aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/properties/data.py3
-rw-r--r--components/style/properties/gecko.mako.rs49
-rw-r--r--components/style/properties/longhand/outline.mako.rs2
-rw-r--r--components/style/properties/longhand/text.mako.rs1
4 files changed, 28 insertions, 27 deletions
diff --git a/components/style/properties/data.py b/components/style/properties/data.py
index 2c9990ed7bc..2b11109bbc4 100644
--- a/components/style/properties/data.py
+++ b/components/style/properties/data.py
@@ -63,7 +63,7 @@ class Longhand(object):
def __init__(self, style_struct, name, animatable=None, derived_from=None, keyword=None,
predefined_type=None, custom_cascade=False, experimental=False, internal=False,
need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False,
- allowed_in_keyframe_block=True):
+ allowed_in_keyframe_block=True, complex_color=False):
self.name = name
self.keyword = keyword
self.predefined_type = predefined_type
@@ -77,6 +77,7 @@ class Longhand(object):
self.gecko_ffi_name = gecko_ffi_name or "m" + self.camel_case
self.depend_on_viewport_size = depend_on_viewport_size
self.derived_from = (derived_from or "").split()
+ self.complex_color = complex_color
# https://drafts.csswg.org/css-animations/#keyframes
# > The <declaration-list> inside of <keyframe-block> accepts any CSS property
diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs
index cf90c6e7f52..9283a14a71d 100644
--- a/components/style/properties/gecko.mako.rs
+++ b/components/style/properties/gecko.mako.rs
@@ -481,16 +481,29 @@ impl Debug for ${style_struct.gecko_struct_name} {
# Types used with predefined_type()-defined properties that we can auto-generate.
predefined_types = {
- "LengthOrPercentage": impl_style_coord,
- "LengthOrPercentageOrAuto": impl_style_coord,
- "LengthOrPercentageOrNone": impl_style_coord,
- "Number": impl_simple,
- "Opacity": impl_simple,
+ "Length": impl_style_coord,
+ "LengthOrPercentage": impl_style_coord,
+ "LengthOrPercentageOrAuto": impl_style_coord,
+ "LengthOrPercentageOrNone": impl_style_coord,
+ "Number": impl_simple,
+ "Opacity": impl_simple,
+ "CSSColor": impl_color,
}
- keyword_longhands = [x for x in longhands if x.keyword and not x.name in force_stub]
+ def predefined_type_method(longhand):
+ args = dict(ident=longhand.ident, gecko_ffi_name=longhand.gecko_ffi_name,
+ need_clone=longhand.need_clone)
+ method = predefined_types[longhand.predefined_type]
+
+ # additional type-specific arguments
+ if longhand.predefined_type in ["CSSColor"]:
+ args.update(complex_color=longhand.complex_color)
+
+ method(**args)
+
+ keyword_longhands = [x for x in longhands if x.keyword and x.name not in force_stub]
predefined_longhands = [x for x in longhands
- if x.predefined_type in predefined_types and not x.name in force_stub]
+ if x.predefined_type in predefined_types and x.name not in force_stub]
stub_longhands = [x for x in longhands if x not in keyword_longhands + predefined_longhands]
# If one of the longhands is not handled
@@ -523,8 +536,7 @@ impl ${style_struct.gecko_struct_name} {
for longhand in keyword_longhands:
impl_keyword(longhand.ident, longhand.gecko_ffi_name, longhand.keyword, longhand.need_clone)
for longhand in predefined_longhands:
- impl_fn = predefined_types[longhand.predefined_type]
- impl_fn(longhand.ident, longhand.gecko_ffi_name, need_clone=longhand.need_clone)
+ predefined_type_method(longhand)
%>
/*
@@ -721,7 +733,7 @@ fn static_assert() {
</%self:impl_trait>
-<% skip_outline_longhands = " ".join("outline-color outline-style outline-width".split() +
+<% skip_outline_longhands = " ".join("outline-style outline-width".split() +
["-moz-outline-radius-{0}".format(x.ident.replace("_", ""))
for x in CORNERS]) %>
<%self:impl_trait style_struct_name="Outline"
@@ -730,8 +742,6 @@ fn static_assert() {
<% impl_keyword("outline_style", "mOutlineStyle", border_style_keyword, need_clone=True) %>
- <% impl_color("outline_color", "mOutlineColor", need_clone=True) %>
-
<% impl_app_units("outline_width", "mActualOutlineWidth", need_clone=True,
round_to_pixels=True) %>
@@ -1440,7 +1450,7 @@ fn static_assert() {
// TODO: Gecko accepts lists in most background-related properties. We just use
// the first element (which is the common case), but at some point we want to
// add support for parsing these lists in servo and pushing to nsTArray's.
-<% skip_background_longhands = """background-color background-repeat
+<% skip_background_longhands = """background-repeat
background-image background-clip
background-origin background-attachment
background-size background-position""" %>
@@ -1448,8 +1458,6 @@ fn static_assert() {
skip_longhands="${skip_background_longhands}"
skip_additionals="*">
- <% impl_color("background_color", "mBackgroundColor", need_clone=True, complex_color=False) %>
-
<% impl_common_image_layer_properties("background") %>
<%self:simple_image_array_property name="attachment" shorthand="background" field_name="mAttachment">
@@ -1739,11 +1747,9 @@ fn static_assert() {
</%self:impl_trait>
<%self:impl_trait style_struct_name="Text"
- skip_longhands="text-decoration-color text-decoration-line text-overflow"
+ skip_longhands="text-decoration-line text-overflow"
skip_additionals="*">
- ${impl_color("text_decoration_color", "mTextDecorationColor", need_clone=True)}
-
pub fn set_text_decoration_line(&mut self, v: longhands::text_decoration_line::computed_value::T) {
let mut bits: u8 = 0;
if v.underline {
@@ -1833,7 +1839,6 @@ fn static_assert() {
</%self:impl_trait>
<% skip_svg_longhands = """
-flood-color lighting-color stop-color
mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position mask-size mask-image
clip-path
"""
@@ -1842,12 +1847,6 @@ clip-path
skip_longhands="${skip_svg_longhands}"
skip_additionals="*">
- <% impl_color("flood_color", "mFloodColor", complex_color=False) %>
-
- <% impl_color("lighting_color", "mLightingColor", complex_color=False) %>
-
- <% impl_color("stop_color", "mStopColor", complex_color=False) %>
-
<% impl_common_image_layer_properties("mask") %>
<%self:simple_image_array_property name="mode" shorthand="mask" field_name="mMaskMode">
diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs
index ada1ffc7bfa..2d55e1592c5 100644
--- a/components/style/properties/longhand/outline.mako.rs
+++ b/components/style/properties/longhand/outline.mako.rs
@@ -11,7 +11,7 @@
// TODO(pcwalton): `invert`
${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::CurrentColor",
- animatable=True)}
+ animatable=True, complex_color=True, need_clone=True)}
<%helpers:longhand name="outline-style" need_clone="True" animatable="False">
pub use values::specified::BorderStyle as SpecifiedValue;
diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs
index 94e1981b03c..b983877cb30 100644
--- a/components/style/properties/longhand/text.mako.rs
+++ b/components/style/properties/longhand/text.mako.rs
@@ -209,5 +209,6 @@ ${helpers.single_keyword("text-decoration-style",
${helpers.predefined_type(
"text-decoration-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0 })",
+ complex_color=True,
products="gecko",
animatable=True)}