Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 UI.Tooltip = class { | 7 UI.Tooltip = class { |
| 8 /** | 8 /** |
| 9 * @param {!Document} doc | 9 * @param {!Document} doc |
| 10 */ | 10 */ |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 } | 22 } |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * @param {!Document} doc | 25 * @param {!Document} doc |
| 26 */ | 26 */ |
| 27 static installHandler(doc) { | 27 static installHandler(doc) { |
| 28 new UI.Tooltip(doc); | 28 new UI.Tooltip(doc); |
| 29 } | 29 } |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Installs the tooltipContent to be shown on mouseover, called when title is set on an Element. | |
|
lushnikov
2016/12/06 01:19:37
style: please, drop the documentation comment (i k
paulirish
2016/12/06 01:37:27
Isn't that old policy? Blink is open to comments f
lushnikov
2016/12/06 22:30:23
Let's discuss this on Thursday!
We should either
phulce
2016/12/06 23:09:32
Done.
| |
| 33 * Removes the tooltip if content is null or empty. | |
| 34 * | |
| 32 * @param {!Element} element | 35 * @param {!Element} element |
| 33 * @param {!Element|string} tooltipContent | 36 * @param {?Element|string} tooltipContent |
| 34 * @param {string=} actionId | 37 * @param {string=} actionId |
| 35 * @param {!Object=} options | 38 * @param {!Object=} options |
| 36 */ | 39 */ |
| 37 static install(element, tooltipContent, actionId, options) { | 40 static install(element, tooltipContent, actionId, options) { |
| 38 if (typeof tooltipContent === 'string' && tooltipContent === '') { | 41 if (tooltipContent === null || tooltipContent === '') { |
|
lushnikov
2016/12/06 01:19:36
if (!tooltipContent) {
...
}
phulce
2016/12/06 23:09:32
Done.
| |
| 39 delete element[UI.Tooltip._symbol]; | 42 delete element[UI.Tooltip._symbol]; |
| 40 return; | 43 return; |
| 41 } | 44 } |
| 42 element[UI.Tooltip._symbol] = {content: tooltipContent, actionId: actionId, options: options || {}}; | 45 element[UI.Tooltip._symbol] = {content: tooltipContent, actionId: actionId, options: options || {}}; |
| 43 } | 46 } |
| 44 | 47 |
| 45 /** | 48 /** |
| 46 * @param {!Element} element | 49 * @param {!Element} element |
| 47 */ | 50 */ |
| 48 static addNativeOverrideContainer(element) { | 51 static addNativeOverrideContainer(element) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 }, | 194 }, |
| 192 | 195 |
| 193 /** | 196 /** |
| 194 * @param {!Element|string} x | 197 * @param {!Element|string} x |
| 195 * @this {!Element} | 198 * @this {!Element} |
| 196 */ | 199 */ |
| 197 set: function(x) { | 200 set: function(x) { |
| 198 UI.Tooltip.install(this, x); | 201 UI.Tooltip.install(this, x); |
| 199 } | 202 } |
| 200 }); | 203 }); |
| OLD | NEW |