summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-08-28 18:09:38 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-31 15:35:08 +0000
commitaf59cf16b40b6243a2194ced3e5f476ec655edb3 (patch)
treeb88fac856dd70edb25d21e14b61b434f5e17cefa
parentd120920fe18bcfa3c102ecd0c7502c00d5f0425a (diff)
downloadpdfium-af59cf16b40b6243a2194ced3e5f476ec655edb3.tar.xz
Change CPDF_Form::ParseContent() to ParseContentWithParams().
Add a new ParseContent() method as a convenience to call ParseContentWithParams() with the default parameters. Change-Id: I274682845a72e125c3fc6299289edb760104ac4d Reviewed-on: https://pdfium-review.googlesource.com/12250 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_type3font.cpp3
-rw-r--r--core/fpdfapi/page/cpdf_form.cpp12
-rw-r--r--core/fpdfapi/page/cpdf_form.h11
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp3
-rw-r--r--core/fpdfapi/page/cpdf_tilingpattern.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp2
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp2
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp2
-rw-r--r--fpdfsdk/fpdfannot.cpp2
10 files changed, 25 insertions, 18 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index c7a98c9493..1dd6d25e2a 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -298,7 +298,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessEmptyForm) {
// Create an empty form.
auto pTestForm =
pdfium::MakeUnique<CPDF_Form>(pDoc.get(), nullptr, pStream.get());
- pTestForm->ParseContent(nullptr, nullptr, nullptr);
+ pTestForm->ParseContent();
ASSERT_TRUE(pTestForm->IsParsed());
// The generated stream for the empty form should be an empty string.
@@ -324,7 +324,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessFormWithPath) {
// Create a form with a non-empty stream.
auto pTestForm =
pdfium::MakeUnique<CPDF_Form>(pDoc.get(), nullptr, pStream.get());
- pTestForm->ParseContent(nullptr, nullptr, nullptr);
+ pTestForm->ParseContent();
ASSERT_TRUE(pTestForm->IsParsed());
CPDF_PageContentGenerator generator(pTestForm.get());
diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp
index e13deaa56b..2af1dac44f 100644
--- a/core/fpdfapi/font/cpdf_type3font.cpp
+++ b/core/fpdfapi/font/cpdf_type3font.cpp
@@ -114,7 +114,8 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) {
// can change as a result. Thus after it returns, check the cache again for
// a cache hit.
m_CharLoadingDepth++;
- pNewChar->m_pForm->ParseContent(nullptr, nullptr, pNewChar.get());
+ pNewChar->m_pForm->ParseContentWithParams(nullptr, nullptr, pNewChar.get(),
+ 0);
m_CharLoadingDepth--;
it = m_CacheMap.find(charcode);
if (it != m_CacheMap.end())
diff --git a/core/fpdfapi/page/cpdf_form.cpp b/core/fpdfapi/page/cpdf_form.cpp
index c2170ac4e7..c5d9cbffcf 100644
--- a/core/fpdfapi/page/cpdf_form.cpp
+++ b/core/fpdfapi/page/cpdf_form.cpp
@@ -44,10 +44,14 @@ void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates,
m_ParseState = CONTENT_PARSING;
}
-void CPDF_Form::ParseContent(CPDF_AllStates* pGraphicStates,
- const CFX_Matrix* pParentMatrix,
- CPDF_Type3Char* pType3Char,
- int level) {
+void CPDF_Form::ParseContent() {
+ ParseContentWithParams(nullptr, nullptr, nullptr, 0);
+}
+
+void CPDF_Form::ParseContentWithParams(CPDF_AllStates* pGraphicStates,
+ const CFX_Matrix* pParentMatrix,
+ CPDF_Type3Char* pType3Char,
+ int level) {
StartParse(pGraphicStates, pParentMatrix, pType3Char, level);
ContinueParse(nullptr);
}
diff --git a/core/fpdfapi/page/cpdf_form.h b/core/fpdfapi/page/cpdf_form.h
index 910f38fd08..2cce800f23 100644
--- a/core/fpdfapi/page/cpdf_form.h
+++ b/core/fpdfapi/page/cpdf_form.h
@@ -24,16 +24,17 @@ class CPDF_Form : public CPDF_PageObjectHolder {
CPDF_Dictionary* pParentResources = nullptr);
~CPDF_Form() override;
- void ParseContent(CPDF_AllStates* pGraphicStates,
- const CFX_Matrix* pParentMatrix,
- CPDF_Type3Char* pType3Char,
- int level = 0);
+ void ParseContent();
+ void ParseContentWithParams(CPDF_AllStates* pGraphicStates,
+ const CFX_Matrix* pParentMatrix,
+ CPDF_Type3Char* pType3Char,
+ int level);
private:
void StartParse(CPDF_AllStates* pGraphicStates,
const CFX_Matrix* pParentMatrix,
CPDF_Type3Char* pType3Char,
- int level = 0);
+ int level);
};
#endif // CORE_FPDFAPI_PAGE_CPDF_FORM_H_
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index a6af91d9ff..7bd6b50123 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -775,7 +775,8 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
status.m_GraphState = m_pCurStates->m_GraphState;
status.m_ColorState = m_pCurStates->m_ColorState;
status.m_TextState = m_pCurStates->m_TextState;
- pFormObj->m_pForm->ParseContent(&status, nullptr, nullptr, m_Level + 1);
+ pFormObj->m_pForm->ParseContentWithParams(&status, nullptr, nullptr,
+ m_Level + 1);
if (!m_pObjectHolder->BackgroundAlphaNeeded() &&
pFormObj->m_pForm->BackgroundAlphaNeeded()) {
m_pObjectHolder->SetBackgroundAlphaNeeded(true);
diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp
index 65542a27b5..a5252578a5 100644
--- a/core/fpdfapi/page/cpdf_tilingpattern.cpp
+++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp
@@ -49,7 +49,7 @@ bool CPDF_TilingPattern::Load() {
const CFX_Matrix& matrix = parent_matrix();
m_pForm = pdfium::MakeUnique<CPDF_Form>(document(), nullptr, pStream);
- m_pForm->ParseContent(nullptr, &matrix, nullptr);
+ m_pForm->ParseContentWithParams(nullptr, &matrix, nullptr, 0);
m_BBox = pDict->GetRectFor("BBox");
return true;
}
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 380914fd27..316717c120 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -2545,7 +2545,7 @@ CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
CPDF_Form form(m_pContext->GetDocument(), m_pContext->GetPageResources(),
pGroup);
- form.ParseContent(nullptr, nullptr, nullptr);
+ form.ParseContent();
CFX_DefaultRenderDevice bitmap_device;
bool bLuminosity = pSMaskDict->GetStringFor("S") != "Alpha";
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 89fd1c9740..ea15436565 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -207,7 +207,7 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) {
auto pNewForm = pdfium::MakeUnique<CPDF_Form>(
m_pDocument.Get(), pPage->m_pResources.Get(), pStream);
- pNewForm->ParseContent(nullptr, nullptr, nullptr);
+ pNewForm->ParseContent();
CPDF_Form* pResult = pNewForm.get();
m_APMap[pStream] = std::move(pNewForm);
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 322abc0eb1..555d19660f 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -182,7 +182,7 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
matrix.Concat(*pMatrix);
CPDF_Form form(m_pField->GetForm()->m_pDocument.Get(),
m_pField->GetForm()->m_pFormDict->GetDictFor("DR"), pStream);
- form.ParseContent(nullptr, nullptr, nullptr);
+ form.ParseContent();
CPDF_RenderContext context(pPage);
context.AppendLayer(&form, &matrix);
context.Render(pDevice, pOptions, nullptr);
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp
index 8c62ecf311..d6080fd35f 100644
--- a/fpdfsdk/fpdfannot.cpp
+++ b/fpdfsdk/fpdfannot.cpp
@@ -151,7 +151,7 @@ class CPDF_AnnotContext {
m_pAnnotForm = pdfium::MakeUnique<CPDF_Form>(
m_pPage->m_pDocument.Get(), m_pPage->m_pResources.Get(), pStream);
- m_pAnnotForm->ParseContent(nullptr, nullptr, nullptr);
+ m_pAnnotForm->ParseContent();
}
CPDF_Form* GetForm() const { return m_pAnnotForm.get(); }