From 3348645b69db97cb6e851408f5391bc738630c3a Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Sat, 12 Feb 2000 00:58:38 +0000 Subject: [PATCH] bug 8524 - don't use -moz-bg-inset in standard mode. r=troy bug 10269 - renamed RequiresPass1Layout to IsAutoLayout and have it force a fixed layout table (not tree) to be auto layout if the table is auto width. git-svn-id: svn://10.0.0.236/trunk@60554 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsHTMLTableElement.cpp | 10 ++++- .../html/content/src/nsHTMLTableElement.cpp | 10 ++++- .../html/table/src/nsTableCellFrame.cpp | 38 ------------------- .../layout/html/table/src/nsTableCellFrame.h | 2 - .../layout/html/table/src/nsTableFrame.cpp | 28 ++++++++++---- mozilla/layout/html/table/src/nsTableFrame.h | 2 +- .../layout/html/table/src/nsTableRowFrame.cpp | 13 +++---- mozilla/layout/tables/nsTableCellFrame.cpp | 38 ------------------- mozilla/layout/tables/nsTableCellFrame.h | 2 - mozilla/layout/tables/nsTableFrame.cpp | 28 ++++++++++---- mozilla/layout/tables/nsTableFrame.h | 2 +- mozilla/layout/tables/nsTableRowFrame.cpp | 13 +++---- mozilla/layout/xul/base/src/nsTreeFrame.cpp | 14 +++++++ mozilla/layout/xul/base/src/nsTreeFrame.h | 3 ++ 14 files changed, 89 insertions(+), 114 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLTableElement.cpp b/mozilla/content/html/content/src/nsHTMLTableElement.cpp index 561694f1934..75bf98858e2 100644 --- a/mozilla/content/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableElement.cpp @@ -1159,7 +1159,10 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, // basis of the outset border. If the table has a transparant background then it finds // the closest ancestor that has a non transparant backgound. NS_STYLE_BORDER_OUTSET // uses the border color of the table and if that is not set, then it uses the color. - PRUint8 borderStyle = NS_STYLE_BORDER_STYLE_BG_OUTSET; + nsCompatibility mode; + aPresContext->GetCompatibilityMode(&mode); + PRUint8 borderStyle = (eCompatibility_NavQuirks == mode) + ? NS_STYLE_BORDER_STYLE_BG_OUTSET : NS_STYLE_BORDER_STYLE_OUTSET; // bordercolor aAttributes->GetAttribute(nsHTMLAtoms::bordercolor, value); @@ -1214,6 +1217,11 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, tableStyle = (nsStyleTable*)aContext->GetMutableStyleData(eStyleStruct_Table); tableStyle->mCellPadding.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), sp2t)); } + else if (value.GetUnit() == eHTMLUnit_Percent) { + if (nsnull==tableStyle) + tableStyle = (nsStyleTable*)aContext->GetMutableStyleData(eStyleStruct_Table); + tableStyle->mCellPadding.SetPercentValue(value.GetPercentValue()); + } // cellspacing (reuses tableStyle if already resolved) // ua.css sets cellspacing diff --git a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp index 561694f1934..75bf98858e2 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp @@ -1159,7 +1159,10 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, // basis of the outset border. If the table has a transparant background then it finds // the closest ancestor that has a non transparant backgound. NS_STYLE_BORDER_OUTSET // uses the border color of the table and if that is not set, then it uses the color. - PRUint8 borderStyle = NS_STYLE_BORDER_STYLE_BG_OUTSET; + nsCompatibility mode; + aPresContext->GetCompatibilityMode(&mode); + PRUint8 borderStyle = (eCompatibility_NavQuirks == mode) + ? NS_STYLE_BORDER_STYLE_BG_OUTSET : NS_STYLE_BORDER_STYLE_OUTSET; // bordercolor aAttributes->GetAttribute(nsHTMLAtoms::bordercolor, value); @@ -1214,6 +1217,11 @@ MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, tableStyle = (nsStyleTable*)aContext->GetMutableStyleData(eStyleStruct_Table); tableStyle->mCellPadding.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), sp2t)); } + else if (value.GetUnit() == eHTMLUnit_Percent) { + if (nsnull==tableStyle) + tableStyle = (nsStyleTable*)aContext->GetMutableStyleData(eStyleStruct_Table); + tableStyle->mCellPadding.SetPercentValue(value.GetPercentValue()); + } // cellspacing (reuses tableStyle if already resolved) // ua.css sets cellspacing diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 63dd779e55e..95a723f98ef 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -1058,44 +1058,6 @@ NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) /* ----- methods from CellLayoutData ----- */ -/** - * Given a frame and an edge, find the margin - * - **/ -nscoord nsTableCellFrame::GetMargin(nsIFrame* aFrame, PRUint8 aEdge) const -{ - nscoord result = 0; - - if (aFrame) - { - const nsStyleSpacing* spacing; - aFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing); - nsMargin margin; - spacing->CalcMarginFor(aFrame, margin); - switch (aEdge) - { - case NS_SIDE_TOP: - result = margin.top; - break; - - case NS_SIDE_RIGHT: - result = margin.right; - break; - - case NS_SIDE_BOTTOM: - result = margin.bottom; - break; - - case NS_SIDE_LEFT: - result = margin.left; - break; - - } - } - return result; -} - - /** * Given an Edge, find the opposing edge (top<-->bottom, left<-->right) * diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.h b/mozilla/layout/html/table/src/nsTableCellFrame.h index fdea4b1fce2..61c2547671c 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.h +++ b/mozilla/layout/html/table/src/nsTableCellFrame.h @@ -221,8 +221,6 @@ private: // All these methods are support methods for RecalcLayoutData nsIFrame* GetFrameAt(nsVoidArray* aList, PRInt32 aIndex); - nscoord GetMargin(nsIFrame* aFrame, PRUint8 aEdge) const; - //XXX: aTableFrame can be removed as soon as border-collapse inherits correctly void GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFrame); diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index b9b5fc5fa64..85e1fb56312 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -1613,7 +1613,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, // See if we are supposed to compute our maximum width if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) { - PRBool isAutoWidth = RequiresPass1Layout() && + PRBool isAutoWidth = IsAutoLayout(&aReflowState) && (eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit()); // See if the pass1 maximum width is no longer valid because one of the @@ -1694,7 +1694,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, // Compute the insets (sum of border and padding) // XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste - if (PR_TRUE==RequiresPass1Layout()) + if (IsAutoLayout(&aReflowState)) { nsIFrame* kidFrame = aStartingFrame; if (nsnull==kidFrame) @@ -2886,7 +2886,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext* aPresContext, nsresult rv = NS_OK; nsReflowReason reason; - if (PR_FALSE==RequiresPass1Layout()) + if (!IsAutoLayout(&aReflowState.reflowState)) { reason = aReflowState.reflowState.reason; if (eReflowReason_Incremental==reason) { @@ -3215,7 +3215,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext, if (nsnull == mTableLayoutStrategy) { nsCompatibility mode; aPresContext->GetCompatibilityMode(&mode); - if (PR_FALSE==RequiresPass1Layout()) + if (!IsAutoLayout(&aReflowState)) mTableLayoutStrategy = new FixedTableLayoutStrategy(this); else mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode); @@ -3224,7 +3224,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext, } // fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars // reflow gets called twice and the 2nd time has the correct space available. - else if (!RequiresPass1Layout()) { + else if (!IsAutoLayout(&aReflowState)) { mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth); } @@ -4176,11 +4176,25 @@ void nsTableFrame::SetMaxElementSize(nsSize* aMaxElementSize) } -PRBool nsTableFrame::RequiresPass1Layout() +PRBool nsTableFrame::IsAutoLayout(const nsHTMLReflowState* aReflowState) { const nsStyleTable* tableStyle; GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); - return (PRBool)(NS_STYLE_TABLE_LAYOUT_FIXED!=tableStyle->mLayoutStrategy); + // a fixed table-layout table with an auto width is not considered as such + // for purposes of requiring pass1 reflow and assigning a layout strategy + if (NS_STYLE_TABLE_LAYOUT_FIXED == tableStyle->mLayoutStrategy) { + const nsStylePosition* position; + if (aReflowState) { + position = aReflowState->mStylePosition; + } + else { + GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)position); + } + if (eStyleUnit_Auto != position->mWidth.GetUnit()) { + return PR_FALSE; + } + } + return PR_TRUE; } #ifdef DEBUG diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index 2967f980881..04703d8148a 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -792,7 +792,7 @@ public: /* ----- Cell Map public methods ----- */ void SetMaxElementSize(nsSize* aMaxElementSize); /** returns PR_TRUE if table layout requires a preliminary pass over the content */ - PRBool RequiresPass1Layout(); + virtual PRBool IsAutoLayout(const nsHTMLReflowState* aReflowState = nsnull); // compute the height of the table to be used as the basis for // percentage height cells diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index a2fd24ab6a5..8272e88f9ac 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -924,15 +924,12 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext, nsTableCellFrame * aStartFrame, PRBool aDoSiblings) { + nsresult rv = NS_OK; // Place our children, one at a time, until we are out of children nsSize kidMaxElementSize(0,0); nscoord x = 0; - PRBool tableLayoutStrategy=NS_STYLE_TABLE_LAYOUT_AUTO; nsTableFrame* table = aReflowState.tableFrame; - nsresult rv = NS_OK; - const nsStyleTable* tableStyle; - table->GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); - tableLayoutStrategy = tableStyle->mLayoutStrategy; + PRBool isAutoLayout = table->IsAutoLayout(&aReflowState.reflowState); nsIFrame* kidFrame; if (nsnull==aStartFrame) @@ -962,7 +959,7 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext, // get the child's maximum width nsSize kidAvailSize; nsHTMLReflowMetrics kidSize(nsnull); - if (NS_STYLE_TABLE_LAYOUT_AUTO==tableLayoutStrategy) + if (isAutoLayout) { kidAvailSize.SizeTo(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); kidSize.maxElementSize=&kidMaxElementSize; @@ -1223,7 +1220,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext, // Unless this is a fixed-layout table, then have the cell incrementally // update its maximum width nsHTMLReflowMetrics desiredSize(&kidMaxElementSize, - aReflowState.tableFrame->RequiresPass1Layout() ? + aReflowState.tableFrame->IsAutoLayout() ? NS_REFLOW_CALC_MAX_WIDTH : 0); nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, @@ -1350,7 +1347,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, switch (reason) { case eReflowReason_Initial: rv = InitialReflow(aPresContext, aDesiredSize, state, aStatus, nsnull, PR_TRUE); - if (PR_FALSE==tableFrame->RequiresPass1Layout()) + if (!tableFrame->IsAutoLayout()) { // this resize reflow is necessary to place the cells correctly in the case of rowspans and colspans. // It is very efficient. It does not actually need to pass a reflow down to the cells. nsSize availSpace(aReflowState.availableWidth, aReflowState.availableHeight); diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 63dd779e55e..95a723f98ef 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -1058,44 +1058,6 @@ NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) /* ----- methods from CellLayoutData ----- */ -/** - * Given a frame and an edge, find the margin - * - **/ -nscoord nsTableCellFrame::GetMargin(nsIFrame* aFrame, PRUint8 aEdge) const -{ - nscoord result = 0; - - if (aFrame) - { - const nsStyleSpacing* spacing; - aFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing); - nsMargin margin; - spacing->CalcMarginFor(aFrame, margin); - switch (aEdge) - { - case NS_SIDE_TOP: - result = margin.top; - break; - - case NS_SIDE_RIGHT: - result = margin.right; - break; - - case NS_SIDE_BOTTOM: - result = margin.bottom; - break; - - case NS_SIDE_LEFT: - result = margin.left; - break; - - } - } - return result; -} - - /** * Given an Edge, find the opposing edge (top<-->bottom, left<-->right) * diff --git a/mozilla/layout/tables/nsTableCellFrame.h b/mozilla/layout/tables/nsTableCellFrame.h index fdea4b1fce2..61c2547671c 100644 --- a/mozilla/layout/tables/nsTableCellFrame.h +++ b/mozilla/layout/tables/nsTableCellFrame.h @@ -221,8 +221,6 @@ private: // All these methods are support methods for RecalcLayoutData nsIFrame* GetFrameAt(nsVoidArray* aList, PRInt32 aIndex); - nscoord GetMargin(nsIFrame* aFrame, PRUint8 aEdge) const; - //XXX: aTableFrame can be removed as soon as border-collapse inherits correctly void GetCellBorder(nsMargin &aBorder, nsTableFrame *aTableFrame); diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index b9b5fc5fa64..85e1fb56312 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -1613,7 +1613,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext, // See if we are supposed to compute our maximum width if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) { - PRBool isAutoWidth = RequiresPass1Layout() && + PRBool isAutoWidth = IsAutoLayout(&aReflowState) && (eStyleUnit_Auto == aReflowState.mStylePosition->mWidth.GetUnit()); // See if the pass1 maximum width is no longer valid because one of the @@ -1694,7 +1694,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext* aPresContext, // Compute the insets (sum of border and padding) // XXX: since this is pass1 reflow and where we place the rowgroup frames is irrelevant, insets are probably a waste - if (PR_TRUE==RequiresPass1Layout()) + if (IsAutoLayout(&aReflowState)) { nsIFrame* kidFrame = aStartingFrame; if (nsnull==kidFrame) @@ -2886,7 +2886,7 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext* aPresContext, nsresult rv = NS_OK; nsReflowReason reason; - if (PR_FALSE==RequiresPass1Layout()) + if (!IsAutoLayout(&aReflowState.reflowState)) { reason = aReflowState.reflowState.reason; if (eReflowReason_Incremental==reason) { @@ -3215,7 +3215,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext, if (nsnull == mTableLayoutStrategy) { nsCompatibility mode; aPresContext->GetCompatibilityMode(&mode); - if (PR_FALSE==RequiresPass1Layout()) + if (!IsAutoLayout(&aReflowState)) mTableLayoutStrategy = new FixedTableLayoutStrategy(this); else mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode); @@ -3224,7 +3224,7 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext, } // fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars // reflow gets called twice and the 2nd time has the correct space available. - else if (!RequiresPass1Layout()) { + else if (!IsAutoLayout(&aReflowState)) { mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth); } @@ -4176,11 +4176,25 @@ void nsTableFrame::SetMaxElementSize(nsSize* aMaxElementSize) } -PRBool nsTableFrame::RequiresPass1Layout() +PRBool nsTableFrame::IsAutoLayout(const nsHTMLReflowState* aReflowState) { const nsStyleTable* tableStyle; GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); - return (PRBool)(NS_STYLE_TABLE_LAYOUT_FIXED!=tableStyle->mLayoutStrategy); + // a fixed table-layout table with an auto width is not considered as such + // for purposes of requiring pass1 reflow and assigning a layout strategy + if (NS_STYLE_TABLE_LAYOUT_FIXED == tableStyle->mLayoutStrategy) { + const nsStylePosition* position; + if (aReflowState) { + position = aReflowState->mStylePosition; + } + else { + GetStyleData(eStyleStruct_Position, (const nsStyleStruct *&)position); + } + if (eStyleUnit_Auto != position->mWidth.GetUnit()) { + return PR_FALSE; + } + } + return PR_TRUE; } #ifdef DEBUG diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index 2967f980881..04703d8148a 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -792,7 +792,7 @@ public: /* ----- Cell Map public methods ----- */ void SetMaxElementSize(nsSize* aMaxElementSize); /** returns PR_TRUE if table layout requires a preliminary pass over the content */ - PRBool RequiresPass1Layout(); + virtual PRBool IsAutoLayout(const nsHTMLReflowState* aReflowState = nsnull); // compute the height of the table to be used as the basis for // percentage height cells diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index a2fd24ab6a5..8272e88f9ac 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -924,15 +924,12 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext, nsTableCellFrame * aStartFrame, PRBool aDoSiblings) { + nsresult rv = NS_OK; // Place our children, one at a time, until we are out of children nsSize kidMaxElementSize(0,0); nscoord x = 0; - PRBool tableLayoutStrategy=NS_STYLE_TABLE_LAYOUT_AUTO; nsTableFrame* table = aReflowState.tableFrame; - nsresult rv = NS_OK; - const nsStyleTable* tableStyle; - table->GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); - tableLayoutStrategy = tableStyle->mLayoutStrategy; + PRBool isAutoLayout = table->IsAutoLayout(&aReflowState.reflowState); nsIFrame* kidFrame; if (nsnull==aStartFrame) @@ -962,7 +959,7 @@ nsTableRowFrame::InitialReflow(nsIPresContext* aPresContext, // get the child's maximum width nsSize kidAvailSize; nsHTMLReflowMetrics kidSize(nsnull); - if (NS_STYLE_TABLE_LAYOUT_AUTO==tableLayoutStrategy) + if (isAutoLayout) { kidAvailSize.SizeTo(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); kidSize.maxElementSize=&kidMaxElementSize; @@ -1223,7 +1220,7 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext, // Unless this is a fixed-layout table, then have the cell incrementally // update its maximum width nsHTMLReflowMetrics desiredSize(&kidMaxElementSize, - aReflowState.tableFrame->RequiresPass1Layout() ? + aReflowState.tableFrame->IsAutoLayout() ? NS_REFLOW_CALC_MAX_WIDTH : 0); nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, @@ -1350,7 +1347,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext, switch (reason) { case eReflowReason_Initial: rv = InitialReflow(aPresContext, aDesiredSize, state, aStatus, nsnull, PR_TRUE); - if (PR_FALSE==tableFrame->RequiresPass1Layout()) + if (!tableFrame->IsAutoLayout()) { // this resize reflow is necessary to place the cells correctly in the case of rowspans and colspans. // It is very efficient. It does not actually need to pass a reflow down to the cells. nsSize availSpace(aReflowState.availableWidth, aReflowState.availableHeight); diff --git a/mozilla/layout/xul/base/src/nsTreeFrame.cpp b/mozilla/layout/xul/base/src/nsTreeFrame.cpp index 9489428ccdb..73f019eb27b 100644 --- a/mozilla/layout/xul/base/src/nsTreeFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeFrame.cpp @@ -105,6 +105,20 @@ NS_IMETHODIMP nsTreeFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) return nsTableFrame::QueryInterface(aIID, aInstancePtr); } +// this is overriden because the behavior for a table is to force the layout +// to auto layout if the table is auto width. This doesn't work for trees. +PRBool nsTreeFrame::IsAutoLayout(const nsHTMLReflowState* aReflowState) +{ + const nsStyleTable* tableStyle; + GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); + // a fixed table-layout table with an auto width is not considered as such + // for purposes of requiring pass1 reflow and assigning a layout strategy + if (NS_STYLE_TABLE_LAYOUT_FIXED == tableStyle->mLayoutStrategy) { + return PR_FALSE; + } + return PR_TRUE; +} + void nsTreeFrame::SetSelection(nsIPresContext* aPresContext, nsTreeCellFrame* aFrame) { nsCOMPtr cellContent; diff --git a/mozilla/layout/xul/base/src/nsTreeFrame.h b/mozilla/layout/xul/base/src/nsTreeFrame.h index d26e90f73b5..635c7785fec 100644 --- a/mozilla/layout/xul/base/src/nsTreeFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeFrame.h @@ -77,6 +77,9 @@ public: NS_IMETHOD DidReflow(nsIPresContext* aPresContext, nsDidReflowStatus aStatus); + // returns PR_TRUE if layout requires a preliminary pass over the content + virtual PRBool IsAutoLayout(const nsHTMLReflowState* aReflowState = nsnull); + PRInt32 GetCurrentGeneration() { return mGeneration; }; void SetCurrentGeneration(PRInt32 aGeneration) { mGeneration = aGeneration; };