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/SpellCheckMarkerListImpl.h" | 5 #include "core/editing/markers/SpellCheckMarkerListImpl.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 SpellCheckMarkerListImpl::SpellCheckMarkerListImpl( |
| 13 DocumentMarker::MarkerType marker_type) |
| 14 : marker_type_(marker_type) {} |
| 15 |
| 16 DocumentMarker::MarkerType SpellCheckMarkerListImpl::MarkerType() const { |
| 17 return marker_type_; |
| 18 } |
| 19 |
12 bool SpellCheckMarkerListImpl::IsEmpty() const { | 20 bool SpellCheckMarkerListImpl::IsEmpty() const { |
13 return markers_.IsEmpty(); | 21 return markers_.IsEmpty(); |
14 } | 22 } |
15 | 23 |
16 void SpellCheckMarkerListImpl::Add(DocumentMarker* marker) { | 24 void SpellCheckMarkerListImpl::Add(DocumentMarker* marker) { |
17 RenderedDocumentMarker* rendered_marker = | 25 RenderedDocumentMarker* rendered_marker = |
18 RenderedDocumentMarker::Create(*marker); | 26 RenderedDocumentMarker::Create(*marker); |
19 if (markers_.IsEmpty() || | 27 if (markers_.IsEmpty() || |
20 markers_.back()->EndOffset() < marker->StartOffset()) { | 28 markers_.back()->EndOffset() < marker->StartOffset()) { |
21 markers_.push_back(rendered_marker); | 29 markers_.push_back(rendered_marker); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 if (words.Contains(marker_text)) { | 97 if (words.Contains(marker_text)) { |
90 markers_.erase(j - 1); | 98 markers_.erase(j - 1); |
91 removed_markers = true; | 99 removed_markers = true; |
92 } | 100 } |
93 } | 101 } |
94 | 102 |
95 return removed_markers; | 103 return removed_markers; |
96 } | 104 } |
97 | 105 |
98 } // namespace blink | 106 } // namespace blink |
OLD | NEW |