Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: fpdfsdk/src/fpdfformfill.cpp

Issue 1295893005: Merge to XFA: Add new public APIs to find the z-order for links and widgets. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: self review Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfview_c_api_test.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfformfill.cpp
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index abb8026a7f3c16dd2129335b92bf3198b6259c75..51d90b7eabd4652328fde7c2eb0e3b09a29725ad 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -37,32 +37,26 @@ 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 = ((CPDFXFA_Page*)page)->GetPDFPage();
if (pPage) {
- CPDF_InterForm* pInterForm = NULL;
- pInterForm = new CPDF_InterForm(pPage->m_pDocument, FALSE);
- if (!pInterForm)
+ 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;
- CPDF_FormControl* pFormCtrl = pInterForm->GetControlAtPoint(
- pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y);
- if (!pFormCtrl) {
- delete pInterForm;
- return -1;
- }
+
CPDF_FormField* pFormField = pFormCtrl->GetField();
- if (!pFormField) {
- delete pInterForm;
+ if (!pFormField)
return -1;
- }
int nType = pFormField->GetFieldType();
- delete pInterForm;
return nType;
}
@@ -109,6 +103,28 @@ DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
return -1;
}
+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) {
« no previous file with comments | « fpdfsdk/src/fpdfdoc.cpp ('k') | fpdfsdk/src/fpdfview_c_api_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698