Commit 5a4e760f authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[AspectRatio] In abspos, handle transferred min/max

..even if contain-intrinsic-size is specified.

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

Bug: 1124922
Change-Id: If4c887a3536b65fbeb1c22a8a2e3a66896046ae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2423584
Auto-Submit: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810105}
parent b8e245a9
......@@ -439,6 +439,15 @@ void ComputeOutOfFlowInlineDimensions(
space, style, border_padding, min_max_sizes, style.LogicalMaxWidth(),
LengthResolvePhase::kLayout);
// This implements the transferred min/max sizes per
// https://drafts.csswg.org/css-sizing-4/#aspect-ratio
if (style.AspectRatio() && dimensions->size.block_size == kIndefiniteSize) {
MinMaxSizes sizes = ComputeMinMaxInlineSizesFromAspectRatio(
space, style, border_padding, LengthResolvePhase::kLayout);
min_inline_size = std::max(sizes.min_size, min_inline_size);
max_inline_size = std::min(sizes.max_size, max_inline_size);
}
bool is_table = style.IsDisplayTableBox();
base::Optional<LayoutUnit> inline_size;
if (!style.LogicalWidth().IsAuto()) {
......
......@@ -21,7 +21,7 @@ struct NGLogicalStaticPosition;
struct CORE_EXPORT NGLogicalOutOfFlowDimensions {
NGBoxStrut inset;
LogicalSize size;
LogicalSize size = {kIndefiniteSize, kIndefiniteSize};
NGBoxStrut margins;
};
......
<!DOCTYPE html>
<title>CSS aspect-ratio: abspos div inline size with max-height and contain-intrinsic-size</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="help" href="https://github.com/w3c/csswg-drafts/issues/5257">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" />
<meta name="assert" content="A max-height constraint should be transferred through the aspect-ratio to apply to the inline size">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="position: relative; height: 100px; position: relative;">
<div style="position: absolute; aspect-ratio: 1/1; max-height: 100%; min-height: 0; contain-intrinsic-size: 500px 500px; contain: size; background: green; color: green;">
</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