aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/cssstylesheet.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-04-29 08:38:50 -0400
committerGitHub <noreply@github.com>2019-04-29 08:38:50 -0400
commit799490a02e9bea575bf34c39f045ef0883539f05 (patch)
tree278cada683564db36997cf3f96c92513b89c3096 /components/script/dom/cssstylesheet.rs
parentd58ea974baff1b51a43d2e2bf4b287ff11991a8d (diff)
parent37e88e77cdf00e3555599dd4004d03548bd95dcf (diff)
downloadservo-799490a02e9bea575bf34c39f045ef0883539f05.tar.gz
servo-799490a02e9bea575bf34c39f045ef0883539f05.zip
Auto merge of #22743 - ferjm:shadowdom, r=emilio
Partial ShadowDOM support This is just an early WIP, not to take it very seriously yet. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [x] These changes fix #22719 - [x] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22743) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/cssstylesheet.rs')
-rw-r--r--components/script/dom/cssstylesheet.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs
index 2def47d7aaa..66d2fd8a339 100644
--- a/components/script/dom/cssstylesheet.rs
+++ b/components/script/dom/cssstylesheet.rs
@@ -4,13 +4,14 @@
use crate::dom::bindings::codegen::Bindings::CSSStyleSheetBinding;
use crate::dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods;
-use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
+use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::cssrulelist::{CSSRuleList, RulesSource};
use crate::dom::element::Element;
+use crate::dom::node::{stylesheets_owner_from_node, Node};
use crate::dom::stylesheet::StyleSheet;
use crate::dom::window::Window;
use dom_struct::dom_struct;
@@ -64,6 +65,10 @@ impl CSSStyleSheet {
)
}
+ pub fn owner(&self) -> DomRoot<Element> {
+ DomRoot::from_ref(&*self.owner)
+ }
+
fn rulelist(&self) -> DomRoot<CSSRuleList> {
self.rulelist.or_init(|| {
let rules = self.style_stylesheet.contents.rules.clone();
@@ -81,10 +86,7 @@ impl CSSStyleSheet {
pub fn set_disabled(&self, disabled: bool) {
if self.style_stylesheet.set_disabled(disabled) {
- self.global()
- .as_window()
- .Document()
- .invalidate_stylesheets();
+ stylesheets_owner_from_node(self.owner().upcast::<Node>()).invalidate_stylesheets();
}
}