Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: Source/core/css/LayoutStyleCSSValueMapping.cpp

Issue 1007623003: Fix incorrect percentage top for positioned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated patch Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) {

Powered by Google App Engine
This is Rietveld 408576698