[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

timothy at apple.com timothy at apple.com
Thu Oct 29 20:51:27 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 68ef0aa572a4562aa92aedcd8ba68ecdef5b987c
Author: timothy at apple.com <timothy at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Oct 24 23:08:09 2009 +0000

    Make resizing the Web Inspector's Elements panel sidebar work again.
    Also makes Resources panel use the sidebar code in Panel.
    
    https://bugs.webkit.org/show_bug.cgi?id=30742
    
    Reviewed by Pavel Feldman.
    
    * inspector/front-end/Panel.js:
    (WebInspector.Panel): Don't create the sidebar with an argument.
    (WebInspector.Panel.prototype.show): Call updateSidebarWidth.
    (WebInspector.Panel.prototype.handleKeyEvent): Call handleSidebarKeyEvent.
    (WebInspector.Panel.prototype.handleSidebarKeyEvent): Added.
    (WebInspector.Panel.prototype.createSidebar): Renamed from _createSidebar.
    (WebInspector.Panel.prototype._sidebarDragging): Call updateSidebarWidth.
    (WebInspector.Panel.prototype.updateSidebarWidth): Renamed from _updateSidebarWidth.
    (WebInspector.Panel.prototype.setSidebarWidth): Added. Called by updateSidebarWidth.
    (WebInspector.Panel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
    * inspector/front-end/ProfilesPanel.js:
    (WebInspector.ProfilesPanel): Call createSidebar.
    (WebInspector.ProfilesPanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
    * inspector/front-end/ResourcesPanel.js:
    (WebInspector.ResourcesPanel.prototype.show): Remove call to _updateSidebarWidth.
    (WebInspector.ResourcesPanel.prototype.showResource): Call updateSidebarWidth
    (WebInspector.ResourcesPanel.prototype.closeVisibleResource): Ditto.
    (WebInspector.ResourcesPanel.prototype.setSidebarWidth): Added.
    (WebInspector.ResourcesPanel.prototype.updateMainViewWidth): Added.
    * inspector/front-end/StoragePanel.js:
    (WebInspector.StoragePanel): Call createSidebar.
    (WebInspector.StoragePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
    * inspector/front-end/TimelinePanel.js:
    (WebInspector.TimelinePanel): Call createSidebar.
    (WebInspector.TimelinePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50033 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ae2a9ce..4263a3f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,40 @@
 2009-10-24  Timothy Hatcher  <timothy at apple.com>
 
+        Make resizing the Web Inspector's Elements panel sidebar work again.
+        Also makes Resources panel use the sidebar code in Panel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30742
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/Panel.js:
+        (WebInspector.Panel): Don't create the sidebar with an argument.
+        (WebInspector.Panel.prototype.show): Call updateSidebarWidth.
+        (WebInspector.Panel.prototype.handleKeyEvent): Call handleSidebarKeyEvent.
+        (WebInspector.Panel.prototype.handleSidebarKeyEvent): Added.
+        (WebInspector.Panel.prototype.createSidebar): Renamed from _createSidebar.
+        (WebInspector.Panel.prototype._sidebarDragging): Call updateSidebarWidth.
+        (WebInspector.Panel.prototype.updateSidebarWidth): Renamed from _updateSidebarWidth.
+        (WebInspector.Panel.prototype.setSidebarWidth): Added. Called by updateSidebarWidth.
+        (WebInspector.Panel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfilesPanel): Call createSidebar.
+        (WebInspector.ProfilesPanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel.prototype.show): Remove call to _updateSidebarWidth.
+        (WebInspector.ResourcesPanel.prototype.showResource): Call updateSidebarWidth
+        (WebInspector.ResourcesPanel.prototype.closeVisibleResource): Ditto.
+        (WebInspector.ResourcesPanel.prototype.setSidebarWidth): Added.
+        (WebInspector.ResourcesPanel.prototype.updateMainViewWidth): Added.
+        * inspector/front-end/StoragePanel.js:
+        (WebInspector.StoragePanel): Call createSidebar.
+        (WebInspector.StoragePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel): Call createSidebar.
+        (WebInspector.TimelinePanel.prototype.updateMainViewWidth): Renamed from setMainViewWidth.
+
+2009-10-24  Timothy Hatcher  <timothy at apple.com>
+
         Call updateSelection() in a few places so hovering in the Web Inspector's
         Elements panel always has the correct row selection height.
 
diff --git a/WebCore/inspector/front-end/Panel.js b/WebCore/inspector/front-end/Panel.js
index 376bb82..6cd200b 100644
--- a/WebCore/inspector/front-end/Panel.js
+++ b/WebCore/inspector/front-end/Panel.js
@@ -26,11 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Panel = function(createSidebar)
+WebInspector.Panel = function()
 {
     WebInspector.View.call(this);
-    if (createSidebar)
-        this._createSidebar();
 
     this.element.addStyleClass("panel");
 }
@@ -84,7 +82,8 @@ WebInspector.Panel.prototype = {
             this._toolbarItem.addStyleClass("toggled-on");
 
         WebInspector.currentFocusElement = document.getElementById("main-panels");
-        this._updateSidebarWidth();
+
+        this.updateSidebarWidth();
     },
 
     hide: function()
@@ -274,23 +273,41 @@ WebInspector.Panel.prototype = {
 
     handleKeyEvent: function(event)
     {
-        this.sidebarTree.handleKeyEvent(event);
+        this.handleSidebarKeyEvent(event);
+    },
+
+    handleSidebarKeyEvent: function(event)
+    {
+        if (this.hasSidebar && this.sidebarTree)
+            this.sidebarTree.handleKeyEvent(event);
     },
 
-    _createSidebar: function()
+    createSidebar: function(parentElement, resizerParentElement)
     {
+        if (this.hasSidebar)
+            return;
+
+        if (!parentElement)
+            parentElement = this.element;
+
+        if (!resizerParentElement)
+            resizerParentElement = parentElement;
+
+        this.hasSidebar = true;
+
         this.sidebarElement = document.createElement("div");
         this.sidebarElement.className = "sidebar";
-        this.element.appendChild(this.sidebarElement);
+        parentElement.appendChild(this.sidebarElement);
 
         this.sidebarResizeElement = document.createElement("div");
         this.sidebarResizeElement.className = "sidebar-resizer-vertical";
         this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false);
-        this.element.appendChild(this.sidebarResizeElement);
+        resizerParentElement.appendChild(this.sidebarResizeElement);
 
         this.sidebarTreeElement = document.createElement("ol");
         this.sidebarTreeElement.className = "sidebar-tree";
         this.sidebarElement.appendChild(this.sidebarTreeElement);
+
         this.sidebarTree = new TreeOutline(this.sidebarTreeElement);
     },
 
@@ -301,7 +318,7 @@ WebInspector.Panel.prototype = {
 
     _sidebarDragging: function(event)
     {
-        this._updateSidebarWidth(event.pageX);
+        this.updateSidebarWidth(event.pageX);
 
         event.preventDefault();
     },
@@ -311,8 +328,11 @@ WebInspector.Panel.prototype = {
         WebInspector.elementDragEnd(event);
     },
 
-    _updateSidebarWidth: function(width)
+    updateSidebarWidth: function(width)
     {
+        if (!this.hasSidebar)
+            return;
+
         if (this.sidebarElement.offsetWidth <= 0) {
             // The stylesheet hasn't loaded yet or the window is closed,
             // so we can't calculate what is need. Return early.
@@ -328,17 +348,22 @@ WebInspector.Panel.prototype = {
         width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2);
 
         this._currentSidebarWidth = width;
+        this.setSidebarWidth(width);
+
+        this.updateMainViewWidth(width);
 
-        this.sidebarElement.style.width = width + "px";
-        this.setMainViewWidth(width);
-        this.sidebarResizeElement.style.left = (width - 3) + "px";
-        
         var visibleView = this.visibleView;
         if (visibleView && "resize" in visibleView)
             visibleView.resize();
     },
-    
-    setMainViewWidth: function(width)
+
+    setSidebarWidth: function(width)
+    {
+        this.sidebarElement.style.width = width + "px";
+        this.sidebarResizeElement.style.left = (width - 3) + "px";
+    },
+
+    updateMainViewWidth: function(width)
     {
         // Should be implemented by ancestors.
     }
diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js
index 6acc64e..74c2bb6 100644
--- a/WebCore/inspector/front-end/ProfilesPanel.js
+++ b/WebCore/inspector/front-end/ProfilesPanel.js
@@ -85,7 +85,9 @@ WebInspector.ProfileType.prototype = {
 
 WebInspector.ProfilesPanel = function()
 {
-    WebInspector.Panel.call(this, true);
+    WebInspector.Panel.call(this);
+
+    this.createSidebar();
 
     this.element.addStyleClass("profiles");
     this._profileTypesByIdMap = {};
@@ -449,7 +451,7 @@ WebInspector.ProfilesPanel.prototype = {
         delete this._shouldPopulateProfiles;
     },
 
-    setMainViewWidth: function(width)
+    updateMainViewWidth: function(width)
     {
         this.profileViews.style.left = width + "px";
         this.profileViewStatusBarItemsContainer.style.left = width + "px";
diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js
index 36d657d..35fcd88 100644
--- a/WebCore/inspector/front-end/ResourcesPanel.js
+++ b/WebCore/inspector/front-end/ResourcesPanel.js
@@ -46,15 +46,9 @@ WebInspector.ResourcesPanel = function()
     this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false);
     this.element.appendChild(this.containerElement);
 
-    this.sidebarElement = document.createElement("div");
-    this.sidebarElement.id = "resources-sidebar";
-    this.sidebarElement.className = "sidebar";
-    this.containerElement.appendChild(this.sidebarElement);
+    this.createSidebar(this.containerElement, this.element);
 
-    this.sidebarResizeElement = document.createElement("div");
-    this.sidebarResizeElement.className = "sidebar-resizer-vertical";
-    this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false);
-    this.element.appendChild(this.sidebarResizeElement);
+    this.sidebarElement.id = "resources-sidebar";
 
     this.containerContentElement = document.createElement("div");
     this.containerContentElement.id = "resources-container-content";
@@ -80,12 +74,6 @@ WebInspector.ResourcesPanel = function()
     this.dividersLabelBarElement.id = "resources-dividers-label-bar";
     this.containerContentElement.appendChild(this.dividersLabelBarElement);
 
-    this.sidebarTreeElement = document.createElement("ol");
-    this.sidebarTreeElement.className = "sidebar-tree";
-    this.sidebarElement.appendChild(this.sidebarTreeElement);
-
-    this.sidebarTree = new TreeOutline(this.sidebarTreeElement);
-
     var timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time"));
     timeGraphItem.onselect = this._graphSelected.bind(this);
 
@@ -284,7 +272,6 @@ WebInspector.ResourcesPanel.prototype = {
         WebInspector.Panel.prototype.show.call(this);
 
         this._updateDividersLabelBarPosition();
-        this._updateSidebarWidth();
         this.refreshIfNeeded();
 
         var visibleView = this.visibleView;
@@ -675,7 +662,7 @@ WebInspector.ResourcesPanel.prototype = {
 
         this.visibleResource = resource;
 
-        this._updateSidebarWidth();
+        this.updateSidebarWidth();
     },
 
     showView: function(view)
@@ -697,7 +684,7 @@ WebInspector.ResourcesPanel.prototype = {
         if (this._lastSelectedGraphTreeElement)
             this._lastSelectedGraphTreeElement.select(true);
 
-        this._updateSidebarWidth();
+        this.updateSidebarWidth();
     },
 
     resourceViewForResource: function(resource)
@@ -726,11 +713,6 @@ WebInspector.ResourcesPanel.prototype = {
         return view.sourceFrame;
     },
 
-    handleKeyEvent: function(event)
-    {
-        this.sidebarTree.handleKeyEvent(event);
-    },
-
     _sortResourcesIfNeeded: function()
     {
         var sortedElements = [].concat(this.resourcesTreeElement.children);
@@ -926,41 +908,8 @@ WebInspector.ResourcesPanel.prototype = {
         }
     },
 
-    _startSidebarDragging: function(event)
-    {
-        WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize");
-    },
-
-    _sidebarDragging: function(event)
-    {
-        this._updateSidebarWidth(event.pageX);
-
-        event.preventDefault();
-    },
-
-    _endSidebarDragging: function(event)
+    setSidebarWidth: function(width)
     {
-        WebInspector.elementDragEnd(event);
-    },
-
-    _updateSidebarWidth: function(width)
-    {
-        if (this.sidebarElement.offsetWidth <= 0) {
-            // The stylesheet hasn't loaded yet or the window is closed,
-            // so we can't calculate what is need. Return early.
-            return;
-        }
-
-        if (!("_currentSidebarWidth" in this))
-            this._currentSidebarWidth = this.sidebarElement.offsetWidth;
-
-        if (typeof width === "undefined")
-            width = this._currentSidebarWidth;
-
-        width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2);
-
-        this._currentSidebarWidth = width;
-
         if (this.visibleResource) {
             this.containerElement.style.width = width + "px";
             this.sidebarElement.style.removeProperty("width");
@@ -969,15 +918,15 @@ WebInspector.ResourcesPanel.prototype = {
             this.containerElement.style.removeProperty("width");
         }
 
+        this.sidebarResizeElement.style.left = (width - 3) + "px";
+    },
+
+    updateMainViewWidth: function(width)
+    {
         this.containerContentElement.style.left = width + "px";
         this.viewsContainerElement.style.left = width + "px";
-        this.sidebarResizeElement.style.left = (width - 3) + "px";
 
         this._updateGraphDividersIfNeeded();
-
-        var visibleView = this.visibleView;
-        if (visibleView && "resize" in visibleView)
-            visibleView.resize();
     },
 
     _enableResourceTracking: function()
diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js
index 0f068c5..1aa11ee 100644
--- a/WebCore/inspector/front-end/StoragePanel.js
+++ b/WebCore/inspector/front-end/StoragePanel.js
@@ -29,7 +29,9 @@
 
 WebInspector.StoragePanel = function(database)
 {
-    WebInspector.Panel.call(this, true);
+    WebInspector.Panel.call(this);
+
+    this.createSidebar();
 
     this.databasesListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("DATABASES"), {}, true);
     this.sidebarTree.appendChild(this.databasesListTreeElement);
@@ -111,11 +113,6 @@ WebInspector.StoragePanel.prototype = {
             this.sidebarTree.selectedTreeElement.deselect();
     },
 
-    handleKeyEvent: function(event)
-    {
-        this.sidebarTree.handleKeyEvent(event);
-    },
-
     addDatabase: function(database)
     {
         this._databases.push(database);
@@ -394,7 +391,7 @@ WebInspector.StoragePanel.prototype = {
         return null;
     },
 
-    setMainViewWidth: function(width)
+    updateMainViewWidth: function(width)
     {
         this.storageViews.style.left = width + "px";
         this.storageViewStatusBarItemsContainer.style.left = width + "px";
diff --git a/WebCore/inspector/front-end/TimelinePanel.js b/WebCore/inspector/front-end/TimelinePanel.js
index 86034d3..9338de0 100644
--- a/WebCore/inspector/front-end/TimelinePanel.js
+++ b/WebCore/inspector/front-end/TimelinePanel.js
@@ -30,7 +30,9 @@
 
 WebInspector.TimelinePanel = function()
 {
-    WebInspector.Panel.call(this, true);
+    WebInspector.Panel.call(this);
+
+    this.createSidebar();
 
     this.element.addStyleClass("timeline");
 
@@ -59,11 +61,6 @@ WebInspector.TimelinePanel.prototype = {
         return [this.toggleTimelineButton.element];
     },
 
-    handleKeyEvent: function(event)
-    {
-        this.sidebarTree.handleKeyEvent(event);
-    },
-
     timelineWasStarted: function()
     {
         this.toggleTimelineButton.toggled = true;
@@ -97,7 +94,7 @@ WebInspector.TimelinePanel.prototype = {
             InspectorController.startTimelineProfiler();
     },
 
-    setMainViewWidth: function(width)
+    updateMainViewWidth: function(width)
     {
         this.timelineView.style.left = width + "px";
     },

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list