Commit 69918b2d authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

CSSIntrinsicSize: Add a flex-box test to exercise ChildUnstretchedLogicalHeight code

This patch updates the code to simplify the if condition. This should a no-op change
since the override is considered when getting the intrinsic content logical height.

This also adds a test that fails if that if condition is not present, and passes
otherwise. The test sizes the flex box based on the unstretched size when the
item itself is stretched.

R=cbiesinger@chromium.org, chrishtr@chromium.org

Bug: 1018395
Change-Id: I16ff62d887110a9b93704160e93f2fbcc764c509
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1891012Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710970}
parent 15bfb21f
......@@ -508,12 +508,11 @@ LayoutUnit LayoutFlexibleBox::ChildUnstretchedLogicalHeight(
AutoClearOverrideLogicalHeight clear(const_cast<LayoutBox*>(&child));
LayoutUnit child_intrinsic_content_logical_height;
// TODO(crbug.com/1018395): Write more tests for this and the size
// containment.
if (child.HasOverrideIntrinsicContentLogicalHeight()) {
child_intrinsic_content_logical_height =
child.OverrideIntrinsicContentLogicalHeight();
} else if (!child.ShouldApplySizeContainment()) {
// If we have size containment specified, and are not overriding the
// intrinsic content height, then the height is LayoutUnit(). In all other
// cases, this if-condition will pass and set the intrinsic height.
if (!child.ShouldApplySizeContainment() ||
child.HasOverrideIntrinsicContentLogicalHeight()) {
child_intrinsic_content_logical_height =
child.IntrinsicContentLogicalHeight();
}
......
<!doctype html>
<meta charset="utf8">
<title>CSS intrinsic-size: flex row, flex height based on children</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override">
<style>
#flex {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
width: 250px;
}
.item {
border: 1px solid black;
box-sizing: content-box;
}
#one {
background: lightblue;
width: 55px;
height: 21px;
}
#two {
background: lightgreen;
width: 66px;
height: 42px;
}
#three {
background: lightgrey;
align-self: stretch;
width: 77px;
height: 63px;
}
</style>
<div id=flex>
<div class=item id=one></div>
<div class=item id=two></div>
<div class=item id=three></div>
</div>
<!doctype html>
<meta charset="utf8">
<title>CSS intrinsic-size: flex row, flex height based on children</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#intrinsic-size-override">
<link rel="match" href="intrinsic-size-021-ref.html">
<style>
#flex {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: flex-start;
width: 250px;
}
.item {
border: 1px solid black;
}
#one {
background: lightblue;
intrinsic-size: 55px 21px;
}
#two {
background: lightgreen;
intrinsic-size: 66px 42px;
}
#three {
background: lightgrey;
align-self: stretch;
intrinsic-size: 77px 63px;
}
</style>
<div id=flex>
<div class=item id=one></div>
<div class=item id=two></div>
<div class=item id=three></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