style: Support the all shorthand. draft
authorCameron McCormack <cam@mcc.id.au>
Thu, 13 Apr 2017 13:23:04 +0800
changeset 561760 0f52829f285b4da580713a6af0db57b6a32c5e7e
parent 561759 b05d6f8cf2d886eceeca0abc5e7ef4b1290b0cb3
child 561761 a1e09158f862bc4e04cd9733222d97662dc551dd
push id53854
push userbmo:cam@mcc.id.au
push dateThu, 13 Apr 2017 06:34:16 +0000
milestone55.0a1
style: Support the all shorthand. MozReview-Commit-ID: Bp8N7XtRXZ2
servo/components/style/properties/properties.mako.rs
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -160,16 +160,36 @@ pub mod shorthands {
     <%include file="/shorthand/list.mako.rs" />
     <%include file="/shorthand/margin.mako.rs" />
     <%include file="/shorthand/mask.mako.rs" />
     <%include file="/shorthand/outline.mako.rs" />
     <%include file="/shorthand/padding.mako.rs" />
     <%include file="/shorthand/position.mako.rs" />
     <%include file="/shorthand/inherited_svg.mako.rs" />
     <%include file="/shorthand/text.mako.rs" />
+
+    <% components_of_all_shorthand = [p.name for p in data.longhands if p.name not in ['direction', 'unicode-bidi']] %>
+    <%helpers:shorthand name="all"
+                        sub_properties="${' '.join(components_of_all_shorthand)}"
+                        spec="https://drafts.csswg.org/css-cascade-3/#all-shorthand">
+
+        pub fn parse_value(_context: &ParserContext, _input: &mut Parser) -> Result<Longhands, ()> {
+            // cascade_property handles parsing the CSS-wide keywords, so we
+            // don't need to handle any other values here.
+            Err(())
+        }
+
+        impl<'a> ToCss for LonghandsToSerialize<'a> {
+            fn to_css<W>(&self, _dest: &mut W) -> fmt::Result where W: fmt::Write {
+                // get_shorthand_appendable_value handles this for us.
+                debug_assert!(false, "we shouldn't need to be called");
+                Ok(())
+            }
+        }
+    </%helpers:shorthand>
 }
 
 /// A module with all the code related to animated properties.
 ///
 /// This needs to be "included" by mako at least after all longhand modules,
 /// given they populate the global data.
 pub mod animated_properties {
     <%include file="/helpers/animated_properties.mako.rs" />