Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit c123fc3

Browse files
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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent a363b12 commit c123fc3

18 files changed

+175
-11
lines changed

Source/WebInspectorUI/ChangeLog

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,84 @@
1+
2018-03-12 Jon Davis <[email protected]>
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+
182
2018-03-09 Nikita Vasilyev <[email protected]>
283

384
Web Inspector: Sources: Open all resources in Sources tab instead of Resources/Debugger

Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ localizedStrings["Fill"] = "Fill";
420420
localizedStrings["Fill Mode"] = "Fill Mode";
421421
localizedStrings["Filter"] = "Filter";
422422
localizedStrings["Filter Full URL"] = "Filter Full URL";
423+
localizedStrings["Find Next (%s)"] = "Find Next (%s)";
424+
localizedStrings["Find Previous (%s)"] = "Find Previous (%s)";
423425
localizedStrings["Flexbox"] = "Flexbox";
424426
localizedStrings["Float"] = "Float";
425427
localizedStrings["Float and Clear"] = "Float and Clear";
@@ -474,6 +476,7 @@ localizedStrings["Heading Level"] = "Heading Level";
474476
localizedStrings["Heap Snapshot Object (%s)"] = "Heap Snapshot Object (%s)";
475477
localizedStrings["Height"] = "Height";
476478
localizedStrings["Hide Console"] = "Hide Console";
479+
localizedStrings["Hide Console (%s)"] = "Hide Console (%s)";
477480
localizedStrings["Hide Grid"] = "Hide Grid";
478481
localizedStrings["Hide Path"] = "Hide Path";
479482
localizedStrings["Hide compositing borders"] = "Hide compositing borders";

Source/WebInspectorUI/UserInterface/Base/Main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,6 @@ WI.contentLoaded = function()
281281
this._contentElement.setAttribute("role", "main");
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

290286
// FIXME: <https://webkit.org/b/151310> Web Inspector: Command-E should propagate to other search fields (including the system)
@@ -293,6 +289,10 @@ WI.contentLoaded = function()
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));
295291

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);
295+
296296
this.quickConsole = new WI.QuickConsole(document.getElementById("quick-console"));
297297

298298
this._consoleRepresentedObject = new WI.LogObject;

Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ WI.BreakpointTreeElement = class BreakpointTreeElement extends WI.GeneralTreeEle
6262

6363
this._iconAnimationLayerElement = document.createElement("span");
6464
this.iconElement.appendChild(this._iconAnimationLayerElement);
65+
this.tooltipHandledSeparately = true;
6566
}
6667

6768
// Public

Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ WI.ButtonNavigationItem = class ButtonNavigationItem extends WI.NavigationItem
3434

3535
this._enabled = true;
3636

37-
this.tooltip = toolTipOrLabel;
38-
3937
this.element.addEventListener("click", this._mouseClicked.bind(this));
4038

4139
if (label)
@@ -49,6 +47,9 @@ WI.ButtonNavigationItem = class ButtonNavigationItem extends WI.NavigationItem
4947
this._label = toolTipOrLabel;
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

5455
// Public

Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ WI.ConsoleDrawer = class ConsoleDrawer extends WI.ContentBrowser
3939
this.navigationBar.element.addEventListener("mousedown", this._consoleResizerMouseDown.bind(this));
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(); });
4445
this.navigationBar.insertNavigationItem(this._toggleDrawerButton, 0);
@@ -50,6 +51,11 @@ WI.ConsoleDrawer = class ConsoleDrawer extends WI.ContentBrowser
5051

5152
// Public
5253

54+
toggleButtonShortcutTooltip(keyboardShortcut)
55+
{
56+
this._toggleDrawerButton.defaultToolTip = WI.UIString("Hide Console (%s)").format(keyboardShortcut.displayName);
57+
}
58+
5359
get collapsed()
5460
{
5561
return this._collapsed;

Source/WebInspectorUI/UserInterface/Views/DOMBreakpointTreeElement.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ WI.DOMBreakpointTreeElement = class DOMBreakpointTreeElement extends WI.GeneralT
4040
this._statusImageElement = document.createElement("img");
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);
4546

Source/WebInspectorUI/UserInterface/Views/DOMNodeTreeElement.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ WI.DOMNodeTreeElement = class DOMNodeTreeElement extends WI.GeneralTreeElement
3333
super("dom-node", domNode.displayName, subtitle, domNode, {hasChildren: true});
3434

3535
this.status = WI.linkifyNodeReferenceElement(domNode, WI.createGoToArrowButton());
36+
this.tooltipHandledSeparately = true;
3637
}
3738

3839
// Protected

Source/WebInspectorUI/UserInterface/Views/FindBanner.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ WI.FindBanner = class FindBanner extends WI.NavigationItem
5353
this._previousResultButton = document.createElement("button");
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);
5859

@@ -63,6 +64,7 @@ WI.FindBanner = class FindBanner extends WI.NavigationItem
6364
this._nextResultButton = document.createElement("button");
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);
6870

Source/WebInspectorUI/UserInterface/Views/HierarchicalPathComponent.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ WI.HierarchicalPathComponent = class HierarchicalPathComponent extends WI.Object
8181
this._selectorArrows = false;
8282

8383
this.displayName = displayName;
84+
this.tooltip = displayName;
8485
this.selectorArrows = showSelectorArrows;
8586
}
8687

@@ -217,6 +218,32 @@ WI.HierarchicalPathComponent = class HierarchicalPathComponent extends WI.Object
217218
this._element.classList.toggle("show-selector-arrows", !!this._selectorArrows);
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; }
222249
get nextSibling() { return this._nextSibling; }
@@ -230,8 +257,12 @@ WI.HierarchicalPathComponent = class HierarchicalPathComponent extends WI.Object
230257
if (this._truncatedDisplayNameLength && truncatedDisplayName.length > this._truncatedDisplayNameLength)
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

237268
_updateSelectElement()

0 commit comments

Comments
 (0)