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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class CORE_EXPORT DocumentMarkerController final | 47 class CORE_EXPORT DocumentMarkerController final |
48 : public GarbageCollected<DocumentMarkerController>, | 48 : public GarbageCollected<DocumentMarkerController>, |
49 public SynchronousMutationObserver { | 49 public SynchronousMutationObserver { |
50 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); | 50 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); |
51 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); | 51 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); |
52 | 52 |
53 public: | 53 public: |
54 explicit DocumentMarkerController(Document&); | 54 explicit DocumentMarkerController(Document&); |
55 | 55 |
56 void Clear(); | 56 void Clear(); |
57 void AddMarker(const Position& start, | 57 void AddSpellingMarker(const Position& start, |
58 const Position& end, | 58 const Position& end, |
59 DocumentMarker::MarkerType, | 59 const String& description = g_empty_string); |
60 const String& description = g_empty_string); | 60 void AddGrammarMarker(const Position& start, |
| 61 const Position& end, |
| 62 const String& description = g_empty_string); |
61 void AddTextMatchMarker(const EphemeralRange&, DocumentMarker::MatchStatus); | 63 void AddTextMatchMarker(const EphemeralRange&, DocumentMarker::MatchStatus); |
62 void AddCompositionMarker(const Position& start, | 64 void AddCompositionMarker(const Position& start, |
63 const Position& end, | 65 const Position& end, |
64 Color underline_color, | 66 Color underline_color, |
65 bool thick, | 67 bool thick, |
66 Color background_color); | 68 Color background_color); |
67 | 69 |
68 void MoveMarkers(Node* src_node, int length, Node* dst_node); | 70 void MoveMarkers(Node* src_node, int length, Node* dst_node); |
69 | 71 |
70 void PrepareForDestruction(); | 72 void PrepareForDestruction(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #endif | 108 #endif |
107 | 109 |
108 // SynchronousMutationObserver | 110 // SynchronousMutationObserver |
109 void DidUpdateCharacterData(CharacterData*, | 111 void DidUpdateCharacterData(CharacterData*, |
110 unsigned offset, | 112 unsigned offset, |
111 unsigned old_length, | 113 unsigned old_length, |
112 unsigned new_length) final; | 114 unsigned new_length) final; |
113 | 115 |
114 private: | 116 private: |
115 void AddMarker(Node*, DocumentMarker*); | 117 void AddMarker(Node*, DocumentMarker*); |
| 118 void AddSpellCheckMarker(const Position& start, |
| 119 const Position& end, |
| 120 DocumentMarker::MarkerType, |
| 121 const String& description = g_empty_string); |
116 | 122 |
117 using MarkerLists = HeapVector<Member<DocumentMarkerList>, | 123 using MarkerLists = HeapVector<Member<DocumentMarkerList>, |
118 DocumentMarker::kMarkerTypeIndexesCount>; | 124 DocumentMarker::kMarkerTypeIndexesCount>; |
119 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; | 125 using MarkerMap = HeapHashMap<WeakMember<const Node>, Member<MarkerLists>>; |
120 static Member<DocumentMarkerList>& ListForType(MarkerLists*, | 126 static Member<DocumentMarkerList>& ListForType(MarkerLists*, |
121 DocumentMarker::MarkerType); | 127 DocumentMarker::MarkerType); |
122 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); | 128 bool PossiblyHasMarkers(DocumentMarker::MarkerTypes); |
123 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); | 129 void RemoveMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes); |
124 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); | 130 void RemoveMarkers(TextIterator&, DocumentMarker::MarkerTypes); |
125 void RemoveMarkersInternal(Node*, | 131 void RemoveMarkersInternal(Node*, |
126 unsigned start_offset, | 132 unsigned start_offset, |
127 int length, | 133 int length, |
128 DocumentMarker::MarkerTypes); | 134 DocumentMarker::MarkerTypes); |
129 | 135 |
130 MarkerMap markers_; | 136 MarkerMap markers_; |
131 // Provide a quick way to determine whether a particular marker type is absent | 137 // Provide a quick way to determine whether a particular marker type is absent |
132 // without going through the map. | 138 // without going through the map. |
133 DocumentMarker::MarkerTypes possibly_existing_marker_types_; | 139 DocumentMarker::MarkerTypes possibly_existing_marker_types_; |
134 const Member<const Document> document_; | 140 const Member<const Document> document_; |
135 }; | 141 }; |
136 | 142 |
137 } // namespace blink | 143 } // namespace blink |
138 | 144 |
139 #ifndef NDEBUG | 145 #ifndef NDEBUG |
140 void showDocumentMarkers(const blink::DocumentMarkerController*); | 146 void showDocumentMarkers(const blink::DocumentMarkerController*); |
141 #endif | 147 #endif |
142 | 148 |
143 #endif // DocumentMarkerController_h | 149 #endif // DocumentMarkerController_h |
OLD | NEW |