Changeset 49997 in webkit
- Timestamp:
- Oct 23, 2009 1:47:58 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49996 r49997 1 2009-10-23 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: pull basic sidebar implementation into the Panel. 6 7 https://bugs.webkit.org/show_bug.cgi?id=30720 8 9 * inspector/front-end/Panel.js: 10 (WebInspector.Panel): 11 (WebInspector.Panel.prototype.jumpToPreviousSearchResult): 12 (WebInspector.Panel.prototype.handleKeyEvent): 13 (WebInspector.Panel.prototype._createSidebar): 14 (WebInspector.Panel.prototype._startSidebarDragging): 15 (WebInspector.Panel.prototype._sidebarDragging): 16 (WebInspector.Panel.prototype._endSidebarDragging): 17 (WebInspector.Panel.prototype._updateSidebarWidth): 18 (WebInspector.Panel.prototype.setCenterViewWidth): 19 * inspector/front-end/ProfilesPanel.js: 20 (WebInspector.ProfilesPanel): 21 (WebInspector.ProfilesPanel.prototype.setCenterViewWidth): 22 * inspector/front-end/StoragePanel.js: 23 (WebInspector.StoragePanel): 24 (WebInspector.StoragePanel.prototype.setCenterViewWidth): 25 1 26 2009-10-23 Jens Alfke <snej@chromium.org> 2 27 -
trunk/WebCore/inspector/front-end/Panel.js
r47192 r49997 27 27 */ 28 28 29 WebInspector.Panel = function( )29 WebInspector.Panel = function(createSidebar) 30 30 { 31 31 WebInspector.View.call(this); 32 if (createSidebar) 33 this._createSidebar(); 32 34 33 35 this.element.addStyleClass("panel"); … … 83 85 84 86 WebInspector.currentFocusElement = document.getElementById("main-panels"); 87 this._updateSidebarWidth(); 85 88 }, 86 89 … … 268 271 else 269 272 currentView.jumpToPreviousSearchResult(); 273 }, 274 275 handleKeyEvent: function(event) 276 { 277 this.sidebarTree.handleKeyEvent(event); 278 }, 279 280 _createSidebar: function() 281 { 282 this.sidebarElement = document.createElement("div"); 283 this.sidebarElement.className = "sidebar"; 284 this.element.appendChild(this.sidebarElement); 285 286 this.sidebarResizeElement = document.createElement("div"); 287 this.sidebarResizeElement.className = "sidebar-resizer-vertical"; 288 this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false); 289 this.element.appendChild(this.sidebarResizeElement); 290 291 this.sidebarTreeElement = document.createElement("ol"); 292 this.sidebarTreeElement.className = "sidebar-tree"; 293 this.sidebarElement.appendChild(this.sidebarTreeElement); 294 this.sidebarTree = new TreeOutline(this.sidebarTreeElement); 295 }, 296 297 _startSidebarDragging: function(event) 298 { 299 WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); 300 }, 301 302 _sidebarDragging: function(event) 303 { 304 this._updateSidebarWidth(event.pageX); 305 306 event.preventDefault(); 307 }, 308 309 _endSidebarDragging: function(event) 310 { 311 WebInspector.elementDragEnd(event); 312 }, 313 314 _updateSidebarWidth: function(width) 315 { 316 if (this.sidebarElement.offsetWidth <= 0) { 317 // The stylesheet hasn't loaded yet or the window is closed, 318 // so we can't calculate what is need. Return early. 319 return; 320 } 321 322 if (!("_currentSidebarWidth" in this)) 323 this._currentSidebarWidth = this.sidebarElement.offsetWidth; 324 325 if (typeof width === "undefined") 326 width = this._currentSidebarWidth; 327 328 width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); 329 330 this._currentSidebarWidth = width; 331 332 this.sidebarElement.style.width = width + "px"; 333 this.setMainViewWidth(width); 334 this.sidebarResizeElement.style.left = (width - 3) + "px"; 335 336 var visibleView = this.visibleView; 337 if (visibleView && "resize" in visibleView) 338 visibleView.resize(); 339 }, 340 341 setMainViewWidth: function(width) 342 { 343 // Should be implemented by ancestors. 270 344 } 271 345 } -
trunk/WebCore/inspector/front-end/ProfilesPanel.js
r49905 r49997 86 86 WebInspector.ProfilesPanel = function() 87 87 { 88 WebInspector.Panel.call(this );88 WebInspector.Panel.call(this, true); 89 89 90 90 this.element.addStyleClass("profiles"); … … 99 99 100 100 this.element.appendChild(this.panelEnablerView.element); 101 102 this.sidebarElement = document.createElement("div");103 this.sidebarElement.id = "profiles-sidebar";104 this.sidebarElement.className = "sidebar";105 this.element.appendChild(this.sidebarElement);106 107 this.sidebarResizeElement = document.createElement("div");108 this.sidebarResizeElement.className = "sidebar-resizer-vertical";109 this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false);110 this.element.appendChild(this.sidebarResizeElement);111 112 this.sidebarTreeElement = document.createElement("ol");113 this.sidebarTreeElement.className = "sidebar-tree";114 this.sidebarElement.appendChild(this.sidebarTreeElement);115 this.sidebarTree = new TreeOutline(this.sidebarTreeElement);116 101 117 102 this.profileViews = document.createElement("div"); … … 163 148 { 164 149 WebInspector.Panel.prototype.show.call(this); 165 this._updateSidebarWidth();166 150 if (this._shouldPopulateProfiles) 167 151 this._populateProfiles(); … … 210 194 211 195 this._updateInterface(); 212 },213 214 handleKeyEvent: function(event)215 {216 this.sidebarTree.handleKeyEvent(event);217 196 }, 218 197 … … 471 450 }, 472 451 473 _startSidebarDragging: function(event) 474 { 475 WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); 476 }, 477 478 _sidebarDragging: function(event) 479 { 480 this._updateSidebarWidth(event.pageX); 481 482 event.preventDefault(); 483 }, 484 485 _endSidebarDragging: function(event) 486 { 487 WebInspector.elementDragEnd(event); 488 }, 489 490 _updateSidebarWidth: function(width) 491 { 492 if (this.sidebarElement.offsetWidth <= 0) { 493 // The stylesheet hasn't loaded yet or the window is closed, 494 // so we can't calculate what is need. Return early. 495 return; 496 } 497 498 if (!("_currentSidebarWidth" in this)) 499 this._currentSidebarWidth = this.sidebarElement.offsetWidth; 500 501 if (typeof width === "undefined") 502 width = this._currentSidebarWidth; 503 504 width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); 505 506 this._currentSidebarWidth = width; 507 508 this.sidebarElement.style.width = width + "px"; 452 setMainViewWidth: function(width) 453 { 509 454 this.profileViews.style.left = width + "px"; 510 455 this.profileViewStatusBarItemsContainer.style.left = width + "px"; 511 this.sidebarResizeElement.style.left = (width - 3) + "px";512 513 var visibleView = this.visibleView;514 if (visibleView && "resize" in visibleView)515 visibleView.resize();516 456 } 517 457 } -
trunk/WebCore/inspector/front-end/StoragePanel.js
r49314 r49997 30 30 WebInspector.StoragePanel = function(database) 31 31 { 32 WebInspector.Panel.call(this); 33 34 this.sidebarElement = document.createElement("div"); 35 this.sidebarElement.id = "storage-sidebar"; 36 this.sidebarElement.className = "sidebar"; 37 this.element.appendChild(this.sidebarElement); 38 39 this.sidebarResizeElement = document.createElement("div"); 40 this.sidebarResizeElement.className = "sidebar-resizer-vertical"; 41 this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false); 42 this.element.appendChild(this.sidebarResizeElement); 43 44 this.sidebarTreeElement = document.createElement("ol"); 45 this.sidebarTreeElement.className = "sidebar-tree"; 46 this.sidebarElement.appendChild(this.sidebarTreeElement); 47 48 this.sidebarTree = new TreeOutline(this.sidebarTreeElement); 32 WebInspector.Panel.call(this, true); 49 33 50 34 this.databasesListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("DATABASES"), {}, true); … … 85 69 { 86 70 return [this.storageViewStatusBarItemsContainer]; 87 },88 89 show: function()90 {91 WebInspector.Panel.prototype.show.call(this);92 this._updateSidebarWidth();93 71 }, 94 72 … … 417 395 }, 418 396 419 _startSidebarDragging: function(event) 420 { 421 WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize"); 422 }, 423 424 _sidebarDragging: function(event) 425 { 426 this._updateSidebarWidth(event.pageX); 427 428 event.preventDefault(); 429 }, 430 431 _endSidebarDragging: function(event) 432 { 433 WebInspector.elementDragEnd(event); 434 }, 435 436 _updateSidebarWidth: function(width) 437 { 438 if (this.sidebarElement.offsetWidth <= 0) { 439 // The stylesheet hasn't loaded yet or the window is closed, 440 // so we can't calculate what is need. Return early. 441 return; 442 } 443 444 if (!("_currentSidebarWidth" in this)) 445 this._currentSidebarWidth = this.sidebarElement.offsetWidth; 446 447 if (typeof width === "undefined") 448 width = this._currentSidebarWidth; 449 450 width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2); 451 452 this._currentSidebarWidth = width; 453 454 this.sidebarElement.style.width = width + "px"; 397 setMainViewWidth: function(width) 398 { 455 399 this.storageViews.style.left = width + "px"; 456 400 this.storageViewStatusBarItemsContainer.style.left = width + "px"; 457 this.sidebarResizeElement.style.left = (width - 3) + "px";458 459 var visibleView = this.visibleView;460 if (visibleView && "resize" in visibleView)461 visibleView.resize();462 401 } 463 402 }
Note: See TracChangeset
for help on using the changeset viewer.