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:
@@ -236,9 +236,7 @@ nsTableCellFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||||||
}
|
}
|
||||||
// let the table frame decide what to do
|
// let the table frame decide what to do
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (tableFrame) {
|
|
||||||
tableFrame->AttributeChangedFor(this, mContent, aAttribute);
|
tableFrame->AttributeChangedFor(this, mContent, aAttribute);
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +247,6 @@ nsTableCellFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
|
|
||||||
if (tableFrame->IsBorderCollapse() &&
|
if (tableFrame->IsBorderCollapse() &&
|
||||||
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
||||||
PRInt32 colIndex, rowIndex;
|
PRInt32 colIndex, rowIndex;
|
||||||
@@ -443,7 +440,6 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
|
|
||||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
|
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
|
|
||||||
PRInt32 emptyCellStyle = GetContentEmpty() && !tableFrame->IsBorderCollapse() ?
|
PRInt32 emptyCellStyle = GetContentEmpty() && !tableFrame->IsBorderCollapse() ?
|
||||||
GetStyleTableBorder()->mEmptyCells
|
GetStyleTableBorder()->mEmptyCells
|
||||||
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
|
||||||
@@ -824,11 +820,6 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
aStatus = NS_FRAME_COMPLETE;
|
aStatus = NS_FRAME_COMPLETE;
|
||||||
nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight);
|
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 borderPadding = aReflowState.mComputedPadding;
|
||||||
nsMargin border;
|
nsMargin border;
|
||||||
GetBorderWidth(border);
|
GetBorderWidth(border);
|
||||||
@@ -854,6 +845,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
SetPriorAvailWidth(aReflowState.availableWidth);
|
SetPriorAvailWidth(aReflowState.availableWidth);
|
||||||
nsIFrame* firstKid = mFrames.FirstChild();
|
nsIFrame* firstKid = mFrames.FirstChild();
|
||||||
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
|
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
|
||||||
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
|
|
||||||
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
||||||
const_cast<nsHTMLReflowState&>(aReflowState).SetComputedHeight(mRect.height - topInset - bottomInset);
|
const_cast<nsHTMLReflowState&>(aReflowState).SetComputedHeight(mRect.height - topInset - bottomInset);
|
||||||
|
|||||||
@@ -90,13 +90,11 @@ nsTableColFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
|
|
||||||
if (tableFrame->IsBorderCollapse() &&
|
if (tableFrame->IsBorderCollapse() &&
|
||||||
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
||||||
nsRect damageArea = nsRect(GetColIndex(), 0, 1, tableFrame->GetRowCount());
|
nsRect damageArea = nsRect(GetColIndex(), 0, 1, tableFrame->GetRowCount());
|
||||||
tableFrame->AddBCDamageArea(damageArea);
|
tableFrame->AddBCDamageArea(damageArea);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsTableColFrame::SetContinuousBCBorderWidth(PRUint8 aForSide,
|
void nsTableColFrame::SetContinuousBCBorderWidth(PRUint8 aForSide,
|
||||||
@@ -130,10 +128,8 @@ NS_METHOD nsTableColFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
bool collapseCol = (NS_STYLE_VISIBILITY_COLLAPSE == colVis->mVisible);
|
||||||
if (collapseCol) {
|
if (collapseCol) {
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (tableFrame) {
|
|
||||||
tableFrame->SetNeedToCollapse(true);
|
tableFrame->SetNeedToCollapse(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
aStatus = NS_FRAME_COMPLETE;
|
aStatus = NS_FRAME_COMPLETE;
|
||||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|||||||
@@ -102,10 +102,7 @@ nsTableColGroupFrame::AddColsToTable(PRInt32 aFirstColIndex,
|
|||||||
bool aResetSubsequentColIndices,
|
bool aResetSubsequentColIndices,
|
||||||
const nsFrameList::Slice& aCols)
|
const nsFrameList::Slice& aCols)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
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
|
// set the col indices of the col frames and and add col info to the table
|
||||||
PRInt32 colIndex = aFirstColIndex;
|
PRInt32 colIndex = aFirstColIndex;
|
||||||
@@ -132,7 +129,7 @@ nsTableColGroupFrame::AddColsToTable(PRInt32 aFirstColIndex,
|
|||||||
ResetColIndices(GetNextSibling(), colIndex);
|
ResetColIndices(GetNextSibling(), colIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -177,9 +174,6 @@ nsTableColGroupFrame::SetInitialChildList(ChildListID aListID,
|
|||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
if (aChildList.IsEmpty()) {
|
if (aChildList.IsEmpty()) {
|
||||||
tableFrame->AppendAnonymousColFrames(this, GetSpan(), eColAnonymousColGroup,
|
tableFrame->AppendAnonymousColFrames(this, GetSpan(), eColAnonymousColGroup,
|
||||||
false);
|
false);
|
||||||
@@ -197,7 +191,6 @@ nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
|
|
||||||
if (tableFrame->IsBorderCollapse() &&
|
if (tableFrame->IsBorderCollapse() &&
|
||||||
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
||||||
PRInt32 colCount = GetColCount();
|
PRInt32 colCount = GetColCount();
|
||||||
@@ -207,7 +200,6 @@ nsTableColGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|||||||
tableFrame->GetRowCount());
|
tableFrame->GetRowCount());
|
||||||
tableFrame->AddBCDamageArea(damageArea);
|
tableFrame->AddBCDamageArea(damageArea);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@@ -359,9 +351,6 @@ nsTableColGroupFrame::RemoveFrame(ChildListID aListID,
|
|||||||
RemoveChild(*colFrame, true);
|
RemoveChild(*colFrame, true);
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
tableFrame->RemoveCol(this, colIndex, true, true);
|
tableFrame->RemoveCol(this, colIndex, true, true);
|
||||||
if (mFrames.IsEmpty() && contentRemoval &&
|
if (mFrames.IsEmpty() && contentRemoval &&
|
||||||
GetColType() == eColGroupContent) {
|
GetColType() == eColGroupContent) {
|
||||||
@@ -403,9 +392,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||||
if (collapseGroup) {
|
if (collapseGroup) {
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
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)
|
// for every content child that (is a column thingy and does not already have a frame)
|
||||||
// create a frame and adjust it's style
|
// create a frame and adjust it's style
|
||||||
@@ -487,7 +474,6 @@ void nsTableColGroupFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
|
|||||||
mTopContBorderWidth);
|
mTopContBorderWidth);
|
||||||
aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
|
aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
|
||||||
mBottomContBorderWidth);
|
mBottomContBorderWidth);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----- global methods ----- */
|
/* ----- global methods ----- */
|
||||||
|
|||||||
@@ -3364,18 +3364,15 @@ NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||||||
NS_IMPL_FRAMEARENA_HELPERS(nsTableFrame)
|
NS_IMPL_FRAMEARENA_HELPERS(nsTableFrame)
|
||||||
|
|
||||||
nsTableFrame*
|
nsTableFrame*
|
||||||
nsTableFrame::GetTableFrame(nsIFrame* aSourceFrame)
|
nsTableFrame::GetTableFrame(nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
if (aSourceFrame) {
|
for (nsIFrame* ancestor = aFrame->GetParent(); ancestor;
|
||||||
// "result" is the result of intermediate calls, not the result we return from this method
|
ancestor = ancestor->GetParent()) {
|
||||||
for (nsIFrame* parentFrame = aSourceFrame->GetParent(); parentFrame;
|
if (nsGkAtoms::tableFrame == ancestor->GetType()) {
|
||||||
parentFrame = parentFrame->GetParent()) {
|
return static_cast<nsTableFrame*>(ancestor);
|
||||||
if (nsGkAtoms::tableFrame == parentFrame->GetType()) {
|
|
||||||
return (nsTableFrame*)parentFrame;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
NS_RUNTIMEABORT("unable to find table parent");
|
||||||
NS_NOTREACHED("unable to find table parent");
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3581,14 +3578,8 @@ void nsTableIterator::Init(nsIFrame* aFirstChild)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsTableFrame* table = nsTableFrame::GetTableFrame(mFirstChild);
|
nsTableFrame* table = nsTableFrame::GetTableFrame(mFirstChild);
|
||||||
if (table) {
|
|
||||||
mLeftToRight = (NS_STYLE_DIRECTION_LTR ==
|
mLeftToRight = (NS_STYLE_DIRECTION_LTR ==
|
||||||
table->GetStyleVisibility()->mDirection);
|
table->GetStyleVisibility()->mDirection);
|
||||||
}
|
|
||||||
else {
|
|
||||||
NS_NOTREACHED("source of table iterator is not part of a table");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mLeftToRight) {
|
if (!mLeftToRight) {
|
||||||
mCount = 0;
|
mCount = 0;
|
||||||
|
|||||||
@@ -196,7 +196,6 @@ nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|||||||
nsRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
|
nsRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1);
|
||||||
tableFrame->AddBCDamageArea(damageArea);
|
tableFrame->AddBCDamageArea(damageArea);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@@ -265,7 +264,6 @@ nsTableRowFrame::RemoveFrame(ChildListID aListID,
|
|||||||
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (tableFrame) {
|
|
||||||
nsTableCellFrame *cellFrame = do_QueryFrame(aOldFrame);
|
nsTableCellFrame *cellFrame = do_QueryFrame(aOldFrame);
|
||||||
if (cellFrame) {
|
if (cellFrame) {
|
||||||
PRInt32 colIndex;
|
PRInt32 colIndex;
|
||||||
@@ -285,7 +283,6 @@ nsTableRowFrame::RemoveFrame(ChildListID aListID,
|
|||||||
NS_ERROR("unexpected frame type");
|
NS_ERROR("unexpected frame type");
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@@ -350,9 +347,6 @@ nsTableRowFrame::DidResize()
|
|||||||
{
|
{
|
||||||
// Resize and re-align the cell frames based on our row height
|
// Resize and re-align the cell frames based on our row height
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame)
|
|
||||||
return;
|
|
||||||
|
|
||||||
nsTableIterator iter(*this);
|
nsTableIterator iter(*this);
|
||||||
nsIFrame* childFrame = iter.First();
|
nsIFrame* childFrame = iter.First();
|
||||||
|
|
||||||
@@ -519,9 +513,6 @@ nscoord
|
|||||||
nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
||||||
{
|
{
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight())
|
nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight())
|
||||||
? 0 : aReflowState.ComputedHeight();
|
? 0 : aReflowState.ComputedHeight();
|
||||||
ResetHeight(computedHeight);
|
ResetHeight(computedHeight);
|
||||||
@@ -582,9 +573,9 @@ public:
|
|||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
nsDisplayTableRowBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx) {
|
nsRenderingContext* aCtx)
|
||||||
|
{
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
|
||||||
|
|
||||||
TableBackgroundPainter painter(tableFrame,
|
TableBackgroundPainter painter(tableFrame,
|
||||||
TableBackgroundPainter::eOrigin_TableRow,
|
TableBackgroundPainter::eOrigin_TableRow,
|
||||||
mFrame->PresContext(), *aCtx,
|
mFrame->PresContext(), *aCtx,
|
||||||
@@ -644,9 +635,6 @@ nsTableRowFrame::CalculateCellActualHeight(nsTableCellFrame* aCellFrame,
|
|||||||
const nsStylePosition* position = aCellFrame->GetStylePosition();
|
const nsStylePosition* position = aCellFrame->GetStylePosition();
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
PRInt32 rowSpan = tableFrame->GetEffectiveRowSpan(*aCellFrame);
|
PRInt32 rowSpan = tableFrame->GetEffectiveRowSpan(*aCellFrame);
|
||||||
|
|
||||||
switch (position->mHeight.GetUnit()) {
|
switch (position->mHeight.GetUnit()) {
|
||||||
@@ -1027,9 +1015,6 @@ nsTableRowFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
const nsStyleVisibility* rowVis = GetStyleVisibility();
|
const nsStyleVisibility* rowVis = GetStyleVisibility();
|
||||||
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
||||||
if (collapseRow) {
|
if (collapseRow) {
|
||||||
@@ -1071,15 +1056,12 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
|
|||||||
nscoord aAvailableHeight,
|
nscoord aAvailableHeight,
|
||||||
nsReflowStatus& aStatus)
|
nsReflowStatus& aStatus)
|
||||||
{
|
{
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
||||||
if (!tableFrame)
|
|
||||||
ABORT1(NS_ERROR_NULL_POINTER);
|
|
||||||
|
|
||||||
// Reflow the cell frame with the specified height. Use the existing width
|
// Reflow the cell frame with the specified height. Use the existing width
|
||||||
nsRect cellRect = aCellFrame->GetRect();
|
nsRect cellRect = aCellFrame->GetRect();
|
||||||
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
|
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
|
||||||
|
|
||||||
nsSize availSize(cellRect.width, aAvailableHeight);
|
nsSize availSize(cellRect.width, aAvailableHeight);
|
||||||
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
bool borderCollapse = tableFrame->IsBorderCollapse();
|
bool borderCollapse = tableFrame->IsBorderCollapse();
|
||||||
nsTableCellReflowState cellReflowState(aPresContext, aReflowState,
|
nsTableCellReflowState cellReflowState(aPresContext, aReflowState,
|
||||||
aCellFrame, availSize, false);
|
aCellFrame, availSize, false);
|
||||||
|
|||||||
@@ -96,10 +96,8 @@ PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
|
|||||||
// if the row group doesn't have any children, get it the hard way
|
// if the row group doesn't have any children, get it the hard way
|
||||||
if (-1 == result) {
|
if (-1 == result) {
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (tableFrame) {
|
|
||||||
return tableFrame->GetStartRowIndex(this);
|
return tableFrame->GetStartRowIndex(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -178,9 +176,9 @@ public:
|
|||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayTableRowGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
|
nsDisplayTableRowGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx) {
|
nsRenderingContext* aCtx)
|
||||||
|
{
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(mFrame);
|
||||||
|
|
||||||
TableBackgroundPainter painter(tableFrame,
|
TableBackgroundPainter painter(tableFrame,
|
||||||
TableBackgroundPainter::eOrigin_TableRowGroup,
|
TableBackgroundPainter::eOrigin_TableRowGroup,
|
||||||
mFrame->PresContext(), *aCtx,
|
mFrame->PresContext(), *aCtx,
|
||||||
@@ -350,13 +348,8 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
|
|||||||
*aPageBreakBeforeEnd = false;
|
*aPageBreakBeforeEnd = false;
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame)
|
|
||||||
ABORT1(NS_ERROR_NULL_POINTER);
|
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
const bool borderCollapse = tableFrame->IsBorderCollapse();
|
||||||
bool borderCollapse = tableFrame->IsBorderCollapse();
|
|
||||||
|
|
||||||
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
|
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
|
||||||
|
|
||||||
// XXXldb Should we really be checking this rather than available height?
|
// XXXldb Should we really be checking this rather than available height?
|
||||||
@@ -564,9 +557,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
|
|||||||
const nsHTMLReflowState& aReflowState)
|
const nsHTMLReflowState& aReflowState)
|
||||||
{
|
{
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (!tableFrame) return;
|
const bool isPaginated = aPresContext->IsPaginated();
|
||||||
|
|
||||||
bool isPaginated = aPresContext->IsPaginated();
|
|
||||||
|
|
||||||
// all table cells have the same top and bottom margins, namely cellSpacingY
|
// all table cells have the same top and bottom margins, namely cellSpacingY
|
||||||
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
|
nscoord cellSpacingY = tableFrame->GetCellSpacingY();
|
||||||
@@ -844,7 +835,6 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aYTotalOffset,
|
|||||||
nscoord aWidth)
|
nscoord aWidth)
|
||||||
{
|
{
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
|
|
||||||
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
||||||
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||||
if (collapseGroup) {
|
if (collapseGroup) {
|
||||||
@@ -1317,15 +1307,13 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
aStatus = NS_FRAME_COMPLETE;
|
aStatus = NS_FRAME_COMPLETE;
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
||||||
if (!tableFrame) return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
// Row geometry may be going to change so we need to invalidate any row cursor.
|
// Row geometry may be going to change so we need to invalidate any row cursor.
|
||||||
ClearRowCursor();
|
ClearRowCursor();
|
||||||
|
|
||||||
// see if a special height reflow needs to occur due to having a pct height
|
// see if a special height reflow needs to occur due to having a pct height
|
||||||
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
||||||
|
|
||||||
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
nsRowGroupReflowState state(aReflowState, tableFrame);
|
nsRowGroupReflowState state(aReflowState, tableFrame);
|
||||||
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
const nsStyleVisibility* groupVis = GetStyleVisibility();
|
||||||
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
|
||||||
@@ -1388,14 +1376,12 @@ nsTableRowGroupFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
|
|
||||||
if (tableFrame->IsBorderCollapse() &&
|
if (tableFrame->IsBorderCollapse() &&
|
||||||
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) {
|
||||||
nsRect damageArea(0, GetStartRowIndex(), tableFrame->GetColCount(),
|
nsRect damageArea(0, GetStartRowIndex(), tableFrame->GetColCount(),
|
||||||
GetRowCount());
|
GetRowCount());
|
||||||
tableFrame->AddBCDamageArea(damageArea);
|
tableFrame->AddBCDamageArea(damageArea);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@@ -1426,14 +1412,12 @@ nsTableRowGroupFrame::AppendFrames(ChildListID aListID,
|
|||||||
|
|
||||||
if (rows.Length() > 0) {
|
if (rows.Length() > 0) {
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (tableFrame) {
|
|
||||||
tableFrame->AppendRows(this, rowIndex, rows);
|
tableFrame->AppendRows(this, rowIndex, rows);
|
||||||
PresContext()->PresShell()->
|
PresContext()->PresShell()->
|
||||||
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
||||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||||
tableFrame->SetGeometryDirty();
|
tableFrame->SetGeometryDirty();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@@ -1449,12 +1433,9 @@ nsTableRowGroupFrame::InsertFrames(ChildListID aListID,
|
|||||||
|
|
||||||
ClearRowCursor();
|
ClearRowCursor();
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
|
||||||
if (!tableFrame)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
|
||||||
// collect the new row frames in an array
|
// collect the new row frames in an array
|
||||||
// XXXbz why are we doing the QI stuff? There shouldn't be any non-rows here.
|
// XXXbz why are we doing the QI stuff? There shouldn't be any non-rows here.
|
||||||
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
nsTArray<nsTableRowFrame*> rows;
|
nsTArray<nsTableRowFrame*> rows;
|
||||||
bool gotFirstRow = false;
|
bool gotFirstRow = false;
|
||||||
for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
|
for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
|
||||||
@@ -1500,7 +1481,7 @@ nsTableRowGroupFrame::RemoveFrame(ChildListID aListID,
|
|||||||
ClearRowCursor();
|
ClearRowCursor();
|
||||||
|
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (tableFrame) {
|
// XXX why are we doing the QI stuff? There shouldn't be any non-rows here.
|
||||||
nsTableRowFrame* rowFrame = do_QueryFrame(aOldFrame);
|
nsTableRowFrame* rowFrame = do_QueryFrame(aOldFrame);
|
||||||
if (rowFrame) {
|
if (rowFrame) {
|
||||||
// remove the rows from the table (and flag a rebalance)
|
// remove the rows from the table (and flag a rebalance)
|
||||||
@@ -1511,7 +1492,6 @@ nsTableRowGroupFrame::RemoveFrame(ChildListID aListID,
|
|||||||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||||
tableFrame->SetGeometryDirty();
|
tableFrame->SetGeometryDirty();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
mFrames.DestroyFrame(aOldFrame);
|
mFrames.DestroyFrame(aOldFrame);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -1540,7 +1520,6 @@ nsTableRowGroupFrame::GetHeightBasis(const nsHTMLReflowState& aReflowState)
|
|||||||
{
|
{
|
||||||
nscoord result = 0;
|
nscoord result = 0;
|
||||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||||
if (tableFrame) {
|
|
||||||
if ((aReflowState.ComputedHeight() > 0) && (aReflowState.ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
|
if ((aReflowState.ComputedHeight() > 0) && (aReflowState.ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
|
||||||
nscoord cellSpacing = NS_MAX(0, GetRowCount() - 1) * tableFrame->GetCellSpacingY();
|
nscoord cellSpacing = NS_MAX(0, GetRowCount() - 1) * tableFrame->GetCellSpacingY();
|
||||||
result = aReflowState.ComputedHeight() - cellSpacing;
|
result = aReflowState.ComputedHeight() - cellSpacing;
|
||||||
@@ -1556,7 +1535,6 @@ nsTableRowGroupFrame::GetHeightBasis(const nsHTMLReflowState& aReflowState)
|
|||||||
result = parentRS->ComputedHeight() - cellSpacing;
|
result = parentRS->ComputedHeight() - cellSpacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user