Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h |
| diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h |
| index 060c6b305b1149c465c58af5e5a460c015493c06..cc077b126556666a738c97c23694641ab32fb39f 100644 |
| --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h |
| +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h |
| @@ -40,21 +40,22 @@ |
| namespace blink { |
| +class CompositionMarkerList; |
| +class DocumentMarkerList; |
| +class GrammarMarkerList; |
| class Node; |
| -class RenderedDocumentMarker; |
| -class Text; |
| +class RenderedTextMatchMarker; |
| +class SpellingMarkerList; |
| +class TextMatchMarkerList; |
| class MarkerRemoverPredicate final { |
| public: |
| explicit MarkerRemoverPredicate(const Vector<String>& words); |
| - bool operator()(const DocumentMarker&, const Text&) const; |
| - |
| - private: |
| Vector<String> m_words; |
| }; |
| class CORE_EXPORT DocumentMarkerController final |
| - : public GarbageCollected<DocumentMarkerController>, |
| + : public GarbageCollectedFinalized<DocumentMarkerController>, |
| public SynchronousMutationObserver { |
| WTF_MAKE_NONCOPYABLE(DocumentMarkerController); |
| USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); |
| @@ -63,6 +64,7 @@ class CORE_EXPORT DocumentMarkerController final |
| explicit DocumentMarkerController(Document&); |
| void clear(); |
| + void addMarker(Node*, DocumentMarker*); |
| void addMarker(const Position& start, |
| const Position& end, |
| DocumentMarker::MarkerType, |
| @@ -111,9 +113,9 @@ class CORE_EXPORT DocumentMarkerController final |
| // Returns true if markers within a range are found. |
| bool setMarkersActive(const EphemeralRange&, bool); |
| // Returns true if markers within a range defined by a node, |startOffset| and |
| - // |endOffset| are found. |
| + // |endOffset| are found |
| bool setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool); |
| - bool hasMarkers(Node* node) const { return m_markers.contains(node); } |
| + bool hasMarkers(Node*) const; |
| DocumentMarkerVector markersFor( |
| Node*, |
| @@ -121,10 +123,11 @@ class CORE_EXPORT DocumentMarkerController final |
| DocumentMarkerVector markersInRange(const EphemeralRange&, |
| DocumentMarker::MarkerTypes); |
| DocumentMarkerVector markers(); |
| - Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); |
|
Xiaocheng
2017/03/17 23:56:33
Please do not change the signature of this functio
rlanday
2017/03/18 01:12:27
I can do that, but then the method will just have
Xiaocheng
2017/03/18 01:58:08
That's exactly what I mean.
Or we can first uploa
|
| - void updateMarkerRenderedRectIfNeeded(const Node&, RenderedDocumentMarker&); |
| + Vector<IntRect> renderedRectsForMarkers(); |
| + void updateTextMatchMarkerRenderedRectIfNeeded(const Node&, |
| + RenderedTextMatchMarker&); |
| void invalidateRectsForAllMarkers(); |
| - void invalidateRectsForMarkersInNode(const Node&); |
| + void invalidateRectsForMarkersInNode(Node&); |
| DECLARE_TRACE(); |
| @@ -139,23 +142,21 @@ class CORE_EXPORT DocumentMarkerController final |
| unsigned newLength) final; |
| private: |
| - void addMarker(Node*, const DocumentMarker&); |
| - |
| - using MarkerList = HeapVector<Member<RenderedDocumentMarker>>; |
| - using MarkerLists = |
| - HeapVector<Member<MarkerList>, DocumentMarker::MarkerTypeIndexesCount>; |
| - using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; |
| - void mergeOverlapping(MarkerList*, RenderedDocumentMarker*); |
| - bool possiblyHasMarkers(DocumentMarker::MarkerTypes); |
| - void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); |
| + HeapVector<Member<DocumentMarkerList>> getMarkerListsForNode( |
| + Node*, |
| + DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); |
| void removeMarkers(TextIterator&, |
| DocumentMarker::MarkerTypes, |
| RemovePartiallyOverlappingMarkerOrNot); |
| - MarkerMap m_markers; |
| - // Provide a quick way to determine whether a particular marker type is absent |
| - // without going through the map. |
| - DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; |
| + template <typename MarkerListType> |
| + using MarkerMap = HeapHashMap<WeakMember<Node>, Member<MarkerListType>>; |
| + |
| + MarkerMap<SpellingMarkerList> m_spelling; |
| + MarkerMap<GrammarMarkerList> m_grammar; |
| + MarkerMap<TextMatchMarkerList> m_textMatches; |
| + MarkerMap<CompositionMarkerList> m_compositions; |
| + |
| const Member<const Document> m_document; |
| }; |