Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/RootView.js

Issue 2170993002: Revert of DevTools: keep widgets in widget hierarchy upon hide, split attach/detach cycle from show/hide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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(/** @type {!Element} */ (document.body)); 26 this.show(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698