all containers now decend from nsHTMLContainerFrame
all "unknown frame" incremental reflow support methods now replaced with nsHTMLContainerFrame::AddFrame and ::RemoveFrame
This commit is contained in:
@@ -84,7 +84,7 @@ struct RowReflowState {
|
||||
|
||||
nsTableRowFrame::nsTableRowFrame(nsIContent* aContent,
|
||||
nsIFrame* aParentFrame)
|
||||
: nsContainerFrame(aContent, aParentFrame),
|
||||
: nsHTMLContainerFrame(aContent, aParentFrame),
|
||||
mTallestCell(0),
|
||||
mCellMaxTopMargin(0),
|
||||
mCellMaxBottomMargin(0),
|
||||
@@ -240,6 +240,19 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext& aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRIntn
|
||||
nsTableRowFrame::GetSkipSides() const
|
||||
{
|
||||
PRIntn skip = 0;
|
||||
if (nsnull != mPrevInFlow) {
|
||||
skip |= 1 << NS_SIDE_TOP;
|
||||
}
|
||||
if (nsnull != mNextInFlow) {
|
||||
skip |= 1 << NS_SIDE_BOTTOM;
|
||||
}
|
||||
return skip;
|
||||
}
|
||||
|
||||
/** overloaded method from nsContainerFrame. The difference is that
|
||||
* we don't want to clip our children, so a cell can do a rowspan
|
||||
*/
|
||||
@@ -866,8 +879,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = IR_UnknownFrameInserted(aPresContext, aDesiredSize, aReflowState, aStatus,
|
||||
objectFrame, PR_FALSE);
|
||||
rv = AddFrame(aReflowState.reflowState, objectFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -879,8 +891,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
|
||||
}
|
||||
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.reflowState, objectFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -897,8 +908,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = IR_UnknownFrameRemoved(aPresContext, aDesiredSize, aReflowState, aStatus,
|
||||
objectFrame);
|
||||
rv = RemoveFrame(objectFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -934,8 +944,7 @@ NS_METHOD nsTableRowFrame::IR_CellInserted(nsIPresContext& aPresContext,
|
||||
PRBool aReplace)
|
||||
{
|
||||
if (PR_TRUE==gsDebugIR) printf("\nTRF IR: IR_CellInserted\n");
|
||||
nsresult rv = IR_UnknownFrameInserted(aPresContext, aDesiredSize, aReflowState,
|
||||
aStatus, (nsIFrame*)aInsertedFrame, aReplace);
|
||||
nsresult rv = AddFrame(aReflowState.reflowState, (nsIFrame*)aInsertedFrame);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@@ -971,8 +980,7 @@ NS_METHOD nsTableRowFrame::IR_CellAppended(nsIPresContext& aPresContext,
|
||||
{
|
||||
|
||||
if (PR_TRUE==gsDebugIR) printf("\nTRF IR: IR_CellInserted\n");
|
||||
nsresult rv = IR_UnknownFrameInserted(aPresContext, aDesiredSize, aReflowState,
|
||||
aStatus, (nsIFrame*)aAppendedFrame, PR_FALSE);
|
||||
nsresult rv = AddFrame(aReflowState.reflowState, (nsIFrame*)aAppendedFrame);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@@ -1037,9 +1045,8 @@ NS_METHOD nsTableRowFrame::IR_CellRemoved(nsIPresContext& aPresContext,
|
||||
nsReflowStatus& aStatus,
|
||||
nsTableCellFrame * aDeletedFrame)
|
||||
{
|
||||
if (PR_TRUE==gsDebugIR) printf("\nTRGF IR: IR_RowRemoved\n");
|
||||
nsresult rv = IR_UnknownFrameRemoved(aPresContext, aDesiredSize, aReflowState, aStatus,
|
||||
aDeletedFrame);
|
||||
if (PR_TRUE==gsDebugIR) printf("\nRow IR: IR_RowRemoved\n");
|
||||
nsresult rv = RemoveFrame((nsIFrame*)aDeletedFrame);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsTableFrame *tableFrame=nsnull;
|
||||
@@ -1057,84 +1064,6 @@ NS_METHOD nsTableRowFrame::IR_CellRemoved(nsIPresContext& aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
//XXX: handle aReplace
|
||||
NS_METHOD nsTableRowFrame::IR_UnknownFrameInserted(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
RowReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus,
|
||||
nsIFrame * aInsertedFrame,
|
||||
PRBool aReplace)
|
||||
{
|
||||
if (PR_TRUE==gsDebugIR) printf("\nTRGF IR: IR_UnknownFrameInserted\n");
|
||||
nsIReflowCommand::ReflowType type;
|
||||
aReflowState.reflowState.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("TRGF 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("TRGF IR: FrameInserted adding unknown frame type.\n");
|
||||
nsIFrame *prevSibling=nsnull;
|
||||
nsresult rv = aReflowState.reflowState.reflowCommand->GetPrevSiblingFrame(prevSibling);
|
||||
if (NS_SUCCEEDED(rv) && (nsnull!=prevSibling))
|
||||
{
|
||||
nsIFrame *nextSibling=nsnull;
|
||||
prevSibling->GetNextSibling(nextSibling);
|
||||
prevSibling->SetNextSibling(aInsertedFrame);
|
||||
aInsertedFrame->SetNextSibling(nextSibling);
|
||||
}
|
||||
else
|
||||
{
|
||||
nsIFrame *nextSibling=mFirstChild;
|
||||
mFirstChild = aInsertedFrame;
|
||||
aInsertedFrame->SetNextSibling(nextSibling);
|
||||
}
|
||||
}
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsTableRowFrame::IR_UnknownFrameRemoved(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
RowReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus,
|
||||
nsIFrame * aRemovedFrame)
|
||||
{
|
||||
if (PR_TRUE==gsDebugIR) printf("\nTRGF IR: IR_UnknownFrameRemoved\n");
|
||||
// we have a generic frame that gets removed but doesn't effect reflow
|
||||
// unhook it then ignore it
|
||||
if (PR_TRUE==gsDebugIR) printf("TRGF 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 nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
RowReflowState& aReflowState,
|
||||
|
||||
Reference in New Issue
Block a user