Merge pull request #21218 from RolandWArnold/fix/text-layer-hidden-canvas-layout-neutral

Ensure TextLayer hiddenCanvasElement is layout-neutral by default
This commit is contained in:
calixteman 2026-05-14 22:11:06 +02:00 committed by GitHub
commit cd4fd7563c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 11 deletions

View File

@ -472,7 +472,8 @@ class TextLayer {
// their replacements when they aren't embedded) and then we can use an
// OffscreenCanvas.
const canvas = document.createElement("canvas");
canvas.className = "hiddenCanvasElement";
canvas.style.cssText =
"position:absolute;top:0;left:0;width:0;height:0;display:none";
canvas.lang = lang;
document.body.append(canvas);
ctx = canvas.getContext("2d", {

View File

@ -78,16 +78,6 @@
transform: rotate(270deg) translateX(-100%);
}
#hiddenCopyElement,
.hiddenCanvasElement {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
display: none;
}
.pdfViewer {
/* Define this variable here and not in :root to avoid to reflow all the UI
when scaling (see #15929). */

View File

@ -967,6 +967,8 @@ class PDFViewer {
const element = (this.#hiddenCopyElement =
document.createElement("div"));
element.id = "hiddenCopyElement";
element.style.cssText =
"position:absolute;top:0;left:0;width:0;height:0;display:none";
viewer.before(element);
}