summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn1
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp20
-rw-r--r--core/fpdfapi/page/cpdf_page.h39
-rw-r--r--core/fpdfapi/page/ipdf_page.h52
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_annot.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_annot.h2
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp29
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.h12
-rw-r--r--fpdfsdk/cpdfsdk_helpers.cpp12
-rw-r--r--fpdfsdk/cpdfsdk_helpers.h15
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp45
-rw-r--r--fpdfsdk/cpdfsdk_pageview.h10
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp6
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp2
-rw-r--r--fpdfsdk/fpdf_editpage.cpp4
-rw-r--r--fpdfsdk/fpdf_formfill.cpp15
-rw-r--r--fpdfsdk/fpdf_view.cpp18
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp12
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.h31
-rw-r--r--fxjs/cjs_document.cpp2
-rw-r--r--fxjs/cjs_field.cpp3
24 files changed, 135 insertions, 205 deletions
diff --git a/BUILD.gn b/BUILD.gn
index a7af222d16..e546543080 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -589,7 +589,6 @@ jumbo_static_library("fpdfapi") {
"core/fpdfapi/page/cpdf_textstate.h",
"core/fpdfapi/page/cpdf_tilingpattern.cpp",
"core/fpdfapi/page/cpdf_tilingpattern.h",
- "core/fpdfapi/page/ipdf_page.h",
"core/fpdfapi/parser/cfdf_document.cpp",
"core/fpdfapi/parser/cfdf_document.h",
"core/fpdfapi/parser/cpdf_array.cpp",
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 918c55ef5e..c5c85635b2 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -74,26 +74,6 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
CPDF_Page::~CPDF_Page() {}
-CPDF_Page* CPDF_Page::AsPDFPage() {
- return this;
-}
-
-CPDFXFA_Page* CPDF_Page::AsXFAPage() {
- return nullptr;
-}
-
-CPDF_Document* CPDF_Page::GetDocument() const {
- return GetPDFDocument();
-}
-
-float CPDF_Page::GetPageWidth() const {
- return m_PageSize.width;
-}
-
-float CPDF_Page::GetPageHeight() const {
- return m_PageSize.height;
-}
-
bool CPDF_Page::IsPage() const {
return true;
}
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index f1d6f2124f..b94326e47b 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -10,7 +10,6 @@
#include <memory>
#include "core/fpdfapi/page/cpdf_pageobjectholder.h"
-#include "core/fpdfapi/page/ipdf_page.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/observable.h"
@@ -21,50 +20,41 @@
class CPDF_Dictionary;
class CPDF_Document;
class CPDF_Object;
-class CPDF_Page;
class CPDF_PageRenderCache;
class CPDF_PageRenderContext;
-// Small layering violation, incomplete type and always null if non-XFA.
-class CPDFXFA_Page;
-
-class CPDF_Page : public IPDF_Page,
+class CPDF_Page : public Retainable,
public Observable<CPDF_Page>,
public CPDF_PageObjectHolder {
public:
class View {}; // Caller implements as desired, empty here due to layering.
+ class Extension : public Retainable {}; // XFA page parent class, layering.
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- // IPDF_Page:
- CPDF_Page* AsPDFPage() override;
- CPDFXFA_Page* AsXFAPage() override;
- CPDF_Document* GetDocument() const override;
- float GetPageWidth() const override;
- float GetPageHeight() const override;
- CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const override;
- Optional<CFX_PointF> DeviceToPage(
- const FX_RECT& rect,
- int rotate,
- const CFX_PointF& device_point) const override;
- Optional<CFX_PointF> PageToDevice(
- const FX_RECT& rect,
- int rotate,
- const CFX_PointF& page_point) const override;
-
// CPDF_PageObjectHolder:
bool IsPage() const override;
void ParseContent();
+ Optional<CFX_PointF> DeviceToPage(const FX_RECT& rect,
+ int rotate,
+ const CFX_PointF& device_point) const;
+ Optional<CFX_PointF> PageToDevice(const FX_RECT& rect,
+ int rotate,
+ const CFX_PointF& page_point) const;
+ CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const;
+ float GetPageWidth() const { return m_PageSize.width; }
+ float GetPageHeight() const { return m_PageSize.height; }
const CFX_SizeF& GetPageSize() const { return m_PageSize; }
+
const CFX_FloatRect& GetPageBBox() const { return m_BBox; }
int GetPageRotation() const;
-
CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender.get(); }
+
CPDF_PageRenderContext* GetRenderContext() const {
return m_pRenderContext.get();
}
@@ -73,6 +63,8 @@ class CPDF_Page : public IPDF_Page,
CPDF_Document* GetPDFDocument() const { return m_pPDFDocument.Get(); }
View* GetView() const { return m_pView.Get(); }
void SetView(View* pView) { m_pView = pView; }
+ Extension* GetPageExtension() const { return m_pPageExtension.Get(); }
+ void SetPageExtension(Extension* pExt) { m_pPageExtension = pExt; }
private:
CPDF_Page(CPDF_Document* pDocument,
@@ -88,6 +80,7 @@ class CPDF_Page : public IPDF_Page,
CFX_SizeF m_PageSize;
CFX_Matrix m_PageMatrix;
UnownedPtr<CPDF_Document> m_pPDFDocument;
+ UnownedPtr<Extension> m_pPageExtension;
std::unique_ptr<CPDF_PageRenderCache> m_pPageRender;
std::unique_ptr<CPDF_PageRenderContext> m_pRenderContext;
UnownedPtr<View> m_pView;
diff --git a/core/fpdfapi/page/ipdf_page.h b/core/fpdfapi/page/ipdf_page.h
deleted file mode 100644
index 929cba7583..0000000000
--- a/core/fpdfapi/page/ipdf_page.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2018 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_FPDFAPI_PAGE_IPDF_PAGE_H_
-#define CORE_FPDFAPI_PAGE_IPDF_PAGE_H_
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/retain_ptr.h"
-#include "third_party/base/optional.h"
-
-class CPDF_Document;
-class CPDF_Page;
-
-// Small layering violation, incomplete type and always null if non-XFA.
-class CPDFXFA_Page;
-
-// Interface implented by both page types (CPDF_Page and CPDFXFA_Page).
-class IPDF_Page : public Retainable {
- public:
- virtual CPDF_Page* AsPDFPage() = 0;
- virtual CPDFXFA_Page* AsXFAPage() = 0;
-
- virtual CPDF_Document* GetDocument() const = 0;
-
- virtual float GetPageWidth() const = 0;
- virtual float GetPageHeight() const = 0;
- virtual CFX_Matrix GetDisplayMatrix(const FX_RECT& rect,
- int iRotate) const = 0;
-
- virtual Optional<CFX_PointF> DeviceToPage(
- const FX_RECT& rect,
- int rotate,
- const CFX_PointF& device_point) const = 0;
-
- virtual Optional<CFX_PointF> PageToDevice(
- const FX_RECT& rect,
- int rotate,
- const CFX_PointF& page_point) const = 0;
-};
-
-inline CPDF_Page* ToPDFPage(IPDF_Page* pBase) {
- return pBase ? pBase->AsPDFPage() : nullptr;
-}
-
-inline CPDFXFA_Page* ToXFAPage(IPDF_Page* pBase) {
- return pBase ? pBase->AsXFAPage() : nullptr;
-}
-
-#endif // CORE_FPDFAPI_PAGE_IPDF_PAGE_H_
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index 99aff8c6f8..8281f5663a 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -28,7 +28,7 @@ CFX_SystemHandler::~CFX_SystemHandler() {}
void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget,
const CFX_FloatRect& rect) {
CPDFSDK_PageView* pPageView = widget->GetPageView();
- IPDF_Page* pPage = widget->GetPage();
+ UnderlyingPageType* pPage = widget->GetUnderlyingPage();
if (!pPage || !pPageView)
return;
@@ -55,7 +55,7 @@ void CFX_SystemHandler::OutputSelectedRect(CFFL_FormFiller* pFormFiller,
CFX_PointF ptB = pFormFiller->PWLtoFFL(CFX_PointF(rect.right, rect.top));
CPDFSDK_Annot* pAnnot = pFormFiller->GetSDKAnnot();
- IPDF_Page* pPage = pAnnot->GetPage();
+ UnderlyingPageType* pPage = pAnnot->GetUnderlyingPage();
ASSERT(pPage);
m_pFormFillEnv->OutputSelectedRect(pPage,
diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp
index 6c17628a33..e105ed90fb 100644
--- a/fpdfsdk/cpdfsdk_annot.cpp
+++ b/fpdfsdk/cpdfsdk_annot.cpp
@@ -73,7 +73,7 @@ CFX_FloatRect CPDFSDK_Annot::GetRect() const {
return CFX_FloatRect();
}
-IPDF_Page* CPDFSDK_Annot::GetPage() {
+UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() {
#ifdef PDF_ENABLE_XFA
return GetPDFXFAPage();
#else // PDF_ENABLE_XFA
diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h
index 2d97f0870c..bf6e2cc387 100644
--- a/fpdfsdk/cpdfsdk_annot.h
+++ b/fpdfsdk/cpdfsdk_annot.h
@@ -45,7 +45,7 @@ class CPDFSDK_Annot : public Observable<CPDFSDK_Annot> {
virtual CFX_FloatRect GetRect() const;
virtual void SetRect(const CFX_FloatRect& rect);
- IPDF_Page* GetPage();
+ UnderlyingPageType* GetUnderlyingPage();
CPDF_Page* GetPDFPage();
#ifdef PDF_ENABLE_XFA
CPDFXFA_Page* GetPDFXFAPage();
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 117bf936e4..37d5274bab 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -311,7 +311,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,
CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage();
if (!pPage)
return nullptr;
- if (pPage->AsPDFPage()) { // for pdf annots.
+ if (pPage->GetPDFPage()) { // for pdf annots.
CPDFSDK_AnnotIterator ai(pSDKAnnot->GetPageView(),
pSDKAnnot->GetAnnotSubtype());
CPDFSDK_Annot* pNext =
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 44807fdc0c..a0859a225a 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -231,19 +231,19 @@ CPDFSDK_FormFillEnvironment::GetInteractiveFormFiller() {
return m_pFormFiller.get();
}
-void CPDFSDK_FormFillEnvironment::Invalidate(IPDF_Page* page,
+void CPDFSDK_FormFillEnvironment::Invalidate(UnderlyingPageType* page,
const FX_RECT& rect) {
if (m_pInfo && m_pInfo->FFI_Invalidate) {
- m_pInfo->FFI_Invalidate(m_pInfo, FPDFPageFromIPDFPage(page), rect.left,
+ m_pInfo->FFI_Invalidate(m_pInfo, FPDFPageFromUnderlying(page), rect.left,
rect.top, rect.right, rect.bottom);
}
}
void CPDFSDK_FormFillEnvironment::OutputSelectedRect(
- IPDF_Page* page,
+ UnderlyingPageType* page,
const CFX_FloatRect& rect) {
if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) {
- m_pInfo->FFI_OutputSelectedRect(m_pInfo, FPDFPageFromIPDFPage(page),
+ m_pInfo->FFI_OutputSelectedRect(m_pInfo, FPDFPageFromUnderlying(page),
rect.left, rect.top, rect.right,
rect.bottom);
}
@@ -332,7 +332,7 @@ void CPDFSDK_FormFillEnvironment::DisplayCaret(CPDFXFA_Page* page,
double right,
double bottom) {
if (m_pInfo && m_pInfo->FFI_DisplayCaret) {
- m_pInfo->FFI_DisplayCaret(m_pInfo, FPDFPageFromIPDFPage(page), bVisible,
+ m_pInfo->FFI_DisplayCaret(m_pInfo, FPDFPageFromUnderlying(page), bVisible,
left, top, right, bottom);
}
}
@@ -387,8 +387,8 @@ void CPDFSDK_FormFillEnvironment::GetPageViewRect(CPDFXFA_Page* page,
double top;
double right;
double bottom;
- m_pInfo->FFI_GetPageViewRect(m_pInfo, FPDFPageFromIPDFPage(page), &left, &top,
- &right, &bottom);
+ m_pInfo->FFI_GetPageViewRect(m_pInfo, FPDFPageFromUnderlying(page), &left,
+ &top, &right, &bottom);
dstRect.left = static_cast<float>(left);
dstRect.top = static_cast<float>(top);
@@ -401,7 +401,7 @@ bool CPDFSDK_FormFillEnvironment::PopupMenu(CPDFXFA_Page* page,
int menuFlag,
CFX_PointF pt) {
return m_pInfo && m_pInfo->FFI_PopupMenu &&
- m_pInfo->FFI_PopupMenu(m_pInfo, FPDFPageFromIPDFPage(page), hWidget,
+ m_pInfo->FFI_PopupMenu(m_pInfo, FPDFPageFromUnderlying(page), hWidget,
menuFlag, pt.x, pt.y);
}
@@ -531,7 +531,7 @@ void CPDFSDK_FormFillEnvironment::ClearAllFocusedAnnots() {
}
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(
- IPDF_Page* pUnderlyingPage,
+ UnderlyingPageType* pUnderlyingPage,
bool renew) {
auto it = m_PageMap.find(pUnderlyingPage);
if (it != m_PageMap.end())
@@ -550,12 +550,12 @@ CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(
}
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetCurrentView() {
- IPDF_Page* pPage = IPDFPageFromFPDFPage(GetCurrentPage());
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(GetCurrentPage());
return pPage ? GetPageView(pPage, true) : nullptr;
}
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(int nIndex) {
- IPDF_Page* pTempPage = GetPage(nIndex);
+ UnderlyingPageType* pTempPage = GetPage(nIndex);
if (!pTempPage)
return nullptr;
@@ -599,7 +599,8 @@ bool CPDFSDK_FormFillEnvironment::ProcOpenAction() {
return true;
}
-void CPDFSDK_FormFillEnvironment::RemovePageView(IPDF_Page* pUnderlyingPage) {
+void CPDFSDK_FormFillEnvironment::RemovePageView(
+ UnderlyingPageType* pUnderlyingPage) {
auto it = m_PageMap.find(pUnderlyingPage);
if (it == m_PageMap.end())
return;
@@ -625,10 +626,10 @@ void CPDFSDK_FormFillEnvironment::RemovePageView(IPDF_Page* pUnderlyingPage) {
m_PageMap.erase(it);
}
-IPDF_Page* CPDFSDK_FormFillEnvironment::GetPage(int nIndex) {
+UnderlyingPageType* CPDFSDK_FormFillEnvironment::GetPage(int nIndex) {
if (!m_pInfo || !m_pInfo->FFI_GetPage)
return nullptr;
- return IPDFPageFromFPDFPage(m_pInfo->FFI_GetPage(
+ return UnderlyingFromFPDFPage(m_pInfo->FFI_GetPage(
m_pInfo, FPDFDocumentFromCPDFDocument(m_pCPDFDoc.Get()), nIndex));
}
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index 9818259ca2..8baa5848fd 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -60,10 +60,10 @@ class CPDFSDK_FormFillEnvironment
return !!(nFlag & FWL_EVENTFLAG_AltKey);
}
- CPDFSDK_PageView* GetPageView(IPDF_Page* pPage, bool renew);
+ CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool renew);
CPDFSDK_PageView* GetPageView(int nIndex);
CPDFSDK_PageView* GetCurrentView();
- void RemovePageView(IPDF_Page* pPage);
+ void RemovePageView(UnderlyingPageType* pPage);
void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); }
@@ -90,8 +90,8 @@ class CPDFSDK_FormFillEnvironment
void ProcJavascriptFun();
bool ProcOpenAction();
- void Invalidate(IPDF_Page* page, const FX_RECT& rect);
- void OutputSelectedRect(IPDF_Page* page, const CFX_FloatRect& rect);
+ void Invalidate(UnderlyingPageType* page, const FX_RECT& rect);
+ void OutputSelectedRect(UnderlyingPageType* page, const CFX_FloatRect& rect);
void SetCursor(int nCursorType);
int SetTimer(int uElapse, TimerCallback lpTimerFunc);
@@ -210,13 +210,13 @@ class CPDFSDK_FormFillEnvironment
CPDFSDK_InterForm* GetInterForm(); // Creates if not present.
private:
- IPDF_Page* GetPage(int nIndex);
+ UnderlyingPageType* GetPage(int nIndex);
FPDF_FORMFILLINFO* const m_pInfo;
std::unique_ptr<CPDFSDK_AnnotHandlerMgr> m_pAnnotHandlerMgr;
std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
std::unique_ptr<IJS_Runtime> m_pIJSRuntime;
- std::map<IPDF_Page*, std::unique_ptr<CPDFSDK_PageView>> m_PageMap;
+ std::map<UnderlyingPageType*, std::unique_ptr<CPDFSDK_PageView>> m_PageMap;
std::unique_ptr<CPDFSDK_InterForm> m_pInterForm;
CPDFSDK_Annot::ObservedPtr m_pFocusAnnot;
UnownedPtr<CPDF_Document> const m_pCPDFDoc;
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index f7a875a3e9..e96b09f3a1 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -143,11 +143,11 @@ bool FPDF_FileHandlerContext::Flush() {
} // namespace
-IPDF_Page* IPDFPageFromFPDFPage(FPDF_PAGE page) {
- return reinterpret_cast<IPDF_Page*>(page);
+UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page) {
+ return reinterpret_cast<UnderlyingPageType*>(page);
}
-FPDF_PAGE FPDFPageFromIPDFPage(IPDF_Page* page) {
+FPDF_PAGE FPDFPageFromUnderlying(UnderlyingPageType* page) {
return reinterpret_cast<FPDF_PAGE>(page);
}
@@ -160,7 +160,11 @@ FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc) {
}
CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page) {
- return page ? IPDFPageFromFPDFPage(page)->AsPDFPage() : nullptr;
+#ifdef PDF_ENABLE_XFA
+ return page ? UnderlyingFromFPDFPage(page)->GetPDFPage() : nullptr;
+#else // PDF_ENABLE_XFA
+ return UnderlyingFromFPDFPage(page);
+#endif // PDF_ENABLE_XFA
}
ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) {
diff --git a/fpdfsdk/cpdfsdk_helpers.h b/fpdfsdk/cpdfsdk_helpers.h
index 98d7e45e5f..fae7ef0782 100644
--- a/fpdfsdk/cpdfsdk_helpers.h
+++ b/fpdfsdk/cpdfsdk_helpers.h
@@ -7,7 +7,6 @@
#ifndef FPDFSDK_CPDFSDK_HELPERS_H_
#define FPDFSDK_CPDFSDK_HELPERS_H_
-#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
@@ -30,6 +29,7 @@ class CPDF_ContentMarkItem;
class CPDF_Object;
class CPDF_Font;
class CPDF_LinkExtract;
+class CPDF_Page;
class CPDF_PageObject;
class CPDF_PageRenderContext;
class CPDF_PathObject;
@@ -47,9 +47,18 @@ class CPDFXFA_Page;
class CXFA_FFWidget;
#endif // PDF_ENABLE_XFA
+// Object types for public FPDF_ types; these correspond to next layer down
+// from fpdfsdk. For master, these are CPDF_ types, but for XFA, these are
+// CPDFXFA_ types.
+#ifdef PDF_ENABLE_XFA
+using UnderlyingPageType = CPDFXFA_Page;
+#else // PDF_ENABLE_XFA
+using UnderlyingPageType = CPDF_Page;
+#endif // PDF_ENABLE_XFA
+
// Conversions to/from underlying types.
-IPDF_Page* IPDFPageFromFPDFPage(FPDF_PAGE page);
-FPDF_PAGE FPDFPageFromIPDFPage(IPDF_Page* page);
+UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page);
+FPDF_PAGE FPDFPageFromUnderlying(UnderlyingPageType* page);
CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page);
FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc);
CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc);
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 3b92723597..638b4dfc07 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -361,7 +361,7 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) {
if (!pWidget)
continue;
- IPDF_Page* pPage = pWidget->GetPage();
+ UnderlyingPageType* pPage = pWidget->GetUnderlyingPage();
FX_RECT rect = formfiller->GetViewBBox(
m_pFormFillEnv->GetPageView(pPage, false), pWidget);
m_pFormFillEnv->Invalidate(pPage, rect);
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 5cb5f2ced2..43f8ee0214 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -31,17 +31,17 @@
#endif // PDF_ENABLE_XFA
CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_FormFillEnvironment* pFormFillEnv,
- IPDF_Page* page)
+ UnderlyingPageType* page)
: m_page(page), m_pFormFillEnv(pFormFillEnv) {
- CPDF_Page* pPDFPage = ToPDFPage(page);
- if (pPDFPage) {
- CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
- CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
- pPDFInterForm->FixPageFields(pPDFPage);
-#ifndef PDF_ENABLE_XFA
- pPDFPage->SetView(this);
+ CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
+ CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
+#ifdef PDF_ENABLE_XFA
+ if (page->GetPDFPage())
+ pPDFInterForm->FixPageFields(page->GetPDFPage());
+#else // PDF_ENABLE_XFA
+ pPDFInterForm->FixPageFields(page);
+ m_page->SetView(this);
#endif // PDF_ENABLE_XFA
- }
}
CPDFSDK_PageView::~CPDFSDK_PageView() {
@@ -49,7 +49,7 @@ CPDFSDK_PageView::~CPDFSDK_PageView() {
// The call to |ReleaseAnnot| can cause the page pointed to by |m_page| to
// be freed, which will cause issues if we try to cleanup the pageview pointer
// in |m_page|. So, reset the pageview pointer before doing anything else.
- m_page->AsPDFPage()->SetView(nullptr);
+ m_page->SetView(nullptr);
#endif // PDF_ENABLE_XFA
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
@@ -190,11 +190,22 @@ bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
#endif // PDF_ENABLE_XFA
CPDF_Document* CPDFSDK_PageView::GetPDFDocument() {
- return m_page ? m_page->GetDocument() : nullptr;
+ if (m_page) {
+#ifdef PDF_ENABLE_XFA
+ return m_page->GetDocumentExtension()->GetPDFDoc();
+#else // PDF_ENABLE_XFA
+ return m_page->GetDocument();
+#endif // PDF_ENABLE_XFA
+ }
+ return nullptr;
}
CPDF_Page* CPDFSDK_PageView::GetPDFPage() const {
- return ToPDFPage(m_page);
+#ifdef PDF_ENABLE_XFA
+ return m_page ? m_page->GetPDFPage() : nullptr;
+#else // PDF_ENABLE_XFA
+ return m_page;
+#endif // PDF_ENABLE_XFA
}
CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByDict(CPDF_Dictionary* pDict) {
@@ -449,9 +460,9 @@ void CPDFSDK_PageView::LoadFXAnnots() {
m_bLocked = true;
#ifdef PDF_ENABLE_XFA
- RetainPtr<CPDFXFA_Page> protector(ToXFAPage(m_page));
+ RetainPtr<CPDFXFA_Page> protector(m_page);
if (m_pFormFillEnv->GetXFAContext()->GetFormType() == FormType::kXFAFull) {
- CXFA_FFPageView* pageView = protector->GetXFAPageView();
+ CXFA_FFPageView* pageView = m_page->GetXFAPageView();
std::unique_ptr<IXFA_WidgetIterator> pWidgetHandler(
pageView->CreateWidgetIterator(
XFA_TRAVERSEWAY_Form,
@@ -507,11 +518,11 @@ int CPDFSDK_PageView::GetPageIndex() const {
return -1;
#ifdef PDF_ENABLE_XFA
- auto* pContext = static_cast<CPDFXFA_Context*>(
- m_page->AsXFAPage()->GetDocumentExtension());
+ auto* pContext =
+ static_cast<CPDFXFA_Context*>(m_page->GetDocumentExtension());
switch (pContext->GetFormType()) {
case FormType::kXFAFull: {
- CXFA_FFPageView* pPageView = m_page->AsXFAPage()->GetXFAPageView();
+ CXFA_FFPageView* pPageView = m_page->GetXFAPageView();
return pPageView ? pPageView->GetPageIndex() : -1;
}
case FormType::kNone:
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index cf2d9bf442..bfb6450ca8 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -22,7 +22,8 @@ class CPDF_RenderOptions;
class CPDFSDK_PageView final : public CPDF_Page::View {
public:
- CPDFSDK_PageView(CPDFSDK_FormFillEnvironment* pFormFillEnv, IPDF_Page* page);
+ CPDFSDK_PageView(CPDFSDK_FormFillEnvironment* pFormFillEnv,
+ UnderlyingPageType* page);
~CPDFSDK_PageView();
void PageView_OnDraw(CFX_RenderDevice* pDevice,
@@ -44,7 +45,8 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
bool DeleteAnnot(CPDFSDK_Annot* pAnnot);
CPDFSDK_Annot* AddAnnot(CXFA_FFWidget* pPDFAnnot);
CPDFSDK_Annot* GetAnnotByXFAWidget(CXFA_FFWidget* hWidget);
- CPDFXFA_Page* GetPDFXFAPage() { return ToXFAPage(m_page); }
+
+ CPDFXFA_Page* GetPDFXFAPage() { return m_page; }
#endif // PDF_ENABLE_XFA
CPDF_Page* GetPDFPage() const;
@@ -94,7 +96,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
bool IsBeingDestroyed() const { return m_bBeingDestroyed; }
#ifndef PDF_ENABLE_XFA
- void TakePageOwnership() { m_pOwnsPage.Reset(ToPDFPage(m_page)); }
+ void TakePageOwnership() { m_pOwnsPage.Reset(m_page); }
#endif // PDF_ENABLE_XFA
private:
@@ -111,7 +113,7 @@ class CPDFSDK_PageView final : public CPDF_Page::View {
uint32_t nFlag);
CFX_Matrix m_curMatrix;
- IPDF_Page* const m_page;
+ UnderlyingPageType* const m_page;
std::unique_ptr<CPDF_AnnotList> m_pAnnotList;
std::vector<CPDFSDK_Annot*> m_SDKAnnotArray;
UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 44e91d3334..261cb653e5 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -302,7 +302,7 @@ bool CFFL_FormFiller::Redo(CPDFSDK_Annot* pAnnot) {
void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) {
auto* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
- IPDF_Page* pPage = pWidget->GetPage();
+ UnderlyingPageType* pPage = pWidget->GetUnderlyingPage();
CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(pPage, true);
if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, true))
pWnd->SetFocus();
@@ -479,7 +479,7 @@ CFX_FloatRect CFFL_FormFiller::GetPDFWindowRect() const {
}
CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView(bool renew) {
- IPDF_Page* pPage = m_pWidget->GetPage();
+ UnderlyingPageType* pPage = m_pWidget->GetUnderlyingPage();
return m_pFormFillEnv->GetPageView(pPage, renew);
}
@@ -618,5 +618,5 @@ void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView,
}
void CFFL_FormFiller::InvalidateRect(const FX_RECT& rect) {
- m_pFormFillEnv->Invalidate(m_pWidget->GetPage(), rect);
+ m_pFormFillEnv->Invalidate(m_pWidget->GetUnderlyingPage(), rect);
}
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index da011e40ab..eeed266235 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -100,7 +100,7 @@ bool CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot,
CPDFSDK_PageView* pPageView = GetCurPageView(true);
ASSERT(pPageView);
m_bValid = !m_bValid;
- m_pFormFillEnv->Invalidate(pAnnot->GetPage(),
+ m_pFormFillEnv->Invalidate(pAnnot->GetUnderlyingPage(),
pAnnot->GetRect().GetOuterRect());
if (m_bValid) {
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 9198e1d2e4..b8ceea5724 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -195,13 +195,13 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document,
if (pContext) {
auto pXFAPage = pdfium::MakeRetain<CPDFXFA_Page>(pContext, page_index);
pXFAPage->LoadPDFPage(pPageDict);
- return FPDFPageFromIPDFPage(pXFAPage.Leak()); // Caller takes ownership.
+ return FPDFPageFromUnderlying(pXFAPage.Leak()); // Caller takes ownership.
}
// Eventually, fallthru into non-XFA case once page type is consistent.
return nullptr;
#else // PDF_ENABLE_XFA
RetainPtr<CPDF_Page> pPage = pDoc->GetOrCreatePDFPage(pPageDict);
- return FPDFPageFromIPDFPage(pPage.Leak()); // Caller takes ownership.
+ return FPDFPageFromUnderlying(pPage.Leak()); // Caller takes ownership.
#endif // PDF_ENABLE_XFA
}
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index c03b55b722..62d2c00d55 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -111,7 +111,7 @@ CPDFSDK_InterForm* FormHandleToInterForm(FPDF_FORMHANDLE hHandle) {
CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page) {
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
if (!pPage)
return nullptr;
@@ -133,13 +133,12 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
if (!hHandle)
return;
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
if (!pPage)
return;
#ifdef PDF_ENABLE_XFA
- CPDF_Document::Extension* pExtension =
- pPage->AsXFAPage()->GetDocumentExtension();
+ CPDF_Document::Extension* pExtension = pPage->GetDocumentExtension();
if (!pExtension)
return;
CPDF_Document* pPDFDoc = pExtension->GetPDFDoc();
@@ -186,7 +185,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle,
CPDFSDK_PageView* pPageView = pFormFillEnv->GetPageView(pPage, true);
#else // PDF_ENABLE_XFA
CPDFSDK_PageView* pPageView =
- FormHandleToPageView(hHandle, FPDFPageFromIPDFPage(pPage));
+ FormHandleToPageView(hHandle, FPDFPageFromUnderlying(pPage));
#endif // PDF_ENABLE_XFA
if (pPageView)
@@ -221,7 +220,7 @@ FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
}
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Page* pXFAPage = ToXFAPage(IPDFPageFromFPDFPage(page));
+ CPDFXFA_Page* pXFAPage = UnderlyingFromFPDFPage(page);
if (!pXFAPage)
return -1;
@@ -583,7 +582,7 @@ FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page,
if (!pFormFillEnv)
return;
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
if (!pPage)
return;
@@ -641,7 +640,7 @@ FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page,
if (!pFormFillEnv)
return;
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page);
if (!pPDFPage)
return;
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index d5c2a7e3dd..e38c651cbe 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -351,7 +351,7 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
#ifdef PDF_ENABLE_XFA
auto* pContext = static_cast<CPDFXFA_Context*>(pDoc->GetExtension());
if (pContext)
- return FPDFPageFromIPDFPage(pContext->GetXFAPage(page_index).Leak());
+ return FPDFPageFromUnderlying(pContext->GetXFAPage(page_index).Leak());
// Eventually, fallthrough into non-xfa case once page type made consistent.
return nullptr;
@@ -361,17 +361,17 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
return nullptr;
RetainPtr<CPDF_Page> pPage = pDoc->GetOrCreatePDFPage(pDict);
- return FPDFPageFromIPDFPage(pPage.Leak());
+ return FPDFPageFromUnderlying(pPage.Leak());
#endif // PDF_ENABLE_XFA
}
FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page) {
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
return pPage ? pPage->GetPageWidth() : 0.0;
}
FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page) {
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
return pPage ? pPage->GetPageHeight() : 0.0;
}
@@ -731,12 +731,12 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page) {
return;
// Take it back across the API and hold for duration of this function.
- RetainPtr<IPDF_Page> pPage;
- pPage.Unleak(IPDFPageFromFPDFPage(page));
+ RetainPtr<UnderlyingPageType> pPage;
+ pPage.Unleak(UnderlyingFromFPDFPage(page));
#ifndef PDF_ENABLE_XFA
CPDFSDK_PageView* pPageView =
- static_cast<CPDFSDK_PageView*>(pPage->AsPDFPage()->GetView());
+ static_cast<CPDFSDK_PageView*>(pPage->GetView());
if (!pPageView || pPageView->IsBeingDestroyed())
return;
@@ -774,7 +774,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_DeviceToPage(FPDF_PAGE page,
if (!page || !page_x || !page_y)
return false;
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
Optional<CFX_PointF> pos =
pPage->DeviceToPage(rect, rotate, CFX_PointF(device_x, device_y));
@@ -799,7 +799,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page,
if (!page || !device_x || !device_y)
return false;
- IPDF_Page* pPage = IPDFPageFromFPDFPage(page);
+ UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
CFX_PointF page_point(static_cast<float>(page_x), static_cast<float>(page_y));
Optional<CFX_PointF> pos = pPage->PageToDevice(rect, rotate, page_point);
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index ad0615528f..f4120896a8 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -22,18 +22,6 @@ CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Context* pContext, int page_index)
CPDFXFA_Page::~CPDFXFA_Page() {}
-CPDF_Page* CPDFXFA_Page::AsPDFPage() {
- return m_pPDFPage.Get();
-}
-
-CPDFXFA_Page* CPDFXFA_Page::AsXFAPage() {
- return this;
-}
-
-CPDF_Document* CPDFXFA_Page::GetDocument() const {
- return GetDocumentExtension()->GetPDFDoc();
-}
-
bool CPDFXFA_Page::LoadPDFPage() {
if (!m_pContext)
return false;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.h b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
index 76c425f82b..2573b9cebd 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.h
@@ -10,7 +10,6 @@
#include <memory>
#include "core/fpdfapi/page/cpdf_page.h"
-#include "core/fpdfapi/page/ipdf_page.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
@@ -22,39 +21,35 @@ class CPDF_Dictionary;
class CPDFXFA_Context;
class CXFA_FFPageView;
-class CPDFXFA_Page : public IPDF_Page {
+class CPDFXFA_Page : public CPDF_Page::Extension {
public:
template <typename T, typename... Args>
friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- // IPDF_Page:
- CPDF_Page* AsPDFPage() override;
- CPDFXFA_Page* AsXFAPage() override;
- CPDF_Document* GetDocument() const override;
- float GetPageWidth() const override;
- float GetPageHeight() const override;
- CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const override;
- Optional<CFX_PointF> DeviceToPage(
- const FX_RECT& rect,
- int rotate,
- const CFX_PointF& device_point) const override;
- Optional<CFX_PointF> PageToDevice(
- const FX_RECT& rect,
- int rotate,
- const CFX_PointF& page_point) const override;
-
bool LoadPage();
bool LoadPDFPage(CPDF_Dictionary* pageDict);
CPDF_Document::Extension* GetDocumentExtension() const;
int GetPageIndex() const { return m_iPageIndex; }
+ CPDF_Page* GetPDFPage() const { return m_pPDFPage.Get(); }
CXFA_FFPageView* GetXFAPageView() const { return m_pXFAPageView; }
void SetXFAPageView(CXFA_FFPageView* pPageView) {
m_pXFAPageView = pPageView;
}
+ float GetPageWidth() const;
+ float GetPageHeight() const;
+
+ Optional<CFX_PointF> DeviceToPage(const FX_RECT& rect,
+ int rotate,
+ const CFX_PointF& device_point) const;
+ Optional<CFX_PointF> PageToDevice(const FX_RECT& rect,
+ int rotate,
+ const CFX_PointF& page_point) const;
+
+ CFX_Matrix GetDisplayMatrix(const FX_RECT& rect, int iRotate) const;
protected:
// Refcounted class.
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index e087e0eda9..b2cc1eb72c 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -442,7 +442,7 @@ CJS_Return CJS_Document::removeField(
++rcAnnot.top;
std::vector<CFX_FloatRect> aRefresh(1, rcAnnot);
- IPDF_Page* pPage = pWidget->GetPage();
+ UnderlyingPageType* pPage = pWidget->GetUnderlyingPage();
ASSERT(pPage);
// If there is currently no pageview associated with the page being used
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 263585cde8..1e9e389d84 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -2530,7 +2530,8 @@ CJS_Return CJS_Field::setFocus(
if (nCount == 1) {
pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
} else {
- IPDF_Page* pPage = IPDFPageFromFPDFPage(m_pFormFillEnv->GetCurrentPage());
+ UnderlyingPageType* pPage =
+ UnderlyingFromFPDFPage(m_pFormFillEnv->GetCurrentPage());
if (!pPage)
return CJS_Return(false);
if (CPDFSDK_PageView* pCurPageView =