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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!Document} doc 7 * @param {!Document} doc
8 */ 8 */
9 WebInspector.Tooltip = function(doc) 9 WebInspector.Tooltip = function(doc)
10 { 10 {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 var tooltip = anchorElement[WebInspector.Tooltip._symbol]; 59 var tooltip = anchorElement[WebInspector.Tooltip._symbol];
60 this._anchorElement = anchorElement; 60 this._anchorElement = anchorElement;
61 this._tooltipElement.removeChildren(); 61 this._tooltipElement.removeChildren();
62 if (typeof tooltip.content === "string") 62 if (typeof tooltip.content === "string")
63 this._tooltipElement.textContent = tooltip.content; 63 this._tooltipElement.textContent = tooltip.content;
64 else 64 else
65 this._tooltipElement.appendChild(tooltip.content); 65 this._tooltipElement.appendChild(tooltip.content);
66 66
67 if (tooltip.actionId) { 67 if (tooltip.actionId) {
68 var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsFor Action(tooltip.actionId); 68 var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsFor Action(tooltip.actionId);
69 if (shortcuts && shortcuts.length) { 69 for (var shortcut of shortcuts) {
70 var shortcutElement = this._tooltipElement.createChild("div", "t ooltip-shortcut"); 70 var shortcutElement = this._tooltipElement.createChild("div", "t ooltip-shortcut");
71 shortcutElement.textContent = shortcuts[0].name; 71 shortcutElement.textContent = shortcut.name;
72 } 72 }
73 } 73 }
74 74
75 this._tooltipElement.classList.add("shown"); 75 this._tooltipElement.classList.add("shown");
76 // Reposition to ensure text doesn't overflow unnecessarily. 76 // Reposition to ensure text doesn't overflow unnecessarily.
77 this._tooltipElement.positionAt(0, 0); 77 this._tooltipElement.positionAt(0, 0);
78 78
79 // Show tooltip instantly if a tooltip was shown recently. 79 // Show tooltip instantly if a tooltip was shown recently.
80 var now = Date.now(); 80 var now = Date.now();
81 var instant = (this._tooltipLastClosed && now - this._tooltipLastClosed < WebInspector.Tooltip.Timing.InstantThreshold); 81 var instant = (this._tooltipLastClosed && now - this._tooltipLastClosed < WebInspector.Tooltip.Timing.InstantThreshold);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 { 134 {
135 if (Runtime.experiments.isEnabled("tooltips") && typeof tooltipContent === " string" && tooltipContent === "") 135 if (Runtime.experiments.isEnabled("tooltips") && typeof tooltipContent === " string" && tooltipContent === "")
136 return; 136 return;
137 if (Runtime.experiments.isEnabled("tooltips")) 137 if (Runtime.experiments.isEnabled("tooltips"))
138 element[WebInspector.Tooltip._symbol] = { content: tooltipContent, acti onId: actionId }; 138 element[WebInspector.Tooltip._symbol] = { content: tooltipContent, acti onId: actionId };
139 else if (typeof tooltipContent === "string") 139 else if (typeof tooltipContent === "string")
140 element.title = tooltipContent; 140 element.title = tooltipContent;
141 else 141 else
142 console.assert("Cannot set an element without custom tooltips enabled"); 142 console.assert("Cannot set an element without custom tooltips enabled");
143 } 143 }
OLDNEW
« 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