Bug 1363292 - Have unprefixed linear-gradient accept zero as angle value. r=dholbert
authorXidorn Quan <me@upsuper.org>
Mon, 29 May 2017 14:28:19 +1000
changeset 361454 73abfac22f012c8f6fcfe7c732b203660f0e7ca9
parent 361453 b19afe698a9e1580908f386d267c4e3d1a26c8b4
child 361455 190658a95c3cc6ae48ec3308d893049bb18615df
push id31930
push usercbook@mozilla.com
push dateWed, 31 May 2017 09:24:33 +0000
treeherdermozilla-central@23243677c7dd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1363292
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
Bug 1363292 - Have unprefixed linear-gradient accept zero as angle value. r=dholbert MozReview-Commit-ID: GRHi9GbkrnG
layout/style/nsCSSParser.cpp
layout/style/test/property_database.js
layout/style/test/stylo-failures.md
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -10244,17 +10244,18 @@ CSSParserImpl::ParseLinearGradient(nsCSS
 
   if (!(aFlags & eGradient_AnyLegacy)) {
     // We're parsing an unprefixed linear-gradient, and we tried & failed to
     // parse a 'to' token above. Put the token back & try to re-parse our
     // expression as <angle>? <color-stop-list>
     UngetToken();
 
     // <angle> ,
-    if (ParseSingleTokenVariant(cssGradient->mAngle, VARIANT_ANGLE, nullptr) &&
+    if (ParseSingleTokenVariant(cssGradient->mAngle,
+                                VARIANT_ANGLE_OR_ZERO, nullptr) &&
         !ExpectSymbol(',', true)) {
       SkipUntil(')');
       return false;
     }
 
     return ParseGradientColorStops(cssGradient, aValue);
   }
 
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -127,16 +127,19 @@ var validGradientAndElementValues = [
   "linear-gradient(.414rad, red 50%, 50%, blue 50%)",
   "linear-gradient(.414rad, red 50%, 20%, blue 50%)",
   "linear-gradient(.414rad, red 50%, 30%, blue 10%)",
   "linear-gradient(to right bottom, red, 20%, green 50%, 65%, blue)",
   "linear-gradient(to right bottom, red, 20%, green 10%, blue)",
   "linear-gradient(to right bottom, red, 50%, green 50%, 50%, blue)",
   "linear-gradient(to right bottom, red, 0%, green 50%, 100%, blue)",
 
+  /* Unitless 0 is valid as an <angle> */
+  "linear-gradient(0, red, blue)",
+
   "radial-gradient(red, blue)",
   "radial-gradient(red, yellow, blue)",
   "radial-gradient(red 1px, yellow 20%, blue 24em, green)",
   "radial-gradient(red, yellow, green, blue 50%)",
   "radial-gradient(red -50%, yellow -25%, green, blue)",
   "radial-gradient(red -99px, yellow, green, blue 120%)",
   "radial-gradient(#ffff00, #ef3, rgba(10, 20, 30, 0.4))",
 
@@ -233,18 +236,16 @@ var invalidGradientAndElementValues = [
   "-moz-element(#a+a)",
   "-moz-element(#a())",
   /* no quirks mode colors */
   "linear-gradient(red, ff00ff)",
   /* no quirks mode colors */
   "radial-gradient(at 10% bottom, ffffff, black) scroll no-repeat",
   /* no quirks mode lengths */
   "linear-gradient(red -99, yellow, green, blue 120%)",
-  /* Unitless 0 is invalid as an <angle> */
-  "linear-gradient(0, red, blue)",
   /* There must be a comma between gradient-line (e.g. <angle>) and colors */
   "linear-gradient(30deg red, blue)",
   "linear-gradient(to top left red, blue)",
   "linear-gradient(to right red, blue)",
   /* Invalid color, calc() or -moz-image-rect() function */
   "linear-gradient(red, rgb(0, rubbish, 0) 50%, red)",
   "linear-gradient(red, red calc(50% + rubbish), red)",
   "linear-gradient(to top calc(50% + rubbish), red, blue)",
--- a/layout/style/test/stylo-failures.md
+++ b/layout/style/test/stylo-failures.md
@@ -128,17 +128,16 @@ to mochitest command.
 
 ## Assertions
 
 ## Need Gecko change
 
 * Servo is correct but Gecko is wrong
   * Gecko rejects calc() in -webkit-gradient bug 1363349
     * test_property_syntax_errors.html `-webkit-gradient` [20]
-* test_property_syntax_errors.html `linear-gradient(0,`: unitless zero as degree bug 1363292 [10]
 * test_specified_value_serialization.html `-webkit-radial-gradient`: bug 1367299 [1]
 * test_variables.html `var(--var6)`: irrelevant test for stylo bug 1367306 [1]
 
 ## Unknown / Unsure
 
 * test_selectors_on_anonymous_content.html: xbl and :nth-child [1]
 * test_parse_rule.html `rgb(0, 128, 0)`: color properties not getting computed [5]
 * test_selectors.html `:nth-child`: &lt;an+b&gt; parsing difference bug 1364009 [14]