зеркало из https://github.com/mozilla/pjs.git
Bug 345741 - Improve "All Tabs" menu active/visible tab feedback
p=Michael Ventnor <ventnor.bugzilla@yahoo.com.au> r=mano
This commit is contained in:
Родитель
2df27faf4d
Коммит
2afed25051
|
@ -2963,9 +2963,6 @@
|
||||||
<method name="_menuItemOnCommand">
|
<method name="_menuItemOnCommand">
|
||||||
<parameter name="aEvent"/>
|
<parameter name="aEvent"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
// note, the tab may not be valid (if after we built the popup
|
|
||||||
// the tab was closed. but selectedItem setter handles that
|
|
||||||
// gracefully.
|
|
||||||
var tabcontainer = document.getBindingParent(this);
|
var tabcontainer = document.getBindingParent(this);
|
||||||
tabcontainer.selectedItem = aEvent.target.tab;
|
tabcontainer.selectedItem = aEvent.target.tab;
|
||||||
]]></body>
|
]]></body>
|
||||||
|
@ -3020,6 +3017,28 @@
|
||||||
case "TabOpen":
|
case "TabOpen":
|
||||||
this._createTabMenuItem(aEvent.originalTarget);
|
this._createTabMenuItem(aEvent.originalTarget);
|
||||||
break;
|
break;
|
||||||
|
case "scroll":
|
||||||
|
this._updateTabsVisibilityStatus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
]]></body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="_updateTabsVisibilityStatus">
|
||||||
|
<body><![CDATA[
|
||||||
|
var tabContainer = document.getBindingParent(this);
|
||||||
|
// We don't want menu item decoration unless there is overflow.
|
||||||
|
if (tabContainer.getAttribute("overflow") != "true")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var tabstripBO = tabContainer.mTabstrip.scrollBoxObject;
|
||||||
|
for (var i = 0; i < this.childNodes.length; i++) {
|
||||||
|
var curTabBO = this.childNodes[i].tab.boxObject;
|
||||||
|
if (curTabBO.screenX >= tabstripBO.screenX &&
|
||||||
|
curTabBO.screenX + curTabBO.width <= tabstripBO.screenX + tabstripBO.width)
|
||||||
|
this.childNodes[i].setAttribute("tabIsVisible", "true");
|
||||||
|
else
|
||||||
|
this.childNodes[i].removeAttribute("tabIsVisible");
|
||||||
}
|
}
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -3066,6 +3085,7 @@
|
||||||
// Listen for changes in the tab bar.
|
// Listen for changes in the tab bar.
|
||||||
var tabbrowser = document.getBindingParent(tabcontainer);
|
var tabbrowser = document.getBindingParent(tabcontainer);
|
||||||
tabbrowser.addEventListener("TabOpen", this, false);
|
tabbrowser.addEventListener("TabOpen", this, false);
|
||||||
|
tabcontainer.mTabstrip.addEventListener("scroll", this, false);
|
||||||
|
|
||||||
// if an animation is in progress and the user
|
// if an animation is in progress and the user
|
||||||
// clicks on the "all tabs" button, stop the animation
|
// clicks on the "all tabs" button, stop the animation
|
||||||
|
@ -3074,6 +3094,7 @@
|
||||||
for (var i = 0; i < tabs.length; i++) {
|
for (var i = 0; i < tabs.length; i++) {
|
||||||
this._createTabMenuItem(tabs[i]);
|
this._createTabMenuItem(tabs[i]);
|
||||||
}
|
}
|
||||||
|
this._updateTabsVisibilityStatus();
|
||||||
]]></handler>
|
]]></handler>
|
||||||
|
|
||||||
<handler event="popuphiding">
|
<handler event="popuphiding">
|
||||||
|
@ -3087,8 +3108,9 @@
|
||||||
menuItem.tab.mCorrespondingMenuitem = null;
|
menuItem.tab.mCorrespondingMenuitem = null;
|
||||||
this.removeChild(menuItem);
|
this.removeChild(menuItem);
|
||||||
}
|
}
|
||||||
var tabbrowser = document.getBindingParent(document.getBindingParent(this));
|
var tabcontainer = document.getBindingParent(this);
|
||||||
tabbrowser.removeEventListener("TabOpen", this, false);
|
tabcontainer.mTabstrip.removeEventListener("scroll", this, false);
|
||||||
|
document.getBindingParent(tabcontainer).removeEventListener("TabOpen", this, false);
|
||||||
]]></handler>
|
]]></handler>
|
||||||
|
|
||||||
<handler event="DOMMenuItemActive">
|
<handler event="DOMMenuItemActive">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче