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

Unified Diff: third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js

Issue 2740803002: [DevTools] Simplify Popover API (Closed)
Patch Set: better Created 3 years, 9 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/inline_editor/SwatchPopoverHelper.js
diff --git a/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js b/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js
index b2c943604e3d4e240a6c1acfc4710d8f4540b050..05b49ec317bf0a8383106c79cde087b87f214aac 100644
--- a/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js
+++ b/third_party/WebKit/Source/devtools/front_end/inline_editor/SwatchPopoverHelper.js
@@ -7,8 +7,11 @@
InlineEditor.SwatchPopoverHelper = class extends Common.Object {
constructor() {
super();
- this._popover = new UI.Popover();
- this._popover.setNoPadding(true);
+ this._popover = new UI.GlassPane();
+ this._popover.registerRequiredCSS('ui/popover.css');
lushnikov 2017/03/10 22:07:14 should we have a helper method createPopover() whi
dgozman 2017/03/11 00:00:44 I'll copy over the css. The rest lines are GlassPa
+ this._popover.setBlockPointerEvents(false);
+ this._popover.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent);
+ this._popover.setShowArrow(true);
this._popover.element.addEventListener('mousedown', e => e.consume(), false);
this._hideProxy = this.hide.bind(this, true);
@@ -61,9 +64,11 @@ InlineEditor.SwatchPopoverHelper = class extends Common.Object {
}
reposition() {
- // Unbind "blur" listener to avoid reenterability: |popover.showView| will hide the popover and trigger it synchronously.
+ // Unbind "blur" listener to avoid reenterability: |popover.show()| will hide the popover and trigger it synchronously.
this._view.contentElement.removeEventListener('focusout', this._boundFocusOut, false);
- this._popover.showView(this._view, this._anchorElement);
+ this._view.show(this._popover.contentElement);
+ this._popover.setContentAnchorBox(this._anchorElement.boxInWindow());
+ this._popover.show(this._anchorElement.ownerDocument);
this._view.contentElement.addEventListener('focusout', this._boundFocusOut, false);
if (!this._focusRestorer)
this._focusRestorer = new UI.WidgetFocusRestorer(this._view);

Powered by Google App Engine
This is Rietveld 408576698