Changeset 261894 in webkit


Ignore:
Timestamp:
May 19, 2020 4:50:25 PM (4 years ago)
Author:
Oriol Brufau
Message:

Fix marginLogicalSizeForChild to check auto margins in the right axis
https://bugs.webkit.org/show_bug.cgi?id=212055

Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Import new WPT test.

  • web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001-expected.txt: Added.
  • web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html: Added.
  • web-platform-tests/css/css-grid/grid-items/w3c-import.log:

Source/WebCore:

GridLayoutFunctions::marginLogicalSizeForChild checks for 'auto' margins
before retrieving the margin size, since these should be treated as 0.
However, for orthogonal grid items, it used to check the wrong axis.
So if an item had 'margin-top: auto' and 'margin-left: 5px', when asking
for the horizontal margin we could get 0px instead of 5px due to the
auto margin in the vertical axis.

Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html

  • rendering/GridLayoutFunctions.cpp:

(WebCore::GridLayoutFunctions::marginLogicalSizeForChild):

Location:
trunk
Files:
2 added
4 edited

Legend:

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

    r261863 r261894  
     12020-05-19  Oriol Brufau  <obrufau@igalia.com>
     2
     3        Fix marginLogicalSizeForChild to check auto margins in the right axis
     4        https://bugs.webkit.org/show_bug.cgi?id=212055
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        Import new WPT test.
     9
     10        * web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001-expected.txt: Added.
     11        * web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html: Added.
     12        * web-platform-tests/css/css-grid/grid-items/w3c-import.log:
     13
    1142020-05-14  Sergio Villar Senin  <svillar@igalia.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/w3c-import.log

    r261841 r261894  
    8585/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-inline-blocks-001-expected.xht
    8686/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-inline-blocks-001.html
     87/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html
    8788/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-width-001.html
    8889/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-width-002.html
  • trunk/Source/WebCore/ChangeLog

    r261893 r261894  
     12020-05-19  Oriol Brufau  <obrufau@igalia.com>
     2
     3        Fix marginLogicalSizeForChild to check auto margins in the right axis
     4        https://bugs.webkit.org/show_bug.cgi?id=212055
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        GridLayoutFunctions::marginLogicalSizeForChild checks for 'auto' margins
     9        before retrieving the margin size, since these should be treated as 0.
     10        However, for orthogonal grid items, it used to check the wrong axis.
     11        So if an item had 'margin-top: auto' and 'margin-left: 5px', when asking
     12        for the horizontal margin we could get 0px instead of 5px due to the
     13        auto margin in the vertical axis.
     14
     15        Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-minimum-height-orthogonal-001.html
     16
     17        * rendering/GridLayoutFunctions.cpp:
     18        (WebCore::GridLayoutFunctions::marginLogicalSizeForChild):
     19
    1202020-05-19  Jacob Uphoff  <jacob_uphoff@apple.com>
    221
  • trunk/Source/WebCore/rendering/GridLayoutFunctions.cpp

    r244115 r261894  
    7070    if (child.needsLayout())
    7171        return computeMarginLogicalSizeForChild(grid, direction, child);
    72     bool isRowAxis = flowAwareDirectionForChild(grid, child, direction) == ForColumns;
    73     LayoutUnit marginStart = marginStartIsAuto(child, direction) ? 0_lu : isRowAxis ? child.marginStart() : child.marginBefore();
    74     LayoutUnit marginEnd = marginEndIsAuto(child, direction) ? 0_lu : isRowAxis ? child.marginEnd() : child.marginAfter();
     72    GridTrackSizingDirection flowAwareDirection = GridLayoutFunctions::flowAwareDirectionForChild(grid, child, direction);
     73    bool isRowAxis = flowAwareDirection == ForColumns;
     74    LayoutUnit marginStart = marginStartIsAuto(child, flowAwareDirection) ? 0_lu : isRowAxis ? child.marginStart() : child.marginBefore();
     75    LayoutUnit marginEnd = marginEndIsAuto(child, flowAwareDirection) ? 0_lu : isRowAxis ? child.marginEnd() : child.marginAfter();
    7576    return marginStart + marginEnd;
    7677}
Note: See TracChangeset for help on using the changeset viewer.