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..60001785f37bdc238effa8ae2eae08ff362f93df 100644 |
--- a/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp |
+++ b/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp |
@@ -81,4 +81,27 @@ 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_pos = std::upper_bound( |
yosin_UTC9
2017/05/25 05:25:39
nit: s/start_pos/start/
Blink doesn't like abbrev
|
+ markers_.begin(), markers_.end(), start_offset, |
+ [](size_t start_offset, const Member<DocumentMarker>& marker) { |
+ return start_offset < marker->EndOffset(); |
+ }); |
+ for (auto marker = start_pos; marker != markers_.end(); ++marker) { |
yosin_UTC9
2017/05/25 05:25:39
|marker| is an iterator instead of |DocumentMarker
|
+ // 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 |