Remove CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus().
Remove this method, CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(), and
CPDFXFA_WidgetHandler::OnXFAChangedFocus(). Instead, move the code to
CPDFXFA_Widget::OnChangedFocus(), simplify it, and call that directly.
Change-Id: I456c152565c1ce9285c75f3fa9fe5d3029f4b60d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/92210
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 5f6aec8..9bae35c 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -29,6 +29,10 @@
#include "third_party/base/check.h"
#include "third_party/base/numerics/safe_conversions.h"
+#ifdef PDF_ENABLE_XFA
+#include "fpdfsdk/fpdfxfa/cpdfxfa_widget.h"
+#endif
+
static_assert(FXCT_ARROW ==
static_cast<int>(IPWL_SystemHandler::CursorStyle::kArrow),
"kArrow value mismatch");
@@ -758,19 +762,20 @@
if (!pAnnot->GetPageView()->IsValid())
return false;
- CPDFSDK_AnnotHandlerMgr* pAnnotHandler = GetAnnotHandlerMgr();
if (m_pFocusAnnot)
return false;
#ifdef PDF_ENABLE_XFA
- if (!pAnnotHandler->Annot_OnChangeFocus(pAnnot))
+ CPDFXFA_Widget* pXFAWidget = ToXFAWidget(pAnnot.Get());
+ if (pXFAWidget && pXFAWidget->OnChangedFocus())
return false;
- // |pAnnot| may be destroyed in |Annot_OnChangeFocus|.
+ // `pAnnot` may be destroyed in `OnChangedFocus()`.
if (!pAnnot)
return false;
#endif // PDF_ENABLE_XFA
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandler = GetAnnotHandlerMgr();
if (!pAnnotHandler->Annot_OnSetFocus(pAnnot, {}))
return false;
if (m_pFocusAnnot)