diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index f0f872aa8b5b..a476ec749bf0 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -36,6 +36,8 @@ * * ***** END LICENSE BLOCK ***** */ +//#define MOZ_GRID2 1 + #include "nsCSSFrameConstructor.h" #include "nsIArena.h" #include "nsCRT.h" @@ -299,24 +301,20 @@ NS_NewOutlinerBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame); #ifdef MOZ_GRID2 nsresult NS_NewGridLayout2 ( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout ); -#else -nsresult -NS_NewGridLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); -#endif - -#ifdef MOZ_GRID2 nsresult NS_NewGridRowLeafLayout ( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout ); -#else nsresult -NS_NewObeliskLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); -#endif - -#ifdef MOZ_GRID2 +NS_NewGridRowLeafFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot, nsIBoxLayout* aLayout); nsresult NS_NewGridRowGroupLayout ( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout ); +nsresult +NS_NewGridRowGroupFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot, nsIBoxLayout* aLayout); #else nsresult +NS_NewGridLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); +nsresult +NS_NewObeliskLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); +nsresult NS_NewTempleLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); #endif @@ -5422,10 +5420,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, { #ifdef MOZ_GRID2 NS_NewGridRowGroupLayout(aPresShell, getter_AddRefs(layout)); + rv = NS_NewGridRowGroupFrame(aPresShell, &newFrame, PR_FALSE, layout); #else NS_NewTempleLayout(aPresShell, layout); -#endif rv = NS_NewBoxFrame(aPresShell, &newFrame, PR_FALSE, layout); +#endif } // Boxes can scroll. @@ -5456,6 +5455,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsCOMPtr layout; + #ifdef MOZ_GRID2 NS_NewGridRowLeafLayout(aPresShell, getter_AddRefs(layout)); #else @@ -5465,7 +5465,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, if (aTag == nsXULAtoms::treerow) rv = NS_NewXULTreeSliceFrame(aPresShell, &newFrame, PR_FALSE, layout); else - rv = NS_NewBoxFrame(aPresShell, &newFrame, PR_FALSE, layout); +#ifdef MOZ_GRID2 + rv = NS_NewGridRowLeafFrame(aPresShell, &newFrame, PR_FALSE, layout); +#else + rv = NS_NewBoxFrame(aPresShell, &newFrame, PR_FALSE, layout); +#endif // Boxes can scroll. if (IsScrollable(aPresContext, display)) { diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index f0f872aa8b5b..a476ec749bf0 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -36,6 +36,8 @@ * * ***** END LICENSE BLOCK ***** */ +//#define MOZ_GRID2 1 + #include "nsCSSFrameConstructor.h" #include "nsIArena.h" #include "nsCRT.h" @@ -299,24 +301,20 @@ NS_NewOutlinerBodyFrame (nsIPresShell* aPresShell, nsIFrame** aNewFrame); #ifdef MOZ_GRID2 nsresult NS_NewGridLayout2 ( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout ); -#else -nsresult -NS_NewGridLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); -#endif - -#ifdef MOZ_GRID2 nsresult NS_NewGridRowLeafLayout ( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout ); -#else nsresult -NS_NewObeliskLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); -#endif - -#ifdef MOZ_GRID2 +NS_NewGridRowLeafFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot, nsIBoxLayout* aLayout); nsresult NS_NewGridRowGroupLayout ( nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout ); +nsresult +NS_NewGridRowGroupFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot, nsIBoxLayout* aLayout); #else nsresult +NS_NewGridLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); +nsresult +NS_NewObeliskLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); +nsresult NS_NewTempleLayout ( nsIPresShell* aPresShell, nsCOMPtr& aNewLayout ); #endif @@ -5422,10 +5420,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, { #ifdef MOZ_GRID2 NS_NewGridRowGroupLayout(aPresShell, getter_AddRefs(layout)); + rv = NS_NewGridRowGroupFrame(aPresShell, &newFrame, PR_FALSE, layout); #else NS_NewTempleLayout(aPresShell, layout); -#endif rv = NS_NewBoxFrame(aPresShell, &newFrame, PR_FALSE, layout); +#endif } // Boxes can scroll. @@ -5456,6 +5455,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, nsCOMPtr layout; + #ifdef MOZ_GRID2 NS_NewGridRowLeafLayout(aPresShell, getter_AddRefs(layout)); #else @@ -5465,7 +5465,11 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell, if (aTag == nsXULAtoms::treerow) rv = NS_NewXULTreeSliceFrame(aPresShell, &newFrame, PR_FALSE, layout); else - rv = NS_NewBoxFrame(aPresShell, &newFrame, PR_FALSE, layout); +#ifdef MOZ_GRID2 + rv = NS_NewGridRowLeafFrame(aPresShell, &newFrame, PR_FALSE, layout); +#else + rv = NS_NewBoxFrame(aPresShell, &newFrame, PR_FALSE, layout); +#endif // Boxes can scroll. if (IsScrollable(aPresContext, display)) { diff --git a/layout/xul/base/src/makefile.win b/layout/xul/base/src/makefile.win index edd458cb97e6..50d6bd7f9f29 100644 --- a/layout/xul/base/src/makefile.win +++ b/layout/xul/base/src/makefile.win @@ -62,10 +62,12 @@ CPPSRCS= \ nsPopupBoxObject.cpp \ nsMenuBoxObject.cpp \ nsBoxObject.cpp \ +!ifndef MOZ_GRID2 nsGridLayout.cpp \ nsTempleLayout.cpp \ nsObeliskLayout.cpp \ nsMonumentLayout.cpp \ +!endif nsImageBoxFrame.cpp \ nsRootBoxFrame.cpp \ nsDocElementBoxFrame.cpp \ @@ -121,10 +123,12 @@ CPP_OBJS= \ .\$(OBJDIR)\nsPopupBoxObject.obj \ .\$(OBJDIR)\nsMenuBoxObject.obj \ .\$(OBJDIR)\nsBoxObject.obj \ +!ifndef MOZ_GRID2 .\$(OBJDIR)\nsGridLayout.obj \ .\$(OBJDIR)\nsTempleLayout.obj \ .\$(OBJDIR)\nsObeliskLayout.obj \ .\$(OBJDIR)\nsMonumentLayout.obj \ +!endif .\$(OBJDIR)\nsImageBoxFrame.obj \ .\$(OBJDIR)\nsRootBoxFrame.obj \ .\$(OBJDIR)\nsDocElementBoxFrame.obj \ diff --git a/layout/xul/base/src/nsTreeLayout.h b/layout/xul/base/src/nsTreeLayout.h index bd5a0d4e81d5..e648bee5d748 100644 --- a/layout/xul/base/src/nsTreeLayout.h +++ b/layout/xul/base/src/nsTreeLayout.h @@ -45,6 +45,8 @@ #ifndef nsTreeLayout_h___ #define nsTreeLayout_h___ +//#define MOZ_GRID2 1 + #ifdef MOZ_GRID2 #include "nsGridRowGroupLayout.h" #else diff --git a/layout/xul/base/src/nsXULTreeCellFrame.cpp b/layout/xul/base/src/nsXULTreeCellFrame.cpp index f116ef9ab7e5..870d648e6cfa 100644 --- a/layout/xul/base/src/nsXULTreeCellFrame.cpp +++ b/layout/xul/base/src/nsXULTreeCellFrame.cpp @@ -47,6 +47,8 @@ #include "nsIBoxLayout.h" #include "nsMonumentLayout.h" +//#define MOZ_GRID2 1 + #ifdef MOZ_GRID2 #include "nsGrid.h" #include "nsGridRow.h" @@ -142,7 +144,9 @@ nsXULTreeCellFrame::GetFrameForPoint(nsIPresContext* aPresContext, nsGrid* grid; PRInt32 index; part->GetGrid(box, &grid, &index); - nsIBox* splitBox = grid->GetColumnAt(i)->GetBox(); + nsIBox* splitBox = nsnull; + if (grid->GetColumnCount() > 0) + splitBox = grid->GetColumnAt(i)->GetBox(); #else box->GetLayoutManager(getter_AddRefs(lm)); nsCOMPtr mon(do_QueryInterface(lm)); diff --git a/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp b/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp index 2765315aab30..7f05e1104131 100644 --- a/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp +++ b/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp @@ -65,6 +65,8 @@ #include "nsIStyleContext.h" #include "nsIDOMText.h" +//#define MOZ_GRID2 1 + #ifdef MOZ_GRID2 #include "nsGridRowGroupLayout.h" #else diff --git a/layout/xul/base/src/nsXULTreeSliceFrame.h b/layout/xul/base/src/nsXULTreeSliceFrame.h index 02a5c1b72328..fa10b013b633 100644 --- a/layout/xul/base/src/nsXULTreeSliceFrame.h +++ b/layout/xul/base/src/nsXULTreeSliceFrame.h @@ -39,7 +39,12 @@ #include "nsBoxFrame.h" #include "nsIXULTreeSlice.h" +#ifdef MOZ_GRID2 +#include "nsGridRowLeafFrame.h" +class nsXULTreeSliceFrame : public nsGridRowLeafFrame, public nsIXULTreeSlice +#else class nsXULTreeSliceFrame : public nsBoxFrame, public nsIXULTreeSlice +#endif { public: NS_DECL_ISUPPORTS