Bug 1692425 [wpt PR 27602] - [css-layout] Don't let contain-intrinsic-size establish an aspect ratio, a=testonly

Automatic update from web-platform-tests
[css-layout] Don't let contain-intrinsic-size establish an aspect ratio

contain:size on a replaced element kills its natural aspect ratio. Blink
had been treating contain-intrinsic-size values as establishing a new
aspect ratio, but this was not supposed to happen. E.g. the following
should have no aspect ratio:

<img src="100x100.png" style="contain: size; contain-intrinsic-size: 40px 20px">

This change has the side effect of making HasAspectRatio() logically
imply !GetAspectRatio.IsEmpty().

Flex has a DCHECK enforcing that logical relationship, which was
triggered in the canvas test case in this patch.

Fixed: 1175526
Change-Id: I592820a133bfea88ecdff42aade0814cf96ff922
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2691931
Commit-Queue: David Grogan <dgrogan@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#859266}

--

wpt-commits: b964db08565d01d21c778783da8e9b5d403de3d4
wpt-pr: 27602
This commit is contained in:
David Grogan 2021-03-10 21:11:31 +00:00 коммит произвёл moz-wptsync-bot
Родитель 64c9ecd7ef
Коммит ad66106f49
2 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,14 @@
<!doctype html>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#algo-cross-item" />
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images" />
<link rel="issue" href="https://crbug.com/1175526" />
<meta name="assert" content="width and height attributes on canvas don't map to css width/height, but do map to css aspect ratio, which is honored by flexbox, even when the item has contain: size. " />
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<p>Test passes if there is a filled green square.</p>
<!-- align-items: flex-start so we don't have to think about stretching -->
<div style="display: flex; align-items: flex-start;">
<canvas width=20 height=20 style="contain: size; background: green; width: 100px;">
</div>

Просмотреть файл

@ -0,0 +1,18 @@
<!doctype html>
<meta charset="utf8">
<title>CSS contain-intrinsic-size: aspect-ratio interaction</title>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5241">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<meta name="assert" content="contain-intrinsic-size doesn't establish an aspect-ratio">
<p>Test passes if there is a filled green square.</p>
<!-- Use flex because a bug in blink's layout_replaced size computation makes
this test pass even when blink makes c-i-s establish an aspect ratio. Flex
doesn't use layout_replaced sizing, so it bypasses the bug. -->
<!-- min-width: 0 is just so we don't have to think about it. -->
<div style="display: flex;">
<img src="/css/support/60x60-green.png" style="min-width: 0px; contain: size; contain-intrinsic-size: 50px 100px; width: 100px;">
</div>