Index: Source/core/rendering/RenderBox.cpp |
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
index c214c7eef167186ff38a19d20f2d1018079eaf16..72a93e8c55a9ab751bf097d49cb1d21127537a04 100644 |
--- a/Source/core/rendering/RenderBox.cpp |
+++ b/Source/core/rendering/RenderBox.cpp |
@@ -2771,10 +2771,32 @@ LayoutUnit RenderBox::computeReplacedLogicalHeight() const |
return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style()->logicalHeight())); |
} |
+bool RenderBox::logicalHeightComputesAsNone(SizeType sizeType) const |
+{ |
+ ASSERT(sizeType == MinSize || sizeType == MaxSize); |
+ Length logicalHeightLength = sizeType == MinSize ? style()->logicalMinHeight() : style()->logicalMaxHeight(); |
+ |
+ if (logicalHeightLength == (sizeType == MinSize ? RenderStyle::initialMinSize() : RenderStyle::initialMaxSize())) |
+ return true; |
+ |
+ if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned() || document().inQuirksMode()) |
leviw_travelin_and_unemployed
2014/07/07 18:02:35
Why the Quirks Mode check here? Is this tested any
|
+ return false; |
+ |
+ // Anonymous block boxes are ignored when resolving percentage values that would refer to it: |
+ // the closest non-anonymous ancestor box is used instead. |
+ RenderBlock* cb = containingBlock(); |
+ while (cb->isAnonymous()) |
+ cb = cb->containingBlock(); |
+ |
+ return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); |
+} |
+ |
LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const |
{ |
- LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight()); |
- LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); |
+ // If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, |
+ // the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height'). |
+ LayoutUnit minLogicalHeight = logicalHeightComputesAsNone(MinSize) ? LayoutUnit() : computeReplacedLogicalHeightUsing(style()->logicalMinHeight()); |
esprehn
2014/07/07 18:15:53
computeReplacedLogicalHeightUsing should just know
|
+ LayoutUnit maxLogicalHeight = logicalHeightComputesAsNone(MaxSize) ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); |
return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)); |
} |