diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index 38f79b69f13..4f08c59d1ac 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -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, diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h index c1b87d11c4f..31a16d7e371 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h @@ -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, diff --git a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp index ab11fd36668..7209e7093ae 100644 --- a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp @@ -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); } diff --git a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h index a1db975c8a2..2ae18aa1276 100644 --- a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h @@ -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, diff --git a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h index 26863569acc..11e00249d59 100644 --- a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h @@ -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, diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 70f24cc94aa..500a5dd9b9c 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -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; } diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index ae50c99d216..141426d2b8c 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -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(); diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 38f79b69f13..4f08c59d1ac 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -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, diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.h b/mozilla/layout/tables/BasicTableLayoutStrategy.h index c1b87d11c4f..31a16d7e371 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.h +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.h @@ -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, diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp index ab11fd36668..7209e7093ae 100644 --- a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp @@ -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); } diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.h b/mozilla/layout/tables/FixedTableLayoutStrategy.h index a1db975c8a2..2ae18aa1276 100644 --- a/mozilla/layout/tables/FixedTableLayoutStrategy.h +++ b/mozilla/layout/tables/FixedTableLayoutStrategy.h @@ -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, diff --git a/mozilla/layout/tables/nsITableLayoutStrategy.h b/mozilla/layout/tables/nsITableLayoutStrategy.h index 26863569acc..11e00249d59 100644 --- a/mozilla/layout/tables/nsITableLayoutStrategy.h +++ b/mozilla/layout/tables/nsITableLayoutStrategy.h @@ -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, diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 70f24cc94aa..500a5dd9b9c 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -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; } diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index ae50c99d216..141426d2b8c 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -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();