mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Added 'parent is/was in tree' param to bind_to_tree/unbind_from_tree
According to a talk with Ms2ger, both bind_to_tree / unbind_from_tree should be called regardless if the tree is part of a Document. This information is now passed as a parameter to their respective virtual methods.
This commit is contained in:
parent
e8996d5ce5
commit
aea4ccf849
5 changed files with 32 additions and 25 deletions
|
@ -60,18 +60,20 @@ pub trait VirtualMethods {
|
|||
}
|
||||
}
|
||||
|
||||
/// Called when a Node is appended to a tree that is part of a Document.
|
||||
fn bind_to_tree(&self) {
|
||||
/// Called when a Node is appended to a tree, where 'tree_in_doc' indicates
|
||||
/// whether the tree is part of a Document.
|
||||
fn bind_to_tree(&self, tree_in_doc: bool) {
|
||||
match self.super_type() {
|
||||
Some(ref s) => s.bind_to_tree(),
|
||||
Some(ref s) => s.bind_to_tree(tree_in_doc),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when a Node is removed from a tree that is part of a Document.
|
||||
fn unbind_from_tree(&self) {
|
||||
/// Called when a Node is removed from a tree, where 'tree_in_doc'
|
||||
/// indicates whether the tree is part of a Document.
|
||||
fn unbind_from_tree(&self, tree_in_doc: bool) {
|
||||
match self.super_type() {
|
||||
Some(ref s) => s.unbind_from_tree(),
|
||||
Some(ref s) => s.unbind_from_tree(tree_in_doc),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue