mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add overridable tree binding/unbinding behaviour.
This commit is contained in:
parent
f5d1907195
commit
6388dec996
3 changed files with 39 additions and 10 deletions
|
@ -42,6 +42,22 @@ pub trait VirtualMethods {
|
|||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when a Node is appended to a tree that is part of a Document.
|
||||
fn bind_to_tree(&mut self) {
|
||||
match self.super_type() {
|
||||
Some(ref mut s) => s.bind_to_tree(),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when a Node is removed from a tree that is part of a Document.
|
||||
fn unbind_from_tree(&mut self) {
|
||||
match self.super_type() {
|
||||
Some(ref mut s) => s.unbind_from_tree(),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Obtain a VirtualMethods instance for a given Node-derived object. Any
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue