OLD | NEW |
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/TextMatchMarkerList.h" | 5 #include "core/editing/markers/TextMatchMarkerList.h" |
6 | 6 |
7 #include "core/editing/markers/DocumentMarkerController.h" | 7 #include "core/editing/markers/DocumentMarkerController.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 textMatchMarker->invalidate(); | 44 textMatchMarker->invalidate(); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 bool TextMatchMarkerList::setTextMatchMarkersActive(unsigned startOffset, | 48 bool TextMatchMarkerList::setTextMatchMarkersActive(unsigned startOffset, |
49 unsigned endOffset, | 49 unsigned endOffset, |
50 bool active) { | 50 bool active) { |
51 bool docDirty = false; | 51 bool docDirty = false; |
52 for (auto it = getPosOfFirstMarkerNotEndingBefore(startOffset); | 52 for (auto it = getPosOfFirstMarkerNotEndingBefore(startOffset); |
53 it != m_markers.end(); ++it) { | 53 it != m_markers.end(); ++it) { |
54 DocumentMarker& marker = **it; | 54 TextMatchMarker& marker = toTextMatchMarker(**it); |
55 // Markers are stored in order, so stop if we are now past the specified | 55 // Markers are stored in order, so stop if we are now past the specified |
56 // range. | 56 // range. |
57 if (marker.startOffset() >= endOffset) | 57 if (marker.startOffset() >= endOffset) |
58 break; | 58 break; |
59 | 59 |
60 marker.setActiveMatch(active); | 60 marker.setActiveMatch(active); |
61 docDirty = true; | 61 docDirty = true; |
62 } | 62 } |
63 | 63 |
64 return docDirty; | 64 return docDirty; |
65 } | 65 } |
66 | 66 |
67 bool TextMatchMarkerList::markerListIsSorted() const { | 67 bool TextMatchMarkerList::markerListIsSorted() const { |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 DEFINE_TRACE(TextMatchMarkerList) { | 71 DEFINE_TRACE(TextMatchMarkerList) { |
72 visitor->trace(m_markers); | 72 visitor->trace(m_markers); |
73 DocumentMarkerList::trace(visitor); | 73 DocumentMarkerList::trace(visitor); |
74 } | 74 } |
75 | 75 |
76 } // namespace blink | 76 } // namespace blink |
OLD | NEW |