Commit a4c33ac0 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Chromium LUCI CQ

Make LayoutBlock::PositionForBox() not to crash on anonymous block

This patch changes |LayoutBlock::PositionForBox()| to return null
position if |LayoutBlock| is anonymous for avoiding call
|Position::FirstPositionInOrBeforeNode()| with null position.

Note: |LayoutBlock::PositionForBox()| is used only for legacy layout.

Note: I don't have the test case to reproduce because ClusterFuzz's
test case is too huge (large than 1MB) to reduce.

Bug: 1157993
Change-Id: Ief106d22bb6c29620182fbb9a4f5fe84919879c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626820
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843404}
parent f5ecce53
...@@ -1339,6 +1339,8 @@ Position LayoutBlock::PositionForBox(InlineBox* box, bool start) const { ...@@ -1339,6 +1339,8 @@ Position LayoutBlock::PositionForBox(InlineBox* box, bool start) const {
Node* const node = box->GetLineLayoutItem().NonPseudoNode(); Node* const node = box->GetLineLayoutItem().NonPseudoNode();
if (!node) { if (!node) {
if (!NonPseudoNode())
return Position();
if (start) if (start)
return Position::FirstPositionInOrBeforeNode(*NonPseudoNode()); return Position::FirstPositionInOrBeforeNode(*NonPseudoNode());
return Position::LastPositionInOrAfterNode(*NonPseudoNode()); return Position::LastPositionInOrAfterNode(*NonPseudoNode());
......
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