Merge pull request #13020 from Snuffleupagus/rm-some-NullL10n-use

Remove the `NullL10n` default value from viewer components not included in the `COMPONENTS`-bundle
This commit is contained in:
Tim van der Meij 2021-02-25 23:27:49 +01:00 committed by GitHub
commit 163a840a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 36 deletions

View File

@ -13,7 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
import { NullL10n } from "./ui_utils.js";
import { PasswordResponses } from "pdfjs-lib"; import { PasswordResponses } from "pdfjs-lib";
/** /**
@ -37,12 +36,7 @@ class PasswordPrompt {
* @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g. * @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g.
* an <iframe> or an <object>. The default value is `false`. * an <iframe> or an <object>. The default value is `false`.
*/ */
constructor( constructor(options, overlayManager, l10n, isViewerEmbedded = false) {
options,
overlayManager,
l10n = NullL10n,
isViewerEmbedded = false
) {
this.overlayName = options.overlayName; this.overlayName = options.overlayName;
this.container = options.container; this.container = options.container;
this.label = options.label; this.label = options.label;

View File

@ -18,7 +18,6 @@ import {
getPageSizeInches, getPageSizeInches,
getPDFFileNameFromURL, getPDFFileNameFromURL,
isPortraitOrientation, isPortraitOrientation,
NullL10n,
} from "./ui_utils.js"; } from "./ui_utils.js";
const DEFAULT_FIELD_CONTENT = "-"; const DEFAULT_FIELD_CONTENT = "-";
@ -63,7 +62,7 @@ class PDFDocumentProperties {
{ overlayName, fields, container, closeButton }, { overlayName, fields, container, closeButton },
overlayManager, overlayManager,
eventBus, eventBus,
l10n = NullL10n l10n
) { ) {
this.overlayName = overlayName; this.overlayName = overlayName;
this.fields = fields; this.fields = fields;

View File

@ -14,7 +14,6 @@
*/ */
import { FindState } from "./pdf_find_controller.js"; import { FindState } from "./pdf_find_controller.js";
import { NullL10n } from "./ui_utils.js";
const MATCHES_COUNT_LIMIT = 1000; const MATCHES_COUNT_LIMIT = 1000;
@ -25,7 +24,7 @@ const MATCHES_COUNT_LIMIT = 1000;
* is done by PDFFindController. * is done by PDFFindController.
*/ */
class PDFFindBar { class PDFFindBar {
constructor(options, eventBus, l10n = NullL10n) { constructor(options, eventBus, l10n) {
this.opened = false; this.opened = false;
this.bar = options.bar; this.bar = options.bar;

View File

@ -13,8 +13,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { CSS_UNITS, NullL10n } from "./ui_utils.js";
import { PDFPrintServiceFactory, PDFViewerApplication } from "./app.js"; import { PDFPrintServiceFactory, PDFViewerApplication } from "./app.js";
import { CSS_UNITS } from "./ui_utils.js";
import { viewerCompatibilityParams } from "./viewer_compatibility.js"; import { viewerCompatibilityParams } from "./viewer_compatibility.js";
let activeService = null; let activeService = null;
@ -82,7 +82,7 @@ function PDFPrintService(
this._printResolution = printResolution || 150; this._printResolution = printResolution || 150;
this._optionalContentConfigPromise = this._optionalContentConfigPromise =
optionalContentConfigPromise || pdfDocument.getOptionalContentConfig(); optionalContentConfigPromise || pdfDocument.getOptionalContentConfig();
this.l10n = l10n || NullL10n; this.l10n = l10n;
this.currentPage = -1; this.currentPage = -1;
// The temporary canvas where renderPage paints one page at a time. // The temporary canvas where renderPage paints one page at a time.
this.scratchCanvas = document.createElement("canvas"); this.scratchCanvas = document.createElement("canvas");

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { NullL10n, PresentationModeState, SidebarView } from "./ui_utils.js"; import { PresentationModeState, SidebarView } from "./ui_utils.js";
import { RenderingStates } from "./pdf_rendering_queue.js"; import { RenderingStates } from "./pdf_rendering_queue.js";
const UI_NOTIFICATION_CLASS = "pdfSidebarNotification"; const UI_NOTIFICATION_CLASS = "pdfSidebarNotification";
@ -61,13 +61,7 @@ class PDFSidebar {
/** /**
* @param {PDFSidebarOptions} options * @param {PDFSidebarOptions} options
*/ */
constructor({ constructor({ elements, pdfViewer, pdfThumbnailViewer, eventBus, l10n }) {
elements,
pdfViewer,
pdfThumbnailViewer,
eventBus,
l10n = NullL10n,
}) {
this.isOpen = false; this.isOpen = false;
this.active = SidebarView.THUMBS; this.active = SidebarView.THUMBS;
this.isInitialViewSet = false; this.isInitialViewSet = false;

View File

@ -13,8 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
import { NullL10n } from "./ui_utils.js";
const SIDEBAR_WIDTH_VAR = "--sidebar-width"; const SIDEBAR_WIDTH_VAR = "--sidebar-width";
const SIDEBAR_MIN_WIDTH = 200; // pixels const SIDEBAR_MIN_WIDTH = 200; // pixels
const SIDEBAR_RESIZING_CLASS = "sidebarResizing"; const SIDEBAR_RESIZING_CLASS = "sidebarResizing";
@ -33,7 +31,7 @@ class PDFSidebarResizer {
* @param {EventBus} eventBus - The application event bus. * @param {EventBus} eventBus - The application event bus.
* @param {IL10n} l10n - Localization service. * @param {IL10n} l10n - Localization service.
*/ */
constructor(options, eventBus, l10n = NullL10n) { constructor(options, eventBus, l10n) {
this.isRTL = false; this.isRTL = false;
this.sidebarOpen = false; this.sidebarOpen = false;
this.doc = document.documentElement; this.doc = document.documentElement;

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { getOutputScale, NullL10n } from "./ui_utils.js"; import { getOutputScale } from "./ui_utils.js";
import { RenderingCancelledException } from "pdfjs-lib"; import { RenderingCancelledException } from "pdfjs-lib";
import { RenderingStates } from "./pdf_rendering_queue.js"; import { RenderingStates } from "./pdf_rendering_queue.js";
@ -97,7 +97,7 @@ class PDFThumbnailView {
renderingQueue, renderingQueue,
checkSetImageDisabled, checkSetImageDisabled,
disableCanvasToImageConversion = false, disableCanvasToImageConversion = false,
l10n = NullL10n, l10n,
}) { }) {
this.id = id; this.id = id;
this.renderingId = "thumbnail" + id; this.renderingId = "thumbnail" + id;

View File

@ -16,7 +16,6 @@
import { import {
getVisibleElements, getVisibleElements,
isValidRotation, isValidRotation,
NullL10n,
scrollIntoView, scrollIntoView,
watchScroll, watchScroll,
} from "./ui_utils.js"; } from "./ui_utils.js";
@ -45,13 +44,7 @@ class PDFThumbnailViewer {
/** /**
* @param {PDFThumbnailViewerOptions} options * @param {PDFThumbnailViewerOptions} options
*/ */
constructor({ constructor({ container, eventBus, linkService, renderingQueue, l10n }) {
container,
eventBus,
linkService,
renderingQueue,
l10n = NullL10n,
}) {
this.container = container; this.container = container;
this.linkService = linkService; this.linkService = linkService;
this.renderingQueue = renderingQueue; this.renderingQueue = renderingQueue;

View File

@ -20,7 +20,6 @@ import {
MAX_SCALE, MAX_SCALE,
MIN_SCALE, MIN_SCALE,
noContextMenuHandler, noContextMenuHandler,
NullL10n,
} from "./ui_utils.js"; } from "./ui_utils.js";
const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading"; const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading";
@ -58,7 +57,7 @@ class Toolbar {
* @param {EventBus} eventBus * @param {EventBus} eventBus
* @param {IL10n} l10n - Localization service. * @param {IL10n} l10n - Localization service.
*/ */
constructor(options, eventBus, l10n = NullL10n) { constructor(options, eventBus, l10n) {
this.toolbar = options.container; this.toolbar = options.container;
this.eventBus = eventBus; this.eventBus = eventBus;
this.l10n = l10n; this.l10n = l10n;