| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 /** | 78 /** |
| 79 * Shows the bubble for given anchor element. | 79 * Shows the bubble for given anchor element. |
| 80 * @param {!HTMLElement} el Anchor element of the bubble. | 80 * @param {!HTMLElement} el Anchor element of the bubble. |
| 81 * @param {HTMLElement} content Content to show in bubble. | 81 * @param {HTMLElement} content Content to show in bubble. |
| 82 * @param {!Attachment} attachment Bubble attachment (on which side of the | 82 * @param {!Attachment} attachment Bubble attachment (on which side of the |
| 83 * element it should be displayed). | 83 * element it should be displayed). |
| 84 * @param {number=} opt_offset Offset of the bubble attachment point from | 84 * @param {number=} opt_offset Offset of the bubble attachment point from |
| 85 * left (for vertical attachment) or top (for horizontal attachment) | 85 * left (for vertical attachment) or top (for horizontal attachment) |
| 86 * side of the element. If not specified, the bubble is positioned to | 86 * side of the element. If not specified, the bubble is positioned to |
| 87 * be aligned with the left/top side of the element but not farther than | 87 * be aligned with the left/top side of the element but not farther than |
| 88 * half of it's weight/height. | 88 * half of its weight/height. |
| 89 * @param {number=} opt_padding Optional padding of the bubble. | 89 * @param {number=} opt_padding Optional padding of the bubble. |
| 90 * @public | 90 * @public |
| 91 */ | 91 */ |
| 92 showContentForElement: function(el, content, attachment, | 92 showContentForElement: function(el, content, attachment, |
| 93 opt_offset, opt_padding) { | 93 opt_offset, opt_padding) { |
| 94 const ARROW_OFFSET = 25; | 94 const ARROW_OFFSET = 25; |
| 95 const DEFAULT_PADDING = 18; | 95 const DEFAULT_PADDING = 18; |
| 96 | 96 |
| 97 if (typeof opt_padding == 'undefined') | 97 if (typeof opt_padding == 'undefined') |
| 98 opt_padding = DEFAULT_PADDING; | 98 opt_padding = DEFAULT_PADDING; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 /** | 151 /** |
| 152 * Shows the bubble for given anchor element. | 152 * Shows the bubble for given anchor element. |
| 153 * @param {!HTMLElement} el Anchor element of the bubble. | 153 * @param {!HTMLElement} el Anchor element of the bubble. |
| 154 * @param {string} text Text content to show in bubble. | 154 * @param {string} text Text content to show in bubble. |
| 155 * @param {!Attachment} attachment Bubble attachment (on which side of the | 155 * @param {!Attachment} attachment Bubble attachment (on which side of the |
| 156 * element it should be displayed). | 156 * element it should be displayed). |
| 157 * @param {number=} opt_offset Offset of the bubble attachment point from | 157 * @param {number=} opt_offset Offset of the bubble attachment point from |
| 158 * left (for vertical attachment) or top (for horizontal attachment) | 158 * left (for vertical attachment) or top (for horizontal attachment) |
| 159 * side of the element. If not specified, the bubble is positioned to | 159 * side of the element. If not specified, the bubble is positioned to |
| 160 * be aligned with the left/top side of the element but not farther than | 160 * be aligned with the left/top side of the element but not farther than |
| 161 * half of it's weight/height. | 161 * half of its weight/height. |
| 162 * @param {number=} opt_padding Optional padding of the bubble. | 162 * @param {number=} opt_padding Optional padding of the bubble. |
| 163 * @public | 163 * @public |
| 164 */ | 164 */ |
| 165 showTextForElement: function(el, text, attachment, | 165 showTextForElement: function(el, text, attachment, |
| 166 opt_offset, opt_padding) { | 166 opt_offset, opt_padding) { |
| 167 var span = this.ownerDocument.createElement('span'); | 167 var span = this.ownerDocument.createElement('span'); |
| 168 span.textContent = text; | 168 span.textContent = text; |
| 169 this.showContentForElement(el, span, attachment, opt_offset, opt_padding); | 169 this.showContentForElement(el, span, attachment, opt_offset, opt_padding); |
| 170 }, | 170 }, |
| 171 | 171 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 handleDocKeyDown_: function(e) { | 215 handleDocKeyDown_: function(e) { |
| 216 if (!this.hidden) | 216 if (!this.hidden) |
| 217 this.hide(); | 217 this.hide(); |
| 218 } | 218 } |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 return { | 221 return { |
| 222 Bubble: Bubble | 222 Bubble: Bubble |
| 223 }; | 223 }; |
| 224 }); | 224 }); |
| OLD | NEW |