Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 67d0e83ce37305ee9471d1ef55e851b10004c8f2
https://github.com/WebKit/WebKit/commit/67d0e83ce37305ee9471d1ef55e851b10004c8f2
Author: Sammy Gill <[email protected]>
Date: 2023-04-16 (Sun, 16 Apr 2023)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-columns-added-to-end-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-columns-added-to-end.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-items-in-last-column-trimmed-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-items-in-last-column-trimmed.html
M Source/WebCore/css/ComputedStyleExtractor.cpp
M Source/WebCore/rendering/RenderBox.cpp
Log Message:
-----------
[margin-trim] Trimmed inline-end margins for grid items in horizontal
writing-mode should be reflected in computed style.
https://bugs.webkit.org/show_bug.cgi?id=253719
rdar://106559432
Reviewed by Alan Baradlay.
When a grid has inline-end specified for margin trim, it will trim the
margins in the last column. Currently these trimmed margins are not
showing up as "trimmed," in the computed style of the element, but they
should be shown as a margin value of 0. In order to reflect this trimming
within the computed style, ComputedStyleExtractor must be able to identify
when a particular margin has been trimmed during layout. We can accomplish
this by setting the margin-trim rare data bit for the respective margin
to indicate that is has been trimmed. This bit can then be checked for
a renderer after layout has completed to check if a specific margin
was trimmed.
The inline-end margins for grid items are trimmed inside
RenderBox::computeOrTrimInlineMargin
as the renderer is going through layout. When a grid item reaches this
point, it consults with the grid via shouldTrimChildMargin to determine
if it should consider its own value as trimmed. If this returns true,
the function will return a value of 0_lu for the margin, but at this
point we can also set the margin-trim rare data bit for the renderer.
This is done via a call to markMarginAsTrimmed with the appropriate
margin side passed in.
When ComputedStyleExtractor is then trying to get the value for the
"right," margin, it can use RenderBox::hasTrimmedMargin with an argument
of PhysicalDirection::Right to check if that renderer had its margin
trimmed during layout.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-columns-added-to-end-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-columns-added-to-end.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-items-in-last-column-trimmed-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/computed-margin-values/grid-inline-end-items-in-last-column-trimmed.html:
Added.
* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::rendererCanHaveTrimmedMargin):
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
(WebCore::isFlexItem): Deleted.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::hasTrimmedMargin const):
(WebCore::RenderBox::computeOrTrimInlineMargin const):
Canonical link: https://commits.webkit.org/263008@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes