aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-07-30 00:04:17 -0600
committerbors-servo <metajack+bors@gmail.com>2015-07-30 00:04:17 -0600
commit12c46ddd6131533454e353fa8fdd8cb4b517ffd0 (patch)
tree9a04b6d349db30c23e5f9c08e84013c5bb54b748 /components/script/script_task.rs
parent3a112bc07f49e5f1a79fe4788fe5e7676ccb8345 (diff)
parent01e5c513a9d3259f978a1c4027057d96fc319663 (diff)
downloadservo-12c46ddd6131533454e353fa8fdd8cb4b517ffd0.tar.gz
servo-12c46ddd6131533454e353fa8fdd8cb4b517ffd0.zip
Auto merge of #6841 - pcwalton:squash-animation-ticks, r=metajack
script: Squash duplicate animation tick events in the queue. This prevents them from piling up endlessly if the JS `requestAnimationFrame()` callback takes a long time to complete. r? @jdm <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6841) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index e34e93008d2..9254d67b0f2 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -665,8 +665,9 @@ impl ScriptTask {
}
};
- // Squash any pending resize, reflow, and mouse-move events in the queue.
+ // Squash any pending resize, reflow, animation tick, and mouse-move events in the queue.
let mut mouse_move_event_index = None;
+ let mut animation_ticks = HashSet::new();
loop {
match event {
// This has to be handled before the ResizeMsg below,
@@ -682,6 +683,13 @@ impl ScriptTask {
MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
self.handle_viewport(id, rect);
}
+ MixedMessage::FromConstellation(ConstellationControlMsg::TickAllAnimations(
+ pipeline_id)) => {
+ if !animation_ticks.contains(&pipeline_id) {
+ animation_ticks.insert(pipeline_id);
+ sequential.push(event);
+ }
+ }
MixedMessage::FromConstellation(ConstellationControlMsg::SendEvent(
_,
MouseMoveEvent(_))) => {