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/GenericDocumentMarkerListImpl.h" | 5 #include "core/editing/markers/GenericDocumentMarkerListImpl.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 bool GenericDocumentMarkerListImpl::IsEmpty() const { | 12 bool GenericDocumentMarkerListImpl::IsEmpty() const { |
13 return markers_.IsEmpty(); | 13 return markers_.IsEmpty(); |
14 } | 14 } |
15 | 15 |
16 void GenericDocumentMarkerListImpl::Add(DocumentMarker* marker) { | 16 void GenericDocumentMarkerListImpl::Add(DocumentMarker* marker) { |
17 switch (marker->GetType()) { | 17 switch (marker->GetType()) { |
18 case DocumentMarker::kSpelling: | 18 case DocumentMarker::kSpelling: |
19 case DocumentMarker::kGrammar: | 19 case DocumentMarker::kGrammar: |
20 DocumentMarkerListEditor::AddMarkerAndMergeOverlapping(&markers_, marker); | 20 NOTREACHED(); |
21 return; | |
22 case DocumentMarker::kTextMatch: | 21 case DocumentMarker::kTextMatch: |
23 DocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping(&markers_, | 22 DocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping(&markers_, |
24 marker); | 23 marker); |
25 return; | 24 return; |
26 case DocumentMarker::kComposition: | 25 case DocumentMarker::kComposition: |
27 NOTREACHED(); | 26 NOTREACHED(); |
28 } | 27 } |
29 | 28 |
30 NOTREACHED(); | 29 NOTREACHED(); |
31 return; | 30 return; |
(...skipping 12 matching lines...) Expand all Loading... |
44 DocumentMarkerList* dst_list) { | 43 DocumentMarkerList* dst_list) { |
45 return DocumentMarkerListEditor::MoveMarkers(&markers_, length, dst_list); | 44 return DocumentMarkerListEditor::MoveMarkers(&markers_, length, dst_list); |
46 } | 45 } |
47 | 46 |
48 bool GenericDocumentMarkerListImpl::RemoveMarkers(unsigned start_offset, | 47 bool GenericDocumentMarkerListImpl::RemoveMarkers(unsigned start_offset, |
49 int length) { | 48 int length) { |
50 return DocumentMarkerListEditor::RemoveMarkers(&markers_, start_offset, | 49 return DocumentMarkerListEditor::RemoveMarkers(&markers_, start_offset, |
51 length); | 50 length); |
52 } | 51 } |
53 | 52 |
54 bool GenericDocumentMarkerListImpl::RemoveMarkersUnderWords( | |
55 const String& node_text, | |
56 const Vector<String>& words) { | |
57 return DocumentMarkerListEditor::RemoveMarkersUnderWords(&markers_, node_text, | |
58 words); | |
59 } | |
60 | |
61 bool GenericDocumentMarkerListImpl::ShiftMarkers(unsigned offset, | 53 bool GenericDocumentMarkerListImpl::ShiftMarkers(unsigned offset, |
62 unsigned old_length, | 54 unsigned old_length, |
63 unsigned new_length) { | 55 unsigned new_length) { |
64 return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, | 56 return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, |
65 new_length); | 57 new_length); |
66 } | 58 } |
67 | 59 |
68 DEFINE_TRACE(GenericDocumentMarkerListImpl) { | 60 DEFINE_TRACE(GenericDocumentMarkerListImpl) { |
69 visitor->Trace(markers_); | 61 visitor->Trace(markers_); |
70 DocumentMarkerList::Trace(visitor); | 62 DocumentMarkerList::Trace(visitor); |
71 } | 63 } |
72 | 64 |
73 } // namespace blink | 65 } // namespace blink |
OLD | NEW |