Commit 370de89c authored by Christian Biesinger's avatar Christian Biesinger Committed by Chromium LUCI CQ

[AspectRatio] Correctly detect indefinite percentages

The block size may be a percentage, in which case we would think the
extent is definite on the final pass through this function, even if
it is an indefinite percentage. Fix this by using BlockLengthUnresolvable.

R=ikilpatrick@chromium.org, mstensho@chromium.org

Bug: 1154572
Change-Id: Ia70dc730d4fee2005904942afa4020f9074f4eee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595248
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837699}
parent 22af966d
......@@ -636,8 +636,7 @@ LayoutUnit ComputeBlockSizeForFragmentInternal(
style.OverflowBlockDirection() == EOverflow::kScroll))
return min_max.min_size;
const bool is_logical_height_auto = logical_height.IsAuto();
if (is_logical_height_auto) {
if (logical_height.IsAuto()) {
logical_height = space.StretchBlockSizeIfAuto() ? Length::FillAvailable()
: Length::FitContent();
}
......@@ -647,8 +646,10 @@ LayoutUnit ComputeBlockSizeForFragmentInternal(
space, style, border_padding, logical_height, intrinsic_size,
LengthResolvePhase::kLayout, available_block_size_adjustment,
opt_percentage_resolution_block_size_for_min_max);
if (UNLIKELY((extent == kIndefiniteSize || is_logical_height_auto) &&
!style.AspectRatio().IsAuto() && inline_size)) {
if (UNLIKELY(!style.AspectRatio().IsAuto() && inline_size &&
BlockLengthUnresolvable(
space, logical_height, LengthResolvePhase::kLayout,
opt_percentage_resolution_block_size_for_min_max))) {
extent =
BlockSizeFromAspectRatio(border_padding, style.LogicalAspectRatio(),
style.BoxSizing(), *inline_size);
......
......@@ -140,6 +140,7 @@ crbug.com/591099 external/wpt/css/css-shapes/shape-outside/supported-shapes/poly
crbug.com/1045668 external/wpt/css/css-sizing/aspect-ratio/abspos-013.html [ Pass ]
crbug.com/1045668 external/wpt/css/css-sizing/aspect-ratio/block-aspect-ratio-024.html [ Failure ]
crbug.com/1045668 external/wpt/css/css-sizing/aspect-ratio/block-aspect-ratio-028.html [ Failure ]
crbug.com/1154572 external/wpt/css/css-sizing/aspect-ratio/block-aspect-ratio-030.html [ Failure ]
crbug.com/1157740 external/wpt/css/css-sizing/aspect-ratio/flex-aspect-ratio-024.html [ Failure ]
crbug.com/591099 external/wpt/css/css-sizing/clone-nowrap-intrinsic-size-bidi.html [ Failure ]
crbug.com/591099 external/wpt/css/css-sizing/intrinsic-percent-non-replaced-004.html [ Failure ]
......
<!DOCTYPE html>
<title>CSS aspect-ratio: div inline size with indefinite percentage</title>
<link rel="author" title="Google LLC" href="https://www.google.com/">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio">
<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="width: 100px;">
<div style="background: green; height: 100%; aspect-ratio: 1/1;"></div>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment