Commit 42890398 authored by Yoichi Osato's avatar Yoichi Osato Committed by Commit Bot

Set SelectionState w/o propagation at LayoutSelection::Commit().

We reassign SelectionState at the end of LayoutSelection::Commit()
to avoid use-after-free.

This patch changes it to call non virtual
LayoutObject::SetSelectionState() and assign SelectionState
to only target LayoutObjects.

Bug: 739062
Change-Id: I5613257c99332b887501e1bcd4fe27482f9280d0
Reviewed-on: https://chromium-review.googlesource.com/773788Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517031}
parent d9e35229
...@@ -625,12 +625,12 @@ void LayoutSelection::Commit() { ...@@ -625,12 +625,12 @@ void LayoutSelection::Commit() {
paint_range_.EndLayoutObject()->GetSelectionState() != paint_range_.EndLayoutObject()->GetSelectionState() !=
SelectionState::kStartAndEnd)) { SelectionState::kStartAndEnd)) {
if (paint_range_.StartLayoutObject() == paint_range_.EndLayoutObject()) { if (paint_range_.StartLayoutObject() == paint_range_.EndLayoutObject()) {
paint_range_.StartLayoutObject()->SetSelectionStateIfNeeded( paint_range_.StartLayoutObject()->LayoutObject::SetSelectionState(
SelectionState::kStartAndEnd); SelectionState::kStartAndEnd);
} else { } else {
paint_range_.StartLayoutObject()->SetSelectionStateIfNeeded( paint_range_.StartLayoutObject()->LayoutObject::SetSelectionState(
SelectionState::kStart); SelectionState::kStart);
paint_range_.EndLayoutObject()->SetSelectionStateIfNeeded( paint_range_.EndLayoutObject()->LayoutObject::SetSelectionState(
SelectionState::kEnd); SelectionState::kEnd);
} }
} }
......
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