Bug 716408 - Make nsTableFrame::GetTableFrame abort if the given frame isn't a table frame descendant, thus guaranteeing a non-null result. r=bernd

This commit is contained in:
Mats Palmgren
2012-01-17 00:38:10 +01:00
parent 702081ffc5
commit e0018d2b82
6 changed files with 66 additions and 141 deletions

View File

@@ -236,9 +236,7 @@ nsTableCellFrame::AttributeChanged(PRInt32 aNameSpaceID,
}
// let the table frame decide what to do
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
tableFrame->AttributeChangedFor(this, mContent, aAttribute);
}
tableFrame->AttributeChangedFor(this, mContent, aAttribute);
return NS_OK;
}
@@ -249,7 +247,6 @@ nsTableCellFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
return;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
PRInt32 colIndex, rowIndex;
@@ -443,7 +440,6 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
PRInt32 emptyCellStyle = GetContentEmpty() && !tableFrame->IsBorderCollapse() ?
GetStyleTableBorder()->mEmptyCells
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
@@ -824,11 +820,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight);
/* It's the 'border-collapse' on the table that matters */
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
ABORT1(NS_ERROR_NULL_POINTER);
nsMargin borderPadding = aReflowState.mComputedPadding;
nsMargin border;
GetBorderWidth(border);
@@ -854,6 +845,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
SetPriorAvailWidth(aReflowState.availableWidth);
nsIFrame* firstKid = mFrames.FirstChild();
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (aReflowState.mFlags.mSpecialHeightReflow) {
const_cast<nsHTMLReflowState&>(aReflowState).SetComputedHeight(mRect.height - topInset - bottomInset);