• rego@igalia.com's avatar
    [CSS Grid Layout] Fix auto-placement algorithm · 1d74eca7
    rego@igalia.com authored
    In RenderGrid::placeAutoMajorAxisItemOnGrid if the empty grid area does
    not fit in the minor axis direction we should discard it. That way we 
    will avoid to grow in that direction at this moment, as this was 
    previously done at RenderGrid::populateExplicitGridAndOrderIterator().
    
    A simple use case to reproduce the problem would be a 2x2 grid with
    grid-auto-flow property set to "row", where the only empty cell is at
    row 2 and column 2. If you try to place an item with the following
    properties:
        grid-row: auto;
        grid-column: span 2;
    
    It should be inserted in a new row, however before this patch it was
    inserted at row 2 using columns 2 and 3. As even when the empty grid
    area does not fit in the minor axis direction, it was still being used
    later to insert the item.
    
    Updated layout test to include similar cases that don't work without
    this patch.
    
    BUG=353789
    TEST=fast/css-grid-layout/grid-item-auto-placement-automatic-span.html
    
    Review URL: https://codereview.chromium.org/314993002
    
    git-svn-id: svn://svn.chromium.org/blink/trunk@175886 bbb929c8-8fbe-4397-9dbb-9b2b20218538
    1d74eca7
grid-item-auto-placement-automatic-span.html 15.3 KB