fune/testing/web-platform/tests/css/css-flexbox/canvas-contain-size.html
David Grogan ad66106f49 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
2021-03-15 08:34:06 +00:00

14 lines
913 B
HTML

<!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>