1998-04-13 20:24:54 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00: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-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00: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-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-04-13 20:24:54 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2000-02-02 22:24:56 +00:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1998-04-13 20:24:54 +00:00
|
|
|
*/
|
1999-12-14 00:24:33 +00:00
|
|
|
#include "nsTableFrame.h"
|
1999-01-03 19:22:40 +00:00
|
|
|
#include "nsTableColFrame.h"
|
1999-12-14 00:24:33 +00:00
|
|
|
#include "nsTableCellFrame.h"
|
1998-11-11 19:56:02 +00:00
|
|
|
#include "nsTableFrame.h"
|
1998-06-09 04:51:44 +00:00
|
|
|
#include "nsIReflowCommand.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIRenderingContext.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
#include "nsIContent.h"
|
1998-09-15 17:58:24 +00:00
|
|
|
#include "nsIHTMLContent.h"
|
|
|
|
#include "nsHTMLIIDs.h"
|
1998-10-06 00:44:35 +00:00
|
|
|
#include "nsHTMLParts.h"
|
1998-06-11 00:13:18 +00:00
|
|
|
#include "nsHTMLValue.h"
|
1998-05-01 20:44:55 +00:00
|
|
|
#include "nsHTMLAtoms.h"
|
1998-06-05 02:36:25 +00:00
|
|
|
#include "nsHTMLIIDs.h"
|
1998-10-06 00:44:35 +00:00
|
|
|
#include "nsVoidArray.h"
|
1998-05-21 23:43:18 +00:00
|
|
|
#include "nsIView.h"
|
1998-07-23 18:05:03 +00:00
|
|
|
#include "nsStyleUtil.h"
|
1999-02-24 05:54:31 +00:00
|
|
|
#include "nsLayoutAtoms.h"
|
1999-10-22 02:06:22 +00:00
|
|
|
#include "nsIFrameManager.h"
|
|
|
|
#include "nsIPresShell.h"
|
1999-07-28 08:09:02 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIHTMLTableCellElement.h"
|
1999-09-30 14:11:16 +00:00
|
|
|
#include "nsIDOMHTMLTableCellElement.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2000-04-13 20:21:32 +00:00
|
|
|
//TABLECELL SELECTION
|
|
|
|
#include "nsIFrameSelection.h"
|
2000-04-13 22:39:39 +00:00
|
|
|
#include "nsILookAndFeel.h"
|
2000-04-13 20:21:32 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID);
|
1999-09-30 14:11:16 +00:00
|
|
|
static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID);
|
1998-06-23 23:23:21 +00:00
|
|
|
|
2000-01-04 05:31:56 +00:00
|
|
|
nsTableCellFrame::nsTableCellFrame()
|
|
|
|
{
|
|
|
|
mColIndex = 0;
|
|
|
|
mPriorAvailWidth = 0;
|
|
|
|
mBorderEdges = nsnull;
|
|
|
|
}
|
|
|
|
|
1999-10-17 03:30:11 +00:00
|
|
|
nsTableCellFrame::~nsTableCellFrame()
|
|
|
|
{
|
|
|
|
delete mBorderEdges;
|
|
|
|
}
|
|
|
|
|
1999-02-25 05:31:15 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsTableCellFrame::Init(nsIPresContext* aPresContext,
|
1999-02-25 05:31:15 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// Let the base class do its initialization
|
|
|
|
rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext,
|
|
|
|
aPrevInFlow);
|
|
|
|
|
|
|
|
if (aPrevInFlow) {
|
|
|
|
// Set the column index
|
|
|
|
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aPrevInFlow;
|
1999-12-13 22:56:31 +00:00
|
|
|
PRInt32 colIndex;
|
|
|
|
cellFrame->GetColIndex(colIndex);
|
|
|
|
InitCellFrame(colIndex);
|
1999-02-25 05:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2000-01-04 05:31:56 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint)
|
|
|
|
{
|
|
|
|
// let the table frame decide what to do
|
|
|
|
nsTableFrame* tableFrame = nsnull;
|
|
|
|
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (tableFrame)) {
|
|
|
|
tableFrame->AttributeChangedFor(aPresContext, this, aChild, aAttribute);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-09-30 14:11:16 +00:00
|
|
|
void nsTableCellFrame::SetPass1MaxElementSize(const nsSize& aMaxElementSize)
|
|
|
|
{
|
|
|
|
mPass1MaxElementSize.height = aMaxElementSize.height;
|
|
|
|
nscoord maxElemWidth = aMaxElementSize.width;
|
|
|
|
// the max elem width needs to be set to the max of aMaxElementSize.width and
|
|
|
|
// the width attribute if both nowrap and width are present on the cell.
|
|
|
|
const nsStylePosition* stylePosition;
|
|
|
|
GetStyleData(eStyleStruct_Position, ((const nsStyleStruct *&)stylePosition));
|
|
|
|
if (stylePosition->mWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord styleWidth = stylePosition->mWidth.GetCoordValue();
|
|
|
|
if (styleWidth > 0) {
|
|
|
|
nsIDOMHTMLTableCellElement* cellContent = nsnull;
|
|
|
|
nsresult rv = mContent->QueryInterface(kIDOMHTMLTableCellElementIID, (void **)&cellContent);
|
|
|
|
if (cellContent && NS_SUCCEEDED(rv)) {
|
|
|
|
PRBool nowrap = PR_FALSE;
|
|
|
|
cellContent->GetNoWrap(&nowrap);
|
|
|
|
if (nowrap) {
|
|
|
|
maxElemWidth = PR_MAX(maxElemWidth, styleWidth);
|
|
|
|
}
|
|
|
|
NS_RELEASE(cellContent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mPass1MaxElementSize.width = maxElemWidth;
|
|
|
|
}
|
|
|
|
|
1999-08-01 22:21:03 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsTableCellFrame::AppendFrames(nsIPresContext* aPresContext,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(PR_FALSE, "unsupported operation");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsTableCellFrame::InsertFrames(nsIPresContext* aPresContext,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(PR_FALSE, "unsupported operation");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsTableCellFrame::RemoveFrame(nsIPresContext* aPresContext,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(PR_FALSE, "unsupported operation");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
1998-12-21 06:38:18 +00:00
|
|
|
void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
|
|
|
|
{
|
|
|
|
nsTableFrame* tableFrame=nsnull; // I should be checking my own style context, but border-collapse isn't inheriting correctly
|
|
|
|
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
1999-12-13 22:56:31 +00:00
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame)) {
|
|
|
|
SetColIndex(aColIndex);
|
|
|
|
if (NS_STYLE_BORDER_COLLAPSE == tableFrame->GetBorderCollapseStyle()) {
|
2000-01-04 05:31:56 +00:00
|
|
|
if (mBorderEdges) delete mBorderEdges; // this could be non null during a reinitialization
|
1999-10-17 03:30:11 +00:00
|
|
|
mBorderEdges = new nsBorderEdges;
|
|
|
|
mBorderEdges->mOutsideEdge=PR_FALSE;
|
|
|
|
|
2000-02-01 03:23:29 +00:00
|
|
|
PRInt32 rowspan = tableFrame->GetEffectiveRowSpan(*this);
|
1998-12-21 06:38:18 +00:00
|
|
|
PRInt32 i;
|
1999-12-13 22:56:31 +00:00
|
|
|
for (i=0; i<rowspan; i++) {
|
1998-12-21 06:38:18 +00:00
|
|
|
nsBorderEdge *borderToAdd = new nsBorderEdge();
|
1999-10-17 03:30:11 +00:00
|
|
|
mBorderEdges->mEdges[NS_SIDE_LEFT].AppendElement(borderToAdd);
|
1998-12-21 06:38:18 +00:00
|
|
|
borderToAdd = new nsBorderEdge();
|
1999-10-17 03:30:11 +00:00
|
|
|
mBorderEdges->mEdges[NS_SIDE_RIGHT].AppendElement(borderToAdd);
|
1998-12-21 06:38:18 +00:00
|
|
|
}
|
2000-02-01 03:23:29 +00:00
|
|
|
PRInt32 colspan = tableFrame->GetEffectiveColSpan(*this);
|
1999-12-13 22:56:31 +00:00
|
|
|
for (i=0; i<colspan; i++) {
|
1998-12-21 06:38:18 +00:00
|
|
|
nsBorderEdge *borderToAdd = new nsBorderEdge();
|
1999-10-17 03:30:11 +00:00
|
|
|
mBorderEdges->mEdges[NS_SIDE_TOP].AppendElement(borderToAdd);
|
1998-12-21 06:38:18 +00:00
|
|
|
borderToAdd = new nsBorderEdge();
|
1999-10-17 03:30:11 +00:00
|
|
|
mBorderEdges->mEdges[NS_SIDE_BOTTOM].AppendElement(borderToAdd);
|
1998-12-21 06:38:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
nsresult nsTableCellFrame::SetColIndex(PRInt32 aColIndex)
|
|
|
|
{
|
|
|
|
mColIndex = aColIndex;
|
|
|
|
// for style context optimization, set the content's column index if possible.
|
|
|
|
// this can only be done if we really have an nsTableCell.
|
|
|
|
// other tags mapped to table cell display won't benefit from this optimization
|
|
|
|
// see nsHTMLStyleSheet::RulesMatching
|
|
|
|
|
|
|
|
//nsIContent* cell;
|
|
|
|
//kidFrame->GetContent(&cell);
|
|
|
|
nsCOMPtr<nsIContent> cell;
|
|
|
|
nsresult rv = GetContent(getter_AddRefs(cell));
|
|
|
|
if (NS_FAILED(rv) || !cell)
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsIHTMLTableCellElement* cellContent = nsnull;
|
|
|
|
rv = cell->QueryInterface(kIHTMLTableCellElementIID,
|
|
|
|
(void **)&cellContent); // cellContent: REFCNT++
|
|
|
|
if (cellContent && NS_SUCCEEDED(rv)) { // it's a table cell
|
|
|
|
cellContent->SetColIndex(aColIndex);
|
|
|
|
NS_RELEASE(cellContent);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-12-21 18:54:23 +00:00
|
|
|
void nsTableCellFrame::SetBorderEdgeLength(PRUint8 aSide,
|
|
|
|
PRInt32 aIndex,
|
|
|
|
nscoord aLength)
|
1998-12-21 06:38:18 +00:00
|
|
|
{
|
1999-10-17 03:30:11 +00:00
|
|
|
NS_PRECONDITION(mBorderEdges, "haven't allocated border edges struct");
|
1998-12-21 06:38:18 +00:00
|
|
|
if ((NS_SIDE_LEFT==aSide) || (NS_SIDE_RIGHT==aSide))
|
|
|
|
{
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 baseRowIndex;
|
|
|
|
GetRowIndex(baseRowIndex);
|
|
|
|
PRInt32 rowIndex = aIndex-baseRowIndex;
|
1999-10-17 03:30:11 +00:00
|
|
|
nsBorderEdge *border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
|
2000-03-04 01:05:18 +00:00
|
|
|
if (border) {
|
|
|
|
border->mLength = aLength;
|
|
|
|
}
|
1998-12-21 06:38:18 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
NS_ASSERTION(PR_FALSE, "bad arg aSide passed to SetBorderEdgeLength");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_METHOD nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
1998-04-17 01:41:24 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 15:54:23 +00:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-08-27 21:53:04 +00:00
|
|
|
const nsStyleDisplay* disp =
|
|
|
|
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-08-27 21:53:04 +00:00
|
|
|
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
2000-03-17 10:15:13 +00:00
|
|
|
if (disp->IsVisibleOrCollapsed()) {
|
1998-12-18 15:54:23 +00:00
|
|
|
const nsStyleColor* myColor =
|
|
|
|
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
|
2000-04-13 20:21:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
//TABLECELL SELECTION
|
2000-04-30 18:56:26 +00:00
|
|
|
PRInt16 displaySelection;
|
2000-04-13 20:21:32 +00:00
|
|
|
displaySelection = DisplaySelection(aPresContext);
|
|
|
|
if (displaySelection)
|
|
|
|
{
|
|
|
|
nsFrameState frameState;
|
|
|
|
PRBool isSelected;
|
|
|
|
GetFrameState(&frameState);
|
|
|
|
isSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
|
|
|
|
if (isSelected)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsresult result = aPresContext->GetShell(getter_AddRefs(shell));
|
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
|
|
|
nsCOMPtr<nsIFrameSelection> frameSelection;
|
|
|
|
result = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
|
|
|
if (NS_SUCCEEDED(result))
|
|
|
|
{
|
|
|
|
PRBool tableCellSelectionMode;
|
|
|
|
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
|
|
|
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
|
|
|
{
|
|
|
|
frameSelection->GetTableCellSelectionStyleColor(&myColor);
|
2000-04-30 18:56:26 +00:00
|
|
|
if(displaySelection==nsISelectionController::SELECTION_DISABLED)
|
|
|
|
{
|
|
|
|
((nsStyleColor *)myColor)->mBackgroundColor = NS_RGB(176,176,176);// disabled color
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nsILookAndFeel* look = nsnull;
|
|
|
|
if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(&look)) && look) {
|
|
|
|
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, ((nsStyleColor *)myColor)->mBackgroundColor);//VERY BAD CAST..TEMPORARY
|
|
|
|
NS_RELEASE(look);
|
|
|
|
}
|
|
|
|
}
|
2000-04-13 20:21:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//END SELECTION
|
|
|
|
|
1998-12-18 15:54:23 +00:00
|
|
|
const nsStyleSpacing* mySpacing =
|
|
|
|
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
|
|
|
NS_ASSERTION(nsnull!=myColor, "bad style color");
|
|
|
|
NS_ASSERTION(nsnull!=mySpacing, "bad style spacing");
|
1998-04-30 00:27:59 +00:00
|
|
|
|
1998-12-21 06:38:18 +00:00
|
|
|
const nsStyleTable* cellTableStyle;
|
|
|
|
GetStyleData(eStyleStruct_Table, ((const nsStyleStruct *&)cellTableStyle));
|
1998-12-18 15:54:23 +00:00
|
|
|
nsRect rect(0, 0, mRect.width, mRect.height);
|
1998-05-26 23:17:29 +00:00
|
|
|
|
1999-06-08 05:04:22 +00:00
|
|
|
// only non empty cells render their background
|
|
|
|
if (PR_FALSE == GetContentEmpty()) {
|
|
|
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *myColor, *mySpacing, 0, 0);
|
|
|
|
}
|
1998-10-30 07:57:44 +00:00
|
|
|
|
1998-12-18 15:54:23 +00:00
|
|
|
// empty cells do not render their border
|
|
|
|
PRBool renderBorder = PR_TRUE;
|
|
|
|
if (PR_TRUE==GetContentEmpty())
|
|
|
|
{
|
|
|
|
if (NS_STYLE_TABLE_EMPTY_CELLS_HIDE==cellTableStyle->mEmptyCells)
|
|
|
|
renderBorder=PR_FALSE;
|
|
|
|
}
|
|
|
|
if (PR_TRUE==renderBorder)
|
|
|
|
{
|
1998-12-21 06:38:18 +00:00
|
|
|
PRIntn skipSides = GetSkipSides();
|
|
|
|
nsTableFrame* tableFrame=nsnull; // I should be checking my own style context, but border-collapse isn't inheriting correctly
|
|
|
|
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if ((NS_SUCCEEDED(rv)) && (nsnull!=tableFrame))
|
|
|
|
{
|
|
|
|
const nsStyleTable* tableStyle;
|
|
|
|
tableFrame->GetStyleData(eStyleStruct_Table, ((const nsStyleStruct *&)tableStyle));
|
1999-08-10 00:49:10 +00:00
|
|
|
if (NS_STYLE_BORDER_SEPARATE == tableFrame->GetBorderCollapseStyle())
|
1998-12-21 06:38:18 +00:00
|
|
|
{
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
1999-01-22 22:38:34 +00:00
|
|
|
aDirtyRect, rect, *mySpacing, mStyleContext, skipSides);
|
1998-12-21 06:38:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nsCSSRendering::PaintBorderEdges(aPresContext, aRenderingContext, this,
|
1999-10-17 03:30:11 +00:00
|
|
|
aDirtyRect, rect, mBorderEdges, mStyleContext, skipSides);
|
1998-12-21 06:38:18 +00:00
|
|
|
}
|
|
|
|
}
|
1998-12-18 15:54:23 +00:00
|
|
|
}
|
1998-07-27 07:37:57 +00:00
|
|
|
}
|
1998-05-26 23:17:29 +00:00
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
1998-04-13 20:24:54 +00:00
|
|
|
// for debug...
|
1999-03-26 00:39:35 +00:00
|
|
|
if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) {
|
1998-12-23 15:47:43 +00:00
|
|
|
aRenderingContext.SetColor(NS_RGB(0, 0, 128));
|
1998-04-13 20:24:54 +00:00
|
|
|
aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);
|
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-08-27 21:53:04 +00:00
|
|
|
// if the cell originates in a row and/or col that is collapsed, the
|
|
|
|
// bottom and/or right portion of the cell is painted by translating
|
|
|
|
// the rendering context.
|
1999-02-11 06:22:33 +00:00
|
|
|
PRBool clipState;
|
1999-10-22 02:06:22 +00:00
|
|
|
nsPoint offset;
|
1999-11-24 06:03:41 +00:00
|
|
|
GetCollapseOffset(aPresContext, offset);
|
1999-02-11 06:22:33 +00:00
|
|
|
if ((0 != offset.x) || (0 != offset.y)) {
|
1999-10-27 23:01:21 +00:00
|
|
|
aRenderingContext.PushState();
|
1999-02-11 06:22:33 +00:00
|
|
|
aRenderingContext.Translate(offset.x, offset.y);
|
1999-08-27 21:53:04 +00:00
|
|
|
aRenderingContext.SetClipRect(nsRect(-offset.x, -offset.y, mRect.width, mRect.height),
|
1999-02-11 06:22:33 +00:00
|
|
|
nsClipCombine_kIntersect, clipState);
|
1999-10-27 23:01:21 +00:00
|
|
|
}
|
1998-12-18 15:54:23 +00:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
1999-10-27 23:01:21 +00:00
|
|
|
if ((0 != offset.x) || (0 != offset.y)) {
|
|
|
|
aRenderingContext.PopState(clipState);
|
|
|
|
}
|
1999-02-11 06:22:33 +00:00
|
|
|
|
1999-09-17 23:33:39 +00:00
|
|
|
return NS_OK;
|
|
|
|
/*nsFrame::Paint(aPresContext,
|
1999-06-01 23:04:13 +00:00
|
|
|
aRenderingContext,
|
|
|
|
aDirtyRect,
|
1999-09-17 23:33:39 +00:00
|
|
|
aWhichLayer);*/
|
1999-06-01 23:04:13 +00:00
|
|
|
}
|
|
|
|
|
2000-03-22 02:43:08 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame)
|
|
|
|
{
|
|
|
|
// this should act like a block, so we need to override
|
|
|
|
return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame);
|
|
|
|
}
|
|
|
|
|
1999-06-01 23:04:13 +00:00
|
|
|
//null range means the whole thing
|
|
|
|
NS_IMETHODIMP
|
1999-10-26 04:44:41 +00:00
|
|
|
nsTableCellFrame::SetSelected(nsIPresContext* aPresContext,
|
|
|
|
nsIDOMRange *aRange,
|
|
|
|
PRBool aSelected,
|
|
|
|
nsSpread aSpread)
|
1999-06-01 23:04:13 +00:00
|
|
|
{
|
|
|
|
//traverse through children unselect tables
|
1999-09-21 22:58:14 +00:00
|
|
|
#if 0
|
1999-09-17 23:33:39 +00:00
|
|
|
if ((aSpread == eSpreadDown)){
|
1999-06-01 23:04:13 +00:00
|
|
|
nsIFrame* kid;
|
1999-08-27 21:53:04 +00:00
|
|
|
FirstChild(nsnull, &kid);
|
1999-06-01 23:04:13 +00:00
|
|
|
while (nsnull != kid) {
|
1999-09-17 23:33:39 +00:00
|
|
|
kid->SetSelected(nsnull,aSelected,eSpreadDown);
|
1999-06-01 23:04:13 +00:00
|
|
|
|
|
|
|
kid->GetNextSibling(&kid);
|
|
|
|
}
|
|
|
|
}
|
1999-09-21 22:58:14 +00:00
|
|
|
//return nsFrame::SetSelected(aRange,aSelected,eSpreadNone);
|
|
|
|
#endif
|
2000-03-21 06:04:02 +00:00
|
|
|
// Must call base class to set mSelected state and trigger repaint of frame
|
|
|
|
// Note that in current version, aRange and aSpread are ignored,
|
|
|
|
// only this frame is considered
|
|
|
|
nsFrame::SetSelected(aPresContext, aRange, aSelected, aSpread);
|
2000-04-30 18:56:26 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
nsresult result = aPresContext->GetShell(getter_AddRefs(shell));
|
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
|
|
|
nsCOMPtr<nsIFrameSelection> frameSelection;
|
|
|
|
result = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
|
|
|
if (NS_SUCCEEDED(result) && frameSelection)
|
|
|
|
{
|
|
|
|
PRBool tableCellSelectionMode;
|
|
|
|
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
|
|
|
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
|
|
|
{
|
|
|
|
nsRect frameRect;
|
|
|
|
GetRect(frameRect);
|
|
|
|
nsRect rect(0, 0, frameRect.width, frameRect.height);
|
|
|
|
Invalidate(aPresContext, rect, PR_FALSE);
|
|
|
|
}
|
|
|
|
}
|
1999-09-21 22:58:14 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-20 17:45:07 +00:00
|
|
|
PRIntn
|
|
|
|
nsTableCellFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
PRIntn skip = 0;
|
|
|
|
if (nsnull != mPrevInFlow) {
|
|
|
|
skip |= 1 << NS_SIDE_TOP;
|
|
|
|
}
|
|
|
|
if (nsnull != mNextInFlow) {
|
|
|
|
skip |= 1 << NS_SIDE_BOTTOM;
|
|
|
|
}
|
|
|
|
return skip;
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-06-01 23:04:13 +00:00
|
|
|
PRBool nsTableCellFrame::ParentDisablesSelection() const //override default behavior
|
|
|
|
{
|
|
|
|
PRBool returnval;
|
|
|
|
if (NS_FAILED(GetSelected(&returnval)))
|
|
|
|
return PR_FALSE;
|
|
|
|
if (returnval)
|
|
|
|
return PR_TRUE;
|
|
|
|
return nsFrame::ParentDisablesSelection();
|
|
|
|
}
|
|
|
|
|
1998-12-21 06:38:18 +00:00
|
|
|
void nsTableCellFrame::SetBorderEdge(PRUint8 aSide,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndex,
|
1998-12-21 18:54:23 +00:00
|
|
|
nsBorderEdge *aBorder,
|
|
|
|
nscoord aOddAmountToAdd)
|
1998-12-21 06:38:18 +00:00
|
|
|
{
|
1999-10-17 03:30:11 +00:00
|
|
|
NS_PRECONDITION(mBorderEdges, "haven't allocated border edges struct");
|
1998-12-21 06:38:18 +00:00
|
|
|
nsBorderEdge *border = nsnull;
|
|
|
|
switch (aSide)
|
|
|
|
{
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
{
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 baseColIndex;
|
|
|
|
GetColIndex(baseColIndex);
|
|
|
|
PRInt32 colIndex = aColIndex-baseColIndex;
|
1999-10-17 03:30:11 +00:00
|
|
|
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(colIndex));
|
|
|
|
mBorderEdges->mMaxBorderWidth.top = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.top);
|
1998-12-21 06:38:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
{
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 baseColIndex;
|
|
|
|
GetColIndex(baseColIndex);
|
|
|
|
PRInt32 colIndex = aColIndex-baseColIndex;
|
1999-10-17 03:30:11 +00:00
|
|
|
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(colIndex));
|
|
|
|
mBorderEdges->mMaxBorderWidth.bottom = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.bottom);
|
1998-12-21 06:38:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
{
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 baseRowIndex;
|
|
|
|
GetRowIndex(baseRowIndex);
|
|
|
|
PRInt32 rowIndex = aRowIndex-baseRowIndex;
|
1999-10-17 03:30:11 +00:00
|
|
|
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
|
|
|
|
mBorderEdges->mMaxBorderWidth.left = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.left);
|
1998-12-21 06:38:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
{
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 baseRowIndex;
|
|
|
|
GetRowIndex(baseRowIndex);
|
|
|
|
PRInt32 rowIndex = aRowIndex-baseRowIndex;
|
1999-10-17 03:30:11 +00:00
|
|
|
border = (nsBorderEdge *)(mBorderEdges->mEdges[aSide].ElementAt(rowIndex));
|
|
|
|
mBorderEdges->mMaxBorderWidth.right = PR_MAX(aBorder->mWidth+aOddAmountToAdd, mBorderEdges->mMaxBorderWidth.right);
|
1998-12-21 06:38:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (nsnull!=border) {
|
|
|
|
*border=*aBorder;
|
1998-12-21 18:54:23 +00:00
|
|
|
border->mWidth += aOddAmountToAdd;
|
1998-12-21 06:38:18 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-03-04 01:05:18 +00:00
|
|
|
//XXX determine why this was asserting (after beta)
|
|
|
|
//NS_ASSERTION(PR_FALSE, "bad border edge state");
|
1998-12-21 06:38:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-10-20 17:45:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Align the cell's child frame within the cell
|
|
|
|
*
|
|
|
|
*/
|
2000-02-12 01:55:40 +00:00
|
|
|
void nsTableCellFrame::VerticallyAlignChild(nsIPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState)
|
1998-04-25 18:48:48 +00:00
|
|
|
{
|
1998-06-05 06:09:09 +00:00
|
|
|
const nsStyleText* textStyle =
|
|
|
|
(const nsStyleText*)mStyleContext->GetStyleData(eStyleStruct_Text);
|
1998-12-23 15:47:43 +00:00
|
|
|
/* XXX: remove tableFrame when border-collapse inherits */
|
2000-02-12 01:55:40 +00:00
|
|
|
nsTableFrame* tableFrame = nsnull;
|
1999-08-27 21:53:04 +00:00
|
|
|
(void) nsTableFrame::GetTableFrame(this, tableFrame);
|
1999-07-28 08:09:02 +00:00
|
|
|
nsMargin borderPadding;
|
|
|
|
GetCellBorder (borderPadding, tableFrame);
|
2000-02-12 01:55:40 +00:00
|
|
|
nsMargin padding = nsTableFrame::GetPadding(aReflowState, this);
|
1999-07-28 08:09:02 +00:00
|
|
|
borderPadding += padding;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
nscoord topInset = borderPadding.top;
|
|
|
|
nscoord bottomInset = borderPadding.bottom;
|
|
|
|
PRUint8 verticalAlignFlags = NS_STYLE_VERTICAL_ALIGN_MIDDLE;
|
|
|
|
if (textStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) {
|
|
|
|
verticalAlignFlags = textStyle->mVerticalAlign.GetIntValue();
|
|
|
|
}
|
|
|
|
nscoord height = mRect.height;
|
|
|
|
nsRect kidRect;
|
|
|
|
nsIFrame* firstKid = mFrames.FirstChild();
|
|
|
|
firstKid->GetRect(kidRect);
|
|
|
|
nscoord childHeight = kidRect.height;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
// Vertically align the child
|
|
|
|
nscoord kidYTop = 0;
|
|
|
|
switch (verticalAlignFlags)
|
|
|
|
{
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the baselines of the child frame with the baselines of
|
|
|
|
// other children in the same row which have align = baseline
|
|
|
|
// XXX Not yet implemented, so fall through to top
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the top of the child frame with the top of the content area,
|
1999-07-28 08:09:02 +00:00
|
|
|
kidYTop = topInset;
|
|
|
|
break;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the bottom of the child frame with the bottom of the content area,
|
1999-07-28 08:09:02 +00:00
|
|
|
kidYTop = height - childHeight - bottomInset;
|
|
|
|
break;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-07-28 08:09:02 +00:00
|
|
|
default:
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
1999-08-27 04:29:05 +00:00
|
|
|
// Align the middle of the child frame with the middle of the content area,
|
|
|
|
kidYTop = (height - childHeight - bottomInset + topInset) / 2;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
1999-10-26 04:44:41 +00:00
|
|
|
firstKid->MoveTo(aPresContext, kidRect.x, kidYTop);
|
1999-11-19 15:33:29 +00:00
|
|
|
if (kidYTop != kidRect.y) {
|
|
|
|
// Make sure any child views are correctly positioned. We know the inner table
|
|
|
|
// cell won't have a view
|
|
|
|
nsContainerFrame::PositionChildViews(aPresContext, firstKid);
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
PRInt32 nsTableCellFrame::GetRowSpan()
|
|
|
|
{
|
|
|
|
PRInt32 rowSpan=1;
|
|
|
|
nsIHTMLContent *hc=nsnull;
|
|
|
|
nsresult rv = mContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
|
|
|
|
if (NS_OK==rv)
|
|
|
|
{
|
|
|
|
nsHTMLValue val;
|
1998-12-20 01:21:23 +00:00
|
|
|
hc->GetHTMLAttribute(nsHTMLAtoms::rowspan, val);
|
1998-09-15 17:58:24 +00:00
|
|
|
if (eHTMLUnit_Integer == val.GetUnit()) {
|
|
|
|
rowSpan=val.GetIntValue();
|
|
|
|
}
|
|
|
|
NS_RELEASE(hc);
|
|
|
|
}
|
|
|
|
return rowSpan;
|
|
|
|
}
|
1998-05-21 23:43:18 +00:00
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
PRInt32 nsTableCellFrame::GetColSpan()
|
|
|
|
{
|
|
|
|
PRInt32 colSpan=1;
|
|
|
|
nsIHTMLContent *hc=nsnull;
|
|
|
|
nsresult rv = mContent->QueryInterface(kIHTMLContentIID, (void**) &hc);
|
|
|
|
if (NS_OK==rv)
|
|
|
|
{
|
|
|
|
nsHTMLValue val;
|
1998-12-20 01:21:23 +00:00
|
|
|
hc->GetHTMLAttribute(nsHTMLAtoms::colspan, val);
|
1998-09-15 17:58:24 +00:00
|
|
|
if (eHTMLUnit_Integer == val.GetUnit()) {
|
|
|
|
colSpan=val.GetIntValue();
|
|
|
|
}
|
|
|
|
NS_RELEASE(hc);
|
|
|
|
}
|
|
|
|
return colSpan;
|
|
|
|
}
|
1998-05-21 23:43:18 +00:00
|
|
|
|
|
|
|
|
1999-08-20 13:32:23 +00:00
|
|
|
static
|
1999-04-29 17:43:41 +00:00
|
|
|
void DebugCheckChildSize(nsIFrame* aChild,
|
|
|
|
nsHTMLReflowMetrics& aMet,
|
|
|
|
nsSize& aAvailSize,
|
|
|
|
PRBool aIsPass2Reflow)
|
1999-03-13 12:49:37 +00:00
|
|
|
{
|
1999-07-19 21:37:04 +00:00
|
|
|
|
|
|
|
/* approved for commenting out by rickg
|
1999-03-13 12:49:37 +00:00
|
|
|
if (aMet.width > aAvailSize.width) {
|
|
|
|
nsAutoString tmp;
|
|
|
|
aChild->GetFrameName(tmp);
|
1999-05-11 22:03:29 +00:00
|
|
|
printf("WARNING: cell ");
|
|
|
|
fputs(tmp, stdout);
|
|
|
|
printf(" content has desired width %d given avail width %d\n",
|
|
|
|
aMet.width, aAvailSize.width);
|
1999-03-13 12:49:37 +00:00
|
|
|
}
|
1999-07-19 21:37:04 +00:00
|
|
|
*/
|
1999-04-29 17:43:41 +00:00
|
|
|
if (aIsPass2Reflow) {
|
|
|
|
if ((aMet.width < 0) || (aMet.width > 60000)) {
|
1999-05-11 22:03:29 +00:00
|
|
|
printf("WARNING: cell content %p has large width %d \n", aChild, aMet.width);
|
1999-04-29 17:43:41 +00:00
|
|
|
}
|
|
|
|
if ((aMet.height < 0) || (aMet.height > 60000)) {
|
1999-05-11 22:03:29 +00:00
|
|
|
printf("WARNING: cell content %p has large height %d \n", aChild, aMet.height);
|
1999-04-29 17:43:41 +00:00
|
|
|
}
|
1999-03-13 12:49:37 +00:00
|
|
|
}
|
|
|
|
if (aMet.maxElementSize) {
|
|
|
|
nscoord tmp = aMet.maxElementSize->width;
|
1999-04-29 17:43:41 +00:00
|
|
|
if ((tmp < 0) || (tmp > 60000)) {
|
1999-05-11 22:03:29 +00:00
|
|
|
printf("WARNING: cell content %p has large max element width %d \n", aChild, tmp);
|
1999-03-13 12:49:37 +00:00
|
|
|
}
|
|
|
|
tmp = aMet.maxElementSize->height;
|
1999-04-29 17:43:41 +00:00
|
|
|
if ((tmp < 0) || (tmp > 60000)) {
|
1999-05-11 22:03:29 +00:00
|
|
|
printf("WARNING: cell content %p has large max element height %d \n", aChild, tmp);
|
1999-03-13 12:49:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
/**
|
|
|
|
*/
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
|
1999-04-29 17:43:41 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 04:10:00 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1999-04-29 17:43:41 +00:00
|
|
|
nsReflowStatus& aStatus)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2000-04-21 21:36:33 +00:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame", aReflowState.reason);
|
1999-08-24 12:01:31 +00:00
|
|
|
if (nsDebugTable::gRflCell) nsTableFrame::DebugReflow("TC::Rfl", this, &aReflowState, nsnull);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-10-30 07:57:44 +00:00
|
|
|
nsresult rv = NS_OK;
|
1999-04-09 21:09:52 +00:00
|
|
|
// this should probably be cached somewhere
|
|
|
|
nsCompatibility compatMode;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetCompatibilityMode(&compatMode);
|
1998-10-30 07:57:44 +00:00
|
|
|
|
1998-06-03 00:43:53 +00:00
|
|
|
// Initialize out parameter
|
|
|
|
if (nsnull != aDesiredSize.maxElementSize) {
|
|
|
|
aDesiredSize.maxElementSize->width = 0;
|
|
|
|
aDesiredSize.maxElementSize->height = 0;
|
|
|
|
}
|
|
|
|
|
1998-05-12 04:17:56 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1999-01-05 23:31:18 +00:00
|
|
|
nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight);
|
1998-04-13 20:24:54 +00:00
|
|
|
nsSize maxElementSize;
|
1998-05-25 17:31:49 +00:00
|
|
|
nsSize *pMaxElementSize = aDesiredSize.maxElementSize;
|
1999-01-05 23:31:18 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE==aReflowState.availableWidth)
|
1998-04-13 20:24:54 +00:00
|
|
|
pMaxElementSize = &maxElementSize;
|
1999-05-11 22:03:29 +00:00
|
|
|
|
1998-12-23 15:47:43 +00:00
|
|
|
/* XXX: remove tableFrame when border-collapse inherits */
|
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
2000-02-12 01:55:40 +00:00
|
|
|
nsMargin borderPadding = aReflowState.mComputedPadding;
|
1999-04-09 21:09:52 +00:00
|
|
|
nsMargin border;
|
|
|
|
GetCellBorder(border, tableFrame);
|
|
|
|
if ((NS_UNCONSTRAINEDSIZE == availSize.width) || !GetContentEmpty()) {
|
|
|
|
borderPadding += border;
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord topInset = borderPadding.top;
|
|
|
|
nscoord rightInset = borderPadding.right;
|
1998-05-12 22:28:01 +00:00
|
|
|
nscoord bottomInset = borderPadding.bottom;
|
1999-04-09 21:09:52 +00:00
|
|
|
nscoord leftInset = borderPadding.left;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-07-06 21:00:11 +00:00
|
|
|
// reduce available space by insets, if we're in a constrained situation
|
1998-06-26 00:48:44 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE!=availSize.width)
|
1998-07-06 21:00:11 +00:00
|
|
|
availSize.width -= leftInset+rightInset;
|
1998-06-26 00:48:44 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE!=availSize.height)
|
1998-11-22 08:56:19 +00:00
|
|
|
availSize.height -= topInset+bottomInset;
|
1998-06-26 00:48:44 +00:00
|
|
|
|
1999-08-29 04:18:00 +00:00
|
|
|
PRBool isStyleChanged = PR_FALSE;
|
1998-10-30 07:57:44 +00:00
|
|
|
if (eReflowReason_Incremental == aReflowState.reason)
|
|
|
|
{
|
1999-03-13 12:49:37 +00:00
|
|
|
// We *must* do this otherwise incremental reflow that's
|
1998-07-16 22:15:02 +00:00
|
|
|
// passing through will not work right.
|
|
|
|
nsIFrame* next;
|
|
|
|
aReflowState.reflowCommand->GetNext(next);
|
1998-10-30 07:57:44 +00:00
|
|
|
|
|
|
|
// if it is a StyleChanged reflow targeted at this cell frame,
|
|
|
|
// handle that here
|
|
|
|
// first 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)
|
|
|
|
{
|
|
|
|
nsIReflowCommand::ReflowType type;
|
|
|
|
aReflowState.reflowCommand->GetType(type);
|
|
|
|
if (nsIReflowCommand::StyleChanged==type)
|
|
|
|
{
|
1999-08-29 04:18:00 +00:00
|
|
|
isStyleChanged = PR_TRUE;
|
1998-10-30 07:57:44 +00:00
|
|
|
}
|
1999-04-15 19:28:11 +00:00
|
|
|
else {
|
|
|
|
NS_ASSERTION(PR_FALSE, "table cell target of illegal incremental reflow type");
|
|
|
|
}
|
1998-10-30 07:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// if any of these conditions are not true, we just pass the reflow command down
|
1998-07-16 22:15:02 +00:00
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
// Try to reflow the child into the available space. It might not
|
|
|
|
// fit or might need continuing.
|
1998-04-23 17:29:07 +00:00
|
|
|
if (availSize.height < 0)
|
|
|
|
availSize.height = 1;
|
1998-09-24 16:37:22 +00:00
|
|
|
|
1999-12-30 04:15:45 +00:00
|
|
|
nsHTMLReflowMetrics kidSize(pMaxElementSize, aDesiredSize.mFlags);
|
1998-06-03 00:43:53 +00:00
|
|
|
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
|
1999-01-05 23:31:18 +00:00
|
|
|
SetPriorAvailWidth(aReflowState.availableWidth);
|
1999-01-15 22:52:05 +00:00
|
|
|
nsIFrame* firstKid = mFrames.FirstChild();
|
1999-03-05 04:19:09 +00:00
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid,
|
1998-10-12 14:48:02 +00:00
|
|
|
availSize);
|
1998-10-01 04:46:11 +00:00
|
|
|
|
1999-08-29 04:18:00 +00:00
|
|
|
// If it was a style change targeted at us, then reflow the child using
|
|
|
|
// the special reflow reason
|
|
|
|
if (isStyleChanged) {
|
|
|
|
kidReflowState.reason = eReflowReason_StyleChange;
|
|
|
|
kidReflowState.reflowCommand = nsnull;
|
|
|
|
}
|
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
// Assume the inner child will stay positioned exactly where it is. Later in
|
|
|
|
// VerticallyAlignChild() we'll move it if it turns out to be wrong. This
|
|
|
|
// avoids excessive movement and is more stable
|
|
|
|
nsPoint kidOrigin;
|
|
|
|
if (eReflowReason_Initial == aReflowState.reason) {
|
|
|
|
kidOrigin.MoveTo(leftInset, topInset);
|
|
|
|
} else {
|
2000-02-12 01:55:40 +00:00
|
|
|
// handle percent padding-left which was 0 during initial reflow
|
|
|
|
if (eStyleUnit_Percent == aReflowState.mStyleSpacing->mPadding.GetLeftUnit()) {
|
|
|
|
nsRect kidRect;
|
|
|
|
firstKid->GetRect(kidRect);
|
|
|
|
// only move in the x direction for the same reason as above
|
|
|
|
kidOrigin.MoveTo(leftInset, kidRect.y);
|
|
|
|
firstKid->MoveTo(aPresContext, leftInset, kidRect.y);
|
|
|
|
}
|
1999-11-19 15:33:29 +00:00
|
|
|
firstKid->GetOrigin(kidOrigin);
|
|
|
|
}
|
1999-08-24 12:01:31 +00:00
|
|
|
if (nsDebugTable::gRflArea) nsTableFrame::DebugReflow("Area::Rfl en", firstKid, &kidReflowState, nsnull);
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
|
|
|
|
kidOrigin.x, kidOrigin.y, 0, aStatus);
|
2000-01-02 22:55:48 +00:00
|
|
|
if (nsDebugTable::gRflArea) nsTableFrame::DebugReflow("Area::Rfl ex", firstKid, nsnull, &kidSize, aStatus);
|
1999-08-21 06:38:07 +00:00
|
|
|
|
1998-09-09 20:00:40 +00:00
|
|
|
#ifdef NS_DEBUG
|
1999-04-29 17:43:41 +00:00
|
|
|
DebugCheckChildSize(firstKid, kidSize, availSize, (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth));
|
1998-12-08 19:18:33 +00:00
|
|
|
#endif
|
|
|
|
|
1999-04-09 21:09:52 +00:00
|
|
|
// 0 dimensioned cells need to be treated specially in Standard/NavQuirks mode
|
1999-09-10 18:55:46 +00:00
|
|
|
// see testcase "emptyCells.html"
|
2000-01-28 02:19:45 +00:00
|
|
|
if ((0 == kidSize.width) || (0 == kidSize.height)) { // XXX why was this &&
|
|
|
|
SetContentEmpty(PR_TRUE);
|
|
|
|
if (NS_UNCONSTRAINEDSIZE == kidReflowState.availableWidth) {
|
1999-04-09 21:09:52 +00:00
|
|
|
// need to reduce the insets by border if the cell is empty
|
|
|
|
leftInset -= border.left;
|
|
|
|
rightInset -= border.right;
|
|
|
|
topInset -= border.top;
|
|
|
|
bottomInset -= border.bottom;
|
|
|
|
}
|
2000-01-28 02:19:45 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
SetContentEmpty(PR_FALSE);
|
1998-12-10 19:57:42 +00:00
|
|
|
}
|
1999-09-10 18:55:46 +00:00
|
|
|
|
|
|
|
const nsStylePosition* pos;
|
|
|
|
GetStyleData(eStyleStruct_Position, ((const nsStyleStruct *&)pos));
|
|
|
|
|
|
|
|
// calculate the min cell width
|
|
|
|
float p2t;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-09-10 18:55:46 +00:00
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
nscoord smallestMinWidth = onePixel;
|
|
|
|
if (eCompatibility_NavQuirks == compatMode) {
|
|
|
|
if ((pos->mWidth.GetUnit() != eStyleUnit_Coord) &&
|
|
|
|
(pos->mWidth.GetUnit() != eStyleUnit_Percent)) {
|
1999-10-18 13:45:41 +00:00
|
|
|
if (PR_TRUE == GetContentEmpty()) {
|
|
|
|
if (border.left > 0)
|
|
|
|
smallestMinWidth += onePixel;
|
|
|
|
if (border.right > 0)
|
|
|
|
smallestMinWidth += onePixel;
|
|
|
|
}
|
1999-09-10 18:55:46 +00:00
|
|
|
}
|
1999-10-05 04:21:00 +00:00
|
|
|
}
|
2000-02-01 03:23:29 +00:00
|
|
|
PRInt32 colspan = tableFrame->GetEffectiveColSpan(*this);
|
1999-10-05 04:21:00 +00:00
|
|
|
if (colspan > 1) {
|
|
|
|
smallestMinWidth = PR_MAX(smallestMinWidth, colspan * onePixel);
|
|
|
|
nscoord spacingX = tableFrame->GetCellSpacingX();
|
|
|
|
nscoord spacingExtra = spacingX * (colspan - 1);
|
|
|
|
smallestMinWidth += spacingExtra;
|
2000-02-12 01:55:40 +00:00
|
|
|
if (aReflowState.mComputedPadding.left > 0) {
|
1999-10-05 04:21:00 +00:00
|
|
|
smallestMinWidth -= onePixel;
|
1999-09-10 18:55:46 +00:00
|
|
|
}
|
|
|
|
}
|
1999-10-05 04:21:00 +00:00
|
|
|
|
1999-09-13 14:35:00 +00:00
|
|
|
if ((0 == kidSize.width) && (NS_UNCONSTRAINEDSIZE != kidReflowState.availableWidth)) {
|
|
|
|
// empty content has to be forced to the assigned width for resize or incremental reflow
|
|
|
|
kidSize.width = kidReflowState.availableWidth;
|
1998-11-25 18:43:56 +00:00
|
|
|
}
|
1999-04-09 21:09:52 +00:00
|
|
|
if (0 == kidSize.height) {
|
|
|
|
if ((pos->mHeight.GetUnit() != eStyleUnit_Coord) &&
|
|
|
|
(pos->mHeight.GetUnit() != eStyleUnit_Percent)) {
|
|
|
|
// Standard mode should probably be 0 pixels high instead of 1
|
|
|
|
PRInt32 pixHeight = (eCompatibility_Standard == compatMode) ? 1 : 2;
|
|
|
|
kidSize.height = NSIntPixelsToTwips(pixHeight, p2t);
|
|
|
|
if ((nsnull != aDesiredSize.maxElementSize) && (0 == pMaxElementSize->height))
|
|
|
|
pMaxElementSize->height = kidSize.height;
|
|
|
|
}
|
1998-12-05 05:27:21 +00:00
|
|
|
}
|
1999-04-09 21:09:52 +00:00
|
|
|
// end 0 dimensioned cells
|
1998-12-08 19:18:33 +00:00
|
|
|
|
1999-09-10 18:55:46 +00:00
|
|
|
kidSize.width = PR_MAX(kidSize.width, smallestMinWidth);
|
|
|
|
|
1998-06-05 02:36:25 +00:00
|
|
|
// Place the child
|
1998-09-09 20:00:40 +00:00
|
|
|
//////////////////////////////// HACK //////////////////////////////
|
|
|
|
kidSize.width = PR_MIN(kidSize.width, availSize.width);
|
|
|
|
///////////////////////////// END HACK /////////////////////////////
|
1999-11-19 15:33:29 +00:00
|
|
|
FinishReflowChild(firstKid, aPresContext, kidSize,
|
|
|
|
kidOrigin.x, kidOrigin.y, 0);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
|
|
|
// Return our size and our result
|
1998-06-05 02:36:25 +00:00
|
|
|
|
1999-04-09 21:09:52 +00:00
|
|
|
// first, compute the height which can be set w/o being restricted by aMaxSize.height
|
1999-09-13 14:35:00 +00:00
|
|
|
nscoord cellHeight = kidSize.height;
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != cellHeight) {
|
|
|
|
cellHeight += topInset + bottomInset;
|
|
|
|
}
|
1999-08-19 19:52:37 +00:00
|
|
|
|
1998-06-05 02:36:25 +00:00
|
|
|
// next determine the cell's width
|
1998-07-06 21:00:11 +00:00
|
|
|
nscoord cellWidth = kidSize.width; // at this point, we've factored in the cell's style attributes
|
1998-07-02 17:40:56 +00:00
|
|
|
|
1999-09-13 14:35:00 +00:00
|
|
|
// factor in border and padding
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != cellWidth) {
|
|
|
|
cellWidth += leftInset + rightInset;
|
|
|
|
}
|
1998-07-31 00:32:27 +00:00
|
|
|
|
1998-06-05 02:36:25 +00:00
|
|
|
// set the cell's desired size and max element size
|
1999-09-13 14:35:00 +00:00
|
|
|
aDesiredSize.width = cellWidth;
|
|
|
|
aDesiredSize.height = cellHeight;
|
|
|
|
aDesiredSize.ascent = topInset;
|
1998-04-13 20:24:54 +00:00
|
|
|
aDesiredSize.descent = bottomInset;
|
1999-12-30 04:15:45 +00:00
|
|
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
|
|
|
aDesiredSize.mMaximumWidth = kidSize.mMaximumWidth + leftInset + rightInset;
|
|
|
|
}
|
1999-09-13 14:35:00 +00:00
|
|
|
if (nsnull!=aDesiredSize.maxElementSize) {
|
1998-05-25 17:31:49 +00:00
|
|
|
*aDesiredSize.maxElementSize = *pMaxElementSize;
|
1999-09-13 14:35:00 +00:00
|
|
|
if (0!=pMaxElementSize->height) {
|
1998-07-13 20:41:38 +00:00
|
|
|
aDesiredSize.maxElementSize->height += topInset + bottomInset;
|
1999-09-13 14:35:00 +00:00
|
|
|
}
|
1999-09-10 18:55:46 +00:00
|
|
|
aDesiredSize.maxElementSize->width = PR_MAX(smallestMinWidth, aDesiredSize.maxElementSize->width);
|
|
|
|
aDesiredSize.maxElementSize->width += leftInset + rightInset;
|
1998-04-20 22:49:15 +00:00
|
|
|
}
|
1998-10-02 20:36:35 +00:00
|
|
|
// remember my desired size for this reflow
|
1998-07-11 00:00:31 +00:00
|
|
|
SetDesiredSize(aDesiredSize);
|
1998-10-02 20:36:35 +00:00
|
|
|
|
1999-09-13 14:35:00 +00:00
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
1998-10-08 15:34:48 +00:00
|
|
|
|
2000-01-02 22:55:48 +00:00
|
|
|
if (nsDebugTable::gRflCell) nsTableFrame::DebugReflow("TC::Rfl ex", this, nsnull, &aDesiredSize, aStatus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-04-17 01:41:24 +00:00
|
|
|
return NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-05-01 20:44:55 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Update the border style to map to the HTML border style
|
|
|
|
*
|
|
|
|
*/
|
1998-11-11 19:56:02 +00:00
|
|
|
void nsTableCellFrame::MapHTMLBorderStyle(nsIPresContext* aPresContext,
|
1999-09-02 00:07:14 +00:00
|
|
|
nsStyleSpacing& aSpacingStyle,
|
1999-05-18 05:18:16 +00:00
|
|
|
nsTableFrame* aTableFrame)
|
1998-05-01 20:44:55 +00:00
|
|
|
{
|
1998-11-11 19:56:02 +00:00
|
|
|
//adjust the border style based on the table rules attribute
|
|
|
|
const nsStyleTable* tableStyle;
|
1999-09-02 00:07:14 +00:00
|
|
|
aTableFrame->GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
1998-11-11 19:56:02 +00:00
|
|
|
|
|
|
|
switch (tableStyle->mRules)
|
|
|
|
{
|
|
|
|
case NS_STYLE_TABLE_RULES_NONE:
|
1998-12-07 19:06:55 +00:00
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_TOP, NS_STYLE_BORDER_STYLE_NONE);
|
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_LEFT, NS_STYLE_BORDER_STYLE_NONE);
|
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_BOTTOM, NS_STYLE_BORDER_STYLE_NONE);
|
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_RIGHT, NS_STYLE_BORDER_STYLE_NONE);
|
1998-11-11 19:56:02 +00:00
|
|
|
break;
|
1999-09-02 00:07:14 +00:00
|
|
|
|
1998-11-11 19:56:02 +00:00
|
|
|
case NS_STYLE_TABLE_RULES_COLS:
|
1999-05-18 05:18:16 +00:00
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_TOP, NS_STYLE_BORDER_STYLE_NONE);
|
1998-12-07 19:06:55 +00:00
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_BOTTOM, NS_STYLE_BORDER_STYLE_NONE);
|
1998-11-11 19:56:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_TABLE_RULES_ROWS:
|
1998-12-07 19:06:55 +00:00
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_LEFT, NS_STYLE_BORDER_STYLE_NONE);
|
|
|
|
aSpacingStyle.SetBorderStyle(NS_SIDE_RIGHT, NS_STYLE_BORDER_STYLE_NONE);
|
1998-11-11 19:56:02 +00:00
|
|
|
break;
|
|
|
|
|
1999-09-02 00:07:14 +00:00
|
|
|
default:
|
|
|
|
// do nothing for "GROUPS" or "ALL" or for any illegal value
|
|
|
|
// "GROUPS" will be handled in nsTableFrame::ProcessGroupRules
|
|
|
|
break;
|
1998-11-11 19:56:02 +00:00
|
|
|
}
|
1998-05-01 20:44:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-21 23:43:18 +00:00
|
|
|
PRBool nsTableCellFrame::ConvertToPixelValue(nsHTMLValue& aValue, PRInt32 aDefault, PRInt32& aResult)
|
1998-05-01 21:55:36 +00:00
|
|
|
{
|
1998-05-21 23:43:18 +00:00
|
|
|
if (aValue.GetUnit() == eHTMLUnit_Pixel)
|
1998-05-01 21:55:36 +00:00
|
|
|
aResult = aValue.GetPixelValue();
|
|
|
|
else if (aValue.GetUnit() == eHTMLUnit_Empty)
|
|
|
|
aResult = aDefault;
|
|
|
|
else
|
1998-05-21 23:43:18 +00:00
|
|
|
{
|
|
|
|
NS_ERROR("Unit must be pixel or empty");
|
1998-05-01 21:55:36 +00:00
|
|
|
return PR_FALSE;
|
1998-05-21 23:43:18 +00:00
|
|
|
}
|
1998-05-01 21:55:36 +00:00
|
|
|
return PR_TRUE;
|
|
|
|
}
|
1998-05-01 20:44:55 +00:00
|
|
|
|
1999-10-20 14:18:56 +00:00
|
|
|
void nsTableCellFrame::MapBorderPadding(nsIPresContext* aPresContext)
|
1998-05-01 20:44:55 +00:00
|
|
|
{
|
1999-10-20 14:18:56 +00:00
|
|
|
// Check to see if the table has cell padding or defined for the table. If true,
|
|
|
|
// then this setting overrides any specific border or padding information in the
|
|
|
|
// cell. If these attributes are not defined, the the cells attributes are used
|
1998-05-01 20:44:55 +00:00
|
|
|
|
1998-09-24 16:37:22 +00:00
|
|
|
nsTableFrame* tableFrame;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
1998-11-20 01:01:25 +00:00
|
|
|
NS_ASSERTION(tableFrame,"Table must not be null");
|
1998-06-11 15:46:37 +00:00
|
|
|
if (!tableFrame)
|
1998-05-01 20:44:55 +00:00
|
|
|
return;
|
|
|
|
|
1998-06-11 15:46:37 +00:00
|
|
|
// get the table frame style context, and from it get cellpadding, cellspacing, and border info
|
1998-11-11 19:56:02 +00:00
|
|
|
const nsStyleTable* tableStyle;
|
|
|
|
tableFrame->GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle);
|
1998-12-02 16:45:20 +00:00
|
|
|
const nsStyleSpacing* tableSpacingStyle;
|
|
|
|
tableFrame->GetStyleData(eStyleStruct_Spacing,(const nsStyleStruct *&)tableSpacingStyle);
|
1998-06-05 06:09:09 +00:00
|
|
|
nsStyleSpacing* spacingData = (nsStyleSpacing*)mStyleContext->GetMutableStyleData(eStyleStruct_Spacing);
|
1998-05-12 22:28:01 +00:00
|
|
|
|
1999-05-18 05:18:16 +00:00
|
|
|
float p2t;
|
|
|
|
aPresContext->GetPixelsToTwips(&p2t);
|
|
|
|
|
|
|
|
// Get the table's cellpadding or use 2 pixels as the default if it is not set.
|
|
|
|
// This assumes that ua.css does not set padding for the cell.
|
|
|
|
nscoord defaultPadding = tableFrame->GetCellPadding();
|
|
|
|
if (-1 == defaultPadding) { // not set in table
|
|
|
|
defaultPadding = NSIntPixelsToTwips(1, p2t);
|
|
|
|
}
|
|
|
|
|
|
|
|
// if the padding is not already set, set it to the table's cellpadding
|
1999-08-24 12:01:31 +00:00
|
|
|
if (eStyleUnit_Null == spacingData->mPadding.GetTopUnit())
|
1999-05-18 05:18:16 +00:00
|
|
|
spacingData->mPadding.SetTop(defaultPadding);
|
1999-08-24 12:01:31 +00:00
|
|
|
if (eStyleUnit_Null == spacingData->mPadding.GetRightUnit())
|
1999-05-18 05:18:16 +00:00
|
|
|
spacingData->mPadding.SetRight(defaultPadding);
|
1999-08-24 12:01:31 +00:00
|
|
|
if (eStyleUnit_Null == spacingData->mPadding.GetBottomUnit())
|
1999-05-18 05:18:16 +00:00
|
|
|
spacingData->mPadding.SetBottom(defaultPadding);
|
1999-08-24 12:01:31 +00:00
|
|
|
if (eStyleUnit_Null == spacingData->mPadding.GetLeftUnit())
|
1999-05-18 05:18:16 +00:00
|
|
|
spacingData->mPadding.SetLeft(defaultPadding);
|
1998-05-01 21:55:36 +00:00
|
|
|
|
1999-09-02 00:07:14 +00:00
|
|
|
MapHTMLBorderStyle(aPresContext, *spacingData, tableFrame);
|
1998-11-20 01:01:25 +00:00
|
|
|
|
1999-01-03 19:22:40 +00:00
|
|
|
MapVAlignAttribute(aPresContext, tableFrame);
|
|
|
|
MapHAlignAttribute(aPresContext, tableFrame);
|
1998-06-23 23:23:21 +00:00
|
|
|
|
1998-05-01 20:44:55 +00:00
|
|
|
}
|
|
|
|
|
1999-01-03 19:22:40 +00:00
|
|
|
/* XXX: this code will not work properly until the style and layout code has been updated
|
|
|
|
* as outlined in Bugzilla bug report 1802 and 915 */
|
|
|
|
void nsTableCellFrame::MapVAlignAttribute(nsIPresContext* aPresContext, nsTableFrame *aTableFrame)
|
|
|
|
{
|
|
|
|
const nsStyleText* textStyle;
|
|
|
|
GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)textStyle);
|
|
|
|
// check if valign is set on the cell
|
2000-02-16 01:08:54 +00:00
|
|
|
// this condition will also be true if we inherited valign from the row or rowgroup
|
|
|
|
if (textStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) {
|
1999-01-03 19:22:40 +00:00
|
|
|
return; // valign is already set on this cell
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if valign is set on the cell's COL (or COLGROUP by inheritance)
|
2000-02-16 01:08:54 +00:00
|
|
|
nsTableColFrame* colFrame;
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 colIndex;
|
|
|
|
GetColIndex(colIndex);
|
|
|
|
aTableFrame->GetColumnFrame(colIndex, colFrame);
|
1999-08-10 18:15:46 +00:00
|
|
|
if (colFrame) {
|
|
|
|
const nsStyleText* colTextStyle;
|
|
|
|
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
|
|
|
|
if (colTextStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) {
|
2000-02-16 01:08:54 +00:00
|
|
|
nsStyleText* cellTextStyle = (nsStyleText*)mStyleContext->GetMutableStyleData(eStyleStruct_Text);
|
|
|
|
cellTextStyle->mVerticalAlign.SetIntValue(colTextStyle->mVerticalAlign.GetIntValue(), eStyleUnit_Enumerated);
|
1999-08-10 18:15:46 +00:00
|
|
|
return; // valign set from COL info
|
2000-02-16 01:08:54 +00:00
|
|
|
}
|
1999-01-03 19:22:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// otherwise, set the vertical align attribute to the HTML default
|
2000-02-16 01:08:54 +00:00
|
|
|
nsStyleText* cellTextStyle = (nsStyleText*)mStyleContext->GetMutableStyleData(eStyleStruct_Text);
|
|
|
|
cellTextStyle->mVerticalAlign.SetIntValue(NS_STYLE_VERTICAL_ALIGN_MIDDLE, eStyleUnit_Enumerated);
|
1999-01-03 19:22:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* XXX: this code will not work properly until the style and layout code has been updated
|
|
|
|
* as outlined in Bugzilla bug report 1802 and 915.
|
|
|
|
* In particular, mTextAlign has to be an nsStyleCoord, not just an int */
|
2000-02-16 01:08:54 +00:00
|
|
|
void nsTableCellFrame::MapHAlignAttribute(nsIPresContext* aPresContext,
|
|
|
|
nsTableFrame* aTableFrame)
|
1999-01-03 19:22:40 +00:00
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
const nsStyleText* textStyle;
|
|
|
|
GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)textStyle);
|
|
|
|
// check if halign is set on the cell
|
2000-02-16 01:08:54 +00:00
|
|
|
// cells do not inherited halign from the row or rowgroup
|
|
|
|
if (NS_STYLE_TEXT_ALIGN_DEFAULT != textStyle->mTextAlign) {
|
|
|
|
return; // text align is already set on this cell
|
1999-01-03 19:22:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// check if halign is set on the cell's ROW (or ROWGROUP by inheritance)
|
2000-02-16 01:08:54 +00:00
|
|
|
nsIFrame* rowFrame;
|
|
|
|
GetParent(&rowFrame);
|
1999-01-03 19:22:40 +00:00
|
|
|
const nsStyleText* rowTextStyle;
|
|
|
|
rowFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)rowTextStyle);
|
2000-02-16 01:08:54 +00:00
|
|
|
if (NS_STYLE_TEXT_ALIGN_DEFAULT != rowTextStyle->mTextAlign) {
|
|
|
|
nsStyleText* cellTextStyle = (nsStyleText*)mStyleContext->GetMutableStyleData(eStyleStruct_Text);
|
|
|
|
cellTextStyle->mTextAlign = rowTextStyle->mTextAlign;
|
1999-01-03 19:22:40 +00:00
|
|
|
return; // halign set from ROW info
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if halign is set on the cell's COL (or COLGROUP by inheritance)
|
2000-02-16 01:08:54 +00:00
|
|
|
nsTableColFrame* colFrame;
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 colIndex;
|
|
|
|
GetColIndex(colIndex);
|
|
|
|
aTableFrame->GetColumnFrame(colIndex, colFrame);
|
1999-08-10 18:15:46 +00:00
|
|
|
if (colFrame) {
|
|
|
|
const nsStyleText* colTextStyle;
|
|
|
|
colFrame->GetStyleData(eStyleStruct_Text,(const nsStyleStruct *&)colTextStyle);
|
2000-02-16 01:08:54 +00:00
|
|
|
if (NS_STYLE_TEXT_ALIGN_DEFAULT != colTextStyle->mTextAlign) {
|
|
|
|
nsStyleText* cellTextStyle = (nsStyleText*)mStyleContext->GetMutableStyleData(eStyleStruct_Text);
|
|
|
|
cellTextStyle->mTextAlign = colTextStyle->mTextAlign;
|
1999-08-10 18:15:46 +00:00
|
|
|
return; // halign set from COL info
|
2000-02-16 01:08:54 +00:00
|
|
|
}
|
1999-01-03 19:22:40 +00:00
|
|
|
}
|
|
|
|
|
2000-02-16 01:08:54 +00:00
|
|
|
// otherwise, set the text align to the HTML default (center for TH, left for TD)
|
|
|
|
nsStyleText* cellTextStyle = (nsStyleText*)mStyleContext->GetMutableStyleData(eStyleStruct_Text);
|
|
|
|
nsIAtom* tag;
|
|
|
|
if (mContent) {
|
1999-01-03 19:22:40 +00:00
|
|
|
mContent->GetTag(tag);
|
2000-02-16 01:08:54 +00:00
|
|
|
if (tag) {
|
|
|
|
cellTextStyle->mTextAlign = (nsHTMLAtoms::th == tag)
|
|
|
|
? NS_STYLE_TEXT_ALIGN_CENTER
|
|
|
|
: NS_STYLE_TEXT_ALIGN_LEFT;
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(tag);
|
|
|
|
}
|
1999-01-03 19:22:40 +00:00
|
|
|
#endif
|
|
|
|
}
|
1998-05-01 20:44:55 +00:00
|
|
|
|
|
|
|
// Subclass hook for style post processing
|
|
|
|
NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
#ifdef NOISY_STYLE
|
|
|
|
printf("nsTableCellFrame::DidSetStyleContext \n");
|
|
|
|
#endif
|
|
|
|
|
1999-10-20 14:18:56 +00:00
|
|
|
MapBorderPadding(aPresContext);
|
1998-05-12 22:28:01 +00:00
|
|
|
mStyleContext->RecalcAutomaticData(aPresContext);
|
1998-05-01 20:44:55 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
/* ----- global methods ----- */
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-08-01 18:26:45 +00:00
|
|
|
NS_IMPL_ADDREF_INHERITED(nsTableCellFrame, nsHTMLContainerFrame)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(nsTableCellFrame, nsHTMLContainerFrame)
|
1999-07-31 22:11:50 +00:00
|
|
|
|
1999-08-01 18:26:45 +00:00
|
|
|
nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
if (NULL == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
2000-02-02 22:24:56 +00:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsITableCellLayout))) {
|
1999-08-04 02:04:45 +00:00
|
|
|
*aInstancePtr = (void*) (nsITableCellLayout *)this;
|
1999-08-01 18:26:45 +00:00
|
|
|
return NS_OK;
|
|
|
|
} else {
|
|
|
|
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
}
|
1999-07-31 22:11:50 +00:00
|
|
|
|
1999-08-04 02:04:45 +00:00
|
|
|
/* This is primarily for editor access via nsITableLayout */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex)
|
|
|
|
{
|
|
|
|
nsresult res = GetRowIndex(aRowIndex);
|
|
|
|
if (NS_FAILED(res))
|
|
|
|
{
|
|
|
|
aColIndex = 0;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
aColIndex = mColIndex;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-03-23 04:24:58 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetPreviousCellInColumn(nsITableCellLayout **aCellLayout)
|
|
|
|
{
|
|
|
|
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
|
|
|
|
*aCellLayout = nsnull;
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsnull;
|
|
|
|
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
if (!tableFrame) return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
// Get current cell location
|
|
|
|
PRInt32 rowIndex, colIndex;
|
|
|
|
GetCellIndexes(rowIndex, colIndex);
|
|
|
|
if (colIndex > 0)
|
|
|
|
{
|
|
|
|
// Get the cellframe at previous colIndex
|
|
|
|
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex-1);
|
|
|
|
if (cellFrame)
|
|
|
|
cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)aCellLayout);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetNextCellInColumn(nsITableCellLayout **aCellLayout)
|
|
|
|
{
|
|
|
|
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
|
|
|
|
*aCellLayout = nsnull;
|
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsnull;
|
|
|
|
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
if (!tableFrame) return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
// Get current cell location
|
|
|
|
PRInt32 rowIndex, colIndex;
|
|
|
|
GetCellIndexes(rowIndex, colIndex);
|
|
|
|
|
|
|
|
// Get the cellframe at next colIndex
|
|
|
|
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex+1);
|
|
|
|
if (cellFrame)
|
|
|
|
cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)aCellLayout);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
nsresult
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-05-11 22:03:29 +00:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-04 23:49:50 +00:00
|
|
|
nsTableCellFrame* it = new (aPresShell) nsTableCellFrame;
|
1998-04-13 20:24:54 +00:00
|
|
|
if (nsnull == it) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1999-05-11 22:03:29 +00:00
|
|
|
*aNewFrame = it;
|
1998-04-13 20:24:54 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-05-21 23:43:18 +00:00
|
|
|
|
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
|
|
|
|
/* ----- methods from CellLayoutData ----- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Given an Edge, find the opposing edge (top<-->bottom, left<-->right)
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
PRUint8 nsTableCellFrame::GetOpposingEdge(PRUint8 aEdge)
|
|
|
|
{
|
|
|
|
PRUint8 result;
|
|
|
|
|
|
|
|
switch (aEdge)
|
|
|
|
{
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
result = NS_SIDE_RIGHT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
result = NS_SIDE_LEFT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
result = NS_SIDE_BOTTOM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
result = NS_SIDE_TOP;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
result = NS_SIDE_TOP;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-02-12 01:55:40 +00:00
|
|
|
void
|
|
|
|
nsTableCellFrame::GetCellBorder(nsMargin& aBorder,
|
|
|
|
nsTableFrame* aTableFrame)
|
1998-12-23 15:47:43 +00:00
|
|
|
{
|
|
|
|
aBorder.left = aBorder.right = aBorder.top = aBorder.bottom = 0;
|
1999-03-14 17:36:10 +00:00
|
|
|
if (nsnull==aTableFrame) {
|
1998-12-23 15:47:43 +00:00
|
|
|
return;
|
1999-03-14 17:36:10 +00:00
|
|
|
}
|
1998-07-11 00:00:31 +00:00
|
|
|
|
1999-03-14 17:36:10 +00:00
|
|
|
if (NS_STYLE_BORDER_COLLAPSE==aTableFrame->GetBorderCollapseStyle()) {
|
1999-10-17 03:30:11 +00:00
|
|
|
NS_PRECONDITION(mBorderEdges, "haven't allocated border edges struct");
|
|
|
|
aBorder = mBorderEdges->mMaxBorderWidth;
|
1999-03-14 17:36:10 +00:00
|
|
|
} else {
|
1998-12-23 15:47:43 +00:00
|
|
|
const nsStyleSpacing* spacing;
|
1999-03-14 17:36:10 +00:00
|
|
|
GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);
|
1998-12-23 15:47:43 +00:00
|
|
|
spacing->GetBorder(aBorder);
|
|
|
|
}
|
|
|
|
}
|
1998-07-11 00:00:31 +00:00
|
|
|
|
1999-02-24 05:54:31 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetFrameType(nsIAtom** aType) const
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(nsnull != aType, "null OUT parameter pointer");
|
|
|
|
*aType = nsLayoutAtoms::tableCellFrame;
|
|
|
|
NS_ADDREF(*aType);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
1998-11-19 17:22:29 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::GetFrameName(nsString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName("TableCell", aResult);
|
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1999-02-11 06:22:33 +00:00
|
|
|
|
1999-10-22 02:06:22 +00:00
|
|
|
// Destructor function for the collapse offset frame property
|
|
|
|
static void
|
|
|
|
DestroyPointFunc(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
void* aPropertyValue)
|
1999-02-11 06:22:33 +00:00
|
|
|
{
|
1999-10-22 02:06:22 +00:00
|
|
|
delete (nsPoint*)aPropertyValue;
|
1999-02-11 06:22:33 +00:00
|
|
|
}
|
|
|
|
|
1999-10-22 02:06:22 +00:00
|
|
|
static nsPoint*
|
|
|
|
GetCollapseOffsetProperty(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
PRBool aCreateIfNecessary = PR_FALSE)
|
1999-02-11 06:22:33 +00:00
|
|
|
{
|
1999-10-22 02:06:22 +00:00
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
|
|
|
|
|
|
|
if (presShell) {
|
|
|
|
nsCOMPtr<nsIFrameManager> frameManager;
|
|
|
|
presShell->GetFrameManager(getter_AddRefs(frameManager));
|
|
|
|
|
|
|
|
if (frameManager) {
|
|
|
|
void* value;
|
|
|
|
|
|
|
|
frameManager->GetFrameProperty(aFrame, nsLayoutAtoms::collapseOffsetProperty,
|
|
|
|
0, &value);
|
|
|
|
if (value) {
|
|
|
|
return (nsPoint*)value; // the property already exists
|
|
|
|
|
|
|
|
} else if (aCreateIfNecessary) {
|
|
|
|
// The property isn't set yet, so allocate a new point, set the property,
|
|
|
|
// and return the newly allocated point
|
|
|
|
nsPoint* offset = new nsPoint(0, 0);
|
|
|
|
|
|
|
|
frameManager->SetFrameProperty(aFrame, nsLayoutAtoms::collapseOffsetProperty,
|
|
|
|
offset, DestroyPointFunc);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsTableCellFrame::SetCollapseOffsetX(nsIPresContext* aPresContext,
|
|
|
|
nscoord aXOffset)
|
|
|
|
{
|
|
|
|
// Get the frame property (creating a point struct if necessary)
|
|
|
|
nsPoint* offset = ::GetCollapseOffsetProperty(aPresContext, this, PR_TRUE);
|
|
|
|
|
|
|
|
if (offset) {
|
|
|
|
offset->x = aXOffset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsTableCellFrame::SetCollapseOffsetY(nsIPresContext* aPresContext,
|
|
|
|
nscoord aYOffset)
|
|
|
|
{
|
|
|
|
// Get the property (creating a point struct if necessary)
|
|
|
|
nsPoint* offset = ::GetCollapseOffsetProperty(aPresContext, this, PR_TRUE);
|
|
|
|
|
|
|
|
if (offset) {
|
|
|
|
offset->y = aYOffset;
|
|
|
|
}
|
1999-02-11 06:22:33 +00:00
|
|
|
}
|
|
|
|
|
1999-10-22 02:06:22 +00:00
|
|
|
void nsTableCellFrame::GetCollapseOffset(nsIPresContext* aPresContext,
|
|
|
|
nsPoint& aOffset)
|
1999-02-11 06:22:33 +00:00
|
|
|
{
|
1999-10-22 02:06:22 +00:00
|
|
|
// See if the property is set
|
|
|
|
nsPoint* offset = ::GetCollapseOffsetProperty(aPresContext, this);
|
|
|
|
|
|
|
|
if (offset) {
|
|
|
|
aOffset = *offset;
|
|
|
|
} else {
|
|
|
|
aOffset.MoveTo(0, 0);
|
|
|
|
}
|
1999-02-11 06:22:33 +00:00
|
|
|
}
|
|
|
|
|
1999-09-01 01:02:16 +00:00
|
|
|
#ifdef DEBUG
|
1999-08-31 03:09:40 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
|
|
|
|
{
|
1999-09-01 01:02:16 +00:00
|
|
|
if (!aResult) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
1999-08-31 03:09:40 +00:00
|
|
|
}
|
1999-09-01 01:02:16 +00:00
|
|
|
PRUint32 sum = sizeof(*this);
|
|
|
|
*aResult = sum;
|
|
|
|
return NS_OK;
|
1999-08-31 03:09:40 +00:00
|
|
|
}
|
1999-09-01 01:02:16 +00:00
|
|
|
#endif
|