[CSS Grid Layout] Support for align-self and align-items in grid layout
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 22:44:11 +0000 (22:44 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 22:44:11 +0000 (22:44 +0000)
commitc46ad8146f2444b802e880c31d7ad19531aceed8
tree45f434424e72c1304ec127b4a00d91eb877da96e
parent3bbe20654e86659f4643fc1dca64a5b9ab9c0ee6
[CSS Grid Layout] Support for align-self and align-items in grid layout
https://bugs.webkit.org/show_bug.cgi?id=133225

Reviewed by Darin Adler.

Source/WebCore:

Implementation of align-self and align-items properties for grid. It supports
different writing-modes and direction. Margins, borders and paddings are also
considered when computing the final position and stretched size.

Overflow handling is still missing and will be added when implemented row-axis
alignment support.

Test: fast/css-grid-layout/grid-align.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::logicalContentHeightForChild):
(WebCore::RenderGrid::layoutGridItems):
(WebCore::computeOverflowAlignmentOffset):
(WebCore::RenderGrid::endOfRowForChild):
(WebCore::RenderGrid::startOfRowForChild):
(WebCore::RenderGrid::centeredRowPositionForChild):
(WebCore::marginWidthForChild):
(WebCore::marginHeightForChild):
(WebCore::RenderGrid::allowedToStretchLogicalHeightForChild):
(WebCore::RenderGrid::needToStretchChildLogicalHeight):
(WebCore::RenderGrid::marginLogicalHeightForChild):
(WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching):
(WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
(WebCore::RenderGrid::rowPositionForChild):
(WebCore::RenderGrid::findChildLogicalPosition):
(WebCore::RenderGrid::populateGridPositions): Deleted.
* rendering/RenderGrid.h:

LayoutTests:

Implementation of align-self and align-items properties ifor grid.

Several layout tests were touched for adapting them to the new grid item's
column-axis position when using RTL direction.

* fast/css-grid-layout/grid-align-expected.txt: Added.
* fast/css-grid-layout/grid-align.html: Added.
* fast/css-grid-layout/grid-element-border-grid-item.html:
* fast/css-grid-layout/grid-element-border-padding-grid-item.html:
* fast/css-grid-layout/grid-element-padding-grid-item.html:
* fast/css-grid-layout/grid-item-margin-auto-columns-rows-horizontal-rtl-expected.html:
* fast/css-grid-layout/grid-item-margin-auto-columns-rows-vertical-rtl-expected.html:
* fast/css-grid-layout/grid-item-margin-resolution.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-align-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-align.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-element-border-grid-item.html
LayoutTests/fast/css-grid-layout/grid-element-border-padding-grid-item.html
LayoutTests/fast/css-grid-layout/grid-element-padding-grid-item.html
LayoutTests/fast/css-grid-layout/grid-item-margin-auto-columns-rows-horizontal-rtl-expected.html
LayoutTests/fast/css-grid-layout/grid-item-margin-auto-columns-rows-vertical-rtl-expected.html
LayoutTests/fast/css-grid-layout/grid-item-margin-resolution.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h