mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implements Stylesheet.ownerNode
This commit is contained in:
parent
406d15974f
commit
e7199c029f
14 changed files with 72 additions and 39 deletions
|
@ -116,7 +116,7 @@ impl HTMLLinkElement {
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,13 @@ impl HTMLLinkElement {
|
|||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn clean_stylesheet_ownership(&self) {
|
||||
if let Some(cssom_stylesheet) = self.cssom_stylesheet.get() {
|
||||
cssom_stylesheet.set_owner(None);
|
||||
}
|
||||
self.cssom_stylesheet.set(None);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_attr(element: &Element, local_name: &LocalName) -> Option<String> {
|
||||
|
@ -255,6 +262,7 @@ impl VirtualMethods for HTMLLinkElement {
|
|||
}
|
||||
|
||||
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