Title: [295166] trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js
Revision
295166
Author
[email protected]
Date
2022-06-02 18:31:02 -0700 (Thu, 02 Jun 2022)

Log Message

Web Inspector: Layout details sidebar panel does unnecessary tracking of the selected DOM node's styles
https://bugs.webkit.org/show_bug.cgi?id=241245
rdar://94318782

Reviewed by Devin Rousso.

Code that, among other things, causes a layout when the selected DOM node's styles change should have been removed when
the Box Model diagram was removed from this sidebar panel. Additionally, because that was the only node-specific thing
in this panel, we can persist the sidebar panel even when the selected node is not an element.

* Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js:
(WI.LayoutDetailsSidebarPanel):
(WI.LayoutDetailsSidebarPanel.prototype.inspect): Deleted.
(WI.LayoutDetailsSidebarPanel.prototype.supportsDOMNode): Deleted.
(WI.LayoutDetailsSidebarPanel.prototype._nodeStylesRefreshed): Deleted.
(WI.LayoutDetailsSidebarPanel.prototype._nodeStylesNeedsRefreshed): Deleted.

Canonical link: https://commits.webkit.org/251250@main

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js (295165 => 295166)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js	2022-06-03 01:07:37 UTC (rev 295165)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutDetailsSidebarPanel.js	2022-06-03 01:31:02 UTC (rev 295166)
@@ -31,47 +31,9 @@
 
         this._flexNodeSet = null;
         this._gridNodeSet = null;
-        this._nodeStyles = null;
         this.element.classList.add("layout-panel");
     }
 
-    // Public
-
-    inspect(objects)
-    {
-        // Layout panel doesn't show when hasDOMNode is false.
-        let hasDOMNode = super.inspect(objects);
-        if (!hasDOMNode)
-            return false;
-
-        let stylesForNode = WI.cssManager.stylesForNode(this.domNode);
-        stylesForNode.refreshIfNeeded().then((nodeStyles) => {
-            if (nodeStyles === this._nodeStyles)
-                return;
-
-            if (this._nodeStyles) {
-                this._nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.Refreshed, this._nodeStylesRefreshed, this);
-                this._nodeStyles.removeEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
-            }
-
-            this._nodeStyles = nodeStyles;
-
-            if (this._nodeStyles) {
-                this._nodeStyles.addEventListener(WI.DOMNodeStyles.Event.Refreshed, this._nodeStylesRefreshed, this);
-                this._nodeStyles.addEventListener(WI.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
-            }
-
-            this.needsLayout();
-        });
-
-        return hasDOMNode;
-    }
-
-    supportsDOMNode(nodeToInspect)
-    {
-        return nodeToInspect.nodeType() === Node.ELEMENT_NODE;
-    }
-
     // Protected
 
     attached()
@@ -190,18 +152,6 @@
         this.needsLayout();
     }
 
-    _nodeStylesRefreshed()
-    {
-        if (this.isAttached)
-            this.needsLayout();
-    }
-
-    _nodeStylesNeedsRefreshed()
-    {
-        if (this.isAttached)
-            this._nodeStyles?.refresh();
-    }
-
     _removeNodeFromNodeSets(domNode)
     {
         this._flexNodeSet?.delete(domNode);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to