Bug 674732 - Re-support tab duplication/bookmarking via ctrl/opt+drag. r=dao
authorFrank Yan <fyan@mozilla.com>
Thu, 28 Jul 2011 21:26:38 -0700
changeset 74276 5fc7b3f0bae67ba77280328388d55a58bf96370c
parent 74275 5bd0acd3230871f83f199c555ee050d854ea9f32
child 74277 cef1817c3b13bcb5065b721a35dee94a2940e339
push id235
push userbzbarsky@mozilla.com
push dateTue, 27 Sep 2011 17:13:04 +0000
treeherdermozilla-beta@2d1e082d176a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs674732
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 674732 - Re-support tab duplication/bookmarking via ctrl/opt+drag. r=dao
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -3808,16 +3808,31 @@
 
       <handler event="dragstart"><![CDATA[
         if (this.draggedTab)
           return;
         var tab = this._getDragTargetTab(event);
         if (!tab || !tab._fullyOpen || tab.closing)
           return;
 
+#ifdef XP_MACOSX
+        if (event.altKey) {
+#else
+        if (event.ctrlKey) {
+#endif
+          let dt = event.dataTransfer;
+          let uri = this.tabbrowser.getBrowserForTab(tab).currentURI;
+          let spec = uri ? uri.spec : "about:blank";
+          dt.setData("text/x-moz-url", spec);
+
+          let favicon = document.getAnonymousElementByAttribute(tab, "class", "tab-icon-image");
+          dt.setDragImage(favicon, 16, 16);
+          return;
+        }
+
         this.setAttribute("drag", "move");
         this.draggedTab = tab;
         tab.setAttribute("dragged", "true");
         let data = tab._dragData = {};
         data._dragStartX = event.screenX;
         if (!tab.pinned)
           data._dragStartX += this.mTabstrip.scrollPosition;
         data._dragDistX = 0;