Bug 1277814 - APZ mochitest for scroll frame with transform that results in a cumulative resolution of zero. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Mon, 06 Jun 2016 16:28:04 -0400
changeset 375893 9f334338564ae35b167b73597101fb1d1340f2c8
parent 375892 569276f2edd39600de534183e12b7f8762b917c8
child 375931 ec5189e224d229d2695fcd3c8dd7527e45259b44
push id20420
push userbballo@mozilla.com
push dateMon, 06 Jun 2016 22:18:53 +0000
reviewerskats
bugs1277814
milestone49.0a1
Bug 1277814 - APZ mochitest for scroll frame with transform that results in a cumulative resolution of zero. r=kats MozReview-Commit-ID: J6ueE23YqC
gfx/layers/apz/test/mochitest/mochitest.ini
gfx/layers/apz/test/mochitest/test_bug1277814.html
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -18,16 +18,17 @@ support-files =
   helper_click.html
   helper_drag_click.html
   helper_bug1271432.html
   helper_touch_action.html
   helper_touch_action_regions.html
 tags = apz
 [test_bug982141.html]
 [test_bug1151663.html]
+[test_bug1277814.html]
 [test_wheel_scroll.html]
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
 [test_wheel_transactions.html]
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
 [test_bug1151667.html]
 skip-if = (os == 'android') || (os == 'b2g') # wheel events not supported on mobile
 [test_layerization.html]
 skip-if = (os == 'android') || (os == 'b2g') # uses wheel events which are not supported on mobile
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/test_bug1277814.html
@@ -0,0 +1,94 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1277814
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1151663</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
+  <script type="application/javascript" src="apz_test_utils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+    function* test(testDriver) {
+      // Trigger the buggy scenario
+      document.getElementById('bug1277814-div').classList.add('a');
+
+      // Give APZ the chance to compute a displayport, and content
+      // to render based on it.
+      yield waitForAllPaints(function() {
+        flushApzRepaints(testDriver);
+      });
+
+      // Examine the content-side APZ test data
+      var utils = SpecialPowers.getDOMWindowUtils(window);
+      var contentTestData = utils.getContentAPZTestData();
+
+      // Test that the scroll frame for the div 'bug1277814-div' appears in
+      // the APZ test data. The bug this test is for causes the displayport
+      // calculation for this scroll frame to go wrong, causing it not to
+      // become layerized.
+      contentTestData = convertTestData(contentTestData);
+      var foundIt = false;
+      for (var seqNo in contentTestData.paints) {
+        var paint = contentTestData.paints[seqNo];
+        for (var scrollId in paint) {
+          var scrollFrame = paint[scrollId];
+          for (var key in scrollFrame) {
+            if (key == 'contentDescription') {
+              if (scrollFrame[key].includes('bug1277814')) {
+                foundIt = true;
+              }
+            }
+          }
+        }
+      }
+      SimpleTest.ok(foundIt, "expected to find APZ test data for bug1277814-div");
+    }
+
+    if (isApzEnabled()) {
+      SimpleTest.waitForExplicitFinish();
+
+      pushPrefs([["apz.test.logging_enabled", true]])
+        .then(waitUntilApzStable)
+        .then(runContinuation(test))
+        .then(SimpleTest.finish);
+    }
+  </script>
+  <style>
+    #bug1277814-div
+    {
+      position: absolute;
+      left: 0;
+      top: 0;
+      padding: .5em;
+      overflow: auto;
+      color: white;
+      background: green;
+      max-width: 30em;
+      max-height: 6em;
+      visibility: hidden;
+      transform: scaleY(0);
+      transition: transform .15s ease-out, visibility 0s ease .15s;
+    }
+    #bug1277814-div.a
+    {
+      visibility: visible;
+      transform: scaleY(1);
+      transition: transform .15s ease-out;
+    }
+  </style>
+</head>
+<body>
+  <!-- Use a unique id because we'll be checking for it in the content
+       description logged in the APZ test data -->
+  <div id="bug1277814-div">
+    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
+    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
+    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
+    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
+    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
+  <button>click me</button>
+</body>
+</html>