Bug 663614 - remove double-click to create a new tab in a group r=ehsan

This commit is contained in:
Raymond Lee 2011-06-13 12:06:27 +08:00
parent 12d1aa8f4d
commit 0a22ac5466
3 changed files with 14 additions and 52 deletions

View File

@ -86,10 +86,6 @@ function GroupItem(listOfEls, options) {
this.keepProportional = false;
this._frozenItemSizeData = {};
// Double click tracker
this._lastClick = 0;
this._lastClickPositions = null;
// Variable: _activeTab
// The <TabItem> for the groupItem's active tab.
this._activeTab = null;
@ -1651,28 +1647,6 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
_addHandlers: function GroupItem__addHandlers(container) {
let self = this;
// Create new tab and zoom in on it after a double click
container.mousedown(function(e) {
if (!Utils.isLeftClick(e) || self.$titlebar[0] == e.target ||
self.$titlebar.contains(e.target)) {
self._lastClick = 0;
self._lastClickPositions = null;
return;
}
if (Date.now() - self._lastClick <= UI.DBLCLICK_INTERVAL &&
(self._lastClickPositions.x - UI.DBLCLICK_OFFSET) <= e.clientX &&
(self._lastClickPositions.x + UI.DBLCLICK_OFFSET) >= e.clientX &&
(self._lastClickPositions.y - UI.DBLCLICK_OFFSET) <= e.clientY &&
(self._lastClickPositions.y + UI.DBLCLICK_OFFSET) >= e.clientY) {
self.newTab();
self._lastClick = 0;
self._lastClickPositions = null;
} else {
self._lastClick = Date.now();
self._lastClickPositions = new Point(e.clientX, e.clientY);
}
});
var dropIndex = false;
var dropSpaceTimer = null;

View File

@ -9,6 +9,12 @@ let contentElement;
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
if (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
hideTabView(function() {});
});
showTabView(function() {
contentWindow = TabView.getContentWindow();
contentElement = contentWindow.document.getElementById("content");
@ -24,9 +30,10 @@ function test1() {
showTabView(function() {
is(contentWindow.GroupItems.getOrphanedTabs().length, 1,
"An orphaned tab is created");
orphanedTab = contentWindow.GroupItems.getOrphanedTabs()[0].tab;
test2();
hideTabView(function() {
gBrowser.selectedTab = originalTab;
finish();
});
});
});
@ -36,29 +43,10 @@ function test1() {
mouseClick(contentElement, 0);
}
function test2() {
let groupItem = createEmptyGroupItem(contentWindow, 300, 300, 200);
is(groupItem.getChildren().length, 0, "The group is empty");
hideTabView(function() {
is(groupItem.getChildren().length, 1, "A tab is created inside the group");
gBrowser.selectedTab = originalTab;
gBrowser.removeTab(orphanedTab);
gBrowser.removeTab(groupItem.getChildren()[0].tab);
finish();
});
// first click
mouseClick(groupItem.container, 0);
// second click
mouseClick(groupItem.container, 0);
}
function mouseClick(targetElement, buttonCode) {
EventUtils.sendMouseEvent(
{ type: "mousedown", button: buttonCode }, targetElement, contentWindow);
EventUtils.sendMouseEvent(
{ type: "mouseup", button: buttonCode }, targetElement, contentWindow);
}

View File

@ -35,7 +35,6 @@ function test() {
let tabItem = gBrowser.tabs[0]._tabViewTabItem;
cw.GroupItems.updateActiveGroupItemAndTabBar(tabItem);
gBrowser.removeTab(gBrowser.tabs[1]);
assertNumberOfGroups(1);
assertNumberOfTabs(1);
@ -69,9 +68,10 @@ function test() {
// simulate double click with left mouse button
let container = groupItem.container;
simulateDoubleClick(container);
assertNumberOfTabs(2);
assertNumberOfTabs(1);
whenTabViewIsHidden(finishTest);
groupItem.close();
hideTabView(finishTest);
}
waitForExplicitFinish();