Changeset 201545 in webkit


Ignore:
Timestamp:
Jun 1, 2016 12:24:21 AM (8 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Positioned items can be placed on the implicit grid
https://bugs.webkit.org/show_bug.cgi?id=158197

Reviewed by Sergio Villar Senin.

Source/WebCore:

The old code wrongly assumed that positioned items couldn't be placed
on the implicit grid. However, the spec doesn't mention anything about this.

The patch fixes this issue, so now positioned items can be actually
placed on the implicit tracks.

Test: fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::offsetAndBreadthForPositionedChild): Use the lines
of the implicit grid instead of the explicit one.

LayoutTests:

Updated the test to follow the expected behavior.

  • fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track-expected.txt:
  • fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r201529 r201545  
     12016-06-01  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Positioned items can be placed on the implicit grid
     4        https://bugs.webkit.org/show_bug.cgi?id=158197
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Updated the test to follow the expected behavior.
     9
     10        * fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track-expected.txt:
     11        * fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html:
     12
    1132016-05-31  Dave Hyatt  <hyatt@apple.com>
    214
  • trunk/LayoutTests/fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track-expected.txt

    r199098 r201545  
    1 This test checks that positioned grid items are placed properly (ignoring implicit tracks) even if the grid has implicit tracks.
     1This test checks that positioned grid items are placed properly (including implicit tracks) even if the grid has implicit tracks.
    22
    33PASS
  • trunk/LayoutTests/fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html

    r200510 r201545  
    3636<body onload="checkLayout('.grid')">
    3737
    38 <p>This test checks that positioned grid items are placed properly (ignoring implicit tracks) even if the grid has implicit tracks.</p>
     38<p>This test checks that positioned grid items are placed properly (including implicit tracks) even if the grid has implicit tracks.</p>
    3939
    4040<div class="grid">
     
    7979    </div>
    8080    <div class="absolute" style="grid-column: -4 / 1; grid-row: -4 / 1;"
    81         data-offset-x="0" data-offset-y="0" data-expected-width="215" data-expected-height="115">
     81        data-offset-x="115" data-offset-y="65" data-expected-width="100" data-expected-height="50">
    8282    </div>
    8383</div>
     
    8888    </div>
    8989    <div class="absolute" style="grid-column: -4 / 2; grid-row: -4 / 2;"
    90         data-offset-x="0" data-offset-y="0" data-expected-width="415" data-expected-height="265">
     90        data-offset-x="115" data-offset-y="65" data-expected-width="300" data-expected-height="200">
    9191    </div>
    9292</div>
     
    9797    </div>
    9898    <div class="absolute" style="grid-column: 3 / 4; grid-row: 3 / 4;"
    99         data-offset-x="715" data-offset-y="515" data-expected-width="115" data-expected-height="115">
     99        data-offset-x="715" data-offset-y="515" data-expected-width="100" data-expected-height="50">
    100100    </div>
    101101</div>
     
    106106    </div>
    107107    <div class="absolute" style="grid-column: 2 / 4; grid-row: 2 / 4;"
    108         data-offset-x="415" data-offset-y="265" data-expected-width="415" data-expected-height="365">
     108        data-offset-x="415" data-offset-y="265" data-expected-width="400" data-expected-height="300">
    109109    </div>
    110110</div>
     
    151151    </div>
    152152    <div class="absolute" style="grid-column: -4 / 1; grid-row: -4 / 1;"
    153         data-offset-x="615" data-offset-y="0" data-expected-width="215" data-expected-height="115">
     153        data-offset-x="615" data-offset-y="65" data-expected-width="100" data-expected-height="50">
    154154    </div>
    155155</div>
     
    160160    </div>
    161161    <div class="absolute" style="grid-column: -4 / 2; grid-row: -4 / 2;"
    162         data-offset-x="415" data-offset-y="0" data-expected-width="415" data-expected-height="265">
     162        data-offset-x="415" data-offset-y="65" data-expected-width="300" data-expected-height="200">
    163163    </div>
    164164</div>
     
    169169    </div>
    170170    <div class="absolute" style="grid-column: 3 / 4; grid-row: 3 / 4;"
    171         data-offset-x="0" data-offset-y="515" data-expected-width="115" data-expected-height="115">
     171        data-offset-x="15" data-offset-y="515" data-expected-width="100" data-expected-height="50">
    172172    </div>
    173173</div>
     
    178178    </div>
    179179    <div class="absolute" style="grid-column: 2 / 4; grid-row: 2 / 4;"
    180         data-offset-x="0" data-offset-y="265" data-expected-width="415" data-expected-height="365">
     180        data-offset-x="15" data-offset-y="265" data-expected-width="400" data-expected-height="300">
    181181    </div>
    182182</div>
  • trunk/Source/WebCore/ChangeLog

    r201543 r201545  
     12016-06-01  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Positioned items can be placed on the implicit grid
     4        https://bugs.webkit.org/show_bug.cgi?id=158197
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        The old code wrongly assumed that positioned items couldn't be placed
     9        on the implicit grid. However, the spec doesn't mention anything about this.
     10
     11        The patch fixes this issue, so now positioned items can be actually
     12        placed on the implicit tracks.
     13
     14        Test: fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html
     15
     16        * rendering/RenderGrid.cpp:
     17        (WebCore::RenderGrid::offsetAndBreadthForPositionedChild): Use the lines
     18        of the implicit grid instead of the explicit one.
     19
    1202016-05-31  Chris Dumez  <cdumez@apple.com>
    221
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r201511 r201545  
    16841684    GridPosition startPosition = isRowAxis ? child.style().gridItemColumnStart() : child.style().gridItemRowStart();
    16851685    GridPosition endPosition = isRowAxis ? child.style().gridItemColumnEnd() : child.style().gridItemRowEnd();
    1686     int firstExplicitLine = smallestStart;
    1687     int lastExplicitLine = (isRowAxis ? GridPositionsResolver::explicitGridColumnCount(style(), autoRepeatCount) : GridPositionsResolver::explicitGridRowCount(style(), autoRepeatCount)) + smallestStart;
     1686    int lastLine = isRowAxis ? gridColumnCount() : gridRowCount();
    16881687
    16891688    bool startIsAuto = startPosition.isAuto()
    16901689        || (startPosition.isNamedGridArea() && !NamedLineCollection::isValidNamedLineOrArea(startPosition.namedGridLine(), style(), (direction == ForColumns) ? ColumnStartSide : RowStartSide))
    1691         || (startLine < firstExplicitLine)
    1692         || (startLine > lastExplicitLine);
     1690        || (startLine < 0)
     1691        || (startLine > lastLine);
    16931692    bool endIsAuto = endPosition.isAuto()
    16941693        || (endPosition.isNamedGridArea() && !NamedLineCollection::isValidNamedLineOrArea(endPosition.namedGridLine(), style(), (direction == ForColumns) ? ColumnEndSide : RowEndSide))
    1695         || (endLine < firstExplicitLine)
    1696         || (endLine > lastExplicitLine);
     1694        || (endLine < 0)
     1695        || (endLine > lastLine);
    16971696
    16981697    // We're normalizing the positions to avoid issues with RTL (as they're stored in the same order than LTR but adding an offset).
     
    17191718
    17201719        // These vectors store line positions including gaps, but we shouldn't consider them for the edges of the grid.
    1721         if (endLine > firstExplicitLine && endLine < lastExplicitLine) {
     1720        if (endLine > 0 && endLine < lastLine) {
    17221721            end -= guttersSize(direction, 2);
    17231722            end -= isRowAxis ? m_offsetBetweenColumns : m_offsetBetweenRows;
     
    17361735            offset = translateRTLCoordinate(m_columnPositions[endLine]) - borderLogicalLeft();
    17371736
    1738             if (endLine > firstExplicitLine && endLine < lastExplicitLine) {
     1737            if (endLine > 0 && endLine < lastLine) {
    17391738                offset += guttersSize(direction, 2);
    17401739                offset += isRowAxis ? m_offsetBetweenColumns : m_offsetBetweenRows;
Note: See TracChangeset for help on using the changeset viewer.