1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
#include "nsTableColGroupFrame.h"
|
1998-06-17 20:38:24 +04:00
|
|
|
#include "nsTableColFrame.h"
|
1998-09-01 01:23:28 +04:00
|
|
|
#include "nsTableFrame.h"
|
1998-09-15 21:58:24 +04:00
|
|
|
#include "nsIHTMLTableColElement.h"
|
1998-06-09 08:51:44 +04:00
|
|
|
#include "nsIReflowCommand.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsIPresContext.h"
|
1998-05-29 01:39:22 +04:00
|
|
|
#include "nsIPtr.h"
|
|
|
|
#include "nsIContentDelegate.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
|
|
|
|
NS_DEF_PTR(nsIContent);
|
|
|
|
NS_DEF_PTR(nsIStyleContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-09-15 21:58:24 +04:00
|
|
|
static NS_DEFINE_IID(kIHTMLTableColElementIID, NS_IHTMLTABLECOLELEMENT_IID);
|
|
|
|
|
1998-08-26 21:26:38 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
static PRBool gsDebug = PR_FALSE;
|
|
|
|
|
|
|
|
nsTableColGroupFrame::nsTableColGroupFrame(nsIContent* aContent,
|
|
|
|
nsIFrame* aParentFrame)
|
1998-05-06 03:56:50 +04:00
|
|
|
: nsContainerFrame(aContent, aParentFrame)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-06-17 20:38:24 +04:00
|
|
|
mColCount=0;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTableColGroupFrame::~nsTableColGroupFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1998-09-16 21:19:20 +04:00
|
|
|
nsresult
|
|
|
|
nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
|
|
|
{
|
|
|
|
nsIFrame* lastChild;
|
|
|
|
LastChild(lastChild);
|
|
|
|
|
|
|
|
// Append the new frames to the child list
|
|
|
|
if (nsnull == lastChild) {
|
|
|
|
mFirstChild = aChildList;
|
|
|
|
} else {
|
|
|
|
lastChild->SetNextSibling(aChildList);
|
|
|
|
}
|
|
|
|
mChildCount += LengthOf(aChildList);
|
|
|
|
|
|
|
|
// Process the newly added column frames
|
|
|
|
for (nsIFrame* kidFrame = aChildList; nsnull != kidFrame; kidFrame->GetNextSibling(kidFrame)) {
|
|
|
|
// Set the preliminary values for the column frame
|
|
|
|
nsIContent* kid;
|
|
|
|
kidFrame->GetContent(kid);
|
|
|
|
PRInt32 repeat=1;
|
|
|
|
nsIHTMLTableColElement* colContent = nsnull;
|
|
|
|
nsresult rv = kid->QueryInterface(kIHTMLTableColElementIID,
|
|
|
|
(void**) &colContent); // colContent: ADDREF++
|
|
|
|
NS_RELEASE(kid);
|
|
|
|
if (rv==NS_OK)
|
|
|
|
{
|
|
|
|
colContent->GetSpanValue(&repeat);
|
|
|
|
NS_RELEASE(colContent);
|
|
|
|
}
|
|
|
|
PRInt32 colIndex = mStartColIndex + mColCount;
|
|
|
|
((nsTableColFrame *)(kidFrame))->InitColFrame (colIndex, repeat);
|
|
|
|
mColCount+= repeat;
|
|
|
|
|
|
|
|
// Set nsColFrame-specific information
|
|
|
|
((nsTableColFrame *)kidFrame)->SetColumnIndex(colIndex);
|
|
|
|
nsIFrame* tableFrame=nsnull;
|
|
|
|
GetGeometricParent(tableFrame);
|
|
|
|
((nsTableFrame *)tableFrame)->AddColumnFrame((nsTableColFrame *)kidFrame);
|
|
|
|
|
|
|
|
SetStyleContextForFirstPass(&aPresContext, colIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableColGroupFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
|
|
|
{
|
|
|
|
return AppendNewFrames(aPresContext, aChildList);
|
|
|
|
}
|
|
|
|
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_METHOD nsTableColGroupFrame::Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
if (gsDebug==PR_TRUE) printf("nsTableColGroupFrame::Paint\n");
|
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect);
|
1998-04-17 05:41:24 +04:00
|
|
|
return NS_OK;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
1998-08-26 21:26:38 +04:00
|
|
|
// TODO: incremental reflow
|
|
|
|
// today, we just throw away the column frames and start over every time
|
|
|
|
// this is dumb, we should be able to maintain column frames and adjust incrementally
|
1998-07-15 06:53:09 +04:00
|
|
|
NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext& aPresContext,
|
1998-05-29 01:39:22 +04:00
|
|
|
nsReflowMetrics& aDesiredSize,
|
|
|
|
const nsReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-05-29 01:39:22 +04:00
|
|
|
NS_ASSERTION(nsnull!=mContent, "bad state -- null content for frame");
|
|
|
|
|
1998-08-26 21:26:38 +04:00
|
|
|
// for every content child that (is a column thingy and does not already have a frame)
|
|
|
|
// create a frame and adjust it's style
|
1998-09-15 21:58:24 +04:00
|
|
|
nsresult rv;
|
1998-08-26 21:26:38 +04:00
|
|
|
nsIFrame* kidFrame = nsnull;
|
|
|
|
nsIFrame* prevKidFrame;
|
|
|
|
|
1998-09-16 21:19:20 +04:00
|
|
|
// XXX CONSTRUCTION
|
|
|
|
#if 0
|
1998-08-26 21:26:38 +04:00
|
|
|
LastChild(prevKidFrame); // XXX remember this...
|
|
|
|
PRInt32 kidIndex = 0; // index of the content child we are currently working on
|
|
|
|
PRInt32 colIndex = 0; // number of content children that are columns, normally same as kidIndex
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
// get the next content child, breaking if there is none
|
1998-08-30 00:20:38 +04:00
|
|
|
nsIContentPtr kid;
|
|
|
|
mContent->ChildAt(kidIndex, kid.AssignRef()); // kid: REFCNT++
|
1998-08-26 21:26:38 +04:00
|
|
|
if (kid.IsNull()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1998-09-15 21:58:24 +04:00
|
|
|
//XXX: with the new content code, this check is no longer valid
|
|
|
|
/*
|
1998-08-26 21:26:38 +04:00
|
|
|
// verify that we're dealing with table content. If so, we know it's a column
|
|
|
|
nsITableContent *tableContentInterface = nsnull;
|
1998-09-15 21:58:24 +04:00
|
|
|
rv = kid->QueryInterface(kITableContentIID,
|
1998-08-26 21:26:38 +04:00
|
|
|
(void **)&tableContentInterface); // tableContentInterface: REFCNT++
|
|
|
|
if (NS_FAILED(rv))
|
1998-05-29 01:39:22 +04:00
|
|
|
{
|
1998-08-26 21:26:38 +04:00
|
|
|
kidIndex++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
NS_RELEASE(tableContentInterface); // tableContentInterface: REFCNT--
|
1998-09-15 21:58:24 +04:00
|
|
|
*/
|
1998-08-26 21:26:38 +04:00
|
|
|
if (mChildCount<=colIndex)
|
|
|
|
{
|
1998-05-29 01:39:22 +04:00
|
|
|
// Resolve style
|
|
|
|
nsIStyleContextPtr kidSC =
|
1998-07-15 06:53:09 +04:00
|
|
|
aPresContext.ResolveStyleContextFor(kid, this, PR_TRUE);
|
1998-06-05 10:09:09 +04:00
|
|
|
const nsStyleSpacing* kidSpacing = (const nsStyleSpacing*)
|
|
|
|
kidSC->GetStyleData(eStyleStruct_Spacing);
|
1998-05-29 01:39:22 +04:00
|
|
|
|
|
|
|
// Create a child frame
|
|
|
|
nsIContentDelegate* kidDel = nsnull;
|
1998-07-15 06:53:09 +04:00
|
|
|
kidDel = kid->GetDelegate(&aPresContext);
|
1998-08-26 21:26:38 +04:00
|
|
|
rv = kidDel->CreateFrame(&aPresContext, kid, this, kidSC, kidFrame);
|
1998-05-29 01:39:22 +04:00
|
|
|
NS_RELEASE(kidDel);
|
1998-09-15 21:58:24 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
// set the preliminary values for the column frame
|
|
|
|
PRInt32 repeat=1;
|
|
|
|
nsIHTMLTableColElement* colContent = nsnull;
|
|
|
|
kid->QueryInterface(kIHTMLTableColElementIID,
|
|
|
|
(void**) &colContent); // colContent: ADDREF++
|
|
|
|
if (rv==NS_OK)
|
|
|
|
{
|
|
|
|
colContent->GetSpanValue(&repeat);
|
|
|
|
NS_RELEASE(colContent);
|
|
|
|
}
|
|
|
|
((nsTableColFrame *)(kidFrame))->InitColFrame (mStartColIndex + mColCount, repeat);
|
|
|
|
mColCount+= repeat;
|
1998-05-29 01:39:22 +04:00
|
|
|
|
|
|
|
// give the child frame a chance to reflow, even though we know it'll have 0 size
|
|
|
|
nsReflowMetrics kidSize(nsnull);
|
1998-05-30 00:36:05 +04:00
|
|
|
nsReflowState kidReflowState(kidFrame, aReflowState, nsSize(0,0), eReflowReason_Initial);
|
1998-07-15 06:53:09 +04:00
|
|
|
kidFrame->WillReflow(aPresContext);
|
|
|
|
nsReflowStatus status = ReflowChild(kidFrame,&aPresContext, kidSize,
|
1998-05-29 01:39:22 +04:00
|
|
|
kidReflowState);
|
|
|
|
// note that DidReflow is called as the result of some ancestor firing off a DidReflow above me
|
|
|
|
kidFrame->SetRect(nsRect(0,0,0,0));
|
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
// set nsColFrame-specific information
|
|
|
|
((nsTableColFrame *)kidFrame)->SetColumnIndex(colIndex+mStartColIndex);
|
1998-09-01 01:23:28 +04:00
|
|
|
nsIFrame* tableFrame=nsnull;
|
|
|
|
GetGeometricParent(tableFrame);
|
|
|
|
((nsTableFrame *)tableFrame)->AddColumnFrame((nsTableColFrame *)kidFrame);
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-05-29 01:39:22 +04:00
|
|
|
// Link child frame into the list of children
|
|
|
|
if (nsnull != prevKidFrame) {
|
|
|
|
prevKidFrame->SetNextSibling(kidFrame);
|
|
|
|
} else {
|
|
|
|
mFirstChild = kidFrame; // our first child
|
1998-07-10 23:04:06 +04:00
|
|
|
SetFirstContentOffset(kidIndex);
|
1998-05-29 01:39:22 +04:00
|
|
|
}
|
|
|
|
prevKidFrame = kidFrame;
|
|
|
|
mChildCount++;
|
1998-08-26 21:26:38 +04:00
|
|
|
SetStyleContextForFirstPass(&aPresContext, colIndex);
|
1998-05-29 01:39:22 +04:00
|
|
|
}
|
1998-08-26 21:26:38 +04:00
|
|
|
colIndex++; // if this wasn't a column, we would not have gotten this far
|
|
|
|
kidIndex++;
|
1998-05-29 01:39:22 +04:00
|
|
|
}
|
1998-09-16 21:19:20 +04:00
|
|
|
#else
|
|
|
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
|
|
|
NS_ASSERTION(nsnull != aReflowState.reflowCommand, "null reflow command");
|
|
|
|
|
|
|
|
// Get the type of reflow command
|
|
|
|
nsIReflowCommand::ReflowType reflowCmdType;
|
|
|
|
aReflowState.reflowCommand->GetType(reflowCmdType);
|
|
|
|
|
|
|
|
// Currently we only expect appended reflow commands
|
|
|
|
NS_ASSERTION(nsIReflowCommand::FrameAppended == reflowCmdType,
|
|
|
|
"unexpected reflow command");
|
|
|
|
|
|
|
|
// Get the new column frames
|
|
|
|
nsIFrame* childList;
|
|
|
|
aReflowState.reflowCommand->GetChildFrame(childList);
|
|
|
|
|
|
|
|
// Append them to the child list
|
|
|
|
AppendNewFrames(aPresContext, childList);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (kidFrame = mFirstChild; nsnull != kidFrame; kidFrame->GetNextSibling(kidFrame)) {
|
|
|
|
// Give the child frame a chance to reflow, even though we know it'll have 0 size
|
|
|
|
nsReflowMetrics kidSize(nsnull);
|
|
|
|
// XXX Use a valid reason...
|
|
|
|
nsReflowState kidReflowState(kidFrame, aReflowState, nsSize(0,0), eReflowReason_Initial);
|
|
|
|
kidFrame->WillReflow(aPresContext);
|
|
|
|
nsReflowStatus status = ReflowChild(kidFrame,&aPresContext, kidSize,
|
|
|
|
kidReflowState);
|
|
|
|
// note that DidReflow is called as the result of some ancestor firing off a DidReflow above me
|
|
|
|
kidFrame->SetRect(nsRect(0,0,0,0));
|
|
|
|
}
|
|
|
|
#endif
|
1998-04-14 00:24:54 +04:00
|
|
|
aDesiredSize.width=0;
|
|
|
|
aDesiredSize.height=0;
|
1998-05-25 21:31:49 +04:00
|
|
|
if (nsnull!=aDesiredSize.maxElementSize)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-05-25 21:31:49 +04:00
|
|
|
aDesiredSize.maxElementSize->width=0;
|
|
|
|
aDesiredSize.maxElementSize->height=0;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
1998-05-12 08:17:56 +04:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1998-04-17 05:41:24 +04:00
|
|
|
return NS_OK;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
1998-05-29 01:39:22 +04:00
|
|
|
// Subclass hook for style post processing
|
1998-08-26 21:26:38 +04:00
|
|
|
NS_METHOD nsTableColGroupFrame::SetStyleContextForFirstPass(nsIPresContext* aPresContext,
|
|
|
|
PRInt32 aColIndex)
|
1998-05-29 01:39:22 +04:00
|
|
|
{
|
1998-06-11 21:50:51 +04:00
|
|
|
// get the table frame
|
|
|
|
nsIFrame* tableFrame=nsnull;
|
|
|
|
GetGeometricParent(tableFrame);
|
|
|
|
tableFrame->GetGeometricParent(tableFrame); // get the outer frame
|
1998-05-29 01:39:22 +04:00
|
|
|
|
1998-06-11 21:50:51 +04:00
|
|
|
// get the style for the table frame
|
|
|
|
nsIStyleContextPtr tableSC;
|
|
|
|
tableFrame->GetStyleContext(aPresContext, tableSC.AssignRef());
|
|
|
|
nsStyleTable *tableStyle = (nsStyleTable*)tableSC->GetStyleData(eStyleStruct_Table);
|
|
|
|
|
1998-05-29 01:39:22 +04:00
|
|
|
// if COLS is set, then map it into the COL frames
|
1998-06-11 21:50:51 +04:00
|
|
|
if (NS_STYLE_TABLE_COLS_NONE != tableStyle->mCols)
|
1998-05-29 01:39:22 +04:00
|
|
|
{
|
1998-06-11 21:50:51 +04:00
|
|
|
// set numCols to the number of columns effected by the COLS attribute
|
1998-05-30 02:08:19 +04:00
|
|
|
PRInt32 numCols=0;
|
1998-06-11 21:50:51 +04:00
|
|
|
if (NS_STYLE_TABLE_COLS_ALL == tableStyle->mCols)
|
1998-05-29 01:39:22 +04:00
|
|
|
ChildCount(numCols);
|
1998-06-11 21:50:51 +04:00
|
|
|
else
|
|
|
|
numCols = tableStyle->mCols;
|
1998-05-29 01:39:22 +04:00
|
|
|
|
1998-06-11 21:50:51 +04:00
|
|
|
// for every column effected, set its width style
|
1998-05-30 02:08:19 +04:00
|
|
|
PRInt32 colIndex=0;
|
|
|
|
nsIFrame *colFrame=nsnull;
|
1998-06-05 10:09:09 +04:00
|
|
|
nsIStyleContextPtr colStyleContext;
|
1998-08-26 21:26:38 +04:00
|
|
|
ChildAt(aColIndex, colFrame);
|
|
|
|
if (nsnull!=colFrame)
|
1998-05-30 02:08:19 +04:00
|
|
|
{
|
|
|
|
nsStylePosition * colPosition=nsnull;
|
1998-06-05 10:09:09 +04:00
|
|
|
colFrame->GetStyleContext(aPresContext, colStyleContext.AssignRef());
|
|
|
|
colPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position);
|
1998-05-30 02:08:19 +04:00
|
|
|
nsStyleCoord width (1, eStyleUnit_Proportional);
|
|
|
|
colPosition->mWidth = width;
|
|
|
|
colStyleContext->RecalcAutomaticData(aPresContext);
|
1998-08-26 21:26:38 +04:00
|
|
|
|
|
|
|
// if there are more columns, there width is set to "minimum"
|
|
|
|
PRInt32 numChildFrames;
|
|
|
|
ChildCount(numChildFrames);
|
|
|
|
for (; aColIndex<numChildFrames-1; colIndex++)
|
|
|
|
{
|
|
|
|
ChildAt(colIndex, colFrame);
|
|
|
|
if (nsnull==colFrame)
|
|
|
|
break;
|
|
|
|
nsStylePosition * colPosition=nsnull;
|
|
|
|
colFrame->GetStyleContext(aPresContext, colStyleContext.AssignRef());
|
|
|
|
colPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position);
|
|
|
|
colPosition->mWidth.SetCoordValue(0);
|
|
|
|
colStyleContext->RecalcAutomaticData(aPresContext);
|
|
|
|
}
|
1998-05-30 02:08:19 +04:00
|
|
|
}
|
1998-05-29 01:39:22 +04:00
|
|
|
|
1998-05-30 02:08:19 +04:00
|
|
|
mStyleContext->RecalcAutomaticData(aPresContext);
|
|
|
|
}
|
1998-05-29 01:39:22 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
|
|
|
|
/** returns the number of columns represented by this group.
|
|
|
|
* if there are col children, count them (taking into account the span of each)
|
|
|
|
* else, check my own span attribute.
|
|
|
|
*/
|
|
|
|
int nsTableColGroupFrame::GetColumnCount ()
|
|
|
|
{
|
1998-08-26 21:26:38 +04:00
|
|
|
mColCount=0;
|
|
|
|
int count;
|
|
|
|
ChildCount (count);
|
|
|
|
if (0 < count)
|
1998-06-17 20:38:24 +04:00
|
|
|
{
|
1998-08-26 21:26:38 +04:00
|
|
|
nsIFrame * child = nsnull;
|
|
|
|
ChildAt(0, child);
|
|
|
|
NS_ASSERTION(nsnull!=child, "bad child");
|
|
|
|
while (nsnull!=child)
|
1998-06-17 20:38:24 +04:00
|
|
|
{
|
1998-08-26 21:26:38 +04:00
|
|
|
nsTableColFrame *col = (nsTableColFrame *)child;
|
|
|
|
col->SetColumnIndex (mStartColIndex + mColCount);
|
|
|
|
mColCount += col->GetRepeat ();
|
|
|
|
child->GetNextSibling(child);
|
1998-06-17 20:38:24 +04:00
|
|
|
}
|
|
|
|
}
|
1998-08-26 21:26:38 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
const nsStyleTable *tableStyle;
|
|
|
|
GetStyleData(eStyleStruct_Table, (nsStyleStruct *&)tableStyle);
|
|
|
|
mColCount = tableStyle->mSpan;
|
|
|
|
}
|
1998-06-17 20:38:24 +04:00
|
|
|
return mColCount;
|
|
|
|
}
|
|
|
|
|
1998-09-15 21:58:24 +04:00
|
|
|
/* ----- global methods ----- */
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-15 21:58:24 +04:00
|
|
|
nsresult
|
|
|
|
NS_NewTableColGroupFrame(nsIContent* aContent,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIFrame*& aResult)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-09-15 21:58:24 +04:00
|
|
|
nsIFrame* it = new nsTableColGroupFrame(aContent, aParentFrame);
|
1998-04-14 00:24:54 +04:00
|
|
|
if (nsnull == it) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1998-09-15 21:58:24 +04:00
|
|
|
aResult = it;
|
1998-04-14 00:24:54 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-03 01:59:54 +04:00
|
|
|
/* ----- debugging methods ----- */
|
|
|
|
NS_METHOD nsTableColGroupFrame::List(FILE* out, PRInt32 aIndent, nsIListFilter *aFilter) const
|
|
|
|
{
|
|
|
|
// if a filter is present, only output this frame if the filter says we should
|
|
|
|
// since this could be any "tag" with the right display type, we'll
|
|
|
|
// just pretend it's a colgroup
|
|
|
|
if (nsnull==aFilter)
|
|
|
|
return nsContainerFrame::List(out, aIndent, aFilter);
|
|
|
|
|
|
|
|
nsAutoString tagString("colgroup");
|
|
|
|
PRBool outputMe = aFilter->OutputTag(&tagString);
|
|
|
|
if (PR_TRUE==outputMe)
|
|
|
|
{
|
|
|
|
// Indent
|
|
|
|
for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out);
|
|
|
|
|
|
|
|
// Output the tag and rect
|
|
|
|
nsIAtom* tag;
|
|
|
|
mContent->GetTag(tag);
|
|
|
|
if (tag != nsnull) {
|
|
|
|
nsAutoString buf;
|
|
|
|
tag->ToString(buf);
|
|
|
|
fputs(buf, out);
|
|
|
|
NS_RELEASE(tag);
|
|
|
|
}
|
|
|
|
PRInt32 contentIndex;
|
|
|
|
|
|
|
|
GetContentIndex(contentIndex);
|
|
|
|
fprintf(out, "(%d)", contentIndex);
|
|
|
|
out << mRect;
|
|
|
|
if (0 != mState) {
|
|
|
|
fprintf(out, " [state=%08x]", mState);
|
|
|
|
}
|
|
|
|
fputs("\n", out);
|
|
|
|
}
|
|
|
|
// Output the children
|
|
|
|
if (mChildCount > 0) {
|
|
|
|
if (PR_TRUE==outputMe)
|
|
|
|
{
|
|
|
|
if (0 != mState) {
|
|
|
|
fprintf(out, " [state=%08x]\n", mState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (nsIFrame* child = mFirstChild; child; NextChild(child, child)) {
|
|
|
|
child->List(out, aIndent + 1, aFilter);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (PR_TRUE==outputMe)
|
|
|
|
{
|
|
|
|
if (0 != mState) {
|
|
|
|
fprintf(out, " [state=%08x]\n", mState);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
|