Commit 1d1405a2 authored by hcarmona's avatar hcarmona Committed by Commit bot

Fix Closure Compilation for chrome://downloads and chrome://history

Changes in https://codereview.chromium.org/807593005/ broke Closure Compilation.

BUG=427670, 452870

Review URL: https://codereview.chromium.org/895283002

Cr-Commit-Position: refs/heads/master@{#314718}
parent b4bc7328
...@@ -8,10 +8,14 @@ ...@@ -8,10 +8,14 @@
'variables': { 'variables': {
'depends': [ 'depends': [
'../../../../ui/webui/resources/js/action_link.js', '../../../../ui/webui/resources/js/action_link.js',
'../../../../ui/webui/resources/js/assert.js',
'../../../../ui/webui/resources/js/compiled_resources.gyp:load_time_data',
'../../../../ui/webui/resources/js/cr.js', '../../../../ui/webui/resources/js/cr.js',
'../../../../ui/webui/resources/js/cr/ui.js', '../../../../ui/webui/resources/js/cr/ui.js',
'../../../../ui/webui/resources/js/cr/ui/command.js', '../../../../ui/webui/resources/js/cr/ui/command.js',
'../../../../ui/webui/resources/js/compiled_resources.gyp:load_time_data', '../../../../ui/webui/resources/js/cr/ui/focus_grid.js',
'../../../../ui/webui/resources/js/cr/ui/focus_row.js',
'../../../../ui/webui/resources/js/event_tracker.js',
'../../../../ui/webui/resources/js/util.js', '../../../../ui/webui/resources/js/util.js',
], ],
'externs': ['<(CLOSURE_DIR)/externs/chrome_send_externs.js'], 'externs': ['<(CLOSURE_DIR)/externs/chrome_send_externs.js'],
......
...@@ -156,7 +156,7 @@ DownloadFocusRow.prototype = { ...@@ -156,7 +156,7 @@ DownloadFocusRow.prototype = {
/** /**
* Determines if element should be focusable. * Determines if element should be focusable.
* @param {!Element} element * @param {Element} element
* @return {boolean} * @return {boolean}
* @private * @private
*/ */
......
...@@ -43,6 +43,7 @@ cr.define('cr.ui', function() { ...@@ -43,6 +43,7 @@ cr.define('cr.ui', function() {
* Row delegate to overwrite the behavior of a mouse click to deselect any row * Row delegate to overwrite the behavior of a mouse click to deselect any row
* that wasn't clicked. * that wasn't clicked.
* @param {cr.ui.FocusGrid} focusGrid * @param {cr.ui.FocusGrid} focusGrid
* @constructor
* @implements {cr.ui.FocusRow.Delegate} * @implements {cr.ui.FocusRow.Delegate}
*/ */
FocusGrid.RowDelegate = function(focusGrid) { FocusGrid.RowDelegate = function(focusGrid) {
...@@ -61,8 +62,9 @@ cr.define('cr.ui', function() { ...@@ -61,8 +62,9 @@ cr.define('cr.ui', function() {
return false; return false;
// Only the clicked row should be active. // Only the clicked row should be active.
var target = assertInstanceof(e.target, Node);
this.focusGrid_.rows.forEach(function(row) { this.focusGrid_.rows.forEach(function(row) {
row.makeRowActive(row.contains(e.target)); row.makeRowActive(row.contains(target));
}); });
e.preventDefault(); e.preventDefault();
...@@ -80,7 +82,7 @@ cr.define('cr.ui', function() { ...@@ -80,7 +82,7 @@ cr.define('cr.ui', function() {
}, },
/** /**
* @param {EventTarget} target A target item to find in this grid. * @param {Node} target A target item to find in this grid.
* @return {number} The row index. -1 if not found. * @return {number} The row index. -1 if not found.
*/ */
getRowIndexForTarget: function(target) { getRowIndexForTarget: function(target) {
...@@ -97,7 +99,8 @@ cr.define('cr.ui', function() { ...@@ -97,7 +99,8 @@ cr.define('cr.ui', function() {
* @private * @private
*/ */
onKeydown_: function(e) { onKeydown_: function(e) {
var rowIndex = this.getRowIndexForTarget(e.target); var target = assertInstanceof(e.target, Node);
var rowIndex = this.getRowIndexForTarget(target);
if (rowIndex == -1) if (rowIndex == -1)
return; return;
...@@ -122,7 +125,7 @@ cr.define('cr.ui', function() { ...@@ -122,7 +125,7 @@ cr.define('cr.ui', function() {
/** /**
* Keep track of the last column that the user manually focused. * Keep track of the last column that the user manually focused.
* @param {Event} The focusin event. * @param {Event} e The focusin event.
* @private * @private
*/ */
onFocusin_: function(e) { onFocusin_: function(e) {
...@@ -131,8 +134,9 @@ cr.define('cr.ui', function() { ...@@ -131,8 +134,9 @@ cr.define('cr.ui', function() {
return; return;
} }
if (this.getRowIndexForTarget(e.target) != -1) var target = assertInstanceof(e.target, Node);
this.lastFocused = e.target; if (this.getRowIndexForTarget(target) != -1)
this.lastFocused = target;
}, },
/** /**
......
...@@ -29,6 +29,7 @@ cr.define('cr.ui', function() { ...@@ -29,6 +29,7 @@ cr.define('cr.ui', function() {
* any focus change deactivates the row. * any focus change deactivates the row.
* *
* @constructor * @constructor
* @extends {HTMLDivElement}
*/ */
function FocusRow() {} function FocusRow() {}
...@@ -59,7 +60,8 @@ cr.define('cr.ui', function() { ...@@ -59,7 +60,8 @@ cr.define('cr.ui', function() {
/** /**
* Should be called in the constructor to decorate |this|. * Should be called in the constructor to decorate |this|.
* @param {Node} boundary Focus events are ignored outside of this node. * @param {Node} boundary Focus events are ignored outside of this node.
* @param {FocusRow.Delegate=} opt_delegate A delegate to handle key events. * @param {cr.ui.FocusRow.Delegate=} opt_delegate A delegate to handle key
* events.
*/ */
decorate: function(boundary, opt_delegate) { decorate: function(boundary, opt_delegate) {
/** @private {!Node} */ /** @private {!Node} */
...@@ -90,7 +92,7 @@ cr.define('cr.ui', function() { ...@@ -90,7 +92,7 @@ cr.define('cr.ui', function() {
* which previously held focus. * which previously held focus.
* @return {!Element} The element that best matches sampleElement. * @return {!Element} The element that best matches sampleElement.
*/ */
getEquivalentElement: assertNotReached, getEquivalentElement: function(sampleElement) { assertNotReached(); },
/** /**
* Add an element to this FocusRow. No-op if |element| is not provided. * Add an element to this FocusRow. No-op if |element| is not provided.
...@@ -148,8 +150,9 @@ cr.define('cr.ui', function() { ...@@ -148,8 +150,9 @@ cr.define('cr.ui', function() {
* @private * @private
*/ */
onFocusin_: function(e) { onFocusin_: function(e) {
if (this.boundary_.contains(assertInstanceof(e.target, Node))) var target = assertInstanceof(e.target, Element);
this.onFocusChange_(e.target); if (this.boundary_.contains(target))
this.onFocusChange_(target);
}, },
/** /**
...@@ -158,13 +161,14 @@ cr.define('cr.ui', function() { ...@@ -158,13 +161,14 @@ cr.define('cr.ui', function() {
* @private * @private
*/ */
onKeydown_: function(e) { onKeydown_: function(e) {
if (!this.contains(e.target)) var element = assertInstanceof(e.target, Element);
if (!this.contains(element))
return; return;
if (this.delegate && this.delegate.onKeydown(this, e)) if (this.delegate && this.delegate.onKeydown(this, e))
return; return;
var elementIndex = this.focusableElements.indexOf(e.target); var elementIndex = this.focusableElements.indexOf(element);
var index = -1; var index = -1;
if (e.keyIdentifier == 'Left') if (e.keyIdentifier == 'Left')
...@@ -194,7 +198,7 @@ cr.define('cr.ui', function() { ...@@ -194,7 +198,7 @@ cr.define('cr.ui', function() {
// Only accept the left mouse click. // Only accept the left mouse click.
if (!e.button) { if (!e.button) {
// Focus this row if the target is one of the elements in this row. // Focus this row if the target is one of the elements in this row.
this.onFocusChange_(e.target); this.onFocusChange_(assertInstanceof(e.target, Element));
} }
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment