fixed crash (cnn and other sites with javascript) in nsCellMap due to it not being invalidated.

This commit is contained in:
karnaze@netscape.com
1999-11-11 05:43:35 +00:00
parent 88fa4bc8ba
commit 62ff07de0a
2 changed files with 28 additions and 20 deletions

View File

@@ -1209,11 +1209,24 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull); if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull);
// this is a temporary fix to prevent a recent crash due to incremental content // this is a temporary fix to prevent a recent crash due to incremental content
// sink changes. this will go away when the col cache and cell map are synchronized // sink changes. XXX remove this when the col cache and cell map are synchronized
if (!IsColumnCacheValid()) { if (!IsColumnCacheValid()) {
CacheColFrames(aPresContext, PR_TRUE); CacheColFrames(aPresContext, PR_TRUE);
} }
PRBool needsRecalc=PR_FALSE;
// this is necessary here because the cell map can change even before the first reflow.
// XXX remove this when the incremental cell map is finished
if (!IsCellMapValid()) {
if (mCellMap) {
delete mCellMap;
mCellMap = new nsCellMap(0,0);
ReBuildCellMap();
needsRecalc = PR_TRUE;
}
}
// Initialize out parameter // Initialize out parameter
if (nsnull != aDesiredSize.maxElementSize) { if (nsnull != aDesiredSize.maxElementSize) {
aDesiredSize.maxElementSize->width = 0; aDesiredSize.maxElementSize->width = 0;
@@ -1235,15 +1248,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
// NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow // NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow
if (PR_TRUE==NeedsReflow(aReflowState)) if (PR_TRUE==NeedsReflow(aReflowState))
{ {
PRBool needsRecalc=PR_FALSE;
if (eReflowReason_Initial!=aReflowState.reason && PR_FALSE==IsCellMapValid())
{
if (nsnull!=mCellMap)
delete mCellMap;
mCellMap = new nsCellMap(0,0);
ReBuildCellMap();
needsRecalc=PR_TRUE;
}
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) || if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) ||
(PR_FALSE==IsFirstPassValid())) (PR_FALSE==IsFirstPassValid()))
{ {

View File

@@ -1209,11 +1209,24 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull); if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull);
// this is a temporary fix to prevent a recent crash due to incremental content // this is a temporary fix to prevent a recent crash due to incremental content
// sink changes. this will go away when the col cache and cell map are synchronized // sink changes. XXX remove this when the col cache and cell map are synchronized
if (!IsColumnCacheValid()) { if (!IsColumnCacheValid()) {
CacheColFrames(aPresContext, PR_TRUE); CacheColFrames(aPresContext, PR_TRUE);
} }
PRBool needsRecalc=PR_FALSE;
// this is necessary here because the cell map can change even before the first reflow.
// XXX remove this when the incremental cell map is finished
if (!IsCellMapValid()) {
if (mCellMap) {
delete mCellMap;
mCellMap = new nsCellMap(0,0);
ReBuildCellMap();
needsRecalc = PR_TRUE;
}
}
// Initialize out parameter // Initialize out parameter
if (nsnull != aDesiredSize.maxElementSize) { if (nsnull != aDesiredSize.maxElementSize) {
aDesiredSize.maxElementSize->width = 0; aDesiredSize.maxElementSize->width = 0;
@@ -1235,15 +1248,6 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
// NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow // NeedsReflow and IsFirstPassValid take into account reflow type = Initial_Reflow
if (PR_TRUE==NeedsReflow(aReflowState)) if (PR_TRUE==NeedsReflow(aReflowState))
{ {
PRBool needsRecalc=PR_FALSE;
if (eReflowReason_Initial!=aReflowState.reason && PR_FALSE==IsCellMapValid())
{
if (nsnull!=mCellMap)
delete mCellMap;
mCellMap = new nsCellMap(0,0);
ReBuildCellMap();
needsRecalc=PR_TRUE;
}
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) || if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) ||
(PR_FALSE==IsFirstPassValid())) (PR_FALSE==IsFirstPassValid()))
{ {