OLD | NEW |
(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/EditingMarkerList.h" |
| 6 |
| 7 #include <algorithm> |
| 8 #include "core/editing/markers/DocumentMarkerController.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 EditingMarkerList::EditingMarkerList() : m_markersAreSorted(true) {} |
| 13 |
| 14 bool EditingMarkerList::isEditingMarkerList() const { |
| 15 return true; |
| 16 } |
| 17 |
| 18 void EditingMarkerList::push_back(DocumentMarker* marker) { |
| 19 DCHECK(marker->type() == allowedMarkerType()); |
| 20 if (m_markersAreSorted && !m_markers.isEmpty() && |
| 21 m_markers.back()->endOffset() > marker->startOffset()) |
| 22 m_markersAreSorted = false; |
| 23 m_markers.push_back(marker); |
| 24 } |
| 25 |
| 26 void EditingMarkerList::clear() { |
| 27 m_markersAreSorted = true; |
| 28 DocumentMarkerList::clear(); |
| 29 } |
| 30 |
| 31 bool EditingMarkerList::markerListIsSorted() const { |
| 32 return m_markersAreSorted; |
| 33 } |
| 34 |
| 35 DEFINE_TRACE(EditingMarkerList) { |
| 36 visitor->trace(m_markers); |
| 37 DocumentMarkerList::trace(visitor); |
| 38 } |
| 39 |
| 40 } // namespace blink |
OLD | NEW |