| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 UI.GlassPane = class { | 5 UI.GlassPane = class { |
| 6 constructor() { | 6 constructor() { |
| 7 this._widget = new UI.Widget(true); | 7 this._widget = new UI.Widget(true); |
| 8 this._widget.markAsRoot(); | 8 this._widget.markAsRoot(); |
| 9 this.element = this._widget.element; | 9 this.element = this._widget.element; |
| 10 this.contentElement = this._widget.contentElement; | 10 this.contentElement = this._widget.contentElement; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * @param {!Document} document | 119 * @param {!Document} document |
| 120 */ | 120 */ |
| 121 show(document) { | 121 show(document) { |
| 122 if (this.isShowing()) | 122 if (this.isShowing()) |
| 123 return; | 123 return; |
| 124 // Deliberately starts with 3000 to hide other z-indexed elements below. | 124 // Deliberately starts with 3000 to hide other z-indexed elements below. |
| 125 this.element.style.zIndex = 3000 + 1000 * UI.GlassPane._panes.size; | 125 this.element.style.zIndex = 3000 + 1000 * UI.GlassPane._panes.size; |
| 126 document.body.addEventListener('click', this._onMouseDownBound, true); | 126 document.body.addEventListener('mousedown', this._onMouseDownBound, true); |
| 127 this._widget.show(document.body); | 127 this._widget.show(document.body); |
| 128 UI.GlassPane._panes.add(this); | 128 UI.GlassPane._panes.add(this); |
| 129 this._positionContent(); | 129 this._positionContent(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 hide() { | 132 hide() { |
| 133 if (!this.isShowing()) | 133 if (!this.isShowing()) |
| 134 return; | 134 return; |
| 135 UI.GlassPane._panes.delete(this); | 135 UI.GlassPane._panes.delete(this); |
| 136 this.element.ownerDocument.body.removeEventListener('click', this._onMouseDo
wnBound, true); | 136 this.element.ownerDocument.body.removeEventListener('mousedown', this._onMou
seDownBound, true); |
| 137 this._widget.detach(); | 137 this._widget.detach(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 /** | 140 /** |
| 141 * @param {!Event} event | 141 * @param {!Event} event |
| 142 */ | 142 */ |
| 143 _onMouseDown(event) { | 143 _onMouseDown(event) { |
| 144 if (!this._onClickOutsideCallback) | 144 if (!this._onClickOutsideCallback) |
| 145 return; | 145 return; |
| 146 var node = event.deepElementFromPoint(); | 146 var node = event.deepElementFromPoint(); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 UI.GlassPane.MarginBehavior = { | 389 UI.GlassPane.MarginBehavior = { |
| 390 Arrow: Symbol('Arrow'), | 390 Arrow: Symbol('Arrow'), |
| 391 DefaultMargin: Symbol('DefaultMargin'), | 391 DefaultMargin: Symbol('DefaultMargin'), |
| 392 NoMargin: Symbol('NoMargin') | 392 NoMargin: Symbol('NoMargin') |
| 393 }; | 393 }; |
| 394 | 394 |
| 395 /** @type {!Map<!Document, !Element>} */ | 395 /** @type {!Map<!Document, !Element>} */ |
| 396 UI.GlassPane._containers = new Map(); | 396 UI.GlassPane._containers = new Map(); |
| 397 /** @type {!Set<!UI.GlassPane>} */ | 397 /** @type {!Set<!UI.GlassPane>} */ |
| 398 UI.GlassPane._panes = new Set(); | 398 UI.GlassPane._panes = new Set(); |
| OLD | NEW |