[webkit-changes] [WebKit/WebKit] 47ace8: [css-transitions] the `all` value to `transition-p...

Antoine Quint noreply at github.com
Thu Feb 16 11:06:07 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 47ace808375379d30d233bda3a5a7158d3babd88
      https://github.com/WebKit/WebKit/commit/47ace808375379d30d233bda3a5a7158d3babd88
  Author: Antoine Quint <graouts at webkit.org>
  Date:   2023-02-16 (Thu, 16 Feb 2023)

  Changed paths:
    M LayoutTests/fast/css/transform-inline-style-expected.txt
    M LayoutTests/fast/css/transform-inline-style-remove-expected.txt
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

  Log Message:
  -----------
  [css-transitions] the `all` value to `transition-property` should parse as a keyword and not a CSS property
https://bugs.webkit.org/show_bug.cgi?id=252393

Reviewed by Darin Adler.

The `all` value for `transition-property` is a special keyword and not the CSS shorthand property of
the same name [1]. This is important because while the `all` keyword "indicates that all properties
are to be transitioned", the `all` shorthand property "resets all CSS properties" but "does not
reset custom properties". This is an important distinction working towards bug 252312 where we'll
allow registered custom properties to be transitioned when `all` is used.

The issue is that when we would parse `<single-transition-property>` we would fail to check for
CSSValueAll and match the spec definition `all | <custom-ident>` [2]. While this seems to be an
important mistake, this turned out not to be so bad because Styleable::updateCSSTransitions() expands
any shorthand property and thus CSSPropertyAll would expand to most every CSS property. Indeed, this
issue would only become apparent in the case where a custom property was expected to transition.

We now make CSSPropertyParserHelpers::consumeSingleTransitionPropertyIdent() account for CSSValueAll
which will yield the expected Animation::TransitionMode::All for the Animation object in RenderStyle.

This was a good opportunity to clean up and improve some of the longhand code for the `transition`
property where we now get rid of the initialCSSValueForAnimationLonghand() static method and instead
set CSSPrimitiveValue::implicitInitialValue() as the value for any implicit value in the shorthand.

This means that now isInitialValueForLonghand() will correctly recognize those values as implicit and
`all`, whether it was provided explicitly or implicitly, will no longer serialize for the `transition`
shorthand, in the spirit of the "serialize a CSS value" procedure [3] stating that "if component values
can be omitted or replaced with a shorter representation without changing the meaning of the value,
omit/replace them."

As such we rebaseline a couple of tests which needlessly expected `all` to be serialized.

[0] https://drafts.csswg.org/css-transitions/#valdef-transition-property-all
[1] https://w3c.github.io/csswg-drafts/css-cascade/#all-shorthand
[2] https://drafts.csswg.org/css-transitions/#single-transition-property
[3] https://www.w3.org/TR/cssom-1/#serialize-a-css-value

* LayoutTests/fast/css/transform-inline-style-expected.txt:
* LayoutTests/fast/css/transform-inline-style-remove-expected.txt:
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeAnimationShorthand):
(WebCore::initialCSSValueForAnimationLonghand): Deleted.
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::consumeSingleTransitionPropertyIdent):

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




More information about the webkit-changes mailing list