[webkit-changes] [WebKit/WebKit] a0488d: shorthand serialization for background and mask sh...

Darin Adler noreply at github.com
Tue Dec 6 12:55:20 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a0488d1bf07c46a94b77ef9a721b5de4e20a92c1
      https://github.com/WebKit/WebKit/commit/a0488d1bf07c46a94b77ef9a721b5de4e20a92c1
  Author: Darin Adler <darin at apple.com>
  Date:   2022-12-06 (Tue, 06 Dec 2022)

  Changed paths:
    M LayoutTests/css3/flexbox/css-properties-expected.txt
    M LayoutTests/css3/flexbox/css-properties.html
    M LayoutTests/fast/css/cssText-shorthand-expected.txt
    M LayoutTests/fast/css/remove-shorthand-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/flex-serialization-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/overflow-serialization-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt
    M LayoutTests/platform/mac/editing/execCommand/find-after-replace-expected.txt
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.cpp

  Log Message:
  -----------
  shorthand serialization for background and mask should not include "initial" in the middle of the value
https://bugs.webkit.org/show_bug.cgi?id=242775
rdar://97405629

Reviewed by Tim Nguyen.

Moved the code that handles CSS-wide keywords into the commonShorthandChecks function, and got rid
of many of the attempts to handle it in various shorthand-specific functions. To do this without
causing regressions, had to make the handling of the implicit flag more consistent; we'll be
removing the implicit flag as soon as we can, but we can't remove it until we have serialization
that understands initial values of the longhands for all the shorthands.

* LayoutTests/css3/flexbox/css-properties-expected.txt: Updated since setting a longhand to
"initial" means the shorthand will serialize as the empty string.
* LayoutTests/css3/flexbox/css-properties.html: Ditto.

* LayoutTests/fast/css/cssText-shorthand-expected.txt: Updated since an incorrect test is now
failing. I think this test is a duplicate of the test below,
imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt, so we may want to
delete this one.

* LayoutTests/fast/css/remove-shorthand-expected.txt: Updated for a progression. Since
-webkit-mask is a legacy shorthand, it should serialize as the empty string, and so it should not
have shown up in these test results.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/cssom-getPropertyValue-common-checks-expected.txt:
Updated for progressions. Some tests that were failing are now passig. Others are still failing,
but are closer to passing.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/flex-serialization-expected.txt:
One more test passing.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/overflow-serialization-expected.txt:
One more test passing.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-serialization-expected.txt:
One more test passing.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/shorthand-values-expected.txt: Updated
since an incorrect test is now failing. The test expectation is wrong, and we should fix the test.
For now, I did not include the test fix here because the fixed test will still fail for a
different reason. Can handle that change separately.

* LayoutTests/platform/mac/editing/execCommand/find-after-replace-expected.txt: Updated for a
progression. This was improved by another recent change, not any of the changes here.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::commonShorthandChecks const): Added checks for CSS-wide keywords,
implementing two related rules: 1) If all longhands have the same CSS-wide keyword value,
serialize the shorthand as that value. 2) If some but not all longhands have a CSS-wide keyword
value, serialize as empty string. At this time there is still an exception to those rules for
initial implicit value.
(WebCore::StyleProperties::fontValue const): Removed CSS-wide keyword handling. Still need
similar code to handle system font shorthand.
(WebCore::StyleProperties::fontVariantValue const): Ditto.
(WebCore::StyleProperties::fontSynthesisValue const): Ditto.
(WebCore::StyleProperties::get2Values const): Removed special handling for inherit. Should
also be able to remove special handling of initial, will do that in a follow-up patch.
(WebCore::StyleProperties::getLayeredShorthandValue const): Removed CSS-wide keyword handling.
(WebCore::StyleProperties::getShorthandValue const): Removed CSS-wide keyword handling.
(WebCore::StyleProperties::getCommonValue const): Skip implicit initial values. Also removed a
comment that does not make sense referring to a CSSValue derived class we don't have.
(WebCore::StyleProperties::getAlignmentShorthandValue const): Streamlined a tiny bit.
(WebCore::StyleProperties::borderImagePropertyValue const): Removed CSS-wide keyword handling.
(WebCore::StyleProperties::borderRadiusShorthandValue const): Ditto.
(WebCore::StyleProperties::borderPropertyValue const): Ditto. Also skip implicit initial values.
(WebCore::StyleProperties::breakInsideShorthandValue const): Removed CSS-wide keyword handling.
(WebCore::StyleProperties::pageBreakValue const): Ditto.
(WebCore::StyleProperties::webkitColumnBreakValue const): Ditto.
(WebCore::StyleProperties::asTextInternal const): Skip implicit initial values unless they
are inherited. Removed the old code trying to do this in a less precise fashion.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::addProperty): Set the implicit flag for all implicit initial values.
Some call sites were passing in false for implicit, but that was clearly unintentional. It was
much easier to make this change here than the plumb through the implicit flag correctly.

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




More information about the webkit-changes mailing list