diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index abfe42508a5..cae0540ddb8 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -137,18 +137,10 @@ nsresult nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePt } } +// tables change 0 width into auto, trees override this and do nothing NS_IMETHODIMP -nsTableOuterFrame::Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsIStyleContext* aContext, - nsIFrame* aPrevInFlow) +nsTableOuterFrame::AdjustZeroWidth() { - nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, - aContext, aPrevInFlow); - if (NS_FAILED(rv) || !mStyleContext) return rv; - -#if 0 // a 0 width table becomes auto PRBool makeAuto = PR_FALSE; nsStylePosition* position = (nsStylePosition*)mStyleContext->GetMutableStyleData(eStyleStruct_Position); @@ -166,7 +158,21 @@ nsTableOuterFrame::Init(nsIPresContext* aPresContext, if (makeAuto) { position->mWidth = nsStyleCoord(eStyleUnit_Auto); } -#endif + return NS_OK; +} + +NS_IMETHODIMP +nsTableOuterFrame::Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, + aContext, aPrevInFlow); + if (NS_FAILED(rv) || !mStyleContext) return rv; + AdjustZeroWidth(); + return rv; } diff --git a/layout/html/table/src/nsTableOuterFrame.h b/layout/html/table/src/nsTableOuterFrame.h index 6a0a54f6caa..1ad22e1bd08 100644 --- a/layout/html/table/src/nsTableOuterFrame.h +++ b/layout/html/table/src/nsTableOuterFrame.h @@ -69,6 +69,8 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow); + NS_IMETHOD AdjustZeroWidth(); + /** @see nsIFrame::SetInitialChildList */ NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index abfe42508a5..cae0540ddb8 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -137,18 +137,10 @@ nsresult nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePt } } +// tables change 0 width into auto, trees override this and do nothing NS_IMETHODIMP -nsTableOuterFrame::Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsIStyleContext* aContext, - nsIFrame* aPrevInFlow) +nsTableOuterFrame::AdjustZeroWidth() { - nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, - aContext, aPrevInFlow); - if (NS_FAILED(rv) || !mStyleContext) return rv; - -#if 0 // a 0 width table becomes auto PRBool makeAuto = PR_FALSE; nsStylePosition* position = (nsStylePosition*)mStyleContext->GetMutableStyleData(eStyleStruct_Position); @@ -166,7 +158,21 @@ nsTableOuterFrame::Init(nsIPresContext* aPresContext, if (makeAuto) { position->mWidth = nsStyleCoord(eStyleUnit_Auto); } -#endif + return NS_OK; +} + +NS_IMETHODIMP +nsTableOuterFrame::Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, + aContext, aPrevInFlow); + if (NS_FAILED(rv) || !mStyleContext) return rv; + AdjustZeroWidth(); + return rv; } diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h index 6a0a54f6caa..1ad22e1bd08 100644 --- a/layout/tables/nsTableOuterFrame.h +++ b/layout/tables/nsTableOuterFrame.h @@ -69,6 +69,8 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow); + NS_IMETHOD AdjustZeroWidth(); + /** @see nsIFrame::SetInitialChildList */ NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, nsIAtom* aListName, diff --git a/layout/xul/base/src/nsTreeOuterFrame.cpp b/layout/xul/base/src/nsTreeOuterFrame.cpp index baf7d9aa7cf..530d009ae37 100644 --- a/layout/xul/base/src/nsTreeOuterFrame.cpp +++ b/layout/xul/base/src/nsTreeOuterFrame.cpp @@ -80,6 +80,13 @@ nsTreeOuterFrame::Init(nsIPresContext* aPresContext, return rv; } +NS_IMETHODIMP +nsTreeOuterFrame::AdjustZeroWidth() +{ + // don't do anything, tables change 0 width into auto + return NS_OK; +} + NS_IMETHODIMP nsTreeOuterFrame::HandleEvent(nsIPresContext* aPresContext, nsGUIEvent* aEvent, diff --git a/layout/xul/base/src/nsTreeOuterFrame.h b/layout/xul/base/src/nsTreeOuterFrame.h index 3ca93ec88b4..53f242916b0 100644 --- a/layout/xul/base/src/nsTreeOuterFrame.h +++ b/layout/xul/base/src/nsTreeOuterFrame.h @@ -45,6 +45,8 @@ public: nsIStyleContext* aContext, nsIFrame* aPrevInFlow); + NS_IMETHOD AdjustZeroWidth(); + NS_DECL_ISUPPORTS NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);