Merge InitFloat into AddFloat (on nsLineLayout and nsBlockReflowState). (Bug 25888) r+sr=roc

This commit is contained in:
L. David Baron 2009-05-20 07:21:34 -04:00
parent 3dcf82f2cc
commit 78f084eb30
4 changed files with 5 additions and 38 deletions

View File

@ -521,22 +521,6 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
}
}
PRBool
nsBlockReflowState::InitFloat(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholder,
nscoord aAvailableWidth,
nsReflowStatus& aReflowStatus)
{
// Set the geometric parent of the float
nsIFrame* floatFrame = aPlaceholder->GetOutOfFlowFrame();
floatFrame->SetParent(mBlock);
// Then add the float to the current line and place it when
// appropriate
return AddFloat(aLineLayout, aPlaceholder, PR_TRUE,
aAvailableWidth, aReflowStatus);
}
// This is called by the line layout's AddFloat method when a
// place-holder frame is reflowed in a line. If the float is a
// left-most child (it's x coordinate is at the line's left margin)
@ -550,12 +534,14 @@ nsBlockReflowState::InitFloat(nsLineLayout& aLineLayout,
PRBool
nsBlockReflowState::AddFloat(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholder,
PRBool aInitialReflow,
nscoord aAvailableWidth,
nsReflowStatus& aReflowStatus)
{
NS_PRECONDITION(mBlock->end_lines() != mCurrentLine, "null ptr");
// Set the geometric parent of the float
aPlaceholder->GetOutOfFlowFrame()->SetParent(mBlock);
aReflowStatus = NS_FRAME_COMPLETE;
// Allocate a nsFloatCache for the float
nsFloatCache* fc = mFloatCacheFreeList.Alloc();

View File

@ -106,13 +106,8 @@ public:
* place the float, PR_FALSE if the float did not fit in available
* space.
*/
PRBool InitFloat(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholderFrame,
nscoord aAvailableWidth,
nsReflowStatus& aReflowStatus);
PRBool AddFloat(nsLineLayout& aLineLayout,
nsPlaceholderFrame* aPlaceholderFrame,
PRBool aInitialReflow,
nscoord aAvailableWidth,
nsReflowStatus& aReflowStatus);
PRBool CanPlaceFloat(const nsSize& aFloatSize, PRUint8 aFloats,

View File

@ -880,14 +880,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// We might as well allow zero-width floats to be placed, though.
availableWidth = 0;
}
// XXXldb What is this test supposed to be?
if (!NS_SUBTREE_DIRTY(aFrame)) {
// incremental reflow of child
placedFloat = InitFloat(placeholder, availableWidth, aReflowStatus);
}
else {
placedFloat = AddFloat(placeholder, availableWidth, aReflowStatus);
}
placedFloat = AddFloat(placeholder, availableWidth, aReflowStatus);
NS_ASSERTION(!(outOfFlowFrame->GetType() == nsGkAtoms::letterFrame &&
GetFirstLetterStyleOK()),
"FirstLetterStyle set on line with floating first letter");

View File

@ -208,17 +208,10 @@ public:
//----------------------------------------
// Inform the line-layout about the presence of a floating frame
// XXX get rid of this: use get-frame-type?
PRBool InitFloat(nsPlaceholderFrame* aFrame,
nscoord aAvailableWidth,
nsReflowStatus& aReflowStatus) {
return mBlockRS->InitFloat(*this, aFrame, aAvailableWidth, aReflowStatus);
}
PRBool AddFloat(nsPlaceholderFrame* aFrame,
nscoord aAvailableWidth,
nsReflowStatus& aReflowStatus) {
return mBlockRS->AddFloat(*this, aFrame, PR_FALSE,
aAvailableWidth, aReflowStatus);
return mBlockRS->AddFloat(*this, aFrame, aAvailableWidth, aReflowStatus);
}
void SetTrimmableWidth(nscoord aTrimmableWidth) {