Skip to content

Commit

Permalink
Fix margin collapsing with aspect-ratio.
Browse files Browse the repository at this point in the history
Basically, we treat aspect-ratio (together with inline size) as a
non-auto block size. This means the block is not empty when using
aspect-ratio.

Also, add 2 tentative wpts for this, based on the current spec issue
examples.

w3c/csswg-drafts#5328

Differential Revision: https://phabricator.services.mozilla.com/D84452

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1639963
gecko-commit: a5e9b2bede3a76b9587985a37eed227dcbabd620
gecko-integration-branch: autoland
gecko-reviewers: emilio
  • Loading branch information
BorisChiou authored and moz-wptsync-bot committed Aug 21, 2020
1 parent 4b8d683 commit a56c6a2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<title>CSS aspect-ratio: margin-collapsing with aspect-ratio on child element</title>
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio">
<link rel="help" href="https://drafts.csswg.org/css2/#collapsing-margins">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" />

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="background: green; width: 100px; height: 25px; margin-bottom: -50px;"></div>
<div style="background: green; width: 100px; margin: 0px;">
<div style="margin-top: 50px; margin-bottom: 100px;
width: 100px; aspect-ratio: 2/1"></div>
</div>
<div style="background: green; width: 100px; height: 25px; margin-top: -100px;"></div>
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>CSS aspect-ratio: margin-collapsing with aspect-ratio on parent element</title>
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio">
<link rel="help" href="https://drafts.csswg.org/css2/#collapsing-margins">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" />

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div style="background: green; width: 100px; height: 25px; margin-bottom: -200px;"></div>
<div style="background: green; width: 100px; margin: 0px; aspect-ratio: 2/1">
<div style="width: 100px; margin-top: 50px; margin-bottom: 200px;"></div>
</div>
<div style="background: green; width: 100px; height: 25px;"></div>

0 comments on commit a56c6a2

Please sign in to comment.