Title: [253706] trunk/Source/WebInspectorUI
Revision
253706
Author
[email protected]
Date
2019-12-18 12:06:19 -0800 (Wed, 18 Dec 2019)

Log Message

Web Inspector: Elements: remove the "Show/Hide Shadow DOM" navigation item
https://bugs.webkit.org/show_bug.cgi?id=205199

Reviewed by Timothy Hatcher.

There's really no good reason to hide shadow DOM, especially for non-user-agent shadow trees.
The user has full control over whether to expand/collapse shadow trees (and their hosts), so
having a setting that entirely removes the shadow trees from view throughout Web Inspector
seems overkill.

* UserInterface/Base/Setting.js:

* UserInterface/Models/DOMNode.js:
(WI.DOMNode):
(WI.DOMNode.prototype.get nextSibling):
(WI.DOMNode.prototype.get previousSibling):
(WI.DOMNode.prototype.get children):
(WI.DOMNode.prototype.get childNodeCount):

* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView):
(WI.DOMTreeContentView.prototype.get navigationItems):
(WI.DOMTreeContentView.prototype.closed):
(WI.DOMTreeContentView.prototype._showShadowDOMSettingChanged): Deleted.
(WI.DOMTreeContentView.prototype._toggleShowsShadowDOMSetting): Deleted.

* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.close):
(WI.DOMTreeOutline.prototype._revealAndSelectNode):
(WI.DOMTreeOutline.prototype._showShadowDOMSettingChanged): Deleted.

* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
(WI.LayerTreeDetailsSidebarPanel.prototype.initialLayout):
(WI.LayerTreeDetailsSidebarPanel.prototype._updateDisplayWithLayers):
(WI.LayerTreeDetailsSidebarPanel.prototype._showShadowDOMSettingChanged): Deleted.

* UserInterface/Images/ShadowDOM.svg: Removed.
* Localizations/en.lproj/localizedStrings.js:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (253705 => 253706)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-12-18 20:06:19 UTC (rev 253706)
@@ -1,3 +1,44 @@
+2019-12-18  Devin Rousso  <[email protected]>
+
+        Web Inspector: Elements: remove the "Show/Hide Shadow DOM" navigation item
+        https://bugs.webkit.org/show_bug.cgi?id=205199
+
+        Reviewed by Timothy Hatcher.
+
+        There's really no good reason to hide shadow DOM, especially for non-user-agent shadow trees.
+        The user has full control over whether to expand/collapse shadow trees (and their hosts), so
+        having a setting that entirely removes the shadow trees from view throughout Web Inspector
+        seems overkill.
+
+        * UserInterface/Base/Setting.js:
+
+        * UserInterface/Models/DOMNode.js:
+        (WI.DOMNode):
+        (WI.DOMNode.prototype.get nextSibling):
+        (WI.DOMNode.prototype.get previousSibling):
+        (WI.DOMNode.prototype.get children):
+        (WI.DOMNode.prototype.get childNodeCount):
+
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WI.DOMTreeContentView):
+        (WI.DOMTreeContentView.prototype.get navigationItems):
+        (WI.DOMTreeContentView.prototype.closed):
+        (WI.DOMTreeContentView.prototype._showShadowDOMSettingChanged): Deleted.
+        (WI.DOMTreeContentView.prototype._toggleShowsShadowDOMSetting): Deleted.
+
+        * UserInterface/Views/DOMTreeOutline.js:
+        (WI.DOMTreeOutline.prototype.close):
+        (WI.DOMTreeOutline.prototype._revealAndSelectNode):
+        (WI.DOMTreeOutline.prototype._showShadowDOMSettingChanged): Deleted.
+
+        * UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
+        (WI.LayerTreeDetailsSidebarPanel.prototype.initialLayout):
+        (WI.LayerTreeDetailsSidebarPanel.prototype._updateDisplayWithLayers):
+        (WI.LayerTreeDetailsSidebarPanel.prototype._showShadowDOMSettingChanged): Deleted.
+
+        * UserInterface/Images/ShadowDOM.svg: Removed.
+        * Localizations/en.lproj/localizedStrings.js:
+
 2019-12-11  Brian Burg  <[email protected]>
 
         Web Inspector: add TabNavigation diagnostic event and related hooks

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


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2019-12-18 20:06:19 UTC (rev 253706)
@@ -608,7 +608,6 @@
 localizedStrings["Hide Path"] = "Hide Path";
 localizedStrings["Hide compositing borders"] = "Hide compositing borders";
 localizedStrings["Hide rulers"] = "Hide rulers";
-localizedStrings["Hide shadow DOM nodes"] = "Hide shadow DOM nodes";
 localizedStrings["Hide the details sidebar (%s)"] = "Hide the details sidebar (%s)";
 localizedStrings["Hide the navigation sidebar (%s)"] = "Hide the navigation sidebar (%s)";
 localizedStrings["Hide transparency grid"] = "Hide transparency grid";
@@ -1074,7 +1073,6 @@
 localizedStrings["Show page resources"] = "Show page resources";
 localizedStrings["Show page rulers and node border lines"] = "Show page rulers and node border lines";
 localizedStrings["Show rulers"] = "Show rulers";
-localizedStrings["Show shadow DOM nodes"] = "Show shadow DOM nodes";
 localizedStrings["Show the details sidebar (%s)"] = "Show the details sidebar (%s)";
 localizedStrings["Show the navigation sidebar (%s)"] = "Show the navigation sidebar (%s)";
 localizedStrings["Show transparency grid"] = "Show transparency grid";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js (253705 => 253706)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js	2019-12-18 20:06:19 UTC (rev 253706)
@@ -210,7 +210,6 @@
     showRulers: new WI.Setting("show-rulers", false),
     showRulersDuringElementSelection: new WI.Setting("show-rulers-during-element-selection", true),
     showScopeChainOnPause: new WI.Setting("show-scope-chain-sidebar", true),
-    showShadowDOM: new WI.Setting("show-shadow-dom", true),
     showWhitespaceCharacters: new WI.Setting("show-whitespace-characters", false),
     tabSize: new WI.Setting("tab-size", 4),
     timelinesAutoStop: new WI.Setting("timelines-auto-stop", true),

Deleted: trunk/Source/WebInspectorUI/UserInterface/Images/ShadowDOM.svg (253705 => 253706)


--- trunk/Source/WebInspectorUI/UserInterface/Images/ShadowDOM.svg	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/ShadowDOM.svg	2019-12-18 20:06:19 UTC (rev 253706)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright © 2014 Apple Inc. All rights reserved. -->
-<svg xmlns="http://www.w3.org/2000/svg" id="root" version="1.1" viewBox="0 0 13 13">
-    <path fill="none" stroke="currentColor" stroke-linecap="square" d="M 3.5 0.5 L 0.5 6.5 L 3.5 12.5"/>
-    <path fill="none" stroke="currentColor" stroke-linecap="square" opacity="0.5" d="M 9.5 12.5 L 12.5 6.5 L 9.5 0.5"/>
-    <path fill="none" stroke="currentColor" stroke-linecap="square" opacity="0.5" d="M 5.5 0.5 L 2.5 6.5 L 5.5 12.5"/>
-    <path fill="none" stroke="currentColor" stroke-linecap="square" d="M 7.5 12.5 L 10.5 6.5 L 7.5 0.5"/>
-</svg>

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js (253705 => 253706)


--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2019-12-18 20:06:19 UTC (rev 253706)
@@ -78,8 +78,6 @@
 
         this._childNodeCount = payload.childNodeCount;
         this._children = null;
-        this._filteredChildren = null;
-        this._filteredChildrenNeedsUpdating = true;
 
         this._nextSibling = null;
         this._previousSibling = null;
@@ -192,6 +190,9 @@
 
     get destroyed() { return this._destroyed; }
     get frame() { return this._frame; }
+    get nextSibling() { return this._nextSibling; }
+    get previousSibling() { return this._previousSibling; }
+    get children() { return this._children; }
     get domEvents() { return this._domEvents; }
     get powerEfficientPlaybackRanges() { return this._powerEfficientPlaybackRanges; }
 
@@ -207,24 +208,6 @@
         return false;
     }
 
-    get children()
-    {
-        if (!this._children)
-            return null;
-
-        if (WI.settings.showShadowDOM.value)
-            return this._children;
-
-        if (this._filteredChildrenNeedsUpdating) {
-            this._filteredChildrenNeedsUpdating = false;
-            this._filteredChildren = this._children.filter(function(node) {
-                return !node._isInShadowTree;
-            });
-        }
-
-        return this._filteredChildren;
-    }
-
     get firstChild()
     {
         var children = this.children;
@@ -245,34 +228,6 @@
         return null;
     }
 
-    get nextSibling()
-    {
-        if (WI.settings.showShadowDOM.value)
-            return this._nextSibling;
-
-        var node = this._nextSibling;
-        while (node) {
-            if (!node._isInShadowTree)
-                return node;
-            node = node._nextSibling;
-        }
-        return null;
-    }
-
-    get previousSibling()
-    {
-        if (WI.settings.showShadowDOM.value)
-            return this._previousSibling;
-
-        var node = this._previousSibling;
-        while (node) {
-            if (!node._isInShadowTree)
-                return node;
-            node = node._previousSibling;
-        }
-        return null;
-    }
-
     get childNodeCount()
     {
         var children = this.children;
@@ -279,10 +234,7 @@
         if (children)
             return children.length;
 
-        if (WI.settings.showShadowDOM.value)
-            return this._childNodeCount + this._shadowRoots.length;
-
-        return this._childNodeCount;
+        return this._childNodeCount + this._shadowRoots.length;
     }
 
     set childNodeCount(count)
@@ -1018,8 +970,6 @@
 
     _renumber()
     {
-        this._filteredChildrenNeedsUpdating = true;
-
         var childNodeCount = this._children.length;
         if (childNodeCount === 0)
             return;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js (253705 => 253706)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2019-12-18 20:06:19 UTC (rev 253706)
@@ -63,12 +63,6 @@
         this._paintFlashingButtonNavigationItem.activated = this._paintFlashingButtonNavigationItem.enabled && WI.settings.showPaintRects.value;
         this._paintFlashingButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
 
-        WI.settings.showShadowDOM.addEventListener(WI.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
-        this._showsShadowDOMButtonNavigationItem = new WI.ActivateButtonNavigationItem("shows-shadow-DOM", WI.UIString("Show shadow DOM nodes"), WI.UIString("Hide shadow DOM nodes"), "Images/ShadowDOM.svg", 13, 13);
-        this._showsShadowDOMButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleShowsShadowDOMSetting, this);
-        this._showsShadowDOMButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
-        this._showShadowDOMSettingChanged();
-
         this.element.classList.add("dom-tree");
         this.element.addEventListener("click", this._mouseWasClicked.bind(this), false);
 
@@ -121,7 +115,6 @@
             this._forceAppearanceButtonNavigationItem,
             this._compositingBordersButtonNavigationItem,
             this._paintFlashingButtonNavigationItem,
-            this._showsShadowDOMButtonNavigationItem,
         ];
     }
 
@@ -175,7 +168,6 @@
         super.closed();
 
         WI.settings.showPaintRects.removeEventListener(null, null, this);
-        WI.settings.showShadowDOM.removeEventListener(null, null, this);
         WI.settings.showRulers.removeEventListener(null, null, this);
         WI.debuggerManager.removeEventListener(null, null, this);
         WI.domManager.removeEventListener(null, null, this);
@@ -634,16 +626,6 @@
         }
     }
 
-    _showShadowDOMSettingChanged(event)
-    {
-        this._showsShadowDOMButtonNavigationItem.activated = WI.settings.showShadowDOM.value;
-    }
-
-    _toggleShowsShadowDOMSetting(event)
-    {
-        WI.settings.showShadowDOM.value = !WI.settings.showShadowDOM.value;
-    }
-
     _showPrintStylesChanged()
     {
         this._showPrintStylesButtonNavigationItem.activated = WI.printStylesEnabled;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js (253705 => 253706)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js	2019-12-18 20:06:19 UTC (rev 253706)
@@ -60,8 +60,6 @@
         this._hideElementsKeyboardShortcut = new WI.KeyboardShortcut(null, "H", this._hideElements.bind(this), this.element);
         this._hideElementsKeyboardShortcut.implicitlyPreventsDefault = false;
 
-        WI.settings.showShadowDOM.addEventListener(WI.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
-
         if (showInspectedNode)
             WI.domManager.addEventListener(WI.DOMManager.Event.InspectedNodeChanged, this._handleInspectedNodeChanged, this);
     }
@@ -75,8 +73,6 @@
 
     close()
     {
-        WI.settings.showShadowDOM.removeEventListener(null, null, this);
-
         if (this._elementsTreeUpdater) {
             this._elementsTreeUpdater.close();
             this._elementsTreeUpdater = null;
@@ -427,13 +423,6 @@
         if (!node || this._suppressRevealAndSelect)
             return;
 
-        if (!WI.settings.showShadowDOM.value) {
-            while (node && node.isInShadowTree())
-                node = node.parentNode;
-            if (!node)
-                return;
-        }
-
         var treeElement = this.createTreeElementFor(node);
         if (!treeElement)
             return;
@@ -651,23 +640,6 @@
             this._elementsTreeUpdater._updateModifiedNodes();
     }
 
-    _showShadowDOMSettingChanged(event)
-    {
-        var nodeToSelect = this.selectedTreeElement ? this.selectedTreeElement.representedObject : null;
-        while (nodeToSelect) {
-            if (!nodeToSelect.isInShadowTree())
-                break;
-            nodeToSelect = nodeToSelect.parentNode;
-        }
-
-        this.children.forEach(function(child) {
-            child.updateChildren(true);
-        });
-
-        if (nodeToSelect)
-            this.selectDOMNode(nodeToSelect);
-    }
-
     _handleInspectedNodeChanged(event)
     {
         let {lastInspectedNode} = event.data;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js (253705 => 253706)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js	2019-12-18 19:40:07 UTC (rev 253705)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js	2019-12-18 20:06:19 UTC (rev 253706)
@@ -65,8 +65,6 @@
     {
         super.initialLayout();
 
-        WI.settings.showShadowDOM.addEventListener(WI.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
-
         this._buildLayerInfoSection();
         this._buildDataGridSection();
         this._buildBottomBar();
@@ -102,12 +100,6 @@
         this.needsLayout();
     }
 
-    _showShadowDOMSettingChanged(event)
-    {
-        if (this.selected)
-            this._updateDisplayWithLayers(this._layerForNode, this._unfilteredChildLayers);
-    }
-
     _buildLayerInfoSection()
     {
         var rows = this._layerInfoRows = {};
@@ -243,12 +235,6 @@
 
     _updateDisplayWithLayers(layerForNode, childLayers)
     {
-        if (!WI.settings.showShadowDOM.value) {
-            childLayers = childLayers.filter(function(layer) {
-                return !layer.isInShadowTree;
-            });
-        }
-
         this._updateLayerInfoSection(layerForNode);
         this._updateDataGrid(layerForNode, childLayers);
         this._updateMetrics(layerForNode, childLayers);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to