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

LibWeb: Calculate valid grid areas

When starting the GridFormattingContext, calculate the valid grid areas
as declared in the `grid-template-areas` property. Since this doesn't
change, are able to do this once and store the results.
This commit is contained in:
martinfalisse 2023-01-17 13:50:41 +01:00 committed by Andreas Kling
parent fa5d016176
commit 47c77858b6
2 changed files with 60 additions and 0 deletions

View file

@ -89,6 +89,15 @@ private:
}
};
struct GridArea {
String name;
int row_start { 0 };
int row_end { 1 };
int column_start { 0 };
int column_end { 1 };
};
Vector<GridArea> m_valid_grid_areas;
Vector<TemporaryTrack> m_grid_rows;
Vector<TemporaryTrack> m_grid_columns;
@ -107,6 +116,8 @@ private:
int count_of_repeated_auto_fill_or_fit_tracks(Vector<CSS::ExplicitGridTrack> const& track_list, AvailableSpace const&, Box const&);
int get_count_of_tracks(Vector<CSS::ExplicitGridTrack> const&, AvailableSpace const&, Box const&);
void build_valid_grid_areas(Box const&);
void place_item_with_row_and_column_position(Box const& box, Box const& child_box);
void place_item_with_row_position(Box const& box, Box const& child_box);
void place_item_with_column_position(Box const& box, Box const& child_box, int& auto_placement_cursor_x, int& auto_placement_cursor_y);