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

Side by Side Diff: ui/webui/resources/js/cr/ui/menu.js

Issue 454223004: Typecheck JS files for chrome://history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@B_download
Patch Set: right rebase, switched to gyp Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('cr.ui', function() { 5 cr.define('cr.ui', function() {
6 6
7 /** @const */ var MenuItem = cr.ui.MenuItem; 7 /** @const */ var MenuItem = cr.ui.MenuItem;
8 8
9 /** 9 /**
10 * Creates a new menu element. Menu dispatches all commands on the element it 10 * Creates a new menu element. Menu dispatches all commands on the element it
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 /** 81 /**
82 * Clears menu. 82 * Clears menu.
83 */ 83 */
84 clear: function() { 84 clear: function() {
85 this.textContent = ''; 85 this.textContent = '';
86 }, 86 },
87 87
88 /** 88 /**
89 * Walks up the ancestors of |el| until a menu item belonging to this menu 89 * Walks up the ancestors of |el| until a menu item belonging to this menu
90 * is found. 90 * is found.
91 * @param {Element} el The element to start searching from. 91 * @param {Node} el The element to start searching from.
Dan Beam 2014/08/19 00:31:53 s/el/node
Vitaly Pavlenko 2014/08/19 18:30:27 Done.
92 * @return {cr.ui.MenuItem} The found menu item or null. 92 * @return {cr.ui.MenuItem} The found menu item or null.
93 * @private 93 * @private
94 */ 94 */
95 findMenuItem_: function(el) { 95 findMenuItem_: function(el) {
96 while (el && el.parentNode != this) { 96 while (el && el.parentNode != this) {
97 el = el.parentNode; 97 el = el.parentNode;
98 } 98 }
99 return assertInstanceof(el, MenuItem); 99 return assertInstanceof(el, MenuItem);
100 }, 100 },
101 101
102 /** 102 /**
103 * Handles mouseover events and selects the hovered item. 103 * Handles mouseover events and selects the hovered item.
104 * @param {Event} e The mouseover event. 104 * @param {Event} e The mouseover event.
105 * @private 105 * @private
106 */ 106 */
107 handleMouseOver_: function(e) { 107 handleMouseOver_: function(e) {
108 var overItem = this.findMenuItem_(e.target); 108 var overItem = this.findMenuItem_(/** @type {Element} */(e.target));
109 this.selectedItem = overItem; 109 this.selectedItem = overItem;
110 }, 110 },
111 111
112 /** 112 /**
113 * Handles mouseout events and deselects any selected item. 113 * Handles mouseout events and deselects any selected item.
114 * @param {Event} e The mouseout event. 114 * @param {Event} e The mouseout event.
115 * @private 115 * @private
116 */ 116 */
117 handleMouseOut_: function(e) { 117 handleMouseOut_: function(e) {
118 this.selectedItem = null; 118 this.selectedItem = null;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 oldSelectedItem.selected = false; 260 oldSelectedItem.selected = false;
261 oldSelectedItem.blur(); 261 oldSelectedItem.blur();
262 } 262 }
263 var item = this.selectedItem; 263 var item = this.selectedItem;
264 if (item) 264 if (item)
265 item.selected = true; 265 item.selected = true;
266 } 266 }
267 267
268 /** 268 /**
269 * The selected menu item. 269 * The selected menu item.
270 * @type {number} 270 * type {number}
Dan Beam 2014/08/19 00:31:53 make a real jsdoc param or remove
Vitaly Pavlenko 2014/08/19 18:30:27 Not done. We still have no type checking for Objec
271 */ 271 */
272 cr.defineProperty(Menu, 'selectedIndex', cr.PropertyKind.JS, 272 cr.defineProperty(Menu, 'selectedIndex', cr.PropertyKind.JS,
273 selectedIndexChanged); 273 selectedIndexChanged);
274 274
275 // Export 275 // Export
276 return { 276 return {
277 Menu: Menu 277 Menu: Menu
278 }; 278 };
279 }); 279 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698