mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Introduce UpdateAnimationTasks to perform a bunch of animation's tasks in a SequentialTask.
The UpdateAnimationsTasks is a bitflags and each bit is generated from Gecko's UpdateAnimationsTasks (enum class) values for matching values between C++ and Rust. For this reason, the bitflags is annotated as (feature = "gecko"), as a result update_animations() which uses this bitflags also became gecko-only function.
This commit is contained in:
parent
0c843d4b7d
commit
4183b0dff2
9 changed files with 82 additions and 21 deletions
|
@ -638,11 +638,15 @@ trait PrivateMatchMethods: TElement {
|
|||
new_values: &mut Arc<ComputedValues>,
|
||||
pseudo: Option<&PseudoElement>,
|
||||
_possibly_expired_animations: &mut Vec<PropertyAnimation>) {
|
||||
use context::CSS_ANIMATIONS;
|
||||
use context::UpdateAnimationsTasks;
|
||||
|
||||
let ref new_box_style = new_values.get_box();
|
||||
let has_new_animation_style = new_box_style.animation_name_count() >= 1 &&
|
||||
new_box_style.animation_name_at(0).0.len() != 0;
|
||||
let has_animations = self.has_css_animations(pseudo);
|
||||
|
||||
let mut tasks = UpdateAnimationsTasks::empty();
|
||||
let needs_update_animations =
|
||||
old_values.as_ref().map_or(has_new_animation_style, |ref old| {
|
||||
let ref old_box_style = old.get_box();
|
||||
|
@ -658,8 +662,12 @@ trait PrivateMatchMethods: TElement {
|
|||
has_animations)
|
||||
});
|
||||
if needs_update_animations {
|
||||
tasks.insert(CSS_ANIMATIONS);
|
||||
}
|
||||
if !tasks.is_empty() {
|
||||
let task = SequentialTask::update_animations(self.as_node().as_element().unwrap(),
|
||||
pseudo.cloned());
|
||||
pseudo.cloned(),
|
||||
tasks);
|
||||
context.thread_local.tasks.push(task);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue