[webkit-changes] [WebKit/WebKit] e8f311: Implement margin-trim for grid containers.

Sammy Gill noreply at github.com
Fri Jan 6 17:56:29 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e8f3117677da09237aee608c42a4741985dacb50
      https://github.com/WebKit/WebKit/commit/e8f3117677da09237aee608c42a4741985dacb50
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-01-06 (Fri, 06 Jan 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-end-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-end.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-start-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-start.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-end-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-end.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-start-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-start.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-trim-ignores-collapsed-tracks-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-trim-ignores-collapsed-tracks.html
    M Source/WebCore/rendering/Grid.cpp
    M Source/WebCore/rendering/Grid.h
    M Source/WebCore/rendering/RenderGrid.cpp
    M Source/WebCore/rendering/RenderGrid.h

  Log Message:
  -----------
  Implement margin-trim for grid containers.
https://bugs.webkit.org/show_bug.cgi?id=249210
rdar://103285873

Reviewed by Alan Baradlay.

Adds support for the margin-trim property on grids. This will trim the
margin of items that are adjacent to the edges of the container
specified by the property values. This can be done by checking the
placement of the grid items on the track. After
RenderGrid::placeItemsOnGrid is finished, each grid item should have a
position in the grid that we can look at.

Since we are supposed to ignore collapsed tracks, gridItemSpan may not
return the correct values to compare. gridItemSpanIgnoringCollapsedTracks
was added to try and address this. It will get the value returned by
gridItemSpan, but it will also try to adjust the position in the grid so
that it ignores the collapsed tracks.

Spec reference: https://drafts.csswg.org/css-box-4/#margin-trim-grid

* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-end-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-end.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-expected.html: Added.
* LayoutTests/imported/w3c/web-iplatform-tests/css/css-box/margin-trim/grid-block-start-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block-start.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-block.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-end-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-end.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-start-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline-start.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-inline.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-trim-ignores-collapsed-tracks-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/grid-trim-ignores-collapsed-tracks.html: Added.
* Source/WebCore/rendering/Grid.cpp:
(WebCore::Grid::gridItemSpanIgnoringCollapsedTracks const):
* Source/WebCore/rendering/Grid.h:
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::shouldTrimChildMargin const):
* Source/WebCore/rendering/RenderGrid.h:

Canonical link: https://commits.webkit.org/258587@main




More information about the webkit-changes mailing list