Index: chrome/browser/resources/shared/js/cr/ui/list.js |
diff --git a/chrome/browser/resources/shared/js/cr/ui/list.js b/chrome/browser/resources/shared/js/cr/ui/list.js |
index 121703a0b9616db58c39f1e80b0f5b4cbdcb04c6..5abc4e2f06cb5fc4961cf9d268e98b32a19d0f47 100644 |
--- a/chrome/browser/resources/shared/js/cr/ui/list.js |
+++ b/chrome/browser/resources/shared/js/cr/ui/list.js |
@@ -269,6 +269,7 @@ cr.define('cr.ui', function() { |
var length = this.dataModel ? this.dataModel.length : 0; |
this.selectionModel = new ListSelectionModel(length); |
+ this.addEventListener('dblclick', this.handleDoubleClick_); |
this.addEventListener('mousedown', this.handleMouseDownUp_); |
this.addEventListener('mouseup', this.handleMouseDownUp_); |
this.addEventListener('keydown', this.handleKeyDown); |
@@ -290,6 +291,28 @@ cr.define('cr.ui', function() { |
}, |
/** |
+ * Callback for the double click event. |
+ * @param {Event} e The mouse event object. |
+ * @private |
+ */ |
+ handleDoubleClick_: function(e) { |
+ if (this.disabled) |
+ return; |
+ |
+ var target = e.target; |
+ |
+ // If the target was this element we need to make sure that the user did |
+ // not click on a border or a scrollbar. |
+ if (target == this && !inViewport(target, e)) |
arv (Not doing code reviews)
2010/12/22 18:14:07
In this case I think you can skip this check since
James Hawkins
2010/12/22 21:22:31
Done.
|
+ return; |
+ |
+ target = this.getListItemAncestor(target); |
+ |
+ var index = target ? this.getIndexOfListItem(target) : -1; |
+ this.activateItemAtIndex(index); |
arv (Not doing code reviews)
2010/12/22 18:14:07
Now the question arise if we should allow Enter (a
James Hawkins
2010/12/22 21:22:31
We should allow Enter to activate the item as well
|
+ }, |
+ |
+ /** |
* Callback for mousedown and mouseup events. |
* @param {Event} e The mouse event object. |
* @private |