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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/list.js

Issue 6034005: DOMUI: Implement the new-style Autofill options page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 10 years 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
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

Powered by Google App Engine
This is Rietveld 408576698