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

Unified Diff: ui/webui/resources/js/cr/ui/menu_button.js

Issue 1088023003: Web content context menu shows over chrome://bookmarks menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/menu_button.js
diff --git a/ui/webui/resources/js/cr/ui/menu_button.js b/ui/webui/resources/js/cr/ui/menu_button.js
index e240a3221511e4e1889b3ff2abf1225ca3ef9fae..3f084b5f75375a6059bab84a6d59eb48c7c4c92c 100644
--- a/ui/webui/resources/js/cr/ui/menu_button.js
+++ b/ui/webui/resources/js/cr/ui/menu_button.js
@@ -154,6 +154,14 @@ cr.define('cr.ui', function() {
case 'resize':
this.hideMenu();
break;
+ case 'contextmenu':
+ if ((!this.menu || !this.menu.contains(e.target)) &&
+ (!this.hideTimestamp_ || Date.now() - this.hideTimestamp_ > 50))
+ this.showMenu(true);
+ e.preventDefault();
+ // Don't allow elements further up in the DOM to show their menus.
+ e.stopPropagation();
+ break;
}
},
@@ -186,6 +194,7 @@ cr.define('cr.ui', function() {
this.showingEvents_.add(doc, 'scroll', this, true);
this.showingEvents_.add(win, 'popstate', this);
this.showingEvents_.add(win, 'resize', this);
+ this.showingEvents_.add(this.menu, 'contextmenu', this);
this.showingEvents_.add(this.menu, 'activate', this);
this.positionMenu_();
@@ -212,6 +221,11 @@ cr.define('cr.ui', function() {
this.showingEvents_.removeAll();
this.focus();
+
+ // On windows we might hide the menu in a right mouse button up and if
+ // that is the case we wait some short period before we allow the menu
+ // to be shown again.
+ this.hideTimestamp_ = cr.isWindows ? Date.now() : 0;
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698