Title: [238202] trunk/Source/WebInspectorUI
Revision
238202
Author
drou...@apple.com
Date
2018-11-14 14:39:25 -0800 (Wed, 14 Nov 2018)

Log Message

Web Inspector: REGRESSION(r236540): Debugger: breakpoints are sorted alphabetically instead of numerically
https://bugs.webkit.org/show_bug.cgi?id=191560

Reviewed by Joseph Pecoraro.

When sorting breakpoints, if the `WI.TreeElement`s being compared both contain instances of
`WI.Breakpoint`, sort by `WI.SourceCodeLocation` instead of title.

We only do this for `WI.Breakpoint` because they are the only debuggable item that has a
`WI.SourceCodeLocation` (e.g. `WI.EventBreakpoint` is just an event name string).

* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel.prototype._addTreeElement):
(WI.DebuggerSidebarPanel.prototype._compareBreakpointTreeElements): Added.
(WI.DebuggerSidebarPanel.prototype._addIssue):
(WI.DebuggerSidebarPanel.prototype._addTreeElement.comparator): Deleted.
(WI.DebuggerSidebarPanel.prototype._compareTreeElements): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (238201 => 238202)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-11-14 22:28:52 UTC (rev 238201)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-11-14 22:39:25 UTC (rev 238202)
@@ -1,3 +1,23 @@
+2018-11-14  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: REGRESSION(r236540): Debugger: breakpoints are sorted alphabetically instead of numerically
+        https://bugs.webkit.org/show_bug.cgi?id=191560
+
+        Reviewed by Joseph Pecoraro.
+
+        When sorting breakpoints, if the `WI.TreeElement`s being compared both contain instances of
+        `WI.Breakpoint`, sort by `WI.SourceCodeLocation` instead of title.
+
+        We only do this for `WI.Breakpoint` because they are the only debuggable item that has a
+        `WI.SourceCodeLocation` (e.g. `WI.EventBreakpoint` is just an event name string).
+
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WI.DebuggerSidebarPanel.prototype._addTreeElement):
+        (WI.DebuggerSidebarPanel.prototype._compareBreakpointTreeElements): Added.
+        (WI.DebuggerSidebarPanel.prototype._addIssue):
+        (WI.DebuggerSidebarPanel.prototype._addTreeElement.comparator): Deleted.
+        (WI.DebuggerSidebarPanel.prototype._compareTreeElements): Deleted.
+
 2018-11-14  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: Styles: shift-clicking on a property should extend selection

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (238201 => 238202)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2018-11-14 22:28:52 UTC (rev 238201)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2018-11-14 22:39:25 UTC (rev 238202)
@@ -969,7 +969,7 @@
         if (!parentTreeElement)
             parentTreeElement = this._breakpointsContentTreeOutline;
 
-        function comparator(a, b) {
+        let comparator = (a, b) => {
             const rankFunctions = [
                 (treeElement) => treeElement.representedObject === WI.debuggerManager.allExceptionsBreakpoint,
                 (treeElement) => treeElement.representedObject === WI.debuggerManager.uncaughtExceptionsBreakpoint,
@@ -991,13 +991,16 @@
                     return 1;
             }
 
+            if (a instanceof WI.BreakpointTreeElement && b instanceof WI.BreakpointTreeElement)
+                return this._compareBreakpointTreeElements(a, b);
+
             return a.mainTitle.extendedLocaleCompare(b.mainTitle) || a.subtitle.extendedLocaleCompare(b.subtitle);
-        }
+        };
 
         parentTreeElement.insertChild(treeElement, insertionIndexForObjectInListSortedByFunction(treeElement, parentTreeElement.children, comparator));
     }
 
-    _compareTreeElements(a, b)
+    _compareBreakpointTreeElements(a, b)
     {
         if (!a.representedObject || !b.representedObject)
             return 0;
@@ -1326,7 +1329,7 @@
 
         issueTreeElement = new WI.IssueTreeElement(issueMessage);
 
-        parentTreeElement.insertChild(issueTreeElement, insertionIndexForObjectInListSortedByFunction(issueTreeElement, parentTreeElement.children, this._compareTreeElements));
+        parentTreeElement.insertChild(issueTreeElement, insertionIndexForObjectInListSortedByFunction(issueTreeElement, parentTreeElement.children, this._compareBreakpointTreeElements));
         if (parentTreeElement.children.length === 1)
             parentTreeElement.expand();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to