diff --git a/components/script/dom/css2properties.rs b/components/script/dom/css2properties.rs new file mode 100644 index 00000000000..95de3b782d1 --- /dev/null +++ b/components/script/dom/css2properties.rs @@ -0,0 +1,64 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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::CSS2PropertiesBinding::CSS2PropertiesMethods; +use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods; +use dom::bindings::codegen::InheritTypes::CSSStyleDeclarationCast; +use dom::bindings::utils::{Reflectable, Reflector}; +use dom::bindings::js::JSRef; +use dom::cssstyledeclaration::CSSStyleDeclaration; +use servo_util::str::DOMString; + +#[dom_struct] +pub struct CSS2Properties { + declaration: CSSStyleDeclaration, +} + +impl<'a> CSS2PropertiesMethods for JSRef<'a, CSS2Properties> { + fn Color(self) -> DOMString { + "".to_string() + } + + fn SetColor(self, _value: DOMString) { + } + + fn Background(self) -> DOMString { + "".to_string() + } + + fn SetBackground(self, _value: DOMString) { + } + + fn Display(self) -> DOMString { + "".to_string() + } + + fn SetDisplay(self, _value: DOMString) { + } + + fn Width(self) -> DOMString { + "".to_string() + } + + fn SetWidth(self, _value: DOMString) { + } + + fn Height(self) -> DOMString { + "".to_string() + } + + fn SetHeight(self, _value: DOMString) { + } + + fn IndexedGetter(self, index: u32, found: &mut bool) -> DOMString { + let decl: JSRef = CSSStyleDeclarationCast::from_ref(self); + decl.IndexedGetter(index, found) + } +} + +impl Reflectable for CSS2Properties { + fn reflector<'a>(&'a self) -> &'a Reflector { + self.declaration.reflector() + } +} diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 873d7dfb6a2..d9687fd17f3 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -65,4 +65,3 @@ impl Reflectable for CSSStyleDeclaration { &self.reflector_ } } - diff --git a/components/script/dom/webidls/CSS2Properties.webidl b/components/script/dom/webidls/CSS2Properties.webidl new file mode 100644 index 00000000000..818a41522ad --- /dev/null +++ b/components/script/dom/webidls/CSS2Properties.webidl @@ -0,0 +1,17 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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/. + * + * The origin of this IDL file is + * http://dev.w3.org/csswg/cssom/ + * + */ + +interface CSS2Properties : CSSStyleDeclaration { + [TreatNullAs=EmptyString] attribute DOMString color; + [TreatNullAs=EmptyString] attribute DOMString display; + [TreatNullAs=EmptyString] attribute DOMString background; + [TreatNullAs=EmptyString] attribute DOMString width; + [TreatNullAs=EmptyString] attribute DOMString height; +}; diff --git a/components/script/lib.rs b/components/script/lib.rs index c818df7cb00..a956a26d876 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -88,6 +88,7 @@ pub mod dom { pub mod browsercontext; pub mod canvasrenderingcontext2d; pub mod characterdata; + pub mod css2properties; pub mod cssstyledeclaration; pub mod domrect; pub mod domrectlist;