Commit ae146184 authored by Koji Ishii's avatar Koji Ishii Committed by Chromium LUCI CQ

Avoid crash in |HitTestResult| when |PostLayout| is nullptr

This is probably because of <crbug.com/1152696>, where we call
|PositionForPoint| after running even handlers.

Bug: 1155733, 1150362, 1152696
Change-Id: I4ec0a685fa0507da2536d9cbff5d1e8da5076bf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574557Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834271}
parent 03a5179c
...@@ -186,8 +186,10 @@ PositionWithAffinity HitTestResult::GetPosition() const { ...@@ -186,8 +186,10 @@ PositionWithAffinity HitTestResult::GetPosition() const {
// relayout? // relayout?
if (box_fragment_ && if (box_fragment_ &&
RuntimeEnabledFeatures::LayoutNGFullPositionForPointEnabled() && RuntimeEnabledFeatures::LayoutNGFullPositionForPointEnabled() &&
!box_fragment_->IsLayoutObjectDestroyedOrMoved()) !box_fragment_->IsLayoutObjectDestroyedOrMoved()) {
return box_fragment_->PostLayout()->PositionForPoint(LocalPoint()); if (const NGPhysicalBoxFragment* fragment = box_fragment_->PostLayout())
return fragment->PositionForPoint(LocalPoint());
}
return layout_object->PositionForPoint(LocalPoint()); return layout_object->PositionForPoint(LocalPoint());
} }
......
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