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

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

Issue 2923033002: [ActiveSuggestionMarker #2] Add ActiveSuggestionMarker (Closed)
Patch Set: Update comment on ActiveSuggestionMarker.h Created 3 years, 6 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/ActiveSuggestionMarkerListImpl.h
diff --git a/third_party/WebKit/Source/core/editing/markers/ActiveSuggestionMarkerListImpl.h b/third_party/WebKit/Source/core/editing/markers/ActiveSuggestionMarkerListImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..c00182318b613e3019c3e933d5977321990a9f7d
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/ActiveSuggestionMarkerListImpl.h
@@ -0,0 +1,49 @@
+// 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 ActiveSuggestionMarkerListImpl_h
+#define ActiveSuggestionMarkerListImpl_h
+
+#include "core/editing/markers/DocumentMarkerList.h"
+
+namespace blink {
+
+// Implementation of DocumentMarkerList for ActiveSuggestion markers.
+// ActiveSuggestion markers are always inserted in order, aside from some
+// potential oddball cases (e.g. splitting the marker list into two nodes, then
+// undoing the split). This means we can keep the list in sorted order to do
+// some operations more efficiently, while still being able to do inserts in
+// O(1) time at the end of the list.
+class CORE_EXPORT ActiveSuggestionMarkerListImpl final
+ : public DocumentMarkerList {
+ public:
+ ActiveSuggestionMarkerListImpl() = default;
+
+ // DocumentMarkerList implementations
+ DocumentMarker::MarkerType MarkerType() const final;
+
+ bool IsEmpty() const final;
+
+ void Add(DocumentMarker*) final;
+ void Clear() final;
+
+ const HeapVector<Member<DocumentMarker>>& GetMarkers() const final;
+
+ bool MoveMarkers(int length, DocumentMarkerList* dst_list) final;
+ bool RemoveMarkers(unsigned start_offset, int length) final;
+ bool ShiftMarkers(unsigned offset,
+ unsigned old_length,
+ unsigned new_length) final;
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ HeapVector<Member<DocumentMarker>> markers_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActiveSuggestionMarkerListImpl);
+};
+
+} // namespace blink
+
+#endif // ActiveSuggestionMarkerListImpl_h

Powered by Google App Engine
This is Rietveld 408576698