mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1033881 part 1 - Don't generate animations when the animation-name doesn't match; r=dbaron
When animation-name does not match a keyframes rule, we should not dispatch animation events as per: "Any animation for which both a valid keyframe rule and a non-zero duration are defined will run and generate events; this includes animations with empty keyframe rules." http://dev.w3.org/csswg/css-animations/#events Since bug 1004377, however, we started dispatching events in this case because we no longer ignore animations whose set of keyframes is empty. This patch checks for a matching keyframes rule in BuildAnimations and if one is not found, no corresponding animation is generated.
This commit is contained in:
parent
8a1d25238c
commit
cd38f4d2f0
@ -395,11 +395,17 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
|
||||
animIdx != animEnd; ++animIdx) {
|
||||
const StyleAnimation& src = disp->mAnimations[animIdx];
|
||||
|
||||
// CSS Animations with an animation-name of "none" are represented
|
||||
// by StyleAnimations with an empty name. Unlike animations with an empty
|
||||
// keyframes rule, these "none" animations should not generate events
|
||||
// at all so we drop them here.
|
||||
if (src.GetName().IsEmpty()) {
|
||||
// CSS Animations whose animation-name does not match a @keyframes rule do
|
||||
// not generate animation events. This includes when the animation-name is
|
||||
// "none" which is represented by an empty name in the StyleAnimation.
|
||||
// Since such animations neither affect style nor dispatch events, we do
|
||||
// not generate a corresponding ElementAnimation for them.
|
||||
nsCSSKeyframesRule* rule =
|
||||
src.GetName().IsEmpty()
|
||||
? nullptr
|
||||
: mPresContext->StyleSet()->KeyframesRuleForName(mPresContext,
|
||||
src.GetName());
|
||||
if (!rule) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -423,14 +429,6 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
|
||||
dest->mPauseStart = TimeStamp();
|
||||
}
|
||||
|
||||
nsCSSKeyframesRule* rule =
|
||||
mPresContext->StyleSet()->KeyframesRuleForName(mPresContext,
|
||||
dest->mName);
|
||||
if (!rule) {
|
||||
// no segments
|
||||
continue;
|
||||
}
|
||||
|
||||
// While current drafts of css3-animations say that later keyframes
|
||||
// with the same key entirely replace earlier ones (no cascading),
|
||||
// this is a bad idea and contradictory to the rest of CSS. So
|
||||
|
@ -1937,6 +1937,27 @@ check_events([{ type: 'animationstart', target: div,
|
||||
"events for animation-name: a, none, a");
|
||||
done_div();
|
||||
|
||||
/*
|
||||
* Bug 1033881 - Non-matching animation-name
|
||||
*
|
||||
* The code under test here is run entirely on the main thread so there is no
|
||||
* OMTA version of these tests in test_animations_omta.html.
|
||||
*/
|
||||
|
||||
new_div("animation-name: non_existent, always_fifty; animation-duration: 1s");
|
||||
listen();
|
||||
advance_clock(0);
|
||||
advance_clock(500);
|
||||
advance_clock(500);
|
||||
check_events([{ type: 'animationstart', target: div,
|
||||
animationName: 'always_fifty', elapsedTime: 0,
|
||||
pseudoElement: '' },
|
||||
{ type: 'animationend', target: div,
|
||||
animationName: 'always_fifty', elapsedTime: 1,
|
||||
pseudoElement: '' }],
|
||||
"events for animation-name: non_existent, always_fifty");
|
||||
done_div();
|
||||
|
||||
SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
|
||||
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user