diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-05 19:24:42 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-05 19:24:42 +0000 |
commit | 778e59ed40ed31f6176a68253b694acd31f640c9 (patch) | |
tree | 8fbaac034139d4a64a561f481c56eaf28d2b8118 /core/fpdfapi/page/cpdf_pageobjectholder.h | |
parent | 354ed202ccd4d6b9d408789a30517ebb1633570b (diff) | |
download | pdfium-778e59ed40ed31f6176a68253b694acd31f640c9.tar.xz |
Tidy parser lifecycle state machine in CPDF_PageObjectHolder.
Only update state in CPDF_PageObjectHolder itself.
Make more data private.
Remove CPDF_Page::GetPageBBox() as exact duplicate of
CPDF_PageObjectHolder::GetBBox().
Change-Id: I083ec33f61a1490e7a5e673c9787751af15a6cd1
Reviewed-on: https://pdfium-review.googlesource.com/33810
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_pageobjectholder.h')
-rw-r--r-- | core/fpdfapi/page/cpdf_pageobjectholder.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h index 816a294149..79b2166d52 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.h +++ b/core/fpdfapi/page/cpdf_pageobjectholder.h @@ -41,21 +41,22 @@ struct FontData { class CPDF_PageObjectHolder { public: + enum class ParseState : uint8_t { kNotParsed, kParsing, kParsed }; + CPDF_PageObjectHolder(CPDF_Document* pDoc, CPDF_Dictionary* pFormDict); virtual ~CPDF_PageObjectHolder(); virtual bool IsPage() const; + void StartParse(std::unique_ptr<CPDF_ContentParser> pParser); void ContinueParse(PauseIndicatorIface* pPause); - bool IsParsed() const { return m_ParseState == CONTENT_PARSED; } + ParseState GetParseState() const { return m_ParseState; } - const CPDF_Document* GetDocument() const { return m_pDocument.Get(); } - CPDF_Document* GetDocument() { return m_pDocument.Get(); } + CPDF_Document* GetDocument() const { return m_pDocument.Get(); } // TODO(thestig): Can this return nullptr? If not, audit callers and simplify // the ones that assume it can. - const CPDF_Dictionary* GetFormDict() const { return m_pFormDict.Get(); } - CPDF_Dictionary* GetFormDict() { return m_pFormDict.Get(); } + CPDF_Dictionary* GetFormDict() const { return m_pFormDict.Get(); } const CPDF_PageObjectList* GetPageObjectList() const { return &m_PageObjectList; @@ -90,17 +91,17 @@ class CPDF_PageObjectHolder { std::map<FontData, ByteString> m_FontsMap; protected: - enum ParseState { CONTENT_NOT_PARSED, CONTENT_PARSING, CONTENT_PARSED }; - void LoadTransInfo(); - const UnownedPtr<CPDF_Dictionary> m_pFormDict; - UnownedPtr<CPDF_Document> m_pDocument; CFX_FloatRect m_BBox; CPDF_Transparency m_Transparency; + + private: bool m_bBackgroundAlphaNeeded = false; + ParseState m_ParseState = ParseState::kNotParsed; + const UnownedPtr<CPDF_Dictionary> m_pFormDict; + UnownedPtr<CPDF_Document> m_pDocument; std::vector<CFX_FloatRect> m_MaskBoundingBoxes; - ParseState m_ParseState = CONTENT_NOT_PARSED; std::unique_ptr<CPDF_ContentParser> m_pParser; CPDF_PageObjectList m_PageObjectList; CFX_Matrix m_LastCTM; |