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 nsTableFrame_h__
|
|
|
|
#define nsTableFrame_h__
|
|
|
|
|
2013-05-14 20:33:23 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-08-08 17:05:17 +04:00
|
|
|
#include "celldata.h"
|
2015-02-06 07:45:56 +03:00
|
|
|
#include "imgIContainer.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nscore.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
1998-06-05 10:09:09 +04:00
|
|
|
#include "nsStyleCoord.h"
|
1998-10-11 13:18:27 +04:00
|
|
|
#include "nsStyleConsts.h"
|
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
|
|
|
#include "nsCellMap.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2008-04-06 15:34:14 +04:00
|
|
|
#include "nsDisplayList.h"
|
2015-05-01 00:46:59 +03:00
|
|
|
#include "TableArea.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
class nsTableCellFrame;
|
2012-08-08 17:05:17 +04:00
|
|
|
class nsTableCellMap;
|
1998-06-05 06:36:25 +04:00
|
|
|
class nsTableColFrame;
|
1998-07-02 02:22:28 +04:00
|
|
|
class nsTableRowGroupFrame;
|
1998-06-17 20:38:24 +04:00
|
|
|
class nsTableRowFrame;
|
1998-10-15 02:51:50 +04:00
|
|
|
class nsTableColGroupFrame;
|
1998-04-30 21:57:09 +04:00
|
|
|
class nsITableLayoutStrategy;
|
2003-02-22 03:32:13 +03:00
|
|
|
class nsStyleContext;
|
2015-06-10 04:13:49 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class WritingMode;
|
|
|
|
class LogicalMargin;
|
2016-07-21 13:36:36 +03:00
|
|
|
struct TableReflowInput;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
1999-10-28 08:09:39 +04:00
|
|
|
|
2011-10-27 17:58:44 +04:00
|
|
|
struct BCPropertyData;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static inline bool IS_TABLE_CELL(nsIAtom* frameType) {
|
2007-01-30 03:06:41 +03:00
|
|
|
return nsGkAtoms::tableCellFrame == frameType ||
|
|
|
|
nsGkAtoms::bcTableCellFrame == frameType;
|
|
|
|
}
|
|
|
|
|
2012-08-29 09:39:31 +04:00
|
|
|
static inline bool FrameHasBorderOrBackground(nsIFrame* f) {
|
2013-02-17 01:51:02 +04:00
|
|
|
return (f->StyleVisibility()->IsVisible() &&
|
|
|
|
(!f->StyleBackground()->IsTransparent() ||
|
|
|
|
f->StyleDisplay()->mAppearance ||
|
|
|
|
f->StyleBorder()->HasBorder()));
|
2012-08-29 09:39:31 +04:00
|
|
|
}
|
|
|
|
|
2008-04-06 15:34:14 +04:00
|
|
|
class nsDisplayTableItem : public nsDisplayItem
|
|
|
|
{
|
|
|
|
public:
|
2016-05-30 23:03:50 +03:00
|
|
|
nsDisplayTableItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
|
|
|
bool aDrawsBackground = true) :
|
2010-08-13 14:01:13 +04:00
|
|
|
nsDisplayItem(aBuilder, aFrame),
|
2016-05-30 23:03:50 +03:00
|
|
|
mPartHasFixedBackground(false),
|
|
|
|
mDrawsBackground(aDrawsBackground) {}
|
2008-04-06 15:34:14 +04: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.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override;
|
2008-04-06 15:34:14 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override;
|
2015-03-04 14:02:14 +03:00
|
|
|
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayItemGeometry* aGeometry,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsRegion *aInvalidRegion) override;
|
2015-03-04 14:02:14 +03:00
|
|
|
|
2008-04-06 15:34:14 +04:00
|
|
|
void UpdateForFrameBackground(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPartHasFixedBackground;
|
2016-05-30 23:03:50 +03:00
|
|
|
bool mDrawsBackground;
|
2008-04-06 15:34:14 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsAutoPushCurrentTableItem
|
|
|
|
{
|
|
|
|
public:
|
2012-07-30 18:20:58 +04:00
|
|
|
nsAutoPushCurrentTableItem() : mBuilder(nullptr) {}
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2008-04-06 15:34:14 +04: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
|
|
|
|
};
|
|
|
|
|
1998-07-07 01:00:11 +04:00
|
|
|
/* ============================================================================ */
|
|
|
|
|
2015-04-30 07:24:59 +03:00
|
|
|
enum nsTableColGroupType {
|
|
|
|
eColGroupContent = 0, // there is real col group content associated
|
|
|
|
eColGroupAnonymousCol = 1, // the result of a col
|
|
|
|
eColGroupAnonymousCell = 2 // the result of a cell alone
|
|
|
|
};
|
|
|
|
|
|
|
|
enum nsTableColType {
|
|
|
|
eColContent = 0, // there is real col content associated
|
|
|
|
eColAnonymousCol = 1, // the result of a span on a col
|
|
|
|
eColAnonymousColGroup = 2, // the result of a span on a col group
|
|
|
|
eColAnonymousCell = 3 // the result of a cell alone
|
|
|
|
};
|
|
|
|
|
2011-08-25 00:54:30 +04:00
|
|
|
/**
|
|
|
|
* nsTableFrame maps the inner portion of a table (everything except captions.)
|
2016-06-16 15:14:08 +03:00
|
|
|
* Used as a pseudo-frame within nsTableWrapperFrame, it may also be used
|
1998-12-04 06:14:28 +03:00
|
|
|
* stand-alone as the top-level frame.
|
|
|
|
*
|
2011-08-25 00:54:30 +04:00
|
|
|
* The principal child list contains row group frames. There is also an
|
|
|
|
* additional child list, kColGroupList, which contains the col group frames.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
2012-08-08 17:05:17 +04:00
|
|
|
class nsTableFrame : public nsContainerFrame
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
2015-02-06 07:45:56 +03:00
|
|
|
typedef mozilla::image::DrawResult DrawResult;
|
2015-06-10 04:13:49 +03:00
|
|
|
typedef mozilla::WritingMode WritingMode;
|
|
|
|
typedef mozilla::LogicalMargin LogicalMargin;
|
2016-07-21 13:36:36 +03:00
|
|
|
typedef mozilla::TableReflowInput TableReflowInput;
|
2015-02-06 07:45:56 +03:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2015-03-04 14:02:14 +03:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsTableFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1999-08-01 02:11:50 +04:00
|
|
|
|
2016-06-21 23:17:11 +03:00
|
|
|
typedef nsTArray<nsIFrame*> FrameTArray;
|
|
|
|
NS_DECLARE_FRAME_PROPERTY_DELETABLE(PositionedTablePartArray, FrameTArray)
|
2014-03-11 02:41:17 +04:00
|
|
|
|
2016-06-16 15:14:08 +03:00
|
|
|
/** nsTableWrapperFrame has intimate knowledge of the inner table frame */
|
|
|
|
friend class nsTableWrapperFrame;
|
1998-04-14 00:24:54 +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
|
|
|
*/
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsTableFrame* NS_NewTableFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** sets defaults for table-specific style.
|
2015-04-17 21:42:05 +03:00
|
|
|
* @see nsIFrame::Init
|
1999-01-27 22:29:24 +03:00
|
|
|
*/
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
1998-12-05 08:27:21 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
static float GetTwipsToPixels(nsPresContext* aPresContext);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
// Return true if aParentReflowInput.frame or any of its ancestors within
|
2015-06-22 12:33:34 +03:00
|
|
|
// the containing table have non-auto bsize. (e.g. pct or fixed bsize)
|
2016-07-21 13:36:39 +03:00
|
|
|
static bool AncestorsHaveStyleBSize(const ReflowInput& aParentReflowInput);
|
2007-06-26 00:34:35 +04:00
|
|
|
|
2015-06-22 12:33:34 +03:00
|
|
|
// See if a special bsize reflow will occur due to having a pct bsize when
|
2015-06-22 12:33:34 +03:00
|
|
|
// the pct bsize basis may not yet be valid.
|
2016-07-21 13:36:39 +03:00
|
|
|
static void CheckRequestSpecialBSizeReflow(const ReflowInput& aReflowInput);
|
2002-04-01 10:46:17 +04:00
|
|
|
|
|
|
|
// Notify the frame and its ancestors (up to the containing table) that a special
|
2015-04-17 21:42:05 +03:00
|
|
|
// height reflow will occur.
|
2016-07-21 13:36:39 +03:00
|
|
|
static void RequestSpecialBSizeReflow(const ReflowInput& aReflowInput);
|
2002-04-01 10:46:17 +04:00
|
|
|
|
2004-12-27 18:05:18 +03:00
|
|
|
static void RePositionViews(nsIFrame* aFrame);
|
2001-03-13 09:38:59 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool PageBreakAfter(nsIFrame* aSourceFrame,
|
2002-03-18 00:35:08 +03:00
|
|
|
nsIFrame* aNextFrame);
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2014-03-11 02:41:17 +04:00
|
|
|
// Register a positioned table part with its nsTableFrame. These objects will
|
|
|
|
// be visited by FixupPositionedTableParts after reflow is complete. (See that
|
|
|
|
// function for more explanation.) Should be called during frame construction.
|
|
|
|
static void RegisterPositionedTablePart(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
// Unregister a positioned table part with its nsTableFrame.
|
|
|
|
static void UnregisterPositionedTablePart(nsIFrame* aFrame,
|
|
|
|
nsIFrame* aDestructRoot);
|
2002-03-18 00:35:08 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
nsPoint GetFirstSectionOrigin(const ReflowInput& aReflowInput) const;
|
2000-01-04 08:31:56 +03:00
|
|
|
/*
|
|
|
|
* Notification that aAttribute has changed for content inside a table (cell, row, etc)
|
|
|
|
*/
|
2005-02-07 04:58:25 +03:00
|
|
|
void AttributeChangedFor(nsIFrame* aFrame,
|
2015-04-17 21:42:05 +03:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIAtom* aAttribute);
|
2000-01-04 08:31:56 +03:00
|
|
|
|
2009-12-24 08:21:15 +03:00
|
|
|
/** @see nsIFrame::DestroyFrom */
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2008-10-18 21:25:26 +04:00
|
|
|
/** @see nsIFrame::DidSetStyleContext */
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
|
1998-12-04 06:14:28 +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-19 07:51:25 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMargin GetUsedBorder() const override;
|
|
|
|
virtual nsMargin GetUsedPadding() const override;
|
|
|
|
virtual nsMargin GetUsedMargin() const override;
|
2006-12-14 02:04:57 +03:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
// Get the offset from the border box to the area where the row groups fit
|
2015-06-10 04:13:49 +03:00
|
|
|
LogicalMargin GetChildAreaOffset(const WritingMode aWM,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput* aReflowInput) const;
|
2002-02-19 18:48:28 +03:00
|
|
|
|
1998-09-24 20:37:22 +04:00
|
|
|
/** helper method to find the table parent of any table frame object */
|
2006-03-04 08:26:57 +03:00
|
|
|
static nsTableFrame* GetTableFrame(nsIFrame* aSourceFrame);
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2016-02-10 02:18:55 +03:00
|
|
|
/* Like GetTableFrame, but will set *aDidPassThrough to false if we don't
|
|
|
|
* pass through aMustPassThrough on the way to the table.
|
2014-03-11 02:41:17 +04:00
|
|
|
*/
|
|
|
|
static nsTableFrame* GetTableFramePassingThrough(nsIFrame* aMustPassThrough,
|
2016-02-10 02:18:55 +03:00
|
|
|
nsIFrame* aSourceFrame,
|
|
|
|
bool* aDidPassThrough);
|
2014-03-11 02:41:17 +04:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
typedef void (* DisplayGenericTablePartTraversal)
|
2006-09-22 05:56:04 +04:00
|
|
|
(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect, const nsDisplayListSet& aLists);
|
2013-02-14 15:12:27 +04:00
|
|
|
static void GenericTraversal(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect, const nsDisplayListSet& aLists);
|
2006-09-22 05:56:04 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* 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 15:34:14 +04:00
|
|
|
* @param aDisplayItem the display item created for this part, or null
|
|
|
|
* if this part's border/background painting is delegated to an ancestor
|
2006-09-22 05:56:04 +04: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.
|
2006-01-26 05:29:17 +03:00
|
|
|
*/
|
2013-02-14 15:12:27 +04:00
|
|
|
static void DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsFrame* aFrame,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
nsDisplayTableItem* aDisplayItem,
|
|
|
|
DisplayGenericTablePartTraversal aTraversal = GenericTraversal);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
|
|
|
// Return the closest sibling of aPriorChildFrame (including aPriroChildFrame)
|
|
|
|
// of type aChildType.
|
2004-01-18 13:28:40 +03:00
|
|
|
static nsIFrame* GetFrameAtOrBefore(nsIFrame* aParentFrame,
|
2000-01-22 04:16:50 +03:00
|
|
|
nsIFrame* aPriorChildFrame,
|
|
|
|
nsIAtom* aChildType);
|
2015-06-22 12:33:34 +03:00
|
|
|
bool IsAutoBSize(mozilla::WritingMode aWM);
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
/** @return true if aDisplayType represents a rowgroup of any sort
|
1998-10-11 13:18:27 +04:00
|
|
|
* (header, footer, or body)
|
|
|
|
*/
|
2016-08-28 05:31:50 +03:00
|
|
|
bool IsRowGroup(mozilla::StyleDisplay aDisplayType) const;
|
1998-06-05 06:36:25 +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;
|
1998-12-03 21:01:35 +03: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;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-10-23 05:54:49 +03:00
|
|
|
DrawResult PaintTableBorderBackground(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsRenderingContext& aRenderingContext,
|
2015-02-06 07:45:56 +03:00
|
|
|
const nsRect& aDirtyRect,
|
2015-10-23 05:54:49 +03:00
|
|
|
nsPoint aPt);
|
2013-06-26 20:43:26 +04:00
|
|
|
|
2009-02-08 19:46:42 +03: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.
|
|
|
|
*/
|
2015-06-10 04:13:49 +03:00
|
|
|
LogicalMargin GetOuterBCBorder(const WritingMode aWM) const;
|
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
|
|
|
|
2009-02-08 19:46:42 +03:00
|
|
|
/** Same as above, but only if it's included from the border-box width
|
|
|
|
* of the table.
|
|
|
|
*/
|
2015-06-10 04:13:49 +03:00
|
|
|
LogicalMargin GetIncludedOuterBCBorder(const WritingMode aWM) const;
|
2003-09-13 20:26:30 +04:00
|
|
|
|
2009-02-08 19:46:42 +03: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).
|
|
|
|
*/
|
2015-06-10 04:13:49 +03:00
|
|
|
LogicalMargin GetExcludedOuterBCBorder(const WritingMode aWM) const;
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2009-07-22 04:44:52 +04: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;
|
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
/** Get width of table + colgroup + col collapse: elements that
|
2015-06-27 21:16:18 +03:00
|
|
|
* continue along the length of the whole iStart side.
|
2004-03-09 09:48:35 +03:00
|
|
|
* see nsTablePainter about continuous borders
|
|
|
|
*/
|
2015-06-27 21:16:10 +03:00
|
|
|
nscoord GetContinuousIStartBCBorderWidth() const;
|
|
|
|
void SetContinuousIStartBCBorderWidth(nscoord aValue);
|
2009-06-21 20:31:40 +04:00
|
|
|
|
2008-10-26 13:11:34 +03:00
|
|
|
friend class nsDelayedCalcBCBorders;
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2015-05-01 00:46:59 +03:00
|
|
|
void AddBCDamageArea(const mozilla::TableArea& aValue);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool BCRecalcNeeded(nsStyleContext* aOldStyleContext,
|
2008-10-26 13:11:34 +03:00
|
|
|
nsStyleContext* aNewStyleContext);
|
2016-01-08 07:20:06 +03:00
|
|
|
void PaintBCBorders(DrawTarget& aDrawTarget, const nsRect& aDirtyRect);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void MarkIntrinsicISizesDirty() 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
|
|
|
// For border-collapse tables, the caller must not add padding and
|
|
|
|
// border to the results of these functions.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
2015-06-16 14:21:04 +03:00
|
|
|
virtual IntrinsicISizeOffsetData IntrinsicISizeOffsets() 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
|
|
|
|
2014-08-24 18:34:44 +04:00
|
|
|
virtual mozilla::LogicalSize
|
|
|
|
ComputeSize(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
|
|
|
ComputeSizeFlags aFlags) override;
|
2014-08-24 18:34:44 +04:00
|
|
|
|
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;
|
2014-08-24 18:34:51 +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
|
|
|
/**
|
|
|
|
* A copy of nsFrame::ShrinkWidthToFit that calls a different
|
2014-07-24 21:03:25 +04:00
|
|
|
* GetPrefISize, since tables have two different ones.
|
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-06-22 12:33:34 +03:00
|
|
|
nscoord TableShrinkISizeToFit(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
|
|
|
nscoord aWidthInCB);
|
|
|
|
|
|
|
|
// XXXldb REWRITE THIS COMMENT!
|
1998-04-15 01:45:28 +04:00
|
|
|
/** 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
|
1998-05-25 21:31:49 +04:00
|
|
|
* use column widths to Reflow cells
|
1998-04-15 01:45:28 +04:00
|
|
|
* </pre>
|
|
|
|
*
|
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
|
|
|
* @see nsIFrame::Reflow
|
1998-04-15 01:45:28 +04:00
|
|
|
*/
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2016-07-21 13:36:38 +03:00
|
|
|
void ReflowTable(ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-06-22 12:33:34 +03:00
|
|
|
nscoord aAvailBSize,
|
2014-05-13 04:47:53 +04:00
|
|
|
nsIFrame*& aLastChildReflowed,
|
|
|
|
nsReflowStatus& aStatus);
|
2001-08-08 05:13:35 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
nsFrameList& GetColGroups();
|
|
|
|
|
2014-11-20 21:24:10 +03:00
|
|
|
virtual nsStyleContext*
|
2015-03-21 19:28:04 +03:00
|
|
|
GetParentStyleContext(nsIFrame** aProviderFrame) const override;
|
2002-03-27 05:38:13 +03: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::tableFrame
|
1999-02-24 08:54:31 +03:00
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* GetType() const override;
|
1998-12-23 18:47:43 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2012-12-04 08:50:05 +04:00
|
|
|
{
|
|
|
|
if (aFlags & eSupportsCSSTransforms) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags);
|
|
|
|
}
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
1999-01-27 22:29:24 +03:00
|
|
|
/** @see nsIFrame::GetFrameName */
|
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-06-23 21:44:36 +03:00
|
|
|
/** Return the isize of the column at aColIndex.
|
|
|
|
* This may only be called on the table's first-in-flow.
|
|
|
|
*/
|
|
|
|
nscoord GetColumnISizeFromFirstInFlow(int32_t aColIndex);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2015-03-20 07:16:00 +03:00
|
|
|
/** Helper to get the column spacing style value.
|
2014-06-18 14:47:00 +04:00
|
|
|
* The argument refers to the space between column aColIndex and column
|
|
|
|
* aColIndex + 1. An index of -1 indicates the padding between the table
|
|
|
|
* and the left border, an index equal to the number of columns indicates
|
|
|
|
* the padding between the table and the right border.
|
|
|
|
*
|
|
|
|
* Although in this class cell spacing does not depend on the index, it
|
|
|
|
* may be important for overriding classes.
|
|
|
|
*/
|
2015-03-20 07:16:00 +03:00
|
|
|
virtual nscoord GetColSpacing(int32_t aColIndex);
|
2014-06-18 14:47:00 +04:00
|
|
|
|
|
|
|
/** Helper to find the sum of the cell spacing between arbitrary columns.
|
|
|
|
* The argument refers to the space between column aColIndex and column
|
|
|
|
* aColIndex + 1. An index of -1 indicates the padding between the table
|
|
|
|
* and the left border, an index equal to the number of columns indicates
|
|
|
|
* the padding between the table and the right border.
|
|
|
|
*
|
|
|
|
* This method is equivalent to
|
|
|
|
* nscoord result = 0;
|
|
|
|
* for (i = aStartColIndex; i < aEndColIndex; i++) {
|
2015-03-20 07:16:00 +03:00
|
|
|
* result += GetColSpacing(i);
|
2014-06-18 14:47:00 +04:00
|
|
|
* }
|
|
|
|
* return result;
|
|
|
|
*/
|
2015-03-20 07:16:00 +03:00
|
|
|
virtual nscoord GetColSpacing(int32_t aStartColIndex,
|
|
|
|
int32_t aEndColIndex);
|
2014-06-18 14:47:00 +04:00
|
|
|
|
2015-03-20 07:16:00 +03:00
|
|
|
/** Helper to get the row spacing style value.
|
2014-06-18 14:47:00 +04:00
|
|
|
* The argument refers to the space between row aRowIndex and row
|
|
|
|
* aRowIndex + 1. An index of -1 indicates the padding between the table
|
|
|
|
* and the top border, an index equal to the number of rows indicates
|
|
|
|
* the padding between the table and the bottom border.
|
|
|
|
*
|
|
|
|
* Although in this class cell spacing does not depend on the index, it
|
|
|
|
* may be important for overriding classes.
|
|
|
|
*/
|
2015-03-20 07:16:00 +03:00
|
|
|
virtual nscoord GetRowSpacing(int32_t aRowIndex);
|
2014-06-15 02:53:00 +04:00
|
|
|
|
2014-06-18 14:47:00 +04:00
|
|
|
/** Helper to find the sum of the cell spacing between arbitrary rows.
|
|
|
|
* The argument refers to the space between row aRowIndex and row
|
|
|
|
* aRowIndex + 1. An index of -1 indicates the padding between the table
|
|
|
|
* and the top border, an index equal to the number of rows indicates
|
|
|
|
* the padding between the table and the bottom border.
|
|
|
|
*
|
|
|
|
* This method is equivalent to
|
|
|
|
* nscoord result = 0;
|
|
|
|
* for (i = aStartRowIndex; i < aEndRowIndex; i++) {
|
2015-03-20 07:16:00 +03:00
|
|
|
* result += GetRowSpacing(i);
|
2014-06-18 14:47:00 +04:00
|
|
|
* }
|
|
|
|
* return result;
|
|
|
|
*/
|
2015-03-20 07:16:00 +03:00
|
|
|
virtual nscoord GetRowSpacing(int32_t aStartRowIndex,
|
2014-06-18 14:47:00 +04:00
|
|
|
int32_t aEndRowIndex);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/* For the base implementation of nsTableFrame, cell spacing does not depend
|
|
|
|
* on row/column indexing.
|
|
|
|
*/
|
2015-03-20 07:16:00 +03:00
|
|
|
nscoord GetColSpacing();
|
|
|
|
nscoord GetRowSpacing();
|
2014-06-18 14:47:00 +04:00
|
|
|
|
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
|
1998-06-24 23:13:19 +04:00
|
|
|
/** return the row span of a cell, taking into account row span magic at the bottom
|
2000-02-01 06:23:29 +03:00
|
|
|
* 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.
|
1998-07-17 03:23:31 +04:00
|
|
|
*
|
2000-02-01 06:23:29 +03:00
|
|
|
* @param aStartRowIndex the cell
|
|
|
|
* @param aCell the cell
|
1998-07-17 03:23:31 +04:00
|
|
|
*
|
1998-06-24 23:13:19 +04:00
|
|
|
* @return the row span, correcting for row spans that extend beyond the bottom
|
|
|
|
* of the table.
|
|
|
|
*/
|
2013-02-04 01:54:07 +04:00
|
|
|
int32_t GetEffectiveRowSpan(int32_t aStartRowIndex,
|
|
|
|
const nsTableCellFrame& aCell) const;
|
|
|
|
int32_t GetEffectiveRowSpan(const nsTableCellFrame& aCell,
|
|
|
|
nsCellMap* aCellMap = nullptr);
|
1998-06-24 23:13:19 +04:00
|
|
|
|
1998-07-17 03:23:31 +04: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.
|
|
|
|
*/
|
2013-02-04 01:54:07 +04:00
|
|
|
int32_t GetEffectiveColSpan(const nsTableCellFrame& aCell,
|
|
|
|
nsCellMap* aCellMap = nullptr) const;
|
1998-07-17 03:23:31 +04:00
|
|
|
|
2004-04-13 10:21:16 +04:00
|
|
|
/** indicate whether the row has more than one cell that either originates
|
|
|
|
* or is spanned from the rows above
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
bool HasMoreThanOneCell(int32_t aRowIndex) const;
|
2004-04-13 10:21:16 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** return the column frame associated with aColIndex
|
2012-07-30 18:20:58 +04:00
|
|
|
* returns nullptr if the col frame has not yet been allocated, or if
|
2004-05-03 22:31:34 +04:00
|
|
|
* aColIndex is out of range
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
nsTableColFrame* GetColFrame(int32_t aColIndex) const;
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2004-05-03 22:31:34 +04: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
|
|
|
|
*/
|
2005-02-07 04:58:25 +03:00
|
|
|
void InsertCol(nsTableColFrame& aColFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aColIndex);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2005-02-07 04:58:25 +03:00
|
|
|
nsTableColGroupFrame* CreateAnonymousColGroupFrame(nsTableColGroupType aType);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t DestroyAnonymousColFrames(int32_t aNumFrames);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2009-07-28 16:53:18 +04: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 19:56:38 +04:00
|
|
|
void AppendAnonymousColFrames(int32_t aNumColsToAdd);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2009-07-28 16:53:18 +04: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 19:56:38 +04:00
|
|
|
int32_t aNumColsToAdd,
|
1999-12-14 01:56:31 +03:00
|
|
|
nsTableColType aColType,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aAddToTable);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2006-08-28 21:39:36 +04:00
|
|
|
void MatchCellMapToColCache(nsTableCellMap* aCellMap);
|
1999-12-14 01:56:31 +03:00
|
|
|
/** empty the column frame cache */
|
|
|
|
void ClearColCache();
|
|
|
|
|
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
|
|
|
void DidResizeColumns();
|
|
|
|
|
2013-02-04 01:54:07 +04:00
|
|
|
void AppendCell(nsTableCellFrame& aCellFrame,
|
|
|
|
int32_t aRowIndex);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2013-02-04 01:54:07 +04:00
|
|
|
void InsertCells(nsTArray<nsTableCellFrame*>& aCellFrames,
|
|
|
|
int32_t aRowIndex,
|
|
|
|
int32_t aColIndexBefore);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2013-02-04 01:54:07 +04:00
|
|
|
void RemoveCell(nsTableCellFrame* aCellFrame,
|
|
|
|
int32_t aRowIndex);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2010-01-16 19:05:46 +03:00
|
|
|
void AppendRows(nsTableRowGroupFrame* aRowGroupFrame,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aRowIndex,
|
2009-02-05 12:09:50 +03:00
|
|
|
nsTArray<nsTableRowFrame*>& aRowFrames);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t InsertRows(nsTableRowGroupFrame* aRowGroupFrame,
|
2009-02-05 12:09:50 +03:00
|
|
|
nsTArray<nsTableRowFrame*>& aFrames,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aRowIndex,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aConsiderSpans);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2013-02-04 01:54:07 +04:00
|
|
|
void RemoveRows(nsTableRowFrame& aFirstRowFrame,
|
|
|
|
int32_t aNumRowsToRemove,
|
|
|
|
bool aConsiderSpans);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2006-08-04 23:15:50 +04:00
|
|
|
/** Insert multiple rowgroups into the table cellmap handling
|
2009-07-30 21:23:32 +04:00
|
|
|
* @param aRowGroups - iterator that iterates over the rowgroups to insert
|
2006-08-04 23:15:50 +04:00
|
|
|
*/
|
2009-07-30 21:23:32 +04:00
|
|
|
void InsertRowGroups(const nsFrameList::Slice& aRowGroups);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void InsertColGroups(int32_t aStartColIndex,
|
2009-07-30 21:23:32 +04:00
|
|
|
const nsFrameList::Slice& aColgroups);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2013-02-04 01:54:07 +04:00
|
|
|
void RemoveCol(nsTableColGroupFrame* aColGroupFrame,
|
|
|
|
int32_t aColIndex,
|
|
|
|
bool aRemoveFromCache,
|
|
|
|
bool aRemoveFromCellMap);
|
1998-09-01 01:23:28 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
bool ColumnHasCellSpacingBefore(int32_t aColIndex) const;
|
1999-07-28 12:09:02 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasPctCol() const;
|
|
|
|
void SetHasPctCol(bool aValue);
|
2001-03-13 09:38:59 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasCellSpanningPctCol() const;
|
|
|
|
void SetHasCellSpanningPctCol(bool aValue);
|
2001-11-05 03:15:51 +03:00
|
|
|
|
2012-08-29 09:48:45 +04: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);
|
|
|
|
|
2016-05-04 03:27:43 +03:00
|
|
|
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
|
2011-06-16 01:03:49 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
|
|
|
|
2015-04-17 21:42:05 +03:00
|
|
|
/** protected constructor.
|
1998-04-15 01:45:28 +04:00
|
|
|
* @see NewFrame
|
|
|
|
*/
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsTableFrame(nsStyleContext* aContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
/** destructor, responsible for mColumnLayoutData */
|
1998-04-14 00:24:54 +04:00
|
|
|
virtual ~nsTableFrame();
|
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
void InitChildReflowInput(ReflowInput& aReflowInput);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
|
1998-10-20 21:45:07 +04:00
|
|
|
|
1999-06-15 05:19:18 +04:00
|
|
|
public:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsRowInserted() const;
|
|
|
|
void SetRowInserted(bool aValue);
|
2001-08-06 18:48:09 +04:00
|
|
|
|
1999-06-15 05:19:18 +04:00
|
|
|
protected:
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2007-12-05 05:32:56 +03: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.
|
2016-07-21 13:36:39 +03:00
|
|
|
nsresult SetupHeaderFooterChild(const TableReflowInput& aReflowInput,
|
2007-12-05 05:32:56 +03:00
|
|
|
nsTableRowGroupFrame* aFrame,
|
|
|
|
nscoord* aDesiredHeight);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
void ReflowChildren(TableReflowInput& aReflowInput,
|
2014-05-13 04:47:53 +04:00
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame*& aLastChildReflowed,
|
|
|
|
nsOverflowAreas& aOverflowAreas);
|
1998-10-11 13:18:27 +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
|
|
|
// 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-08 05:04:40 +04:00
|
|
|
void ReflowColGroups(nsRenderingContext* aRenderingContext);
|
1999-02-11 09:22:33 +03:00
|
|
|
|
2015-06-22 12:33:34 +03:00
|
|
|
/** return the isize of the table taking into account visibility collapse
|
2006-03-04 08:26:57 +03:00
|
|
|
* on columns and colgroups
|
|
|
|
* @param aBorderPadding the border and padding of the table
|
|
|
|
*/
|
2015-06-22 12:33:34 +03:00
|
|
|
nscoord GetCollapsedISize(const WritingMode aWM,
|
2015-06-10 04:13:49 +03:00
|
|
|
const LogicalMargin& aBorderPadding);
|
1999-06-14 12:01:00 +04:00
|
|
|
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2011-09-07 04:20:35 +04:00
|
|
|
/** Adjust the table for visibility.collapse set on rowgroups, rows,
|
|
|
|
* colgroups and cols
|
2006-03-04 08:26:57 +03:00
|
|
|
* @param aDesiredSize the metrics of the table
|
|
|
|
* @param aBorderPadding the border and padding of the table
|
|
|
|
*/
|
2016-07-21 13:36:38 +03:00
|
|
|
void AdjustForCollapsingRowsCols(ReflowOutput& aDesiredSize,
|
2015-06-10 04:13:49 +03:00
|
|
|
const WritingMode aWM,
|
|
|
|
const LogicalMargin& aBorderPadding);
|
1999-02-11 09:22:33 +03:00
|
|
|
|
2014-03-11 02:41:17 +04:00
|
|
|
/** FixupPositionedTableParts is called at the end of table reflow to reflow
|
|
|
|
* the absolutely positioned descendants of positioned table parts. This is
|
|
|
|
* necessary because the dimensions of table parts may change after they've
|
|
|
|
* been reflowed (e.g. in AdjustForCollapsingRowsCols).
|
|
|
|
*/
|
2014-03-19 07:04:23 +04:00
|
|
|
void FixupPositionedTableParts(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput);
|
2014-03-11 02:41:17 +04:00
|
|
|
|
|
|
|
// Clears the list of positioned table parts.
|
|
|
|
void ClearAllPositionedTableParts();
|
|
|
|
|
2008-09-24 21:14:35 +04:00
|
|
|
nsITableLayoutStrategy* LayoutStrategy() const {
|
2013-09-25 15:42:34 +04:00
|
|
|
return static_cast<nsTableFrame*>(FirstInFlow())->
|
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
|
|
|
mTableLayoutStrategy;
|
|
|
|
}
|
1998-09-01 01:23:28 +04:00
|
|
|
|
2012-06-01 23:56:33 +04:00
|
|
|
// Helper for InsertFrames.
|
|
|
|
void HomogenousInsertFrames(ChildListID aListID,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsFrameList& aFrameList);
|
2008-02-07 01:01:41 +03:00
|
|
|
private:
|
|
|
|
/* Handle a row that got inserted during reflow. aNewHeight is the
|
|
|
|
new height of the table after reflow. */
|
|
|
|
void ProcessRowInserted(nscoord aNewHeight);
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
// WIDTH AND HEIGHT CALCULATION
|
1998-11-20 04:01:25 +03:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
public:
|
|
|
|
|
2015-06-22 12:33:34 +03:00
|
|
|
// calculate the computed block-size of aFrame including its border and
|
|
|
|
// padding given its reflow state.
|
2016-07-21 13:36:39 +03:00
|
|
|
nscoord CalcBorderBoxBSize(const ReflowInput& aReflowInput);
|
2001-03-13 09:38:59 +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
|
|
|
protected:
|
2001-03-13 09:38:59 +03:00
|
|
|
|
2015-06-22 12:33:34 +03:00
|
|
|
// update the desired block-size of this table taking into account the current
|
|
|
|
// reflow state, the table attributes and the content driven rowgroup bsizes
|
2004-09-13 22:21:03 +04:00
|
|
|
// this function can change the overflow area
|
2016-07-21 13:36:39 +03:00
|
|
|
void CalcDesiredBSize(const ReflowInput& aReflowInput,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize);
|
2001-11-05 03:15:51 +03:00
|
|
|
|
2015-06-22 12:33:34 +03:00
|
|
|
// The following is a helper for CalcDesiredBSize
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
void DistributeBSizeToRows(const ReflowInput& aReflowInput,
|
2015-06-22 12:33:34 +03:00
|
|
|
nscoord aAmount);
|
1998-11-20 04:01:25 +03:00
|
|
|
|
2016-07-21 13:36:39 +03:00
|
|
|
void PlaceChild(TableReflowInput& aReflowInput,
|
2001-03-13 09:38:59 +03:00
|
|
|
nsIFrame* aKidFrame,
|
2014-08-20 05:24:58 +04:00
|
|
|
nsPoint aKidPosition,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aKidDesiredSize,
|
2008-03-16 23:32:48 +03:00
|
|
|
const nsRect& aOriginalKidRect,
|
2010-10-07 08:25:46 +04:00
|
|
|
const nsRect& aOriginalKidVisualOverflow);
|
2016-07-21 13:36:39 +03:00
|
|
|
void PlaceRepeatedFooter(TableReflowInput& aReflowInput,
|
2010-05-13 18:15:49 +04:00
|
|
|
nsTableRowGroupFrame *aTfoot,
|
|
|
|
nscoord aFooterHeight);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-03-09 08:29:37 +03:00
|
|
|
nsIFrame* GetFirstBodyRowGroupFrame();
|
2010-01-16 19:05:46 +03:00
|
|
|
public:
|
2016-02-02 18:36:30 +03:00
|
|
|
typedef AutoTArray<nsTableRowGroupFrame*, 8> RowGroupArray;
|
2005-02-16 23:02:14 +03:00
|
|
|
/**
|
2010-01-16 19:05:46 +03: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.
|
2005-02-16 23:02:14 +03:00
|
|
|
*/
|
2010-01-16 19:05:46 +03:00
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
void PushChildren(const RowGroupArray& aRowGroups, int32_t aPushFrom);
|
1999-03-09 08:29:37 +03:00
|
|
|
|
1998-10-14 20:32:45 +04:00
|
|
|
public:
|
2007-06-05 22:55:26 +04: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 19:05:46 +03:00
|
|
|
|
|
|
|
void OrderRowGroups(RowGroupArray& aChildren,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsTableRowGroupFrame** aHead = nullptr,
|
|
|
|
nsTableRowGroupFrame** aFoot = nullptr) const;
|
2000-09-14 10:49:47 +04:00
|
|
|
|
2007-06-05 22:55:26 +04:00
|
|
|
// Return the thead, if any
|
|
|
|
nsTableRowGroupFrame* GetTHead() const;
|
|
|
|
|
|
|
|
// Return the tfoot, if any
|
|
|
|
nsTableRowGroupFrame* GetTFoot() const;
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
// Returns true if there are any cells above the row at
|
2005-11-04 21:41:32 +03:00
|
|
|
// aRowIndex and spanning into the row at aRowIndex, the number of
|
|
|
|
// effective columns limits the search up to that column
|
2012-08-22 19:56:38 +04:00
|
|
|
bool RowIsSpannedInto(int32_t aRowIndex, int32_t aNumEffCols);
|
1999-08-19 23:52:37 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
// Returns true if there is a cell originating in aRowIndex
|
2005-11-04 21:41:32 +03:00
|
|
|
// which spans into the next row, the number of effective
|
|
|
|
// columns limits the search up to that column
|
2012-08-22 19:56:38 +04:00
|
|
|
bool RowHasSpanningCells(int32_t aRowIndex, int32_t aNumEffCols);
|
1999-08-19 23:52:37 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
protected:
|
1998-10-16 01:07:37 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HaveReflowedColGroups() const;
|
|
|
|
void SetHaveReflowedColGroups(bool aValue);
|
2000-01-11 18:55:31 +03:00
|
|
|
|
1998-10-14 20:32:45 +04:00
|
|
|
public:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsBorderCollapse() const;
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool NeedToCalcBCBorders() const;
|
|
|
|
void SetNeedToCalcBCBorders(bool aValue);
|
2006-03-04 08:26:57 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool NeedToCollapse() const;
|
|
|
|
void SetNeedToCollapse(bool aValue);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2007-05-18 10:04:43 +04: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 18:59:28 +04:00
|
|
|
void SetGeometryDirty() { mBits.mGeometryDirty = true; }
|
|
|
|
void ClearGeometryDirty() { mBits.mGeometryDirty = false; }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsGeometryDirty() const { return mBits.mGeometryDirty; }
|
2006-12-13 06:45:28 +03:00
|
|
|
|
1999-07-28 12:09:02 +04:00
|
|
|
/** Get the cell map for this table frame. It is not always mCellMap.
|
|
|
|
* Only the firstInFlow has a legit cell map
|
|
|
|
*/
|
2013-02-04 01:54:07 +04:00
|
|
|
nsTableCellMap* GetCellMap() const;
|
2006-08-04 23:15:50 +04:00
|
|
|
|
2015-04-17 21:42:05 +03:00
|
|
|
/** Iterate over the row groups and adjust the row indices of all rows
|
|
|
|
* whose index is >= aRowIndex.
|
2006-08-04 23:15:50 +04:00
|
|
|
* @param aRowIndex - start adjusting with this index
|
|
|
|
* @param aAdjustment - shift the row index by this amount
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
void AdjustRowIndices(int32_t aRowIndex,
|
|
|
|
int32_t aAdjustment);
|
1999-08-30 04:01:09 +04:00
|
|
|
|
2015-04-17 21:42:05 +03:00
|
|
|
/** Reset the rowindices of all rows as they might have changed due to
|
2006-08-04 23:15:50 +04:00
|
|
|
* rowgroup reordering, exclude new row group frames that show in the
|
|
|
|
* reordering but are not yet inserted into the cellmap
|
2009-07-30 21:23:32 +04:00
|
|
|
* @param aRowGroupsToExclude - an iterator that will produce the row groups
|
|
|
|
* to exclude.
|
2006-06-28 23:00:01 +04:00
|
|
|
*/
|
2009-07-30 21:23:32 +04:00
|
|
|
void ResetRowIndices(const nsFrameList::Slice& aRowGroupsToExclude);
|
1999-09-02 04:07:14 +04:00
|
|
|
|
2009-02-05 12:09:50 +03:00
|
|
|
nsTArray<nsTableColFrame*>& GetColCache();
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2011-10-27 17:58:44 +04:00
|
|
|
|
1998-10-14 20:32:45 +04:00
|
|
|
protected:
|
1998-06-17 20:38:24 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetBorderCollapse(bool aValue);
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2011-10-27 17:58:44 +04:00
|
|
|
BCPropertyData* GetBCProperty(bool aCreateIfNecessary = false) const;
|
|
|
|
void SetFullBCDamageArea();
|
2005-02-07 04:58:25 +03:00
|
|
|
void CalcBCBorders();
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2015-05-01 00:46:59 +03:00
|
|
|
void ExpandBCDamageArea(mozilla::TableArea& aRect) const;
|
2002-02-19 18:48:28 +03:00
|
|
|
|
2015-06-10 04:13:49 +03:00
|
|
|
void SetColumnDimensions(nscoord aHeight, WritingMode aWM,
|
2015-06-20 23:00:33 +03:00
|
|
|
const LogicalMargin& aBorderPadding,
|
2015-07-16 12:07:57 +03:00
|
|
|
const nsSize& aContainerSize);
|
1999-06-08 01:10:25 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t CollectRows(nsIFrame* aFrame,
|
2009-02-05 12:09:50 +03:00
|
|
|
nsTArray<nsTableRowFrame*>& aCollection);
|
1999-01-18 02:35:56 +03:00
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
public: /* ----- Cell Map public methods ----- */
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetStartRowIndex(nsTableRowGroupFrame* aRowGroupFrame);
|
2000-09-14 10:49:47 +04:00
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
/** returns the number of rows in this table.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetRowCount () const
|
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
|
|
|
{
|
|
|
|
return GetCellMap()->GetRowCount();
|
|
|
|
}
|
1998-06-17 20:38:24 +04:00
|
|
|
|
2015-04-17 21:42:05 +03:00
|
|
|
/** returns the number of columns in this table after redundant columns have been removed
|
1998-07-24 20:51:16 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetEffectiveColCount() const;
|
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
|
|
|
|
|
|
|
/* return the col count including dead cols */
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetColCount () const
|
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
|
|
|
{
|
|
|
|
return GetCellMap()->GetColCount();
|
|
|
|
}
|
1998-07-24 20:51:16 +04:00
|
|
|
|
2001-05-17 16:40:27 +04:00
|
|
|
// return the last col index which isn't of type eColAnonymousCell
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetIndexOfLastRealCol();
|
1998-06-17 20:38:24 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
/** returns true if table-layout:auto */
|
2013-02-04 01:54:07 +04:00
|
|
|
bool IsAutoLayout();
|
1998-10-21 00:05:44 +04:00
|
|
|
|
1998-12-03 21:01:35 +03:00
|
|
|
public:
|
2015-04-17 21:42:05 +03:00
|
|
|
|
2002-03-06 18:56:32 +03:00
|
|
|
#ifdef DEBUG
|
2011-09-29 10:19:26 +04:00
|
|
|
void Dump(bool aDumpRows,
|
2015-04-17 21:42:05 +03:00
|
|
|
bool aDumpCols,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDumpCellMap);
|
2001-09-24 18:48:38 +04:00
|
|
|
#endif
|
|
|
|
|
1999-02-04 01:35:03 +03:00
|
|
|
protected:
|
2012-12-01 04:10:40 +04:00
|
|
|
/**
|
|
|
|
* Helper method for RemoveFrame.
|
|
|
|
*/
|
|
|
|
void DoRemoveFrame(ChildListID aListID, nsIFrame* aOldFrame);
|
2002-03-06 18:56:32 +03:00
|
|
|
#ifdef DEBUG
|
2004-01-18 13:28:40 +03:00
|
|
|
void DumpRowGroup(nsIFrame* aChildFrame);
|
2002-03-06 18:56:32 +03:00
|
|
|
#endif
|
2001-03-13 09:38:59 +03:00
|
|
|
// DATA MEMBERS
|
2016-02-02 18:36:30 +03:00
|
|
|
AutoTArray<nsTableColFrame*, 8> mColFrames;
|
1999-10-05 03:48:05 +04:00
|
|
|
|
|
|
|
struct TableBits {
|
2012-08-22 19:56:38 +04: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;
|
2015-06-27 21:16:10 +03:00
|
|
|
uint32_t mIStartContBCBorder:8;
|
2016-01-27 19:02:12 +03:00
|
|
|
uint32_t mNeedToCollapse:1; // rows, cols that have visibility:collapse need to be collapsed
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mResizedColumns:1; // have we resized columns since last reflow?
|
1999-10-05 03:48:05 +04:00
|
|
|
} mBits;
|
|
|
|
|
2000-07-06 17:37:28 +04:00
|
|
|
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
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-09-30 03:15:01 +04:00
|
|
|
|
2016-08-28 05:31:50 +03:00
|
|
|
inline bool nsTableFrame::IsRowGroup(mozilla::StyleDisplay aDisplayType) const
|
1998-10-11 13:18:27 +04:00
|
|
|
{
|
2016-08-28 05:31:50 +03:00
|
|
|
return mozilla::StyleDisplay::TableHeaderGroup == aDisplayType ||
|
|
|
|
mozilla::StyleDisplay::TableFooterGroup == aDisplayType ||
|
|
|
|
mozilla::StyleDisplay::TableRowGroup == aDisplayType;
|
1998-10-11 13:18:27 +04:00
|
|
|
}
|
1998-10-15 02:12:06 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline void nsTableFrame::SetHaveReflowedColGroups(bool aValue)
|
2001-03-13 09:38:59 +03:00
|
|
|
{
|
|
|
|
mBits.mHaveReflowedColGroups = aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsTableFrame::HaveReflowedColGroups() const
|
2001-03-13 09:38:59 +03:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
return (bool)mBits.mHaveReflowedColGroups;
|
2001-03-13 09:38:59 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsTableFrame::HasPctCol() const
|
2001-03-13 09:38:59 +03:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
return (bool)mBits.mHasPctCol;
|
2001-03-13 09:38:59 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline void nsTableFrame::SetHasPctCol(bool aValue)
|
2001-03-13 09:38:59 +03:00
|
|
|
{
|
|
|
|
mBits.mHasPctCol = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsTableFrame::HasCellSpanningPctCol() const
|
1999-10-04 09:19:32 +04:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
return (bool)mBits.mCellSpansPctCol;
|
1999-10-04 09:19:32 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline void nsTableFrame::SetHasCellSpanningPctCol(bool aValue)
|
1999-10-04 09:19:32 +04:00
|
|
|
{
|
2000-09-09 05:46:44 +04:00
|
|
|
mBits.mCellSpansPctCol = (unsigned)aValue;
|
1999-10-04 09:19:32 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsTableFrame::IsRowInserted() const
|
2001-08-06 18:48:09 +04:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
return (bool)mBits.mRowInserted;
|
2001-08-06 18:48:09 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline void nsTableFrame::SetRowInserted(bool aValue)
|
2001-08-06 18:48:09 +04:00
|
|
|
{
|
|
|
|
mBits.mRowInserted = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline void nsTableFrame::SetNeedToCollapse(bool aValue)
|
2004-04-28 20:42:59 +04:00
|
|
|
{
|
2013-09-25 15:42:34 +04:00
|
|
|
static_cast<nsTableFrame*>(FirstInFlow())->mBits.mNeedToCollapse = (unsigned)aValue;
|
2004-04-28 20:42:59 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsTableFrame::NeedToCollapse() const
|
2004-04-28 20:42:59 +04:00
|
|
|
{
|
2013-09-25 15:42:34 +04:00
|
|
|
return (bool) static_cast<nsTableFrame*>(FirstInFlow())->mBits.mNeedToCollapse;
|
2004-04-28 20:42:59 +04:00
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
inline nsFrameList& nsTableFrame::GetColGroups()
|
|
|
|
{
|
2013-09-25 15:42:34 +04:00
|
|
|
return static_cast<nsTableFrame*>(FirstInFlow())->mColGroups;
|
1999-12-14 01:56:31 +03:00
|
|
|
}
|
|
|
|
|
2009-02-05 12:09:50 +03:00
|
|
|
inline nsTArray<nsTableColFrame*>& nsTableFrame::GetColCache()
|
1999-12-14 01:56:31 +03:00
|
|
|
{
|
|
|
|
return mColFrames;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsTableFrame::IsBorderCollapse() const
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
return (bool)mBits.mIsBorderCollapse;
|
2002-02-19 18:48:28 +03:00
|
|
|
}
|
|
|
|
|
2015-04-17 21:42:05 +03:00
|
|
|
inline void nsTableFrame::SetBorderCollapse(bool aValue)
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
|
|
|
mBits.mIsBorderCollapse = aValue;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsTableFrame::NeedToCalcBCBorders() const
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
return (bool)mBits.mNeedToCalcBCBorders;
|
2002-02-19 18:48:28 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline void nsTableFrame::SetNeedToCalcBCBorders(bool aValue)
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
|
|
|
mBits.mNeedToCalcBCBorders = (unsigned)aValue;
|
|
|
|
}
|
2001-03-13 09:38:59 +03:00
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
inline nscoord
|
2015-06-27 21:16:10 +03:00
|
|
|
nsTableFrame::GetContinuousIStartBCBorderWidth() const
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
|
2015-06-27 21:16:10 +03:00
|
|
|
return BC_BORDER_END_HALF_COORD(aPixelsToTwips, mBits.mIStartContBCBorder);
|
2004-03-09 09:48:35 +03:00
|
|
|
}
|
|
|
|
|
2015-06-27 21:16:10 +03:00
|
|
|
inline void nsTableFrame::SetContinuousIStartBCBorderWidth(nscoord aValue)
|
2009-06-21 20:31:40 +04:00
|
|
|
{
|
2015-06-27 21:16:10 +03:00
|
|
|
mBits.mIStartContBCBorder = (unsigned) aValue;
|
2009-06-21 20:31:40 +04:00
|
|
|
}
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
#define ABORT0() \
|
2011-10-17 18:59:28 +04:00
|
|
|
{NS_ASSERTION(false, "CellIterator program error"); \
|
2002-02-19 18:48:28 +03:00
|
|
|
return;}
|
|
|
|
|
|
|
|
#define ABORT1(aReturn) \
|
2011-10-17 18:59:28 +04:00
|
|
|
{NS_ASSERTION(false, "CellIterator program error"); \
|
2015-04-17 21:42:05 +03:00
|
|
|
return aReturn;}
|
2002-02-19 18:48:28 +03:00
|
|
|
|
1998-10-15 02:12:06 +04:00
|
|
|
#endif
|