From 20ce0084dbed3d3688d3c5e10264605c178c87d1 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 29 Jun 2016 14:29:42 -0400 Subject: [PATCH] Bug 1253683 - Add a test. r=tnikkel MozReview-Commit-ID: Cn3paFTFo1O --HG-- extra : rebase_source : 58868e2aef582b4fb12d5dd8af72996863d3fc13 --- .../apz/test/mochitest/apz_test_utils.js | 19 ++++++ gfx/layers/apz/test/mochitest/mochitest.ini | 2 + .../apz/test/mochitest/test_bug1253683.html | 59 +++++++++++++++++++ .../apz/test/mochitest/test_layerization.html | 23 -------- 4 files changed, 80 insertions(+), 23 deletions(-) create mode 100644 gfx/layers/apz/test/mochitest/test_bug1253683.html diff --git a/gfx/layers/apz/test/mochitest/apz_test_utils.js b/gfx/layers/apz/test/mochitest/apz_test_utils.js index a97527f3a1df..b5ed7e077645 100644 --- a/gfx/layers/apz/test/mochitest/apz_test_utils.js +++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js @@ -81,6 +81,25 @@ function findRcdNode(apzcTree) { return null; } +// Return whether an element whose id includes |elementId| has been layerized. +// Assumes |elementId| will be present in the content description for the +// element, and not in the content descriptions of other elements. +function isLayerized(elementId) { + var contentTestData = SpecialPowers.getDOMWindowUtils(window).getContentAPZTestData(); + ok(contentTestData.paints.length > 0, "expected at least one paint"); + var seqno = contentTestData.paints[contentTestData.paints.length - 1].sequenceNumber; + contentTestData = convertTestData(contentTestData); + var paint = contentTestData.paints[seqno]; + for (var scrollId in paint) { + if ("contentDescription" in paint[scrollId]) { + if (paint[scrollId]["contentDescription"].includes(elementId)) { + return true; + } + } + } + return false; +} + function flushApzRepaints(aCallback, aWindow = window) { if (!aCallback) { throw "A callback must be provided!"; diff --git a/gfx/layers/apz/test/mochitest/mochitest.ini b/gfx/layers/apz/test/mochitest/mochitest.ini index b00b42596d24..c9cc058396f7 100644 --- a/gfx/layers/apz/test/mochitest/mochitest.ini +++ b/gfx/layers/apz/test/mochitest/mochitest.ini @@ -52,3 +52,5 @@ skip-if = (toolkit == 'android') # wheel events not supported on mobile [test_group_mouseevents.html] [test_touch_listeners_impacting_wheel.html] skip-if = (toolkit == 'android') || (toolkit == 'cocoa') # wheel events not supported on mobile, and synthesized wheel smooth-scrolling not supported on OS X +[test_bug1253683.html] +skip-if = (os == 'android') || (os == 'b2g') # uses wheel events which are not supported on mobile diff --git a/gfx/layers/apz/test/mochitest/test_bug1253683.html b/gfx/layers/apz/test/mochitest/test_bug1253683.html new file mode 100644 index 000000000000..52c8e4a960fe --- /dev/null +++ b/gfx/layers/apz/test/mochitest/test_bug1253683.html @@ -0,0 +1,59 @@ + + + + + Test to ensure non-scrollable frames don't get layerized + + + + + + + + +

+
+
sample code here
+
spacer to make the 'container' div the root scrollable element
+
+
+
+
+ + diff --git a/gfx/layers/apz/test/mochitest/test_layerization.html b/gfx/layers/apz/test/mochitest/test_layerization.html index 13af614328be..3ec426c94c40 100644 --- a/gfx/layers/apz/test/mochitest/test_layerization.html +++ b/gfx/layers/apz/test/mochitest/test_layerization.html @@ -58,29 +58,8 @@ function scrollWheelOver(element, waitForScroll, testDriver) { moveMouseAndScrollWheelOver(element, 10, 10, testDriver, waitForScroll); } -var utils; - const DISPLAYPORT_EXPIRY = 100; -// Return whether the element with id |elementId| has been layerized. -// Assumes |elementId| will be present in the content description for the -// element, and not in the content descriptions of other elements. -function isLayerized(elementId) { - var contentTestData = utils.getContentAPZTestData(); - ok(contentTestData.paints.length > 0, "expected at least one paint"); - var seqno = contentTestData.paints[contentTestData.paints.length - 1].sequenceNumber; - contentTestData = convertTestData(contentTestData); - var paint = contentTestData.paints[seqno]; - for (var scrollId in paint) { - if ("contentDescription" in paint[scrollId]) { - if (paint[scrollId]["contentDescription"].includes(elementId)) { - return true; - } - } - } - return false; -} - // This helper function produces another helper function, which, when invoked, // invokes the provided testDriver argument in a setTimeout 0. This is really // just useful in cases when there are no paints pending, because then @@ -94,8 +73,6 @@ function asyncWrapper(testDriver) { } function* test(testDriver) { - utils = SpecialPowers.getDOMWindowUtils(window); - // Initially, nothing should be layerized. ok(!isLayerized('outer1'), "initially 'outer1' should not be layerized"); ok(!isLayerized('inner1'), "initially 'inner1' should not be layerized");