Bug 804068 - set social sharebutton image via .src, plus css tweaks to ensure it is sized correctly. r=jaws
☠☠ backed out by 5d2cb96108c1 ☠ ☠
authorAlfred Kayser <alfredkayser@gmail.com>
Wed, 24 Oct 2012 13:46:05 +1100
changeset 111353 ed8fc02602d47a46eec83557bf8ddd52ce1be2a6
parent 111352 82dd8aa2a13021d9ec4e3a2e4c0fe3502ace068f
child 111354 6350c6370ca501f08a0f98276b7b194cc59096f2
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjaws
bugs804068
milestone19.0a1
Bug 804068 - set social sharebutton image via .src, plus css tweaks to ensure it is sized correctly. r=jaws
browser/base/content/browser-social.js
browser/base/content/test/browser_social_shareButton.js
browser/themes/gnomestripe/browser.css
browser/themes/pinstripe/browser.css
browser/themes/winstripe/browser.css
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -588,17 +588,17 @@ let SocialShareButton = {
       shareButton.setAttribute("shared", "true");
       shareButton.setAttribute("tooltiptext", this.promptMessages['unshareTooltip']);
       imageURL = this.promptImages["unshare"]
     } else {
       shareButton.removeAttribute("shared");
       shareButton.setAttribute("tooltiptext", this.promptMessages['shareTooltip']);
       imageURL = this.promptImages["share"]
     }
-    shareButton.style.backgroundImage = 'url("' + encodeURI(imageURL) + '")';
+    shareButton.src = imageURL;
   }
 };
 
 var SocialMenu = {
   populate: function SocialMenu_populate() {
     // This menu is only accessible through keyboard navigation.
     let submenu = document.getElementById("menu_socialAmbientMenuPopup");
     let ambientMenuItems = submenu.getElementsByClassName("ambient-menuitem");
--- a/browser/base/content/test/browser_social_shareButton.js
+++ b/browser/base/content/test/browser_social_shareButton.js
@@ -63,26 +63,26 @@ function testInitial(finishcb) {
     let displayName = document.getElementById("socialUserDisplayName");
     is(displayName.label, profile.displayName, "display name is set");
     ok(!document.getElementById("unsharePopupHeader").hidden, "user profile is visible");
 
     // Check the strings from our worker actually ended up on the button.
     is(shareButton.getAttribute("tooltiptext"), "Share this page", "check tooltip text is correct");
     is(shareStatusLabel.getAttribute("value"), "", "check status label text is blank");
     // Check the relative URL was resolved correctly (note this image has offsets of zero...)
-    is(shareButton.style.backgroundImage, 'url("https://example.com/browser/browser/base/content/test/social_share_image.png")', "check image url is correct");
+    is(shareButton.src, 'https://example.com/browser/browser/base/content/test/social_share_image.png', "check image url is correct");
 
     // Test clicking the share button
     shareButton.addEventListener("click", function listener() {
       shareButton.removeEventListener("click", listener);
       is(shareButton.hasAttribute("shared"), true, "Share button should have 'shared' attribute after share button is clicked");
       is(shareButton.getAttribute("tooltiptext"), "Unshare this page", "check tooltip text is correct");
       is(shareStatusLabel.getAttribute("value"), "This page has been shared", "check status label text is correct");
       // Check the URL and offsets were applied correctly
-      is(shareButton.style.backgroundImage, 'url("https://example.com/browser/browser/base/content/test/social_share_image.png")', "check image url is correct");
+      is(shareButton.src, 'https://example.com/browser/browser/base/content/test/social_share_image.png', "check image url is correct");
       executeSoon(testSecondClick.bind(window, testPopupOKButton));
     });
     EventUtils.synthesizeMouseAtCenter(shareButton, {});
   }, "provider didn't provide user-recommend-prompt response");
 }
 
 function testSecondClick(nextTest) {
   let {shareButton, unsharePopup} = SocialShareButton;
--- a/browser/themes/gnomestripe/browser.css
+++ b/browser/themes/gnomestripe/browser.css
@@ -1373,21 +1373,16 @@ richlistitem[type~="action"][actiontype=
 
 /* Popup blocker button */
 #page-report-button {
   list-style-image: url("chrome://browser/skin/Info.png");
 }
 
 /* social recommending panel */
 
-#share-button {
-  width: 16px;
-  height: 16px;
-}
-
 #socialUserPortrait {
   width: 48px;
   height: 48px;
 }
 
 #socialUserDisplayName,
 #socialUserPortrait {
   cursor: pointer;
--- a/browser/themes/pinstripe/browser.css
+++ b/browser/themes/pinstripe/browser.css
@@ -1631,21 +1631,16 @@ window[tabsontop="false"] richlistitem[t
   #page-report-button:hover:active,
   #page-report-button[open="true"] {
     -moz-image-region: rect(0, 64px, 32px, 32px);
   }
 }
 
 /* social recommending panel */
 
-#share-button {
-  width: 16px;
-  height: 16px;
-}
-
 #socialUserPortrait {
   width: 48px;
   height: 48px;
 }
 
 #socialUserDisplayName,
 #socialUserPortrait {
   cursor: pointer;
--- a/browser/themes/winstripe/browser.css
+++ b/browser/themes/winstripe/browser.css
@@ -1635,21 +1635,16 @@ richlistitem[type~="action"][actiontype=
 
 #page-report-button:hover:active,
 #page-report-button[open="true"] {
   -moz-image-region: rect(0, 48px, 16px, 32px);
 }
 
 /* social recommending panel */
 
-#share-button {
-  width: 16px;
-  height: 16px;
-}
-
 #socialUserPortrait {
   width: 48px;
   height: 48px;
 }
 
 #socialUserDisplayName,
 #socialUserPortrait {
   cursor: pointer;