Index: Source/core/css/LayoutStyleCSSValueMapping.cpp |
diff --git a/Source/core/css/LayoutStyleCSSValueMapping.cpp b/Source/core/css/LayoutStyleCSSValueMapping.cpp |
index a33156932f6c3e183d3e8143a2626baca6d2b4a8..c9d004ecf898cb8bc007578ca04e442b0c5d13a3 100644 |
--- a/Source/core/css/LayoutStyleCSSValueMapping.cpp |
+++ b/Source/core/css/LayoutStyleCSSValueMapping.cpp |
@@ -162,10 +162,12 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const LayoutStyle |
return nullptr; |
} |
- if (offset.isPercent() && renderer && renderer->isBox()) { |
+ if (offset.isPercent() && renderer && renderer->isBox() && renderer->isPositioned()) { |
+ // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details |
+ AvailableLogicalHeightType heightType = (style.position() == AbsolutePosition) ? IncludePadding : ExcludeMarginBorderPadding; |
LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || propertyID == CSSPropertyRight) ? |
toLayoutBox(renderer)->containingBlockLogicalWidthForContent() : |
- toLayoutBox(renderer)->containingBlockLogicalHeightForContent(ExcludeMarginBorderPadding); |
+ toLayoutBox(renderer)->containingBlockLogicalHeightForContent(heightType); |
return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize), style); |
} |
if (offset.isAuto()) { |