summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_fftextedit.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-04-10 16:10:36 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-10 16:10:36 +0000
commitd27f392c79ce53390f9de36778bb20f73f3e9324 (patch)
tree0e1b34a82134a0e170146e573414cf0461683047 /xfa/fxfa/cxfa_fftextedit.cpp
parent4027887ee29a7f4920b03041068bff9bde239782 (diff)
downloadpdfium-d27f392c79ce53390f9de36778bb20f73f3e9324.tar.xz
Break down CXFA_FFWidget::On{L|R}ButtonDown() into two steps.
The first step, AcceptsFocusOnButtonDown(), returns whether the widget wants focus on a mouse click. The second step, On{L|R}ButtonDown(), handles the click after focus has been assigned. Bug: chromium:820256 Change-Id: I9da1f1a930f198fc17b24acb7f1e3e6ef7f12ae4 Reviewed-on: https://pdfium-review.googlesource.com/29951 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_fftextedit.cpp')
-rw-r--r--xfa/fxfa/cxfa_fftextedit.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp
index 9861b5253c..fd2cfb76cc 100644
--- a/xfa/fxfa/cxfa_fftextedit.cpp
+++ b/xfa/fxfa/cxfa_fftextedit.cpp
@@ -107,9 +107,18 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() {
m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
}
-bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
+bool CXFA_FFTextEdit::AcceptsFocusOnButtonDown(uint32_t dwFlags,
+ const CFX_PointF& point,
+ FWL_MouseCommand command) {
+ if (command == FWL_MouseCommand::RightButtonDown && !m_pNode->IsOpenAccess())
+ return false;
if (!PtInActiveRect(point))
return false;
+
+ return true;
+}
+
+void CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
if (!IsFocused()) {
m_dwStatus |= XFA_WidgetStatus_Focused;
UpdateFWLData();
@@ -122,14 +131,9 @@ bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
ms.m_dwFlags = dwFlags;
ms.m_pos = FWLToClient(point);
TranslateFWLMessage(&ms);
- return true;
}
-bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
- if (!m_pNode->IsOpenAccess())
- return false;
- if (!PtInActiveRect(point))
- return false;
+void CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
if (!IsFocused()) {
m_dwStatus |= XFA_WidgetStatus_Focused;
UpdateFWLData();
@@ -142,7 +146,6 @@ bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) {
ms.m_dwFlags = dwFlags;
ms.m_pos = FWLToClient(point);
TranslateFWLMessage(&ms);
- return true;
}
bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) {