From 5a398331a81a3713f849e58f5cf82529991ca8c3 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 17 May 2002 00:05:27 +0000 Subject: [PATCH] Fix positioning of fixed and absolute positioned blocks with auto left or top. Bug 126213, r=dbaron, sr=attinasi git-svn-id: svn://10.0.0.236/trunk@121700 18797224-902f-48f8-a5cc-f745e15eee43 --- .../generic/nsAbsoluteContainingBlock.cpp | 14 ++++---- mozilla/layout/generic/nsViewportFrame.cpp | 36 +++++++++---------- .../base/src/nsAbsoluteContainingBlock.cpp | 14 ++++---- .../layout/html/base/src/nsViewportFrame.cpp | 36 +++++++++---------- 4 files changed, 48 insertions(+), 52 deletions(-) diff --git a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp index c47ccc8b37e..4e8988f0886 100644 --- a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp @@ -456,15 +456,17 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) { kidReflowState.mComputedOffsets.left = aContainingBlockWidth - - kidReflowState.mComputedOffsets.right - kidReflowState.mComputedMargin.right - - kidReflowState.mComputedBorderPadding.right - kidDesiredSize.width - - kidReflowState.mComputedMargin.left - kidReflowState.mComputedBorderPadding.left; + kidReflowState.mComputedOffsets.right - + kidReflowState.mComputedMargin.right - + kidDesiredSize.width - + kidReflowState.mComputedMargin.left; } if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) { kidReflowState.mComputedOffsets.top = aContainingBlockHeight - - kidReflowState.mComputedOffsets.bottom - kidReflowState.mComputedMargin.bottom - - kidReflowState.mComputedBorderPadding.bottom - kidDesiredSize.height - - kidReflowState.mComputedMargin.top - kidReflowState.mComputedBorderPadding.top; + kidReflowState.mComputedOffsets.bottom - + kidReflowState.mComputedMargin.bottom - + kidDesiredSize.height - + kidReflowState.mComputedMargin.top; } } diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index a8b3977787f..f1fdcf962b1 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -375,32 +375,28 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext* aPresContext, // Do the reflow rv = aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowState, aStatus); - if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) - kidReflowState.mComputedOffsets.left = aReflowState.mComputedWidth - - kidReflowState.mComputedOffsets.right - - kidReflowState.mComputedMargin.right - - kidReflowState.mComputedBorderPadding.right - - kidDesiredSize.width - - kidReflowState.mComputedBorderPadding.left - - kidReflowState.mComputedMargin.left; - if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) - kidReflowState.mComputedOffsets.top = aReflowState.mComputedHeight - - kidReflowState.mComputedOffsets.bottom - - kidReflowState.mComputedMargin.bottom - - kidReflowState.mComputedBorderPadding.bottom - - kidDesiredSize.height - - kidReflowState.mComputedBorderPadding.top - - kidReflowState.mComputedMargin.top; - // XXX If the child had a fixed height, then make sure it respected it... if (NS_AUTOHEIGHT != kidReflowState.mComputedHeight) { if (kidDesiredSize.height < kidReflowState.mComputedHeight) { - kidDesiredSize.height = kidReflowState.mComputedHeight; - kidDesiredSize.height += kidReflowState.mComputedBorderPadding.top + - kidReflowState.mComputedBorderPadding.bottom; + kidDesiredSize.height = kidReflowState.mComputedHeight + + kidReflowState.mComputedBorderPadding.top + + kidReflowState.mComputedBorderPadding.bottom; } } + if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) + kidReflowState.mComputedOffsets.left = aReflowState.mComputedWidth - + kidReflowState.mComputedOffsets.right - + kidReflowState.mComputedMargin.right - + kidDesiredSize.width - + kidReflowState.mComputedMargin.left; + if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) + kidReflowState.mComputedOffsets.top = aReflowState.mComputedHeight - + kidReflowState.mComputedOffsets.bottom - + kidReflowState.mComputedMargin.bottom - + kidDesiredSize.height - + kidReflowState.mComputedMargin.top; + // Position the child nsRect rect(kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left, kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top, diff --git a/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp b/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp index c47ccc8b37e..4e8988f0886 100644 --- a/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp +++ b/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp @@ -456,15 +456,17 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) { kidReflowState.mComputedOffsets.left = aContainingBlockWidth - - kidReflowState.mComputedOffsets.right - kidReflowState.mComputedMargin.right - - kidReflowState.mComputedBorderPadding.right - kidDesiredSize.width - - kidReflowState.mComputedMargin.left - kidReflowState.mComputedBorderPadding.left; + kidReflowState.mComputedOffsets.right - + kidReflowState.mComputedMargin.right - + kidDesiredSize.width - + kidReflowState.mComputedMargin.left; } if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) { kidReflowState.mComputedOffsets.top = aContainingBlockHeight - - kidReflowState.mComputedOffsets.bottom - kidReflowState.mComputedMargin.bottom - - kidReflowState.mComputedBorderPadding.bottom - kidDesiredSize.height - - kidReflowState.mComputedMargin.top - kidReflowState.mComputedBorderPadding.top; + kidReflowState.mComputedOffsets.bottom - + kidReflowState.mComputedMargin.bottom - + kidDesiredSize.height - + kidReflowState.mComputedMargin.top; } } diff --git a/mozilla/layout/html/base/src/nsViewportFrame.cpp b/mozilla/layout/html/base/src/nsViewportFrame.cpp index a8b3977787f..f1fdcf962b1 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.cpp +++ b/mozilla/layout/html/base/src/nsViewportFrame.cpp @@ -375,32 +375,28 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext* aPresContext, // Do the reflow rv = aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowState, aStatus); - if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) - kidReflowState.mComputedOffsets.left = aReflowState.mComputedWidth - - kidReflowState.mComputedOffsets.right - - kidReflowState.mComputedMargin.right - - kidReflowState.mComputedBorderPadding.right - - kidDesiredSize.width - - kidReflowState.mComputedBorderPadding.left - - kidReflowState.mComputedMargin.left; - if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) - kidReflowState.mComputedOffsets.top = aReflowState.mComputedHeight - - kidReflowState.mComputedOffsets.bottom - - kidReflowState.mComputedMargin.bottom - - kidReflowState.mComputedBorderPadding.bottom - - kidDesiredSize.height - - kidReflowState.mComputedBorderPadding.top - - kidReflowState.mComputedMargin.top; - // XXX If the child had a fixed height, then make sure it respected it... if (NS_AUTOHEIGHT != kidReflowState.mComputedHeight) { if (kidDesiredSize.height < kidReflowState.mComputedHeight) { - kidDesiredSize.height = kidReflowState.mComputedHeight; - kidDesiredSize.height += kidReflowState.mComputedBorderPadding.top + - kidReflowState.mComputedBorderPadding.bottom; + kidDesiredSize.height = kidReflowState.mComputedHeight + + kidReflowState.mComputedBorderPadding.top + + kidReflowState.mComputedBorderPadding.bottom; } } + if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) + kidReflowState.mComputedOffsets.left = aReflowState.mComputedWidth - + kidReflowState.mComputedOffsets.right - + kidReflowState.mComputedMargin.right - + kidDesiredSize.width - + kidReflowState.mComputedMargin.left; + if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) + kidReflowState.mComputedOffsets.top = aReflowState.mComputedHeight - + kidReflowState.mComputedOffsets.bottom - + kidReflowState.mComputedMargin.bottom - + kidDesiredSize.height - + kidReflowState.mComputedMargin.top; + // Position the child nsRect rect(kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left, kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top,