| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 */ | 104 */ |
| 105 _mouseMove(event) { | 105 _mouseMove(event) { |
| 106 // Pretend that nothing has happened. | 106 // Pretend that nothing has happened. |
| 107 if (this._eventInScheduledContent(event)) | 107 if (this._eventInScheduledContent(event)) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 this._startHidePopoverTimer(this._hideTimeout); | 110 this._startHidePopoverTimer(this._hideTimeout); |
| 111 this._stopShowPopoverTimer(); | 111 this._stopShowPopoverTimer(); |
| 112 if (event.which && this._disableOnClick) | 112 if (event.which && this._disableOnClick) |
| 113 return; | 113 return; |
| 114 this._startShowPopoverTimer( | 114 this._startShowPopoverTimer(event, this.isPopoverVisible() ? this._timeout *
0.6 : this._timeout); |
| 115 event, this.isPopoverVisible() ? Math.max(this._timeout * 0.6, this._hid
eTimeout) : this._timeout); | |
| 116 } | 115 } |
| 117 | 116 |
| 118 /** | 117 /** |
| 119 * @param {!Event} event | 118 * @param {!Event} event |
| 120 */ | 119 */ |
| 121 _popoverMouseMove(event) { | 120 _popoverMouseMove(event) { |
| 122 this._stopHidePopoverTimer(); | 121 this._stopHidePopoverTimer(); |
| 123 } | 122 } |
| 124 | 123 |
| 125 /** | 124 /** |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 * @param {!Event} event | 160 * @param {!Event} event |
| 162 * @param {number} timeout | 161 * @param {number} timeout |
| 163 */ | 162 */ |
| 164 _startShowPopoverTimer(event, timeout) { | 163 _startShowPopoverTimer(event, timeout) { |
| 165 this._scheduledRequest = this._getRequest.call(null, event); | 164 this._scheduledRequest = this._getRequest.call(null, event); |
| 166 if (!this._scheduledRequest) | 165 if (!this._scheduledRequest) |
| 167 return; | 166 return; |
| 168 | 167 |
| 169 this._showPopoverTimer = setTimeout(() => { | 168 this._showPopoverTimer = setTimeout(() => { |
| 170 delete this._showPopoverTimer; | 169 delete this._showPopoverTimer; |
| 170 this._stopHidePopoverTimer(); |
| 171 this._hidePopover(); |
| 171 this._showPopover(event.target.ownerDocument); | 172 this._showPopover(event.target.ownerDocument); |
| 172 }, timeout); | 173 }, timeout); |
| 173 } | 174 } |
| 174 | 175 |
| 175 _stopShowPopoverTimer() { | 176 _stopShowPopoverTimer() { |
| 176 if (!this._showPopoverTimer) | 177 if (!this._showPopoverTimer) |
| 177 return; | 178 return; |
| 178 clearTimeout(this._showPopoverTimer); | 179 clearTimeout(this._showPopoverTimer); |
| 179 delete this._showPopoverTimer; | 180 delete this._showPopoverTimer; |
| 180 } | 181 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 delete this._hidePopoverTimer; | 248 delete this._hidePopoverTimer; |
| 248 | 249 |
| 249 // We know that we reached the popup, but we might have moved over other ele
ments. | 250 // We know that we reached the popup, but we might have moved over other ele
ments. |
| 250 // Discard pending command. | 251 // Discard pending command. |
| 251 this._stopShowPopoverTimer(); | 252 this._stopShowPopoverTimer(); |
| 252 } | 253 } |
| 253 }; | 254 }; |
| 254 | 255 |
| 255 /** @typedef {{box: !AnchorBox, show:(function(!UI.GlassPane):!Promise<boolean>)
, hide:(function()|undefined)}} */ | 256 /** @typedef {{box: !AnchorBox, show:(function(!UI.GlassPane):!Promise<boolean>)
, hide:(function()|undefined)}} */ |
| 256 UI.PopoverRequest; | 257 UI.PopoverRequest; |
| OLD | NEW |