Skip to content

Commit

Permalink
Merge pull request mozilla#16311 from linxianxi/fix-viewer-browser-co…
Browse files Browse the repository at this point in the history
…mpatibility

Compatible with ResizeObserver borderBoxSize in legacy safari
  • Loading branch information
Snuffleupagus authored Apr 18, 2023
2 parents f1b005d + 6ca702d commit 88e2d04
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/pdf_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 88e2d04

Please sign in to comment.