Source/WebCore: [CSS Grid Layout] Support paddings and margins on grid items
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2012 02:24:23 +0000 (02:24 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2012 02:24:23 +0000 (02:24 +0000)
commitc8f3bc966c9acce3a27f70083bf8ccb1a711d67c
treed0ccf246e03c922ce88cc1367469e4d3d2450d25
parentd4ca61ff2534f4716aea9d762ae95c4ca7b5e1ae
Source/WebCore: [CSS Grid Layout] Support paddings and margins on grid items
https://bugs.webkit.org/show_bug.cgi?id=103677

Reviewed by Tony Chang.

After bug 102968, we properly resolve grid items' width and height against the
grid areas' sizes. However we didn't check for paddings and margins, which is
what this change fixes..

Test: fast/css-grid-layout/percent-padding-margin-resolution-grid-item.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidthInRegion):
Don't stretch the end margin to match the containing block's extent.
The fix is similar to what was done for flex-box in bug 65887.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints):
Added a comment about not using containingBlockLogicalWidthForContent.

(WebCore::RenderBoxModelObject::computedCSSPaddingTop):
(WebCore::RenderBoxModelObject::computedCSSPaddingBottom):
(WebCore::RenderBoxModelObject::computedCSSPaddingLeft):
(WebCore::RenderBoxModelObject::computedCSSPaddingRight):
(WebCore::RenderBoxModelObject::computedCSSPaddingBefore):
(WebCore::RenderBoxModelObject::computedCSSPaddingAfter):
(WebCore::RenderBoxModelObject::computedCSSPaddingStart):
(WebCore::RenderBoxModelObject::computedCSSPaddingEnd):
Updated these functions to use containingBlockLogicalWidthForContent.

* rendering/RenderGrid.h:
* rendering/RenderObject.h:
(WebCore::RenderObject::isRenderGrid):
Added isRenderGrid.

LayoutTests: [CSS Grid Layout] Support percentage paddings and margins on grid items
https://bugs.webkit.org/show_bug.cgi?id=103677

Reviewed by Tony Chang.

* resources/check-layout.js:
Extended check-layout to be able to query paddings and margins. Note that in order to compare,
the attribute with the returned value from getComputedStyle, we need to trim the unit ("px")
from the actual values. This trick also works in FireFox and Opera.

* fast/css-grid-layout/percent-padding-margin-resolution-grid-item-expected.txt: Added.
* fast/css-grid-layout/percent-padding-margin-resolution-grid-item.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136465 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/percent-padding-margin-resolution-grid-item-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/percent-padding-margin-resolution-grid-item.html [new file with mode: 0644]
LayoutTests/resources/check-layout.js
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/RenderObject.h