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

Unified Diff: chrome/browser/resources/options2/chromeos/display_options.js

Issue 10828005: Show "displays" section in the options page even for 1 display. It happens in case of mirroring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months 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 | chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options2/chromeos/display_options.js
diff --git a/chrome/browser/resources/options2/chromeos/display_options.js b/chrome/browser/resources/options2/chromeos/display_options.js
index e1705a4de8f0a2e24d1dd12d0097d2c1bd76e605..d156a551a4401e2031df8abf44b1662913c24b69 100644
--- a/chrome/browser/resources/options2/chromeos/display_options.js
+++ b/chrome/browser/resources/options2/chromeos/display_options.js
@@ -230,19 +230,23 @@ cr.define('options', function() {
var width = this.displays_[0].width * VISUAL_SCALE;
var height = this.displays_[0].height * VISUAL_SCALE;
+ // Always show two displays because there must be two displays when
+ // the display_options is enabled. Don't rely on displays_.length because
+ // there is only one display from chrome's perspective in mirror mode.
+ var num_displays = Math.max(2, this.displays_.length);
+
this.displays_view_.style.height =
- height + this.displays_.length * 2 + 'px';
+ height + num_displays * 2 + 'px';
James Hawkins 2012/07/25 15:07:16 What is this 2 about? In general I'd pull these m
Jun Mukai 2012/07/27 08:43:52 Introduced a const and replaced.
- for (var i = 0; i < this.displays_.length; i++) {
+ for (var i = 0; i < num_displays; i++) {
var div = document.createElement('div');
- this.displays_[i].div = div;
div.className = 'displays-display';
div.style.top = i * 2 + 'px';
div.style.left = i * 2 + 'px';
div.style.width = width + 'px';
div.style.height = height + 'px';
div.style.zIndex = i;
- if (i == this.displays_.length - 1)
+ if (i == num_displays - 1)
div.className += ' displays-primary';
this.displays_view_.appendChild(div);
}
@@ -330,9 +334,6 @@ cr.define('options', function() {
this.displays_ = displays;
- if (this.displays_.length <= 1)
- return;
-
this.resetDisplaysView_();
if (this.mirroring_)
this.layoutMirroringDisplays_();
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698