Bug 1362542 - Avoid flusing layout when updating tabs' visiblity status for the overflow menu. r=florian

MozReview-Commit-ID: CuqI1gXcg0i

--HG--
extra : rebase_source : 4e354963eda7d884d77a5b481ee3344203ed38d8
This commit is contained in:
Dão Gottwald 2017-05-29 17:50:13 +02:00
Родитель 2686efa296
Коммит e5a35bb911
1 изменённых файлов: 17 добавлений и 16 удалений

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

@ -7552,9 +7552,6 @@
case "TabClose":
this._tabOnTabClose(aEvent);
break;
case "scroll":
this._updateTabsVisibilityStatus();
break;
}
]]></body>
</method>
@ -7563,20 +7560,26 @@
<body><![CDATA[
var tabContainer = gBrowser.tabContainer;
// We don't want menu item decoration unless there is overflow.
if (tabContainer.getAttribute("overflow") != "true")
if (tabContainer.getAttribute("overflow") != "true") {
return;
}
var tabstripBO = tabContainer.mTabstrip.scrollBoxObject;
for (var i = 0; i < this.childNodes.length; i++) {
let curTab = this.childNodes[i].tab;
if (!curTab) // "Undo close tab", menuseparator, or entries put here by addons.
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let tabstripRect = windowUtils.getBoundsWithoutFlushing(tabContainer.mTabstrip);
for (let menuitem of this.childNodes) {
let curTab = menuitem.tab;
if (!curTab) {
// "Undo close tab", menuseparator, or entries put here by addons.
continue;
let curTabBO = curTab.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");
}
let curTabRect = windowUtils.getBoundsWithoutFlushing(curTab);
if (curTabRect.left >= tabstripRect.left &&
curTabRect.right <= tabstripRect.right) {
menuitem.setAttribute("tabIsVisible", "true");
} else {
menuitem.removeAttribute("tabIsVisible");
}
}
]]></body>
</method>
@ -7675,7 +7678,6 @@
// Listen for changes in the tab bar.
tabcontainer.addEventListener("TabAttrModified", this);
tabcontainer.addEventListener("TabClose", this);
tabcontainer.mTabstrip.addEventListener("scroll", this);
let tabs = gBrowser.visibleTabs;
for (var i = 0; i < tabs.length; i++) {
@ -7704,7 +7706,6 @@
}
}
var tabcontainer = gBrowser.tabContainer;
tabcontainer.mTabstrip.removeEventListener("scroll", this);
tabcontainer.removeEventListener("TabAttrModified", this);
tabcontainer.removeEventListener("TabClose", this);
]]></handler>