Bug 1207734 - Part 9.a. (testing) Update gCSSProperties for the properties of individual transforms. r=emilio draft
authorcku <cku@mozilla.com>
Thu, 25 Jan 2018 09:32:49 +0900
changeset 749197 f7f5499cde9e8120cd73f60f9a274634045308f4
parent 749196 7b7636b19922be08ad107df6fda8b807132f2914
child 749198 c454215cf36112a5e01618b7f118d7e0103c7d17
push id97349
push userbbirtles@mozilla.com
push dateWed, 31 Jan 2018 02:59:16 +0000
reviewersemilio
bugs1207734
milestone60.0a1
Bug 1207734 - Part 9.a. (testing) Update gCSSProperties for the properties of individual transforms. r=emilio MozReview-Commit-ID: GiQCo18M5da
layout/style/test/property_database.js
layout/style/test/test_property_database.html
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -6282,16 +6282,68 @@ function get_computed_value(cs, property
     }
     return results.join(" ; ");
   }
   if (info.get_computed)
     return info.get_computed(cs, property);
   return cs.getPropertyValue(property);
 }
 
+if (SpecialPowers.DOMWindowUtils.isStyledByServo &&
+    IsCSSPropertyPrefEnabled("layout.css.individual-transform.enabled")) {
+  gCSSProperties.rotate = {
+    domProp: "rotate",
+    inherited: false,
+    type: CSS_TYPE_LONGHAND,
+    initial_values: [ "none" ],
+    other_values: [ "45deg", "45grad", "72rad", "0.25turn", ".57rad",
+                    "0 0 0 0rad", "0 0 1 45deg", "0 0 1 0rad",
+                    /* valid calc() values */
+                    "calc(1) 0 0 calc(45deg + 5rad)",
+                    "0 1 0 calc(400grad + 1rad)",
+                    "calc(0.5turn + 10deg)"],
+    invalid_values: [ "0", "7", "0, 0, 1, 45deg", "0 0 45deg", "0 0 20rad",
+                      "0 0 0 0",
+                      /* invalid calc() values */
+                      "0.5 1 0 calc(45deg + 10)", "calc(0.5turn + 10%)"],
+  };
+
+  gCSSProperties.translate = {
+    domProp: "translate",
+    inherited: false,
+    type: CSS_TYPE_LONGHAND,
+    initial_values: [ "none" ],
+    other_values: [ "-4px", "3px", "4em", "50%", "4px 5px 6px",
+                    "4px 5px", "50% 5px 6px", "50% 10% 6em",
+                    /* valid calc() values */
+                    "calc(5px + 10%)",
+                    "calc(0.25 * 5px + 10% / 3)",
+                    "calc(5px - 10% * 3)",
+                    "calc(5px - 3 * 10%) 50px",
+                    "-50px calc(5px - 10% * 3)"],
+    invalid_values: [ "1", "-moz-min(5px,10%)", "4px, 5px, 6px",
+                      "3px 4px 1px 7px", "4px 5px 10%",
+                      /* invalid calc() values */
+                      "10px calc(min(5px,10%))",
+                      "calc(max(5px,10%) 10%)", "calc(nonsense)"],
+  };
+  gCSSProperties.scale = {
+    domProp: "scale",
+    inherited: false,
+    type: CSS_TYPE_LONGHAND,
+    initial_values: [ "none" ],
+    other_values: [ "10", "10 20", "10 20 30", "0 2.0",
+                     /* valid calc() values */
+                     "calc(1 + 2)", "calc(10) calc(20) 30"],
+    invalid_values: ["150%", "10px", "10deg", "10, 20, 30",
+                      /* invalid calc() values */
+                      "calc(1 + 20%)",  "10 calc(1 + 10px)"],
+  };
+}
+
 if (IsCSSPropertyPrefEnabled("layout.css.touch_action.enabled")) {
     gCSSProperties["touch-action"] = {
         domProp: "touchAction",
         inherited: false,
         type: CSS_TYPE_LONGHAND,
         initial_values: ["auto"],
         other_values: ["none", "pan-x", "pan-y", "pan-x pan-y", "pan-y pan-x", "manipulation"],
         invalid_values: ["zoom", "pinch", "tap", "10px", "2", "auto pan-x", "pan-x auto", "none pan-x", "pan-x none",
--- a/layout/style/test/test_property_database.html
+++ b/layout/style/test/test_property_database.html
@@ -26,21 +26,31 @@
  * the autogenerated css_properties.js to make sure that everything in
  * css_properties.js is in property_database.js.
  *
  * 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.
  */
 
+const gServoOnlyProperties = [
+  'rotate',
+  'scale',
+  'translate',
+];
+
 for (var idx in gLonghandProperties) {
   var prop = gLonghandProperties[idx];
   if (prop.pref && !IsCSSPropertyPrefEnabled(prop.pref)) {
     continue;
   }
+  if (!SpecialPowers.DOMWindowUtils.isStyledByServo &&
+      gServoOnlyProperties.includes(prop.name)) {
+    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");