[webkit-changes] [WebKit/WebKit] 7e8288: [margin-trim] Trimmed block-end margins for grid i...

Sammy Gill noreply at github.com
Sat Apr 15 08:49:35 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7e8288073ff2c88c74a6b7bf0a19f131bcedbe97
      https://github.com/WebKit/WebKit/commit/7e8288073ff2c88c74a6b7bf0a19f131bcedbe97
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-04-15 (Sat, 15 Apr 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-column-auto-flow-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-column-auto-flow.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-item-spans-multiple-rows-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-item-spans-multiple-rows.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end.html
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/rendering/RenderBox.cpp

  Log Message:
  -----------
  [margin-trim] Trimmed block-end margins for grid items in horizontal writing-mode should be refected in computed style.
https://bugs.webkit.org/show_bug.cgi?id=253717
rdar://106559562

Reviewed by Alan Baradlay.

When a grid has block-end margin-trim specified, then it should
trim the block-end margins of any of its items on the last row.
These margins that end up getting trimmed should be reflected in the
computed style of that margin as having being trimmed (value of 0). This
can be done by setting the rare data margin-trim bit for the "bottm,"
margin of the renderer during layout.

Since the trimming for the block-end margins of grid item occurs in
RenderBox::constrainBlockMarginInAvailableSpaceOrTrim, then that is the
appropriate place to set the rare data bit for the trimmed margin. The
renderer can set this bit by calling markMarginAsTrimmed and passing in
the margin that has been trimmed.

ComputedStyleExtractor should then be able to use
RenderBox::hasTrimmedMargin, which returns true if the rare data bit is set
for the passed in margin, to determine if the "bottom," margin has been
trimmed during layout.

* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-column-auto-flow-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-column-auto-flow.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-item-spans-multiple-rows-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end-item-spans-multiple-rows.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-block-end.html: Added.
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::rendererCanHaveTrimmedMargin):
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::hasTrimmedMargin const):
(WebCore::RenderBox::constrainBlockMarginInAvailableSpaceOrTrim const):

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




More information about the webkit-changes mailing list