Changeset 269337 in webkit


Ignore:
Timestamp:
Nov 3, 2020 3:33:31 PM (21 months ago)
Author:
Devin Rousso
Message:

Web Inspector: Elements: should have the option to Edit Breakpoint... or at least Reveal Breakpoint in Sources Tab
https://bugs.webkit.org/show_bug.cgi?id=218366

Reviewed by Brian Burg.

  • UserInterface/Views/BreakpointPopover.js:

(WI.BreakpointPopover.appendContextMenuItems):

  • UserInterface/Views/DOMTreeElement.js:

(WI.DOMTreeElement.prototype.get statusImageElement): Added.
(WI.DOMTreeElement.prototype._statusImageContextmenu):

  • UserInterface/Views/DOMTreeOutline.js:

(WI.DOMTreeOutline.prototype.populateContextMenu):

  • UserInterface/Views/ContextMenuUtilities.js:

(WI.appendContextMenuItemsForDOMNodeBreakpoints):
Show an "Edit Breakpoint..." action (via WI.BreakpointPopover.appendContextMenuItems) when
there is only one WI.DOMBreakpoint (if there are multiple then it would be confusing),
otherwise using "Breakpoints" (plural) for the other actions.

  • UserInterface/Base/Main.js:

(WI.showSourcesTab):

  • UserInterface/Views/EventListenerSectionGroup.js:

(WI.EventListenerSectionGroup):

  • UserInterface/Views/SourceCodeTextEditor.js:

(WI.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):

  • UserInterface/Views/SourcesTabContentView.js:

(WI.SourcesTabContentView.prototype.revealAndSelectRepresentedObject): Added.
(WI.SourcesTabContentView.prototype.revealAndSelectBreakpoint): Deleted.
Rename breakpointToSelect to representedObjectToSelect for more flexibility in the case
that there are multiple WI.DOMBreakpoint for the given WI.DOMNode, in which case we want
to select the WI.DOMNode instead.

  • Localizations/en.lproj/localizedStrings.js:
Location:
trunk/Source/WebInspectorUI
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r269201 r269337  
     12020-11-03  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Elements: should have the option to Edit Breakpoint... or at least Reveal Breakpoint in Sources Tab
     4        https://bugs.webkit.org/show_bug.cgi?id=218366
     5
     6        Reviewed by Brian Burg.
     7
     8        * UserInterface/Views/BreakpointPopover.js:
     9        (WI.BreakpointPopover.appendContextMenuItems):
     10        * UserInterface/Views/DOMTreeElement.js:
     11        (WI.DOMTreeElement.prototype.get statusImageElement): Added.
     12        (WI.DOMTreeElement.prototype._statusImageContextmenu):
     13        * UserInterface/Views/DOMTreeOutline.js:
     14        (WI.DOMTreeOutline.prototype.populateContextMenu):
     15        * UserInterface/Views/ContextMenuUtilities.js:
     16        (WI.appendContextMenuItemsForDOMNodeBreakpoints):
     17        Show an "Edit Breakpoint..." action (via `WI.BreakpointPopover.appendContextMenuItems`) when
     18        there is only one `WI.DOMBreakpoint` (if there are multiple then it would be confusing),
     19        otherwise using "Breakpoints" (plural) for the other actions.
     20
     21        * UserInterface/Base/Main.js:
     22        (WI.showSourcesTab):
     23        * UserInterface/Views/EventListenerSectionGroup.js:
     24        (WI.EventListenerSectionGroup):
     25        * UserInterface/Views/SourceCodeTextEditor.js:
     26        (WI.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):
     27        * UserInterface/Views/SourcesTabContentView.js:
     28        (WI.SourcesTabContentView.prototype.revealAndSelectRepresentedObject): Added.
     29        (WI.SourcesTabContentView.prototype.revealAndSelectBreakpoint): Deleted.
     30        Rename `breakpointToSelect` to `representedObjectToSelect` for more flexibility in the case
     31        that there are multiple `WI.DOMBreakpoint` for the given `WI.DOMNode`, in which case we want
     32        to select the `WI.DOMNode` instead.
     33
     34        * Localizations/en.lproj/localizedStrings.js:
     35
    1362020-10-30  Nikita Vasilyev  <nvasilyev@apple.com>
    237
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r268716 r269337  
    10911091localizedStrings["Reveal"] = "Reveal";
    10921092localizedStrings["Reveal Blackbox Pattern"] = "Reveal Blackbox Pattern";
     1093localizedStrings["Reveal Breakpoint in Sources Tab"] = "Reveal Breakpoint in Sources Tab";
     1094localizedStrings["Reveal Breakpoints in Sources Tab"] = "Reveal Breakpoints in Sources Tab";
    10931095localizedStrings["Reveal Descendant Breakpoints"] = "Reveal Descendant Breakpoints";
    10941096localizedStrings["Reveal Local Override"] = "Reveal Local Override";
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r269075 r269337  
    12011201        tabContentView = new WI.SourcesTabContentView;
    12021202
    1203     if (options.breakpointToSelect instanceof WI.Breakpoint)
    1204         tabContentView.revealAndSelectBreakpoint(options.breakpointToSelect);
     1203    if (options.representedObjectToSelect)
     1204        tabContentView.revealAndSelectRepresentedObject(options.representedObjectToSelect);
    12051205
    12061206    if (options.showScopeChainSidebar)
  • trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointPopover.js

    r269023 r269337  
    5353    static appendContextMenuItems(contextMenu, breakpoint, targetElement)
    5454    {
    55         if (breakpoint.editable) {
     55        if (breakpoint.editable && targetElement) {
    5656            contextMenu.appendItem(WI.UIString("Edit Breakpoint\u2026"), () => {
    5757                const delegate = null;
  • trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js

    r267723 r269337  
    406406    }
    407407
    408     contextMenu.appendSeparator();
    409 
    410     if (breakpoints.length) {
     408    if (breakpoints.length && !WI.isShowingSourcesTab()) {
     409        contextMenu.appendItem(breakpoints.length === 1 ? WI.UIString("Reveal Breakpoint in Sources Tab") : WI.UIString("Reveal Breakpoints in Sources Tab"), () => {
     410            WI.showSourcesTab({
     411                representedObjectToSelect: breakpoints.length === 1 ? breakpoints[0] : domNode,
     412            });
     413        });
     414    }
     415
     416    contextMenu.appendSeparator();
     417
     418    if (breakpoints.length === 1)
     419        WI.BreakpointPopover.appendContextMenuItems(contextMenu, breakpoints[0], options.popoverTargetElement);
     420    else if (breakpoints.length) {
    411421        let shouldEnable = breakpoints.some((breakpoint) => breakpoint.disabled);
    412         contextMenu.appendItem(shouldEnable ? WI.UIString("Enable Breakpoint") : WI.UIString("Disable Breakpoint"), () => {
     422        contextMenu.appendItem(shouldEnable ? WI.UIString("Enable Breakpoints") : WI.UIString("Disable Breakpoints"), () => {
    413423            for (let breakpoint of breakpoints)
    414424                breakpoint.disabled = !shouldEnable;
    415425        });
    416426
    417         contextMenu.appendItem(WI.UIString("Delete Breakpoint"), () => {
     427        contextMenu.appendItem(WI.UIString("Delete Breakpoints"), () => {
    418428            for (let breakpoint of breakpoints)
    419429                WI.domDebuggerManager.removeDOMBreakpoint(breakpoint);
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

    r262302 r269337  
    7575    // Public
    7676
     77    get statusImageElement() { return this._statusImageElement; }
     78
    7779    get hasBreakpoint()
    7880    {
     
    19731975
    19741976        WI.appendContextMenuItemsForDOMNodeBreakpoints(contextMenu, this.representedObject, {
     1977            popoverTargetElement: event.target,
    19751978            revealDescendantBreakpointsMenuItemHandler: this.bindRevealDescendantBreakpointsMenuItemHandler(),
    19761979        });
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js

    r257380 r269337  
    299299            excludeRevealElement: this._excludeRevealElementContextMenu,
    300300            copySubMenu: subMenus.copy,
     301            popoverTargetElement: treeElement.statusImageElement,
    301302        };
    302303
  • trunk/Source/WebInspectorUI/UserInterface/Views/EventListenerSectionGroup.js

    r266074 r269337  
    8888                    revealBreakpointGoToArrow.addEventListener("click", (event) => {
    8989                        console.assert(this.hasEventListenerBreakpoint);
    90 
    91                         let breakpointToSelect = WI.domManager.breakpointForEventListenerId(this._eventListener.eventListenerId);
    92                         console.assert(breakpointToSelect);
    93 
    94                         WI.showSourcesTab({breakpointToSelect});
     90                        WI.showSourcesTab({
     91                            representedObjectToSelect: WI.domManager.breakpointForEventListenerId(this._eventListener.eventListenerId),
     92                        });
    9593                    });
    9694                }
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

    r266480 r269337  
    12781278                contextMenu.appendItem(WI.UIString("Reveal in Sources Tab"), () => {
    12791279                    WI.showSourcesTab({
    1280                         breakpointToSelect: breakpoints[0],
     1280                        representedObjectToSelect: breakpoints[0],
    12811281                        initiatorHint: WI.TabBrowser.TabNavigationInitiator.ContextMenu,
    12821282                    });
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourcesTabContentView.js

    r268427 r269337  
    100100    }
    101101
    102     revealAndSelectBreakpoint(breakpoint)
     102    revealAndSelectRepresentedObject(representedObject)
    103103    {
    104         console.assert(breakpoint instanceof WI.Breakpoint);
    105 
    106         let treeElement = this.navigationSidebarPanel.treeElementForRepresentedObject(breakpoint);
    107         if (treeElement)
    108             treeElement.revealAndSelect();
     104        let treeElement = this.navigationSidebarPanel.treeElementForRepresentedObject(representedObject);
     105        if (treeElement) {
     106            const omitFocus = false;
     107            const selectedByUser = true;
     108            treeElement.revealAndSelect(omitFocus, selectedByUser);
     109        }
    109110    }
    110111
Note: See TracChangeset for help on using the changeset viewer.