diff --git a/view/src/nsViewFactory.cpp b/view/src/nsViewFactory.cpp index 9013d896f95..b32847fd345 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 //////////////////////////////////////////////////////////////////////