This commit is contained in:
kipp 1998-06-04 23:08:49 +00:00
Родитель d4ee4ef891
Коммит 35f737aeb1
6 изменённых файлов: 738 добавлений и 18 удалений

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

@ -477,9 +477,129 @@ nsBlockFrame::ReflowBlockChild(nsIFrame* aKidFrame,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
{
aStatus = ReflowChild(aKidFrame, aPresContext, aSpaceManager,
aDesiredSize, aReflowState, aDesiredRect);
return NS_OK;
nsIRunaround* reflowRunaround;
nsReflowStatus status;
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
// Get the band for this y-offset and see whether there are any floaters
// that have changed the left/right edges.
//
// XXX In order to do this efficiently we should move all this code to
// nsBlockFrame since it already has band data, and it's probably the only
// one who calls this routine anyway
nsBandData bandData;
nsBandTrapezoid trapezoids[12];
nsBandTrapezoid* trapezoid = trapezoids;
nsRect availBand;
bandData.trapezoids = trapezoids;
bandData.size = 12;
aSpaceManager->GetBandData(0, aReflowState.maxSize, bandData);
if (bandData.count > 1) {
// If there's more than one trapezoid that means there are floaters
PRInt32 i;
// Stop when we get to space occupied by a right floater, or when we've
// looked at every trapezoid and none are right floaters
for (i = 0; i < bandData.count; i++) {
nsBandTrapezoid* trapezoid = &trapezoids[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (PRInt32 i = 0; i < numFrames; i++) {
nsIFrame* f = (nsIFrame*)trapezoid->frames->ElementAt(i);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
goto foundRightFloater;
}
}
} else {
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
break;
}
}
}
}
foundRightFloater:
if (i > 0) {
trapezoid = &trapezoids[i - 1];
}
}
if (nsBandTrapezoid::Available == trapezoid->state) {
// The trapezoid is available
trapezoid->GetRect(availBand);
} else {
nsStyleDisplay* display;
// The trapezoid is occupied. That means there's no available space
trapezoid->GetRect(availBand);
// XXX Handle the case of multiple frames
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
availBand.x = availBand.XMost();
}
availBand.width = 0;
}
// Does the child frame support interface nsIRunaround?
if (NS_OK == aKidFrame->QueryInterface(kIRunaroundIID,
(void**)&reflowRunaround)) {
// Yes, the child frame wants to interact directly with the space
// manager.
reflowRunaround->Reflow(aPresContext, aSpaceManager, aDesiredSize, aReflowState,
aDesiredRect, status);
} else {
// No, use interface nsIFrame instead.
if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {
if ((availBand.x > 0) || (availBand.XMost() < aReflowState.maxSize.width)) {
// There are left/right floaters.
aReflowState.maxSize.width = availBand.width;
}
}
// XXX FIX ME
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, status);
// Return the desired rect
aDesiredRect.x = availBand.x;
aDesiredRect.y = 0;
aDesiredRect.width = aDesiredSize.width;
aDesiredRect.height = aDesiredSize.height;
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return status;
}
nsLineData*

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

@ -477,9 +477,129 @@ nsBlockFrame::ReflowBlockChild(nsIFrame* aKidFrame,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
{
aStatus = ReflowChild(aKidFrame, aPresContext, aSpaceManager,
aDesiredSize, aReflowState, aDesiredRect);
return NS_OK;
nsIRunaround* reflowRunaround;
nsReflowStatus status;
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
// Get the band for this y-offset and see whether there are any floaters
// that have changed the left/right edges.
//
// XXX In order to do this efficiently we should move all this code to
// nsBlockFrame since it already has band data, and it's probably the only
// one who calls this routine anyway
nsBandData bandData;
nsBandTrapezoid trapezoids[12];
nsBandTrapezoid* trapezoid = trapezoids;
nsRect availBand;
bandData.trapezoids = trapezoids;
bandData.size = 12;
aSpaceManager->GetBandData(0, aReflowState.maxSize, bandData);
if (bandData.count > 1) {
// If there's more than one trapezoid that means there are floaters
PRInt32 i;
// Stop when we get to space occupied by a right floater, or when we've
// looked at every trapezoid and none are right floaters
for (i = 0; i < bandData.count; i++) {
nsBandTrapezoid* trapezoid = &trapezoids[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (PRInt32 i = 0; i < numFrames; i++) {
nsIFrame* f = (nsIFrame*)trapezoid->frames->ElementAt(i);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
goto foundRightFloater;
}
}
} else {
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
break;
}
}
}
}
foundRightFloater:
if (i > 0) {
trapezoid = &trapezoids[i - 1];
}
}
if (nsBandTrapezoid::Available == trapezoid->state) {
// The trapezoid is available
trapezoid->GetRect(availBand);
} else {
nsStyleDisplay* display;
// The trapezoid is occupied. That means there's no available space
trapezoid->GetRect(availBand);
// XXX Handle the case of multiple frames
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
availBand.x = availBand.XMost();
}
availBand.width = 0;
}
// Does the child frame support interface nsIRunaround?
if (NS_OK == aKidFrame->QueryInterface(kIRunaroundIID,
(void**)&reflowRunaround)) {
// Yes, the child frame wants to interact directly with the space
// manager.
reflowRunaround->Reflow(aPresContext, aSpaceManager, aDesiredSize, aReflowState,
aDesiredRect, status);
} else {
// No, use interface nsIFrame instead.
if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {
if ((availBand.x > 0) || (availBand.XMost() < aReflowState.maxSize.width)) {
// There are left/right floaters.
aReflowState.maxSize.width = availBand.width;
}
}
// XXX FIX ME
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, status);
// Return the desired rect
aDesiredRect.x = availBand.x;
aDesiredRect.y = 0;
aDesiredRect.width = aDesiredSize.width;
aDesiredRect.height = aDesiredSize.height;
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return status;
}
nsLineData*

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

@ -477,9 +477,129 @@ nsBlockFrame::ReflowBlockChild(nsIFrame* aKidFrame,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
{
aStatus = ReflowChild(aKidFrame, aPresContext, aSpaceManager,
aDesiredSize, aReflowState, aDesiredRect);
return NS_OK;
nsIRunaround* reflowRunaround;
nsReflowStatus status;
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
// Get the band for this y-offset and see whether there are any floaters
// that have changed the left/right edges.
//
// XXX In order to do this efficiently we should move all this code to
// nsBlockFrame since it already has band data, and it's probably the only
// one who calls this routine anyway
nsBandData bandData;
nsBandTrapezoid trapezoids[12];
nsBandTrapezoid* trapezoid = trapezoids;
nsRect availBand;
bandData.trapezoids = trapezoids;
bandData.size = 12;
aSpaceManager->GetBandData(0, aReflowState.maxSize, bandData);
if (bandData.count > 1) {
// If there's more than one trapezoid that means there are floaters
PRInt32 i;
// Stop when we get to space occupied by a right floater, or when we've
// looked at every trapezoid and none are right floaters
for (i = 0; i < bandData.count; i++) {
nsBandTrapezoid* trapezoid = &trapezoids[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (PRInt32 i = 0; i < numFrames; i++) {
nsIFrame* f = (nsIFrame*)trapezoid->frames->ElementAt(i);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
goto foundRightFloater;
}
}
} else {
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
break;
}
}
}
}
foundRightFloater:
if (i > 0) {
trapezoid = &trapezoids[i - 1];
}
}
if (nsBandTrapezoid::Available == trapezoid->state) {
// The trapezoid is available
trapezoid->GetRect(availBand);
} else {
nsStyleDisplay* display;
// The trapezoid is occupied. That means there's no available space
trapezoid->GetRect(availBand);
// XXX Handle the case of multiple frames
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
availBand.x = availBand.XMost();
}
availBand.width = 0;
}
// Does the child frame support interface nsIRunaround?
if (NS_OK == aKidFrame->QueryInterface(kIRunaroundIID,
(void**)&reflowRunaround)) {
// Yes, the child frame wants to interact directly with the space
// manager.
reflowRunaround->Reflow(aPresContext, aSpaceManager, aDesiredSize, aReflowState,
aDesiredRect, status);
} else {
// No, use interface nsIFrame instead.
if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {
if ((availBand.x > 0) || (availBand.XMost() < aReflowState.maxSize.width)) {
// There are left/right floaters.
aReflowState.maxSize.width = availBand.width;
}
}
// XXX FIX ME
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, status);
// Return the desired rect
aDesiredRect.x = availBand.x;
aDesiredRect.y = 0;
aDesiredRect.width = aDesiredSize.width;
aDesiredRect.height = aDesiredSize.height;
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return status;
}
nsLineData*

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

@ -477,9 +477,129 @@ nsBlockFrame::ReflowBlockChild(nsIFrame* aKidFrame,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
{
aStatus = ReflowChild(aKidFrame, aPresContext, aSpaceManager,
aDesiredSize, aReflowState, aDesiredRect);
return NS_OK;
nsIRunaround* reflowRunaround;
nsReflowStatus status;
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
// Get the band for this y-offset and see whether there are any floaters
// that have changed the left/right edges.
//
// XXX In order to do this efficiently we should move all this code to
// nsBlockFrame since it already has band data, and it's probably the only
// one who calls this routine anyway
nsBandData bandData;
nsBandTrapezoid trapezoids[12];
nsBandTrapezoid* trapezoid = trapezoids;
nsRect availBand;
bandData.trapezoids = trapezoids;
bandData.size = 12;
aSpaceManager->GetBandData(0, aReflowState.maxSize, bandData);
if (bandData.count > 1) {
// If there's more than one trapezoid that means there are floaters
PRInt32 i;
// Stop when we get to space occupied by a right floater, or when we've
// looked at every trapezoid and none are right floaters
for (i = 0; i < bandData.count; i++) {
nsBandTrapezoid* trapezoid = &trapezoids[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (PRInt32 i = 0; i < numFrames; i++) {
nsIFrame* f = (nsIFrame*)trapezoid->frames->ElementAt(i);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
goto foundRightFloater;
}
}
} else {
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
break;
}
}
}
}
foundRightFloater:
if (i > 0) {
trapezoid = &trapezoids[i - 1];
}
}
if (nsBandTrapezoid::Available == trapezoid->state) {
// The trapezoid is available
trapezoid->GetRect(availBand);
} else {
nsStyleDisplay* display;
// The trapezoid is occupied. That means there's no available space
trapezoid->GetRect(availBand);
// XXX Handle the case of multiple frames
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
availBand.x = availBand.XMost();
}
availBand.width = 0;
}
// Does the child frame support interface nsIRunaround?
if (NS_OK == aKidFrame->QueryInterface(kIRunaroundIID,
(void**)&reflowRunaround)) {
// Yes, the child frame wants to interact directly with the space
// manager.
reflowRunaround->Reflow(aPresContext, aSpaceManager, aDesiredSize, aReflowState,
aDesiredRect, status);
} else {
// No, use interface nsIFrame instead.
if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {
if ((availBand.x > 0) || (availBand.XMost() < aReflowState.maxSize.width)) {
// There are left/right floaters.
aReflowState.maxSize.width = availBand.width;
}
}
// XXX FIX ME
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, status);
// Return the desired rect
aDesiredRect.x = availBand.x;
aDesiredRect.y = 0;
aDesiredRect.width = aDesiredSize.width;
aDesiredRect.height = aDesiredSize.height;
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return status;
}
nsLineData*

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

@ -477,9 +477,129 @@ nsBlockFrame::ReflowBlockChild(nsIFrame* aKidFrame,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
{
aStatus = ReflowChild(aKidFrame, aPresContext, aSpaceManager,
aDesiredSize, aReflowState, aDesiredRect);
return NS_OK;
nsIRunaround* reflowRunaround;
nsReflowStatus status;
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
// Get the band for this y-offset and see whether there are any floaters
// that have changed the left/right edges.
//
// XXX In order to do this efficiently we should move all this code to
// nsBlockFrame since it already has band data, and it's probably the only
// one who calls this routine anyway
nsBandData bandData;
nsBandTrapezoid trapezoids[12];
nsBandTrapezoid* trapezoid = trapezoids;
nsRect availBand;
bandData.trapezoids = trapezoids;
bandData.size = 12;
aSpaceManager->GetBandData(0, aReflowState.maxSize, bandData);
if (bandData.count > 1) {
// If there's more than one trapezoid that means there are floaters
PRInt32 i;
// Stop when we get to space occupied by a right floater, or when we've
// looked at every trapezoid and none are right floaters
for (i = 0; i < bandData.count; i++) {
nsBandTrapezoid* trapezoid = &trapezoids[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (PRInt32 i = 0; i < numFrames; i++) {
nsIFrame* f = (nsIFrame*)trapezoid->frames->ElementAt(i);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
goto foundRightFloater;
}
}
} else {
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
break;
}
}
}
}
foundRightFloater:
if (i > 0) {
trapezoid = &trapezoids[i - 1];
}
}
if (nsBandTrapezoid::Available == trapezoid->state) {
// The trapezoid is available
trapezoid->GetRect(availBand);
} else {
nsStyleDisplay* display;
// The trapezoid is occupied. That means there's no available space
trapezoid->GetRect(availBand);
// XXX Handle the case of multiple frames
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
availBand.x = availBand.XMost();
}
availBand.width = 0;
}
// Does the child frame support interface nsIRunaround?
if (NS_OK == aKidFrame->QueryInterface(kIRunaroundIID,
(void**)&reflowRunaround)) {
// Yes, the child frame wants to interact directly with the space
// manager.
reflowRunaround->Reflow(aPresContext, aSpaceManager, aDesiredSize, aReflowState,
aDesiredRect, status);
} else {
// No, use interface nsIFrame instead.
if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {
if ((availBand.x > 0) || (availBand.XMost() < aReflowState.maxSize.width)) {
// There are left/right floaters.
aReflowState.maxSize.width = availBand.width;
}
}
// XXX FIX ME
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, status);
// Return the desired rect
aDesiredRect.x = availBand.x;
aDesiredRect.y = 0;
aDesiredRect.width = aDesiredSize.width;
aDesiredRect.height = aDesiredSize.height;
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return status;
}
nsLineData*

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

@ -477,9 +477,129 @@ nsBlockFrame::ReflowBlockChild(nsIFrame* aKidFrame,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
{
aStatus = ReflowChild(aKidFrame, aPresContext, aSpaceManager,
aDesiredSize, aReflowState, aDesiredRect);
return NS_OK;
nsIRunaround* reflowRunaround;
nsReflowStatus status;
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
// Get the band for this y-offset and see whether there are any floaters
// that have changed the left/right edges.
//
// XXX In order to do this efficiently we should move all this code to
// nsBlockFrame since it already has band data, and it's probably the only
// one who calls this routine anyway
nsBandData bandData;
nsBandTrapezoid trapezoids[12];
nsBandTrapezoid* trapezoid = trapezoids;
nsRect availBand;
bandData.trapezoids = trapezoids;
bandData.size = 12;
aSpaceManager->GetBandData(0, aReflowState.maxSize, bandData);
if (bandData.count > 1) {
// If there's more than one trapezoid that means there are floaters
PRInt32 i;
// Stop when we get to space occupied by a right floater, or when we've
// looked at every trapezoid and none are right floaters
for (i = 0; i < bandData.count; i++) {
nsBandTrapezoid* trapezoid = &trapezoids[i];
if (trapezoid->state != nsBandTrapezoid::Available) {
nsStyleDisplay* display;
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->state) {
PRInt32 numFrames = trapezoid->frames->Count();
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
for (PRInt32 i = 0; i < numFrames; i++) {
nsIFrame* f = (nsIFrame*)trapezoid->frames->ElementAt(i);
f->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
goto foundRightFloater;
}
}
} else {
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
break;
}
}
}
}
foundRightFloater:
if (i > 0) {
trapezoid = &trapezoids[i - 1];
}
}
if (nsBandTrapezoid::Available == trapezoid->state) {
// The trapezoid is available
trapezoid->GetRect(availBand);
} else {
nsStyleDisplay* display;
// The trapezoid is occupied. That means there's no available space
trapezoid->GetRect(availBand);
// XXX Handle the case of multiple frames
trapezoid->frame->GetStyleData(eStyleStruct_Display, (nsStyleStruct*&)display);
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
availBand.x = availBand.XMost();
}
availBand.width = 0;
}
// Does the child frame support interface nsIRunaround?
if (NS_OK == aKidFrame->QueryInterface(kIRunaroundIID,
(void**)&reflowRunaround)) {
// Yes, the child frame wants to interact directly with the space
// manager.
reflowRunaround->Reflow(aPresContext, aSpaceManager, aDesiredSize, aReflowState,
aDesiredRect, status);
} else {
// No, use interface nsIFrame instead.
if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {
if ((availBand.x > 0) || (availBand.XMost() < aReflowState.maxSize.width)) {
// There are left/right floaters.
aReflowState.maxSize.width = availBand.width;
}
}
// XXX FIX ME
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, status);
// Return the desired rect
aDesiredRect.x = availBand.x;
aDesiredRect.y = 0;
aDesiredRect.width = aDesiredSize.width;
aDesiredRect.height = aDesiredSize.height;
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return status;
}
nsLineData*