Don't resize widgets to negative sizes. Bug 397871, r+sr=roc, a=beltzner.

This commit is contained in:
bzbarsky@mit.edu 2007-11-23 15:18:08 -08:00
parent 39e2a45b3f
commit ff237c9fd5

View File

@ -562,8 +562,15 @@ nsSubDocumentFrame::ReflowFinished()
nsSize innerSize(GetSize());
if (IsInline()) {
nsMargin usedBorderPadding = GetUsedBorderAndPadding();
// Sadly, XUL smacks the frame size without changing the used
// border and padding, so we can't trust those. Subtracting
// them might make things negative.
innerSize.width -= usedBorderPadding.LeftRight();
innerSize.width = PR_MAX(innerSize.width, 0);
innerSize.height -= usedBorderPadding.TopBottom();
innerSize.height = PR_MAX(innerSize.height, 0);
}
PRInt32 cx = presContext->AppUnitsToDevPixels(innerSize.width);