servo: Merge #15896 - Change the predefined type of flex-basis and make gecko glue auto-generate (from canaltinova:flex-basis); r=Manishearth
authorNazım Can Altınova <canaltinova@gmail.com>
Thu, 09 Mar 2017 18:46:37 -0800
changeset 346890 25204dacc9c2f8bbb5f01338cb2beb43127bef3f
parent 346889 96e3bc2098c8ff6206924883e12b8429e4962921
child 346891 f1784b3cb04ec7ffa9baf26268eed22652e2a838
push id31480
push usercbook@mozilla.com
push dateFri, 10 Mar 2017 10:37:06 +0000
treeherdermozilla-central@e18d3dd20e8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersManishearth
bugs1331529
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #15896 - Change the predefined type of flex-basis and make gecko glue auto-generate (from canaltinova:flex-basis); r=Manishearth Gecko [doesn't support](https://bugzilla.mozilla.org/show_bug.cgi?id=1105111) content value in flex-basis yet. We had to change the predefined type to `LengthOrPercentageOrAuto` in stylo build. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [Bug 1331529](https://bugzilla.mozilla.org/show_bug.cgi?id=1331529) <!-- Either: --> - [X] These changes do not require tests because it's stylo glue change. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 8b8eb5e192295fb903db5855a8f7be85581461b7
servo/components/style/properties/gecko.mako.rs
servo/components/style/properties/longhand/position.mako.rs
servo/components/style/properties/shorthand/position.mako.rs
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -607,22 +607,16 @@ impl Debug for ${style_struct.gecko_stru
     # Make a list of types we can't auto-generate.
     #
     force_stub = [];
     # These live in an nsFont member in Gecko. Should be straightforward to do manually.
     force_stub += ["font-variant"]
     # These have unusual representations in gecko.
     force_stub += ["list-style-type"]
 
-    # These are part of shorthands so we must include them in stylo builds,
-    # but we haven't implemented the stylo glue for the longhand
-    # so we generate a stub
-    force_stub += ["flex-basis", # position
-                   ]
-
     # Types used with predefined_type()-defined properties that we can auto-generate.
     predefined_types = {
         "length::LengthOrAuto": impl_style_coord,
         "length::LengthOrNormal": impl_style_coord,
         "Length": impl_absolute_length,
         "Position": impl_position,
         "LengthOrPercentage": impl_style_coord,
         "LengthOrPercentageOrAuto": impl_style_coord,
--- a/servo/components/style/properties/longhand/position.mako.rs
+++ b/servo/components/style/properties/longhand/position.mako.rs
@@ -190,23 +190,26 @@
         0
     }
 
     fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
         specified::parse_integer(input)
     }
 </%helpers:longhand>
 
+// FIXME: Gecko doesn't support content value yet.
 // FIXME: This property should be animatable.
 ${helpers.predefined_type("flex-basis",
+                          "LengthOrPercentageOrAuto" if product == "gecko" else
                           "LengthOrPercentageOrAutoOrContent",
+                          "computed::LengthOrPercentageOrAuto::Auto" if product == "gecko" else
                           "computed::LengthOrPercentageOrAutoOrContent::Auto",
                           spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
                           extra_prefixes="webkit",
-                          animatable=False)}
+                          animatable=True if product == "gecko" else False)}
 
 % for (size, logical) in ALL_SIZES:
     <%
       spec = "https://drafts.csswg.org/css-box/#propdef-%s"
       if logical:
         spec = "https://drafts.csswg.org/css-logical-props/#propdef-%s"
     %>
     // width, height, block-size, inline-size
--- a/servo/components/style/properties/shorthand/position.mako.rs
+++ b/servo/components/style/properties/shorthand/position.mako.rs
@@ -44,17 +44,22 @@
             self.flex_wrap.to_css(dest)
         }
     }
 </%helpers:shorthand>
 
 <%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis" extra_prefixes="webkit"
                     spec="https://drafts.csswg.org/css-flexbox/#flex-property">
     use parser::Parse;
-    use values::specified::{Number, NoCalcLength, LengthOrPercentageOrAutoOrContent};
+    use values::specified::{Number, NoCalcLength};
+    % if product == "gecko":
+        use values::specified::LengthOrPercentageOrAuto;
+    % else:
+        use values::specified::LengthOrPercentageOrAutoOrContent;
+    % endif
 
     pub fn parse_flexibility(input: &mut Parser)
                              -> Result<(Number, Option<Number>),()> {
         let grow = try!(Number::parse_non_negative(input));
         let shrink = input.try(Number::parse_non_negative).ok();
         Ok((grow, shrink))
     }
 
@@ -62,43 +67,56 @@
         let mut grow = None;
         let mut shrink = None;
         let mut basis = None;
 
         if input.try(|input| input.expect_ident_matching("none")).is_ok() {
             return Ok(Longhands {
                 flex_grow: Number(0.0),
                 flex_shrink: Number(0.0),
-                flex_basis: LengthOrPercentageOrAutoOrContent::Auto
+                % if product == "gecko":
+                    flex_basis: LengthOrPercentageOrAuto::Auto
+                % else:
+                    flex_basis: LengthOrPercentageOrAutoOrContent::Auto
+                % endif
+
             })
         }
         loop {
             if grow.is_none() {
                 if let Ok((flex_grow, flex_shrink)) = input.try(parse_flexibility) {
                     grow = Some(flex_grow);
                     shrink = flex_shrink;
                     continue
                 }
             }
             if basis.is_none() {
-                if let Ok(value) = input.try(|i| LengthOrPercentageOrAutoOrContent::parse(context, i)) {
+                % if product == "gecko":
+                    if let Ok(value) = input.try(|i| LengthOrPercentageOrAuto::parse(context, i)) {
+                % else:
+                    if let Ok(value) = input.try(|i| LengthOrPercentageOrAutoOrContent::parse(context, i)) {
+                % endif
                     basis = Some(value);
                     continue
                 }
             }
             break
         }
 
         if grow.is_none() && basis.is_none() {
             return Err(())
         }
         Ok(Longhands {
             flex_grow: grow.unwrap_or(Number(1.0)),
             flex_shrink: shrink.unwrap_or(Number(1.0)),
-            flex_basis: basis.unwrap_or(LengthOrPercentageOrAutoOrContent::Length(NoCalcLength::zero()))
+            % if product == "gecko":
+                flex_basis: basis.unwrap_or(LengthOrPercentageOrAuto::Length(NoCalcLength::zero()))
+            % else:
+                flex_basis: basis.unwrap_or(LengthOrPercentageOrAutoOrContent::Length(NoCalcLength::zero()))
+            % endif
         })
     }
 
     impl<'a> ToCss for LonghandsToSerialize<'a>  {
         fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
             try!(self.flex_grow.to_css(dest));
             try!(write!(dest, " "));