Chromium Code Reviews| 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..06e713b02102ef557d7aac8750ae9f53f48e7d08 100644 |
| --- a/chrome/browser/resources/options2/chromeos/display_options.js |
| +++ b/chrome/browser/resources/options2/chromeos/display_options.js |
| @@ -226,23 +226,30 @@ cr.define('options', function() { |
| * @private |
| */ |
| layoutMirroringDisplays_: function() { |
| + // Offset pixels for secondary display rectangles. |
| + /** @const */ var MIRRORING_OFFSET_PIXELS = 2; |
| + |
| // The width/height should be same as the primary display: |
| 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); |
|
James Hawkins
2012/07/30 03:14:35
Optional nit: Pull this two into a const, e.g., MI
Jun Mukai
2012/07/30 07:58:41
Done.
|
| + |
| this.displays_view_.style.height = |
| - height + this.displays_.length * 2 + 'px'; |
| + height + num_displays * MIRRORING_OFFSET_PIXELS + 'px'; |
| - 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.top = i * MIRRORING_OFFSET_PIXELS + 'px'; |
| + div.style.left = i * MIRRORING_OFFSET_PIXELS + '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 +337,6 @@ cr.define('options', function() { |
| this.displays_ = displays; |
| - if (this.displays_.length <= 1) |
| - return; |
| - |
| this.resetDisplaysView_(); |
| if (this.mirroring_) |
| this.layoutMirroringDisplays_(); |