summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-06-06 19:45:14 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-06 19:45:14 +0000
commit9ce75b8b7aa81c335d755a01e4109d4092b48d59 (patch)
tree90342b581e8668dd3b3ada7f02323cd3958b1f0a /fpdfsdk
parent7c2e8a32c34e0a258963daf6483d5af1695a3dba (diff)
downloadpdfium-9ce75b8b7aa81c335d755a01e4109d4092b48d59.tar.xz
Add ability to log click events reaching PDFium
Adds in logging statement to related API methods and a build flag to control enabling the feature. This is meant to be used in conjunction with Chromium. A developer can enable this flag, load a test PDF, and then click on elements to determine appropriate coordinates for an .evt file. BUG=pdfium:1057 Change-Id: I956c39f545297872a61affdb621a412b3c407ff5 Reviewed-on: https://pdfium-review.googlesource.com/34010 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdf_formfill.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 62d2c00d55..de2bf4d35e 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -362,6 +362,10 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,
CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
if (!pPageView)
return false;
+#ifdef PDF_ENABLE_CLICK_LOGGING
+ fprintf(stderr, "mousedown,left,%d,%d\n", static_cast<int>(round(page_x)),
+ static_cast<int>(round(page_y)));
+#endif // PDF_ENABLE_CLICK_LOGGING
return pPageView->OnLButtonDown(CFX_PointF(page_x, page_y), modifier);
}
@@ -373,6 +377,10 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,
CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
if (!pPageView)
return false;
+#ifdef PDF_ENABLE_CLICK_LOGGING
+ fprintf(stderr, "mouseup,left,%d,%d\n", static_cast<int>(round(page_x)),
+ static_cast<int>(round(page_y)));
+#endif // PDF_ENABLE_CLICK_LOGGING
return pPageView->OnLButtonUp(CFX_PointF(page_x, page_y), modifier);
}
@@ -385,6 +393,10 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle,
CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
if (!pPageView)
return false;
+#ifdef PDF_ENABLE_CLICK_LOGGING
+ fprintf(stderr, "mousedown,right,%d,%d\n", static_cast<int>(round(page_x)),
+ static_cast<int>(round(page_y)));
+#endif // PDF_ENABLE_CLICK_LOGGING
return pPageView->OnRButtonDown(CFX_PointF(page_x, page_y), modifier);
}
@@ -396,6 +408,10 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle,
CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page);
if (!pPageView)
return false;
+#ifdef PDF_ENABLE_CLICK_LOGGING
+ fprintf(stderr, "mouseup,right,%d,%d\n", static_cast<int>(round(page_x)),
+ static_cast<int>(round(page_y)));
+#endif // PDF_ENABLE_CLICK_LOGGING
return pPageView->OnRButtonUp(CFX_PointF(page_x, page_y), modifier);
}
#endif // PDF_ENABLE_XFA