mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-05-13 13:54:05 +02:00
Merge pull request #20492 from nicolo-ribaudo/simplify-markedcontent-text-layer
Simplify positioning of elements inside `markedContent`
This commit is contained in:
commit
ff4529d127
@ -346,14 +346,8 @@ class TextLayer {
|
||||
const divStyle = textDiv.style;
|
||||
// Setting the style properties individually, rather than all at once,
|
||||
// should be OK since the `textDiv` isn't appended to the document yet.
|
||||
if (this.#container === this.#rootContainer) {
|
||||
divStyle.left = `${((100 * left) / this.#pageWidth).toFixed(2)}%`;
|
||||
divStyle.top = `${((100 * top) / this.#pageHeight).toFixed(2)}%`;
|
||||
} else {
|
||||
// We're in a marked content span, hence we can't use percents.
|
||||
divStyle.left = `calc(var(--total-scale-factor) * ${left.toFixed(2)}px)`;
|
||||
divStyle.top = `calc(var(--total-scale-factor) * ${top.toFixed(2)}px)`;
|
||||
}
|
||||
divStyle.left = `${((100 * left) / this.#pageWidth).toFixed(2)}%`;
|
||||
divStyle.top = `${((100 * top) / this.#pageHeight).toFixed(2)}%`;
|
||||
divStyle.setProperty("--font-height", `${fontHeight.toFixed(2)}px`);
|
||||
divStyle.fontFamily = fontFamily;
|
||||
|
||||
|
||||
@ -59,14 +59,9 @@
|
||||
scale(var(--min-font-size-inv));
|
||||
}
|
||||
|
||||
/* Only necessary in Google Chrome, see issue 14205, and most unfortunately
|
||||
* the problem doesn't show up in "text" reference tests. */
|
||||
/*#if !MOZCENTRAL*/
|
||||
span.markedContent {
|
||||
top: 0;
|
||||
height: 0;
|
||||
.markedContent {
|
||||
display: contents;
|
||||
}
|
||||
/*#endif*/
|
||||
|
||||
span[role="img"] {
|
||||
user-select: none;
|
||||
|
||||
@ -321,6 +321,7 @@ class TextLayerBuilder {
|
||||
if (endDiv) {
|
||||
endDiv.style.width = parentTextLayer.style.width;
|
||||
endDiv.style.height = parentTextLayer.style.height;
|
||||
endDiv.style.userSelect = "text";
|
||||
anchor.parentElement.insertBefore(
|
||||
endDiv,
|
||||
modifyStart ? anchor : anchor.nextSibling
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user