Bug 1247824 - Don't set the popup's size unless the width/height attributes exist. r=masayuki

This commit is contained in:
Neil Deakin 2016-06-09 13:21:01 +02:00
parent 2273c7b9f8
commit bbd2fd7ef4

View File

@ -524,6 +524,14 @@ nsXULPopupManager::PopupResized(nsIFrame* aFrame, LayoutDeviceIntSize aSize)
if (curDevSize.width == aSize.width && curDevSize.height == aSize.height)
return;
nsIContent* popup = menuPopupFrame->GetContent();
// Only set the width and height if the popup already has these attributes.
if (!popup->HasAttr(kNameSpaceID_None, nsGkAtoms::width) ||
!popup->HasAttr(kNameSpaceID_None, nsGkAtoms::height)) {
return;
}
// The size is different. Convert the actual size to css pixels and store it
// as 'width' and 'height' attributes on the popup.
nsPresContext* presContext = menuPopupFrame->PresContext();
@ -531,7 +539,6 @@ nsXULPopupManager::PopupResized(nsIFrame* aFrame, LayoutDeviceIntSize aSize)
CSSIntSize newCSS(presContext->DevPixelsToIntCSSPixels(aSize.width),
presContext->DevPixelsToIntCSSPixels(aSize.height));
nsIContent* popup = menuPopupFrame->GetContent();
nsAutoString width, height;
width.AppendInt(newCSS.width);
height.AppendInt(newCSS.height);