aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/document.rs4
-rw-r--r--components/script/dom/node.rs7
2 files changed, 11 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 1d0aabc3d51..1092a070837 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -3855,6 +3855,10 @@ impl Document {
.borrow()
.do_post_reflow_update(&self.window, self.current_animation_timeline_value());
}
+
+ pub(crate) fn cancel_animations_for_node(&self, node: &Node) {
+ self.animations.borrow().cancel_animations_for_node(node);
+ }
}
impl Element {
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index f17c22163d0..9bfe91e3470 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -281,6 +281,11 @@ impl Node {
}
}
+ pub fn clean_up_layout_data(&self) {
+ self.owner_doc().cancel_animations_for_node(self);
+ self.style_and_layout_data.borrow_mut().take();
+ }
+
/// Clean up flags and unbind from tree.
pub fn complete_remove_subtree(root: &Node, context: &UnbindContext) {
for node in root.traverse_preorder(ShadowIncluding::Yes) {
@@ -295,6 +300,8 @@ impl Node {
);
}
for node in root.traverse_preorder(ShadowIncluding::Yes) {
+ node.clean_up_layout_data();
+
// This needs to be in its own loop, because unbind_from_tree may
// rely on the state of IS_IN_DOC of the context node's descendants,
// e.g. when removing a <form>.