Back out f0f8c5391540 (bug 626368) a=bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Tue, 25 Jan 2011 21:57:24 -0800
changeset 61307 21a7c88123caa715d161598cff269d828ab24fc8
parent 61306 84431e8293867784d04eded2eb75bfa187b0b82e
child 61308 5a0f46c26d12b1b915ba7003308cbf978757f058
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersbustage
bugs626368
milestone2.0b11pre
backs outf0f8c5391540155c2ed128776cc36fe46f2c33de
Back out f0f8c5391540 (bug 626368) a=bustage
browser/base/content/tabview/groupitems.js
browser/base/content/tabview/items.js
browser/base/content/tabview/modules/utils.jsm
browser/base/content/tabview/tabitems.js
browser/base/content/test/tabview/Makefile.in
browser/base/content/test/tabview/browser_tabview_bug626368.js
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -201,17 +201,17 @@ function GroupItem(listOfEls, options) {
     .keydown(handleKeyDown)
     .keyup(handleKeyUp);
 
   if (this.locked.title)
     this.$title.addClass('name-locked');
   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);
         self.lastMouseDownTarget = null;
         if (!same)
           return;
 
         if (!self.isDragging) {
@@ -1006,17 +1006,17 @@ GroupItem.prototype = Utils.extend(new I
     // add the icon
     let iconUrl = xulTab.image || Utils.defaultFaviconURL;
     let $appTab = iQ("<img>")
       .addClass("appTabIcon")
       .attr("src", iconUrl)
       .data("xulTab", xulTab)
       .appendTo(this.$appTabTray)
       .click(function(event) {
-        if (!Utils.isLeftClick(event))
+        if (Utils.isRightClick(event))
           return;
 
         GroupItems.setActiveGroupItem(self);
         UI.goToTab(iQ(this).data("xulTab"));
       });
 
     // adjust the tray
     let columnWidth = $appTab.width();
--- a/browser/base/content/tabview/items.js
+++ b/browser/base/content/tabview/items.js
@@ -692,17 +692,17 @@ Item.prototype = {
         if (startSent && typeof self.dragOptions.stop == "function")
           self.dragOptions.stop.apply(self, [e]);
 
         e.preventDefault();
       };
 
       // ___ mousedown
       $container.mousedown(function(e) {
-        if (!Utils.isLeftClick(e))
+        if (Utils.isRightClick(e))
           return;
 
         var cancel = false;
         var $target = iQ(e.target);
         cancelClasses.forEach(function(className) {
           if ($target.hasClass(className))
             cancel = true;
         });
@@ -824,17 +824,17 @@ Item.prototype = {
           e.stopPropagation();
         };
 
         // ___ handle + mousedown
         iQ('<div>')
           .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);
             startSize = self.getBounds().size();
             startAspect = startSize.y / startSize.x;
 
             if (typeof self.resizeOptions.start == "function")
               self.resizeOptions.start.apply(self, [e]);
--- a/browser/base/content/tabview/modules/utils.jsm
+++ b/browser/base/content/tabview/modules/utils.jsm
@@ -576,30 +576,16 @@ let Utils = {
     return Array.map(args, function(arg) {
       return typeof arg == 'object' ? that.expandObject(arg) : arg;
     }).join('; ');
   },
 
   // ___ 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.
   isRightClick: function Utils_isRightClick(event) {
     return event.button == 2;
   },
 
   // ----------
   // Function: isDOMElement
--- a/browser/base/content/tabview/tabitems.js
+++ b/browser/base/content/tabview/tabitems.js
@@ -183,17 +183,17 @@ function TabItem(tab, options) {
 
   $div.mouseup(function(e) {
     var same = (e.target == self.lastMouseDownTarget);
     self.lastMouseDownTarget = null;
     if (!same)
       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)
         self.zoomIn();
     }
   });
 
   iQ("<div>")
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -86,17 +86,16 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug618828.js \
                  browser_tabview_bug619937.js \
                  browser_tabview_bug622835.js \
                  browser_tabview_bug622872.js \
                  browser_tabview_bug624265.js \
                  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 \
                  browser_tabview_expander.js \
                  browser_tabview_group.js \
                  browser_tabview_launch.js \
                  browser_tabview_multiwindow_search.js \
                  browser_tabview_orphaned_tabs.js \
deleted file mode 100644
--- a/browser/base/content/test/tabview/browser_tabview_bug626368.js
+++ /dev/null
@@ -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);
-  });
-}