Bug 1157569 - Followup to address review nits (renamings, comment updates) from parts 13 and 14.

This commit is contained in:
Jonathan Kew 2015-06-27 11:16:18 -07:00
Родитель d22a7ebb8c
Коммит 0cb8df0560
5 изменённых файлов: 167 добавлений и 169 удалений

Просмотреть файл

@ -93,14 +93,14 @@ nsTableCellMap::~nsTableCellMap()
}
if (mBCInfo) {
DeleteRightBottomBorders();
DeleteIEndBEndBorders();
delete mBCInfo;
}
}
// Get the bcData holding the border segments of the right edge of the table
// Get the bcData holding the border segments of the iEnd edge of the table
BCData*
nsTableCellMap::GetRightMostBorder(int32_t aRowIndex)
nsTableCellMap::GetIEndMostBorder(int32_t aRowIndex)
{
if (!mBCInfo) ABORT1(nullptr);
@ -113,9 +113,9 @@ nsTableCellMap::GetRightMostBorder(int32_t aRowIndex)
return &mBCInfo->mIEndBorders.ElementAt(aRowIndex);
}
// Get the bcData holding the border segments of the bottom edge of the table
// Get the bcData holding the border segments of the bEnd edge of the table
BCData*
nsTableCellMap::GetBottomMostBorder(int32_t aColIndex)
nsTableCellMap::GetBEndMostBorder(int32_t aColIndex)
{
if (!mBCInfo) ABORT1(nullptr);
@ -128,9 +128,9 @@ nsTableCellMap::GetBottomMostBorder(int32_t aColIndex)
return &mBCInfo->mBEndBorders.ElementAt(aColIndex);
}
// delete the borders corresponding to the right and bottom edges of the table
// delete the borders corresponding to the iEnd and bEnd edges of the table
void
nsTableCellMap::DeleteRightBottomBorders()
nsTableCellMap::DeleteIEndBEndBorders()
{
if (mBCInfo) {
mBCInfo->mBEndBorders.Clear();
@ -491,7 +491,7 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame* aParent,
}
}
else {
GetRightMostBorder(aFirstRowIndex); // this will create missing entries
GetIEndMostBorder(aFirstRowIndex); // this will create missing entries
for (int32_t rowX = aFirstRowIndex + 1; rowX < aFirstRowIndex + numNewRows; rowX++) {
mBCInfo->mIEndBorders.AppendElement();
}
@ -726,7 +726,7 @@ nsTableCellMap::Dump(char* aString) const
cellMap = cellMap->GetNextSibling();
}
if (nullptr != mBCInfo) {
printf("***** bottom borders *****\n");
printf("***** block-end borders *****\n");
nscoord size;
BCBorderOwner owner;
LogicalSide side;
@ -912,13 +912,13 @@ void nsTableCellMap::ExpandZeroColSpans()
}
void
nsTableCellMap::ResetTopStart(LogicalSide aSide,
nsCellMap& aCellMap,
uint32_t aRowIndex,
uint32_t aColIndex,
bool aIsLowerRight)
nsTableCellMap::ResetBStartStart(LogicalSide aSide,
nsCellMap& aCellMap,
uint32_t aRowIndex,
uint32_t aColIndex,
bool aIsBEndIEnd)
{
if (!mBCInfo || aIsLowerRight) ABORT0();
if (!mBCInfo || aIsBEndIEnd) ABORT0();
BCCellData* cellData;
BCData* bcData = nullptr;
@ -942,7 +942,7 @@ nsTableCellMap::ResetTopStart(LogicalSide aSide,
bcData = &cellData->mData;
}
else {
bcData = GetBottomMostBorder(aColIndex);
bcData = GetBEndMostBorder(aColIndex);
}
}
}
@ -957,7 +957,7 @@ nsTableCellMap::ResetTopStart(LogicalSide aSide,
}
else {
NS_ASSERTION(aSide == eLogicalSideIEnd, "program error");
bcData = GetRightMostBorder(aRowIndex);
bcData = GetIEndMostBorder(aRowIndex);
}
break;
}
@ -966,10 +966,10 @@ nsTableCellMap::ResetTopStart(LogicalSide aSide,
}
}
// store the aSide border segment at coord = (aRowIndex, aColIndex). For top/left, store
// the info at coord. For bottom/left store it at the adjacent location so that it is
// top/left at that location. If the new location is at the right or bottom edge of the
// table, then store it one of the special arrays (right most borders, bottom most borders).
// store the aSide border segment at coord = (aRowIndex, aColIndex). For bStart/iStart, store
// the info at coord. For bEnd/iStart store it at the adjacent location so that it is
// bStart/iStart at that location. If the new location is at the iEnd or bEnd edge of the
// table, then store it one of the special arrays (iEnd-most borders, bEnd-most borders).
void
nsTableCellMap::SetBCBorderEdge(LogicalSide aSide,
nsCellMap& aCellMap,
@ -1025,7 +1025,7 @@ nsTableCellMap::SetBCBorderEdge(LogicalSide aSide,
}
}
else { // must be at the end of the table
bcData = GetBottomMostBorder(xIndex);
bcData = GetBEndMostBorder(xIndex);
}
}
}
@ -1035,13 +1035,13 @@ nsTableCellMap::SetBCBorderEdge(LogicalSide aSide,
if (bcData) {
bcData->SetBStartEdge(aOwner, aSize, changed);
}
else NS_ERROR("Cellmap: Top edge not found");
else NS_ERROR("Cellmap: BStart edge not found");
}
break;
case eLogicalSideIEnd:
xPos++;
case eLogicalSideIStart:
// since top, bottom borders were set, there should already be a cellData entry
// since bStart, bEnd borders were set, there should already be a cellData entry
lastIndex = rgYPos + aLength - 1;
for (yIndex = rgYPos; yIndex <= lastIndex; yIndex++) {
changed = aChanged && (yIndex == rgYPos);
@ -1051,20 +1051,20 @@ nsTableCellMap::SetBCBorderEdge(LogicalSide aSide,
}
else {
NS_ASSERTION(aSide == eLogicalSideIEnd, "program error");
BCData* bcData = GetRightMostBorder(yIndex + aCellMapStart);
BCData* bcData = GetIEndMostBorder(yIndex + aCellMapStart);
if (bcData) {
bcData->SetIStartEdge(aOwner, aSize, changed);
}
else NS_ERROR("Cellmap: Left edge not found");
else NS_ERROR("Cellmap: IStart edge not found");
}
}
break;
}
}
// store corner info (aOwner, aSubSize, aBevel). For aCorner = eTopLeft, store the info at
// (aRowIndex, aColIndex). For eTopRight, store it in the entry to the right where
// it would be top left. For eBottomRight, store it in the entry to the bottom. etc.
// store corner info (aOwner, aSubSize, aBevel). For aCorner = eBStartIStart, store the info at
// (aRowIndex, aColIndex). For eBStartIEnd, store it in the entry to the iEnd-wards where
// it would be BStartIStart. For eBEndIEnd, store it in the entry to the bEnd-wards. etc.
void
nsTableCellMap::SetBCBorderCorner(Corner aCorner,
nsCellMap& aCellMap,
@ -1104,9 +1104,9 @@ nsTableCellMap::SetBCBorderCorner(Corner aCorner,
BCData* bcData = nullptr;
if (GetColCount() <= xPos) {
NS_ASSERTION(xPos == GetColCount(), "program error");
// at the right edge of the table as we checked the corner before
// at the iEnd edge of the table as we checked the corner before
NS_ASSERTION(!aIsBEndIEnd, "should be handled before");
bcData = GetRightMostBorder(yPos);
bcData = GetIEndMostBorder(yPos);
}
else {
cellData = (BCCellData*)aCellMap.GetDataAt(rgYPos, xPos);
@ -1131,8 +1131,8 @@ nsTableCellMap::SetBCBorderCorner(Corner aCorner,
false, 0, damageArea);
}
}
else { // must be at the bottom of the table
bcData = GetBottomMostBorder(xPos);
else { // must be at the bEnd of the table
bcData = GetBEndMostBorder(xPos);
}
}
}

Просмотреть файл

@ -200,11 +200,11 @@ protected:
public:
void ExpandZeroColSpans();
void ResetTopStart(mozilla::LogicalSide aSide,
nsCellMap& aCellMap,
uint32_t aYPos,
uint32_t aXPos,
bool aIsLowerRight = false);
void ResetBStartStart(mozilla::LogicalSide aSide,
nsCellMap& aCellMap,
uint32_t aYPos,
uint32_t aXPos,
bool aIsBEndIEnd = false);
void SetBCBorderEdge(mozilla::LogicalSide aEdge,
nsCellMap& aCellMap,
@ -232,8 +232,8 @@ public:
#endif
protected:
BCData* GetRightMostBorder(int32_t aRowIndex);
BCData* GetBottomMostBorder(int32_t aColIndex);
BCData* GetIEndMostBorder(int32_t aRowIndex);
BCData* GetBEndMostBorder(int32_t aColIndex);
friend class nsCellMap;
friend class BCMapCellIterator;
@ -246,7 +246,7 @@ protected:
*/
void InsertGroupCellMap(nsCellMap* aPrevMap,
nsCellMap& aNewMap);
void DeleteRightBottomBorders();
void DeleteIEndBEndBorders();
nsTableFrame& mTableFrame;
nsAutoTArray<nsColInfo, 8> mCols;

Просмотреть файл

@ -4106,16 +4106,16 @@ nsTableFrame::SetFullBCDamageArea()
}
/* BCCellBorder represents a border segment which can be either a horizontal
* or a vertical segment. For each segment we need to know the color, width,
/* BCCellBorder represents a border segment which can be either an inline-dir
* or a block-dir segment. For each segment we need to know the color, width,
* style, who owns it and how long it is in cellmap coordinates.
* Ownership of these segments is important to calculate which corners should
* be bevelled. This structure has dual use, its used first to compute the
* dominant border for horizontal and vertical segments and to store the
* dominant border for inline-dir and block-dir segments and to store the
* preliminary computed border results in the BCCellBorders structure.
* This temporary storage is not symmetric with respect to horizontal and
* vertical border segments, its always column oriented. For each column in
* the cellmap there is a temporary stored vertical and horizontal segment.
* This temporary storage is not symmetric with respect to inline-dir and
* block-dir border segments, its always column oriented. For each column in
* the cellmap there is a temporary stored block-dir and inline-dir segment.
* XXX_Bernd this asymmetry is the root of those rowspan bc border errors
*/
struct BCCellBorder
@ -4826,7 +4826,7 @@ nsTableFrame::BCRecalcNeeded(nsStyleContext* aOldStyleContext,
// Compare two border segments, this comparison depends whether the two
// segments meet at a corner and whether the second segment is horizontal.
// segments meet at a corner and whether the second segment is inline-dir.
// The return value is whichever of aBorder1 or aBorder2 dominates.
static const BCCellBorder&
CompareBorders(bool aIsCorner, // Pass true for corner calculations
@ -5156,8 +5156,8 @@ SetBorder(const BCCellBorder& aNewBorder,
return changed;
}
// this function will set the horizontal border. It will return true if the
// existing segment will not be continued. Having a vertical owner of a corner
// this function will set the inline-dir border. It will return true if the
// existing segment will not be continued. Having a block-dir owner of a corner
// should also start a new segment.
static bool
SetInlineDirBorder(const BCCellBorder& aNewBorder,
@ -5486,7 +5486,7 @@ BCMapCellInfo::SetTableBStartBorderWidth(BCPixelSize aWidth)
void
BCMapCellInfo::SetTableIStartBorderWidth(int32_t aRowB, BCPixelSize aWidth)
{
// update the left/right first cell border
// update the iStart first cell border
if (aRowB == 0) {
mTableBCData->mIStartCellBorderWidth = aWidth;
}
@ -5497,7 +5497,7 @@ BCMapCellInfo::SetTableIStartBorderWidth(int32_t aRowB, BCPixelSize aWidth)
void
BCMapCellInfo::SetTableIEndBorderWidth(int32_t aRowB, BCPixelSize aWidth)
{
// update the left/right first cell border
// update the iEnd first cell border
if (aRowB == 0) {
mTableBCData->mIEndCellBorderWidth = aWidth;
}
@ -5984,7 +5984,7 @@ nsTableFrame::CalcBCBorders()
// find the dominant border considering the cell's bEnd border, adjacent
// cells and the table, row group, row
if (info.mNumTableRows == info.GetCellEndRowIndex() + 1) {
// touches bottom edge of table
// touches bEnd edge of table
if (!tableBorderReset[eLogicalSideBEnd]) {
propData->mBEndBorderWidth = 0;
tableBorderReset[eLogicalSideBEnd] = true;
@ -6155,9 +6155,9 @@ nsTableFrame::CalcBCBorders()
// set the flag on the next border indicating it is not the start of a
// new segment
if (iter.mCellMap) {
tableCellMap->ResetTopStart(eLogicalSideBEnd, *iter.mCellMap,
info.GetCellEndRowIndex(),
info.GetCellEndColIndex() + 1);
tableCellMap->ResetBStartStart(eLogicalSideBEnd, *iter.mCellMap,
info.GetCellEndRowIndex(),
info.GetCellEndColIndex() + 1);
}
}
}
@ -6232,11 +6232,11 @@ struct BCInlineDirSeg
void Start(BCPaintBorderIterator& aIter,
BCBorderOwner aBorderOwner,
BCPixelSize aBEndBlockSegWidth,
BCPixelSize aBEndBlockSegISize,
BCPixelSize aInlineSegBSize);
void GetIEndCorner(BCPaintBorderIterator& aIter,
BCPixelSize aIStartSegWidth);
void AdvanceOffsetI(int32_t aIncrement);
BCPixelSize aIStartSegISize);
void AdvanceOffsetI();
void IncludeCurrentBorder(BCPaintBorderIterator& aIter);
void Paint(BCPaintBorderIterator& aIter,
nsRenderingContext& aRenderingContext);
@ -6269,8 +6269,8 @@ class BCPaintBorderIterator
{
public:
explicit BCPaintBorderIterator(nsTableFrame* aTable);
~BCPaintBorderIterator() { if (mVerInfo) {
delete [] mVerInfo;
~BCPaintBorderIterator() { if (mBlockDirInfo) {
delete [] mBlockDirInfo;
}}
void Reset();
@ -6336,10 +6336,10 @@ public:
BCCellData* mCellData;
BCData* mBCData;
bool IsTableTopMost() {return (mRowIndex == 0) && !mTable->GetPrevInFlow();}
bool IsTableRightMost() {return (mColIndex >= mNumTableCols);}
bool IsTableBottomMost() {return (mRowIndex >= mNumTableRows) && !mTable->GetNextInFlow();}
bool IsTableLeftMost() {return (mColIndex == 0);}
bool IsTableBStartMost() {return (mRowIndex == 0) && !mTable->GetPrevInFlow();}
bool IsTableIEndMost() {return (mColIndex >= mNumTableCols);}
bool IsTableBEndMost() {return (mRowIndex >= mNumTableRows) && !mTable->GetNextInFlow();}
bool IsTableIStartMost() {return (mColIndex == 0);}
bool IsDamageAreaBStartMost() const
{ return mRowIndex == mDamageArea.StartRow(); }
bool IsDamageAreaIEndMost() const
@ -6352,7 +6352,8 @@ public:
{ return mColIndex - mDamageArea.StartCol(); }
TableArea mDamageArea; // damageArea in cellmap coordinates
bool IsAfterRepeatedHeader() { return !mIsRepeatedHeader && (mRowIndex == (mRepeatedHeaderRowIndex + 1));}
bool IsAfterRepeatedHeader()
{ return !mIsRepeatedHeader && (mRowIndex == (mRepeatedHeaderRowIndex + 1)); }
bool StartRepeatedFooter() const
{
return mIsRepeatedFooter && mRowIndex == mRgFirstRowIndex &&
@ -6364,7 +6365,7 @@ public:
nscoord mInitialOffsetB; // offsetB of the first border with
// respect to the table
nscoord mNextOffsetB; // offsetB of the next segment
BCBlockDirSeg* mVerInfo; // this array is used differently when
BCBlockDirSeg* mBlockDirInfo; // this array is used differently when
// inline-dir and block-dir borders are drawn
// When inline-dir border are drawn we cache
// the column widths and the width of the
@ -6396,7 +6397,7 @@ BCPaintBorderIterator::BCPaintBorderIterator(nsTableFrame* aTable)
, mTableCellMap(aTable->GetCellMap())
, mTableWM(aTable->StyleContext())
{
mVerInfo = nullptr;
mBlockDirInfo = nullptr;
LogicalMargin childAreaOffset = mTable->GetChildAreaOffset(mTableWM, nullptr);
// y position of first row in damage area
mInitialOffsetB =
@ -6474,19 +6475,16 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
haveIntersect = false;
if (0 == mNumTableCols)
return false;
int32_t leftCol, rightCol; // columns are in the range [leftCol, rightCol)
LogicalMargin childAreaOffset = mTable->GetChildAreaOffset(mTableWM, nullptr);
// x position of first col in damage area
// inline position of first col in damage area
mInitialOffsetI = childAreaOffset.IStart(mTableWM);
leftCol = 0;
rightCol = mNumTableCols;
nscoord x = 0;
int32_t colX;
for (colX = leftCol; colX != rightCol; colX++) {
nsTableColFrame* colFrame = mTableFirstInFlow->GetColFrame(colX);
int32_t colIdx;
for (colIdx = 0; colIdx != mNumTableCols; colIdx++) {
nsTableColFrame* colFrame = mTableFirstInFlow->GetColFrame(colIdx);
if (!colFrame) ABORT1(false);
// get the col rect relative to the table rather than the col group
nscoord colISize = colFrame->ISize(mTableWM);
@ -6495,7 +6493,7 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
nscoord iStartBorderHalf = nsPresContext::
CSSPixelsToAppUnits(colFrame->GetIStartBorderWidth() + 1);
if (dirtyRect.IEnd(mTableWM) >= x - iStartBorderHalf) {
endColIndex = colX;
endColIndex = colIdx;
}
else break;
}
@ -6504,7 +6502,7 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
nscoord iEndBorderHalf = nsPresContext::
CSSPixelsToAppUnits(colFrame->GetIEndBorderWidth() + 1);
if (x + colISize + iEndBorderHalf >= dirtyRect.IStart(mTableWM)) {
startColIndex = endColIndex = colX;
startColIndex = endColIndex = colIdx;
haveIntersect = true;
}
else {
@ -6520,8 +6518,8 @@ BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
1 + endRowIndex - startRowIndex);
Reset();
mVerInfo = new BCBlockDirSeg[mDamageArea.ColCount() + 1];
if (!mVerInfo)
mBlockDirInfo = new BCBlockDirSeg[mDamageArea.ColCount() + 1];
if (!mBlockDirInfo)
return false;
return true;
}
@ -6558,15 +6556,15 @@ BCPaintBorderIterator::SetNewData(int32_t aY,
mColIndex = aX;
mRowIndex = aY;
mPrevCellData = mCellData;
if (IsTableRightMost() && IsTableBottomMost()) {
if (IsTableIEndMost() && IsTableBEndMost()) {
mCell = nullptr;
mBCData = &mTableCellMap->mBCInfo->mBEndIEndCorner;
}
else if (IsTableRightMost()) {
else if (IsTableIEndMost()) {
mCellData = nullptr;
mBCData = &mTableCellMap->mBCInfo->mIEndBorders.ElementAt(aY);
}
else if (IsTableBottomMost()) {
else if (IsTableBEndMost()) {
mCellData = nullptr;
mBCData = &mTableCellMap->mBCInfo->mBEndBorders.ElementAt(aX);
}
@ -6840,13 +6838,13 @@ BCBlockDirSeg::Start(BCPaintBorderIterator& aIter,
nscoord cornerSubWidth = (aIter.mBCData) ?
aIter.mBCData->GetCorner(ownerSide, bevel) : 0;
bool topBevel = (aBlockSegISize > 0) ? bevel : false;
bool bStartBevel = (aBlockSegISize > 0) ? bevel : false;
BCPixelSize maxInlineSegBSize = std::max(aIter.mPrevInlineSegBSize, aInlineSegBSize);
nscoord offset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
maxInlineSegBSize, true,
topBevel);
bStartBevel);
mBStartBevelOffset = topBevel ?
mBStartBevelOffset = bStartBevel ?
nsPresContext::CSSPixelsToAppUnits(maxInlineSegBSize): 0;
// XXX this assumes that only corners where 2 segments join can be beveled
mBStartBevelSide = (aInlineSegBSize > 0) ? eLogicalSideIEnd : eLogicalSideIStart;
@ -6858,28 +6856,28 @@ BCBlockDirSeg::Start(BCPaintBorderIterator& aIter,
mFirstRowGroup = aIter.mRg;
mFirstRow = aIter.mRow;
if (aIter.GetRelativeColIndex() > 0) {
mAjaCell = aIter.mVerInfo[aIter.GetRelativeColIndex() - 1].mLastCell;
mAjaCell = aIter.mBlockDirInfo[aIter.GetRelativeColIndex() - 1].mLastCell;
}
}
/**
* Initialize the vertical segments with information that will persist for any
* vertical segment in this column
* Initialize the block-dir segments with information that will persist for any
* block-dir segment in this column
* @param aIter - iterator containing the structural information
*/
void
BCBlockDirSeg::Initialize(BCPaintBorderIterator& aIter)
{
int32_t relColIndex = aIter.GetRelativeColIndex();
mCol = aIter.IsTableRightMost() ? aIter.mVerInfo[relColIndex - 1].mCol :
mCol = aIter.IsTableIEndMost() ? aIter.mBlockDirInfo[relColIndex - 1].mCol :
aIter.mTableFirstInFlow->GetColFrame(aIter.mColIndex);
if (!mCol) ABORT0();
if (0 == relColIndex) {
mOffsetI = aIter.mInitialOffsetI;
}
// set colX for the next column
// set mOffsetI for the next column
if (!aIter.IsDamageAreaIEndMost()) {
aIter.mVerInfo[relColIndex + 1].mOffsetI =
aIter.mBlockDirInfo[relColIndex + 1].mOffsetI =
mOffsetI + mCol->ISize(aIter.mTableWM);
}
mOffsetB = aIter.mInitialOffsetB;
@ -6887,10 +6885,10 @@ BCBlockDirSeg::Initialize(BCPaintBorderIterator& aIter)
}
/**
* Compute the offsets for the bottom corner of a vertical segment
* @param aIter - iterator containing the structural information
* @param aInlineSegBSize - the width of the horizontal segment joining the corner
* at the start
* Compute the offsets for the bEnd corner of a block-dir segment
* @param aIter - iterator containing the structural information
* @param aInlineSegBSize - the width of the inline-dir segment joining the corner
* at the start
*/
void
BCBlockDirSeg::GetBEndCorner(BCPaintBorderIterator& aIter,
@ -6911,11 +6909,11 @@ BCBlockDirSeg::GetBEndCorner(BCPaintBorderIterator& aIter,
}
/**
* Paint the vertical segment
* @param aIter - iterator containing the structural information
* Paint the block-dir segment
* @param aIter - iterator containing the structural information
* @param aRenderingContext - the rendering context
* @param aInlineSegBSize - the width of the horizontal segment joining the corner
* at the start
* @param aInlineSegBSize - the width of the inline-dir segment joining the corner
* at the start
*/
void
BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
@ -6942,8 +6940,8 @@ BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
break;
case eAjaColGroupOwner:
side = eLogicalSideIEnd;
if (!aIter.IsTableRightMost() && (relColIndex > 0)) {
col = aIter.mVerInfo[relColIndex - 1].mCol;
if (!aIter.IsTableIEndMost() && (relColIndex > 0)) {
col = aIter.mBlockDirInfo[relColIndex - 1].mCol;
} // and fall through
case eColGroupOwner:
if (col) {
@ -6952,8 +6950,8 @@ BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
break;
case eAjaColOwner:
side = eLogicalSideIEnd;
if (!aIter.IsTableRightMost() && (relColIndex > 0)) {
col = aIter.mVerInfo[relColIndex - 1].mCol;
if (!aIter.IsTableIEndMost() && (relColIndex > 0)) {
col = aIter.mBlockDirInfo[relColIndex - 1].mCol;
} // and fall through
case eColOwner:
owner = col;
@ -6962,14 +6960,14 @@ BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
NS_ERROR("a neighboring rowgroup can never own a vertical border");
// and fall through
case eRowGroupOwner:
NS_ASSERTION(aIter.IsTableLeftMost() || aIter.IsTableRightMost(),
NS_ASSERTION(aIter.IsTableIStartMost() || aIter.IsTableIEndMost(),
"row group can own border only at table edge");
owner = mFirstRowGroup;
break;
case eAjaRowOwner:
NS_ERROR("program error"); // and fall through
case eRowOwner:
NS_ASSERTION(aIter.IsTableLeftMost() || aIter.IsTableRightMost(),
NS_ASSERTION(aIter.IsTableIStartMost() || aIter.IsTableIEndMost(),
"row can own border only at table edge");
owner = mFirstRow;
break;
@ -7034,13 +7032,13 @@ BCInlineDirSeg::BCInlineDirSeg()
/** Initialize an inline-dir border segment for painting
* @param aIter - iterator storing the current and adjacent frames
* @param aBorderOwner - which frame owns the border
* @param aBEndBlockSegWidth - block-dir segment width coming from up
* @param aBEndBlockSegISize - block-dir segment width coming from up
* @param aInlineSegBSize - the thickness of the segment
+ */
void
BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
BCBorderOwner aBorderOwner,
BCPixelSize aBEndBlockSegWidth,
BCPixelSize aBEndBlockSegISize,
BCPixelSize aInlineSegBSize)
{
LogicalSide cornerOwnerSide = eLogicalSideBStart;
@ -7051,32 +7049,32 @@ BCInlineDirSeg::Start(BCPaintBorderIterator& aIter,
aIter.mBCData->GetCorner(cornerOwnerSide,
bevel) : 0;
bool leftBevel = (aInlineSegBSize > 0) ? bevel : false;
bool iStartBevel = (aInlineSegBSize > 0) ? bevel : false;
int32_t relColIndex = aIter.GetRelativeColIndex();
nscoord maxBlockSegISize = std::max(aIter.mVerInfo[relColIndex].mWidth,
aBEndBlockSegWidth);
nscoord maxBlockSegISize = std::max(aIter.mBlockDirInfo[relColIndex].mWidth,
aBEndBlockSegISize);
nscoord offset = CalcHorCornerOffset(cornerOwnerSide, cornerSubWidth,
maxBlockSegISize, true, leftBevel);
mIStartBevelOffset = (leftBevel && (aInlineSegBSize > 0)) ? maxBlockSegISize : 0;
maxBlockSegISize, true, iStartBevel);
mIStartBevelOffset = (iStartBevel && (aInlineSegBSize > 0)) ? maxBlockSegISize : 0;
// XXX this assumes that only corners where 2 segments join can be beveled
mIStartBevelSide = (aBEndBlockSegWidth > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
mIStartBevelSide = (aBEndBlockSegISize > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
mOffsetI += offset;
mLength = -offset;
mWidth = aInlineSegBSize;
mFirstCell = aIter.mCell;
mAjaCell = (aIter.IsDamageAreaBStartMost()) ? nullptr :
aIter.mVerInfo[relColIndex].mLastCell;
aIter.mBlockDirInfo[relColIndex].mLastCell;
}
/**
* Compute the offsets for the right corner of a horizontal segment
* Compute the offsets for the iEnd corner of an inline-dir segment
* @param aIter - iterator containing the structural information
* @param aIStartSegWidth - the width of the vertical segment joining the corner
* @param aIStartSegISize - the iSize of the block-dir segment joining the corner
* at the start
*/
void
BCInlineDirSeg::GetIEndCorner(BCPaintBorderIterator& aIter,
BCPixelSize aIStartSegWidth)
BCPixelSize aIStartSegISize)
{
LogicalSide ownerSide = eLogicalSideBStart;
nscoord cornerSubWidth = 0;
@ -7087,23 +7085,24 @@ BCInlineDirSeg::GetIEndCorner(BCPaintBorderIterator& aIter,
mIsIEndBevel = (mWidth > 0) ? bevel : 0;
int32_t relColIndex = aIter.GetRelativeColIndex();
nscoord verWidth = std::max(aIter.mVerInfo[relColIndex].mWidth, aIStartSegWidth);
nscoord verWidth = std::max(aIter.mBlockDirInfo[relColIndex].mWidth,
aIStartSegISize);
mEndOffset = CalcHorCornerOffset(ownerSide, cornerSubWidth, verWidth,
false, mIsIEndBevel);
mLength += mEndOffset;
mIEndBevelOffset = (mIsIEndBevel) ?
nsPresContext::CSSPixelsToAppUnits(verWidth) : 0;
mIEndBevelSide = (aIStartSegWidth > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
mIEndBevelSide = (aIStartSegISize > 0) ? eLogicalSideBEnd : eLogicalSideBStart;
}
/**
* Paint the inline-dir segment
* @param aIter - iterator containing the structural information
* @param aIter - iterator containing the structural information
* @param aRenderingContext - the rendering context
*/
void
BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter,
nsRenderingContext& aRenderingContext)
nsRenderingContext& aRenderingContext)
{
// get the border style, color and paint the segment
LogicalSide side =
@ -7121,39 +7120,38 @@ BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter,
uint8_t style = NS_STYLE_BORDER_STYLE_SOLID;
nscolor color = 0xFFFFFFFF;
switch (mOwner) {
case eTableOwner:
owner = aIter.mTable;
break;
case eAjaColGroupOwner:
NS_ERROR("neighboring colgroups can never own a horizontal border");
NS_ERROR("neighboring colgroups can never own an inline-dir border");
// and fall through
case eColGroupOwner:
NS_ASSERTION(aIter.IsTableTopMost() || aIter.IsTableBottomMost(),
NS_ASSERTION(aIter.IsTableBStartMost() || aIter.IsTableBEndMost(),
"col group can own border only at the table edge");
col = aIter.mTableFirstInFlow->GetColFrame(aIter.mColIndex - 1);
if (!col) ABORT0();
owner = col->GetParent();
break;
case eAjaColOwner:
NS_ERROR("neighboring column can never own a horizontal border");
NS_ERROR("neighboring column can never own an inline-dir border");
// and fall through
case eColOwner:
NS_ASSERTION(aIter.IsTableTopMost() || aIter.IsTableBottomMost(),
NS_ASSERTION(aIter.IsTableBStartMost() || aIter.IsTableBEndMost(),
"col can own border only at the table edge");
owner = aIter.mTableFirstInFlow->GetColFrame(aIter.mColIndex - 1);
break;
case eAjaRowGroupOwner:
side = eLogicalSideBEnd;
rg = (aIter.IsTableBottomMost()) ? aIter.mRg : aIter.mPrevRg;
rg = (aIter.IsTableBEndMost()) ? aIter.mRg : aIter.mPrevRg;
// and fall through
case eRowGroupOwner:
owner = rg;
break;
case eAjaRowOwner:
side = eLogicalSideBEnd;
row = (aIter.IsTableBottomMost()) ? aIter.mRow : aIter.mPrevRow;
row = (aIter.IsTableBEndMost()) ? aIter.mRow : aIter.mPrevRow;
// and fall through
case eRowOwner:
owner = row;
@ -7206,9 +7204,9 @@ BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter,
* Advance the start point of a segment
*/
void
BCInlineDirSeg::AdvanceOffsetI(int32_t aIncrement)
BCInlineDirSeg::AdvanceOffsetI()
{
mOffsetI += aIncrement * (mLength - mEndOffset);
mOffsetI += (mLength - mEndOffset);
}
/**
@ -7217,26 +7215,26 @@ BCInlineDirSeg::AdvanceOffsetI(int32_t aIncrement)
void
BCInlineDirSeg::IncludeCurrentBorder(BCPaintBorderIterator& aIter)
{
mLength += aIter.mVerInfo[aIter.GetRelativeColIndex()].mColWidth;
mLength += aIter.mBlockDirInfo[aIter.GetRelativeColIndex()].mColWidth;
}
/**
* store the column width information while painting horizontal segment
* store the column width information while painting inline-dir segment
*/
void
BCPaintBorderIterator::StoreColumnWidth(int32_t aIndex)
{
if (IsTableRightMost()) {
mVerInfo[aIndex].mColWidth = mVerInfo[aIndex - 1].mColWidth;
if (IsTableIEndMost()) {
mBlockDirInfo[aIndex].mColWidth = mBlockDirInfo[aIndex - 1].mColWidth;
}
else {
nsTableColFrame* col = mTableFirstInFlow->GetColFrame(mColIndex);
if (!col) ABORT0();
mVerInfo[aIndex].mColWidth = col->ISize(mTableWM);
mBlockDirInfo[aIndex].mColWidth = col->ISize(mTableWM);
}
}
/**
* Determine if a vertical segment owns the corder
* Determine if a block-dir segment owns the corner
*/
bool
BCPaintBorderIterator::BlockDirSegmentOwnsCorner()
@ -7261,7 +7259,7 @@ BCPaintBorderIterator::AccumulateOrPaintInlineDirSegment(nsRenderingContext& aRe
int32_t relColIndex = GetRelativeColIndex();
// store the current col width if it hasn't been already
if (mVerInfo[relColIndex].mColWidth < 0) {
if (mBlockDirInfo[relColIndex].mColWidth < 0) {
StoreColumnWidth(relColIndex);
}
@ -7284,23 +7282,23 @@ BCPaintBorderIterator::AccumulateOrPaintInlineDirSegment(nsRenderingContext& aRe
}
if (!IsDamageAreaIStartMost() && (isSegStart || IsDamageAreaIEndMost() ||
BlockDirSegmentOwnsCorner())) {
BlockDirSegmentOwnsCorner())) {
// paint the previous seg or the current one if IsDamageAreaIEndMost()
if (mInlineSeg.mLength > 0) {
mInlineSeg.GetIEndCorner(*this, iStartSegISize);
if (mInlineSeg.mWidth > 0) {
mInlineSeg.Paint(*this, aRenderingContext);
}
mInlineSeg.AdvanceOffsetI(1);
mInlineSeg.AdvanceOffsetI();
}
mInlineSeg.Start(*this, borderOwner, iStartSegISize, bStartSegBSize);
}
mInlineSeg.IncludeCurrentBorder(*this);
mVerInfo[relColIndex].mWidth = iStartSegISize;
mVerInfo[relColIndex].mLastCell = mCell;
mBlockDirInfo[relColIndex].mWidth = iStartSegISize;
mBlockDirInfo[relColIndex].mLastCell = mCell;
}
/**
* Paint if necessary a block-dir segment, otherwise it
* Paint if necessary a block-dir segment, otherwise accumulate it
* @param aRenderingContext - the rendering context
*/
void
@ -7317,27 +7315,27 @@ BCPaintBorderIterator::AccumulateOrPaintBlockDirSegment(nsRenderingContext& aRen
mBCData ? mBCData->GetBStartEdge(ignoreBorderOwner, ignoreSegStart) : 0;
int32_t relColIndex = GetRelativeColIndex();
BCBlockDirSeg& verSeg = mVerInfo[relColIndex];
if (!verSeg.mCol) { // on the first damaged row and the first segment in the
// col
verSeg.Initialize(*this);
verSeg.Start(*this, borderOwner, blockSegISize, inlineSegBSize);
BCBlockDirSeg& blockDirSeg = mBlockDirInfo[relColIndex];
if (!blockDirSeg.mCol) { // on the first damaged row and the first segment in the
// col
blockDirSeg.Initialize(*this);
blockDirSeg.Start(*this, borderOwner, blockSegISize, inlineSegBSize);
}
if (!IsDamageAreaBStartMost() && (isSegStart || IsDamageAreaBEndMost() ||
IsAfterRepeatedHeader() ||
StartRepeatedFooter())) {
IsAfterRepeatedHeader() ||
StartRepeatedFooter())) {
// paint the previous seg or the current one if IsDamageAreaBEndMost()
if (verSeg.mLength > 0) {
verSeg.GetBEndCorner(*this, inlineSegBSize);
if (verSeg.mWidth > 0) {
verSeg.Paint(*this, aRenderingContext, inlineSegBSize);
if (blockDirSeg.mLength > 0) {
blockDirSeg.GetBEndCorner(*this, inlineSegBSize);
if (blockDirSeg.mWidth > 0) {
blockDirSeg.Paint(*this, aRenderingContext, inlineSegBSize);
}
verSeg.AdvanceOffsetB();
blockDirSeg.AdvanceOffsetB();
}
verSeg.Start(*this, borderOwner, blockSegISize, inlineSegBSize);
blockDirSeg.Start(*this, borderOwner, blockSegISize, inlineSegBSize);
}
verSeg.IncludeCurrentBorder(*this);
blockDirSeg.IncludeCurrentBorder(*this);
mPrevInlineSegBSize = inlineSegBSize;
}
@ -7347,11 +7345,11 @@ BCPaintBorderIterator::AccumulateOrPaintBlockDirSegment(nsRenderingContext& aRen
void
BCPaintBorderIterator::ResetVerInfo()
{
if (mVerInfo) {
memset(mVerInfo, 0, mDamageArea.ColCount() * sizeof(BCBlockDirSeg));
if (mBlockDirInfo) {
memset(mBlockDirInfo, 0, mDamageArea.ColCount() * sizeof(BCBlockDirSeg));
// XXX reinitialize properly
for (auto xIndex : MakeRange(mDamageArea.ColCount())) {
mVerInfo[xIndex].mColWidth = -1;
mBlockDirInfo[xIndex].mColWidth = -1;
}
}
}
@ -7381,13 +7379,13 @@ nsTableFrame::PaintBCBorders(nsRenderingContext& aRenderingContext,
// we look up if the current border would start a new segment, if so we paint
// the previously stored vertical segment and start a new segment. After
// this we the now active segment with the current border. These
// segments are stored in mVerInfo to be used on the next row
// segments are stored in mBlockDirInfo to be used on the next row
for (iter.First(); !iter.mAtEnd; iter.Next()) {
iter.AccumulateOrPaintBlockDirSegment(aRenderingContext);
}
// Next, paint all of the inline-dir border segments from bStart to bEnd reuse
// the mVerInfo array to keep track of col widths and block-dir segments for
// the mBlockDirInfo array to keep track of col widths and block-dir segments for
// corner calculations
iter.Reset();
for (iter.First(); !iter.mAtEnd; iter.Next()) {

Просмотреть файл

@ -300,7 +300,7 @@ public:
nsMargin GetDeflationForBackground(nsPresContext* aPresContext) const;
/** Get width of table + colgroup + col collapse: elements that
* continue along the length of the whole left side.
* continue along the length of the whole iStart side.
* see nsTablePainter about continuous borders
*/
nscoord GetContinuousIStartBCBorderWidth() const;

Просмотреть файл

@ -319,16 +319,16 @@ TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
mColGroups.SetCapacity(colGroupFrames.Length());
LogicalMargin border(wm);
/* BC left borders aren't stored on cols, but the previous column's
right border is the next one's left border.*/
//Start with table's left border.
nscoord lastLeftBorder = aTableFrame->GetContinuousIStartBCBorderWidth();
/* BC iStart borders aren't stored on cols, but the previous column's
iEnd border is the next one's iStart border.*/
//Start with table's iStart border.
nscoord lastIStartBorder = aTableFrame->GetContinuousIStartBCBorderWidth();
for (nsTableColGroupFrame* cgFrame : colGroupFrames) {
/*Create data struct for column group*/
TableBackgroundData& cgData = *mColGroups.AppendElement(TableBackgroundData(cgFrame));
if (mIsBorderCollapse && cgData.ShouldSetBCBorder()) {
border.IStart(wm) = lastLeftBorder;
border.IStart(wm) = lastIStartBorder;
cgFrame->GetContinuousBCBorderWidth(wm, border);
cgData.SetBCBorder(border.GetPhysicalMargin(wm));
}
@ -342,8 +342,8 @@ TableBackgroundPainter::PaintTable(nsTableFrame* aTableFrame,
//Bring column mRect into table's coord system
colData.mCol.mRect.MoveBy(cgData.mRect.x, cgData.mRect.y);
if (mIsBorderCollapse) {
border.IStart(wm) = lastLeftBorder;
lastLeftBorder = col->GetContinuousBCBorderWidth(wm, border);
border.IStart(wm) = lastIStartBorder;
lastIStartBorder = col->GetContinuousBCBorderWidth(wm, border);
if (colData.mCol.ShouldSetBCBorder()) {
colData.mCol.SetBCBorder(border.GetPhysicalMargin(wm));
}