From e1b485937d5e00926fc14a11d956af60647cc62e Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Tue, 27 Sep 2011 04:33:35 +0200 Subject: [PATCH] Bug 685476 - App tab icons should not act as drag handlers for groupItems; r=dietrich --- browser/base/content/tabview/groupitems.js | 4 ++++ browser/base/content/test/tabview/Makefile.in | 1 + .../test/tabview/browser_tabview_bug685476.js | 24 +++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 browser/base/content/test/tabview/browser_tabview_bug685476.js diff --git a/browser/base/content/tabview/groupitems.js b/browser/base/content/tabview/groupitems.js index 9b63072ce82..edaf06a1df6 100644 --- a/browser/base/content/tabview/groupitems.js +++ b/browser/base/content/tabview/groupitems.js @@ -1211,6 +1211,10 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), { .attr("src", iconUrl) .data("xulTab", xulTab) .appendTo(this.$appTabTray) + .mousedown(function onAppTabMousedown(event) { + // stop mousedown propagation to disable group dragging on app tabs + event.stopPropagation(); + }) .click(function(event) { if (!Utils.isLeftClick(event)) return; diff --git a/browser/base/content/test/tabview/Makefile.in b/browser/base/content/test/tabview/Makefile.in index ffcbc98d3a2..a9c52424bc4 100644 --- a/browser/base/content/test/tabview/Makefile.in +++ b/browser/base/content/test/tabview/Makefile.in @@ -158,6 +158,7 @@ _BROWSER_FILES = \ browser_tabview_bug677310.js \ browser_tabview_bug679853.js \ browser_tabview_bug681599.js \ + browser_tabview_bug685476.js \ browser_tabview_bug685692.js \ browser_tabview_bug686654.js \ browser_tabview_click_group.js \ diff --git a/browser/base/content/test/tabview/browser_tabview_bug685476.js b/browser/base/content/test/tabview/browser_tabview_bug685476.js new file mode 100644 index 00000000000..2832ebf2c21 --- /dev/null +++ b/browser/base/content/test/tabview/browser_tabview_bug685476.js @@ -0,0 +1,24 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function test() { + waitForExplicitFinish(); + + showTabView(function () { + let tab = gBrowser.addTab(); + gBrowser.pinTab(tab); + registerCleanupFunction(function () gBrowser.removeTab(tab)); + + let cw = TabView.getContentWindow(); + let body = cw.document.body; + let [appTabIcon] = cw.iQ(".appTabTray .appTabIcon"); + + EventUtils.synthesizeMouseAtCenter(appTabIcon, {type: "mousedown"}, cw); + EventUtils.synthesizeMouse(body, 500, 100, {type: "mousemove"}, cw); + EventUtils.synthesizeMouse(body, 500, 100, {type: "mouseup"}, cw); + + ok(TabView.isVisible(), "tabview is still visible"); + + hideTabView(finish); + }); +}