Bug 1208858: Show the page URL in the Site Identity Button's drag-image/tooltip. r=johannh
authorSyeda Asra Arshia Qadri <asra.qadri@gmail.com>
Tue, 09 Apr 2019 08:20:50 +0000
changeset 468538 efbc44239b5cbf46ada4dd9063a23b7c41222f28
parent 468537 1245a50cc3a0f1ef77e9b38c7c618415434207f8
child 468539 bb332aeab4053b4aabe2f82697f870a2327b9148
push id112733
push usercsabou@mozilla.com
push dateTue, 09 Apr 2019 16:30:22 +0000
treeherdermozilla-inbound@e14dba56bbfd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1208858
milestone68.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 1208858: Show the page URL in the Site Identity Button's drag-image/tooltip. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D26527
browser/base/content/browser-siteIdentity.js
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -919,22 +919,30 @@ var gIdentityHandler = {
   onDragStart(event) {
     if (gURLBar.getAttribute("pageproxystate") != "valid")
       return;
 
     let value = gBrowser.currentURI.displaySpec;
     let urlString = value + "\n" + gBrowser.contentTitle;
     let htmlString = "<a href=\"" + value + "\">" + value + "</a>";
 
+    let windowUtils = window.windowUtils;
+    let scale = windowUtils.screenPixelsPerCSSPixel / windowUtils.fullZoom;
+    let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
+    canvas.width = 550 * scale;
+    let ctx = canvas.getContext("2d");
+    ctx.font = `${14 * scale}px sans-serif`;
+    ctx.fillText(`${value}`, 10, 50);
+
     let 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(this._identityIcon, 16, 16);
+    dt.setDragImage(canvas, 16, 16);
   },
 
   onLocationChange() {
     this._permissionReloadHint.setAttribute("hidden", "true");
 
     if (!this._permissionList.hasChildNodes()) {
       this._permissionEmptyHint.removeAttribute("hidden");
     }