Skip to content
Snippets Groups Projects
  • jchaffraix@webkit.org's avatar
    afbeefa2
    [CSS Grid Layout] Adding or removing grid items doesn't properly recompute the track sizes · afbeefa2
    jchaffraix@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=109100
    
    Reviewed by Ojan Vafai.
    
    Source/WebCore:
    
    Test: fast/css-grid-layout/grid-item-removal-track-breadth-update.html
    
    The test uncovered several bugs in our implementation that is fixed as part
    of this change. They will be detailed below.
    
    * rendering/RenderGrid.cpp:
    (WebCore::RenderGrid::logicalContentHeightForChild):
    Added this function to share the code between minContentForChild and maxContentForChild.
    Also forced a relayout in this case to avoid getting a wrong answer (e.g. the logical height
    constrained by the previous layout's grid breadth).
    
    (WebCore::RenderGrid::minContentForChild):
    (WebCore::RenderGrid::maxContentForChild):
    Updated to use logicalContentHeightForChild.
    
    (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
    Updated to match the specification and set max breadth to current breadth per the specification.
    This made us over-grow some cases in the test.
    
    (WebCore::RenderGrid::distributeSpaceToTracks):
    Updated to match the specification and use an extra variable to do the intermediate spreading. Also removed
    a now unneeded max. This fixes the case of multiple grid items in the same grid area that was completely broken.
    
    (WebCore::RenderGrid::layoutGridItems):
    Added a FIXME about always relaying out content sized tracks' children.
    
    * rendering/RenderGrid.h:
    Added logicalContentHeightForChild.
    
    LayoutTests:
    
    * fast/css-grid-layout/grid-item-addition-track-breadth-update-expected.txt: Added.
    * fast/css-grid-layout/grid-item-addition-track-breadth-update.html: Added.
    * fast/css-grid-layout/grid-item-removal-track-breadth-update-expected.txt: Added.
    * fast/css-grid-layout/grid-item-removal-track-breadth-update.html: Added.
    New tests.
    
    * fast/css-grid-layout/resources/grid.css:
    (.constrainedContainer):
    (.unconstrainedContainer):
    Added these class to share them with other tests.
    
    * fast/css-grid-layout/auto-content-resolution-columns.html:
    * fast/css-grid-layout/auto-content-resolution-rows.html:
    * fast/css-grid-layout/implicit-columns-auto-resolution.html:
    * fast/css-grid-layout/implicit-position-dynamic-change.html:
    * fast/css-grid-layout/implicit-rows-auto-resolution.html:
    * fast/css-grid-layout/minmax-max-content-resolution-columns.html:
    * fast/css-grid-layout/minmax-max-content-resolution-rows.html:
    * fast/css-grid-layout/minmax-min-content-column-resolution-columns.html:
    * fast/css-grid-layout/minmax-min-content-column-resolution-rows.html:
    Removed constrainedContainer definition as it was moved to grid.css.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142798 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    afbeefa2
    History
    [CSS Grid Layout] Adding or removing grid items doesn't properly recompute the track sizes
    jchaffraix@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=109100
    
    Reviewed by Ojan Vafai.
    
    Source/WebCore:
    
    Test: fast/css-grid-layout/grid-item-removal-track-breadth-update.html
    
    The test uncovered several bugs in our implementation that is fixed as part
    of this change. They will be detailed below.
    
    * rendering/RenderGrid.cpp:
    (WebCore::RenderGrid::logicalContentHeightForChild):
    Added this function to share the code between minContentForChild and maxContentForChild.
    Also forced a relayout in this case to avoid getting a wrong answer (e.g. the logical height
    constrained by the previous layout's grid breadth).
    
    (WebCore::RenderGrid::minContentForChild):
    (WebCore::RenderGrid::maxContentForChild):
    Updated to use logicalContentHeightForChild.
    
    (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
    Updated to match the specification and set max breadth to current breadth per the specification.
    This made us over-grow some cases in the test.
    
    (WebCore::RenderGrid::distributeSpaceToTracks):
    Updated to match the specification and use an extra variable to do the intermediate spreading. Also removed
    a now unneeded max. This fixes the case of multiple grid items in the same grid area that was completely broken.
    
    (WebCore::RenderGrid::layoutGridItems):
    Added a FIXME about always relaying out content sized tracks' children.
    
    * rendering/RenderGrid.h:
    Added logicalContentHeightForChild.
    
    LayoutTests:
    
    * fast/css-grid-layout/grid-item-addition-track-breadth-update-expected.txt: Added.
    * fast/css-grid-layout/grid-item-addition-track-breadth-update.html: Added.
    * fast/css-grid-layout/grid-item-removal-track-breadth-update-expected.txt: Added.
    * fast/css-grid-layout/grid-item-removal-track-breadth-update.html: Added.
    New tests.
    
    * fast/css-grid-layout/resources/grid.css:
    (.constrainedContainer):
    (.unconstrainedContainer):
    Added these class to share them with other tests.
    
    * fast/css-grid-layout/auto-content-resolution-columns.html:
    * fast/css-grid-layout/auto-content-resolution-rows.html:
    * fast/css-grid-layout/implicit-columns-auto-resolution.html:
    * fast/css-grid-layout/implicit-position-dynamic-change.html:
    * fast/css-grid-layout/implicit-rows-auto-resolution.html:
    * fast/css-grid-layout/minmax-max-content-resolution-columns.html:
    * fast/css-grid-layout/minmax-max-content-resolution-rows.html:
    * fast/css-grid-layout/minmax-min-content-column-resolution-columns.html:
    * fast/css-grid-layout/minmax-min-content-column-resolution-rows.html:
    Removed constrainedContainer definition as it was moved to grid.css.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142798 268f45cc-cd09-0410-ab3c-d52691b4dbfc