diff --git a/layout/base/src/nsContainerFrame.cpp b/layout/base/src/nsContainerFrame.cpp index 521c2deebed..ef0ea6b994a 100644 --- a/layout/base/src/nsContainerFrame.cpp +++ b/layout/base/src/nsContainerFrame.cpp @@ -431,8 +431,6 @@ PRBool nsContainerFrame::IsPseudoFrame() const // Returns true if aChild is being used as a pseudo frame PRBool nsContainerFrame::ChildIsPseudoFrame(const nsIFrame* aChild) const { - NS_PRECONDITION(IsChild(aChild), "bad geometric parent"); - nsIContent* childContent; PRBool result; @@ -483,149 +481,6 @@ nsReflowStatus nsContainerFrame::ReflowChild(nsIFrame* aKidFrame, return status; } -/** - * Reflow a child frame and return the status of the reflow. If the child - * is complete and it has next-in-flows, then delete the next-in-flows. - * - * Use this version if you have a space manager. Checks if the child frame - * supports interface nsIRunaround. If it does, interface nsIRunaround is - * used to reflow the child; otherwise interface nsIFrame is used. If the - * child is splittable then runaround is done using continuing frames. - */ -nsReflowStatus nsContainerFrame::ReflowChild(nsIFrame* aKidFrame, - nsIPresContext* aPresContext, - nsISpaceManager* aSpaceManager, - nsReflowMetrics& aDesiredSize, - nsReflowState& aReflowState, - nsRect& aDesiredRect) -{ - 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); - ((nsContainerFrame*)parent)->DeleteChildsNextInFlow(aKidFrame); - } - } - - return status; -} - /** * Remove and delete aChild's next-in-flow(s). Updates the sibling and flow * pointers diff --git a/layout/base/src/nsContainerFrame.h b/layout/base/src/nsContainerFrame.h index 9ae38566730..d35713e05cb 100644 --- a/layout/base/src/nsContainerFrame.h +++ b/layout/base/src/nsContainerFrame.h @@ -222,28 +222,6 @@ protected: nsReflowMetrics& aDesiredSize, const nsReflowState& aReflowState); - /** - * Reflow a child frame and return the status of the reflow. If the child - * is complete and it has next-in-flows, then delete the next-in-flows. - * - * Use this version if you have a space manager. Checks if the child frame - * supports interface nsIRunaround. If it does, interface nsIRunaround is - * used to reflow the child; otherwise interface nsIFrame is used. If the - * child is splittable then runaround is done using continuing frames. - * - * XXX This function needs to account for left/right margins so the caller - * should not adjust the max size to account for left/right margins -or- - * translate the space manager coordinate space - * - * @see nsIRunaround - */ - nsReflowStatus ReflowChild(nsIFrame* aKidFrame, - nsIPresContext* aPresContext, - nsISpaceManager* aSpaceManager, - nsReflowMetrics& aDesiredSize, - nsReflowState& aReflowState, - nsRect& aDesiredRect); - /** * Moves any frames on both the prev-in-flow's overflow list and the receiver's * overflow to the receiver's child list. @@ -267,6 +245,11 @@ protected: */ PRBool DeleteChildsNextInFlow(nsIFrame* aChild); + static PRBool DeleteNextInFlowsFor(nsContainerFrame* aParent, nsIFrame* aKid) + { + return aParent->DeleteChildsNextInFlow(aKid); + } + /** * Push aFromChild and its next siblings to the next-in-flow. Change the * geometric parent of each frame that's pushed. If there is no next-in-flow