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
parent c0f741760c
commit 7eb8b0e356

View File

@ -308,6 +308,21 @@
]]>
</body>
</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) {
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;
}
if (this.hasCustomInteractiveItems(aCurrentSet))
this.setAttribute("customized", "true");
else
this.removeAttribute("customized");
]]></body>
</method>