Bug 1292283 - Enable test_transitions_per_property.html. draft
authorBoris Chiou <boris.chiou@gmail.com>
Fri, 16 Jun 2017 17:23:24 +0800
changeset 642358 a6800ce8b7f4b83ec62778a129667037365abd78
parent 642357 94f1eada6a6f2251d26b8f975719507017fd9fc2
child 642410 79ad89544d9999055443db14606e196f1c0124c6
push id72711
push userbmo:boris.chiou@gmail.com
push dateTue, 08 Aug 2017 02:50:08 +0000
bugs1292283
milestone57.0a1
Bug 1292283 - Enable test_transitions_per_property.html. MozReview-Commit-ID: 7noX0Lf5UU8
layout/style/test/mochitest.ini
layout/style/test/test_transitions_per_property.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -293,17 +293,17 @@ skip-if = !stylo
 [test_transitions_computed_values.html]
 [test_transitions_computed_value_combinations.html]
 [test_transitions_events.html]
 [test_transitions.html]
 skip-if = (android_version == '18' && debug) # bug 1159532
 [test_transitions_bug537151.html]
 [test_transitions_dynamic_changes.html]
 [test_transitions_per_property.html]
-skip-if = (toolkit == 'android' || stylo) # bug 775227 for android, bug 1292283 for stylo
+skip-if = (toolkit == 'android') # bug 775227 for android
 [test_transitions_replacement_on_busy_frame.html]
 support-files = file_transitions_replacement_on_busy_frame.html
 [test_transitions_step_functions.html]
 [test_transitions_with_disabled_properties.html]
 support-files = file_transitions_with_disabled_properties.html
 [test_unclosed_parentheses.html]
 [test_unicode_range_loading.html]
 support-files = ../../reftests/fonts/markA.woff ../../reftests/fonts/markB.woff ../../reftests/fonts/markC.woff ../../reftests/fonts/markD.woff
--- a/layout/style/test/test_transitions_per_property.html
+++ b/layout/style/test/test_transitions_per_property.html
@@ -53,16 +53,49 @@ function has_num(str)
 function any_unit_to_num(str)
 {
     return Number(String(str).match(/^([\d.]+)/)[1]);
 }
 
 var FUNC_NEGATIVE = "cubic-bezier(0.25, -2, 0.75, 1)";
 var FUNC_OVERONE = "cubic-bezier(0.25, 0, 0.75, 3)";
 
+// After resolving Bug 1387080, we can remove this variable.
+const isServo = SpecialPowers.DOMWindowUtils.isStyledByServo;
+
+// The following properties will be skipped while using Servo backend.
+var skippedProperties = {
+    "background-position": true,    // Bug 1387946
+    "background-position-x": true,  // Bug 1387946
+    "background-position-y": true,  // Bug 1387946
+    "background-size": true,        // Bug 1387946
+    "mask-position": true,          // Bug 1387946
+    "mask-position-x": true,        // Bug 1387946
+    "mask-position-y": true,        // Bug 1387946
+    "mask-size": true,              // Bug 1387946
+    "box-shadow": true,             // Bug 1387973
+    "caret-color": true,            // Bug 1387951
+    "clip": true,                   // Bug 1387951
+    "clip-path": true,              // Bug 1387952
+    "column-count": true,           // Bug 1387939
+    "font-weight": true,            // Bug 1387948
+    "-moz-image-region": true,      // Bug 1387951
+    "order": true,                  // Bug 1387939
+    "stroke-dasharray": true,       // Bug 1387986
+    "stroke-dashoffset": true,      // Bug 1369614
+    "stroke-width": true,           // Bug 1369614
+    "text-shadow": true,            // Bug 1387973
+    "vertical-align": true,         // Bug 1387949
+    "z-index": true,                // Bug 1387939
+    // Bug 1387941: Spec drops these properties, so we might also need to update
+    // this for Gecko.
+    "scroll-snap-coordinate": true,
+    "scroll-snap-destination": true,
+};
+
 var supported_properties = {
     "border-bottom-left-radius": [ test_radius_transition ],
     "border-bottom-right-radius": [ test_radius_transition ],
     "border-top-left-radius": [ test_radius_transition ],
     "border-top-right-radius": [ test_radius_transition ],
     "-moz-box-flex": [ test_float_zeroToOne_transition,
                        test_float_aboveOne_transition,
                        test_float_zeroToOne_clamped ],
@@ -366,23 +399,25 @@ var transformTests = [
     expected_uncomputed: 'rotate(360deg)',
     expected: computeMatrix('scale(1)'),
     round_error_ok: true },
   { start: 'none', end: 'rotatey(60deg)',
     expected_uncomputed: 'rotatey(15deg)',
     expected: computeMatrix('rotatey(15deg)') },
   { start: 'none', end: 'rotatey(720deg)',
     expected_uncomputed: 'rotatey(180deg)',
-    expected: computeMatrix('rotatey(180deg)') },
+    expected: computeMatrix('rotatey(180deg)'),
+    skipped: isServo },
   { start: 'none', end: 'rotatex(60deg)',
     expected_uncomputed: 'rotatex(15deg)',
     expected: computeMatrix('rotatex(15deg)') },
   { start: 'none', end: 'rotatex(720deg)',
     expected_uncomputed: 'rotatex(180deg)',
-    expected: computeMatrix('rotatex(180deg)') },
+    expected: computeMatrix('rotatex(180deg)'),
+    skipped: isServo },
 
   // translate
   { start: 'translate(20px)', end: 'none',
     expected_uncomputed: 'translate(15px)',
     expected: 'matrix(1, 0, 0, 1, 15, 0)' },
   { start: 'translate(20px, 12px)', end: 'none',
     expected_uncomputed: 'translate(15px, 9px)',
     expected: 'matrix(1, 0, 0, 1, 15, 9)' },
@@ -433,20 +468,22 @@ var transformTests = [
     round_error_ok: true },
   // test calc() in translate
   // Note that font-size: is 20px, and that percentages are relative
   // to 300px (width) and 50px (height) per the prerequisites in
   // property_database.js
   { start: 'translateX(20%)', /* 60px */
     end: 'translateX(calc(10% + 1em))', /* 30px + 20px = 50px */
     expected_uncomputed: 'translateX(calc(17.5% + 0.25em))',
-    expected: 'matrix(1, 0, 0, 1, 57.5, 0)' },
+    expected: 'matrix(1, 0, 0, 1, 57.5, 0)',
+    skipped: isServo },
   { start: 'translate(calc(0.75 * 3em + 1.5 * 10%), calc(0.5 * 5em + 0.5 * 8%))', /* 90px, 52px */
     end: 'rotate(90deg) translateY(20%) rotate(90deg) translateY(calc(10% + 0.5em)) rotate(180deg)', /* -10px, -15px */
-    expected: 'matrix(1, 0, 0, 1, 65, 35.25)' },
+    expected: 'matrix(1, 0, 0, 1, 65, 35.25)',
+    skipped: isServo },
 
   // scale
   { start: 'scale(2)', end: 'none',
     expected_uncomputed: 'scale(1.75)',
     expected: 'matrix(1.75, 0, 0, 1.75, 0, 0)' },
   { start: 'none', end: 'scale(0.4)',
     expected_uncomputed: 'scale(0.85)',
     expected: 'matrix(0.85, 0, 0, 0.85, 0, 0)',
@@ -488,128 +525,146 @@ var transformTests = [
   { start: 'skewX(0)', end: 'skewX(-45deg)',
     expected_uncomputed: 'skewX(-11.25deg)' },
   { start: 'skewY(45deg)', end: 'skewY(-45deg)',
     expected_uncomputed: 'skewY(22.5deg)' },
 
   // matrix : skewX
   { start: 'matrix(1, 0, 3, 1, 0, 0)', end: 'none',
     expected: 'matrix(1, 0, ' + 3 * 0.75 + ', 1, 0, 0)',
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   { start: 'skewX(0)', end: 'skewX(-45deg) translate(0)',
     expected: 'matrix(1, 0, -0.25, 1, 0, 0)',
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   // matrix : rotate
   { start: 'rotate(-30deg)', end: 'matrix(0, 1, -1, 0, 0, 0)',
     expected: 'matrix(1, 0, 0, 1, 0, 0)',
     round_error_ok: true },
   { start: 'rotate(-30deg) translateX(0)',
     end: 'translateX(0) rotate(-90deg)',
     expected: computeMatrix('rotate(-45deg)'),
     round_error_ok: true },
   // matrix decomposition of skewY
   { start: 'skewY(60deg)', end: 'skewY(-60deg) translateX(0)',
     /* rotate(30deg) skewX(60deg)/2 scale(2, 0.5) */
     expected: computeMatrix('rotate(30deg) skewX(' + Math.atan(Math.tan(Math.PI * 60/180) / 2) + 'rad) scale(2, 0.5)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
+
 
   // matrix decomposition
 
   // Four pairs of the same matrix expressed different ways.
   { start: 'matrix(-1, 0, 0, -1, 0, 0)', /* rotate(180deg) */
     end: 'matrix(1, 0, 0, 1, 0, 0)',
-    expected: computeMatrix('rotate(135deg)') },
+    expected: computeMatrix('rotate(135deg)'),
+    skipped: isServo },
   { start: 'scale(-1)', end: 'none',
     expected_uncomputed: 'scale(-0.5)',
     expected: 'matrix(-0.5, 0, 0, -0.5, 0, 0)' },
   { start: 'rotate(180deg)', end: 'none',
     expected_uncomputed: 'rotate(135deg)' },
   { start: 'rotate(-180deg)', end: 'none',
     expected_uncomputed: 'rotate(-135deg)',
     expected: computeMatrix('rotate(225deg)') },
 
   // matrix followed by scale
   { start: 'matrix(2, 0, 0, 2, 10, 20) scale(2)',
     end: 'none',
-    expected: 'matrix(3.0625, 0, 0, 3.0625, 7.5, 15)' },
+    expected: 'matrix(3.0625, 0, 0, 3.0625, 7.5, 15)',
+    skipped: isServo },
 
   // ... and a bunch of similar possibilities.  The spec isn't settled
   // here; there are multiple options.  See:
   // http://lists.w3.org/Archives/Public/www-style/2010Jun/0602.html
   { start: 'matrix(-1, 0, 0, 1, 0, 0)', /* scaleX(-1) */
     end: 'matrix(1, 0, 0, 1, 0, 0)',
-    expected: computeMatrix('scaleX(-0.5)') },
+    expected: computeMatrix('scaleX(-0.5)'),
+    skipped: isServo },
 
   { start: 'matrix(1, 0, 0, -1, 0, 0)', /* rotate(-180deg) scaleX(-1) */
     end: 'matrix(1, 0, 0, 1, 0, 0)',
-    expected: computeMatrix('rotate(-135deg) scaleX(-0.5)') },
+    expected: computeMatrix('rotate(-135deg) scaleX(-0.5)'),
+    skipped: isServo },
 
   { start: 'matrix(0, 1, 1, 0, 0, 0)', /* rotate(-90deg) scaleX(-1) */
     end: 'matrix(1, 0, 0, 1, 0, 0)',
-    expected: computeMatrix('rotate(-67.5deg) scaleX(-0.5)') },
+    expected: computeMatrix('rotate(-67.5deg) scaleX(-0.5)'),
+    skipped: isServo },
 
   { start: 'matrix(0, -1, 1, 0, 0, 0)', /* rotate(-90deg) */
     end: 'matrix(1, 0, 0, 1, 0, 0)',
     expected: computeMatrix('rotate(-67.5deg)') },
 
   { start: 'matrix(0, 1, -1, 0, 0, 0)', /* rotate(90deg) */
     end: 'matrix(1, 0, 0, 1, 0, 0)',
     expected: computeMatrix('rotate(67.5deg)') },
 
   { start: 'matrix(0, -1, -1, 0, 0, 0)', /* rotate(90deg) scaleX(-1) */
     end: 'matrix(1, 0, 0, 1, 0, 0)',
-    expected: computeMatrix('rotate(67.5deg) scaleX(-0.5)') },
+    expected: computeMatrix('rotate(67.5deg) scaleX(-0.5)'),
+    skipped: isServo },
 
   // Similar decomposition tests, but with skewX.  I checked visually
   // that the sign of the skew was correct by checking visually that
   // the animations in
   // https://dbaron.org/css/test/2010/transition-negative-determinant
   // don't flip when they finish, and then wrote tests corresponding
   // to the current code's behavior.
   // ... start with four with positive determinants
   { start: 'none',
     end: 'matrix(1, 0, 1.5, 1, 0, 0)',
     /* skewX(atan(1.5)) */
     expected: 'matrix(1, 0, ' + 1.5 * 0.25 + ', 1, 0, 0)',
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   { start: 'none',
     end: 'matrix(-1, 0, 2, -1, 0, 0)',
             /* rotate(180deg) skewX(atan(-2)) */
     expected: computeMatrix('rotate(45deg) matrix(1, 0, ' + -2 * 0.25 + ', 1, 0, 0)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   { start: 'none',
     end: 'matrix(0, -1, 1, -3, 0, 0)',
             /* rotate(-90deg) skewX(atan(3)) */
     expected: computeMatrix('rotate(-22.5deg) matrix(1, 0, ' + 3 * 0.25 + ', 1, 0, 0)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   { start: 'none',
     end: 'matrix(0, 1, -1, 4, 0, 0)',
             /* rotate(90deg) skewX(atan(4)) */
     expected: computeMatrix('rotate(22.5deg) matrix(1, 0, ' + 4 * 0.25 + ', 1, 0, 0)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   // and then four with negative determinants
   { start: 'none',
     end: 'matrix(1, 0, 1, -1, 0, 0)',
             /* rotate(-180deg) skewX(atan(-1)) scaleX(-1) */
     expected: computeMatrix('rotate(-45deg) matrix(1, 0, ' + -1 * 0.25 + ', 1, 0, 0) scaleX(0.5)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   { start: 'none',
     end: 'matrix(-1, 0, -1, 1, 0, 0)',
             /* skewX(atan(-1)) scaleX(-1) */
-    expected: computeMatrix('matrix(1, 0, ' + -1 * 0.25 + ', 1, 0, 0) scaleX(0.5)') },
+    expected: computeMatrix('matrix(1, 0, ' + -1 * 0.25 + ', 1, 0, 0) scaleX(0.5)'),
+    skipped: isServo },
   { start: 'none',
     end: 'matrix(0, 1, 1, -2, 0, 0)',
             /* rotate(-90deg) skewX(atan(2)) scaleX(-1) */
     expected: computeMatrix('rotate(-22.5deg) matrix(1, 0, ' + 2 * 0.25 + ', 1, 0, 0) scaleX(0.5)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
   { start: 'none',
     end: 'matrix(0, -1, -1, 0.5, 0, 0)',
             /* rotate(90deg) skewX(atan(0.5)) scaleX(-1) */
     expected: computeMatrix('rotate(22.5deg) matrix(1, 0, ' + 0.5 * 0.25 + ', 1, 0, 0) scaleX(0.5)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
 
   // lists vs. matrix decomposition
   { start: 'translate(10px) skewY(45deg)',
     end: 'translate(30px) skewY(-45deg)',
     expected_uncomputed: 'translate(15px) skewY(22.5deg)' },
   { start: 'skewY(45deg) rotate(90deg)',
     end: 'skewY(-45deg) rotate(90deg)',
     expected_uncomputed: 'skewY(22.5deg) rotate(90deg)' },
@@ -618,17 +673,18 @@ var transformTests = [
     expected: 'matrix(0, 1, -1, -0.5, 0, 0)',
     round_error_ok: true },
   { start: 'skewX(45deg) rotate(90deg)',
     end: 'skewX(-45deg) rotate(90deg)',
     expected_uncomputed: 'skewX(22.5deg) rotate(90deg)' },
   { start: 'skewX(-60deg) rotate(90deg) translate(0)',
     end: 'skewX(60deg) rotate(90deg)',
     expected: computeMatrix('rotate(120deg) skewX(' + Math.atan(Math.tan(Math.PI * 60/180) / 2) + 'rad) scale(2, 0.5)'),
-    round_error_ok: true },
+    round_error_ok: true,
+    skipped: isServo },
 ];
 
 var clipPathTests = [
   { start: "none", end: "none",
     expected: ["none"] },
   // none to shape
   { start: "none",
     end: "circle(500px at 500px 500px) border-box",
@@ -898,20 +954,22 @@ var filterTests = [
   { start: "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)",
     end: "drop-shadow(rgb(0, 0, 0) 4px 4px 0px)",
     expected: ["drop-shadow", "rgb(0, 0, 0) 1px 1px 0px"] },
   { start: "drop-shadow(#038000 4px 4px)",
     end: "drop-shadow(8px 8px 8px red)",
     expected: ["drop-shadow", "rgb(66, 96, 0) 5px 5px 2px"] },
   { start: "blur(25px) drop-shadow(8px 8px)",
     end: "blur(75px)",
-    expected: ["blur", 37.5, "drop-shadow", "rgb(0, 0, 0) 6px 6px 0px"] },
+    expected: ["blur", 37.5, "drop-shadow", "rgb(0, 0, 0) 6px 6px 0px"],
+    skipped: isServo }, // Bug 1387982
   { start: "blur(75px)",
     end: "blur(25px) drop-shadow(8px 8px)",
-    expected: ["blur", 62.5, "drop-shadow", "rgb(0, 0, 0) 2px 2px 0px"] },
+    expected: ["blur", 62.5, "drop-shadow", "rgb(0, 0, 0) 2px 2px 0px"],
+    skipped: isServo }, // Bug 1387982
   { start: "drop-shadow(2px 2px blue)",
     end: "none",
     expected: ["drop-shadow", "rgba(0, 0, 255, 0.75) 1.5px 1.5px 0px"] },
 ];
 
 var prop;
 for (prop in supported_properties) {
   // Test that prop is in the property database.
@@ -938,16 +996,21 @@ function sample_array(array, count) {
   }
   return result;
 }
 
 // Test that transitions don't do anything (i.e., aren't supported) on
 // the properties not in our test list above (and not transition
 // properties themselves).
 for (prop in gCSSProperties) {
+  // Bug 1387080, we should remove this after passing all tests.
+  if (isServo && (prop in skippedProperties)) {
+    continue;
+  }
+
   var info = gCSSProperties[prop];
   if (!(prop in supported_properties) &&
       info.type != CSS_TYPE_TRUE_SHORTHAND &&
       !("alias_for" in info) &&
       !prop.match(/^transition-/) &&
       // FIXME (Bug 119078): THIS SHOULD REALLY NOT BE NEEDED!
       prop != "-moz-binding" &&
       prop != "mask") {
@@ -1016,16 +1079,21 @@ for (prop in gCSSProperties) {
 // Do 4-second linear transitions with -1 second transition delay and
 // linear timing function so that we can expect the transition to be
 // one quarter of the way through the value space right after changing
 // the property.
 div.style.setProperty("transition-duration", "4s", "");
 div.style.setProperty("transition-delay", "-1s", "");
 div.style.setProperty("transition-timing-function", "linear", "");
 for (prop in supported_properties) {
+  // Bug 1387080, we should remove this after passing all tests.
+  if (isServo && (prop in skippedProperties)) {
+    continue;
+  }
+
   var tinfo = supported_properties[prop];
   var info = gCSSProperties[prop];
 
   isnot(info.type, CSS_TYPE_TRUE_SHORTHAND,
         prop + " must not be a shorthand");
   if ("prerequisites" in info) {
     var prereqs = info.prerequisites;
     for (var prereq in prereqs) {
@@ -1563,16 +1631,20 @@ function test_clip_path_transition(prop)
 }
 
 function test_filter_transition(prop) {
   if (!SpecialPowers.getBoolPref("layout.css.filters.enabled")) {
     return;
   }
   for (var i in filterTests) {
     var test = filterTests[i];
+    // Bug 1387982: remove this after we pass all filter tests.
+    if (!!test.skipped) {
+      continue;
+    }
     div.style.setProperty("transition-property", "none", "");
     div.style.setProperty(prop, test.start, "");
     cs.getPropertyValue(prop);
     div.style.setProperty("transition-property", prop, "");
     div.style.setProperty(prop, test.end, "");
     var actual = cs.getPropertyValue(prop);
     ok(filter_function_list_equals(actual, test.expected),
                                    "Filter property is " + actual + " expected values of " +
@@ -2452,16 +2524,20 @@ function test_transform_transition(prop)
       } else {
         test.expected = computeMatrix(v);
       }
     }
   }
 
   for (var i in transformTests) {
     var test = transformTests[i];
+    // Bug 1387990: remove this after passing all transform tests on
+    if (!!test.skipped) {
+      continue;
+    }
     div.style.setProperty("transition-property", "none", "");
     div.style.setProperty(prop, test.start, "");
     cs.getPropertyValue(prop);
     div.style.setProperty("transition-property", prop, "");
     div.style.setProperty(prop, test.end, "");
     var actual = cs.getPropertyValue(prop);
     if (!test.round_error_ok || actual == test.expected) {
       // In most cases, we'll get an exact match, but in some cases
@@ -2533,17 +2609,20 @@ function runAsyncTests() {
   runAllAsyncAnimTests().then(function() {
     OMTAdiv.style.removeProperty("transition");
     SimpleTest.finish();
   });
 }
 
 function addAsyncTransformTests() {
   transformTests.forEach(function(test) {
-    addAsyncAnimTest(function () { return runTransformTest(test); } );
+    // Bug 1387990: remove this if-check after passing all transform tests on
+    if (!test.skipped) {
+      addAsyncAnimTest(function () { return runTransformTest(test); } );
+    }
   });
 }
 
 async function runTransformTest(test) {
   OMTAdiv.style.setProperty("transition-property", "none", "");
   OMTAdiv.style.setProperty("transform", test.start, "");
   OMTACs.getPropertyValue("transform");
   OMTAdiv.style.setProperty("transition-property", "transform", "");