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

Side by Side Diff: Source/core/dom/DocumentMarkerController.cpp

Issue 576073003: Removal of more temporary Range objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix build; accidentally removed .get() call Created 6 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 | Annotate | Revision Log
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerTyp e type) 113 void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerTyp e type)
114 { 114 {
115 // Use a TextIterator to visit the potentially multiple nodes the range cove rs. 115 // Use a TextIterator to visit the potentially multiple nodes the range cove rs.
116 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance ()) { 116 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance ()) {
117 addMarker(markedText.startContainer(), DocumentMarker(type, markedText.s tartOffset(), markedText.endOffset())); 117 addMarker(markedText.startContainer(), DocumentMarker(type, markedText.s tartOffset(), markedText.endOffset()));
118 } 118 }
119 119
120 } 120 }
121 121
122 void DocumentMarkerController::addMarker(const Position& start, const Position& end, DocumentMarker::MarkerType type, const String& description)
123 {
124 // Use a TextIterator to visit the potentially multiple nodes the range cove rs.
125 for (TextIterator markedText(start, end); !markedText.atEnd(); markedText.ad vance()) {
126 addMarker(markedText.startContainer(), DocumentMarker(type, markedText.s tartOffset(), markedText.endOffset(), description));
127 }
128 }
129
130 void DocumentMarkerController::addMarker(const Position& start, const Position& end, DocumentMarker::MarkerType type)
131 {
132 // Use a TextIterator to visit the potentially multiple nodes the range cove rs.
133 for (TextIterator markedText(start, end); !markedText.atEnd(); markedText.ad vance()) {
134 addMarker(markedText.startContainer(), DocumentMarker(type, markedText.s tartOffset(), markedText.endOffset()));
135 }
136 }
137
122 void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activ eMatch) 138 void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activ eMatch)
123 { 139 {
124 // Use a TextIterator to visit the potentially multiple nodes the range cove rs. 140 // Use a TextIterator to visit the potentially multiple nodes the range cove rs.
125 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance ()) { 141 for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance ()) {
126 unsigned startOffset = markedText.startOffset(); 142 unsigned startOffset = markedText.startOffset();
127 unsigned endOffset = markedText.endOffset(); 143 unsigned endOffset = markedText.endOffset();
128 addMarker(markedText.startContainer(), DocumentMarker(startOffset, endOf fset, activeMatch)); 144 addMarker(markedText.startContainer(), DocumentMarker(startOffset, endOf fset, activeMatch));
129 if (endOffset > startOffset) { 145 if (endOffset > startOffset) {
130 // Rendered rects for markers in WebKit are not populated until each time 146 // Rendered rects for markers in WebKit are not populated until each time
131 // the markers are painted. However, we need it to happen sooner, be cause 147 // the markers are painted. However, we need it to happen sooner, be cause
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 786
771 } // namespace blink 787 } // namespace blink
772 788
773 #ifndef NDEBUG 789 #ifndef NDEBUG
774 void showDocumentMarkers(const blink::DocumentMarkerController* controller) 790 void showDocumentMarkers(const blink::DocumentMarkerController* controller)
775 { 791 {
776 if (controller) 792 if (controller)
777 controller->showMarkers(); 793 controller->showMarkers();
778 } 794 }
779 #endif 795 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentMarkerController.h ('k') | Source/core/editing/CompositeEditCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698