[webkit-changes] [WebKit/WebKit] 5c0b3c: [web-animations] keyframes should be recomputed if...

Antoine Quint noreply at github.com
Sun Nov 20 12:36:58 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5c0b3cb4b2450bcc60e21f512306aaaa56e3e9b3
      https://github.com/WebKit/WebKit/commit/5c0b3cb4b2450bcc60e21f512306aaaa56e3e9b3
  Author: Antoine Quint <graouts at apple.com>
  Date:   2022-11-20 (Sun, 20 Nov 2022)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-css-variable-in-keyframe-adjusted-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-css-variable-in-keyframe-adjusted.html
    M LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-context-filling-expected.txt
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/animation/KeyframeEffect.h
    M Source/WebCore/animation/KeyframeEffectStack.cpp
    M Source/WebCore/css/CSSKeyframeRule.cpp
    M Source/WebCore/css/CSSKeyframeRule.h
    M Source/WebCore/style/StyleResolver.cpp
    M Source/WebCore/style/StyleResolver.h

  Log Message:
  -----------
  [web-animations] keyframes should be recomputed if used CSS variable changes
https://bugs.webkit.org/show_bug.cgi?id=248145

Reviewed by Antti Koivisto.

When the value for a CSS variable changes, we must ensure that any set of keyframes that use that CSS variable
are recomputed, whether the animation is a CSS Animation of a script-originated animation. This does not apply
to CSS Transitions which would operate on resolved values in RenderStyle.

To do this we add a StyleRuleKeyframe::containsCSSVariableReferences() method which indicates whether a keyframe
rule contains CSS variables. Then, we add a similar method on KeyframeEffect returning the boolean flag computed
resolving keyframes in KeyframeEffect::computeCSSAnimationBlendingKeyframes(), for the CSS Animations case, and
KeyframeEffect::updateBlendingKeyframes(), for the script-originated animation case.

Then in KeyframeEffectStack::applyKeyframeEffects(), much like we do for detecting changes made to font-size, we
check whether any CSS variable (or custom property in WebCore parlance) has changed and recompute keyframes if that
is the case.

We now pass the final two subtests in web-animations/animation-model/keyframe-effects/effect-value-context-filling.html
and since those tests only test the script-originated animation case, we also add a new test in css/css-animations
to test the CSS Animations case.

* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-css-variable-in-keyframe-adjusted-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-css-variable-in-keyframe-adjusted.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-context-filling-expected.txt:
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::updateBlendingKeyframes):
(WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes):
* Source/WebCore/animation/KeyframeEffect.h:
(WebCore::KeyframeEffect::containsCSSVariableReferences const):
* Source/WebCore/animation/KeyframeEffectStack.cpp:
(WebCore::KeyframeEffectStack::applyKeyframeEffects):
* Source/WebCore/css/CSSKeyframeRule.cpp:
(WebCore::StyleRuleKeyframe::containsCSSVariableReferences const):
* Source/WebCore/css/CSSKeyframeRule.h:
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::keyframeStylesForAnimation):
* Source/WebCore/style/StyleResolver.h:

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




More information about the webkit-changes mailing list