summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-07-13 19:10:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-13 19:10:53 +0000
commita34067721d6630975c356a621a12753bbdab1cdb (patch)
treef9ad22fb224bbeb2e0786357a031165a8d63751d /core
parentc8a235ba4d42b67fa1bfe5f7c0dd872a3b72fc5f (diff)
downloadpdfium-a34067721d6630975c356a621a12753bbdab1cdb.tar.xz
Fix mark parameters not saved if nothing changed.
Bug: pdfium:1037 Change-Id: Ia2cd0d6ef99495dda3289988123489e3a2ad6e82 Reviewed-on: https://pdfium-review.googlesource.com/37750 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.cpp16
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index 1ff567d9e6..4932ee6231 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -30,6 +30,13 @@ size_t CPDF_ContentMark::CountItems() const {
return m_pMarkData->CountItems();
}
+bool CPDF_ContentMark::ContainsItem(const CPDF_ContentMarkItem* pItem) const {
+ if (!m_pMarkData)
+ return false;
+
+ return m_pMarkData->ContainsItem(pItem);
+}
+
CPDF_ContentMarkItem* CPDF_ContentMark::GetItem(size_t i) {
ASSERT(i < CountItems());
return m_pMarkData->GetItem(i);
@@ -105,6 +112,15 @@ size_t CPDF_ContentMark::MarkData::CountItems() const {
return m_Marks.size();
}
+bool CPDF_ContentMark::MarkData::ContainsItem(
+ const CPDF_ContentMarkItem* pItem) const {
+ for (const auto pMark : m_Marks) {
+ if (pMark.Get() == pItem)
+ return true;
+ }
+ return false;
+}
+
CPDF_ContentMarkItem* CPDF_ContentMark::MarkData::GetItem(size_t index) {
return m_Marks[index].Get();
}
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index 8bbae52418..8dc98370e6 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -24,6 +24,7 @@ class CPDF_ContentMark {
std::unique_ptr<CPDF_ContentMark> Clone();
int GetMarkedContentID() const;
size_t CountItems() const;
+ bool ContainsItem(const CPDF_ContentMarkItem* pItem) const;
// The returned pointer is never null.
CPDF_ContentMarkItem* GetItem(size_t i);
@@ -45,6 +46,7 @@ class CPDF_ContentMark {
~MarkData() override;
size_t CountItems() const;
+ bool ContainsItem(const CPDF_ContentMarkItem* pItem) const;
CPDF_ContentMarkItem* GetItem(size_t index);
const CPDF_ContentMarkItem* GetItem(size_t index) const;