Skip to content

Commit

Permalink
Disables broken rAF on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed Jun 17, 2014
1 parent ea16723 commit dccc709
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.

This comment has been minimized.

Copy link
@mgol

mgol Jun 17, 2014

Contributor

What do you mean by "broken" here?

This comment has been minimized.

Copy link
@yurydelendik

yurydelendik Jun 17, 2014

Author Contributor

I was not able to run the viewer on iOS7.1 It never called rAF during rendering.

This comment has been minimized.

This comment has been minimized.

Copy link
@mgol

mgol Jun 17, 2014

Contributor

Ouch, so it wasn't fixed in iOS7. :/

Thanks for the info.

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 dccc709

Please sign in to comment.