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-05-30 02:08:19 +04:00
|
|
|
#ifndef nsTableColFrame_h__
|
|
|
|
#define nsTableColFrame_h__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1998-05-30 02:08:19 +04:00
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsContainerFrame.h"
|
2004-03-09 09:48:35 +03:00
|
|
|
#include "nsTablePainter.h"
|
2009-02-05 12:09:50 +03:00
|
|
|
#include "nsTArray.h"
|
1998-05-30 02:08:19 +04:00
|
|
|
|
1999-08-19 23:52:37 +04:00
|
|
|
class nsTableCellFrame;
|
1999-04-13 05:15:16 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
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
|
2001-11-30 18:05:51 +03:00
|
|
|
eColAnonymousCell = 3 // the result of a cell alone
|
1999-12-14 01:56:31 +03:00
|
|
|
};
|
|
|
|
|
2007-12-03 10:45:06 +03:00
|
|
|
class nsTableColFrame : public nsSplittableFrame {
|
1998-05-30 02:08:19 +04:00
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1998-06-11 04:13:18 +04:00
|
|
|
|
1998-07-22 07:53:43 +04:00
|
|
|
enum {eWIDTH_SOURCE_NONE =0, // no cell has contributed to the width style
|
|
|
|
eWIDTH_SOURCE_CELL =1, // a cell specified a width
|
|
|
|
eWIDTH_SOURCE_CELL_WITH_SPAN=2 // a cell implicitly specified a width via colspan
|
|
|
|
};
|
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
nsTableColType GetColType() const;
|
|
|
|
void SetColType(nsTableColType aType);
|
1998-09-15 21:58:24 +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-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
|
|
|
*/
|
2007-11-18 21:56:49 +03:00
|
|
|
friend nsTableColFrame* NS_NewTableColFrame(nsIPresShell* aPresShell,
|
|
|
|
nsStyleContext* aContext);
|
2008-10-26 13:11:34 +03:00
|
|
|
/** @see nsIFrame::DidSetStyleContext */
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
|
2008-10-26 13:11:34 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetColIndex() const;
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetColIndex (int32_t aColIndex);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
nsTableColFrame* GetNextCol() const;
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
1998-05-30 02:08:19 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* Table columns never paint anything, nor receive events.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) { return NS_OK; }
|
|
|
|
|
1999-10-02 04:02:54 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::tableColFrame
|
1999-10-02 04:02:54 +04:00
|
|
|
*/
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
1999-10-02 04:02:54 +04:00
|
|
|
|
1999-09-01 05:02:16 +04:00
|
|
|
#ifdef DEBUG
|
2012-09-14 20:10:08 +04:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1998-11-19 20:22:29 +03:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
|
2007-12-03 10:45:06 +03:00
|
|
|
|
2007-11-18 21:56:49 +03:00
|
|
|
/** return the number of the columns the col represents. always >= 1 */
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetSpan();
|
1998-06-11 04:13:18 +04:00
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
/** convenience method, calls into cellmap */
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t Count() const;
|
1998-07-11 04:00:31 +04:00
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
nscoord GetLeftBorderWidth();
|
2004-03-09 09:48:35 +03:00
|
|
|
void SetLeftBorderWidth(BCPixelSize aWidth);
|
2007-02-07 10:46:44 +03:00
|
|
|
nscoord GetRightBorderWidth();
|
2004-03-09 09:48:35 +03:00
|
|
|
void SetRightBorderWidth(BCPixelSize aWidth);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets inner border widths before collapsing with cell borders
|
|
|
|
* Caller must get left border from previous column or from table
|
|
|
|
* GetContinuousBCBorderWidth will not overwrite aBorder.left
|
|
|
|
* see nsTablePainter about continuous borders
|
|
|
|
*
|
|
|
|
* @return outer right border width (left inner for next column)
|
|
|
|
*/
|
2007-02-07 10:46:44 +03:00
|
|
|
nscoord GetContinuousBCBorderWidth(nsMargin& aBorder);
|
2004-03-09 09:48:35 +03:00
|
|
|
/**
|
|
|
|
* Set full border widths before collapsing with cell borders
|
|
|
|
* @param aForSide - side to set; only valid for top, right, and bottom
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetContinuousBCBorderWidth(uint8_t aForSide,
|
2004-03-09 09:48:35 +03:00
|
|
|
BCPixelSize aPixelValue);
|
2004-09-04 20:02:50 +04:00
|
|
|
#ifdef DEBUG
|
2012-08-22 19:56:38 +04:00
|
|
|
void Dump(int32_t aIndent);
|
2004-09-04 20:02:50 +04:00
|
|
|
#endif
|
1999-07-28 12:09:02 +04:00
|
|
|
|
2007-03-19 23:26:36 +03:00
|
|
|
/**
|
|
|
|
* Restore the default values of the intrinsic widths, so that we can
|
|
|
|
* re-accumulate intrinsic widths from the cells in the column.
|
|
|
|
*/
|
|
|
|
void ResetIntrinsics() {
|
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
|
|
|
mMinCoord = 0;
|
2007-03-19 23:26:36 +03:00
|
|
|
mPrefCoord = 0;
|
|
|
|
mPrefPercent = 0.0f;
|
2011-10-17 18:59:28 +04:00
|
|
|
mHasSpecifiedCoord = false;
|
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
|
|
|
}
|
2007-03-19 23:26:36 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Restore the default value of the preferred percentage width (the
|
|
|
|
* only intrinsic width used by FixedTableLayoutStrategy.
|
|
|
|
*/
|
|
|
|
void ResetPrefPercent() {
|
|
|
|
mPrefPercent = 0.0f;
|
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
|
|
|
}
|
|
|
|
|
2007-03-19 23:26:36 +03:00
|
|
|
/**
|
|
|
|
* Restore the default values of the temporary buffer for
|
|
|
|
* spanning-cell intrinsic widths (as we process spanning cells).
|
|
|
|
*/
|
|
|
|
void ResetSpanIntrinsics() {
|
|
|
|
mSpanMinCoord = 0;
|
|
|
|
mSpanPrefCoord = 0;
|
|
|
|
mSpanPrefPercent = 0.0f;
|
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
|
|
|
}
|
2007-03-19 23:26:36 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the widths for a cell or column element, or the contribution of
|
|
|
|
* the widths from a column-spanning cell:
|
|
|
|
* @param aMinCoord The minimum intrinsic width
|
|
|
|
* @param aPrefCoord The preferred intrinsic width or, if there is a
|
|
|
|
* specified non-percentage width, max(specified width, minimum intrinsic
|
|
|
|
* width).
|
|
|
|
* @param aHasSpecifiedCoord Whether there is a specified
|
|
|
|
* non-percentage width.
|
|
|
|
*
|
|
|
|
* Note that the implementation of this functions is a bit tricky
|
|
|
|
* since mPrefCoord means different things depending on
|
|
|
|
* whether mHasSpecifiedCoord is true (and likewise for aPrefCoord and
|
|
|
|
* aHasSpecifiedCoord). If mHasSpecifiedCoord is false, then
|
|
|
|
* all widths added had aHasSpecifiedCoord false and mPrefCoord is the
|
|
|
|
* largest of the pref widths. But if mHasSpecifiedCoord is true,
|
|
|
|
* then mPrefCoord is the largest of (1) the pref widths for cells
|
|
|
|
* with aHasSpecifiedCoord true and (2) the min widths for cells with
|
|
|
|
* aHasSpecifiedCoord false.
|
|
|
|
*/
|
|
|
|
void AddCoords(nscoord aMinCoord, nscoord aPrefCoord,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aHasSpecifiedCoord) {
|
2007-03-19 23:26:36 +03:00
|
|
|
NS_ASSERTION(aMinCoord <= aPrefCoord, "intrinsic widths out of order");
|
|
|
|
|
|
|
|
if (aHasSpecifiedCoord && !mHasSpecifiedCoord) {
|
|
|
|
mPrefCoord = mMinCoord;
|
2011-10-17 18:59:28 +04:00
|
|
|
mHasSpecifiedCoord = true;
|
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
|
|
|
}
|
2007-03-19 23:26:36 +03:00
|
|
|
if (!aHasSpecifiedCoord && mHasSpecifiedCoord) {
|
|
|
|
aPrefCoord = aMinCoord; // NOTE: modifying argument
|
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
|
|
|
}
|
|
|
|
|
2007-03-19 23:26:36 +03:00
|
|
|
if (aMinCoord > mMinCoord)
|
|
|
|
mMinCoord = aMinCoord;
|
|
|
|
if (aPrefCoord > mPrefCoord)
|
|
|
|
mPrefCoord = aPrefCoord;
|
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
|
|
|
|
2007-03-19 23:26:36 +03:00
|
|
|
NS_ASSERTION(mMinCoord <= mPrefCoord, "min larger than pref");
|
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
|
|
|
}
|
2007-03-19 23:26:36 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a percentage width specified on a cell or column element or the
|
|
|
|
* contribution to this column of a percentage width specified on a
|
|
|
|
* column-spanning cell.
|
|
|
|
*/
|
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 AddPrefPercent(float aPrefPercent) {
|
|
|
|
if (aPrefPercent > mPrefPercent)
|
|
|
|
mPrefPercent = aPrefPercent;
|
|
|
|
}
|
|
|
|
|
2007-03-19 23:26:36 +03:00
|
|
|
/**
|
|
|
|
* Get the largest minimum intrinsic width for this column.
|
|
|
|
*/
|
|
|
|
nscoord GetMinCoord() const { return mMinCoord; }
|
|
|
|
/**
|
|
|
|
* Get the largest preferred width for this column, or, if there were
|
|
|
|
* any specified non-percentage widths (see GetHasSpecifiedCoord), the
|
|
|
|
* largest minimum intrinsic width or specified width.
|
|
|
|
*/
|
|
|
|
nscoord GetPrefCoord() const { return mPrefCoord; }
|
|
|
|
/**
|
|
|
|
* Get whether there were any specified widths contributing to this
|
|
|
|
* column.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetHasSpecifiedCoord() const { return mHasSpecifiedCoord; }
|
2007-03-19 23:26:36 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the largest specified percentage width contributing to this
|
|
|
|
* column (returns 0 if there were none).
|
|
|
|
*/
|
|
|
|
float GetPrefPercent() const { return mPrefPercent; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Like AddCoords, but into a temporary buffer used for groups of
|
|
|
|
* column-spanning cells.
|
|
|
|
*/
|
|
|
|
void AddSpanCoords(nscoord aSpanMinCoord, nscoord aSpanPrefCoord,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aSpanHasSpecifiedCoord) {
|
2007-03-19 23:26:36 +03:00
|
|
|
NS_ASSERTION(aSpanMinCoord <= aSpanPrefCoord,
|
|
|
|
"intrinsic widths out of order");
|
|
|
|
|
2008-01-18 07:18:21 +03:00
|
|
|
if (!aSpanHasSpecifiedCoord && mHasSpecifiedCoord) {
|
2007-03-19 23:26:36 +03:00
|
|
|
aSpanPrefCoord = aSpanMinCoord; // NOTE: modifying argument
|
|
|
|
}
|
|
|
|
|
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
|
|
|
if (aSpanMinCoord > mSpanMinCoord)
|
|
|
|
mSpanMinCoord = aSpanMinCoord;
|
|
|
|
if (aSpanPrefCoord > mSpanPrefCoord)
|
|
|
|
mSpanPrefCoord = aSpanPrefCoord;
|
|
|
|
|
2007-03-19 23:26:36 +03:00
|
|
|
NS_ASSERTION(mSpanMinCoord <= mSpanPrefCoord, "min larger than pref");
|
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
|
|
|
}
|
2007-03-19 23:26:36 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Accumulate percentage widths on column spanning cells into
|
|
|
|
* temporary variables.
|
|
|
|
*/
|
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 AddSpanPrefPercent(float aSpanPrefPercent) {
|
|
|
|
if (aSpanPrefPercent > mSpanPrefPercent)
|
|
|
|
mSpanPrefPercent = aSpanPrefPercent;
|
|
|
|
}
|
2007-03-19 23:26:36 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Accumulate the temporary variables for column spanning cells into
|
|
|
|
* the primary variables.
|
|
|
|
*/
|
|
|
|
void AccumulateSpanIntrinsics() {
|
2008-01-18 07:18:21 +03:00
|
|
|
AddCoords(mSpanMinCoord, mSpanPrefCoord, mHasSpecifiedCoord);
|
2007-03-19 23:26:36 +03:00
|
|
|
AddPrefPercent(mSpanPrefPercent);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// Used to adjust a column's pref percent so that the table's total
|
|
|
|
// never exceeeds 100% (by only allowing percentages to be used,
|
|
|
|
// starting at the first column, until they reach 100%).
|
|
|
|
void AdjustPrefPercent(float *aTableTotalPercent) {
|
|
|
|
float allowed = 1.0f - *aTableTotalPercent;
|
|
|
|
if (mPrefPercent > allowed)
|
|
|
|
mPrefPercent = allowed;
|
|
|
|
*aTableTotalPercent += mPrefPercent;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The final width of the column.
|
|
|
|
void ResetFinalWidth() {
|
|
|
|
mFinalWidth = nscoord_MIN; // so we detect that it changed
|
|
|
|
}
|
|
|
|
void SetFinalWidth(nscoord aFinalWidth) {
|
|
|
|
mFinalWidth = aFinalWidth;
|
|
|
|
}
|
|
|
|
nscoord GetFinalWidth() {
|
|
|
|
return mFinalWidth;
|
|
|
|
}
|
2012-08-29 09:39:31 +04:00
|
|
|
|
2012-08-29 09:48:45 +04:00
|
|
|
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) MOZ_OVERRIDE;
|
|
|
|
virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) MOZ_OVERRIDE;
|
|
|
|
virtual void InvalidateFrameForRemoval() MOZ_OVERRIDE { InvalidateFrameSubtree(); }
|
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
|
|
|
|
1998-05-30 02:08:19 +04:00
|
|
|
protected:
|
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
nsTableColFrame(nsStyleContext* aContext);
|
1999-07-28 12:09:02 +04:00
|
|
|
~nsTableColFrame();
|
1998-05-30 02:08:19 +04:00
|
|
|
|
2009-05-12 14:13:09 +04:00
|
|
|
nscoord mMinCoord;
|
|
|
|
nscoord mPrefCoord;
|
|
|
|
nscoord mSpanMinCoord; // XXX...
|
|
|
|
nscoord mSpanPrefCoord; // XXX...
|
|
|
|
float mPrefPercent;
|
|
|
|
float mSpanPrefPercent; // XXX...
|
|
|
|
// ...XXX the four members marked above could be allocated as part of
|
|
|
|
// a separate array allocated only during
|
|
|
|
// BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths (and only
|
|
|
|
// when colspans were present).
|
|
|
|
nscoord mFinalWidth;
|
|
|
|
|
2005-09-12 17:44:15 +04:00
|
|
|
// the index of the column with respect to the whole tabble (starting at 0)
|
|
|
|
// it should never be smaller then the start column index of the parent
|
|
|
|
// colgroup
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mColIndex: 16;
|
2004-03-09 09:48:35 +03:00
|
|
|
|
2005-04-07 22:04:38 +04:00
|
|
|
// border width in pixels of the inner half of the border only
|
2004-03-09 09:48:35 +03:00
|
|
|
BCPixelSize mLeftBorderWidth;
|
|
|
|
BCPixelSize mRightBorderWidth;
|
|
|
|
BCPixelSize mTopContBorderWidth;
|
|
|
|
BCPixelSize mRightContBorderWidth;
|
|
|
|
BCPixelSize mBottomContBorderWidth;
|
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
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasSpecifiedCoord;
|
1998-05-30 02:08:19 +04:00
|
|
|
};
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline int32_t nsTableColFrame::GetColIndex() const
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2002-02-19 18:48:28 +03:00
|
|
|
return mColIndex;
|
|
|
|
}
|
1998-06-11 04:13:18 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline void nsTableColFrame::SetColIndex (int32_t aColIndex)
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
|
|
|
mColIndex = aColIndex;
|
|
|
|
}
|
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
inline nscoord nsTableColFrame::GetLeftBorderWidth()
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
2007-02-07 10:46:44 +03:00
|
|
|
return mLeftBorderWidth;
|
2002-02-19 18:48:28 +03:00
|
|
|
}
|
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
inline void nsTableColFrame::SetLeftBorderWidth(BCPixelSize aWidth)
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
|
|
|
mLeftBorderWidth = aWidth;
|
|
|
|
}
|
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
inline nscoord nsTableColFrame::GetRightBorderWidth()
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
2007-02-07 10:46:44 +03:00
|
|
|
return mRightBorderWidth;
|
2002-02-19 18:48:28 +03:00
|
|
|
}
|
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
inline void nsTableColFrame::SetRightBorderWidth(BCPixelSize aWidth)
|
2002-02-19 18:48:28 +03:00
|
|
|
{
|
|
|
|
mRightBorderWidth = aWidth;
|
|
|
|
}
|
1998-06-11 04:13:18 +04:00
|
|
|
|
2004-03-09 09:48:35 +03:00
|
|
|
inline nscoord
|
2007-02-07 10:46:44 +03:00
|
|
|
nsTableColFrame::GetContinuousBCBorderWidth(nsMargin& aBorder)
|
2004-03-09 09:48:35 +03:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aPixelsToTwips = nsPresContext::AppUnitsPerCSSPixel();
|
2004-03-09 09:48:35 +03:00
|
|
|
aBorder.top = BC_BORDER_BOTTOM_HALF_COORD(aPixelsToTwips,
|
|
|
|
mTopContBorderWidth);
|
|
|
|
aBorder.right = BC_BORDER_LEFT_HALF_COORD(aPixelsToTwips,
|
|
|
|
mRightContBorderWidth);
|
|
|
|
aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips,
|
|
|
|
mBottomContBorderWidth);
|
|
|
|
return BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips, mRightContBorderWidth);
|
|
|
|
}
|
|
|
|
|
1998-05-30 02:08:19 +04:00
|
|
|
#endif
|
|
|
|
|