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

Unified Diff: chrome/browser/resources/downloads/focus_row.js

Issue 1018543005: downloads: fix Resume/Pause focus regression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests Created 5 years, 9 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 | « no previous file | chrome/browser/resources/downloads/manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/downloads/focus_row.js
diff --git a/chrome/browser/resources/downloads/focus_row.js b/chrome/browser/resources/downloads/focus_row.js
index 063b8ccfb400cb3fbaf317bb92aafe750a29b40b..088098f6804704573bc6148026197d34001faf3d 100644
--- a/chrome/browser/resources/downloads/focus_row.js
+++ b/chrome/browser/resources/downloads/focus_row.js
@@ -23,6 +23,25 @@ cr.define('downloads', function() {
focusRow.addFocusableElements_();
};
+ /**
+ * Determines if element should be focusable.
+ * @param {Element} element
+ * @return {boolean}
+ */
+ FocusRow.shouldFocus = function(element) {
+ if (!element)
+ return false;
+
+ // Hidden elements are not focusable.
+ var style = window.getComputedStyle(element);
+ if (style.visibility == 'hidden' || style.display == 'none')
+ return false;
+
+ // Verify all ancestors are focusable.
+ return !element.parentElement ||
+ FocusRow.shouldFocus(element.parentElement);
+ };
+
FocusRow.prototype = {
__proto__: cr.ui.FocusRow.prototype,
@@ -56,29 +75,10 @@ cr.define('downloads', function() {
var possiblyFocusableElements = this.querySelectorAll('[column-type]');
for (var i = 0; i < possiblyFocusableElements.length; ++i) {
var possiblyFocusableElement = possiblyFocusableElements[i];
- if (this.shouldFocus_(possiblyFocusableElement))
+ if (FocusRow.shouldFocus(possiblyFocusableElement))
this.addFocusableElement(possiblyFocusableElement);
}
},
-
- /**
- * Determines if element should be focusable.
- * @param {Element} element
- * @return {boolean}
- * @private
- */
- shouldFocus_: function(element) {
- if (!element)
- return false;
-
- // Hidden elements are not focusable.
- var style = window.getComputedStyle(element);
- if (style.visibility == 'hidden' || style.display == 'none')
- return false;
-
- // Verify all ancestors are focusable.
- return !element.parentElement || this.shouldFocus_(element.parentElement);
- },
};
return {FocusRow: FocusRow};
« no previous file with comments | « no previous file | chrome/browser/resources/downloads/manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698