| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.RootView = class extends WebInspector.VBox { | 7 UI.RootView = class extends UI.VBox { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this.markAsRoot(); | 10 this.markAsRoot(); |
| 11 this.element.classList.add('root-view'); | 11 this.element.classList.add('root-view'); |
| 12 this.registerRequiredCSS('ui/rootView.css'); | 12 this.registerRequiredCSS('ui/rootView.css'); |
| 13 this.element.setAttribute('spellcheck', false); | 13 this.element.setAttribute('spellcheck', false); |
| 14 } | 14 } |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * @param {!Document} document | 17 * @param {!Document} document |
| 18 */ | 18 */ |
| 19 attachToDocument(document) { | 19 attachToDocument(document) { |
| 20 document.defaultView.addEventListener('resize', this.doResize.bind(this), fa
lse); | 20 document.defaultView.addEventListener('resize', this.doResize.bind(this), fa
lse); |
| 21 this._window = document.defaultView; | 21 this._window = document.defaultView; |
| 22 this.doResize(); | 22 this.doResize(); |
| 23 this.show(/** @type {!Element} */ (document.body)); | 23 this.show(/** @type {!Element} */ (document.body)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @override | 27 * @override |
| 28 */ | 28 */ |
| 29 doResize() { | 29 doResize() { |
| 30 if (this._window) { | 30 if (this._window) { |
| 31 var size = this.constraints().minimum; | 31 var size = this.constraints().minimum; |
| 32 var zoom = WebInspector.zoomManager.zoomFactor(); | 32 var zoom = UI.zoomManager.zoomFactor(); |
| 33 var right = Math.min(0, this._window.innerWidth - size.width / zoom); | 33 var right = Math.min(0, this._window.innerWidth - size.width / zoom); |
| 34 this.element.style.marginRight = right + 'px'; | 34 this.element.style.marginRight = right + 'px'; |
| 35 var bottom = Math.min(0, this._window.innerHeight - size.height / zoom); | 35 var bottom = Math.min(0, this._window.innerHeight - size.height / zoom); |
| 36 this.element.style.marginBottom = bottom + 'px'; | 36 this.element.style.marginBottom = bottom + 'px'; |
| 37 } | 37 } |
| 38 super.doResize(); | 38 super.doResize(); |
| 39 } | 39 } |
| 40 }; | 40 }; |
| OLD | NEW |