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

Unified Diff: Source/core/editing/commands/EditorCommand.cpp

Issue 1315813003: Make EditorCommand to use VisibleSelection::toNormalizedEphemeralRange() instead of toNormalizedRang (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-25T15:39:00 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/commands/EditorCommand.cpp
diff --git a/Source/core/editing/commands/EditorCommand.cpp b/Source/core/editing/commands/EditorCommand.cpp
index 546c0dabfb9d5008efae0e4428648de28f9ba2ae..3664368b1431c351c9316b068c69a498ea803a60 100644
--- a/Source/core/editing/commands/EditorCommand.cpp
+++ b/Source/core/editing/commands/EditorCommand.cpp
@@ -394,11 +394,9 @@ static bool executeDeleteToEndOfParagraph(LocalFrame& frame, Event*, EditorComma
static bool executeDeleteToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- // TODO(yosin) We should use |EphemeralRange| version of
- // |VisibleSelection::toNormalizedRange()|.
- RefPtrWillBeRawPtr<Range> mark = frame.editor().mark().toNormalizedRange();
- if (mark) {
- bool selected = frame.selection().setSelectedRange(unionEphemeralRanges(EphemeralRange(mark.get()), frame.editor().selectedRange()), TextAffinity::Downstream, FrameSelection::NonDirectional, FrameSelection::CloseTyping);
+ const EphemeralRange mark = frame.editor().mark().toNormalizedEphemeralRange();
+ if (mark.isNotNull()) {
+ bool selected = frame.selection().setSelectedRange(unionEphemeralRanges(mark, frame.editor().selectedRange()), TextAffinity::Downstream, FrameSelection::NonDirectional, FrameSelection::CloseTyping);
ASSERT(selected);
if (!selected)
return false;
@@ -1042,13 +1040,11 @@ static bool executeSelectSentence(LocalFrame& frame, Event*, EditorCommandSource
static bool executeSelectToMark(LocalFrame& frame, Event*, EditorCommandSource, const String&)
{
- // TODO(yosin) We should use |EphemeralRange| version of
- // |VisibleSelection::toNormalizedRange()|.
- RefPtrWillBeRawPtr<Range> mark = frame.editor().mark().toNormalizedRange();
+ const EphemeralRange mark = frame.editor().mark().toNormalizedEphemeralRange();
EphemeralRange selection = frame.editor().selectedRange();
- if (!mark || selection.isNull())
+ if (mark.isNull() || selection.isNull())
return false;
- frame.selection().setSelectedRange(unionEphemeralRanges(EphemeralRange(mark.get()), selection), TextAffinity::Downstream, FrameSelection::NonDirectional, FrameSelection::CloseTyping);
+ frame.selection().setSelectedRange(unionEphemeralRanges(mark, selection), TextAffinity::Downstream, FrameSelection::NonDirectional, FrameSelection::CloseTyping);
return true;
}
« 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