Title: [288030] trunk/Source/WebInspectorUI
Revision
288030
Author
[email protected]
Date
2022-01-14 13:47:10 -0800 (Fri, 14 Jan 2022)

Log Message

Web Inspector: Sources: cannot copy grouping of blackboxed call frames
https://bugs.webkit.org/show_bug.cgi?id=234615
<rdar://problem/86989248>

Reviewed by Patrick Angle.

* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel.prototype.handleCopyEvent):
(WI.SourcesNavigationSidebarPanel.prototype.handleCopyEvent.addCallFrame): Added.
Include every `WI.CallFrame` managed by any selected `WI.BlackboxedGroupTreeElement` when
copying. Also make sure that any async boundaries are taken into account.

* UserInterface/Views/BlackboxedGroupTreeElement.js:
(WI.BlackboxedGroupTreeElement):
(WI.BlackboxedGroupTreeElement.prototype.get callFrames): Added.
(WI.BlackboxedGroupTreeElement.prototype.get expandable): Added.
(WI.BlackboxedGroupTreeElement.prototype.onenter): Added.
(WI.BlackboxedGroupTreeElement.prototype.onspace): Added.
Make `WI.BlackboxedGroupTreeElement` selectable, and add extra action handlers for expansion.

* UserInterface/Views/BlackboxedGroupTreeElement.css:
(.tree-outline .item.blackboxed-group):
(.tree-outline .item.blackboxed-group:not(.selected) > *, .tree-outline:not(:focus-within) .item.blackboxed-group.selected > *, body:is(.window-inactive, .window-docked-inactive) .tree-outline .item.blackboxed-group.selected > *): Added.
(body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.blackboxed-group.selected .icon): Added.
Only make the content more transparent if not `.selected` (when the window/tree has focus).

* UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.get expandable): Added.
(WI.TreeElement.treeElementToggled):
Allow `toggleOnClick` to be used when `selectable` too. This allows `WI.BlackboxedGroupTreeElement`
to `expand` on click while also being able to be selected (e.g. shift-up, command-A, etc.).
All other uses of `toggleOnClick` set `this.selectable = false;` anyways, so this will have
no effect to other clients.

* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype.insertChild):
(WI.TreeOutline.prototype._treeKeyDown):
* UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype.update):
Add a helper `get expandable` instead of assuming it from `get hasChildren`. This allows
`WI.BlackboxedGroupTreeElement` to override it and always be `true`, since there is no
situation where we would disallow expansion (which shows the grouped blackboxed call frames).

* UserInterface/Models/CallFrame.js:
(WI.CallFrame.prototype.get displayName): Added.
* UserInterface/Views/CallFrameView.js:
(WI.CallFrameView):
* UserInterface/Views/CallFrameTreeElement.js:
(WI.CallFrameTreeElement):
* UserInterface/Views/ConsoleMessageView.js:
(WI.ConsoleMessageView.prototype.toClipboardString):
Add a helper `get displayName` to avoid repeated specialized logic.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (288029 => 288030)


--- trunk/Source/WebInspectorUI/ChangeLog	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/ChangeLog	2022-01-14 21:47:10 UTC (rev 288030)
@@ -1,5 +1,60 @@
 2022-01-14  Devin Rousso  <[email protected]>
 
+        Web Inspector: Sources: cannot copy grouping of blackboxed call frames
+        https://bugs.webkit.org/show_bug.cgi?id=234615
+        <rdar://problem/86989248>
+
+        Reviewed by Patrick Angle.
+
+        * UserInterface/Views/SourcesNavigationSidebarPanel.js:
+        (WI.SourcesNavigationSidebarPanel.prototype.handleCopyEvent):
+        (WI.SourcesNavigationSidebarPanel.prototype.handleCopyEvent.addCallFrame): Added.
+        Include every `WI.CallFrame` managed by any selected `WI.BlackboxedGroupTreeElement` when
+        copying. Also make sure that any async boundaries are taken into account.
+
+        * UserInterface/Views/BlackboxedGroupTreeElement.js:
+        (WI.BlackboxedGroupTreeElement):
+        (WI.BlackboxedGroupTreeElement.prototype.get callFrames): Added.
+        (WI.BlackboxedGroupTreeElement.prototype.get expandable): Added.
+        (WI.BlackboxedGroupTreeElement.prototype.onenter): Added.
+        (WI.BlackboxedGroupTreeElement.prototype.onspace): Added.
+        Make `WI.BlackboxedGroupTreeElement` selectable, and add extra action handlers for expansion.
+
+        * UserInterface/Views/BlackboxedGroupTreeElement.css:
+        (.tree-outline .item.blackboxed-group):
+        (.tree-outline .item.blackboxed-group:not(.selected) > *, .tree-outline:not(:focus-within) .item.blackboxed-group.selected > *, body:is(.window-inactive, .window-docked-inactive) .tree-outline .item.blackboxed-group.selected > *): Added.
+        (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.blackboxed-group.selected .icon): Added.
+        Only make the content more transparent if not `.selected` (when the window/tree has focus).
+
+        * UserInterface/Views/TreeElement.js:
+        (WI.TreeElement.prototype.get expandable): Added.
+        (WI.TreeElement.treeElementToggled):
+        Allow `toggleOnClick` to be used when `selectable` too. This allows `WI.BlackboxedGroupTreeElement`
+        to `expand` on click while also being able to be selected (e.g. shift-up, command-A, etc.).
+        All other uses of `toggleOnClick` set `this.selectable = false;` anyways, so this will have
+        no effect to other clients.
+
+        * UserInterface/Views/TreeOutline.js:
+        (WI.TreeOutline.prototype.insertChild):
+        (WI.TreeOutline.prototype._treeKeyDown):
+        * UserInterface/Views/DOMTreeOutline.js:
+        (WI.DOMTreeOutline.prototype.update):
+        Add a helper `get expandable` instead of assuming it from `get hasChildren`. This allows
+        `WI.BlackboxedGroupTreeElement` to override it and always be `true`, since there is no
+        situation where we would disallow expansion (which shows the grouped blackboxed call frames).
+
+        * UserInterface/Models/CallFrame.js:
+        (WI.CallFrame.prototype.get displayName): Added.
+        * UserInterface/Views/CallFrameView.js:
+        (WI.CallFrameView):
+        * UserInterface/Views/CallFrameTreeElement.js:
+        (WI.CallFrameTreeElement):
+        * UserInterface/Views/ConsoleMessageView.js:
+        (WI.ConsoleMessageView.prototype.toClipboardString):
+        Add a helper `get displayName` to avoid repeated specialized logic.
+
+2022-01-14  Devin Rousso  <[email protected]>
+
         Web Inspector: add a contextmenu item to create a URL Breakpoint for resources initiated by script
         https://bugs.webkit.org/show_bug.cgi?id=235216
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -64,6 +64,11 @@
     get blackboxed() { return this._blackboxed; }
     get isConsoleEvaluation() { return this._isConsoleEvaluation; }
 
+    get displayName()
+    {
+        return this._functionName || WI.UIString("(anonymous function)");
+    }
+
     isEqual(other)
     {
         if (!other)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.css (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.css	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.css	2022-01-14 21:47:10 UTC (rev 288030)
@@ -25,6 +25,11 @@
 
 .tree-outline .item.blackboxed-group {
     cursor: pointer;
+}
+
+.tree-outline .item.blackboxed-group:not(.selected) > *,
+.tree-outline:not(:focus-within) .item.blackboxed-group.selected > *,
+body:is(.window-inactive, .window-docked-inactive) .tree-outline .item.blackboxed-group.selected > * {
     opacity: var(--blackboxed-tree-item-opacity);
 }
 
@@ -32,6 +37,10 @@
     content: url(../Images/Hide.svg#black);
 }
 
+body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.blackboxed-group.selected .icon {
+    content: url(../Images/Hide.svg#white);
+}
+
 @media (prefers-color-scheme: dark) {
     .tree-outline .item.blackboxed-group .icon {
         content: url(../Images/Hide.svg#white);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BlackboxedGroupTreeElement.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -39,7 +39,6 @@
 
         super(classNames, title, subtitle);
 
-        this.selectable = false;
         this.toggleOnClick = true;
         this._callFrames = callFrames;
     }
@@ -46,6 +45,13 @@
 
     // Public
 
+    get callFrames() { return this._callFrames; }
+
+    get expandable()
+    {
+        return true;
+    }
+
     expand()
     {
         WI.debuggerManager.rememberBlackboxedCallFrameGroupToAutoExpand(this._callFrames);
@@ -56,4 +62,16 @@
 
         this.parent.removeChild(this);
     }
+
+    onenter()
+    {
+        this.expand();
+        return true;
+    }
+
+    onspace()
+    {
+        this.expand();
+        return true;
+    }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -30,7 +30,7 @@
         console.assert(callFrame instanceof WI.CallFrame);
 
         let className = WI.CallFrameView.iconClassNameForCallFrame(callFrame);
-        let title = callFrame.functionName || WI.UIString("(anonymous function)");
+        let title = callFrame.displayName;
         const subtitle = null;
         super(["call-frame", className], title, subtitle, callFrame);
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameView.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameView.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameView.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -69,7 +69,7 @@
             var imgElement = document.createElement("img");
             imgElement.classList.add("icon");
 
-            titleElement.append(imgElement, callFrame.functionName || WI.UIString("(anonymous function)"));
+            titleElement.append(imgElement, callFrame.displayName);
         }
 
         callFrameElement.append(titleElement, subtitleElement);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -237,7 +237,7 @@
 
         if (hasStackTrace) {
             this._message.stackTrace.callFrames.forEach(function(frame) {
-                clipboardString += "\n\t" + (frame.functionName || WI.UIString("(anonymous function)"));
+                clipboardString += "\n\t" + frame.displayName;
                 if (frame.sourceCodeLocation)
                     clipboardString += " (" + frame.sourceCodeLocation.originalLocationString() + ")";
             });

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -184,7 +184,7 @@
                 this.appendChild(treeElement);
                 node = node.nextSibling;
 
-                if (treeElement.hasChildren && !treeElement.expanded)
+                if (treeElement.expandable && !treeElement.expanded)
                     treeElement.expand();
             }
         }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -679,7 +679,22 @@
         let threads = [];
         let asyncBoundary = null;
 
-        while (treeElement) {
+        function addCallFrame(callFrame) {
+            if (asyncBoundary) {
+                threads.lastValue.frames.push("--- " + asyncBoundary + " ---");
+                asyncBoundary = null;
+            }
+
+            let line = callFrame.displayName;
+
+            let sourceCodeLocation = callFrame.sourceCodeLocation;
+            if (sourceCodeLocation)
+                line += " (" + sourceCodeLocation.displayLocationString() + ")";
+
+            threads.lastValue.frames.push(line);
+        }
+
+        for (; treeElement; treeElement = treeElement.traverseNextTreeElement(skipUnrevealed, stayWithin, dontPopulate)) {
             if (treeElement instanceof WI.ThreadTreeElement) {
                 threads.push({
                     name: treeElement.mainTitle,
@@ -687,26 +702,27 @@
                 });
 
                 asyncBoundary = null;
-            } else if (treeElement instanceof WI.CallFrameTreeElement) {
-                if (treeElement.isAsyncBoundaryCallFrame) {
-                    asyncBoundary = treeElement.mainTitle;
-                } else if (selectedTreeElements.has(treeElement)) {
-                    if (asyncBoundary) {
-                        threads.lastValue.frames.push("--- " + asyncBoundary + " ---");
-                        asyncBoundary = null;
-                    }
 
-                    let line = treeElement.mainTitle;
+                continue;
+            }
 
-                    let sourceCodeLocation = treeElement.callFrame.sourceCodeLocation;
-                    if (sourceCodeLocation)
-                        line += " (" + sourceCodeLocation.displayLocationString() + ")";
+            if (treeElement.isAsyncBoundaryCallFrame)
+                asyncBoundary = treeElement.mainTitle;
 
-                    threads.lastValue.frames.push(line);
-                }
+            if (!selectedTreeElements.has(treeElement))
+                continue;
+
+            if (treeElement instanceof WI.CallFrameTreeElement) {
+                addCallFrame(treeElement.callFrame);
+                continue;
             }
 
-            treeElement = treeElement.traverseNextTreeElement(skipUnrevealed, stayWithin, dontPopulate);
+            if (treeElement instanceof WI.BlackboxedGroupTreeElement) {
+                for (let callFrame of treeElement.callFrames)
+                    addCallFrame(callFrame);
+
+                continue;
+            }
         }
 
         let multipleFramesSelected = threads.filter(({frames}) => frames.length).length > 1;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -81,6 +81,11 @@
         this._selectable = x;
     }
 
+    get expandable()
+    {
+        return this.hasChildren;
+    }
+
     get listItemElement()
     {
         return this._listItemNode;
@@ -308,8 +313,7 @@
         if (!treeElement)
             return;
 
-        let toggleOnClick = treeElement.toggleOnClick && !treeElement.selectable;
-        if (toggleOnClick || treeElement.isEventWithinDisclosureTriangle(event)) {
+        if (treeElement.toggleOnClick || treeElement.isEventWithinDisclosureTriangle(event)) {
             if (treeElement.expanded) {
                 if (event.altKey)
                     treeElement.collapseRecursively();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js (288029 => 288030)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2022-01-14 21:34:39 UTC (rev 288029)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js	2022-01-14 21:47:10 UTC (rev 288030)
@@ -294,7 +294,7 @@
             current = current.traverseNextTreeElement(false, child, true);
         }
 
-        if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
+        if (child.expandable && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
             child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
         if (this._childrenListNode)
@@ -587,7 +587,7 @@
                 if (!this.selectedTreeElement.revealed()) {
                     this.selectedTreeElement.reveal();
                     handled = true;
-                } else if (this.selectedTreeElement.hasChildren) {
+                } else if (this.selectedTreeElement.expandable) {
                     handled = true;
                     if (this.selectedTreeElement.expanded) {
                         nextSelectedElement = this.selectedTreeElement.children[0];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to