Move the pdfBug option from the global PDFJS object and into getDocument instead

Also removes the now unused `getDefaultSetting` helper function.
This commit is contained in:
Jonas Jenwald 2018-02-17 23:13:49 +01:00
parent 1d03ad0060
commit 212553840f
7 changed files with 33 additions and 44 deletions

View file

@ -14,7 +14,7 @@
*/
import { AbortException, createPromiseCapability, Util } from '../shared/util';
import { getDefaultSetting } from './dom_utils';
import globalScope from '../shared/global_scope';
/**
* Text layer render parameters.
@ -107,11 +107,9 @@ var renderTextLayer = (function renderTextLayerClosure() {
textDiv.setAttribute('style', textDivProperties.style);
textDiv.textContent = geom.str;
// |fontName| is only used by the Font Inspector. This test will succeed
// when e.g. the Font Inspector is off but the Stepper is on, but it's
// not worth the effort to do a more accurate test. We only use `dataset`
// here to make the font name available for the debugger.
if (getDefaultSetting('pdfBug')) {
// `fontName` is only used by the FontInspector, and we only use `dataset`
// here to make the font name available in the debugger.
if (task._fontInspectorEnabled) {
textDiv.dataset.fontName = geom.fontName;
}
if (angle !== 0) {
@ -479,6 +477,8 @@ var renderTextLayer = (function renderTextLayerClosure() {
this._textDivs = textDivs || [];
this._textContentItemsStr = textContentItemsStr || [];
this._enhanceTextSelection = !!enhanceTextSelection;
this._fontInspectorEnabled = !!(globalScope.FontInspector &&
globalScope.FontInspector.enabled);
this._reader = null;
this._layoutTextLastFontSize = null;