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