Bug 1338388 - Part 11: stylo: Support `marker` shorthand; r?heycam draft
authorManish Goregaokar <manishearth@gmail.com>
Fri, 17 Feb 2017 15:36:38 -0800
changeset 486523 3921c3f483609ffdbe9f13a427fd5cb290b877de
parent 486501 f9d568fb81cd33c438301a118e68c271a4ad6a49
child 486524 fb1ec0a7153c5b918000ea81e33432ac4441039e
push id46011
push userbmo:manishearth@gmail.com
push dateSat, 18 Feb 2017 05:38:06 +0000
reviewersheycam
bugs1338388
milestone54.0a1
Bug 1338388 - Part 11: stylo: Support `marker` shorthand; r?heycam MozReview-Commit-ID: 7B6h4IDZD67
media/webrtc/signaling/fuzztest/moz.build
servo/components/style/properties/shorthand/inherited_svg.mako.rs
--- a/media/webrtc/signaling/fuzztest/moz.build
+++ b/media/webrtc/signaling/fuzztest/moz.build
@@ -16,16 +16,17 @@ if CONFIG['OS_TARGET'] == 'Linux' or CON
     LOCAL_INCLUDES += [
         '../..',
         '/media/mtransport',
         '/media/webrtc/signaling/src/common/browser_logging',
     ]
 
     USE_LIBS += [
         '/media/webrtc/trunk/testing/gtest_gtest/gtest',
+        'mozglue',
         'nspr',
     ]
 
     SOURCES = [
       '/media/webrtc/signaling/src/sdp/SdpAttribute.cpp',
       '/media/webrtc/signaling/src/sdp/SdpHelper.cpp',
       '/media/webrtc/signaling/src/sdp/SdpMediaSection.cpp',
       '/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c',
new file mode 100644
--- /dev/null
+++ b/servo/components/style/properties/shorthand/inherited_svg.mako.rs
@@ -0,0 +1,36 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+<%namespace name="helpers" file="/helpers.mako.rs" />
+
+<%helpers:shorthand name="marker" products="gecko"
+    sub_properties="marker-start marker-end marker-mid"
+    spec="https://www.w3.org/TR/SVG2/painting.html#MarkerShorthand">
+    use values::specified::UrlOrNone;
+
+    pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
+        let url = UrlOrNone::parse(context, input)?;
+
+        Ok(Longhands {
+            marker_start: url.clone(),
+            marker_mid: url.clone(),
+            marker_end: url,
+        })
+    }
+
+    impl<'a> LonghandsToSerialize<'a>  {
+        fn to_css_declared<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
+            if let DeclaredValue::Value(ref start) = *self.marker_start {
+                if let DeclaredValue::Value(ref mid) = *self.marker_mid {
+                    if let DeclaredValue::Value(ref end) = *self.marker_end {
+                        if start == mid && mid == end {
+                            start.to_css(dest)?;
+                        }
+                    }
+                }
+            }
+            Ok(())
+        }
+    }
+</%helpers:shorthand>