summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
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;