summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfformfill.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-14 19:02:30 -0700
committerLei Zhang <thestig@chromium.org>2015-08-14 19:02:30 -0700
commit24fbf134d43a7ec4226de3db601f0a617bbe428b (patch)
treeb4313e784666623df89c635a3f9841a7cc7e817a /fpdfsdk/src/fpdfformfill.cpp
parentcb62e7657b3a9a04142028a4e6614029a08e894b (diff)
downloadpdfium-24fbf134d43a7ec4226de3db601f0a617bbe428b.tar.xz
Add new public APIs to find the z-order for links and widgets.chromium/2485chromium/2484
- Implement FPDFLink_GetLinkZOrderAtPoint(). - Implement FPDFPage_FormFieldZOrderAtPoint(). - Mark FPDPage_HasFormFieldAtPoint() as deprecated. - Modify CPDF_LinkList and CPDF_InterForm to support new APIs. - Clean up dead code in CPDF_LinkList and CPDF_InterForm. BUG=chromium:515837 R=jun_fang@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/1278053004 .
Diffstat (limited to 'fpdfsdk/src/fpdfformfill.cpp')
-rw-r--r--fpdfsdk/src/fpdfformfill.cpp39
1 files changed, 30 insertions, 9 deletions
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index 170ae15799..272e781cc2 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -34,18 +34,17 @@ CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
} // namespace
-DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
- FPDF_PAGE page,
- double page_x,
- double page_y) {
+DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ double page_x,
+ double page_y) {
if (!page || !hHandle)
return -1;
- CPDF_Page* pPage = (CPDF_Page*)page;
- nonstd::unique_ptr<CPDF_InterForm> pInterForm(
- new CPDF_InterForm(pPage->m_pDocument, FALSE));
- CPDF_FormControl* pFormCtrl =
- pInterForm->GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y);
+ CPDF_Page* pPage = (CPDF_Page*)page;
+ CPDF_InterForm interform(pPage->m_pDocument, FALSE);
+ CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint(
+ pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr);
if (!pFormCtrl)
return -1;
@@ -56,6 +55,28 @@ DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
return pFormField->GetFieldType();
}
+DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ double page_x,
+ double page_y) {
+ return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y);
+}
+
+DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle,
+ FPDF_PAGE page,
+ double page_x,
+ double page_y) {
+ if (!page || !hHandle)
+ return -1;
+
+ CPDF_Page* pPage = (CPDF_Page*)page;
+ CPDF_InterForm interform(pPage->m_pDocument, FALSE);
+ int z_order = -1;
+ (void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y,
+ &z_order);
+ return z_order;
+}
+
DLLEXPORT FPDF_FORMHANDLE STDCALL
FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
FPDF_FORMFILLINFO* formInfo) {