Bug 1062335 - Loop panel size increases after switching themes. r=mixedpuppy, a=lmandel
--- a/browser/modules/PanelFrame.jsm
+++ b/browser/modules/PanelFrame.jsm
@@ -45,17 +45,17 @@ let PanelFrameInternal = {
* @param {String} aSize The initial size of the panel (width and height are the same
* if specified).
*/
_attachNotificatonPanel: function(aWindow, aParent, aButton, aType, aOrigin, aSrc, aSize) {
aParent.hidden = false;
let notificationFrameId = aOrigin ? aType + "-status-" + aOrigin : aType;
let frame = aWindow.document.getElementById(notificationFrameId);
- // If the button was customized to a new location, we we'll destroy the
+ // If the button was customized to a new location, destroy the
// iframe and start fresh.
if (frame && frame.parentNode != aParent) {
SharedFrame.forgetGroup(frame.id);
frame.parentNode.removeChild(frame);
frame = null;
}
if (!frame) {
@@ -152,28 +152,28 @@ let PanelFrame = {
dynamicResizer.stop();
notificationFrame.docShell.isActive = false;
dispatchPanelEvent(aType + "FrameHide");
});
panel.addEventListener("popupshown", function onpopupshown() {
panel.removeEventListener("popupshown", onpopupshown);
SharedFrame.setOwner(notificationFrameId, notificationFrame);
- // This attribute is needed on both the button and the
- // containing toolbaritem since the buttons on OS X have
- // moz-appearance:none, while their container gets
- // moz-appearance:toolbarbutton due to the way that toolbar buttons
- // get combined on OS X.
let initFrameShow = () => {
notificationFrame.docShell.isActive = true;
notificationFrame.docShell.isAppTab = true;
if (dynamicResizer)
dynamicResizer.start(panel, notificationFrame);
dispatchPanelEvent(aType + "FrameShow");
};
+ // This attribute is needed on both the button and the
+ // containing toolbaritem since the buttons on OS X have
+ // moz-appearance:none, while their container gets
+ // moz-appearance:toolbarbutton due to the way that toolbar buttons
+ // get combined on OS X.
anchorBtn.setAttribute("open", "true");
if (notificationFrame.contentDocument &&
notificationFrame.contentDocument.readyState == "complete") {
initFrameShow();
} else {
// first time load, wait for load and dispatch after load
notificationFrame.addEventListener("load", function panelBrowserOnload(e) {
notificationFrame.removeEventListener("load", panelBrowserOnload, true);
--- a/browser/modules/Social.jsm
+++ b/browser/modules/Social.jsm
@@ -416,23 +416,27 @@ function sizeSocialPanelToContent(panel,
// if the panel is preloaded prior to being shown, cs will be null. in that
// case use the minimum size for the panel until it is shown.
if (cs) {
let computedHeight = parseInt(cs.marginTop) + body.offsetHeight + parseInt(cs.marginBottom);
height = Math.max(computedHeight, height);
let computedWidth = parseInt(cs.marginLeft) + body.offsetWidth + parseInt(cs.marginRight);
width = Math.max(computedWidth, width);
}
- // add extra space the panel needs if any
- width += panel.boxObject.width - iframe.boxObject.width;
- height += panel.boxObject.height - iframe.boxObject.height;
+
+ // only add the extra space if the iframe has been loaded
+ if (iframe.boxObject.width && iframe.boxObject.height) {
+ // add extra space the panel needs if any
+ width += panel.boxObject.width - iframe.boxObject.width;
+ height += panel.boxObject.height - iframe.boxObject.height;
+ }
// when size is computed, we want to be sure changes are "significant" since
// some sites will resize when the iframe is resized by a small amount, making
- // the panel slowely shrink to some minimum.
+ // the panel slowly shrink to some minimum.
if (Math.abs(panel.boxObject.width - width) > 2 || Math.abs(panel.boxObject.height - height) > 2) {
panel.sizeTo(width, height);
}
}
function DynamicResizeWatcher() {
this._mutationObserver = null;
}