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

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

Issue 2723663002: Refactor DocumentMarkerController (Closed)
Patch Set: Use correct base commit 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.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..46e81e3005020727da6fcfe73e7ef86d4ad10ee8
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerList.cpp
@@ -0,0 +1,66 @@
+// 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/DocumentMarkerList.h"
+
+#include "core/editing/markers/DocumentMarkerController.h"
+
+namespace blink {
+
+DocumentMarkerList::DocumentMarkerList(
+ DocumentMarkerController* documentMarkerController)
+ : m_documentMarkerController(documentMarkerController) {}
+
+size_t DocumentMarkerList::size() const {
+ return m_markers.size();
+}
+
+bool DocumentMarkerList::empty() const {
+ return m_markers.isEmpty();
+}
+
+DocumentMarker* DocumentMarkerList::at(size_t index) {
+ return m_markers[index].get();
+}
+
+DocumentMarkerList::iterator DocumentMarkerList::begin() {
+ return m_markers.begin();
+}
+
+DocumentMarkerList::iterator DocumentMarkerList::end() {
+ return m_markers.end();
+}
+
+DocumentMarkerList::const_iterator DocumentMarkerList::begin() const {
+ return m_markers.begin();
+}
+
+DocumentMarkerList::const_iterator DocumentMarkerList::end() const {
+ return m_markers.end();
+}
+
+void DocumentMarkerList::appendMarkersToInputList(
+ DocumentMarkerVector* list) const {
+ for (Member<DocumentMarker> marker : m_markers) {
+ list->push_back(marker);
+ }
+}
+
+HeapVector<Member<DocumentMarker>>::iterator
+DocumentMarkerList::getPosOfFirstMarkerNotEndingBefore(size_t startOffset) {
+ return std::upper_bound(m_markers.begin(), m_markers.end(), startOffset,
+ DocumentMarkerList::endsBefore);
+}
+
+bool DocumentMarkerList::endsBefore(size_t startOffset,
+ const Member<DocumentMarker>& rhv) {
+ return startOffset < rhv->endOffset();
+}
+
+DEFINE_TRACE(DocumentMarkerList) {
+ visitor->trace(m_documentMarkerController);
+ visitor->trace(m_markers);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698