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

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

Issue 2972753002: Make FrameSelection::MoveRangeSelection() not to set live granularity selection (Closed)
Patch Set: 2017-07-05T14:09:35 Created 3 years, 5 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 | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 0c0c97180de781399fa076ce5f323a3945d93950..e0d3908dc76c88c2580ac38555a2d1b78ef1195e 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -1136,7 +1136,25 @@ void FrameSelection::MoveRangeSelection(const VisiblePosition& base_position,
if (new_selection.IsNone())
return;
- SetSelection(new_selection, kCloseTyping | kClearTypingStyle,
+ const VisibleSelection visible_selection =
+ CreateVisibleSelection(new_selection);
+ if (visible_selection.IsNone()) {
+ SetSelection(new_selection, kCloseTyping | kClearTypingStyle,
yoichio 2017/07/05 06:56:40 Why don't you set selection even VS is none?
yosin_UTC9 2017/07/05 07:14:16 Good catch! We don't need to set selection if expa
+ CursorAlignOnScroll::kIfNeeded, granularity);
+ return;
+ }
+
+ SelectionInDOMTree::Builder builder;
+ if (visible_selection.IsBaseFirst()) {
+ builder.SetBaseAndExtent(visible_selection.Start(),
+ visible_selection.End());
+ } else {
+ builder.SetBaseAndExtent(visible_selection.End(),
+ visible_selection.Start());
+ }
+ builder.SetAffinity(visible_selection.Affinity());
+ builder.SetIsHandleVisible(IsHandleVisible());
+ SetSelection(builder.Build(), kCloseTyping | kClearTypingStyle,
CursorAlignOnScroll::kIfNeeded, granularity);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698