.grid-item) [468,8 50x35]
+ TextPaintable (TextNode<#text>)
+ PaintableWithLines (BlockContainer
.grid-item) [528,8 50x35]
+ TextPaintable (TextNode<#text>)
+ PaintableWithLines (BlockContainer(anonymous)) [8,43 784x0]
diff --git a/Tests/LibWeb/Layout/input/grid/fixed-tracks-followed-by-repeat-auto-fill.html b/Tests/LibWeb/Layout/input/grid/fixed-tracks-followed-by-repeat-auto-fill.html
new file mode 100644
index 00000000000..a38317c08fc
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/fixed-tracks-followed-by-repeat-auto-fill.html
@@ -0,0 +1,26 @@
+
+
+
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
index 5c475a930b3..c8be1a117f2 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
@@ -88,7 +88,7 @@ CSSPixels GridFormattingContext::resolve_definite_track_size(CSS::GridSize const
return 0;
}
-int GridFormattingContext::count_of_repeated_auto_fill_or_fit_tracks(GridDimension dimension)
+int GridFormattingContext::count_of_repeated_auto_fill_or_fit_tracks(GridDimension dimension, CSS::ExplicitGridTrack const& repeated_track)
{
// https://www.w3.org/TR/css-grid-2/#auto-repeat
// 7.2.3.2. Repeat-to-fill: auto-fill and auto-fit repetitions
@@ -102,12 +102,11 @@ int GridFormattingContext::count_of_repeated_auto_fill_or_fit_tracks(GridDimensi
// content box of its grid container
auto const& grid_computed_values = grid_container().computed_values();
- auto const& track_list = dimension == GridDimension::Row ? grid_computed_values.grid_template_rows().track_list() : grid_computed_values.grid_template_columns().track_list();
CSSPixels size_of_repeated_tracks = 0;
// (treating each track as its max track sizing function if that is definite or its minimum track sizing
// function otherwise, flooring the max track sizing function by the min track sizing function if both
// are definite, and taking gap into account)
- auto const& repeat_track_list = track_list.first().repeat().grid_track_size_list().track_list();
+ auto const& repeat_track_list = repeated_track.repeat().grid_track_size_list().track_list();
for (auto const& explicit_grid_track : repeat_track_list) {
auto const& track_sizing_function = explicit_grid_track;
CSSPixels track_size = 0;
@@ -422,7 +421,7 @@ void GridFormattingContext::initialize_grid_tracks_from_definition(GridDimension
int repeat_count = 1;
if (track_definition.is_repeat()) {
if (track_definition.repeat().is_auto_fill() || track_definition.repeat().is_auto_fit())
- repeat_count = count_of_repeated_auto_fill_or_fit_tracks(dimension);
+ repeat_count = count_of_repeated_auto_fill_or_fit_tracks(dimension, track_definition);
else
repeat_count = track_definition.repeat().repeat_count();
}
@@ -2096,7 +2095,7 @@ void GridFormattingContext::init_grid_lines(GridDimension dimension)
} else if (explicit_track.is_repeat()) {
int repeat_count = 0;
if (explicit_track.repeat().is_auto_fill() || explicit_track.repeat().is_auto_fit())
- repeat_count = count_of_repeated_auto_fill_or_fit_tracks(dimension);
+ repeat_count = count_of_repeated_auto_fill_or_fit_tracks(dimension, explicit_track);
else
repeat_count = explicit_track.repeat().repeat_count();
auto const& repeat_track = explicit_track.repeat();
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h
index 719c8914f54..c0ac693522f 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h
@@ -248,7 +248,7 @@ private:
Optional
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(GridDimension);
+ int count_of_repeated_auto_fill_or_fit_tracks(GridDimension, CSS::ExplicitGridTrack const& repeated_track);
void build_grid_areas();