Make cpdf_interactiveform.cpp ordering better match header.
Put AddNativeInteractiveFormFont(), IsUpdateAPEnabled() and
SetUpdateAP() in the right order. Also consistently mark static methods
with comments indicating they are static.
Change-Id: Ic606eebb267416fe00d786ae457a3c03963e70de
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/73125
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Hui Yingst <nigi@chromium.org>
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index 2df45fd0..fb04ec3 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -540,6 +540,38 @@
return pNode;
}
+CPDF_InteractiveForm::CPDF_InteractiveForm(CPDF_Document* pDocument)
+ : m_pDocument(pDocument), m_pFieldTree(std::make_unique<CFieldTree>()) {
+ CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
+ if (!pRoot)
+ return;
+
+ m_pFormDict.Reset(pRoot->GetDictFor("AcroForm"));
+ if (!m_pFormDict)
+ return;
+
+ CPDF_Array* pFields = m_pFormDict->GetArrayFor("Fields");
+ if (!pFields)
+ return;
+
+ for (size_t i = 0; i < pFields->size(); ++i)
+ LoadField(pFields->GetDictAt(i), 0);
+}
+
+CPDF_InteractiveForm::~CPDF_InteractiveForm() = default;
+
+bool CPDF_InteractiveForm::s_bUpdateAP = true;
+
+// static
+bool CPDF_InteractiveForm::IsUpdateAPEnabled() {
+ return s_bUpdateAP;
+}
+
+// static
+void CPDF_InteractiveForm::SetUpdateAP(bool bUpdateAP) {
+ s_bUpdateAP = bUpdateAP;
+}
+
// static
RetainPtr<CPDF_Font> CPDF_InteractiveForm::AddNativeInteractiveFormFont(
CPDF_Dictionary*& pFormDict,
@@ -572,36 +604,6 @@
return pFont;
}
-CPDF_InteractiveForm::CPDF_InteractiveForm(CPDF_Document* pDocument)
- : m_pDocument(pDocument), m_pFieldTree(std::make_unique<CFieldTree>()) {
- CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
- if (!pRoot)
- return;
-
- m_pFormDict.Reset(pRoot->GetDictFor("AcroForm"));
- if (!m_pFormDict)
- return;
-
- CPDF_Array* pFields = m_pFormDict->GetArrayFor("Fields");
- if (!pFields)
- return;
-
- for (size_t i = 0; i < pFields->size(); ++i)
- LoadField(pFields->GetDictAt(i), 0);
-}
-
-CPDF_InteractiveForm::~CPDF_InteractiveForm() = default;
-
-bool CPDF_InteractiveForm::s_bUpdateAP = true;
-
-bool CPDF_InteractiveForm::IsUpdateAPEnabled() {
- return s_bUpdateAP;
-}
-
-void CPDF_InteractiveForm::SetUpdateAP(bool bUpdateAP) {
- s_bUpdateAP = bUpdateAP;
-}
-
size_t CPDF_InteractiveForm::CountFields(const WideString& csFieldName) const {
if (csFieldName.IsEmpty())
return m_pFieldTree->m_Root.CountFields();
diff --git a/core/fpdfdoc/cpdf_interactiveform.h b/core/fpdfdoc/cpdf_interactiveform.h
index 3458fb8..c299f52 100644
--- a/core/fpdfdoc/cpdf_interactiveform.h
+++ b/core/fpdfdoc/cpdf_interactiveform.h
@@ -47,8 +47,8 @@
explicit CPDF_InteractiveForm(CPDF_Document* pDocument);
~CPDF_InteractiveForm();
- static void SetUpdateAP(bool bUpdateAP);
static bool IsUpdateAPEnabled();
+ static void SetUpdateAP(bool bUpdateAP);
static RetainPtr<CPDF_Font> AddNativeInteractiveFormFont(
CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,