1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-04-14 00:24:54 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
#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"
|
1999-12-14 01:56:31 +03:00
|
|
|
#include "nsIDOMHTMLTableColElement.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"
|
1999-06-08 01:10:25 +04:00
|
|
|
#include "nsCSSRendering.h"
|
1999-08-06 18:34:56 +04:00
|
|
|
#include "nsIPresShell.h"
|
1999-10-02 04:02:54 +04:00
|
|
|
#include "nsLayoutAtoms.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);
|
1999-12-14 01:56:31 +03:00
|
|
|
static NS_DEFINE_IID(kIDOMHTMLTableColElementIID, NS_IDOMHTMLTABLECOLELEMENT_IID);
|
|
|
|
|
|
|
|
#define COLGROUP_TYPE_CONTENT 0x0
|
|
|
|
#define COLGROUP_TYPE_ANONYMOUS_COL 0x1
|
|
|
|
#define COLGROUP_TYPE_ANONYMOUS_CELL 0x2
|
|
|
|
|
|
|
|
nsTableColGroupType nsTableColGroupFrame::GetType() const {
|
|
|
|
switch(mBits.mType) {
|
|
|
|
case COLGROUP_TYPE_ANONYMOUS_COL:
|
|
|
|
return eColGroupAnonymousCol;
|
|
|
|
case COLGROUP_TYPE_ANONYMOUS_CELL:
|
|
|
|
return eColGroupAnonymousCell;
|
|
|
|
default:
|
|
|
|
return eColGroupContent;
|
|
|
|
}
|
|
|
|
}
|
1998-09-15 21:58:24 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
void nsTableColGroupFrame::SetType(nsTableColGroupType aType) {
|
|
|
|
mBits.mType = aType - eColGroupContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsTableColGroupFrame::ResetColIndices(nsIFrame* aFirstColGroup,
|
|
|
|
PRInt32 aFirstColIndex,
|
|
|
|
nsIFrame* aStartColFrame)
|
1998-09-16 21:19:20 +04:00
|
|
|
{
|
1999-12-14 01:56:31 +03:00
|
|
|
nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame*)aFirstColGroup;
|
|
|
|
PRInt32 colIndex = aFirstColIndex;
|
|
|
|
while (colGroupFrame) {
|
|
|
|
nsIAtom* cgType;
|
|
|
|
colGroupFrame->GetFrameType(&cgType);
|
|
|
|
if (nsLayoutAtoms::tableColGroupFrame == cgType) {
|
|
|
|
colGroupFrame->SetStartColumnIndex(colIndex);
|
|
|
|
nsIFrame* colFrame = aStartColFrame;
|
|
|
|
if (!colFrame || (colIndex != aFirstColIndex)) {
|
|
|
|
colGroupFrame->FirstChild(nsnull, &colFrame);
|
|
|
|
}
|
|
|
|
while (colFrame) {
|
|
|
|
nsIAtom* colType;
|
|
|
|
colFrame->GetFrameType(&colType);
|
|
|
|
if (nsLayoutAtoms::tableColFrame == colType) {
|
|
|
|
((nsTableColFrame*)colFrame)->SetColIndex(colIndex);
|
|
|
|
colIndex++;
|
1999-08-10 06:45:18 +04:00
|
|
|
}
|
1999-12-14 01:56:31 +03:00
|
|
|
NS_IF_RELEASE(colType);
|
|
|
|
colFrame->GetNextSibling(&colFrame);
|
1998-10-14 20:32:45 +04:00
|
|
|
}
|
1998-09-24 01:48:26 +04:00
|
|
|
}
|
1999-12-14 01:56:31 +03:00
|
|
|
NS_IF_RELEASE(cgType);
|
|
|
|
colGroupFrame->GetNextSibling((nsIFrame**)&colGroupFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableColGroupFrame::AddColsToTable(nsIPresContext& aPresContext,
|
|
|
|
PRInt32 aFirstColIndex,
|
|
|
|
PRBool aResetSubsequentColIndices,
|
|
|
|
nsIFrame* aFirstFrame,
|
|
|
|
nsIFrame* aLastFrame)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsTableFrame* tableFrame = nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if (!(NS_SUCCEEDED(rv) && tableFrame && aFirstFrame)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// set the col indices of the col frames and and add col info to the table
|
|
|
|
PRInt32 colIndex = aFirstColIndex;
|
|
|
|
nsIFrame* kidFrame = aFirstFrame;
|
|
|
|
PRBool foundLastFrame = PR_FALSE;
|
|
|
|
while (kidFrame) {
|
|
|
|
nsIAtom* kidType;
|
|
|
|
kidFrame->GetFrameType(&kidType);
|
|
|
|
if (nsLayoutAtoms::tableColFrame == kidType) {
|
|
|
|
((nsTableColFrame*)kidFrame)->SetColIndex(colIndex);
|
|
|
|
if (!foundLastFrame) {
|
|
|
|
tableFrame->InsertCol(aPresContext, (nsTableColFrame &)*kidFrame, colIndex);
|
|
|
|
mColCount++;
|
1998-10-14 20:32:45 +04:00
|
|
|
}
|
1999-12-14 01:56:31 +03:00
|
|
|
colIndex++;
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(kidType);
|
|
|
|
if (kidFrame == aLastFrame) {
|
|
|
|
foundLastFrame = PR_TRUE;
|
|
|
|
}
|
|
|
|
kidFrame->GetNextSibling(&kidFrame);
|
|
|
|
}
|
1999-01-16 01:52:05 +03:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
if (aResetSubsequentColIndices) {
|
|
|
|
nsIFrame* nextSibling;
|
|
|
|
GetNextSibling(&nextSibling);
|
|
|
|
if (nextSibling) {
|
|
|
|
ResetColIndices(nextSibling, colIndex);
|
1998-09-24 01:48:26 +04:00
|
|
|
}
|
|
|
|
}
|
1999-12-14 01:56:31 +03:00
|
|
|
|
1998-09-24 01:48:26 +04:00
|
|
|
return rv;
|
1998-09-16 21:19:20 +04:00
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
// this is called when a col frame doesn't have an explicit col group parent.
|
|
|
|
nsTableColGroupFrame*
|
|
|
|
nsTableColGroupFrame::FindParentForAppendedCol(nsTableFrame* aTableFrame,
|
|
|
|
nsTableColType aColType)
|
1998-09-17 03:24:39 +04:00
|
|
|
{
|
1999-12-14 01:56:31 +03:00
|
|
|
nsVoidArray& cols = aTableFrame->GetColCache();
|
|
|
|
PRInt32 numCols = cols.Count();
|
|
|
|
nsIFrame* lastColGroup;
|
|
|
|
nsIFrame* lastCol = (nsIFrame*)cols.ElementAt(numCols - 1);
|
|
|
|
if (!lastCol) return nsnull; // no columns so no colgroups
|
|
|
|
lastCol->GetParent(&lastColGroup);
|
|
|
|
if (!lastColGroup) return nsnull; // shouldn't happen
|
|
|
|
|
|
|
|
nsTableColGroupFrame* relevantColGroup = (nsTableColGroupFrame *)lastColGroup;
|
|
|
|
nsTableColGroupType relevantColGroupType = relevantColGroup->GetType();
|
|
|
|
if (eColGroupAnonymousCell == relevantColGroupType) {
|
|
|
|
if (eColAnonymousCell == aColType) {
|
|
|
|
return relevantColGroup;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// find the next to last col group
|
|
|
|
for (PRInt32 colX = numCols - 2; colX >= 0; colX--) {
|
|
|
|
nsTableColFrame* colFrame = (nsTableColFrame*)cols.ElementAt(colX);
|
|
|
|
nsTableColGroupFrame* colGroupFrame;
|
|
|
|
colFrame->GetParent((nsIFrame**)&colGroupFrame);
|
|
|
|
nsTableColGroupType cgType = colGroupFrame->GetType();
|
|
|
|
if (cgType != relevantColGroupType) {
|
|
|
|
relevantColGroup = colGroupFrame;
|
|
|
|
relevantColGroupType = cgType;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (0 == colX) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (eColGroupAnonymousCol == relevantColGroupType) {
|
|
|
|
if ((eColContent == aColType) || (eColAnonymousCol == aColType)) {
|
|
|
|
return relevantColGroup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsTableColGroupFrame::GetLastRealColGroup(nsTableFrame* aTableFrame,
|
|
|
|
nsIFrame** aLastColGroup)
|
|
|
|
{
|
|
|
|
*aLastColGroup = nsnull;
|
|
|
|
nsFrameList colGroups = aTableFrame->GetColGroups();
|
|
|
|
|
|
|
|
nsIFrame* nextToLastColGroup = nsnull;
|
|
|
|
nsIFrame* lastColGroup = colGroups.FirstChild();
|
|
|
|
while(lastColGroup) {
|
|
|
|
nsIFrame* next;
|
|
|
|
lastColGroup->GetNextSibling(&next);
|
|
|
|
if (next) {
|
|
|
|
nextToLastColGroup = lastColGroup;
|
|
|
|
lastColGroup = next;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!lastColGroup) return PR_TRUE; // there are no col group frames
|
|
|
|
|
|
|
|
nsTableColGroupType lastColGroupType = ((nsTableColGroupFrame *)lastColGroup)->GetType();
|
|
|
|
if (eColGroupAnonymousCell == lastColGroupType) {
|
|
|
|
*aLastColGroup = nextToLastColGroup;
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*aLastColGroup = lastColGroup;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
1998-09-17 03:24:39 +04:00
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
// don't set mColCount here, it is done in AddColsToTable
|
1998-09-16 21:19:20 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsTableColGroupFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-10 09:05:32 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1998-09-16 21:19:20 +04:00
|
|
|
{
|
1999-12-14 01:56:31 +03:00
|
|
|
nsTableFrame* tableFrame;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if (!aChildList) {
|
|
|
|
nsIFrame* firstChild;
|
|
|
|
tableFrame->CreateAnonymousColFrames(*aPresContext, *this, GetSpan(), eColAnonymousColGroup,
|
|
|
|
PR_FALSE, nsnull, &firstChild);
|
|
|
|
if (firstChild) {
|
|
|
|
SetInitialChildList(aPresContext, aListName, firstChild);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIFrame* kidFrame = aChildList;
|
|
|
|
while (kidFrame) {
|
|
|
|
nsIAtom* kidType;
|
|
|
|
kidFrame->GetFrameType(&kidType);
|
|
|
|
if (nsLayoutAtoms::tableColFrame == kidType) {
|
|
|
|
// Set the preliminary values for the column frame
|
|
|
|
PRInt32 span = ((nsTableColFrame*)kidFrame)->GetSpan();
|
|
|
|
if (span > 1) {
|
|
|
|
nsTableColFrame* firstSpannedCol;
|
|
|
|
tableFrame->CreateAnonymousColFrames(*aPresContext, *this, span - 1, eColAnonymousCol,
|
|
|
|
PR_FALSE, (nsTableColFrame*)kidFrame, (nsIFrame **)&firstSpannedCol);
|
|
|
|
nsIFrame* spanner = kidFrame;
|
|
|
|
kidFrame->GetNextSibling(&kidFrame); // need to do this before we insert the new frames
|
|
|
|
nsFrameList newChildren(aChildList); // used as a convience to hook up siblings
|
|
|
|
newChildren.InsertFrames(this, (nsTableColFrame*)spanner, (nsIFrame *)firstSpannedCol);
|
|
|
|
NS_RELEASE(kidType);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(kidType);
|
|
|
|
kidFrame->GetNextSibling(&kidFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
mFrames.AppendFrames(this, aChildList);
|
|
|
|
return NS_OK;
|
1998-09-16 21:19:20 +04:00
|
|
|
}
|
|
|
|
|
1999-08-06 18:34:56 +04:00
|
|
|
// Helper function. It marks the table frame as dirty and generates
|
|
|
|
// a reflow command
|
|
|
|
nsresult
|
1999-11-24 09:03:41 +03:00
|
|
|
nsTableColGroupFrame::AddTableDirtyReflowCommand(nsIPresContext* aPresContext,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIFrame* aTableFrame)
|
|
|
|
{
|
|
|
|
nsFrameState frameState;
|
|
|
|
nsIFrame* tableParentFrame;
|
|
|
|
nsIReflowCommand* reflowCmd;
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// Mark the table frame as dirty
|
|
|
|
aTableFrame->GetFrameState(&frameState);
|
|
|
|
frameState |= NS_FRAME_IS_DIRTY;
|
|
|
|
aTableFrame->SetFrameState(frameState);
|
|
|
|
|
|
|
|
// Target the reflow comamnd at its parent frame
|
|
|
|
aTableFrame->GetParent(&tableParentFrame);
|
|
|
|
rv = NS_NewHTMLReflowCommand(&reflowCmd, tableParentFrame,
|
|
|
|
nsIReflowCommand::ReflowDirty);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
// Add the reflow command
|
|
|
|
rv = aPresShell.AppendReflowCommand(reflowCmd);
|
|
|
|
NS_RELEASE(reflowCmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsTableColGroupFrame::AppendFrames(nsIPresContext* aPresContext,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
1999-12-14 01:56:31 +03:00
|
|
|
mFrames.AppendFrames(this, aFrameList);
|
|
|
|
InsertColsReflow(*aPresContext, aPresShell, mColCount, aFrameList);
|
1999-08-06 18:34:56 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsTableColGroupFrame::InsertFrames(nsIPresContext* aPresContext,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
1999-12-14 01:56:31 +03:00
|
|
|
nsIFrame* aPrevFrameIn,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
1999-12-14 01:56:31 +03:00
|
|
|
nsFrameList frames(aFrameList); // convience for getting last frame
|
|
|
|
nsIFrame* lastFrame = frames.LastChild();
|
1999-08-06 18:34:56 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
mFrames.InsertFrames(this, aPrevFrameIn, aFrameList);
|
|
|
|
nsIFrame* prevFrame = nsTableFrame::GetFrameAtOrBefore(this, aPrevFrameIn,
|
|
|
|
nsLayoutAtoms::tableColFrame);
|
1999-08-06 18:34:56 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
PRInt32 colIndex = (prevFrame) ? ((nsTableColFrame*)prevFrame)->GetColIndex() + 1 : 0;
|
|
|
|
InsertColsReflow(*aPresContext, aPresShell, colIndex, aFrameList, lastFrame);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableColGroupFrame::InsertColsReflow(nsIPresContext& aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
nsIFrame* aFirstFrame,
|
|
|
|
nsIFrame* aLastFrame)
|
|
|
|
{
|
|
|
|
AddColsToTable(aPresContext, aColIndex, PR_TRUE, aFirstFrame, aLastFrame);
|
1999-08-06 18:34:56 +04:00
|
|
|
|
|
|
|
nsTableFrame* tableFrame;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
1999-12-14 01:56:31 +03:00
|
|
|
tableFrame->InvalidateColumnWidths();
|
1999-08-06 18:34:56 +04:00
|
|
|
|
|
|
|
// Generate a reflow command so we reflow the table
|
1999-12-14 01:56:31 +03:00
|
|
|
AddTableDirtyReflowCommand(&aPresContext, aPresShell, tableFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableColGroupFrame::RemoveChild(nsIPresContext& aPresContext,
|
|
|
|
nsTableColFrame& aChild,
|
|
|
|
PRBool aResetColIndices)
|
|
|
|
{
|
|
|
|
PRInt32 colIndex = 0;
|
|
|
|
nsIFrame* nextChild = nsnull;
|
|
|
|
if (aResetColIndices) {
|
|
|
|
colIndex = aChild.GetColIndex();
|
|
|
|
aChild.GetNextSibling(&nextChild);
|
|
|
|
}
|
|
|
|
if (mFrames.DestroyFrame(&aPresContext, (nsIFrame*)&aChild)) {
|
|
|
|
mColCount--;
|
|
|
|
if (aResetColIndices) {
|
|
|
|
ResetColIndices(this, colIndex, nextChild);
|
|
|
|
}
|
|
|
|
}
|
1999-08-06 18:34:56 +04:00
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
// this removes children form the last col group (eColGroupAnonymousCell) in the
|
|
|
|
// table only,so there is no need to reset col indices for subsequent col groups.
|
|
|
|
void
|
|
|
|
nsTableColGroupFrame::RemoveChildrenAtEnd(nsIPresContext& aPresContext,
|
|
|
|
PRInt32 aNumChildrenToRemove)
|
|
|
|
{
|
|
|
|
PRInt32 numToRemove = aNumChildrenToRemove;
|
|
|
|
if (numToRemove > mColCount) {
|
|
|
|
NS_ASSERTION(PR_FALSE, "invalid arg to RemoveChildrenAtEnd");
|
|
|
|
numToRemove = mColCount;
|
|
|
|
}
|
|
|
|
PRInt32 offsetOfFirstRemoval = mColCount - numToRemove;
|
|
|
|
PRInt32 offsetX = 0;
|
|
|
|
nsIFrame* kidFrame = mFrames.FirstChild();
|
|
|
|
while(kidFrame) {
|
|
|
|
nsIAtom* kidType;
|
|
|
|
kidFrame->GetFrameType(&kidType);
|
|
|
|
if (nsLayoutAtoms::tableColFrame == kidType) {
|
|
|
|
offsetX++;
|
|
|
|
if (offsetX > offsetOfFirstRemoval) {
|
|
|
|
nsIFrame* byebye = kidFrame;
|
|
|
|
kidFrame->GetNextSibling(&kidFrame);
|
|
|
|
mFrames.DestroyFrame(&aPresContext, byebye);
|
|
|
|
NS_RELEASE(kidType);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(kidType);
|
|
|
|
kidFrame->GetNextSibling(&kidFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-08-06 18:34:56 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsTableColGroupFrame::RemoveFrame(nsIPresContext* aPresContext,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
1999-12-14 01:56:31 +03:00
|
|
|
if (!aOldFrame) return NS_OK;
|
|
|
|
|
|
|
|
nsIAtom* frameType = nsnull;
|
|
|
|
aOldFrame->GetFrameType(&frameType);
|
|
|
|
if (nsLayoutAtoms::tableColFrame == frameType) {
|
|
|
|
nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame;
|
|
|
|
PRInt32 colIndex = colFrame->GetColIndex();
|
|
|
|
RemoveChild(*aPresContext, *colFrame, PR_TRUE);
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if (tableFrame) {
|
|
|
|
tableFrame->RemoveCol(*aPresContext, this, colIndex, PR_TRUE, PR_TRUE);
|
1999-08-06 18:34:56 +04:00
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
tableFrame->InvalidateColumnWidths();
|
|
|
|
// Generate a reflow command so we reflow the table
|
|
|
|
AddTableDirtyReflowCommand(aPresContext, aPresShell, tableFrame);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mFrames.DestroyFrame(aPresContext, aOldFrame);
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(frameType);
|
1999-08-06 18:34:56 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD nsTableColGroupFrame::Paint(nsIPresContext* aPresContext,
|
1998-04-17 05:41:24 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
1999-06-08 01:10:25 +04:00
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1999-06-08 01:10:25 +04:00
|
|
|
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
|
|
|
nsCompatibility mode;
|
1999-11-24 09:03:41 +03:00
|
|
|
aPresContext->GetCompatibilityMode(&mode);
|
1999-06-08 01:10:25 +04:00
|
|
|
if (eCompatibility_Standard == mode) {
|
|
|
|
const nsStyleDisplay* disp =
|
|
|
|
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
|
|
|
|
if (disp->mVisible) {
|
|
|
|
const nsStyleSpacing* spacing =
|
|
|
|
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
|
|
|
const nsStyleColor* color =
|
|
|
|
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
|
|
|
|
nsRect rect(0, 0, mRect.width, mRect.height);
|
|
|
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *color, *spacing, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
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;
|
1999-11-19 18:33:29 +03:00
|
|
|
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status);
|
|
|
|
FinishReflowChild(kidFrame, aPresContext, kidSize, 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;
|
|
|
|
}
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD nsTableColGroupFrame::IncrementalReflow(nsIPresContext* aPresContext,
|
1998-10-16 01:07:37 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
|
1998-10-16 01:07:37 +04:00
|
|
|
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
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
1999-08-06 18:34:56 +04:00
|
|
|
default:
|
|
|
|
NS_NOTYETIMPLEMENTED("unexpected reflow command type");
|
1998-10-16 01:07:37 +04:00
|
|
|
rv = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD nsTableColGroupFrame::IR_StyleChanged(nsIPresContext* aPresContext,
|
1998-10-30 10:57:44 +03:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
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
|
1999-12-14 01:56:31 +03:00
|
|
|
nsTableFrame* tableFrame = nsnull;
|
1998-10-30 10:57:44 +03:00
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
1999-12-14 01:56:31 +03:00
|
|
|
if ((NS_SUCCEEDED(rv)) && tableFrame) {
|
|
|
|
tableFrame->InvalidateColumnWidths();
|
1998-10-30 10:57:44 +03:00
|
|
|
tableFrame->InvalidateFirstPassCache();
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
|
1998-10-16 01:07:37 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame * aNextFrame)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
1999-08-19 23:52:37 +04:00
|
|
|
|
1998-10-16 01:07:37 +04:00
|
|
|
// Remember the old col count
|
1999-12-14 01:56:31 +03:00
|
|
|
const PRInt32 oldColCount = GetColCount();
|
1998-10-16 01:07:37 +04:00
|
|
|
|
|
|
|
// 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));
|
1999-11-19 18:33:29 +03:00
|
|
|
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, aStatus);
|
|
|
|
aNextFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
|
1998-10-16 01:07:37 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsTableFrame *tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
1999-12-14 01:56:31 +03:00
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame)) {
|
1998-10-16 01:07:37 +04:00
|
|
|
// 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
|
1999-12-14 01:56:31 +03:00
|
|
|
const PRInt32 newColCount = GetColCount();
|
|
|
|
tableFrame->InvalidateColumnWidths();
|
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-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;
|
1999-12-16 04:51:06 +03:00
|
|
|
count++;
|
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()
|
|
|
|
{
|
1999-12-14 01:56:31 +03:00
|
|
|
PRInt32 span = 1;
|
|
|
|
nsCOMPtr<nsIContent> iContent;
|
|
|
|
nsresult rv = GetContent(getter_AddRefs(iContent));
|
|
|
|
if (NS_FAILED(rv) || !iContent) return rv;
|
|
|
|
|
|
|
|
// col group element derives from col element
|
|
|
|
nsIDOMHTMLTableColElement* cgContent = nsnull;
|
|
|
|
rv = iContent->QueryInterface(kIDOMHTMLTableColElementIID,
|
|
|
|
(void **)&cgContent);
|
|
|
|
if (cgContent && NS_SUCCEEDED(rv)) {
|
|
|
|
cgContent->GetSpan(&span);
|
|
|
|
// XXX why does this work!!
|
|
|
|
if (span == -1) {
|
|
|
|
span = 1;
|
|
|
|
}
|
|
|
|
NS_RELEASE(cgContent);
|
1998-09-24 01:48:26 +04:00
|
|
|
}
|
|
|
|
return span;
|
|
|
|
}
|
|
|
|
|
1998-10-15 02:51:50 +04:00
|
|
|
/** 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;
|
1999-12-14 01:56:31 +03:00
|
|
|
if (aIndex != mStartColIndex) {
|
1998-10-15 02:51:50 +04:00
|
|
|
mStartColIndex = aIndex;
|
1999-12-14 01:56:31 +03:00
|
|
|
result = GetColCount();
|
1998-10-15 02:51:50 +04:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
|
|
|
|
// this could be optimized by using col group frame starting indicies,
|
|
|
|
// but typically there aren't enough very large col groups for the added complexity.
|
|
|
|
nsTableColGroupFrame*
|
|
|
|
nsTableColGroupFrame::GetColGroupFrameContaining(nsFrameList& aColGroupList,
|
|
|
|
nsTableColFrame& aColFrame)
|
|
|
|
{
|
|
|
|
nsIFrame* childFrame = aColGroupList.FirstChild();
|
|
|
|
while (childFrame) {
|
|
|
|
nsIAtom* frameType = nsnull;
|
|
|
|
childFrame->GetFrameType(&frameType);
|
|
|
|
if (nsLayoutAtoms::tableColGroupFrame == frameType) {
|
|
|
|
nsTableColFrame* colFrame = nsnull;
|
|
|
|
childFrame->FirstChild(nsnull, (nsIFrame **)&colFrame);
|
|
|
|
while (colFrame) {
|
|
|
|
if (colFrame = &aColFrame) {
|
|
|
|
NS_RELEASE(frameType);
|
|
|
|
return (nsTableColGroupFrame *)childFrame;
|
|
|
|
}
|
|
|
|
colFrame->GetNextSibling((nsIFrame **)&colFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(frameType);
|
|
|
|
childFrame->GetNextSibling(&childFrame);
|
|
|
|
}
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
void nsTableColGroupFrame::DeleteColFrame(nsIPresContext* aPresContext, nsTableColFrame* aColFrame)
|
1999-07-28 12:09:02 +04:00
|
|
|
{
|
|
|
|
mFrames.DestroyFrame(aPresContext, aColFrame);
|
|
|
|
}
|
|
|
|
|
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
|
1999-12-05 02:49:50 +03:00
|
|
|
NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
1999-05-12 02:03:29 +04:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-05 02:49:50 +03:00
|
|
|
nsTableColGroupFrame* it = new (aPresShell) nsTableColGroupFrame;
|
1998-04-14 00:24:54 +04:00
|
|
|
if (nsnull == it) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1999-05-12 02:03:29 +04:00
|
|
|
*aNewFrame = it;
|
1998-04-14 00:24:54 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1999-10-02 04:02:54 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableColGroupFrame::GetFrameType(nsIAtom** aType) const
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
|
|
|
|
*aType = nsLayoutAtoms::tableColGroupFrame;
|
|
|
|
NS_ADDREF(*aType);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableColGroupFrame::GetFrameName(nsString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName("TableColGroup", aResult);
|
|
|
|
}
|
1999-08-31 07:09:40 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableColGroupFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
|
|
|
|
{
|
1999-09-01 05:02:16 +04:00
|
|
|
if (!aResult) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
1999-08-31 07:09:40 +04:00
|
|
|
}
|
1999-09-01 05:02:16 +04:00
|
|
|
PRUint32 sum = sizeof(*this);
|
|
|
|
*aResult = sum;
|
|
|
|
return NS_OK;
|
1999-08-31 07:09:40 +04:00
|
|
|
}
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|