Reviewed by Adam.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Oct 2007 06:45:10 +0000 (06:45 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Oct 2007 06:45:10 +0000 (06:45 +0000)
        Bug 15727: Resizing the resource sidebar doesn't scale the font preview or network timeline
        http://bugs.webkit.org/show_bug.cgi?id=15727

        Add one window resize listener and call the new resize function on the currentPanel.
        Also call the currentPanel's resize function when resizing the sidebar.

        * page/inspector/DocumentPanel.js: Implement resize and call updateTreeSelection() when
          the panel is shown and when resizing the DOM sidebar.
        * page/inspector/FontPanel.js: Implement resize.
        * page/inspector/NetworkPanel.js: Ditto.
        * page/inspector/inspector.js: Add a window resize listener.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/page/inspector/DocumentPanel.js
WebCore/page/inspector/FontPanel.js
WebCore/page/inspector/NetworkPanel.js
WebCore/page/inspector/inspector.js

index a59caf1efb3817d52079d216184808da9337da55..6ebba64adb50e5bfcd682a40f9249ae666a4bf91 100644 (file)
@@ -1,3 +1,19 @@
+2007-10-27  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Adam.
+
+        Bug 15727: Resizing the resource sidebar doesn't scale the font preview or network timeline
+        http://bugs.webkit.org/show_bug.cgi?id=15727
+
+        Add one window resize listener and call the new resize function on the currentPanel.
+        Also call the currentPanel's resize function when resizing the sidebar.
+
+        * page/inspector/DocumentPanel.js: Implement resize and call updateTreeSelection() when
+          the panel is shown and when resizing the DOM sidebar.
+        * page/inspector/FontPanel.js: Implement resize.
+        * page/inspector/NetworkPanel.js: Ditto.
+        * page/inspector/inspector.js: Add a window resize listener.
+
 2007-10-27  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Oliver.
index 23a6b118ac65d45ca0f823c2419c959b3a7af08c..f53cae86ca42775ec2db6eb81b3d8a9f4f0f827b 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index 7f11081ed2b8c1e118ad65d6ecfbda5bab257ee4..54efd2c4ea72cb79577b60fa137303c66d18af8a 100644 (file)
@@ -48,9 +48,6 @@ WebInspector.DocumentPanel = function(resource, views)
     domView.treeOutline = new TreeOutline(domView.treeListElement);
     domView.treeOutline.panel = this;
 
-    var panel = this;
-    window.addEventListener("resize", function() { panel.updateTreeSelection() }, false);
-
     domView.crumbsElement = document.createElement("div");
     domView.crumbsElement.className = "crumbs";
 
@@ -92,6 +89,17 @@ WebInspector.DocumentPanel = function(resource, views)
 }
 
 WebInspector.DocumentPanel.prototype = {
+    show: function()
+    {
+        WebInspector.SourcePanel.prototype.show.call(this);
+        this.updateTreeSelection();
+    },
+
+    resize: function()
+    {
+        this.updateTreeSelection();
+    },
+
     updateTreeSelection: function()
     {
         if (!this.views.dom.treeOutline || !this.views.dom.treeOutline.selectedTreeElement)
@@ -703,6 +711,9 @@ WebInspector.DocumentPanel.prototype = {
             rightSidebar.style.width = newWidth + "px";
             this.views.dom.sideContentElement.style.right = newWidth + "px";
             this.views.dom.sidebarResizeElement.style.right = (newWidth - 3) + "px";
+
+            this.updateTreeSelection();
+
             event.preventDefault();
         }
     }
index 85e5fb5c94765e25f948c5c2c23102cd98306e44..c1ffd2f85f5839169c10f91e2ed70a6b50b7f1b9 100644 (file)
@@ -42,13 +42,6 @@ WebInspector.FontPanel = function(resource)
     this.fontPreviewElement.innerHTML = "ABCDEFGHIJKLM<br>NOPQRSTUVWXYZ<br>abcdefghijklm<br>nopqrstuvwxyz<br>1234567890";
 
     this.updateFontPreviewSize();
-
-    var panel = this;
-    var resizeListener = function() {
-        panel.updateFontPreviewSize();
-    };
-
-    window.addEventListener("resize", resizeListener, false);
 }
 
 WebInspector.FontPanel.prototype = {
@@ -58,6 +51,11 @@ WebInspector.FontPanel.prototype = {
         this.updateFontPreviewSize();
     },
 
+    resize: function()
+    {
+        this.updateFontPreviewSize();
+    },
+
     updateFontPreviewSize: function ()
     {
         if (!this.fontPreviewElement || !this.visible)
index da5762adb58117579fd8d0debb6101b01816d025..6be5fe268d4040bee59399e6c4e2172a643cca42 100644 (file)
@@ -88,9 +88,6 @@ WebInspector.NetworkPanel = function()
     this.legendElement.className = "network-graph-legend";
     graphSideElement.appendChild(this.legendElement);
 
-    var networkPanel = this;
-    window.addEventListener("resize", function() { networkPanel.updateTimelineDividersIfNeeded() }, false);
-
     this.drawSummaryGraph(); // draws an empty graph
 
     this.needsRefresh = true; 
@@ -110,6 +107,11 @@ WebInspector.NetworkPanel.prototype = {
         WebInspector.networkListItem.deselect();
     },
 
+    resize: function()
+    {
+        this.updateTimelineDividersIfNeeded();
+    },
+
     onClick: function(event)
     {
         var resourceElement = event.target.firstParentOrSelfWithClass("network-resource");
index aef020b16ff27852cf97726db8b7dccd3f8ae8cd..02cf552f67a2d085e19cb4894da527e18a2a5307 100644 (file)
@@ -236,6 +236,8 @@ WebInspector.loaded = function(event)
     this.addMainEventListeners(document);
 
     window.addEventListener("unload", function(event) { WebInspector.windowUnload(event) }, true);
+    window.addEventListener("resize", function(event) { WebInspector.windowResize(event) }, true);
+
     document.addEventListener("mousedown", function(event) { WebInspector.changeFocus(event) }, true);
     document.addEventListener("focus", function(event) { WebInspector.changeFocus(event) }, true);
     document.addEventListener("keypress", function(event) { WebInspector.documentKeypress(event) }, true);
@@ -268,6 +270,12 @@ WebInspector.windowUnload = function(event)
     InspectorController.windowUnloading();
 }
 
+WebInspector.windowResize = function(event)
+{
+    if (this.currentPanel && this.currentPanel.resize)
+        this.currentPanel.resize();
+}
+
 WebInspector.windowFocused = function(event)
 {
     if (event.target.nodeType === Node.DOCUMENT_NODE)
@@ -461,7 +469,6 @@ WebInspector.sidebarResizerDrag = function(event)
 {
     var sidebar = document.getElementById("sidebar");
     if (sidebar.dragging == true) {
-
         var x = event.clientX + window.scrollX;
 
         // FIXME: We can should come up with a better hueristic for constraining the size
@@ -477,6 +484,10 @@ WebInspector.sidebarResizerDrag = function(event)
         document.getElementById("toolbarButtons").style.left = newWidth + "px";
         document.getElementById("searchResults").style.left = newWidth + "px";
         document.getElementById("searchResultsResizer").style.left = newWidth + "px";
+
+        if (WebInspector.currentPanel && WebInspector.currentPanel.resize)
+            WebInspector.currentPanel.resize();
+
         event.preventDefault();
     }
 }