mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-05-31 07:11:00 +02:00
fix: inline styles for hidden helper elements
Set layout-neutral styles at the creation sites for the hidden TextLayer canvas and PDFViewer copy element rather than relying on the shared web/pdf_viewer.css rule. This keeps the helper elements invisible and out of layout when viewer CSS selectors are scoped or omitted, and removes the obsolete hiddenCanvasElement class and shared CSS rule.
This commit is contained in:
parent
7ade637449
commit
16d82e094f
@ -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", {
|
||||
|
||||
@ -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). */
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user