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

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

Issue 1128953004: Fix regression where rows could become non-focusable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply feedback Created 5 years, 7 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 | « chrome/browser/resources/extensions/extension_list.js ('k') | 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/focus_grid.js
diff --git a/ui/webui/resources/js/cr/ui/focus_grid.js b/ui/webui/resources/js/cr/ui/focus_grid.js
index ab418899878dc30c8fa661f8c94d39ed8ad7fb07..82c84f2bfe0d8b23f5f38ce9fa27fbf63e8a9508 100644
--- a/ui/webui/resources/js/cr/ui/focus_grid.js
+++ b/ui/webui/resources/js/cr/ui/focus_grid.js
@@ -139,14 +139,37 @@ cr.define('cr.ui', function() {
},
/**
- * Add a FocusRow to this grid. This needs to be called AFTER adding columns
- * to the row. This is so that TAB focus can be properly enabled in the
- * columns.
- * @param {cr.ui.FocusRow} row The row that needs to be added to this grid.
+ * Adds |row| to the end of this list.
+ * @param {!cr.ui.FocusRow} row The row that needs to be added to this grid.
*/
addRow: function(row) {
+ this.addRowBefore(row, null);
+ },
+
+ /**
+ * Adds |row| before |nextRow|. If |nextRow| is not in the list or it's
+ * null, |row| is added to the end.
+ * @param {!cr.ui.FocusRow} row The row that needs to be added to this grid.
+ * @param {cr.ui.FocusRow} nextRow The row that should follow |row|.
+ */
+ addRowBefore: function(row, nextRow) {
row.delegate = row.delegate || this.delegate_;
- this.rows.push(row);
+
+ var nextRowIndex = this.rows.indexOf(nextRow);
+ if (nextRowIndex == -1)
+ this.rows.push(row);
+ else
+ this.rows.splice(nextRowIndex, 0, row);
+ },
+
+ /**
+ * Removes a row from the focus row. No-op if row is not in the grid.
+ * @param {cr.ui.FocusRow} row The row that needs to be removed.
+ */
+ removeRow: function(row) {
+ var nextRowIndex = this.rows.indexOf(row);
+ if (nextRowIndex > -1)
+ this.rows.splice(nextRowIndex, 1);
},
/**
« no previous file with comments | « chrome/browser/resources/extensions/extension_list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698