Chromium Code Reviews| Index: chrome/browser/resources/settings/device_page/layout_behavior.js |
| diff --git a/chrome/browser/resources/settings/device_page/layout_behavior.js b/chrome/browser/resources/settings/device_page/layout_behavior.js |
| index 51ba51bd83342f9380b855e19f5a23c19e4c0dcc..699be738b81f7ba687d65d0c8c20e3f89a10d9f3 100644 |
| --- a/chrome/browser/resources/settings/device_page/layout_behavior.js |
| +++ b/chrome/browser/resources/settings/device_page/layout_behavior.js |
| @@ -15,6 +15,12 @@ var LayoutBehavior = { |
| * @type {!Array<!chrome.system.display.DisplayLayout>} |
| */ |
| layouts: Array, |
| + |
| + /** |
| + * Whether or not mirroring is enabled. |
| + * @type {boolean} |
| + */ |
| + mirroring: false, |
| }, |
| /** @private {!Map<string, chrome.system.display.Bounds>} */ |
| @@ -49,6 +55,8 @@ var LayoutBehavior = { |
| this.dragLayoutId = ''; |
| this.dragParentId_ = ''; |
| + this.mirroring = displays.length > 0 && !!displays[0].mirroringSourceId; |
| + |
| this.displayBoundsMap_.clear(); |
| for (let display of displays) |
| this.displayBoundsMap_.set(display.id, display.bounds); |
| @@ -182,11 +190,12 @@ var LayoutBehavior = { |
| /** |
| * @param {string} displayId |
| + * @param {boolean=} opt_test |
|
michaelpg
2016/07/11 20:41:56
i'd prefer optional params default to false, e.g.
stevenjb
2016/07/11 21:56:23
I inverted the variable to be notest instead. We c
|
| * @return {!chrome.system.display.Bounds} bounds |
| */ |
| - getCalculatedDisplayBounds: function(displayId) { |
| + getCalculatedDisplayBounds: function(displayId, opt_test) { |
| var bounds = this.calculatedBoundsMap_.get(displayId); |
| - assert(bounds); |
| + assert(opt_test === false || bounds); |
| return bounds; |
| }, |
| @@ -308,7 +317,7 @@ var LayoutBehavior = { |
| calculateBounds_: function(id, width, height) { |
| var left, top; |
| var layout = this.displayLayoutMap_.get(id); |
| - if (!layout || !layout.parentId) { |
| + if (this.mirroring || !layout || !layout.parentId) { |
| left = -width / 2; |
| top = -height / 2; |
| } else { |