Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / devtools / front_end / ui / RootView.js
blobe4b5ef9bfb2ead634f523cbe3059910f063cf654
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
3 // found in the LICENSE file.
5 /**
6 * @constructor
7 * @extends {WebInspector.VBox}
8 */
9 WebInspector.RootView = function()
11 WebInspector.VBox.call(this);
12 this.markAsRoot();
13 this.element.classList.add("root-view");
14 this.element.setAttribute("spellcheck", false);
17 WebInspector.RootView.prototype = {
18 /**
19 * @param {!Document} document
21 attachToDocument: function(document)
23 document.defaultView.addEventListener("resize", this.doResize.bind(this), false);
24 this._window = document.defaultView;
25 this.doResize();
26 this.show(document.body);
29 doResize: function()
31 if (this._window) {
32 var size = this.constraints().minimum;
33 var zoom = WebInspector.zoomManager.zoomFactor();
34 var right = Math.min(0, this._window.innerWidth - size.width / zoom);
35 this.element.style.marginRight = right + "px";
36 var bottom = Math.min(0, this._window.innerHeight - size.height / zoom);
37 this.element.style.marginBottom = bottom + "px";
39 WebInspector.VBox.prototype.doResize.call(this);
42 __proto__: WebInspector.VBox.prototype