Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp

Issue 2904973003: [DMC #15] Add TextMatchMarkerListImpl::SetTextMatchMarkersActive() (Closed)
Patch Set: Remove blank lines Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp b/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp
index da557e5d802c6b4a0b7d718026f969affc797916..01bfa1bf31d8879938136a300b00594f6affcf16 100644
--- a/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp
@@ -81,4 +81,25 @@ Vector<IntRect> TextMatchMarkerListImpl::RenderedRects(const Node& node) const {
return result;
}
+bool TextMatchMarkerListImpl::SetTextMatchMarkersActive(unsigned start_offset,
+ unsigned end_offset,
+ bool active) {
+ bool doc_dirty = false;
+ const auto start = std::upper_bound(
+ markers_.begin(), markers_.end(), start_offset,
+ [](size_t start_offset, const Member<DocumentMarker>& marker) {
+ return start_offset < marker->EndOffset();
+ });
+ for (auto it = start; it != markers_.end(); ++it) {
+ DocumentMarker& marker = **it;
+ // Markers are returned in order, so stop if we are now past the specified
+ // range.
+ if (marker.StartOffset() >= end_offset)
+ break;
+ marker.SetIsActiveMatch(active);
+ doc_dirty = true;
+ }
+ return doc_dirty;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698