mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #26953 - mrobinson:cancel-reparent, r=nox
Cancel animations for nodes which are removed from the DOM This includes nodes which are being reparented. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
f35f671f45
8 changed files with 32 additions and 31 deletions
|
@ -3861,6 +3861,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 {
|
||||
|
|
|
@ -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>.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue