зеркало из https://github.com/mozilla/pjs.git
Bug 481881 - use better template arguments for nsTArray<T> after bug 474369, layout part; r+sr=roc
This commit is contained in:
Родитель
c24c683b6c
Коммит
bbcc716f14
|
@ -7021,7 +7021,7 @@ struct DR_State
|
|||
PRBool mIndentUndisplayedFrames;
|
||||
PRBool mDisplayPixelErrors;
|
||||
nsTArray<DR_Rule*> mWildRules;
|
||||
nsTArray<DR_FrameTypeInfo*> mFrameTypeTable;
|
||||
nsTArray<DR_FrameTypeInfo> mFrameTypeTable;
|
||||
// reflow specific state
|
||||
nsTArray<DR_FrameTreeNode*> mFrameTreeLeaves;
|
||||
};
|
||||
|
@ -7073,7 +7073,6 @@ struct DR_FrameTypeInfo
|
|||
{
|
||||
DR_FrameTypeInfo(nsIAtom* aFrmeType, const char* aFrameNameAbbrev, const char* aFrameName);
|
||||
~DR_FrameTypeInfo() {
|
||||
MOZ_COUNT_DTOR(DR_FrameTypeInfo);
|
||||
PRInt32 numElements;
|
||||
numElements = mRules.Length();
|
||||
for (PRInt32 i = numElements - 1; i >= 0; i--) {
|
||||
|
@ -7085,6 +7084,8 @@ struct DR_FrameTypeInfo
|
|||
char mNameAbbrev[16];
|
||||
char mName[32];
|
||||
nsTArray<DR_Rule*> mRules;
|
||||
private:
|
||||
DR_FrameTypeInfo& operator=(const DR_FrameTypeInfo&); // NOT USED
|
||||
};
|
||||
|
||||
DR_FrameTypeInfo::DR_FrameTypeInfo(nsIAtom* aFrameType,
|
||||
|
@ -7094,7 +7095,6 @@ DR_FrameTypeInfo::DR_FrameTypeInfo(nsIAtom* aFrameType,
|
|||
mType = aFrameType;
|
||||
strcpy(mNameAbbrev, aFrameNameAbbrev);
|
||||
strcpy(mName, aFrameName);
|
||||
MOZ_COUNT_CTOR(DR_FrameTypeInfo);
|
||||
}
|
||||
|
||||
struct DR_FrameTreeNode
|
||||
|
@ -7176,10 +7176,6 @@ DR_State::~DR_State()
|
|||
for (i = numElements - 1; i >= 0; i--) {
|
||||
delete mFrameTreeLeaves.ElementAt(i);
|
||||
}
|
||||
numElements = mFrameTypeTable.Length();
|
||||
for (i = numElements - 1; i >= 0; i--) {
|
||||
delete mFrameTypeTable.ElementAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool DR_State::GetNumber(char* aBuf,
|
||||
|
@ -7310,7 +7306,7 @@ void DR_State::AddFrameTypeInfo(nsIAtom* aFrameType,
|
|||
const char* aFrameNameAbbrev,
|
||||
const char* aFrameName)
|
||||
{
|
||||
mFrameTypeTable.AppendElement(new DR_FrameTypeInfo(aFrameType, aFrameNameAbbrev, aFrameName));
|
||||
mFrameTypeTable.AppendElement(DR_FrameTypeInfo(aFrameType, aFrameNameAbbrev, aFrameName));
|
||||
}
|
||||
|
||||
DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType)
|
||||
|
@ -7318,12 +7314,12 @@ DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType)
|
|||
PRInt32 numEntries = mFrameTypeTable.Length();
|
||||
NS_ASSERTION(numEntries != 0, "empty FrameTypeTable");
|
||||
for (PRInt32 i = 0; i < numEntries; i++) {
|
||||
DR_FrameTypeInfo* info = mFrameTypeTable.ElementAt(i);
|
||||
if (info && (info->mType == aFrameType)) {
|
||||
return info;
|
||||
DR_FrameTypeInfo& info = mFrameTypeTable.ElementAt(i);
|
||||
if (info.mType == aFrameType) {
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
return mFrameTypeTable.ElementAt(numEntries - 1); // return unknown frame type
|
||||
return &mFrameTypeTable.ElementAt(numEntries - 1); // return unknown frame type
|
||||
}
|
||||
|
||||
DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(char* aFrameName)
|
||||
|
@ -7331,12 +7327,12 @@ DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(char* aFrameName)
|
|||
PRInt32 numEntries = mFrameTypeTable.Length();
|
||||
NS_ASSERTION(numEntries != 0, "empty FrameTypeTable");
|
||||
for (PRInt32 i = 0; i < numEntries; i++) {
|
||||
DR_FrameTypeInfo* info = mFrameTypeTable.ElementAt(i);
|
||||
if (info && ((strcmp(aFrameName, info->mName) == 0) || (strcmp(aFrameName, info->mNameAbbrev) == 0))) {
|
||||
return info;
|
||||
DR_FrameTypeInfo& info = mFrameTypeTable.ElementAt(i);
|
||||
if ((strcmp(aFrameName, info.mName) == 0) || (strcmp(aFrameName, info.mNameAbbrev) == 0)) {
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
return mFrameTypeTable.ElementAt(numEntries - 1); // return unknown frame type
|
||||
return &mFrameTypeTable.ElementAt(numEntries - 1); // return unknown frame type
|
||||
}
|
||||
|
||||
void DR_State::InitFrameTypeTable()
|
||||
|
@ -7476,7 +7472,7 @@ DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame,
|
|||
|
||||
DR_FrameTreeNode* lastLeaf = nsnull;
|
||||
if(mFrameTreeLeaves.Length())
|
||||
lastLeaf = (DR_FrameTreeNode*)mFrameTreeLeaves.ElementAt(mFrameTreeLeaves.Length() - 1);
|
||||
lastLeaf = mFrameTreeLeaves.ElementAt(mFrameTreeLeaves.Length() - 1);
|
||||
if (lastLeaf) {
|
||||
for (parentNode = lastLeaf; parentNode && (parentNode->mFrame != parentFrame); parentNode = parentNode->mParent) {
|
||||
}
|
||||
|
|
|
@ -2754,8 +2754,15 @@ protected:
|
|||
: mPresContext(aPresContext), mFrame(aFrame) {}
|
||||
};
|
||||
|
||||
class FrameDataComparator {
|
||||
public:
|
||||
PRBool Equals(const FrameData& aTimer, nsIFrame* const& aFrame) const {
|
||||
return aTimer.mFrame == aFrame;
|
||||
}
|
||||
};
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsTArray<FrameData*> mFrames;
|
||||
nsTArray<FrameData> mFrames;
|
||||
nsPresContext* mPresContext;
|
||||
|
||||
protected:
|
||||
|
@ -2802,26 +2809,16 @@ void nsBlinkTimer::Stop()
|
|||
NS_IMPL_ISUPPORTS1(nsBlinkTimer, nsITimerCallback)
|
||||
|
||||
void nsBlinkTimer::AddFrame(nsPresContext* aPresContext, nsIFrame* aFrame) {
|
||||
FrameData* frameData = new FrameData(aPresContext, aFrame);
|
||||
mFrames.AppendElement(frameData);
|
||||
mFrames.AppendElement(FrameData(aPresContext, aFrame));
|
||||
if (1 == mFrames.Length()) {
|
||||
Start();
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsBlinkTimer::RemoveFrame(nsIFrame* aFrame) {
|
||||
PRUint32 i, n = mFrames.Length();
|
||||
for (i = 0; i < n; i++) {
|
||||
FrameData* frameData = mFrames.ElementAt(i);
|
||||
|
||||
if (frameData->mFrame == aFrame) {
|
||||
mFrames.RemoveElementAt(i);
|
||||
delete frameData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mFrames.RemoveElement(aFrame, FrameDataComparator());
|
||||
|
||||
if (0 == mFrames.Length()) {
|
||||
if (mFrames.IsEmpty()) {
|
||||
Stop();
|
||||
}
|
||||
return PR_TRUE;
|
||||
|
@ -2853,12 +2850,12 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer)
|
|||
|
||||
PRUint32 i, n = mFrames.Length();
|
||||
for (i = 0; i < n; i++) {
|
||||
FrameData* frameData = mFrames.ElementAt(i);
|
||||
FrameData& frameData = mFrames.ElementAt(i);
|
||||
|
||||
// Determine damaged area and tell view manager to redraw it
|
||||
// blink doesn't blink outline ... I hope
|
||||
nsRect bounds(nsPoint(0, 0), frameData->mFrame->GetSize());
|
||||
frameData->mFrame->Invalidate(bounds);
|
||||
nsRect bounds(nsPoint(0, 0), frameData.mFrame->GetSize());
|
||||
frameData.mFrame->Invalidate(bounds);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -53,18 +53,6 @@
|
|||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
struct DeepTreeStackItem
|
||||
{
|
||||
DeepTreeStackItem() { MOZ_COUNT_CTOR(DeepTreeStackItem); }
|
||||
~DeepTreeStackItem() { MOZ_COUNT_DTOR(DeepTreeStackItem); }
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIDOMNodeList> kids;
|
||||
PRUint32 lastIndex;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
inDeepTreeWalker::inDeepTreeWalker()
|
||||
: mShowAnonymousContent(PR_FALSE),
|
||||
mShowSubDocuments(PR_FALSE),
|
||||
|
@ -74,9 +62,6 @@ inDeepTreeWalker::inDeepTreeWalker()
|
|||
|
||||
inDeepTreeWalker::~inDeepTreeWalker()
|
||||
{
|
||||
for (PRInt32 i = mStack.Length() - 1; i >= 0; --i) {
|
||||
delete mStack[i];
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(inDeepTreeWalker,
|
||||
|
@ -228,20 +213,19 @@ inDeepTreeWalker::NextNode(nsIDOMNode **_retval)
|
|||
nsCOMPtr<nsIDOMNode> next;
|
||||
|
||||
while (1) {
|
||||
DeepTreeStackItem* top = mStack.ElementAt(mStack.Length()-1);
|
||||
nsCOMPtr<nsIDOMNodeList> kids = top->kids;
|
||||
DeepTreeStackItem& top = mStack.ElementAt(mStack.Length()-1);
|
||||
nsCOMPtr<nsIDOMNodeList> kids = top.kids;
|
||||
PRUint32 childCount;
|
||||
kids->GetLength(&childCount);
|
||||
|
||||
if (top->lastIndex == childCount) {
|
||||
if (top.lastIndex == childCount) {
|
||||
mStack.RemoveElementAt(mStack.Length()-1);
|
||||
delete top;
|
||||
if (mStack.Length() == 0) {
|
||||
mCurrentNode = nsnull;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
kids->Item(top->lastIndex++, getter_AddRefs(next));
|
||||
kids->Item(top.lastIndex++, getter_AddRefs(next));
|
||||
PushNode(next);
|
||||
break;
|
||||
}
|
||||
|
@ -259,8 +243,8 @@ inDeepTreeWalker::PushNode(nsIDOMNode* aNode)
|
|||
mCurrentNode = aNode;
|
||||
if (!aNode) return;
|
||||
|
||||
DeepTreeStackItem* item = new DeepTreeStackItem();
|
||||
item->node = aNode;
|
||||
DeepTreeStackItem item;
|
||||
item.node = aNode;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> kids;
|
||||
if (mShowSubDocuments) {
|
||||
|
@ -286,8 +270,8 @@ inDeepTreeWalker::PushNode(nsIDOMNode* aNode)
|
|||
aNode->GetChildNodes(getter_AddRefs(kids));
|
||||
}
|
||||
|
||||
item->kids = kids;
|
||||
item->lastIndex = 0;
|
||||
item.kids = kids;
|
||||
item.lastIndex = 0;
|
||||
mStack.AppendElement(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,17 @@
|
|||
#include "nsTArray.h"
|
||||
|
||||
class inIDOMUtils;
|
||||
class DeepTreeStackItem;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
struct DeepTreeStackItem
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIDOMNodeList> kids;
|
||||
PRUint32 lastIndex;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
class inDeepTreeWalker : public inIDeepTreeWalker
|
||||
{
|
||||
|
@ -66,7 +76,7 @@ protected:
|
|||
nsCOMPtr<nsIDOMNode> mCurrentNode;
|
||||
PRUint32 mWhatToShow;
|
||||
|
||||
nsAutoTArray<DeepTreeStackItem*, 8> mStack;
|
||||
nsAutoTArray<DeepTreeStackItem, 8> mStack;
|
||||
nsCOMPtr<inIDOMUtils> mDOMUtils;
|
||||
};
|
||||
|
||||
|
|
|
@ -101,13 +101,6 @@ nsTableCellMap::~nsTableCellMap()
|
|||
cellMap = next;
|
||||
}
|
||||
|
||||
PRInt32 colCount = mCols.Length();
|
||||
for (PRInt32 colX = 0; colX < colCount; colX++) {
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
if (colInfo) {
|
||||
delete colInfo;
|
||||
}
|
||||
}
|
||||
if (mBCInfo) {
|
||||
DeleteRightBottomBorders();
|
||||
delete mBCInfo;
|
||||
|
@ -122,19 +115,12 @@ nsTableCellMap::GetRightMostBorder(PRInt32 aRowIndex)
|
|||
|
||||
PRInt32 numRows = mBCInfo->mRightBorders.Length();
|
||||
if (aRowIndex < numRows) {
|
||||
return mBCInfo->mRightBorders.ElementAt(aRowIndex);
|
||||
return &mBCInfo->mRightBorders.ElementAt(aRowIndex);
|
||||
}
|
||||
|
||||
BCData* bcData;
|
||||
PRInt32 rowX = numRows;
|
||||
|
||||
do {
|
||||
bcData = new BCData();
|
||||
if (!bcData) ABORT1(nsnull);
|
||||
mBCInfo->mRightBorders.AppendElement(bcData);
|
||||
} while (++rowX <= aRowIndex);
|
||||
|
||||
return bcData;
|
||||
if (!mBCInfo->mRightBorders.SetLength(aRowIndex+1))
|
||||
ABORT1(nsnull);
|
||||
return &mBCInfo->mRightBorders.ElementAt(aRowIndex);
|
||||
}
|
||||
|
||||
// Get the bcData holding the border segments of the bottom edge of the table
|
||||
|
@ -145,19 +131,12 @@ nsTableCellMap::GetBottomMostBorder(PRInt32 aColIndex)
|
|||
|
||||
PRInt32 numCols = mBCInfo->mBottomBorders.Length();
|
||||
if (aColIndex < numCols) {
|
||||
return mBCInfo->mBottomBorders.ElementAt(aColIndex);
|
||||
return &mBCInfo->mBottomBorders.ElementAt(aColIndex);
|
||||
}
|
||||
|
||||
BCData* bcData;
|
||||
PRInt32 colX = numCols;
|
||||
|
||||
do {
|
||||
bcData = new BCData();
|
||||
if (!bcData) ABORT1(nsnull);
|
||||
mBCInfo->mBottomBorders.AppendElement(bcData);
|
||||
} while (++colX <= aColIndex);
|
||||
|
||||
return bcData;
|
||||
if (!mBCInfo->mBottomBorders.SetLength(aColIndex+1))
|
||||
ABORT1(nsnull);
|
||||
return &mBCInfo->mBottomBorders.ElementAt(aColIndex);
|
||||
}
|
||||
|
||||
// delete the borders corresponding to the right and bottom edges of the table
|
||||
|
@ -165,22 +144,7 @@ void
|
|||
nsTableCellMap::DeleteRightBottomBorders()
|
||||
{
|
||||
if (mBCInfo) {
|
||||
PRUint32 numCols = mBCInfo->mBottomBorders.Length();
|
||||
for (PRUint32 colX = 0; colX < numCols; colX++) {
|
||||
BCData* bcData = mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
}
|
||||
mBCInfo->mBottomBorders.Clear();
|
||||
|
||||
PRUint32 numRows = mBCInfo->mRightBorders.Length();
|
||||
for (PRUint32 rowX = 0; rowX < numRows; rowX++) {
|
||||
BCData* bcData = mBCInfo->mRightBorders.ElementAt(rowX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
}
|
||||
mBCInfo->mRightBorders.Clear();
|
||||
}
|
||||
}
|
||||
|
@ -430,7 +394,7 @@ nsTableCellMap::GetColInfoAt(PRInt32 aColIndex)
|
|||
if (numColsToAdd > 0) {
|
||||
AddColsAtEnd(numColsToAdd); // XXX this could fail to add cols in theory
|
||||
}
|
||||
return mCols.ElementAt(aColIndex);
|
||||
return &mCols.ElementAt(aColIndex);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -464,29 +428,12 @@ nsTableCellMap::GetDataAt(PRInt32 aRowIndex,
|
|||
void
|
||||
nsTableCellMap::AddColsAtEnd(PRUint32 aNumCols)
|
||||
{
|
||||
PRBool added;
|
||||
// XXX We really should have a way to say "make this voidarray at least
|
||||
// N entries long" to avoid reallocating N times. On the other hand, the
|
||||
// number of likely allocations here isn't TOO gigantic, and we may not
|
||||
// know about many of them at a time.
|
||||
for (PRUint32 numX = 1; numX <= aNumCols; numX++) {
|
||||
nsColInfo* colInfo = new nsColInfo();
|
||||
if (colInfo) {
|
||||
added = mCols.AppendElement(colInfo) != nsnull;
|
||||
if (!added) {
|
||||
delete colInfo;
|
||||
NS_WARNING("Could not AppendElement");
|
||||
}
|
||||
}
|
||||
if (mBCInfo) {
|
||||
BCData* bcData = new BCData();
|
||||
if (bcData) {
|
||||
added = mBCInfo->mBottomBorders.AppendElement(bcData) != nsnull;
|
||||
if (!added) {
|
||||
delete bcData;
|
||||
NS_WARNING("Could not AppendElement");
|
||||
}
|
||||
}
|
||||
if (!mCols.AppendElements(aNumCols)) {
|
||||
NS_WARNING("Could not AppendElement");
|
||||
}
|
||||
if (mBCInfo) {
|
||||
if (!mBCInfo->mBottomBorders.AppendElements(aNumCols)) {
|
||||
NS_WARNING("Could not AppendElement");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -499,52 +446,27 @@ nsTableCellMap::RemoveColsAtEnd()
|
|||
PRInt32 numCols = GetColCount();
|
||||
PRInt32 lastGoodColIndex = mTableFrame.GetIndexOfLastRealCol();
|
||||
for (PRInt32 colX = numCols - 1; (colX >= 0) && (colX > lastGoodColIndex); colX--) {
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
if (colInfo) {
|
||||
if ((colInfo->mNumCellsOrig <= 0) && (colInfo->mNumCellsSpan <= 0)) {
|
||||
nsColInfo& colInfo = mCols.ElementAt(colX);
|
||||
if ((colInfo.mNumCellsOrig <= 0) && (colInfo.mNumCellsSpan <= 0)) {
|
||||
mCols.RemoveElementAt(colX);
|
||||
|
||||
delete colInfo;
|
||||
mCols.RemoveElementAt(colX);
|
||||
|
||||
if (mBCInfo) {
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Length();
|
||||
if (colX < count) {
|
||||
BCData* bcData = mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
mBCInfo->mBottomBorders.RemoveElementAt(colX);
|
||||
}
|
||||
if (mBCInfo) {
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Length();
|
||||
if (colX < count) {
|
||||
mBCInfo->mBottomBorders.RemoveElementAt(colX);
|
||||
}
|
||||
}
|
||||
else break; // only remove until we encounter the 1st valid one
|
||||
}
|
||||
else {
|
||||
NS_ERROR("null entry in column info array");
|
||||
mCols.RemoveElementAt(colX);
|
||||
}
|
||||
else break; // only remove until we encounter the 1st valid one
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsTableCellMap::ClearCols()
|
||||
{
|
||||
PRInt32 numCols = GetColCount();
|
||||
for (PRInt32 colX = numCols - 1; (colX >= 0);colX--) {
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
delete colInfo;
|
||||
mCols.RemoveElementAt(colX);
|
||||
if (mBCInfo) {
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Length();
|
||||
if (colX < count) {
|
||||
BCData* bcData = mBCInfo->mBottomBorders.ElementAt(colX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
mBCInfo->mBottomBorders.RemoveElementAt(colX);
|
||||
}
|
||||
}
|
||||
}
|
||||
mCols.Clear();
|
||||
if (mBCInfo)
|
||||
mBCInfo->mBottomBorders.Clear();
|
||||
}
|
||||
void
|
||||
nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
|
||||
|
@ -568,19 +490,18 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
|
|||
Dump("after InsertRows");
|
||||
#endif
|
||||
if (mBCInfo) {
|
||||
BCData* bcData;
|
||||
PRInt32 count = mBCInfo->mRightBorders.Length();
|
||||
if (aFirstRowIndex < count) {
|
||||
for (PRInt32 rowX = aFirstRowIndex; rowX < aFirstRowIndex + numNewRows; rowX++) {
|
||||
bcData = new BCData(); if (!bcData) ABORT0();
|
||||
mBCInfo->mRightBorders.InsertElementAt(rowX, bcData);
|
||||
if (!mBCInfo->mRightBorders.InsertElementAt(rowX))
|
||||
ABORT0();
|
||||
}
|
||||
}
|
||||
else {
|
||||
GetRightMostBorder(aFirstRowIndex); // this will create missing entries
|
||||
for (PRInt32 rowX = aFirstRowIndex + 1; rowX < aFirstRowIndex + numNewRows; rowX++) {
|
||||
bcData = new BCData(); if (!bcData) ABORT0();
|
||||
mBCInfo->mRightBorders.AppendElement(bcData);
|
||||
if (!mBCInfo->mRightBorders.AppendElement())
|
||||
ABORT0();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -608,13 +529,8 @@ nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
|
|||
aDamageArea.y += (rg) ? rg->GetStartRowIndex() : 0;
|
||||
aDamageArea.height = PR_MAX(0, GetRowCount() - aFirstRowIndex);
|
||||
if (mBCInfo) {
|
||||
BCData* bcData;
|
||||
for (PRInt32 rowX = aFirstRowIndex + aNumRowsToRemove - 1; rowX >= aFirstRowIndex; rowX--) {
|
||||
if (PRUint32(rowX) < mBCInfo->mRightBorders.Length()) {
|
||||
bcData = mBCInfo->mRightBorders.ElementAt(rowX);
|
||||
if (bcData) {
|
||||
delete bcData;
|
||||
}
|
||||
mBCInfo->mRightBorders.RemoveElementAt(rowX);
|
||||
}
|
||||
}
|
||||
|
@ -792,7 +708,7 @@ nsTableCellMap::GetNumCellsOriginatingInCol(PRInt32 aColIndex) const
|
|||
{
|
||||
PRInt32 colCount = mCols.Length();
|
||||
if ((aColIndex >= 0) && (aColIndex < colCount)) {
|
||||
return (mCols.ElementAt(aColIndex))->mNumCellsOrig;
|
||||
return mCols.ElementAt(aColIndex).mNumCellsOrig;
|
||||
}
|
||||
else {
|
||||
NS_ERROR("nsCellMap::GetNumCellsOriginatingInCol - bad col index");
|
||||
|
@ -811,8 +727,8 @@ nsTableCellMap::Dump(char* aString) const
|
|||
PRInt32 colCount = mCols.Length();
|
||||
printf ("cols array orig/span-> %p", (void*)this);
|
||||
for (PRInt32 colX = 0; colX < colCount; colX++) {
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
printf ("%d=%d/%d ", colX, colInfo->mNumCellsOrig, colInfo->mNumCellsSpan);
|
||||
const nsColInfo& colInfo = mCols.ElementAt(colX);
|
||||
printf ("%d=%d/%d ", colX, colInfo.mNumCellsOrig, colInfo.mNumCellsSpan);
|
||||
}
|
||||
printf(" cols in cache %d\n", mTableFrame.GetColCache().Length());
|
||||
nsCellMap* cellMap = mFirstMap;
|
||||
|
@ -833,37 +749,33 @@ nsTableCellMap::Dump(char* aString) const
|
|||
|
||||
printf("\n ");
|
||||
for (colIndex = 0; colIndex < numCols; colIndex++) {
|
||||
BCData* cd = mBCInfo->mBottomBorders.ElementAt(colIndex);
|
||||
if (cd) {
|
||||
if (0 == i) {
|
||||
size = cd->GetTopEdge(owner, segStart);
|
||||
printf("t=%d%X%d ", size, owner, segStart);
|
||||
}
|
||||
else if (1 == i) {
|
||||
size = cd->GetLeftEdge(owner, segStart);
|
||||
printf("l=%d%X%d ", size, owner, segStart);
|
||||
}
|
||||
else {
|
||||
size = cd->GetCorner(side, bevel);
|
||||
printf("c=%d%X%d ", size, side, bevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
BCData* cd = &mBCInfo->mLowerRightCorner;
|
||||
if (cd) {
|
||||
BCData& cd = mBCInfo->mBottomBorders.ElementAt(colIndex);
|
||||
if (0 == i) {
|
||||
size = cd->GetTopEdge(owner, segStart);
|
||||
printf("t=%d%X%d ", size, owner, segStart);
|
||||
size = cd.GetTopEdge(owner, segStart);
|
||||
printf("t=%d%X%d ", size, owner, segStart);
|
||||
}
|
||||
else if (1 == i) {
|
||||
size = cd->GetLeftEdge(owner, segStart);
|
||||
size = cd.GetLeftEdge(owner, segStart);
|
||||
printf("l=%d%X%d ", size, owner, segStart);
|
||||
}
|
||||
else {
|
||||
size = cd->GetCorner(side, bevel);
|
||||
size = cd.GetCorner(side, bevel);
|
||||
printf("c=%d%X%d ", size, side, bevel);
|
||||
}
|
||||
}
|
||||
BCData& cd = mBCInfo->mLowerRightCorner;
|
||||
if (0 == i) {
|
||||
size = cd.GetTopEdge(owner, segStart);
|
||||
printf("t=%d%X%d ", size, owner, segStart);
|
||||
}
|
||||
else if (1 == i) {
|
||||
size = cd.GetLeftEdge(owner, segStart);
|
||||
printf("l=%d%X%d ", size, owner, segStart);
|
||||
}
|
||||
else {
|
||||
size = cd.GetCorner(side, bevel);
|
||||
printf("c=%d%X%d ", size, side, bevel);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -1002,7 +914,7 @@ PRBool nsTableCellMap::ColIsSpannedInto(PRInt32 aColIndex) const
|
|||
|
||||
PRInt32 colCount = mCols.Length();
|
||||
if ((aColIndex >= 0) && (aColIndex < colCount)) {
|
||||
result = (mCols.ElementAt(aColIndex))->mNumCellsSpan != 0;
|
||||
result = mCols.ElementAt(aColIndex).mNumCellsSpan != 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1031,14 +943,15 @@ void nsTableCellMap::ExpandZeroColSpans()
|
|||
cellMap = cellMap->GetNextSibling();
|
||||
}
|
||||
}
|
||||
BCData*
|
||||
nsTableCellMap::GetBCData(PRUint8 aSide,
|
||||
nsCellMap& aCellMap,
|
||||
PRUint32 aRowIndex,
|
||||
PRUint32 aColIndex,
|
||||
PRBool aIsLowerRight)
|
||||
|
||||
void
|
||||
nsTableCellMap::SetNotTopStart(PRUint8 aSide,
|
||||
nsCellMap& aCellMap,
|
||||
PRUint32 aRowIndex,
|
||||
PRUint32 aColIndex,
|
||||
PRBool aIsLowerRight)
|
||||
{
|
||||
if (!mBCInfo || aIsLowerRight) ABORT1(nsnull);
|
||||
if (!mBCInfo || aIsLowerRight) ABORT0();
|
||||
|
||||
BCCellData* cellData;
|
||||
BCData* bcData = nsnull;
|
||||
|
@ -1079,7 +992,9 @@ nsTableCellMap::GetBCData(PRUint8 aSide,
|
|||
}
|
||||
break;
|
||||
}
|
||||
return bcData;
|
||||
if (bcData) {
|
||||
bcData->SetTopStart(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// store the aSide border segment at coord = (aRowIndex, aColIndex). For top/left, store
|
||||
|
|
|
@ -75,9 +75,9 @@ enum Corner
|
|||
|
||||
struct BCInfo
|
||||
{
|
||||
nsTArray<BCData*> mRightBorders;
|
||||
nsTArray<BCData*> mBottomBorders;
|
||||
BCData mLowerRightCorner;
|
||||
nsTArray<BCData> mRightBorders;
|
||||
nsTArray<BCData> mBottomBorders;
|
||||
BCData mLowerRightCorner;
|
||||
};
|
||||
|
||||
class nsTableCellMap
|
||||
|
@ -230,11 +230,11 @@ public:
|
|||
|
||||
void ExpandZeroColSpans();
|
||||
|
||||
BCData* GetBCData(PRUint8 aSide,
|
||||
nsCellMap& aCellMap,
|
||||
PRUint32 aYPos,
|
||||
PRUint32 aXPos,
|
||||
PRBool aIsLowerRight = PR_FALSE);
|
||||
void SetNotTopStart(PRUint8 aSide,
|
||||
nsCellMap& aCellMap,
|
||||
PRUint32 aYPos,
|
||||
PRUint32 aXPos,
|
||||
PRBool aIsLowerRight = PR_FALSE);
|
||||
|
||||
void SetBCBorderEdge(PRUint8 aEdge,
|
||||
nsCellMap& aCellMap,
|
||||
|
@ -279,7 +279,7 @@ protected:
|
|||
void DeleteRightBottomBorders();
|
||||
|
||||
nsTableFrame& mTableFrame;
|
||||
nsAutoTArray<nsColInfo*, 8> mCols;
|
||||
nsAutoTArray<nsColInfo, 8> mCols;
|
||||
nsCellMap* mFirstMap;
|
||||
// border collapsing info
|
||||
BCInfo* mBCInfo;
|
||||
|
|
|
@ -5849,11 +5849,8 @@ nsTableFrame::CalcBCBorders()
|
|||
(thisBorder.style == nextBorder.style)) {
|
||||
// set the flag on the next border indicating it is not the start of a new segment
|
||||
if (iter.mCellMap) {
|
||||
BCData* bcData = tableCellMap->GetBCData(NS_SIDE_BOTTOM, *iter.mCellMap, cellEndRowIndex,
|
||||
cellEndColIndex + 1);
|
||||
if (bcData) {
|
||||
bcData->SetTopStart(PR_FALSE);
|
||||
}
|
||||
tableCellMap->SetNotTopStart(NS_SIDE_BOTTOM, *iter.mCellMap,
|
||||
cellEndRowIndex, cellEndColIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5995,11 +5992,11 @@ BCMapBorderIterator::SetNewData(PRInt32 aY,
|
|||
}
|
||||
else if (IsRightMost()) {
|
||||
cellData = nsnull;
|
||||
bcData = (BCData*)tableCellMap->mBCInfo->mRightBorders.ElementAt(aY);
|
||||
bcData = &tableCellMap->mBCInfo->mRightBorders.ElementAt(aY);
|
||||
}
|
||||
else if (IsBottomMost()) {
|
||||
cellData = nsnull;
|
||||
bcData = (BCData*)tableCellMap->mBCInfo->mBottomBorders.ElementAt(aX);
|
||||
bcData = &tableCellMap->mBCInfo->mBottomBorders.ElementAt(aX);
|
||||
}
|
||||
else {
|
||||
if (PRUint32(y - fifRowGroupStart) < cellMap->mRows.Length()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче