Implement StyleSheet.disabled.

This commit is contained in:
Cameron McCormack 2016-11-23 18:07:16 +08:00
parent 4529435f96
commit 64ff6dc103
10 changed files with 62 additions and 16 deletions

View file

@ -4,12 +4,13 @@
use dom::bindings::codegen::Bindings::StyleSheetBinding;
use dom::bindings::codegen::Bindings::StyleSheetBinding::StyleSheetMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
#[dom_struct]
pub struct StyleSheet {
reflector_: Reflector,
@ -20,12 +21,14 @@ pub struct StyleSheet {
impl StyleSheet {
#[allow(unrooted_must_root)]
pub fn new_inherited(type_: DOMString, href: Option<DOMString>, title: Option<DOMString>) -> StyleSheet {
pub fn new_inherited(type_: DOMString,
href: Option<DOMString>,
title: Option<DOMString>) -> StyleSheet {
StyleSheet {
reflector_: Reflector::new(),
type_: type_,
href: href,
title: title
title: title,
}
}
@ -55,5 +58,14 @@ impl StyleSheetMethods for StyleSheet {
fn GetTitle(&self) -> Option<DOMString> {
self.title.clone()
}
}
// https://drafts.csswg.org/cssom/#dom-stylesheet-disabled
fn Disabled(&self) -> bool {
self.downcast::<CSSStyleSheet>().unwrap().disabled()
}
// https://drafts.csswg.org/cssom/#dom-stylesheet-disabled
fn SetDisabled(&self, disabled: bool) {
self.downcast::<CSSStyleSheet>().unwrap().set_disabled(disabled)
}
}