bug 797298 make logged out information icon themeable, r=markh
authorShane Caraveo <scaraveo@mozilla.com>
Mon, 04 Mar 2013 14:08:25 -0800
changeset 123868 dcf8ffe7a3a076f16b8ddc8529ac28ee77d316e6
parent 123867 1f3d297633e0253fb9e7a4566f43e99db870f057
child 123869 6de0da52f3a30ccd7495d8d8475cb2e593ca9241
push id1401
push userpastithas@mozilla.com
push dateThu, 07 Mar 2013 07:26:45 +0000
treeherderfx-team@ee4879719f78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs797298
milestone22.0a1
bug 797298 make logged out information icon themeable, r=markh
browser/base/content/browser-social.js
browser/base/content/test/social/browser_social_toolbar.js
browser/themes/linux/browser.css
browser/themes/osx/browser.css
browser/themes/windows/browser.css
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -579,17 +579,21 @@ let SocialShareButton = {
   // Called when the provider's profile info changes (or when the provider
   // changes, via updateProvider)
   updateProfileInfo: function SSB_updateProfileInfo() {
     let profileRow = document.getElementById("unsharePopupHeader");
     let profile = SocialUI.enabled ? Social.provider.profile : null;
     if (profile && profile.displayName) {
       profileRow.hidden = false;
       let portrait = document.getElementById("socialUserPortrait");
-      portrait.setAttribute("src", profile.portrait || "chrome://global/skin/icons/information-32.png");
+      if (profile.portrait) {
+        portrait.setAttribute("src", profile.portrait);
+      } else {
+        portrait.removeAttribute("src");
+      }
       let displayName = document.getElementById("socialUserDisplayName");
       displayName.setAttribute("label", profile.displayName);
     } else {
       profileRow.hidden = true;
       this.updateButtonHiddenState();
     }
   },
 
@@ -797,26 +801,31 @@ var SocialToolbar = {
 
   updateProfile: function SocialToolbar_updateProfile() {
     // Profile may not have been initialized yet, since it depends on a worker
     // response. In that case we'll be called again when it's available, via
     // social:profile-changed
     if (!Social.provider)
       return;
     let profile = Social.provider.profile || {};
-    let userPortrait = profile.portrait || "chrome://global/skin/icons/information-32.png";
+    let userPortrait = profile.portrait;
 
     let userDetailsBroadcaster = document.getElementById("socialBroadcaster_userDetails");
     let loggedInStatusValue = profile.userName ||
                               userDetailsBroadcaster.getAttribute("notLoggedInLabel");
 
     // "image" and "label" are used by Mac's native menus that do not render the menuitem's children
     // elements. "src" and "value" are used by the image/label children on the other platforms.
-    userDetailsBroadcaster.setAttribute("src", userPortrait);
-    userDetailsBroadcaster.setAttribute("image", userPortrait);
+    if (userPortrait) {
+      userDetailsBroadcaster.setAttribute("src", userPortrait);
+      userDetailsBroadcaster.setAttribute("image", userPortrait);
+    } else {
+      userDetailsBroadcaster.removeAttribute("src");
+      userDetailsBroadcaster.removeAttribute("image");
+    }
 
     userDetailsBroadcaster.setAttribute("value", loggedInStatusValue);
     userDetailsBroadcaster.setAttribute("label", loggedInStatusValue);
   },
 
   // XXX doesn't this need to be called for profile changes, given its use of provider.profile?
   updateButton: function SocialToolbar_updateButton() {
     this.updateButtonHiddenState();
--- a/browser/base/content/test/social/browser_social_toolbar.js
+++ b/browser/base/content/test/social/browser_social_toolbar.js
@@ -18,17 +18,17 @@ function test() {
 
 var tests = {
   testProfileNone: function(next, useNull) {
     let profile = useNull ? null : {};
     Social.provider.updateUserProfile(profile);
     // check dom values
     let portrait = document.getElementsByClassName("social-statusarea-user-portrait")[0].getAttribute("src");
     // this is the default image for the profile area when not logged in.
-    is(portrait, "chrome://global/skin/icons/information-32.png", "portrait is empty");
+    ok(!portrait, "portrait is empty");
     let userDetailsBroadcaster = document.getElementById("socialBroadcaster_userDetails");
     let notLoggedInStatusValue = userDetailsBroadcaster.getAttribute("notLoggedInLabel");
     let userButton = document.getElementsByClassName("social-statusarea-loggedInStatus")[0];
     ok(!userButton.hidden, "username is visible");
     is(userButton.getAttribute("label"), notLoggedInStatusValue, "label reflects not being logged in");
     next();
   },
   testProfileNull: function(next) {
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -1431,16 +1431,17 @@ richlistitem[type~="action"][actiontype=
 
 #share-button {
   -moz-image-region: rect(0, 16px, 16px, 0);
 }
 
 #socialUserPortrait {
   width: 48px;
   height: 48px;
+  list-style-image:url("chrome://global/skin/icons/information-32.png");
 }
 
 #socialUserDisplayName,
 #socialUserPortrait {
   cursor: pointer;
 }
 
 #socialUserDisplayName {
@@ -2137,16 +2138,20 @@ toolbar[mode="text"] toolbarbutton.chevr
 
 /* social toolbar provider menu */
 #social-statusarea-popup {
   margin-top: 0;
   margin-left: -12px;
   margin-right: -12px;
 }
 
+.social-statusarea-user {
+  list-style-image:url("chrome://global/skin/icons/information-32.png");
+}
+
 .social-statusarea-user-portrait {
   width: 32px;
   height: 32px;
   border-radius: 2px;
   margin: 10px;
 }
 
 .social-panel > .panel-arrowcontainer > .panel-arrowcontent {
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -1668,16 +1668,17 @@ window[tabsontop="false"] richlistitem[t
 
 #share-button {
   -moz-image-region: rect(0, 16px, 16px, 0);
 }
 
 #socialUserPortrait {
   width: 48px;
   height: 48px;
+  list-style-image:url("chrome://global/skin/icons/information-32.png");
 }
 
 #socialUserDisplayName,
 #socialUserPortrait {
   cursor: pointer;
 }
 
 #socialUserDisplayName {
@@ -3611,16 +3612,20 @@ toolbar[mode="icons"] > *|* > .social-no
 toolbar[mode="icons"] > *|* > .social-notification-container > .toolbarbutton-1[badge]:not([badge=""]):-moz-locale-dir(rtl)::after {
   left: -2px;
 }
 
 /* === end of social toolbar button === */
 
 /* === social toolbar provider menu  === */
 
+.social-statusarea-user {
+  list-style-image:url("chrome://global/skin/icons/information-32.png");
+}
+
 .social-statusarea-user-portrait {
   width: 32px;
   height: 32px;
   margin: 4px;
   -moz-margin-start: 0;
 }
 
 .social-panel > .panel-arrowcontainer > .panel-arrowcontent {
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -1609,16 +1609,17 @@ richlistitem[type~="action"][actiontype=
 
 #share-button {
   -moz-image-region: rect(0, 16px, 16px, 0);
 }
 
 #socialUserPortrait {
   width: 48px;
   height: 48px;
+  list-style-image:url("chrome://global/skin/icons/information-32.png");
 }
 
 #socialUserDisplayName,
 #socialUserPortrait {
   cursor: pointer;
 }
 
 #socialUserDisplayName {
@@ -2722,16 +2723,17 @@ toolbarbutton.bookmark-item[dragover="tr
 }
 
 .social-statusarea-user {
   -moz-appearance: none;
   border-bottom: 1px solid rgb(221,221,221);
   background-color: -moz-Dialog;
   position: relative;
   cursor: pointer;
+  list-style-image:url("chrome://global/skin/icons/information-32.png");
 }
 
 .social-statusarea-user-portrait {
   width: 32px;
   height: 32px;
   border-radius: 2px;
   margin: 10px;
 }