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

Unified Diff: ui/file_manager/gallery/js/ribbon.js

Issue 719273004: Add type annotations to gallery/js/ribbon.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a space. Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/ribbon.js
diff --git a/ui/file_manager/gallery/js/ribbon.js b/ui/file_manager/gallery/js/ribbon.js
index acbc4f97f99e9f3c68d139cab310ae669900e20b..6d6e3a066023e025a1cca4b4a5f5fc24082bec1b 100644
--- a/ui/file_manager/gallery/js/ribbon.js
+++ b/ui/file_manager/gallery/js/ribbon.js
@@ -5,14 +5,17 @@
/**
* Scrollable thumbnail ribbon at the bottom of the Gallery in the Slide mode.
*
- * @param {Document} document Document.
- * @param {cr.ui.ArrayDataModel} dataModel Data model.
- * @param {cr.ui.ListSelectionModel} selectionModel Selection model.
- * @return {Element} Ribbon element.
+ * @param {!Document} document Document.
+ * @param {!cr.ui.ArrayDataModel} dataModel Data model.
+ * @param {!cr.ui.ListSelectionModel} selectionModel Selection model.
+ * @return {!HTMLElement} Ribbon element.
+ * @extends {HTMLElement}
* @constructor
+ * @suppress {checkStructDictInheritance}
+ * @struct
*/
function Ribbon(document, dataModel, selectionModel) {
- var self = document.createElement('div');
+ var self = assertInstanceof(document.createElement('div'), HTMLElement);
Ribbon.decorate(self, dataModel, selectionModel);
return self;
}
@@ -25,21 +28,44 @@ Ribbon.prototype.__proto__ = HTMLDivElement.prototype;
/**
* Decorate a Ribbon instance.
*
- * @param {Ribbon} self Self pointer.
- * @param {cr.ui.ArrayDataModel} dataModel Data model.
- * @param {cr.ui.ListSelectionModel} selectionModel Selection model.
+ * @param {!HTMLElement} self Self pointer.
+ * @param {!cr.ui.ArrayDataModel} dataModel Data model.
+ * @param {!cr.ui.ListSelectionModel} selectionModel Selection model.
*/
Ribbon.decorate = function(self, dataModel, selectionModel) {
self.__proto__ = Ribbon.prototype;
+ self = /** @type {!Ribbon} */ (self);
self.dataModel_ = dataModel;
self.selectionModel_ = selectionModel;
+ /** @type {!Object} */
+ self.renderCache_ = {};
+
+ /** @type {number} */
+ self.firstVisibleIndex_ = 0;
+
+ /** @type {number} */
+ self.lastVisibleIndex_ = -1;
+
+ /** @type {?function(!Event)} */
+ self.onContentBound_ = null;
+
+ /** @type {?function(!Event)} */
+ self.onSpliceBound_ = null;
+
+ /** @type {?function(!Event)} */
+ self.onSelectionBound_ = null;
+
+ /** @type {?number} */
+ self.removeTimeout_ = null;
+
self.className = 'ribbon';
};
/**
* Max number of thumbnails in the ribbon.
* @type {number}
+ * @const
*/
Ribbon.ITEMS_COUNT = 5;
@@ -90,7 +116,7 @@ Ribbon.prototype.disable = function() {
/**
* Data model splice handler.
- * @param {Event} event Event.
+ * @param {!Event} event Event.
* @private
*/
Ribbon.prototype.onSplice_ = function(event) {
@@ -298,7 +324,7 @@ Ribbon.prototype.removeVanishing_ = function() {
* Create a DOM element for a thumbnail.
*
* @param {number} index Item index.
- * @return {Element} Newly created element.
+ * @return {!Element} Newly created element.
* @private
*/
Ribbon.prototype.renderThumbnail_ = function(index) {
@@ -335,8 +361,8 @@ Ribbon.prototype.renderThumbnail_ = function(index) {
/**
* Set the thumbnail image.
*
- * @param {Element} thumbnail Thumbnail element.
- * @param {Gallery.Item} item Gallery item.
+ * @param {!Element} thumbnail Thumbnail element.
+ * @param {!Gallery.Item} item Gallery item.
* @private
*/
Ribbon.prototype.setThumbnailImage_ = function(thumbnail, item) {
@@ -353,7 +379,7 @@ Ribbon.prototype.setThumbnailImage_ = function(thumbnail, item) {
/**
* Content change handler.
*
- * @param {Event} event Event.
+ * @param {!Event} event Event.
* @private
*/
Ribbon.prototype.onContentChange_ = function(event) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698