[css-flexbox] Use correct aspect ratio for min-size: auto
https://codereview.chromium.org/1421423005 caused this regression. We never
handled aspect ratio correctly in flexbox (that's bug 249112), but that patch
made our handling worse because we now distort and enlarge images when
a cross axis size is specified that's bigger than the image's intrinsic size.
This was tested by
imported/csswg-test/css-flexbox-1/flex-minimum-height-flex-items-008.xht which
we now pass. I didn't realize the significance of failing that test at the time :(
BUG=581361,581535
[email protected]
Review URL: https://codereview.chromium.org/1639723003
Cr-Commit-Position: refs/heads/master@{#372000}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 5300b21..b9c0c34 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -971,13 +971,17 @@
crbug.com/471824 virtual/pointerevent/imported/web-platform-tests/pointerevents/pointerevent_touch-action-illegal.html [ Skip ]
crbug.com/471824 virtual/pointerevent/imported/web-platform-tests/pointerevents/pointerevent_touch-action-verification.html [ Skip ]
+# These testcases are incorrect, mark them as failing until they're fixed in the testsuite.
+# https://lists.w3.org/Archives/Public/www-style/2016Jan/0275.html
+# https://lists.w3.org/Archives/Public/www-style/2016Jan/0276.html
+crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-height-flex-items-005.xht [ Failure ]
+crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-height-flex-items-007.xht [ Failure ]
+crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-width-flex-items-005.xht [ Failure ]
+crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-width-flex-items-007.xht [ Failure ]
+
# Not implemented yet
crbug.com/336604 imported/csswg-test/css-flexbox-1/flexbox_visibility-collapse-line-wrapping.html [ Failure ]
crbug.com/336604 imported/csswg-test/css-flexbox-1/flexbox_visibility-collapse.html [ Failure ]
-crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-height-flex-items-005.xht [ Failure ]
-crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-height-flex-items-007.xht [ Failure ]
-crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-height-flex-items-008.xht [ Failure ]
-crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-width-flex-items-005.xht [ Failure ]
crbug.com/249112 imported/csswg-test/css-flexbox-1/flex-minimum-width-flex-items-006.xht [ Failure ]
crbug.com/467127 imported/csswg-test/css-flexbox-1/flex-grow-006.html [ Failure ]
@@ -987,7 +991,6 @@
crbug.com/467127 imported/csswg-test/css-flexbox-1/getcomputedstyle/flexbox_computedstyle_flex-basis-0percent.html [ Failure ]
crbug.com/467127 imported/csswg-test/css-flexbox-1/getcomputedstyle/flexbox_computedstyle_flex-basis-percent.html [ Failure ]
crbug.com/467127 imported/csswg-test/css-flexbox-1/getcomputedstyle/flexbox_computedstyle_flex-shorthand-number.html [ Failure ]
-crbug.com/467127 [ Mac ] imported/csswg-test/css-flexbox-1/flex-minimum-width-flex-items-007.xht [ Failure ]
crbug.com/467127 [ Mac Win ] imported/csswg-test/css-flexbox-1/ttwf-reftest-flex-wrap-reverse.html [ Failure ]
crbug.com/467127 [ Mac Win ] imported/csswg-test/css-flexbox-1/ttwf-reftest-flex-wrap.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/minimum-size-image.html b/third_party/WebKit/LayoutTests/css3/flexbox/minimum-size-image.html
new file mode 100644
index 0000000..1840859
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/flexbox/minimum-size-image.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+
+<link href="resources/flexbox.css" rel="stylesheet">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../../resources/check-layout-th.js"></script>
+
+<body onload="checkLayout('.flexbox')">
+<div id=log></div>
+
+<div class="flexbox" style="width: 10px;" data-expected-width="10">
+ <!-- should use content width, clamped by converted max-height, as minimum width. -->
+ <img src="../images/resources/green-100.png" style="max-height: 5px;"
+ data-expected-width="5" data-expected-height="5">
+</div>
+
+<div class="flexbox" style="width: 10px;" data-expected-width="10">
+ <!-- should use min(specified, content width) = 10px as minimum width,
+ which the image will shrink to due to default flex-shrink. -->
+ <img src="../images/resources/green-10.png" style="width: 100px;" data-expected-width="10">
+</div>
+
+
+<div class="flexbox" style="width: 10px;" data-expected-width="10">
+ <!-- should use content width, clamped by converted min-height, as minimum width. -->
+ <img src="../images/resources/green-100.png" style="max-height: 5px;"
+ data-expected-width="5" data-expected-height="5">
+</div>
+
+<div class="flexbox" style="width: 10px;" data-expected-width="10">
+ <!-- should use content width, clamped by converted min-height, as minimum width. -->
+ <img src="../images/resources/green-100.png" style="max-height: 5px; min-height: 10px;"
+ data-expected-width="10" data-expected-height="10">
+</div>
+
+<div class="flexbox" style="width: 10px;" data-expected-width="10">
+ <!-- should use min(transferred, content width) = 10px as minimum width,
+ which the image will shrink to due to default flex-shrink. -->
+ <img src="../images/resources/green-10.png" style="height: 100px;" data-expected-width="10">
+</div>
+
+<div class="flexbox column" style="height: 10px;" data-expected-height="10">
+ <!-- should use content height, clamped by converted max-width, as minimum height. -->
+ <img src="../images/resources/green-100.png" style="max-width: 5px;"
+ data-expected-width="5" data-expected-height="5">
+</div>
+
+<div class="flexbox column" style="height: 10px;" data-expected-height="10">
+ <!-- should use min(specified, content height) = 10px as minimum height,
+ which the image will shrink to due to default flex-shrink. -->
+ <img src="../images/resources/green-10.png" style="height: 100px;" data-expected-height="10">
+</div>
+
+<div class="flexbox" style="height: 10px;" data-expected-height="10">
+ <!-- should use content height, clamped by converted min-height, as minimum height. -->
+ <img src="../images/resources/green-100.png" style="max-height: 5px;"
+ data-expected-height="5" data-expected-height="5">
+</div>
+
+<div class="flexbox" style="height: 10px;" data-expected-height="10">
+ <!-- should use content height, clamped by converted min-width, as minimum height. -->
+ <img src="../images/resources/green-100.png" style="max-width: 5px; min-width: 10px;"
+ data-expected-height="10" data-expected-width="10">
+</div>
+
+<div class="flexbox column" style="height: 10px;" data-expected-height="10">
+ <!-- should use min(transferred, content height) = 10px as minimum height,
+ which the image will shrink to due to default flex-shrink. -->
+ <img src="../images/resources/green-10.png" style="width: 100px;" data-expected-height="10">
+</div>