Index: fpdfsdk/src/fpdfformfill.cpp |
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp |
index e86a47be5551c91992bc1039fb19bdec5dfb30cc..ffe85b8752976cd3ac0ccc3644f3b9ec69de28a8 100644 |
--- a/fpdfsdk/src/fpdfformfill.cpp |
+++ b/fpdfsdk/src/fpdfformfill.cpp |
@@ -42,10 +42,9 @@ DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
FPDF_PAGE page, |
double page_x, |
double page_y) { |
- if (!page || !hHandle) |
+ if (!hHandle) |
return -1; |
- |
- CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); |
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
if (pPage) { |
CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( |
@@ -115,10 +114,11 @@ DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, |
FPDF_PAGE page, |
double page_x, |
double page_y) { |
- if (!page || !hHandle) |
+ if (!hHandle) |
+ return -1; |
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
+ if (!pPage) |
return -1; |
- |
- CPDF_Page* pPage = (CPDF_Page*)page; |
Tom Sepez
2015/10/16 00:18:55
And this would be a bug in xfa.
Lei Zhang
2015/10/16 01:23:55
I wonder why wrote that code... Hmmmm!
|
CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
int z_order = -1; |
(void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, |
@@ -266,15 +266,15 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, |
int size_y, |
int rotate, |
int flags) { |
- if (!hHandle || !page) |
+ if (!hHandle) |
return; |
- CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; |
- CPDFXFA_Document* pDocument = pPage->GetDocument(); |
- if (!pDocument) |
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
Tom Sepez
2015/10/16 00:18:55
wrong, fix it.
|
+ if (!pPage) |
return; |
- CPDF_Document* pPDFDoc = pDocument->GetPDFDoc(); |
- if (!pPDFDoc) |
+ |
+ CPDFXFA_Document* pDocument = ((CPDFXFA_Page*)pPage)->GetDocument(); |
Lei Zhang
2015/10/16 01:23:55
No more C-style casts.
|
+ if (!pDocument) |
return; |
CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; |
@@ -601,7 +601,7 @@ DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, |
DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, |
FPDF_FORMHANDLE hHandle) { |
- if (!hHandle || !page) |
+ if (!hHandle) |
Tom Sepez
2015/10/16 00:18:55
wrong, fix.
Lei Zhang
2015/10/16 01:23:55
We are ok with a NULL |page| ?
Tom Sepez
2015/10/16 16:58:54
No, fixed.
|
return; |
CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); |
@@ -654,10 +654,12 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, |
DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, |
FPDF_FORMHANDLE hHandle, |
int aaType) { |
- if (!hHandle || !page) |
+ if (!hHandle) |
return; |
CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); |
CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; |
+ if (!pPage) |
+ return; |
CPDFSDK_PageView* pPageView = pSDKDoc->GetPageView(pPage, FALSE); |
if (pPageView) { |
CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); |