mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Add is_connected flag to node and use it to replace most uses of is_in_doc
This commit is contained in:
parent
640fc04743
commit
441357b74e
29 changed files with 111 additions and 96 deletions
|
@ -185,14 +185,14 @@ impl VirtualMethods for HTMLStyleElement {
|
|||
}
|
||||
}
|
||||
|
||||
fn bind_to_tree(&self, tree_in_doc: bool) {
|
||||
self.super_type().unwrap().bind_to_tree(tree_in_doc);
|
||||
fn bind_to_tree(&self, tree_connected: bool) {
|
||||
self.super_type().unwrap().bind_to_tree(tree_connected);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#update-a-style-block
|
||||
// Handles the case when:
|
||||
// "The element is not on the stack of open elements of an HTML parser or XML parser,
|
||||
// and it becomes connected or disconnected."
|
||||
if tree_in_doc && !self.in_stack_of_open_elements.get() {
|
||||
if tree_connected && !self.in_stack_of_open_elements.get() {
|
||||
self.parse_own_css();
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ impl VirtualMethods for HTMLStyleElement {
|
|||
s.unbind_from_tree(context);
|
||||
}
|
||||
|
||||
if context.tree_in_doc {
|
||||
if context.tree_connected {
|
||||
if let Some(s) = self.stylesheet.borrow_mut().take() {
|
||||
document_from_node(self).remove_stylesheet(self.upcast(), &s)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue