Bug 856107 - Mouse hovering events should be handled seperately from tab select/move code for tab attributes. f=unusualtears r=MattN

This commit is contained in:
Mike de Boer 2013-05-01 23:36:33 -04:00
Родитель 3c0eb2885b
Коммит d199cbb909
2 изменённых файлов: 38 добавлений и 17 удалений

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

@ -3045,14 +3045,6 @@
let lastVisible = visibleTabs.length - 1;
// selectedItem will not be in visibleTabs briefly when
// browser.tabs.closeWindowWithLastTab is disabled and the user closes
// the last tab
if (!this.selectedItem.closing && selectedIndex != 0) {
let beforeSelectedTab = visibleTabs[selectedIndex - 1];
beforeSelectedTab.removeAttribute("beforehovered");
}
if (this._afterSelectedTab)
this._afterSelectedTab.removeAttribute("afterselected-visible");
if (this.selectedItem.closing || selectedIndex == lastVisible) {
@ -3061,7 +3053,6 @@
this._afterSelectedTab = visibleTabs[selectedIndex + 1];
this._afterSelectedTab.setAttribute("afterselected-visible",
"true");
this._afterSelectedTab.removeAttribute("afterhovered");
}
if (this._firstTab)
@ -4314,7 +4305,7 @@
this.mOverCloseButton = true;
let tab = event.target;
if (tab.selected || tab.closing)
if (tab.closing)
return;
let tabContainer = this.parentNode;

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

@ -83,15 +83,45 @@ function test_movedLower() {
function test_hoverOne() {
EventUtils.synthesizeMouseAtCenter(gBrowser.tabs[4], { type: "mousemove" });
testAttrib(gBrowser.tabs[3], "beforehovered", true,
"Fourth tab marked beforehovered");
testAttrib(gBrowser.tabs[3], "beforehovered", true, "Fourth tab marked beforehovered");
EventUtils.synthesizeMouseAtCenter(gBrowser.tabs[3], { type: "mousemove" });
testAttrib(gBrowser.tabs[2], "beforehovered", true,
"Third tab marked beforehovered!");
testAttrib(gBrowser.tabs[4], "afterhovered", true,
"Fifth tab marked afterhovered!");
testAttrib(gBrowser.tabs[2], "beforehovered", true, "Third tab marked beforehovered!");
testAttrib(gBrowser.tabs[2], "afterhovered", false, "Third tab not marked afterhovered!");
testAttrib(gBrowser.tabs[4], "afterhovered", true, "Fifth tab marked afterhovered!");
testAttrib(gBrowser.tabs[4], "beforehovered", false, "Fifth tab not marked beforehovered!");
testAttrib(gBrowser.tabs[0], "beforehovered", false, "First tab not marked beforehovered!");
testAttrib(gBrowser.tabs[0], "afterhovered", false, "First tab not marked afterhovered!");
testAttrib(gBrowser.tabs[1], "beforehovered", false, "Second tab not marked beforehovered!");
testAttrib(gBrowser.tabs[1], "afterhovered", false, "Second tab not marked afterhovered!");
testAttrib(gBrowser.tabs[3], "beforehovered", false, "Fourth tab not marked beforehovered!");
testAttrib(gBrowser.tabs[3], "afterhovered", false, "Fourth tab not marked afterhovered!");
gBrowser.removeTab(tabs.pop());
test_pinning();
executeSoon(test_hoverStatePersistence);
}
function test_hoverStatePersistence() {
// Test that the afterhovered and beforehovered attributes are still there when
// a tab is selected and then unselected again. See bug 856107.
function assertState() {
testAttrib(gBrowser.tabs[0], "beforehovered", true, "First tab still marked beforehovered!");
testAttrib(gBrowser.tabs[0], "afterhovered", false, "First tab not marked afterhovered!");
testAttrib(gBrowser.tabs[2], "afterhovered", true, "Third tab still marked afterhovered!");
testAttrib(gBrowser.tabs[2], "beforehovered", false, "Third tab not marked afterhovered!");
testAttrib(gBrowser.tabs[1], "beforehovered", false, "Second tab not marked beforehovered!");
testAttrib(gBrowser.tabs[1], "afterhovered", false, "Second tab not marked afterhovered!");
testAttrib(gBrowser.tabs[3], "beforehovered", false, "Fourth tab not marked beforehovered!");
testAttrib(gBrowser.tabs[3], "afterhovered", false, "Fourth tab not marked afterhovered!");
}
gBrowser.selectedTab = gBrowser.tabs[3];
EventUtils.synthesizeMouseAtCenter(gBrowser.tabs[1], { type: "mousemove" });
assertState();
gBrowser.selectedTab = gBrowser.tabs[1];
assertState();
gBrowser.selectedTab = gBrowser.tabs[3];
assertState();
executeSoon(test_pinning);
}
function test_pinning() {