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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include <algorithm> | 31 #include <algorithm> |
32 #include "core/dom/Node.h" | 32 #include "core/dom/Node.h" |
33 #include "core/dom/NodeTraversal.h" | 33 #include "core/dom/NodeTraversal.h" |
34 #include "core/dom/Text.h" | 34 #include "core/dom/Text.h" |
35 #include "core/editing/VisibleUnits.h" | 35 #include "core/editing/VisibleUnits.h" |
36 #include "core/editing/iterators/TextIterator.h" | 36 #include "core/editing/iterators/TextIterator.h" |
37 #include "core/editing/markers/CompositionMarker.h" | 37 #include "core/editing/markers/CompositionMarker.h" |
38 #include "core/editing/markers/CompositionMarkerListImpl.h" | 38 #include "core/editing/markers/CompositionMarkerListImpl.h" |
39 #include "core/editing/markers/DocumentMarkerListEditor.h" | 39 #include "core/editing/markers/DocumentMarkerListEditor.h" |
| 40 #include "core/editing/markers/GrammarMarker.h" |
40 #include "core/editing/markers/GrammarMarkerListImpl.h" | 41 #include "core/editing/markers/GrammarMarkerListImpl.h" |
| 42 #include "core/editing/markers/SpellingMarker.h" |
41 #include "core/editing/markers/SpellingMarkerListImpl.h" | 43 #include "core/editing/markers/SpellingMarkerListImpl.h" |
42 #include "core/editing/markers/TextMatchMarker.h" | 44 #include "core/editing/markers/TextMatchMarker.h" |
43 #include "core/editing/markers/TextMatchMarkerListImpl.h" | 45 #include "core/editing/markers/TextMatchMarkerListImpl.h" |
44 #include "core/frame/LocalFrameView.h" | 46 #include "core/frame/LocalFrameView.h" |
45 #include "core/layout/LayoutObject.h" | 47 #include "core/layout/LayoutObject.h" |
46 | 48 |
47 #ifndef NDEBUG | 49 #ifndef NDEBUG |
48 #include <stdio.h> | 50 #include <stdio.h> |
49 #endif | 51 #endif |
50 | 52 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 SetContext(&document); | 120 SetContext(&document); |
119 } | 121 } |
120 | 122 |
121 void DocumentMarkerController::Clear() { | 123 void DocumentMarkerController::Clear() { |
122 markers_.clear(); | 124 markers_.clear(); |
123 possibly_existing_marker_types_ = 0; | 125 possibly_existing_marker_types_ = 0; |
124 } | 126 } |
125 | 127 |
126 void DocumentMarkerController::AddSpellingMarker(const EphemeralRange& range, | 128 void DocumentMarkerController::AddSpellingMarker(const EphemeralRange& range, |
127 const String& description) { | 129 const String& description) { |
128 AddSpellCheckMarker(range, DocumentMarker::kSpelling, description); | 130 AddMarkerInternal(range, [&description](int start_offset, int end_offset) { |
| 131 return new SpellingMarker(start_offset, end_offset, description); |
| 132 }); |
129 } | 133 } |
130 | 134 |
131 void DocumentMarkerController::AddGrammarMarker(const EphemeralRange& range, | 135 void DocumentMarkerController::AddGrammarMarker(const EphemeralRange& range, |
132 const String& description) { | 136 const String& description) { |
133 AddSpellCheckMarker(range, DocumentMarker::kGrammar, description); | 137 AddMarkerInternal(range, [&description](int start_offset, int end_offset) { |
134 } | 138 return new GrammarMarker(start_offset, end_offset, description); |
135 | 139 }); |
136 void DocumentMarkerController::AddSpellCheckMarker( | |
137 const EphemeralRange& range, | |
138 DocumentMarker::MarkerType type, | |
139 const String& description) { | |
140 DCHECK(type == DocumentMarker::kSpelling || type == DocumentMarker::kGrammar) | |
141 << type; | |
142 AddMarkerInternal( | |
143 range, [type, &description](int start_offset, int end_offset) { | |
144 return new DocumentMarker(type, start_offset, end_offset, description); | |
145 }); | |
146 } | 140 } |
147 | 141 |
148 void DocumentMarkerController::AddTextMatchMarker( | 142 void DocumentMarkerController::AddTextMatchMarker( |
149 const EphemeralRange& range, | 143 const EphemeralRange& range, |
150 TextMatchMarker::MatchStatus match_status) { | 144 TextMatchMarker::MatchStatus match_status) { |
151 DCHECK(!document_->NeedsLayoutTreeUpdate()); | 145 DCHECK(!document_->NeedsLayoutTreeUpdate()); |
152 AddMarkerInternal(range, [match_status](int start_offset, int end_offset) { | 146 AddMarkerInternal(range, [match_status](int start_offset, int end_offset) { |
153 return new TextMatchMarker(start_offset, end_offset, match_status); | 147 return new TextMatchMarker(start_offset, end_offset, match_status); |
154 }); | 148 }); |
155 // Don't invalidate tickmarks here. TextFinder invalidates tickmarks using a | 149 // Don't invalidate tickmarks here. TextFinder invalidates tickmarks using a |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 713 } |
720 | 714 |
721 } // namespace blink | 715 } // namespace blink |
722 | 716 |
723 #ifndef NDEBUG | 717 #ifndef NDEBUG |
724 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { | 718 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { |
725 if (controller) | 719 if (controller) |
726 controller->ShowMarkers(); | 720 controller->ShowMarkers(); |
727 } | 721 } |
728 #endif | 722 #endif |
OLD | NEW |