diff options
Diffstat (limited to 'components/script/dom/cssrule.rs')
-rw-r--r-- | components/script/dom/cssrule.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/components/script/dom/cssrule.rs b/components/script/dom/cssrule.rs index 603354c8621..8323d7e22b0 100644 --- a/components/script/dom/cssrule.rs +++ b/components/script/dom/cssrule.rs @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::codegen::Bindings::CSSRuleBinding; use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleMethods; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, Root}; -use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bindings::reflector::Reflector; use dom::bindings::str::DOMString; use dom::cssfontfacerule::CSSFontFaceRule; +use dom::cssimportrule::CSSImportRule; use dom::csskeyframerule::CSSKeyframeRule; use dom::csskeyframesrule::CSSKeyframesRule; use dom::cssmediarule::CSSMediaRule; @@ -42,13 +42,6 @@ impl CSSRule { } } - #[allow(unrooted_must_root)] - pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet) -> Root<CSSRule> { - reflect_dom_object(box CSSRule::new_inherited(parent_stylesheet), - window, - CSSRuleBinding::Wrap) - } - pub fn as_specific(&self) -> &SpecificCSSRule { if let Some(rule) = self.downcast::<CSSStyleRule>() { rule as &SpecificCSSRule @@ -64,6 +57,8 @@ impl CSSRule { rule as &SpecificCSSRule } else if let Some(rule) = self.downcast::<CSSKeyframeRule>() { rule as &SpecificCSSRule + } else if let Some(rule) = self.downcast::<CSSImportRule>() { + rule as &SpecificCSSRule } else { unreachable!() } @@ -75,6 +70,7 @@ impl CSSRule { rule: StyleCssRule) -> Root<CSSRule> { // be sure to update the match in as_specific when this is updated match rule { + StyleCssRule::Import(s) => Root::upcast(CSSImportRule::new(window, parent_stylesheet, s)), StyleCssRule::Style(s) => Root::upcast(CSSStyleRule::new(window, parent_stylesheet, s)), StyleCssRule::FontFace(s) => Root::upcast(CSSFontFaceRule::new(window, parent_stylesheet, s)), StyleCssRule::Keyframes(s) => Root::upcast(CSSKeyframesRule::new(window, parent_stylesheet, s)), |