mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
LibWeb: Fix grid line name placement when repeat() is used
Before this change, parsed grid-template-columns/grid-template-rows were represented as two lists: line names and track sizes. The problem with this approach is that it erases the relationship between tracks and their names, which results in unnecessarily complicated code that restores this data (incorrectly if repeat() is involved) during layout. This change solves that by representing line definitions as a list of sizes and names in the order they were defined. Visual progression https://genius.com/
This commit is contained in:
parent
c4d75ac11a
commit
cfcc459140
7 changed files with 168 additions and 104 deletions
|
@ -147,6 +147,14 @@ private:
|
|||
bool invalid { false }; /* FIXME: Ignore ignore invalid areas during layout */
|
||||
};
|
||||
|
||||
struct GridLine {
|
||||
Vector<String> names;
|
||||
};
|
||||
Vector<GridLine> m_row_lines;
|
||||
Vector<GridLine> m_column_lines;
|
||||
|
||||
void init_grid_lines(GridDimension);
|
||||
|
||||
HashMap<String, GridArea> m_grid_areas;
|
||||
|
||||
Vector<GridTrack> m_grid_rows;
|
||||
|
@ -234,7 +242,7 @@ private:
|
|||
|
||||
AvailableSize get_free_space(AvailableSpace const&, GridDimension const) const;
|
||||
|
||||
int get_line_index_by_line_name(String const& line_name, CSS::GridTrackSizeList);
|
||||
Optional<int> get_line_index_by_line_name(GridDimension dimension, String const&);
|
||||
CSSPixels resolve_definite_track_size(CSS::GridSize const&, AvailableSpace const&);
|
||||
int count_of_repeated_auto_fill_or_fit_tracks(Vector<CSS::ExplicitGridTrack> const& track_list, AvailableSpace const&);
|
||||
int get_count_of_tracks(Vector<CSS::ExplicitGridTrack> const&, AvailableSpace const&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue