| 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/editing/markers/DocumentMarkerListEditor.h" | 7 #include "core/editing/markers/DocumentMarkerListEditor.h" |
| 8 #include "core/editing/markers/RenderedDocumentMarker.h" | 8 #include "core/editing/markers/RenderedDocumentMarker.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 DocumentMarker::MarkerType TextMatchMarkerListImpl::MarkerType() const { | 12 DocumentMarker::MarkerType TextMatchMarkerListImpl::MarkerType() const { |
| 13 return DocumentMarker::kTextMatch; | 13 return DocumentMarker::kTextMatch; |
| 14 } | 14 } |
| 15 | 15 |
| 16 bool TextMatchMarkerListImpl::IsEmpty() const { | 16 bool TextMatchMarkerListImpl::IsEmpty() const { |
| 17 return markers_.IsEmpty(); | 17 return markers_.IsEmpty(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void TextMatchMarkerListImpl::Add(DocumentMarker* marker) { | 20 void TextMatchMarkerListImpl::Add(DocumentMarker* marker) { |
| 21 DocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping(&markers_, | 21 DocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping( |
| 22 marker); | 22 &markers_, RenderedDocumentMarker::Create(*marker)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void TextMatchMarkerListImpl::Clear() { | 25 void TextMatchMarkerListImpl::Clear() { |
| 26 markers_.clear(); | 26 markers_.clear(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 const HeapVector<Member<RenderedDocumentMarker>>& | 29 const HeapVector<Member<DocumentMarker>>& TextMatchMarkerListImpl::GetMarkers() |
| 30 TextMatchMarkerListImpl::GetMarkers() const { | 30 const { |
| 31 return markers_; | 31 return markers_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool TextMatchMarkerListImpl::MoveMarkers(int length, | 34 bool TextMatchMarkerListImpl::MoveMarkers(int length, |
| 35 DocumentMarkerList* dst_list) { | 35 DocumentMarkerList* dst_list) { |
| 36 return DocumentMarkerListEditor::MoveMarkers(&markers_, length, dst_list); | 36 return DocumentMarkerListEditor::MoveMarkers(&markers_, length, dst_list); |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool TextMatchMarkerListImpl::RemoveMarkers(unsigned start_offset, int length) { | 39 bool TextMatchMarkerListImpl::RemoveMarkers(unsigned start_offset, int length) { |
| 40 return DocumentMarkerListEditor::RemoveMarkers(&markers_, start_offset, | 40 return DocumentMarkerListEditor::RemoveMarkers(&markers_, start_offset, |
| 41 length); | 41 length); |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool TextMatchMarkerListImpl::ShiftMarkers(unsigned offset, | 44 bool TextMatchMarkerListImpl::ShiftMarkers(unsigned offset, |
| 45 unsigned old_length, | 45 unsigned old_length, |
| 46 unsigned new_length) { | 46 unsigned new_length) { |
| 47 return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, | 47 return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, |
| 48 new_length); | 48 new_length); |
| 49 } | 49 } |
| 50 | 50 |
| 51 DEFINE_TRACE(TextMatchMarkerListImpl) { | 51 DEFINE_TRACE(TextMatchMarkerListImpl) { |
| 52 visitor->Trace(markers_); | 52 visitor->Trace(markers_); |
| 53 DocumentMarkerList::Trace(visitor); | 53 DocumentMarkerList::Trace(visitor); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace blink | 56 } // namespace blink |
| OLD | NEW |