Rework code in CJS_Field in light of single Form Fill Environment.
Resolves an old TODO() and allows removal of one accessor.
Change-Id: I64ed6da68ea5f314f02308d43ad7d0dc737a21a6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/96270
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_interactiveform.h b/fpdfsdk/cpdfsdk_interactiveform.h
index 824095b..2510d42 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.h
+++ b/fpdfsdk/cpdfsdk_interactiveform.h
@@ -33,9 +33,6 @@
CPDF_InteractiveForm* GetInteractiveForm() const {
return m_pInteractiveForm.get();
}
- CPDFSDK_FormFillEnvironment* GetFormFillEnv() const {
- return m_pFormFillEnv.Get();
- }
CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
void GetWidgets(const WideString& sFieldName,
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 089a120..d633427 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -88,17 +88,10 @@
// sure none of the widgets have been deleted.
std::vector<ObservedPtr<CPDFSDK_Widget>> widgets;
pForm->GetWidgets(pFormField, &widgets);
-
- // TODO(dsinclair): Determine if all widgets share the same
- // CPDFSDK_InteractiveForm. If that's the case, we can move the code to
- // |GetFormFillEnv| out of the loop.
for (auto& pWidget : widgets) {
- if (pWidget) {
- pWidget->GetInteractiveForm()->GetFormFillEnv()->UpdateAllViews(
- pWidget.Get());
- }
+ if (pWidget)
+ pFormFillEnv->UpdateAllViews(pWidget.Get());
}
-
pFormFillEnv->SetChangeMark();
}
@@ -125,8 +118,7 @@
if (!observed_widget)
return;
}
- CPDFSDK_InteractiveForm* pWidgetForm = pWidget->GetInteractiveForm();
- pWidgetForm->GetFormFillEnv()->UpdateAllViews(pWidget);
+ pFormFillEnv->UpdateAllViews(pWidget);
}
pFormFillEnv->SetChangeMark();
}