/** * Place below-current-line floats. */ void nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList, nsLineBox* aLine) { nsFloatCache* fc = aList.Head(); while (fc) { #ifdef DEBUG if (nsBlockFrame::gNoisyReflow) { nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent); printf("placing bcl float: "); nsFrame::ListTag(stdout, fc->mFloat); printf("\n"); } #endif // Place the float bool placed = FlowAndPlaceFloat(fc->mFloat); nsFloatCache *next = fc->Next(); if (!placed) { aList.Remove(fc); delete fc; aLine->SetHadFloatPushed(); } fc = next; } }
// XXX this might be too eager to free memory void nsLineBox::FreeFloats(nsFloatCacheFreeList& aFreeList) { NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats"); if (IsInline() && mInlineData) { if (mInlineData->mFloats.NotEmpty()) { aFreeList.Append(mInlineData->mFloats); } MaybeFreeData(); } }
void nsLineBox::AppendFloats(nsFloatCacheFreeList& aFreeList) { NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats"); if (IsInline()) { if (aFreeList.NotEmpty()) { if (!mInlineData) { mInlineData = new ExtraInlineData(mBounds); } mInlineData->mFloats.Append(aFreeList); } } }
void nsLineBox::AppendFloats(nsFloatCacheFreeList& aFreeList) { MOZ_ASSERT(IsInline(), "block line can't have floats"); if (IsInline()) { if (aFreeList.NotEmpty()) { if (!mInlineData) { mInlineData = new ExtraInlineData(GetPhysicalBounds()); } mInlineData->mFloats.Append(aFreeList); } } }
/** * Place below-current-line floats. */ PRBool nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList, PRBool aForceFit) { nsFloatCache* fc = aList.Head(); while (fc) { { #ifdef DEBUG if (nsBlockFrame::gNoisyReflow) { nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent); printf("placing bcl float: "); nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame()); printf("\n"); } #endif // Place the float PRBool isLeftFloat; nsReflowStatus reflowStatus; PRBool placed = FlowAndPlaceFloat(fc, &isLeftFloat, reflowStatus, aForceFit); NS_ASSERTION(placed || !aForceFit, "If we're in force-fit mode, we should have placed the float"); if (!placed || (NS_FRAME_IS_TRUNCATED(reflowStatus) && !aForceFit)) { // return before processing all of the floats, since the line will be pushed. return PR_FALSE; } else if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus)) { // Create a continuation for the incomplete float and its placeholder. nsresult rv = mBlock->SplitPlaceholder(*this, fc->mPlaceholder); if (NS_FAILED(rv)) return PR_FALSE; } else { // XXX We could deal with truncated frames better by breaking before // the associated placeholder NS_WARN_IF_FALSE(!NS_FRAME_IS_TRUNCATED(reflowStatus), "This situation currently leads to data not printing"); // Float is complete. We need to delete any leftover placeholders now. nsIFrame* nextPlaceholder = fc->mPlaceholder->GetNextInFlow(); if (nextPlaceholder) { nsHTMLContainerFrame* parent = static_cast<nsHTMLContainerFrame*>(nextPlaceholder->GetParent()); parent->DeleteNextInFlowChild(mPresContext, nextPlaceholder); } } } fc = fc->Next(); } return PR_TRUE; }
void nsFloatCacheList::Append(nsFloatCacheFreeList& aList) { NS_PRECONDITION(aList.NotEmpty(), "Appending empty list will fail"); nsFloatCache* tail = Tail(); if (tail) { NS_ASSERTION(!tail->mNext, "Bogus!"); tail->mNext = aList.mHead; } else { NS_ASSERTION(!mHead, "Bogus!"); mHead = aList.mHead; } aList.mHead = nsnull; aList.mTail = nsnull; }
/** * Place below-current-line floats. */ PRBool nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheFreeList& aList, PRBool aForceFit) { nsFloatCache* fc = aList.Head(); while (fc) { { #ifdef DEBUG if (nsBlockFrame::gNoisyReflow) { nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent); printf("placing bcl float: "); nsFrame::ListTag(stdout, fc->mFloat); printf("\n"); } #endif // Place the float nsReflowStatus reflowStatus; PRBool placed = FlowAndPlaceFloat(fc->mFloat, reflowStatus, aForceFit); NS_ASSERTION(placed || !aForceFit, "If we're in force-fit mode, we should have placed the float"); if (!placed || (NS_FRAME_IS_TRUNCATED(reflowStatus) && !aForceFit)) { // return before processing all of the floats, since the line will be pushed. return PR_FALSE; } else if (!NS_FRAME_IS_FULLY_COMPLETE(reflowStatus)) { // Create a continuation for the incomplete float nsresult rv = mBlock->SplitFloat(*this, fc->mFloat, reflowStatus); if (NS_FAILED(rv)) return PR_FALSE; } else { // XXX We could deal with truncated frames better by breaking before // the associated placeholder NS_WARN_IF_FALSE(!NS_FRAME_IS_TRUNCATED(reflowStatus), "This situation currently leads to data not printing"); // Float is complete. } } fc = fc->Next(); } return PR_TRUE; }