[TextLayer] Immediately set the padding, rather than checking if it's empty, in expandTextDivs

In practice it's extremely rare[1] for the padding to be zero in *all* components, hence it seems better to just set it directly rather than creating a temporary variable and checking for the "no padding"-case.

---
[1] In the `tracemonkey.pdf` file that only happens with `0.08%` of all text elements.
This commit is contained in:
Jonas Jenwald 2020-02-11 15:52:36 +01:00
parent 10be0997a7
commit 7b0836ca75

View File

@ -658,7 +658,6 @@ var renderTextLayer = (function renderTextLayerClosure() {
expand(this);
this._bounds = null;
}
const NO_PADDING = "0 0 0 0";
const transformBuf = [],
paddingBuf = [];
@ -701,10 +700,7 @@ var renderTextLayer = (function renderTextLayerClosure() {
paddingBuf.push(0);
}
const padding = paddingBuf.join(" ");
if (padding !== NO_PADDING) {
div.style.padding = padding;
}
div.style.padding = paddingBuf.join(" ");
if (transformBuf.length) {
div.style.transform = transformBuf.join(" ");
}