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

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

Issue 2829543002: [DMC #5] Add SpellCheckMarkerListImpl (Closed)
Patch Set: Don't update DocumentMarkerControllerTest in this CL Created 3 years, 8 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/GenericDocumentMarkerListImpl.h b/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h
similarity index 56%
copy from third_party/WebKit/Source/core/editing/markers/GenericDocumentMarkerListImpl.h
copy to third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h
index bd148c554746c436bdbb5c4e0cfd33f491b23bba..819b5e792cca26bb478e60554f1030ab5c80e341 100644
--- a/third_party/WebKit/Source/core/editing/markers/GenericDocumentMarkerListImpl.h
+++ b/third_party/WebKit/Source/core/editing/markers/SpellCheckMarkerListImpl.h
@@ -2,21 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef GenericDocumentMarkerListImpl_h
-#define GenericDocumentMarkerListImpl_h
+#ifndef SpellCheckMarkerListImpl_h
+#define SpellCheckMarkerListImpl_h
#include "core/editing/markers/DocumentMarkerList.h"
namespace blink {
-class RenderedDocumentMarker;
-
-// Temporary implementation of DocumentMarkerList that can handle
-// DocumentMarkers of all MarkerTypes. This will be removed once we have
-// specialized implementations for every MarkerType.
-class GenericDocumentMarkerListImpl final : public DocumentMarkerList {
+// 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:
- GenericDocumentMarkerListImpl() = default;
+ SpellCheckMarkerListImpl() = default;
// DocumentMarkerList implementations
bool IsEmpty() const final;
@@ -28,20 +26,22 @@ class GenericDocumentMarkerListImpl final : public DocumentMarkerList {
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) final;
bool ShiftMarkers(unsigned offset,
unsigned old_length,
unsigned new_length) final;
+ DECLARE_VIRTUAL_TRACE();
yosin_UTC9 2017/05/08 04:50:54 nit: Could you add a blank line before |DECLARE_VI
- DECLARE_TRACE();
+ // SpellCheckMarkerListImpl-specific
+ // Returns true if a marker was removed, false otherwise.
+ bool RemoveMarkersUnderWords(const String& node_text,
+ const Vector<String>& words);
private:
HeapVector<Member<RenderedDocumentMarker>> markers_;
- DISALLOW_COPY_AND_ASSIGN(GenericDocumentMarkerListImpl);
+ DISALLOW_COPY_AND_ASSIGN(SpellCheckMarkerListImpl);
};
} // namespace blink
-#endif // GenericDocumentMarkerListImpl_h
+#endif // SpellCheckMarkerListImpl_h

Powered by Google App Engine
This is Rietveld 408576698