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

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

Issue 2805553003: DocumentMarkerList refactor as an interface (Closed)
Patch Set: Respond to comments, fill in unimplemented methods 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..46fc78fb66ab92cfe9a7e313866f1e4251f3b857
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerList.cpp
@@ -0,0 +1,68 @@
+// 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::allowedMarkerType() const {
+ return DocumentMarker::Composition;
+}
+
+bool CompositionMarkerList::empty() const {
+ return m_markers.isEmpty();
+}
+
+DocumentMarker* CompositionMarkerList::at(size_t index) {
+ return m_markers[index].get();
+}
+
+void CompositionMarkerList::add(DocumentMarker* marker) {
+ m_markers.push_back(marker);
+}
+
+void CompositionMarkerList::clear() {
+ m_markers.clear();
+}
+
+void CompositionMarkerList::appendMarkersToInputList(
+ DocumentMarkerVector* list) const {
+ DocumentMarkerListEditor::appendMarkersToInputList(m_markers, list);
+}
+
+DocumentMarkerList::DidCopyMarkerOrNot CompositionMarkerList::copyMarkers(
+ unsigned startOffset,
+ int length,
+ DocumentMarkerList* dstList,
+ int delta) {
+ return DocumentMarkerListEditor::copyUnsortedMarkers(&m_markers, startOffset,
+ length, dstList, delta);
+}
+
+DocumentMarkerList::DidRemoveMarkerOrNot CompositionMarkerList::removeMarkers(
+ unsigned startOffset,
+ int length,
+ bool shouldRemovePartiallyOverlappingMarkers) {
+ return DocumentMarkerListEditor::removeUnsortedMarkers(
+ &m_markers, startOffset, length, shouldRemovePartiallyOverlappingMarkers);
+}
+
+DocumentMarkerList::DidShiftMarkerOrNot CompositionMarkerList::shiftMarkers(
+ unsigned offset,
+ unsigned oldLength,
+ unsigned newLength) {
+ return DocumentMarkerListEditor::shiftUnsortedMarkers(&m_markers, offset,
+ oldLength, newLength);
+}
+
+DEFINE_TRACE(CompositionMarkerList) {
+ visitor->trace(m_markers);
+ DocumentMarkerList::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698