Bug 1367283 - Part 5: Implements svg related properties. r?hiro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Mon, 29 May 2017 22:37:17 +0900
changeset 585970 0132bfa5382cd4fc0ee63b9b5ff86aa3fd6080ee
parent 585969 63a9ab24a9573fb6d8548ae3661759b65cb7a232
child 585971 59093730349c881dbc0ae26be753a0e19d0e634d
push id61246
push userbmo:dakatsuka@mozilla.com
push dateMon, 29 May 2017 13:44:07 +0000
reviewershiro
bugs1367283
milestone55.0a1
Bug 1367283 - Part 5: Implements svg related properties. r?hiro In this patch, implements following svg related properties that type is single keyword. * mask-clip * mask-composite * mask-origin * mask-mode We change only the animation type of mask-clip and mask-origin. Because we already made the clone_mask_clip and clone_mask_origin methods in patch 2 along with clone_background_clip and clone_background_origin. MozReview-Commit-ID: 5pV5IpPOPIj
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhand/svg.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -4044,37 +4044,18 @@ mask-mode mask-repeat mask-clip mask-ori
 clip-path
 """
 %>
 <%self:impl_trait style_struct_name="SVG"
                   skip_longhands="${skip_svg_longhands}"
                   skip_additionals="*">
 
     <% impl_common_image_layer_properties("mask") %>
-
-    <%self:simple_image_array_property name="mode" shorthand="mask" field_name="mMaskMode">
-        use properties::longhands::mask_mode::single_value::computed_value::T;
-
-        match servo {
-          T::alpha => structs::NS_STYLE_MASK_MODE_ALPHA as u8,
-          T::luminance => structs::NS_STYLE_MASK_MODE_LUMINANCE as u8,
-          T::match_source => structs::NS_STYLE_MASK_MODE_MATCH_SOURCE as u8,
-        }
-    </%self:simple_image_array_property>
-    <%self:simple_image_array_property name="composite" shorthand="mask" field_name="mComposite">
-        use properties::longhands::mask_composite::single_value::computed_value::T;
-
-        match servo {
-            T::add => structs::NS_STYLE_MASK_COMPOSITE_ADD as u8,
-            T::subtract => structs::NS_STYLE_MASK_COMPOSITE_SUBTRACT as u8,
-            T::intersect => structs::NS_STYLE_MASK_COMPOSITE_INTERSECT as u8,
-            T::exclude => structs::NS_STYLE_MASK_COMPOSITE_EXCLUDE as u8,
-        }
-    </%self:simple_image_array_property>
-
+    <% impl_simple_image_array_property("mode", "mask", "mMask", "mMaskMode", "SVG") %>
+    <% impl_simple_image_array_property("composite", "mask", "mMask", "mComposite", "SVG") %>
     <% impl_shape_source("clip_path", "mClipPath") %>
 </%self:impl_trait>
 
 <%self:impl_trait style_struct_name="InheritedSVG"
                   skip_longhands="paint-order stroke-dasharray stroke-dashoffset stroke-width -moz-context-properties"
                   skip_additionals="*">
     pub fn set_paint_order(&mut self, v: longhands::paint_order::computed_value::T) {
         use self::longhands::paint_order;
--- a/servo/components/style/properties/longhand/svg.mako.rs
+++ b/servo/components/style/properties/longhand/svg.mako.rs
@@ -62,17 +62,17 @@
                           products="gecko", boxed="True",
                           animation_value_type="none", flags="CREATES_STACKING_CONTEXT",
                           spec="https://drafts.fxtf.org/css-masking/#propdef-clip-path")}
 
 ${helpers.single_keyword("mask-mode",
                          "match-source alpha luminance",
                          vector=True,
                          products="gecko",
-                         animation_value_type="none",
+                         animation_value_type="discrete",
                          spec="https://drafts.fxtf.org/css-masking/#propdef-mask-mode")}
 
 <%helpers:vector_longhand name="mask-repeat" products="gecko" animation_value_type="none" extra_prefixes="webkit"
                           spec="https://drafts.fxtf.org/css-masking/#propdef-mask-repeat">
     pub use properties::longhands::background_repeat::single_value::parse;
     pub use properties::longhands::background_repeat::single_value::SpecifiedValue;
     pub use properties::longhands::background_repeat::single_value::computed_value;
     pub use properties::longhands::background_repeat::single_value::RepeatKeyword;
@@ -99,27 +99,27 @@
 
 ${helpers.single_keyword("mask-clip",
                          "border-box content-box padding-box",
                          extra_gecko_values="fill-box stroke-box view-box no-clip",
                          vector=True,
                          products="gecko",
                          extra_prefixes="webkit",
                          gecko_enum_prefix="StyleGeometryBox",
-                         animation_value_type="none",
+                         animation_value_type="discrete",
                          spec="https://drafts.fxtf.org/css-masking/#propdef-mask-clip")}
 
 ${helpers.single_keyword("mask-origin",
                          "border-box content-box padding-box",
                          extra_gecko_values="fill-box stroke-box view-box",
                          vector=True,
                          products="gecko",
                          extra_prefixes="webkit",
                          gecko_enum_prefix="StyleGeometryBox",
-                         animation_value_type="none",
+                         animation_value_type="discrete",
                          spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin")}
 
 <%helpers:longhand name="mask-size" products="gecko" animation_value_type="ComputedValue" extra_prefixes="webkit"
                    spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size">
     use properties::longhands::background_size;
     pub use ::properties::longhands::background_size::SpecifiedValue;
     pub use ::properties::longhands::background_size::single_value as single_value;
     pub use ::properties::longhands::background_size::computed_value as computed_value;
@@ -134,17 +134,17 @@
     }
 </%helpers:longhand>
 
 ${helpers.single_keyword("mask-composite",
                          "add subtract intersect exclude",
                          vector=True,
                          products="gecko",
                          extra_prefixes="webkit",
-                         animation_value_type="none",
+                         animation_value_type="discrete",
                          spec="https://drafts.fxtf.org/css-masking/#propdef-mask-composite")}
 
 ${helpers.predefined_type("mask-image", "ImageLayer",
     initial_value="Either::First(None_)",
     initial_specified_value="Either::First(None_)",
     spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image",
     vector=True,
     products="gecko",