Bug 1546088: Improve the look of the page URL in the Site Identity Button's drag-image/tooltip.r=johannh
authorSyeda Asra Arshia Qadri <asra.qadri@gmail.com>
Wed, 15 May 2019 12:54:57 +0000
changeset 473912 10571a393265c39d8b42627b2f0a3c0c2c79f842
parent 473911 d865d7a290f8c93bfca4ad532878fbc0e4403b62
child 473913 55d8ca64343b8c2c725ace70eed4e002b775f795
push id36019
push userdvarga@mozilla.com
push dateWed, 15 May 2019 21:30:39 +0000
treeherdermozilla-central@9e68d485f7cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1546088
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 1546088: Improve the look of the page URL in the Site Identity Button's drag-image/tooltip.r=johannh Differential Revision: https://phabricator.services.mozilla.com/D28985
browser/base/content/browser-siteIdentity.js
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -942,17 +942,21 @@ var gIdentityHandler = {
     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);
+    ctx.fillText(`${value}`, 20 * scale, 14 * scale);
+    let tabIcon = document.getAnonymousElementByAttribute(gBrowser.selectedTab, "anonid", "tab-icon-image");
+    let image = new Image();
+    image.src = tabIcon.src;
+    ctx.drawImage(image, 0, 0, 16 * scale, 16 * scale);
 
     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(canvas, 16, 16);
   },