| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 setContext(&document); | 55 setContext(&document); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void DocumentMarkerController::clear() { | 58 void DocumentMarkerController::clear() { |
| 59 for (DocumentMarker::MarkerType type : DocumentMarker::AllMarkers()) { | 59 for (DocumentMarker::MarkerType type : DocumentMarker::AllMarkers()) { |
| 60 MarkerMap& markerMap = markerMapForType(type); | 60 MarkerMap& markerMap = markerMapForType(type); |
| 61 markerMap.clear(); | 61 markerMap.clear(); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DocumentMarkerController::addMarker(const Position& start, | 65 void DocumentMarkerController::addGrammarOrSpellingMarker( |
| 66 const Position& end, | 66 const Position& start, |
| 67 DocumentMarker::MarkerType type, | 67 const Position& end, |
| 68 const String& description) { | 68 DocumentMarker::MarkerType type, |
| 69 const String& description) { |
| 70 DCHECK(!m_document->needsLayoutTreeUpdate()); |
| 71 DCHECK(type == DocumentMarker::Grammar || type == DocumentMarker::Spelling) |
| 72 << type; |
| 69 // Use a TextIterator to visit the potentially multiple nodes the range | 73 // Use a TextIterator to visit the potentially multiple nodes the range |
| 70 // covers. | 74 // covers. |
| 71 for (TextIterator markedText(start, end); !markedText.atEnd(); | 75 for (TextIterator markedText(start, end); !markedText.atEnd(); |
| 72 markedText.advance()) { | 76 markedText.advance()) { |
| 73 addMarker(markedText.currentContainer(), | 77 addMarker(markedText.currentContainer(), |
| 74 new SpellCheckMarker( | 78 new SpellCheckMarker( |
| 75 type, markedText.startOffsetInCurrentContainer(), | 79 type, markedText.startOffsetInCurrentContainer(), |
| 76 markedText.endOffsetInCurrentContainer(), description)); | 80 markedText.endOffsetInCurrentContainer(), description)); |
| 77 } | 81 } |
| 78 } | 82 } |
| 79 | 83 |
| 84 void DocumentMarkerController::addSpellingMarker(const Position& start, |
| 85 const Position& end, |
| 86 const String& description) { |
| 87 addGrammarOrSpellingMarker(start, end, DocumentMarker::Spelling, description); |
| 88 } |
| 89 |
| 90 void DocumentMarkerController::addGrammarMarker(const Position& start, |
| 91 const Position& end, |
| 92 const String& description) { |
| 93 addGrammarOrSpellingMarker(start, end, DocumentMarker::Grammar, description); |
| 94 } |
| 95 |
| 80 void DocumentMarkerController::addTextMatchMarker(const EphemeralRange& range, | 96 void DocumentMarkerController::addTextMatchMarker(const EphemeralRange& range, |
| 81 bool activeMatch) { | 97 bool activeMatch) { |
| 82 DCHECK(!m_document->needsLayoutTreeUpdate()); | 98 DCHECK(!m_document->needsLayoutTreeUpdate()); |
| 83 | 99 |
| 84 // Use a TextIterator to visit the potentially multiple nodes the range | 100 // Use a TextIterator to visit the potentially multiple nodes the range |
| 85 // covers. | 101 // covers. |
| 86 for (TextIterator markedText(range.startPosition(), range.endPosition()); | 102 for (TextIterator markedText(range.startPosition(), range.endPosition()); |
| 87 !markedText.atEnd(); markedText.advance()) { | 103 !markedText.atEnd(); markedText.advance()) { |
| 88 addMarker(markedText.currentContainer(), | 104 addMarker(markedText.currentContainer(), |
| 89 new TextMatchMarker(markedText.startOffsetInCurrentContainer(), | 105 new TextMatchMarker(markedText.startOffsetInCurrentContainer(), |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } | 605 } |
| 590 | 606 |
| 591 } // namespace blink | 607 } // namespace blink |
| 592 | 608 |
| 593 #ifndef NDEBUG | 609 #ifndef NDEBUG |
| 594 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { | 610 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { |
| 595 if (controller) | 611 if (controller) |
| 596 controller->showMarkers(); | 612 controller->showMarkers(); |
| 597 } | 613 } |
| 598 #endif | 614 #endif |
| OLD | NEW |