all containers now decend from nsHTMLContainerFrame

all "unknown frame" incremental reflow support methods now
replaced with nsHTMLContainerFrame::AddFrame and ::RemoveFrame


git-svn-id: svn://10.0.0.236/trunk@13209 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
buster%netscape.com
1998-10-20 17:45:07 +00:00
parent 36835ec766
commit 75468d7b44
24 changed files with 346 additions and 948 deletions

View File

@@ -45,7 +45,7 @@ static const PRBool gsDebugIR = PR_FALSE;
nsTableColGroupFrame::nsTableColGroupFrame(nsIContent* aContent,
nsIFrame* aParentFrame)
: nsContainerFrame(aContent, aParentFrame)
: nsHTMLContainerFrame(aContent, aParentFrame)
{
mColCount=0;
}
@@ -176,6 +176,19 @@ NS_METHOD nsTableColGroupFrame::Paint(nsIPresContext& aPresContext,
return NS_OK;
}
PRIntn
nsTableColGroupFrame::GetSkipSides() const
{
PRIntn skip = 0;
if (nsnull != mPrevInFlow) {
skip |= 1 << NS_SIDE_TOP;
}
if (nsnull != mNextInFlow) {
skip |= 1 << NS_SIDE_BOTTOM;
}
return skip;
}
NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
@@ -267,8 +280,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
}
else
{
rv = IR_UnknownFrameInserted(aPresContext, aDesiredSize, aReflowState, aStatus,
objectFrame, PR_FALSE);
rv = AddFrame(aReflowState, objectFrame);
}
break;
@@ -280,8 +292,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
}
else
{ // no optimization to be done for Unknown frame types, so just reuse the Inserted method
rv = IR_UnknownFrameInserted(aPresContext, aDesiredSize, aReflowState, aStatus,
objectFrame, PR_FALSE);
rv = AddFrame(aReflowState, objectFrame);
}
break;
@@ -299,8 +310,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
else
{
rv = IR_UnknownFrameRemoved(aPresContext, aDesiredSize, aReflowState, aStatus,
objectFrame);
rv = RemoveFrame(objectFrame);
}
break;
@@ -337,7 +347,7 @@ NS_METHOD nsTableColGroupFrame::IR_ColInserted(nsIPresContext& aPresCon
{
nsresult rv=NS_OK;
PRBool adjustStartingColIndex=PR_FALSE;
rv = IR_UnknownFrameInserted(aPresContext, aDesiredSize, aReflowState, aStatus, aInsertedFrame, aReplace);
rv = AddFrame(aReflowState, (nsIFrame *)aInsertedFrame);
if (NS_FAILED(rv))
return rv;
PRInt32 startingColIndex=mStartColIndex;
@@ -373,7 +383,7 @@ NS_METHOD nsTableColGroupFrame::IR_ColAppended(nsIPresContext& aPresCon
{
nsresult rv=NS_OK;
PRBool adjustStartingColIndex=PR_FALSE;
rv = IR_UnknownFrameInserted(aPresContext, aDesiredSize, aReflowState, aStatus, aAppendedFrame, PR_FALSE);
rv = AddFrame(aReflowState, (nsIFrame*)aAppendedFrame);
if (NS_FAILED(rv))
return rv;
PRInt32 startingColIndex=mStartColIndex;
@@ -447,85 +457,6 @@ NS_METHOD nsTableColGroupFrame::IR_ColRemoved(nsIPresContext& aPresCont
return rv;
}
//XXX: handle aReplace
NS_METHOD nsTableColGroupFrame::IR_UnknownFrameInserted(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,
nsIFrame * aInsertedFrame,
PRBool aReplace)
{
nsIReflowCommand::ReflowType type;
aReflowState.reflowCommand->GetType(type);
// we have a generic frame that gets inserted but doesn't effect reflow
// hook it up then ignore it
if (nsIReflowCommand::FrameAppended==type)
{ // frameAppended reflow -- find the last child and make aInsertedFrame its next sibling
if (PR_TRUE==gsDebugIR) printf("TCGF IR: FrameAppended adding unknown frame type.\n");
nsIFrame *lastChild=mFirstChild;
nsIFrame *nextChild=mFirstChild;
while (nsnull!=nextChild)
{
lastChild=nextChild;
nextChild->GetNextSibling(nextChild);
}
if (nsnull==lastChild)
mFirstChild = aInsertedFrame;
else
lastChild->SetNextSibling(aInsertedFrame);
}
else
{ // frameInserted reflow -- hook up aInsertedFrame as prevSibling's next sibling,
// and be sure to hook in aInsertedFrame's nextSibling (from prevSibling)
if (PR_TRUE==gsDebugIR) printf("TCGF IR: FrameInserted adding unknown frame type.\n");
nsIFrame *prevSibling=nsnull;
nsresult rv = aReflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
if (NS_SUCCEEDED(rv) && (nsnull!=prevSibling))
{
nsIFrame *nextSibling=nsnull;
prevSibling->GetNextSibling(nextSibling);
prevSibling->SetNextSibling(aInsertedFrame);
aInsertedFrame->SetNextSibling(nextSibling);
}
else
{
nsIFrame *nextSibling=nsnull;
if (nsnull!=mFirstChild)
mFirstChild->GetNextSibling(nextSibling);
mFirstChild = aInsertedFrame;
aInsertedFrame->SetNextSibling(nextSibling);
}
}
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
NS_METHOD nsTableColGroupFrame::IR_UnknownFrameRemoved(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,
nsIFrame * aRemovedFrame)
{
// we have a generic frame that gets removed but doesn't effect reflow
// unhook it then ignore it
if (PR_TRUE==gsDebugIR) printf("TCGF IR: FrameRemoved removing unknown frame type.\n");
nsIFrame *prevChild=nsnull;
nsIFrame *nextChild=mFirstChild;
while (nextChild!=aRemovedFrame)
{
prevChild=nextChild;
nextChild->GetNextSibling(nextChild);
}
nextChild=nsnull;
aRemovedFrame->GetNextSibling(nextChild);
if (nsnull==prevChild) // objectFrame was first child
mFirstChild = nextChild;
else
prevChild->SetNextSibling(nextChild);
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,