| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 this.element.ownerDocument.body.removeEventListener('click', this._onMouseDo
wnBound, true); | 136 this.element.ownerDocument.body.removeEventListener('click', this._onMouseDo
wnBound, 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 if (this.contentElement.isSelfOrAncestor(/** @type {?Node} */ (event.deepEle
mentFromPoint()))) | 146 var node = event.deepElementFromPoint(); |
| 147 if (!node || this.contentElement.isSelfOrAncestor(node)) |
| 147 return; | 148 return; |
| 148 this._onClickOutsideCallback.call(null, event); | 149 this._onClickOutsideCallback.call(null, event); |
| 149 } | 150 } |
| 150 | 151 |
| 151 _positionContent() { | 152 _positionContent() { |
| 152 if (!this.isShowing()) | 153 if (!this.isShowing()) |
| 153 return; | 154 return; |
| 154 | 155 |
| 155 var showArrow = this._marginBehavior === UI.GlassPane.MarginBehavior.Arrow; | 156 var showArrow = this._marginBehavior === UI.GlassPane.MarginBehavior.Arrow; |
| 156 var gutterSize = showArrow ? 8 : (this._marginBehavior === UI.GlassPane.Marg
inBehavior.NoMargin ? 0 : 3); | 157 var gutterSize = showArrow ? 8 : (this._marginBehavior === UI.GlassPane.Marg
inBehavior.NoMargin ? 0 : 3); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 UI.GlassPane.MarginBehavior = { | 389 UI.GlassPane.MarginBehavior = { |
| 389 Arrow: Symbol('Arrow'), | 390 Arrow: Symbol('Arrow'), |
| 390 DefaultMargin: Symbol('DefaultMargin'), | 391 DefaultMargin: Symbol('DefaultMargin'), |
| 391 NoMargin: Symbol('NoMargin') | 392 NoMargin: Symbol('NoMargin') |
| 392 }; | 393 }; |
| 393 | 394 |
| 394 /** @type {!Map<!Document, !Element>} */ | 395 /** @type {!Map<!Document, !Element>} */ |
| 395 UI.GlassPane._containers = new Map(); | 396 UI.GlassPane._containers = new Map(); |
| 396 /** @type {!Set<!UI.GlassPane>} */ | 397 /** @type {!Set<!UI.GlassPane>} */ |
| 397 UI.GlassPane._panes = new Set(); | 398 UI.GlassPane._panes = new Set(); |
| OLD | NEW |