Bug 964529: Support scientific (exponential) notation for CSS <number> values, including percentages and dimensions (but not <integer> values). r=SimonSapin
authorL. David Baron <dbaron@dbaron.org>
Fri, 31 Jan 2014 16:06:46 -0800
changeset 166325 ce3bd1ad8565cdbf04b7361d72df40cc176b3412
parent 166324 56aaeebb639f07fa2b312a0888f9de6f8f3ddec3
child 166326 2c7dbe305a8a2beba5b5596dd5a4e20a7bb3441d
push id39180
push userdbaron@mozilla.com
push dateSat, 01 Feb 2014 00:08:08 +0000
treeherdermozilla-inbound@ce3bd1ad8565 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersSimonSapin
bugs964529
milestone29.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 964529: Support scientific (exponential) notation for CSS <number> values, including percentages and dimensions (but not <integer> values). r=SimonSapin Resolved for <number> on 2012-08-15: http://lists.w3.org/Archives/Public/www-style/2012Aug/0900.html Resolved for percentages and dimensions in CSS teleconference 2013-04-17: http://lists.w3.org/Archives/Public/www-style/2013Apr/0428.html
layout/style/nsCSSScanner.cpp
layout/style/test/property_database.js
--- a/layout/style/nsCSSScanner.cpp
+++ b/layout/style/nsCSSScanner.cpp
@@ -876,17 +876,17 @@ nsCSSScanner::ScanNumber(nsCSSToken& aTo
       fracPart += DecimalDigitValue(c) / divisor;
       divisor *= 10;
       Advance();
       c = Peek();
     } while (IsDigit(c));
   }
 
   bool gotE = false;
-  if (IsSVGMode() && (c == 'e' || c == 'E')) {
+  if (c == 'e' || c == 'E') {
     int32_t expSignChar = Peek(1);
     int32_t nextChar = Peek(2);
     if (IsDigit(expSignChar) ||
         ((expSignChar == '-' || expSignChar == '+') && IsDigit(nextChar))) {
       gotE = true;
       if (expSignChar == '-') {
         expSign = -1;
       }
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -2850,18 +2850,18 @@ var gCSSProperties = {
 		],
 		invalid_values: [ "auto", "none", "5" ]
 	},
 
 	"opacity": {
 		domProp: "opacity",
 		inherited: false,
 		type: CSS_TYPE_LONGHAND,
-		initial_values: [ "1", "17", "397.376" ],
-		other_values: [ "0", "0.4", "0.0000", "-3" ],
+		initial_values: [ "1", "17", "397.376", "3e1", "3e+1", "3e0", "3e+0", "3e-0" ],
+		other_values: [ "0", "0.4", "0.0000", "-3", "3e-1" ],
 		invalid_values: [ "0px", "1px" ]
 	},
 	"-moz-orient": {
 		domProp: "MozOrient",
 		inherited: false,
 		type: CSS_TYPE_LONGHAND,
 		initial_values: [ "auto" ],
 		other_values: [ "horizontal", "vertical" ],
@@ -2870,17 +2870,17 @@ var gCSSProperties = {
 	"orphans": {
 		domProp: "orphans",
 		inherited: true,
 		backend_only: true,
 		type: CSS_TYPE_LONGHAND,
 		// XXX requires display:block
 		initial_values: [ "2" ],
 		other_values: [ "1", "7" ],
-		invalid_values: [ "0", "-1", "0px", "3px" ]
+		invalid_values: [ "0", "-1", "0px", "3px", "3e1" ]
 	},
 	"outline": {
 		domProp: "outline",
 		inherited: false,
 		type: CSS_TYPE_TRUE_SHORTHAND,
 		subproperties: [ "outline-color", "outline-style", "outline-width" ],
 		initial_values: [
 			"none", "medium", "thin",
@@ -3342,27 +3342,31 @@ var gCSSProperties = {
 	"widows": {
 		domProp: "widows",
 		inherited: true,
 		backend_only: true,
 		type: CSS_TYPE_LONGHAND,
 		// XXX requires display:block
 		initial_values: [ "2" ],
 		other_values: [ "1", "7" ],
-		invalid_values: [ "0", "-1", "0px", "3px" ]
+		invalid_values: [ "0", "-1", "0px", "3px", "3e1" ]
 	},
 	"width": {
 		domProp: "width",
 		inherited: false,
 		type: CSS_TYPE_LONGHAND,
 		/* computed value tests for width test more with display:block */
 		prerequisites: { "display": "block" },
 		initial_values: [ " auto" ],
 		/* XXX these have prerequisites */
 		other_values: [ "15px", "3em", "15%", "-moz-max-content", "-moz-min-content", "-moz-fit-content", "-moz-available",
+			"3e1px", "3e+1px", "3e0px", "3e+0px", "3e-0px", "3e-1px",
+			"3.2e1px", "3.2e+1px", "3.2e0px", "3.2e+0px", "3.2e-0px", "3.2e-1px",
+			"3e1%", "3e+1%", "3e0%", "3e+0%", "3e-0%", "3e-1%",
+			"3.2e1%", "3.2e+1%", "3.2e0%", "3.2e+0%", "3.2e-0%", "3.2e-1%",
 			/* valid -moz-calc() values */
 			"-moz-calc(-2px)",
 			"-moz-calc(2px)",
 			"-moz-calc(50%)",
 			"-moz-calc(50% + 2px)",
 			"-moz-calc( 50% + 2px)",
 			"-moz-calc(50% + 2px )",
 			"-moz-calc( 50% + 2px )",
@@ -3487,17 +3491,17 @@ var gCSSProperties = {
 	},
 	"z-index": {
 		domProp: "zIndex",
 		inherited: false,
 		type: CSS_TYPE_LONGHAND,
 		/* XXX requires position */
 		initial_values: [ "auto" ],
 		other_values: [ "0", "3", "-7000", "12000" ],
-		invalid_values: [ "3.0", "17.5" ]
+		invalid_values: [ "3.0", "17.5", "3e1" ]
 	}
 	,
 	"clip-path": {
 		domProp: "clipPath",
 		inherited: false,
 		type: CSS_TYPE_LONGHAND,
 		initial_values: [ "none" ],
 		other_values: [ "url(#mypath)", "url('404.svg#mypath')" ],