зеркало из https://github.com/mozilla/pjs.git
backout dac7c3176b33 from bug 481881
This commit is contained in:
Родитель
449ef2a743
Коммит
55e2cd9b37
|
@ -7020,7 +7020,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;
|
||||
};
|
||||
|
@ -7175,6 +7175,10 @@ 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,
|
||||
|
@ -7305,7 +7309,7 @@ void DR_State::AddFrameTypeInfo(nsIAtom* aFrameType,
|
|||
const char* aFrameNameAbbrev,
|
||||
const char* aFrameName)
|
||||
{
|
||||
mFrameTypeTable.AppendElement(DR_FrameTypeInfo(aFrameType, aFrameNameAbbrev, aFrameName));
|
||||
mFrameTypeTable.AppendElement(new DR_FrameTypeInfo(aFrameType, aFrameNameAbbrev, aFrameName));
|
||||
}
|
||||
|
||||
DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType)
|
||||
|
@ -7313,12 +7317,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.mType == aFrameType) {
|
||||
return &mFrameTypeTable.ElementAt(i);
|
||||
DR_FrameTypeInfo* info = mFrameTypeTable.ElementAt(i);
|
||||
if (info && (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)
|
||||
|
@ -7326,12 +7330,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 ((strcmp(aFrameName, info.mName) == 0) || (strcmp(aFrameName, info.mNameAbbrev) == 0)) {
|
||||
return &mFrameTypeTable.ElementAt(i);
|
||||
DR_FrameTypeInfo* info = mFrameTypeTable.ElementAt(i);
|
||||
if (info && ((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()
|
||||
|
@ -7471,7 +7475,7 @@ DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame,
|
|||
|
||||
DR_FrameTreeNode* lastLeaf = nsnull;
|
||||
if(mFrameTreeLeaves.Length())
|
||||
lastLeaf = mFrameTreeLeaves.ElementAt(mFrameTreeLeaves.Length() - 1);
|
||||
lastLeaf = (DR_FrameTreeNode*)mFrameTreeLeaves.ElementAt(mFrameTreeLeaves.Length() - 1);
|
||||
if (lastLeaf) {
|
||||
for (parentNode = lastLeaf; parentNode && (parentNode->mFrame != parentFrame); parentNode = parentNode->mParent) {
|
||||
}
|
||||
|
|
|
@ -2755,7 +2755,7 @@ protected:
|
|||
};
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsTArray<FrameData> mFrames;
|
||||
nsTArray<FrameData*> mFrames;
|
||||
nsPresContext* mPresContext;
|
||||
|
||||
protected:
|
||||
|
@ -2802,7 +2802,8 @@ void nsBlinkTimer::Stop()
|
|||
NS_IMPL_ISUPPORTS1(nsBlinkTimer, nsITimerCallback)
|
||||
|
||||
void nsBlinkTimer::AddFrame(nsPresContext* aPresContext, nsIFrame* aFrame) {
|
||||
mFrames.AppendElement(FrameData(aPresContext, aFrame));
|
||||
FrameData* frameData = new FrameData(aPresContext, aFrame);
|
||||
mFrames.AppendElement(frameData);
|
||||
if (1 == mFrames.Length()) {
|
||||
Start();
|
||||
}
|
||||
|
@ -2811,10 +2812,11 @@ void nsBlinkTimer::AddFrame(nsPresContext* aPresContext, nsIFrame* aFrame) {
|
|||
PRBool nsBlinkTimer::RemoveFrame(nsIFrame* aFrame) {
|
||||
PRUint32 i, n = mFrames.Length();
|
||||
for (i = 0; i < n; i++) {
|
||||
FrameData frameData = mFrames.ElementAt(i);
|
||||
FrameData* frameData = mFrames.ElementAt(i);
|
||||
|
||||
if (frameData.mFrame == aFrame) {
|
||||
if (frameData->mFrame == aFrame) {
|
||||
mFrames.RemoveElementAt(i);
|
||||
delete frameData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2851,12 +2853,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,6 +53,18 @@
|
|||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
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),
|
||||
|
@ -62,6 +74,9 @@ inDeepTreeWalker::inDeepTreeWalker()
|
|||
|
||||
inDeepTreeWalker::~inDeepTreeWalker()
|
||||
{
|
||||
for (PRInt32 i = mStack.Length() - 1; i >= 0; --i) {
|
||||
delete mStack[i];
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(inDeepTreeWalker,
|
||||
|
@ -213,19 +228,20 @@ 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;
|
||||
}
|
||||
|
@ -243,8 +259,8 @@ inDeepTreeWalker::PushNode(nsIDOMNode* aNode)
|
|||
mCurrentNode = aNode;
|
||||
if (!aNode) return;
|
||||
|
||||
DeepTreeStackItem item;
|
||||
item.node = aNode;
|
||||
DeepTreeStackItem* item = new DeepTreeStackItem();
|
||||
item->node = aNode;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> kids;
|
||||
if (mShowSubDocuments) {
|
||||
|
@ -270,8 +286,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,20 +45,7 @@
|
|||
#include "nsTArray.h"
|
||||
|
||||
class inIDOMUtils;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
struct DeepTreeStackItem
|
||||
{
|
||||
DeepTreeStackItem() { MOZ_COUNT_CTOR(DeepTreeStackItem); }
|
||||
~DeepTreeStackItem() { MOZ_COUNT_DTOR(DeepTreeStackItem); }
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIDOMNodeList> kids;
|
||||
PRUint32 lastIndex;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
class DeepTreeStackItem;
|
||||
|
||||
class inDeepTreeWalker : public inIDeepTreeWalker
|
||||
{
|
||||
|
@ -79,7 +66,7 @@ protected:
|
|||
nsCOMPtr<nsIDOMNode> mCurrentNode;
|
||||
PRUint32 mWhatToShow;
|
||||
|
||||
nsAutoTArray<DeepTreeStackItem, 8> mStack;
|
||||
nsAutoTArray<DeepTreeStackItem*, 8> mStack;
|
||||
nsCOMPtr<inIDOMUtils> mDOMUtils;
|
||||
};
|
||||
|
||||
|
|
|
@ -101,6 +101,13 @@ 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;
|
||||
|
@ -115,12 +122,19 @@ nsTableCellMap::GetRightMostBorder(PRInt32 aRowIndex)
|
|||
|
||||
PRInt32 numRows = mBCInfo->mRightBorders.Length();
|
||||
if (aRowIndex < numRows) {
|
||||
return &mBCInfo->mRightBorders.ElementAt(aRowIndex);
|
||||
return mBCInfo->mRightBorders.ElementAt(aRowIndex);
|
||||
}
|
||||
|
||||
if (!mBCInfo->mRightBorders.SetLength(aRowIndex+1))
|
||||
ABORT1(nsnull);
|
||||
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;
|
||||
}
|
||||
|
||||
// Get the bcData holding the border segments of the bottom edge of the table
|
||||
|
@ -131,12 +145,19 @@ nsTableCellMap::GetBottomMostBorder(PRInt32 aColIndex)
|
|||
|
||||
PRInt32 numCols = mBCInfo->mBottomBorders.Length();
|
||||
if (aColIndex < numCols) {
|
||||
return &mBCInfo->mBottomBorders.ElementAt(aColIndex);
|
||||
return mBCInfo->mBottomBorders.ElementAt(aColIndex);
|
||||
}
|
||||
|
||||
if (!mBCInfo->mBottomBorders.SetLength(aColIndex+1))
|
||||
ABORT1(nsnull);
|
||||
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;
|
||||
}
|
||||
|
||||
// delete the borders corresponding to the right and bottom edges of the table
|
||||
|
@ -144,7 +165,22 @@ 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();
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +430,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
|
||||
|
@ -428,12 +464,29 @@ nsTableCellMap::GetDataAt(PRInt32 aRowIndex,
|
|||
void
|
||||
nsTableCellMap::AddColsAtEnd(PRUint32 aNumCols)
|
||||
{
|
||||
if (!mCols.AppendElements(aNumCols)) {
|
||||
NS_WARNING("Could not AppendElement");
|
||||
}
|
||||
if (mBCInfo) {
|
||||
if (!mBCInfo->mBottomBorders.AppendElements(aNumCols)) {
|
||||
NS_WARNING("Could not AppendElement");
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -446,27 +499,52 @@ 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.mNumCellsOrig <= 0) && (colInfo.mNumCellsSpan <= 0)) {
|
||||
mCols.RemoveElementAt(colX);
|
||||
nsColInfo* colInfo = mCols.ElementAt(colX);
|
||||
if (colInfo) {
|
||||
if ((colInfo->mNumCellsOrig <= 0) && (colInfo->mNumCellsSpan <= 0)) {
|
||||
|
||||
if (mBCInfo) {
|
||||
PRInt32 count = mBCInfo->mBottomBorders.Length();
|
||||
if (colX < count) {
|
||||
mBCInfo->mBottomBorders.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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()
|
||||
{
|
||||
mCols.Clear();
|
||||
if (mBCInfo)
|
||||
mBCInfo->mBottomBorders.Clear();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void
|
||||
nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
|
||||
|
@ -490,18 +568,19 @@ 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++) {
|
||||
if (!mBCInfo->mRightBorders.InsertElementAt(rowX))
|
||||
ABORT0();
|
||||
bcData = new BCData(); if (!bcData) ABORT0();
|
||||
mBCInfo->mRightBorders.InsertElementAt(rowX, bcData);
|
||||
}
|
||||
}
|
||||
else {
|
||||
GetRightMostBorder(aFirstRowIndex); // this will create missing entries
|
||||
for (PRInt32 rowX = aFirstRowIndex + 1; rowX < aFirstRowIndex + numNewRows; rowX++) {
|
||||
if (!mBCInfo->mRightBorders.AppendElement())
|
||||
ABORT0();
|
||||
bcData = new BCData(); if (!bcData) ABORT0();
|
||||
mBCInfo->mRightBorders.AppendElement(bcData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -529,8 +608,13 @@ 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);
|
||||
}
|
||||
}
|
||||
|
@ -708,7 +792,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");
|
||||
|
@ -727,8 +811,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++) {
|
||||
const nsColInfo& colInfo = mCols.ElementAt(colX);
|
||||
printf ("%d=%d/%d ", colX, colInfo.mNumCellsOrig, colInfo.mNumCellsSpan);
|
||||
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;
|
||||
|
@ -749,33 +833,37 @@ nsTableCellMap::Dump(char* aString) const
|
|||
|
||||
printf("\n ");
|
||||
for (colIndex = 0; colIndex < numCols; colIndex++) {
|
||||
BCData& cd = mBCInfo->mBottomBorders.ElementAt(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) {
|
||||
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");
|
||||
}
|
||||
|
@ -914,7 +1002,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;
|
||||
}
|
||||
|
@ -943,15 +1031,14 @@ void nsTableCellMap::ExpandZeroColSpans()
|
|||
cellMap = cellMap->GetNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsTableCellMap::SetNotTopStart(PRUint8 aSide,
|
||||
nsCellMap& aCellMap,
|
||||
PRUint32 aRowIndex,
|
||||
PRUint32 aColIndex,
|
||||
PRBool aIsLowerRight)
|
||||
BCData*
|
||||
nsTableCellMap::GetBCData(PRUint8 aSide,
|
||||
nsCellMap& aCellMap,
|
||||
PRUint32 aRowIndex,
|
||||
PRUint32 aColIndex,
|
||||
PRBool aIsLowerRight)
|
||||
{
|
||||
if (!mBCInfo || aIsLowerRight) ABORT0();
|
||||
if (!mBCInfo || aIsLowerRight) ABORT1(nsnull);
|
||||
|
||||
BCCellData* cellData;
|
||||
BCData* bcData = nsnull;
|
||||
|
@ -992,9 +1079,7 @@ nsTableCellMap::SetNotTopStart(PRUint8 aSide,
|
|||
}
|
||||
break;
|
||||
}
|
||||
if (bcData) {
|
||||
bcData->SetTopStart(PR_FALSE);
|
||||
}
|
||||
return bcData;
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
void SetNotTopStart(PRUint8 aSide,
|
||||
nsCellMap& aCellMap,
|
||||
PRUint32 aYPos,
|
||||
PRUint32 aXPos,
|
||||
PRBool aIsLowerRight = PR_FALSE);
|
||||
BCData* GetBCData(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,8 +5849,11 @@ 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) {
|
||||
tableCellMap->SetNotTopStart(NS_SIDE_BOTTOM, *iter.mCellMap,
|
||||
cellEndRowIndex, cellEndColIndex + 1);
|
||||
BCData* bcData = tableCellMap->GetBCData(NS_SIDE_BOTTOM, *iter.mCellMap, cellEndRowIndex,
|
||||
cellEndColIndex + 1);
|
||||
if (bcData) {
|
||||
bcData->SetTopStart(PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5992,11 +5995,11 @@ BCMapBorderIterator::SetNewData(PRInt32 aY,
|
|||
}
|
||||
else if (IsRightMost()) {
|
||||
cellData = nsnull;
|
||||
bcData = &tableCellMap->mBCInfo->mRightBorders.ElementAt(aY);
|
||||
bcData = (BCData*)tableCellMap->mBCInfo->mRightBorders.ElementAt(aY);
|
||||
}
|
||||
else if (IsBottomMost()) {
|
||||
cellData = nsnull;
|
||||
bcData = &tableCellMap->mBCInfo->mBottomBorders.ElementAt(aX);
|
||||
bcData = (BCData*)tableCellMap->mBCInfo->mBottomBorders.ElementAt(aX);
|
||||
}
|
||||
else {
|
||||
if (PRUint32(y - fifRowGroupStart) < cellMap->mRows.Length()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче