Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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
- Loading branch information
Showing
37 changed files
with
215 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ported/w3c/web-platform-tests/css/css-animations/animation-base-response-001-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
FAIL em units respond to font-size animation assert_equals: expected "15px" but got "1px" | ||
FAIL ex units respond to font-size animation assert_equals: expected "6.71875px" but got "0.4375px" | ||
FAIL var() references respond to custom property animation assert_equals: expected "20px" but got "0px" | ||
PASS em units respond to font-size animation | ||
PASS ex units respond to font-size animation | ||
PASS var() references respond to custom property animation | ||
|
2 changes: 1 addition & 1 deletion
2
...ported/w3c/web-platform-tests/css/css-animations/animation-base-response-003-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Identical elements are all responsive to font-size animation assert_equals: expected "15px" but got "1px" | ||
PASS Identical elements are all responsive to font-size animation | ||
|
2 changes: 1 addition & 1 deletion
2
...ported/w3c/web-platform-tests/css/css-animations/animation-base-response-004-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Base is responsive to font-affecting appearing via setKeyframes assert_equals: expected "15px" but got "10px" | ||
PASS Base is responsive to font-affecting appearing via setKeyframes | ||
|
8 changes: 4 additions & 4 deletions
8
...s/imported/w3c/web-platform-tests/css/css-animations/animation-important-001-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
PASS Interpolated value is observable | ||
FAIL Important rules override animations assert_equals: expected "rgb(0, 128, 0)" but got "rgb(15, 15, 15)" | ||
FAIL Non-overriden interpolations are observable assert_equals: expected "rgb(0, 128, 0)" but got "rgb(15, 15, 15)" | ||
PASS Important rules override animations | ||
PASS Non-overriden interpolations are observable | ||
FAIL Important rules override animations (::before) assert_equals: expected "rgb(0, 128, 0)" but got "rgb(15, 15, 15)" | ||
PASS Important rules do not override animations on :visited as seen from JS | ||
FAIL Standard property animations appearing via setKeyframes do not override important declarations assert_equals: expected "rgb(255, 255, 255)" but got "rgb(15, 15, 15)" | ||
FAIL Custom property animations appearing via setKeyframes do not override important declarations assert_equals: expected "10px" but got "150px" | ||
PASS Standard property animations appearing via setKeyframes do not override important declarations | ||
PASS Custom property animations appearing via setKeyframes do not override important declarations | ||
|
2 changes: 1 addition & 1 deletion
2
...3c/web-platform-tests/css/css-animations/keyframes-unrelated-custom-property-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Unrelated custom properties do not conflict with each other assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" | ||
PASS Unrelated custom properties do not conflict with each other | ||
|
2 changes: 1 addition & 1 deletion
2
.../animation/custom-property-animation-non-inherited-used-by-standard-property-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Animating a non-inherited CSS variable is reflected on a standard property using that variable as a value assert_equals: expected "25px" but got "0px" | ||
PASS Animating a non-inherited CSS variable is reflected on a standard property using that variable as a value | ||
|
2 changes: 1 addition & 1 deletion
2
...animation/custom-property-transition-non-inherited-used-by-standard-property-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Running a transition a non-inherited CSS variable is reflected on a standard property using that variable as a value assert_equals: expected "150px" but got "200px" | ||
PASS Running a transition a non-inherited CSS variable is reflected on a standard property using that variable as a value | ||
|
4 changes: 2 additions & 2 deletions
4
...rted/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
FAIL em units respond to font-size transition assert_equals: expected "15px" but got "20px" | ||
FAIL ex units respond to font-size transition assert_equals: expected "6.71875px" but got "8.96875px" | ||
PASS em units respond to font-size transition | ||
PASS ex units respond to font-size transition | ||
PASS var() references respond to custom property transition | ||
|
2 changes: 1 addition & 1 deletion
2
...rted/w3c/web-platform-tests/css/css-transitions/transition-base-response-003-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Identical elements are all responsive to font-size transition assert_equals: expected "15px" but got "20px" | ||
PASS Identical elements are all responsive to font-size transition | ||
|
4 changes: 2 additions & 2 deletions
4
...imported/w3c/web-platform-tests/css/css-variables/variable-animation-from-to-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
This text should animate from blue to green over a period of 1 second. | ||
|
||
PASS Verify CSS variable value before animation | ||
FAIL Verify substituted color value before animation assert_equals: color is blue before animation runs expected "rgb(0, 0, 255)" but got "rgb(255, 0, 0)" | ||
PASS Verify substituted color value before animation | ||
PASS Verify CSS variable value after animation | ||
FAIL Verify substituted color value after animation assert_equals: color is green after animation runs expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" | ||
PASS Verify substituted color value after animation | ||
|
4 changes: 2 additions & 2 deletions
4
.../w3c/web-platform-tests/css/css-variables/variable-animation-over-transition-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
This text should animate from blue to green over a period of 1 second. The transition is not visible because the animation overrides it. | ||
|
||
PASS Verify CSS variable value before animation | ||
FAIL Verify substituted color value before animation assert_equals: color is blue before animation runs expected "rgb(0, 0, 255)" but got "rgb(255, 0, 0)" | ||
PASS Verify substituted color value before animation | ||
PASS Verify CSS variable value after animation | ||
FAIL Verify substituted color value after animation assert_equals: color is green after animation runs expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)" | ||
PASS Verify substituted color value after animation | ||
|
5 changes: 0 additions & 5 deletions
5
...ported/w3c/web-platform-tests/css/css-animations/animation-base-response-001-expected.txt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...rted/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...rted/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...ported/w3c/web-platform-tests/css/css-animations/animation-base-response-001-expected.txt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...rted/w3c/web-platform-tests/css/css-transitions/transition-base-response-001-expected.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.