Bug 1062335 - Loop panel size increases after switching themes. r=mixedpuppy

--HG--
extra : rebase_source : f8c63b9dfc7de05d0b53908e72ab8c9083b95a49
This commit is contained in:
Jared Wein 2014-10-20 11:49:20 -04:00
parent ea34dcad39
commit d149f76f6a
2 changed files with 14 additions and 10 deletions

View File

@ -50,7 +50,7 @@ let PanelFrameInternal = {
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);
@ -157,11 +157,6 @@ let PanelFrame = {
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;
@ -169,6 +164,11 @@ let PanelFrame = {
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") {

View File

@ -421,13 +421,17 @@ function sizeSocialPanelToContent(panel, iframe) {
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);
}