Chromium Code Reviews| 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); | |
|
yosin_UTC9
2017/05/23 09:35:04
nit: s/);/) << type;/
| |
| 130 // Use a TextIterator to visit the potentially multiple nodes the range | 144 // Use a TextIterator to visit the potentially multiple nodes the range |
| 131 // covers. | 145 // covers. |
| 132 for (TextIterator marked_text(start, end); !marked_text.AtEnd(); | 146 for (TextIterator marked_text(start, end); !marked_text.AtEnd(); |
| 133 marked_text.Advance()) { | 147 marked_text.Advance()) { |
| 134 AddMarker(marked_text.CurrentContainer(), | 148 AddMarker(marked_text.CurrentContainer(), |
| 135 new DocumentMarker( | 149 new DocumentMarker( |
| 136 type, marked_text.StartOffsetInCurrentContainer(), | 150 type, marked_text.StartOffsetInCurrentContainer(), |
| 137 marked_text.EndOffsetInCurrentContainer(), description)); | 151 marked_text.EndOffsetInCurrentContainer(), description)); |
| 138 } | 152 } |
| 139 } | 153 } |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 } | 746 } |
| 733 | 747 |
| 734 } // namespace blink | 748 } // namespace blink |
| 735 | 749 |
| 736 #ifndef NDEBUG | 750 #ifndef NDEBUG |
| 737 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { | 751 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { |
| 738 if (controller) | 752 if (controller) |
| 739 controller->ShowMarkers(); | 753 controller->ShowMarkers(); |
| 740 } | 754 } |
| 741 #endif | 755 #endif |
| OLD | NEW |