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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp

Issue 2898893002: Use SetSelection in ExecuteSelectToMark (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2009 Igalia S.L. 4 * Copyright (C) 2009 Igalia S.L.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 1782
1783 static bool ExecuteSelectToMark(LocalFrame& frame, 1783 static bool ExecuteSelectToMark(LocalFrame& frame,
1784 Event*, 1784 Event*,
1785 EditorCommandSource, 1785 EditorCommandSource,
1786 const String&) { 1786 const String&) {
1787 const EphemeralRange mark = 1787 const EphemeralRange mark =
1788 frame.GetEditor().Mark().ToNormalizedEphemeralRange(); 1788 frame.GetEditor().Mark().ToNormalizedEphemeralRange();
1789 EphemeralRange selection = frame.GetEditor().SelectedRange(); 1789 EphemeralRange selection = frame.GetEditor().SelectedRange();
1790 if (mark.IsNull() || selection.IsNull()) 1790 if (mark.IsNull() || selection.IsNull())
1791 return false; 1791 return false;
1792 frame.Selection().SetSelectedRange( 1792 frame.Selection().SetSelection(
1793 UnionEphemeralRanges(mark, selection), TextAffinity::kDownstream, 1793 SelectionInDOMTree::Builder()
1794 SelectionDirectionalMode::kNonDirectional, FrameSelection::kCloseTyping); 1794 .SetBaseAndExtent(UnionEphemeralRanges(mark, selection))
1795 .Build(),
1796 FrameSelection::kCloseTyping);
1795 return true; 1797 return true;
1796 } 1798 }
1797 1799
1798 static bool ExecuteSelectWord(LocalFrame& frame, 1800 static bool ExecuteSelectWord(LocalFrame& frame,
1799 Event*, 1801 Event*,
1800 EditorCommandSource, 1802 EditorCommandSource,
1801 const String&) { 1803 const String&) {
1802 return ExpandSelectionToGranularity(frame, kWordGranularity); 1804 return ExpandSelectionToGranularity(frame, kWordGranularity);
1803 } 1805 }
1804 1806
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3028 *frame_, kDirectionBackward, kWordGranularity); 3030 *frame_, kDirectionBackward, kWordGranularity);
3029 case WebEditingCommandType::kDeleteWordForward: 3031 case WebEditingCommandType::kDeleteWordForward:
3030 return RangesFromCurrentSelectionOrExtendCaret(*frame_, kDirectionForward, 3032 return RangesFromCurrentSelectionOrExtendCaret(*frame_, kDirectionForward,
3031 kWordGranularity); 3033 kWordGranularity);
3032 default: 3034 default:
3033 return TargetRangesForInputEvent(*target); 3035 return TargetRangesForInputEvent(*target);
3034 } 3036 }
3035 } 3037 }
3036 3038
3037 } // namespace blink 3039 } // namespace blink
OLDNEW
« 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