diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-04 15:35:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-04 15:35:12 -0700 |
commit | c5267c54ea32ade03bf10e6bb203e34e3fcbd77d (patch) | |
tree | e9cdfed6f7af12ce42cf3daefcbee7d26fc05422 /fpdfsdk/cpdfsdk_interform.cpp | |
parent | ec64cee9acccd0d1e574bbbd8aa91b08c1cf254f (diff) | |
download | pdfium-c5267c54ea32ade03bf10e6bb203e34e3fcbd77d.tar.xz |
Revert: Only create widgets if really needed
This CL reverts ef523dd36aea991084b8b934df846014a5c09c6f which causes issues
with syncing of form fields over pages.
The initial bug had follow on fixes which seem to have rendered this fix
un-needed.
BUG=chromium:632709, chromium:661294
Review-Url: https://codereview.chromium.org/2473103003
Diffstat (limited to 'fpdfsdk/cpdfsdk_interform.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_interform.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 5229f95528..f8fd3b3db5 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; |