+
+In a sollicitudin augue. Sed ante augue, rhoncus nec porttitor id,
+lacinia et nibh. Pellentesque diam libero, ultrices eget eleifend at,
+consequat ut orci.
+
+
+Suspendisse potenti. Pellentesque at varius lacus, sed sollicitudin leo.
+Pellentesque malesuada mi eget pellentesque tempor. Donec egestas mauris
+est, ut lobortis nisi luctus at. Vivamus eleifend, lorem vulputate
+maximus porta, nunc metus porttitor nibh, nec bibendum nulla lectus ut
+felis.
+
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae
+condimentum erat, ac posuere arcu. Aenean tincidunt mi ligula, vel
+semper dolor aliquet at. Phasellus scelerisque dapibus diam sed rhoncus.
+Proin sed orci leo. Praesent pellentesque mi eu nunc gravida, vel
+consectetur nulla malesuada. Sed pellentesque, elit sit amet
+sollicitudin sollicitudin, lectus justo facilisis lacus, ac vehicula
+metus neque ac mi. In in augue et massa maximus venenatis auctor
+fermentum dui. Aliquam dictum finibus urna, quis lacinia massa laoreet
+a. Suspendisse elementum non lectus nec elementum. Quisque ultricies
+suscipit porttitor. Sed non urna rutrum, mattis nulla at, feugiat erat.
+Duis orci elit, vehicula sed blandit eget, auctor in arcu. Ut cursus
+magna sit amet nulla cursus, vitae gravida mauris dictum.
+
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
index bc02b99832..913f231a5e 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
@@ -841,55 +841,18 @@ void GridFormattingContext::resolve_intrinsic_track_sizes(AvailableSpace const&
// 3. Increase sizes to accommodate spanning items crossing content-sized tracks: Next, consider the
// items with a span of 2 that do not span a track with a flexible sizing function.
- // FIXME: Content-sized tracks not implemented (min-content, etc.)
-
- // 3.1. For intrinsic minimums: First increase the base size of tracks with an intrinsic min track sizing
- // function by distributing extra space as needed to accommodate these items’ minimum contributions.
-
- // If the grid container is being sized under a min- or max-content constraint, use the items’
- // limited min-content contributions in place of their minimum contributions here. (For an item
- // spanning multiple tracks, the upper limit used to calculate its limited min-/max-content
- // contribution is the sum of the fixed max track sizing functions of any tracks it spans, and is
- // applied if it only spans such tracks.)
-
- // 3.2. For content-based minimums: Next continue to increase the base size of tracks with a min track
- // sizing function of min-content or max-content by distributing extra space as needed to account
- // for these items' min-content contributions.
-
- // 3.3. For max-content minimums: Next, if the grid container is being sized under a max-content
- // constraint, continue to increase the base size of tracks with a min track sizing function of auto
- // or max-content by distributing extra space as needed to account for these items' limited
- // max-content contributions.
-
- // In all cases, continue to increase the base size of tracks with a min track sizing function of
- // max-content by distributing extra space as needed to account for these items' max-content
- // contributions.
-
- // 3.4. If at this point any track’s growth limit is now less than its base size, increase its growth
- // limit to match its base size.
-
- // 3.5. For intrinsic maximums: Next increase the growth limit of tracks with an intrinsic max track
- // sizing function by distributing extra space as needed to account for these items' min-content
- // contributions. Mark any tracks whose growth limit changed from infinite to finite in this step as
- // infinitely growable for the next step.
-
- // 3.6. For max-content maximums: Lastly continue to increase the growth limit of tracks with a max track
- // sizing function of max-content by distributing extra space as needed to account for these items'
- // max-content contributions. However, limit the growth of any fit-content() tracks by their
- // fit-content() argument.
-
// Repeat incrementally for items with greater spans until all items have been considered.
+ size_t max_item_span = 1;
+ for (auto& item : m_grid_items)
+ max_item_span = max(item.span(dimension), max_item_span);
+ for (size_t span = 2; span <= max_item_span; span++) {
+ increase_sizes_to_accommodate_spanning_items_crossing_content_sized_tracks(dimension, 2);
+ }
- // FIXME: 4. Increase sizes to accommodate spanning items crossing flexible tracks: Next, repeat the previous
+ // 4. Increase sizes to accommodate spanning items crossing flexible tracks: Next, repeat the previous
// step instead considering (together, rather than grouped by span size) all items that do span a
// track with a flexible sizing function while
-
- // - distributing space only to flexible tracks (i.e. treating all other tracks as having a fixed
- // sizing function)
-
- // - if the sum of the flexible sizing functions of all flexible tracks spanned by the item is greater
- // than zero, distributing space to such tracks according to the ratios of their flexible sizing
- // functions rather than distributing space equally
+ increase_sizes_to_accommodate_spanning_items_crossing_flexible_tracks(dimension);
// 5. If any track still has an infinite growth limit (because, for example, it had no items placed in
// it or it is a flexible track), set its growth limit to its base size.
@@ -903,6 +866,140 @@ void GridFormattingContext::resolve_intrinsic_track_sizes(AvailableSpace const&
track.has_definite_base_size = true;
}
+void GridFormattingContext::distribute_extra_space_across_spanned_tracks(CSSPixels item_size_contribution, Vector