diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-02-05 20:50:44 +0100 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-04-26 10:17:47 +0200 |
commit | 3bb50cc4795c3ac98d25e2b54d871ded2c3f3fed (patch) | |
tree | 736690ba430ac32c66157ca93a2d304c5a969820 /components/script/dom/htmlstyleelement.rs | |
parent | 0d6bd24245df02e8e745a273e37cd53d70c19ce6 (diff) | |
download | servo-3bb50cc4795c3ac98d25e2b54d871ded2c3f3fed.tar.gz servo-3bb50cc4795c3ac98d25e2b54d871ded2c3f3fed.zip |
ShadowRoot stylesheet list
Diffstat (limited to 'components/script/dom/htmlstyleelement.rs')
-rw-r--r-- | components/script/dom/htmlstyleelement.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 20617a37079..f8465874a38 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -13,7 +13,8 @@ use crate::dom::document::Document; use crate::dom::element::{Element, ElementCreator}; use crate::dom::htmlelement::HTMLElement; use crate::dom::node::{ - document_from_node, window_from_node, ChildrenMutation, Node, UnbindContext, + document_from_node, stylesheets_owner_from_node, window_from_node, ChildrenMutation, Node, + UnbindContext, }; use crate::dom::stylesheet::StyleSheet as DOMStyleSheet; use crate::dom::virtualmethods::VirtualMethods; @@ -138,13 +139,13 @@ impl HTMLStyleElement { // FIXME(emilio): This is duplicated with HTMLLinkElement::set_stylesheet. pub fn set_stylesheet(&self, s: Arc<Stylesheet>) { - let doc = document_from_node(self); + let stylesheets_owner = stylesheets_owner_from_node(self); if let Some(ref s) = *self.stylesheet.borrow() { - doc.remove_stylesheet(self.upcast(), s) + stylesheets_owner.remove_stylesheet(self.upcast(), s) } *self.stylesheet.borrow_mut() = Some(s.clone()); self.cssom_stylesheet.set(None); - doc.add_stylesheet(self.upcast(), s); + stylesheets_owner.add_stylesheet(self.upcast(), s); } pub fn get_stylesheet(&self) -> Option<Arc<Stylesheet>> { @@ -216,7 +217,7 @@ impl VirtualMethods for HTMLStyleElement { if context.tree_connected { if let Some(s) = self.stylesheet.borrow_mut().take() { - document_from_node(self).remove_stylesheet(self.upcast(), &s) + stylesheets_owner_from_node(self).remove_stylesheet(self.upcast(), &s) } } } |