[webkit-changes] [WebKit/WebKit] 5a0b0f: ComputedStyleExtractor should query renderers for ...

Sammy Gill noreply at github.com
Sun Dec 1 14:54:27 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5a0b0f236dcea83dcb235d4af082e9e4f5215186
      https://github.com/WebKit/WebKit/commit/5a0b0f236dcea83dcb235d4af082e9e4f5215186
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2024-12-01 (Sun, 01 Dec 2024)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-margins-roundtrip-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt
    M LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt
    M Source/WebCore/css/ComputedStyleExtractor.cpp

  Log Message:
  -----------
  ComputedStyleExtractor should query renderers for used margin values.
https://bugs.webkit.org/show_bug.cgi?id=283590
rdar://140439313

Reviewed by Alan Baradlay.

Currently, we have some confusing logic that attempts to determine the used margin values
in different ways depending on the characteristics of whether or not there is a renderer and
the existence of any other properties that could influence the margin. This is fairly
cumbersome to maintain and likely to be error-prone depending on the type of content.
Instead, we should just query the renderer for the margin value since we already store the
used values there as a result of layout. We should do this even if the margin property
has a fixed value as the used value can still be influenced by other properties
(e.g. margin-trim or block-step-size). This not only greatly simplifies the logic in
ComputedStyleExtractor but also allows layout code to just focus on layout rather than
doing so with an additional responsibility of making sure it sets certain bits correctly
for other (ComputedStyleExtractor) code to check when it needs to make a decision.

To accomplish this:
1.) Make the margin properties return isLayoutDependent if we have a valid renderer that
is a RenderBox.
2.) Rename paddingOrMarginIsRendererDependent to paddingIsRendererDependent.
3.) Separate out the logic of zoomAdjustedPaddingOrMarginPixelValue into separate
functions dedicated for margin and padding since the logic is slightly different now.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-margins-roundtrip-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/rendering/pixel-length-attributes-expected.txt:
These tests were already failing and are still failing so we can just rebaseling them.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::zoomAdjustedPaddingPixelValue):
(WebCore::zoomAdjustedMarginPixelValue):
(WebCore::paddingIsRendererDependent):
(WebCore::isLayoutDependent):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle const):
(WebCore::zoomAdjustedPaddingOrMarginPixelValue): Deleted.
(WebCore::paddingOrMarginIsRendererDependent): Deleted.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list