Bug 1117538 part 2 - [css-grid] Accept 'grid-auto-flow: dense' which now implies 'row dense'. r=simon.sapin
authorMats Palmgren <mats@mozilla.com>
Mon, 05 Jan 2015 22:20:56 +0000
changeset 222137 576c21be1808221944401b82b0c23e0565d03b98
parent 222136 5f96dee075de1d388b20e206b9c0756bb07e4e6d
child 222138 73eadfc19bba78adaba9cef4e9b38decce37b030
push id28059
push userryanvm@gmail.com
push dateTue, 06 Jan 2015 15:53:01 +0000
treeherdermozilla-central@4d91c33b351c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssimon.sapin
bugs1117538
milestone37.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 1117538 part 2 - [css-grid] Accept 'grid-auto-flow: dense' which now implies 'row dense'. r=simon.sapin
layout/style/nsCSSParser.cpp
layout/style/test/property_database.js
layout/style/test/test_grid_container_shorthands.html
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -7649,20 +7649,21 @@ CSSParserImpl::ParseGridAutoFlow()
     NS_STYLE_GRID_AUTO_FLOW_ROW | NS_STYLE_GRID_AUTO_FLOW_COLUMN,
     MASK_END_VALUE
   };
   if (!ParseBitmaskValues(value, nsCSSProps::kGridAutoFlowKTable, mask)) {
     return false;
   }
   int32_t bitField = value.GetIntValue();
 
-  // Require one of these.
-  if (!(bitField & NS_STYLE_GRID_AUTO_FLOW_ROW ||
-        bitField & NS_STYLE_GRID_AUTO_FLOW_COLUMN)) {
-    return false;
+  // If neither row nor column is provided, row is assumed.
+  if (!(bitField & (NS_STYLE_GRID_AUTO_FLOW_ROW |
+                    NS_STYLE_GRID_AUTO_FLOW_COLUMN))) {
+    value.SetIntValue(bitField | NS_STYLE_GRID_AUTO_FLOW_ROW,
+                      eCSSUnit_Enumerated);
   }
 
   AppendValue(eCSSProperty_grid_auto_flow, value);
   return true;
 }
 
 CSSParseResult
 CSSParserImpl::ParseGridLineNames(nsCSSValue& aValue)
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -5072,23 +5072,23 @@ if (SpecialPowers.getBoolPref("layout.cs
     type: CSS_TYPE_LONGHAND,
     initial_values: [ "row" ],
     other_values: [
       "column",
       "column dense",
       "row dense",
       "dense column",
       "dense row",
+      "dense",
     ],
     invalid_values: [
       "",
       "auto",
       "none",
       "10px",
-      "dense",
       "column row",
       "dense row dense",
     ]
   };
 
   gCSSProperties["grid-auto-columns"] = {
     domProp: "gridAutoColumns",
     inherited: false,
--- a/layout/style/test/test_grid_container_shorthands.html
+++ b/layout/style/test/test_grid_container_shorthands.html
@@ -174,16 +174,20 @@ var grid_template_test_cases = [
 ];
 
 grid_test_cases = grid_template_test_cases.concat([
     {
         specified: "row",
         gridAutoFlow: "row",
     },
     {
+        specified: "dense",
+        gridAutoFlow: "row dense",
+    },
+    {
         specified: "row 40px",
         gridAutoFlow: "row",
         gridAutoColumns: "40px",
     },
     {
         specified: "column 40px",
         gridAutoFlow: "column",
         gridAutoColumns: "40px",