Chromium Code Reviews| 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); |
| } |