| 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 * @suppressGlobalPropertiesCheck |
| 8 */ | 9 */ |
| 9 WebInspector.RootView = function() | 10 WebInspector.RootView = function() |
| 10 { | 11 { |
| 11 WebInspector.VBox.call(this); | 12 WebInspector.VBox.call(this); |
| 12 this.markAsRoot(); | 13 this.markAsRoot(); |
| 13 this.element.classList.add("root-view"); | 14 this.element.classList.add("root-view"); |
| 14 this.element.setAttribute("spellcheck", false); | 15 this.element.setAttribute("spellcheck", false); |
| 16 // This view is not designed to change owner document. |
| 15 window.addEventListener("resize", this.doResize.bind(this), false); | 17 window.addEventListener("resize", this.doResize.bind(this), false); |
| 16 } | 18 } |
| 17 | 19 |
| 18 WebInspector.RootView.prototype = { | 20 WebInspector.RootView.prototype = { |
| 21 /** |
| 22 * @public // FIXME: this is a workaround for validator bug (http://crbug.co
m/425506). |
| 23 * @suppressGlobalPropertiesCheck |
| 24 */ |
| 19 attachToBody: function() | 25 attachToBody: function() |
| 20 { | 26 { |
| 21 this.doResize(); | 27 this.doResize(); |
| 22 this.show(document.body); | 28 this.show(document.body); |
| 23 }, | 29 }, |
| 24 | 30 |
| 25 doResize: function() | 31 doResize: function() |
| 26 { | 32 { |
| 27 var size = this.constraints().minimum; | 33 var size = this.constraints().minimum; |
| 28 var zoom = WebInspector.zoomManager.zoomFactor(); | 34 var zoom = WebInspector.zoomManager.zoomFactor(); |
| 29 var right = Math.min(0, window.innerWidth - size.width / zoom); | 35 var right = Math.min(0, window.innerWidth - size.width / zoom); |
| 30 this.element.style.marginRight = right + "px"; | 36 this.element.style.marginRight = right + "px"; |
| 31 var bottom = Math.min(0, window.innerHeight - size.height / zoom); | 37 var bottom = Math.min(0, window.innerHeight - size.height / zoom); |
| 32 this.element.style.marginBottom = bottom + "px"; | 38 this.element.style.marginBottom = bottom + "px"; |
| 33 WebInspector.VBox.prototype.doResize.call(this); | 39 WebInspector.VBox.prototype.doResize.call(this); |
| 34 }, | 40 }, |
| 35 | 41 |
| 36 __proto__: WebInspector.VBox.prototype | 42 __proto__: WebInspector.VBox.prototype |
| 37 } | 43 } |
| OLD | NEW |