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; |