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

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

Issue 2455083003: Reduce usage of VisibleSelection::setBase() and setExtent() (Closed)
Patch Set: 2016-10-31T10:31:10 Created 4 years, 1 month 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 | third_party/WebKit/Source/core/editing/SelectionController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/GranularityStrategy.h" 5 #include "core/editing/GranularityStrategy.h"
6 6
7 #include "core/editing/EditingUtilities.h" 7 #include "core/editing/EditingUtilities.h"
8 #include "core/editing/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 261
262 // Only update the state if the selection actually changed as a result of 262 // Only update the state if the selection actually changed as a result of
263 // this move. 263 // this move.
264 if (newSelectionExtent.deepEquivalent() != 264 if (newSelectionExtent.deepEquivalent() !=
265 selection.visibleExtent().deepEquivalent()) 265 selection.visibleExtent().deepEquivalent())
266 m_state = thisMoveShrunkSelection ? StrategyState::Shrinking 266 m_state = thisMoveShrunkSelection ? StrategyState::Shrinking
267 : StrategyState::Expanding; 267 : StrategyState::Expanding;
268 268
269 m_diffExtentPointFromExtentPosition = 269 m_diffExtentPointFromExtentPosition =
270 extentPoint + IntSize(m_offset, 0) - positionLocation(newSelectionExtent); 270 extentPoint + IntSize(m_offset, 0) - positionLocation(newSelectionExtent);
271 VisibleSelection newSelection = selection; 271 return createVisibleSelection(
272 newSelection.setExtent(newSelectionExtent); 272 SelectionInDOMTree::Builder(selection.asSelection())
273 return newSelection; 273 .collapse(selection.base())
274 .extend(newSelectionExtent.deepEquivalent())
275 .build());
274 } 276 }
275 277
276 } // namespace blink 278 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/SelectionController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698