mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 23:28:06 +02:00
Uses rAF to interrupt the operator list execution
This commit is contained in:
parent
abc924b5af
commit
c5eb058b09
4 changed files with 28 additions and 18 deletions
|
@ -564,3 +564,15 @@ if (typeof PDFJS === 'undefined') {
|
|||
console.log('Unable to create polyfill for localStorage');
|
||||
}
|
||||
})();
|
||||
|
||||
(function checkRequestAnimationFrame() {
|
||||
if ('requestAnimationFrame' in window) {
|
||||
return;
|
||||
}
|
||||
window.requestAnimationFrame =
|
||||
window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
|
||||
(function fakeRequestAnimationFrame(callback) {
|
||||
window.setTimeout(callback, 20);
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -2410,16 +2410,8 @@ window.addEventListener('afterprint', function afterPrint(evt) {
|
|||
(function animationStartedClosure() {
|
||||
// The offsetParent is not set until the pdf.js iframe or object is visible.
|
||||
// Waiting for first animation.
|
||||
var requestAnimationFrame = window.requestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame ||
|
||||
function startAtOnce(callback) { callback(); };
|
||||
PDFView.animationStartedPromise = new Promise(function (resolve) {
|
||||
requestAnimationFrame(function onAnimationFrame() {
|
||||
resolve();
|
||||
});
|
||||
window.requestAnimationFrame(resolve);
|
||||
});
|
||||
})();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue