| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.VBox} | 33 * @extends {WebInspector.VBox} |
| 34 */ | 34 */ |
| 35 WebInspector.InspectorView = function() | 35 WebInspector.InspectorView = function() |
| 36 { | 36 { |
| 37 WebInspector.VBox.call(this); | 37 WebInspector.VBox.call(this); |
| 38 WebInspector.Dialog.setModalHostView(this); | 38 WebInspector.Dialog.setModalHostView(this); |
| 39 this.setMinimumSize(180, 72); |
| 39 | 40 |
| 40 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer. | 41 // DevTools sidebar is a vertical split of panels tabbed pane and a drawer. |
| 41 this._drawerSplitView = new WebInspector.SplitView(false, true, "Inspector.d
rawerSplitViewState", 200, 200); | 42 this._drawerSplitView = new WebInspector.SplitView(false, true, "Inspector.d
rawerSplitViewState", 200, 200); |
| 42 this._drawerSplitView.hideSidebar(); | 43 this._drawerSplitView.hideSidebar(); |
| 43 this._drawerSplitView.enableShowModeSaving(); | 44 this._drawerSplitView.enableShowModeSaving(); |
| 44 this._drawerSplitView.setSidebarElementConstraints(Preferences.minDrawerHeig
ht, Preferences.minDrawerHeight); | |
| 45 this._drawerSplitView.setMainElementConstraints(25, 25); | |
| 46 this._drawerSplitView.show(this.element); | 45 this._drawerSplitView.show(this.element); |
| 47 | 46 |
| 48 this._tabbedPane = new WebInspector.TabbedPane(); | 47 this._tabbedPane = new WebInspector.TabbedPane(); |
| 49 this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderCom
parator(WebInspector.Panel, "name", "order")); | 48 this._tabbedPane.setRetainTabOrder(true, WebInspector.moduleManager.orderCom
parator(WebInspector.Panel, "name", "order")); |
| 50 this._tabbedPane.show(this._drawerSplitView.mainElement()); | 49 this._tabbedPane.show(this._drawerSplitView.mainElement()); |
| 51 this._drawer = new WebInspector.Drawer(this._drawerSplitView); | 50 this._drawer = new WebInspector.Drawer(this._drawerSplitView); |
| 52 | 51 |
| 53 // Patch tabbed pane header with toolbar actions. | 52 // Patch tabbed pane header with toolbar actions. |
| 54 this._toolbarElement = document.createElement("div"); | 53 this._toolbarElement = document.createElement("div"); |
| 55 this._toolbarElement.className = "toolbar toolbar-background"; | 54 this._toolbarElement.className = "toolbar toolbar-background"; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 WebInspector.inspectorView; | 432 WebInspector.inspectorView; |
| 434 | 433 |
| 435 /** | 434 /** |
| 436 * @constructor | 435 * @constructor |
| 437 * @extends {WebInspector.VBox} | 436 * @extends {WebInspector.VBox} |
| 438 */ | 437 */ |
| 439 WebInspector.RootView = function() | 438 WebInspector.RootView = function() |
| 440 { | 439 { |
| 441 WebInspector.VBox.call(this); | 440 WebInspector.VBox.call(this); |
| 442 this.markAsRoot(); | 441 this.markAsRoot(); |
| 443 this.element.classList.add("fill", "root-view"); | 442 this.element.classList.add("root-view"); |
| 444 this.element.setAttribute("spellcheck", false); | 443 this.element.setAttribute("spellcheck", false); |
| 445 window.addEventListener("resize", this.doResize.bind(this), true); | 444 window.addEventListener("resize", this.doResize.bind(this), true); |
| 445 this._onScrollBound = this._onScroll.bind(this); |
| 446 }; | 446 }; |
| 447 | 447 |
| 448 WebInspector.RootView.prototype = { | 448 WebInspector.RootView.prototype = { |
| 449 attachToBody: function() |
| 450 { |
| 451 this.doResize(); |
| 452 this.show(document.body); |
| 453 }, |
| 454 |
| 455 _onScroll: function() |
| 456 { |
| 457 // If we didn't have enough space at the start, we may have wrong scroll
offsets. |
| 458 if (document.body.scrollTop !== 0) |
| 459 document.body.scrollTop = 0; |
| 460 if (document.body.scrollLeft !== 0) |
| 461 document.body.scrollLeft = 0; |
| 462 }, |
| 463 |
| 464 doResize: function() |
| 465 { |
| 466 var size = this.minimumSize(); |
| 467 var right = Math.min(0, window.innerWidth - size.width); |
| 468 this.element.style.right = right + "px"; |
| 469 var bottom = Math.min(0, window.innerHeight - size.height); |
| 470 this.element.style.bottom = bottom + "px"; |
| 471 |
| 472 if (window.innerWidth < size.width || window.innerHeight < size.height) |
| 473 window.addEventListener("scroll", this._onScrollBound, false); |
| 474 else |
| 475 window.removeEventListener("scroll", this._onScrollBound, false); |
| 476 |
| 477 WebInspector.VBox.prototype.doResize.call(this); |
| 478 this._onScroll(); |
| 479 }, |
| 480 |
| 449 __proto__: WebInspector.VBox.prototype | 481 __proto__: WebInspector.VBox.prototype |
| 450 }; | 482 }; |
| OLD | NEW |