Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / ui / RootView.js
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.
4
5 /**
6  * @constructor
7  * @extends {WebInspector.VBox}
8  */
9 WebInspector.RootView = function()
10 {
11     WebInspector.VBox.call(this);
12     this.markAsRoot();
13     this.element.classList.add("root-view");
14     this.element.setAttribute("spellcheck", false);
15 }
16
17 WebInspector.RootView.prototype = {
18     /**
19      * @param {!Document} document
20      */
21     attachToDocument: function(document)
22     {
23         document.defaultView.addEventListener("resize", this.doResize.bind(this), false);
24         this._window = document.defaultView;
25         this.doResize();
26         this.show(document.body);
27     },
28
29     doResize: function()
30     {
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";
38         }
39         WebInspector.VBox.prototype.doResize.call(this);
40     },
41
42     __proto__: WebInspector.VBox.prototype
43 }