Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js

Issue 2834053004: DevTools: Fix timeline overview flickering (Closed)
Patch Set: addressing comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
11 this._arrowElement = UI.Icon.create('', 'arrow hidden'); 11 this._arrowElement = UI.Icon.create('', 'arrow hidden');
12 this.element.shadowRoot.appendChild(this._arrowElement); 12 this.element.shadowRoot.appendChild(this._arrowElement);
13 13
14 this.registerRequiredCSS('ui/glassPane.css'); 14 this.registerRequiredCSS('ui/glassPane.css');
15 this.element.classList.add('no-pointer-events'); 15 this.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior.PierceGlass Pane);
16
16 this._onMouseDownBound = this._onMouseDown.bind(this); 17 this._onMouseDownBound = this._onMouseDown.bind(this);
17 /** @type {?function(!Event)} */ 18 /** @type {?function(!Event)} */
18 this._onClickOutsideCallback = null; 19 this._onClickOutsideCallback = null;
19 /** @type {?UI.Size} */ 20 /** @type {?UI.Size} */
20 this._maxSize = null; 21 this._maxSize = null;
21 /** @type {?number} */ 22 /** @type {?number} */
22 this._positionX = null; 23 this._positionX = null;
23 /** @type {?number} */ 24 /** @type {?number} */
24 this._positionY = null; 25 this._positionY = null;
25 /** @type {?AnchorBox} */ 26 /** @type {?AnchorBox} */
(...skipping 18 matching lines...) Expand all
44 } 45 }
45 46
46 /** 47 /**
47 * @param {boolean} dimmed 48 * @param {boolean} dimmed
48 */ 49 */
49 setDimmed(dimmed) { 50 setDimmed(dimmed) {
50 this.element.classList.toggle('dimmed-pane', dimmed); 51 this.element.classList.toggle('dimmed-pane', dimmed);
51 } 52 }
52 53
53 /** 54 /**
54 * @param {boolean} blockPointerEvents 55 * @param {!UI.GlassPane.PointerEventsBehavior} pointerEventsBehavior
55 */ 56 */
56 setBlockPointerEvents(blockPointerEvents) { 57 setPointerEventsBehavior(pointerEventsBehavior) {
57 this.element.classList.toggle('no-pointer-events', !blockPointerEvents); 58 this.element.classList.toggle(
59 'no-pointer-events', pointerEventsBehavior !== UI.GlassPane.PointerEvent sBehavior.BlockedByGlassPane);
60 this.contentElement.classList.toggle(
61 'no-pointer-events', pointerEventsBehavior === UI.GlassPane.PointerEvent sBehavior.PierceContents);
58 } 62 }
59 63
60 /** 64 /**
61 * @param {?function(!Event)} callback 65 * @param {?function(!Event)} callback
62 */ 66 */
63 setSetOutsideClickCallback(callback) { 67 setSetOutsideClickCallback(callback) {
64 this._onClickOutsideCallback = callback; 68 this._onClickOutsideCallback = callback;
65 } 69 }
66 70
67 /** 71 /**
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * @param {!Element} element 361 * @param {!Element} element
358 */ 362 */
359 static containerMoved(element) { 363 static containerMoved(element) {
360 for (var pane of UI.GlassPane._panes) { 364 for (var pane of UI.GlassPane._panes) {
361 if (pane.isShowing() && pane.element.ownerDocument === element.ownerDocume nt) 365 if (pane.isShowing() && pane.element.ownerDocument === element.ownerDocume nt)
362 pane._positionContent(); 366 pane._positionContent();
363 } 367 }
364 } 368 }
365 }; 369 };
366 370
367 /** 371 /** @enum {symbol} */
368 * @enum {symbol} 372 UI.GlassPane.PointerEventsBehavior = {
369 */ 373 BlockedByGlassPane: Symbol('BlockedByGlassPane'),
374 PierceGlassPane: Symbol('PierceGlassPane'),
375 PierceContents: Symbol('PierceContents')
376 };
377
378 /** @enum {symbol} */
370 UI.GlassPane.AnchorBehavior = { 379 UI.GlassPane.AnchorBehavior = {
371 PreferTop: Symbol('PreferTop'), 380 PreferTop: Symbol('PreferTop'),
372 PreferBottom: Symbol('PreferBottom'), 381 PreferBottom: Symbol('PreferBottom'),
373 PreferLeft: Symbol('PreferLeft'), 382 PreferLeft: Symbol('PreferLeft'),
374 PreferRight: Symbol('PreferRight'), 383 PreferRight: Symbol('PreferRight'),
375 }; 384 };
376 385
377 /** 386 /** @enum {symbol} */
378 * @enum {symbol}
379 */
380 UI.GlassPane.SizeBehavior = { 387 UI.GlassPane.SizeBehavior = {
381 SetExactSize: Symbol('SetExactSize'), 388 SetExactSize: Symbol('SetExactSize'),
382 SetExactWidthMaxHeight: Symbol('SetExactWidthMaxHeight'), 389 SetExactWidthMaxHeight: Symbol('SetExactWidthMaxHeight'),
383 MeasureContent: Symbol('MeasureContent') 390 MeasureContent: Symbol('MeasureContent')
384 }; 391 };
385 392
386 /** 393 /** @enum {symbol} */
387 * @enum {symbol}
388 */
389 UI.GlassPane.MarginBehavior = { 394 UI.GlassPane.MarginBehavior = {
390 Arrow: Symbol('Arrow'), 395 Arrow: Symbol('Arrow'),
391 DefaultMargin: Symbol('DefaultMargin'), 396 DefaultMargin: Symbol('DefaultMargin'),
392 NoMargin: Symbol('NoMargin') 397 NoMargin: Symbol('NoMargin')
393 }; 398 };
394 399
395 /** @type {!Map<!Document, !Element>} */ 400 /** @type {!Map<!Document, !Element>} */
396 UI.GlassPane._containers = new Map(); 401 UI.GlassPane._containers = new Map();
397 /** @type {!Set<!UI.GlassPane>} */ 402 /** @type {!Set<!UI.GlassPane>} */
398 UI.GlassPane._panes = new Set(); 403 UI.GlassPane._panes = new Set();
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/Dialog.js ('k') | third_party/WebKit/Source/devtools/front_end/ui/Popover.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698