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

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

Issue 2801373002: [DevTools] Listen to mousedown in SoftContextMenu once (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
index aa43be97ea93d6c8c5b6f32b69a9de822752b784..4ba29b98c7f21a9e53a48e3a788b8d5a21457d5f 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
@@ -50,10 +50,6 @@ UI.SoftContextMenu = class {
this._glassPane = new UI.GlassPane();
this._glassPane.setBlockPointerEvents(!this._parentMenu);
- this._glassPane.setSetOutsideClickCallback(event => {
lushnikov 2017/04/07 22:25:40 can we fix the setSetOutsideClickCallback name?
dgozman 2017/04/07 22:30:32 Yeah, in a separate patch?
- this._discardMenu(true, event);
- event.consume();
lushnikov 2017/04/07 22:25:40 why does the bug happen in the first place? As far
dgozman 2017/04/07 22:30:32 This is because we have two nested menus, and clic
- });
this._glassPane.registerRequiredCSS('ui/softContextMenu.css');
this._glassPane.setContentAnchorBox(anchorBox);
this._glassPane.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent);
@@ -71,6 +67,11 @@ UI.SoftContextMenu = class {
this._glassPane.show(document);
this._focus();
+
+ if (!this._parentMenu) {
+ this._onBodyMouseDown = event => this._discardMenu(true, event);
+ this._document.body.addEventListener('mousedown', this._onBodyMouseDown, false);
+ }
}
discard() {
@@ -330,6 +331,10 @@ UI.SoftContextMenu = class {
if (this._glassPane) {
this._glassPane.hide();
delete this._glassPane;
+ if (this._onBodyMouseDown) {
+ this._document.body.removeEventListener('mousedown', this._onBodyMouseDown, false);
+ delete this._onBodyMouseDown;
+ }
}
if (this._parentMenu)
delete this._parentMenu._subMenu;
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698