OLD | NEW |
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 /** | 5 /** |
6 * @fileoverview Bubble implementation. | 6 * @fileoverview Bubble implementation. |
7 */ | 7 */ |
8 | 8 |
9 // TODO(xiyuan): Move this into shared. | 9 // TODO(xiyuan): Move this into shared. |
10 cr.define('cr.ui', function() { | 10 cr.define('cr.ui', function() { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 e.stopPropagation(); | 92 e.stopPropagation(); |
93 }, | 93 }, |
94 | 94 |
95 /** | 95 /** |
96 * Sets the attachment of the bubble. | 96 * Sets the attachment of the bubble. |
97 * @param {!Attachment} attachment Bubble attachment. | 97 * @param {!Attachment} attachment Bubble attachment. |
98 */ | 98 */ |
99 setAttachment_: function(attachment) { | 99 setAttachment_: function(attachment) { |
100 for (var k in Bubble.Attachment) { | 100 for (var k in Bubble.Attachment) { |
101 var v = Bubble.Attachment[k]; | 101 var v = Bubble.Attachment[k]; |
102 this.classList[v == attachment ? 'add' : 'remove'](v); | 102 this.classList.toggle(v, v == attachment); |
103 } | 103 } |
104 }, | 104 }, |
105 | 105 |
106 /** | 106 /** |
107 * Shows the bubble for given anchor element. | 107 * Shows the bubble for given anchor element. |
108 * @param {!Object} pos Bubble position (left, top, right, bottom in px). | 108 * @param {!Object} pos Bubble position (left, top, right, bottom in px). |
109 * @param {!Attachment} attachment Bubble attachment (on which side of the | 109 * @param {!Attachment} attachment Bubble attachment (on which side of the |
110 * specified position it should be displayed). | 110 * specified position it should be displayed). |
111 * @param {HTMLElement} opt_content Content to show in bubble. | 111 * @param {HTMLElement} opt_content Content to show in bubble. |
112 * If not specified, bubble element content is shown. | 112 * If not specified, bubble element content is shown. |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 handleWindowBlur_: function(e) { | 304 handleWindowBlur_: function(e) { |
305 if (!this.hidden) | 305 if (!this.hidden) |
306 this.hide(); | 306 this.hide(); |
307 } | 307 } |
308 }; | 308 }; |
309 | 309 |
310 return { | 310 return { |
311 Bubble: Bubble | 311 Bubble: Bubble |
312 }; | 312 }; |
313 }); | 313 }); |
OLD | NEW |