зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1217129: Part 4a - Allow creating CustomizableUI widgets without tooltips. r=gijs
--HG-- extra : commitid : 4J9bvN6e3P6 extra : rebase_source : d9209f219d747b2a9e22078a630af8b423e08776 extra : source : 71f46fe62f59385d6a39d426fd571ed08e46a403
This commit is contained in:
Родитель
a87121bb05
Коммит
64330244a4
|
@ -1342,7 +1342,9 @@ var CustomizableUIInternal = {
|
|||
}
|
||||
|
||||
let tooltip = this.getLocalizedProperty(aWidget, "tooltiptext", additionalTooltipArguments);
|
||||
node.setAttribute("tooltiptext", tooltip);
|
||||
if (tooltip) {
|
||||
node.setAttribute("tooltiptext", tooltip);
|
||||
}
|
||||
node.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");
|
||||
|
||||
let commandHandler = this.handleWidgetCommand.bind(this, aWidget, node);
|
||||
|
@ -1385,6 +1387,8 @@ var CustomizableUIInternal = {
|
|||
},
|
||||
|
||||
getLocalizedProperty: function(aWidget, aProp, aFormatArgs, aDef) {
|
||||
const kReqStringProps = ["label"];
|
||||
|
||||
if (typeof aWidget == "string") {
|
||||
aWidget = gPalette.get(aWidget);
|
||||
}
|
||||
|
@ -1395,7 +1399,7 @@ var CustomizableUIInternal = {
|
|||
// Let widgets pass their own string identifiers or strings, so that
|
||||
// we can use strings which aren't the default (in case string ids change)
|
||||
// and so that non-builtin-widgets can also provide labels, tooltips, etc.
|
||||
if (aWidget[aProp]) {
|
||||
if (aWidget[aProp] != null) {
|
||||
name = aWidget[aProp];
|
||||
// By using this as the default, if a widget provides a full string rather
|
||||
// than a string ID for localization, we will fall back to that string
|
||||
|
@ -1412,7 +1416,9 @@ var CustomizableUIInternal = {
|
|||
}
|
||||
return gWidgetsBundle.GetStringFromName(name) || def;
|
||||
} catch(ex) {
|
||||
if (!def) {
|
||||
// If an empty string was explicitly passed, treat it as an actual
|
||||
// value rather than a missing property.
|
||||
if (!def && (name != "" || kReqStringProps.includes(aProp))) {
|
||||
ERROR("Could not localize property '" + name + "'.");
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче