Bug 1181765. Remove uses of mozRequestAnimationFrame from layout tests. r=bkelly

This commit is contained in:
Boris Zbarsky 2015-07-14 15:28:58 -04:00
parent f9793d505e
commit 3dc492a257
9 changed files with 21 additions and 31 deletions

View File

@ -11,7 +11,7 @@
if (report) { if (report) {
opener.postMessage("callbackHappened", "*"); opener.postMessage("callbackHappened", "*");
} }
window.mozRequestAnimationFrame(g); window.requestAnimationFrame(g);
} }
g(); g();

View File

@ -21,24 +21,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=569520
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged"); SimpleTest.requestFlakyTimeout("untriaged");
var startNow = Date.now(); var start = window.performance.now();
var start = window.mozAnimationStartTime;
var firstListenerArg; var firstListenerArg;
var secondListenerArg; var secondListenerArg;
var thirdListenerTime; var thirdListenerTime;
// callback arg is wallclock from mozRequestAnimationFrame // callback arg is in the same timeline as performance.now()
function thirdListener(t) { function thirdListener(t) {
thirdListenerTime = t; thirdListenerTime = t;
// They really shouldn't be more than 100ms apart, but we can get weird ok(secondListenerArg >= firstListenerArg, // callback args from consecutive requestAnimationFrame
// effects on slow machines. 5 minutes is our test timeout, though.
ok(Math.abs(startNow - start) <= 5 * 60 * 1000, "Bogus animation start time");
ok(secondListenerArg >= firstListenerArg, // callback args from consecutive unprefixed requestAnimationFrame
"Second listener should fire after first listener"); "Second listener should fire after first listener");
ok(thirdListenerTime >= start, "Third listener should fire after start"); ok(thirdListenerTime >= secondListenerArg,
"Third listener should fire after second listener");
ok(firstListenerArg >= start, "First listener should fire after start");
SimpleTest.finish(); SimpleTest.finish();
} }
@ -46,7 +44,7 @@ function thirdListener(t) {
// callback arg is from requestAnimationFrame and comparable to performance.now() // callback arg is from requestAnimationFrame and comparable to performance.now()
function secondListener(t) { function secondListener(t) {
secondListenerArg = t; secondListenerArg = t;
mozRequestAnimationFrame(thirdListener); requestAnimationFrame(thirdListener);
} }
function firstListener(t) { function firstListener(t) {

View File

@ -21,24 +21,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=569520
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged"); SimpleTest.requestFlakyTimeout("untriaged");
var startNow = Date.now(); var start = window.performance.now();
var start = window.mozAnimationStartTime;
var firstListenerArg; var firstListenerArg;
var secondListenerArg; var secondListenerArg;
var thirdListenerTime; var thirdListenerTime;
// callback arg is wallclock from mozRequestAnimationFrame // callback arg is in the same timeline as performance.now()
function thirdListener(t) { function thirdListener(t) {
thirdListenerTime = t; thirdListenerTime = t;
// They really shouldn't be more than 100ms apart, but we can get weird ok(secondListenerArg >= firstListenerArg, // callback args from consecutive requestAnimationFrame
// effects on slow machines. 5 minutes is our test timeout, though.
ok(Math.abs(startNow - start) <= 5 * 60 * 1000, "Bogus animation start time");
ok(secondListenerArg >= firstListenerArg, // callback args from consecutive unprefixed requestAnimationFrame
"Second listener should fire after first listener"); "Second listener should fire after first listener");
ok(thirdListenerTime >= start, "Third listener should fire after start"); ok(thirdListenerTime >= secondListenerArg,
"Third listener should fire after second listener");
ok(firstListenerArg >= start, "First listener should fire after start");
SimpleTest.finish(); SimpleTest.finish();
} }
@ -46,7 +44,7 @@ function thirdListener(t) {
// callback arg is from requestAnimationFrame and comparable to performance.now() // callback arg is from requestAnimationFrame and comparable to performance.now()
function secondListener(t) { function secondListener(t) {
secondListenerArg = t; secondListenerArg = t;
mozRequestAnimationFrame(thirdListener); requestAnimationFrame(thirdListener);
} }
function firstListener(t) { function firstListener(t) {

View File

@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607529
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
/* General idea: Open a new window (needed because we don't bfcache /* General idea: Open a new window (needed because we don't bfcache
subframes) that uses mozRequestAnimationFrame, navigate it, navigate it subframes) that uses requestAnimationFrame, navigate it, navigate it
back, and verify that the animations are still running. */ back, and verify that the animations are still running. */
var doneOneLoad = false; var doneOneLoad = false;

View File

@ -42,7 +42,7 @@ function onScroll() {
function doTest() { function doTest() {
window.getSelection().collapse(inner.firstChild, 0); window.getSelection().collapse(inner.firstChild, 0);
window.mozRequestAnimationFrame(onFrame); window.requestAnimationFrame(onFrame);
d.onscroll = onScroll; d.onscroll = onScroll;
sendKey("DOWN"); sendKey("DOWN");
} }
@ -50,7 +50,7 @@ function doTest() {
function prepareTest() { function prepareTest() {
// Start the test after we've gotten at least one rAF callback, to make sure // Start the test after we've gotten at least one rAF callback, to make sure
// that rAF is no longer throttled. (See bug 1145439.) // that rAF is no longer throttled. (See bug 1145439.)
window.mozRequestAnimationFrame(function() { window.requestAnimationFrame(function() {
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, doTest); SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, doTest);
}); });
} }

View File

@ -48,7 +48,7 @@ function runTest() {
// Delay until next repaint in case stuff is asynchronous. Also // Delay until next repaint in case stuff is asynchronous. Also
// take a trip through the event loop. // take a trip through the event loop.
setTimeout(function() { setTimeout(function() {
window.mozRequestAnimationFrame(function() { window.requestAnimationFrame(function() {
is(sel.anchorNode, target.firstChild, "Should have selected 'target' text node"); is(sel.anchorNode, target.firstChild, "Should have selected 'target' text node");
is(sel.anchorOffset, 1, "Selection should have moved left one character"); is(sel.anchorOffset, 1, "Selection should have moved left one character");
// We should not have needed to scroll the caret into view // We should not have needed to scroll the caret into view

View File

@ -5,8 +5,6 @@ var property = "left";
var rfa = null; var rfa = null;
if (window.requestAnimationFrame) { if (window.requestAnimationFrame) {
rfa = requestAnimationFrame; rfa = requestAnimationFrame;
} else if (window.mozRequestAnimationFrame) {
rfa = mozRequestAnimationFrame;
} else if (window.webkitRequestAnimationFrame) { } else if (window.webkitRequestAnimationFrame) {
rfa = webkitRequestAnimationFrame; rfa = webkitRequestAnimationFrame;
} else if (window.msRequestAnimationFrame) { } else if (window.msRequestAnimationFrame) {

View File

@ -1,8 +1,6 @@
var rfa = null; var rfa = null;
if (window.requestAnimationFrame) { if (window.requestAnimationFrame) {
rfa = requestAnimationFrame; rfa = requestAnimationFrame;
} else if (window.mozRequestAnimationFrame) {
rfa = mozRequestAnimationFrame;
} else if (window.webkitRequestAnimationFrame) { } else if (window.webkitRequestAnimationFrame) {
rfa = webkitRequestAnimationFrame; rfa = webkitRequestAnimationFrame;
} else if (window.msRequestAnimationFrame) { } else if (window.msRequestAnimationFrame) {

View File

@ -5,8 +5,6 @@ var property = "top";
var rfa = null; var rfa = null;
if (window.requestAnimationFrame) { if (window.requestAnimationFrame) {
rfa = requestAnimationFrame; rfa = requestAnimationFrame;
} else if (window.mozRequestAnimationFrame) {
rfa = mozRequestAnimationFrame;
} else if (window.webkitRequestAnimationFrame) { } else if (window.webkitRequestAnimationFrame) {
rfa = webkitRequestAnimationFrame; rfa = webkitRequestAnimationFrame;
} else if (window.msRequestAnimationFrame) { } else if (window.msRequestAnimationFrame) {