mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Add animation and transition support for pseudo-elements
This change extends the DocumentAnimationSet to hold animations for pseudo-elements. Since pseudo-elements in Servo are not in the DOM like in Gecko, they need to be handled a bit carefully in stylo. When a pseudo-element has an animation, recascade the style. Finally, this change passes the pseudo-element string properly to animation events. Fixes: #10316
This commit is contained in:
parent
ba5568a0a6
commit
f3e373bc62
19 changed files with 359 additions and 138 deletions
|
@ -38,6 +38,7 @@ use servo_arc::Arc;
|
|||
use style::animation::AnimationSetKey;
|
||||
use style::dom::OpaqueNode;
|
||||
use style::properties::ComputedValues;
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style::values::computed::Length;
|
||||
use style_traits::CSSPixel;
|
||||
|
||||
|
@ -449,9 +450,12 @@ impl FragmentTree {
|
|||
|
||||
pub fn remove_nodes_in_fragment_tree_from_set(&self, set: &mut FxHashSet<AnimationSetKey>) {
|
||||
self.find(|fragment, _| {
|
||||
if let Some(tag) = fragment.tag().as_ref() {
|
||||
set.remove(&AnimationSetKey(tag.node()));
|
||||
}
|
||||
let (node, pseudo) = match fragment.tag()? {
|
||||
Tag::Node(node) => (node, None),
|
||||
Tag::BeforePseudo(node) => (node, Some(PseudoElement::Before)),
|
||||
Tag::AfterPseudo(node) => (node, Some(PseudoElement::After)),
|
||||
};
|
||||
set.remove(&AnimationSetKey::new(node, pseudo));
|
||||
None::<()>
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue