Merge pull request #16425 from calixteman/gv_nimbus

[GeckoView] Add a Nimbus experiment for the toolbar (bug 1833093)
This commit is contained in:
calixteman 2023-05-15 18:26:28 +02:00 committed by GitHub
commit 5f91d39f13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 7 deletions

View file

@ -151,6 +151,10 @@ class DefaultExternalServices {
static get canvasMaxAreaInBytes() {
return shadow(this, "canvasMaxAreaInBytes", -1);
}
static getNimbusExperimentData() {
return shadow(this, "getNimbusExperimentData", Promise.resolve(null));
}
}
const PDFViewerApplication = {
@ -227,12 +231,21 @@ const PDFViewerApplication = {
_printAnnotationStoragePromise: null,
_touchInfo: null,
_isCtrlKeyDown: false,
_nimbusDataPromise: null,
// Called once when the document is loaded.
async initialize(appConfig) {
this.preferences = this.externalServices.createPreferences();
this.appConfig = appConfig;
if (
typeof PDFJSDev === "undefined"
? window.isGECKOVIEW
: PDFJSDev.test("GECKOVIEW")
) {
this._nimbusDataPromise = this.externalServices.getNimbusExperimentData();
}
await this._initializeOptions();
this._forceCssTheme();
await this._initializeL10n();
@ -584,7 +597,12 @@ const PDFViewerApplication = {
: PDFJSDev.test("GECKOVIEW")
) {
if (AppOptions.get("enableFloatingToolbar")) {
this.toolbar = new Toolbar(appConfig.toolbar, eventBus, this.l10n);
this.toolbar = new Toolbar(
appConfig.toolbar,
eventBus,
this.l10n,
await this._nimbusDataPromise
);
}
} else {
this.toolbar = new Toolbar(appConfig.toolbar, eventBus, this.l10n);