mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update CSS animations in a SequentialTask.
We create the SequentialTask only if: * We have no old computed values and we have animation name style in the new computed values. * Any animation properties is changed. * display property is changed from 'none' and we have animation name style. * display property is changed to 'none'. In a subsequent patch we skip the SequentialTask if we have no running animations and the display propery is changed to 'none'.
This commit is contained in:
parent
fdb8c48094
commit
9ff99d4608
6 changed files with 84 additions and 8 deletions
|
@ -15,6 +15,7 @@ use euclid::Size2D;
|
|||
use matching::StyleSharingCandidateCache;
|
||||
use parking_lot::RwLock;
|
||||
use properties::ComputedValues;
|
||||
use selector_parser::PseudoElement;
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
use servo_config::opts;
|
||||
use std::collections::HashMap;
|
||||
|
@ -181,6 +182,10 @@ pub enum SequentialTask<E: TElement> {
|
|||
/// Sets selector flags. This is used when we need to set flags on an
|
||||
/// element that we don't have exclusive access to (i.e. the parent).
|
||||
SetSelectorFlags(SendElement<E>, ElementSelectorFlags),
|
||||
|
||||
/// Marks that we need to create/remove/update CSS animations after the
|
||||
/// first traversal.
|
||||
UpdateAnimations(SendElement<E>, Option<PseudoElement>),
|
||||
}
|
||||
|
||||
impl<E: TElement> SequentialTask<E> {
|
||||
|
@ -192,6 +197,9 @@ impl<E: TElement> SequentialTask<E> {
|
|||
SetSelectorFlags(el, flags) => {
|
||||
unsafe { el.set_selector_flags(flags) };
|
||||
}
|
||||
UpdateAnimations(el, pseudo) => {
|
||||
unsafe { el.update_animations(pseudo.as_ref()) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,6 +208,12 @@ impl<E: TElement> SequentialTask<E> {
|
|||
use self::SequentialTask::*;
|
||||
SetSelectorFlags(unsafe { SendElement::new(el) }, flags)
|
||||
}
|
||||
|
||||
/// Creates a task to update CSS Animations on a given (pseudo-)element.
|
||||
pub fn update_animations(el: E, pseudo: Option<PseudoElement>) -> Self {
|
||||
use self::SequentialTask::*;
|
||||
UpdateAnimations(unsafe { SendElement::new(el) }, pseudo)
|
||||
}
|
||||
}
|
||||
|
||||
/// A thread-local style context.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue