Title: [229495] trunk/Source/WebInspectorUI
Revision
229495
Author
nvasil...@apple.com
Date
2018-03-09 17:24:24 -0800 (Fri, 09 Mar 2018)

Log Message

Web Inspector: Sources: Open all resources in Sources tab instead of Resources/Debugger
https://bugs.webkit.org/show_bug.cgi?id=183317
<rdar://problem/38108455>

Reviewed by Matt Baker.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Main.js:
* UserInterface/Views/ContextMenuUtilities.js:
(WI.appendContextMenuItemsForURL):
Introduce preferredTabType option instead of listing ignoreResourcesTab, ignoreDebuggerTab, ignoreSearchTab, and ignoreNetworkTab.
The only correct outcome of selecting "Reveal in Sources Tab" context menu is to open Sources tab, not any other tab.

* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):
* UserInterface/Views/TabBrowser.js:
(WI.TabBrowser.prototype.bestTabContentViewForRepresentedObject):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (229494 => 229495)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-03-10 01:18:08 UTC (rev 229494)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-03-10 01:24:24 UTC (rev 229495)
@@ -1,3 +1,23 @@
+2018-03-09  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Sources: Open all resources in Sources tab instead of Resources/Debugger
+        https://bugs.webkit.org/show_bug.cgi?id=183317
+        <rdar://problem/38108455>
+
+        Reviewed by Matt Baker.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Base/Main.js:
+        * UserInterface/Views/ContextMenuUtilities.js:
+        (WI.appendContextMenuItemsForURL):
+        Introduce preferredTabType option instead of listing ignoreResourcesTab, ignoreDebuggerTab, ignoreSearchTab, and ignoreNetworkTab.
+        The only correct outcome of selecting "Reveal in Sources Tab" context menu is to open Sources tab, not any other tab.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WI.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):
+        * UserInterface/Views/TabBrowser.js:
+        (WI.TabBrowser.prototype.bestTabContentViewForRepresentedObject):
+
 2018-03-08  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Sources: add SourcesTabContentView and SourceSidebarPanel classes

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (229494 => 229495)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2018-03-10 01:18:08 UTC (rev 229494)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2018-03-10 01:24:24 UTC (rev 229495)
@@ -797,6 +797,7 @@
 localizedStrings["Reveal in Network Tab"] = "Reveal in Network Tab";
 localizedStrings["Reveal in Original Resource"] = "Reveal in Original Resource";
 localizedStrings["Reveal in Resources Tab"] = "Reveal in Resources Tab";
+localizedStrings["Reveal in Sources Tab"] = "Reveal in Sources Tab";
 localizedStrings["Right"] = "Right";
 localizedStrings["Role"] = "Role";
 localizedStrings["Rule"] = "Rule";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (229494 => 229495)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2018-03-10 01:18:08 UTC (rev 229494)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2018-03-10 01:24:24 UTC (rev 229495)
@@ -968,6 +968,23 @@
     return this.tabBrowser.selectedTabContentView instanceof WI.ResourcesTabContentView;
 };
 
+WI.isShowingSourcesTab = function()
+{
+    return this.tabBrowser.selectedTabContentView instanceof WI.SourcesTabContentView;
+};
+
+WI.showSourcesTab = function(options = {})
+{
+    let tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.SourcesTabContentView);
+    if (!tabContentView)
+        tabContentView = new WI.SourcesTabContentView;
+
+    if (options.breakpointToSelect instanceof WI.Breakpoint)
+        tabContentView.revealAndSelectBreakpoint(options.breakpointToSelect);
+
+    this.tabBrowser.showTabForContentView(tabContentView);
+};
+
 WI.showStorageTab = function()
 {
     var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.StorageTabContentView);
@@ -1351,7 +1368,10 @@
 
 WI._debuggerDidPause = function(event)
 {
-    this.showDebuggerTab({showScopeChainSidebar: WI.settings.showScopeChainOnPause.value});
+    if (WI.settings.experimentalEnableSourcesTab.value)
+        this.showSourcesTab();
+    else
+        this.showDebuggerTab({showScopeChainSidebar: WI.settings.showScopeChainOnPause.value});
 
     this._dashboardContainer.showDashboardViewForRepresentedObject(this.dashboardManager.dashboards.debugger);
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js (229494 => 229495)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js	2018-03-10 01:18:08 UTC (rev 229494)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js	2018-03-10 01:24:24 UTC (rev 229495)
@@ -101,7 +101,13 @@
     });
 
     if (WI.frameResourceManager.resourceForURL(url)) {
-        if (!WI.isShowingResourcesTab()) {
+        if (WI.settings.experimentalEnableSourcesTab.value) {
+            if (!WI.isShowingSourcesTab()) {
+                contextMenu.appendItem(WI.UIString("Reveal in Sources Tab"), () => {
+                    showResourceWithOptions({preferredTabType: WI.SourcesTabContentView.Type});
+                });
+            }
+        } else if (!WI.isShowingResourcesTab()) {
             contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
                 showResourceWithOptions({ignoreNetworkTab: true, ignoreSearchTab: true});
             });

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (229494 => 229495)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-03-10 01:18:08 UTC (rev 229494)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-03-10 01:24:24 UTC (rev 229495)
@@ -1248,7 +1248,14 @@
         if (breakpoints.length === 1) {
             WI.breakpointPopoverController.appendContextMenuItems(contextMenu, breakpoints[0], event.target);
 
-            if (!WI.isShowingDebuggerTab()) {
+            if (WI.settings.experimentalEnableSourcesTab.value) {
+                if (!WI.isShowingSourcesTab()) {
+                    contextMenu.appendSeparator();
+                    contextMenu.appendItem(WI.UIString("Reveal in Sources Tab"), () => {
+                        WI.showSourcesTab({breakpointToSelect: breakpoints[0]});
+                    });
+                }
+            } else if (!WI.isShowingDebuggerTab()) {
                 contextMenu.appendSeparator();
                 contextMenu.appendItem(WI.UIString("Reveal in Debugger Tab"), () => {
                     WI.showDebuggerTab({breakpointToSelect: breakpoints[0]});

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js (229494 => 229495)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js	2018-03-10 01:18:08 UTC (rev 229494)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js	2018-03-10 01:24:24 UTC (rev 229495)
@@ -121,6 +121,10 @@
     {
         console.assert(!this.selectedTabContentView || this.selectedTabContentView === this._recentTabContentViews[0]);
 
+        let tabContentView = this._recentTabContentViews.find((tabContentView) => tabContentView.type === options.preferredTabType);
+        if (tabContentView && tabContentView.canShowRepresentedObject(representedObject))
+            return tabContentView;
+
         for (let tabContentView of this._recentTabContentViews) {
             if (options.ignoreSearchTab && tabContentView instanceof WI.SearchTabContentView)
                 continue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to