Commit 95c34ae1 authored by cbiesinger's avatar cbiesinger Committed by Commit bot

availableLogicalHeightUsing needs to take flexbox stretched heights into account

This function is used to calculate percentage positions for relative-
positioned boxes in LayoutBoxModelObject::relativePositionOffset and thus needs
to check childLogicalHeightForPercentageResolution.

BUG=646397
R=eae@chromium.org,dgrogan@chromium.org

Review-Url: https://codereview.chromium.org/2349803002
Cr-Commit-Position: refs/heads/master@{#419271}
parent 4aa87e1c
<!DOCTYPE html>
<style>
html, body {
margin: 0;
}
.border {
border:1px solid #000;
}
.width-50 {
width: 50%;
}
.flex {
display: flex;
flex-flow: row wrap;
}
.tall {
height: 300px;
}
.top-50 {
position: relative;
top: 50%;
}
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/check-layout-th.js"></script>
<body onload="checkLayout('.border')">
<div class="border">
<div class="flex">
<div class="width-50">
<label class="top-50" data-offset-y="151">This should be in the center of the container</label>
</div>
<div class="width-50">
<div class="tall">
This is tall
</div>
</div>
</div>
</div>
......@@ -3081,6 +3081,13 @@ LayoutUnit LayoutBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
return logicalHeight() - borderAndPaddingLogicalHeight();
}
if (isFlexItem()) {
LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent());
LayoutUnit stretchedHeight = flexBox.childLogicalHeightForPercentageResolution(*this);
if (stretchedHeight != LayoutUnit(-1))
return stretchedHeight;
}
if (h.isPercentOrCalc() && isOutOfFlowPositioned()) {
// FIXME: This is wrong if the containingBlock has a perpendicular writing mode.
LayoutUnit availableHeight = containingBlockLogicalHeightForPositioned(containingBlock());
......
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