mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implements Stylesheet.ownerNode
This commit is contained in:
parent
406d15974f
commit
e7199c029f
14 changed files with 72 additions and 39 deletions
|
@ -144,7 +144,7 @@ impl HTMLStyleElement {
|
|||
stylesheets_owner.remove_stylesheet(self.upcast(), s)
|
||||
}
|
||||
*self.stylesheet.borrow_mut() = Some(s.clone());
|
||||
self.cssom_stylesheet.set(None);
|
||||
self.clean_stylesheet_ownership();
|
||||
stylesheets_owner.add_stylesheet(self.upcast(), s);
|
||||
}
|
||||
|
||||
|
@ -166,6 +166,13 @@ impl HTMLStyleElement {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn clean_stylesheet_ownership(&self) {
|
||||
if let Some(cssom_stylesheet) = self.cssom_stylesheet.get() {
|
||||
cssom_stylesheet.set_owner(None);
|
||||
}
|
||||
self.cssom_stylesheet.set(None);
|
||||
}
|
||||
}
|
||||
|
||||
impl VirtualMethods for HTMLStyleElement {
|
||||
|
@ -217,6 +224,7 @@ impl VirtualMethods for HTMLStyleElement {
|
|||
|
||||
if context.tree_connected {
|
||||
if let Some(s) = self.stylesheet.borrow_mut().take() {
|
||||
self.clean_stylesheet_ownership();
|
||||
stylesheets_owner_from_node(self).remove_stylesheet(self.upcast(), &s)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue