Include animations and transitions in the cascade

Instead of applying animations and transitions to styled elements,
include them in the cascade. This allows them to interact properly with
things like font-size and !important rules.
This commit is contained in:
Martin Robinson 2020-05-20 15:44:17 +02:00
parent 8b56b7a3c2
commit 364235ac0c
17 changed files with 314 additions and 216 deletions

View file

@ -1524,32 +1524,10 @@ impl<'le> TElement for GeckoElement<'le> {
self.may_have_animations() && unsafe { Gecko_ElementHasCSSAnimations(self.0) }
}
fn has_css_transitions(&self) -> bool {
fn has_css_transitions(&self, _: &SharedStyleContext) -> bool {
self.may_have_animations() && unsafe { Gecko_ElementHasCSSTransitions(self.0) }
}
fn might_need_transitions_update(
&self,
old_style: Option<&ComputedValues>,
new_style: &ComputedValues,
) -> bool {
let old_style = match old_style {
Some(v) => v,
None => return false,
};
let new_box_style = new_style.get_box();
if !self.has_css_transitions() && !new_box_style.specifies_transitions() {
return false;
}
if new_box_style.clone_display().is_none() || old_style.clone_display().is_none() {
return false;
}
return true;
}
// Detect if there are any changes that require us to update transitions.
// This is used as a more thoroughgoing check than the, cheaper
// might_need_transitions_update check.