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

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

Issue 1330233003: Revert of Avoid style clobbering in setCompositionFromExistingText. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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;
74 } 72 }
75 73
76 ASSERT_NOT_REACHED(); 74 ASSERT_NOT_REACHED();
77 return DocumentMarker::SpellingMarkerIndex; 75 return DocumentMarker::SpellingMarkerIndex;
78 } 76 }
79 77
80 } // namespace 78 } // namespace
81 79
82 inline bool DocumentMarkerController::possiblyHasMarkers(DocumentMarker::MarkerT ypes types) 80 inline bool DocumentMarkerController::possiblyHasMarkers(DocumentMarker::MarkerT ypes types)
83 { 81 {
(...skipping 22 matching lines...) Expand all
106 } 104 }
107 105
108 void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activ eMatch) 106 void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activ eMatch)
109 { 107 {
110 // Use a TextIterator to visit the potentially multiple nodes the range cove rs. 108 // Use a TextIterator to visit the potentially multiple nodes the range cove rs.
111 for (TextIterator markedText(range->startPosition(), range->endPosition()); !markedText.atEnd(); markedText.advance()) 109 for (TextIterator markedText(range->startPosition(), range->endPosition()); !markedText.atEnd(); markedText.advance())
112 addMarker(markedText.currentContainer(), DocumentMarker(markedText.start OffsetInCurrentContainer(), markedText.endOffsetInCurrentContainer(), activeMatc h)); 110 addMarker(markedText.currentContainer(), DocumentMarker(markedText.start OffsetInCurrentContainer(), markedText.endOffsetInCurrentContainer(), activeMatc h));
113 // Don't invalidate tickmarks here. TextFinder invalidates tickmarks using a throttling algorithm. crbug.com/6819. 111 // Don't invalidate tickmarks here. TextFinder invalidates tickmarks using a throttling algorithm. crbug.com/6819.
114 } 112 }
115 113
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
122 void DocumentMarkerController::prepareForDestruction() 114 void DocumentMarkerController::prepareForDestruction()
123 { 115 {
124 clear(); 116 clear();
125 } 117 }
126 118
127 void DocumentMarkerController::removeMarkers(TextIterator& markedText, DocumentM arker::MarkerTypes markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemo vePartiallyOverlappingMarker) 119 void DocumentMarkerController::removeMarkers(TextIterator& markedText, DocumentM arker::MarkerTypes markerTypes, RemovePartiallyOverlappingMarkerOrNot shouldRemo vePartiallyOverlappingMarker)
128 { 120 {
129 for (; !markedText.atEnd(); markedText.advance()) { 121 for (; !markedText.atEnd(); markedText.advance()) {
130 if (!possiblyHasMarkers(markerTypes)) 122 if (!possiblyHasMarkers(markerTypes))
131 return; 123 return;
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 734
743 } // namespace blink 735 } // namespace blink
744 736
745 #ifndef NDEBUG 737 #ifndef NDEBUG
746 void showDocumentMarkers(const blink::DocumentMarkerController* controller) 738 void showDocumentMarkers(const blink::DocumentMarkerController* controller)
747 { 739 {
748 if (controller) 740 if (controller)
749 controller->showMarkers(); 741 controller->showMarkers();
750 } 742 }
751 #endif 743 #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