[CSS Grid Layout] Support for the justify-self and justify-items in grid layout
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Apr 2015 17:24:44 +0000 (17:24 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Apr 2015 17:24:44 +0000 (17:24 +0000)
commite525b5a685ca17f16611aed386012b8efd596bbe
treecb9391fd8ac8bfa756b752625e3a0525120519c8
parente215b6ad71f4a2edd14b0169b8441f82db4c3307
[CSS Grid Layout] Support for the justify-self and justify-items in grid layout
https://bugs.webkit.org/show_bug.cgi?id=133280

Source/WebCore:

Reviewed by David Hyatt.

Implementation of justify-self and justify-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.

This patch applies also a quite important refactoring of the alignment logic in
order to share code between the two alignment dimensions, row-axis and column-axis.

Overflow handling is still missing and will be added later in a follow-up bug.

Tests: fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-lr.html
       fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-rl.html
       fast/css-grid-layout/grid-align-justify-margin-border-padding.html
       fast/css-grid-layout/justify-self-cell.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutGridItems):
(WebCore::RenderGrid::columnAxisPositionForChild):
(WebCore::RenderGrid::rowAxisPositionForChild):
(WebCore::RenderGrid::rowPositionForChild):
(WebCore::RenderGrid::columnPositionForChild):
(WebCore::RenderGrid::findChildLogicalPosition):
(WebCore::RenderGrid::allowedToStretchLogicalHeightForChild): Deleted.
(WebCore::RenderGrid::needToStretchChildLogicalHeight): Deleted.
(WebCore::RenderGrid::marginLogicalHeightForChild): Deleted.
(WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching): Deleted.
(WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded): Deleted.
* rendering/RenderGrid.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::resolveJustification):
* rendering/style/RenderStyle.h:

LayoutTests:

Implementation of justify-self and justify-items properties for grid.
Added additional testing for ensuring margin, padding and border are considered when
computing grid item's position.

Reviewed by David Hyatt.

* fast/css-grid-layout/grid-align-justify-margin-border-padding-expected.txt: Added.
* fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-lr-expected.txt: Added.
* fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-lr.html: Added.
* fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-rl-expected.txt: Added.
* fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-rl.html: Added.
* fast/css-grid-layout/grid-align-justify-margin-border-padding.html: Added.
* fast/css-grid-layout/justify-self-cell-expected.txt: Added.
* fast/css-grid-layout/justify-self-cell.html: Added.
* fast/css-grid-layout/resources/grid.css:
(.directionLTR): Added. Useful for defining orthogonal flows.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-align-justify-margin-border-padding-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-lr-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-lr.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-rl-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-align-justify-margin-border-padding-vertical-rl.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-align-justify-margin-border-padding.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/justify-self-cell-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/justify-self-cell.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/resources/grid.css
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h