Title: [183375] trunk/Source/WebInspectorUI
Revision
183375
Author
[email protected]
Date
2015-04-26 18:24:37 -0700 (Sun, 26 Apr 2015)

Log Message

Web Inspector: Don't use treeElement.revealAndSelect when showing a default content view
https://bugs.webkit.org/show_bug.cgi?id=144239

Using revealAndSelect will end up calling WebInspector.showRepresentedObject. That is not bad
is most cases, but if the select tab supports the same represented object, it can end up showing
the content view in the wrong tab.

Reviewed by Darin Adler.

* UserInterface/Views/ContentBrowserTabContentView.js:
(WebInspector.ContentBrowserTabContentView.prototype._revealAndSelectRepresentedObjectInNavigationSidebar):
* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel.prototype.showDefaultContentView):
* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype.showDefaultContentViewForTreeElement):
(WebInspector.NavigationSidebarPanel.prototype._checkElementsForPendingViewStateCookie):
(WebInspector.NavigationSidebarPanel):
(WebInspector.NavigationSidebarPanel.prototype.showContentViewForCurrentSelection): Deleted.
* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype.showDefaultContentView):
(WebInspector.ResourceSidebarPanel.prototype._mainFrameDidChange):
(WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange.delayedWork):
(WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (183374 => 183375)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-04-27 00:33:48 UTC (rev 183374)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-04-27 01:24:37 UTC (rev 183375)
@@ -1,3 +1,29 @@
+2015-04-26  Timothy Hatcher  <[email protected]>
+
+        Web Inspector: Don't use treeElement.revealAndSelect when showing a default content view
+        https://bugs.webkit.org/show_bug.cgi?id=144239
+
+        Using revealAndSelect will end up calling WebInspector.showRepresentedObject. That is not bad
+        is most cases, but if the select tab supports the same represented object, it can end up showing
+        the content view in the wrong tab.
+
+        Reviewed by Darin Adler.
+
+        * UserInterface/Views/ContentBrowserTabContentView.js:
+        (WebInspector.ContentBrowserTabContentView.prototype._revealAndSelectRepresentedObjectInNavigationSidebar):
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WebInspector.DebuggerSidebarPanel.prototype.showDefaultContentView):
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WebInspector.NavigationSidebarPanel.prototype.showDefaultContentViewForTreeElement):
+        (WebInspector.NavigationSidebarPanel.prototype._checkElementsForPendingViewStateCookie):
+        (WebInspector.NavigationSidebarPanel):
+        (WebInspector.NavigationSidebarPanel.prototype.showContentViewForCurrentSelection): Deleted.
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        (WebInspector.ResourceSidebarPanel.prototype.showDefaultContentView):
+        (WebInspector.ResourceSidebarPanel.prototype._mainFrameDidChange):
+        (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange.delayedWork):
+        (WebInspector.ResourceSidebarPanel.prototype._mainFrameMainResourceDidChange):
+
 2015-04-26  Jono Wells  <[email protected]>
 
         Web Inspector: Vertically misaligned text in Object Trees

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js (183374 => 183375)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2015-04-27 00:33:48 UTC (rev 183374)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowserTabContentView.js	2015-04-27 01:24:37 UTC (rev 183375)
@@ -256,7 +256,7 @@
         var treeElement = this.navigationSidebarPanel.treeElementForRepresentedObject(representedObject);
 
         if (treeElement)
-            treeElement.revealAndSelect(true, false, false, true);
+            treeElement.revealAndSelect(true, false, true, true);
         else if (this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement)
             this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement.deselect(true);
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (183374 => 183375)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2015-04-27 00:33:48 UTC (rev 183374)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2015-04-27 01:24:37 UTC (rev 183375)
@@ -184,7 +184,7 @@
         var currentTreeElement = this._contentTreeOutline.children[0];
         while (currentTreeElement && !currentTreeElement.root) {
             if (currentTreeElement instanceof WebInspector.ResourceTreeElement || currentTreeElement instanceof WebInspector.ScriptTreeElement) {
-                currentTreeElement.revealAndSelect();
+                this.showDefaultContentViewForTreeElement(currentTreeElement);
                 return;
             }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (183374 => 183375)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2015-04-27 00:33:48 UTC (rev 183374)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2015-04-27 01:24:37 UTC (rev 183375)
@@ -173,12 +173,14 @@
         // Implemneted by subclasses if needed to show a content view when no existing tree element is selected.
     }
 
-    showContentViewForCurrentSelection()
+    showDefaultContentViewForTreeElement(treeElement)
     {
-        // Reselect the selected tree element to cause the content view to be shown as well. <rdar://problem/10854727>
-        var selectedTreeElement = this._contentTreeOutline.selectedTreeElement;
-        if (selectedTreeElement)
-            selectedTreeElement.select();
+        console.assert(treeElement);
+        console.assert(treeElement.representedObject);
+        if (!treeElement || !treeElement.representedObject)
+            return;
+        this.contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject);
+        treeElement.revealAndSelect(true, false, true, true);
     }
 
     saveStateToCookie(cookie)
@@ -688,7 +690,7 @@
         }, this);
 
         if (matchedElement) {
-            matchedElement.revealAndSelect();
+            this.showDefaultContentViewForTreeElement(matchedElement);
 
             delete this._pendingViewStateCookie;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (183374 => 183375)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2015-04-27 00:33:48 UTC (rev 183374)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2015-04-27 01:24:37 UTC (rev 183375)
@@ -85,7 +85,7 @@
 
         var firstTreeElement = this.contentTreeOutline.children[0];
         if (firstTreeElement)
-            firstTreeElement.revealAndSelect();
+            this.showDefaultContentViewForTreeElement(firstTreeElement);
     }
 
     treeElementForRepresentedObject(representedObject)
@@ -184,7 +184,7 @@
                 var treeElement = currentContentView ? this.treeElementForRepresentedObject(currentContentView.representedObject) : null;
                 if (!treeElement)
                     treeElement = this._mainFrameTreeElement;
-                treeElement.revealAndSelect(true, false, !!currentContentView, true);
+                this.showDefaultContentViewForTreeElement(treeElement);
             }
         }
 
@@ -220,7 +220,7 @@
             if (!this.contentBrowser.currentContentView || wasShowingResourceContentView) {
                 // NOTE: This selection, during provisional loading, won't be saved, so it is
                 // safe to do and not-clobber cookie restoration.
-                this._mainFrameTreeElement.revealAndSelect(true, false);
+                this.showDefaultContentViewForTreeElement(this._mainFrameTreeElement);
             }
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to