Merge pull request #8510 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

View File

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