Convert files in the src/display/-folder to use optional chaining where possible

By using optional chaining, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining, it's possible to reduce unnecessary code-repetition in many cases.
Note that these changes also reduce the size of the *built* `pdf.js` file, when `SKIP_BABEL == true` is set, and for the `MOZCENTRAL` build-target that result in a `0.1%` filesize reduction from a simple and mostly mechanical code change.
This commit is contained in:
Jonas Jenwald 2020-11-06 14:36:16 +01:00
parent e3851a6765
commit 1dad255784
8 changed files with 19 additions and 41 deletions

View file

@ -526,9 +526,7 @@ const renderTextLayer = (function renderTextLayerClosure() {
this._textDivs = textDivs || [];
this._textContentItemsStr = textContentItemsStr || [];
this._enhanceTextSelection = !!enhanceTextSelection;
this._fontInspectorEnabled = !!(
globalThis.FontInspector && globalThis.FontInspector.enabled
);
this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled;
this._reader = null;
this._layoutTextLastFontSize = null;