Optimize text layer: Avoid unneeded .textContent

Built-in DOM properties are slower than plain JS properties.
A few lines before, textContent is assigned as follows:
  textDiv.textContent = geom.str;
So replacing textDiv.textContent.length with geom.str.length slightly
improves performance without side effects.
This commit is contained in:
Rob Wu 2015-07-25 10:48:30 +02:00
parent 862342189f
commit 47f2c14723

View File

@ -197,7 +197,7 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() {
// We don't bother scaling single-char text divs, because it has very
// little effect on text highlighting. This makes scrolling on docs with
// lots of such divs a lot faster.
if (textDiv.textContent.length > 1) {
if (geom.str.length > 1) {
if (style.vertical) {
textDiv.dataset.canvasWidth = geom.height * this.viewport.scale;
} else {