diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/document.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmllinkelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmlmetaelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmlstyleelement.rs | 5 |
4 files changed, 8 insertions, 9 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 886e392dee7..c20ab990561 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -141,7 +141,7 @@ use style::selector_parser::{RestyleDamage, Snapshot}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard}; use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join}; use style::stylesheet_set::StylesheetSet; -use style::stylesheets::{Stylesheet, StylesheetContents, OriginSet}; +use style::stylesheets::{Stylesheet, StylesheetContents, Origin, OriginSet}; use task_source::TaskSource; use time; use timers::OneshotTimerCallback; @@ -2435,7 +2435,7 @@ impl Document { pub fn stylesheet_at(&self, index: usize) -> Option<Root<CSSStyleSheet>> { let stylesheets = self.stylesheets.borrow(); - stylesheets.get(index).and_then(|s| { + stylesheets.get(Origin::Author, index).and_then(|s| { s.owner.upcast::<Node>().get_cssom_stylesheet() }) } diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 963f570700a..f1a8242b345 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -242,8 +242,8 @@ impl VirtualMethods for HTMLLinkElement { s.unbind_from_tree(context); } - if let Some(ref s) = *self.stylesheet.borrow() { - document_from_node(self).remove_stylesheet(self.upcast(), s); + if let Some(s) = self.stylesheet.borrow_mut().take() { + document_from_node(self).remove_stylesheet(self.upcast(), &s); } } } diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 5e2d9c1c0b4..dbf5b676879 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -196,8 +196,8 @@ impl VirtualMethods for HTMLMetaElement { if context.tree_in_doc { self.process_referrer_attribute(); - if let Some(ref s) = *self.stylesheet.borrow() { - document_from_node(self).remove_stylesheet(self.upcast(), s); + if let Some(s) = self.stylesheet.borrow_mut().take() { + document_from_node(self).remove_stylesheet(self.upcast(), &s); } } } diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 330ee738466..65c7d11c12f 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -190,9 +190,8 @@ impl VirtualMethods for HTMLStyleElement { } if context.tree_in_doc { - if let Some(ref s) = *self.stylesheet.borrow() { - let doc = document_from_node(self); - doc.remove_stylesheet(self.upcast(), s) + if let Some(s) = self.stylesheet.borrow_mut().take() { + document_from_node(self).remove_stylesheet(self.upcast(), &s) } } } |