OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
7 * reserved. | 7 * reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "platform/geometry/IntRect.h" | 36 #include "platform/geometry/IntRect.h" |
37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
38 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class DocumentMarkerList; | 43 class DocumentMarkerList; |
44 class Node; | 44 class Node; |
45 | 45 |
46 class MarkerRemoverPredicate final { | |
47 public: | |
48 explicit MarkerRemoverPredicate(const Vector<String>& words); | |
49 bool operator()(const DocumentMarker&, const Text&) const; | |
50 | |
51 Vector<String> m_words; | |
52 }; | |
53 | |
54 class CORE_EXPORT DocumentMarkerController final | 46 class CORE_EXPORT DocumentMarkerController final |
55 : public GarbageCollected<DocumentMarkerController>, | 47 : public GarbageCollected<DocumentMarkerController>, |
56 public SynchronousMutationObserver { | 48 public SynchronousMutationObserver { |
57 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); | 49 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); |
58 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); | 50 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); |
59 | 51 |
60 public: | 52 public: |
61 explicit DocumentMarkerController(Document&); | 53 explicit DocumentMarkerController(Document&); |
62 | 54 |
63 void clear(); | 55 void clear(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 int length, | 89 int length, |
98 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(), | 90 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(), |
99 RemovePartiallyOverlappingMarkerOrNot = | 91 RemovePartiallyOverlappingMarkerOrNot = |
100 DoNotRemovePartiallyOverlappingMarker); | 92 DoNotRemovePartiallyOverlappingMarker); |
101 | 93 |
102 void removeMarkers( | 94 void removeMarkers( |
103 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); | 95 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); |
104 void removeMarkers( | 96 void removeMarkers( |
105 Node*, | 97 Node*, |
106 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); | 98 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); |
107 void removeMarkers(const MarkerRemoverPredicate& shouldRemoveMarker); | 99 void removeSpellingMarkersForWords(const Vector<String>& words); |
108 void repaintMarkers( | 100 void repaintMarkers( |
109 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); | 101 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); |
110 // Returns true if markers within a range are found. | 102 // Returns true if markers within a range are found. |
111 bool setMarkersActive(const EphemeralRange&, bool); | 103 bool setTextMatchMarkersActive(const EphemeralRange&, bool); |
112 // Returns true if markers within a range defined by a node, |startOffset| and | 104 // Returns true if markers within a range defined by a node, |startOffset| and |
113 // |endOffset| are found. | 105 // |endOffset| are found. |
114 bool setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool); | 106 bool setTextMatchMarkersActive(Node*, |
| 107 unsigned startOffset, |
| 108 unsigned endOffset, |
| 109 bool); |
115 bool hasMarkers(Node*) const; | 110 bool hasMarkers(Node*) const; |
116 | 111 |
117 DocumentMarkerVector markersFor( | 112 DocumentMarkerVector markersFor( |
118 Node*, | 113 Node*, |
119 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); | 114 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); |
120 DocumentMarkerVector markersInRange(const EphemeralRange&, | 115 DocumentMarkerVector markersInRange(const EphemeralRange&, |
121 DocumentMarker::MarkerTypes); | 116 DocumentMarker::MarkerTypes); |
122 DocumentMarkerVector markers(); | 117 DocumentMarkerVector markers(); |
123 Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); | 118 Vector<IntRect> renderedRectsForTextMatchMarkers(); |
124 | 119 |
125 void invalidateRectsForAllMarkers(); | 120 void invalidateRectsForAllTextMatchMarkers(); |
126 void invalidateRectsForMarkersInNode(Node&); | 121 void invalidateRectsForTextMatchMarkersInNode(Node&); |
127 | 122 |
128 DECLARE_TRACE(); | 123 DECLARE_TRACE(); |
129 | 124 |
130 #ifndef NDEBUG | 125 #ifndef NDEBUG |
131 void showMarkers() const; | 126 void showMarkers() const; |
132 #endif | 127 #endif |
133 | 128 |
134 // SynchronousMutationObserver | 129 // SynchronousMutationObserver |
135 void didUpdateCharacterData(CharacterData*, | 130 void didUpdateCharacterData(CharacterData*, |
136 unsigned offset, | 131 unsigned offset, |
(...skipping 21 matching lines...) Expand all Loading... |
158 const Member<const Document> m_document; | 153 const Member<const Document> m_document; |
159 }; | 154 }; |
160 | 155 |
161 } // namespace blink | 156 } // namespace blink |
162 | 157 |
163 #ifndef NDEBUG | 158 #ifndef NDEBUG |
164 void showDocumentMarkers(const blink::DocumentMarkerController*); | 159 void showDocumentMarkers(const blink::DocumentMarkerController*); |
165 #endif | 160 #endif |
166 | 161 |
167 #endif // DocumentMarkerController_h | 162 #endif // DocumentMarkerController_h |
OLD | NEW |