Title: [218305] trunk/Source/WebInspectorUI
Revision
218305
Author
[email protected]
Date
2017-06-14 18:44:40 -0700 (Wed, 14 Jun 2017)

Log Message

Web Inspector: Pretty print / type info / code coverage buttons disappear after switching tabs
https://bugs.webkit.org/show_bug.cgi?id=162515
<rdar://problem/28455322>

Reviewed by Joseph Pecoraro.

Each ContentView owns a list of NavigationItems. When the ContentView moves across
Tabs (ContentBrowsers) it removes its NavigationItems from the old Tab's NavigationBar
and adds them to the new Tab's NavigationBar. When switching back to the original tab
the ContentView is restored, but its NavigationItems are not carried back.

* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser.prototype._updateContentViewNavigationItems):
Add a forceUpdate parameter that is needed when navigationItems are unchanged but navigationBar is
different.

(WebInspector.ContentBrowser.prototype._removeAllNavigationItems):
Remove navigation items even when their navigationBar is no longer a current navigationBar,
e.g. a navigationBar of the previous tab.

(WebInspector.ContentBrowser.prototype._contentViewNavigationItemsDidChange):
* UserInterface/Views/ContentViewContainer.js:
(WebInspector.ContentViewContainer.prototype._takeOwnershipOfContentView):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (218304 => 218305)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-06-15 01:33:57 UTC (rev 218304)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-06-15 01:44:40 UTC (rev 218305)
@@ -1,3 +1,29 @@
+2017-06-14  Nikita Vasilyev  <[email protected]>
+
+        Web Inspector: Pretty print / type info / code coverage buttons disappear after switching tabs
+        https://bugs.webkit.org/show_bug.cgi?id=162515
+        <rdar://problem/28455322>
+
+        Reviewed by Joseph Pecoraro.
+
+        Each ContentView owns a list of NavigationItems. When the ContentView moves across
+        Tabs (ContentBrowsers) it removes its NavigationItems from the old Tab's NavigationBar
+        and adds them to the new Tab's NavigationBar. When switching back to the original tab
+        the ContentView is restored, but its NavigationItems are not carried back.
+
+        * UserInterface/Views/ContentBrowser.js:
+        (WebInspector.ContentBrowser.prototype._updateContentViewNavigationItems):
+        Add a forceUpdate parameter that is needed when navigationItems are unchanged but navigationBar is
+        different.
+
+        (WebInspector.ContentBrowser.prototype._removeAllNavigationItems):
+        Remove navigation items even when their navigationBar is no longer a current navigationBar,
+        e.g. a navigationBar of the previous tab.
+
+        (WebInspector.ContentBrowser.prototype._contentViewNavigationItemsDidChange):
+        * UserInterface/Views/ContentViewContainer.js:
+        (WebInspector.ContentViewContainer.prototype._takeOwnershipOfContentView):
+
 2017-06-14  Devin Rousso  <[email protected]>
 
         Web Inspector: REGRESSION: SVG files and favicon don't display properly

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js (218304 => 218305)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2017-06-15 01:33:57 UTC (rev 218304)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js	2017-06-15 01:44:40 UTC (rev 218305)
@@ -367,9 +367,9 @@
         this._forwardNavigationItem.enabled = this.canGoForward();
     }
 
-    _updateContentViewNavigationItems()
+    _updateContentViewNavigationItems(forceUpdate)
     {
-        var currentContentView = this.currentContentView;
+        let currentContentView = this.currentContentView;
         if (!currentContentView) {
             this._removeAllNavigationItems();
             this._currentContentViewNavigationItems = [];
@@ -376,12 +376,19 @@
             return;
         }
 
-        let previousItems = this._currentContentViewNavigationItems.filter((item) => !(item instanceof WebInspector.DividerNavigationItem));
-        let isUnchanged = Array.shallowEqual(previousItems, currentContentView.navigationItems);
-
-        if (isUnchanged)
+        // If the ContentView is a tombstone within our ContentViewContainer, don't steal its navigationItems.
+        // Only the owning ContentBrowser should have the navigationItems.
+        if (currentContentView.parentContainer !== this._contentViewContainer)
             return;
 
+        if (!forceUpdate) {
+            let previousItems = this._currentContentViewNavigationItems.filter((item) => !(item instanceof WebInspector.DividerNavigationItem));
+            let isUnchanged = Array.shallowEqual(previousItems, currentContentView.navigationItems);
+
+            if (isUnchanged)
+                return;
+        }
+
         this._removeAllNavigationItems();
 
         let navigationBar = this.navigationBar;
@@ -410,8 +417,10 @@
 
     _removeAllNavigationItems()
     {
-        for (let navigationItem of this._currentContentViewNavigationItems)
-            this.navigationBar.removeNavigationItem(navigationItem);
+        for (let navigationItem of this._currentContentViewNavigationItems) {
+            if (navigationItem.parentNavigationBar)
+                navigationItem.parentNavigationBar.removeNavigationItem(navigationItem);
+        }
     }
 
     _updateFindBanner(currentContentView)
@@ -487,7 +496,8 @@
         if (event.target !== this.currentContentView)
             return;
 
-        this._updateContentViewNavigationItems();
+        const forceUpdate = true;
+        this._updateContentViewNavigationItems(forceUpdate);
         this._navigationBar.needsLayout();
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js (218304 => 218305)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js	2017-06-15 01:33:57 UTC (rev 218304)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js	2017-06-15 01:44:40 UTC (rev 218305)
@@ -349,6 +349,9 @@
         contentView._parentContainer = this;
 
         this._clearTombstonesForContentView(contentView);
+
+        // These contentView navigation items need to move to the new content browser.
+        contentView.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);
     }
 
     _placeTombstonesForContentView(contentView)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to