summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-16 17:15:32 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-16 17:15:32 -0800
commit32c70815316672091946be88e5941089c359d151 (patch)
tree5c09a48725bb43b07d09a435f38ead6a933e1712 /fpdfsdk/src/javascript
parent4e44b4049bd4790bcb6c835455632c81c34e78b6 (diff)
downloadpdfium-32c70815316672091946be88e5941089c359d151.tar.xz
Split CPDF_PageObjectHolder off from CPDF_PageObjectList
Eventually, we're going to expose an iterator over CPDF_PageObjectList that we don't want to be inherited by the CPDF_PageObjectHolder sub-classes: page and form. Also, the operations that the object holder performs dealing with inquiring about masks and such seem beyond the scope of what a list would provide. Hence the "Holder" name. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1701073002 .
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/Document.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 0bd754af76..e869e72310 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1380,14 +1380,12 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
page.Load(pDocument, pPageDict);
page.ParseContent(nullptr);
- FX_POSITION pos = page.GetFirstObjectPosition();
-
int nWords = 0;
-
CFX_WideString swRet;
-
+ FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition();
while (pos) {
- if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) {
+ if (CPDF_PageObject* pPageObj =
+ page.GetPageObjectList()->GetNextObject(pos)) {
if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
int nObjWords = CountWords((CPDF_TextObject*)pPageObj);
@@ -1444,9 +1442,10 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
page.ParseContent(nullptr);
int nWords = 0;
- FX_POSITION pos = page.GetFirstObjectPosition();
+ FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition();
while (pos) {
- if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) {
+ if (CPDF_PageObject* pPageObj =
+ page.GetPageObjectList()->GetNextObject(pos)) {
if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
CPDF_TextObject* pTextObj = (CPDF_TextObject*)pPageObj;
nWords += CountWords(pTextObj);