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

Unified Diff: fpdfsdk/cpdfsdk_interform.cpp

Issue 2473103003: Revert: Only create widgets if really needed (Closed)
Patch Set: Created 4 years, 1 month 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/cpdfsdk_interform.h ('k') | fpdfsdk/javascript/Field.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_interform.cpp
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 5229f955280e861b23859389525696295f38c48c..f8fd3b3db5689c241b7834a8383c9f7ddf46e4a9 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -82,8 +82,7 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
return static_cast<CPDFSDK_Widget*>(pIterator->GetPrevAnnot(pWidget));
}
-CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl,
- bool createIfNeeded) const {
+CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const {
if (!pControl || !m_pInterForm)
return nullptr;
@@ -93,8 +92,6 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl,
pWidget = it->second;
if (pWidget)
return pWidget;
- if (!createIfNeeded)
- return nullptr;
CPDF_Dictionary* pControlDict = pControl->GetWidget();
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
@@ -134,7 +131,7 @@ void CPDFSDK_InterForm::GetWidgets(
for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormCtrl = pField->GetControl(i);
ASSERT(pFormCtrl);
- CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, true);
+ CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl);
if (pWidget)
widgets->push_back(pWidget);
}
@@ -213,7 +210,7 @@ void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField,
bool bSynchronizeElse) {
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
- if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, false))
+ if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl))
pWidget->Synchronize(bSynchronizeElse);
}
}
@@ -322,7 +319,7 @@ void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField,
for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
ASSERT(pFormCtrl);
- if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, false))
+ if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl))
pWidget->ResetAppearance(sValue, bValueChanged);
}
}
@@ -332,7 +329,7 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) {
CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
ASSERT(pFormCtrl);
- if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl, false)) {
+ if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) {
UnderlyingPageType* pPage = pWidget->GetUnderlyingPage();
CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(pPage, false);
FX_RECT rcBBox = m_pFormFillEnv->GetInteractiveFormFiller()->GetViewBBox(
@@ -399,7 +396,7 @@ bool CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) {
CPDF_FormControl* pControl = pField->GetControl(i);
ASSERT(pControl);
- if (CPDFSDK_Widget* pWidget = GetWidget(pControl, false)) {
+ if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) {
uint32_t nFlags = pWidget->GetFlags();
nFlags &= ~ANNOTFLAG_INVISIBLE;
nFlags &= ~ANNOTFLAG_NOVIEW;
« no previous file with comments | « fpdfsdk/cpdfsdk_interform.h ('k') | fpdfsdk/javascript/Field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698