Changeset 261949 in webkit


Ignore:
Timestamp:
May 20, 2020 1:24:52 PM (4 years ago)
Author:
Oriol Brufau
Message:

[css-grid] Fix auto repeat with multiple tracks and gutters
https://bugs.webkit.org/show_bug.cgi?id=182922

Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Import WPT test.

  • web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001-expected.html: Added.
  • web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html: Added.
  • web-platform-tests/css/css-grid/grid-definition/w3c-import.log:

Source/WebCore:

The code that computes the number of auto repeat tracks wrongly assumes
that the second argument of the repeat() notation is a single track
function. That was true in the beginning, however specs were later on
modified to allow a <track-list>. We support a <track-list> as a second
argument since long ago but the code that computes the number of
auto-repeat tracks was never updated.

This patch modifies two places that relate to the gaps between the
auto-repeat tracks, which ensures the proper total length.

This is a port of https://crrev.com/620278 from Chromium.

Tests: fast/css-grid-layout/grid-auto-repeat-huge-grid.html

imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::computeAutoRepeatTracksCount const):

LayoutTests:

Update test expectations.

  • fast/css-grid-layout/grid-auto-repeat-huge-grid.html:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r261946 r261949  
     12020-05-20  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-grid] Fix auto repeat with multiple tracks and gutters
     4        https://bugs.webkit.org/show_bug.cgi?id=182922
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        Update test expectations.
     9
     10        * fast/css-grid-layout/grid-auto-repeat-huge-grid.html:
     11
    1122020-05-20  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/fast/css-grid-layout/grid-auto-repeat-huge-grid.html

    r214604 r261949  
    181181    autoFitGridElementCols.style.gridGap = "1000000px";
    182182
    183     getTracksCheckingLength(autoFillGridElementCols, "grid-template-columns", 130, ["wideGrid", "lotsOfAutoRepeatWithAutoFillCols"]);
    184     getTracksCheckingLength(autoFitGridElementCols, "grid-template-columns", 82, ["wideGrid", "lotsOfAutoRepeatWithAutoFitCols"]);
     183    getTracksCheckingLength(autoFillGridElementCols, "grid-template-columns", 30, ["wideGrid", "lotsOfAutoRepeatWithAutoFillCols"]);
     184    getTracksCheckingLength(autoFitGridElementCols, "grid-template-columns", 34, ["wideGrid", "lotsOfAutoRepeatWithAutoFitCols"]);
    185185
    186186    autoFillGridElementCols.style.gridGap = "0px";
     
    203203    autoFitGridElementRows.style.gridGap = "1000000px";
    204204
    205     getTracksCheckingLength(autoFillGridElementRows, "grid-template-rows", 130, ["tallGrid", "lotsOfAutoRepeatWithAutoFillRows"]);
    206     getTracksCheckingLength(autoFitGridElementRows, "grid-template-rows", 82, ["tallGrid", "lotsOfAutoRepeatWithAutoFitRows"]);
     205    getTracksCheckingLength(autoFillGridElementRows, "grid-template-rows", 30, ["tallGrid", "lotsOfAutoRepeatWithAutoFillRows"]);
     206    getTracksCheckingLength(autoFitGridElementRows, "grid-template-rows", 34, ["tallGrid", "lotsOfAutoRepeatWithAutoFitRows"]);
    207207
    208208    autoFillGridElementRows.style.gridGap = "0px";
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r261907 r261949  
     12020-05-20  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-grid] Fix auto repeat with multiple tracks and gutters
     4        https://bugs.webkit.org/show_bug.cgi?id=182922
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        Import WPT test.
     9
     10        * web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001-expected.html: Added.
     11        * web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html: Added.
     12        * web-platform-tests/css/css-grid/grid-definition/w3c-import.log:
     13
    1142020-05-20  Oriol Brufau  <obrufau@igalia.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/w3c-import.log

    r261767 r261949  
    2424/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-min-size-001.html
    2525/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-min-size-002.html
     26/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001-expected.html
     27/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html
    2628/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-change-auto-repeat-tracks.html
    2729/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-change-fit-content-argument-001.html
  • trunk/Source/WebCore/ChangeLog

    r261948 r261949  
     12020-05-20  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-grid] Fix auto repeat with multiple tracks and gutters
     4        https://bugs.webkit.org/show_bug.cgi?id=182922
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        The code that computes the number of auto repeat tracks wrongly assumes
     9        that the second argument of the repeat() notation is a single track
     10        function. That was true in the beginning, however specs were later on
     11        modified to allow a <track-list>. We support a <track-list> as a second
     12        argument since long ago but the code that computes the number of
     13        auto-repeat tracks was never updated.
     14
     15        This patch modifies two places that relate to the gaps between the
     16        auto-repeat tracks, which ensures the proper total length.
     17
     18        This is a port of https://crrev.com/620278 from Chromium.
     19
     20        Tests: fast/css-grid-layout/grid-auto-repeat-huge-grid.html
     21               imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-multiple-values-001.html
     22
     23        * rendering/RenderGrid.cpp:
     24        (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
     25
    1262020-05-20  Simon Fraser  <simon.fraser@apple.com>
    227
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r260249 r261949  
    508508    }
    509509
    510     // Add gutters as if there where only 1 auto repeat track. Gaps between auto repeat tracks will be added later when
    511     // computing the repetitions.
     510    // Add gutters as if auto repeat tracks were only repeated once. Gaps between different repetitions will be added later when
     511    // computing the number of repetitions of the auto repeat().
    512512    LayoutUnit gapSize = gridGap(direction, availableSize);
    513     tracksSize += gapSize * trackSizes.size();
     513    tracksSize += gapSize * (trackSizes.size() + autoRepeatTrackListLength - 1);
    514514
    515515    LayoutUnit freeSpace = availableSize.value() - tracksSize;
     
    517517        return autoRepeatTrackListLength;
    518518
    519     LayoutUnit autoRepeatSizeWithGap = autoRepeatTracksSize + gapSize;
     519    LayoutUnit autoRepeatSizeWithGap = autoRepeatTracksSize + gapSize * autoRepeatTrackListLength;
    520520    unsigned repetitions = 1 + (freeSpace / autoRepeatSizeWithGap).toUnsigned();
    521521    freeSpace -= autoRepeatSizeWithGap * (repetitions - 1);
Note: See TracChangeset for help on using the changeset viewer.