summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfdoc.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-15 16:34:32 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-15 16:34:32 -0700
commit943ea142b6a7e6edc91fe3c307013129e6eb0ef3 (patch)
tree8de4aaa7bb8eb3d463246d2a2f400006e60bae99 /fpdfsdk/src/fpdfdoc.cpp
parentb456ba7f62fa416f456ef78750c18fd2bdf837be (diff)
downloadpdfium-943ea142b6a7e6edc91fe3c307013129e6eb0ef3.tar.xz
Introduce CPDFPageFromFPFDPage()
Abstracts the way that pages are passed to the embedder between XFA and master. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1406543004 .
Diffstat (limited to 'fpdfsdk/src/fpdfdoc.cpp')
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index 05b151e0a7..b770295604 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -201,7 +201,10 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
DLLEXPORT FPDF_LINK STDCALL
FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y) {
- CPDF_Page* pPage = (CPDF_Page*)page;
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ if (!pPage)
+ return nullptr;
+
CPDF_LinkList* pLinkList = GetLinkList(pPage);
if (!pLinkList)
return nullptr;
@@ -212,7 +215,10 @@ FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y) {
DLLEXPORT int STDCALL
FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y) {
- CPDF_Page* pPage = (CPDF_Page*)page;
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ if (!pPage)
+ return -1;
+
CPDF_LinkList* pLinkList = GetLinkList(pPage);
if (!pLinkList)
return -1;
@@ -251,10 +257,10 @@ DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) {
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
int* startPos,
FPDF_LINK* linkAnnot) {
- if (!page || !startPos || !linkAnnot)
+ if (!startPos || !linkAnnot)
return FALSE;
- CPDF_Page* pPage = (CPDF_Page*)page;
- if (!pPage->m_pFormDict)
+ CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+ if (!pPage || !pPage->m_pFormDict)
return FALSE;
CPDF_Array* pAnnots = pPage->m_pFormDict->GetArray("Annots");
if (!pAnnots)