Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h

Issue 2773883003: Add CompositionMarkerList in preparation for DocumentMarkerController refactor (Closed)
Patch Set: Make requested changes, refactor tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h
new file mode 100644
index 0000000000000000000000000000000000000000..d2bbd7d65af66cf48c7f840691f7c02ad01eb63c
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.h
@@ -0,0 +1,61 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DocumentMarkerList_h
+#define DocumentMarkerList_h
+
+#include "core/editing/markers/DocumentMarker.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class CORE_EXPORT DocumentMarkerList
+ : public GarbageCollected<DocumentMarkerList> {
+ public:
+ explicit DocumentMarkerList();
+ using iterator = Member<DocumentMarker>*;
+ using const_iterator = const Member<DocumentMarker>*;
+
+ virtual DocumentMarker::MarkerType allowedMarkerType() const = 0;
+ virtual bool isEditingMarkerList() const;
+ virtual bool isSpellCheckMarkerList() const;
+
+ size_t size() const { return m_markers.size(); }
+ bool empty() const { return m_markers.isEmpty(); }
+ DocumentMarker* at(size_t index) { return m_markers[index].get(); }
+
+ virtual void push_back(DocumentMarker*) = 0;
Xiaocheng 2017/03/25 00:05:35 Why not have a default implementation that simply
rlanday 2017/03/27 19:51:30 Note: I'm going to change this to add() here per y
+ virtual void clear();
+
+ iterator begin() { return m_markers.begin(); }
+ iterator end() { return m_markers.end(); }
+ const_iterator begin() const { return m_markers.begin(); }
+ const_iterator end() const { return m_markers.end(); }
+
+ void appendMarkersToInputList(DocumentMarkerVector* list) const;
+
+ bool copyMarkers(unsigned startOffset,
Xiaocheng 2017/03/25 00:05:35 |bool| return values can be ambiguous and should b
+ int length,
+ DocumentMarkerList* dstList,
+ int delta) const;
+ void removeMarkers(unsigned startOffset,
Xiaocheng 2017/03/25 00:05:35 No need to use |bool*| to return. Just return it d
+ int length,
+ bool shouldRemovePartiallyOverlappingMarkers,
+ bool* didRemoveMarker);
+ bool shiftMarkers(unsigned offset, unsigned oldLength, unsigned newLength);
+
+ DECLARE_VIRTUAL_TRACE();
+
+ protected:
+ iterator getPosOfFirstMarkerNotEndingBefore(size_t startOffset);
+ virtual bool markerListIsSorted() const = 0;
+
+ HeapVector<Member<DocumentMarker>> m_markers;
+
+ DISALLOW_COPY_AND_ASSIGN(DocumentMarkerList);
+};
+
+} // namespace blink
+
+#endif // DocumentMarkerList_h

Powered by Google App Engine
This is Rietveld 408576698