summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-06-08 20:40:15 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-08 20:40:15 +0000
commitfc615c63d34037896963f636e4b5d9e05efd41de (patch)
tree30ab4b41c8eaf07297ff1255b2d62c1cccde9377 /core
parent8ef4ef26481d8ed80d33b898bcff829fa7c0999c (diff)
downloadpdfium-fc615c63d34037896963f636e4b5d9e05efd41de.tar.xz
Add constants for PDF 1.7 spec, table 3.27.
BUG=pdfium:1049 Change-Id: Ie8bdb893d2af8d63420027a7ef95baf58cd97aa6 Reviewed-on: https://pdfium-review.googlesource.com/34691 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 10463510a3..e730aee668 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -9,6 +9,7 @@
#include <set>
#include <utility>
+#include "constants/page_object.h"
#include "core/fpdfapi/cpdf_pagerendercontext.h"
#include "core/fpdfapi/page/cpdf_contentparser.h"
#include "core/fpdfapi/page/cpdf_pageobject.h"
@@ -30,15 +31,15 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
if (!pPageDict)
return;
- CPDF_Object* pPageAttr = GetPageAttr("Resources");
+ CPDF_Object* pPageAttr = GetPageAttr(pdfium::page_object::kResources);
m_pResources = pPageAttr ? pPageAttr->GetDict() : nullptr;
m_pPageResources = m_pResources;
- CFX_FloatRect mediabox = GetBox("MediaBox");
+ CFX_FloatRect mediabox = GetBox(pdfium::page_object::kMediaBox);
if (mediabox.IsEmpty())
mediabox = CFX_FloatRect(0, 0, 612, 792);
- m_BBox = GetBox("CropBox");
+ m_BBox = GetBox(pdfium::page_object::kCropBox);
if (m_BBox.IsEmpty())
m_BBox = mediabox;
else
@@ -102,7 +103,7 @@ CPDF_Object* CPDF_Page::GetPageAttr(const ByteString& name) const {
if (CPDF_Object* pObj = pPageDict->GetDirectObjectFor(name))
return pObj;
- pPageDict = pPageDict->GetDictFor("Parent");
+ pPageDict = pPageDict->GetDictFor(pdfium::page_object::kParent);
if (!pPageDict || pdfium::ContainsKey(visited, pPageDict))
break;
}
@@ -194,7 +195,7 @@ CFX_Matrix CPDF_Page::GetDisplayMatrix(const FX_RECT& rect, int iRotate) const {
}
int CPDF_Page::GetPageRotation() const {
- CPDF_Object* pRotate = GetPageAttr("Rotate");
+ CPDF_Object* pRotate = GetPageAttr(pdfium::page_object::kRotate);
int rotate = pRotate ? (pRotate->GetInteger() / 90) % 4 : 0;
return (rotate < 0) ? (rotate + 4) : rotate;
}