diff --git a/layout/css/layout/src/nsCSSBlockFrame.cpp b/layout/css/layout/src/nsCSSBlockFrame.cpp index 255f46bcf01..86d8202d2c0 100644 --- a/layout/css/layout/src/nsCSSBlockFrame.cpp +++ b/layout/css/layout/src/nsCSSBlockFrame.cpp @@ -1422,6 +1422,13 @@ nsCSSBlockFrame::ComputeFinalSize(nsCSSBlockReflowState& aState, aMetrics.descent = 0; if (aState.mComputeMaxElementSize) { *aMetrics.maxElementSize = aState.mMaxElementSize; + + // Add in our border and padding to the max-element-size so that + // we don't shrink too far. + aMetrics.maxElementSize->width += aState.mBorderPadding.left + + aState.mBorderPadding.right; + aMetrics.maxElementSize->height += aState.mBorderPadding.top + + aState.mBorderPadding.bottom; } NS_ASSERTION(aDesiredRect.width < 1000000, "whoops"); } diff --git a/layout/css/layout/src/nsCSSInlineFrame.cpp b/layout/css/layout/src/nsCSSInlineFrame.cpp index 7ecdfeab316..95180493ac8 100644 --- a/layout/css/layout/src/nsCSSInlineFrame.cpp +++ b/layout/css/layout/src/nsCSSInlineFrame.cpp @@ -381,6 +381,13 @@ nsCSSInlineFrame::ComputeFinalSize(nsCSSInlineReflowState& aState, else { *aMetrics.maxElementSize = aState.mInlineLayout.mMaxElementSize; } + + // Add in our border and padding to the max-element-size so that + // we don't shrink too far. + aMetrics.maxElementSize->width += aState.mBorderPadding.left + + aState.mBorderPadding.right; + aMetrics.maxElementSize->height += aState.mBorderPadding.top + + aState.mBorderPadding.bottom; } }