bug 11944 - row group is properly offset using table border. cleaned up new incremental reflow methods.

git-svn-id: svn://10.0.0.236/trunk@43899 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
karnaze%netscape.com
1999-08-20 23:27:54 +00:00
parent 7ff87b81d8
commit ecc88ac54d
14 changed files with 64 additions and 58 deletions

View File

@@ -131,7 +131,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidthIn)
{
//mTableFrame->Dump(PR_TRUE, PR_FALSE);
mTableFrame->Dump(PR_TRUE, PR_FALSE);
ContinuingFrameCheck();
if (!aTableStyle) {
NS_ASSERTION(aTableStyle, "bad style arg");
@@ -1250,10 +1250,9 @@ void BasicTableLayoutStrategy::AllocateConstrained(PRInt32 aAvailWidth,
// from AssignPreliminarColumnWidths and AssignPercentageColumnWidths. For now, pessimistic
// assumptions are made
PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth) const
const nsTableCellFrame& aCellFrame) const
{
if (aConsiderMinWidth || !mTableFrame)
if (!mTableFrame)
return PR_TRUE;
const nsStylePosition* cellPosition;
@@ -1381,7 +1380,7 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
minChanged = PR_FALSE;
}
if (minChanged) {
return PR_TRUE; // XXX add cases where table has coord width and cell is constrained
return PR_FALSE; // XXX add cases where table has coord width and cell is constrained
}
PRBool desChanged = PR_FALSE;
@@ -1396,26 +1395,26 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
(colFrame->GetWidth(MIN_PRO) > 0)) {
if ((colFrame->GetWidth(PCT_ADJ) > 0) && (colFrame->GetWidth(PCT) <= 0)) {
if (desChanged) {
return PR_TRUE; // XXX add cases where table has coord width
return PR_FALSE; // XXX add cases where table has coord width
}
}
if ((colFrame->GetWidth(FIX_ADJ) > 0) && (colFrame->GetWidth(FIX) <= 0)) {
if (desChanged) {
return PR_TRUE; // its unfortunate that the balancing algorithms cause this
return PR_FALSE; // its unfortunate that the balancing algorithms cause this
// XXX add cases where table has coord width
}
}
}
else { // the column width is not constrained
if (desChanged) {
return PR_TRUE;
return PR_FALSE;
}
}
}
else {
return PR_TRUE; // XXX this needs a lot of cases
return PR_FALSE; // XXX this needs a lot of cases
}
return PR_FALSE;
return PR_TRUE;
}
PRBool BasicTableLayoutStrategy::IsColumnInList(const PRInt32 colIndex,

View File

@@ -154,8 +154,7 @@ protected:
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const;
const nsTableCellFrame& aCellFrame) const;
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(const nsTableCellFrame& aCellFrame,

View File

@@ -184,8 +184,7 @@ PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aComputed
}
PRBool FixedTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth) const
const nsTableCellFrame& aCellFrame) const
{
return ColumnsCanBeInvalidatedBy(aCellFrame);
}
@@ -199,9 +198,9 @@ PRBool FixedTableLayoutStrategy::ColumnsCanBeInvalidatedBy(const nsTableCellFram
if (0 == rowIndex) {
// It is not worth the effort to determine if the col or cell determined the col
// width. Since rebalancing the columns is fairly trival in this strategy, just force it.
return PR_FALSE;
return PR_TRUE;
}
return PR_TRUE;
return PR_FALSE;
}
PRBool FixedTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCellFrame,
@@ -209,7 +208,7 @@ PRBool FixedTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
nscoord aPrevCellDes) const
{
// take the easy way out, see comments above.
return ColumnsCanBeInvalidatedBy(aCellFrame);
return !ColumnsCanBeInvalidatedBy(aCellFrame);
}

View File

@@ -60,8 +60,7 @@ public:
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const;
const nsTableCellFrame& aCellFrame) const;
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(const nsTableCellFrame& aCellFrame,

View File

@@ -78,8 +78,7 @@ public:
// see nsTableFrame::ColumnsCanBeInvalidatedBy
virtual PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const = 0;
const nsTableCellFrame& aCellFrame) const = 0;
// see nsTableFrame::ColumnsCanBeInvalidatedBy
virtual PRBool ColumnsCanBeInvalidatedBy(const nsTableCellFrame& aCellFrame,

View File

@@ -3850,7 +3850,19 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
rowGroupFrame->GetNextSibling(&rowGroupFrame);
}
rowGroupFrame=mFrames.FirstChild();
// the first row group's y position starts inside our padding
nscoord rowGroupYPos = 0;
if (rowGroupFrame) {
const nsStyleSpacing* spacing =
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
nsMargin margin(0,0,0,0);
if (spacing->GetBorder(margin)) { // XXX see bug 10636 and handle percentages
rowGroupYPos = margin.top;
}
if (spacing->GetPadding(margin)) { // XXX see bug 10636 and handle percentages
rowGroupYPos += margin.top;
}
}
while (nsnull!=rowGroupFrame)
{
const nsStyleDisplay *rowGroupDisplay;
@@ -4185,11 +4197,10 @@ void nsTableFrame::CacheColFramesInCellMap()
}
PRBool nsTableFrame::ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth) const
const nsTableCellFrame& aCellFrame) const
{
if (mTableLayoutStrategy) {
return mTableLayoutStrategy->ColumnsCanBeInvalidatedBy(aPrevStyleWidth, aCellFrame, aConsiderMinWidth);
return mTableLayoutStrategy->ColumnsCanBeInvalidatedBy(aPrevStyleWidth, aCellFrame);
}
return PR_FALSE;
}

View File

@@ -679,8 +679,7 @@ public:
// changes to aCellFrame's min width is considered (however, if considered,
// the function will always return PR_TRUE if the layout strategy is Basic).
PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const;
const nsTableCellFrame& aCellFrame) const;
// Returns PR_TRUE if potential width changes to aCellFrame could require the
// columns to be rebalanced. This method can be used after an incremental reflow
@@ -692,7 +691,7 @@ public:
PRBool aConsiderMinWidth = PR_FALSE) const;
// Returns PR_TRUE if changes to aCellFrame's pass1 min and desired (max) sizes
// could require the columns to be rebalanced. This method can be used after a
// don't require the columns to be rebalanced. This method can be used after a
// pass1 reflow of aCellFrame to determine if the columns need rebalancing.
// aPrevCellMin and aPrevCellDes are the values aCellFrame had before the last
// pass1 reflow.
@@ -700,8 +699,6 @@ public:
nscoord aPrevCellMin,
nscoord aPrevCellDes) const;
nscoord GetColumnConstraint(nscoord aColIndex) const;
virtual void InvalidateFirstPassCache();
virtual void InvalidateColumnCache();

View File

@@ -131,7 +131,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidthIn)
{
//mTableFrame->Dump(PR_TRUE, PR_FALSE);
mTableFrame->Dump(PR_TRUE, PR_FALSE);
ContinuingFrameCheck();
if (!aTableStyle) {
NS_ASSERTION(aTableStyle, "bad style arg");
@@ -1250,10 +1250,9 @@ void BasicTableLayoutStrategy::AllocateConstrained(PRInt32 aAvailWidth,
// from AssignPreliminarColumnWidths and AssignPercentageColumnWidths. For now, pessimistic
// assumptions are made
PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth) const
const nsTableCellFrame& aCellFrame) const
{
if (aConsiderMinWidth || !mTableFrame)
if (!mTableFrame)
return PR_TRUE;
const nsStylePosition* cellPosition;
@@ -1381,7 +1380,7 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
minChanged = PR_FALSE;
}
if (minChanged) {
return PR_TRUE; // XXX add cases where table has coord width and cell is constrained
return PR_FALSE; // XXX add cases where table has coord width and cell is constrained
}
PRBool desChanged = PR_FALSE;
@@ -1396,26 +1395,26 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
(colFrame->GetWidth(MIN_PRO) > 0)) {
if ((colFrame->GetWidth(PCT_ADJ) > 0) && (colFrame->GetWidth(PCT) <= 0)) {
if (desChanged) {
return PR_TRUE; // XXX add cases where table has coord width
return PR_FALSE; // XXX add cases where table has coord width
}
}
if ((colFrame->GetWidth(FIX_ADJ) > 0) && (colFrame->GetWidth(FIX) <= 0)) {
if (desChanged) {
return PR_TRUE; // its unfortunate that the balancing algorithms cause this
return PR_FALSE; // its unfortunate that the balancing algorithms cause this
// XXX add cases where table has coord width
}
}
}
else { // the column width is not constrained
if (desChanged) {
return PR_TRUE;
return PR_FALSE;
}
}
}
else {
return PR_TRUE; // XXX this needs a lot of cases
return PR_FALSE; // XXX this needs a lot of cases
}
return PR_FALSE;
return PR_TRUE;
}
PRBool BasicTableLayoutStrategy::IsColumnInList(const PRInt32 colIndex,

View File

@@ -154,8 +154,7 @@ protected:
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const;
const nsTableCellFrame& aCellFrame) const;
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(const nsTableCellFrame& aCellFrame,

View File

@@ -184,8 +184,7 @@ PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aComputed
}
PRBool FixedTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth) const
const nsTableCellFrame& aCellFrame) const
{
return ColumnsCanBeInvalidatedBy(aCellFrame);
}
@@ -199,9 +198,9 @@ PRBool FixedTableLayoutStrategy::ColumnsCanBeInvalidatedBy(const nsTableCellFram
if (0 == rowIndex) {
// It is not worth the effort to determine if the col or cell determined the col
// width. Since rebalancing the columns is fairly trival in this strategy, just force it.
return PR_FALSE;
return PR_TRUE;
}
return PR_TRUE;
return PR_FALSE;
}
PRBool FixedTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCellFrame,
@@ -209,7 +208,7 @@ PRBool FixedTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
nscoord aPrevCellDes) const
{
// take the easy way out, see comments above.
return ColumnsCanBeInvalidatedBy(aCellFrame);
return !ColumnsCanBeInvalidatedBy(aCellFrame);
}

View File

@@ -60,8 +60,7 @@ public:
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const;
const nsTableCellFrame& aCellFrame) const;
// see nsTableFrame::ColumnsCanBeInvalidatedBy
PRBool ColumnsCanBeInvalidatedBy(const nsTableCellFrame& aCellFrame,

View File

@@ -78,8 +78,7 @@ public:
// see nsTableFrame::ColumnsCanBeInvalidatedBy
virtual PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const = 0;
const nsTableCellFrame& aCellFrame) const = 0;
// see nsTableFrame::ColumnsCanBeInvalidatedBy
virtual PRBool ColumnsCanBeInvalidatedBy(const nsTableCellFrame& aCellFrame,

View File

@@ -3850,7 +3850,19 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext,
rowGroupFrame->GetNextSibling(&rowGroupFrame);
}
rowGroupFrame=mFrames.FirstChild();
// the first row group's y position starts inside our padding
nscoord rowGroupYPos = 0;
if (rowGroupFrame) {
const nsStyleSpacing* spacing =
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
nsMargin margin(0,0,0,0);
if (spacing->GetBorder(margin)) { // XXX see bug 10636 and handle percentages
rowGroupYPos = margin.top;
}
if (spacing->GetPadding(margin)) { // XXX see bug 10636 and handle percentages
rowGroupYPos += margin.top;
}
}
while (nsnull!=rowGroupFrame)
{
const nsStyleDisplay *rowGroupDisplay;
@@ -4185,11 +4197,10 @@ void nsTableFrame::CacheColFramesInCellMap()
}
PRBool nsTableFrame::ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth) const
const nsTableCellFrame& aCellFrame) const
{
if (mTableLayoutStrategy) {
return mTableLayoutStrategy->ColumnsCanBeInvalidatedBy(aPrevStyleWidth, aCellFrame, aConsiderMinWidth);
return mTableLayoutStrategy->ColumnsCanBeInvalidatedBy(aPrevStyleWidth, aCellFrame);
}
return PR_FALSE;
}

View File

@@ -679,8 +679,7 @@ public:
// changes to aCellFrame's min width is considered (however, if considered,
// the function will always return PR_TRUE if the layout strategy is Basic).
PRBool ColumnsCanBeInvalidatedBy(nsStyleCoord* aPrevStyleWidth,
const nsTableCellFrame& aCellFrame,
PRBool aConsiderMinWidth = PR_FALSE) const;
const nsTableCellFrame& aCellFrame) const;
// Returns PR_TRUE if potential width changes to aCellFrame could require the
// columns to be rebalanced. This method can be used after an incremental reflow
@@ -692,7 +691,7 @@ public:
PRBool aConsiderMinWidth = PR_FALSE) const;
// Returns PR_TRUE if changes to aCellFrame's pass1 min and desired (max) sizes
// could require the columns to be rebalanced. This method can be used after a
// don't require the columns to be rebalanced. This method can be used after a
// pass1 reflow of aCellFrame to determine if the columns need rebalancing.
// aPrevCellMin and aPrevCellDes are the values aCellFrame had before the last
// pass1 reflow.
@@ -700,8 +699,6 @@ public:
nscoord aPrevCellMin,
nscoord aPrevCellDes) const;
nscoord GetColumnConstraint(nscoord aColIndex) const;
virtual void InvalidateFirstPassCache();
virtual void InvalidateColumnCache();