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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/editing/markers/DocumentMarkerList.h"
6
7 #include "core/editing/markers/DocumentMarkerController.h"
8
9 namespace blink {
10
11 DocumentMarkerList::DocumentMarkerList(
12 DocumentMarkerController* documentMarkerController)
13 : m_documentMarkerController(documentMarkerController) {}
14
15 size_t DocumentMarkerList::size() const {
16 return m_markers.size();
17 }
18
19 bool DocumentMarkerList::empty() const {
20 return m_markers.isEmpty();
21 }
22
23 DocumentMarker* DocumentMarkerList::at(size_t index) {
24 return m_markers[index].get();
25 }
26
27 DocumentMarkerList::iterator DocumentMarkerList::begin() {
28 return m_markers.begin();
29 }
30
31 DocumentMarkerList::iterator DocumentMarkerList::end() {
32 return m_markers.end();
33 }
34
35 DocumentMarkerList::const_iterator DocumentMarkerList::begin() const {
36 return m_markers.begin();
37 }
38
39 DocumentMarkerList::const_iterator DocumentMarkerList::end() const {
40 return m_markers.end();
41 }
42
43 void DocumentMarkerList::appendMarkersToInputList(
44 DocumentMarkerVector* list) const {
45 for (Member<DocumentMarker> marker : m_markers) {
46 list->push_back(marker);
47 }
48 }
49
50 HeapVector<Member<DocumentMarker>>::iterator
51 DocumentMarkerList::getPosOfFirstMarkerNotEndingBefore(size_t startOffset) {
52 return std::upper_bound(m_markers.begin(), m_markers.end(), startOffset,
53 DocumentMarkerList::endsBefore);
54 }
55
56 bool DocumentMarkerList::endsBefore(size_t startOffset,
57 const Member<DocumentMarker>& rhv) {
58 return startOffset < rhv->endOffset();
59 }
60
61 DEFINE_TRACE(DocumentMarkerList) {
62 visitor->trace(m_documentMarkerController);
63 visitor->trace(m_markers);
64 }
65
66 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698