[CSS Grid Layout] Align our grid-line handling with the updated specification
authorsergio@webkit.org <sergio@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2013 10:40:40 +0000 (10:40 +0000)
committersergio@webkit.org <sergio@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2013 10:40:40 +0000 (10:40 +0000)
commit09dda66964380ca9b5c711dc301c051577a425d0
tree0014f3fcd68021e27d8ede9938b80f3082247d85
parent665c722c6ccf98d802a30db1735c880dbc4dd9a7
[CSS Grid Layout] Align our grid-line handling with the updated specification
https://bugs.webkit.org/show_bug.cgi?id=113546

Reviewed by Andreas Kling.

From Blink r148091 by <jchaffraix@chromium.org>

Source/WebCore:

This change makes us match the updated specification by making
grid line numbers to always resolve against the
grid-{column|row}-start edge (the previous code would resolve
grid-{column|row}-end grid lines against the grid-{column|row}-end
edge).

To keep feature parity, negative numbers resolve against the
grid-{column|row}-end edge of the 'explicit grid'.

Test: fast/css-grid-layout/grid-item-negative-integer-explicit-grid-resolution.html

* rendering/RenderGrid.cpp:
(WebCore::estimatedGridSizeForPosition):
(WebCore::RenderGrid::explicitGridColumnCount): New utility function.
(WebCore::RenderGrid::explicitGridRowCount): Ditto.
(WebCore::RenderGrid::maximumIndexInDirection): Use explicitGridXXXCount().
(WebCore::RenderGrid::resolveGridPositionsFromStyle): Check that row-end > row-start.
(WebCore::RenderGrid::resolveGridPositionFromStyle): Clamp negative values to the first line.
* rendering/RenderGrid.h:
* rendering/style/GridPosition.h:

LayoutTests:

Added a couple of new tests to cover the cases of grid resolutions
using negative integers. Negative integers must resolve against
the grid-{column|row}-end of the explicit grid.

* fast/css-grid-layout/grid-auto-flow-resolution-expected.txt:
* fast/css-grid-layout/grid-auto-flow-resolution.html:
* fast/css-grid-layout/grid-item-negative-integer-explicit-grid-resolution-expected.txt: Added.
* fast/css-grid-layout/grid-item-negative-integer-explicit-grid-resolution.html: Added.
* fast/css-grid-layout/grid-item-spanning-resolution-expected.txt:
* fast/css-grid-layout/grid-item-spanning-resolution.html:
* fast/css-grid-layout/resources/grid.css:
(.autoLastRowAutoLastColumn):
(.autoSecondRowAutoFirstColumn):
(.firstRowBothColumn):
(.secondRowBothColumn):
(.bothRowFirstColumn):
(.bothRowSecondColumn):
(.bothRowBothColumn):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154044 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/grid-auto-flow-resolution-expected.txt
LayoutTests/fast/css-grid-layout/grid-auto-flow-resolution.html
LayoutTests/fast/css-grid-layout/grid-item-negative-integer-explicit-grid-resolution-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-negative-integer-explicit-grid-resolution.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-spanning-resolution-expected.txt
LayoutTests/fast/css-grid-layout/grid-item-spanning-resolution.html
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/GridPosition.h