1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Use grid item *outer* size when calculating minimum contribution

Previously we used the border box, which meant that tracks did not grow
to accommodate item margins.
This commit is contained in:
Andreas Kling 2023-06-12 14:30:00 +02:00
parent 741c7aef21
commit 867e04768e
4 changed files with 33 additions and 15 deletions

View file

@ -45,14 +45,12 @@ public:
return dimension == GridDimension::Column ? m_column : m_row;
}
CSSPixels add_border_box_sizes(CSSPixels content_size, GridDimension dimension, LayoutState const& state) const
[[nodiscard]] CSSPixels add_margin_box_sizes(CSSPixels content_size, GridDimension dimension, LayoutState const& state) const
{
auto& box_state = state.get(box());
if (dimension == GridDimension::Column) {
return box_state.border_left + box_state.padding_left + content_size + box_state.padding_right + box_state.border_right;
} else {
return box_state.border_top + box_state.padding_top + content_size + box_state.padding_bottom + box_state.border_bottom;
}
auto const& box_state = state.get(box());
if (dimension == GridDimension::Column)
return box_state.margin_box_left() + content_size + box_state.margin_box_right();
return box_state.margin_box_top() + content_size + box_state.margin_box_bottom();
}
int raw_row() const { return m_row; }