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

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

Issue 2702523003: [DevTools] Continue GlassPane refactoring. (Closed)
Patch Set: element 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/SuggestBox.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
index e74c80710adfb7cf502478f9f90f633950a7959c..73d29087fa0349f87c8fa1f4097187f9ddb8d650 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
@@ -53,7 +53,6 @@ UI.SuggestBox = class {
* @param {!UI.SuggestBoxDelegate} suggestBoxDelegate
* @param {number=} maxItemsHeight
* @param {boolean=} captureEnter
- * @suppressGlobalPropertiesCheck
*/
constructor(suggestBoxDelegate, maxItemsHeight, captureEnter) {
this._suggestBoxDelegate = suggestBoxDelegate;
@@ -71,10 +70,9 @@ UI.SuggestBox = class {
this._element.classList.add('suggest-box');
this._element.addEventListener('mousedown', event => event.preventDefault(), true);
- // TODO(dgozman): take document in constructor.
- this._glassPane =
- new UI.GlassPane(document, false /* dimmed */, false /* blockPointerEvents */, this.hide.bind(this));
+ this._glassPane = new UI.GlassPane();
this._glassPane.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom);
+ this._glassPane.setSetOutsideClickCallback(this.hide.bind(this));
var shadowRoot = UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'ui/suggestBox.css');
shadowRoot.appendChild(this._element);
}
@@ -83,7 +81,7 @@ UI.SuggestBox = class {
* @return {boolean}
*/
visible() {
- return this._glassPane.visible();
+ return this._glassPane.isShowing();
}
/**
@@ -124,10 +122,14 @@ UI.SuggestBox = class {
return Math.min(kMaxWidth, UI.measurePreferredSize(element, this._element).width);
}
+ /**
+ * @suppressGlobalPropertiesCheck
+ */
_show() {
if (this.visible())
return;
- this._glassPane.show();
+ // TODO(dgozman): take document as a parameter.
+ this._glassPane.showGlassPane(document);
this._rowHeight =
UI.measurePreferredSize(this.createElementForItem({text: '1', subtitle: '12'}), this._element).height;
}
@@ -136,7 +138,7 @@ UI.SuggestBox = class {
if (!this.visible())
return;
this._userInteracted = false;
- this._glassPane.hide();
+ this._glassPane.hideGlassPane();
}
/**

Powered by Google App Engine
This is Rietveld 408576698