summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-01 07:11:15 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-01 07:11:15 -0700
commit22b64c361bf4630cdfe2b783d5b1e582f4842711 (patch)
treef2791406df5b4cc0225ab44508d9eb6dfef585ff /core/fpdftext
parent380f53ec1d0a46648473e407934c9adede6cc1bd (diff)
downloadpdfium-22b64c361bf4630cdfe2b783d5b1e582f4842711.tar.xz
Make CPDF_ContentMark have a CPDF_ContentMarkData.
This one doesn't require an explict Emplace(), as the object seems to get constructed only as a side-effect of making a private copy. Review-Url: https://codereview.chromium.org/2298953002
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 909e029262..7512453093 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -805,11 +805,10 @@ void CPDF_TextPage::ProcessTextObject(
FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
CPDF_TextObject* pTextObj = Obj.m_pTextObj;
- const CPDF_ContentMarkData* pMarkData = pTextObj->m_ContentMark.GetObject();
- if (!pMarkData)
+ if (!pTextObj->m_ContentMark)
return FPDFText_MarkedContent::Pass;
- int nContentMark = pMarkData->CountItems();
+ int nContentMark = pTextObj->m_ContentMark.CountItems();
if (nContentMark < 1)
return FPDFText_MarkedContent::Pass;
@@ -818,7 +817,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
CPDF_Dictionary* pDict = nullptr;
int n = 0;
for (n = 0; n < nContentMark; n++) {
- const CPDF_ContentMarkItem& item = pMarkData->GetItem(n);
+ const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
if (item.GetParamType() == CPDF_ContentMarkItem::ParamType::None)
continue;
pDict = item.GetParam();
@@ -832,14 +831,12 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
if (!bExist)
return FPDFText_MarkedContent::Pass;
- if (m_pPreTextObj) {
- const CPDF_ContentMarkData* pPreMarkData =
- m_pPreTextObj->m_ContentMark.GetObject();
- if (pPreMarkData && pPreMarkData->CountItems() == n &&
- pDict == pPreMarkData->GetItem(n - 1).GetParam()) {
- return FPDFText_MarkedContent::Done;
- }
+ if (m_pPreTextObj && m_pPreTextObj->m_ContentMark &&
+ m_pPreTextObj->m_ContentMark.CountItems() == n &&
+ pDict == m_pPreTextObj->m_ContentMark.GetItem(n - 1).GetParam()) {
+ return FPDFText_MarkedContent::Done;
}
+
FX_STRSIZE nItems = actText.GetLength();
if (nItems < 1)
return FPDFText_MarkedContent::Pass;
@@ -872,17 +869,17 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
CPDF_TextObject* pTextObj = Obj.m_pTextObj;
- const CPDF_ContentMarkData* pMarkData = pTextObj->m_ContentMark.GetObject();
- if (!pMarkData)
+ if (!pTextObj->m_ContentMark)
return;
- int nContentMark = pMarkData->CountItems();
+ int nContentMark = pTextObj->m_ContentMark.CountItems();
if (nContentMark < 1)
return;
+
CFX_WideString actText;
CPDF_Dictionary* pDict = nullptr;
for (int n = 0; n < nContentMark; n++) {
- const CPDF_ContentMarkItem& item = pMarkData->GetItem(n);
+ const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
if (item.GetParamType() == CPDF_ContentMarkItem::ParamType::None)
continue;
pDict = item.GetParam();