mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Update animations when a pseudo-element had animations but no longer has, and has been re-framed in the meantime.
This is the easy fix. The hard fix (outlined in the comment) would be nice, but I don't think this bug alone justifies it. Differential Revision: https://phabricator.services.mozilla.com/D38184
This commit is contained in:
parent
59cf10d1b0
commit
137044a3db
2 changed files with 26 additions and 6 deletions
|
@ -240,16 +240,31 @@ trait PrivateMatchMethods: TElement {
|
||||||
let new_box_style = new_style.get_box();
|
let new_box_style = new_style.get_box();
|
||||||
let new_style_specifies_animations = new_box_style.specifies_animations();
|
let new_style_specifies_animations = new_box_style.specifies_animations();
|
||||||
|
|
||||||
let old_style = match old_style {
|
|
||||||
Some(old) => old,
|
|
||||||
None => return new_style_specifies_animations,
|
|
||||||
};
|
|
||||||
|
|
||||||
let has_animations = self.has_css_animations();
|
let has_animations = self.has_css_animations();
|
||||||
if !new_style_specifies_animations && !has_animations {
|
if !new_style_specifies_animations && !has_animations {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let old_style = match old_style {
|
||||||
|
Some(old) => old,
|
||||||
|
// If we have no old style but have animations, we may be a
|
||||||
|
// pseudo-element which was re-created without style changes.
|
||||||
|
//
|
||||||
|
// This can happen when we reframe the pseudo-element without
|
||||||
|
// restyling it (due to content insertion on a flex container or
|
||||||
|
// such, for example). See bug 1564366.
|
||||||
|
//
|
||||||
|
// FIXME(emilio): The really right fix for this is keeping the
|
||||||
|
// pseudo-element itself around on reframes, but that's a bit
|
||||||
|
// harder. If we do that we can probably remove quite a lot of the
|
||||||
|
// EffectSet complexity though, since right now it's stored on the
|
||||||
|
// parent element for pseudo-elements given we need to keep it
|
||||||
|
// around...
|
||||||
|
None => {
|
||||||
|
return new_style_specifies_animations || new_style.is_pseudo_style();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let old_box_style = old_style.get_box();
|
let old_box_style = old_style.get_box();
|
||||||
|
|
||||||
let keyframes_could_have_changed = context
|
let keyframes_could_have_changed = context
|
||||||
|
|
|
@ -117,9 +117,14 @@ impl ComputedValues {
|
||||||
).to_outer(None)
|
).to_outer(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn is_pseudo_style(&self) -> bool {
|
||||||
|
self.0.mPseudoType != PseudoStyleType::NotPseudo
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn pseudo(&self) -> Option<PseudoElement> {
|
pub fn pseudo(&self) -> Option<PseudoElement> {
|
||||||
if self.0.mPseudoType == PseudoStyleType::NotPseudo {
|
if !self.is_pseudo_style() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
PseudoElement::from_pseudo_type(self.0.mPseudoType)
|
PseudoElement::from_pseudo_type(self.0.mPseudoType)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue