summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.cpp14
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index 4932ee6231..615d31f3eb 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -73,6 +73,10 @@ void CPDF_ContentMark::AddMarkWithPropertiesDict(
m_pMarkData->AddMarkWithPropertiesDict(std::move(name), pDict, property_name);
}
+bool CPDF_ContentMark::RemoveMark(CPDF_ContentMarkItem* pMarkItem) {
+ return m_pMarkData && m_pMarkData->RemoveMark(pMarkItem);
+}
+
void CPDF_ContentMark::EnsureMarkDataExists() {
if (!m_pMarkData)
m_pMarkData = pdfium::MakeRetain<MarkData>();
@@ -160,6 +164,16 @@ void CPDF_ContentMark::MarkData::AddMarkWithPropertiesDict(
m_Marks.push_back(pItem);
}
+bool CPDF_ContentMark::MarkData::RemoveMark(CPDF_ContentMarkItem* pMarkItem) {
+ for (auto it = m_Marks.begin(); it != m_Marks.end(); ++it) {
+ if (it->Get() == pMarkItem) {
+ m_Marks.erase(it);
+ return true;
+ }
+ }
+ return false;
+}
+
void CPDF_ContentMark::MarkData::DeleteLastMark() {
if (!m_Marks.empty())
m_Marks.pop_back();
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index 8dc98370e6..4f678aff8e 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -35,6 +35,7 @@ class CPDF_ContentMark {
void AddMarkWithPropertiesDict(ByteString name,
CPDF_Dictionary* pDict,
const ByteString& property_name);
+ bool RemoveMark(CPDF_ContentMarkItem* pMarkItem);
void DeleteLastMark();
size_t FindFirstDifference(const CPDF_ContentMark* other) const;
@@ -56,6 +57,7 @@ class CPDF_ContentMark {
void AddMarkWithPropertiesDict(ByteString name,
CPDF_Dictionary* pDict,
const ByteString& property_name);
+ bool RemoveMark(CPDF_ContentMarkItem* pMarkItem);
void DeleteLastMark();
private: