mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
bug 135112 - correctly set border collapse damage area and fix it if incorrect when borders are calculated. a=asa, adt=jaimejr, sr=attinasi, r=bernd
This commit is contained in:
parent
ece225e1cc
commit
739509e13e
@ -564,7 +564,7 @@ nsTableCellMap::InsertCells(nsVoidArray& aCellFrames,
|
||||
cellMap->InsertCells(*this, aCellFrames, rowIndex, aColIndexBefore, aDamageArea);
|
||||
nsTableRowGroupFrame* rg = cellMap->GetRowGroup();
|
||||
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - aColIndexBefore);
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - aColIndexBefore - 1);
|
||||
break;
|
||||
}
|
||||
rowIndex -= cellMap->GetRowCount();
|
||||
@ -591,7 +591,7 @@ nsTableCellMap::RemoveCell(nsTableCellFrame* aCellFrame,
|
||||
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
|
||||
PRInt32 colIndex;
|
||||
aCellFrame->GetColIndex(colIndex);
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - colIndex);
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - colIndex - 1);
|
||||
break;
|
||||
}
|
||||
rowIndex -= cellMap->GetRowCount();
|
||||
|
@ -4824,6 +4824,22 @@ PRInt32 nsTableFrame::GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
CheckFixDamageArea(PRInt32 aNumRows,
|
||||
PRInt32 aNumCols,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
if (((aDamageArea.XMost() > aNumCols) && (aDamageArea.width != 1) & (aNumCols != 0)) ||
|
||||
((aDamageArea.YMost() > aNumRows) && (aDamageArea.height != 1) & (aNumRows != 0))) {
|
||||
// the damage area was set incorrectly, just be safe and make it the entire table
|
||||
NS_ASSERTION(PR_FALSE, "invalid BC damage area");
|
||||
aDamageArea.x = 0;
|
||||
aDamageArea.y = 0;
|
||||
aDamageArea.width = aNumCols;
|
||||
aDamageArea.height = aNumRows;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* Collapsing Borders
|
||||
*
|
||||
@ -4855,6 +4871,7 @@ nsTableFrame::SetBCDamageArea(nsIPresContext& aPresContext,
|
||||
if (value) {
|
||||
// for now just construct a union of the new and old damage areas
|
||||
value->mDamageArea.UnionRect(value->mDamageArea, newRect);
|
||||
CheckFixDamageArea(GetRowCount(), GetColCount(), value->mDamageArea);
|
||||
}
|
||||
}
|
||||
/*****************************************************************
|
||||
@ -5926,6 +5943,8 @@ nsTableFrame::CalcBCBorders(nsIPresContext& aPresContext)
|
||||
BCPropertyData* propData =
|
||||
(BCPropertyData*)nsTableFrame::GetProperty(&aPresContext, this, nsLayoutAtoms::tableBCProperty, PR_FALSE);
|
||||
if (!propData) ABORT0();
|
||||
|
||||
CheckFixDamageArea(numRows, numCols, propData->mDamageArea);
|
||||
// calculate an expanded damage area
|
||||
nsRect damageArea(propData->mDamageArea);
|
||||
ExpandBCDamageArea(damageArea);
|
||||
|
@ -564,7 +564,7 @@ nsTableCellMap::InsertCells(nsVoidArray& aCellFrames,
|
||||
cellMap->InsertCells(*this, aCellFrames, rowIndex, aColIndexBefore, aDamageArea);
|
||||
nsTableRowGroupFrame* rg = cellMap->GetRowGroup();
|
||||
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - aColIndexBefore);
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - aColIndexBefore - 1);
|
||||
break;
|
||||
}
|
||||
rowIndex -= cellMap->GetRowCount();
|
||||
@ -591,7 +591,7 @@ nsTableCellMap::RemoveCell(nsTableCellFrame* aCellFrame,
|
||||
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
|
||||
PRInt32 colIndex;
|
||||
aCellFrame->GetColIndex(colIndex);
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - colIndex);
|
||||
aDamageArea.width = PR_MAX(0, GetColCount() - colIndex - 1);
|
||||
break;
|
||||
}
|
||||
rowIndex -= cellMap->GetRowCount();
|
||||
|
@ -4824,6 +4824,22 @@ PRInt32 nsTableFrame::GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
CheckFixDamageArea(PRInt32 aNumRows,
|
||||
PRInt32 aNumCols,
|
||||
nsRect& aDamageArea)
|
||||
{
|
||||
if (((aDamageArea.XMost() > aNumCols) && (aDamageArea.width != 1) & (aNumCols != 0)) ||
|
||||
((aDamageArea.YMost() > aNumRows) && (aDamageArea.height != 1) & (aNumRows != 0))) {
|
||||
// the damage area was set incorrectly, just be safe and make it the entire table
|
||||
NS_ASSERTION(PR_FALSE, "invalid BC damage area");
|
||||
aDamageArea.x = 0;
|
||||
aDamageArea.y = 0;
|
||||
aDamageArea.width = aNumCols;
|
||||
aDamageArea.height = aNumRows;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* Collapsing Borders
|
||||
*
|
||||
@ -4855,6 +4871,7 @@ nsTableFrame::SetBCDamageArea(nsIPresContext& aPresContext,
|
||||
if (value) {
|
||||
// for now just construct a union of the new and old damage areas
|
||||
value->mDamageArea.UnionRect(value->mDamageArea, newRect);
|
||||
CheckFixDamageArea(GetRowCount(), GetColCount(), value->mDamageArea);
|
||||
}
|
||||
}
|
||||
/*****************************************************************
|
||||
@ -5926,6 +5943,8 @@ nsTableFrame::CalcBCBorders(nsIPresContext& aPresContext)
|
||||
BCPropertyData* propData =
|
||||
(BCPropertyData*)nsTableFrame::GetProperty(&aPresContext, this, nsLayoutAtoms::tableBCProperty, PR_FALSE);
|
||||
if (!propData) ABORT0();
|
||||
|
||||
CheckFixDamageArea(numRows, numCols, propData->mDamageArea);
|
||||
// calculate an expanded damage area
|
||||
nsRect damageArea(propData->mDamageArea);
|
||||
ExpandBCDamageArea(damageArea);
|
||||
|
Loading…
x
Reference in New Issue
Block a user