From 3266b5b31f8fd3caffa0e0688c3c39966ad4347e Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 6 Feb 2017 17:45:09 -0800 Subject: [PATCH] stylo: Implement outline-offset MozReview-Commit-ID: 6mr4ktfeEGT --- components/style/properties/gecko.mako.rs | 16 +++++++++++++++- .../style/properties/longhand/outline.mako.rs | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 1148a25bbcc..cd8440f089a 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -328,6 +328,20 @@ def set_gecko_property(ffi_name, expr): % endif +<%def name="impl_absolute_length(ident, gecko_ffi_name, need_clone=False)"> + #[allow(non_snake_case)] + pub fn set_${ident}(&mut self, v: longhands::${ident}::computed_value::T) { + ${set_gecko_property(gecko_ffi_name, "v.0")} + } + <%call expr="impl_simple_copy(ident, gecko_ffi_name)"> + % if need_clone: + #[allow(non_snake_case)] + pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T { + Au(self.gecko.${gecko_ffi_name}) + } + % endif + + <%def name="impl_color(ident, gecko_ffi_name, need_clone=False, complex_color=True)"> <%call expr="impl_color_setter(ident, gecko_ffi_name, complex_color)"> <%call expr="impl_color_copy(ident, gecko_ffi_name, complex_color)"> @@ -501,7 +515,7 @@ impl Debug for ${style_struct.gecko_struct_name} { # Types used with predefined_type()-defined properties that we can auto-generate. predefined_types = { "length::LengthOrAuto": impl_style_coord, - "Length": impl_style_coord, + "Length": impl_absolute_length, "LengthOrPercentage": impl_style_coord, "LengthOrPercentageOrAuto": impl_style_coord, "LengthOrPercentageOrNone": impl_style_coord, diff --git a/components/style/properties/longhand/outline.mako.rs b/components/style/properties/longhand/outline.mako.rs index b47f45d7a68..cd242797f0d 100644 --- a/components/style/properties/longhand/outline.mako.rs +++ b/components/style/properties/longhand/outline.mako.rs @@ -114,5 +114,5 @@ ${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::Curr spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)")} % endfor -${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo", animatable=True, +${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo gecko", animatable=True, spec="https://drafts.csswg.org/css-ui/#propdef-outline-offset")}