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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js

Issue 1809543002: [DevTools] Add 200ms timeout to menu on mousedown behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improved Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
index cfc5efd13db88e8f10692ce1cf6437ecc63b37f7..70c374e8dcbc3ce3142f65ecb1f339cf698cd52d 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -644,6 +644,16 @@ WebInspector.ToolbarMenuButton.prototype = {
return;
}
+ if (!this._triggerTimeout)
+ this._triggerTimeout = setTimeout(this._trigger.bind(this, event), 200);
+ },
+
+ /**
+ * @param {!Event} event
+ */
+ _trigger: function(event)
+ {
+ delete this._triggerTimeout;
PhistucK 2016/03/16 18:04:48 As far as I know, delete foo; is discouraged becau
pfeldman 2016/03/16 19:33:31 This code path will never be optimized in the firs
var contextMenu = new WebInspector.ContextMenu(event,
this._useSoftMenu,
this.element.totalOffsetLeft(),
@@ -658,6 +668,10 @@ WebInspector.ToolbarMenuButton.prototype = {
*/
_clicked: function(event)
{
+ if (!this._triggerTimeout)
+ return;
+ clearTimeout(this._triggerTimeout);
+ this._trigger(event);
},
__proto__: WebInspector.ToolbarButton.prototype
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698