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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DocumentMarkerController::DocumentMarkerController(Document& document) | 116 DocumentMarkerController::DocumentMarkerController(Document& document) |
117 : possibly_existing_marker_types_(0), document_(&document) { | 117 : possibly_existing_marker_types_(0), document_(&document) { |
118 SetContext(&document); | 118 SetContext(&document); |
119 } | 119 } |
120 | 120 |
121 void DocumentMarkerController::Clear() { | 121 void DocumentMarkerController::Clear() { |
122 markers_.clear(); | 122 markers_.clear(); |
123 possibly_existing_marker_types_ = 0; | 123 possibly_existing_marker_types_ = 0; |
124 } | 124 } |
125 | 125 |
126 void DocumentMarkerController::AddMarker(const Position& start, | 126 void DocumentMarkerController::AddSpellingMarker(const Position& start, |
127 const Position& end, | 127 const Position& end, |
128 DocumentMarker::MarkerType type, | 128 const String& description) { |
129 const String& description) { | 129 AddSpellCheckMarker(start, end, DocumentMarker::kSpelling, description); |
| 130 } |
| 131 |
| 132 void DocumentMarkerController::AddGrammarMarker(const Position& start, |
| 133 const Position& end, |
| 134 const String& description) { |
| 135 AddSpellCheckMarker(start, end, DocumentMarker::kGrammar, description); |
| 136 } |
| 137 |
| 138 void DocumentMarkerController::AddSpellCheckMarker( |
| 139 const Position& start, |
| 140 const Position& end, |
| 141 DocumentMarker::MarkerType type, |
| 142 const String& description) { |
| 143 DCHECK(type == DocumentMarker::kSpelling || type == DocumentMarker::kGrammar) |
| 144 << type; |
130 // Use a TextIterator to visit the potentially multiple nodes the range | 145 // Use a TextIterator to visit the potentially multiple nodes the range |
131 // covers. | 146 // covers. |
132 for (TextIterator marked_text(start, end); !marked_text.AtEnd(); | 147 for (TextIterator marked_text(start, end); !marked_text.AtEnd(); |
133 marked_text.Advance()) { | 148 marked_text.Advance()) { |
134 AddMarker(marked_text.CurrentContainer(), | 149 AddMarker(marked_text.CurrentContainer(), |
135 new DocumentMarker( | 150 new DocumentMarker( |
136 type, marked_text.StartOffsetInCurrentContainer(), | 151 type, marked_text.StartOffsetInCurrentContainer(), |
137 marked_text.EndOffsetInCurrentContainer(), description)); | 152 marked_text.EndOffsetInCurrentContainer(), description)); |
138 } | 153 } |
139 } | 154 } |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } | 747 } |
733 | 748 |
734 } // namespace blink | 749 } // namespace blink |
735 | 750 |
736 #ifndef NDEBUG | 751 #ifndef NDEBUG |
737 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { | 752 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { |
738 if (controller) | 753 if (controller) |
739 controller->ShowMarkers(); | 754 controller->ShowMarkers(); |
740 } | 755 } |
741 #endif | 756 #endif |
OLD | NEW |