| OLD | NEW |
| 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 Behavior for handling display layout, specifically | 6 * @fileoverview Behavior for handling display layout, specifically |
| 7 * edge snapping and collisions. | 7 * edge snapping and collisions. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @polymerBehavior */ | 10 /** @polymerBehavior */ |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 }, | 286 }, |
| 287 | 287 |
| 288 /** | 288 /** |
| 289 * @param {string} parentId | 289 * @param {string} parentId |
| 290 * @param {boolean} recurse Include descendants of children. | 290 * @param {boolean} recurse Include descendants of children. |
| 291 * @return {!Array<string>} | 291 * @return {!Array<string>} |
| 292 * @private | 292 * @private |
| 293 */ | 293 */ |
| 294 findChildren_: function(parentId, recurse) { | 294 findChildren_: function(parentId, recurse) { |
| 295 var children = []; | 295 var children = []; |
| 296 this.displayLayoutMap_.forEach(function(value, key) { | 296 this.displayLayoutMap_.forEach((value, key) => { |
| 297 var childId = key; | 297 var childId = key; |
| 298 if (childId != parentId && value.parentId == parentId) { | 298 if (childId != parentId && value.parentId == parentId) { |
| 299 // Insert immediate children at the front of the array. | 299 // Insert immediate children at the front of the array. |
| 300 children.unshift(childId); | 300 children.unshift(childId); |
| 301 if (recurse) { | 301 if (recurse) { |
| 302 // Descendants get added to the end of the list. | 302 // Descendants get added to the end of the list. |
| 303 children = children.concat(this.findChildren_(childId, true)); | 303 children = children.concat(this.findChildren_(childId, true)); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 }.bind(this)); | 306 }); |
| 307 return children; | 307 return children; |
| 308 }, | 308 }, |
| 309 | 309 |
| 310 /** | 310 /** |
| 311 * Recursively calculates the absolute bounds of a display. | 311 * Recursively calculates the absolute bounds of a display. |
| 312 * Caches the display bounds so that parent bounds are only calculated once. | 312 * Caches the display bounds so that parent bounds are only calculated once. |
| 313 * @param {string} id | 313 * @param {string} id |
| 314 * @param {number} width | 314 * @param {number} width |
| 315 * @param {number} height | 315 * @param {number} height |
| 316 * @private | 316 * @private |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 highlight == chrome.system.display.LayoutPosition.LEFT); | 705 highlight == chrome.system.display.LayoutPosition.LEFT); |
| 706 div.classList.toggle( | 706 div.classList.toggle( |
| 707 'highlight-top', | 707 'highlight-top', |
| 708 highlight == chrome.system.display.LayoutPosition.TOP); | 708 highlight == chrome.system.display.LayoutPosition.TOP); |
| 709 div.classList.toggle( | 709 div.classList.toggle( |
| 710 'highlight-bottom', | 710 'highlight-bottom', |
| 711 highlight == chrome.system.display.LayoutPosition.BOTTOM); | 711 highlight == chrome.system.display.LayoutPosition.BOTTOM); |
| 712 } | 712 } |
| 713 }, | 713 }, |
| 714 }; | 714 }; |
| OLD | NEW |