Changeset 50033 in webkit
- Timestamp:
- Oct 24, 2009 4:08:09 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r50032 r50033 1 2009-10-24 Timothy Hatcher <timothy@apple.com> 2 3 Make resizing the Web Inspector's Elements panel sidebar work again. 4 Also makes Resources panel use the sidebar code in Panel. 5 6 https://bugs.webkit.org/show_bug.cgi?id=30742 7 8 Reviewed by Pavel Feldman. 9 10 * inspector/front-end/Panel.js: 11 (WebInspector.Panel): Don't create the sidebar with an argument. 12 (WebInspector.Panel.prototype.show): Call updateSidebarWidth. 13 (WebInspector.Panel.prototype.handleKeyEvent): Call handleSidebarKeyEvent. 14 (WebInspector.Panel.prototype.handleSidebarKeyEvent): Added. 15 (WebInspector.Panel.prototype.createSidebar): Renamed from _createSidebar. 16 (WebInspector.Panel.prototype._sidebarDragging): Call updateSidebarWidth. 17 (WebInspector.Panel.prototype.updateSidebarWidth): Renamed from _updateSidebarWidth. 18 (WebInspector.Panel.prototype.setSidebarWidth): Added. Called by updateSidebarWidth. 19 (WebInspector.Panel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. 20 * inspector/front-end/ProfilesPanel.js: 21 (WebInspector.ProfilesPanel): Call createSidebar. 22 (WebInspector.ProfilesPanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. 23 * inspector/front-end/ResourcesPanel.js: 24 (WebInspector.ResourcesPanel.prototype.show): Remove call to _updateSidebarWidth. 25 (WebInspector.ResourcesPanel.prototype.showResource): Call updateSidebarWidth 26 (WebInspector.ResourcesPanel.prototype.closeVisibleResource): Ditto. 27 (WebInspector.ResourcesPanel.prototype.setSidebarWidth): Added. 28 (WebInspector.ResourcesPanel.prototype.updateMainViewWidth): Added. 29 * inspector/front-end/StoragePanel.js: 30 (WebInspector.StoragePanel): Call createSidebar. 31 (WebInspector.StoragePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. 32 * inspector/front-end/TimelinePanel.js: 33 (WebInspector.TimelinePanel): Call createSidebar. 34 (WebInspector.TimelinePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth. 35 1 36 2009-10-24 Timothy Hatcher <timothy@apple.com> 2 37 -
trunk/WebCore/inspector/front-end/Panel.js
r49997 r50033 27 27 */ 28 28 29 WebInspector.Panel = function( createSidebar)29 WebInspector.Panel = function() 30 30 { 31 31 WebInspector.View.call(this); 32 if (createSidebar)33 this._createSidebar();34 32 35 33 this.element.addStyleClass("panel"); … … 85 83 86 84 WebInspector.currentFocusElement = document.getElementById("main-panels"); 87 this._updateSidebarWidth(); 85 86 this.updateSidebarWidth(); 88 87 }, 89 88 … … 275 274 handleKeyEvent: function(event) 276 275 { 277 this.sidebarTree.handleKeyEvent(event); 278 }, 279 280 _createSidebar: function() 281 { 276 this.handleSidebarKeyEvent(event); 277 }, 278 279 handleSidebarKeyEvent: function(event) 280 { 281 if (this.hasSidebar && this.sidebarTree) 282 this.sidebarTree.handleKeyEvent(event); 283 }, 284 285 createSidebar: function(parentElement, resizerParentElement) 286 { 287 if (this.hasSidebar) 288 return; 289 290 if (!parentElement) 291 parentElement = this.element; 292 293 if (!resizerParentElement) 294 resizerParentElement = parentElement; 295 296 this.hasSidebar = true; 297 282 298 this.sidebarElement = document.createElement("div"); 283 299 this.sidebarElement.className = "sidebar"; 284 this.element.appendChild(this.sidebarElement);300 parentElement.appendChild(this.sidebarElement); 285 301 286 302 this.sidebarResizeElement = document.createElement("div"); 287 303 this.sidebarResizeElement.className = "sidebar-resizer-vertical"; 288 304 this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false); 289 this.element.appendChild(this.sidebarResizeElement);305 resizerParentElement.appendChild(this.sidebarResizeElement); 290 306 291 307 this.sidebarTreeElement = document.createElement("ol"); 292 308 this.sidebarTreeElement.className = "sidebar-tree"; 293 309 this.sidebarElement.appendChild(this.sidebarTreeElement); 310 294 311 this.sidebarTree = new TreeOutline(this.sidebarTreeElement); 295 312 }, … … 302 319 _sidebarDragging: function(event) 303 320 { 304 this. _updateSidebarWidth(event.pageX);321 this.updateSidebarWidth(event.pageX); 305 322 306 323 event.preventDefault(); … … 312 329 }, 313 330 314 _updateSidebarWidth: function(width) 315 { 331 updateSidebarWidth: function(width) 332 { 333 if (!this.hasSidebar) 334 return; 335 316 336 if (this.sidebarElement.offsetWidth <= 0) { 317 337 // The stylesheet hasn't loaded yet or the window is closed, … … 329 349 330 350 this._currentSidebarWidth = width; 331 332 this.sidebarElement.style.width = width + "px"; 333 this.setMainViewWidth(width); 334 this.sidebarResizeElement.style.left = (width - 3) + "px"; 335 351 this.setSidebarWidth(width); 352 353 this.updateMainViewWidth(width); 354 336 355 var visibleView = this.visibleView; 337 356 if (visibleView && "resize" in visibleView) 338 357 visibleView.resize(); 339 358 }, 340 341 setMainViewWidth: function(width) 359 360 setSidebarWidth: function(width) 361 { 362 this.sidebarElement.style.width = width + "px"; 363 this.sidebarResizeElement.style.left = (width - 3) + "px"; 364 }, 365 366 updateMainViewWidth: function(width) 342 367 { 343 368 // Should be implemented by ancestors. -
trunk/WebCore/inspector/front-end/ProfilesPanel.js
r49997 r50033 86 86 WebInspector.ProfilesPanel = function() 87 87 { 88 WebInspector.Panel.call(this, true); 88 WebInspector.Panel.call(this); 89 90 this.createSidebar(); 89 91 90 92 this.element.addStyleClass("profiles"); … … 450 452 }, 451 453 452 setMainViewWidth: function(width)454 updateMainViewWidth: function(width) 453 455 { 454 456 this.profileViews.style.left = width + "px"; -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r50021 r50033 47 47 this.element.appendChild(this.containerElement); 48 48 49 this.sidebarElement = document.createElement("div"); 49 this.createSidebar(this.containerElement, this.element); 50 50 51 this.sidebarElement.id = "resources-sidebar"; 51 this.sidebarElement.className = "sidebar";52 this.containerElement.appendChild(this.sidebarElement);53 54 this.sidebarResizeElement = document.createElement("div");55 this.sidebarResizeElement.className = "sidebar-resizer-vertical";56 this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false);57 this.element.appendChild(this.sidebarResizeElement);58 52 59 53 this.containerContentElement = document.createElement("div"); … … 80 74 this.dividersLabelBarElement.id = "resources-dividers-label-bar"; 81 75 this.containerContentElement.appendChild(this.dividersLabelBarElement); 82 83 this.sidebarTreeElement = document.createElement("ol");84 this.sidebarTreeElement.className = "sidebar-tree";85 this.sidebarElement.appendChild(this.sidebarTreeElement);86 87 this.sidebarTree = new TreeOutline(this.sidebarTreeElement);88 76 89 77 var timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time")); … … 285 273 286 274 this._updateDividersLabelBarPosition(); 287 this._updateSidebarWidth();288 275 this.refreshIfNeeded(); 289 276 … … 676 663 this.visibleResource = resource; 677 664 678 this. _updateSidebarWidth();665 this.updateSidebarWidth(); 679 666 }, 680 667 … … 698 685 this._lastSelectedGraphTreeElement.select(true); 699 686 700 this. _updateSidebarWidth();687 this.updateSidebarWidth(); 701 688 }, 702 689 … … 725 712 view.setupSourceFrameIfNeeded(); 726 713 return view.sourceFrame; 727 },728 729 handleKeyEvent: function(event)730 {731 this.sidebarTree.handleKeyEvent(event);732 714 }, 733 715 … … 927 909 }, 928 910 929 _startSidebarDragging: function(event) 930 { 931 WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); 932 }, 933 934 _sidebarDragging: function(event) 935 { 936 this._updateSidebarWidth(event.pageX); 937 938 event.preventDefault(); 939 }, 940 941 _endSidebarDragging: function(event) 942 { 943 WebInspector.elementDragEnd(event); 944 }, 945 946 _updateSidebarWidth: function(width) 947 { 948 if (this.sidebarElement.offsetWidth <= 0) { 949 // The stylesheet hasn't loaded yet or the window is closed, 950 // so we can't calculate what is need. Return early. 951 return; 952 } 953 954 if (!("_currentSidebarWidth" in this)) 955 this._currentSidebarWidth = this.sidebarElement.offsetWidth; 956 957 if (typeof width === "undefined") 958 width = this._currentSidebarWidth; 959 960 width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); 961 962 this._currentSidebarWidth = width; 963 911 setSidebarWidth: function(width) 912 { 964 913 if (this.visibleResource) { 965 914 this.containerElement.style.width = width + "px"; … … 970 919 } 971 920 921 this.sidebarResizeElement.style.left = (width - 3) + "px"; 922 }, 923 924 updateMainViewWidth: function(width) 925 { 972 926 this.containerContentElement.style.left = width + "px"; 973 927 this.viewsContainerElement.style.left = width + "px"; 974 this.sidebarResizeElement.style.left = (width - 3) + "px";975 928 976 929 this._updateGraphDividersIfNeeded(); 977 978 var visibleView = this.visibleView;979 if (visibleView && "resize" in visibleView)980 visibleView.resize();981 930 }, 982 931 -
trunk/WebCore/inspector/front-end/StoragePanel.js
r49997 r50033 30 30 WebInspector.StoragePanel = function(database) 31 31 { 32 WebInspector.Panel.call(this, true); 32 WebInspector.Panel.call(this); 33 34 this.createSidebar(); 33 35 34 36 this.databasesListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("DATABASES"), {}, true); … … 110 112 if (this.sidebarTree.selectedTreeElement) 111 113 this.sidebarTree.selectedTreeElement.deselect(); 112 },113 114 handleKeyEvent: function(event)115 {116 this.sidebarTree.handleKeyEvent(event);117 114 }, 118 115 … … 395 392 }, 396 393 397 setMainViewWidth: function(width)394 updateMainViewWidth: function(width) 398 395 { 399 396 this.storageViews.style.left = width + "px"; -
trunk/WebCore/inspector/front-end/TimelinePanel.js
r50015 r50033 31 31 WebInspector.TimelinePanel = function() 32 32 { 33 WebInspector.Panel.call(this, true); 33 WebInspector.Panel.call(this); 34 35 this.createSidebar(); 34 36 35 37 this.element.addStyleClass("timeline"); … … 58 60 { 59 61 return [this.toggleTimelineButton.element]; 60 },61 62 handleKeyEvent: function(event)63 {64 this.sidebarTree.handleKeyEvent(event);65 62 }, 66 63 … … 98 95 }, 99 96 100 setMainViewWidth: function(width)97 updateMainViewWidth: function(width) 101 98 { 102 99 this.timelineView.style.left = width + "px";
Note: See TracChangeset
for help on using the changeset viewer.