1. enhancement of the debug code so that coltypes become visible
2. remove the isanonymous flag which is unused 3. make the col dump routine #ifdef DEBUG 4. stop to defer the appending of the colgroup frame. bug 248474 r/sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@161755 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
0be99300a4
commit
beb1e800a5
@ -49,15 +49,13 @@
|
||||
|
||||
#define COL_TYPE_BITS 0xF0000000 // uses bits 29-32 from mState
|
||||
#define COL_TYPE_OFFSET 28
|
||||
#define COL_ANONYMOUS_BIT 0x08000000 // uses bit 28
|
||||
#define COL_ANONYMOUS_OFFSET 27
|
||||
|
||||
#define COL_CONSTRAINT_BITS 0x07000000 // uses bits 25-27
|
||||
#define COL_CONSTRAINT_OFFSET 24
|
||||
|
||||
nsTableColFrame::nsTableColFrame()
|
||||
: nsFrame()
|
||||
{
|
||||
SetIsAnonymous(PR_FALSE);
|
||||
SetColType(eColContent);
|
||||
ResetSizingInfo();
|
||||
}
|
||||
@ -92,19 +90,6 @@ nsTableColFrame::SetConstraint(nsColConstraint aConstraint)
|
||||
mState |= (con << COL_CONSTRAINT_OFFSET);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsTableColFrame::IsAnonymous()
|
||||
{
|
||||
return ((mState & COL_ANONYMOUS_BIT) > 0);
|
||||
}
|
||||
|
||||
void
|
||||
nsTableColFrame::SetIsAnonymous(PRBool aIsAnonymous)
|
||||
{
|
||||
PRUint32 anon = (aIsAnonymous) ? 1 : 0;
|
||||
mState |= (anon << COL_ANONYMOUS_OFFSET);
|
||||
}
|
||||
|
||||
// XXX what about other style besides width
|
||||
nsStyleCoord nsTableColFrame::GetStyleWidth() const
|
||||
{
|
||||
@ -241,6 +226,7 @@ nscoord nsTableColFrame::GetPctWidth()
|
||||
return PR_MAX(mWidths[PCT], mWidths[PCT_ADJ]);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void nsTableColFrame::Dump(PRInt32 aIndent)
|
||||
{
|
||||
char* indent = new char[aIndent + 1];
|
||||
@ -250,16 +236,31 @@ void nsTableColFrame::Dump(PRInt32 aIndent)
|
||||
}
|
||||
indent[aIndent] = 0;
|
||||
|
||||
printf("%s**START COL DUMP** colIndex=%d isAnonymous=%d constraint=%d",
|
||||
indent, mColIndex, IsAnonymous(), GetConstraint());
|
||||
printf("%s**START COL DUMP**\n%s colIndex=%d constraint=%d coltype=",
|
||||
indent, indent, mColIndex, GetConstraint());
|
||||
nsTableColType colType = GetColType();
|
||||
switch (colType) {
|
||||
case eColContent:
|
||||
printf(" content ");
|
||||
break;
|
||||
case eColAnonymousCol:
|
||||
printf(" anonymous-column ");
|
||||
break;
|
||||
case eColAnonymousColGroup:
|
||||
printf(" anonymous-colgroup ");
|
||||
break;
|
||||
case eColAnonymousCell:
|
||||
printf(" anonymous-cell ");
|
||||
break;
|
||||
}
|
||||
printf("\n%s widths=", indent);
|
||||
for (PRInt32 widthX = 0; widthX < NUM_WIDTHS; widthX++) {
|
||||
printf("%d ", mWidths[widthX]);
|
||||
}
|
||||
printf(" **END COL DUMP** ");
|
||||
printf("\n%s**END COL DUMP** ", indent);
|
||||
delete [] indent;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* ----- global methods ----- */
|
||||
|
||||
nsresult
|
||||
|
||||
@ -161,12 +161,6 @@ public:
|
||||
/** convenience method, calls into cellmap */
|
||||
PRInt32 Count() const;
|
||||
|
||||
/** Return true if this col was constructed implicitly due to cells needing a col.
|
||||
* Return false if this col was constructed due to content having display type of table-col
|
||||
*/
|
||||
PRBool IsAnonymous();
|
||||
void SetIsAnonymous(PRBool aValue);
|
||||
|
||||
void ResetSizingInfo();
|
||||
|
||||
nscoord GetLeftBorderWidth(float* aPixelsToTwips = nsnull);
|
||||
@ -190,8 +184,9 @@ public:
|
||||
*/
|
||||
void SetContinuousBCBorderWidth(PRUint8 aForSide,
|
||||
BCPixelSize aPixelValue);
|
||||
|
||||
#ifdef DEBUG
|
||||
void Dump(PRInt32 aIndent);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@ -624,4 +624,31 @@ nsTableColGroupFrame::GetFrameName(nsAString& aResult) const
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("TableColGroup"), aResult);
|
||||
}
|
||||
|
||||
void nsTableColGroupFrame::Dump(PRInt32 aIndent)
|
||||
{
|
||||
char* indent = new char[aIndent + 1];
|
||||
if (!indent) return;
|
||||
for (PRInt32 i = 0; i < aIndent + 1; i++) {
|
||||
indent[i] = ' ';
|
||||
}
|
||||
indent[aIndent] = 0;
|
||||
|
||||
printf("%s**START COLGROUP DUMP**\n%s startcolIndex=%d colcount=%d span=%d coltype=",
|
||||
indent, indent, GetStartColumnIndex(), GetColCount(), GetSpan());
|
||||
nsTableColGroupType colType = GetColType();
|
||||
switch (colType) {
|
||||
case eColGroupContent:
|
||||
printf(" content ");
|
||||
break;
|
||||
case eColGroupAnonymousCol:
|
||||
printf(" anonymous-column ");
|
||||
break;
|
||||
case eColGroupAnonymousCell:
|
||||
printf(" anonymous-cell ");
|
||||
break;
|
||||
}
|
||||
printf("\n%s**END COLGROUP DUMP** ", indent);
|
||||
delete [] indent;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -202,6 +202,7 @@ public:
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
void Dump(PRInt32 aIndent);
|
||||
#endif
|
||||
|
||||
/** returns the number of columns represented by this group.
|
||||
|
||||
@ -2476,11 +2476,9 @@ nsTableFrame::AppendFrames(nsPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aFrameList)
|
||||
{
|
||||
PRInt32 startColIndex = 0;
|
||||
// Because we actually have two child lists, one for col group frames and one
|
||||
// for everything else, we need to look at each frame individually
|
||||
nsIFrame* f = aFrameList;
|
||||
nsIFrame* firstAppendedColGroup = nsnull;
|
||||
while (f) {
|
||||
// Get the next frame and disconnect this frame from its sibling
|
||||
nsIFrame* next = f->GetNextSibling();
|
||||
@ -2490,14 +2488,15 @@ nsTableFrame::AppendFrames(nsPresContext* aPresContext,
|
||||
const nsStyleDisplay* display = f->GetStyleDisplay();
|
||||
|
||||
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == display->mDisplay) {
|
||||
if (!firstAppendedColGroup) {
|
||||
firstAppendedColGroup = f;
|
||||
nsTableColGroupFrame* lastColGroup = (nsTableColGroupFrame *)mColGroups.LastChild();
|
||||
startColIndex = (lastColGroup)
|
||||
? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;
|
||||
}
|
||||
nsTableColGroupFrame* lastColGroup = (nsTableColGroupFrame *)mColGroups.LastChild();
|
||||
PRInt32 startColIndex = (lastColGroup)
|
||||
? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;
|
||||
|
||||
// Append the new col group frame
|
||||
mColGroups.AppendFrame(nsnull, f);
|
||||
|
||||
// Insert the colgroup and its cols into the table
|
||||
InsertColGroups(*aPresContext, startColIndex, f);
|
||||
} else if (IsRowGroup(display->mDisplay)) {
|
||||
// Append the new row group frame to the sibling chain
|
||||
mFrames.AppendFrame(nsnull, f);
|
||||
@ -2513,10 +2512,10 @@ nsTableFrame::AppendFrames(nsPresContext* aPresContext,
|
||||
f = next;
|
||||
}
|
||||
|
||||
if (firstAppendedColGroup) {
|
||||
InsertColGroups(*aPresContext, startColIndex, firstAppendedColGroup);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("TableFrame::AppendFrames");
|
||||
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
|
||||
#endif
|
||||
SetNeedStrategyInit(PR_TRUE); // XXX assume the worse
|
||||
AppendDirtyReflowCommand(&aPresShell, this);
|
||||
|
||||
@ -4318,12 +4317,35 @@ nsTableFrame::Dump(PRBool aDumpRows,
|
||||
if (aDumpCols) {
|
||||
// output col frame cache
|
||||
printf("\n col frame cache ->");
|
||||
for (colX = 0; colX < numCols; colX++) {
|
||||
for (colX = 0; colX < numCols; colX++) {
|
||||
nsTableColFrame* colFrame = (nsTableColFrame *)mColFrames.ElementAt(colX);
|
||||
if (0 == (colX % 8)) {
|
||||
printf("\n");
|
||||
}
|
||||
printf ("%d=%p ", colX, colFrame);
|
||||
nsTableColType colType = colFrame->GetColType();
|
||||
switch (colType) {
|
||||
case eColContent:
|
||||
printf(" content ");
|
||||
break;
|
||||
case eColAnonymousCol:
|
||||
printf(" anonymous-column ");
|
||||
break;
|
||||
case eColAnonymousColGroup:
|
||||
printf(" anonymous-colgroup ");
|
||||
break;
|
||||
case eColAnonymousCell:
|
||||
printf(" anonymous-cell ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("\n colgroups->");
|
||||
for (nsIFrame* childFrame = mColGroups.FirstChild(); childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) {
|
||||
nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame *)childFrame;
|
||||
colGroupFrame->Dump(1);
|
||||
}
|
||||
}
|
||||
for (colX = 0; colX < numCols; colX++) {
|
||||
printf("\n");
|
||||
|
||||
@ -49,15 +49,13 @@
|
||||
|
||||
#define COL_TYPE_BITS 0xF0000000 // uses bits 29-32 from mState
|
||||
#define COL_TYPE_OFFSET 28
|
||||
#define COL_ANONYMOUS_BIT 0x08000000 // uses bit 28
|
||||
#define COL_ANONYMOUS_OFFSET 27
|
||||
|
||||
#define COL_CONSTRAINT_BITS 0x07000000 // uses bits 25-27
|
||||
#define COL_CONSTRAINT_OFFSET 24
|
||||
|
||||
nsTableColFrame::nsTableColFrame()
|
||||
: nsFrame()
|
||||
{
|
||||
SetIsAnonymous(PR_FALSE);
|
||||
SetColType(eColContent);
|
||||
ResetSizingInfo();
|
||||
}
|
||||
@ -92,19 +90,6 @@ nsTableColFrame::SetConstraint(nsColConstraint aConstraint)
|
||||
mState |= (con << COL_CONSTRAINT_OFFSET);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsTableColFrame::IsAnonymous()
|
||||
{
|
||||
return ((mState & COL_ANONYMOUS_BIT) > 0);
|
||||
}
|
||||
|
||||
void
|
||||
nsTableColFrame::SetIsAnonymous(PRBool aIsAnonymous)
|
||||
{
|
||||
PRUint32 anon = (aIsAnonymous) ? 1 : 0;
|
||||
mState |= (anon << COL_ANONYMOUS_OFFSET);
|
||||
}
|
||||
|
||||
// XXX what about other style besides width
|
||||
nsStyleCoord nsTableColFrame::GetStyleWidth() const
|
||||
{
|
||||
@ -241,6 +226,7 @@ nscoord nsTableColFrame::GetPctWidth()
|
||||
return PR_MAX(mWidths[PCT], mWidths[PCT_ADJ]);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void nsTableColFrame::Dump(PRInt32 aIndent)
|
||||
{
|
||||
char* indent = new char[aIndent + 1];
|
||||
@ -250,16 +236,31 @@ void nsTableColFrame::Dump(PRInt32 aIndent)
|
||||
}
|
||||
indent[aIndent] = 0;
|
||||
|
||||
printf("%s**START COL DUMP** colIndex=%d isAnonymous=%d constraint=%d",
|
||||
indent, mColIndex, IsAnonymous(), GetConstraint());
|
||||
printf("%s**START COL DUMP**\n%s colIndex=%d constraint=%d coltype=",
|
||||
indent, indent, mColIndex, GetConstraint());
|
||||
nsTableColType colType = GetColType();
|
||||
switch (colType) {
|
||||
case eColContent:
|
||||
printf(" content ");
|
||||
break;
|
||||
case eColAnonymousCol:
|
||||
printf(" anonymous-column ");
|
||||
break;
|
||||
case eColAnonymousColGroup:
|
||||
printf(" anonymous-colgroup ");
|
||||
break;
|
||||
case eColAnonymousCell:
|
||||
printf(" anonymous-cell ");
|
||||
break;
|
||||
}
|
||||
printf("\n%s widths=", indent);
|
||||
for (PRInt32 widthX = 0; widthX < NUM_WIDTHS; widthX++) {
|
||||
printf("%d ", mWidths[widthX]);
|
||||
}
|
||||
printf(" **END COL DUMP** ");
|
||||
printf("\n%s**END COL DUMP** ", indent);
|
||||
delete [] indent;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* ----- global methods ----- */
|
||||
|
||||
nsresult
|
||||
|
||||
@ -161,12 +161,6 @@ public:
|
||||
/** convenience method, calls into cellmap */
|
||||
PRInt32 Count() const;
|
||||
|
||||
/** Return true if this col was constructed implicitly due to cells needing a col.
|
||||
* Return false if this col was constructed due to content having display type of table-col
|
||||
*/
|
||||
PRBool IsAnonymous();
|
||||
void SetIsAnonymous(PRBool aValue);
|
||||
|
||||
void ResetSizingInfo();
|
||||
|
||||
nscoord GetLeftBorderWidth(float* aPixelsToTwips = nsnull);
|
||||
@ -190,8 +184,9 @@ public:
|
||||
*/
|
||||
void SetContinuousBCBorderWidth(PRUint8 aForSide,
|
||||
BCPixelSize aPixelValue);
|
||||
|
||||
#ifdef DEBUG
|
||||
void Dump(PRInt32 aIndent);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@ -624,4 +624,31 @@ nsTableColGroupFrame::GetFrameName(nsAString& aResult) const
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("TableColGroup"), aResult);
|
||||
}
|
||||
|
||||
void nsTableColGroupFrame::Dump(PRInt32 aIndent)
|
||||
{
|
||||
char* indent = new char[aIndent + 1];
|
||||
if (!indent) return;
|
||||
for (PRInt32 i = 0; i < aIndent + 1; i++) {
|
||||
indent[i] = ' ';
|
||||
}
|
||||
indent[aIndent] = 0;
|
||||
|
||||
printf("%s**START COLGROUP DUMP**\n%s startcolIndex=%d colcount=%d span=%d coltype=",
|
||||
indent, indent, GetStartColumnIndex(), GetColCount(), GetSpan());
|
||||
nsTableColGroupType colType = GetColType();
|
||||
switch (colType) {
|
||||
case eColGroupContent:
|
||||
printf(" content ");
|
||||
break;
|
||||
case eColGroupAnonymousCol:
|
||||
printf(" anonymous-column ");
|
||||
break;
|
||||
case eColGroupAnonymousCell:
|
||||
printf(" anonymous-cell ");
|
||||
break;
|
||||
}
|
||||
printf("\n%s**END COLGROUP DUMP** ", indent);
|
||||
delete [] indent;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -202,6 +202,7 @@ public:
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
void Dump(PRInt32 aIndent);
|
||||
#endif
|
||||
|
||||
/** returns the number of columns represented by this group.
|
||||
|
||||
@ -2476,11 +2476,9 @@ nsTableFrame::AppendFrames(nsPresContext* aPresContext,
|
||||
nsIAtom* aListName,
|
||||
nsIFrame* aFrameList)
|
||||
{
|
||||
PRInt32 startColIndex = 0;
|
||||
// Because we actually have two child lists, one for col group frames and one
|
||||
// for everything else, we need to look at each frame individually
|
||||
nsIFrame* f = aFrameList;
|
||||
nsIFrame* firstAppendedColGroup = nsnull;
|
||||
while (f) {
|
||||
// Get the next frame and disconnect this frame from its sibling
|
||||
nsIFrame* next = f->GetNextSibling();
|
||||
@ -2490,14 +2488,15 @@ nsTableFrame::AppendFrames(nsPresContext* aPresContext,
|
||||
const nsStyleDisplay* display = f->GetStyleDisplay();
|
||||
|
||||
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == display->mDisplay) {
|
||||
if (!firstAppendedColGroup) {
|
||||
firstAppendedColGroup = f;
|
||||
nsTableColGroupFrame* lastColGroup = (nsTableColGroupFrame *)mColGroups.LastChild();
|
||||
startColIndex = (lastColGroup)
|
||||
? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;
|
||||
}
|
||||
nsTableColGroupFrame* lastColGroup = (nsTableColGroupFrame *)mColGroups.LastChild();
|
||||
PRInt32 startColIndex = (lastColGroup)
|
||||
? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;
|
||||
|
||||
// Append the new col group frame
|
||||
mColGroups.AppendFrame(nsnull, f);
|
||||
|
||||
// Insert the colgroup and its cols into the table
|
||||
InsertColGroups(*aPresContext, startColIndex, f);
|
||||
} else if (IsRowGroup(display->mDisplay)) {
|
||||
// Append the new row group frame to the sibling chain
|
||||
mFrames.AppendFrame(nsnull, f);
|
||||
@ -2513,10 +2512,10 @@ nsTableFrame::AppendFrames(nsPresContext* aPresContext,
|
||||
f = next;
|
||||
}
|
||||
|
||||
if (firstAppendedColGroup) {
|
||||
InsertColGroups(*aPresContext, startColIndex, firstAppendedColGroup);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TABLE_CELLMAP
|
||||
printf("TableFrame::AppendFrames");
|
||||
Dump(PR_TRUE, PR_TRUE, PR_TRUE);
|
||||
#endif
|
||||
SetNeedStrategyInit(PR_TRUE); // XXX assume the worse
|
||||
AppendDirtyReflowCommand(&aPresShell, this);
|
||||
|
||||
@ -4318,12 +4317,35 @@ nsTableFrame::Dump(PRBool aDumpRows,
|
||||
if (aDumpCols) {
|
||||
// output col frame cache
|
||||
printf("\n col frame cache ->");
|
||||
for (colX = 0; colX < numCols; colX++) {
|
||||
for (colX = 0; colX < numCols; colX++) {
|
||||
nsTableColFrame* colFrame = (nsTableColFrame *)mColFrames.ElementAt(colX);
|
||||
if (0 == (colX % 8)) {
|
||||
printf("\n");
|
||||
}
|
||||
printf ("%d=%p ", colX, colFrame);
|
||||
nsTableColType colType = colFrame->GetColType();
|
||||
switch (colType) {
|
||||
case eColContent:
|
||||
printf(" content ");
|
||||
break;
|
||||
case eColAnonymousCol:
|
||||
printf(" anonymous-column ");
|
||||
break;
|
||||
case eColAnonymousColGroup:
|
||||
printf(" anonymous-colgroup ");
|
||||
break;
|
||||
case eColAnonymousCell:
|
||||
printf(" anonymous-cell ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("\n colgroups->");
|
||||
for (nsIFrame* childFrame = mColGroups.FirstChild(); childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
if (nsLayoutAtoms::tableColGroupFrame == childFrame->GetType()) {
|
||||
nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame *)childFrame;
|
||||
colGroupFrame->Dump(1);
|
||||
}
|
||||
}
|
||||
for (colX = 0; colX < numCols; colX++) {
|
||||
printf("\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user