| 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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 650 |
| 651 if (!this._triggerTimeout) | 651 if (!this._triggerTimeout) |
| 652 this._triggerTimeout = setTimeout(this._trigger.bind(this, event), 200); | 652 this._triggerTimeout = setTimeout(this._trigger.bind(this, event), 200); |
| 653 } | 653 } |
| 654 | 654 |
| 655 /** | 655 /** |
| 656 * @param {!Event} event | 656 * @param {!Event} event |
| 657 */ | 657 */ |
| 658 _trigger(event) { | 658 _trigger(event) { |
| 659 delete this._triggerTimeout; | 659 delete this._triggerTimeout; |
| 660 |
| 661 // Throttling avoids entering a bad state on Macs when rapidly triggering co
ntext menus just |
| 662 // after the window gains focus. See crbug.com/655556 |
| 663 if (this._lastTriggerTime && Date.now() - this._lastTriggerTime < 300) |
| 664 return; |
| 660 var contextMenu = new WebInspector.ContextMenu( | 665 var contextMenu = new WebInspector.ContextMenu( |
| 661 event, this._useSoftMenu, this.element.totalOffsetLeft(), | 666 event, this._useSoftMenu, this.element.totalOffsetLeft(), |
| 662 this.element.totalOffsetTop() + this.element.offsetHeight); | 667 this.element.totalOffsetTop() + this.element.offsetHeight); |
| 663 this._contextMenuHandler(contextMenu); | 668 this._contextMenuHandler(contextMenu); |
| 664 contextMenu.show(); | 669 contextMenu.show(); |
| 670 this._lastTriggerTime = Date.now(); |
| 665 } | 671 } |
| 666 | 672 |
| 667 /** | 673 /** |
| 668 * @override | 674 * @override |
| 669 * @param {!Event} event | 675 * @param {!Event} event |
| 670 */ | 676 */ |
| 671 _clicked(event) { | 677 _clicked(event) { |
| 672 if (!this._triggerTimeout) | 678 if (!this._triggerTimeout) |
| 673 return; | 679 return; |
| 674 clearTimeout(this._triggerTimeout); | 680 clearTimeout(this._triggerTimeout); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 return this.inputElement.checked; | 901 return this.inputElement.checked; |
| 896 } | 902 } |
| 897 | 903 |
| 898 /** | 904 /** |
| 899 * @param {boolean} value | 905 * @param {boolean} value |
| 900 */ | 906 */ |
| 901 setChecked(value) { | 907 setChecked(value) { |
| 902 this.inputElement.checked = value; | 908 this.inputElement.checked = value; |
| 903 } | 909 } |
| 904 }; | 910 }; |
| OLD | NEW |