Changeset 248873 in webkit


Ignore:
Timestamp:
Aug 19, 2019 3:21:21 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: REGRESSION: Debugger: pressing delete when the all/uncaught exceptions breakpoint is selected should select the next tree element
https://bugs.webkit.org/show_bug.cgi?id=200876

Reviewed by Joseph Pecoraro.

Removing the return true; from the various WI.TreeElement breakpoint classes allows the
owner WI.TreeOutline to also handle the delete event. In the Debugger/Sources navigation
sidebar, the owner WI.TreeOutline checks to see if the currently selected WI.TreeElement
is one of the "top" items ("All Exceptions", "Uncaught Exceptions", "Assertion Failures")
and if so, select the next tree element (if able) instead of the previous one.

This is a preferred experience because the "top" items can only be disabled, not deleted, so
trying to delete them wouldn't actually change the selection. They should only ever be
selected if there's nothing else that can be selected.

  • UserInterface/Views/DebuggerSidebarPanel.js:

(WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement):
(WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement.checkIfSelectionAdjustmentNeeded): Added.

  • UserInterface/Views/SourcesNavigationSidebarPanel.js:

(WI.SourcesNavigationSidebarPanel):
(WI.SourcesNavigationSidebarPanel.checkIfSelectionAdjustmentNeeded): Added.

  • UserInterface/Views/BreakpointTreeElement.js:

(WI.BreakpointTreeElement.prototype.ondelete):

  • UserInterface/Views/DOMBreakpointTreeElement.js:

(WI.DOMBreakpointTreeElement.prototype.ondelete):

  • UserInterface/Views/DOMNodeTreeElement.js:

(WI.DOMNodeTreeElement.prototype.ondelete):

  • UserInterface/Views/EventBreakpointTreeElement.js:

(WI.EventBreakpointTreeElement.prototype.ondelete):

  • UserInterface/Views/URLBreakpointTreeElement.js:

(WI.URLBreakpointTreeElement.prototype.ondelete):

Location:
trunk/Source/WebInspectorUI
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r248860 r248873  
     12019-08-19  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: REGRESSION: Debugger: pressing delete when the all/uncaught exceptions breakpoint is selected should select the next tree element
     4        https://bugs.webkit.org/show_bug.cgi?id=200876
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Removing the `return true;` from the various `WI.TreeElement` breakpoint classes allows the
     9        owner `WI.TreeOutline` to also handle the delete event. In the Debugger/Sources navigation
     10        sidebar, the owner `WI.TreeOutline` checks to see if the currently selected `WI.TreeElement`
     11        is one of the "top" items ("All Exceptions", "Uncaught Exceptions", "Assertion Failures")
     12        and if so, select the next tree element (if able) instead of the previous one.
     13
     14        This is a preferred experience because the "top" items can only be disabled, not deleted, so
     15        trying to delete them wouldn't actually change the selection. They should only ever be
     16        selected if there's nothing else that can be selected.
     17
     18        * UserInterface/Views/DebuggerSidebarPanel.js:
     19        (WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement):
     20        (WI.DebuggerSidebarPanel.prototype._breakpointTreeOutlineDeleteTreeElement.checkIfSelectionAdjustmentNeeded): Added.
     21        * UserInterface/Views/SourcesNavigationSidebarPanel.js:
     22        (WI.SourcesNavigationSidebarPanel):
     23        (WI.SourcesNavigationSidebarPanel.checkIfSelectionAdjustmentNeeded): Added.
     24
     25        * UserInterface/Views/BreakpointTreeElement.js:
     26        (WI.BreakpointTreeElement.prototype.ondelete):
     27        * UserInterface/Views/DOMBreakpointTreeElement.js:
     28        (WI.DOMBreakpointTreeElement.prototype.ondelete):
     29        * UserInterface/Views/DOMNodeTreeElement.js:
     30        (WI.DOMNodeTreeElement.prototype.ondelete):
     31        * UserInterface/Views/EventBreakpointTreeElement.js:
     32        (WI.EventBreakpointTreeElement.prototype.ondelete):
     33        * UserInterface/Views/URLBreakpointTreeElement.js:
     34        (WI.URLBreakpointTreeElement.prototype.ondelete):
     35
    1362019-08-19  Devin Rousso  <drousso@apple.com>
    237
  • trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js

    r244274 r248873  
    8383            else
    8484                this._breakpoint.disabled = true;
    85             return true;
     85            return;
    8686        }
    8787
     
    9292
    9393        WI.debuggerManager.removeBreakpoint(this._breakpoint);
    94         return true;
    9594    }
    9695
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js

    r247252 r248873  
    107107
    108108        WI.domDebuggerManager.removeDOMBreakpoint(this.representedObject);
    109         return true;
    110109    }
    111110
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js

    r247053 r248873  
    4848        WI.domDebuggerManager.removeDOMBreakpointsForNode(this.representedObject);
    4949        WI.domManager.removeEventListenerBreakpointsForNode(this.representedObject);
    50 
    51         return true;
    5250    }
    5351
  • trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js

    r248537 r248873  
    979979    }
    980980
    981     _breakpointTreeOutlineDeleteTreeElement(treeElement)
    982     {
    983         console.assert(treeElement.selected);
    984 
    985         if (treeElement.representedObject === DebuggerSidebarPanel.__windowEventTargetRepresentedObject) {
     981    _breakpointTreeOutlineDeleteTreeElement(selectedTreeElement)
     982    {
     983        console.assert(selectedTreeElement.selected);
     984
     985        let treeElementToSelect = null;
     986        function checkIfSelectionAdjustmentNeeded(treeElement) {
     987            if (!treeElement)
     988                return;
     989
     990            let representedObjects = [
     991                WI.debuggerManager.allExceptionsBreakpoint,
     992                WI.debuggerManager.uncaughtExceptionsBreakpoint,
     993                WI.debuggerManager.assertionFailuresBreakpoint,
     994            ];
     995            if (representedObjects.includes(treeElement.representedObject))
     996                treeElementToSelect = selectedTreeElement.nextSibling;
     997        }
     998        checkIfSelectionAdjustmentNeeded(selectedTreeElement);
     999
     1000        if (selectedTreeElement instanceof WI.ResourceTreeElement || selectedTreeElement instanceof WI.ScriptTreeElement) {
     1001            checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
     1002
     1003            let breakpoints = this._breakpointsBeneathTreeElement(selectedTreeElement);
     1004            this._removeAllBreakpoints(breakpoints);
     1005        } else if (selectedTreeElement.representedObject === DebuggerSidebarPanel.__windowEventTargetRepresentedObject) {
     1006            checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
     1007
    9861008            let eventBreakpointsOnWindow = WI.domManager.eventListenerBreakpoints.filter((eventBreakpoint) => eventBreakpoint.eventListener.onWindow);
    9871009            for (let eventBreakpoint of eventBreakpointsOnWindow)
    9881010                WI.domManager.removeBreakpointForEventListener(eventBreakpoint.eventListener);
    989             return true;
    990         }
    991 
    992         console.assert(treeElement instanceof WI.ResourceTreeElement || treeElement instanceof WI.ScriptTreeElement);
    993         if (!(treeElement instanceof WI.ResourceTreeElement) && !(treeElement instanceof WI.ScriptTreeElement))
    994             return false;
    995 
    996         var wasTopResourceTreeElement = treeElement.previousSibling === this._assertionsBreakpointTreeElement || treeElement.previousSibling === this._allUncaughtExceptionsBreakpointTreeElement;
    997         var nextSibling = treeElement.nextSibling;
    998 
    999         var breakpoints = this._breakpointsBeneathTreeElement(treeElement);
    1000         this._removeAllBreakpoints(breakpoints);
    1001 
    1002         if (wasTopResourceTreeElement && nextSibling)
    1003             nextSibling.select(true, true);
     1011        }
     1012
     1013        if (treeElementToSelect) {
     1014            const omitFocus = true;
     1015            const selectedByUser = true;
     1016            treeElementToSelect.select(omitFocus, selectedByUser);
     1017        }
    10041018
    10051019        return true;
  • trunk/Source/WebInspectorUI/UserInterface/Views/EventBreakpointTreeElement.js

    r247053 r248873  
    9393        else
    9494            WI.domDebuggerManager.removeEventBreakpoint(this.representedObject);
    95         return true;
    9695    }
    9796
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js

    r248753 r248873  
    139139        this._breakpointsTreeOutline.addEventListener(WI.TreeOutline.Event.ElementRemoved, this._handleBreakpointElementAddedOrRemoved, this);
    140140        this._breakpointsTreeOutline.addEventListener(WI.TreeOutline.Event.SelectionDidChange, this._handleTreeSelectionDidChange, this);
    141         this._breakpointsTreeOutline.ondelete = (treeElement) => {
    142             console.assert(treeElement.selected);
    143 
    144             if (treeElement.representedObject === SourcesNavigationSidebarPanel.__windowEventTargetRepresentedObject) {
     141        this._breakpointsTreeOutline.ondelete = (selectedTreeElement) => {
     142            console.assert(selectedTreeElement.selected);
     143
     144            let treeElementToSelect = null;
     145            function checkIfSelectionAdjustmentNeeded(treeElement) {
     146                if (!treeElement)
     147                    return;
     148
     149                let representedObjects = [
     150                    WI.debuggerManager.allExceptionsBreakpoint,
     151                    WI.debuggerManager.uncaughtExceptionsBreakpoint,
     152                    WI.debuggerManager.assertionFailuresBreakpoint,
     153                ];
     154                if (representedObjects.includes(treeElement.representedObject))
     155                    treeElementToSelect = selectedTreeElement.nextSibling;
     156            }
     157            checkIfSelectionAdjustmentNeeded(selectedTreeElement);
     158
     159            if (selectedTreeElement instanceof WI.ResourceTreeElement || selectedTreeElement instanceof WI.ScriptTreeElement) {
     160                checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
     161
     162                let breakpoints = this._breakpointsBeneathTreeElement(selectedTreeElement);
     163                this._removeAllBreakpoints(breakpoints);
     164            } else if (selectedTreeElement.representedObject === SourcesNavigationSidebarPanel.__windowEventTargetRepresentedObject) {
     165                checkIfSelectionAdjustmentNeeded(selectedTreeElement.previousSibling);
     166
    145167                let eventBreakpointsOnWindow = WI.domManager.eventListenerBreakpoints.filter((eventBreakpoint) => eventBreakpoint.eventListener.onWindow);
    146168                for (let eventBreakpoint of eventBreakpointsOnWindow)
    147169                    WI.domManager.removeBreakpointForEventListener(eventBreakpoint.eventListener);
    148                 return true;
    149             }
    150 
    151             console.assert(treeElement instanceof WI.ResourceTreeElement || treeElement instanceof WI.ScriptTreeElement);
    152             if (!(treeElement instanceof WI.ResourceTreeElement) && !(treeElement instanceof WI.ScriptTreeElement))
    153                 return false;
    154 
    155             let wasTopResourceTreeElement = treeElement.previousSibling === this._assertionsBreakpointTreeElement || treeElement.previousSibling === this._allUncaughtExceptionsBreakpointTreeElement;
    156             let nextSibling = treeElement.nextSibling;
    157 
    158             let breakpoints = this._breakpointsBeneathTreeElement(treeElement);
    159             this._removeAllBreakpoints(breakpoints);
    160 
    161             if (wasTopResourceTreeElement && nextSibling) {
     170            }
     171
     172            if (treeElementToSelect) {
    162173                const omitFocus = true;
    163174                const selectedByUser = true;
    164                 nextSibling.select(omitFocus, selectedByUser);
     175                treeElementToSelect.select(omitFocus, selectedByUser);
    165176            }
    166177
  • trunk/Source/WebInspectorUI/UserInterface/Views/URLBreakpointTreeElement.js

    r247237 r248873  
    9595
    9696        WI.domDebuggerManager.removeURLBreakpoint(this.representedObject);
    97         return true;
    9897    }
    9998
Note: See TracChangeset for help on using the changeset viewer.