Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Side by Side Diff: Source/core/editing/markers/DocumentMarkerController.cpp

Issue 1325563002: Avoid style clobbering in setCompositionFromExistingText. (2nd land) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Release Range on document detach and remove selectionStart/End Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 { 62 {
63 switch (type) { 63 switch (type) {
64 case DocumentMarker::Spelling: 64 case DocumentMarker::Spelling:
65 return DocumentMarker::SpellingMarkerIndex; 65 return DocumentMarker::SpellingMarkerIndex;
66 case DocumentMarker::Grammar: 66 case DocumentMarker::Grammar:
67 return DocumentMarker::GramarMarkerIndex; 67 return DocumentMarker::GramarMarkerIndex;
68 case DocumentMarker::TextMatch: 68 case DocumentMarker::TextMatch:
69 return DocumentMarker::TextMatchMarkerIndex; 69 return DocumentMarker::TextMatchMarkerIndex;
70 case DocumentMarker::InvisibleSpellcheck: 70 case DocumentMarker::InvisibleSpellcheck:
71 return DocumentMarker::InvisibleSpellcheckMarkerIndex; 71 return DocumentMarker::InvisibleSpellcheckMarkerIndex;
72 case DocumentMarker::Composition:
73 return DocumentMarker::CompositionMarkerIndex;
72 } 74 }
73 75
74 ASSERT_NOT_REACHED(); 76 ASSERT_NOT_REACHED();
75 return DocumentMarker::SpellingMarkerIndex; 77 return DocumentMarker::SpellingMarkerIndex;
76 } 78 }
77 79
78 } // namespace 80 } // namespace
79 81
80 inline bool DocumentMarkerController::possiblyHasMarkers(DocumentMarker::MarkerT ypes types) 82 inline bool DocumentMarkerController::possiblyHasMarkers(DocumentMarker::MarkerT ypes types)
81 { 83 {
(...skipping 22 matching lines...) Expand all
104 } 106 }
105 107
106 void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activ eMatch) 108 void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activ eMatch)
107 { 109 {
108 // Use a TextIterator to visit the potentially multiple nodes the range cove rs. 110 // Use a TextIterator to visit the potentially multiple nodes the range cove rs.
109 for (TextIterator markedText(range->startPosition(), range->endPosition()); !markedText.atEnd(); markedText.advance()) 111 for (TextIterator markedText(range->startPosition(), range->endPosition()); !markedText.atEnd(); markedText.advance())
110 addMarker(markedText.currentContainer(), DocumentMarker(markedText.start OffsetInCurrentContainer(), markedText.endOffsetInCurrentContainer(), activeMatc h)); 112 addMarker(markedText.currentContainer(), DocumentMarker(markedText.start OffsetInCurrentContainer(), markedText.endOffsetInCurrentContainer(), activeMatc h));
111 // Don't invalidate tickmarks here. TextFinder invalidates tickmarks using a throttling algorithm. crbug.com/6819. 113 // Don't invalidate tickmarks here. TextFinder invalidates tickmarks using a throttling algorithm. crbug.com/6819.
112 } 114 }
113 115
116 void DocumentMarkerController::addCompositionMarker(const Position& start, const Position& end, Color underlineColor, bool thick, Color backgroundColor)
117 {
118 for (TextIterator markedText(start, end); !markedText.atEnd(); markedText.ad vance())
119 addMarker(markedText.currentContainer(), DocumentMarker(markedText.start OffsetInCurrentContainer(), markedText.endOffsetInCurrentContainer(), underlineC olor, thick, backgroundColor));
120 }
121
114 void DocumentMarkerController::prepareForDestruction() 122 void DocumentMarkerController::prepareForDestruction()
115 { 123 {
116 clear(); 124 clear();
117 } 125 }
118 126
119 void DocumentMarkerController::removeMarkers(TextIterator& markedText, DocumentM arker::MarkerTypes markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemo vePartiallyOverlappingMarker) 127 void DocumentMarkerController::removeMarkers(TextIterator& markedText, DocumentM arker::MarkerTypes markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemo vePartiallyOverlappingMarker)
120 { 128 {
121 for (; !markedText.atEnd(); markedText.advance()) { 129 for (; !markedText.atEnd(); markedText.advance()) {
122 if (!possiblyHasMarkers(markerTypes)) 130 if (!possiblyHasMarkers(markerTypes))
123 return; 131 return;
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 742
735 } // namespace blink 743 } // namespace blink
736 744
737 #ifndef NDEBUG 745 #ifndef NDEBUG
738 void showDocumentMarkers(const blink::DocumentMarkerController* controller) 746 void showDocumentMarkers(const blink::DocumentMarkerController* controller)
739 { 747 {
740 if (controller) 748 if (controller)
741 controller->showMarkers(); 749 controller->showMarkers();
742 } 750 }
743 #endif 751 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/markers/DocumentMarkerController.h ('k') | Source/core/editing/markers/DocumentMarkerControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698