summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2023-05-16 17:03:14 +0300
committerAndreas Kling <kling@serenityos.org>2023-05-17 07:48:38 +0200
commitc61bb1706f4fd4bdc6363df93e0d8f31709123ff (patch)
tree154b6f05327e244a33a21045f2a1bcef73e75318
parent5f2264a2bd2cde4701ab4af9483b30f7bc53cd62 (diff)
downloadserenity-c61bb1706f4fd4bdc6363df93e0d8f31709123ff.zip
LibWeb: Use auto minimimum size while resolving flexible tracks in GFC
-rw-r--r--Tests/LibWeb/Layout/expected/grid/column-1fr-1fr.txt6
-rw-r--r--Tests/LibWeb/Layout/input/grid/column-1fr-1fr.html17
-rw-r--r--Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp2
3 files changed, 24 insertions, 1 deletions
diff --git a/Tests/LibWeb/Layout/expected/grid/column-1fr-1fr.txt b/Tests/LibWeb/Layout/expected/grid/column-1fr-1fr.txt
new file mode 100644
index 0000000000..76500ec8a2
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/column-1fr-1fr.txt
@@ -0,0 +1,6 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
+ BlockContainer <body> at (8,8) content-size 784x100 children: not-inline
+ Box <div.grid> at (8,8) content-size 100x100 [GFC] children: not-inline
+ BlockContainer <div.test> at (8,8) content-size 100x100 [BFC] children: not-inline
+ BlockContainer <div.big-child> at (8,8) content-size 500x100 children: not-inline
diff --git a/Tests/LibWeb/Layout/input/grid/column-1fr-1fr.html b/Tests/LibWeb/Layout/input/grid/column-1fr-1fr.html
new file mode 100644
index 0000000000..c0fcd3bba5
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/column-1fr-1fr.html
@@ -0,0 +1,17 @@
+<style>
+.grid {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ height: 100px;
+ width: 100px;
+}
+.test {
+ grid-column: 1 / span 2;
+ grid-row: 1;
+ background: red;
+}
+.big-child {
+ width: 500px;
+ height: 100px;
+}
+</style><div class="grid"><div class="test"><div class="big-child"></div></div></div> \ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
index 03805a6642..aa41f1346b 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
@@ -996,7 +996,7 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
if (track.min_track_sizing_function.is_flexible_length())
spanned_flexible_tracks.append(track);
}
- auto item_minimum_contribution = calculate_limited_min_content_contribution(item, dimension);
+ auto item_minimum_contribution = automatic_minimum_size(item, dimension);
distribute_extra_space_across_spanned_tracks(item_minimum_contribution, spanned_flexible_tracks);
for (auto& track : spanned_tracks) {