Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |