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

Side by Side Diff: chrome/browser/resources/settings/device_page/display_layout.js

Issue 2651483002: MD Settings: Eliminate use of ES6 for Chrome OS (Closed)
Patch Set: Feedback Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'display-layout' presents a visual representation of the layout of one or 7 * 'display-layout' presents a visual representation of the layout of one or
8 * more displays and allows them to be arranged. 8 * more displays and allows them to be arranged.
9 */ 9 */
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 var display = this.displays[0]; 85 var display = this.displays[0];
86 var bounds = this.getCalculatedDisplayBounds(display.id); 86 var bounds = this.getCalculatedDisplayBounds(display.id);
87 var boundsBoundingBox = { 87 var boundsBoundingBox = {
88 left: bounds.left, 88 left: bounds.left,
89 right: bounds.left + bounds.width, 89 right: bounds.left + bounds.width,
90 top: bounds.top, 90 top: bounds.top,
91 bottom: bounds.top + bounds.height, 91 bottom: bounds.top + bounds.height,
92 }; 92 };
93 var maxWidth = bounds.width; 93 var maxWidth = bounds.width;
94 var maxHeight = bounds.height; 94 var maxHeight = bounds.height;
95 for (let i = 1; i < this.displays.length; ++i) { 95 for (var i = 1; i < this.displays.length; ++i) {
96 display = this.displays[i]; 96 display = this.displays[i];
97 bounds = this.getCalculatedDisplayBounds(display.id); 97 bounds = this.getCalculatedDisplayBounds(display.id);
98 boundsBoundingBox.left = Math.min(boundsBoundingBox.left, bounds.left); 98 boundsBoundingBox.left = Math.min(boundsBoundingBox.left, bounds.left);
99 boundsBoundingBox.right = 99 boundsBoundingBox.right =
100 Math.max(boundsBoundingBox.right, bounds.left + bounds.width); 100 Math.max(boundsBoundingBox.right, bounds.left + bounds.width);
101 boundsBoundingBox.top = Math.min(boundsBoundingBox.top, bounds.top); 101 boundsBoundingBox.top = Math.min(boundsBoundingBox.top, bounds.top);
102 boundsBoundingBox.bottom = 102 boundsBoundingBox.bottom =
103 Math.max(boundsBoundingBox.bottom, bounds.top + bounds.height); 103 Math.max(boundsBoundingBox.bottom, bounds.top + bounds.height);
104 maxWidth = Math.max(maxWidth, bounds.width); 104 maxWidth = Math.max(maxWidth, bounds.width);
105 maxHeight = Math.max(maxHeight, bounds.height); 105 maxHeight = Math.max(maxHeight, bounds.height);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (!bounds) 149 if (!bounds)
150 return ''; 150 return '';
151 var height = Math.round(bounds.height * this.visualScale) - BORDER * 2 - 151 var height = Math.round(bounds.height * this.visualScale) - BORDER * 2 -
152 MARGIN * 2 - PADDING * 2; 152 MARGIN * 2 - PADDING * 2;
153 var width = Math.round(bounds.width * this.visualScale) - BORDER * 2 - 153 var width = Math.round(bounds.width * this.visualScale) - BORDER * 2 -
154 MARGIN * 2 - PADDING * 2; 154 MARGIN * 2 - PADDING * 2;
155 var left = OFFSET + 155 var left = OFFSET +
156 Math.round(this.visualOffset_.left + (bounds.left * this.visualScale)); 156 Math.round(this.visualOffset_.left + (bounds.left * this.visualScale));
157 var top = OFFSET + 157 var top = OFFSET +
158 Math.round(this.visualOffset_.top + (bounds.top * this.visualScale)); 158 Math.round(this.visualOffset_.top + (bounds.top * this.visualScale));
159 return `height: ${height}px; width: ${width}px;` + 159 return 'height: ' + height + 'px; width: ' + width + 'px;' +
160 ` left: ${left}px; top: ${top}px`; 160 ' left: ' + left + 'px; top: ' + top + 'px';
161 }, 161 },
162 162
163 /** 163 /**
164 * @param {string} id 164 * @param {string} id
165 * @param {!chrome.system.display.Bounds} displayBounds 165 * @param {!chrome.system.display.Bounds} displayBounds
166 * @param {number} visualScale 166 * @param {number} visualScale
167 * @return {string} The style string for the mirror div. 167 * @return {string} The style string for the mirror div.
168 * @private 168 * @private
169 */ 169 */
170 getMirrorDivStyle_: function(id, displayBounds, visualScale) { 170 getMirrorDivStyle_: function(id, displayBounds, visualScale) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 var top = 224 var top =
225 this.visualOffset_.top + Math.round(newBounds.top * this.visualScale); 225 this.visualOffset_.top + Math.round(newBounds.top * this.visualScale);
226 var div = this.$$('#_' + id); 226 var div = this.$$('#_' + id);
227 div.style.left = '' + left + 'px'; 227 div.style.left = '' + left + 'px';
228 div.style.top = '' + top + 'px'; 228 div.style.top = '' + top + 'px';
229 }, 229 },
230 230
231 }); 231 });
232 232
233 })(); 233 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698