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

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

Issue 2773883003: Add CompositionMarkerList in preparation for DocumentMarkerController refactor (Closed)
Patch Set: Respond to comments 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/EditingMarkerList.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/EditingMarkerList.cpp b/third_party/WebKit/Source/core/editing/markers/EditingMarkerList.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..448604116c93f4bc3b60e5a6d78810ab8e6f9cc3
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/EditingMarkerList.cpp
@@ -0,0 +1,42 @@
+// 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/EditingMarkerList.h"
+
+#include <algorithm>
+#include "core/editing/markers/DocumentMarkerController.h"
+
+namespace blink {
+
+EditingMarkerList::EditingMarkerList(
+ DocumentMarkerController* documentMarkerController)
+ : DocumentMarkerList(documentMarkerController), m_markersAreSorted(true) {}
+
+bool EditingMarkerList::isEditingMarkerList() const {
+ return true;
+}
+
+void EditingMarkerList::clear() {
+ m_markers.clear();
+ m_markersAreSorted = true;
+}
+
+void EditingMarkerList::insert(DocumentMarker* marker) {
+ DCHECK(marker->type() == allowedMarkerType());
+ if (m_markersAreSorted && !m_markers.isEmpty() &&
+ m_markers.back()->endOffset() > marker->startOffset())
+ m_markersAreSorted = false;
+ m_markers.push_back(marker);
+}
+
+bool EditingMarkerList::markerListIsSorted() const {
+ return m_markersAreSorted;
+}
+
+DEFINE_TRACE(EditingMarkerList) {
+ visitor->trace(m_markers);
+ DocumentMarkerList::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698