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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 * @override 637 * @override
638 * @param {!Event} event 638 * @param {!Event} event
639 */ 639 */
640 _mouseDown: function(event) 640 _mouseDown: function(event)
641 { 641 {
642 if (event.buttons !== 1) { 642 if (event.buttons !== 1) {
643 WebInspector.ToolbarButton.prototype._mouseDown.call(this, event); 643 WebInspector.ToolbarButton.prototype._mouseDown.call(this, event);
644 return; 644 return;
645 } 645 }
646 646
647 if (!this._triggerTimeout)
648 this._triggerTimeout = setTimeout(this._trigger.bind(this, event), 2 00);
649 },
650
651 /**
652 * @param {!Event} event
653 */
654 _trigger: function(event)
655 {
656 delete this._triggerTimeout;
647 var contextMenu = new WebInspector.ContextMenu(event, 657 var contextMenu = new WebInspector.ContextMenu(event,
648 this._useSoftMenu, 658 this._useSoftMenu,
649 this.element.totalOffsetLeft(), 659 this.element.totalOffsetLeft(),
650 this.element.totalOffsetTop() + this.element.offsetHeight); 660 this.element.totalOffsetTop() + this.element.offsetHeight);
651 this._contextMenuHandler(contextMenu); 661 this._contextMenuHandler(contextMenu);
652 contextMenu.show(); 662 contextMenu.show();
653 }, 663 },
654 664
655 /** 665 /**
656 * @override 666 * @override
657 * @param {!Event} event 667 * @param {!Event} event
658 */ 668 */
659 _clicked: function(event) 669 _clicked: function(event)
660 { 670 {
671 if (this._triggerTimeout) {
caseq 2016/03/16 00:12:00 nit: if (!this._triggerTimeout) return;
dgozman 2016/03/16 01:54:13 Done.
672 clearTimeout(this._triggerTimeout);
673 delete this._triggerTimeout;
caseq 2016/03/16 00:12:00 this is redundant.
dgozman 2016/03/16 01:54:12 Done.
674 this._trigger(event);
675 }
661 }, 676 },
662 677
663 __proto__: WebInspector.ToolbarButton.prototype 678 __proto__: WebInspector.ToolbarButton.prototype
664 } 679 }
665 680
666 /** 681 /**
667 * @constructor 682 * @constructor
668 * @extends {WebInspector.ToolbarToggle} 683 * @extends {WebInspector.ToolbarToggle}
669 * @param {!WebInspector.Setting} setting 684 * @param {!WebInspector.Setting} setting
670 * @param {string} glyph 685 * @param {string} glyph
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 /** 973 /**
959 * @return {!Promise} 974 * @return {!Promise}
960 */ 975 */
961 onLoad: function() 976 onLoad: function()
962 { 977 {
963 return this._promise; 978 return this._promise;
964 }, 979 },
965 980
966 __proto__: WebInspector.Toolbar.prototype 981 __proto__: WebInspector.Toolbar.prototype
967 } 982 }
OLDNEW
« 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