Changeset 251965 in webkit


Ignore:
Timestamp:
Nov 2, 2019 11:48:15 AM (4 years ago)
Author:
Oriol Brufau
Message:

[css-grid] Fix line name positions after auto repeat with no line names
https://bugs.webkit.org/show_bug.cgi?id=203670

Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Import WPT tests.
There are some test failures because integer repeat() is still expanded
at computed-value time (https://webkit.org/b/202259).

  • web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid.html:
  • web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent-expected.txt: Added.
  • web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent.html: Added.
  • web-platform-tests/css/css-grid/parsing/grid-template-columns-computed.html:
  • web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid-expected.txt:
  • web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid.html:
  • web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent-expected.txt: Added.
  • web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent.html: Added.
  • web-platform-tests/css/css-grid/parsing/grid-template-rows-computed.html:
  • web-platform-tests/css/css-grid/parsing/w3c-import.log:

Source/WebCore:

When serializing grid-template-rows/columns of a grid container, we need
to handle auto repeat() specially in order to insert the line names at
the correct places.

Before this patch, this was skipped for indices before the insertion
point of the auto repeat, and in case the auto repeat had no line name.
The latter logic was wrong, if there is an auto repeat we still need the
special code after the insertion point, even if it has no line names.
The proper condition to check is whether there is no auto repeat.

The patch also avoids a 2nd call to gridAutoRepeatRows/Columns since we
already have the value in a variable.

Tests: imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed.html

imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid.html
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent.html
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed.html
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid.html
imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::OrderedNamedLinesCollectorInGridLayout::OrderedNamedLinesCollectorInGridLayout):
(WebCore::OrderedNamedLinesCollectorInGridLayout::collectLineNamesForIndex const):
(WebCore::valueForGridTrackList):

Location:
trunk
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r251877 r251965  
     12019-11-02  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-grid] Fix line name positions after auto repeat with no line names
     4        https://bugs.webkit.org/show_bug.cgi?id=203670
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        Import WPT tests.
     9        There are some test failures because integer repeat() is still expanded
     10        at computed-value time (https://webkit.org/b/202259).
     11
     12        * web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-expected.txt:
     13        * web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid-expected.txt:
     14        * web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid.html:
     15        * web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent-expected.txt: Added.
     16        * web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent.html: Added.
     17        * web-platform-tests/css/css-grid/parsing/grid-template-columns-computed.html:
     18        * web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-expected.txt:
     19        * web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid-expected.txt:
     20        * web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid.html:
     21        * web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent-expected.txt: Added.
     22        * web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent.html: Added.
     23        * web-platform-tests/css/css-grid/parsing/grid-template-rows-computed.html:
     24        * web-platform-tests/css/css-grid/parsing/w3c-import.log:
     25
    1262019-10-31  Said Abou-Hallawa  <sabouhallawa@apple.com>
    227
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-expected.txt

    r250715 r251965  
    99PASS Property grid-template-columns value '1px repeat(auto-fill, 2px) 3px' computes to '1px 2px 3px'
    1010PASS Property grid-template-columns value '1px repeat(auto-fit, 2px) 3px' computes to '1px 0px 3px'
     11PASS Property grid-template-columns value '1px [a] repeat(1, 2px 3px) [b] 4px' computes to '1px [a] 2px 3px [b] 4px'
     12PASS Property grid-template-columns value '1px [a] repeat(auto-fill, 2px 3px) [b] 4px' computes to '1px [a] 2px 3px [b] 4px'
     13PASS Property grid-template-columns value '1px [a] repeat(auto-fit, 2px 3px) [b] 4px' computes to '1px [a] 0px 0px [b] 4px'
    1114PASS Property grid-template-columns value '1px [a] repeat(1, [b] 2px [c]) [d] 3px' computes to '1px [a b] 2px [c d] 3px'
    1215PASS Property grid-template-columns value '1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px' computes to '1px [a b] 2px [c d] 3px'
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid-expected.txt

    r250715 r251965  
    99PASS Property grid-template-columns value '1px repeat(auto-fill, 2px) 3px' computes to '1px repeat(auto-fill, 2px) 3px'
    1010PASS Property grid-template-columns value '1px repeat(auto-fit, 2px) 3px' computes to '1px repeat(auto-fit, 2px) 3px'
     11FAIL Property grid-template-columns value '1px [a] repeat(1, 2px 3px) [b] 4px' computes to '1px [a] repeat(1, 2px 3px) [b] 4px' assert_equals: expected "1px [a] repeat(1, 2px 3px) [b] 4px" but got "1px [a] 2px 3px [b] 4px"
     12PASS Property grid-template-columns value '1px [a] repeat(auto-fill, 2px 3px) [b] 4px' computes to '1px [a] repeat(auto-fill, 2px 3px) [b] 4px'
     13PASS Property grid-template-columns value '1px [a] repeat(auto-fit, 2px 3px) [b] 4px' computes to '1px [a] repeat(auto-fit, 2px 3px) [b] 4px'
    1114FAIL Property grid-template-columns value '1px [a] repeat(1, [b] 2px [c]) [d] 3px' computes to '1px [a] repeat(1, [b] 2px [c]) [d] 3px' assert_equals: expected "1px [a] repeat(1, [b] 2px [c]) [d] 3px" but got "1px [a b] 2px [c d] 3px"
    1215PASS Property grid-template-columns value '1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px' computes to '1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px'
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid.html

    r250715 r251965  
    2626test_computed_value("grid-template-columns", "1px repeat(auto-fill, 2px) 3px");
    2727test_computed_value("grid-template-columns", "1px repeat(auto-fit, 2px) 3px");
     28test_computed_value("grid-template-columns", "1px [a] repeat(1, 2px 3px) [b] 4px");
     29test_computed_value("grid-template-columns", "1px [a] repeat(auto-fill, 2px 3px) [b] 4px");
     30test_computed_value("grid-template-columns", "1px [a] repeat(auto-fit, 2px 3px) [b] 4px");
    2831test_computed_value("grid-template-columns", "1px [a] repeat(1, [b] 2px [c]) [d] 3px");
    2932test_computed_value("grid-template-columns", "1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed.html

    r250715 r251965  
    2626test_computed_value("grid-template-columns", "1px repeat(auto-fill, 2px) 3px", "1px 2px 3px");
    2727test_computed_value("grid-template-columns", "1px repeat(auto-fit, 2px) 3px", "1px 0px 3px");
     28test_computed_value("grid-template-columns", "1px [a] repeat(1, 2px 3px) [b] 4px", "1px [a] 2px 3px [b] 4px");
     29test_computed_value("grid-template-columns", "1px [a] repeat(auto-fill, 2px 3px) [b] 4px", "1px [a] 2px 3px [b] 4px");
     30test_computed_value("grid-template-columns", "1px [a] repeat(auto-fit, 2px 3px) [b] 4px", "1px [a] 0px 0px [b] 4px");
    2831test_computed_value("grid-template-columns", "1px [a] repeat(1, [b] 2px [c]) [d] 3px", "1px [a b] 2px [c d] 3px");
    2932test_computed_value("grid-template-columns", "1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px", "1px [a b] 2px [c d] 3px");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-expected.txt

    r250715 r251965  
    99PASS Property grid-template-rows value '1px repeat(auto-fill, 2px) 3px' computes to '1px 2px 3px'
    1010PASS Property grid-template-rows value '1px repeat(auto-fit, 2px) 3px' computes to '1px 0px 3px'
     11PASS Property grid-template-rows value '1px [a] repeat(1, 2px 3px) [b] 4px' computes to '1px [a] 2px 3px [b] 4px'
     12PASS Property grid-template-rows value '1px [a] repeat(auto-fill, 2px 3px) [b] 4px' computes to '1px [a] 2px 3px [b] 4px'
     13PASS Property grid-template-rows value '1px [a] repeat(auto-fit, 2px 3px) [b] 4px' computes to '1px [a] 0px 0px [b] 4px'
    1114PASS Property grid-template-rows value '1px [a] repeat(1, [b] 2px [c]) [d] 3px' computes to '1px [a b] 2px [c d] 3px'
    1215PASS Property grid-template-rows value '1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px' computes to '1px [a b] 2px [c d] 3px'
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid-expected.txt

    r250715 r251965  
    99PASS Property grid-template-rows value '1px repeat(auto-fill, 2px) 3px' computes to '1px repeat(auto-fill, 2px) 3px'
    1010PASS Property grid-template-rows value '1px repeat(auto-fit, 2px) 3px' computes to '1px repeat(auto-fit, 2px) 3px'
     11FAIL Property grid-template-rows value '1px [a] repeat(1, 2px 3px) [b] 4px' computes to '1px [a] repeat(1, 2px 3px) [b] 4px' assert_equals: expected "1px [a] repeat(1, 2px 3px) [b] 4px" but got "1px [a] 2px 3px [b] 4px"
     12PASS Property grid-template-rows value '1px [a] repeat(auto-fill, 2px 3px) [b] 4px' computes to '1px [a] repeat(auto-fill, 2px 3px) [b] 4px'
     13PASS Property grid-template-rows value '1px [a] repeat(auto-fit, 2px 3px) [b] 4px' computes to '1px [a] repeat(auto-fit, 2px 3px) [b] 4px'
    1114FAIL Property grid-template-rows value '1px [a] repeat(1, [b] 2px [c]) [d] 3px' computes to '1px [a] repeat(1, [b] 2px [c]) [d] 3px' assert_equals: expected "1px [a] repeat(1, [b] 2px [c]) [d] 3px" but got "1px [a b] 2px [c d] 3px"
    1215PASS Property grid-template-rows value '1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px' computes to '1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px'
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid.html

    r250715 r251965  
    2626test_computed_value("grid-template-rows", "1px repeat(auto-fill, 2px) 3px");
    2727test_computed_value("grid-template-rows", "1px repeat(auto-fit, 2px) 3px");
     28test_computed_value("grid-template-rows", "1px [a] repeat(1, 2px 3px) [b] 4px");
     29test_computed_value("grid-template-rows", "1px [a] repeat(auto-fill, 2px 3px) [b] 4px");
     30test_computed_value("grid-template-rows", "1px [a] repeat(auto-fit, 2px 3px) [b] 4px");
    2831test_computed_value("grid-template-rows", "1px [a] repeat(1, [b] 2px [c]) [d] 3px");
    2932test_computed_value("grid-template-rows", "1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed.html

    r250715 r251965  
    2626test_computed_value("grid-template-rows", "1px repeat(auto-fill, 2px) 3px", "1px 2px 3px");
    2727test_computed_value("grid-template-rows", "1px repeat(auto-fit, 2px) 3px", "1px 0px 3px");
     28test_computed_value("grid-template-rows", "1px [a] repeat(1, 2px 3px) [b] 4px", "1px [a] 2px 3px [b] 4px");
     29test_computed_value("grid-template-rows", "1px [a] repeat(auto-fill, 2px 3px) [b] 4px", "1px [a] 2px 3px [b] 4px");
     30test_computed_value("grid-template-rows", "1px [a] repeat(auto-fit, 2px 3px) [b] 4px", "1px [a] 0px 0px [b] 4px");
    2831test_computed_value("grid-template-rows", "1px [a] repeat(1, [b] 2px [c]) [d] 3px", "1px [a b] 2px [c d] 3px");
    2932test_computed_value("grid-template-rows", "1px [a] repeat(auto-fill, [b] 2px [c]) [d] 3px", "1px [a b] 2px [c d] 3px");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/w3c-import.log

    r250715 r251965  
    2626/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-areas-valid.html
    2727/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid.html
     28/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent.html
    2829/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed.html
    2930/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid.html
     31/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent.html
    3032/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed.html
  • trunk/Source/WebCore/ChangeLog

    r251963 r251965  
     12019-11-02  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-grid] Fix line name positions after auto repeat with no line names
     4        https://bugs.webkit.org/show_bug.cgi?id=203670
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        When serializing grid-template-rows/columns of a grid container, we need
     9        to handle auto repeat() specially in order to insert the line names at
     10        the correct places.
     11
     12        Before this patch, this was skipped for indices before the insertion
     13        point of the auto repeat, and in case the auto repeat had no line name.
     14        The latter logic was wrong, if there is an auto repeat we still need the
     15        special code after the insertion point, even if it has no line names.
     16        The proper condition to check is whether there is no auto repeat.
     17
     18        The patch also avoids a 2nd call to gridAutoRepeatRows/Columns since we
     19        already have the value in a variable.
     20
     21        Tests: imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed.html
     22               imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-nogrid.html
     23               imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-columns-computed-withcontent.html
     24               imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed.html
     25               imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-nogrid.html
     26               imported/w3c/web-platform-tests/css/css-grid/parsing/grid-template-rows-computed-withcontent.html
     27
     28        * css/CSSComputedStyleDeclaration.cpp:
     29        (WebCore::OrderedNamedLinesCollectorInGridLayout::OrderedNamedLinesCollectorInGridLayout):
     30        (WebCore::OrderedNamedLinesCollectorInGridLayout::collectLineNamesForIndex const):
     31        (WebCore::valueForGridTrackList):
     32
    1332019-11-02  Devin Rousso  <drousso@apple.com>
    234
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r251776 r251965  
    774774class OrderedNamedLinesCollectorInGridLayout : public OrderedNamedLinesCollector {
    775775public:
    776     OrderedNamedLinesCollectorInGridLayout(const RenderStyle& style, bool isRowAxis, unsigned autoRepeatTracksCount)
     776    OrderedNamedLinesCollectorInGridLayout(const RenderStyle& style, bool isRowAxis, unsigned autoRepeatTracksCount, unsigned autoRepeatTrackListLength)
    777777        : OrderedNamedLinesCollector(style, isRowAxis)
    778778        , m_insertionPoint(isRowAxis ? style.gridAutoRepeatColumnsInsertionPoint() : style.gridAutoRepeatRowsInsertionPoint())
    779779        , m_autoRepeatTotalTracks(autoRepeatTracksCount)
    780         , m_autoRepeatTrackListLength(isRowAxis ? style.gridAutoRepeatColumns().size() : style.gridAutoRepeatRows().size())
     780        , m_autoRepeatTrackListLength(autoRepeatTrackListLength)
    781781    {
    782782    }
     
    817817{
    818818    ASSERT(!isEmpty());
    819     if (m_orderedNamedAutoRepeatGridLines.isEmpty() || i < m_insertionPoint) {
     819    if (!m_autoRepeatTrackListLength || i < m_insertionPoint) {
    820820        appendLines(lineNamesValue, i, NamedLines);
    821821        return;
     
    911911    if (isRenderGrid) {
    912912        auto* grid = downcast<RenderGrid>(renderer);
    913         OrderedNamedLinesCollectorInGridLayout collector(style, isRowAxis, grid->autoRepeatCountForDirection(direction));
     913        OrderedNamedLinesCollectorInGridLayout collector(style, isRowAxis, grid->autoRepeatCountForDirection(direction), autoRepeatTrackSizes.size());
    914914        populateGridTrackList(list.get(), collector, grid->trackSizesForComputedStyle(direction), [&](const LayoutUnit& v) {
    915915            return zoomAdjustedPixelValue(v, style);
Note: See TracChangeset for help on using the changeset viewer.