| 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 e63d68bea411ac67e8396e9ed4b85b96bcd9ed8b..9749531655181942d4c7d075f03dbb7c97ea9f08 100644
|
| --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| @@ -242,14 +242,17 @@ void FrameSelection::setSelection(const SelectionInDOMTree& passedSelection,
|
| // Always clear the x position used for vertical arrow navigation.
|
| // It will be restored by the vertical arrow navigation code if necessary.
|
| m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation();
|
| - // TODO(yosin): Can we move this to at end of this function?
|
| - // This may dispatch a synchronous focus-related events.
|
| - selectFrameElementInParentIfFullySelected();
|
| - if (!isAvailable() || document() != currentDocument) {
|
| - // editing/selection/selectallchildren-crash.html and
|
| - // editing/selection/longpress-selection-in-iframe-removed-crash.html
|
| - // reach here.
|
| - return;
|
| +
|
| + if (!(options & DoNotSetFocus)) {
|
| + // TODO(yosin): Can we move this to at end of this function? This may
|
| + // dispatch a synchronous focus-related events.
|
| + selectFrameElementInParentIfFullySelected();
|
| + if (!isAvailable() || document() != currentDocument) {
|
| + // editing/selection/selectallchildren-crash.html and
|
| + // editing/selection/longpress-selection-in-iframe-removed-crash.html
|
| + // reach here.
|
| + return;
|
| + }
|
| }
|
| EUserTriggered userTriggered = selectionOptionsToUserTriggered(options);
|
| notifyLayoutObjectOfSelectionChange(userTriggered);
|
| @@ -368,7 +371,9 @@ static DispatchEventResult dispatchSelectStart(
|
| bool FrameSelection::modify(EAlteration alter,
|
| SelectionDirection direction,
|
| TextGranularity granularity,
|
| - EUserTriggered userTriggered) {
|
| + EUserTriggered userTriggered,
|
| + SetSelectionOptions noFocusFlag) {
|
| + DCHECK(noFocusFlag == 0 || noFocusFlag == DoNotSetFocus);
|
| SelectionModifier selectionModifier(
|
| *frame(), computeVisibleSelectionInDOMTreeDeprecated(),
|
| m_xPosForVerticalArrowNavigation);
|
| @@ -393,7 +398,7 @@ bool FrameSelection::modify(EAlteration alter,
|
| }
|
|
|
| const SetSelectionOptions options =
|
| - CloseTyping | ClearTypingStyle | userTriggered;
|
| + CloseTyping | ClearTypingStyle | userTriggered | noFocusFlag;
|
| setSelection(selectionModifier.selection(), options);
|
|
|
| if (granularity == LineGranularity || granularity == ParagraphGranularity)
|
|
|