зеркало из https://github.com/mozilla/pjs.git
Made sure that column cache is invalidated if necessary when appending rows
frames and cell frames
This commit is contained in:
Родитель
620bc3b57c
Коммит
e50053ef39
|
@ -437,8 +437,8 @@ nsTableFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||||
prevColGroupChild->SetNextSibling(nsnull);
|
prevColGroupChild->SetNextSibling(nsnull);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
//mCellMap->Dump();
|
PRBool createdColFrames;
|
||||||
EnsureColumns(aPresContext);
|
EnsureColumns(aPresContext, createdColFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -633,10 +633,13 @@ PRInt32 nsTableFrame::GetEffectiveCOLSAttribute()
|
||||||
* if the cell map says there are more columns than this,
|
* if the cell map says there are more columns than this,
|
||||||
* add extra implicit columns to the content tree.
|
* add extra implicit columns to the content tree.
|
||||||
*/
|
*/
|
||||||
void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
|
void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext,
|
||||||
|
PRBool& aCreatedColFrames)
|
||||||
{
|
{
|
||||||
if (PR_TRUE==gsDebug) printf("TIF EnsureColumns\n");
|
if (PR_TRUE==gsDebug) printf("TIF EnsureColumns\n");
|
||||||
NS_PRECONDITION(nsnull!=mCellMap, "bad state: null cellmap");
|
NS_PRECONDITION(nsnull!=mCellMap, "bad state: null cellmap");
|
||||||
|
|
||||||
|
aCreatedColFrames = PR_FALSE; // initialize OUT parameter
|
||||||
if (nsnull == mCellMap)
|
if (nsnull == mCellMap)
|
||||||
return; // no info yet, so nothing useful to do
|
return; // no info yet, so nothing useful to do
|
||||||
|
|
||||||
|
@ -715,6 +718,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
|
||||||
lastColGroupStyle,
|
lastColGroupStyle,
|
||||||
PR_TRUE,
|
PR_TRUE,
|
||||||
&colStyleContext); // colStyleContext: REFCNT++
|
&colStyleContext); // colStyleContext: REFCNT++
|
||||||
|
aCreatedColFrames = PR_TRUE; // remember that we're creating implicit col frames
|
||||||
NS_NewTableColFrame(&colFrame);
|
NS_NewTableColFrame(&colFrame);
|
||||||
colFrame->Init(aPresContext, lastColGroupElement, lastColGroupFrame,
|
colFrame->Init(aPresContext, lastColGroupElement, lastColGroupFrame,
|
||||||
colStyleContext, nsnull);
|
colStyleContext, nsnull);
|
||||||
|
@ -4386,8 +4390,9 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext,
|
||||||
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
||||||
PRInt32 colIndex=0;
|
PRInt32 colIndex=0;
|
||||||
const nsStyleTable* tableStyle;
|
const nsStyleTable* tableStyle;
|
||||||
|
PRBool createdColFrames;
|
||||||
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
||||||
EnsureColumns(aPresContext);
|
EnsureColumns(aPresContext, createdColFrames);
|
||||||
if (nsnull!=mColCache)
|
if (nsnull!=mColCache)
|
||||||
{
|
{
|
||||||
if (PR_TRUE==gsDebugIR) printf("TIF BCC: clearing column cache and cell map column frame cache.\n");
|
if (PR_TRUE==gsDebugIR) printf("TIF BCC: clearing column cache and cell map column frame cache.\n");
|
||||||
|
|
|
@ -722,6 +722,15 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void InvalidateCellMap();
|
virtual void InvalidateCellMap();
|
||||||
|
|
||||||
|
/** sum the columns represented by all nsTableColGroup objects.
|
||||||
|
* if the cell map says there are more columns than this,
|
||||||
|
* add extra implicit columns to the content tree.
|
||||||
|
*
|
||||||
|
* returns whether any implicit column frames were created
|
||||||
|
*/
|
||||||
|
virtual void EnsureColumns (nsIPresContext& aPresContext,
|
||||||
|
PRBool& aCreatedColFrames);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** iterates all child frames and creates a new cell map */
|
/** iterates all child frames and creates a new cell map */
|
||||||
NS_IMETHOD ReBuildCellMap();
|
NS_IMETHOD ReBuildCellMap();
|
||||||
|
@ -735,12 +744,6 @@ protected:
|
||||||
void ListColumnLayoutData(FILE* out, PRInt32 aIndent);
|
void ListColumnLayoutData(FILE* out, PRInt32 aIndent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** sum the columns represented by all nsTableColGroup objects.
|
|
||||||
* if the cell map says there are more columns than this,
|
|
||||||
* add extra implicit columns to the content tree.
|
|
||||||
*/
|
|
||||||
virtual void EnsureColumns (nsIPresContext& aPresContext);
|
|
||||||
|
|
||||||
virtual void BuildColumnCache(nsIPresContext& aPresContext,
|
virtual void BuildColumnCache(nsIPresContext& aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredSize,
|
nsHTMLReflowMetrics& aDesiredSize,
|
||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
|
|
|
@ -177,6 +177,16 @@ nsTableRowFrame::AppendFrames(nsIPresContext& aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See if any implicit column frames need to be created as a result of
|
||||||
|
// adding the new rows
|
||||||
|
PRBool createdColFrames;
|
||||||
|
tableFrame->EnsureColumns(aPresContext, createdColFrames);
|
||||||
|
if (createdColFrames) {
|
||||||
|
// We need to rebuild the column cache
|
||||||
|
// XXX It would be nice if this could be done incrementally
|
||||||
|
tableFrame->InvalidateColumnCache();
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
||||||
// command that tells us to reflow our dirty child frames
|
// command that tells us to reflow our dirty child frames
|
||||||
nsIReflowCommand* reflowCmd;
|
nsIReflowCommand* reflowCmd;
|
||||||
|
@ -1265,7 +1275,6 @@ NS_METHOD nsTableRowFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
|
||||||
// If any column widths have to change due to this, rebalance column widths.
|
// If any column widths have to change due to this, rebalance column widths.
|
||||||
// XXX need to calculate this, but for now just do it
|
// XXX need to calculate this, but for now just do it
|
||||||
aReflowState.tableFrame->InvalidateColumnWidths();
|
aReflowState.tableFrame->InvalidateColumnWidths();
|
||||||
aReflowState.tableFrame->InvalidateColumnCache();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ nsTableRowGroupFrame::AppendFrames(nsIPresContext& aPresContext,
|
||||||
nsIFrame* aFrameList)
|
nsIFrame* aFrameList)
|
||||||
{
|
{
|
||||||
// Get the table frame
|
// Get the table frame
|
||||||
nsTableFrame* tableFrame = nsnull;
|
nsTableFrame* tableFrame;
|
||||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||||
|
|
||||||
// Append the frames
|
// Append the frames
|
||||||
|
@ -1188,6 +1188,16 @@ nsTableRowGroupFrame::AppendFrames(nsIPresContext& aPresContext,
|
||||||
DidAppendRow((nsTableRowFrame*)rowFrame);
|
DidAppendRow((nsTableRowFrame*)rowFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See if any implicit column frames need to be created as a result of
|
||||||
|
// adding the new rows
|
||||||
|
PRBool createdColFrames;
|
||||||
|
tableFrame->EnsureColumns(aPresContext, createdColFrames);
|
||||||
|
if (createdColFrames) {
|
||||||
|
// We need to rebuild the column cache
|
||||||
|
// XXX It would be nice if this could be done incrementally
|
||||||
|
tableFrame->InvalidateColumnCache();
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
||||||
// command that tells us to reflow our dirty child frames
|
// command that tells us to reflow our dirty child frames
|
||||||
nsIReflowCommand* reflowCmd;
|
nsIReflowCommand* reflowCmd;
|
||||||
|
|
|
@ -437,8 +437,8 @@ nsTableFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
||||||
prevColGroupChild->SetNextSibling(nsnull);
|
prevColGroupChild->SetNextSibling(nsnull);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
//mCellMap->Dump();
|
PRBool createdColFrames;
|
||||||
EnsureColumns(aPresContext);
|
EnsureColumns(aPresContext, createdColFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -633,10 +633,13 @@ PRInt32 nsTableFrame::GetEffectiveCOLSAttribute()
|
||||||
* if the cell map says there are more columns than this,
|
* if the cell map says there are more columns than this,
|
||||||
* add extra implicit columns to the content tree.
|
* add extra implicit columns to the content tree.
|
||||||
*/
|
*/
|
||||||
void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
|
void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext,
|
||||||
|
PRBool& aCreatedColFrames)
|
||||||
{
|
{
|
||||||
if (PR_TRUE==gsDebug) printf("TIF EnsureColumns\n");
|
if (PR_TRUE==gsDebug) printf("TIF EnsureColumns\n");
|
||||||
NS_PRECONDITION(nsnull!=mCellMap, "bad state: null cellmap");
|
NS_PRECONDITION(nsnull!=mCellMap, "bad state: null cellmap");
|
||||||
|
|
||||||
|
aCreatedColFrames = PR_FALSE; // initialize OUT parameter
|
||||||
if (nsnull == mCellMap)
|
if (nsnull == mCellMap)
|
||||||
return; // no info yet, so nothing useful to do
|
return; // no info yet, so nothing useful to do
|
||||||
|
|
||||||
|
@ -715,6 +718,7 @@ void nsTableFrame::EnsureColumns(nsIPresContext& aPresContext)
|
||||||
lastColGroupStyle,
|
lastColGroupStyle,
|
||||||
PR_TRUE,
|
PR_TRUE,
|
||||||
&colStyleContext); // colStyleContext: REFCNT++
|
&colStyleContext); // colStyleContext: REFCNT++
|
||||||
|
aCreatedColFrames = PR_TRUE; // remember that we're creating implicit col frames
|
||||||
NS_NewTableColFrame(&colFrame);
|
NS_NewTableColFrame(&colFrame);
|
||||||
colFrame->Init(aPresContext, lastColGroupElement, lastColGroupFrame,
|
colFrame->Init(aPresContext, lastColGroupElement, lastColGroupFrame,
|
||||||
colStyleContext, nsnull);
|
colStyleContext, nsnull);
|
||||||
|
@ -4386,8 +4390,9 @@ void nsTableFrame::BuildColumnCache( nsIPresContext& aPresContext,
|
||||||
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
NS_ASSERTION(nsnull!=mCellMap, "never ever call me until the cell map is built!");
|
||||||
PRInt32 colIndex=0;
|
PRInt32 colIndex=0;
|
||||||
const nsStyleTable* tableStyle;
|
const nsStyleTable* tableStyle;
|
||||||
|
PRBool createdColFrames;
|
||||||
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
||||||
EnsureColumns(aPresContext);
|
EnsureColumns(aPresContext, createdColFrames);
|
||||||
if (nsnull!=mColCache)
|
if (nsnull!=mColCache)
|
||||||
{
|
{
|
||||||
if (PR_TRUE==gsDebugIR) printf("TIF BCC: clearing column cache and cell map column frame cache.\n");
|
if (PR_TRUE==gsDebugIR) printf("TIF BCC: clearing column cache and cell map column frame cache.\n");
|
||||||
|
|
|
@ -722,6 +722,15 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void InvalidateCellMap();
|
virtual void InvalidateCellMap();
|
||||||
|
|
||||||
|
/** sum the columns represented by all nsTableColGroup objects.
|
||||||
|
* if the cell map says there are more columns than this,
|
||||||
|
* add extra implicit columns to the content tree.
|
||||||
|
*
|
||||||
|
* returns whether any implicit column frames were created
|
||||||
|
*/
|
||||||
|
virtual void EnsureColumns (nsIPresContext& aPresContext,
|
||||||
|
PRBool& aCreatedColFrames);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** iterates all child frames and creates a new cell map */
|
/** iterates all child frames and creates a new cell map */
|
||||||
NS_IMETHOD ReBuildCellMap();
|
NS_IMETHOD ReBuildCellMap();
|
||||||
|
@ -735,12 +744,6 @@ protected:
|
||||||
void ListColumnLayoutData(FILE* out, PRInt32 aIndent);
|
void ListColumnLayoutData(FILE* out, PRInt32 aIndent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** sum the columns represented by all nsTableColGroup objects.
|
|
||||||
* if the cell map says there are more columns than this,
|
|
||||||
* add extra implicit columns to the content tree.
|
|
||||||
*/
|
|
||||||
virtual void EnsureColumns (nsIPresContext& aPresContext);
|
|
||||||
|
|
||||||
virtual void BuildColumnCache(nsIPresContext& aPresContext,
|
virtual void BuildColumnCache(nsIPresContext& aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredSize,
|
nsHTMLReflowMetrics& aDesiredSize,
|
||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
|
|
|
@ -177,6 +177,16 @@ nsTableRowFrame::AppendFrames(nsIPresContext& aPresContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See if any implicit column frames need to be created as a result of
|
||||||
|
// adding the new rows
|
||||||
|
PRBool createdColFrames;
|
||||||
|
tableFrame->EnsureColumns(aPresContext, createdColFrames);
|
||||||
|
if (createdColFrames) {
|
||||||
|
// We need to rebuild the column cache
|
||||||
|
// XXX It would be nice if this could be done incrementally
|
||||||
|
tableFrame->InvalidateColumnCache();
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
||||||
// command that tells us to reflow our dirty child frames
|
// command that tells us to reflow our dirty child frames
|
||||||
nsIReflowCommand* reflowCmd;
|
nsIReflowCommand* reflowCmd;
|
||||||
|
@ -1265,7 +1275,6 @@ NS_METHOD nsTableRowFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
|
||||||
// If any column widths have to change due to this, rebalance column widths.
|
// If any column widths have to change due to this, rebalance column widths.
|
||||||
// XXX need to calculate this, but for now just do it
|
// XXX need to calculate this, but for now just do it
|
||||||
aReflowState.tableFrame->InvalidateColumnWidths();
|
aReflowState.tableFrame->InvalidateColumnWidths();
|
||||||
aReflowState.tableFrame->InvalidateColumnCache();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ nsTableRowGroupFrame::AppendFrames(nsIPresContext& aPresContext,
|
||||||
nsIFrame* aFrameList)
|
nsIFrame* aFrameList)
|
||||||
{
|
{
|
||||||
// Get the table frame
|
// Get the table frame
|
||||||
nsTableFrame* tableFrame = nsnull;
|
nsTableFrame* tableFrame;
|
||||||
nsTableFrame::GetTableFrame(this, tableFrame);
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
||||||
|
|
||||||
// Append the frames
|
// Append the frames
|
||||||
|
@ -1188,6 +1188,16 @@ nsTableRowGroupFrame::AppendFrames(nsIPresContext& aPresContext,
|
||||||
DidAppendRow((nsTableRowFrame*)rowFrame);
|
DidAppendRow((nsTableRowFrame*)rowFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See if any implicit column frames need to be created as a result of
|
||||||
|
// adding the new rows
|
||||||
|
PRBool createdColFrames;
|
||||||
|
tableFrame->EnsureColumns(aPresContext, createdColFrames);
|
||||||
|
if (createdColFrames) {
|
||||||
|
// We need to rebuild the column cache
|
||||||
|
// XXX It would be nice if this could be done incrementally
|
||||||
|
tableFrame->InvalidateColumnCache();
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
||||||
// command that tells us to reflow our dirty child frames
|
// command that tells us to reflow our dirty child frames
|
||||||
nsIReflowCommand* reflowCmd;
|
nsIReflowCommand* reflowCmd;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче