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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 */ | 8 */ |
9 WebInspector.RootView = function() | 9 WebInspector.RootView = function() |
10 { | 10 { |
11 WebInspector.VBox.call(this); | 11 WebInspector.VBox.call(this); |
12 this.markAsRoot(); | 12 this.markAsRoot(); |
13 this.element.classList.add("root-view"); | 13 this.element.classList.add("root-view", "component-root"); |
14 this.element.setAttribute("spellcheck", false); | 14 this.element.setAttribute("spellcheck", false); |
15 window.addEventListener("resize", this.doResize.bind(this), false); | 15 window.addEventListener("resize", this.doResize.bind(this), false); |
16 } | 16 } |
17 | 17 |
18 WebInspector.RootView.prototype = { | 18 WebInspector.RootView.prototype = { |
19 attachToBody: function() | 19 attachToBody: function() |
20 { | 20 { |
21 this.doResize(); | 21 this.doResize(); |
22 this.show(document.body); | 22 this.show(document.body); |
23 }, | 23 }, |
24 | 24 |
25 doResize: function() | 25 doResize: function() |
26 { | 26 { |
27 var size = this.constraints().minimum; | 27 var size = this.constraints().minimum; |
28 var zoom = WebInspector.zoomManager.zoomFactor(); | 28 var zoom = WebInspector.zoomManager.zoomFactor(); |
29 var right = Math.min(0, window.innerWidth - size.width / zoom); | 29 var right = Math.min(0, window.innerWidth - size.width / zoom); |
30 this.element.style.marginRight = right + "px"; | 30 this.element.style.marginRight = right + "px"; |
31 var bottom = Math.min(0, window.innerHeight - size.height / zoom); | 31 var bottom = Math.min(0, window.innerHeight - size.height / zoom); |
32 this.element.style.marginBottom = bottom + "px"; | 32 this.element.style.marginBottom = bottom + "px"; |
33 WebInspector.VBox.prototype.doResize.call(this); | 33 WebInspector.VBox.prototype.doResize.call(this); |
34 }, | 34 }, |
35 | 35 |
36 __proto__: WebInspector.VBox.prototype | 36 __proto__: WebInspector.VBox.prototype |
37 } | 37 } |
OLD | NEW |