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 nsTableColGroupFrame_h__
|
|
|
|
#define nsTableColGroupFrame_h__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nscore.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2015-04-30 07:24:59 +03:00
|
|
|
#include "nsTableFrame.h"
|
2015-04-30 07:24:59 +03:00
|
|
|
#include "mozilla/WritingModes.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-09-24 20:37:22 +04:00
|
|
|
class nsTableColFrame;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* nsTableColGroupFrame
|
|
|
|
* data structure to maintain information about a single table cell's frame
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsTableColGroupFrame final : public nsContainerFrame {
|
1998-04-14 00:24:54 +04:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
|
1998-12-03 23:19:01 +03:00
|
|
|
|
2018-12-05 21:44:03 +03:00
|
|
|
/**
|
|
|
|
* instantiate a new instance of nsTableRowFrame.
|
|
|
|
*
|
2005-11-04 05:38:33 +03:00
|
|
|
* @param aPresShell the pres shell for this frame
|
1998-09-15 21:58:24 +04:00
|
|
|
*
|
2005-11-04 05:38:33 +03:00
|
|
|
* @return the frame that was created
|
1998-09-15 21:58:24 +04:00
|
|
|
*/
|
2014-05-25 02:20:40 +04:00
|
|
|
friend nsTableColGroupFrame* NS_NewTableColGroupFrame(
|
|
|
|
nsIPresShell* aPresShell, ComputedStyle* aStyle);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2017-02-28 20:58:30 +03:00
|
|
|
// nsIFrame overrides
|
|
|
|
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) override {
|
|
|
|
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
|
|
|
if (!aPrevInFlow) {
|
|
|
|
mWritingMode = GetTableFrame()->GetWritingMode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-30 07:24:59 +03:00
|
|
|
nsTableFrame* GetTableFrame() const {
|
|
|
|
nsIFrame* parent = GetParent();
|
2017-04-30 18:30:08 +03:00
|
|
|
MOZ_ASSERT(parent && parent->IsTableFrame());
|
2015-05-20 04:29:43 +03:00
|
|
|
MOZ_ASSERT(!parent->GetPrevInFlow(),
|
|
|
|
"Col group should always be in a first-in-flow table frame");
|
2015-04-30 07:24:59 +03:00
|
|
|
return static_cast<nsTableFrame*>(parent);
|
|
|
|
}
|
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2017-05-05 09:30:15 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** A colgroup can be caused by three things:
|
2017-09-01 23:30:57 +03:00
|
|
|
* 1) An element with table-column-group display
|
|
|
|
* 2) An element with a table-column display without a
|
|
|
|
* table-column-group parent
|
|
|
|
* 3) Cells that are not in a column (and hence get an anonymous
|
|
|
|
* column and colgroup).
|
|
|
|
*
|
|
|
|
* In practice, we don't need to differentiate between cases (1) and (2),
|
|
|
|
* because they both correspond to table-column-group boxes in the spec and
|
|
|
|
* hence have observably identical behavior. Case three is flagged as a
|
|
|
|
* synthetic colgroup, because it may need to have different behavior in some
|
|
|
|
* cases.
|
2004-05-03 22:31:34 +04:00
|
|
|
*/
|
2017-09-01 23:30:57 +03:00
|
|
|
bool IsSynthetic() const;
|
|
|
|
void SetIsSynthetic();
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** Real in this context are colgroups that come from an element
|
|
|
|
* with table-column-group display or wrap around columns that
|
|
|
|
* come from an element with table-column display. Colgroups
|
|
|
|
* that are the result of wrapping cells in an anonymous
|
|
|
|
* column and colgroup are not considered real here.
|
|
|
|
* @param aTableFrame - the table parent of the colgroups
|
2009-07-30 21:23:32 +04:00
|
|
|
* @return the last real colgroup
|
2004-05-03 22:31:34 +04:00
|
|
|
*/
|
2009-07-30 21:23:32 +04:00
|
|
|
static nsTableColGroupFrame* GetLastRealColGroup(nsTableFrame* aTableFrame);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
/** @see nsIFrame::DidSetComputedStyle */
|
|
|
|
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
2008-10-26 13:11:34 +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, 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, nsIFrame* aOldFrame) override;
|
1999-08-06 18:34:56 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** remove the column aChild from the column group, if requested renumber
|
|
|
|
* the subsequent columns in this column group and all following column
|
|
|
|
* groups. see also ResetColIndices for this
|
|
|
|
* @param aChild - the column frame that needs to be removed
|
|
|
|
* @param aResetSubsequentColIndices - if true the columns that follow
|
|
|
|
* after aChild will be reenumerated
|
|
|
|
*/
|
2005-02-07 04:58:25 +03:00
|
|
|
void RemoveChild(nsTableColFrame& aChild, bool aResetSubsequentColIndices);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
1998-05-29 01:39:22 +04:00
|
|
|
/** reflow of a column group is a trivial matter of reflowing
|
|
|
|
* the col group's children (columns), and setting this frame
|
|
|
|
* to 0-size. Since tables are row-centric, column group frames
|
|
|
|
* don't play directly in the rendering game. They do however
|
|
|
|
* maintain important state that effects table and cell layout.
|
|
|
|
*/
|
2017-04-30 18:30:08 +03:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2017-04-30 18:30:08 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2004-05-03 22:31:34 +04:00
|
|
|
|
|
|
|
/** Add column frames to the table storages: colframe cache and cellmap
|
|
|
|
* this doesn't change the mFrames of the colgroup frame.
|
|
|
|
* @param aFirstColIndex - the index at which aFirstFrame should be inserted
|
|
|
|
* into the colframe cache.
|
|
|
|
* @param aResetSubsequentColIndices - the indices of the col frames
|
|
|
|
* after the insertion might need
|
|
|
|
* an update
|
2009-07-30 21:23:32 +04:00
|
|
|
* @param aCols - an iterator that can be used to iterate over the col
|
|
|
|
* frames to be added. Once this is done, the frames on the
|
|
|
|
* sbling chain of its .get() at that point will still need
|
|
|
|
* their col indices updated.
|
2004-05-03 22:31:34 +04:00
|
|
|
* @result - if there is no table frame or the table frame is not
|
|
|
|
* the first in flow it will return an error
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult AddColsToTable(int32_t aFirstColIndex,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aResetSubsequentColIndices,
|
2009-07-30 21:23:32 +04:00
|
|
|
const nsFrameList::Slice& aCols);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2012-08-22 19:56:38 +04:00
|
|
|
void Dump(int32_t aIndent);
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1998-11-19 20:22:29 +03:00
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
/** returns the number of columns represented by this group.
|
|
|
|
* if there are col children, count them (taking into account the span of
|
|
|
|
* each) else, check my own span attribute.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual int32_t GetColCount() const;
|
1998-06-17 20:38:24 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** first column on the child list */
|
|
|
|
nsTableColFrame* GetFirstColumn();
|
|
|
|
/** next sibling to aChildFrame that is a column frame, first column frame
|
|
|
|
* in the column group if aChildFrame is null
|
|
|
|
*/
|
|
|
|
nsTableColFrame* GetNextColumn(nsIFrame* aChildFrame);
|
1998-10-15 02:51:50 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** @return - the position of the first column in this colgroup in the table
|
|
|
|
* colframe cache.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetStartColumnIndex();
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** set the position of the first column in this colgroup in the table
|
|
|
|
* colframe cache.
|
1998-10-15 02:51:50 +04:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetStartColumnIndex(int32_t aIndex);
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-24 01:48:26 +04:00
|
|
|
/** helper method to get the span attribute for this colgroup */
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetSpan();
|
1998-09-24 01:48:26 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** provide access to the mFrames list
|
|
|
|
*/
|
2009-07-28 16:53:18 +04:00
|
|
|
nsFrameList& GetWritableChildList();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** set the column index for all frames starting at aStartColFrame, it
|
|
|
|
* will also reset the column indices in all subsequent colgroups
|
|
|
|
* @param aFirstColGroup - start the reset operation inside this colgroup
|
|
|
|
* @param aFirstColIndex - first column that is reset should get this index
|
|
|
|
* @param aStartColFrame - if specified the reset starts with this column
|
|
|
|
* inside the colgroup; if not specified, the reset
|
|
|
|
* starts with the first column
|
|
|
|
*/
|
2004-01-18 13:28:40 +03:00
|
|
|
static void ResetColIndices(nsIFrame* aFirstColGroup, int32_t aFirstColIndex,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsIFrame* aStartColFrame = nullptr);
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets inner border widths before collapsing with cell borders
|
2015-06-24 19:56:54 +03:00
|
|
|
* Caller must get istart border from previous column
|
|
|
|
* GetContinuousBCBorderWidth will not overwrite aBorder.IStart
|
2004-03-09 09:48:35 +03:00
|
|
|
* see nsTablePainter about continuous borders
|
|
|
|
*/
|
2015-06-24 19:56:54 +03:00
|
|
|
void GetContinuousBCBorderWidth(mozilla::WritingMode aWM,
|
|
|
|
mozilla::LogicalMargin& aBorder);
|
2004-03-09 09:48:35 +03:00
|
|
|
/**
|
|
|
|
* Set full border widths before collapsing with cell borders
|
2015-06-24 19:56:54 +03:00
|
|
|
* @param aForSide - side to set; only accepts bstart and bend
|
2004-03-09 09:48:35 +03:00
|
|
|
*/
|
2015-06-24 19:56:54 +03:00
|
|
|
void SetContinuousBCBorderWidth(mozilla::LogicalSide aForSide,
|
2004-03-09 09:48:35 +03:00
|
|
|
BCPixelSize aPixelValue);
|
2013-03-08 06:18:45 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2018-08-08 01:02:07 +03:00
|
|
|
if (aFlags & eSupportsContainLayoutAndPaint) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-08 06:18:45 +04:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eTablePart));
|
|
|
|
}
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2018-04-04 07:15:49 +03:00
|
|
|
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0,
|
|
|
|
bool aRebuildDisplayItems = true) override;
|
|
|
|
virtual void InvalidateFrameWithRect(
|
|
|
|
const nsRect& aRect, uint32_t aDisplayItemKey = 0,
|
|
|
|
bool aRebuildDisplayItems = true) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void InvalidateFrameForRemoval() override {
|
|
|
|
InvalidateFrameSubtree();
|
|
|
|
}
|
2012-08-29 09:39:31 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
protected:
|
2018-03-22 21:20:41 +03:00
|
|
|
explicit nsTableColGroupFrame(ComputedStyle* aStyle);
|
1999-08-10 06:45:18 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void InsertColsReflow(int32_t aColIndex, const nsFrameList::Slice& aCols);
|
1999-12-14 01:56:31 +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
|
|
|
|
2001-11-30 18:05:51 +03:00
|
|
|
// data members
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mColCount;
|
2017-04-30 18:30:08 +03:00
|
|
|
// the starting column index this col group represents. Must be >= 0.
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mStartColIndex;
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
// border width in pixels
|
2015-06-24 19:56:54 +03:00
|
|
|
BCPixelSize mBStartContBorderWidth;
|
|
|
|
BCPixelSize mBEndContBorderWidth;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
inline nsTableColGroupFrame::nsTableColGroupFrame(ComputedStyle* aStyle)
|
|
|
|
: nsContainerFrame(aStyle, kClassID), mColCount(0), mStartColIndex(0) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline int32_t nsTableColGroupFrame::GetStartColumnIndex() {
|
1999-12-14 01:56:31 +03:00
|
|
|
return mStartColIndex;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline void nsTableColGroupFrame::SetStartColumnIndex(int32_t aIndex) {
|
2004-05-03 22:31:34 +04:00
|
|
|
mStartColIndex = aIndex;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline int32_t nsTableColGroupFrame::GetColCount() const { return mColCount; }
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2009-07-28 16:53:18 +04:00
|
|
|
inline nsFrameList& nsTableColGroupFrame::GetWritableChildList() {
|
1999-12-14 01:56:31 +03:00
|
|
|
return mFrames;
|
|
|
|
}
|
1999-08-10 06:45:18 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif
|