| 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 78531bc8f80f3948c0b7bd0d6986fe61fb913ea2..04ef09edca22d6104990098622f0334fbef02d87 100644
|
| --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| @@ -164,7 +164,8 @@ void FrameSelection::moveCaretSelection(const IntPoint& point) {
|
| builder.setIsDirectional(selection().isDirectional());
|
| if (position.isNotNull())
|
| builder.collapse(position.toPositionWithAffinity());
|
| - setSelection(builder.build(), CloseTyping | ClearTypingStyle | UserTriggered);
|
| + setSelection(builder.build(),
|
| + CloseTyping | ClearTypingStyle | UserTriggered | HandleVisible);
|
| }
|
|
|
| template <typename Strategy>
|
| @@ -181,6 +182,9 @@ void FrameSelection::setSelectionAlgorithm(
|
| m_granularityStrategy->Clear();
|
| bool closeTyping = options & CloseTyping;
|
| bool shouldClearTypingStyle = options & ClearTypingStyle;
|
| + const HandleVisibility handleVisibility = options & HandleVisible
|
| + ? HandleVisibility::Visible
|
| + : HandleVisibility::NotVisible;
|
| EUserTriggered userTriggered = selectionOptionsToUserTriggered(options);
|
|
|
| // TODO(editing-dev): We should rename variable |s| to another name to avoid
|
| @@ -199,7 +203,8 @@ void FrameSelection::setSelectionAlgorithm(
|
| if (shouldClearTypingStyle)
|
| clearTypingStyle();
|
|
|
| - if (m_selectionEditor->visibleSelection<Strategy>() == s) {
|
| + if (m_selectionEditor->visibleSelection<Strategy>() == s &&
|
| + m_handleVisibility == handleVisibility) {
|
| // Even if selection was not changed, selection offsets may have been
|
| // changed.
|
| m_frame->inputMethodController().cancelCompositionIfSelectionIsInvalid();
|
| @@ -211,6 +216,7 @@ void FrameSelection::setSelectionAlgorithm(
|
| visibleSelection<Strategy>();
|
| const Position& oldSelectionStart = selection().start();
|
|
|
| + m_handleVisibility = handleVisibility;
|
| m_selectionEditor->setVisibleSelection(s, options);
|
| m_frameCaret->setCaretRectNeedsUpdate();
|
|
|
| @@ -1337,7 +1343,8 @@ void FrameSelection::moveRangeSelectionExtent(const IntPoint& contentsPoint) {
|
| granularityStrategy()->updateExtent(contentsPoint, m_frame);
|
| setSelection(newSelection,
|
| FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle |
|
| - FrameSelection::DoNotClearStrategy | UserTriggered,
|
| + FrameSelection::DoNotClearStrategy | UserTriggered |
|
| + FrameSelection::HandleVisible,
|
| CursorAlignOnScroll::IfNeeded, CharacterGranularity);
|
| }
|
|
|
| @@ -1358,8 +1365,11 @@ void FrameSelection::moveRangeSelection(const VisiblePosition& basePosition,
|
| if (newSelection.isNone())
|
| return;
|
|
|
| - setSelection(newSelection, CloseTyping | ClearTypingStyle,
|
| - CursorAlignOnScroll::IfNeeded, granularity);
|
| + SetSelectionOptions options = CloseTyping | ClearTypingStyle;
|
| + if (isHandleVisible())
|
| + options |= HandleVisible;
|
| + setSelection(newSelection, options, CursorAlignOnScroll::IfNeeded,
|
| + granularity);
|
| }
|
|
|
| void FrameSelection::updateIfNeeded() {
|
|
|