Skip to content

Commit

Permalink
[@container] Clear skipped style recalc for all descendants
Browse files Browse the repository at this point in the history
The existing code assumed we would always resume style recalc from the
skipped container's layout, but that is not always the case.

Take the following scenario which could happen with nested containers:

1. Style recalc is not skipped for an outer container because it is not
   marked for layout.
2. Style recalc is skipped for an inner container because it is marked
   for layout.
3. Layout changes the width of the outer container because the outer
   container is auto-sized, and changes size because an ancestor box
   changes its size.
4. The @container evaluation changes for the outer container, which
   means we enter UpdateStyleAndLayoutTreeForContainer() for the outer
   container.
5. We reach recalc for the inner container, whose subtree was skipped
   for style recalc, but we did not clear the skipping or retrieve the
   stored style recalc change.

In this CL we always check, clear, and return the StyleRecalcChange if
style recalc was skipped.

Bug: 346264227
Change-Id: I3dc997850068a6751333ed588adf2f1f0e87518f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5630638
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Commit-Queue: Rune Lillesveen <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1317345}
  • Loading branch information
Rune Lillesveen authored and sadym-chromium committed Jul 18, 2024
1 parent 07b3057 commit d20b639
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<title>Chrome crash bug 346264227</title>
<link rel="help" href="https://crbug.com/346264227">
<style>
@container (width = 0px) {
#inner {
display: none;
}
}
</style>
<div style="container-type: inline-size">
<div id="inner" style="container-type: inline-size; display: none"><span></span></div>
</div>
<script>
document.body.offsetTop;
document.body.style.width = 0;
inner.style.display = "";
document.body.offsetTop;
</script>

0 comments on commit d20b639

Please sign in to comment.