Chromium Code Reviews| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 return; | 152 return; |
| 153 this._onClickOutsideCallback.call(null, event); | 153 this._onClickOutsideCallback.call(null, event); |
| 154 } | 154 } |
| 155 | 155 |
| 156 _positionContent() { | 156 _positionContent() { |
| 157 if (!this.isShowing()) | 157 if (!this.isShowing()) |
| 158 return; | 158 return; |
| 159 | 159 |
| 160 var showArrow = this._marginBehavior === UI.GlassPane.MarginBehavior.Arrow; | 160 var showArrow = this._marginBehavior === UI.GlassPane.MarginBehavior.Arrow; |
| 161 var gutterSize = showArrow ? 8 : (this._marginBehavior === UI.GlassPane.Marg inBehavior.NoMargin ? 0 : 3); | 161 var gutterSize = showArrow ? 8 : (this._marginBehavior === UI.GlassPane.Marg inBehavior.NoMargin ? 0 : 3); |
| 162 var scrollbarSize = 14; | 162 var scrollbarSize = 15; |
|
luoe
2017/07/18 20:49:08
Measured on Linux, manually tested on Mac and Wind
| |
| 163 var arrowSize = 10; | 163 var arrowSize = 10; |
| 164 | 164 |
| 165 var container = UI.GlassPane._containers.get(/** @type {!Document} */ (this. element.ownerDocument)); | 165 var container = UI.GlassPane._containers.get(/** @type {!Document} */ (this. element.ownerDocument)); |
| 166 if (this._sizeBehavior === UI.GlassPane.SizeBehavior.MeasureContent) { | 166 if (this._sizeBehavior === UI.GlassPane.SizeBehavior.MeasureContent) { |
| 167 this.contentElement.positionAt(0, 0); | 167 this.contentElement.positionAt(0, 0); |
| 168 this.contentElement.style.width = ''; | 168 this.contentElement.style.width = ''; |
| 169 this.contentElement.style.maxWidth = ''; | 169 this.contentElement.style.maxWidth = ''; |
| 170 this.contentElement.style.height = ''; | 170 this.contentElement.style.height = ''; |
| 171 this.contentElement.style.maxHeight = ''; | 171 this.contentElement.style.maxHeight = ''; |
| 172 } | 172 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 UI.GlassPane.MarginBehavior = { | 386 UI.GlassPane.MarginBehavior = { |
| 387 Arrow: Symbol('Arrow'), | 387 Arrow: Symbol('Arrow'), |
| 388 DefaultMargin: Symbol('DefaultMargin'), | 388 DefaultMargin: Symbol('DefaultMargin'), |
| 389 NoMargin: Symbol('NoMargin') | 389 NoMargin: Symbol('NoMargin') |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 /** @type {!Map<!Document, !Element>} */ | 392 /** @type {!Map<!Document, !Element>} */ |
| 393 UI.GlassPane._containers = new Map(); | 393 UI.GlassPane._containers = new Map(); |
| 394 /** @type {!Set<!UI.GlassPane>} */ | 394 /** @type {!Set<!UI.GlassPane>} */ |
| 395 UI.GlassPane._panes = new Set(); | 395 UI.GlassPane._panes = new Set(); |
| OLD | NEW |