Skip to content

Commit

Permalink
Remove the requestAnimationFrame polyfill
Browse files Browse the repository at this point in the history
According to https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#Browser_compatibility and https://caniuse.com/#feat=requestanimationframe, the browsers we intend to support with PDF.js version 2.0 should all have native `requestAnimationFrame` support.

Note that the reason for indiscriminately polyfilling `requestAnimationFrame` in iOS, see PR 4961, was apparently because of a bug in iOS 6.
However, according to [Wikipedia](https://en.wikipedia.org/wiki/IOS_version_history#iOS_8): "Support for iOS 8 ended in 2017.", hence the lowest version currently supported is iOS 9.
  • Loading branch information
Snuffleupagus committed Nov 15, 2017
1 parent f09f37f commit 4ab2ec2
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/shared/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,36 +531,6 @@ PDFJS.compatibilityChecked = true;
}
})();

// Support: IE<10, Android<4.0, iOS
(function checkRequestAnimationFrame() {
function installFakeAnimationFrameFunctions() {
window.requestAnimationFrame = function (callback) {
return window.setTimeout(callback, 20);
};
window.cancelAnimationFrame = function (timeoutID) {
window.clearTimeout(timeoutID);
};
}

if (!hasDOM) {
return;
}
if (isIOS) {
// requestAnimationFrame on iOS is broken, replacing with fake one.
installFakeAnimationFrameFunctions();
return;
}
if ('requestAnimationFrame' in window) {
return;
}
window.requestAnimationFrame = window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame;
if (window.requestAnimationFrame) {
return;
}
installFakeAnimationFrameFunctions();
})();

// Support: Android, iOS
(function checkCanvasSizeLimitation() {
if (isIOS || isAndroid) {
Expand Down

0 comments on commit 4ab2ec2

Please sign in to comment.