Skip to content

Commit

Permalink
Use grid area size rather than available space when applying aspect r…
Browse files Browse the repository at this point in the history
…atio to grid items (#656)
  • Loading branch information
nicoburns authored May 14, 2024
1 parent c154b8a commit a326c26
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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

## 0.4.3

Expand Down
4 changes: 2 additions & 2 deletions src/compute/grid/types/grid_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl GridItem {
tree.measure_child_size(
self.node,
known_dimensions,
available_space,
inner_node_size,
available_space.map(|opt| match opt {
Some(size) => AvailableSpace::Definite(size),
None => AvailableSpace::MinContent,
Expand Down Expand Up @@ -387,7 +387,7 @@ impl GridItem {
tree.measure_child_size(
self.node,
known_dimensions,
available_space,
inner_node_size,
available_space.map(|opt| match opt {
Some(size) => AvailableSpace::Definite(size),
None => AvailableSpace::MaxContent,
Expand Down
21 changes: 21 additions & 0 deletions test_fixtures/grid/chrome_issue_325928327.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="../../scripts/gentest/test_helper.js"></script>
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
<title>
Test description
</title>
</head>
<body>

<div class="viewport">
<div id="test-root" style="width: 100%; height: 40px; display: grid; justify-items: center;">
<div style="height: 100%; outline: 2px solid red;">
<div style="height: 100%; aspect-ratio: 1; background: slategray;"></div>
</div>
</div>
</div>

</body>
</html>
112 changes: 112 additions & 0 deletions tests/generated/grid/chrome_issue_325928327.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/generated/grid/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a326c26

Please sign in to comment.