mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use computed styles of the pseudo and its parent when calling Gecko_UpdateAnimations to update CSS Animations on pseudo-elements.
This commit is contained in:
parent
94a2262821
commit
60fadb2d2c
1 changed files with 11 additions and 4 deletions
|
@ -506,24 +506,31 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
}
|
||||
|
||||
fn update_animations(&self, pseudo: Option<&PseudoElement>) {
|
||||
let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo);
|
||||
|
||||
// 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 =
|
||||
computed_data.as_ref().map(|d|
|
||||
pseudo.map_or_else(|| d.styles().primary.values(),
|
||||
|p| d.styles().pseudos.get(p).unwrap().values())
|
||||
);
|
||||
let computed_values_opt = computed_values.map(|v|
|
||||
*HasArcFFI::arc_as_borrowed(v)
|
||||
);
|
||||
|
||||
let parent_element = self.parent_element();
|
||||
let parent_element = if pseudo.is_some() {
|
||||
self.parent_element()
|
||||
} else {
|
||||
Some(*self)
|
||||
};
|
||||
let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
|
||||
let parent_values = parent_data.as_ref().map(|d| d.styles().primary.values());
|
||||
let parent_values_opt = parent_values.map(|v|
|
||||
*HasArcFFI::arc_as_borrowed(v)
|
||||
);
|
||||
|
||||
let atom_ptr = PseudoElement::ns_atom_or_null_from_opt(pseudo);
|
||||
unsafe {
|
||||
Gecko_UpdateAnimations(self.0, atom_ptr,
|
||||
computed_values_opt,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue