Changeset 217709 in webkit


Ignore:
Timestamp:
Jun 2, 2017 4:35:27 AM (7 years ago)
Author:
jfernandez@igalia.com
Message:

[css-grid] Logical margin incorrectly applied during the tracks sizing algorithm of auto tracks
https://bugs.webkit.org/show_bug.cgi?id=172836

Reviewed by Manuel Rego Casasnovas.

Source/WebCore:

When computing min-content and max-content of the content-sized tracks
we are using the marginIntrinsicLogicalWidthForChild function, which
uses the grid's writing-mode to determine wether to use the child's
margin width or height. This is not correct when the grid item is
orthogonal.

This patch changes how we compute the tracks width so we use always
the item's marginLogicalWidth, which depends only on its own writing
mode.

Test: fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows.html

  • rendering/GridTrackSizingAlgorithm.cpp:

(WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
(WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):

LayoutTests:

Test to verify different cases of auto-sized tracks and orthogonal items with margins.

  • fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows-expected.txt: Added.
  • fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r217705 r217709  
     12017-06-02  Javier Fernandez  <jfernandez@igalia.com>
     2
     3        [css-grid] Logical margin incorrectly applied during the tracks sizing algorithm of auto tracks
     4        https://bugs.webkit.org/show_bug.cgi?id=172836
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        Test to verify different cases of auto-sized tracks and orthogonal items with margins.
     9
     10        * fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows-expected.txt: Added.
     11        * fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows.html: Added.
     12
    1132017-06-02  Javier Fernandez  <jfernandez@igalia.com>
    214
  • trunk/LayoutTests/TestExpectations

    r217705 r217709  
    287287webkit.org/b/149891 imported/w3c/web-platform-tests/css/css-grid-1/grid-layout-properties.html [ Failure ]
    288288webkit.org/b/169271 imported/w3c/web-platform-tests/css/css-grid-1/grid-items/grid-items-sizing-alignment-001.html [ ImageOnlyFailure ]
    289 webkit.org/b/172836 imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-014.html [ Failure ]
    290 webkit.org/b/172836 imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-rl-014.html [ Failure ]
    291 webkit.org/b/172836 imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-lr-014.html [ Failure ]
    292289
    293290# selectors4
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-014-expected.txt

    r217652 r217709  
    44XX X
    55
    6 FAIL .grid 1 assert_equals:
    7 <div class="grid">
    8   <div data-offset-x="0" data-offset-y="0" data-expected-width="110" data-expected-height="80" class="firstRowFirstColumn">XX X</div>
    9   <div data-offset-x="120" data-offset-y="0" data-expected-width="20" data-expected-height="110" class="firstRowSecondColumn">XX X</div>
    10   <div data-offset-x="0" data-offset-y="130" data-expected-width="20" data-expected-height="80" class="secondRowFirstColumn">XX X</div>
    11   <div data-offset-x="120" data-offset-y="130" data-expected-width="110" data-expected-height="110" class="secondRowSecondColumn">XX X</div>
    12 </div>
    13 width expected 110 but got 120
     6PASS .grid 1
    147
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-lr-014-expected.txt

    r217652 r217709  
    44XX X
    55
    6 FAIL .grid 1 assert_equals:
    7 <div class="grid">
    8   <div data-offset-x="0" data-offset-y="0" data-expected-width="80" data-expected-height="110" class="firstRowFirstColumn">XX X</div>
    9   <div data-offset-x="0" data-offset-y="120" data-expected-width="110" data-expected-height="20" class="firstRowSecondColumn">XX X</div>
    10   <div data-offset-x="130" data-offset-y="0" data-expected-width="80" data-expected-height="20" class="secondRowFirstColumn">XX X</div>
    11   <div data-offset-x="130" data-offset-y="120" data-expected-width="110" data-expected-height="110" class="secondRowSecondColumn">XX X</div>
    12 </div>
    13 height expected 110 but got 120
     6PASS .grid 1
    147
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-rl-014-expected.txt

    r217652 r217709  
    44XX X
    55
    6 FAIL .grid 1 assert_equals:
    7 <div class="grid">
    8   <div data-offset-x="170" data-offset-y="0" data-expected-width="80" data-expected-height="110" class="firstRowFirstColumn">XX X</div>
    9   <div data-offset-x="120" data-offset-y="120" data-expected-width="110" data-expected-height="20" class="firstRowSecondColumn">XX X</div>
    10   <div data-offset-x="40" data-offset-y="0" data-expected-width="80" data-expected-height="20" class="secondRowFirstColumn">XX X</div>
    11   <div data-offset-x="0" data-offset-y="120" data-expected-width="110" data-expected-height="110" class="secondRowSecondColumn">XX X</div>
    12 </div>
    13 height expected 110 but got 120
     6PASS .grid 1
    147
  • trunk/Source/WebCore/ChangeLog

    r217708 r217709  
     12017-06-02  Javier Fernandez  <jfernandez@igalia.com>
     2
     3        [css-grid] Logical margin incorrectly applied during the tracks sizing algorithm of auto tracks
     4        https://bugs.webkit.org/show_bug.cgi?id=172836
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        When computing min-content and max-content of the content-sized tracks
     9        we are using the marginIntrinsicLogicalWidthForChild function, which
     10        uses the grid's writing-mode to determine wether to use the child's
     11        margin width or height. This is not correct when the grid item is
     12        orthogonal.
     13
     14        This patch changes how we compute the tracks width so we use always
     15        the item's marginLogicalWidth, which depends only on its own writing
     16        mode.
     17
     18        Test: fast/css-grid-layout/grid-track-sizing-with-margins-and-orthogonal-flows.html
     19
     20        * rendering/GridTrackSizingAlgorithm.cpp:
     21        (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild):
     22        (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild):
     23
    1242017-06-02  Emilio Cobos Álvarez  <ecobos@igalia.com>
    225
  • trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp

    r216574 r217709  
    750750        // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
    751751        // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
    752         return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(renderGrid(), child);
     752        LayoutUnit marginLogicalWidth = child.needsLayout() ? computeMarginLogicalSizeForChild(childInlineDirection, *renderGrid(), child) : child.marginLogicalWidth();
     753        return child.minPreferredLogicalWidth() + marginLogicalWidth;
    753754    }
    754755
     
    769770        // FIXME: It's unclear if we should return the intrinsic width or the preferred width.
    770771        // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
    771         return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthForChild(renderGrid(), child);
     772        LayoutUnit marginLogicalWidth = child.needsLayout() ? computeMarginLogicalSizeForChild(childInlineDirection, *renderGrid(), child) : child.marginLogicalWidth();
     773        return child.maxPreferredLogicalWidth() + marginLogicalWidth;
    772774    }
    773775
Note: See TracChangeset for help on using the changeset viewer.