Skip to content

Commit

Permalink
changes to widget to get some default window styles
Browse files Browse the repository at this point in the history
(cherry picked from commit da8fc9b)
  • Loading branch information
dglol authored and Wes Kocher committed Mar 5, 2012
1 parent bc99d37 commit d6cb0c3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/addon-kit/lib/widget.js
Expand Up @@ -817,6 +817,7 @@ WidgetChrome._isImageDoc = function WC__isImageDoc(doc) {
WidgetChrome.prototype.addEventHandlers = function WC_addEventHandlers() {
let contentType = this.getContentType();

let container = this._doc.getElementById("addon-bar");
let self = this;
let listener = function(e) {
// Ignore event firings that target the iframe.
Expand Down Expand Up @@ -845,8 +846,8 @@ WidgetChrome.prototype.addEventHandlers = function WC_addEventHandlers() {

// On document load, make modifications required for nice default
// presentation.
let self = this;
function loadListener(e) {
let containerStyle = self.window.getComputedStyle(container);
// Ignore event firings that target the iframe
if (e.target == iframe)
return;
Expand All @@ -866,6 +867,12 @@ WidgetChrome.prototype.addEventHandlers = function WC_addEventHandlers() {
doc.body.firstElementChild.style.height = "16px";
}

// Extend the add-on bar's default text styles to the widget.
doc.body.style.color = containerStyle.color;
doc.body.style.fontFamily = containerStyle.fontFamily;
doc.body.style.fontSize = containerStyle.fontSize;
doc.body.style.fontWeight = containerStyle.fontWeight;
doc.body.style.textShadow = containerStyle.textShadow;
// Allow all content to fill the box by default.
doc.body.style.margin = "0";
}
Expand Down

0 comments on commit d6cb0c3

Please sign in to comment.