forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Stop spamming animation events on the wrong event target
This patch fixes two issues: - Animation events that should go to the target element now do (some were previously being dispatched on the animation itself.) - We update the "previous phase" and "previous iteration" fields of animation effects, so that we can actually detect phase changes. This means we stop thinking animations always just started, something that caused each animation to send 60 animationstart events every second (to the wrong target!)
- Loading branch information
1 parent
f29ac85
commit c3c3c7a
Showing
5 changed files
with
72 additions
and
11 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
Tests/LibWeb/Text/expected/WebAnimations/misc/animation-events-basic.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,2 @@ | ||
animationstart | ||
animationend |
46 changes: 46 additions & 0 deletions
46
Tests/LibWeb/Text/input/WebAnimations/misc/animation-events-basic.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,46 @@ | ||
<!doctype html><style> | ||
body { | ||
margin: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
background-color: #f0f0f0; | ||
} | ||
|
||
div { | ||
width: 100px; | ||
height: 100px; | ||
background-color: #3498db; | ||
position: relative; | ||
animation: moveRight 0.1s linear; | ||
animation-play-state: paused; | ||
} | ||
|
||
@keyframes moveRight { | ||
0% { | ||
left: 0; | ||
} | ||
100% { | ||
left: 100px; | ||
} | ||
} | ||
</style> | ||
<body> | ||
<script src="../../include.js"></script> | ||
<div id="d"></div> | ||
<script> | ||
asyncTest(done => { | ||
let div = document.getElementById("d"); | ||
div.addEventListener("animationstart", () => { | ||
println("animationstart"); | ||
}); | ||
div.addEventListener("animationend", () => { | ||
println("animationend"); | ||
div.style.animationPlayState = "paused"; | ||
div.style.display = "none"; | ||
done(); | ||
}); | ||
}); | ||
</script> | ||
</body> |
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