Bug 842772 - Don't test for mask-type when the pref is disabled. r=dbaron a=test-only
authorCameron McCormack <cam@mcc.id.au>
Wed, 20 Feb 2013 11:24:42 +1100
changeset 128409 b83c82231d131bdee93cc2554382928760c8a9c3
parent 128408 d8c97bae852106496ea7d9f8f6c97107a6fc4397
child 128410 0ee515e4e9c2b4d13347d1ae131103ce7c11a85f
push id3385
push usercmccormack@mozilla.com
push dateWed, 20 Feb 2013 00:30:36 +0000
treeherdermozilla-aurora@0ee515e4e9c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, test-only
bugs842772
milestone21.0a2
Bug 842772 - Don't test for mask-type when the pref is disabled. r=dbaron a=test-only
layout/style/test/ListCSSProperties.cpp
layout/style/test/property_database.js
layout/style/test/test_property_database.html
--- a/layout/style/test/ListCSSProperties.cpp
+++ b/layout/style/test/ListCSSProperties.cpp
@@ -7,24 +7,25 @@
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
 struct PropertyInfo {
     const char *propName;
     const char *domName;
+    const char *pref;
 };
 
 const PropertyInfo gLonghandProperties[] = {
 
 #define CSS_PROP_DOMPROP_PREFIXED(prop_) Moz ## prop_
 #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
                  stylestruct_, stylestructoffset_, animtype_)                 \
-    { #name_, #method_ },
+    { #name_, #method_, pref_ },
 
 #include "nsCSSPropList.h"
 
 #undef CSS_PROP
 #undef CSS_PROP_DOMPROP_PREFIXED
 
 };
 
@@ -47,28 +48,28 @@ const char* gLonghandPropertiesWithDOMPr
 
 };
 
 const PropertyInfo gShorthandProperties[] = {
 
 #define CSS_PROP_DOMPROP_PREFIXED(prop_) Moz ## prop_
 // Need an extra level of macro nesting to force expansion of method_
 // params before they get pasted.
-#define LISTCSSPROPERTIES_INNER_MACRO(method_) #method_,
+#define LISTCSSPROPERTIES_INNER_MACRO(method_) #method_
 #define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_)	\
-    { #name_, LISTCSSPROPERTIES_INNER_MACRO(method_) },
+    { #name_, LISTCSSPROPERTIES_INNER_MACRO(method_), pref_ },
 
 #include "nsCSSPropList.h"
 
 #undef CSS_PROP_SHORTHAND
 #undef LISTCSSPROPERTIES_INNER_MACRO
 #undef CSS_PROP_DOMPROP_PREFIXED
 
 #define CSS_PROP_ALIAS(name_, id_, method_, pref_) \
-    { #name_, #method_ },
+    { #name_, #method_, #pref_ },
 
 #include "nsCSSPropAliasList.h"
 
 #undef CSS_PROP_ALIAS
 
 };
 
 /* see gLonghandPropertiesWithDOMProp */
@@ -186,17 +187,25 @@ print_array(const char *aName,
         else {
             ++j;
             if (strncmp(p->domName, "Moz", 3) == 0)
                 printf("\"%s\"", p->domName);
             else
                 // lowercase the first letter
                 printf("\"%c%s\"", p->domName[0] + 32, p->domName + 1);
         }
-        printf("}");
+        if (p->pref && p->pref[0]) {
+            printf(", pref: ");
+            if (p->pref[0] == '\"') {
+                printf("%s", p->pref);
+            } else {
+                printf("\"%s\"", p->pref);
+            }
+        }
+        printf(" }");
     }
 
     if (j != aDOMPropsLength) {
         fprintf(stderr, "Assertion failure %s:%d\n", __FILE__, __LINE__);
         fprintf(stderr, "j==%d, aDOMPropsLength == %d\n", j, aDOMPropsLength);
         exit(1);
     }
 
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -3578,24 +3578,16 @@ var gCSSProperties = {
 	"mask": {
 		domProp: "mask",
 		inherited: false,
 		type: CSS_TYPE_LONGHAND,
 		initial_values: [ "none" ],
 		other_values: [ "url(#mymask)" ],
 		invalid_values: []
 	},
-	"mask-type": {
-		domProp: "maskType",
-		inherited: false,
-		type: CSS_TYPE_LONGHAND,
-		initial_values: [ "luminance" ],
-		other_values: [ "alpha" ],
-		invalid_values: []
-	},
 	"shape-rendering": {
 		domProp: "shapeRendering",
 		inherited: true,
 		type: CSS_TYPE_LONGHAND,
 		initial_values: [ "auto" ],
 		other_values: [ "optimizeSpeed", "crispEdges", "geometricPrecision" ],
 		invalid_values: []
 	},
@@ -4252,16 +4244,27 @@ if (SpecialPowers.getBoolPref("layout.cs
 	};
 	for (var prop in flexProperties) {
 		gCSSProperties[prop] = flexProperties[prop];
 	}
 	gCSSProperties["display"].other_values.push("flex");
 	gCSSProperties["display"].other_values.push("inline-flex");
 }
 
+if (SpecialPowers.getBoolPref("layout.css.masking.enabled")) {
+	gCSSProperties["mask-type"] = {
+		domProp: "maskType",
+		inherited: false,
+		type: CSS_TYPE_LONGHAND,
+		initial_values: [ "luminance" ],
+		other_values: [ "alpha" ],
+		invalid_values: []
+	};
+}
+
 if (SpecialPowers.getBoolPref("svg.paint-order.enabled")) {
   gCSSProperties["paint-order"] = {
     domProp: "paintOrder",
     inherited: true,
     type: CSS_TYPE_LONGHAND,
     initial_values: [ "normal" ],
     other_values: [ "fill", "fill stroke", "fill stroke markers", "stroke markers fill" ],
     invalid_values: [ "fill stroke markers fill", "fill normal" ]
--- a/layout/style/test/test_property_database.html
+++ b/layout/style/test/test_property_database.html
@@ -28,41 +28,50 @@
  *
  * This prevents CSS properties from being added to the code without
  * also being put under the minimal test coverage provided by the tests
  * that use property_database.js.
  */
 
 for (var idx in gLonghandProperties) {
   var prop = gLonghandProperties[idx];
+  if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) {
+    continue;
+  }
   var present = prop.name in gCSSProperties;
   ok(present,
      "'" + prop.name + "' listed in gCSSProperties");
   if (present) {
     is(gCSSProperties[prop.name].type, CSS_TYPE_LONGHAND,
        "'" + prop.name + "' listed as CSS_TYPE_LONGHAND");
     is(gCSSProperties[prop.name].domProp, prop.prop,
        "'" + prop.name + "' listed with correct DOM property name");
   }
 }
 for (var idx in gShorthandProperties) {
   var prop = gShorthandProperties[idx];
+  if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) {
+    continue;
+  }
   var present = prop.name in gCSSProperties;
   ok(present,
      "'" + prop.name + "' listed in gCSSProperties");
   if (present) {
     ok(gCSSProperties[prop.name].type == CSS_TYPE_TRUE_SHORTHAND ||
        gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND,
        "'" + prop.name + "' listed as CSS_TYPE_TRUE_SHORTHAND or CSS_TYPE_SHORTHAND_AND_LONGHAND");
     ok(gCSSProperties[prop.name].domProp == prop.prop,
        "'" + prop.name + "' listed with correct DOM property name");
   }
 }
 for (var idx in gShorthandPropertiesLikeLonghand) {
   var prop = gShorthandPropertiesLikeLonghand[idx];
+  if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) {
+    continue;
+  }
   var present = prop.name in gCSSProperties;
   ok(present,
      "'" + prop.name + "' listed in gCSSProperties");
   if (present) {
     ok(gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND,
        "'" + prop.name + "' listed as CSS_TYPE_SHORTHAND_AND_LONGHAND");
     ok(gCSSProperties[prop.name].domProp == prop.prop,
        "'" + prop.name + "' listed with correct DOM property name");
@@ -70,16 +79,19 @@ for (var idx in gShorthandPropertiesLike
 }
 
 /*
  * Test that all shorthand properties have a subproperty list and all
  * longhand properties do not.
  */
 for (var prop in gCSSProperties) {
   var info = gCSSProperties[prop];
+  if (info.pref && !SpecialPowers.getBoolPref(info.pref)) {
+    continue;
+  }
   if (info.type == CSS_TYPE_LONGHAND) {
     ok(!("subproperties" in info),
        "longhand property '" + prop + "' must not have subproperty list");
   } else if (info.type == CSS_TYPE_TRUE_SHORTHAND) {
     ok("subproperties" in info,
        "shorthand property '" + prop + "' must have subproperty list");
   }
   /* optional for CSS_TYPE_SHORTHAND_AND_LONGHAND */