mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:57:44 +00:00
LibWeb: Support positioning of abspos boxes inside grid container
- Out-of-flow items should not affect grid layout - "The static position of an absolutely-positioned child of a grid container is determined as if it were the sole grid item in a grid area whose edges coincide with the content edges of the grid container."
This commit is contained in:
parent
073eb46824
commit
568c486610
4 changed files with 51 additions and 0 deletions
|
@ -1317,6 +1317,10 @@ void GridFormattingContext::place_grid_items(AvailableSpace const& available_spa
|
|||
grid_container().for_each_child_of_type<Box>([&](Box& child_box) {
|
||||
if (can_skip_is_anonymous_text_run(child_box))
|
||||
return IterationDecision::Continue;
|
||||
|
||||
if (child_box.is_out_of_flow(*this))
|
||||
return IterationDecision::Continue;
|
||||
|
||||
m_boxes_to_place.append(child_box);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
@ -1780,6 +1784,18 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const
|
|||
}
|
||||
}
|
||||
|
||||
void GridFormattingContext::parent_context_did_dimension_child_root_box()
|
||||
{
|
||||
grid_container().for_each_child_of_type<Box>([&](Layout::Box& box) {
|
||||
if (box.is_absolutely_positioned()) {
|
||||
auto& cb_state = m_state.get(*box.containing_block());
|
||||
auto available_width = AvailableSize::make_definite(cb_state.content_width() + cb_state.padding_left + cb_state.padding_right);
|
||||
auto available_height = AvailableSize::make_definite(cb_state.content_height() + cb_state.padding_top + cb_state.padding_bottom);
|
||||
layout_absolutely_positioned_element(box, AvailableSpace(available_width, available_height));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void GridFormattingContext::determine_intrinsic_size_of_grid_container(AvailableSpace const& available_space)
|
||||
{
|
||||
// https://www.w3.org/TR/css-grid-1/#intrinsic-sizes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue