Skip to content
  • sergio@webkit.org's avatar
    [CSS Grid Layout] Fix grid position resolution · f67a8c17
    sergio@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=119801
    
    Reviewed by Andreas Kling.
    
    From Blink r148833, r148878, r150403 by <jchaffraix@chromium.org>
    
    Source/WebCore:
    
    Both grid-{column|row}-end and negative positions were not
    properly handled in our grid position resolution code. We were
    using the same code to resolve all the grid positions without
    considering the edges of the grid.
    
    Also refactored the grid size estimation in
    resolveGridPositionsFromStyle() so we can use it for the grid size
    estimation. The code no longer requires the grid to be filled at
    that moment as the specs changed to use the "explicit grid" which
    is independent of grid items (only depends on style).
    
    Test: fast/css-grid-layout/grid-item-negative-position-resolution.html
    
    * rendering/RenderGrid.cpp:
    (WebCore::RenderGrid::maximumIndexInDirection):
    (WebCore::RenderGrid::resolveGridPositionsFromStyle):
    (WebCore::adjustGridPositionForSide):
    (WebCore::RenderGrid::resolveGridPositionFromStyle):
    * rendering/RenderGrid.h:
    
    LayoutTests:
    
    Added a new test to check negative position resolution. Also added
    several new test cases to check that we properly resolve grid
    positions in the grid edges.
    
    * fast/css-grid-layout/grid-item-negative-position-resolution-expected.txt: Added.
    * fast/css-grid-layout/grid-item-negative-position-resolution.html: Added.
    * fast/css-grid-layout/grid-item-spanning-resolution-expected.txt:
    * fast/css-grid-layout/grid-item-spanning-resolution.html:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    f67a8c17