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"); |
14 this.element.setAttribute("spellcheck", false); | 14 this.element.setAttribute("spellcheck", false); |
15 } | 15 } |
16 | 16 |
17 WebInspector.RootView.prototype = { | 17 WebInspector.RootView.prototype = { |
18 /** | 18 /** |
19 * @param {!Document} document | 19 * @param {!Document} document |
20 */ | 20 */ |
21 attachToDocument: function(document) | 21 attachToDocument: function(document) |
22 { | 22 { |
23 document.defaultView.addEventListener("resize", this.doResize.bind(this)
, false); | 23 document.defaultView.addEventListener("resize", this.doResize.bind(this)
, false); |
24 this._window = document.defaultView; | 24 this._window = document.defaultView; |
25 this.doResize(); | 25 this.doResize(); |
26 this.show(document.body); | 26 this.show(/** @type {!Element} */ (document.body)); |
27 }, | 27 }, |
28 | 28 |
29 doResize: function() | 29 doResize: function() |
30 { | 30 { |
31 if (this._window) { | 31 if (this._window) { |
32 var size = this.constraints().minimum; | 32 var size = this.constraints().minimum; |
33 var zoom = WebInspector.zoomManager.zoomFactor(); | 33 var zoom = WebInspector.zoomManager.zoomFactor(); |
34 var right = Math.min(0, this._window.innerWidth - size.width / zoom)
; | 34 var right = Math.min(0, this._window.innerWidth - size.width / zoom)
; |
35 this.element.style.marginRight = right + "px"; | 35 this.element.style.marginRight = right + "px"; |
36 var bottom = Math.min(0, this._window.innerHeight - size.height / zo
om); | 36 var bottom = Math.min(0, this._window.innerHeight - size.height / zo
om); |
37 this.element.style.marginBottom = bottom + "px"; | 37 this.element.style.marginBottom = bottom + "px"; |
38 } | 38 } |
39 WebInspector.VBox.prototype.doResize.call(this); | 39 WebInspector.VBox.prototype.doResize.call(this); |
40 }, | 40 }, |
41 | 41 |
42 __proto__: WebInspector.VBox.prototype | 42 __proto__: WebInspector.VBox.prototype |
43 } | 43 } |
OLD | NEW |