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

Unified Diff: third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h

Issue 2829543002: [DMC #5] Add SpellCheckMarkerListImpl (Closed)
Patch Set: Remove comment about RemoveMarkersUnderWords() being SpellCheckMarkerListImpl-specific (it's not ye… Created 3 years, 7 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/SpellCheckMarkerListImpl.h
diff --git a/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h b/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..ff3de05d1391139db2c952726c3d1a0c40daf3cb
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef SpellCheckMarkerListImpl_h
+#define SpellCheckMarkerListImpl_h
+
+#include "core/editing/markers/DocumentMarkerList.h"
+
+namespace blink {
+
+// Implementation of DocumentMarkerList for Spelling/Grammar markers.
+// Markers with touching endpoints are merged on insert. Markers are kept sorted
+// by start offset in order to be able to do this efficiently.
+class CORE_EXPORT SpellCheckMarkerListImpl : public DocumentMarkerList {
+ public:
+ SpellCheckMarkerListImpl() = default;
+
+ // DocumentMarkerList implementations
+ bool IsEmpty() const final;
+
+ void Add(DocumentMarker*) final;
+ void Clear() final;
+
+ const HeapVector<Member<RenderedDocumentMarker>>& GetMarkers() const final;
+
+ bool MoveMarkers(int length, DocumentMarkerList* dst_list) final;
+ bool RemoveMarkers(unsigned start_offset, int length) final;
+ bool RemoveMarkersUnderWords(const String& node_text,
+ const Vector<String>& words);
+ bool ShiftMarkers(unsigned offset,
+ unsigned old_length,
+ unsigned new_length) final;
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ HeapVector<Member<RenderedDocumentMarker>> markers_;
+
+ DISALLOW_COPY_AND_ASSIGN(SpellCheckMarkerListImpl);
+};
+
+} // namespace blink
+
+#endif // SpellCheckMarkerListImpl_h

Powered by Google App Engine
This is Rietveld 408576698