script: Add CSSImportRule WebIDL interface.

This commit is contained in:
Emilio Cobos Álvarez 2016-12-16 12:13:32 +01:00
parent ca93a2dcec
commit b86aa41568
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 77 additions and 1 deletions

View file

@ -9,6 +9,7 @@ use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
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;
@ -64,6 +65,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 +78,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)),