Bug 1667668 Part 2 - Use main max size to clamp specified size suggestion only if main size is definite. r=dholbert

flex-aspect-ratio-img-row-012.html is the test failed without this
patch. flex-aspect-ratio-img-column-016.html is added for symmetry (Note
column-012.html to column-015.html is occupied in upstream).

Differential Revision: https://phabricator.services.mozilla.com/D91679
This commit is contained in:
Ting-Yu Lin 2020-09-29 16:41:03 +00:00
Родитель 47c44a2355
Коммит 98a915364c
3 изменённых файлов: 33 добавлений и 7 удалений

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

@ -1527,14 +1527,14 @@ static nscoord PartiallyResolveAutoMinSize(
}
}
// Clamp specified size suggestion by the max main-size property if its
// definite.
if (aFlexItem.MainMaxSize() != NS_UNCONSTRAINEDSIZE) {
specifiedSizeSuggestion =
std::min(specifiedSizeSuggestion, aFlexItem.MainMaxSize());
}
if (specifiedSizeSuggestion != nscoord_MAX) {
// Clamp specified size suggestion by the max main-size property if it's
// definite.
if (aFlexItem.MainMaxSize() != NS_UNCONSTRAINEDSIZE) {
specifiedSizeSuggestion =
std::min(specifiedSizeSuggestion, aFlexItem.MainMaxSize());
}
// We have the specified size suggestion. Return it now since we don't need
// to consider transferred size suggestion.
FLEX_LOGV(" Specified size suggestion: %d", specifiedSizeSuggestion);

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

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Aspect-ratio items with undefined specified size suggestion</title>
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1667668">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<meta name="assert" content="Flex item with auto height and fixed max-height (in a column-oriented flex container) should have an undefined specified size suggestion.">
<p>Test passes if there is a filled green square.</p>
<div style="display: flex; flex-direction: column; ">
<img src="support/200x200-green.png" style="max-height:150px; width:100px;">
</div>

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

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Aspect-ratio items with undefined specified size suggestion</title>
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1667668">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<meta name="assert" content="Flex item with auto width and fixed max-width (in a row-oriented flex container) should have an undefined specified size suggestion.">
<p>Test passes if there is a filled green square.</p>
<div style="display: flex;">
<img src="support/200x200-green.png" style="max-width:150px; height:100px;">
</div>