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] a @Keyframes rule using an "inherit" value does not …
…update the resolved value when the parent style changes https://bugs.webkit.org/show_bug.cgi?id=251433 Reviewed by Antti Koivisto. In the case where a @Keyframes rule has one of its properties set to "inherit", we need to update the computed keyframes in case an ancestor changes in a way that the inherited value changes. We already have a mechanism to deal with a similar scenario when the keyframes are provided using the Web Animations API where the m_inheritedProperties instance variable keeps track of all CSS properties set to "inherit" in keyframes. We now pass m_inheritedProperties to Style::Resolver::keyframeStylesForAnimation() to populate it when a CSS Animation's keyframes are computed. * LayoutTests/imported/w3c/web-platform-tests/css/css-animations/responsive/line-height-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-animations/responsive/line-height.html: Added. * Source/WebCore/animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): * Source/WebCore/style/StyleResolver.cpp: (WebCore::Style::Resolver::keyframeStylesForAnimation): * Source/WebCore/style/StyleResolver.h: Canonical link: https://commits.webkit.org/259631@main
- Loading branch information
Showing
5 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...ts/imported/w3c/web-platform-tests/css/css-animations/responsive/line-height-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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PASS line-height responds to inherited changes | ||
|
45 changes: 45 additions & 0 deletions
45
LayoutTests/imported/w3c/web-platform-tests/css/css-animations/responsive/line-height.html
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Animations: line-height animations respond to style changes</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-inline/#line-height-property"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
#target { | ||
animation-name: line-height-animation; | ||
animation-duration: 4s; | ||
animation-timing-function: linear; | ||
animation-delay: -2s; | ||
animation-play-state: paused; | ||
} | ||
@keyframes line-height-animation { | ||
from { line-height: inherit; } | ||
to { line-height: 20px; } | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
<div id="target"></div> | ||
</div> | ||
<script> | ||
'use strict'; | ||
const container = document.getElementById('container'); | ||
const target = document.getElementById('target'); | ||
|
||
test(() => { | ||
container.style.lineHeight = '100px'; | ||
assert_equals(getComputedStyle(target).lineHeight, '60px'); | ||
|
||
container.style.lineHeight = '50px'; | ||
assert_equals(getComputedStyle(target).lineHeight, '35px'); | ||
|
||
container.style.lineHeight = '100px'; | ||
assert_equals(getComputedStyle(target).lineHeight, '60px'); | ||
}, 'line-height responds to inherited changes'); | ||
|
||
</script> | ||
</body> | ||
</html> |
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