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}; |