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

Unified Diff: chrome/browser/resources/md_history/history_item.js

Issue 2409063003: MD History: Select items when tapping anywhere inside the item (Closed)
Patch Set: Remove <a> test Created 4 years, 1 month 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/md_history/history_item.js
diff --git a/chrome/browser/resources/md_history/history_item.js b/chrome/browser/resources/md_history/history_item.js
index f7a1df3dd59f76b341ae5e8c82ae3216c9472a92..14f75068041ba263e5e3b995639c4fc215a74549 100644
--- a/chrome/browser/resources/md_history/history_item.js
+++ b/chrome/browser/resources/md_history/history_item.js
@@ -168,25 +168,34 @@ cr.define('md_history', function() {
},
/**
- * When a history-item is selected the toolbar is notified and increases
- * or decreases its count of selected items accordingly.
+ * Toggle item selection whenever the checkbox or any non-interactive part
+ * of the item is clicked.
* @param {MouseEvent} e
* @private
*/
- onCheckboxSelected_: function(e) {
- // TODO(calamity): Fire this event whenever |selected| changes.
+ onItemClick_: function(e) {
+ for (var i = 0; i < e.path.length; i++) {
+ var elem = e.path[i];
+ if (elem.id != 'checkbox' &&
+ (elem.nodeName == 'A' || elem.nodeName == 'BUTTON')) {
+ return;
+ }
+ }
+
+ if (this.selectionNotAllowed_())
+ return;
+
this.fire('history-checkbox-select', {
element: this,
shiftKey: e.shiftKey,
});
- e.preventDefault();
},
/**
* @param {MouseEvent} e
* @private
*/
- onCheckboxMousedown_: function(e) {
+ onItemMousedown_: function(e) {
// Prevent shift clicking a checkbox from selecting text.
if (e.shiftKey)
e.preventDefault();
« no previous file with comments | « chrome/browser/resources/md_history/history_item.html ('k') | chrome/test/data/webui/md_history/history_item_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698