Fix positioning of fixed and absolute positioned blocks with auto left

or top.  Bug 126213, r=dbaron, sr=attinasi
This commit is contained in:
bzbarsky%mit.edu 2002-05-17 00:05:27 +00:00
Родитель e570523373
Коммит 2daed17185
4 изменённых файлов: 48 добавлений и 52 удалений

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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,