| 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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 if (!this._triggerTimeout) | 708 if (!this._triggerTimeout) |
| 709 this._triggerTimeout = setTimeout(this._trigger.bind(this, event), 2
00); | 709 this._triggerTimeout = setTimeout(this._trigger.bind(this, event), 2
00); |
| 710 }, | 710 }, |
| 711 | 711 |
| 712 /** | 712 /** |
| 713 * @param {!Event} event | 713 * @param {!Event} event |
| 714 */ | 714 */ |
| 715 _trigger: function(event) | 715 _trigger: function(event) |
| 716 { | 716 { |
| 717 delete this._triggerTimeout; | 717 delete this._triggerTimeout; |
| 718 |
| 719 // Throttling avoids entering a bad state on Macs when rapidly triggerin
g context menus just |
| 720 // after the window gains focus. See crbug.com/655556 |
| 721 if (this._lastTriggerTime && Date.now() - this._lastTriggerTime < 300) |
| 722 return; |
| 718 var contextMenu = new WebInspector.ContextMenu(event, | 723 var contextMenu = new WebInspector.ContextMenu(event, |
| 719 this._useSoftMenu, | 724 this._useSoftMenu, |
| 720 this.element.totalOffsetLeft(), | 725 this.element.totalOffsetLeft(), |
| 721 this.element.totalOffsetTop() + this.element.offsetHeight); | 726 this.element.totalOffsetTop() + this.element.offsetHeight); |
| 722 this._contextMenuHandler(contextMenu); | 727 this._contextMenuHandler(contextMenu); |
| 723 contextMenu.show(); | 728 contextMenu.show(); |
| 729 this._lastTriggerTime = Date.now(); |
| 724 }, | 730 }, |
| 725 | 731 |
| 726 /** | 732 /** |
| 727 * @override | 733 * @override |
| 728 * @param {!Event} event | 734 * @param {!Event} event |
| 729 */ | 735 */ |
| 730 _clicked: function(event) | 736 _clicked: function(event) |
| 731 { | 737 { |
| 732 if (!this._triggerTimeout) | 738 if (!this._triggerTimeout) |
| 733 return; | 739 return; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 * @param {boolean} value | 993 * @param {boolean} value |
| 988 */ | 994 */ |
| 989 setChecked: function(value) | 995 setChecked: function(value) |
| 990 { | 996 { |
| 991 this.inputElement.checked = value; | 997 this.inputElement.checked = value; |
| 992 }, | 998 }, |
| 993 | 999 |
| 994 __proto__: WebInspector.ToolbarItem.prototype | 1000 __proto__: WebInspector.ToolbarItem.prototype |
| 995 } | 1001 } |
| 996 | 1002 |
| OLD | NEW |