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

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

Issue 2706293007: [DevTools] Fix Dialog's close button to properly close dialog. (Closed)
Patch Set: test Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
index 58ef0d0ee7fbd8fe72f1b5e6251dab0de0494750..64c589b9e1aa167e323b4283f05bc726cc2322dc 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-UI.GlassPane = class extends UI.Widget {
+UI.GlassPane = class {
constructor() {
- super(true);
- this.markAsRoot();
+ this._widget = new UI.Widget(true);
+ this._widget.markAsRoot();
+ this.element = this._widget.element;
+ this.contentElement = this._widget.contentElement;
+
this.registerRequiredCSS('ui/glassPane.css');
this.element.classList.add('no-pointer-events');
this._onMouseDownBound = this._onMouseDown.bind(this);
@@ -24,6 +27,20 @@ UI.GlassPane = class extends UI.Widget {
}
/**
+ * @return {boolean}
+ */
+ isShowing() {
+ return this._widget.isShowing();
+ }
+
+ /**
+ * @param {string} cssFile
+ */
+ registerRequiredCSS(cssFile) {
+ this._widget.registerRequiredCSS(cssFile);
+ }
+
+ /**
* @param {boolean} dimmed
*/
setDimmed(dimmed) {
@@ -90,23 +107,23 @@ UI.GlassPane = class extends UI.Widget {
/**
* @param {!Document} document
*/
- showGlassPane(document) {
+ show(document) {
if (this.isShowing())
return;
// Deliberately starts with 3000 to hide other z-indexed elements below.
this.element.style.zIndex = 3000 + 1000 * UI.GlassPane._panes.size;
document.body.addEventListener('mousedown', this._onMouseDownBound, true);
- this.show(document.body);
+ this._widget.show(document.body);
UI.GlassPane._panes.add(this);
this._positionContent();
}
- hideGlassPane() {
+ hide() {
if (!this.isShowing())
return;
UI.GlassPane._panes.delete(this);
this.element.ownerDocument.body.removeEventListener('mousedown', this._onMouseDownBound, true);
- this.detach();
+ this._widget.detach();
}
/**
@@ -203,6 +220,15 @@ UI.GlassPane = class extends UI.Widget {
else
this.contentElement.style.height = height + 'px';
this.contentElement.positionAt(positionX, positionY, container);
+ this._widget.doResize();
+ }
+
+ /**
+ * @protected
+ * @return {!UI.Widget}
+ */
+ widget() {
+ return this._widget;
}
/**
@@ -226,10 +252,8 @@ UI.GlassPane = class extends UI.Widget {
*/
static containerMoved(element) {
for (var pane of UI.GlassPane._panes) {
- if (pane.isShowing() && pane.element.ownerDocument === element.ownerDocument) {
+ if (pane.isShowing() && pane.element.ownerDocument === element.ownerDocument)
pane._positionContent();
- pane.doResize();
- }
}
}
};

Powered by Google App Engine
This is Rietveld 408576698