Back out f0f8c5391540 (bug 626368) a=bustage

This commit is contained in:
Phil Ringnalda 2011-01-25 21:57:24 -08:00
parent 64492f4b99
commit f7f741bc9e
6 changed files with 5 additions and 105 deletions

View File

@ -206,7 +206,7 @@ function GroupItem(listOfEls, options) {
else {
this.$titleShield
.mousedown(function(e) {
self.lastMouseDownTarget = (Utils.isLeftClick(e) ? e.target : null);
self.lastMouseDownTarget = (Utils.isRightClick(e) ? null : e.target);
})
.mouseup(function(e) {
var same = (e.target == self.lastMouseDownTarget);
@ -1011,7 +1011,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
.data("xulTab", xulTab)
.appendTo(this.$appTabTray)
.click(function(event) {
if (!Utils.isLeftClick(event))
if (Utils.isRightClick(event))
return;
GroupItems.setActiveGroupItem(self);

View File

@ -697,7 +697,7 @@ Item.prototype = {
// ___ mousedown
$container.mousedown(function(e) {
if (!Utils.isLeftClick(e))
if (Utils.isRightClick(e))
return;
var cancel = false;
@ -829,7 +829,7 @@ Item.prototype = {
.addClass('iq-resizable-handle iq-resizable-se')
.appendTo($container)
.mousedown(function(e) {
if (!Utils.isLeftClick(e))
if (Utils.isRightClick(e))
return;
startMouse = new Point(e.pageX, e.pageY);

View File

@ -580,20 +580,6 @@ let Utils = {
// ___ Misc
// ----------
// Function: isLeftClick
// Given a DOM mouse event, returns true if it was for the left mouse button.
isLeftClick: function Utils_isLeftClick(event) {
return event.button == 0;
},
// ----------
// Function: isMiddleClick
// Given a DOM mouse event, returns true if it was for the middle mouse button.
isMiddleClick: function Utils_isMiddleClick(event) {
return event.button == 1;
},
// ----------
// Function: isRightClick
// Given a DOM mouse event, returns true if it was for the right mouse button.

View File

@ -188,7 +188,7 @@ function TabItem(tab, options) {
return;
// press close button or middle mouse click
if (iQ(e.target).hasClass("close") || Utils.isMiddleClick(e)) {
if (iQ(e.target).hasClass("close") || e.button == 1) {
self.close();
} else {
if (!Items.item(this).isDragging)

View File

@ -91,7 +91,6 @@ _BROWSER_FILES = \
browser_tabview_bug624953.js \
browser_tabview_bug625269.js \
browser_tabview_bug625424.js \
browser_tabview_bug626368.js \
browser_tabview_bug627736.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

View File

@ -1,85 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is a test for bug 626368.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tim Taubert <tim.taubert@gmx.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function test() {
let cw;
let createGroupItem = function () {
let bounds = new cw.Rect(20, 20, 150, 150);
let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true});
cw.GroupItems.setActiveGroupItem(groupItem);
gBrowser.loadOneTab('about:blank', {inBackground: true});
return groupItem;
}
let synthesizeMiddleMouseDrag = function (tabContainer, width) {
EventUtils.synthesizeMouseAtCenter(tabContainer,
{type: 'mousedown', button: 1}, cw);
let rect = tabContainer.getBoundingClientRect();
EventUtils.synthesizeMouse(tabContainer, rect.width / 2 + width,
rect.height / 2, {type: 'mousemove', button: 1}, cw);
EventUtils.synthesizeMouse(tabContainer, rect.width / 2 + width,
rect.height / 2, {type: 'mouseup', button: 1}, cw);
}
let testDragAndDropWithMiddleMouseButton = function () {
let groupItem = createGroupItem();
let tabItem = groupItem.getChild(0);
let tabContainer = tabItem.container;
let bounds = tabItem.getBounds();
// try to drag and move the mouse out of the tab
synthesizeMiddleMouseDrag(tabContainer, 200);
is(groupItem.getChild(0), tabItem, 'tabItem was not closed');
ok(bounds.equals(tabItem.getBounds()), 'bounds did not change');
// try to drag and let the mouse stay within tab bounds
synthesizeMiddleMouseDrag(tabContainer, 10);
ok(!groupItem.getChild(0), 'tabItem was closed');
hideTabView(finish);
}
waitForExplicitFinish();
showTabView(function () {
cw = TabView.getContentWindow();
afterAllTabsLoaded(testDragAndDropWithMiddleMouseButton);
});
}