 Chromium Code Reviews
 Chromium Code Reviews Issue 385583005:
  For flex items, percent paddings should resolve against their respective dimension 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 385583005:
  For flex items, percent paddings should resolve against their respective dimension 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/core/rendering/RenderBoxModelObject.cpp | 
| diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp | 
| index 4137a965a92118d896305488b3af7c227c1b900b..f732cee23f09199fb093ad8b8839953c5d81fc30 100644 | 
| --- a/Source/core/rendering/RenderBoxModelObject.cpp | 
| +++ b/Source/core/rendering/RenderBoxModelObject.cpp | 
| @@ -310,11 +310,15 @@ 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() && (type == TopPadding || type == BottomPadding || type == BeforePadding || type == AfterPadding)) | 
| + w = containingBlockLogicalHeightForContent(); | 
| + else | 
| + w = containingBlockLogicalWidthForContent(); | 
| + } | 
| return minimumValueForLength(padding, w); | 
| } | 
| @@ -2507,6 +2511,36 @@ LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const | 
| return containingBlock()->availableLogicalWidth(); | 
| } | 
| +LayoutUnit RenderBoxModelObject::containingBlockLogicalHeightForContent() const | 
| +{ | 
| + if (containingBlock()->style()->logicalHeight().isAuto()) | 
| + return 0; | 
| + | 
| + if (containingBlock()->style()->logicalHeight().isPercent()) | 
| + return containingBlock()->computePercentLogicalHeight(); | 
| + | 
| + return containingBlock()->logicalHeight() - containingBlock()->borderAndPaddingLogicalHeight(); | 
| +} | 
| + | 
| +LayoutUnit RenderBoxModelObject::computePercentLogicalHeight() const | 
| 
tony
2014/07/14 16:34:38
I'm not sure this function is correct.  For exampl
 
harpreet.sk
2014/07/15 16:31:01
I tried to go through the implementation of mozill
 | 
| +{ | 
| + float percentHeightFactor = style()->logicalHeight().value() / 100; | 
| + RenderBlock* cb = containingBlock(); | 
| + while (cb) { | 
| + if (cb->style()->logicalHeight().isAuto()) | 
| 
tony
2014/07/14 16:34:38
This should probably be !isSpecified().
Please ad
 
harpreet.sk
2014/07/15 16:31:01
Done.
 | 
| + return 0; | 
| + if (cb->style()->logicalHeight().isFixed()) | 
| + break; | 
| + percentHeightFactor *= cb->style()->logicalHeight().value() / 100; | 
| 
tony
2014/07/14 16:34:38
I think you want to verify that b->style()->logica
 
harpreet.sk
2014/07/15 16:31:00
Modifeid the solution to include check for all typ
 | 
| + cb = cb->containingBlock(); | 
| + } | 
| + | 
| + if (cb) | 
| + return percentHeightFactor * cb->style()->logicalHeight().value(); | 
| + | 
| + return 0; | 
| +} | 
| + | 
| RenderBoxModelObject* RenderBoxModelObject::continuation() const | 
| { | 
| if (!continuationMap) |