Commit 3cc43a93 authored by tanvir.rizvi's avatar tanvir.rizvi Committed by Commit Bot

Check document availiblity after 'selectStart' event is dispatched

'selectStart' event in UpdateSelectionForMouseDrag can affect the document.
So we should check the DocumentAvailiblity after the 'selectStart' event.
We should also check the cached position validity after
the event is dispatched.

Bug: 751817
Change-Id: Ie024fd9464771865d6611da10f69fb5df43754ce
Reviewed-on: https://chromium-review.googlesource.com/713074
Commit-Queue: Tanvir Rizvi <tanvir.rizvi@samsung.com>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509348}
parent 841320ae
......@@ -476,9 +476,12 @@ void SelectionController::UpdateSelectionForMouseDrag(
DispatchSelectStart(target) != DispatchEventResult::kNotCanceled)
return;
// TODO(yosin) We should check |targetPosition|, and
// |newSelection| are valid for |m_frame->document()|.
// |dispatchSelectStart()| can change them by "selectstart" event handler.
// |DispatchSelectStart()| can change |GetDocument()| or invalidate
// target_position by 'selectstart' event handler.
// TODO(editing-dev): We should also add a regression test when above
// behaviour happens. See crbug.com/775149.
if (!Selection().IsAvailable() || !target_position.IsValidFor(GetDocument()))
return;
const bool should_extend_selection =
selection_state_ == SelectionState::kExtendedSelection;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment