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