Index: Source/core/rendering/RenderBox.cpp |
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
index 4da182008c1bcf4f08723c6dfd358ff617219c80..54822977280dabd8d624d71a151baf3473030709 100644 |
--- a/Source/core/rendering/RenderBox.cpp |
+++ b/Source/core/rendering/RenderBox.cpp |
@@ -2772,10 +2772,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(); |
esprehn
2014/07/16 20:43:50
Why suffix with Length?
|
+ |
+ if (logicalHeightLength == (sizeType == MinSize ? RenderStyle::initialMinSize() : RenderStyle::initialMaxSize())) |
esprehn
2014/07/16 20:43:49
Can we put this in a stack var instead of inside t
|
+ return true; |
+ |
+ if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned()) |
+ 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(); |
esprehn
2014/07/16 20:43:50
containingBlock = this->containingBlock() ? I'd be
|
+ 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/16 20:43:49
Instead of using a ternary I might early initializ
|
+ LayoutUnit maxLogicalHeight = logicalHeightComputesAsNone(MaxSize) ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); |
return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight)); |
} |