mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Merge CSS2Properties and CSSStyleDeclaration.
This commit is contained in:
parent
b4cade0612
commit
c8557c44a9
6 changed files with 332 additions and 388 deletions
|
@ -1,272 +0,0 @@
|
|||
/* 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;
|
||||
use dom::bindings::codegen::Bindings::CSS2PropertiesBinding::CSS2PropertiesMethods;
|
||||
use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods;
|
||||
use dom::bindings::codegen::InheritTypes::CSSStyleDeclarationCast;
|
||||
use dom::bindings::global;
|
||||
use dom::bindings::js::{JSRef, Temporary};
|
||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::cssstyledeclaration::CSSStyleDeclaration;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::window::Window;
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSS2Properties {
|
||||
cssstyledeclaration: CSSStyleDeclaration,
|
||||
}
|
||||
|
||||
macro_rules! css_getter(
|
||||
( $idlattr:ident, $cssprop:expr ) => (
|
||||
fn $idlattr(self) -> DOMString {
|
||||
let decl: JSRef<CSSStyleDeclaration> = CSSStyleDeclarationCast::from_ref(self);
|
||||
decl.GetPropertyValue($cssprop.to_string())
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
macro_rules! css_setter(
|
||||
( $fnname:ident, $cssprop:expr ) => (
|
||||
fn $fnname(self, value: DOMString) {
|
||||
let decl: JSRef<CSSStyleDeclaration> = CSSStyleDeclarationCast::from_ref(self);
|
||||
decl.SetPropertyValue($cssprop.to_string(), value).unwrap();
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
impl CSS2Properties {
|
||||
fn new_inherited(owner: JSRef<HTMLElement>) -> CSS2Properties {
|
||||
CSS2Properties {
|
||||
cssstyledeclaration: CSSStyleDeclaration::new_inherited(owner),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(global: JSRef<Window>, owner: JSRef<HTMLElement>) -> Temporary<CSS2Properties> {
|
||||
reflect_dom_object(box CSS2Properties::new_inherited(owner),
|
||||
global::Window(global),
|
||||
CSS2PropertiesBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> CSS2PropertiesMethods for JSRef<'a, CSS2Properties> {
|
||||
css_getter!(Color, "color")
|
||||
css_setter!(SetColor, "color")
|
||||
|
||||
css_getter!(Background, "background")
|
||||
css_setter!(SetBackground, "background")
|
||||
|
||||
css_getter!(BackgroundColor, "background-color")
|
||||
css_setter!(SetBackgroundColor, "background-color")
|
||||
|
||||
css_getter!(BackgroundPosition, "background-position")
|
||||
css_setter!(SetBackgroundPosition, "background-position")
|
||||
|
||||
css_getter!(BackgroundImage, "background-image")
|
||||
css_setter!(SetBackgroundImage, "background-image")
|
||||
|
||||
css_getter!(BackgroundRepeat, "background-repeat")
|
||||
css_setter!(SetBackgroundRepeat, "background-repeat")
|
||||
|
||||
css_getter!(BackgroundAttachment, "background-attachment")
|
||||
css_setter!(SetBackgroundAttachment, "background-attachment")
|
||||
|
||||
css_getter!(Border, "border")
|
||||
css_setter!(SetBorder, "border")
|
||||
|
||||
css_getter!(BorderColor, "border-color")
|
||||
css_setter!(SetBorderColor, "border-color")
|
||||
|
||||
css_getter!(BorderStyle, "border-style")
|
||||
css_setter!(SetBorderStyle, "border-style")
|
||||
|
||||
css_getter!(BorderWidth, "border-width")
|
||||
css_setter!(SetBorderWidth, "border-width")
|
||||
|
||||
css_getter!(BorderBottom, "border-bottom")
|
||||
css_setter!(SetBorderBottom, "border-bottom")
|
||||
|
||||
css_getter!(BorderBottomColor, "border-bottom-color")
|
||||
css_setter!(SetBorderBottomColor, "border-bottom-color")
|
||||
|
||||
css_getter!(BorderBottomStyle, "border-bottom-style")
|
||||
css_setter!(SetBorderBottomStyle, "border-bottom-style")
|
||||
|
||||
css_getter!(BorderBottomWidth, "border-bottom-width")
|
||||
css_setter!(SetBorderBottomWidth, "border-bottom-width")
|
||||
|
||||
css_getter!(BorderLeft, "border-left")
|
||||
css_setter!(SetBorderLeft, "border-left")
|
||||
|
||||
css_getter!(BorderLeftColor, "border-left-color")
|
||||
css_setter!(SetBorderLeftColor, "border-left-color")
|
||||
|
||||
css_getter!(BorderLeftStyle, "border-left-style")
|
||||
css_setter!(SetBorderLeftStyle, "border-left-style")
|
||||
|
||||
css_getter!(BorderLeftWidth, "border-left-width")
|
||||
css_setter!(SetBorderLeftWidth, "border-left-width")
|
||||
|
||||
css_getter!(BorderRight, "border-right")
|
||||
css_setter!(SetBorderRight, "border-right")
|
||||
|
||||
css_getter!(BorderRightColor, "border-right-color")
|
||||
css_setter!(SetBorderRightColor, "border-right-color")
|
||||
|
||||
css_getter!(BorderRightStyle, "border-right-style")
|
||||
css_setter!(SetBorderRightStyle, "border-right-style")
|
||||
|
||||
css_getter!(BorderRightWidth, "border-right-width")
|
||||
css_setter!(SetBorderRightWidth, "border-right-width")
|
||||
|
||||
css_getter!(BorderTop, "border-top")
|
||||
css_setter!(SetBorderTop, "border-top")
|
||||
|
||||
css_getter!(BorderTopColor, "border-top-color")
|
||||
css_setter!(SetBorderTopColor, "border-top-color")
|
||||
|
||||
css_getter!(BorderTopStyle, "border-top-style")
|
||||
css_setter!(SetBorderTopStyle, "border-top-style")
|
||||
|
||||
css_getter!(BorderTopWidth, "border-top-width")
|
||||
css_setter!(SetBorderTopWidth, "border-top-width")
|
||||
|
||||
css_getter!(Content, "content")
|
||||
css_setter!(SetContent, "content")
|
||||
|
||||
css_getter!(Display, "display")
|
||||
css_setter!(SetDisplay, "display")
|
||||
|
||||
css_getter!(Width, "width")
|
||||
css_setter!(SetWidth, "width")
|
||||
|
||||
css_getter!(MinWidth, "min-width")
|
||||
css_setter!(SetMinWidth, "min-width")
|
||||
|
||||
css_getter!(MaxWidth, "max-width")
|
||||
css_setter!(SetMaxWidth, "max-width")
|
||||
|
||||
css_getter!(Height, "height")
|
||||
css_setter!(SetHeight, "height")
|
||||
|
||||
css_getter!(MinHeight, "min-height")
|
||||
css_setter!(SetMinHeight, "min-height")
|
||||
|
||||
css_getter!(MaxHeight, "max-height")
|
||||
css_setter!(SetMaxHeight, "max-height")
|
||||
|
||||
css_getter!(Clear, "clear")
|
||||
css_setter!(SetClear, "clear")
|
||||
|
||||
css_getter!(Direction, "direction")
|
||||
css_setter!(SetDirection, "direction")
|
||||
|
||||
css_getter!(LineHeight, "line-height")
|
||||
css_setter!(SetLineHeight, "line-height")
|
||||
|
||||
css_getter!(VerticalAlign, "vertical-align")
|
||||
css_setter!(SetVerticalAlign, "vertical-align")
|
||||
|
||||
css_getter!(Visibility, "visibility")
|
||||
css_setter!(SetVisibility, "visibility")
|
||||
|
||||
css_getter!(Overflow, "overflow")
|
||||
css_setter!(SetOverflow, "overflow")
|
||||
|
||||
css_getter!(TableLayout, "table-layout")
|
||||
css_setter!(SetTableLayout, "table-layout")
|
||||
|
||||
css_getter!(WhiteSpace, "white-space")
|
||||
css_setter!(SetWhiteSpace, "white-space")
|
||||
|
||||
css_getter!(WritingMode, "writing-mode")
|
||||
css_setter!(SetWritingMode, "writing-mode")
|
||||
|
||||
css_getter!(TextAlign, "text-align")
|
||||
css_setter!(SetTextAlign, "text-align")
|
||||
|
||||
css_getter!(TextDecoration, "text-decoration")
|
||||
css_setter!(SetTextDecoration, "text-decoration")
|
||||
|
||||
css_getter!(TextOrientation, "text-orientation")
|
||||
css_setter!(SetTextOrientation, "text-orientation")
|
||||
|
||||
css_getter!(Font, "font")
|
||||
css_setter!(SetFont, "font")
|
||||
|
||||
css_getter!(FontFamily, "font-family")
|
||||
css_setter!(SetFontFamily, "font-family")
|
||||
|
||||
css_getter!(FontSize, "font-size")
|
||||
css_setter!(SetFontSize, "font-size")
|
||||
|
||||
css_getter!(FontStyle, "font-style")
|
||||
css_setter!(SetFontStyle, "font-style")
|
||||
|
||||
css_getter!(FontVariant, "font-variant")
|
||||
css_setter!(SetFontVariant, "font-variant")
|
||||
|
||||
css_getter!(FontWeight, "font-weight")
|
||||
css_setter!(SetFontWeight, "font-weight")
|
||||
|
||||
css_getter!(Margin, "margin")
|
||||
css_setter!(SetMargin, "margin")
|
||||
|
||||
css_getter!(MarginBottom, "margin-bottom")
|
||||
css_setter!(SetMarginBottom, "margin-bottom")
|
||||
|
||||
css_getter!(MarginLeft, "margin-left")
|
||||
css_setter!(SetMarginLeft, "margin-left")
|
||||
|
||||
css_getter!(MarginRight, "margin-right")
|
||||
css_setter!(SetMarginRight, "margin-right")
|
||||
|
||||
css_getter!(MarginTop, "margin-top")
|
||||
css_setter!(SetMarginTop, "margin-top")
|
||||
|
||||
css_getter!(Padding, "padding")
|
||||
css_setter!(SetPadding, "padding")
|
||||
|
||||
css_getter!(PaddingBottom, "padding-bottom")
|
||||
css_setter!(SetPaddingBottom, "padding-bottom")
|
||||
|
||||
css_getter!(PaddingLeft, "padding-left")
|
||||
css_setter!(SetPaddingLeft, "padding-left")
|
||||
|
||||
css_getter!(PaddingRight, "padding-right")
|
||||
css_setter!(SetPaddingRight, "padding-right")
|
||||
|
||||
css_getter!(PaddingTop, "padding-top")
|
||||
css_setter!(SetPaddingTop, "padding-top")
|
||||
|
||||
css_getter!(Position, "position")
|
||||
css_setter!(SetPosition, "position")
|
||||
|
||||
css_getter!(Top, "top")
|
||||
css_setter!(SetTop, "top")
|
||||
|
||||
css_getter!(Bottom, "bottom")
|
||||
css_setter!(SetBottom, "bottom")
|
||||
|
||||
css_getter!(Left, "left")
|
||||
css_setter!(SetLeft, "left")
|
||||
|
||||
css_getter!(Right, "right")
|
||||
css_setter!(SetRight, "right")
|
||||
|
||||
css_getter!(ZIndex, "z-index")
|
||||
css_setter!(SetZIndex, "z-index")
|
||||
|
||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> DOMString {
|
||||
let decl: JSRef<CSSStyleDeclaration> = CSSStyleDeclarationCast::from_ref(self);
|
||||
decl.IndexedGetter(index, found)
|
||||
}
|
||||
}
|
||||
|
||||
impl Reflectable for CSS2Properties {
|
||||
fn reflector<'a>(&'a self) -> &'a Reflector {
|
||||
self.cssstyledeclaration.reflector()
|
||||
}
|
||||
}
|
|
@ -2,16 +2,17 @@
|
|||
* 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::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods;
|
||||
use dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::{mod, CSSStyleDeclarationMethods};
|
||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast};
|
||||
use dom::bindings::error::ErrorResult;
|
||||
use dom::bindings::js::{JS, JSRef, OptionalRootedRootable};
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::bindings::global;
|
||||
use dom::bindings::js::{JS, JSRef, OptionalRootedRootable, Temporary};
|
||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::document::DocumentHelpers;
|
||||
use dom::element::{Element, ElementHelpers};
|
||||
use dom::node::window_from_node;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{document_from_node, NodeDamage, Node};
|
||||
use dom::node::{window_from_node, document_from_node, NodeDamage, Node};
|
||||
use dom::window::Window;
|
||||
use servo_util::str::DOMString;
|
||||
use string_cache::Atom;
|
||||
use style::{is_supported_property, longhands_from_shorthand, parse_style_attribute};
|
||||
|
@ -25,6 +26,22 @@ pub struct CSSStyleDeclaration {
|
|||
owner: JS<HTMLElement>,
|
||||
}
|
||||
|
||||
macro_rules! css_getter(
|
||||
( $idlattr:ident, $cssprop:expr ) => (
|
||||
fn $idlattr(self) -> DOMString {
|
||||
self.GetPropertyValue($cssprop.to_string())
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
macro_rules! css_setter(
|
||||
( $fnname:ident, $cssprop:expr ) => (
|
||||
fn $fnname(self, value: DOMString) {
|
||||
self.SetPropertyValue($cssprop.to_string(), value).unwrap();
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
fn serialize_list(list: &Vec<PropertyDeclaration>) -> DOMString {
|
||||
let mut result = String::new();
|
||||
for declaration in list.iter() {
|
||||
|
@ -45,6 +62,12 @@ impl CSSStyleDeclaration {
|
|||
owner: JS::from_rooted(owner),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(global: JSRef<Window>, owner: JSRef<HTMLElement>) -> Temporary<CSSStyleDeclaration> {
|
||||
reflect_dom_object(box CSSStyleDeclaration::new_inherited(owner),
|
||||
global::Window(global),
|
||||
CSSStyleDeclarationBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
trait PrivateCSSStyleDeclarationHelpers {
|
||||
|
@ -231,6 +254,213 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
*found = index < self.Length();
|
||||
rval
|
||||
}
|
||||
|
||||
css_getter!(Color, "color")
|
||||
css_setter!(SetColor, "color")
|
||||
|
||||
css_getter!(Background, "background")
|
||||
css_setter!(SetBackground, "background")
|
||||
|
||||
css_getter!(BackgroundColor, "background-color")
|
||||
css_setter!(SetBackgroundColor, "background-color")
|
||||
|
||||
css_getter!(BackgroundPosition, "background-position")
|
||||
css_setter!(SetBackgroundPosition, "background-position")
|
||||
|
||||
css_getter!(BackgroundImage, "background-image")
|
||||
css_setter!(SetBackgroundImage, "background-image")
|
||||
|
||||
css_getter!(BackgroundRepeat, "background-repeat")
|
||||
css_setter!(SetBackgroundRepeat, "background-repeat")
|
||||
|
||||
css_getter!(BackgroundAttachment, "background-attachment")
|
||||
css_setter!(SetBackgroundAttachment, "background-attachment")
|
||||
|
||||
css_getter!(Border, "border")
|
||||
css_setter!(SetBorder, "border")
|
||||
|
||||
css_getter!(BorderColor, "border-color")
|
||||
css_setter!(SetBorderColor, "border-color")
|
||||
|
||||
css_getter!(BorderStyle, "border-style")
|
||||
css_setter!(SetBorderStyle, "border-style")
|
||||
|
||||
css_getter!(BorderWidth, "border-width")
|
||||
css_setter!(SetBorderWidth, "border-width")
|
||||
|
||||
css_getter!(BorderBottom, "border-bottom")
|
||||
css_setter!(SetBorderBottom, "border-bottom")
|
||||
|
||||
css_getter!(BorderBottomColor, "border-bottom-color")
|
||||
css_setter!(SetBorderBottomColor, "border-bottom-color")
|
||||
|
||||
css_getter!(BorderBottomStyle, "border-bottom-style")
|
||||
css_setter!(SetBorderBottomStyle, "border-bottom-style")
|
||||
|
||||
css_getter!(BorderBottomWidth, "border-bottom-width")
|
||||
css_setter!(SetBorderBottomWidth, "border-bottom-width")
|
||||
|
||||
css_getter!(BorderLeft, "border-left")
|
||||
css_setter!(SetBorderLeft, "border-left")
|
||||
|
||||
css_getter!(BorderLeftColor, "border-left-color")
|
||||
css_setter!(SetBorderLeftColor, "border-left-color")
|
||||
|
||||
css_getter!(BorderLeftStyle, "border-left-style")
|
||||
css_setter!(SetBorderLeftStyle, "border-left-style")
|
||||
|
||||
css_getter!(BorderLeftWidth, "border-left-width")
|
||||
css_setter!(SetBorderLeftWidth, "border-left-width")
|
||||
|
||||
css_getter!(BorderRight, "border-right")
|
||||
css_setter!(SetBorderRight, "border-right")
|
||||
|
||||
css_getter!(BorderRightColor, "border-right-color")
|
||||
css_setter!(SetBorderRightColor, "border-right-color")
|
||||
|
||||
css_getter!(BorderRightStyle, "border-right-style")
|
||||
css_setter!(SetBorderRightStyle, "border-right-style")
|
||||
|
||||
css_getter!(BorderRightWidth, "border-right-width")
|
||||
css_setter!(SetBorderRightWidth, "border-right-width")
|
||||
|
||||
css_getter!(BorderTop, "border-top")
|
||||
css_setter!(SetBorderTop, "border-top")
|
||||
|
||||
css_getter!(BorderTopColor, "border-top-color")
|
||||
css_setter!(SetBorderTopColor, "border-top-color")
|
||||
|
||||
css_getter!(BorderTopStyle, "border-top-style")
|
||||
css_setter!(SetBorderTopStyle, "border-top-style")
|
||||
|
||||
css_getter!(BorderTopWidth, "border-top-width")
|
||||
css_setter!(SetBorderTopWidth, "border-top-width")
|
||||
|
||||
css_getter!(Content, "content")
|
||||
css_setter!(SetContent, "content")
|
||||
|
||||
css_getter!(Display, "display")
|
||||
css_setter!(SetDisplay, "display")
|
||||
|
||||
css_getter!(Width, "width")
|
||||
css_setter!(SetWidth, "width")
|
||||
|
||||
css_getter!(MinWidth, "min-width")
|
||||
css_setter!(SetMinWidth, "min-width")
|
||||
|
||||
css_getter!(MaxWidth, "max-width")
|
||||
css_setter!(SetMaxWidth, "max-width")
|
||||
|
||||
css_getter!(Height, "height")
|
||||
css_setter!(SetHeight, "height")
|
||||
|
||||
css_getter!(MinHeight, "min-height")
|
||||
css_setter!(SetMinHeight, "min-height")
|
||||
|
||||
css_getter!(MaxHeight, "max-height")
|
||||
css_setter!(SetMaxHeight, "max-height")
|
||||
|
||||
css_getter!(Clear, "clear")
|
||||
css_setter!(SetClear, "clear")
|
||||
|
||||
css_getter!(Direction, "direction")
|
||||
css_setter!(SetDirection, "direction")
|
||||
|
||||
css_getter!(LineHeight, "line-height")
|
||||
css_setter!(SetLineHeight, "line-height")
|
||||
|
||||
css_getter!(VerticalAlign, "vertical-align")
|
||||
css_setter!(SetVerticalAlign, "vertical-align")
|
||||
|
||||
css_getter!(Visibility, "visibility")
|
||||
css_setter!(SetVisibility, "visibility")
|
||||
|
||||
css_getter!(Overflow, "overflow")
|
||||
css_setter!(SetOverflow, "overflow")
|
||||
|
||||
css_getter!(TableLayout, "table-layout")
|
||||
css_setter!(SetTableLayout, "table-layout")
|
||||
|
||||
css_getter!(WhiteSpace, "white-space")
|
||||
css_setter!(SetWhiteSpace, "white-space")
|
||||
|
||||
css_getter!(WritingMode, "writing-mode")
|
||||
css_setter!(SetWritingMode, "writing-mode")
|
||||
|
||||
css_getter!(TextAlign, "text-align")
|
||||
css_setter!(SetTextAlign, "text-align")
|
||||
|
||||
css_getter!(TextDecoration, "text-decoration")
|
||||
css_setter!(SetTextDecoration, "text-decoration")
|
||||
|
||||
css_getter!(TextOrientation, "text-orientation")
|
||||
css_setter!(SetTextOrientation, "text-orientation")
|
||||
|
||||
css_getter!(Font, "font")
|
||||
css_setter!(SetFont, "font")
|
||||
|
||||
css_getter!(FontFamily, "font-family")
|
||||
css_setter!(SetFontFamily, "font-family")
|
||||
|
||||
css_getter!(FontSize, "font-size")
|
||||
css_setter!(SetFontSize, "font-size")
|
||||
|
||||
css_getter!(FontStyle, "font-style")
|
||||
css_setter!(SetFontStyle, "font-style")
|
||||
|
||||
css_getter!(FontVariant, "font-variant")
|
||||
css_setter!(SetFontVariant, "font-variant")
|
||||
|
||||
css_getter!(FontWeight, "font-weight")
|
||||
css_setter!(SetFontWeight, "font-weight")
|
||||
|
||||
css_getter!(Margin, "margin")
|
||||
css_setter!(SetMargin, "margin")
|
||||
|
||||
css_getter!(MarginBottom, "margin-bottom")
|
||||
css_setter!(SetMarginBottom, "margin-bottom")
|
||||
|
||||
css_getter!(MarginLeft, "margin-left")
|
||||
css_setter!(SetMarginLeft, "margin-left")
|
||||
|
||||
css_getter!(MarginRight, "margin-right")
|
||||
css_setter!(SetMarginRight, "margin-right")
|
||||
|
||||
css_getter!(MarginTop, "margin-top")
|
||||
css_setter!(SetMarginTop, "margin-top")
|
||||
|
||||
css_getter!(Padding, "padding")
|
||||
css_setter!(SetPadding, "padding")
|
||||
|
||||
css_getter!(PaddingBottom, "padding-bottom")
|
||||
css_setter!(SetPaddingBottom, "padding-bottom")
|
||||
|
||||
css_getter!(PaddingLeft, "padding-left")
|
||||
css_setter!(SetPaddingLeft, "padding-left")
|
||||
|
||||
css_getter!(PaddingRight, "padding-right")
|
||||
css_setter!(SetPaddingRight, "padding-right")
|
||||
|
||||
css_getter!(PaddingTop, "padding-top")
|
||||
css_setter!(SetPaddingTop, "padding-top")
|
||||
|
||||
css_getter!(Position, "position")
|
||||
css_setter!(SetPosition, "position")
|
||||
|
||||
css_getter!(Top, "top")
|
||||
css_setter!(SetTop, "top")
|
||||
|
||||
css_getter!(Bottom, "bottom")
|
||||
css_setter!(SetBottom, "bottom")
|
||||
|
||||
css_getter!(Left, "left")
|
||||
css_setter!(SetLeft, "left")
|
||||
|
||||
css_getter!(Right, "right")
|
||||
css_setter!(SetRight, "right")
|
||||
|
||||
css_getter!(ZIndex, "z-index")
|
||||
css_setter!(SetZIndex, "z-index")
|
||||
}
|
||||
|
||||
impl Reflectable for CSSStyleDeclaration {
|
||||
|
|
|
@ -10,12 +10,11 @@ use dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElementMethods;
|
|||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFrameSetElementDerived};
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLInputElementCast, CSSStyleDeclarationCast};
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLInputElementCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLElementDerived, HTMLBodyElementDerived};
|
||||
use dom::bindings::js::{JSRef, Temporary, MutNullableJS};
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::cssstyledeclaration::CSSStyleDeclaration;
|
||||
use dom::css2properties::CSS2Properties;
|
||||
use dom::document::Document;
|
||||
use dom::element::{Element, ElementTypeId, ActivationElementHelpers};
|
||||
use dom::eventtarget::{EventTarget, EventTargetHelpers, EventTargetTypeId};
|
||||
|
@ -74,8 +73,7 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
|
|||
fn Style(self) -> Temporary<CSSStyleDeclaration> {
|
||||
self.style_decl.or_init(|| {
|
||||
let global = window_from_node(self).root();
|
||||
let style_props = CSS2Properties::new(*global, self);
|
||||
CSSStyleDeclarationCast::from_temporary(style_props)
|
||||
CSSStyleDeclaration::new(*global, self)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
/* -*- 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://mxr.mozilla.org/mozilla-central/source/dom/webidl/CSS2Properties.webidl.in
|
||||
* http://mxr.mozilla.org/mozilla-central/source/dom/bindings/GenerateCSS2PropertiesWebIDL.py
|
||||
*
|
||||
*/
|
||||
|
||||
interface CSS2Properties : CSSStyleDeclaration {
|
||||
[TreatNullAs=EmptyString] attribute DOMString background;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundPosition;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundRepeat;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundImage;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundAttachment;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString border;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottom;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottomColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottomStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottomWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeft;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeftColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeftStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeftWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRightColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRightStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRightWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTop;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTopColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTopStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTopWidth;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString content;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString color;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString display;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString visibility;
|
||||
|
||||
//[TreatNullAs=EmptyString] attribute DOMString float; //XXXjdm need BinaryName annotation
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString clear;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString direction;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString lineHeight;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString verticalAlign;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString overflow;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString tableLayout;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString whiteSpace;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString writingMode;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString textAlign;
|
||||
[TreatNullAs=EmptyString] attribute DOMString textDecoration;
|
||||
[TreatNullAs=EmptyString] attribute DOMString textOrientation;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString font;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontFamily;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontSize;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontVariant;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontWeight;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString margin;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginBottom;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginLeft;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginRight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginTop;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString padding;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingBottom;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingLeft;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingRight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingTop;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString position;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString top;
|
||||
[TreatNullAs=EmptyString] attribute DOMString right;
|
||||
[TreatNullAs=EmptyString] attribute DOMString left;
|
||||
[TreatNullAs=EmptyString] attribute DOMString bottom;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString height;
|
||||
[TreatNullAs=EmptyString] attribute DOMString minHeight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString maxHeight;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString width;
|
||||
[TreatNullAs=EmptyString] attribute DOMString minWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString maxWidth;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString zIndex;
|
||||
};
|
|
@ -28,3 +28,98 @@ interface CSSStyleDeclaration {
|
|||
attribute DOMString cssFloat;
|
||||
};
|
||||
|
||||
partial interface CSSStyleDeclaration {
|
||||
[TreatNullAs=EmptyString] attribute DOMString background;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundPosition;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundRepeat;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundImage;
|
||||
[TreatNullAs=EmptyString] attribute DOMString backgroundAttachment;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString border;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottom;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottomColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottomStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderBottomWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeft;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeftColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeftStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderLeftWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRightColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRightStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderRightWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTop;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTopColor;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTopStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString borderTopWidth;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString content;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString color;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString display;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString visibility;
|
||||
|
||||
//[TreatNullAs=EmptyString] attribute DOMString float; //XXXjdm need BinaryName annotation
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString clear;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString direction;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString lineHeight;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString verticalAlign;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString overflow;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString tableLayout;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString whiteSpace;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString writingMode;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString textAlign;
|
||||
[TreatNullAs=EmptyString] attribute DOMString textDecoration;
|
||||
[TreatNullAs=EmptyString] attribute DOMString textOrientation;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString font;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontFamily;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontSize;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontStyle;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontVariant;
|
||||
[TreatNullAs=EmptyString] attribute DOMString fontWeight;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString margin;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginBottom;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginLeft;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginRight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString marginTop;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString padding;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingBottom;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingLeft;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingRight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString paddingTop;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString position;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString top;
|
||||
[TreatNullAs=EmptyString] attribute DOMString right;
|
||||
[TreatNullAs=EmptyString] attribute DOMString left;
|
||||
[TreatNullAs=EmptyString] attribute DOMString bottom;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString height;
|
||||
[TreatNullAs=EmptyString] attribute DOMString minHeight;
|
||||
[TreatNullAs=EmptyString] attribute DOMString maxHeight;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString width;
|
||||
[TreatNullAs=EmptyString] attribute DOMString minWidth;
|
||||
[TreatNullAs=EmptyString] attribute DOMString maxWidth;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString zIndex;
|
||||
};
|
||||
|
|
|
@ -88,7 +88,6 @@ pub mod dom {
|
|||
pub mod browsercontext;
|
||||
pub mod canvasrenderingcontext2d;
|
||||
pub mod characterdata;
|
||||
pub mod css2properties;
|
||||
pub mod cssstyledeclaration;
|
||||
pub mod domrect;
|
||||
pub mod domrectlist;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue