OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
8 */ | 8 */ |
9 WebInspector.SwatchPopoverHelper = function() | 9 WebInspector.SwatchPopoverHelper = function() |
10 { | 10 { |
11 this._popover = new WebInspector.Popover(); | 11 this._popover = new WebInspector.Popover(); |
12 this._popover.setCanShrink(false); | 12 this._popover.setCanShrink(false); |
13 this._popover.setNoPadding(true); | 13 this._popover.setNoPadding(true); |
14 this._popover.element.addEventListener("mousedown", (e) => e.consume(), fals
e); | 14 this._popover.element.addEventListener("mousedown", (e) => e.consume(), fals
e); |
15 | 15 |
16 this._hideProxy = this.hide.bind(this, true); | 16 this._hideProxy = this.hide.bind(this, true); |
17 this._boundOnKeyDown = this._onKeyDown.bind(this); | 17 this._boundOnKeyDown = this._onKeyDown.bind(this); |
18 this._boundFocusOut = this._onFocusOut.bind(this); | 18 this._boundFocusOut = this._onFocusOut.bind(this); |
19 this._isHidden = true; | 19 this._isHidden = true; |
20 } | 20 }; |
21 | 21 |
22 WebInspector.SwatchPopoverHelper.prototype = { | 22 WebInspector.SwatchPopoverHelper.prototype = { |
23 /** | 23 /** |
24 * @param {!Event} event | 24 * @param {!Event} event |
25 */ | 25 */ |
26 _onFocusOut: function(event) | 26 _onFocusOut: function(event) |
27 { | 27 { |
28 if (!event.relatedTarget || event.relatedTarget.isSelfOrDescendant(this.
_view.contentElement)) | 28 if (!event.relatedTarget || event.relatedTarget.isSelfOrDescendant(this.
_view.contentElement)) |
29 return; | 29 return; |
30 this._hideProxy(); | 30 this._hideProxy(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 event.consume(true); | 112 event.consume(true); |
113 return; | 113 return; |
114 } | 114 } |
115 if (event.key === "Escape") { | 115 if (event.key === "Escape") { |
116 this.hide(false); | 116 this.hide(false); |
117 event.consume(true); | 117 event.consume(true); |
118 } | 118 } |
119 }, | 119 }, |
120 | 120 |
121 __proto__: WebInspector.Object.prototype | 121 __proto__: WebInspector.Object.prototype |
122 } | 122 }; |
OLD | NEW |