aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/cssstyledeclaration.rs90
-rw-r--r--components/script/dom/webidls/CSSStyleDeclaration.webidl18
-rw-r--r--components/script/lib.rs1
-rw-r--r--components/style/properties/mod.rs.mako34
4 files changed, 46 insertions, 97 deletions
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 7ddf5260283..b95df387901 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -342,93 +342,5 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
rval
}
- css_properties!(
- [Color, SetColor, "color"],
- [Background, SetBackground, "background"],
- [BackgroundColor, SetBackgroundColor, "background-color"],
- [BackgroundPosition, SetBackgroundPosition, "background-position"],
- [BackgroundImage, SetBackgroundImage, "background-image"],
- [BackgroundRepeat, SetBackgroundRepeat, "background-repeat"],
- [BackgroundAttachment, SetBackgroundAttachment, "background-attachment"],
- [Border, SetBorder, "border"],
- [BorderColor, SetBorderColor, "border-color"],
- [BorderRadius, SetBorderRadius, "border-radius"],
- [BorderStyle, SetBorderStyle, "border-style"],
- [BorderWidth, SetBorderWidth, "border-width"],
- [BorderBottom, SetBorderBottom, "border-bottom"],
- [BorderBottomColor, SetBorderBottomColor, "border-bottom-color"],
- [BorderBottomStyle, SetBorderBottomStyle, "border-bottom-style"],
- [BorderBottomWidth, SetBorderBottomWidth, "border-bottom-width"],
- [BorderLeft, SetBorderLeft, "border-left"],
- [BorderLeftColor, SetBorderLeftColor, "border-left-color"],
- [BorderLeftStyle, SetBorderLeftStyle, "border-left-style"],
- [BorderLeftWidth, SetBorderLeftWidth, "border-left-width"],
- [BorderRight, SetBorderRight, "border-right"],
- [BorderRightColor, SetBorderRightColor, "border-right-color"],
- [BorderRightStyle, SetBorderRightStyle, "border-right-style"],
- [BorderRightWidth, SetBorderRightWidth, "border-right-width"],
- [BorderTop, SetBorderTop, "border-top"],
- [BorderTopColor, SetBorderTopColor, "border-top-color"],
- [BorderTopStyle, SetBorderTopStyle, "border-top-style"],
- [BorderTopWidth, SetBorderTopWidth, "border-top-width"],
- [Content, SetContent, "content"],
- [Display, SetDisplay, "display"],
- [Opacity, SetOpacity, "opacity"],
- [Width, SetWidth, "width"],
- [MinWidth, SetMinWidth, "min-width"],
- [MaxWidth, SetMaxWidth, "max-width"],
- [Height, SetHeight, "height"],
- [MinHeight, SetMinHeight, "min-height"],
- [MaxHeight, SetMaxHeight, "max-height"],
- [Clear, SetClear, "clear"],
- [Direction, SetDirection, "direction"],
- [LineHeight, SetLineHeight, "line-height"],
- [VerticalAlign, SetVerticalAlign, "vertical-align"],
- [ListStyle, SetListStyle, "list-style"],
- [ListStylePosition, SetListStylePosition, "list-style-position"],
- [ListStyleType, SetListStyleType, "list-style-type"],
- [ListStyleImage, SetListStyleImage, "list-style-image"],
- [Visibility, SetVisibility, "visibility"],
- [Cursor, SetCursor, "cursor"],
- [BoxShadow, SetBoxShadow, "box-shadow"],
- [BoxSizing, SetBoxSizing, "box-sizing"],
- [Overflow, SetOverflow, "overflow"],
- [OverflowWrap, SetOverflowWrap, "overflow-wrap"],
- [TableLayout, SetTableLayout, "table-layout"],
- [EmptyCells, SetEmptyCells, "empty-cells"],
- [CaptionSide, SetCaptionSide, "caption-side"],
- [WhiteSpace, SetWhiteSpace, "white-space"],
- [WritingMode, SetWritingMode, "writing-mode"],
- [LetterSpacing, SetLetterSpacing, "letter-spacing"],
- [WordSpacing, SetWordSpacing, "word-spacing"],
- [WordWrap, SetWordWrap, "word-wrap"],
- [TextAlign, SetTextAlign, "text-align"],
- [TextDecoration, SetTextDecoration, "text-decoration"],
- [TextIndent, SetTextIndent, "text-indent"],
- [TextOrientation, SetTextOrientation, "text-orientation"],
- [TextTransform, SetTextTransform, "text-transform"],
- [Font, SetFont, "font"],
- [FontFamily, SetFontFamily, "font-family"],
- [FontSize, SetFontSize, "font-size"],
- [FontStyle, SetFontStyle, "font-style"],
- [FontVariant, SetFontVariant, "font-variant"],
- [FontWeight, SetFontWeight, "font-weight"],
- [Margin, SetMargin, "margin"],
- [MarginBottom, SetMarginBottom, "margin-bottom"],
- [MarginLeft, SetMarginLeft, "margin-left"],
- [MarginRight, SetMarginRight, "margin-right"],
- [MarginTop, SetMarginTop, "margin-top"],
- [Padding, SetPadding, "padding"],
- [PaddingBottom, SetPaddingBottom, "padding-bottom"],
- [PaddingLeft, SetPaddingLeft, "padding-left"],
- [PaddingRight, SetPaddingRight, "padding-right"],
- [PaddingTop, SetPaddingTop, "padding-top"],
- [Outline, SetOutline, "outline"],
- [Position, SetPosition, "position"],
- [Bottom, SetBottom, "bottom"],
- [Left, SetLeft, "left"],
- [Right, SetRight, "right"],
- [Top, SetTop, "top"],
- [ZIndex, SetZIndex, "z-index"]
- )
+ css_properties_accessors!(css_properties)
}
diff --git a/components/script/dom/webidls/CSSStyleDeclaration.webidl b/components/script/dom/webidls/CSSStyleDeclaration.webidl
index 7f37e44cbbe..afe511b7e1f 100644
--- a/components/script/dom/webidls/CSSStyleDeclaration.webidl
+++ b/components/script/dom/webidls/CSSStyleDeclaration.webidl
@@ -46,6 +46,8 @@ partial interface CSSStyleDeclaration {
[TreatNullAs=EmptyString] attribute DOMString borderWidth;
[TreatNullAs=EmptyString] attribute DOMString borderBottom;
[TreatNullAs=EmptyString] attribute DOMString borderBottomColor;
+ [TreatNullAs=EmptyString] attribute DOMString borderBottomLeftRadius;
+ [TreatNullAs=EmptyString] attribute DOMString borderBottomRightRadius;
[TreatNullAs=EmptyString] attribute DOMString borderBottomStyle;
[TreatNullAs=EmptyString] attribute DOMString borderBottomWidth;
[TreatNullAs=EmptyString] attribute DOMString borderLeft;
@@ -58,6 +60,8 @@ partial interface CSSStyleDeclaration {
[TreatNullAs=EmptyString] attribute DOMString borderRightWidth;
[TreatNullAs=EmptyString] attribute DOMString borderTop;
[TreatNullAs=EmptyString] attribute DOMString borderTopColor;
+ [TreatNullAs=EmptyString] attribute DOMString borderTopLeftRadius;
+ [TreatNullAs=EmptyString] attribute DOMString borderTopRightRadius;
[TreatNullAs=EmptyString] attribute DOMString borderTopStyle;
[TreatNullAs=EmptyString] attribute DOMString borderTopWidth;
@@ -80,10 +84,16 @@ partial interface CSSStyleDeclaration {
[TreatNullAs=EmptyString] attribute DOMString clear;
+ [TreatNullAs=EmptyString] attribute DOMString clip;
+
[TreatNullAs=EmptyString] attribute DOMString direction;
+ [TreatNullAs=EmptyString] attribute DOMString filter;
+
[TreatNullAs=EmptyString] attribute DOMString lineHeight;
+ [TreatNullAs=EmptyString] attribute DOMString mixBlendMode;
+
[TreatNullAs=EmptyString] attribute DOMString verticalAlign;
[TreatNullAs=EmptyString] attribute DOMString listStyle;
@@ -103,6 +113,7 @@ partial interface CSSStyleDeclaration {
[TreatNullAs=EmptyString] attribute DOMString writingMode;
[TreatNullAs=EmptyString] attribute DOMString letterSpacing;
+ [TreatNullAs=EmptyString] attribute DOMString wordBreak;
[TreatNullAs=EmptyString] attribute DOMString wordSpacing;
[TreatNullAs=EmptyString] attribute DOMString wordWrap;
@@ -110,6 +121,7 @@ partial interface CSSStyleDeclaration {
[TreatNullAs=EmptyString] attribute DOMString textDecoration;
[TreatNullAs=EmptyString] attribute DOMString textIndent;
[TreatNullAs=EmptyString] attribute DOMString textOrientation;
+ [TreatNullAs=EmptyString] attribute DOMString textRendering;
[TreatNullAs=EmptyString] attribute DOMString textTransform;
[TreatNullAs=EmptyString] attribute DOMString font;
@@ -132,9 +144,15 @@ partial interface CSSStyleDeclaration {
[TreatNullAs=EmptyString] attribute DOMString paddingTop;
[TreatNullAs=EmptyString] attribute DOMString outline;
+ [TreatNullAs=EmptyString] attribute DOMString outlineColor;
+ [TreatNullAs=EmptyString] attribute DOMString outlineStyle;
+ [TreatNullAs=EmptyString] attribute DOMString outlineWidth;
+ [TreatNullAs=EmptyString] attribute DOMString outlineOffset;
[TreatNullAs=EmptyString] attribute DOMString position;
+ [TreatNullAs=EmptyString] attribute DOMString pointerEvents;
+
[TreatNullAs=EmptyString] attribute DOMString top;
[TreatNullAs=EmptyString] attribute DOMString right;
[TreatNullAs=EmptyString] attribute DOMString left;
diff --git a/components/script/lib.rs b/components/script/lib.rs
index 7593a3b68a3..a3c528df29c 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -35,6 +35,7 @@ extern crate script_traits;
extern crate "plugins" as servo_plugins;
extern crate "net" as servo_net;
extern crate "util" as servo_util;
+#[phase(plugin, link)]
extern crate style;
extern crate "msg" as servo_msg;
extern crate url;
diff --git a/components/style/properties/mod.rs.mako b/components/style/properties/mod.rs.mako
index 29f4c17b8a8..5f800fd07e3 100644
--- a/components/style/properties/mod.rs.mako
+++ b/components/style/properties/mod.rs.mako
@@ -39,14 +39,14 @@ def to_rust_ident(name):
name += "_"
return name
+def to_camel_case(ident):
+ return re.sub("_([a-z])", lambda m: m.group(1).upper(), ident.strip("_").capitalize())
+
class Longhand(object):
def __init__(self, name, derived_from=None, experimental=False):
self.name = name
self.ident = to_rust_ident(name)
- self.camel_case, _ = re.subn(
- "_([a-z])",
- lambda m: m.group(1).upper(),
- self.ident.strip("_").capitalize())
+ self.camel_case = to_camel_case(self.ident)
self.style_struct = THIS_STYLE_STRUCT
self.experimental = experimental
if derived_from is None:
@@ -58,6 +58,8 @@ class Shorthand(object):
def __init__(self, name, sub_properties):
self.name = name
self.ident = to_rust_ident(name)
+ self.camel_case = to_camel_case(self.ident)
+ self.derived_from = None
self.sub_properties = [LONGHANDS_BY_NAME[s] for s in sub_properties]
class StyleStruct(object):
@@ -3358,16 +3360,32 @@ pub fn make_inline(style: &ComputedValues) -> ComputedValues {
pub fn is_supported_property(property: &str) -> bool {
match property {
- % for property in SHORTHANDS:
- "${property.name}" => true,
- % endfor
- % for property in LONGHANDS:
+ % for property in SHORTHANDS + LONGHANDS:
"${property.name}" => true,
% endfor
_ => false,
}
}
+#[macro_export]
+macro_rules! css_properties_accessors(
+ ($macro: ident) => (
+ $macro!(
+ % for property in SHORTHANDS + LONGHANDS:
+ ## Servo internal CSS properties are not accessible.
+ ## FIXME: Add BinaryName WebIDL annotation (#4435).
+ % if property.derived_from is None and property.name != "float":
+ % if property != LONGHANDS[-1]:
+ [${property.camel_case}, Set${property.camel_case}, "${property.name}"],
+ % else:
+ [${property.camel_case}, Set${property.camel_case}, "${property.name}"]
+ % endif
+ % endif
+ % endfor
+ )
+ )
+)
+
pub fn longhands_from_shorthand(shorthand: &str) -> Option<Vec<String>> {
match shorthand {
% for property in SHORTHANDS: