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