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:
Martin Robinson 2020-06-15 11:51:23 +02:00
parent ba5568a0a6
commit f3e373bc62
19 changed files with 359 additions and 138 deletions

View file

@ -750,12 +750,23 @@ pub trait TElement:
/// or are scheduled to do so in the future.
fn has_animations(&self, context: &SharedStyleContext) -> bool;
/// Returns true if the element has a CSS animation.
fn has_css_animations(&self, context: &SharedStyleContext) -> bool;
/// Returns true if the element has a CSS animation. The `context` and `pseudo_element`
/// arguments are only used by Servo, since it stores animations globally and pseudo-elements
/// are not in the DOM.
fn has_css_animations(
&self,
context: &SharedStyleContext,
pseudo_element: Option<PseudoElement>,
) -> bool;
/// Returns true if the element has a CSS transition (including running transitions and
/// completed transitions).
fn has_css_transitions(&self, context: &SharedStyleContext) -> bool;
/// completed transitions). The `context` and `pseudo_element` arguments are only used
/// by Servo, since it stores animations globally and pseudo-elements are not in the DOM.
fn has_css_transitions(
&self,
context: &SharedStyleContext,
pseudo_element: Option<PseudoElement>,
) -> bool;
/// Returns true if the element has animation restyle hints.
fn has_animation_restyle_hints(&self) -> bool {