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

Unified Diff: third_party/WebKit/Source/core/editing/markers/CompositionMarkerList.cpp

Issue 2805553003: DocumentMarkerList refactor as an interface (Closed)
Patch Set: Rebase on renaming patch, respond to comments Created 3 years, 8 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/CompositionMarkerList.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/CompositionMarkerList.cpp b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerList.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7d19df18b7b6cc7945bc107428fe025793cc3584
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerList.cpp
@@ -0,0 +1,65 @@
+// 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.
+
+#include "core/editing/markers/CompositionMarkerList.h"
+
+#include "core/editing/markers/DocumentMarkerListEditor.h"
+
+namespace blink {
+
+CompositionMarkerList::CompositionMarkerList() : DocumentMarkerList() {}
+
+DocumentMarker::MarkerType CompositionMarkerList::GetAllowedMarkerType() const {
+ return DocumentMarker::kComposition;
+}
+
+bool CompositionMarkerList::Empty() const {
+ return markers_.IsEmpty();
+}
+
+DocumentMarker* CompositionMarkerList::At(size_t index) {
+ return markers_[index].Get();
+}
+
+void CompositionMarkerList::Add(DocumentMarker* marker) {
+ markers_.push_back(marker);
+}
+
+void CompositionMarkerList::Clear() {
+ markers_.Clear();
+}
+
+void CompositionMarkerList::AppendMarkersToInputList(
+ DocumentMarkerVector* list) const {
+ list->AppendVector(markers_);
+}
+
+DocumentMarkerList::DidMoveMarkerOrNot CompositionMarkerList::MoveMarkers(
+ int length,
+ DocumentMarkerList* dst_list) {
+ return DocumentMarkerListEditor::MoveUnsortedMarkers(&markers_, length,
+ dst_list);
+}
+
+DocumentMarkerList::DidRemoveMarkerOrNot CompositionMarkerList::RemoveMarkers(
+ unsigned start_offset,
+ int length) {
+ return DocumentMarkerListEditor::RemoveUnsortedMarkers(&markers_,
+ start_offset, length);
+}
+
+DocumentMarkerList::DidShiftMarkerOrNot CompositionMarkerList::ShiftMarkers(
+ unsigned offset,
+ unsigned old_length,
+ unsigned new_length) {
+ return DocumentMarkerListEditor::ShiftUnsortedMarkers(&markers_, offset,
+ old_length, new_length);
+}
+
+DEFINE_TRACE(CompositionMarkerList) {
+ visitor->Trace(markers_);
+ DocumentMarkerList::Trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698