b=25223. Block code now does a better job of determing where the floater

should go before reflowing it
This commit is contained in:
troy%netscape.com 2000-01-29 00:47:33 +00:00
Родитель 76c6c9dcd2
Коммит 7c5823dbda
8 изменённых файлов: 86 добавлений и 8 удалений

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

@ -5098,7 +5098,12 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// Reflow the floater. Since floaters are continued we given them an
// unbounded height. Floaters with an auto width are sized to zero
// according to the css2 spec.
nsRect availSpace(0, 0, aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
// XXX We also need to take into account whether we should clear any
// preceeding floaters...
// XXX Why do we have to add in our border/padding?
nsRect availSpace(aState.mAvailSpaceRect.x + aState.BorderPadding().left,
aState.mAvailSpaceRect.y + aState.BorderPadding().top,
aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();

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

@ -338,8 +338,32 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
// reflow auto left/right margins will have a zero value.
mMargin = reflowState.mComputedMargin;
mStyleSpacing = reflowState.mStyleSpacing;
nscoord x = aSpace.x + mMargin.left;
nscoord x;
nscoord y = aSpace.y + topMargin;
// If it's a right floated element, then calculate the x-offset
// differently
if (NS_STYLE_FLOAT_RIGHT == reflowState.mStyleDisplay->mFloats) {
nscoord frameWidth;
if (NS_UNCONSTRAINEDSIZE == reflowState.mComputedWidth) {
nsSize frameSize;
// Use the current frame width
aFrame->GetSize(frameSize);
frameWidth = frameSize.width;
} else {
frameWidth = reflowState.mComputedWidth +
reflowState.mComputedBorderPadding.left +
reflowState.mComputedBorderPadding.right;
}
x = aSpace.XMost() - mMargin.right - frameWidth;
} else {
x = aSpace.x + mMargin.left;
}
mX = x;
mY = y;

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

@ -5098,7 +5098,12 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// Reflow the floater. Since floaters are continued we given them an
// unbounded height. Floaters with an auto width are sized to zero
// according to the css2 spec.
nsRect availSpace(0, 0, aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
// XXX We also need to take into account whether we should clear any
// preceeding floaters...
// XXX Why do we have to add in our border/padding?
nsRect availSpace(aState.mAvailSpaceRect.x + aState.BorderPadding().left,
aState.mAvailSpaceRect.y + aState.BorderPadding().top,
aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();

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

@ -5098,7 +5098,12 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// Reflow the floater. Since floaters are continued we given them an
// unbounded height. Floaters with an auto width are sized to zero
// according to the css2 spec.
nsRect availSpace(0, 0, aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
// XXX We also need to take into account whether we should clear any
// preceeding floaters...
// XXX Why do we have to add in our border/padding?
nsRect availSpace(aState.mAvailSpaceRect.x + aState.BorderPadding().left,
aState.mAvailSpaceRect.y + aState.BorderPadding().top,
aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();

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

@ -5098,7 +5098,12 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// Reflow the floater. Since floaters are continued we given them an
// unbounded height. Floaters with an auto width are sized to zero
// according to the css2 spec.
nsRect availSpace(0, 0, aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
// XXX We also need to take into account whether we should clear any
// preceeding floaters...
// XXX Why do we have to add in our border/padding?
nsRect availSpace(aState.mAvailSpaceRect.x + aState.BorderPadding().left,
aState.mAvailSpaceRect.y + aState.BorderPadding().top,
aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();

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

@ -338,8 +338,32 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
// reflow auto left/right margins will have a zero value.
mMargin = reflowState.mComputedMargin;
mStyleSpacing = reflowState.mStyleSpacing;
nscoord x = aSpace.x + mMargin.left;
nscoord x;
nscoord y = aSpace.y + topMargin;
// If it's a right floated element, then calculate the x-offset
// differently
if (NS_STYLE_FLOAT_RIGHT == reflowState.mStyleDisplay->mFloats) {
nscoord frameWidth;
if (NS_UNCONSTRAINEDSIZE == reflowState.mComputedWidth) {
nsSize frameSize;
// Use the current frame width
aFrame->GetSize(frameSize);
frameWidth = frameSize.width;
} else {
frameWidth = reflowState.mComputedWidth +
reflowState.mComputedBorderPadding.left +
reflowState.mComputedBorderPadding.right;
}
x = aSpace.XMost() - mMargin.right - frameWidth;
} else {
x = aSpace.x + mMargin.left;
}
mX = x;
mY = y;

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

@ -5098,7 +5098,12 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// Reflow the floater. Since floaters are continued we given them an
// unbounded height. Floaters with an auto width are sized to zero
// according to the css2 spec.
nsRect availSpace(0, 0, aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
// XXX We also need to take into account whether we should clear any
// preceeding floaters...
// XXX Why do we have to add in our border/padding?
nsRect availSpace(aState.mAvailSpaceRect.x + aState.BorderPadding().left,
aState.mAvailSpaceRect.y + aState.BorderPadding().top,
aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();

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

@ -5098,7 +5098,12 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
// Reflow the floater. Since floaters are continued we given them an
// unbounded height. Floaters with an auto width are sized to zero
// according to the css2 spec.
nsRect availSpace(0, 0, aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
// XXX We also need to take into account whether we should clear any
// preceeding floaters...
// XXX Why do we have to add in our border/padding?
nsRect availSpace(aState.mAvailSpaceRect.x + aState.BorderPadding().left,
aState.mAvailSpaceRect.y + aState.BorderPadding().top,
aState.mAvailSpaceRect.width, NS_UNCONSTRAINEDSIZE);
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();