Changeset 229543 in webkit


Ignore:
Timestamp:
Mar 12, 2018 12:35:00 PM (6 years ago)
Author:
Jon Davis
Message:

Web Inspector: Remove redundant tooltips
https://bugs.webkit.org/show_bug.cgi?id=183099

Reviewed by Matt Baker.

  • Localizations/en.lproj/localizedStrings.js:
  • UserInterface/Base/Main.js:

(WI.contentLoaded):
Instantiate ConsoleDrawer so the keyboard shortcuts for FindBanner are available.

  • UserInterface/Views/BreakpointTreeElement.js:

(WI.BreakpointTreeElement):
Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.

  • UserInterface/Views/ButtonNavigationItem.js:

(WI.ButtonNavigationItem):
Only show tooltips when the button style is an image.

  • UserInterface/Views/ConsoleDrawer.js:

(WI.ConsoleDrawer):
(WI.ConsoleDrawer.prototype.toggleButtonShortcutTooltip):
Added helper to set the toggle button keyboard shortcut tooltip.

  • UserInterface/Views/DOMBreakpointTreeElement.js:

(WI.DOMBreakpointTreeElement):
Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.

  • UserInterface/Views/DOMNodeTreeElement.js:

(WI.DOMNodeTreeElement):
Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.

  • UserInterface/Views/FindBanner.js:

(WI.FindBanner):

  • UserInterface/Views/HierarchicalPathComponent.js:

(WI.HierarchicalPathComponent):
(WI.HierarchicalPathComponent.prototype.get tooltip):
(WI.HierarchicalPathComponent.prototype.set tooltip):
(WI.HierarchicalPathComponent.prototype.get hideTooltip):
(WI.HierarchicalPathComponent.prototype.set hideTooltip):
(WI.HierarchicalPathComponent.prototype._updateElementTitleAndText):
Add tooltip management features to manage tooltips separately of the displayName,
and provide a behavior to hide tooltips while retaining the tooltip data.

  • UserInterface/Views/HierarchicalPathNavigationItem.js:

(WI.HierarchicalPathNavigationItem.prototype.updateLayout):
Hide tooltips when fully visible, show tooltips for collapsed items.

  • UserInterface/Views/PinnedTabBarItem.js:

(WI.PinnedTabBarItem.prototype.titleDidChange):
Set tooltips for pinned tab bar items.

  • UserInterface/Views/QuickConsole.js:

(WI.QuickConsole):
Set the ConsoleDrawer toggle button tooltip after the keyboard shortcut is registered.

  • UserInterface/Views/StorageTreeElement.js:

(WI.StorageTreeElement):
Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.

  • UserInterface/Views/TabBarItem.js:

(WI.TabBarItem.prototype.get title):
(WI.TabBarItem.prototype.set title):
(WI.TabBarItem.prototype.titleDidChange):
(WI.TabBarItem):
Add title property management with an overridable titleDidChange handler for
setting tooltips when needed.

  • UserInterface/Views/TimelineTreeElement.js:

(WI.TimelineTreeElement):
Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.

  • UserInterface/Views/ToggleButtonNavigationItem.js:

(WI.ToggleButtonNavigationItem.prototype.set defaultToolTip):
Added a setter for manging the default tooltip of a toggle button.

  • UserInterface/Views/XHRBreakpointTreeElement.js:

(WI.XHRBreakpointTreeElement):
Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.

Location:
trunk/Source/WebInspectorUI
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r229495 r229543  
     12018-03-12  Jon Davis  <jond@apple.com>
     2
     3        Web Inspector: Remove redundant tooltips
     4        https://bugs.webkit.org/show_bug.cgi?id=183099
     5
     6        Reviewed by Matt Baker.
     7
     8        * Localizations/en.lproj/localizedStrings.js:
     9        * UserInterface/Base/Main.js:
     10        (WI.contentLoaded):
     11        Instantiate ConsoleDrawer so the keyboard shortcuts for FindBanner are available.
     12
     13        * UserInterface/Views/BreakpointTreeElement.js:
     14        (WI.BreakpointTreeElement):
     15        Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.
     16
     17        * UserInterface/Views/ButtonNavigationItem.js:
     18        (WI.ButtonNavigationItem):
     19        Only show tooltips when the button style is an image.
     20
     21        * UserInterface/Views/ConsoleDrawer.js:
     22        (WI.ConsoleDrawer):
     23        (WI.ConsoleDrawer.prototype.toggleButtonShortcutTooltip):
     24        Added helper to set the toggle button keyboard shortcut tooltip.
     25
     26        * UserInterface/Views/DOMBreakpointTreeElement.js:
     27        (WI.DOMBreakpointTreeElement):
     28        Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.
     29
     30        * UserInterface/Views/DOMNodeTreeElement.js:
     31        (WI.DOMNodeTreeElement):
     32        Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.
     33
     34        * UserInterface/Views/FindBanner.js:
     35        (WI.FindBanner):
     36        * UserInterface/Views/HierarchicalPathComponent.js:
     37        (WI.HierarchicalPathComponent):
     38        (WI.HierarchicalPathComponent.prototype.get tooltip):
     39        (WI.HierarchicalPathComponent.prototype.set tooltip):
     40        (WI.HierarchicalPathComponent.prototype.get hideTooltip):
     41        (WI.HierarchicalPathComponent.prototype.set hideTooltip):
     42        (WI.HierarchicalPathComponent.prototype._updateElementTitleAndText):
     43        Add tooltip management features to manage tooltips separately of the displayName,
     44        and provide a behavior to hide tooltips while retaining the tooltip data.
     45
     46        * UserInterface/Views/HierarchicalPathNavigationItem.js:
     47        (WI.HierarchicalPathNavigationItem.prototype.updateLayout):
     48        Hide tooltips when fully visible, show tooltips for collapsed items.
     49
     50        * UserInterface/Views/PinnedTabBarItem.js:
     51        (WI.PinnedTabBarItem.prototype.titleDidChange):
     52        Set tooltips for pinned tab bar items.
     53
     54        * UserInterface/Views/QuickConsole.js:
     55        (WI.QuickConsole):
     56        Set the ConsoleDrawer toggle button tooltip after the keyboard shortcut is registered.
     57
     58        * UserInterface/Views/StorageTreeElement.js:
     59        (WI.StorageTreeElement):
     60        Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.
     61
     62        * UserInterface/Views/TabBarItem.js:
     63        (WI.TabBarItem.prototype.get title):
     64        (WI.TabBarItem.prototype.set title):
     65        (WI.TabBarItem.prototype.titleDidChange):
     66        (WI.TabBarItem):
     67        Add title property management with an overridable titleDidChange handler for
     68        setting tooltips when needed.
     69
     70        * UserInterface/Views/TimelineTreeElement.js:
     71        (WI.TimelineTreeElement):
     72        Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.
     73
     74        * UserInterface/Views/ToggleButtonNavigationItem.js:
     75        (WI.ToggleButtonNavigationItem.prototype.set defaultToolTip):
     76        Added a setter for manging the default tooltip of a toggle button.
     77
     78        * UserInterface/Views/XHRBreakpointTreeElement.js:
     79        (WI.XHRBreakpointTreeElement):
     80        Suppress tooltips by setting the tooltipHandledSeprately flag with no custom handler.
     81
    1822018-03-09  Nikita Vasilyev  <nvasilyev@apple.com>
    283
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r229495 r229543  
    421421localizedStrings["Filter"] = "Filter";
    422422localizedStrings["Filter Full URL"] = "Filter Full URL";
     423localizedStrings["Find Next (%s)"] = "Find Next (%s)";
     424localizedStrings["Find Previous (%s)"] = "Find Previous (%s)";
    423425localizedStrings["Flexbox"] = "Flexbox";
    424426localizedStrings["Float"] = "Float";
     
    475477localizedStrings["Height"] = "Height";
    476478localizedStrings["Hide Console"] = "Hide Console";
     479localizedStrings["Hide Console (%s)"] = "Hide Console (%s)";
    477480localizedStrings["Hide Grid"] = "Hide Grid";
    478481localizedStrings["Hide Path"] = "Hide Path";
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r229495 r229543  
    282282    this._contentElement.setAttribute("aria-label", WI.UIString("Content"));
    283283
    284     this.consoleDrawer = new WI.ConsoleDrawer(document.getElementById("console-drawer"));
    285     this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._consoleDrawerCollapsedStateDidChange, this);
    286     this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.Resized, this._consoleDrawerDidResize, this);
    287 
    288284    this.clearKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "K", this._clear.bind(this));
    289285
     
    293289    this.findNextKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._findNext.bind(this));
    294290    this.findPreviousKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Shift | WI.KeyboardShortcut.Modifier.CommandOrControl, "G", this._findPrevious.bind(this));
     291
     292    this.consoleDrawer = new WI.ConsoleDrawer(document.getElementById("console-drawer"));
     293    this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._consoleDrawerCollapsedStateDidChange, this);
     294    this.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.Resized, this._consoleDrawerDidResize, this);
    295295
    296296    this.quickConsole = new WI.QuickConsole(document.getElementById("quick-console"));
  • trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js

    r220119 r229543  
    6363        this._iconAnimationLayerElement = document.createElement("span");
    6464        this.iconElement.appendChild(this._iconAnimationLayerElement);
     65        this.tooltipHandledSeparately = true;
    6566    }
    6667
  • trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js

    r225250 r229543  
    3535        this._enabled = true;
    3636
    37         this.tooltip = toolTipOrLabel;
    38 
    3937        this.element.addEventListener("click", this._mouseClicked.bind(this));
    4038
     
    5048
    5149        this.buttonStyle = this._image ? WI.ButtonNavigationItem.Style.Image : WI.ButtonNavigationItem.Style.Text;
     50
     51        if (this.buttonStyle === WI.ButtonNavigationItem.Style.Image)
     52            this.tooltip = toolTipOrLabel;
    5253    }
    5354
  • trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js

    r223931 r229543  
    4040
    4141        this._toggleDrawerButton = new WI.ToggleButtonNavigationItem("toggle-drawer", WI.UIString("Hide Console"), WI.UIString("Show Console"), "Images/HideConsoleDrawer.svg", "Images/ShowConsoleDrawer.svg");
     42
    4243        this._toggleDrawerButton.visibilityPriority = WI.NavigationItem.VisibilityPriority.High;
    4344        this._toggleDrawerButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, () => { WI.toggleSplitConsole(); });
     
    5051
    5152    // Public
     53
     54    toggleButtonShortcutTooltip(keyboardShortcut)
     55    {
     56        this._toggleDrawerButton.defaultToolTip = WI.UIString("Hide Console (%s)").format(keyboardShortcut.displayName);
     57    }
    5258
    5359    get collapsed()
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js

    r220119 r229543  
    4141        this._statusImageElement.classList.add("status-image", "resolved");
    4242        this.status = this._statusImageElement;
     43        this.tooltipHandledSeparately = true;
    4344
    4445        breakpoint.addEventListener(WI.DOMBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this);
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js

    r220119 r229543  
    3434
    3535        this.status = WI.linkifyNodeReferenceElement(domNode, WI.createGoToArrowButton());
     36        this.tooltipHandledSeparately = true;
    3637    }
    3738
  • trunk/Source/WebInspectorUI/UserInterface/Views/FindBanner.js

    r223308 r229543  
    5454        this._previousResultButton.classList.add("segmented", "previous-result");
    5555        this._previousResultButton.disabled = true;
     56        this._previousResultButton.title = WI.UIString("Find Previous (%s)").format(WI.findPreviousKeyboardShortcut.displayName);;
    5657        this._previousResultButton.addEventListener("click", this._previousResultButtonClicked.bind(this));
    5758        this.element.appendChild(this._previousResultButton);
     
    6465        this._nextResultButton.classList.add("segmented", "next-result");
    6566        this._nextResultButton.disabled = true;
     67        this._nextResultButton.title = WI.UIString("Find Next (%s)").format(WI.findNextKeyboardShortcut.displayName);;
    6668        this._nextResultButton.addEventListener("click", this._nextResultButtonClicked.bind(this));
    6769        this.element.appendChild(this._nextResultButton);
  • trunk/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js

    r227108 r229543  
    8282
    8383        this.displayName = displayName;
     84        this.tooltip = displayName;
    8485        this.selectorArrows = showSelectorArrows;
    8586    }
     
    218219    }
    219220
     221    get tooltip()
     222    {
     223        return this._tooltip;
     224    }
     225
     226    set tooltip(x)
     227    {
     228        if (x === this._tooltip)
     229            return;
     230
     231
     232        this._tooltip = x;
     233        this._updateElementTitleAndText();
     234    }
     235
     236    get hideTooltip ()
     237    {
     238        return this._hideTooltip;
     239    }
     240
     241    set hideTooltip(hide)
     242    {
     243        this._hideTooltip = hide;
     244        this._updateElementTitleAndText();
     245    }
     246
    220247    get previousSibling() { return this._previousSibling; }
    221248    set previousSibling(newSlibling) { this._previousSibling = newSlibling || null; }
     
    231258            truncatedDisplayName = truncatedDisplayName.substring(0, this._truncatedDisplayNameLength) + ellipsis;
    232259
    233         this._element.title = this._displayName;
    234260        this._titleContentElement.textContent = truncatedDisplayName;
     261
     262        if (this.hideTooltip)
     263            this._element.title = "";
     264        else
     265            this._element.title = this._tooltip;
    235266    }
    236267
  • trunk/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js

    r223308 r229543  
    119119            this._components[i].hidden = false;
    120120            this._components[i].forcedWidth = null;
     121            this._components[i].hideTooltip = true;
    121122        }
    122123
     
    162163            var componentWidth = componentWidths[i];
    163164
     165            this._components[i].hideTooltip = false;
     166
    164167            // Try to take the whole width we need to remove from each component.
    165168            var forcedWidth = componentWidth - widthToRemove;
  • trunk/Source/WebInspectorUI/UserInterface/Views/PinnedTabBarItem.js

    r228581 r229543  
    4040    }
    4141
     42    titleDidChange()
     43    {
     44        this.element.title = this.title;
     45    }
     46
    4247    // Private
    4348
  • trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js

    r227003 r229543  
    6767        this._rebuildExecutionContextPathComponents();
    6868
     69        WI.consoleDrawer.toggleButtonShortcutTooltip(this._toggleOrFocusKeyboardShortcut);
     70        WI.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._updateStyles, this);
     71
    6972        WI.Frame.addEventListener(WI.Frame.Event.PageExecutionContextChanged, this._framePageExecutionContextsChanged, this);
    7073        WI.Frame.addEventListener(WI.Frame.Event.ExecutionContextsCleared, this._frameExecutionContextsCleared, this);
     
    7679        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetAdded, this._targetAdded, this);
    7780        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
    78 
    79         WI.consoleDrawer.addEventListener(WI.ConsoleDrawer.Event.CollapsedStateChanged, this._updateStyles, this);
    8081
    8182        WI.TabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._updateStyles, this);
  • trunk/Source/WebInspectorUI/UserInterface/Views/StorageTreeElement.js

    r220119 r229543  
    3232
    3333        this.flattened = false;
     34        this.tooltipHandledSeparately = true;
    3435    }
    3536
  • trunk/Source/WebInspectorUI/UserInterface/Views/TabBarItem.js

    r228573 r229543  
    100100    set image(url) { this._iconElement.src = url || ""; }
    101101
    102     get title() { return this._element.title || ""; }
    103     set title(title) { this._element.title = title || ""; }
     102    get title()
     103    {
     104        return this._title;
     105    }
     106
     107    set title(title)
     108    {
     109        title = title || "";
     110        if (this._title === title)
     111            return;
     112
     113        this._title = title;
     114        this.titleDidChange();
     115    }
     116
     117    titleDidChange()
     118    {
     119        // Implemented by subclasses.
     120    }
    104121};
    105122
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTreeElement.js

    r224433 r229543  
    3636        this._placeholder = placeholder || false;
    3737        this.editing = this._placeholder;
     38        this.tooltipHandledSeparately = true;
    3839    }
    3940
  • trunk/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js

    r225250 r229543  
    4242    {
    4343        return this._defaultToolTip;
     44    }
     45
     46    set defaultToolTip(toolTip)
     47    {
     48        this._defaultToolTip = toolTip;
     49
     50        if (!this._toggled)
     51            this.tooltip = this._defaultToolTip;
    4452    }
    4553
  • trunk/Source/WebInspectorUI/UserInterface/Views/XHRBreakpointTreeElement.js

    r220119 r229543  
    4747        this._statusImageElement.classList.add("status-image", "resolved");
    4848        this.status = this._statusImageElement;
     49        this.tooltipHandledSeparately = true;
    4950
    5051        breakpoint.addEventListener(WI.XHRBreakpoint.Event.DisabledStateDidChange, this._updateStatus, this);
Note: See TracChangeset for help on using the changeset viewer.