[webkit-changes] [WebKit/WebKit] 812232: Trimmed block-start margins for flex items in hori...

Sammy Gill noreply at github.com
Fri Mar 24 10:36:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 81223299d3fb4a43229294386028092f559b5944
      https://github.com/WebKit/WebKit/commit/81223299d3fb4a43229294386028092f559b5944
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-03-24 (Fri, 24 Mar 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-block-start-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-block-start.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-multi-line-block-start-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-multi-line-block-start.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start-dynamic-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start-dynamic.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-multi-line-block-start-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-multi-line-block-start.html
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlock.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderFlexibleBox.cpp
    M Source/WebCore/rendering/RenderObject.h

  Log Message:
  -----------
  Trimmed block-start margins for flex items in horizontal writing mode should be reflected in computed style
https://bugs.webkit.org/show_bug.cgi?id=253712
rdar://106558991

Reviewed by Alan Baradlay.

Whenever we trim a block-start margin for a flex item, we should include
a bit of information for this trimmed margin as a piece of rare data
for the object. The trimming is done inside trimMainAxisMarginStart and
trimCrossAxisMarginStart, so we can wrap abstract the trimming into a
new helper method, RenderBlock::setTrimmedMarginForChild. This new
helper will trim the correct margin and also set the corresponding bit
of rare data

Then, inside of ComputedStyleExtractor we can check
if this bit has been set when trying to determine the block-start margin
when the flexbox is in horizontal writing-mode (i.e. the top margin).

For flex layout, we can clear these new bits whenever we go through
another layout and recreate the flex items.

We also need to update the conditions for determining whether the
margin-top property is layout dependent by taking into consideration
margin-trim. For flex items, this can be done by checking the set
margin-trim values on the flexbox.

* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-block-start-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-block-start.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-multi-line-block-start-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-multi-line-block-start.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start-dynamic-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start-dynamic.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-block-start.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-multi-line-block-start-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-multi-line-block-start.html: Added.
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::isFlexItem):
(WebCore::rendererContainingBlockHasMarginTrim):
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::setTrimmedMarginForChild):
* Source/WebCore/rendering/RenderBlock.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::physicalToFlowRelativeDirectionMapping const):
(WebCore::flowRelativeDirectionToMarginTrimType):
(WebCore::RenderBox::markMarginAsTrimmed):
(WebCore::RenderBox::clearTrimmedMarginsMarkings):
(WebCore::RenderBox::hasTrimmedMargin const):
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::trimMainAxisMarginStart):
(WebCore::RenderFlexibleBox::trimCrossAxisMarginStart):
(WebCore::RenderFlexibleBox::constructFlexItem):
* Source/WebCore/rendering/RenderObject.h:

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




More information about the webkit-changes mailing list