mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Fix grid size when intrinsically sized
This fixes a bug that was seen when a combination of the grid having been floated with `float: left` and a `minmax()` column size were used. The issue was that a grid track size should be considered intrinsically sized if both the min and max sizes are intrinsic, not just one of them.
This commit is contained in:
parent
9f691b7fe4
commit
c987c934d0
Notes:
sideshowbarker
2024-07-16 21:06:56 +09:00
Author: https://github.com/martinfalisse Commit: https://github.com/SerenityOS/serenity/commit/c987c934d0 Pull-request: https://github.com/SerenityOS/serenity/pull/18475 Issue: https://github.com/SerenityOS/serenity/issues/18387 Reviewed-by: https://github.com/kalenikaliaksandr
14
Tests/LibWeb/Layout/expected/grid/intrinsic-sized-column.txt
Normal file
14
Tests/LibWeb/Layout/expected/grid/intrinsic-sized-column.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
|
BlockContainer <html> at (0,0) content-size 800x35.46875 children: inline
|
||||||
|
TextNode <#text>
|
||||||
|
BlockContainer <body> at (8,8) content-size 0x19.46875 floating children: not-inline
|
||||||
|
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
|
||||||
|
TextNode <#text>
|
||||||
|
Box <div.grid> at (8,8) content-size 0x19.46875 children: not-inline
|
||||||
|
BlockContainer <(anonymous)> children: inline
|
||||||
|
TextNode <#text>
|
||||||
|
BlockContainer <div.whee> at (9,9) content-size 18x17.46875 children: inline
|
||||||
|
line 0 width: 37.953125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||||
|
frag 0 from TextNode start: 0, length: 4, rect: [9,9 37.953125x17.46875]
|
||||||
|
"whee"
|
||||||
|
TextNode <#text>
|
@ -0,0 +1,9 @@
|
|||||||
|
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
|
BlockContainer <html> at (1,1) content-size 798x39.46875 children: not-inline
|
||||||
|
BlockContainer <body> at (10,10) content-size 2x21.46875 floating children: not-inline
|
||||||
|
Box <div.grid> at (11,11) content-size 0x19.46875 children: not-inline
|
||||||
|
BlockContainer <div.whee> at (12,12) content-size 35.953125x17.46875 children: inline
|
||||||
|
line 0 width: 37.953125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||||
|
frag 0 from TextNode start: 0, length: 4, rect: [12,12 37.953125x17.46875]
|
||||||
|
"whee"
|
||||||
|
TextNode <#text>
|
24
Tests/LibWeb/Layout/input/grid/intrinsic-sized-column.html
Normal file
24
Tests/LibWeb/Layout/input/grid/intrinsic-sized-column.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
float: left;
|
||||||
|
font-family: 'SerenitySans';
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.whee {
|
||||||
|
background: pink;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="grid">
|
||||||
|
<div class="whee" style="border: 1px solid black;">whee
|
18
Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid.html
Normal file
18
Tests/LibWeb/Layout/input/grid/intrinsic-sized-grid.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html><html><head><style>
|
||||||
|
* {
|
||||||
|
border: 1px solid black !important;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
float: left;
|
||||||
|
font-family: 'SerenitySans';
|
||||||
|
}
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas: "foo whee";
|
||||||
|
grid-template-columns: min-content minmax(0, auto) min-content;
|
||||||
|
}
|
||||||
|
.whee {
|
||||||
|
grid-area: whee;
|
||||||
|
background: pink;
|
||||||
|
}
|
||||||
|
</style></head><body><div class="grid"><div class="whee">whee
|
@ -753,7 +753,7 @@ void GridFormattingContext::calculate_sizes_of_columns(Box const& box, Available
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!grid_column.min_track_sizing_function.is_intrinsic_track_sizing()) {
|
if (!grid_column.min_track_sizing_function.is_intrinsic_track_sizing() && !grid_column.max_track_sizing_function.is_intrinsic_track_sizing()) {
|
||||||
++index;
|
++index;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1257,7 +1257,7 @@ void GridFormattingContext::calculate_sizes_of_rows(Box const& box)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!grid_row.min_track_sizing_function.is_intrinsic_track_sizing()) {
|
if (!grid_row.min_track_sizing_function.is_intrinsic_track_sizing() && !grid_row.max_track_sizing_function.is_intrinsic_track_sizing()) {
|
||||||
++index;
|
++index;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user