1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-19 11:15:21 +01:00

Fix performance on MacOS, Chrome & external screen (#2104)

* Fix performance on MacOS, Chrome & external screen

* Undo dev logging, tidy up
This commit is contained in:
Thomas Rittson 2021-11-02 08:15:49 +10:00 committed by GitHub
parent ad1653ec3f
commit bbbf152c62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 2 deletions

View File

@ -367,3 +367,17 @@ select option {
background-color: darken(themed('inputBackgroundColor'), +1);
}
}
// Workaround for slow performance on external monitors on Chrome + MacOS
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=971701#c64
@keyframes redraw {
0% {
opacity: 0.99;
}
100% {
opacity: 1;
}
}
html.force_redraw {
animation: redraw 1s linear infinite;
}

View File

@ -76,9 +76,9 @@ const isPrivateMode = BrowserApi.getBackgroundPage() == null;
const stateService = new StateService();
const messagingService = new BrowserMessagingService();
const logService = getBgService<ConsoleLogService>('logService')();
const searchService = isPrivateMode ? null : new PopupSearchService(getBgService<SearchService>('searchService')(),
getBgService<CipherService>('cipherService')(), getBgService<ConsoleLogService>('consoleLogService')(),
getBgService<I18nService>('i18nService')());
getBgService<CipherService>('cipherService')(), logService, getBgService<I18nService>('i18nService')());
export function initFactory(platformUtilsService: PlatformUtilsService, i18nService: I18nService, storageService: StorageService,
popupUtilsService: PopupUtilsService): Function {
@ -109,6 +109,19 @@ export function initFactory(platformUtilsService: PlatformUtilsService, i18nServ
}
});
htmlEl.classList.add('locale_' + i18nService.translationLocale);
// Workaround for slow performance on external monitors on Chrome + MacOS
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=971701#c64
if (platformUtilsService.isChrome() &&
navigator.platform.indexOf('Mac') > -1 &&
popupUtilsService.inPopup(window) &&
(window.screenLeft < 0 ||
window.screenTop < 0 ||
window.screenLeft > window.screen.width ||
window.screenTop > window.screen.height)) {
htmlEl.classList.add('force_redraw');
logService.info('Force redraw is on');
}
}
};
}