From e189e449af15caa2fdee8f360b643d1d6fda272c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Wed, 8 Sep 2010 17:10:46 +0200 Subject: [PATCH] Bug 587901 - Make the identity box draggable. r+a=dolske --HG-- extra : rebase_source : cb1b8aa08d86db86199bfb28a35dc758f9f4270f --- browser/base/content/browser.js | 36 +++++++++++------------ browser/base/content/browser.xul | 4 +-- browser/base/content/test/browser_drag.js | 9 +++--- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index e644a1c95134..769d12179a83 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2870,25 +2870,7 @@ var browserDragAndDrop = { }, drop: function (aEvent, aName) Services.droppedLinkHandler.dropLink(aEvent, aName) -} - -var proxyIconDNDObserver = { - onDragStart: function (aEvent, aXferData, aDragAction) - { - if (gProxyFavIcon.getAttribute("pageproxystate") != "valid") - return; - - var value = content.location.href; - var urlString = value + "\n" + content.document.title; - var htmlString = "" + value + ""; - - var dt = aEvent.dataTransfer; - dt.setData("text/x-moz-url", urlString); - dt.setData("text/uri-list", value); - dt.setData("text/plain", value); - dt.setData("text/html", htmlString); - } -} +}; var homeButtonObserver = { onDrop: function (aEvent) @@ -7225,6 +7207,22 @@ var gIdentityHandler = { // Now open the popup, anchored off the primary chrome element this._identityPopup.openPopup(this._identityBox, position); + }, + + onDragStart: function (event) { + if (gURLBar.getAttribute("pageproxystate") != "valid") + return; + + var value = content.location.href; + var urlString = value + "\n" + content.document.title; + var htmlString = "" + value + ""; + + var dt = event.dataTransfer; + dt.setData("text/x-moz-url", urlString); + dt.setData("text/uri-list", value); + dt.setData("text/plain", value); + dt.setData("text/html", htmlString); + dt.setDragImage(event.currentTarget, 0, 0); } }; diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index a02d6b6e19db..612d8d8f78ab 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -886,14 +886,14 @@ has focus, otherwise pressing F6 focuses it instead of the location bar --> + onkeypress="gIdentityHandler.handleIdentityButtonEvent(event);" + ondragstart="gIdentityHandler.onDragStart(event);"> diff --git a/browser/base/content/test/browser_drag.js b/browser/base/content/test/browser_drag.js index 9e44b45bf1ce..b8368de4d44f 100644 --- a/browser/base/content/test/browser_drag.js +++ b/browser/base/content/test/browser_drag.js @@ -17,12 +17,11 @@ function test() data : htmlString } ] ]; // set the valid attribute so dropping is allowed - var proxyicon = document.getElementById("page-proxy-favicon") - var oldstate = proxyicon.getAttribute("pageproxystate"); - proxyicon.setAttribute("pageproxystate", "valid"); - var dt = EventUtils.synthesizeDragStart(proxyicon, expected); + var oldstate = gURLBar.getAttribute("pageproxystate"); + gURLBar.setAttribute("pageproxystate", "valid"); + var dt = EventUtils.synthesizeDragStart(document.getElementById("identity-box"), expected); is(dt, null, "drag on proxy icon"); - proxyicon.setAttribute("pageproxystate", oldstate); + gURLBar.setAttribute("pageproxystate", oldstate); // Now, the identity information panel is opened by the proxy icon click. // We need to close it for next tests. EventUtils.synthesizeKey("VK_ESCAPE", {}, window);