[CSS Grid Layout] Refactor GridCoordinate to hold GridSpans
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Mar 2013 22:28:10 +0000 (22:28 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Mar 2013 22:28:10 +0000 (22:28 +0000)
commit6c1a0611a0b7aeebc7f2962210472d0b6d8265c6
tree17c2440a6531287a287a7595bcb5441adb32da53
parent94f93fa88e2f4f52e7c60eddb3a2282c3cc5d0e8
[CSS Grid Layout] Refactor GridCoordinate to hold GridSpans
https://bugs.webkit.org/show_bug.cgi?id=112211

Reviewed by Tony Chang.

In order to bring more spanning knowledge to RenderGrid without having
duplicated GridSpan resolution, it became needed to store them into
GridCoordinate. Note that this change is needed as we can only resolve
all the positions with enough context in one place: when we place the
item in the grid.

Refactoring, no change in behavior expected.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridIterator::nextEmptyGridArea):
Updated to create 2 GridSpans. Also fixed a style violation (PassOwnPtr
as local member, not sure why it wasn't caught earlier).

(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
(WebCore::RenderGrid::gridAreaBreadthForChild):
(WebCore::RenderGrid::findChildLogicalPosition):
Updated the original function after GridCoordinate internal representation change.

(WebCore::RenderGrid::insertItemIntoGrid):
Ditto. Also added a new overloaded function that does resolution after auto-placement.

(WebCore::RenderGrid::resolveGridPositionsFromAutoPlacementPosition):
Removed the extra GridSpan computation, which was wrong.

* rendering/RenderGrid.h:
(WebCore::RenderGrid::GridCoordinate::GridCoordinate):
Updated GridCoordinate to hold 2 GridSpan. Also removed the 2 position
constructor (it would have been a hazard), replaced by a 2 GridSpan constructor.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@145762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h