Merge pull request #16401 from Snuffleupagus/Safari-15.4

[api-minor] Update the minimum supported Safari version to 15.4
This commit is contained in:
Tim van der Meij 2023-05-12 10:11:53 +02:00 committed by GitHub
commit a5336d9d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 66 deletions

View File

@ -79,7 +79,7 @@ const ENV_TARGETS = [
"last 2 versions", "last 2 versions",
"Chrome >= 88", "Chrome >= 88",
"Firefox ESR", "Firefox ESR",
"Safari >= 14.1", "Safari >= 15.4",
"Node >= 18", "Node >= 18",
"> 1%", "> 1%",
"not IE > 0", "not IE > 0",
@ -192,8 +192,6 @@ function createWebpackConfig(
DEFAULT_PREFERENCES: defaultPreferencesDir DEFAULT_PREFERENCES: defaultPreferencesDir
? getDefaultPreferences(defaultPreferencesDir) ? getDefaultPreferences(defaultPreferencesDir)
: {}, : {},
DIALOG_POLYFILL_CSS:
defines.GENERIC && !defines.SKIP_BABEL ? getDialogPolyfillCSS() : "",
}); });
const licenseHeaderLibre = fs const licenseHeaderLibre = fs
.readFileSync("./src/license_header_libre.js") .readFileSync("./src/license_header_libre.js")
@ -821,12 +819,6 @@ function getDefaultPreferences(dir) {
return AppOptions.getAll(OptionKind.PREFERENCE); return AppOptions.getAll(OptionKind.PREFERENCE);
} }
function getDialogPolyfillCSS() {
return fs
.readFileSync("node_modules/dialog-polyfill/dist/dialog-polyfill.css")
.toString();
}
gulp.task("locale", function () { gulp.task("locale", function () {
const VIEWER_LOCALE_OUTPUT = "web/locale/"; const VIEWER_LOCALE_OUTPUT = "web/locale/";
@ -1585,8 +1577,6 @@ function buildLib(defines, dir) {
DEFAULT_PREFERENCES: getDefaultPreferences( DEFAULT_PREFERENCES: getDefaultPreferences(
defines.SKIP_BABEL ? "lib/" : "lib-legacy/" defines.SKIP_BABEL ? "lib/" : "lib-legacy/"
), ),
DIALOG_POLYFILL_CSS:
defines.GENERIC && !defines.SKIP_BABEL ? getDialogPolyfillCSS() : "",
}); });
const inputStream = merge([ const inputStream = merge([

37
package-lock.json generated
View File

@ -20,7 +20,6 @@
"canvas": "^2.11.2", "canvas": "^2.11.2",
"core-js": "^3.30.1", "core-js": "^3.30.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"dialog-polyfill": "^0.5.6",
"es-module-shims": "1.4.7", "es-module-shims": "1.4.7",
"eslint": "^8.39.0", "eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
@ -5030,12 +5029,6 @@
"kuler": "1.0.x" "kuler": "1.0.x"
} }
}, },
"node_modules/dialog-polyfill": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/dialog-polyfill/-/dialog-polyfill-0.5.6.tgz",
"integrity": "sha512-ZbVDJI9uvxPAKze6z146rmfUZjBqNEwcnFTVamQzXH+svluiV7swmVIGr7miwADgfgt1G2JQIytypM9fbyhX4w==",
"dev": true
},
"node_modules/dir-glob": { "node_modules/dir-glob": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@ -12506,7 +12499,7 @@
}, },
"node_modules/npm/node_modules/lodash._baseindexof": { "node_modules/npm/node_modules/lodash._baseindexof": {
"version": "3.1.0", "version": "3.1.0",
"dev": true, "extraneous": true,
"inBundle": true, "inBundle": true,
"license": "MIT" "license": "MIT"
}, },
@ -12522,19 +12515,19 @@
}, },
"node_modules/npm/node_modules/lodash._bindcallback": { "node_modules/npm/node_modules/lodash._bindcallback": {
"version": "3.0.1", "version": "3.0.1",
"dev": true, "extraneous": true,
"inBundle": true, "inBundle": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/npm/node_modules/lodash._cacheindexof": { "node_modules/npm/node_modules/lodash._cacheindexof": {
"version": "3.0.2", "version": "3.0.2",
"dev": true, "extraneous": true,
"inBundle": true, "inBundle": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/npm/node_modules/lodash._createcache": { "node_modules/npm/node_modules/lodash._createcache": {
"version": "3.1.2", "version": "3.1.2",
"dev": true, "extraneous": true,
"inBundle": true, "inBundle": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -12549,7 +12542,7 @@
}, },
"node_modules/npm/node_modules/lodash._getnative": { "node_modules/npm/node_modules/lodash._getnative": {
"version": "3.9.1", "version": "3.9.1",
"dev": true, "extraneous": true,
"inBundle": true, "inBundle": true,
"license": "MIT" "license": "MIT"
}, },
@ -12567,7 +12560,7 @@
}, },
"node_modules/npm/node_modules/lodash.restparam": { "node_modules/npm/node_modules/lodash.restparam": {
"version": "3.6.1", "version": "3.6.1",
"dev": true, "extraneous": true,
"inBundle": true, "inBundle": true,
"license": "MIT" "license": "MIT"
}, },
@ -23031,12 +23024,6 @@
"kuler": "1.0.x" "kuler": "1.0.x"
} }
}, },
"dialog-polyfill": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/dialog-polyfill/-/dialog-polyfill-0.5.6.tgz",
"integrity": "sha512-ZbVDJI9uvxPAKze6z146rmfUZjBqNEwcnFTVamQzXH+svluiV7swmVIGr7miwADgfgt1G2JQIytypM9fbyhX4w==",
"dev": true
},
"dir-glob": { "dir-glob": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@ -28769,7 +28756,7 @@
"lodash._baseindexof": { "lodash._baseindexof": {
"version": "3.1.0", "version": "3.1.0",
"bundled": true, "bundled": true,
"dev": true "extraneous": true
}, },
"lodash._baseuniq": { "lodash._baseuniq": {
"version": "4.6.0", "version": "4.6.0",
@ -28783,17 +28770,17 @@
"lodash._bindcallback": { "lodash._bindcallback": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"dev": true "extraneous": true
}, },
"lodash._cacheindexof": { "lodash._cacheindexof": {
"version": "3.0.2", "version": "3.0.2",
"bundled": true, "bundled": true,
"dev": true "extraneous": true
}, },
"lodash._createcache": { "lodash._createcache": {
"version": "3.1.2", "version": "3.1.2",
"bundled": true, "bundled": true,
"dev": true, "extraneous": true,
"requires": { "requires": {
"lodash._getnative": "^3.0.0" "lodash._getnative": "^3.0.0"
} }
@ -28806,7 +28793,7 @@
"lodash._getnative": { "lodash._getnative": {
"version": "3.9.1", "version": "3.9.1",
"bundled": true, "bundled": true,
"dev": true "extraneous": true
}, },
"lodash._root": { "lodash._root": {
"version": "3.0.1", "version": "3.0.1",
@ -28821,7 +28808,7 @@
"lodash.restparam": { "lodash.restparam": {
"version": "3.6.1", "version": "3.6.1",
"bundled": true, "bundled": true,
"dev": true "extraneous": true
}, },
"lodash.union": { "lodash.union": {
"version": "4.6.0", "version": "4.6.0",

View File

@ -13,7 +13,6 @@
"canvas": "^2.11.2", "canvas": "^2.11.2",
"core-js": "^3.30.1", "core-js": "^3.30.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"dialog-polyfill": "^0.5.6",
"es-module-shims": "1.4.7", "es-module-shims": "1.4.7",
"eslint": "^8.39.0", "eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",

View File

@ -36,7 +36,7 @@ import { isNodeJS } from "./is_node.js";
polyfillPath2D(globalThis); polyfillPath2D(globalThis);
})(); })();
// Support: Chrome<92, Safari<15.4 // Support: Chrome<92
(function checkArrayAt() { (function checkArrayAt() {
if (Array.prototype.at) { if (Array.prototype.at) {
return; return;
@ -44,7 +44,7 @@ import { isNodeJS } from "./is_node.js";
require("core-js/es/array/at.js"); require("core-js/es/array/at.js");
})(); })();
// Support: Chrome<92, Safari<15.4 // Support: Chrome<92
(function checkTypedArrayAt() { (function checkTypedArrayAt() {
if (Uint8Array.prototype.at) { if (Uint8Array.prototype.at) {
return; return;
@ -52,7 +52,7 @@ import { isNodeJS } from "./is_node.js";
require("core-js/es/typed-array/at.js"); require("core-js/es/typed-array/at.js");
})(); })();
// Support: Chrome<98, Safari<15.4 // Support: Chrome<98
(function checkStructuredClone() { (function checkStructuredClone() {
if (globalThis.structuredClone) { if (globalThis.structuredClone) {
return; return;

View File

@ -37,24 +37,6 @@ class OverlayManager {
} }
this.#overlays.set(dialog, { canForceClose }); this.#overlays.set(dialog, { canForceClose });
if (
typeof PDFJSDev !== "undefined" &&
PDFJSDev.test("GENERIC && !SKIP_BABEL") &&
!dialog.showModal
) {
const dialogPolyfill = require("dialog-polyfill/dist/dialog-polyfill.js");
dialogPolyfill.registerDialog(dialog);
if (!this._dialogPolyfillCSS) {
this._dialogPolyfillCSS = true;
const style = document.createElement("style");
style.textContent = PDFJSDev.eval("DIALOG_POLYFILL_CSS");
document.head.prepend(style);
}
}
dialog.addEventListener("cancel", evt => { dialog.addEventListener("cancel", evt => {
this.#active = null; this.#active = null;
}); });

View File

@ -2180,14 +2180,7 @@ class PDFViewer {
for (const entry of entries) { for (const entry of entries) {
if (entry.target === this.container) { if (entry.target === this.container) {
this.#updateContainerHeightCss( this.#updateContainerHeightCss(
// Safari doesn't support `borderBoxSize` until version 15.4. Math.floor(entry.borderBoxSize[0].blockSize)
Math.floor(
typeof PDFJSDev !== "undefined" &&
!PDFJSDev.test("SKIP_BABEL") &&
!entry.borderBoxSize?.length
? entry.contentRect.height
: entry.borderBoxSize[0].blockSize
)
); );
this.#containerTopLeft = null; this.#containerTopLeft = null;
break; break;