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

Unified Diff: Source/core/editing/SpellChecker.cpp

Issue 1280543002: Avoid temporary Range object creation in SpellChecker::replaceMisspelledRange() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-06T16:32:55 Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/SpellChecker.cpp
diff --git a/Source/core/editing/SpellChecker.cpp b/Source/core/editing/SpellChecker.cpp
index 5b140f21633d7983a334e47ea03fcb18e9807568..bd56c2c5eef1296e164cc540637535dc31e0cbd6 100644
--- a/Source/core/editing/SpellChecker.cpp
+++ b/Source/core/editing/SpellChecker.cpp
@@ -759,11 +759,10 @@ void SpellChecker::replaceMisspelledRange(const String& text)
DocumentMarkerVector markers = frame().document()->markers().markersInRange(caretRange, DocumentMarker::MisspellingMarkers());
if (markers.size() < 1 || markers[0]->startOffset() >= markers[0]->endOffset())
return;
- // TODO(yosin) |markerRange| should be |EphemeralRange|.
- RefPtrWillBeRawPtr<Range> markerRange = Range::create(caretRange.document(), caretRange.startPosition().computeContainerNode(), markers[0]->startOffset(), caretRange.endPosition().computeContainerNode(), markers[0]->endOffset());
- if (!markerRange)
+ EphemeralRange markerRange = EphemeralRange(Position(caretRange.startPosition().computeContainerNode(), markers[0]->startOffset()), Position(caretRange.endPosition().computeContainerNode(), markers[0]->endOffset()));
+ if (markerRange.isNull())
return;
- frame().selection().setSelection(VisibleSelection(markerRange.get()), CharacterGranularity);
+ frame().selection().setSelection(VisibleSelection(markerRange), CharacterGranularity);
frame().editor().replaceSelectionWithText(text, false, false);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698