1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

Remove the CustomStyle class

It is only used in a few places to handle prefixing style properties if
necessary. However, we used it only for `transform`, `transformOrigin`
and `borderRadius`, which according to Can I Use are supported natively
(unprefixed) in the browsers that PDF.js 2.0 supports. Therefore, we can
remove this class, which should help performance too since this avoids
extra function calls in parts of the code that are called often.
This commit is contained in:
Tim van der Meij 2017-12-31 13:51:51 +01:00
parent 3f88bfcda6
commit d36c46b2c9
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
6 changed files with 22 additions and 83 deletions

View file

@ -18,8 +18,7 @@ import {
RendererType, roundToDivide
} from './ui_utils';
import {
createPromiseCapability, CustomStyle, PDFJS, RenderingCancelledException,
SVGGraphics
createPromiseCapability, PDFJS, RenderingCancelledException, SVGGraphics
} from 'pdfjs-lib';
import { getGlobalEventBus } from './dom_events';
import { RenderingStates } from './pdf_rendering_queue';
@ -280,7 +279,7 @@ class PDFPageView {
}
let cssTransform = 'rotate(' + relativeRotation + 'deg) ' +
'scale(' + scaleX + ',' + scaleY + ')';
CustomStyle.setProp('transform', target, cssTransform);
target.style.transform = cssTransform;
if (this.textLayer) {
// Rotating the text layer is more complicated since the divs inside the
@ -317,11 +316,12 @@ class PDFPageView {
console.error('Bad rotation value.');
break;
}
CustomStyle.setProp('transform', textLayerDiv,
'rotate(' + textAbsRotation + 'deg) ' +
'scale(' + scale + ', ' + scale + ') ' +
'translate(' + transX + ', ' + transY + ')');
CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');
textLayerDiv.style.transform =
'rotate(' + textAbsRotation + 'deg) ' +
'scale(' + scale + ', ' + scale + ') ' +
'translate(' + transX + ', ' + transY + ')';
textLayerDiv.style.transformOrigin = '0% 0%';
}
if (redrawAnnotations && this.annotationLayer) {