Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bug 718015 - Extend add-on bar's text style to widgets #352

Merged
merged 2 commits into from about 2 years ago

4 participants

David Guo Irakli Gozalishvili ochameau KWierso
David Guo

Currently does not take effect when the persona is changed, but on the next load. I couldn't find an event that works best with persona changes and did not want to create overhead with mutation events.

Irakli Gozalishvili
Collaborator

Thanks @dglol ! @ochameau could you please take a look, I think you were looking into these styling issues before.

packages/addon-kit/lib/widget.js
@@ -815,6 +815,7 @@ WidgetChrome._isImageDoc = function WC__isImageDoc(doc) {
815 815
 WidgetChrome.prototype.addEventHandlers = function WC_addEventHandlers() {
816 816
   let contentType = this.getContentType();
817 817
 
  818
+  let container = this._doc.getElementById("addon-bar");
1
ochameau Collaborator

You should not assume that the widget will be in addon-bar. Actually, the user may have moved it to the url-bar.
https://github.com/dglol/addon-sdk/blob/da8fc9b60a6ecc668194d15d5d624587e3c18208/packages/addon-kit/lib/widget.js#L614

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
ochameau
Collaborator

Looks good, works fine!

I found some events dispatched by firefox:
http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/LightweightThemeManager.jsm#275
(that's not the only one, search for "notifyObservers" calls)

I'd be more than happy to re-review this patch or a new one if you feel improving personas support again :)

ochameau ochameau merged commit e9eb864 into from February 29, 2012
ochameau ochameau closed this February 29, 2012
KWierso
Collaborator

Just for bookkeeping records, I just cherrypicked this onto the stabilization branch for the 1.6 release. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  packages/addon-kit/lib/widget.js
8  packages/addon-kit/lib/widget.js
@@ -843,8 +843,8 @@ WidgetChrome.prototype.addEventHandlers = function WC_addEventHandlers() {
843 843
   
844 844
   // On document load, make modifications required for nice default
845 845
   // presentation.
846  
-  let self = this;
847 846
   function loadListener(e) {
  847
+    let containerStyle = self.window.getComputedStyle(self.node.parentNode);
848 848
     // Ignore event firings that target the iframe
849 849
     if (e.target == iframe)
850 850
       return;
@@ -864,6 +864,12 @@ WidgetChrome.prototype.addEventHandlers = function WC_addEventHandlers() {
864 864
       doc.body.firstElementChild.style.height = "16px";
865 865
     }
866 866
 
  867
+    // Extend the add-on bar's default text styles to the widget.
  868
+    doc.body.style.color = containerStyle.color;
  869
+    doc.body.style.fontFamily = containerStyle.fontFamily;
  870
+    doc.body.style.fontSize = containerStyle.fontSize;
  871
+    doc.body.style.fontWeight = containerStyle.fontWeight;
  872
+    doc.body.style.textShadow = containerStyle.textShadow;
867 873
     // Allow all content to fill the box by default.
868 874
     doc.body.style.margin = "0";
869 875
   }
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.