[CSS Grid Layout] Refactor RenderStyle's grid position storage in preparation to...
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2013 18:08:50 +0000 (18:08 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2013 18:08:50 +0000 (18:08 +0000)
commit4dea8b580f02e6232779720c33b98962bee2e601
treed7ab42933884b82c731fc0650ead1e33b724bdcb
parent9fe7a1b20adcc5d64ecd4b56468fa0ec883f05b7
[CSS Grid Layout] Refactor RenderStyle's grid position storage in preparation to supporting spanning
https://bugs.webkit.org/show_bug.cgi?id=110651

Reviewed by Ojan Vafai.

The current code stores grid-{row|column} as a single GridPosition value. While this works well currently,
we want to be able to handle 2 GridPosition as this enables row / column spanning.

That's what this refactoring achieves: it replaces the internal storage by a GridPositions that contains a
single GridPosition for now. The rest is mechanical updates.

Refactoring covered by existing tests.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForGridPositions):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
Added the simple wrapper valueForGridPositions and updated the rest of the code.

* css/StyleResolver.cpp:
(WebCore::createGridPositions):
(WebCore::StyleResolver::applyProperty):
Ditto with createGridPositions.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::maximumIndexInDirection):
(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
(WebCore::RenderGrid::autoPlacementMajorAxisPositionsForChild):
(WebCore::RenderGrid::autoPlacementMinorAxisPositionsForChild):
Updated the code after adding the indirection: s/GridPosition/GridPositions/ and
use the firstPosition helper.

* rendering/RenderGrid.h:
* rendering/style/GridPosition.h:
(WebCore::GridPositions::GridPositions):
(WebCore::GridPositions::firstPosition):
(WebCore::GridPositions::operator==):
Added this class to add the indirection. For now, it only wraps the single GridPosition.

* rendering/style/RenderStyle.h:
* rendering/style/StyleGridItemData.h:
Updated to store / take / return a GridPositions.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143941 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h
Source/WebCore/rendering/style/GridPosition.h
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/StyleGridItemData.h