Compatible with ResizeObserver borderBoxSize in legacy safari

See https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/borderBoxSize\#browser_compatibility
This commit is contained in:
linxianxi 2023-04-18 17:40:26 +08:00
parent f1b005d7b8
commit 6ca702d680

View File

@ -2169,7 +2169,14 @@ 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(
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; this.#containerTopLeft = null;
break; break;