Bug 1181762. Remove uses of mozRequestAnimationFrame from toolkit code. r=gijs

This commit is contained in:
Boris Zbarsky 2015-07-14 15:28:57 -04:00
Родитель f9686558d6
Коммит 64fe037420
5 изменённых файлов: 20 добавлений и 23 удалений

Просмотреть файл

@ -29,6 +29,7 @@ let ClickEventHandler = {
this._screenX = null;
this._screenY = null;
this._lastFrame = null;
this.autoscrollLoop = this.autoscrollLoop.bind(this);
Services.els.addSystemEventListener(global, "mousedown", this, true);
@ -142,9 +143,9 @@ let ClickEventHandler = {
this._screenY = event.screenY;
this._scrollErrorX = 0;
this._scrollErrorY = 0;
this._lastFrame = content.mozAnimationStartTime;
this._lastFrame = content.performance.now();
content.mozRequestAnimationFrame(this);
content.requestAnimationFrame(this.autoscrollLoop);
},
stopScroll: function() {
@ -211,11 +212,7 @@ let ClickEventHandler = {
this._scrollable.scrollLeft += actualScrollX;
this._scrollable.scrollTop += actualScrollY;
}
content.mozRequestAnimationFrame(this);
},
sample: function(timestamp) {
this.autoscrollLoop(timestamp);
content.requestAnimationFrame(this.autoscrollLoop);
},
handleEvent: function(event) {

Просмотреть файл

@ -43,7 +43,7 @@ function test()
var skipFrames = 1;
var checkScroll = function () {
if (skipFrames--) {
window.mozRequestAnimationFrame(checkScroll);
window.requestAnimationFrame(checkScroll);
return;
}
ok(elem.scrollTop == 0, "element should not have scrolled vertically");
@ -70,6 +70,6 @@ function test()
* so request and force redraws to get the chance to check for scrolling at
* all.
*/
window.mozRequestAnimationFrame(checkScroll);
window.requestAnimationFrame(checkScroll);
}
}

Просмотреть файл

@ -117,7 +117,7 @@ function test()
// although it also depends on acceleration, which here in this test
// should be > 1 due to how it synthesizes mouse events below.
if (timeCompensation < 5) {
window.mozRequestAnimationFrame(checkScroll);
window.requestAnimationFrame(checkScroll);
return;
}
@ -174,7 +174,7 @@ function test()
Services.prefs.clearUserPref("middlemouse.paste");
// Start checking for the scroll.
window.mozRequestAnimationFrame(checkScroll);
window.requestAnimationFrame(checkScroll);
}
waitForExplicitFinish();

Просмотреть файл

@ -74,7 +74,7 @@
document.getAnonymousElementByAttribute(this, "anonid", "spacer");
var isLTR =
document.defaultView.getComputedStyle(this, null).direction == "ltr";
var startTime = window.mozAnimationStartTime;
var startTime = performance.now();
var self = this;
function nextStep(t) {
@ -83,7 +83,7 @@
if (!width) {
// Maybe we've been removed from the document.
if (self._alive)
mozRequestAnimationFrame(nextStep);
requestAnimationFrame(nextStep);
return;
}
@ -101,11 +101,11 @@
spacer.width = width;
spacer.left = width * position;
mozRequestAnimationFrame(nextStep);
requestAnimationFrame(nextStep);
} catch (e) {
}
}
mozRequestAnimationFrame(nextStep);
requestAnimationFrame(nextStep);
]]></body>
</method>

Просмотреть файл

@ -292,13 +292,13 @@
this.distance = distance;
this.startPos = this.scrollbox.scrollPosition;
this.duration = Math.min(1000, Math.round(50 * Math.sqrt(Math.abs(distance))));
this.startTime = window.mozAnimationStartTime;
this.startTime = window.performance.now();
if (!this.requestHandle)
this.requestHandle = window.mozRequestAnimationFrame(this);
this.requestHandle = window.requestAnimationFrame(this.sample.bind(this));
},
stop: function scrollAnim_stop() {
window.mozCancelAnimationFrame(this.requestHandle);
window.cancelAnimationFrame(this.requestHandle);
this.requestHandle = 0;
},
sample: function scrollAnim_handleEvent(timeStamp) {
@ -311,7 +311,7 @@
if (pos == 1)
this.scrollbox._stopSmoothScroll();
else
this.requestHandle = window.mozRequestAnimationFrame(this);
this.requestHandle = window.requestAnimationFrame(this.sample.bind(this));
}
})]]></field>
@ -677,12 +677,12 @@
scrollbox: this,
requestHandle: 0, /* 0 indicates there is no pending request */
start: function arrowSmoothScroll_start() {
this.lastFrameTime = window.mozAnimationStartTime;
this.lastFrameTime = window.performance.now();
if (!this.requestHandle)
this.requestHandle = window.mozRequestAnimationFrame(this);
this.requestHandle = window.requestAnimationFrame(this.sample.bind(this));
},
stop: function arrowSmoothScroll_stop() {
window.mozCancelAnimationFrame(this.requestHandle);
window.cancelAnimationFrame(this.requestHandle);
this.requestHandle = 0;
},
sample: function arrowSmoothScroll_handleEvent(timeStamp) {
@ -693,7 +693,7 @@
const scrollDelta = 0.5 * timePassed * scrollIndex;
this.scrollbox.scrollPosition += scrollDelta;
this.requestHandle = window.mozRequestAnimationFrame(this);
this.requestHandle = window.requestAnimationFrame(this.sample.bind(this));
}
})]]></field>