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__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-04-18 01:56:01 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nscore.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2012-08-08 17:05:17 +04:00
|
|
|
#include "nsCellMap.h"
|
2011-09-12 20:08:07 +04:00
|
|
|
#include "nsTableFrame.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
2014-05-28 23:36:58 +04:00
|
|
|
* Primary frame for a table element,
|
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
|
|
|
*/
|
2012-08-08 17:05:17 +04:00
|
|
|
class nsTableOuterFrame : public nsContainerFrame
|
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
|
|
|
|
2012-08-08 17:05:17 +04:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsTableOuterFrame)
|
|
|
|
|
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
|
|
|
*/
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsTableOuterFrame* 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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual const nsFrameList& GetChildList(ChildListID aListID) const override;
|
|
|
|
virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
|
2000-01-28 05:19:45 +03:00
|
|
|
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aChildList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void AppendFrames(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void InsertFrames(ChildListID aListID,
|
2014-05-28 23:36:58 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aFrameList) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void RemoveFrame(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aOldFrame) override;
|
1999-08-10 07:52:15 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
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
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
void BuildDisplayListForInnerTable(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2000-03-22 05:43:08 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
|
2007-01-23 07:06:56 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
2014-08-24 18:34:51 +04:00
|
|
|
|
|
|
|
virtual mozilla::LogicalSize
|
|
|
|
ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|
|
|
mozilla::WritingMode aWritingMode,
|
|
|
|
const mozilla::LogicalSize& aCBSize,
|
|
|
|
nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aShrinkWrap) override;
|
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 */
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
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
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* GetType() const override;
|
1999-02-24 08:54:31 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1999-08-31 07:09:40 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsStyleContext* GetParentStyleContext(nsIFrame** aProviderFrame) const override;
|
2000-09-13 02:48:35 +04:00
|
|
|
|
2012-08-08 17:05:17 +04:00
|
|
|
/**
|
|
|
|
* Return the content for the cell at the given row and column.
|
|
|
|
*/
|
|
|
|
nsIContent* GetCellAt(uint32_t aRowIdx, uint32_t aColIdx) const;
|
1999-08-01 20:20:14 +04:00
|
|
|
|
2012-08-08 17:05:17 +04:00
|
|
|
/**
|
|
|
|
* Return the number of rows in the table.
|
|
|
|
*/
|
|
|
|
int32_t GetRowCount() const
|
|
|
|
{
|
|
|
|
return InnerTableFrame()->GetRowCount();
|
|
|
|
}
|
1999-08-01 02:11:50 +04:00
|
|
|
|
2012-08-08 17:05:17 +04:00
|
|
|
/**
|
|
|
|
* Return the number of columns in the table.
|
|
|
|
*/
|
|
|
|
int32_t GetColCount() const
|
|
|
|
{
|
|
|
|
return InnerTableFrame()->GetColCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the index of the cell at the given row and column.
|
|
|
|
*/
|
|
|
|
int32_t GetIndexByRowAndColumn(int32_t aRowIdx, int32_t aColIdx) const
|
|
|
|
{
|
|
|
|
nsTableCellMap* cellMap = InnerTableFrame()->GetCellMap();
|
|
|
|
if (!cellMap)
|
|
|
|
return -1;
|
1999-08-01 02:11:50 +04:00
|
|
|
|
2012-08-08 17:05:17 +04:00
|
|
|
return cellMap->GetIndexByRowAndColumn(aRowIdx, aColIdx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the row and column indices for the cell at the given index.
|
|
|
|
*/
|
|
|
|
void GetRowAndColumnByIndex(int32_t aCellIdx, int32_t* aRowIdx,
|
|
|
|
int32_t* aColIdx) const
|
|
|
|
{
|
|
|
|
*aRowIdx = *aColIdx = 0;
|
|
|
|
nsTableCellMap* cellMap = InnerTableFrame()->GetCellMap();
|
|
|
|
if (cellMap) {
|
|
|
|
cellMap->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* return the frame for the cell at the given row and column.
|
|
|
|
*/
|
|
|
|
nsTableCellFrame* GetCellFrameAt(uint32_t aRowIdx, uint32_t aColIdx) const
|
|
|
|
{
|
|
|
|
nsTableCellMap* map = InnerTableFrame()->GetCellMap();
|
|
|
|
if (!map) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return map->GetCellInfoAt(aRowIdx, aColIdx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the col span of the cell at the given row and column indices.
|
|
|
|
*/
|
|
|
|
uint32_t GetEffectiveColSpanAt(uint32_t aRowIdx, uint32_t aColIdx) const
|
|
|
|
{
|
|
|
|
nsTableCellMap* map = InnerTableFrame()->GetCellMap();
|
|
|
|
return map->GetEffectiveColSpan(aRowIdx, aColIdx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the effective row span of the cell at the given row and column.
|
|
|
|
*/
|
|
|
|
uint32_t GetEffectiveRowSpanAt(uint32_t aRowIdx, uint32_t aColIdx) const
|
|
|
|
{
|
|
|
|
nsTableCellMap* map = InnerTableFrame()->GetCellMap();
|
|
|
|
return map->GetEffectiveRowSpan(aRowIdx, aColIdx);
|
|
|
|
}
|
2008-02-07 10:03:26 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit 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);
|
|
|
|
|
2015-09-16 00:02:30 +03:00
|
|
|
// Get a NS_STYLE_CAPTION_SIDE_* value, or NO_SIDE if no caption is present.
|
|
|
|
// (Remember that caption-side values are interpreted logically, despite
|
|
|
|
// having "physical" names.)
|
|
|
|
uint8_t GetCaptionSide();
|
|
|
|
|
|
|
|
bool HasSideCaption() {
|
|
|
|
uint8_t captionSide = GetCaptionSide();
|
|
|
|
return captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
|
|
|
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT;
|
2008-02-27 05:02:20 +03:00
|
|
|
}
|
2002-11-08 08:29:34 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetCaptionVerticalAlign();
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2015-07-03 13:37:33 +03:00
|
|
|
void SetDesiredSize(uint8_t aCaptionSide,
|
|
|
|
const mozilla::LogicalSize& aInnerSize,
|
|
|
|
const mozilla::LogicalSize& aCaptionSize,
|
|
|
|
const mozilla::LogicalMargin& aInnerMargin,
|
|
|
|
const mozilla::LogicalMargin& aCaptionMargin,
|
|
|
|
nscoord& aISize,
|
|
|
|
nscoord& aBSize,
|
|
|
|
mozilla::WritingMode aWM);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetCaptionOrigin(uint32_t aCaptionSide,
|
2015-07-03 13:37:33 +03:00
|
|
|
const mozilla::LogicalSize& aContainBlockSize,
|
|
|
|
const mozilla::LogicalSize& aInnerSize,
|
|
|
|
const mozilla::LogicalMargin& aInnerMargin,
|
|
|
|
const mozilla::LogicalSize& aCaptionSize,
|
|
|
|
mozilla::LogicalMargin& aCaptionMargin,
|
|
|
|
mozilla::LogicalPoint& aOrigin,
|
|
|
|
mozilla::WritingMode aWM);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetInnerOrigin(uint32_t aCaptionSide,
|
2015-07-03 13:37:33 +03:00
|
|
|
const mozilla::LogicalSize& aContainBlockSize,
|
|
|
|
const mozilla::LogicalSize& aCaptionSize,
|
|
|
|
const mozilla::LogicalMargin& aCaptionMargin,
|
|
|
|
const mozilla::LogicalSize& aInnerSize,
|
|
|
|
mozilla::LogicalMargin& aInnerMargin,
|
|
|
|
mozilla::LogicalPoint& aOrigin,
|
|
|
|
mozilla::WritingMode aWM);
|
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)
|
2015-04-18 01:56:01 +03:00
|
|
|
void OuterBeginReflowChild(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
const nsHTMLReflowState& aOuterRS,
|
|
|
|
mozilla::Maybe<nsHTMLReflowState>& aChildRS,
|
|
|
|
nscoord aAvailISize);
|
2008-02-27 05:01:33 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
void 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
|
|
|
|
2015-07-03 13:37:33 +03:00
|
|
|
// Set the overflow areas in our reflow metrics
|
|
|
|
void UpdateOverflowAreas(nsHTMLReflowMetrics& aMet);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2015-07-03 13:37:33 +03:00
|
|
|
// Get the margin.
|
2009-12-23 05:59:29 +03:00
|
|
|
void GetChildMargin(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aOuterRS,
|
|
|
|
nsIFrame* aChildFrame,
|
|
|
|
nscoord aAvailableWidth,
|
2014-07-24 12:28:46 +04:00
|
|
|
mozilla::LogicalMargin& aMargin);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2013-03-15 22:36:30 +04:00
|
|
|
{
|
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
|
|
|
(~eCanContainOverflowContainers));
|
|
|
|
}
|
|
|
|
|
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-15 02:12:06 +04:00
|
|
|
#endif
|