| 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/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" |
| 11 #include "core/editing/markers/TextMatchMarker.h" | 11 #include "core/editing/markers/TextMatchMarker.h" |
| 12 #include "third_party/WebKit/Source/core/editing/VisibleUnits.h" | 12 #include "third_party/WebKit/Source/core/editing/VisibleUnits.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 DocumentMarker::MarkerType TextMatchMarkerListImpl::MarkerType() const { | 16 DocumentMarker::MarkerType TextMatchMarkerListImpl::MarkerType() const { |
| 17 return DocumentMarker::kTextMatch; | 17 return DocumentMarker::kTextMatch; |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool TextMatchMarkerListImpl::IsEmpty() const { | 20 bool TextMatchMarkerListImpl::IsEmpty() const { |
| 21 return markers_.IsEmpty(); | 21 return markers_.IsEmpty(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void TextMatchMarkerListImpl::Add(DocumentMarker* marker) { | 24 void TextMatchMarkerListImpl::Add(DocumentMarker* marker) { |
| 25 DocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping(&markers_, | 25 DocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping( |
| 26 marker); | 26 &markers_, TextMatchMarker::Create(*marker)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void TextMatchMarkerListImpl::Clear() { | 29 void TextMatchMarkerListImpl::Clear() { |
| 30 markers_.clear(); | 30 markers_.clear(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 const HeapVector<Member<DocumentMarker>>& TextMatchMarkerListImpl::GetMarkers() | 33 const HeapVector<Member<DocumentMarker>>& TextMatchMarkerListImpl::GetMarkers() |
| 34 const { | 34 const { |
| 35 return markers_; | 35 return markers_; |
| 36 } | 36 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // range. | 95 // range. |
| 96 if (marker.StartOffset() >= end_offset) | 96 if (marker.StartOffset() >= end_offset) |
| 97 break; | 97 break; |
| 98 marker.SetIsActiveMatch(active); | 98 marker.SetIsActiveMatch(active); |
| 99 doc_dirty = true; | 99 doc_dirty = true; |
| 100 } | 100 } |
| 101 return doc_dirty; | 101 return doc_dirty; |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |