diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-03-26 20:17:29 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-26 20:17:29 +0000 |
commit | 2c47fb2c9b3db7be3480cbc044fa90fda988b97f (patch) | |
tree | 8f221ab1bf47c9b624974907b8ee74f92a528cb4 /core/fpdfapi/page/cpdf_pageobjectholder.cpp | |
parent | ca28cb636331de447125de476decbec333fe613b (diff) | |
download | pdfium-2c47fb2c9b3db7be3480cbc044fa90fda988b97f.tar.xz |
Do not call CPDF_PageObjectList directly in fpdfeditpage.cpp.
Change-Id: If816c4f532f03513ad06959182b0e0edfd688e39
Reviewed-on: https://pdfium-review.googlesource.com/29170
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_pageobjectholder.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_pageobjectholder.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.cpp b/core/fpdfapi/page/cpdf_pageobjectholder.cpp index 9413ffbfae..67b356fc57 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.cpp +++ b/core/fpdfapi/page/cpdf_pageobjectholder.cpp @@ -7,6 +7,7 @@ #include "core/fpdfapi/page/cpdf_pageobjectholder.h" #include <algorithm> +#include <utility> #include "core/fpdfapi/page/cpdf_allstates.h" #include "core/fpdfapi/page/cpdf_contentparser.h" @@ -91,3 +92,30 @@ void CPDF_PageObjectHolder::LoadTransInfo() { m_iTransparency |= PDFTRANS_KNOCKOUT; } } + +size_t CPDF_PageObjectHolder::GetPageObjectCount() const { + return pdfium::CollectionSize<size_t>(m_PageObjectList); +} + +CPDF_PageObject* CPDF_PageObjectHolder::GetPageObjectByIndex( + size_t index) const { + return m_PageObjectList.GetPageObjectByIndex(index); +} + +void CPDF_PageObjectHolder::AppendPageObject( + std::unique_ptr<CPDF_PageObject> pPageObj) { + m_PageObjectList.push_back(std::move(pPageObj)); +} + +bool CPDF_PageObjectHolder::RemovePageObject(CPDF_PageObject* pPageObj) { + pdfium::FakeUniquePtr<CPDF_PageObject> p(pPageObj); + + auto it = + std::find(std::begin(m_PageObjectList), std::end(m_PageObjectList), p); + if (it == std::end(m_PageObjectList)) + return false; + + it->release(); + m_PageObjectList.erase(it); + return true; +} |