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

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

Issue 620663004: Revert of All changes to ui/webui/ from bookmarks CL that block other CLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@true_master
Patch Set: Created 6 years, 3 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 | « ui/webui/resources/js/cr/ui/context_menu_button.js ('k') | ui/webui/resources/js/cr/ui/list.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/context_menu_handler.js
diff --git a/ui/webui/resources/js/cr/ui/context_menu_handler.js b/ui/webui/resources/js/cr/ui/context_menu_handler.js
index 1b3a9e207248da0279bcf21c25066f4e9e0fdc03..710856b1528f61f617eb31567ca7d98e811cb506 100644
--- a/ui/webui/resources/js/cr/ui/context_menu_handler.js
+++ b/ui/webui/resources/js/cr/ui/context_menu_handler.js
@@ -11,8 +11,7 @@
/**
* Handles context menus.
* @constructor
- * @extends {cr.EventTarget}
- * @implements {EventListener}
+ * @extends {EventTarget}
*/
function ContextMenuHandler() {
this.showingEvents_ = new EventTracker();
@@ -37,7 +36,6 @@
* @param {!cr.ui.Menu} menu The menu to show.
*/
showMenu: function(e, menu) {
- e.currentTarget = assertInstanceof(e.currentTarget, Node);
menu.updateCommands(e.currentTarget);
if (!menu.hasVisibleItems())
return;
@@ -69,7 +67,7 @@
/**
* Hide the currently shown menu.
- * @param {cr.ui.HideType=} opt_hideType Type of hide.
+ * @param {HideType=} opt_hideType Type of hide.
* default: cr.ui.HideType.INSTANT.
*/
hideMenu: function(opt_hideType) {
@@ -213,17 +211,17 @@
/**
* Adds a contextMenu property to an element or element class.
- * @param {!Element|!Function} elementOrClass The element or class to add
- * the contextMenu property to.
- */
- addContextMenuProperty: function(elementOrClass) {
- var target = typeof elementOrClass == 'function' ?
- elementOrClass.prototype : elementOrClass;
-
- target.__defineGetter__('contextMenu', function() {
+ * @param {!Element|!Function} element The element or class to add the
+ * contextMenu property to.
+ */
+ addContextMenuProperty: function(element) {
+ if (typeof element == 'function')
+ element = element.prototype;
+
+ element.__defineGetter__('contextMenu', function() {
return this.contextMenu_;
});
- target.__defineSetter__('contextMenu', function(menu) {
+ element.__defineSetter__('contextMenu', function(menu) {
var oldContextMenu = this.contextMenu;
if (typeof menu == 'string' && menu[0] == '#') {
@@ -253,12 +251,12 @@
cr.dispatchPropertyChange(this, 'contextMenu', menu, oldContextMenu);
});
- if (!target.getRectForContextMenu) {
+ if (!element.getRectForContextMenu) {
/**
* @return {!ClientRect} The rect to use for positioning the context
* menu when the context menu is not opened using a mouse position.
*/
- target.getRectForContextMenu = function() {
+ element.getRectForContextMenu = function() {
return this.getBoundingClientRect();
};
}
« no previous file with comments | « ui/webui/resources/js/cr/ui/context_menu_button.js ('k') | ui/webui/resources/js/cr/ui/list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698