Bug 499298 - menubar auto-hiding doesn't work when removing default items from the toolbar. r=neil

This commit is contained in:
Dão Gottwald 2009-06-26 14:48:41 +02:00
Родитель 0858e6b05c
Коммит 55f1463d86
1 изменённых файлов: 19 добавлений и 20 удалений

Просмотреть файл

@ -307,7 +307,22 @@
return newItem;
]]>
</body>
</method>
</method>
<method name="hasCustomInteractiveItems">
<parameter name="aCurrentSet"/>
<body><![CDATA[
if (aCurrentSet == "__empty")
return false;
var defaultOrNoninteractive = (this.getAttribute("defaultset") || "")
.split(",")
.concat(["separator", "spacer", "spring"]);
return aCurrentSet.split(",").some(function (item) {
return defaultOrNoninteractive.indexOf(item) == -1;
});
]]></body>
</method>
</implementation>
</binding>
@ -366,26 +381,10 @@
<method name="currentSetChanged">
<parameter name="aCurrentSet"/>
<body><![CDATA[
var defaultSet = this.getAttribute("defaultset");
if (!defaultSet || aCurrentSet == defaultSet) {
if (this.hasCustomInteractiveItems(aCurrentSet))
this.setAttribute("customized", "true");
else
this.removeAttribute("customized");
return;
}
function normalize(aSet) {
return aSet.split(",").filter(function (element) {
return element != "separator" &&
element != "spacer" &&
element != "spring" &&
element != "__empty";
}).sort().join(",");
}
if (normalize(aCurrentSet) == normalize(defaultSet)) {
this.removeAttribute("customized");
return;
}
this.setAttribute("customized", "true");
]]></body>
</method>