diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-11-02 16:33:41 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-11-02 16:34:17 -0800 |
commit | 8d58197bf0609ef400e1cd28419a373d0ad199e4 (patch) | |
tree | 73217249a81ae51a267504ea568f1656d02d9072 /components/layout/animation.rs | |
parent | db1163b1eceb5fef6463c4425e99d974a85a50a8 (diff) | |
download | servo-8d58197bf0609ef400e1cd28419a373d0ad199e4.tar.gz servo-8d58197bf0609ef400e1cd28419a373d0ad199e4.zip |
layout: Avoid flooding the compositor with animation state changes if
there are no animations running and no new animations were added.
Avoids compositor jank during scroll.
Diffstat (limited to 'components/layout/animation.rs')
-rw-r--r-- | components/layout/animation.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/components/layout/animation.rs b/components/layout/animation.rs index 99d257f38a4..27bf118bfda 100644 --- a/components/layout/animation.rs +++ b/components/layout/animation.rs @@ -58,6 +58,12 @@ pub fn update_animation_state(rw_data: &mut LayoutTaskData, pipeline_id: Pipelin let mut running_animations_hash = (*rw_data.running_animations).clone(); + if running_animations_hash.is_empty() && new_running_animations.is_empty() { + // Nothing to do. Return early so we don't flood the compositor with + // `ChangeRunningAnimationsState` messages. + return + } + // Expire old running animations. let now = clock_ticks::precise_time_s(); let mut keys_to_remove = Vec::new(); |