Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4174)

Unified Diff: chrome/browser/resources/settings/device_page/display.js

Issue 2556773003: MD Settings: Display: Fix resolution text (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/device_page/display.js
diff --git a/chrome/browser/resources/settings/device_page/display.js b/chrome/browser/resources/settings/device_page/display.js
index 0f71276edd6dd0cd67eeeedaab99c655e736b42b..24d437496603afb5de1d2bea01343dd6de8be547 100644
--- a/chrome/browser/resources/settings/device_page/display.js
+++ b/chrome/browser/resources/settings/device_page/display.js
@@ -158,6 +158,7 @@ Polymer({
}
this.maxModeIndex_ = this.selectedDisplay.modes.length - 1;
this.selectedModeIndex_ = this.getSelectedModeIndex_(this.selectedDisplay);
+ this.immediateSelectedModeIndex_ = this.selectedModeIndex_;
},
/**
@@ -243,21 +244,25 @@ Polymer({
},
/**
- * @param {!chrome.system.display.DisplayUnitInfo} selectedDisplay
- * @param {number} immediateSelectedModeIndex
* @return {string}
* @private
*/
- getResolutionText_: function(selectedDisplay, immediateSelectedModeIndex) {
+ getResolutionText_: function() {
if (this.selectedDisplay.modes.length == 0) {
- var widthStr = selectedDisplay.bounds.width.toString();
- var heightStr = selectedDisplay.bounds.height.toString();
+ var widthStr = this.selectedDisplay.bounds.width.toString();
+ var heightStr = this.selectedDisplay.bounds.height.toString();
return this.i18n('displayResolutionText', widthStr, heightStr);
}
- if (isNaN(immediateSelectedModeIndex))
- immediateSelectedModeIndex = this.getSelectedModeIndex_(selectedDisplay);
- var mode = selectedDisplay.modes[immediateSelectedModeIndex];
- var best = selectedDisplay.isInternal ? mode.uiScale == 1.0 : mode.isNative;
+ // immediateSelectedModeIndex_ is bound to paper-slider.immediate-value
+ // which may not be valid, or may not have updated yet when this is called.
+ if (isNaN(this.immediateSelectedModeIndex_) ||
+ this.immediateSelectedModeIndex_ >= this.selectedDisplay.modes.length) {
+ this.immediateSelectedModeIndex_ =
+ this.getSelectedModeIndex_(this.selectedDisplay);
+ }
+ var mode = this.selectedDisplay.modes[this.immediateSelectedModeIndex_];
+ var best =
+ this.selectedDisplay.isInternal ? mode.uiScale == 1.0 : mode.isNative;
var widthStr = mode.width.toString();
var heightStr = mode.height.toString();
if (best)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698