summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-04-10 17:22:15 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-10 17:22:15 +0000
commit537115b5a3ceccfe8ce2ca79577b61c5ec31c432 (patch)
tree12fd15fc6b6966f2c9bd297a125ff0d6896f83e3 /fpdfsdk/cpdfsdk_xfawidgethandler.cpp
parentd27f392c79ce53390f9de36778bb20f73f3e9324 (diff)
downloadpdfium-537115b5a3ceccfe8ce2ca79577b61c5ec31c432.tar.xz
Implement CPDFSDK_XFAWidgetHandler::OnKillFocus.
This makes XFA widgets lose focus when a click is performed outside their area. Bug: chromium:820256 Change-Id: I7b70fafdc625089f3340a3494bfd51e5c8d0446d Reviewed-on: https://pdfium-review.googlesource.com/29860 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_xfawidgethandler.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 7eb56570c3..e39f8ceda2 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -302,6 +302,15 @@ bool CPDFSDK_XFAWidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
bool CPDFSDK_XFAWidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) {
+ CXFA_FFWidget* hWidget = *pAnnot ? (*pAnnot)->GetXFAWidget() : nullptr;
+ if (!hWidget)
+ return true;
+
+ CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
+ if (!pXFAPageView)
+ return true;
+
+ pXFAPageView->GetDocView()->SetFocus(nullptr);
return true;
}