Bug 1187219 - Remove _visuallySelected, _logicallySelected from tabbox.xml, avoid code duplication with tabbrowser.xml. r=mconley

This commit is contained in:
Dão Gottwald 2015-07-29 17:33:31 +02:00
Родитель 22c73f6529
Коммит 3509d8e6bc
2 изменённых файлов: 43 добавлений и 75 удалений

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

@ -5668,11 +5668,6 @@
<implementation> <implementation>
<!--
This code is the same as in toolkit/content/widgets/tabbox.xml,
except for the _tabAttrModified call. If you modify it, tabbox.xml
might also need to be modified.
-->
<property name="_visuallySelected"> <property name="_visuallySelected">
<setter> <setter>
<![CDATA[ <![CDATA[
@ -5680,27 +5675,23 @@
this.setAttribute("visuallyselected", "true"); this.setAttribute("visuallyselected", "true");
else else
this.removeAttribute("visuallyselected"); this.removeAttribute("visuallyselected");
gBrowser._tabAttrModified(this, ["visuallyselected"]); this.parentNode.tabbrowser._tabAttrModified(this, ["visuallyselected"]);
if (this.previousSibling && this.previousSibling.localName == "tab") { this._setPositionAttributes(val);
if (val)
this.previousSibling.setAttribute("beforeselected", "true");
else
this.previousSibling.removeAttribute("beforeselected");
this.removeAttribute("first-tab");
}
else
this.setAttribute("first-tab", "true");
if (this.nextSibling && this.nextSibling.localName == "tab") { return val;
if (val) ]]>
this.nextSibling.setAttribute("afterselected", "true"); </setter>
else </property>
this.nextSibling.removeAttribute("afterselected");
this.removeAttribute("last-tab"); <property name="_logicallySelected">
} <setter>
<![CDATA[
if (val)
this.setAttribute("selected", "true");
else else
this.setAttribute("last-tab", "true"); this.removeAttribute("selected");
return val; return val;
]]> ]]>
</setter> </setter>

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

@ -727,66 +727,43 @@
<property name="selected" readonly="true" <property name="selected" readonly="true"
onget="return this.getAttribute('selected') == 'true';"/> onget="return this.getAttribute('selected') == 'true';"/>
<!-- <property name="_selected">
This code is the same as in browser/base/content/tabbrowser.xml, <setter><![CDATA[
except for the _tabAttrModified call. If you modify it, tabbrowser.xml
should probably also be modified.
-->
<property name="_visuallySelected">
<setter>
<![CDATA[
if (val)
this.setAttribute("visuallyselected", "true");
else
this.removeAttribute("visuallyselected");
if (this.previousSibling && this.previousSibling.localName == "tab") {
if (val)
this.previousSibling.setAttribute("beforeselected", "true");
else
this.previousSibling.removeAttribute("beforeselected");
this.removeAttribute("first-tab");
}
else
this.setAttribute("first-tab", "true");
if (this.nextSibling && this.nextSibling.localName == "tab") {
if (val)
this.nextSibling.setAttribute("afterselected", "true");
else
this.nextSibling.removeAttribute("afterselected");
this.removeAttribute("last-tab");
}
else
this.setAttribute("last-tab", "true");
return val;
]]>
</setter>
</property>
<property name="_logicallySelected">
<setter>
<![CDATA[
if (val) if (val)
this.setAttribute("selected", "true"); this.setAttribute("selected", "true");
else else
this.removeAttribute("selected"); this.removeAttribute("selected");
this._setPositionAttributes(val);
return val; return val;
]]> ]]></setter>
</setter>
</property> </property>
<property name="_selected"> <method name="_setPositionAttributes">
<setter> <parameter name="aSelected"/>
<![CDATA[ <body><![CDATA[
// If our tab switching is synchronous, then logical selection = visual selection if (this.previousSibling && this.previousSibling.localName == "tab") {
this._logicallySelected = val; if (aSelected)
this._visuallySelected = val; this.previousSibling.setAttribute("beforeselected", "true");
return val; else
]]> this.previousSibling.removeAttribute("beforeselected");
</setter> this.removeAttribute("first-tab");
</property> } else {
this.setAttribute("first-tab", "true");
}
if (this.nextSibling && this.nextSibling.localName == "tab") {
if (aSelected)
this.nextSibling.setAttribute("afterselected", "true");
else
this.nextSibling.removeAttribute("afterselected");
this.removeAttribute("last-tab");
} else {
this.setAttribute("last-tab", "true");
}
]]></body>
</method>
<property name="linkedPanel" onget="return this.getAttribute('linkedpanel')" <property name="linkedPanel" onget="return this.getAttribute('linkedpanel')"
onset="this.setAttribute('linkedpanel', val); return val;"/> onset="this.setAttribute('linkedpanel', val); return val;"/>