Merge pull request #16311 from linxianxi/fix-viewer-browser-compatibility

Compatible with ResizeObserver borderBoxSize in legacy safari
This commit is contained in:
Jonas Jenwald 2023-04-18 13:05:13 +02:00 committed by GitHub
commit 88e2d04b90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2169,7 +2169,14 @@ class PDFViewer {
for (const entry of entries) {
if (entry.target === this.container) {
this.#updateContainerHeightCss(
Math.floor(entry.borderBoxSize[0].blockSize)
// 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
)
);
this.#containerTopLeft = null;
break;