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

@@ -102,10 +102,7 @@ nsTableColGroupFrame::AddColsToTable(PRInt32 aFirstColIndex,
bool aResetSubsequentColIndices,
const nsFrameList::Slice& aCols)
{
nsresult rv = NS_OK;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
// set the col indices of the col frames and and add col info to the table
PRInt32 colIndex = aFirstColIndex;
@@ -132,7 +129,7 @@ nsTableColGroupFrame::AddColsToTable(PRInt32 aFirstColIndex,
ResetColIndices(GetNextSibling(), colIndex);
}
return rv;
return NS_OK;
}
@@ -177,9 +174,6 @@ nsTableColGroupFrame::SetInitialChildList(ChildListID aListID,
return NS_ERROR_INVALID_ARG;
}
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
if (aChildList.IsEmpty()) {
tableFrame->AppendAnonymousColFrames(this, GetSpan(), eColAnonymousColGroup,
false);
@@ -197,7 +191,6 @@ nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
return;
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
PRInt32 colCount = GetColCount();
@@ -207,7 +200,6 @@ nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
tableFrame->GetRowCount());
tableFrame->AddBCDamageArea(damageArea);
}
return;
}
NS_IMETHODIMP
@@ -359,9 +351,6 @@ nsTableColGroupFrame::RemoveFrame(ChildListID aListID,
RemoveChild(*colFrame, true);
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (!tableFrame)
return NS_ERROR_NULL_POINTER;
tableFrame->RemoveCol(this, colIndex, true, true);
if (mFrames.IsEmpty() && contentRemoval &&
GetColType() == eColGroupContent) {
@@ -403,9 +392,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
if (tableFrame) {
tableFrame->SetNeedToCollapse(true);;
}
tableFrame->SetNeedToCollapse(true);
}
// for every content child that (is a column thingy and does not already have a frame)
// create a frame and adjust it's style
@@ -487,7 +474,6 @@ void nsTableColGroupFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
mTopContBorderWidth);
aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
mBottomContBorderWidth);
return;
}
/* ----- global methods ----- */