[webkit-changes] [WebKit/WebKit] dc7aed: [cssom] Don't serialize shorthand if longhands hav...

Oriol Brufau noreply at github.com
Wed Nov 16 23:59:59 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dc7aed5d4dc6e98d4f0832ceb97c02a085c93379
      https://github.com/WebKit/WebKit/commit/dc7aed5d4dc6e98d4f0832ceb97c02a085c93379
  Author: Oriol Brufau <obrufau at igalia.com>
  Date:   2022-11-16 (Wed, 16 Nov 2022)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks.html
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/StyleProperties.h

  Log Message:
  -----------
  [cssom] Don't serialize shorthand if longhands have different importance
https://bugs.webkit.org/show_bug.cgi?id=247771

Reviewed by Darin Adler.

When some longhand is !important and another isn't, then the shorthand
should serialize as empty string. But most shorthands weren't checking.

This change brings consistency and matches Gecko, Blink and the spec:
https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue

Test: imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks.html

The test still has several failures, but the check for longhands with
different importance is now passing.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt: Added.
Test expectation.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks.html: Added.
New test.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::commonShorthandChecks const):
This method replaces shorthandHasVariableReference. It has a different
name since it now it also checks for importance, and in the future it
should check for even more things so that the test fully passes.

(WebCore::StyleProperties::getPropertyValue const):
Use commonShorthandChecks instead of the old shorthandHasVariableReference.
Assert that all shorthands have serialization logic.

(WebCore::StyleProperties::get2Values const):
Important flags are now checked in commonShorthandChecks().

(WebCore::StyleProperties::get4Values const):
Important flags are now checked in commonShorthandChecks().

(WebCore::StyleProperties::getCommonValue const):
Important flags are now checked in commonShorthandChecks().

(WebCore::StyleProperties::borderImagePropertyValue const):
Important flags are now checked in commonShorthandChecks().

(WebCore::StyleProperties::shorthandHasVariableReference const): Deleted.
Renamed to commonShorthandChecks.

* Source/WebCore/css/StyleProperties.h:
Rename shorthandHasVariableReference to commonShorthandChecks.

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




More information about the webkit-changes mailing list