Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c481e603ede118481a2b4f49b04c0192eead234b |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/editing/markers/CompositionMarkerListImpl.cpp |
| @@ -0,0 +1,63 @@ |
| +// 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/CompositionMarkerListImpl.h" |
| + |
| +#include "core/editing/markers/DocumentMarkerListEditor.h" |
| +#include "core/editing/markers/RenderedDocumentMarker.h" |
| + |
| +namespace blink { |
| + |
| +bool CompositionMarkerListImpl::IsEmpty() const { |
| + return markers_.IsEmpty(); |
| +} |
| + |
| +void CompositionMarkerListImpl::Add(DocumentMarker* marker) { |
| + DocumentMarkerListEditor::AddMarkerWithoutMergingOverlapping(&markers_, |
| + marker); |
| +} |
| + |
| +void CompositionMarkerListImpl::Clear() { |
| + markers_.clear(); |
| +} |
| + |
| +const HeapVector<Member<RenderedDocumentMarker>>& |
| +CompositionMarkerListImpl::GetMarkers() const { |
| + return markers_; |
| +} |
| + |
| +bool CompositionMarkerListImpl::MoveMarkers(int length, |
| + DocumentMarkerList* dst_markers_) { |
| + return DocumentMarkerListEditor::MoveMarkers(&markers_, length, dst_markers_); |
| +} |
| + |
| +bool CompositionMarkerListImpl::RemoveMarkers(unsigned start_offset, |
| + int length) { |
| + return DocumentMarkerListEditor::RemoveMarkers(&markers_, start_offset, |
| + length); |
| +} |
| + |
| +bool CompositionMarkerListImpl::RemoveMarkersUnderWords( |
| + const String& node_text, |
| + const Vector<String>& words) { |
| + // This method will be removed from the DocumentMarkerList interface once |
| + // TextMatchMarkerListImpl is added. DocumentMarkerController shouldn't try to |
|
Xiaocheng
2017/04/28 18:13:12
nit: s/TextMatch/SpellCheck/
|
| + // call it on a list storing Composition markers. |
| + NOTREACHED(); |
| + return false; |
| +} |
| + |
| +bool CompositionMarkerListImpl::ShiftMarkers(unsigned offset, |
| + unsigned old_length, |
| + unsigned new_length) { |
| + return DocumentMarkerListEditor::ShiftMarkers(&markers_, offset, old_length, |
| + new_length); |
| +} |
| + |
| +DEFINE_TRACE(CompositionMarkerListImpl) { |
| + visitor->Trace(markers_); |
| + DocumentMarkerList::Trace(visitor); |
| +} |
| + |
| +} // namespace blink |