aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow/root.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2020-06-15 11:51:23 +0200
committerMartin Robinson <mrobinson@igalia.com>2020-06-16 16:33:55 +0200
commitf3e373bc623fd355cb08122d31a76f6548e6827a (patch)
tree94d416bc55b50b1e343ab02fad79a513d4cd418d /components/layout_2020/flow/root.rs
parentba5568a0a60cbd4bbedd3b766b7182824d75b131 (diff)
downloadservo-f3e373bc623fd355cb08122d31a76f6548e6827a.tar.gz
servo-f3e373bc623fd355cb08122d31a76f6548e6827a.zip
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
Diffstat (limited to 'components/layout_2020/flow/root.rs')
-rw-r--r--components/layout_2020/flow/root.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/components/layout_2020/flow/root.rs b/components/layout_2020/flow/root.rs
index 55c325a3cd0..0d346a34eeb 100644
--- a/components/layout_2020/flow/root.rs
+++ b/components/layout_2020/flow/root.rs
@@ -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::<()>
});
}