2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifndef nsTableFrame_h__
|
|
|
|
#define nsTableFrame_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsStyleCoord.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsITableLayout.h"
|
|
|
|
#include "nsTableColFrame.h"
|
|
|
|
#include "nsTableColGroupFrame.h"
|
|
|
|
#include "nsCellMap.h"
|
|
|
|
#include "nsGkAtoms.h"
|
2008-04-06 04:34:14 -07:00
|
|
|
#include "nsDisplayList.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsTableCellFrame;
|
|
|
|
class nsTableColFrame;
|
|
|
|
class nsTableRowGroupFrame;
|
|
|
|
class nsTableRowFrame;
|
|
|
|
class nsTableColGroupFrame;
|
|
|
|
class nsITableLayoutStrategy;
|
|
|
|
class nsStyleContext;
|
|
|
|
|
|
|
|
struct nsTableReflowState;
|
|
|
|
struct nsStylePosition;
|
2011-10-27 06:58:44 -07:00
|
|
|
struct BCPropertyData;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static inline bool IS_TABLE_CELL(nsIAtom* frameType) {
|
2007-03-22 10:30:00 -07:00
|
|
|
return nsGkAtoms::tableCellFrame == frameType ||
|
|
|
|
nsGkAtoms::bcTableCellFrame == frameType;
|
|
|
|
}
|
|
|
|
|
2012-08-28 22:39:31 -07:00
|
|
|
static inline bool FrameHasBorderOrBackground(nsIFrame* f) {
|
|
|
|
return (f->GetStyleVisibility()->IsVisible() &&
|
|
|
|
(!f->GetStyleBackground()->IsTransparent() ||
|
|
|
|
f->GetStyleDisplay()->mAppearance ||
|
|
|
|
f->GetStyleBorder()->HasBorder()));
|
|
|
|
}
|
|
|
|
|
2008-04-06 04:34:14 -07:00
|
|
|
class nsDisplayTableItem : public nsDisplayItem
|
|
|
|
{
|
|
|
|
public:
|
2010-08-13 03:01:13 -07:00
|
|
|
nsDisplayTableItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) :
|
|
|
|
nsDisplayItem(aBuilder, aFrame),
|
2011-10-17 07:59:28 -07:00
|
|
|
mPartHasFixedBackground(false) {}
|
2008-04-06 04:34:14 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder,
|
2010-08-13 02:54:37 -07:00
|
|
|
nsIFrame* aFrame);
|
2008-04-06 04:34:14 -07:00
|
|
|
// With collapsed borders, parts of the collapsed border can extend outside
|
|
|
|
// the table part frames, so allow this display element to blow out to our
|
|
|
|
// overflow rect. This is also useful for row frames that have spanning
|
|
|
|
// cells extending outside them.
|
2012-04-10 04:24:18 -07:00
|
|
|
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap);
|
2008-04-06 04:34:14 -07:00
|
|
|
|
|
|
|
void UpdateForFrameBackground(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
private:
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mPartHasFixedBackground;
|
2008-04-06 04:34:14 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsAutoPushCurrentTableItem
|
|
|
|
{
|
|
|
|
public:
|
2012-07-30 07:20:58 -07:00
|
|
|
nsAutoPushCurrentTableItem() : mBuilder(nullptr) {}
|
2008-04-06 04:34:14 -07:00
|
|
|
|
|
|
|
void Push(nsDisplayListBuilder* aBuilder, nsDisplayTableItem* aPushItem)
|
|
|
|
{
|
|
|
|
mBuilder = aBuilder;
|
|
|
|
mOldCurrentItem = aBuilder->GetCurrentTableItem();
|
|
|
|
aBuilder->SetCurrentTableItem(aPushItem);
|
|
|
|
#ifdef DEBUG
|
|
|
|
mPushedItem = aPushItem;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
~nsAutoPushCurrentTableItem() {
|
|
|
|
if (!mBuilder)
|
|
|
|
return;
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_ASSERTION(mBuilder->GetCurrentTableItem() == mPushedItem,
|
|
|
|
"Someone messed with the current table item behind our back!");
|
|
|
|
#endif
|
|
|
|
mBuilder->SetCurrentTableItem(mOldCurrentItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsDisplayListBuilder* mBuilder;
|
|
|
|
nsDisplayTableItem* mOldCurrentItem;
|
|
|
|
#ifdef DEBUG
|
|
|
|
nsDisplayTableItem* mPushedItem;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* ============================================================================ */
|
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
/**
|
|
|
|
* nsTableFrame maps the inner portion of a table (everything except captions.)
|
2007-03-22 10:30:00 -07:00
|
|
|
* Used as a pseudo-frame within nsTableOuterFrame, it may also be used
|
|
|
|
* stand-alone as the top-level frame.
|
|
|
|
*
|
2011-08-24 13:54:30 -07:00
|
|
|
* The principal child list contains row group frames. There is also an
|
|
|
|
* additional child list, kColGroupList, which contains the col group frames.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2011-12-27 12:18:48 -08:00
|
|
|
class nsTableFrame : public nsContainerFrame, public nsITableLayout
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** nsTableOuterFrame has intimate knowledge of the inner table frame */
|
|
|
|
friend class nsTableOuterFrame;
|
|
|
|
|
|
|
|
/** instantiate a new instance of nsTableRowFrame.
|
|
|
|
* @param aPresShell the pres shell for this frame
|
|
|
|
*
|
|
|
|
* @return the frame that was created
|
|
|
|
*/
|
|
|
|
friend nsIFrame* NS_NewTableFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
|
|
|
/** sets defaults for table-specific style.
|
|
|
|
* @see nsIFrame::Init
|
|
|
|
*/
|
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
|
|
|
static float GetTwipsToPixels(nsPresContext* aPresContext);
|
|
|
|
|
2007-06-25 13:34:35 -07:00
|
|
|
// Return true if aParentReflowState.frame or any of its ancestors within
|
|
|
|
// the containing table have non-auto height. (e.g. pct or fixed height)
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool AncestorsHaveStyleHeight(const nsHTMLReflowState& aParentReflowState);
|
2007-06-25 13:34:35 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// See if a special height reflow will occur due to having a pct height when
|
|
|
|
// the pct height basis may not yet be valid.
|
|
|
|
static void CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
|
|
|
|
|
|
|
|
// Notify the frame and its ancestors (up to the containing table) that a special
|
|
|
|
// height reflow will occur.
|
|
|
|
static void RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
|
|
|
|
|
|
|
|
static void RePositionViews(nsIFrame* aFrame);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool PageBreakAfter(nsIFrame* aSourceFrame,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aNextFrame);
|
|
|
|
|
|
|
|
nsPoint GetFirstSectionOrigin(const nsHTMLReflowState& aReflowState) const;
|
|
|
|
/*
|
|
|
|
* Notification that aAttribute has changed for content inside a table (cell, row, etc)
|
|
|
|
*/
|
|
|
|
void AttributeChangedFor(nsIFrame* aFrame,
|
|
|
|
nsIContent* aContent,
|
|
|
|
nsIAtom* aAttribute);
|
|
|
|
|
2009-12-23 21:21:15 -08:00
|
|
|
/** @see nsIFrame::DestroyFrom */
|
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2008-10-18 10:25:26 -07:00
|
|
|
|
|
|
|
/** @see nsIFrame::DidSetStyleContext */
|
2008-10-26 03:11:34 -07:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aPrevFrame,
|
2009-07-30 10:23:32 -07:00
|
|
|
nsFrameList& aFrameList);
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
|
|
|
virtual nsMargin GetUsedBorder() const;
|
|
|
|
virtual nsMargin GetUsedPadding() const;
|
Bug 659828 - Part 1: Apply table margins to the outer table frame instead of the inner table frame (also fixes bug 87277); r=dbaron
Outer table frames act as CSS2.1 table wrapper boxes. We used to lay them out
without taking their margins into the account, which meant that their width was
always equal to the available width. This breaks horizontal positioning of
absolutely positioned kids of a table frame.
The main purpose of this patch is to apply the margins of tables to their outer
frame, instead of the inner frame. This means that the inner table frame will
always have a zero margin, which means that a lot of the stuff which used to
rely on the fact that table margins are applied to the inner frame need to
change.
In particular, in order to get the computed margins of a table, we used to query
the inner table frame, and this patch corrects that. Also, when shrink wrapping
tables, we used to not take the margins of the inner table frame into account,
which is fixed by this patch too. nsBlockReflowState::
ComputeReplacedBlockOffsetsForFloats also needed to be changed to read the
margin values from the outer frame too.
Also, as part of this patch, we start to respect the CSS2.1 margin model for
captions on all sides. This means that in particular, the top/bottom margins on
the top-outside and bottom-outside captions will not be collapsed with the
top/bottom margins of the table, and that the margins of the caption element
contribute to the width and height of the outer table frame. The
427129-table-caption reftest has been modified to match this new behavior.
Another side effect of this bug is fixing bug 87277, and the reftests for that
bug are marked as passing in this patch.
2011-05-31 16:02:56 -07:00
|
|
|
virtual nsMargin GetUsedMargin() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Get the offset from the border box to the area where the row groups fit
|
|
|
|
nsMargin GetChildAreaOffset(const nsHTMLReflowState* aReflowState) const;
|
|
|
|
|
|
|
|
/** helper method to find the table parent of any table frame object */
|
|
|
|
static nsTableFrame* GetTableFrame(nsIFrame* aSourceFrame);
|
|
|
|
|
|
|
|
typedef nsresult (* DisplayGenericTablePartTraversal)
|
|
|
|
(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect, const nsDisplayListSet& aLists);
|
|
|
|
static nsresult GenericTraversal(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect, const nsDisplayListSet& aLists);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method to handle display common to table frames, rowgroup frames
|
|
|
|
* and row frames. It creates a background display item for handling events
|
|
|
|
* if necessary, an outline display item if necessary, and displays
|
|
|
|
* all the the frame's children.
|
2008-04-06 04:34:14 -07:00
|
|
|
* @param aDisplayItem the display item created for this part, or null
|
|
|
|
* if this part's border/background painting is delegated to an ancestor
|
2007-03-22 10:30:00 -07:00
|
|
|
* @param aTraversal a function that gets called to traverse the table
|
|
|
|
* part's child frames and add their display list items to a
|
|
|
|
* display list set.
|
|
|
|
*/
|
|
|
|
static nsresult DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
2008-04-06 04:34:14 -07:00
|
|
|
nsDisplayTableItem* aDisplayItem,
|
2007-03-22 10:30:00 -07:00
|
|
|
DisplayGenericTablePartTraversal aTraversal = GenericTraversal);
|
|
|
|
|
|
|
|
// Return the closest sibling of aPriorChildFrame (including aPriroChildFrame)
|
|
|
|
// of type aChildType.
|
|
|
|
static nsIFrame* GetFrameAtOrBefore(nsIFrame* aParentFrame,
|
|
|
|
nsIFrame* aPriorChildFrame,
|
|
|
|
nsIAtom* aChildType);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsAutoHeight();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
/** @return true if aDisplayType represents a rowgroup of any sort
|
2007-03-22 10:30:00 -07:00
|
|
|
* (header, footer, or body)
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
bool IsRowGroup(int32_t aDisplayType) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** Initialize the table frame with a set of children.
|
|
|
|
* @see nsIFrame::SetInitialChildList
|
|
|
|
*/
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 05:53:20 -07:00
|
|
|
nsFrameList& aChildList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-07 17:57:37 -08:00
|
|
|
virtual const nsFrameList& GetChildList(ChildListID aListID) const;
|
2011-08-24 13:54:30 -07:00
|
|
|
virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Paint the background of the table and its parts (column groups,
|
|
|
|
* columns, row groups, rows, and cells), and the table border, and all
|
|
|
|
* internal borders if border-collapse is on.
|
|
|
|
*/
|
2011-04-07 18:04:40 -07:00
|
|
|
void PaintTableBorderBackground(nsRenderingContext& aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsRect& aDirtyRect,
|
2012-08-22 08:56:38 -07:00
|
|
|
nsPoint aPt, uint32_t aBGPaintFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-02-08 08:46:42 -08:00
|
|
|
/** Get the outer half (i.e., the part outside the height and width of
|
|
|
|
* the table) of the largest segment (?) of border-collapsed border on
|
|
|
|
* the table on each side, or 0 for non border-collapsed tables.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMargin GetOuterBCBorder() const;
|
|
|
|
|
2009-02-08 08:46:42 -08:00
|
|
|
/** Same as above, but only if it's included from the border-box width
|
|
|
|
* of the table.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMargin GetIncludedOuterBCBorder() const;
|
|
|
|
|
2009-02-08 08:46:42 -08:00
|
|
|
/** Same as above, but only if it's excluded from the border-box width
|
|
|
|
* of the table. This is the area that leaks out into the margin
|
|
|
|
* (or potentially past it, if there is no margin).
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMargin GetExcludedOuterBCBorder() const;
|
|
|
|
|
2009-07-21 17:44:52 -07:00
|
|
|
/**
|
|
|
|
* In quirks mode, the size of the table background is reduced
|
|
|
|
* by the outer BC border. Compute the reduction needed.
|
|
|
|
*/
|
|
|
|
nsMargin GetDeflationForBackground(nsPresContext* aPresContext) const;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** Get width of table + colgroup + col collapse: elements that
|
|
|
|
* continue along the length of the whole left side.
|
|
|
|
* see nsTablePainter about continuous borders
|
|
|
|
*/
|
|
|
|
nscoord GetContinuousLeftBCBorderWidth() const;
|
2009-06-21 09:31:40 -07:00
|
|
|
void SetContinuousLeftBCBorderWidth(nscoord aValue);
|
|
|
|
|
2008-10-26 03:11:34 -07:00
|
|
|
friend class nsDelayedCalcBCBorders;
|
|
|
|
|
2012-01-22 14:48:34 -08:00
|
|
|
void AddBCDamageArea(const nsIntRect& aValue);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool BCRecalcNeeded(nsStyleContext* aOldStyleContext,
|
2008-10-26 03:11:34 -07:00
|
|
|
nsStyleContext* aNewStyleContext);
|
2011-04-07 18:04:40 -07:00
|
|
|
void PaintBCBorders(nsRenderingContext& aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsRect& aDirtyRect);
|
|
|
|
|
|
|
|
virtual void MarkIntrinsicWidthsDirty();
|
|
|
|
// For border-collapse tables, the caller must not add padding and
|
|
|
|
// border to the results of these functions.
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual IntrinsicWidthOffsetData
|
2011-04-07 18:04:40 -07:00
|
|
|
IntrinsicWidthOffsets(nsRenderingContext* aRenderingContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsSize aPadding, bool aShrinkWrap);
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* A copy of nsFrame::ShrinkWidthToFit that calls a different
|
|
|
|
* GetPrefWidth, since tables have two different ones.
|
|
|
|
*/
|
2011-04-07 18:04:40 -07:00
|
|
|
nscoord TableShrinkWidthToFit(nsRenderingContext *aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord aWidthInCB);
|
|
|
|
|
|
|
|
// XXXldb REWRITE THIS COMMENT!
|
|
|
|
/** inner tables are reflowed in two steps.
|
|
|
|
* <pre>
|
|
|
|
* if mFirstPassValid is false, this is our first time through since content was last changed
|
|
|
|
* set pass to 1
|
|
|
|
* do pass 1
|
|
|
|
* get min/max info for all cells in an infinite space
|
|
|
|
* do column balancing
|
|
|
|
* set mFirstPassValid to true
|
|
|
|
* do pass 2
|
|
|
|
* use column widths to Reflow cells
|
|
|
|
* </pre>
|
|
|
|
*
|
|
|
|
* @see nsIFrame::Reflow
|
|
|
|
*/
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
nsresult ReflowTable(nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nscoord aAvailHeight,
|
|
|
|
nsIFrame*& aLastChildReflowed,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
nsFrameList& GetColGroups();
|
|
|
|
|
2012-02-15 01:28:21 -08:00
|
|
|
virtual nsIFrame* GetParentStyleContextFrame() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::tableFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
/** @see nsIFrame::GetFrameName */
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** return the width of the column at aColIndex */
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual int32_t GetColumnWidth(int32_t aColIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** helper to get the cell spacing X style value */
|
|
|
|
virtual nscoord GetCellSpacingX();
|
|
|
|
|
|
|
|
/** helper to get the cell spacing Y style value */
|
|
|
|
virtual nscoord GetCellSpacingY();
|
|
|
|
|
|
|
|
virtual nscoord GetBaseline() const;
|
|
|
|
/** return the row span of a cell, taking into account row span magic at the bottom
|
|
|
|
* of a table. The row span equals the number of rows spanned by aCell starting at
|
|
|
|
* aStartRowIndex, and can be smaller if aStartRowIndex is greater than the row
|
|
|
|
* index in which aCell originates.
|
|
|
|
*
|
|
|
|
* @param aStartRowIndex the cell
|
|
|
|
* @param aCell the cell
|
|
|
|
*
|
|
|
|
* @return the row span, correcting for row spans that extend beyond the bottom
|
|
|
|
* of the table.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual int32_t GetEffectiveRowSpan(int32_t aStartRowIndex,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsTableCellFrame& aCell) const;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual int32_t GetEffectiveRowSpan(const nsTableCellFrame& aCell,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsCellMap* aCellMap = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** return the col span of a cell, taking into account col span magic at the edge
|
|
|
|
* of a table.
|
|
|
|
*
|
|
|
|
* @param aCell the cell
|
|
|
|
*
|
|
|
|
* @return the col span, correcting for col spans that extend beyond the edge
|
|
|
|
* of the table.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual int32_t GetEffectiveColSpan(const nsTableCellFrame& aCell,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsCellMap* aCellMap = nullptr) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** indicate whether the row has more than one cell that either originates
|
|
|
|
* or is spanned from the rows above
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
bool HasMoreThanOneCell(int32_t aRowIndex) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** return the column frame associated with aColIndex
|
2012-07-30 07:20:58 -07:00
|
|
|
* returns nullptr if the col frame has not yet been allocated, or if
|
2007-03-22 10:30:00 -07:00
|
|
|
* aColIndex is out of range
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
nsTableColFrame* GetColFrame(int32_t aColIndex) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** Insert a col frame reference into the colframe cache and adapt the cellmap
|
|
|
|
* @param aColFrame - the column frame
|
|
|
|
* @param aColIndex - index where the column should be inserted into the
|
|
|
|
* colframe cache
|
|
|
|
*/
|
|
|
|
void InsertCol(nsTableColFrame& aColFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aColIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsTableColGroupFrame* CreateAnonymousColGroupFrame(nsTableColGroupType aType);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t DestroyAnonymousColFrames(int32_t aNumFrames);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-07-28 05:53:18 -07:00
|
|
|
// Append aNumColsToAdd anonymous col frames of type eColAnonymousCell to our
|
|
|
|
// last eColGroupAnonymousCell colgroup. If we have no such colgroup, then
|
|
|
|
// create one.
|
2012-08-22 08:56:38 -07:00
|
|
|
void AppendAnonymousColFrames(int32_t aNumColsToAdd);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-07-28 05:53:18 -07:00
|
|
|
// Append aNumColsToAdd anonymous col frames of type aColType to
|
|
|
|
// aColGroupFrame. If aAddToTable is true, also call AddColsToTable on the
|
|
|
|
// new cols.
|
|
|
|
void AppendAnonymousColFrames(nsTableColGroupFrame* aColGroupFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aNumColsToAdd,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsTableColType aColType,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aAddToTable);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void MatchCellMapToColCache(nsTableCellMap* aCellMap);
|
|
|
|
/** empty the column frame cache */
|
|
|
|
void ClearColCache();
|
|
|
|
|
|
|
|
void DidResizeColumns();
|
|
|
|
|
|
|
|
virtual void AppendCell(nsTableCellFrame& aCellFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aRowIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-02-05 01:09:50 -08:00
|
|
|
virtual void InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aRowIndex,
|
|
|
|
int32_t aColIndexBefore);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual void RemoveCell(nsTableCellFrame* aCellFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aRowIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-01-16 08:05:46 -08:00
|
|
|
void AppendRows(nsTableRowGroupFrame* aRowGroupFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aRowIndex,
|
2009-02-05 01:09:50 -08:00
|
|
|
nsTArray<nsTableRowFrame*>& aRowFrames);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t InsertRows(nsTableRowGroupFrame* aRowGroupFrame,
|
2009-02-05 01:09:50 -08:00
|
|
|
nsTArray<nsTableRowFrame*>& aFrames,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aRowIndex,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aConsiderSpans);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual void RemoveRows(nsTableRowFrame& aFirstRowFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aNumRowsToRemove,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aConsiderSpans);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** Insert multiple rowgroups into the table cellmap handling
|
2009-07-30 10:23:32 -07:00
|
|
|
* @param aRowGroups - iterator that iterates over the rowgroups to insert
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-07-30 10:23:32 -07:00
|
|
|
void InsertRowGroups(const nsFrameList::Slice& aRowGroups);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void InsertColGroups(int32_t aStartColIndex,
|
2009-07-30 10:23:32 -07:00
|
|
|
const nsFrameList::Slice& aColgroups);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual void RemoveCol(nsTableColGroupFrame* aColGroupFrame,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aColIndex,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aRemoveFromCache,
|
|
|
|
bool aRemoveFromCellMap);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetIndexByRowAndColumn(int32_t aRow, int32_t aColumn, int32_t *aIndex);
|
|
|
|
NS_IMETHOD GetRowAndColumnByIndex(int32_t aIndex, int32_t *aRow, int32_t *aColumn);
|
2008-09-24 10:14:35 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
bool ColumnHasCellSpacingBefore(int32_t aColIndex) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasPctCol() const;
|
|
|
|
void SetHasPctCol(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasCellSpanningPctCol() const;
|
|
|
|
void SetHasCellSpanningPctCol(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-28 22:48:45 -07:00
|
|
|
/**
|
|
|
|
* To be called on a frame by its parent after setting its size/position and
|
|
|
|
* calling DidReflow (possibly via FinishReflowChild()). This can also be
|
|
|
|
* used for child frames which are not being reflowed but did have their size
|
|
|
|
* or position changed.
|
|
|
|
*
|
|
|
|
* @param aFrame The frame to invalidate
|
|
|
|
* @param aOrigRect The original rect of aFrame (before the change).
|
|
|
|
* @param aOrigVisualOverflow The original overflow rect of aFrame.
|
|
|
|
* @param aIsFirstReflow True if the size/position change is due to the
|
|
|
|
* first reflow of aFrame.
|
|
|
|
*/
|
|
|
|
static void InvalidateTableFrame(nsIFrame* aFrame,
|
|
|
|
const nsRect& aOrigRect,
|
|
|
|
const nsRect& aOrigVisualOverflow,
|
|
|
|
bool aIsFirstReflow);
|
|
|
|
|
2011-06-15 14:03:49 -07:00
|
|
|
virtual bool UpdateOverflow();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
|
|
|
/** protected constructor.
|
|
|
|
* @see NewFrame
|
|
|
|
*/
|
|
|
|
nsTableFrame(nsStyleContext* aContext);
|
|
|
|
|
|
|
|
/** destructor, responsible for mColumnLayoutData */
|
|
|
|
virtual ~nsTableFrame();
|
|
|
|
|
|
|
|
void InitChildReflowState(nsHTMLReflowState& aReflowState);
|
|
|
|
|
2011-12-27 12:18:48 -08:00
|
|
|
/** implement abstract method on nsContainerFrame */
|
2012-08-09 00:09:40 -07:00
|
|
|
virtual int GetSkipSides() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsRowInserted() const;
|
|
|
|
void SetRowInserted(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2007-12-04 18:32:56 -08:00
|
|
|
|
|
|
|
// A helper function to reflow a header or footer with unconstrained height
|
|
|
|
// to see if it should be made repeatable and also to determine its desired
|
|
|
|
// height.
|
|
|
|
nsresult SetupHeaderFooterChild(const nsTableReflowState& aReflowState,
|
|
|
|
nsTableRowGroupFrame* aFrame,
|
|
|
|
nscoord* aDesiredHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-10-06 21:25:46 -07:00
|
|
|
nsresult ReflowChildren(nsTableReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame*& aLastChildReflowed,
|
|
|
|
nsOverflowAreas& aOverflowAreas);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// This calls the col group and column reflow methods, which do two things:
|
|
|
|
// (1) set all the dimensions to 0
|
|
|
|
// (2) notify the table about colgroups or columns with hidden visibility
|
2011-04-07 18:04:40 -07:00
|
|
|
void ReflowColGroups(nsRenderingContext* aRenderingContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** return the width of the table taking into account visibility collapse
|
|
|
|
* on columns and colgroups
|
|
|
|
* @param aBorderPadding the border and padding of the table
|
|
|
|
*/
|
|
|
|
nscoord GetCollapsedWidth(nsMargin aBorderPadding);
|
|
|
|
|
|
|
|
|
2011-09-06 17:20:35 -07:00
|
|
|
/** Adjust the table for visibility.collapse set on rowgroups, rows,
|
|
|
|
* colgroups and cols
|
2007-03-22 10:30:00 -07:00
|
|
|
* @param aDesiredSize the metrics of the table
|
|
|
|
* @param aBorderPadding the border and padding of the table
|
|
|
|
*/
|
|
|
|
void AdjustForCollapsingRowsCols(nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
nsMargin aBorderPadding);
|
|
|
|
|
2008-09-24 10:14:35 -07:00
|
|
|
nsITableLayoutStrategy* LayoutStrategy() const {
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTableFrame*>(GetFirstInFlow())->
|
2007-03-22 10:30:00 -07:00
|
|
|
mTableLayoutStrategy;
|
|
|
|
}
|
|
|
|
|
2012-06-01 12:56:33 -07:00
|
|
|
// Helper for InsertFrames.
|
|
|
|
void HomogenousInsertFrames(ChildListID aListID,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList);
|
2008-02-06 14:01:41 -08:00
|
|
|
private:
|
|
|
|
/* Handle a row that got inserted during reflow. aNewHeight is the
|
|
|
|
new height of the table after reflow. */
|
|
|
|
void ProcessRowInserted(nscoord aNewHeight);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// WIDTH AND HEIGHT CALCULATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// calculate the computed height of aFrame including its border and padding given
|
|
|
|
// its reflow state.
|
|
|
|
nscoord CalcBorderBoxHeight(const nsHTMLReflowState& aReflowState);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// update the desired height of this table taking into account the current
|
|
|
|
// reflow state, the table attributes and the content driven rowgroup heights
|
|
|
|
// this function can change the overflow area
|
|
|
|
void CalcDesiredHeight(const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize);
|
|
|
|
|
|
|
|
// The following is a helper for CalcDesiredHeight
|
|
|
|
|
|
|
|
void DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
|
|
|
|
nscoord aAmount);
|
|
|
|
|
|
|
|
void PlaceChild(nsTableReflowState& aReflowState,
|
|
|
|
nsIFrame* aKidFrame,
|
2008-02-08 01:36:32 -08:00
|
|
|
nsHTMLReflowMetrics& aKidDesiredSize,
|
2008-03-16 13:32:48 -07:00
|
|
|
const nsRect& aOriginalKidRect,
|
2010-10-06 21:25:46 -07:00
|
|
|
const nsRect& aOriginalKidVisualOverflow);
|
2010-05-13 07:15:49 -07:00
|
|
|
void PlaceRepeatedFooter(nsTableReflowState& aReflowState,
|
|
|
|
nsTableRowGroupFrame *aTfoot,
|
|
|
|
nscoord aFooterHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsIFrame* GetFirstBodyRowGroupFrame();
|
2010-01-16 08:05:46 -08:00
|
|
|
public:
|
2011-08-09 22:36:00 -07:00
|
|
|
typedef nsAutoTArray<nsTableRowGroupFrame*, 8> RowGroupArray;
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
2010-01-16 08:05:46 -08:00
|
|
|
* Push all our child frames from the aRowGroups array, in order, starting
|
|
|
|
* from the frame at aPushFrom to the end of the array. The frames are put on
|
|
|
|
* our overflow list or moved directly to our next-in-flow if one exists.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2010-01-16 08:05:46 -08:00
|
|
|
protected:
|
2012-08-22 08:56:38 -07:00
|
|
|
void PushChildren(const RowGroupArray& aRowGroups, int32_t aPushFrom);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
2007-06-05 11:55:26 -07:00
|
|
|
// put the children frames in the display order (e.g. thead before tbodies
|
|
|
|
// before tfoot). This will handle calling GetRowGroupFrame() on the
|
|
|
|
// children, and not append nulls, so the array is guaranteed to contain
|
|
|
|
// nsTableRowGroupFrames. If there are multiple theads or tfoots, all but
|
|
|
|
// the first one are treated as tbodies instead.
|
2010-01-16 08:05:46 -08:00
|
|
|
|
|
|
|
void OrderRowGroups(RowGroupArray& aChildren,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsTableRowGroupFrame** aHead = nullptr,
|
|
|
|
nsTableRowGroupFrame** aFoot = nullptr) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-06-05 11:55:26 -07:00
|
|
|
// Return the thead, if any
|
|
|
|
nsTableRowGroupFrame* GetTHead() const;
|
|
|
|
|
|
|
|
// Return the tfoot, if any
|
|
|
|
nsTableRowGroupFrame* GetTFoot() const;
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
// Returns true if there are any cells above the row at
|
2007-03-22 10:30:00 -07:00
|
|
|
// aRowIndex and spanning into the row at aRowIndex, the number of
|
|
|
|
// effective columns limits the search up to that column
|
2012-08-22 08:56:38 -07:00
|
|
|
bool RowIsSpannedInto(int32_t aRowIndex, int32_t aNumEffCols);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
// Returns true if there is a cell originating in aRowIndex
|
2007-03-22 10:30:00 -07:00
|
|
|
// which spans into the next row, the number of effective
|
|
|
|
// columns limits the search up to that column
|
2012-08-22 08:56:38 -07:00
|
|
|
bool RowHasSpanningCells(int32_t aRowIndex, int32_t aNumEffCols);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HaveReflowedColGroups() const;
|
|
|
|
void SetHaveReflowedColGroups(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsBorderCollapse() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool NeedToCalcBCBorders() const;
|
|
|
|
void SetNeedToCalcBCBorders(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool NeedToCollapse() const;
|
|
|
|
void SetNeedToCollapse(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasZeroColSpans() const;
|
|
|
|
void SetHasZeroColSpans(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool NeedColSpanExpansion() const;
|
|
|
|
void SetNeedColSpanExpansion(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-05-17 23:04:43 -07:00
|
|
|
/** The GeometryDirty bit is similar to the NS_FRAME_IS_DIRTY frame
|
|
|
|
* state bit, which implies that all descendants are dirty. The
|
|
|
|
* GeometryDirty still implies that all the parts of the table are
|
|
|
|
* dirty, but resizing optimizations should still apply to the
|
|
|
|
* contents of the individual cells.
|
|
|
|
*/
|
2011-10-17 07:59:28 -07:00
|
|
|
void SetGeometryDirty() { mBits.mGeometryDirty = true; }
|
|
|
|
void ClearGeometryDirty() { mBits.mGeometryDirty = false; }
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsGeometryDirty() const { return mBits.mGeometryDirty; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** Get the cell map for this table frame. It is not always mCellMap.
|
|
|
|
* Only the firstInFlow has a legit cell map
|
|
|
|
*/
|
|
|
|
virtual nsTableCellMap* GetCellMap() const;
|
|
|
|
|
|
|
|
/** Iterate over the row groups and adjust the row indices of all rows
|
|
|
|
* whose index is >= aRowIndex.
|
|
|
|
* @param aRowIndex - start adjusting with this index
|
|
|
|
* @param aAdjustment - shift the row index by this amount
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
void AdjustRowIndices(int32_t aRowIndex,
|
|
|
|
int32_t aAdjustment);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** Reset the rowindices of all rows as they might have changed due to
|
|
|
|
* rowgroup reordering, exclude new row group frames that show in the
|
|
|
|
* reordering but are not yet inserted into the cellmap
|
2009-07-30 10:23:32 -07:00
|
|
|
* @param aRowGroupsToExclude - an iterator that will produce the row groups
|
|
|
|
* to exclude.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2009-07-30 10:23:32 -07:00
|
|
|
void ResetRowIndices(const nsFrameList::Slice& aRowGroupsToExclude);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-02-05 01:09:50 -08:00
|
|
|
nsTArray<nsTableColFrame*>& GetColCache();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-27 06:58:44 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetBorderCollapse(bool aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-27 06:58:44 -07:00
|
|
|
BCPropertyData* GetBCProperty(bool aCreateIfNecessary = false) const;
|
|
|
|
void SetFullBCDamageArea();
|
2007-03-22 10:30:00 -07:00
|
|
|
void CalcBCBorders();
|
|
|
|
|
2012-01-22 14:48:34 -08:00
|
|
|
void ExpandBCDamageArea(nsIntRect& aRect) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void SetColumnDimensions(nscoord aHeight,
|
|
|
|
const nsMargin& aReflowState);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t CollectRows(nsIFrame* aFrame,
|
2009-02-05 01:09:50 -08:00
|
|
|
nsTArray<nsTableRowFrame*>& aCollection);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public: /* ----- Cell Map public methods ----- */
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetStartRowIndex(nsTableRowGroupFrame* aRowGroupFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** returns the number of rows in this table.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetRowCount () const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return GetCellMap()->GetRowCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** returns the number of columns in this table after redundant columns have been removed
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetEffectiveColCount() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* return the col count including dead cols */
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetColCount () const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return GetCellMap()->GetColCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
// return the last col index which isn't of type eColAnonymousCell
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetIndexOfLastRealCol();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
/** returns true if table-layout:auto */
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsAutoLayout();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*---------------- nsITableLayout methods ------------------------*/
|
|
|
|
|
|
|
|
/** Get the cell and associated data for a table cell from the frame's cellmap */
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetCellDataAt(int32_t aRowIndex, int32_t aColIndex,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMElement* &aCell, //out params
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t& aStartRowIndex, int32_t& aStartColIndex,
|
|
|
|
int32_t& aRowSpan, int32_t& aColSpan,
|
|
|
|
int32_t& aActualRowSpan, int32_t& aActualColSpan,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool& aIsSelected);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** Get the number of rows and column for a table from the frame's cellmap
|
|
|
|
* Some rows may not have enough cells (the number returned is the maximum possible),
|
|
|
|
* which displays as a ragged-right edge table
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetTableSize(int32_t& aRowCount, int32_t& aColCount);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*------------end of nsITableLayout methods -----------------------*/
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2011-09-28 23:19:26 -07:00
|
|
|
void Dump(bool aDumpRows,
|
|
|
|
bool aDumpCols,
|
|
|
|
bool aDumpCellMap);
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
#ifdef DEBUG
|
|
|
|
void DumpRowGroup(nsIFrame* aChildFrame);
|
|
|
|
#endif
|
|
|
|
// DATA MEMBERS
|
2011-08-09 22:36:00 -07:00
|
|
|
nsAutoTArray<nsTableColFrame*, 8> mColFrames;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
struct TableBits {
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mHaveReflowedColGroups:1; // have the col groups gotten their initial reflow
|
|
|
|
uint32_t mHasPctCol:1; // does any cell or col have a pct width
|
|
|
|
uint32_t mCellSpansPctCol:1; // does any cell span a col with a pct width (or containing a cell with a pct width)
|
|
|
|
uint32_t mIsBorderCollapse:1; // border collapsing model vs. separate model
|
|
|
|
uint32_t mRowInserted:1;
|
|
|
|
uint32_t mNeedToCalcBCBorders:1;
|
|
|
|
uint32_t mGeometryDirty:1;
|
|
|
|
uint32_t mLeftContBCBorder:8;
|
|
|
|
uint32_t mNeedToCollapse:1; // rows, cols that have visibility:collapse need to be collapsed
|
|
|
|
uint32_t mHasZeroColSpans:1;
|
|
|
|
uint32_t mNeedColSpanExpansion:1;
|
|
|
|
uint32_t mResizedColumns:1; // have we resized columns since last reflow?
|
2007-03-22 10:30:00 -07:00
|
|
|
} mBits;
|
|
|
|
|
|
|
|
nsTableCellMap* mCellMap; // maintains the relationships between rows, cols, and cells
|
|
|
|
nsITableLayoutStrategy* mTableLayoutStrategy;// the layout strategy for this frame
|
|
|
|
nsFrameList mColGroups; // the list of colgroup frames
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
inline bool nsTableFrame::IsRowGroup(int32_t aDisplayType) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return bool((NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == aDisplayType) ||
|
2007-03-22 10:30:00 -07:00
|
|
|
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == aDisplayType) ||
|
|
|
|
(NS_STYLE_DISPLAY_TABLE_ROW_GROUP == aDisplayType));
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetHaveReflowedColGroups(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mHaveReflowedColGroups = aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::HaveReflowedColGroups() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mHaveReflowedColGroups;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::HasPctCol() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mHasPctCol;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetHasPctCol(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mHasPctCol = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::HasCellSpanningPctCol() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mCellSpansPctCol;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetHasCellSpanningPctCol(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mCellSpansPctCol = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::IsRowInserted() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mRowInserted;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetRowInserted(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mRowInserted = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetNeedToCollapse(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2009-06-21 09:34:03 -07:00
|
|
|
static_cast<nsTableFrame*>(GetFirstInFlow())->mBits.mNeedToCollapse = (unsigned)aValue;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::NeedToCollapse() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool) static_cast<nsTableFrame*>(GetFirstInFlow())->mBits.mNeedToCollapse;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetHasZeroColSpans(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mHasZeroColSpans = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::HasZeroColSpans() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mHasZeroColSpans;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetNeedColSpanExpansion(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mNeedColSpanExpansion = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::NeedColSpanExpansion() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mNeedColSpanExpansion;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline nsFrameList& nsTableFrame::GetColGroups()
|
|
|
|
{
|
2007-07-08 00:08:04 -07:00
|
|
|
return static_cast<nsTableFrame*>(GetFirstInFlow())->mColGroups;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2009-02-05 01:09:50 -08:00
|
|
|
inline nsTArray<nsTableColFrame*>& nsTableFrame::GetColCache()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return mColFrames;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::IsBorderCollapse() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mIsBorderCollapse;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetBorderCollapse(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mIsBorderCollapse = aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsTableFrame::NeedToCalcBCBorders() const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
return (bool)mBits.mNeedToCalcBCBorders;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline void nsTableFrame::SetNeedToCalcBCBorders(bool aValue)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
mBits.mNeedToCalcBCBorders = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nscoord
|
|
|
|
nsTableFrame::GetContinuousLeftBCBorderWidth() const
|
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
|
2007-03-22 10:30:00 -07:00
|
|
|
return BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips, mBits.mLeftContBCBorder);
|
|
|
|
}
|
|
|
|
|
2009-06-21 09:31:40 -07:00
|
|
|
inline void nsTableFrame::SetContinuousLeftBCBorderWidth(nscoord aValue)
|
|
|
|
{
|
|
|
|
mBits.mLeftContBCBorder = (unsigned) aValue;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsTableIterator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsTableIterator(nsIFrame& aSource);
|
|
|
|
nsTableIterator(nsFrameList& aSource);
|
|
|
|
nsIFrame* First();
|
|
|
|
nsIFrame* Next();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsLeftToRight();
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t Count();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void Init(nsIFrame* aFirstChild);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mLeftToRight;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* mFirstListChild;
|
|
|
|
nsIFrame* mFirstChild;
|
|
|
|
nsIFrame* mCurrentChild;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mCount;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define ABORT0() \
|
2011-10-17 07:59:28 -07:00
|
|
|
{NS_ASSERTION(false, "CellIterator program error"); \
|
2007-03-22 10:30:00 -07:00
|
|
|
return;}
|
|
|
|
|
|
|
|
#define ABORT1(aReturn) \
|
2011-10-17 07:59:28 -07:00
|
|
|
{NS_ASSERTION(false, "CellIterator program error"); \
|
2007-03-22 10:30:00 -07:00
|
|
|
return aReturn;}
|
|
|
|
|
|
|
|
#endif
|