Bug 1242164 - Remove the implementation of colspan=0 (which is now dead code). r=dbaron

This commit is contained in:
Mats Palmgren 2016-01-27 17:02:12 +01:00
parent 2fcfd3ded9
commit 8935d48540
6 changed files with 17 additions and 309 deletions

View File

@ -599,6 +599,7 @@ nsHTMLEditor::InsertTableRow(int32_t aNumber, bool aAfter)
// We are adding a new row after all others // We are adding a new row after all others
// If it weren't for colspan=0 effect, // If it weren't for colspan=0 effect,
// we could simply use colCount for number of new cells... // we could simply use colCount for number of new cells...
// XXX colspan=0 support has now been removed in table layout so maybe this can be cleaned up now? (bug 1243183)
cellsInRow = colCount; cellsInRow = colCount;
// ...but we must compensate for all cells with rowSpan = 0 in the last row // ...but we must compensate for all cells with rowSpan = 0 in the last row

View File

@ -80,19 +80,6 @@ public:
*/ */
bool IsColSpan() const; bool IsColSpan() const;
/** is the entry spanned by a zero colspan
* zero colspans span all cells starting from the originating cell towards
* the end of the colgroup or a cell originating in the same row
* or a rowspanned entry
* @return is true if the entry is spanned by a zero colspan
*/
bool IsZeroColSpan() const;
/** mark the current entry as spanned by a zero colspan
* @param aIsZero if true mark the entry as covered by a zero colspan
*/
void SetZeroColSpan(bool aIsZero);
/** get the distance from the current entry to the corresponding origin of the colspan /** get the distance from the current entry to the corresponding origin of the colspan
* @return containing the distance in the row to the originating cell * @return containing the distance in the row to the originating cell
*/ */
@ -250,7 +237,9 @@ public:
// The layout of a celldata is as follows. The top 10 bits are the colspan // The layout of a celldata is as follows. The top 10 bits are the colspan
// offset (which is enough to represent our allowed values 1-1000 for colspan). // offset (which is enough to represent our allowed values 1-1000 for colspan).
// Then there are three bits of flags. Then 16 bits of rowspan offset (which // Then there are two bits of flags.
// XXXmats Then one unused bit that we should decide how to use in bug 862624.
// Then 16 bits of rowspan offset (which
// lets us represent numbers up to 65535. Then another 3 bits of flags. // lets us represent numbers up to 65535. Then another 3 bits of flags.
// num bits to shift right to get right aligned col span // num bits to shift right to get right aligned col span
@ -267,8 +256,7 @@ public:
#define SPAN 0x00000001 // there a row or col span #define SPAN 0x00000001 // there a row or col span
#define ROW_SPAN 0x00000002 // there is a row span #define ROW_SPAN 0x00000002 // there is a row span
#define ROW_SPAN_0 0x00000004 // the row span is 0 #define ROW_SPAN_0 0x00000004 // the row span is 0
#define COL_SPAN (1 << (COL_SPAN_SHIFT - 3)) // there is a col span #define COL_SPAN (1 << (COL_SPAN_SHIFT - 2)) // there is a col span
#define COL_SPAN_0 (1 << (COL_SPAN_SHIFT - 2)) // the col span is 0
#define OVERLAP (1 << (COL_SPAN_SHIFT - 1)) // there is a row span and #define OVERLAP (1 << (COL_SPAN_SHIFT - 1)) // there is a row span and
// col span but not by // col span but not by
// same cell // same cell
@ -348,25 +336,6 @@ inline bool CellData::IsColSpan() const
(COL_SPAN == (COL_SPAN & mBits)); (COL_SPAN == (COL_SPAN & mBits));
} }
inline bool CellData::IsZeroColSpan() const
{
return (SPAN == (SPAN & mBits)) &&
(COL_SPAN == (COL_SPAN & mBits)) &&
(COL_SPAN_0 == (COL_SPAN_0 & mBits));
}
inline void CellData::SetZeroColSpan(bool aIsZeroSpan)
{
if (SPAN == (SPAN & mBits)) {
if (aIsZeroSpan) {
mBits |= COL_SPAN_0;
}
else {
mBits &= ~COL_SPAN_0;
}
}
}
inline uint32_t CellData::GetColSpanOffset() const inline uint32_t CellData::GetColSpanOffset() const
{ {
if ((SPAN == (SPAN & mBits)) && ((COL_SPAN == (COL_SPAN & mBits)))) { if ((SPAN == (SPAN & mBits)) && ((COL_SPAN == (COL_SPAN & mBits)))) {

View File

@ -353,8 +353,7 @@ nsTableCellMap::GetEffectiveColSpan(int32_t aRowIndex,
nsCellMap* map = mFirstMap; nsCellMap* map = mFirstMap;
while (map) { while (map) {
if (map->GetRowCount() > rowIndex) { if (map->GetRowCount() > rowIndex) {
bool zeroColSpan; return map->GetEffectiveColSpan(*this, rowIndex, aColIndex);
return map->GetEffectiveColSpan(*this, rowIndex, aColIndex, zeroColSpan);
} }
rowIndex -= map->GetRowCount(); rowIndex -= map->GetRowCount();
map = map->GetNextSibling(); map = map->GetNextSibling();
@ -899,18 +898,6 @@ bool nsTableCellMap::RowHasSpanningCells(int32_t aRowIndex,
return false; return false;
} }
void nsTableCellMap::ExpandZeroColSpans()
{
mTableFrame.SetNeedColSpanExpansion(false); // mark the work done
mTableFrame.SetHasZeroColSpans(false); // reset the bit, if there is a
// zerospan it will be set again.
nsCellMap* cellMap = mFirstMap;
while (cellMap) {
cellMap->ExpandZeroColSpans(*this);
cellMap = cellMap->GetNextSibling();
}
}
void void
nsTableCellMap::ResetBStartStart(LogicalSide aSide, nsTableCellMap::ResetBStartStart(LogicalSide aSide,
nsCellMap& aCellMap, nsCellMap& aCellMap,
@ -1454,15 +1441,6 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
origData = data; origData = data;
break; break;
} }
if (data->IsZeroColSpan() ) {
// appending a cell collapses zerospans.
CollapseZeroColSpan(aMap, data, aRowIndex, startColIndex);
// ask again for the data as it should be modified
origData = GetDataAt(aRowIndex, startColIndex);
NS_ASSERTION(origData->IsDead(),
"The cellposition should have been cleared");
break;
}
} }
// We found the place to append the cell, when the next cell is appended // We found the place to append the cell, when the next cell is appended
// the next search does not need to duplicate the search but can start // the next search does not need to duplicate the search but can start
@ -1470,13 +1448,7 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
if (aColToBeginSearch) if (aColToBeginSearch)
*aColToBeginSearch = startColIndex + 1; *aColToBeginSearch = startColIndex + 1;
bool zeroColSpan = false; int32_t colSpan = aCellFrame ? aCellFrame->GetColSpan() : 1;
int32_t colSpan = (aCellFrame) ?
GetColSpanForNewCell(*aCellFrame, zeroColSpan) : 1;
if (zeroColSpan) {
aMap.mTableFrame.SetHasZeroColSpans(true);
aMap.mTableFrame.SetNeedColSpanExpansion(true);
}
// if the new cell could potentially span into other rows and collide with // if the new cell could potentially span into other rows and collide with
// originating cells there, we will play it safe and just rebuild the map // originating cells there, we will play it safe and just rebuild the map
@ -1563,10 +1535,6 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
cellData->SetOverlap(true); cellData->SetOverlap(true);
} }
cellData->SetColSpanOffset(colX - startColIndex); cellData->SetColSpanOffset(colX - startColIndex);
if (zeroColSpan) {
cellData->SetZeroColSpan(true);
}
nsColInfo* colInfo = aMap.GetColInfoAt(colX); nsColInfo* colInfo = aMap.GetColInfoAt(colX);
colInfo->mNumCellsSpan++; colInfo->mNumCellsSpan++;
} }
@ -1583,9 +1551,6 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
} }
if (colX > startColIndex) { if (colX > startColIndex) {
cellData->SetColSpanOffset(colX - startColIndex); cellData->SetColSpanOffset(colX - startColIndex);
if (zeroColSpan) {
cellData->SetZeroColSpan(true);
}
} }
SetDataAt(aMap, *cellData, rowX, colX); SetDataAt(aMap, *cellData, rowX, colX);
} }
@ -1599,50 +1564,6 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
return origData; return origData;
} }
void nsCellMap::CollapseZeroColSpan(nsTableCellMap& aMap,
CellData* aOrigData,
int32_t aRowIndex,
int32_t aColIndex)
{
// if after a colspan = 0 cell another cell is appended in a row the html 4
// spec is already violated. In principle one should then append the cell
// after the last column but then the zero spanning cell would also have
// to grow. The only plausible way to break this cycle is ignore the zero
// colspan and reset the cell to colspan = 1.
NS_ASSERTION(aOrigData && aOrigData->IsZeroColSpan(),
"zero colspan should have been passed");
// find the originating cellframe
nsTableCellFrame* cell = GetCellFrame(aRowIndex, aColIndex, *aOrigData, true);
NS_ASSERTION(cell, "originating cell not found");
// find the clearing region
int32_t startRowIndex = aRowIndex - aOrigData->GetRowSpanOffset();
bool zeroSpan;
int32_t rowSpan = GetRowSpanForNewCell(cell, startRowIndex, zeroSpan);
int32_t endRowIndex = startRowIndex + rowSpan;
int32_t origColIndex = aColIndex - aOrigData->GetColSpanOffset();
int32_t endColIndex = origColIndex +
GetEffectiveColSpan(aMap, startRowIndex,
origColIndex, zeroSpan);
for (int32_t colX = origColIndex +1; colX < endColIndex; colX++) {
// Start the collapse just after the originating cell, since
// we're basically making the originating cell act as if it
// has colspan="1".
nsColInfo* colInfo = aMap.GetColInfoAt(colX);
colInfo->mNumCellsSpan -= rowSpan;
for (int32_t rowX = startRowIndex; rowX < endRowIndex; rowX++)
{
CellData* data = mRows[rowX][colX];
NS_ASSERTION(data->IsZeroColSpan(),
"Overwriting previous data - memory leak");
data->Init(nullptr); // mark the cell as a dead cell.
}
}
}
bool nsCellMap::CellsSpanOut(nsTArray<nsTableRowFrame*>& aRows) const bool nsCellMap::CellsSpanOut(nsTArray<nsTableRowFrame*>& aRows) const
{ {
int32_t numNewRows = aRows.Length(); int32_t numNewRows = aRows.Length();
@ -1751,11 +1672,6 @@ void nsCellMap::InsertCells(nsTableCellMap& aMap,
// // Not a span. Stop. // // Not a span. Stop.
break; break;
} }
if (data->IsZeroColSpan()) {
// Zero colspans collapse. Stop in this case too.
CollapseZeroColSpan(aMap, data, aRowIndex, startColIndex);
break;
}
} }
// record whether inserted cells are going to cause complications due // record whether inserted cells are going to cause complications due
@ -1867,12 +1783,7 @@ void nsCellMap::ExpandWithCells(nsTableCellMap& aMap,
if (!origData) return; if (!origData) return;
// set the starting and ending col index for the new cell // set the starting and ending col index for the new cell
bool zeroColSpan = false; int32_t colSpan = cellFrame->GetColSpan();
int32_t colSpan = GetColSpanForNewCell(*cellFrame, zeroColSpan);
if (zeroColSpan) {
aMap.mTableFrame.SetHasZeroColSpans(true);
aMap.mTableFrame.SetNeedColSpanExpansion(true);
}
totalColSpan += colSpan; totalColSpan += colSpan;
if (cellX == 0) { if (cellX == 0) {
endColIndex = aColIndex + colSpan - 1; endColIndex = aColIndex + colSpan - 1;
@ -1915,9 +1826,6 @@ void nsCellMap::ExpandWithCells(nsTableCellMap& aMap,
} }
if (colX > startColIndex) { if (colX > startColIndex) {
data->SetColSpanOffset(colX - startColIndex); data->SetColSpanOffset(colX - startColIndex);
if (zeroColSpan) {
data->SetZeroColSpan(true);
}
} }
} }
SetDataAt(aMap, *data, rowX, colX); SetDataAt(aMap, *data, rowX, colX);
@ -2015,25 +1923,11 @@ void nsCellMap::ShrinkWithoutRows(nsTableCellMap& aMap,
aMap.GetRowCount() - firstDamagedRow, aDamageArea); aMap.GetRowCount() - firstDamagedRow, aDamageArea);
} }
int32_t nsCellMap::GetColSpanForNewCell(nsTableCellFrame& aCellFrameToAdd,
bool& aIsZeroColSpan) const
{
aIsZeroColSpan = false;
int32_t colSpan = aCellFrameToAdd.GetColSpan();
if (0 == colSpan) {
colSpan = 1; // set the min colspan it will be expanded later
aIsZeroColSpan = true;
}
return colSpan;
}
int32_t nsCellMap::GetEffectiveColSpan(const nsTableCellMap& aMap, int32_t nsCellMap::GetEffectiveColSpan(const nsTableCellMap& aMap,
int32_t aRowIndex, int32_t aRowIndex,
int32_t aColIndex, int32_t aColIndex) const
bool& aZeroColSpan) const
{ {
int32_t numColsInTable = aMap.GetColCount(); int32_t numColsInTable = aMap.GetColCount();
aZeroColSpan = false;
int32_t colSpan = 1; int32_t colSpan = 1;
if (uint32_t(aRowIndex) >= mRows.Length()) { if (uint32_t(aRowIndex) >= mRows.Length()) {
return colSpan; return colSpan;
@ -2064,9 +1958,6 @@ int32_t nsCellMap::GetEffectiveColSpan(const nsTableCellMap& aMap,
} }
if (data->IsColSpan()) { if (data->IsColSpan()) {
colSpan++; colSpan++;
if (data->IsZeroColSpan()) {
aZeroColSpan = true;
}
} }
else { else {
break; break;
@ -2157,17 +2048,12 @@ void nsCellMap::ShrinkWithoutCell(nsTableCellMap& aMap,
uint32_t colX, rowX; uint32_t colX, rowX;
// get the rowspan and colspan from the cell map since the content may have changed // get the rowspan and colspan from the cell map since the content may have changed
bool zeroColSpan;
uint32_t numCols = aMap.GetColCount(); uint32_t numCols = aMap.GetColCount();
int32_t rowSpan = GetRowSpan(aRowIndex, aColIndex, true); int32_t rowSpan = GetRowSpan(aRowIndex, aColIndex, true);
uint32_t colSpan = GetEffectiveColSpan(aMap, aRowIndex, aColIndex, zeroColSpan); uint32_t colSpan = GetEffectiveColSpan(aMap, aRowIndex, aColIndex);
uint32_t endRowIndex = aRowIndex + rowSpan - 1; uint32_t endRowIndex = aRowIndex + rowSpan - 1;
uint32_t endColIndex = aColIndex + colSpan - 1; uint32_t endColIndex = aColIndex + colSpan - 1;
if (aMap.mTableFrame.HasZeroColSpans()) {
aMap.mTableFrame.SetNeedColSpanExpansion(true);
}
// adjust the col counts due to the deleted cell before removing it // adjust the col counts due to the deleted cell before removing it
for (colX = aColIndex; colX <= endColIndex; colX++) { for (colX = aColIndex; colX <= endColIndex; colX++) {
nsColInfo* colInfo = aMap.GetColInfoAt(colX); nsColInfo* colInfo = aMap.GetColInfoAt(colX);
@ -2461,80 +2347,6 @@ void nsCellMap::RemoveCell(nsTableCellMap& aMap,
} }
} }
void nsCellMap::ExpandZeroColSpans(nsTableCellMap& aMap)
{
NS_ASSERTION(!!aMap.mBCInfo == mIsBC, "BC state mismatch");
uint32_t numRows = mRows.Length();
uint32_t numCols = aMap.GetColCount();
uint32_t rowIndex, colIndex;
for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
for (colIndex = 0; colIndex < numCols; colIndex++) {
CellData* data = mRows[rowIndex].SafeElementAt(colIndex);
if (!data || !data->IsOrig())
continue;
nsTableCellFrame* cell = data->GetCellFrame();
NS_ASSERTION(cell, "There has to be a cell");
int32_t cellRowSpan = cell->GetRowSpan();
int32_t cellColSpan = cell->GetColSpan();
bool rowZeroSpan = (0 == cell->GetRowSpan());
bool colZeroSpan = (0 == cell->GetColSpan());
if (colZeroSpan) {
aMap.mTableFrame.SetHasZeroColSpans(true);
// do the expansion
NS_ASSERTION(numRows > 0, "Bogus numRows");
NS_ASSERTION(numCols > 0, "Bogus numCols");
uint32_t endRowIndex = rowZeroSpan ? numRows - 1 :
rowIndex + cellRowSpan - 1;
uint32_t endColIndex = colZeroSpan ? numCols - 1 :
colIndex + cellColSpan - 1;
uint32_t colX, rowX;
colX = colIndex + 1;
while (colX <= endColIndex) {
// look at columns from here to our colspan. For each one, check
// the rows from here to our rowspan to make sure there is no
// obstacle to marking that column as a zerospanned column; if there
// isn't, mark it so
for (rowX = rowIndex; rowX <= endRowIndex; rowX++) {
CellData* oldData = GetDataAt(rowX, colX);
if (oldData) {
if (oldData->IsOrig()) {
break; // something is in the way
}
if (oldData->IsRowSpan()) {
if ((rowX - rowIndex) != oldData->GetRowSpanOffset()) {
break;
}
}
if (oldData->IsColSpan()) {
if ((colX - colIndex) != oldData->GetColSpanOffset()) {
break;
}
}
}
}
if (endRowIndex >= rowX)
break;// we hit something
for (rowX = rowIndex; rowX <= endRowIndex; rowX++) {
CellData* newData = AllocCellData(nullptr);
if (!newData) return;
newData->SetColSpanOffset(colX - colIndex);
newData->SetZeroColSpan(true);
if (rowX > rowIndex) {
newData->SetRowSpanOffset(rowX - rowIndex);
if (rowZeroSpan)
newData->SetZeroRowSpan(true);
}
SetDataAt(aMap, *newData, rowX, colX);
}
colX++;
} // while (colX <= endColIndex)
} // if zerocolspan
}
}
}
#ifdef DEBUG #ifdef DEBUG
void nsCellMap::Dump(bool aIsBorderCollapse) const void nsCellMap::Dump(bool aIsBorderCollapse) const
{ {
@ -2649,7 +2461,8 @@ nsCellMap::GetDataAt(int32_t aMapRowIndex,
} }
// only called if the cell at aMapRowIndex, aColIndex is null or dead // only called if the cell at aMapRowIndex, aColIndex is null or dead
// (the latter from ExpandZeroColSpans). // (the latter from ExpandZeroColSpans (XXXmats which has now been removed -
// are there other ways cells may be dead?)).
void nsCellMap::SetDataAt(nsTableCellMap& aMap, void nsCellMap::SetDataAt(nsTableCellMap& aMap,
CellData& aNewCell, CellData& aNewCell,
int32_t aMapRowIndex, int32_t aMapRowIndex,
@ -2715,8 +2528,7 @@ nsCellMap::GetCellInfoAt(const nsTableCellMap& aMap,
if (cellFrame && aColSpan) { if (cellFrame && aColSpan) {
int32_t initialColIndex; int32_t initialColIndex;
cellFrame->GetColIndex(initialColIndex); cellFrame->GetColIndex(initialColIndex);
bool zeroSpan; *aColSpan = GetEffectiveColSpan(aMap, aRowX, initialColIndex);
*aColSpan = GetEffectiveColSpan(aMap, aRowX, initialColIndex, zeroSpan);
} }
} }
return cellFrame; return cellFrame;
@ -2893,9 +2705,7 @@ nsCellMapColumnIterator::GetNextFrame(int32_t* aRow, int32_t* aColSpan)
NS_ASSERTION(cellFrame, "Orig data without cellframe?"); NS_ASSERTION(cellFrame, "Orig data without cellframe?");
*aRow = mCurMapStart + mCurMapRow; *aRow = mCurMapStart + mCurMapRow;
bool ignoredZeroSpan; *aColSpan = mCurMap->GetEffectiveColSpan(*mMap, mCurMapRow, mCol);
*aColSpan = mCurMap->GetEffectiveColSpan(*mMap, mCurMapRow, mCol,
ignoredZeroSpan);
IncrementRow(cellFrame->GetRowSpan()); IncrementRow(cellFrame->GetRowSpan());

View File

@ -198,8 +198,6 @@ protected:
TableArea& aDamageArea); TableArea& aDamageArea);
public: public:
void ExpandZeroColSpans();
void ResetBStartStart(mozilla::LogicalSide aSide, void ResetBStartStart(mozilla::LogicalSide aSide,
nsCellMap& aCellMap, nsCellMap& aCellMap,
uint32_t aYPos, uint32_t aYPos,
@ -355,22 +353,6 @@ public:
TableArea& aDamageArea, TableArea& aDamageArea,
int32_t* aBeginSearchAtCol = nullptr); int32_t* aBeginSearchAtCol = nullptr);
/** Function to be called when a cell is added at a location which is spanned
* to by a zero colspan. We handle this situation by collapsing the zero
* colspan, since there is really no good way to deal with it (trying to
* increase the number of columns to hold the new cell would just mean the
* zero colspan needs to expand).
* @param aMap - reference to the table cell map
* @param aOrigData - zero colspanned cell that will be collapsed
* @param aRowIndex - row where the first collision appears
* @param aColIndex - column where the first collision appears
**/
void CollapseZeroColSpan(nsTableCellMap& aMap,
CellData* aOrigData,
int32_t aRowIndex,
int32_t aColIndex);
void InsertCells(nsTableCellMap& aMap, void InsertCells(nsTableCellMap& aMap,
nsTArray<nsTableCellFrame*>& aCellFrames, nsTArray<nsTableCellFrame*>& aCellFrames,
int32_t aRowIndex, int32_t aRowIndex,
@ -416,8 +398,6 @@ public:
bool RowHasSpanningCells(int32_t aRowIndex, bool RowHasSpanningCells(int32_t aRowIndex,
int32_t aNumEffCols) const; int32_t aNumEffCols) const;
void ExpandZeroColSpans(nsTableCellMap& aMap);
/** indicate whether the row has more than one cell that either originates /** indicate whether the row has more than one cell that either originates
* or is spanned from the rows above * or is spanned from the rows above
*/ */
@ -435,8 +415,7 @@ public:
int32_t GetEffectiveColSpan(const nsTableCellMap& aMap, int32_t GetEffectiveColSpan(const nsTableCellMap& aMap,
int32_t aRowIndex, int32_t aRowIndex,
int32_t aColIndex, int32_t aColIndex) const;
bool& aIsZeroColSpan) const;
typedef nsTArray<CellData*> CellDataArray; typedef nsTArray<CellData*> CellDataArray;
@ -540,9 +519,6 @@ protected:
int32_t aStartColIndex, int32_t aStartColIndex,
int32_t aEndColIndex) const; int32_t aEndColIndex) const;
void ExpandForZeroSpan(nsTableCellFrame* aCellFrame,
int32_t aNumColsInTable);
bool CreateEmptyRow(int32_t aRowIndex, bool CreateEmptyRow(int32_t aRowIndex,
int32_t aNumCols); int32_t aNumCols);
@ -550,9 +526,6 @@ protected:
int32_t aRowIndex, int32_t aRowIndex,
bool& aIsZeroRowSpan) const; bool& aIsZeroRowSpan) const;
int32_t GetColSpanForNewCell(nsTableCellFrame& aCellFrameToAdd,
bool& aIsZeroColSpan) const;
// Destroy a CellData struct. This will handle the case of aData // Destroy a CellData struct. This will handle the case of aData
// actually being a BCCellData properly. // actually being a BCCellData properly.
void DestroyCellData(CellData* aData); void DestroyCellData(CellData* aData);

View File

@ -473,10 +473,9 @@ nsTableFrame::GetEffectiveColSpan(const nsTableCellFrame& aCell,
int32_t colIndex, rowIndex; int32_t colIndex, rowIndex;
aCell.GetColIndex(colIndex); aCell.GetColIndex(colIndex);
aCell.GetRowIndex(rowIndex); aCell.GetRowIndex(rowIndex);
bool ignore;
if (aCellMap) if (aCellMap)
return aCellMap->GetEffectiveColSpan(*tableCellMap, rowIndex, colIndex, ignore); return aCellMap->GetEffectiveColSpan(*tableCellMap, rowIndex, colIndex);
else else
return tableCellMap->GetEffectiveColSpan(rowIndex, colIndex); return tableCellMap->GetEffectiveColSpan(rowIndex, colIndex);
} }
@ -776,21 +775,6 @@ nsTableFrame::MatchCellMapToColCache(nsTableCellMap* aCellMap)
aCellMap->AddColsAtEnd(numColsNotRemoved); aCellMap->AddColsAtEnd(numColsNotRemoved);
} }
} }
if (numColsToAdd && HasZeroColSpans()) {
SetNeedColSpanExpansion(true);
}
if (NeedColSpanExpansion()) {
// This flag can be set in two ways -- either by changing
// the number of columns (that happens in the block above),
// or by adding a cell with colspan="0" to the cellmap. To
// handle the latter case we need to explicitly check the
// flag here -- it may be set even if the number of columns
// did not change.
//
// @see nsCellMap::AppendCell
aCellMap->ExpandZeroColSpans();
}
} }
void void

View File

@ -762,12 +762,6 @@ public:
bool NeedToCollapse() const; bool NeedToCollapse() const;
void SetNeedToCollapse(bool aValue); void SetNeedToCollapse(bool aValue);
bool HasZeroColSpans() const;
void SetHasZeroColSpans(bool aValue);
bool NeedColSpanExpansion() const;
void SetNeedColSpanExpansion(bool aValue);
/** The GeometryDirty bit is similar to the NS_FRAME_IS_DIRTY frame /** The GeometryDirty bit is similar to the NS_FRAME_IS_DIRTY frame
* state bit, which implies that all descendants are dirty. The * state bit, which implies that all descendants are dirty. The
* GeometryDirty still implies that all the parts of the table are * GeometryDirty still implies that all the parts of the table are
@ -874,9 +868,7 @@ protected:
uint32_t mNeedToCalcBCBorders:1; uint32_t mNeedToCalcBCBorders:1;
uint32_t mGeometryDirty:1; uint32_t mGeometryDirty:1;
uint32_t mIStartContBCBorder:8; uint32_t mIStartContBCBorder:8;
uint32_t mNeedToCollapse:1; // rows, cols that have visibility:collapse need to be collapsed uint32_t mNeedToCollapse:1; // rows, cols that have visibility:collapse need to be collapsed
uint32_t mHasZeroColSpans:1;
uint32_t mNeedColSpanExpansion:1;
uint32_t mResizedColumns:1; // have we resized columns since last reflow? uint32_t mResizedColumns:1; // have we resized columns since last reflow?
} mBits; } mBits;
@ -943,27 +935,6 @@ inline bool nsTableFrame::NeedToCollapse() const
return (bool) static_cast<nsTableFrame*>(FirstInFlow())->mBits.mNeedToCollapse; return (bool) static_cast<nsTableFrame*>(FirstInFlow())->mBits.mNeedToCollapse;
} }
inline void nsTableFrame::SetHasZeroColSpans(bool aValue)
{
mBits.mHasZeroColSpans = (unsigned)aValue;
}
inline bool nsTableFrame::HasZeroColSpans() const
{
return (bool)mBits.mHasZeroColSpans;
}
inline void nsTableFrame::SetNeedColSpanExpansion(bool aValue)
{
mBits.mNeedColSpanExpansion = (unsigned)aValue;
}
inline bool nsTableFrame::NeedColSpanExpansion() const
{
return (bool)mBits.mNeedColSpanExpansion;
}
inline nsFrameList& nsTableFrame::GetColGroups() inline nsFrameList& nsTableFrame::GetColGroups()
{ {
return static_cast<nsTableFrame*>(FirstInFlow())->mColGroups; return static_cast<nsTableFrame*>(FirstInFlow())->mColGroups;