Bug 111886 - [CSS Grid Layout] Fix the auto-placement algorithm to fully match the specification
Summary: [CSS Grid Layout] Fix the auto-placement algorithm to fully match the specifi...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 103316
  Show dependency treegraph
 
Reported: 2013-03-08 13:19 PST by Julien Chaffraix
Modified: 2013-03-08 16:25 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2013-03-08 13:19:23 PST
I believe the current algorithm doesn't totally match the specification as we do the following placing:
* Foreach grid items with a specified major axis, place it on the grid (placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems))
* Foreach grid items with an auto major axis, place it on the grid (placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems))

The specification does a single loop over the unplaced grid items. See http://dev.w3.org/csswg/css3-grid-layout/#auto-placement-algo, point 4 of the algorithm. I am sure we can build a test case where our algorithm differs.
Comment 1 Julien Chaffraix 2013-03-08 16:25:00 PST
I misread the code, we actually follow the proper algorithm:

* We first place items for which we can resolve both positions (it's implicitly mentioned in step 1 - "will not overlap the grid area of any explicitly or previously auto-placed item.").
* Then placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems) is the step 1 loop.
* placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems) is step 4.