summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_pageview.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-03 13:53:02 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-03 13:53:02 +0000
commitccd9421589922b8f35ee5330d7fdac7edea081db (patch)
treebc1628d831ac02ce5fd98ca859d9f0f9f9f5c23b /fpdfsdk/cpdfsdk_pageview.cpp
parent241071b455e8922caa787c821563d1bd2587a4c5 (diff)
downloadpdfium-ccd9421589922b8f35ee5330d7fdac7edea081db.tar.xz
Add CPDF_Page::Extension::GetDocExtension()
In turn, add CPDF_Document::Extension::GetPDFDoc() so that we can use the abstract return type in more places. Mark an internal-only cpdfxfa_context method as private while we're at it. Change-Id: I08e64f4b9438bf2f731c3a37cf2a41152bbbd8fa Reviewed-on: https://pdfium-review.googlesource.com/31916 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index e648e596c4..87856fb0f0 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -89,7 +89,8 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
if (!pPage)
return;
- if (pPage->GetContext()->GetFormType() == FormType::kXFAFull) {
+ auto* pContext = static_cast<CPDFXFA_Context*>(pPage->GetDocumentExtension());
+ if (pContext->GetFormType() == FormType::kXFAFull) {
CFX_RectF rectClip(
static_cast<float>(pClip.left), static_cast<float>(pClip.top),
static_cast<float>(pClip.Width()), static_cast<float>(pClip.Height()));
@@ -177,7 +178,11 @@ bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
return false;
CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage();
- if (!pPage || !pPage->GetContext()->ContainsXFAForm())
+ if (!pPage)
+ return false;
+
+ auto* pContext = static_cast<CPDFXFA_Context*>(pPage->GetDocumentExtension());
+ if (!pContext->ContainsXFAForm())
return false;
CPDFSDK_Annot::ObservedPtr pObserved(pAnnot);
@@ -204,7 +209,7 @@ bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
CPDF_Document* CPDFSDK_PageView::GetPDFDocument() {
if (m_page) {
#ifdef PDF_ENABLE_XFA
- return m_page->GetContext()->GetPDFDoc();
+ return m_page->GetDocumentExtension()->GetPDFDoc();
#else // PDF_ENABLE_XFA
return m_page->m_pDocument.Get();
#endif // PDF_ENABLE_XFA
@@ -530,7 +535,9 @@ int CPDFSDK_PageView::GetPageIndex() const {
return -1;
#ifdef PDF_ENABLE_XFA
- switch (m_page->GetContext()->GetFormType()) {
+ auto* pContext =
+ static_cast<CPDFXFA_Context*>(m_page->GetDocumentExtension());
+ switch (pContext->GetFormType()) {
case FormType::kXFAFull: {
CXFA_FFPageView* pPageView = m_page->GetXFAPageView();
return pPageView ? pPageView->GetPageIndex() : -1;