Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Unified Diff: fpdfsdk/src/javascript/Document.cpp

Issue 1709393002: Remove PageObject's m_Type and add As<Type> functions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdfeditpage.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/Document.cpp
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 733384a154bc3605db2e239336da362e2c73606f..c49524d02ff4936316860012317a7ae2ad9f7f06 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1383,8 +1383,8 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
int nWords = 0;
CFX_WideString swRet;
for (auto& pPageObj : *page.GetPageObjectList()) {
- if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
- CPDF_TextObject* pTextObj = static_cast<CPDF_TextObject*>(pPageObj.get());
+ if (pPageObj->IsText()) {
+ CPDF_TextObject* pTextObj = pPageObj->AsText();
int nObjWords = CountWords(pTextObj);
if (nWords + nObjWords >= nWordNo) {
swRet = GetObjWordStr(pTextObj, nWordNo - nWords);
@@ -1438,8 +1438,8 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
int nWords = 0;
for (auto& pPageObj : *page.GetPageObjectList()) {
- if (pPageObj->m_Type == CPDF_PageObject::TEXT)
- nWords += CountWords(static_cast<CPDF_TextObject*>(pPageObj.get()));
+ if (pPageObj->IsText())
+ nWords += CountWords(pPageObj->AsText());
}
vRet = nWords;
« no previous file with comments | « fpdfsdk/src/fpdfeditpage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698