Merge pull request from Snuffleupagus/zoom-dropdown-glitches

Prevent the Zoom dropdown from intermittently displaying an incorrect custom scale in Firefox (PR 8394 follow-up)
This commit is contained in:
Yury Delendik 2017-06-10 08:03:03 -05:00 committed by GitHub
commit 08c6437196

@ -180,10 +180,13 @@ var Toolbar = (function ToolbarClosure() {
} }
let selectScaleOption = (value, scale) => { let selectScaleOption = (value, scale) => {
var options = items.scaleSelect.options; let customScale = Math.round(scale * 10000) / 100;
var predefinedValueFound = false; this.l10n.get('page_scale_percent', { scale: customScale, },
for (var i = 0, ii = options.length; i < ii; i++) { '{{scale}}%').then((msg) => {
var option = options[i]; let options = items.scaleSelect.options;
let predefinedValueFound = false;
for (let i = 0, ii = options.length; i < ii; i++) {
let option = options[i];
if (option.value !== value) { if (option.value !== value) {
option.selected = false; option.selected = false;
continue; continue;
@ -192,14 +195,10 @@ var Toolbar = (function ToolbarClosure() {
predefinedValueFound = true; predefinedValueFound = true;
} }
if (!predefinedValueFound) { if (!predefinedValueFound) {
var customScale = Math.round(scale * 10000) / 100;
this.l10n.get('page_scale_percent', { scale: customScale, },
'{{scale}}%').
then((msg) => {
items.customScaleOption.textContent = msg; items.customScaleOption.textContent = msg;
});
items.customScaleOption.selected = true; items.customScaleOption.selected = true;
} }
});
}; };
var pageNumber = this.pageNumber; var pageNumber = this.pageNumber;