summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_pageview.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-17 20:32:41 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-17 20:32:41 +0000
commita37989fe53097e4a0b6e87eb6ba01def1e13b675 (patch)
tree9267a150f8d58d96dc7e8448b235eda8561de75d /fpdfsdk/cpdfsdk_pageview.cpp
parent5ae6c564d16ce8b625df3d1950abc822f9ecc987 (diff)
downloadpdfium-a37989fe53097e4a0b6e87eb6ba01def1e13b675.tar.xz
Add FORM_OnLButtonDoubleClick().
The code for this already exists, but is not hooked up to a public API. Hook it up and add a test case. Change-Id: I2ebc8492d8b7347849ff06f664155c6d72ecf76f Reviewed-on: https://pdfium-review.googlesource.com/c/44130 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp48
1 files changed, 34 insertions, 14 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 4d9a905fd6..b0b5f8a68a 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -315,6 +315,40 @@ bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
return true;
}
+bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
+ m_pFormFillEnv->GetAnnotHandlerMgr();
+ CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point));
+ CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot());
+ if (pFocusAnnot && pFocusAnnot != pFXAnnot) {
+ // Last focus Annot gets a chance to handle the event.
+ if (pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFocusAnnot, nFlag, point))
+ return true;
+ }
+ return pFXAnnot &&
+ pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFXAnnot, nFlag, point);
+}
+
+bool CPDFSDK_PageView::OnLButtonDblClk(const CFX_PointF& point,
+ uint32_t nFlag) {
+ CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point));
+ if (!pAnnot) {
+ m_pFormFillEnv->KillFocusAnnot(nFlag);
+ return false;
+ }
+
+ CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
+ m_pFormFillEnv->GetAnnotHandlerMgr();
+ if (!pAnnotHandlerMgr->Annot_OnLButtonDblClk(this, &pAnnot, nFlag, point))
+ return false;
+
+ if (!pAnnot)
+ return false;
+
+ m_pFormFillEnv->SetFocusAnnot(&pAnnot);
+ return true;
+}
+
#ifdef PDF_ENABLE_XFA
bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) {
CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point));
@@ -347,20 +381,6 @@ bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) {
}
#endif // PDF_ENABLE_XFA
-bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
- CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
- m_pFormFillEnv->GetAnnotHandlerMgr();
- CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point));
- CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot());
- if (pFocusAnnot && pFocusAnnot != pFXAnnot) {
- // Last focus Annot gets a chance to handle the event.
- if (pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFocusAnnot, nFlag, point))
- return true;
- }
- return pFXAnnot &&
- pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFXAnnot, nFlag, point);
-}
-
bool CPDFSDK_PageView::OnMouseMove(const CFX_PointF& point, int nFlag) {
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
m_pFormFillEnv->GetAnnotHandlerMgr();