Call UpdateAnimations even if the element has no computed values.

This commit is contained in:
Hiroyuki Ikezoe 2017-03-10 11:30:57 +09:00
parent c32ba98031
commit f2c547aaaf
2 changed files with 10 additions and 4 deletions

View file

@ -511,8 +511,14 @@ impl<'le> TElement for GeckoElement<'le> {
fn update_animations(&self, pseudo: Option<&PseudoElement>) { fn update_animations(&self, pseudo: Option<&PseudoElement>) {
let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo); let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo);
let computed_data = self.borrow_data().unwrap(); // We have to update animations even if the element has no computed style
let computed_values = computed_data.styles().primary.values(); // since it means the element is in a display:none subtree, we should destroy
// all CSS animations in display:none subtree.
let computed_data = self.borrow_data();
let computed_values = computed_data.as_ref().map(|d| d.styles().primary.values());
let computed_values_opt = computed_values.map(|v|
*HasArcFFI::arc_as_borrowed(v)
);
let parent_element = self.parent_element(); let parent_element = self.parent_element();
let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data()); let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
@ -523,7 +529,7 @@ impl<'le> TElement for GeckoElement<'le> {
unsafe { unsafe {
Gecko_UpdateAnimations(self.0, atom_ptr, Gecko_UpdateAnimations(self.0, atom_ptr,
HasArcFFI::arc_as_borrowed(&computed_values), computed_values_opt,
parent_values_opt); parent_values_opt);
} }
} }

View file

@ -545,7 +545,7 @@ extern "C" {
pub fn Gecko_UpdateAnimations(aElement: RawGeckoElementBorrowed, pub fn Gecko_UpdateAnimations(aElement: RawGeckoElementBorrowed,
aPseudoTagOrNull: *mut nsIAtom, aPseudoTagOrNull: *mut nsIAtom,
aComputedValues: aComputedValues:
ServoComputedValuesBorrowed, ServoComputedValuesBorrowedOrNull,
aParentComputedValues: aParentComputedValues:
ServoComputedValuesBorrowedOrNull); ServoComputedValuesBorrowedOrNull);
} }