summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_pageview.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-10-16 14:16:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-17 13:57:00 +0000
commitf9068a5c08e55c1c16b14863abd8a089a327bc4d (patch)
treef8dc58642256506eb9051add027d06696836b811 /fpdfsdk/cpdfsdk_pageview.cpp
parent90fffb31e2ec6cf66fe1b85b466cd2f12ee9c87f (diff)
downloadpdfium-f9068a5c08e55c1c16b14863abd8a089a327bc4d.tar.xz
Convert XFA Doc Types to be more precise
The existing types are PDF, Dynamic & Static, which are poorly named since they don't really convey the fundamental differences between the types. "PDF" is confusing because PDFium only handles PDFs, and "Dynamic" & "Static" describe what a form may do, not how it is specified or some other fundamental difference. The terms "Dynamic" and "Static" were especially confusing, since XFAF documents must be static by definition, whereas full XFA documents can be either dynamic or static, depending on whether or not they change their layout. The types have been renamed to be clear that they are talking about the type of PDF document being described. "PDF" becomes "None", since this is used to indicate that there are no XFA forms in the document. "Dynamic" becomes "Full", since this indicates that the entire XFA spec is being used for the forms, specifically display layout is in the XML. "Static" has become "ForegroundOnly", since the form is specified using the XFAF (XFA Foreground) subset of the spec. The terms Full & Foreground come from the XFA spec. I would have preferred XFAF to have a different name, since it is the display/foreground layer that isn't XFA when using it. BUG=pdfium:917 Change-Id: I4335958c4a11d77d3bbe63b93602dd5bc14acb57 Reviewed-on: https://pdfium-review.googlesource.com/16010 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index f46c74f79a..516b0eb499 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -88,7 +88,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
if (!pPage)
return;
- if (pPage->GetContext()->GetDocType() == XFA_DocType::Dynamic) {
+ if (pPage->GetContext()->GetDocType() == XFA_DocType::kFull) {
CFX_RectF rectClip(
static_cast<float>(pClip.left), static_cast<float>(pClip.top),
static_cast<float>(pClip.Width()), static_cast<float>(pClip.Height()));
@@ -176,8 +176,9 @@ bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
return false;
CPDFXFA_Page* pPage = pAnnot->GetPDFXFAPage();
- if (!pPage || (pPage->GetContext()->GetDocType() != XFA_DocType::Static &&
- pPage->GetContext()->GetDocType() != XFA_DocType::Dynamic)) {
+ if (!pPage ||
+ (pPage->GetContext()->GetDocType() != XFA_DocType::kForegroundOnly &&
+ pPage->GetContext()->GetDocType() != XFA_DocType::kFull)) {
return false;
}
@@ -428,7 +429,7 @@ void CPDFSDK_PageView::LoadFXAnnots() {
#ifdef PDF_ENABLE_XFA
RetainPtr<CPDFXFA_Page> protector(m_page);
- if (m_pFormFillEnv->GetXFAContext()->GetDocType() == XFA_DocType::Dynamic) {
+ if (m_pFormFillEnv->GetXFAContext()->GetDocType() == XFA_DocType::kFull) {
CXFA_FFPageView* pageView = m_page->GetXFAPageView();
std::unique_ptr<IXFA_WidgetIterator> pWidgetHandler(
pageView->CreateWidgetIterator(
@@ -486,12 +487,12 @@ int CPDFSDK_PageView::GetPageIndex() const {
#ifdef PDF_ENABLE_XFA
switch (m_page->GetContext()->GetDocType()) {
- case XFA_DocType::Dynamic: {
+ case XFA_DocType::kFull: {
CXFA_FFPageView* pPageView = m_page->GetXFAPageView();
return pPageView ? pPageView->GetPageIndex() : -1;
}
- case XFA_DocType::Static:
- case XFA_DocType::PDF:
+ case XFA_DocType::kForegroundOnly:
+ case XFA_DocType::kNone:
return GetPageIndexForStaticPDF();
default:
return -1;