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

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: 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 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;
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
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)
672 return;
673 clearTimeout(this._triggerTimeout);
674 this._trigger(event);
661 }, 675 },
662 676
663 __proto__: WebInspector.ToolbarButton.prototype 677 __proto__: WebInspector.ToolbarButton.prototype
664 } 678 }
665 679
666 /** 680 /**
667 * @constructor 681 * @constructor
668 * @extends {WebInspector.ToolbarToggle} 682 * @extends {WebInspector.ToolbarToggle}
669 * @param {!WebInspector.Setting} setting 683 * @param {!WebInspector.Setting} setting
670 * @param {string} glyph 684 * @param {string} glyph
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 /** 972 /**
959 * @return {!Promise} 973 * @return {!Promise}
960 */ 974 */
961 onLoad: function() 975 onLoad: function()
962 { 976 {
963 return this._promise; 977 return this._promise;
964 }, 978 },
965 979
966 __proto__: WebInspector.Toolbar.prototype 980 __proto__: WebInspector.Toolbar.prototype
967 } 981 }
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