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

Side by Side 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, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/markers/TextMatchMarkerListImpl.h" 5 #include "core/editing/markers/TextMatchMarkerListImpl.h"
6 6
7 #include "core/dom/Node.h" 7 #include "core/dom/Node.h"
8 #include "core/dom/Range.h" 8 #include "core/dom/Range.h"
9 #include "core/editing/EphemeralRange.h" 9 #include "core/editing/EphemeralRange.h"
10 #include "core/editing/markers/DocumentMarkerListEditor.h" 10 #include "core/editing/markers/DocumentMarkerListEditor.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (!rendered_marker->IsValid()) 74 if (!rendered_marker->IsValid())
75 UpdateMarkerRenderedRect(node, *rendered_marker); 75 UpdateMarkerRenderedRect(node, *rendered_marker);
76 if (!rendered_marker->IsRendered()) 76 if (!rendered_marker->IsRendered())
77 continue; 77 continue;
78 result.push_back(rendered_marker->RenderedRect()); 78 result.push_back(rendered_marker->RenderedRect());
79 } 79 }
80 80
81 return result; 81 return result;
82 } 82 }
83 83
84 bool TextMatchMarkerListImpl::SetTextMatchMarkersActive(unsigned start_offset,
85 unsigned end_offset,
86 bool active) {
87 bool doc_dirty = false;
88 const auto start = std::upper_bound(
89 markers_.begin(), markers_.end(), start_offset,
90 [](size_t start_offset, const Member<DocumentMarker>& marker) {
91 return start_offset < marker->EndOffset();
92 });
93 for (auto it = start; it != markers_.end(); ++it) {
94 DocumentMarker& marker = **it;
95 // Markers are returned in order, so stop if we are now past the specified
96 // range.
97 if (marker.StartOffset() >= end_offset)
98 break;
99 marker.SetIsActiveMatch(active);
100 doc_dirty = true;
101 }
102 return doc_dirty;
103 }
104
84 } // namespace blink 105 } // namespace blink
OLDNEW
« 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