Skip to content

Commit

Permalink
Merge pull request #4961 from yurydelendik/raf-ios
Browse files Browse the repository at this point in the history
Disables broken rAF on iOS
  • Loading branch information
Snuffleupagus committed Jun 17, 2014
2 parents b160e85 + dccc709 commit bab40ca
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions web/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,25 @@ if (typeof PDFJS === 'undefined') {
}
})();

// Support: IE<10, Android<4.0, iOS<5.0
// Support: IE<10, Android<4.0, iOS
(function checkRequestAnimationFrame() {
function fakeRequestAnimationFrame(callback) {
window.setTimeout(callback, 20);
}

var isIOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
if (isIOS) {
// requestAnimationFrame on iOS is broken, replacing with fake one.
window.requestAnimationFrame = fakeRequestAnimationFrame;
return;
}
if ('requestAnimationFrame' in window) {
return;
}
window.requestAnimationFrame =
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
(function fakeRequestAnimationFrame(callback) {
window.setTimeout(callback, 20);
});
fakeRequestAnimationFrame;
})();

(function checkCanvasSizeLimitation() {
Expand Down

0 comments on commit bab40ca

Please sign in to comment.