mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
LibWeb: Fix percentage insets resolution for grid items
compute_inset() was incorrectly retrieving the containing block size because containing_block() is unaware of grid areas that form a containing block for grid items but do not exist in the layout tree. With this change, we explicitly pass the containing block into compute_inset(), allowing it to correctly provide the containing block sizes for grid items.
This commit is contained in:
parent
07d8ddb5fa
commit
a8c1d12e84
Notes:
github-actions[bot]
2024-11-11 19:21:44 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: a8c1d12e84
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2285
9 changed files with 102 additions and 12 deletions
|
@ -1328,7 +1328,7 @@ void FormattingContext::compute_height_for_absolutely_positioned_replaced_elemen
|
|||
}
|
||||
|
||||
// https://www.w3.org/TR/css-position-3/#relpos-insets
|
||||
void FormattingContext::compute_inset(NodeWithStyleAndBoxModelMetrics const& box)
|
||||
void FormattingContext::compute_inset(NodeWithStyleAndBoxModelMetrics const& box, CSSPixelSize containing_block_size)
|
||||
{
|
||||
if (box.computed_values().position() != CSS::Positioning::Relative)
|
||||
return;
|
||||
|
@ -1363,8 +1363,8 @@ void FormattingContext::compute_inset(NodeWithStyleAndBoxModelMetrics const& box
|
|||
auto const& computed_values = box.computed_values();
|
||||
|
||||
// FIXME: Respect the containing block's writing-mode.
|
||||
resolve_two_opposing_insets(computed_values.inset().left(), computed_values.inset().right(), box_state.inset_left, box_state.inset_right, containing_block_width_for(box));
|
||||
resolve_two_opposing_insets(computed_values.inset().top(), computed_values.inset().bottom(), box_state.inset_top, box_state.inset_bottom, containing_block_height_for(box));
|
||||
resolve_two_opposing_insets(computed_values.inset().left(), computed_values.inset().right(), box_state.inset_left, box_state.inset_right, containing_block_size.width());
|
||||
resolve_two_opposing_insets(computed_values.inset().top(), computed_values.inset().bottom(), box_state.inset_top, box_state.inset_bottom, containing_block_size.height());
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-sizing-3/#fit-content-size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue