mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +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
|
@ -118,6 +118,17 @@ where
|
|||
)
|
||||
}
|
||||
|
||||
fn layout_parent_style_for_pseudo<'a>(
|
||||
primary_style: &'a PrimaryStyle,
|
||||
layout_parent_style: Option<&'a ComputedValues>,
|
||||
) -> Option<&'a ComputedValues> {
|
||||
if primary_style.style().is_display_contents() {
|
||||
layout_parent_style
|
||||
} else {
|
||||
Some(primary_style.style())
|
||||
}
|
||||
}
|
||||
|
||||
fn eager_pseudo_is_definitely_not_generated(
|
||||
pseudo: &PseudoElement,
|
||||
style: &ComputedValues,
|
||||
|
@ -246,11 +257,8 @@ where
|
|||
let mut pseudo_styles = EagerPseudoStyles::default();
|
||||
|
||||
if !self.element.is_pseudo_element() {
|
||||
let layout_parent_style_for_pseudo = if primary_style.style().is_display_contents() {
|
||||
layout_parent_style
|
||||
} else {
|
||||
Some(primary_style.style())
|
||||
};
|
||||
let layout_parent_style_for_pseudo =
|
||||
layout_parent_style_for_pseudo(&primary_style, layout_parent_style);
|
||||
SelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
|
||||
let pseudo_style = self.resolve_pseudo_style(
|
||||
&pseudo,
|
||||
|
@ -298,6 +306,26 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
/// Cascade a set of rules for pseudo element, using the default parent for inheritance.
|
||||
pub(crate) fn cascade_style_and_visited_for_pseudo_with_default_parents(
|
||||
&mut self,
|
||||
inputs: CascadeInputs,
|
||||
pseudo: &PseudoElement,
|
||||
primary_style: &PrimaryStyle,
|
||||
) -> ResolvedStyle {
|
||||
with_default_parent_styles(self.element, |_, layout_parent_style| {
|
||||
let layout_parent_style_for_pseudo =
|
||||
layout_parent_style_for_pseudo(primary_style, layout_parent_style);
|
||||
|
||||
self.cascade_style_and_visited(
|
||||
inputs,
|
||||
Some(primary_style.style()),
|
||||
layout_parent_style_for_pseudo,
|
||||
Some(pseudo),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn cascade_style_and_visited(
|
||||
&mut self,
|
||||
inputs: CascadeInputs,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue