implemented basic attribute changed handling. most things currently work, those that don't will work better after Peter

lands some style context resolution changes.
This commit is contained in:
buster%netscape.com 1998-10-30 23:08:34 +00:00
parent 6f31889714
commit f01655410d
10 changed files with 22 additions and 128 deletions

View File

@ -676,7 +676,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
// clean up
if (nsnull!=spanList)
{
if (gsDebug) printf("BTLS::APCW...space leak, span list not empty");
if (gsDebug) printf("BTLS::APCW...space leak, span list not empty\n");
delete spanList;
}
if (nsnull!=colSpanList)

View File

@ -267,12 +267,15 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
aReflowState.reflowCommand->GetType(type);
nsIFrame *objectFrame;
aReflowState.reflowCommand->GetChildFrame(objectFrame);
const nsStyleDisplay *childDisplay;
objectFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay));
const nsStyleDisplay *childDisplay=nsnull;
if (nsnull!=objectFrame)
objectFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay));
if (PR_TRUE==gsDebugIR) printf("nTCGF IR: IncrementalReflow_TargetIsMe with type=%d\n", type);
switch (type)
{
case nsIReflowCommand::FrameInserted :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (NS_STYLE_DISPLAY_TABLE_COLUMN == childDisplay->mDisplay)
{
rv = IR_ColInserted(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -285,6 +288,8 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
break;
case nsIReflowCommand::FrameAppended :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
{
rv = IR_ColAppended(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -302,6 +307,8 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
*/
case nsIReflowCommand::FrameRemoved :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
{
rv = IR_ColRemoved(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -471,21 +478,6 @@ NS_METHOD nsTableColGroupFrame::IR_StyleChanged(nsIPresContext& aPresCo
tableFrame->InvalidateColumnCache();
tableFrame->InvalidateFirstPassCache();
}
/*
// we are obligated to pass along the reflow command to our children before doing anything else
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState,
aReflowState.maxSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}

View File

@ -2222,23 +2222,8 @@ NS_METHOD nsTableFrame::IR_StyleChanged(nsIPresContext& aPresContext,
// we presume that all the easy optimizations were done in the nsHTMLStyleSheet before we were called here
// XXX: we can optimize this when we know which style attribute changed
// if something like border changes, we need to do pass1 again
// but if something like width changes, we just need to do pass2
// but if something like width changes from 100 to 200, we just need to do pass2
InvalidateFirstPassCache();
// we are obligated to pass along the reflow command to our children before doing anything else
/*
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState.reflowState,
aReflowState.availSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}

View File

@ -1149,21 +1149,6 @@ NS_METHOD nsTableRowFrame::IR_StyleChanged(nsIPresContext& aPresContext,
{
tableFrame->InvalidateFirstPassCache();
}
/*
// we are obligated to pass along the reflow command to our children before doing anything else
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState.reflowState,
aReflowState.availSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}

View File

@ -1198,21 +1198,6 @@ NS_METHOD nsTableRowGroupFrame::IR_StyleChanged(nsIPresContext& aPresContex
{
tableFrame->InvalidateFirstPassCache();
}
/*
// we are obligated to pass along the reflow command to our children before doing anything else
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState.reflowState,
aReflowState.availSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}

View File

@ -676,7 +676,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
// clean up
if (nsnull!=spanList)
{
if (gsDebug) printf("BTLS::APCW...space leak, span list not empty");
if (gsDebug) printf("BTLS::APCW...space leak, span list not empty\n");
delete spanList;
}
if (nsnull!=colSpanList)

View File

@ -267,12 +267,15 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
aReflowState.reflowCommand->GetType(type);
nsIFrame *objectFrame;
aReflowState.reflowCommand->GetChildFrame(objectFrame);
const nsStyleDisplay *childDisplay;
objectFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay));
const nsStyleDisplay *childDisplay=nsnull;
if (nsnull!=objectFrame)
objectFrame->GetStyleData(eStyleStruct_Display, ((nsStyleStruct *&)childDisplay));
if (PR_TRUE==gsDebugIR) printf("nTCGF IR: IncrementalReflow_TargetIsMe with type=%d\n", type);
switch (type)
{
case nsIReflowCommand::FrameInserted :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (NS_STYLE_DISPLAY_TABLE_COLUMN == childDisplay->mDisplay)
{
rv = IR_ColInserted(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -285,6 +288,8 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
break;
case nsIReflowCommand::FrameAppended :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
{
rv = IR_ColAppended(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -302,6 +307,8 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresCont
*/
case nsIReflowCommand::FrameRemoved :
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
{
rv = IR_ColRemoved(aPresContext, aDesiredSize, aReflowState, aStatus,
@ -471,21 +478,6 @@ NS_METHOD nsTableColGroupFrame::IR_StyleChanged(nsIPresContext& aPresCo
tableFrame->InvalidateColumnCache();
tableFrame->InvalidateFirstPassCache();
}
/*
// we are obligated to pass along the reflow command to our children before doing anything else
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState,
aReflowState.maxSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}

View File

@ -2222,23 +2222,8 @@ NS_METHOD nsTableFrame::IR_StyleChanged(nsIPresContext& aPresContext,
// we presume that all the easy optimizations were done in the nsHTMLStyleSheet before we were called here
// XXX: we can optimize this when we know which style attribute changed
// if something like border changes, we need to do pass1 again
// but if something like width changes, we just need to do pass2
// but if something like width changes from 100 to 200, we just need to do pass2
InvalidateFirstPassCache();
// we are obligated to pass along the reflow command to our children before doing anything else
/*
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState.reflowState,
aReflowState.availSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}

View File

@ -1149,21 +1149,6 @@ NS_METHOD nsTableRowFrame::IR_StyleChanged(nsIPresContext& aPresContext,
{
tableFrame->InvalidateFirstPassCache();
}
/*
// we are obligated to pass along the reflow command to our children before doing anything else
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState.reflowState,
aReflowState.availSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}

View File

@ -1198,21 +1198,6 @@ NS_METHOD nsTableRowGroupFrame::IR_StyleChanged(nsIPresContext& aPresContex
{
tableFrame->InvalidateFirstPassCache();
}
/*
// we are obligated to pass along the reflow command to our children before doing anything else
nsIFrame *childFrame = mFirstChild;
while (nsnull!=childFrame)
{
nsHTMLReflowState childReflowState(aPresContext, childFrame, aReflowState.reflowState,
aReflowState.availSize, eReflowReason_Incremental);
rv = ReflowChild(childFrame, aPresContext, aDesiredSize, childReflowState, aStatus);
if (NS_FAILED(rv))
break;
// the returned desired size is irrelevant, because we'll do a resize reflow in a moment
childFrame->GetNextSibling(childFrame);
}
*/
return rv;
}