Title: [158879] trunk/Source/WebInspectorUI
Revision
158879
Author
[email protected]
Date
2013-11-07 15:26:35 -0800 (Thu, 07 Nov 2013)

Log Message

Fix up some sidebar switching details to make selections persist better.

Translate represented objects between sidebars so the same item can be reselected
as you switch between frames and main reources. Also fix some null checks that are
needed on selectedSidebarPanel.

https://bugs.webkit.org/show_bug.cgi?id=124001

Reviewed by Joseph Pecoraro.

* UserInterface/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel.prototype.treeElementForRepresentedObject): Added. Translate a Frame
representedObject into a main resource representedObject.
* UserInterface/Main.js:
(WebInspector._revealAndSelectRepresentedObjectInNavigationSidebar): Null check selectedSidebarPanel.
(WebInspector._updateNavigationSidebarForCurrentContentView): Fix a logic error to match other code.
allowedNavigationSidebarPanels.length needs to have a length before using contains.
(WebInspector._contentBrowserCurrentContentViewDidChange): Null check selectedSidebarPanel.
* UserInterface/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype.treeElementForRepresentedObject): Translate a main resource
representedObject into a Frame representedObject.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (158878 => 158879)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-11-07 23:25:09 UTC (rev 158878)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-11-07 23:26:35 UTC (rev 158879)
@@ -1,3 +1,27 @@
+2013-11-07  Timothy Hatcher  <[email protected]>
+
+        Fix up some sidebar switching details to make selections persist better.
+
+        Translate represented objects between sidebars so the same item can be reselected
+        as you switch between frames and main reources. Also fix some null checks that are
+        needed on selectedSidebarPanel.
+
+        https://bugs.webkit.org/show_bug.cgi?id=124001
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/DebuggerSidebarPanel.js:
+        (WebInspector.DebuggerSidebarPanel.prototype.treeElementForRepresentedObject): Added. Translate a Frame
+        representedObject into a main resource representedObject.
+        * UserInterface/Main.js:
+        (WebInspector._revealAndSelectRepresentedObjectInNavigationSidebar): Null check selectedSidebarPanel.
+        (WebInspector._updateNavigationSidebarForCurrentContentView): Fix a logic error to match other code.
+        allowedNavigationSidebarPanels.length needs to have a length before using contains.
+        (WebInspector._contentBrowserCurrentContentViewDidChange): Null check selectedSidebarPanel.
+        * UserInterface/ResourceSidebarPanel.js:
+        (WebInspector.ResourceSidebarPanel.prototype.treeElementForRepresentedObject): Translate a main resource
+        representedObject into a Frame representedObject.
+
 2013-11-07  Alexandru Chiculita  <[email protected]>
 
         Web Inspector: CSS Regions: Removing a content node of a ContentFlow from the DOM will send a 0 nodeId

Modified: trunk/Source/WebInspectorUI/UserInterface/DebuggerSidebarPanel.js (158878 => 158879)


--- trunk/Source/WebInspectorUI/UserInterface/DebuggerSidebarPanel.js	2013-11-07 23:25:09 UTC (rev 158878)
+++ trunk/Source/WebInspectorUI/UserInterface/DebuggerSidebarPanel.js	2013-11-07 23:26:35 UTC (rev 158879)
@@ -123,6 +123,17 @@
 WebInspector.DebuggerSidebarPanel.prototype = {
     constructor: WebInspector.DebuggerSidebarPanel,
 
+    // Public
+
+    treeElementForRepresentedObject: function(representedObject)
+    {
+        // The main resource is used as the representedObject instead of Frame in our tree.
+        if (representedObject instanceof WebInspector.Frame)
+            representedObject = representedObject.mainResource;
+
+        return this.contentTreeOutline.getCachedTreeElement(representedObject);
+    },
+
     // Private
 
     _debuggerPauseResumeButtonClicked: function(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Main.js (158878 => 158879)


--- trunk/Source/WebInspectorUI/UserInterface/Main.js	2013-11-07 23:25:09 UTC (rev 158878)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.js	2013-11-07 23:26:35 UTC (rev 158879)
@@ -839,6 +839,8 @@
         return;
 
     var selectedSidebarPanel = this.navigationSidebar.selectedSidebarPanel;
+    if (!selectedSidebarPanel)
+        return;
 
     // If the tree outline is processing a selection currently then we can assume the selection does not
     // need to be changed. This is needed to allow breakpoints tree elements to be selected without jumping
@@ -869,7 +871,7 @@
     // Ensure the navigation sidebar panel is allowed by the current content view, if not ask the sidebar panel
     // to show the content view for the current selection.
     var allowedNavigationSidebarPanels = currentContentView.allowedNavigationSidebarPanels;
-    if (!allowedNavigationSidebarPanels.contains(selectedSidebarPanel.identifier)) {
+    if (allowedNavigationSidebarPanels.length && !allowedNavigationSidebarPanels.contains(selectedSidebarPanel.identifier)) {
         selectedSidebarPanel.showContentViewForCurrentSelection();
 
         // Fetch the current content view again, since it likely changed.
@@ -1001,9 +1003,13 @@
     if (!currentContentView)
         return;
 
+    var selectedSidebarPanel = this.navigationSidebar.selectedSidebarPanel;
+    if (!selectedSidebarPanel)
+        return;
+
     // Ensure the navigation sidebar panel is allowed by the current content view, if not change the navigation sidebar panel
     // to the last navigation sidebar panel used with the content view or the first one allowed.
-    var selectedSidebarPanelIdentifier = this.navigationSidebar.selectedSidebarPanel.identifier;
+    var selectedSidebarPanelIdentifier = selectedSidebarPanel.identifier;
 
     var allowedNavigationSidebarPanels = currentContentView.allowedNavigationSidebarPanels;
     if (allowedNavigationSidebarPanels.length && !allowedNavigationSidebarPanels.contains(selectedSidebarPanelIdentifier)) {

Modified: trunk/Source/WebInspectorUI/UserInterface/ResourceSidebarPanel.js (158878 => 158879)


--- trunk/Source/WebInspectorUI/UserInterface/ResourceSidebarPanel.js	2013-11-07 23:25:09 UTC (rev 158878)
+++ trunk/Source/WebInspectorUI/UserInterface/ResourceSidebarPanel.js	2013-11-07 23:26:35 UTC (rev 158879)
@@ -210,6 +210,10 @@
     {
         // A custom implementation is needed for this since the frames are populated lazily.
 
+        // The Frame is used as the representedObject instead of the main resource in our tree.
+        if (representedObject instanceof WebInspector.Resource && representedObject.parentFrame.mainResource === representedObject)
+            representedObject = representedObject.parentFrame;
+
         function isAncestor(ancestor, resourceOrFrame)
         {
             // SourceMapResources are descendants of another SourceCode object.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to