Skip to content

Commit

Permalink
Duolingo continue/next bar trails off of viewport
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=273526
<rdar://126777425>

Reviewed by Antti Koivisto.

When a box changes containing block through style mutation (e.g. by going from out-of-flow to inflow),
its (grid/flex driven) override value becomes stale.
(note that these override values are apparently sticky and we have to keep them around in-between layouts
for example to be able to resolve percent padding values for getComputedStyle)

* LayoutTests/fast/dynamic/out-of-flow-going-in-flow-inside-grid-expected.html: Added.
* LayoutTests/fast/dynamic/out-of-flow-going-in-flow-inside-grid.html: Added.
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutPositionedObject):

Canonical link: https://commits.webkit.org/278209@main
  • Loading branch information
alanbaradlay committed May 1, 2024
1 parent 2a15afd commit c1c858c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<style>
div {
width: 400px;
height: 300px;
background-color: green;
}
</style>
<div></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<style>
.grid {
width: 200px;

display: grid;
padding: 100px;
position: relative;
background-color: green;
}

#abs {
position: absolute;
background-color: green;
width: 100%;
height: 100px;
}
</style>
<!-- PASS if in-flow leaf does not stick out of grid container -->
<div class=grid><div><div id=abs><script>
document.body.offsetHeight;
abs.style.position = "static";
</script>
3 changes: 3 additions & 0 deletions Source/WebCore/rendering/RenderBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
// any override content size set by our container, because it would likely be incorrect after the style change.
if (isOutOfFlowPositioned() && parent() && parent()->style().isDisplayFlexibleBoxIncludingDeprecatedOrGridBox())
clearOverridingContentSize();

if (oldStyle && oldStyle->hasOutOfFlowPosition() != style().hasOutOfFlowPosition())
clearOverridingContainingBlockContentSize();
}

void RenderBox::updateGridPositionAfterStyleChange(const RenderStyle& style, const RenderStyle* oldStyle)
Expand Down

0 comments on commit c1c858c

Please sign in to comment.