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

Unified 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: More tweaks 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/DocumentMarkerController.cpp
diff --git a/Source/core/dom/DocumentMarkerController.cpp b/Source/core/dom/DocumentMarkerController.cpp
index 354d82a857fc1499f6d60a36896db5202f0f5dd0..bf9103837e5643a5081338314b93696310487250 100644
--- a/Source/core/dom/DocumentMarkerController.cpp
+++ b/Source/core/dom/DocumentMarkerController.cpp
@@ -119,6 +119,22 @@ void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerTyp
}
+void DocumentMarkerController::addMarker(const Position& start, const Position& end, DocumentMarker::MarkerType type, const String& description)
+{
+ // Use a TextIterator to visit the potentially multiple nodes the range covers.
+ for (TextIterator markedText(start, end); !markedText.atEnd(); markedText.advance()) {
+ addMarker(markedText.startContainer(), DocumentMarker(type, markedText.startOffset(), markedText.endOffset(), description));
+ }
+}
+
+void DocumentMarkerController::addMarker(const Position& start, const Position& end, DocumentMarker::MarkerType type)
+{
+ // Use a TextIterator to visit the potentially multiple nodes the range covers.
+ for (TextIterator markedText(start, end); !markedText.atEnd(); markedText.advance()) {
+ addMarker(markedText.startContainer(), DocumentMarker(type, markedText.startOffset(), markedText.endOffset()));
yosin_UTC9 2014/09/18 01:08:51 nit: It seems ctor of |DocumentMarker| check |desc
Mads Ager (chromium) 2014/09/18 06:58:49 Thanks, that is true. Looks like this can be simpl
+ }
+}
+
void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activeMatch)
{
// Use a TextIterator to visit the potentially multiple nodes the range covers.

Powered by Google App Engine
This is Rietveld 408576698