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>) {
let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo);
let computed_data = self.borrow_data().unwrap();
let computed_values = computed_data.styles().primary.values();
// We have to update animations even if the element has no computed style
// 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_data = parent_element.as_ref().and_then(|e| e.borrow_data());
@ -523,7 +529,7 @@ impl<'le> TElement for GeckoElement<'le> {
unsafe {
Gecko_UpdateAnimations(self.0, atom_ptr,
HasArcFFI::arc_as_borrowed(&computed_values),
computed_values_opt,
parent_values_opt);
}
}

View file

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