| Index: third_party/WebKit/Source/core/editing/PendingSelection.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/PendingSelection.cpp b/third_party/WebKit/Source/core/editing/PendingSelection.cpp
|
| index 1b106656d49673990d8f12016ed2f04fad889264..8ffc8e7fe380de3dcdca49a8453493e0a42ab10c 100644
|
| --- a/third_party/WebKit/Source/core/editing/PendingSelection.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/PendingSelection.cpp
|
| @@ -123,10 +123,11 @@ void PendingSelection::commit(LayoutView& layoutView) {
|
| // necessarily valid, and the following steps assume a valid selection. See
|
| // <https://bugs.webkit.org/show_bug.cgi?id=69563> and
|
| // <rdar://problem/10232866>.
|
| - const VisibleSelectionInFlatTree& selection =
|
| - createVisibleSelection(calcVisibleSelection(originalSelection));
|
| + const SelectionInFlatTree selection = calcVisibleSelection(originalSelection);
|
| + const VisibleSelectionInFlatTree& visibleSelection =
|
| + createVisibleSelection(selection);
|
|
|
| - if (!selection.isRange()) {
|
| + if (!visibleSelection.isRange() || !selectionHasFocus(selection)) {
|
| layoutView.clearSelection();
|
| return;
|
| }
|
| @@ -137,11 +138,11 @@ void PendingSelection::commit(LayoutView& layoutView) {
|
| // If we pass [foo, 3] as the start of the selection, the selection painting
|
| // code will think that content on the line containing 'foo' is selected
|
| // and will fill the gap before 'bar'.
|
| - PositionInFlatTree startPos = selection.start();
|
| + PositionInFlatTree startPos = visibleSelection.start();
|
| PositionInFlatTree candidate = mostForwardCaretPosition(startPos);
|
| if (isVisuallyEquivalentCandidate(candidate))
|
| startPos = candidate;
|
| - PositionInFlatTree endPos = selection.end();
|
| + PositionInFlatTree endPos = visibleSelection.end();
|
| candidate = mostBackwardCaretPosition(endPos);
|
| if (isVisuallyEquivalentCandidate(candidate))
|
| endPos = candidate;
|
| @@ -150,8 +151,8 @@ void PendingSelection::commit(LayoutView& layoutView) {
|
| // |VisiblePosition| when a selection is deleted because we don't yet notify
|
| // the |FrameSelection| of text removal.
|
| if (startPos.isNull() || endPos.isNull() ||
|
| - selection.visibleStart().deepEquivalent() ==
|
| - selection.visibleEnd().deepEquivalent())
|
| + visibleSelection.visibleStart().deepEquivalent() ==
|
| + visibleSelection.visibleEnd().deepEquivalent())
|
| return;
|
| LayoutObject* startLayoutObject = startPos.anchorNode()->layoutObject();
|
| LayoutObject* endLayoutObject = endPos.anchorNode()->layoutObject();
|
|
|