Skip to content

Commit be60ff4

Browse files
committed
Use grid area size rather than available space when applying aspect ratio to grid items
1 parent c154b8a commit be60ff4

File tree

5 files changed

+137
-2
lines changed

5 files changed

+137
-2
lines changed

RELEASES.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Content alignment (`align-content`/`justify-content`) behaviour was updated to match the latest spec (and Chrome 123+) (#635)
88
- Ensure that root Flexbox nodes are floored by their padding-border (#651, #655)
9+
- Use grid area size not available space when applying aspect ratio to grid containers (#656)
910

1011
## 0.4.3
1112

src/compute/grid/types/grid_item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl GridItem {
348348
tree.measure_child_size(
349349
self.node,
350350
known_dimensions,
351-
available_space,
351+
inner_node_size,
352352
available_space.map(|opt| match opt {
353353
Some(size) => AvailableSpace::Definite(size),
354354
None => AvailableSpace::MinContent,
@@ -387,7 +387,7 @@ impl GridItem {
387387
tree.measure_child_size(
388388
self.node,
389389
known_dimensions,
390-
available_space,
390+
inner_node_size,
391391
available_space.map(|opt| match opt {
392392
Some(size) => AvailableSpace::Definite(size),
393393
None => AvailableSpace::MaxContent,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<script src="../../scripts/gentest/test_helper.js"></script>
5+
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
6+
<title>
7+
Test description
8+
</title>
9+
</head>
10+
<body>
11+
12+
<div class="viewport">
13+
<div id="test-root" style="width: 100%; height: 40px; display: grid; justify-items: center;">
14+
<div style="height: 100%; outline: 2px solid red;">
15+
<div style="height: 100%; aspect-ratio: 1; background: slategray;"></div>
16+
</div>
17+
</div>
18+
</div>
19+
20+
</body>
21+
</html>

tests/generated/grid/chrome_issue_325928327.rs

+112
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/generated/grid/mod.rs

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)