Index: Source/WebCore/rendering/RenderBox.cpp |
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp |
index f93b1474b8a07a98d633f50a3e118ec98b8473d5..961c0ec2f55c398ac0118f0880a7d54383a38deb 100644 |
--- a/Source/WebCore/rendering/RenderBox.cpp |
+++ b/Source/WebCore/rendering/RenderBox.cpp |
@@ -507,26 +507,26 @@ LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWi |
return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUse->logicalMinWidth(), availableWidth, cb, region, offsetFromLogicalTopOfFirstPage)); |
} |
-LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight) const |
+LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit contentHeight) const |
{ |
RenderStyle* styleToUse = style(); |
if (!styleToUse->logicalMaxHeight().isUndefined()) { |
- LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight()); |
+ LayoutUnit maxH = computeLogicalHeightUsing(styleToUse->logicalMaxHeight(), contentHeight); |
if (maxH != -1) |
logicalHeight = min(logicalHeight, maxH); |
} |
- return max(logicalHeight, computeLogicalHeightUsing(styleToUse->logicalMinHeight())); |
+ return max(logicalHeight, computeLogicalHeightUsing(styleToUse->logicalMinHeight(), contentHeight)); |
} |
-LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight) const |
+LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, LayoutUnit contentHeight) const |
{ |
RenderStyle* styleToUse = style(); |
if (!styleToUse->logicalMaxHeight().isUndefined()) { |
- LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeight()); |
+ LayoutUnit maxH = computeContentLogicalHeight(styleToUse->logicalMaxHeight(), contentHeight); |
if (maxH != -1) |
logicalHeight = min(logicalHeight, maxH); |
} |
- return max(logicalHeight, computeContentLogicalHeight(styleToUse->logicalMinHeight())); |
+ return max(logicalHeight, computeContentLogicalHeight(styleToUse->logicalMinHeight(), contentHeight)); |
} |
IntRect RenderBox::absoluteContentBox() const |
@@ -2510,14 +2510,15 @@ void RenderBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica |
LayoutUnit heightResult; |
if (checkMinMaxHeight) { |
- heightResult = computeLogicalHeightUsing(style()->logicalHeight()); |
+ heightResult = computeLogicalHeightUsing(style()->logicalHeight(), computedValues.m_extent - borderAndPaddingLogicalHeight()); |
if (heightResult == -1) |
heightResult = computedValues.m_extent; |
- heightResult = constrainLogicalHeightByMinMax(heightResult); |
+ heightResult = constrainLogicalHeightByMinMax(heightResult, computedValues.m_extent - borderAndPaddingLogicalHeight()); |
} else { |
// The only times we don't check min/max height are when a fixed length has |
// been given as an override. Just use that. The value has already been adjusted |
// for box-sizing. |
+ ASSERT(h.isFixed()); |
heightResult = h.value() + borderAndPaddingLogicalHeight(); |
} |
@@ -2557,24 +2558,28 @@ LayoutUnit RenderBox::viewLogicalHeightForPercentages() const |
return view()->viewLogicalHeight(); |
} |
-LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height) const |
+LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height, LayoutUnit contentHeight) const |
{ |
- LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(height); |
+ LayoutUnit logicalHeight = computeContentAndScrollbarLogicalHeightUsing(height, contentHeight); |
if (logicalHeight != -1) |
logicalHeight = adjustBorderBoxLogicalHeightForBoxSizing(logicalHeight); |
return logicalHeight; |
} |
-LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height) const |
+LayoutUnit RenderBox::computeContentLogicalHeight(const Length& height, LayoutUnit contentHeight) const |
{ |
- LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(height); |
+ LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(height, contentHeight); |
if (heightIncludingScrollbar == -1) |
return -1; |
return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); |
} |
-LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height) const |
+LayoutUnit RenderBox::computeContentAndScrollbarLogicalHeightUsing(const Length& height, LayoutUnit contentHeight) const |
{ |
+ if (height.isMinContent() || height.isMaxContent() || height.isFitContent()) |
ojan
2013/04/11 03:21:46
Maybe include a FIXME that the spec is considering
cbiesinger
2013/04/12 01:17:52
Done.
|
+ return contentHeight; |
+ if (height.isFillAvailable()) |
+ return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPaddingLogicalHeight(); |
if (height.isFixed()) |
return height.value(); |
if (height.isPercent()) |
@@ -2645,7 +2650,7 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const |
} |
} else if (cbstyle->logicalHeight().isFixed()) { |
LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle->logicalHeight().value()); |
- availableHeight = max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight())); |
+ availableHeight = max<LayoutUnit>(0, cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); |
} else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { |
// We need to recur and compute the percentage height for our containing block. |
LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle->logicalHeight()); |
@@ -2655,7 +2660,7 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const |
// handle the min/max of the current block, its caller does. So the |
// return value from the recursive call will not have been adjusted |
// yet. |
- LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); |
+ LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1); |
availableHeight = max<LayoutUnit>(0, contentBoxHeight); |
} |
} else if (isOutOfFlowPositionedWithSpecifiedHeight) { |
@@ -2817,7 +2822,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co |
LayoutUnit RenderBox::availableLogicalHeight(AvailableLogicalHeightType heightType) const |
{ |
- return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style()->logicalHeight(), heightType)); |
+ return constrainLogicalHeightByMinMax(availableLogicalHeightUsing(style()->logicalHeight(), heightType), -1); |
} |
LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogicalHeightType heightType) const |
@@ -2840,7 +2845,7 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogi |
return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight)); |
} |
- LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(h); |
+ LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(h, -1); |
if (heightIncludingScrollbar != -1) |
return std::max<LayoutUnit>(0, adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight()); |
@@ -3454,7 +3459,7 @@ void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp |
} |
// Calculate constraint equation values for 'min-height' case. |
- if (!styleToUse->logicalMinHeight().isZero()) { |
+ if (!styleToUse->logicalMinHeight().isZero() || styleToUse->logicalMinHeight().isIntrinsic()) { |
LogicalExtentComputedValues minValues; |
computePositionedLogicalHeightUsing(styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight, |
@@ -3541,6 +3546,14 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, |
logicalHeightIsAuto = false; |
} |
+ LayoutUnit resolvedLogicalHeight; |
+ if (logicalHeightLength.isMinContent() || logicalHeightLength.isMaxContent() || logicalHeightLength.isFitContent()) |
ojan
2013/04/11 03:21:46
Can you make a computeIntrinsicLogicalHeightUsing
cbiesinger
2013/04/12 01:17:52
Done (named it computeIntrinsicLogicalContentHeigh
ojan
2013/04/12 04:03:11
SGTM
|
+ resolvedLogicalHeight = contentLogicalHeight; |
+ else if (logicalHeightLength.isFillAvailable()) |
+ resolvedLogicalHeight = containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - bordersPlusPadding; |
+ else |
+ resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight, renderView)); |
+ |
if (!logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { |
/*-----------------------------------------------------------------------*\ |
* If none of the three are 'auto': If both 'margin-top' and 'margin- |
@@ -3553,7 +3566,7 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, |
// NOTE: It is not necessary to solve for 'bottom' in the over constrained |
// case because the value is not used for any further calculations. |
- logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight, renderView)); |
+ logicalHeightValue = resolvedLogicalHeight; |
logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); |
const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView) + bordersPlusPadding); |
@@ -3620,7 +3633,7 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, |
logicalHeightValue = contentLogicalHeight; |
} else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { |
// RULE 4: (solve of top) |
- logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight, renderView)); |
+ logicalHeightValue = resolvedLogicalHeight; |
logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight, renderView)); |
} else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { |
// RULE 5: (solve of height) |
@@ -3628,7 +3641,7 @@ void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, |
logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight, renderView))); |
} else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) { |
// RULE 6: (no need solve of bottom) |
- logicalHeightValue = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight, renderView)); |
+ logicalHeightValue = resolvedLogicalHeight; |
logicalTopValue = valueForLength(logicalTop, containerLogicalHeight, renderView); |
} |
} |