[webkit-changes] [WebKit/WebKit] 176479: Trimmed inline-end margins for flex items in horiz...

Sammy Gill noreply at github.com
Thu Apr 6 07:13:36 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 176479519f3166a6f19a9b10a1efcd1123058a18
      https://github.com/WebKit/WebKit/commit/176479519f3166a6f19a9b10a1efcd1123058a18
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-04-06 (Thu, 06 Apr 2023)

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

  Log Message:
  -----------
  Trimmed inline-end margins for flex items in horizontal writing-mode should be reflected in computed style.
https://bugs.webkit.org/show_bug.cgi?id=253715
rdar://106559532

Reviewed by Alan Baradlay.

When trimming the inline-end margins in RenderFlexibleBox::trimMainAxisMarginEnd
and RenderFlexibleBox::trimCrossAxisMarginEnd, instead of trimming the
margins there directly, we can replace the trimming with calls to
RenderBlock::setTrimmedMarginForChild with MarginTrimType::InlineEnd as
an argument. This will both trim the margins by calling
setMarginEndForChild and also set the appropriate rare data bit to
indicate that the inline-end margin for this box has been trimmed. In
horizonal writing modes this bit that is set should refer to
margin-right. This can be used after layout has completed to check if a
box has a trimmed margin.

When ComputedStyleExtractor tries to obtain the "margin-right," value,
it will need to check if this margin has been trimmed. This is done by
calling RenderBox::hasTrimmedMargin(PhysicalDirection::Right), which
will transform this physical direction into a flow relative direction.
In horizontal writing mode with LTR direction, the "right,"
physical direction should correspond to the "inline-end,"
FlowRelativeDirection. hasTrimmedMargin should then take this new
flow relative direction and check to see if the box has this margin
marked as trimmed. If this returns true, then this means that the
box must have had its margin-right trimmed during layout and
ComputedStyleExtractor should consule the box's m_marinBox for the
trimmed value.

* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-inline-end-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-inline-end.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-multi-line-inline-end-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-column-multi-line-inline-end.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-inline-end-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-inline-end.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-multi-line-inline-end-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/flexbox-row-multi-line-inline-end.html: Added.
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::rendererContainingBlockHasMarginTrim):
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::setTrimmedMarginForChild):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::physicalToFlowRelativeDirectionMapping const):
(WebCore::RenderBox::hasTrimmedMargin const):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::trimMainAxisMarginEnd):
(WebCore::RenderFlexibleBox::trimCrossAxisMarginEnd):

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




More information about the webkit-changes mailing list