github web-platform-tests/wpt merge_pr_48191

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
3 months ago

[line-clamp] Fix unresolved BFC offset nullopt dereference

When line-clamp: auto is used, after the layout of every box and
line box contained in the BFC, BlockLineClampData::UpdateAfterLayout
is called to figure out the BFC offset where that box ends and to see
if the box has gone past the clamp point. This is done by checking the
parent's BFC offset, which is passed as a
const std::optional<LayoutUnit>& argument to UpdateAfterLayout.

However, this method assumed that by the point we're calling it, the
BFC offset must have always been resolved already. This, however, was
not always the case.

UpdateAfterLayout has two callers: one for new IFC boxes, where the
BFC offset is guaranteed to have already resolved; and one for in-flow
boxes, where that does not hold. If there is no BFC offset for an
in-flow box, then the box must be empty (containing no lines and
taking up no block size), which means there's nothing to update in the
BlockLineClampData, and the method call can be skipped.

This patch therefore changes the const std::optional<LayoutUnit>&
BFC offset argument so its type is LayoutUnit and callers are made
to deal with it. It also updates the callers as described above.

Bug: 366873190, 40336192
Change-Id: Ideaa6d63648493c59260786b5c752cadb0a9f598
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5861209
Commit-Queue: Andreu Botella abotella@igalia.com
Reviewed-by: Ian Kilpatrick ikilpatrick@chromium.org
Cr-Commit-Position: refs/heads/main@{#1355685}

Don't miss a new wpt release

NewReleases is sending notifications on new releases.