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
  • Loading branch information
nicoburns committed May 14, 2024
1 parent dda47e2 commit c778403
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 2 deletions.
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 c778403

Please sign in to comment.