From f572ef11fb9cbeeb16c181fc78721ec5e5231de0 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Sat, 5 Feb 2000 03:02:10 +0000 Subject: [PATCH] made using nsViewManager2 depend on the preference "nglayout.view.useViewManager2". r=pavlov, kmcclusk --- view/src/nsViewFactory.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/view/src/nsViewFactory.cpp b/view/src/nsViewFactory.cpp index 9013d896f957..b32847fd3451 100644 --- a/view/src/nsViewFactory.cpp +++ b/view/src/nsViewFactory.cpp @@ -110,8 +110,9 @@ nsresult nsViewFactory::LockFactory(PRBool aLock) } //Uncomment the following line to go back to the "new" compositor. -#define USE_NEW_COMPOSITOR 1 +//#define USE_NEW_COMPOSITOR 1 +#if 0 #if USE_NEW_COMPOSITOR #include "nsViewManager.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager) @@ -119,6 +120,31 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager) #include "nsViewManager2.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager2) #define nsViewManagerConstructor nsViewManager2Constructor +#endif +#else + +#include "nsViewManager.h" +#include "nsViewManager2.h" +#include "nsIPref.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager2) + +static NS_IMETHODIMP ViewManagerConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) +{ + PRBool useViewManager2 = PR_FALSE; + nsresult rv; + NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv); + if (NS_SUCCEEDED(rv)) + prefs->GetBoolPref("nglayout.view.useViewManager2", &useViewManager2); + if (useViewManager2) + return nsViewManager2Constructor(aOuter, aIID, aResult); + else + return nsViewManagerConstructor(aOuter, aIID, aResult); +} + +#define nsViewManagerConstructor ViewManagerConstructor + #endif //////////////////////////////////////////////////////////////////////