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

Side by Side Diff: ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.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/.clang-format ('k') | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Polymer({ 5 Polymer({
6 is: 'cr-action-menu', 6 is: 'cr-action-menu',
7 extends: 'dialog', 7 extends: 'dialog',
8 8
9 /** 9 /**
10 * List of all options in this action menu. 10 * List of all options in this action menu.
(...skipping 23 matching lines...) Expand all
34 'keydown': 'onKeyDown_', 34 'keydown': 'onKeyDown_',
35 'tap': 'onTap_', 35 'tap': 'onTap_',
36 }, 36 },
37 37
38 /** override */ 38 /** override */
39 attached: function() { 39 attached: function() {
40 this.options_ = this.querySelectorAll('.dropdown-item'); 40 this.options_ = this.querySelectorAll('.dropdown-item');
41 }, 41 },
42 42
43 /** override */ 43 /** override */
44 detached: function() { this.removeResizeListener_(); }, 44 detached: function() {
45 this.removeResizeListener_();
46 },
45 47
46 /** @private */ 48 /** @private */
47 removeResizeListener_: function() { 49 removeResizeListener_: function() {
48 window.removeEventListener('resize', this.onWindowResize_); 50 window.removeEventListener('resize', this.onWindowResize_);
49 }, 51 },
50 52
51 /** 53 /**
52 * @param {!Event} e 54 * @param {!Event} e
53 * @private 55 * @private
54 */ 56 */
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Attempt to show the menu starting from the top of the rectangle and 144 // Attempt to show the menu starting from the top of the rectangle and
143 // extending downwards. If that does not fit within the window, fallback to 145 // extending downwards. If that does not fit within the window, fallback to
144 // starting from the bottom and extending upwards. 146 // starting from the bottom and extending upwards.
145 var top = rect.top + this.offsetHeight <= window.innerHeight ? rect.top : 147 var top = rect.top + this.offsetHeight <= window.innerHeight ? rect.top :
146 rect.bottom - 148 rect.bottom -
147 this.offsetHeight - Math.max(rect.bottom - window.innerHeight, 0); 149 this.offsetHeight - Math.max(rect.bottom - window.innerHeight, 0);
148 150
149 this.style.top = top + 'px'; 151 this.style.top = top + 'px';
150 }, 152 },
151 }); 153 });
OLDNEW
« no previous file with comments | « ui/webui/resources/.clang-format ('k') | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698