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

Unified Diff: Source/core/layout/LayoutBox.cpp

Issue 1007623003: Fix incorrect percentage top for positioned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: New approach by adding a more simple api to get containingBlock's height 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
« Source/core/layout/LayoutBox.h ('K') | « Source/core/layout/LayoutBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutBox.cpp
diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
index a24c390b55c02b4bb0875bc2132b7c71861930ea..9a5d728312dc88e0e84ada12c18c9feb467ecc6c 100644
--- a/Source/core/layout/LayoutBox.cpp
+++ b/Source/core/layout/LayoutBox.cpp
@@ -1521,6 +1521,19 @@ LayoutUnit LayoutBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
return width;
}
+LayoutUnit LayoutBox::containingBlockLogicalHeight() const
+{
+ if (hasOverrideContainingBlockLogicalHeight())
+ return overrideContainingBlockContentLogicalHeight();
+
+ // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details
mstensho (USE GERRIT) 2015/03/26 12:53:37 Better omit this text. This is not completely spec
changseok 2015/03/30 07:17:57 Good point. containingBlock never return inline bl
changseok 2015/03/30 18:03:34 Well. we don't need to create a new api. container
+ LayoutBlock* cb = containingBlock();
+ LayoutUnit height = cb->isPositioned() ? containingBlockLogicalHeightForPositioned(cb) : cb->clientLogicalHeight();
+ if (styleRef().position() != AbsolutePosition)
+ height -= cb->paddingLogicalHeight();
+ return height;
+}
+
LayoutUnit LayoutBox::containingBlockLogicalWidthForContent() const
{
if (hasOverrideContainingBlockLogicalWidth())
« Source/core/layout/LayoutBox.h ('K') | « Source/core/layout/LayoutBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698