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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2951353003: Get rid of *live granularity* behavior from selection (Closed)
Patch Set: 2017-06-23T18:30:58 Created 3 years, 6 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 | « third_party/WebKit/LayoutTests/editing/selection/double_click_and_modify.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/SelectionController.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
index 26338841bafdfb5c23fa3546189a18bdac50575d..60618f6a7d5545e4ffe61a56f588c693ac941611 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -81,10 +81,19 @@ DispatchEventResult DispatchSelectStart(Node* node) {
VisibleSelectionInFlatTree ExpandSelectionToRespectUserSelectAll(
Node* target_node,
const VisibleSelectionInFlatTree& selection) {
+ if (selection.IsNone())
+ return selection;
Node* const root_user_select_all =
EditingInFlatTreeStrategy::RootUserSelectAllForNode(target_node);
- if (!root_user_select_all)
- return selection;
+ if (!root_user_select_all) {
+ SelectionInFlatTree::Builder builder;
+ if (selection.IsBaseFirst())
Xiaocheng 2017/06/23 17:31:11 Can we use |builder.SetBaseAndExtent(selection.Bas
yosin_UTC9 2017/06/26 04:14:50 No. When granularity is word/pargraph, base == ext
+ builder.SetBaseAndExtent(selection.Start(), selection.End());
+ else
+ builder.SetBaseAndExtent(selection.End(), selection.Start());
+ builder.SetAffinity(selection.Affinity());
+ return CreateVisibleSelection(builder.Build());
+ }
return CreateVisibleSelection(
SelectionInFlatTree::Builder(selection.AsSelection())
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/double_click_and_modify.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698