Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1949)

Unified Diff: Source/devtools/front_end/ui/Tooltip.js

Issue 1273363002: Devtools UI: Show multiple shortcuts, show more shortcuts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/ui/Tooltip.js
diff --git a/Source/devtools/front_end/ui/Tooltip.js b/Source/devtools/front_end/ui/Tooltip.js
index 7cb6998eb028b5c0839b30c8b5541d2d72ed1e15..8e8fdb8e7265813240eb07c1c0e9cb7d718339c1 100644
--- a/Source/devtools/front_end/ui/Tooltip.js
+++ b/Source/devtools/front_end/ui/Tooltip.js
@@ -64,11 +64,11 @@ WebInspector.Tooltip.prototype = {
else
this._tooltipElement.appendChild(tooltip.content);
- if (tooltip.actionId) {
- var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsForAction(tooltip.actionId);
- if (shortcuts && shortcuts.length) {
+ if (tooltip.shortcuts || tooltip.actionId) {
+ var shortcuts = tooltip.shortcuts || WebInspector.shortcutRegistry.shortcutDescriptorsForAction(tooltip.actionId);
+ for (var shortcut of shortcuts) {
var shortcutElement = this._tooltipElement.createChild("div", "tooltip-shortcut");
- shortcutElement.textContent = shortcuts[0].name;
+ shortcutElement.textContent = shortcut.name;
}
}
@@ -135,11 +135,12 @@ WebInspector.Tooltip.installHandler = function(doc)
* @param {!Element|string} tooltipContent
* @param {string=} alignment
* @param {string=} actionId
+ * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>=} shortcuts
*/
-WebInspector.Tooltip.install = function(element, tooltipContent, alignment, actionId)
+WebInspector.Tooltip.install = function(element, tooltipContent, alignment, actionId, shortcuts)
{
if (Runtime.experiments.isEnabled("tooltips"))
- element[WebInspector.Tooltip._symbol] = { content: tooltipContent, alignment: alignment, actionId: actionId };
+ element[WebInspector.Tooltip._symbol] = { content: tooltipContent, alignment: alignment, actionId: actionId, shortcuts: shortcuts };
else if (typeof tooltipContent === "string")
element.title = tooltipContent;
else
« Source/devtools/front_end/ui/Toolbar.js ('K') | « Source/devtools/front_end/ui/Toolbar.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698