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

Unified Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 385583005: For flex items, percent paddings should resolve against their respective dimension Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderThemeChromiumSkia.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBoxModelObject.cpp
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index d8e6b964a86ff8542c214b0063fbfc997faca326..063f480b0453c4ea07fb125489b92f9e1490d477 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -312,11 +312,19 @@ int RenderBoxModelObject::pixelSnappedOffsetHeight() const
return snapSizeToPixel(offsetHeight(), offsetTop());
}
-LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding) const
+LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding, PaddingType type) const
{
LayoutUnit w = 0;
- if (padding.isPercent())
- w = containingBlockLogicalWidthForContent();
+ if (padding.isPercent()) {
+ if (containingBlock()->isFlexibleBox() && RuntimeEnabledFeatures::verticalPaddingEnabled()) {
+ if (type == TopPadding || type == BottomPadding || type == BeforePadding || type == AfterPadding)
+ w = containingBlockLogicalHeightForPadding();
+ else
+ w = containingBlockLogicalWidthForContent();
+ } else {
+ w = containingBlockLogicalWidthForContent();
+ }
+ }
return minimumValueForLength(padding, w);
}
@@ -2503,6 +2511,32 @@ LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const
return containingBlock()->availableLogicalWidth();
}
+LayoutUnit RenderBoxModelObject::containingBlockLogicalHeightForPadding() const
+{
+ switch (containingBlock()->style()->logicalHeight().type()) {
+ case Auto:
+ case MinContent:
+ case MaxContent:
+ case FitContent:
+ case FillAvailable:
+ case Intrinsic:
+ case MinIntrinsic:
+ case MaxSizeNone:
+ case ExtendToZoom:
+ case DeviceWidth:
+ case DeviceHeight:
+ return 0;
+ case Fixed:
+ case Calculated:
+ return containingBlock()->style()->logicalHeight().value();
+ case Percent:
+ return std::max<LayoutUnit>(containingBlock()->computePercentageLogicalHeight(containingBlock()->style()->logicalHeight()), 0);
+ }
+
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
RenderBoxModelObject* RenderBoxModelObject::continuation() const
{
if (!continuationMap)
« no previous file with comments | « Source/core/rendering/RenderBoxModelObject.h ('k') | Source/core/rendering/RenderThemeChromiumSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698