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 #ifndef DocumentMarkerListEditor_h | 5 #ifndef DocumentMarkerListEditor_h |
6 #define DocumentMarkerListEditor_h | 6 #define DocumentMarkerListEditor_h |
7 | 7 |
| 8 #include "core/editing/markers/DocumentMarkerList.h" |
8 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 class DocumentMarker; | 13 class DocumentMarker; |
13 class RenderedDocumentMarker; | 14 class RenderedDocumentMarker; |
14 | 15 |
15 class DocumentMarkerListEditor { | 16 class DocumentMarkerListEditor { |
16 public: | 17 public: |
17 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; | 18 using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; |
18 | 19 |
19 static void AddMarker(MarkerList*, const DocumentMarker*); | 20 static void AddMarker(MarkerList*, const DocumentMarker*); |
20 | 21 |
21 // Returns true if a marker was moved, false otherwise. | 22 // Returns true if a marker was moved, false otherwise. |
22 static bool MoveMarkers(MarkerList* src_list, | 23 static bool MoveMarkers(MarkerList* src_list, |
23 int length, | 24 int length, |
24 MarkerList* dst_list); | 25 DocumentMarkerList* dst_list); |
25 | 26 |
26 // Returns true if a marker was removed, false otherwise. | 27 // Returns true if a marker was removed, false otherwise. |
27 static bool RemoveMarkers(MarkerList*, unsigned start_offset, int length); | 28 static bool RemoveMarkers(MarkerList*, unsigned start_offset, int length); |
28 | 29 |
29 // Returns true if a marker was removed, false otherwise. | 30 // Returns true if a marker was removed, false otherwise. |
30 static bool RemoveMarkersUnderWords(MarkerList*, | 31 static bool RemoveMarkersUnderWords(MarkerList*, |
31 const String& node_text, | 32 const String& node_text, |
32 const Vector<String>& words); | 33 const Vector<String>& words); |
33 | 34 |
34 // Returns true if a marker was shifted or removed, false otherwise. | 35 // Returns true if a marker was shifted or removed, false otherwise. |
35 static bool ShiftMarkers(MarkerList*, | 36 static bool ShiftMarkers(MarkerList*, |
36 unsigned offset, | 37 unsigned offset, |
37 unsigned old_length, | 38 unsigned old_length, |
38 unsigned new_length); | 39 unsigned new_length); |
39 | 40 |
40 private: | 41 private: |
41 static void MergeOverlapping(MarkerList*, RenderedDocumentMarker* to_insert); | 42 static void MergeOverlapping(MarkerList*, RenderedDocumentMarker* to_insert); |
42 }; | 43 }; |
43 | 44 |
44 } // namespace blink | 45 } // namespace blink |
45 | 46 |
46 #endif // DocumentMarkerListEditor_h | 47 #endif // DocumentMarkerListEditor_h |
OLD | NEW |