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

Unified Diff: core/src/fpdftext/fpdf_text_int.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 | « core/src/fpdfapi/fpdf_render/render_int.h ('k') | fpdfsdk/src/fpdf_transformpage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdftext/fpdf_text_int.cpp
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index 8972f84d7c49c5e41f3d6e08c5b801c53c6a93c3..7858fa0bf69e6a9a6932b11c4213e05575e980d0 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -765,7 +765,7 @@ int32_t CPDF_TextPage::FindTextlineFlowDirection() {
return -1;
for (auto& pPageObj : *m_pPage->GetPageObjectList()) {
- if (!pPageObj || pPageObj->m_Type != CPDF_PageObject::TEXT)
+ if (!pPageObj || !pPageObj->IsText())
continue;
int32_t minH =
@@ -846,13 +846,12 @@ void CPDF_TextPage::ProcessObject() {
const CPDF_PageObjectList* pObjList = m_pPage->GetPageObjectList();
for (auto it = pObjList->begin(); it != pObjList->end(); ++it) {
if (CPDF_PageObject* pObj = it->get()) {
- if (pObj->m_Type == CPDF_PageObject::TEXT) {
+ if (pObj->IsText()) {
CFX_Matrix matrix;
- ProcessTextObject(static_cast<CPDF_TextObject*>(pObj), matrix, pObjList,
- it);
- } else if (pObj->m_Type == CPDF_PageObject::FORM) {
+ ProcessTextObject(pObj->AsText(), matrix, pObjList, it);
+ } else if (pObj->IsForm()) {
CFX_Matrix formMatrix(1, 0, 0, 1, 0, 0);
- ProcessFormObject(static_cast<CPDF_FormObject*>(pObj), formMatrix);
+ ProcessFormObject(pObj->AsForm(), formMatrix);
}
}
}
@@ -875,12 +874,10 @@ void CPDF_TextPage::ProcessFormObject(CPDF_FormObject* pFormObj,
for (auto it = pObjectList->begin(); it != pObjectList->end(); ++it) {
if (CPDF_PageObject* pPageObj = it->get()) {
- if (pPageObj->m_Type == CPDF_PageObject::TEXT) {
- ProcessTextObject(static_cast<CPDF_TextObject*>(pPageObj),
- curFormMatrix, pObjectList, it);
- } else if (pPageObj->m_Type == CPDF_PageObject::FORM) {
- ProcessFormObject(static_cast<CPDF_FormObject*>(pPageObj),
- curFormMatrix);
+ if (pPageObj->IsText()) {
+ ProcessTextObject(pPageObj->AsText(), curFormMatrix, pObjectList, it);
+ } else if (pPageObj->IsForm()) {
+ ProcessFormObject(pPageObj->AsForm(), curFormMatrix);
}
}
}
@@ -1825,9 +1822,9 @@ FX_BOOL CPDF_TextPage::IsSameAsPreTextObject(
while (i < 5 && iter != pObjList->begin()) {
--iter;
CPDF_PageObject* pOtherObj = iter->get();
- if (pOtherObj == pTextObj || pOtherObj->m_Type != CPDF_PageObject::TEXT)
+ if (pOtherObj == pTextObj || !pOtherObj->IsText())
continue;
- if (IsSameTextObject(static_cast<CPDF_TextObject*>(pOtherObj), pTextObj))
+ if (IsSameTextObject(pOtherObj->AsText(), pTextObj))
return TRUE;
++i;
}
« no previous file with comments | « core/src/fpdfapi/fpdf_render/render_int.h ('k') | fpdfsdk/src/fpdf_transformpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698