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-09-24 01:48:26 +04:00
|
|
|
#include "nsIHTMLContent.h"
|
|
|
|
#include "nsHTMLParts.h"
|
1998-05-29 01:39:22 +04:00
|
|
|
#include "nsIPtr.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
1998-10-01 08:46:11 +04:00
|
|
|
#include "nsHTMLIIDs.h"
|
1999-02-11 18:56:23 +03:00
|
|
|
#include "nsCOMPtr.h"
|
1998-05-29 01:39:22 +04:00
|
|
|
|
|
|
|
NS_DEF_PTR(nsIContent);
|
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-10-16 01:07:37 +04:00
|
|
|
#ifdef NS_DEBUG
|
1998-04-14 00:24:54 +04:00
|
|
|
static PRBool gsDebug = PR_FALSE;
|
1998-10-16 01:07:37 +04:00
|
|
|
static PRBool gsDebugIR = PR_FALSE;
|
|
|
|
#else
|
|
|
|
static const PRBool gsDebug = PR_FALSE;
|
|
|
|
static const PRBool gsDebugIR = PR_FALSE;
|
|
|
|
#endif
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
|
1998-10-16 01:07:37 +04:00
|
|
|
NS_IMETHODIMP
|
1998-09-17 03:24:39 +04:00
|
|
|
nsTableColGroupFrame::InitNewFrames(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
1998-09-16 21:19:20 +04:00
|
|
|
{
|
1998-09-24 01:48:26 +04:00
|
|
|
nsresult rv=NS_OK;
|
1998-10-14 20:32:45 +04:00
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
1998-09-24 01:48:26 +04:00
|
|
|
{
|
1998-10-14 20:32:45 +04:00
|
|
|
// Process the newly added column frames
|
1999-02-10 09:13:38 +03:00
|
|
|
for (nsIFrame* kidFrame = aChildList; nsnull != kidFrame; kidFrame->GetNextSibling(&kidFrame)) {
|
1998-10-14 20:32:45 +04:00
|
|
|
// Set the preliminary values for the column frame
|
1998-11-12 21:37:28 +03:00
|
|
|
PRInt32 colIndex = mStartColIndex + mColCount;
|
|
|
|
((nsTableColFrame *)(kidFrame))->InitColFrame (colIndex);
|
|
|
|
PRInt32 repeat = ((nsTableColFrame *)(kidFrame))->GetSpan();
|
|
|
|
mColCount += repeat;
|
|
|
|
for (PRInt32 i=0; i<repeat; i++)
|
1998-10-14 20:32:45 +04:00
|
|
|
{
|
1998-11-12 21:37:28 +03:00
|
|
|
tableFrame->AddColumnFrame((nsTableColFrame *)kidFrame);
|
1998-10-14 20:32:45 +04:00
|
|
|
}
|
1998-09-24 01:48:26 +04:00
|
|
|
}
|
1998-10-14 20:32:45 +04:00
|
|
|
// colgroup's span attribute is how many columns the group represents
|
|
|
|
// in the absence of any COL children
|
1998-11-12 21:37:28 +03:00
|
|
|
// Note that this is the correct, though perhaps unexpected, behavior for the span attribute.
|
|
|
|
// The spec says that if there are any COL children, the colgroup's span is ignored.
|
1998-10-14 20:32:45 +04:00
|
|
|
if (0==mColCount)
|
1998-09-24 01:48:26 +04:00
|
|
|
{
|
1998-10-14 20:32:45 +04:00
|
|
|
nsIFrame *firstImplicitColFrame=nsnull;
|
|
|
|
nsIFrame *prevColFrame=nsnull;
|
|
|
|
nsAutoString colTag;
|
|
|
|
nsHTMLAtoms::col->ToString(colTag);
|
|
|
|
mColCount = GetSpan();
|
|
|
|
for (PRInt32 colIndex=0; colIndex<mColCount; colIndex++)
|
1998-09-24 01:48:26 +04:00
|
|
|
{
|
1998-10-14 20:32:45 +04:00
|
|
|
nsIHTMLContent *col=nsnull;
|
|
|
|
// create an implicit col
|
|
|
|
rv = NS_CreateHTMLElement(&col, colTag); // ADDREF: col++
|
|
|
|
//XXX mark the col implicit
|
|
|
|
mContent->AppendChildTo((nsIContent*)col, PR_FALSE);
|
|
|
|
|
|
|
|
// Create a new col frame
|
|
|
|
nsIFrame* colFrame;
|
1998-12-03 09:31:43 +03:00
|
|
|
NS_NewTableColFrame(colFrame);
|
1998-10-14 20:32:45 +04:00
|
|
|
|
|
|
|
// Set its style context
|
1999-02-11 18:56:23 +03:00
|
|
|
nsCOMPtr<nsIStyleContext> colStyleContext;
|
|
|
|
aPresContext.ResolveStyleContextFor(col, mStyleContext,
|
1999-02-12 20:45:58 +03:00
|
|
|
PR_TRUE,
|
|
|
|
getter_AddRefs(colStyleContext));
|
1999-02-25 06:27:57 +03:00
|
|
|
colFrame->Init(aPresContext, col, this, colStyleContext, nsnull);
|
1998-11-10 09:05:32 +03:00
|
|
|
colFrame->SetInitialChildList(aPresContext, nsnull, nsnull);
|
1998-10-14 20:32:45 +04:00
|
|
|
|
|
|
|
// Set nsColFrame-specific information
|
|
|
|
PRInt32 absColIndex = mStartColIndex + colIndex;
|
1998-11-12 21:37:28 +03:00
|
|
|
((nsTableColFrame *)(colFrame))->InitColFrame (absColIndex);
|
1998-10-14 20:32:45 +04:00
|
|
|
((nsTableColFrame *)colFrame)->SetColumnIndex(absColIndex);
|
|
|
|
tableFrame->AddColumnFrame((nsTableColFrame *)colFrame);
|
|
|
|
|
|
|
|
//hook into list of children
|
|
|
|
if (nsnull==firstImplicitColFrame)
|
|
|
|
firstImplicitColFrame = colFrame;
|
|
|
|
else
|
|
|
|
prevColFrame->SetNextSibling(colFrame);
|
|
|
|
prevColFrame = colFrame;
|
|
|
|
}
|
1999-01-16 01:52:05 +03:00
|
|
|
|
1998-10-14 20:32:45 +04:00
|
|
|
// hook new columns into col group child list
|
1999-01-16 01:52:05 +03:00
|
|
|
mFrames.AppendFrames(nsnull, firstImplicitColFrame);
|
1998-09-24 01:48:26 +04:00
|
|
|
}
|
1998-10-14 20:32:45 +04:00
|
|
|
SetStyleContextForFirstPass(aPresContext);
|
1998-09-24 01:48:26 +04:00
|
|
|
}
|
|
|
|
return rv;
|
1998-09-16 21:19:20 +04:00
|
|
|
}
|
|
|
|
|
1998-10-16 01:07:37 +04:00
|
|
|
NS_IMETHODIMP
|
1998-09-17 03:24:39 +04:00
|
|
|
nsTableColGroupFrame::AppendNewFrames(nsIPresContext& aPresContext, nsIFrame* aChildList)
|
|
|
|
{
|
1999-01-19 02:54:23 +03:00
|
|
|
if (nsnull!=aChildList)
|
|
|
|
mFrames.AppendFrames(nsnull, aChildList);
|
1998-09-17 03:24:39 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-16 21:19:20 +04:00
|
|
|
NS_IMETHODIMP
|
1998-11-10 09:05:32 +03:00
|
|
|
nsTableColGroupFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1998-09-16 21:19:20 +04:00
|
|
|
{
|
1998-09-24 01:48:26 +04:00
|
|
|
nsresult result = AppendNewFrames(aPresContext, aChildList);
|
|
|
|
if (NS_OK==result)
|
1998-09-29 00:38:10 +04:00
|
|
|
result = InitNewFrames(aPresContext, aChildList);
|
1998-09-24 01:48:26 +04:00
|
|
|
return result;
|
1998-09-16 21:19:20 +04:00
|
|
|
}
|
|
|
|
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_METHOD nsTableColGroupFrame::Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
if (gsDebug==PR_TRUE) printf("nsTableColGroupFrame::Paint\n");
|
1998-12-18 18:54:23 +03:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
1998-04-17 05:41:24 +04:00
|
|
|
return NS_OK;
|
1998-04-14 00:24:54 +04:00
|
|
|
}
|
|
|
|
|
1998-10-20 21:45:07 +04:00
|
|
|
PRIntn
|
|
|
|
nsTableColGroupFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
PRIntn skip = 0;
|
|
|
|
if (nsnull != mPrevInFlow) {
|
|
|
|
skip |= 1 << NS_SIDE_TOP;
|
|
|
|
}
|
|
|
|
if (nsnull != mNextInFlow) {
|
|
|
|
skip |= 1 << NS_SIDE_BOTTOM;
|
|
|
|
}
|
|
|
|
return skip;
|
|
|
|
}
|
|
|
|
|
1998-10-02 08:10:00 +04:00
|
|
|
NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& 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-10-16 01:07:37 +04:00
|
|
|
nsresult rv=NS_OK;
|
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
|
|
|
|
nsIFrame* kidFrame = nsnull;
|
|
|
|
|
1998-09-24 01:48:26 +04:00
|
|
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
1998-10-16 01:07:37 +04:00
|
|
|
rv = IncrementalReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
1998-09-16 21:19:20 +04:00
|
|
|
}
|
|
|
|
|
1999-01-16 01:52:05 +03:00
|
|
|
for (kidFrame = mFrames.FirstChild(); nsnull != kidFrame;
|
1999-02-10 09:13:38 +03:00
|
|
|
kidFrame->GetNextSibling(&kidFrame)) {
|
1998-09-16 21:19:20 +04:00
|
|
|
// Give the child frame a chance to reflow, even though we know it'll have 0 size
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics kidSize(nsnull);
|
1998-09-16 21:19:20 +04:00
|
|
|
// XXX Use a valid reason...
|
1999-03-05 07:19:09 +03:00
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
|
1998-10-12 18:48:02 +04:00
|
|
|
nsSize(0,0), eReflowReason_Initial);
|
1998-10-06 04:27:22 +04:00
|
|
|
|
|
|
|
nsReflowStatus status;
|
|
|
|
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, status);
|
|
|
|
// 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-09-16 21:19:20 +04:00
|
|
|
}
|
1998-09-17 03:24:39 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
aDesiredSize.width=0;
|
|
|
|
aDesiredSize.height=0;
|
1998-10-08 19:34:48 +04:00
|
|
|
aDesiredSize.ascent=aDesiredSize.height;
|
|
|
|
aDesiredSize.descent=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-10-16 01:07:37 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_METHOD nsTableColGroupFrame::IncrementalReflow(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
if (PR_TRUE==gsDebugIR) printf("\nTCGF IR: IncrementalReflow\n");
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
// determine if this frame is the target or not
|
|
|
|
nsIFrame *target=nsnull;
|
|
|
|
rv = aReflowState.reflowCommand->GetTarget(target);
|
|
|
|
if ((PR_TRUE==NS_SUCCEEDED(rv)) && (nsnull!=target))
|
|
|
|
{
|
|
|
|
if (this==target)
|
|
|
|
rv = IR_TargetIsMe(aPresContext, aDesiredSize, aReflowState, aStatus);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Get the next frame in the reflow chain
|
|
|
|
nsIFrame* nextFrame;
|
|
|
|
aReflowState.reflowCommand->GetNext(nextFrame);
|
|
|
|
rv = IR_TargetIsChild(aPresContext, aDesiredSize, aReflowState, aStatus, nextFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
nsIReflowCommand::ReflowType type;
|
|
|
|
aReflowState.reflowCommand->GetType(type);
|
|
|
|
nsIFrame *objectFrame;
|
|
|
|
aReflowState.reflowCommand->GetChildFrame(objectFrame);
|
1998-10-31 02:08:34 +03:00
|
|
|
const nsStyleDisplay *childDisplay=nsnull;
|
|
|
|
if (nsnull!=objectFrame)
|
1998-12-02 19:45:20 +03:00
|
|
|
objectFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
|
1998-10-16 01:07:37 +04:00
|
|
|
if (PR_TRUE==gsDebugIR) printf("nTCGF IR: IncrementalReflow_TargetIsMe with type=%d\n", type);
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case nsIReflowCommand::FrameInserted :
|
1998-10-31 02:08:34 +03:00
|
|
|
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
|
|
|
|
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN == childDisplay->mDisplay)
|
|
|
|
{
|
|
|
|
rv = IR_ColInserted(aPresContext, aDesiredSize, aReflowState, aStatus,
|
|
|
|
(nsTableColFrame*)objectFrame, PR_FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-10-20 21:45:07 +04:00
|
|
|
rv = AddFrame(aReflowState, objectFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIReflowCommand::FrameAppended :
|
1998-10-31 02:08:34 +03:00
|
|
|
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
|
|
|
|
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
|
|
|
|
{
|
|
|
|
rv = IR_ColAppended(aPresContext, aDesiredSize, aReflowState, aStatus,
|
|
|
|
(nsTableColFrame*)objectFrame);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // no optimization to be done for Unknown frame types, so just reuse the Inserted method
|
1998-10-20 21:45:07 +04:00
|
|
|
rv = AddFrame(aReflowState, objectFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
case nsIReflowCommand::FrameReplaced :
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
case nsIReflowCommand::FrameRemoved :
|
1998-10-31 02:08:34 +03:00
|
|
|
NS_ASSERTION(nsnull!=objectFrame, "bad objectFrame");
|
|
|
|
NS_ASSERTION(nsnull!=childDisplay, "bad childDisplay");
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == childDisplay->mDisplay)
|
|
|
|
{
|
|
|
|
rv = IR_ColRemoved(aPresContext, aDesiredSize, aReflowState, aStatus,
|
|
|
|
(nsTableColFrame*)objectFrame);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
1999-02-04 19:27:18 +03:00
|
|
|
rv = RemoveAFrame(objectFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIReflowCommand::StyleChanged :
|
1998-10-30 10:57:44 +03:00
|
|
|
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
|
1998-10-16 01:07:37 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIReflowCommand::ContentChanged :
|
|
|
|
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
|
|
|
|
rv = NS_ERROR_ILLEGAL_VALUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsIReflowCommand::PullupReflow:
|
|
|
|
case nsIReflowCommand::PushReflow:
|
|
|
|
case nsIReflowCommand::CheckPullupReflow :
|
|
|
|
case nsIReflowCommand::UserDefined :
|
|
|
|
NS_NOTYETIMPLEMENTED("unimplemented reflow command type");
|
|
|
|
rv = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
if (PR_TRUE==gsDebugIR) printf("TCGF IR: reflow command not implemented.\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_METHOD nsTableColGroupFrame::IR_ColInserted(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsTableColFrame * aInsertedFrame,
|
|
|
|
PRBool aReplace)
|
|
|
|
{
|
|
|
|
nsresult rv=NS_OK;
|
|
|
|
PRBool adjustStartingColIndex=PR_FALSE;
|
1998-10-20 21:45:07 +04:00
|
|
|
rv = AddFrame(aReflowState, (nsIFrame *)aInsertedFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
PRInt32 startingColIndex=mStartColIndex;
|
|
|
|
startingColIndex += GetColumnCount(); // has the side effect of resetting all column indexes
|
|
|
|
|
|
|
|
nsIFrame *childFrame=nsnull;
|
1999-02-10 09:13:38 +03:00
|
|
|
GetNextSibling(&childFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
while ((NS_SUCCEEDED(rv)) && (nsnull!=childFrame))
|
|
|
|
{
|
|
|
|
const nsStyleDisplay *display;
|
1998-12-02 19:45:20 +03:00
|
|
|
childFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)display);
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == display->mDisplay)
|
|
|
|
{
|
|
|
|
startingColIndex += ((nsTableColGroupFrame *)childFrame)->SetStartColumnIndex(startingColIndex);
|
|
|
|
}
|
1999-02-10 09:13:38 +03:00
|
|
|
rv = childFrame->GetNextSibling(&childFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
|
|
|
tableFrame->InvalidateColumnCache();
|
|
|
|
//XXX: what we want to do here is determine if the new COL information changes anything about layout
|
|
|
|
// if not, we can skip rebalancing the columns
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_METHOD nsTableColGroupFrame::IR_ColAppended(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsTableColFrame * aAppendedFrame)
|
|
|
|
{
|
|
|
|
nsresult rv=NS_OK;
|
|
|
|
PRBool adjustStartingColIndex=PR_FALSE;
|
1998-10-20 21:45:07 +04:00
|
|
|
rv = AddFrame(aReflowState, (nsIFrame*)aAppendedFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
PRInt32 startingColIndex=mStartColIndex;
|
|
|
|
// this could be optimized
|
|
|
|
startingColIndex += GetColumnCount(); // has the side effect of resetting all column indexes
|
|
|
|
|
|
|
|
nsIFrame *childFrame=nsnull;
|
1999-02-10 09:13:38 +03:00
|
|
|
GetNextSibling(&childFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
while ((NS_SUCCEEDED(rv)) && (nsnull!=childFrame))
|
|
|
|
{
|
|
|
|
const nsStyleDisplay *display;
|
1998-12-02 19:45:20 +03:00
|
|
|
childFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)display);
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == display->mDisplay)
|
|
|
|
{
|
|
|
|
startingColIndex += ((nsTableColGroupFrame *)childFrame)->SetStartColumnIndex(startingColIndex);
|
|
|
|
}
|
1999-02-10 09:13:38 +03:00
|
|
|
rv = childFrame->GetNextSibling(&childFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// today we need to rebuild the whole column cache
|
|
|
|
// if the table frame is ever recoded to build the column cache incrementally, we could take
|
|
|
|
// advantage of that here.
|
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
|
|
|
tableFrame->InvalidateColumnCache();
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_METHOD nsTableColGroupFrame::IR_ColRemoved(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsTableColFrame * aDeletedFrame)
|
|
|
|
{
|
|
|
|
nsresult rv=NS_OK;
|
|
|
|
PRInt32 startingColIndex=mStartColIndex;
|
1999-01-16 01:52:05 +03:00
|
|
|
nsIFrame *childFrame=mFrames.FirstChild();
|
1998-10-16 01:07:37 +04:00
|
|
|
nsIFrame *prevSib=nsnull;
|
|
|
|
while ((NS_SUCCEEDED(rv)) && (nsnull!=childFrame))
|
|
|
|
{
|
1999-01-16 01:52:05 +03:00
|
|
|
// XXX change to use mFrames.DeleteFrame; and why does it keep
|
|
|
|
// looping after finding it?
|
1998-10-16 01:07:37 +04:00
|
|
|
if (childFrame==aDeletedFrame)
|
|
|
|
{
|
|
|
|
nsIFrame *deleteFrameNextSib=nsnull;
|
1999-02-10 09:13:38 +03:00
|
|
|
aDeletedFrame->GetNextSibling(&deleteFrameNextSib);
|
1998-10-16 01:07:37 +04:00
|
|
|
if (nsnull!=prevSib)
|
|
|
|
prevSib->SetNextSibling(deleteFrameNextSib);
|
|
|
|
else
|
1999-01-16 01:52:05 +03:00
|
|
|
mFrames.SetFrames(deleteFrameNextSib);
|
1998-10-16 01:07:37 +04:00
|
|
|
startingColIndex += GetColumnCount(); // resets all column indexes
|
|
|
|
}
|
|
|
|
const nsStyleDisplay *display;
|
1998-12-02 19:45:20 +03:00
|
|
|
childFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)display);
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == display->mDisplay)
|
|
|
|
{
|
|
|
|
// we've removed aDeletedFrame, now adjust the starting col index of all subsequent col groups
|
|
|
|
startingColIndex += ((nsTableColGroupFrame *)childFrame)->SetStartColumnIndex(startingColIndex);
|
|
|
|
}
|
|
|
|
prevSib=childFrame;
|
1999-02-10 09:13:38 +03:00
|
|
|
rv = childFrame->GetNextSibling(&childFrame);
|
1998-10-16 01:07:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// today we need to rebuild the whole column cache
|
|
|
|
// if the table frame is ever recoded to build the column cache incrementally, we could take
|
|
|
|
// advantage of that here.
|
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
|
|
|
tableFrame->InvalidateColumnCache();
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1998-10-30 10:57:44 +03:00
|
|
|
NS_METHOD nsTableColGroupFrame::IR_StyleChanged(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
if (PR_TRUE==gsDebugIR) printf("TIF IR: IR_StyleChanged for frame %p\n", this);
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
// we presume that all the easy optimizations were done in the nsHTMLStyleSheet before we were called here
|
|
|
|
// XXX: we can optimize this when we know which style attribute changed
|
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
|
|
|
{
|
|
|
|
tableFrame->InvalidateColumnCache();
|
|
|
|
tableFrame->InvalidateFirstPassCache();
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1998-10-16 01:07:37 +04:00
|
|
|
NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame * aNextFrame)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
if (PR_TRUE==gsDebugIR) printf("\nTCGF IR: IR_TargetIsChild\n");
|
|
|
|
|
|
|
|
// Remember the old col count
|
|
|
|
const PRInt32 oldColCount = GetColumnCount();
|
|
|
|
|
|
|
|
// Pass along the reflow command
|
|
|
|
nsHTMLReflowMetrics desiredSize(nsnull);
|
1999-03-05 07:19:09 +03:00
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aNextFrame,
|
|
|
|
nsSize(aReflowState.availableWidth,
|
|
|
|
aReflowState.availableHeight));
|
1998-10-16 01:07:37 +04:00
|
|
|
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsTableFrame *tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
|
|
|
{
|
|
|
|
// compare the new col count to the old col count.
|
|
|
|
// If they are the same, we just need to rebalance column widths
|
|
|
|
// If they differ, we need to fix up other column groups and the column cache
|
|
|
|
const PRInt32 newColCount = GetColumnCount(); // this will set the new column indexes if necessary
|
|
|
|
if (oldColCount==newColCount)
|
|
|
|
tableFrame->InvalidateColumnWidths();
|
|
|
|
else
|
|
|
|
tableFrame->InvalidateColumnCache();
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1998-05-29 01:39:22 +04:00
|
|
|
// Subclass hook for style post processing
|
1998-10-11 13:18:27 +04:00
|
|
|
NS_METHOD nsTableColGroupFrame::SetStyleContextForFirstPass(nsIPresContext& aPresContext)
|
1998-05-29 01:39:22 +04:00
|
|
|
{
|
1998-06-11 21:50:51 +04:00
|
|
|
// get the table frame
|
1998-10-14 20:32:45 +04:00
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
|
|
|
{
|
|
|
|
// get the style for the table frame
|
1998-12-02 19:45:20 +03:00
|
|
|
const nsStyleTable *tableStyle;
|
|
|
|
tableFrame->GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
1998-10-14 20:32:45 +04:00
|
|
|
|
|
|
|
// if COLS is set, then map it into the COL frames
|
|
|
|
if (NS_STYLE_TABLE_COLS_NONE != tableStyle->mCols)
|
1998-05-30 02:08:19 +04:00
|
|
|
{
|
1998-10-14 20:32:45 +04:00
|
|
|
// set numCols to the number of columns effected by the COLS attribute
|
|
|
|
PRInt32 numCols=0;
|
|
|
|
if (NS_STYLE_TABLE_COLS_ALL == tableStyle->mCols)
|
1999-01-16 01:52:05 +03:00
|
|
|
numCols = mFrames.GetLength();
|
1998-10-14 20:32:45 +04:00
|
|
|
else
|
|
|
|
numCols = tableStyle->mCols;
|
|
|
|
|
|
|
|
// for every column effected, set its width style
|
|
|
|
PRInt32 colIndex=0;
|
1999-01-16 01:52:05 +03:00
|
|
|
nsIFrame *colFrame=mFrames.FirstChild();
|
1998-10-14 20:32:45 +04:00
|
|
|
while (nsnull!=colFrame)
|
1998-08-26 21:26:38 +04:00
|
|
|
{
|
1998-12-02 19:45:20 +03:00
|
|
|
const nsStyleDisplay * colDisplay=nsnull;
|
|
|
|
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
|
1998-10-14 20:32:45 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay)
|
1998-09-24 01:48:26 +04:00
|
|
|
{
|
1999-02-11 18:56:23 +03:00
|
|
|
nsCOMPtr<nsIStyleContext> colStyleContext;
|
1998-10-14 20:32:45 +04:00
|
|
|
nsStylePosition * colPosition=nsnull;
|
1999-02-11 18:56:23 +03:00
|
|
|
colFrame->GetStyleContext(getter_AddRefs(colStyleContext));
|
1998-10-14 20:32:45 +04:00
|
|
|
colPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position);
|
|
|
|
if (colIndex<numCols)
|
|
|
|
{
|
|
|
|
nsStyleCoord width (1, eStyleUnit_Proportional);
|
|
|
|
colPosition->mWidth = width;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
colPosition->mWidth.SetCoordValue(0);
|
|
|
|
}
|
|
|
|
colStyleContext->RecalcAutomaticData(&aPresContext);
|
|
|
|
colIndex++;
|
1998-09-24 01:48:26 +04:00
|
|
|
}
|
1999-02-10 09:13:38 +03:00
|
|
|
colFrame->GetNextSibling(&colFrame);
|
1998-08-26 21:26:38 +04:00
|
|
|
}
|
1998-05-30 02:08:19 +04:00
|
|
|
}
|
1998-11-12 21:37:28 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// propagate the colgroup width attribute down to the columns if they have no width of their own
|
|
|
|
nsStylePosition* position = (nsStylePosition*)mStyleContext->GetStyleData(eStyleStruct_Position);
|
|
|
|
if (eStyleUnit_Null!=position->mWidth.GetUnit())
|
|
|
|
{
|
|
|
|
// now for every column that doesn't have it's own width, set the width style
|
1999-01-16 01:52:05 +03:00
|
|
|
nsIFrame *colFrame=mFrames.FirstChild();
|
1998-11-12 21:37:28 +03:00
|
|
|
while (nsnull!=colFrame)
|
|
|
|
{
|
1998-12-02 19:45:20 +03:00
|
|
|
const nsStyleDisplay * colDisplay=nsnull;
|
|
|
|
colFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)colDisplay));
|
1998-11-12 21:37:28 +03:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN == colDisplay->mDisplay)
|
|
|
|
{
|
1999-02-11 18:56:23 +03:00
|
|
|
nsCOMPtr<nsIStyleContext> colStyleContext;
|
1998-12-02 19:45:20 +03:00
|
|
|
const nsStylePosition * colPosition=nsnull;
|
|
|
|
colFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)colPosition); // get a read-only version of the style context
|
1998-11-12 21:37:28 +03:00
|
|
|
//XXX: how do I know this is auto because it's defaulted, vs. set explicitly to "auto"?
|
|
|
|
if (eStyleUnit_Auto==colPosition->mWidth.GetUnit())
|
|
|
|
{
|
|
|
|
// notice how we defer getting a mutable style context until we're sure we really need one
|
1999-02-11 18:56:23 +03:00
|
|
|
colFrame->GetStyleContext(getter_AddRefs(colStyleContext));
|
1998-12-02 19:45:20 +03:00
|
|
|
nsStylePosition * mutableColPosition = (nsStylePosition*)colStyleContext->GetMutableStyleData(eStyleStruct_Position);
|
|
|
|
mutableColPosition->mWidth = position->mWidth;
|
1998-11-12 21:37:28 +03:00
|
|
|
colStyleContext->RecalcAutomaticData(&aPresContext);
|
|
|
|
}
|
|
|
|
}
|
1999-02-10 09:13:38 +03:00
|
|
|
colFrame->GetNextSibling(&colFrame);
|
1998-11-12 21:37:28 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//mStyleContext->RecalcAutomaticData(&aPresContext);
|
1998-05-30 02:08:19 +04:00
|
|
|
}
|
1998-10-14 20:32:45 +04:00
|
|
|
return rv;
|
1998-05-29 01:39:22 +04:00
|
|
|
}
|
|
|
|
|
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;
|
1999-01-16 01:52:05 +03:00
|
|
|
nsIFrame *childFrame = mFrames.FirstChild();
|
1998-09-24 20:37:22 +04:00
|
|
|
while (nsnull!=childFrame)
|
1998-06-17 20:38:24 +04:00
|
|
|
{
|
1998-09-24 20:37:22 +04:00
|
|
|
const nsStyleDisplay *childDisplay;
|
1998-12-02 19:45:20 +03:00
|
|
|
childFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
|
1998-09-24 20:37:22 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN == childDisplay->mDisplay)
|
1998-06-17 20:38:24 +04:00
|
|
|
{
|
1998-09-24 20:37:22 +04:00
|
|
|
nsTableColFrame *col = (nsTableColFrame *)childFrame;
|
1998-08-26 21:26:38 +04:00
|
|
|
col->SetColumnIndex (mStartColIndex + mColCount);
|
1998-11-12 21:37:28 +03:00
|
|
|
mColCount += col->GetSpan();
|
1998-06-17 20:38:24 +04:00
|
|
|
}
|
1999-02-10 09:13:38 +03:00
|
|
|
childFrame->GetNextSibling(&childFrame);
|
1998-06-17 20:38:24 +04:00
|
|
|
}
|
1998-09-24 20:37:22 +04:00
|
|
|
if (0==mColCount)
|
|
|
|
{ // there were no children of this colgroup that were columns. So use my span attribute
|
1998-08-26 21:26:38 +04:00
|
|
|
const nsStyleTable *tableStyle;
|
1998-12-02 19:45:20 +03:00
|
|
|
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
1998-08-26 21:26:38 +04:00
|
|
|
mColCount = tableStyle->mSpan;
|
|
|
|
}
|
1998-06-17 20:38:24 +04:00
|
|
|
return mColCount;
|
|
|
|
}
|
|
|
|
|
1998-10-15 02:51:50 +04:00
|
|
|
nsTableColFrame * nsTableColGroupFrame::GetFirstColumn()
|
|
|
|
{
|
|
|
|
return GetNextColumn(nsnull);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTableColFrame * nsTableColGroupFrame::GetNextColumn(nsIFrame *aChildFrame)
|
|
|
|
{
|
|
|
|
nsTableColFrame *result = nsnull;
|
|
|
|
nsIFrame *childFrame = aChildFrame;
|
|
|
|
if (nsnull==childFrame)
|
1999-01-16 01:52:05 +03:00
|
|
|
childFrame = mFrames.FirstChild();
|
1998-10-15 02:51:50 +04:00
|
|
|
while (nsnull!=childFrame)
|
|
|
|
{
|
|
|
|
const nsStyleDisplay *childDisplay;
|
1998-12-02 19:45:20 +03:00
|
|
|
childFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
|
1998-10-15 02:51:50 +04:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN == childDisplay->mDisplay)
|
|
|
|
{
|
|
|
|
result = (nsTableColFrame *)childFrame;
|
|
|
|
break;
|
|
|
|
}
|
1999-02-10 09:13:38 +03:00
|
|
|
childFrame->GetNextSibling(&childFrame);
|
1998-10-15 02:51:50 +04:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-09-24 20:37:22 +04:00
|
|
|
nsTableColFrame * nsTableColGroupFrame::GetColumnAt (PRInt32 aColIndex)
|
|
|
|
{
|
|
|
|
nsTableColFrame *result = nsnull;
|
1999-02-11 09:22:33 +03:00
|
|
|
PRInt32 count = 0;
|
1999-01-16 01:52:05 +03:00
|
|
|
nsIFrame *childFrame = mFrames.FirstChild();
|
1999-02-11 09:22:33 +03:00
|
|
|
|
|
|
|
while (nsnull!=childFrame) {
|
1998-09-24 20:37:22 +04:00
|
|
|
const nsStyleDisplay *childDisplay;
|
1998-12-02 19:45:20 +03:00
|
|
|
childFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
|
1999-02-11 09:22:33 +03:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_COLUMN == childDisplay->mDisplay) {
|
1998-09-24 20:37:22 +04:00
|
|
|
nsTableColFrame *col = (nsTableColFrame *)childFrame;
|
1998-11-12 21:37:28 +03:00
|
|
|
count += col->GetSpan();
|
1999-02-11 09:22:33 +03:00
|
|
|
if (aColIndex<=count) {
|
1998-09-24 20:37:22 +04:00
|
|
|
result = col;
|
1999-02-11 09:22:33 +03:00
|
|
|
}
|
1998-09-24 20:37:22 +04:00
|
|
|
}
|
1999-02-10 09:13:38 +03:00
|
|
|
childFrame->GetNextSibling(&childFrame);
|
1998-09-24 20:37:22 +04:00
|
|
|
}
|
1999-02-11 09:22:33 +03:00
|
|
|
|
1998-09-24 20:37:22 +04:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1998-09-24 01:48:26 +04:00
|
|
|
PRInt32 nsTableColGroupFrame::GetSpan()
|
|
|
|
{
|
|
|
|
PRInt32 span=1;
|
1998-12-02 19:45:20 +03:00
|
|
|
const nsStyleTable* tableStyle=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
1998-09-24 01:48:26 +04:00
|
|
|
if (nsnull!=tableStyle)
|
|
|
|
{
|
|
|
|
span = tableStyle->mSpan;
|
|
|
|
}
|
|
|
|
return span;
|
|
|
|
}
|
|
|
|
|
1998-10-15 02:51:50 +04:00
|
|
|
/* this may be needed when IsSynthetic is properly implemented
|
|
|
|
PRBool nsTableColGroupFrame::IsManufactured()
|
|
|
|
{
|
|
|
|
PRBool result = PR_FALSE;
|
|
|
|
nsIFrame *firstCol = GetFirstColumn();
|
|
|
|
if (nsTableFrame::IsSynthetic(this) &&
|
|
|
|
((nsnull==firstCol) || nsTableFrame::IsSynthetic(firstCol)))
|
|
|
|
result = PR_TRUE;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** returns colcount because it is frequently used in the context of
|
|
|
|
* shuffling relative colgroup order, and it's convenient to not have to
|
|
|
|
* call GetColumnCount redundantly.
|
|
|
|
*/
|
|
|
|
PRInt32 nsTableColGroupFrame::SetStartColumnIndex (int aIndex)
|
|
|
|
{
|
|
|
|
PRInt32 result = mColCount;
|
|
|
|
if (aIndex != mStartColIndex)
|
|
|
|
{
|
|
|
|
mStartColIndex = aIndex;
|
|
|
|
mColCount=0;
|
|
|
|
result = GetColumnCount(); // has the side effect of setting each column index based on new start index
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
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
|
1998-12-03 09:31:43 +03:00
|
|
|
NS_NewTableColGroupFrame(nsIFrame*& aResult)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1998-12-03 09:31:43 +03:00
|
|
|
nsIFrame* it = new nsTableColGroupFrame;
|
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-11-19 20:22:29 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableColGroupFrame::GetFrameName(nsString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName("TableColGroup", aResult);
|
|
|
|
}
|