[webkit-changes] [WebKit/WebKit] eb9e69: CSS animations should participate in the cascade
Antti Koivisto
noreply at github.com
Thu Jan 5 16:09:50 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: eb9e694c2fc9a95c38298f28b922a0844579feae
https://github.com/WebKit/WebKit/commit/eb9e694c2fc9a95c38298f28b922a0844579feae
Author: Antti Koivisto <antti at apple.com>
Date: 2023-01-05 (Thu, 05 Jan 2023)
Changed paths:
M LayoutTests/TestExpectations
M LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-001-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-003-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-004-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-important-001-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-animations/keyframes-unrelated-custom-property-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/animation/custom-property-animation-non-inherited-used-by-standard-property-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/animation/custom-property-transition-non-inherited-used-by-standard-property-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-003-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-animation-from-to-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-animation-over-transition-expected.txt
R LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-001-expected.txt
R LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
R LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
R LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-001-expected.txt
R LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
M Source/WebCore/animation/KeyframeEffectStack.cpp
M Source/WebCore/animation/KeyframeEffectStack.h
M Source/WebCore/animation/WebAnimationTypes.h
M Source/WebCore/dom/Element.h
M Source/WebCore/html/shadow/TextControlInnerElements.cpp
M Source/WebCore/rendering/style/RenderStyle.cpp
M Source/WebCore/rendering/style/RenderStyle.h
M Source/WebCore/style/ElementRuleCollector.cpp
M Source/WebCore/style/ElementRuleCollector.h
M Source/WebCore/style/MatchResult.h
M Source/WebCore/style/PropertyCascade.cpp
M Source/WebCore/style/PropertyCascade.h
M Source/WebCore/style/StyleAdjuster.h
M Source/WebCore/style/StyleBuilder.cpp
M Source/WebCore/style/StyleBuilder.h
M Source/WebCore/style/StyleResolver.cpp
M Source/WebCore/style/StyleResolver.h
M Source/WebCore/style/StyleTreeResolver.cpp
M Source/WebCore/style/StyleTreeResolver.h
M Source/WebCore/style/Styleable.h
Log Message:
-----------
CSS animations should participate in the cascade
https://bugs.webkit.org/show_bug.cgi?id=210963
rdar://62301534
Reviewed by Antoine Quint.
Property animation can affect other properties, for example via em units when animating font-size or var() when animating custom properties.
Animated values can also be overridden by !important properties.
With this patch we start applying the cascade after computing animated style. Only the properties that may be affected are recomputed.
* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-003-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-base-response-004-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/animation-important-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-animations/keyframes-unrelated-custom-property-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/animation/custom-property-animation-non-inherited-used-by-standard-property-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/animation/custom-property-transition-non-inherited-used-by-standard-property-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-transitions/transition-base-response-003-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-animation-from-to-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-animation-over-transition-expected.txt:
A pile of progressions.
* Source/WebCore/animation/KeyframeEffectStack.cpp:
(WebCore::KeyframeEffectStack::applyKeyframeEffects):
Collected animated properties.
* Source/WebCore/animation/KeyframeEffectStack.h:
* Source/WebCore/animation/WebAnimationTypes.h:
* Source/WebCore/dom/Element.h:
* Source/WebCore/html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerElement::resolveCustomStyle):
(WebCore::TextControlInnerTextElement::resolveCustomStyle):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::customPropertiesEqual const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::ElementRuleCollector):
Switch to std::unique_ptr<MatchResult> for easier shuffling around.
(WebCore::Style::ElementRuleCollector::matchResult const):
(WebCore::Style::ElementRuleCollector::releaseMatchResult):
(WebCore::Style::ElementRuleCollector::addElementStyleProperties):
(WebCore::Style::ElementRuleCollector::declarationsForOrigin):
(WebCore::Style::ElementRuleCollector::transferMatchedRules):
(WebCore::Style::ElementRuleCollector::addMatchedProperties):
(WebCore::Style::ElementRuleCollector::addAuthorKeyframeRules):
* Source/WebCore/style/ElementRuleCollector.h:
* Source/WebCore/style/MatchResult.h:
* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::PropertyCascade):
(WebCore::Style::PropertyCascade::AnimationLayer::AnimationLayer):
Animations behave like a cascade layer, that's where the name of this helper struct comes from.
(WebCore::Style::PropertyCascade::set):
(WebCore::Style::PropertyCascade::setDeferred):
(WebCore::Style::PropertyCascade::addMatch):
(WebCore::Style::PropertyCascade::shouldApplyAfterAnimation):
Build a cascade that only contains properties that require re-resolving after animation.
(WebCore::Style::initializeCSSValue): Deleted.
* Source/WebCore/style/PropertyCascade.h:
(WebCore::Style::PropertyCascade::isEmpty const):
In normal cases there is nothing to apply after animations so we can bail out.
* Source/WebCore/style/StyleAdjuster.h:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::Builder):
(WebCore::Style::Builder::applyAllProperties):
* Source/WebCore/style/StyleBuilder.h:
* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::styleForElement):
Return the MatchResult along with the style. This allows us to reapply the cascade without matching the selectors again.
* Source/WebCore/style/StyleResolver.h:
(WebCore::Style::ElementStyle::ElementStyle): Deleted.
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForStyleable):
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolvePseudoElement):
(WebCore::Style::TreeResolver::resolveAncestorPseudoElement):
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):
(WebCore::Style::TreeResolver::applyCascadeAfterAnimation):
Build and apply the cascade.
* Source/WebCore/style/StyleTreeResolver.h:
* Source/WebCore/style/Styleable.h:
(WebCore::Styleable::applyKeyframeEffects const):
Canonical link: https://commits.webkit.org/258514@main
More information about the webkit-changes
mailing list