mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 17:19:13 +00:00
LibWeb: Cache UsedValues pointers in GridFormattingContext and use them
This commit is contained in:
parent
fee0d408a1
commit
81deaad7ad
Notes:
github-actions[bot]
2025-02-11 23:40:38 +00:00
Author: https://github.com/awesomekling
Commit: 81deaad7ad
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3543
2 changed files with 65 additions and 70 deletions
|
@ -36,6 +36,7 @@ struct GridPosition {
|
|||
|
||||
struct GridItem {
|
||||
GC::Ref<Box const> box;
|
||||
LayoutState::UsedValues& used_values;
|
||||
|
||||
// Position and span are empty if the item is auto-placed which could only be the case for abspos items
|
||||
Optional<int> row;
|
||||
|
@ -53,12 +54,11 @@ struct GridItem {
|
|||
return dimension == GridDimension::Column ? column.value() : row.value();
|
||||
}
|
||||
|
||||
[[nodiscard]] CSSPixels add_margin_box_sizes(CSSPixels content_size, GridDimension dimension, LayoutState const& state) const
|
||||
[[nodiscard]] CSSPixels add_margin_box_sizes(CSSPixels content_size, GridDimension dimension) const
|
||||
{
|
||||
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();
|
||||
return used_values.margin_box_left() + content_size + used_values.margin_box_right();
|
||||
return used_values.margin_box_top() + content_size + used_values.margin_box_bottom();
|
||||
}
|
||||
|
||||
[[nodiscard]] int gap_adjusted_position(GridDimension const dimension) const
|
||||
|
@ -253,6 +253,8 @@ private:
|
|||
|
||||
Optional<AvailableSpace> m_available_space;
|
||||
|
||||
LayoutState::UsedValues& m_grid_container_used_values;
|
||||
|
||||
void determine_grid_container_height();
|
||||
void determine_intrinsic_size_of_grid_container(AvailableSpace const& available_space);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue