2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsTableOuterFrame_h__
|
|
|
|
#define nsTableOuterFrame_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2000-01-28 05:19:45 +03:00
|
|
|
#include "nsBlockFrame.h"
|
1999-08-01 02:11:50 +04:00
|
|
|
#include "nsITableLayout.h"
|
2011-09-12 20:08:07 +04:00
|
|
|
#include "nsTableFrame.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2000-01-28 05:19:45 +03:00
|
|
|
class nsTableCaptionFrame : public nsBlockFrame
|
|
|
|
{
|
2000-03-02 09:09:37 +03:00
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2000-01-28 05:19:45 +03:00
|
|
|
// nsISupports
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
2006-03-27 01:30:36 +04:00
|
|
|
friend nsIFrame* NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2000-03-02 09:09:37 +03:00
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
2011-09-29 10:19:26 +04:00
|
|
|
nsSize aPadding, bool aShrinkWrap);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
2012-02-15 13:28:21 +04:00
|
|
|
virtual nsIFrame* GetParentStyleContextFrame() const;
|
2011-09-12 20:08:07 +04:00
|
|
|
|
2007-07-05 19:39:29 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2010-06-28 16:02:03 +04:00
|
|
|
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
2007-07-05 19:39:29 +04:00
|
|
|
#endif
|
|
|
|
|
2006-07-20 12:50:26 +04:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
2000-03-02 09:09:37 +03:00
|
|
|
protected:
|
2006-03-27 01:30:36 +04:00
|
|
|
nsTableCaptionFrame(nsStyleContext* aContext);
|
2000-03-02 09:09:37 +03:00
|
|
|
virtual ~nsTableCaptionFrame();
|
2000-01-28 05:19:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-01-15 22:55:19 +03:00
|
|
|
/* TODO
|
|
|
|
1. decide if we'll allow subclassing. If so, decide which methods really need to be virtual.
|
|
|
|
*/
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
1998-04-15 01:45:28 +04:00
|
|
|
* main frame for an nsTable content object,
|
1998-07-08 08:49:01 +04:00
|
|
|
* the nsTableOuterFrame contains 0 or one caption frame, and a nsTableFrame
|
2004-12-20 00:45:51 +03:00
|
|
|
* pseudo-frame (referred to as the "inner frame').
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2011-12-28 00:18:48 +04:00
|
|
|
class nsTableOuterFrame : public nsContainerFrame, public nsITableLayout
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
public:
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1999-08-01 02:11:50 +04:00
|
|
|
|
2005-11-04 05:38:33 +03:00
|
|
|
/** instantiate a new instance of nsTableRowFrame.
|
|
|
|
* @param aPresShell the pres shell for this frame
|
1998-04-15 01:45:28 +04:00
|
|
|
*
|
2005-11-04 05:38:33 +03:00
|
|
|
* @return the frame that was created
|
1998-04-15 01:45:28 +04:00
|
|
|
*/
|
2006-03-27 01:30:36 +04:00
|
|
|
friend nsIFrame* NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2002-11-08 08:29:34 +03:00
|
|
|
|
|
|
|
// nsIFrame overrides - see there for a description
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2009-12-24 08:21:15 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 16:53:20 +04:00
|
|
|
nsFrameList& aChildList);
|
2002-11-08 08:29:34 +03:00
|
|
|
|
2012-03-08 05:57:37 +04:00
|
|
|
virtual const nsFrameList& GetChildList(ChildListID aListID) const;
|
2011-08-25 00:54:30 +04:00
|
|
|
virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
|
2000-01-28 05:19:45 +03:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
2002-11-08 08:29:34 +03:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
1999-08-10 07:52:15 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 21:23:32 +04:00
|
|
|
nsFrameList& aFrameList);
|
2002-11-08 08:29:34 +03:00
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
1999-08-10 07:52:15 +04:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2004-07-18 16:02:53 +04:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
2011-08-25 00:54:30 +04:00
|
|
|
return GetFirstPrincipalChild()->GetContentInsertionFrame();
|
2004-07-18 16:02:53 +04:00
|
|
|
}
|
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2010-06-28 16:02:03 +04:00
|
|
|
virtual already_AddRefed<nsAccessible> CreateAccessible();
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
|
|
|
nsresult BuildDisplayListForInnerTable(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2000-03-22 05:43:08 +03:00
|
|
|
|
2007-01-23 07:06:56 +03:00
|
|
|
virtual nscoord GetBaseline() const;
|
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
2011-09-29 10:19:26 +04:00
|
|
|
nsSize aPadding, bool aShrinkWrap);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
1999-01-15 22:55:19 +03:00
|
|
|
/** process a reflow command for the table.
|
|
|
|
* This involves reflowing the caption and the inner table.
|
|
|
|
* @see nsIFrame::Reflow */
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-02-24 08:54:31 +03:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::tableOuterFrame
|
1999-02-24 08:54:31 +03:00
|
|
|
*/
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
1999-02-24 08:54:31 +03:00
|
|
|
|
1999-09-01 05:02:16 +04:00
|
|
|
#ifdef DEBUG
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1999-08-31 07:09:40 +04:00
|
|
|
|
2012-02-15 13:28:21 +04:00
|
|
|
virtual nsIFrame* GetParentStyleContextFrame() const;
|
2000-09-13 02:48:35 +04:00
|
|
|
|
1999-08-01 02:11:50 +04:00
|
|
|
/*---------------- nsITableLayout methods ------------------------*/
|
1999-08-01 20:20:14 +04:00
|
|
|
|
|
|
|
/** @see nsITableFrame::GetCellDataAt */
|
1999-08-01 02:11:50 +04:00
|
|
|
NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
nsIDOMElement* &aCell, //out params
|
|
|
|
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
|
|
|
|
PRInt32& aRowSpan, PRInt32& aColSpan,
|
2000-01-26 17:56:06 +03:00
|
|
|
PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool& aIsSelected);
|
1999-08-01 02:11:50 +04:00
|
|
|
|
1999-08-01 20:20:14 +04:00
|
|
|
/** @see nsITableFrame::GetTableSize */
|
|
|
|
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount);
|
1999-08-01 02:11:50 +04:00
|
|
|
|
2008-02-07 10:03:26 +03:00
|
|
|
NS_IMETHOD GetIndexByRowAndColumn(PRInt32 aRow, PRInt32 aColumn, PRInt32 *aIndex);
|
|
|
|
NS_IMETHOD GetRowAndColumnByIndex(PRInt32 aIndex, PRInt32 *aRow, PRInt32 *aColumn);
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
nsTableOuterFrame(nsStyleContext* aContext);
|
2000-03-02 09:09:37 +03:00
|
|
|
virtual ~nsTableOuterFrame();
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void InitChildReflowState(nsPresContext& aPresContext,
|
2002-02-19 18:48:28 +03:00
|
|
|
nsHTMLReflowState& aReflowState);
|
|
|
|
|
1999-01-15 22:55:19 +03:00
|
|
|
/** Always returns 0, since the outer table frame has no border of its own
|
|
|
|
* The inner table frame can answer this question in a meaningful way.
|
2011-12-28 00:18:48 +04:00
|
|
|
* @see nsContainerFrame::GetSkipSides */
|
1998-10-20 21:45:07 +04:00
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
2008-02-27 05:02:20 +03:00
|
|
|
PRUint8 GetCaptionSide(); // NS_STYLE_CAPTION_SIDE_* or NO_SIDE
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasSideCaption() {
|
2008-02-27 05:02:20 +03:00
|
|
|
PRUint8 captionSide = GetCaptionSide();
|
|
|
|
return captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT;
|
|
|
|
}
|
2002-11-08 08:29:34 +03:00
|
|
|
|
|
|
|
PRUint8 GetCaptionVerticalAlign();
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2004-12-27 18:05:18 +03:00
|
|
|
void SetDesiredSize(PRUint8 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
const nsMargin& aInnerMargin,
|
|
|
|
const nsMargin& aCaptionMargin,
|
|
|
|
nscoord& aWidth,
|
|
|
|
nscoord& aHeight);
|
|
|
|
|
2008-02-27 05:01:33 +03:00
|
|
|
nsresult GetCaptionOrigin(PRUint32 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
const nsSize& aContainBlockSize,
|
|
|
|
const nsSize& aInnerSize,
|
|
|
|
const nsMargin& aInnerMargin,
|
|
|
|
const nsSize& aCaptionSize,
|
|
|
|
nsMargin& aCaptionMargin,
|
|
|
|
nsPoint& aOrigin);
|
|
|
|
|
2008-02-27 05:01:33 +03:00
|
|
|
nsresult GetInnerOrigin(PRUint32 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
const nsSize& aContainBlockSize,
|
|
|
|
const nsSize& aCaptionSize,
|
|
|
|
const nsMargin& aCaptionMargin,
|
|
|
|
const nsSize& aInnerSize,
|
|
|
|
nsMargin& aInnerMargin,
|
|
|
|
nsPoint& aOrigin);
|
2002-11-08 08:29:34 +03:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// reflow the child (caption or innertable frame)
|
2008-02-27 05:01:33 +03:00
|
|
|
void OuterBeginReflowChild(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
const nsHTMLReflowState& aOuterRS,
|
|
|
|
void* aChildRSSpace,
|
|
|
|
nscoord aAvailWidth);
|
|
|
|
|
|
|
|
nsresult OuterDoReflowChild(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
const nsHTMLReflowState& aChildRS,
|
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
nsReflowStatus& aStatus);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
|
|
|
// Set the reflow metrics
|
2004-12-27 18:05:18 +03:00
|
|
|
void UpdateReflowMetrics(PRUint8 aCaptionSide,
|
2000-04-29 01:05:31 +04:00
|
|
|
nsHTMLReflowMetrics& aMet,
|
|
|
|
const nsMargin& aInnerMargin,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
const nsMargin& aCaptionMargin);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
// Get the margin. aMarginNoAuto is aMargin, but with auto
|
2002-11-08 08:29:34 +03:00
|
|
|
// margins set to 0
|
2009-12-23 05:59:29 +03:00
|
|
|
void GetChildMargin(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aOuterRS,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
nscoord aAvailableWidth,
|
|
|
|
nsMargin& aMargin);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2012-02-15 13:28:21 +04:00
|
|
|
nsTableFrame* InnerTableFrame() const {
|
2011-09-12 20:08:07 +04:00
|
|
|
return static_cast<nsTableFrame*>(mFrames.FirstChild());
|
|
|
|
}
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
private:
|
2005-12-03 18:13:08 +03:00
|
|
|
nsFrameList mCaptionFrames;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-10-20 21:45:07 +04:00
|
|
|
inline PRIntn nsTableOuterFrame::GetSkipSides() const
|
|
|
|
{ return 0; }
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-10-15 02:12:06 +04:00
|
|
|
#endif
|