From 94a5d4ca9d1df816efbbf93d441ca75117109bed Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Tue, 19 Jul 2005 22:06:39 +0000 Subject: [PATCH] Bug 294934. Absolute positioning should be relative to the padding edge, so we need to set the absolute containing block size to the size of the padding-box of any wrapper frame. r+sr=dbaron,a=bsmedberg --- layout/generic/nsBlockFrame.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index ac561ffbdec9..e6ef4c65a437 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -605,13 +605,17 @@ CalculateContainingBlockSizeForAbsolutes(const nsHTMLReflowState& aReflowState, aLastRS = aLastRS->parentReflowState; } if (aLastRS != &aReflowState) { + // The wrapper frame should be block-level. If it isn't, how the + // heck did it end up wrapping this block frame? + NS_ASSERTION(aLastRS->frame->GetStyleDisplay()->IsBlockLevel(), + "Wrapping frame should be block-level"); // We found a reflow state for the outermost wrapping frame, so use // its computed metrics if available if (aLastRS->mComputedWidth != NS_UNCONSTRAINEDSIZE) { - cbSize.width = aLastRS->mComputedWidth; + cbSize.width = aLastRS->mComputedWidth + aLastRS->mComputedPadding.LeftRight(); } if (aLastRS->mComputedHeight != NS_UNCONSTRAINEDSIZE) { - cbSize.height = aLastRS->mComputedHeight; + cbSize.height = aLastRS->mComputedHeight + aLastRS->mComputedPadding.TopBottom(); } } }