Bug 1371115 - Part 11: implements URLValue type properties animatable. r?hiro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Wed, 28 Jun 2017 10:23:39 +0900
changeset 601119 0445174893ba9080f71cb5fdfcca056cc4b4558f
parent 601118 6f5b481e47035cd9865669c39d38f23337e82004
child 601120 31909f7a6ae54858443e9ba29c436b192d11b27d
push id65962
push userbmo:dakatsuka@mozilla.com
push dateWed, 28 Jun 2017 01:27:06 +0000
reviewershiro
bugs1371115
milestone56.0a1
Bug 1371115 - Part 11: implements URLValue type properties animatable. r?hiro In this patch, implements following properties: * marker-start * marker-mid * marker-end MozReview-Commit-ID: IFBYhsZ39RR
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhand/inherited_svg.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -660,17 +660,31 @@ def set_gecko_property(ffi_name, expr):
     }
     #[allow(non_snake_case)]
     pub fn copy_${ident}_from(&mut self, other: &Self) {
         unsafe {
             self.gecko.${gecko_ffi_name}.set(&other.gecko.${gecko_ffi_name});
         }
     }
     % if need_clone:
-        <% raise Exception("Do not know how to handle clone ") %>
+        pub fn clone_${ident}(&self) -> longhands::${ident}::computed_value::T {
+            use values::specified::url::SpecifiedUrl;
+            use values::None_;
+
+            match self.gecko.${gecko_ffi_name}.mRawPtr.is_null() {
+                true => Either::Second(None_),
+                false => {
+                    unsafe {
+                        let ref gecko_url_value = *self.gecko.${gecko_ffi_name}.mRawPtr;
+                        Either::First(SpecifiedUrl::from_url_value_data(&gecko_url_value._base)
+                                      .expect("${gecko_ffi_name} has valid URL value"))
+                    }
+                },
+            }
+        }
     % endif
 </%def>
 
 <%def name="impl_logical(name, need_clone=False, **kwargs)">
     ${helpers.logical_setter(name, need_clone)}
 </%def>
 
 <%def name="impl_style_struct(style_struct)">
--- a/servo/components/style/properties/longhand/inherited_svg.mako.rs
+++ b/servo/components/style/properties/longhand/inherited_svg.mako.rs
@@ -114,29 +114,29 @@
                          gecko_enum_prefix="StyleFillRule",
                          gecko_inexhaustive=True,
                          animation_value_type="discrete",
                          spec="https://www.w3.org/TR/SVG11/masking.html#ClipRuleProperty")}
 
 ${helpers.predefined_type("marker-start", "UrlOrNone", "Either::Second(None_)",
                           products="gecko",
                           boxed="True" if product == "gecko" else "False",
-                          animation_value_type="none",
+                          animation_value_type="discrete",
                           spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
 
 ${helpers.predefined_type("marker-mid", "UrlOrNone", "Either::Second(None_)",
                           products="gecko",
                           boxed="True" if product == "gecko" else "False",
-                          animation_value_type="none",
+                          animation_value_type="discrete",
                           spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
 
 ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
                           products="gecko",
                           boxed="True" if product == "gecko" else "False",
-                          animation_value_type="none",
+                          animation_value_type="discrete",
                           spec="https://www.w3.org/TR/SVG2/painting.html#VertexMarkerProperties")}
 
 <%helpers:longhand name="paint-order"
                    animation_value_type="none"
                    products="gecko"
                    spec="https://www.w3.org/TR/SVG2/painting.html#PaintOrder">
 
     use values::computed::ComputedValueAsSpecified;