Reflow all of the table structure (although not its descendants) when frame structure within the table is changed. b=363524 r=bernd sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@216926 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org 2006-12-13 03:45:28 +00:00
parent 6a74e8c266
commit 08d8ed684c
4 changed files with 22 additions and 3 deletions

View File

@ -188,6 +188,7 @@ nsTableFrame::nsTableFrame(nsStyleContext* aContext)
mBits.mNeedToCalcBCBorders = PR_FALSE;
mBits.mIsBorderCollapse = PR_FALSE;
mBits.mResizedColumns = PR_FALSE; // only really matters if splitting
mBits.mGeometryDirty = PR_FALSE;
}
NS_IMPL_ADDREF_INHERITED(nsTableFrame, nsHTMLContainerFrame)
@ -1914,6 +1915,7 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext,
!!(GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
if ((GetStateBits() & (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) ||
aReflowState.ShouldReflowAllKids() ||
IsGeometryDirty() ||
needToInitiateSpecialReflow) {
// see if an extra reflow will be necessary in pagination mode when there is a specified table height
if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight)) {
@ -2301,6 +2303,7 @@ nsTableFrame::AppendFrames(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
SetGeometryDirty();
return NS_OK;
}
@ -2403,6 +2406,7 @@ nsTableFrame::InsertFrames(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
SetGeometryDirty();
#ifdef DEBUG_TABLE_CELLMAP
printf("=== TableFrame::InsertFrames\n");
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
@ -2482,6 +2486,7 @@ nsTableFrame::RemoveFrame(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
SetGeometryDirty();
#ifdef DEBUG_TABLE_CELLMAP
printf("=== TableFrame::RemoveFrame\n");
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
@ -2954,8 +2959,10 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
}
}
// We've now propagated the column resize to all the children.
// We've now propagated the column resizes and geometry changes to all
// the children.
mBits.mResizedColumns = PR_FALSE;
ClearGeometryDirty();
return rv;
}

View File

@ -618,6 +618,10 @@ public:
PRBool NeedColSpanExpansion() const;
void SetNeedColSpanExpansion(PRBool aValue);
PRBool SetGeometryDirty() { mBits.mGeometryDirty = PR_TRUE; }
PRBool ClearGeometryDirty() { mBits.mGeometryDirty = PR_FALSE; }
PRBool IsGeometryDirty() const { return mBits.mGeometryDirty; }
/** Get the cell map for this table frame. It is not always mCellMap.
* Only the firstInFlow has a legit cell map
*/
@ -737,12 +741,12 @@ protected:
PRUint32 mIsBorderCollapse:1; // border collapsing model vs. separate model
PRUint32 mRowInserted:1;
PRUint32 mNeedToCalcBCBorders:1;
PRUint32 mGeometryDirty:1;
PRUint32 mLeftContBCBorder:8;
PRUint32 mNeedToCollapse:1; // rows, cols that have visibility:collapse need to be collapsed
PRUint32 mHasZeroColSpans:1;
PRUint32 mNeedColSpanExpansion:1;
PRBool mResizedColumns:1; // have we resized columns since last reflow?
PRUint32 :8; // unused
} mBits;
nsTableCellMap* mCellMap; // maintains the relationships between rows, cols, and cells

View File

@ -200,6 +200,7 @@ nsTableRowFrame::AppendFrames(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
tableFrame->SetGeometryDirty();
return NS_OK;
}
@ -240,6 +241,7 @@ nsTableRowFrame::InsertFrames(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
tableFrame->SetGeometryDirty();
return NS_OK;
}
@ -265,6 +267,7 @@ nsTableRowFrame::RemoveFrame(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
tableFrame->SetGeometryDirty();
}
else {
NS_ERROR("unexpected frame type");
@ -843,6 +846,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// See if we should only reflow the dirty child frames
PRBool doReflowChild = PR_TRUE;
if (!aReflowState.ShouldReflowAllKids() &&
!aTableFrame.IsGeometryDirty() &&
!(kidFrame->GetStateBits() &
(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN))) {
if (!aReflowState.mFlags.mSpecialHeightReflow)

View File

@ -372,7 +372,8 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
PRBool isPaginated = aPresContext->IsPaginated();
PRBool haveRow = PR_FALSE;
PRBool reflowAllKids = aReflowState.reflowState.ShouldReflowAllKids();
PRBool reflowAllKids = aReflowState.reflowState.ShouldReflowAllKids() ||
tableFrame->IsGeometryDirty();
PRBool needToCalcRowHeights = reflowAllKids;
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
@ -1349,6 +1350,7 @@ nsTableRowGroupFrame::AppendFrames(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
tableFrame->SetGeometryDirty();
}
}
@ -1398,6 +1400,7 @@ nsTableRowGroupFrame::InsertFrames(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
tableFrame->SetGeometryDirty();
}
return NS_OK;
}
@ -1419,6 +1422,7 @@ nsTableRowGroupFrame::RemoveFrame(nsIAtom* aListName,
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
GetPresContext()->PresShell()->FrameNeedsReflow(this,
nsIPresShell::eTreeChange);
tableFrame->SetGeometryDirty();
}
}
mFrames.DestroyFrame(aOldFrame);