Skip to content

Commit

Permalink
Merge pull request mozilla#16401 from Snuffleupagus/Safari-15.4
Browse files Browse the repository at this point in the history
[api-minor] Update the minimum supported Safari version to 15.4
  • Loading branch information
timvandermeij authored May 12, 2023
2 parents 9417a37 + d1adab8 commit a5336d9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 66 deletions.
12 changes: 1 addition & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const ENV_TARGETS = [
"last 2 versions",
"Chrome >= 88",
"Firefox ESR",
"Safari >= 14.1",
"Safari >= 15.4",
"Node >= 18",
"> 1%",
"not IE > 0",
Expand Down Expand Up @@ -192,8 +192,6 @@ function createWebpackConfig(
DEFAULT_PREFERENCES: defaultPreferencesDir
? getDefaultPreferences(defaultPreferencesDir)
: {},
DIALOG_POLYFILL_CSS:
defines.GENERIC && !defines.SKIP_BABEL ? getDialogPolyfillCSS() : "",
});
const licenseHeaderLibre = fs
.readFileSync("./src/license_header_libre.js")
Expand Down Expand Up @@ -821,12 +819,6 @@ function getDefaultPreferences(dir) {
return AppOptions.getAll(OptionKind.PREFERENCE);
}

function getDialogPolyfillCSS() {
return fs
.readFileSync("node_modules/dialog-polyfill/dist/dialog-polyfill.css")
.toString();
}

gulp.task("locale", function () {
const VIEWER_LOCALE_OUTPUT = "web/locale/";

Expand Down Expand Up @@ -1585,8 +1577,6 @@ function buildLib(defines, dir) {
DEFAULT_PREFERENCES: getDefaultPreferences(
defines.SKIP_BABEL ? "lib/" : "lib-legacy/"
),
DIALOG_POLYFILL_CSS:
defines.GENERIC && !defines.SKIP_BABEL ? getDialogPolyfillCSS() : "",
});

const inputStream = merge([
Expand Down
37 changes: 12 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"canvas": "^2.11.2",
"core-js": "^3.30.1",
"cross-env": "^7.0.3",
"dialog-polyfill": "^0.5.6",
"es-module-shims": "1.4.7",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
Expand Down
6 changes: 3 additions & 3 deletions src/shared/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ import { isNodeJS } from "./is_node.js";
polyfillPath2D(globalThis);
})();

// Support: Chrome<92, Safari<15.4
// Support: Chrome<92
(function checkArrayAt() {
if (Array.prototype.at) {
return;
}
require("core-js/es/array/at.js");
})();

// Support: Chrome<92, Safari<15.4
// Support: Chrome<92
(function checkTypedArrayAt() {
if (Uint8Array.prototype.at) {
return;
}
require("core-js/es/typed-array/at.js");
})();

// Support: Chrome<98, Safari<15.4
// Support: Chrome<98
(function checkStructuredClone() {
if (globalThis.structuredClone) {
return;
Expand Down
18 changes: 0 additions & 18 deletions web/overlay_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,6 @@ class OverlayManager {
}
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 => {
this.#active = null;
});
Expand Down
9 changes: 1 addition & 8 deletions web/pdf_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2180,14 +2180,7 @@ class PDFViewer {
for (const entry of entries) {
if (entry.target === this.container) {
this.#updateContainerHeightCss(
// Safari doesn't support `borderBoxSize` until version 15.4.
Math.floor(
typeof PDFJSDev !== "undefined" &&
!PDFJSDev.test("SKIP_BABEL") &&
!entry.borderBoxSize?.length
? entry.contentRect.height
: entry.borderBoxSize[0].blockSize
)
Math.floor(entry.borderBoxSize[0].blockSize)
);
this.#containerTopLeft = null;
break;
Expand Down

0 comments on commit a5336d9

Please sign in to comment.