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

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

Issue 2603443002: Clang format JS: Disallow single line functions, conditionals, loops, and switch statements (Closed)
Patch Set: update c/b/r/ as well Created 3 years, 12 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
« no previous file with comments | « ui/webui/resources/js/cr/ui/menu.js ('k') | ui/webui/resources/js/cr/ui/menu_item.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // <include src="../../assert.js"> 5 // <include src="../../assert.js">
6 6
7 cr.exportPath('cr.ui'); 7 cr.exportPath('cr.ui');
8 8
9 /** 9 /**
10 * Enum for type of hide. Delayed is used when called by clicking on a 10 * Enum for type of hide. Delayed is used when called by clicking on a
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 this.showingEvents_ = new EventTracker(); 60 this.showingEvents_ = new EventTracker();
61 61
62 this.anchorType = cr.ui.AnchorType.BELOW; 62 this.anchorType = cr.ui.AnchorType.BELOW;
63 this.invertLeftRight = false; 63 this.invertLeftRight = false;
64 }, 64 },
65 65
66 /** 66 /**
67 * The menu associated with the menu button. 67 * The menu associated with the menu button.
68 * @type {cr.ui.Menu} 68 * @type {cr.ui.Menu}
69 */ 69 */
70 get menu() { return this.menu_; }, 70 get menu() {
71 return this.menu_;
72 },
71 set menu(menu) { 73 set menu(menu) {
72 if (typeof menu == 'string' && menu[0] == '#') { 74 if (typeof menu == 'string' && menu[0] == '#') {
73 menu = assert(this.ownerDocument.getElementById(menu.slice(1))); 75 menu = assert(this.ownerDocument.getElementById(menu.slice(1)));
74 cr.ui.decorate(menu, Menu); 76 cr.ui.decorate(menu, Menu);
75 } 77 }
76 78
77 this.menu_ = menu; 79 this.menu_ = menu;
78 if (menu) { 80 if (menu) {
79 if (menu.id) 81 if (menu.id)
80 this.setAttribute('menu', '#' + menu.id); 82 this.setAttribute('menu', '#' + menu.id);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 235
234 // On windows we might hide the menu in a right mouse button up and if 236 // On windows we might hide the menu in a right mouse button up and if
235 // that is the case we wait some short period before we allow the menu 237 // that is the case we wait some short period before we allow the menu
236 // to be shown again. 238 // to be shown again.
237 this.hideTimestamp_ = cr.isWindows ? Date.now() : 0; 239 this.hideTimestamp_ = cr.isWindows ? Date.now() : 0;
238 }, 240 },
239 241
240 /** 242 /**
241 * Whether the menu is shown. 243 * Whether the menu is shown.
242 */ 244 */
243 isMenuShown: function() { return this.hasAttribute('menu-shown'); }, 245 isMenuShown: function() {
246 return this.hasAttribute('menu-shown');
247 },
244 248
245 /** 249 /**
246 * Positions the menu below the menu button. At this point we do not use any 250 * Positions the menu below the menu button. At this point we do not use any
247 * advanced positioning logic to ensure the menu fits in the viewport. 251 * advanced positioning logic to ensure the menu fits in the viewport.
248 * @private 252 * @private
249 */ 253 */
250 positionMenu_: function() { 254 positionMenu_: function() {
251 positionPopupAroundElement( 255 positionPopupAroundElement(
252 this, this.menu, this.anchorType, this.invertLeftRight); 256 this, this.menu, this.anchorType, this.invertLeftRight);
253 }, 257 },
(...skipping 19 matching lines...) Expand all
273 break; 277 break;
274 } 278 }
275 } 279 }
276 }; 280 };
277 281
278 // Export 282 // Export
279 return { 283 return {
280 MenuButton: MenuButton, 284 MenuButton: MenuButton,
281 }; 285 };
282 }); 286 });
OLDNEW
« no previous file with comments | « ui/webui/resources/js/cr/ui/menu.js ('k') | ui/webui/resources/js/cr/ui/menu_item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698