Bug 474825 - honor mozilla.widget.disable-native-theme preference. move preference check to the right place r=stuart
authorVladimir Vukicevic <vladimir@pobox.com>
Wed, 18 Feb 2009 10:38:37 -0800
changeset 25145 a6a7dac9155a66c8739df30c52a49ae39baa93eb
parent 25144 00f309d0d507ad18969c99b1c558c213892587ba
child 25146 cc2e2e847469e3df83b8dd8cc70772ad9b746f78
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstuart
bugs474825
milestone1.9.2a1pre
Bug 474825 - honor mozilla.widget.disable-native-theme preference. move preference check to the right place r=stuart
widget/src/build/nsWinWidgetFactory.cpp
widget/src/windows/nsNativeThemeWin.cpp
--- a/widget/src/build/nsWinWidgetFactory.cpp
+++ b/widget/src/build/nsWinWidgetFactory.cpp
@@ -73,48 +73,16 @@
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
 NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerWin)
 
-// from nsWindow.cpp
-extern PRBool gDisableNativeTheme;
-
-static NS_IMETHODIMP
-nsNativeThemeWinConstructor(nsISupports *aOuter, REFNSIID aIID,
-                            void **aResult)
-{
-    nsresult rv;
-    nsNativeThemeWin * inst;
-
-    if (gDisableNativeTheme)
-        return NS_ERROR_NO_INTERFACE;
-
-    *aResult = NULL;
-    if (NULL != aOuter) {
-        rv = NS_ERROR_NO_AGGREGATION;
-        return rv;
-    }
-
-    NS_NEWXPCOM(inst, nsNativeThemeWin);
-    if (NULL == inst) {
-        rv = NS_ERROR_OUT_OF_MEMORY;
-        return rv;
-    }
-    NS_ADDREF(inst);
-    rv = inst->QueryInterface(aIID, aResult);
-    NS_RELEASE(inst);
-
-    return rv;
-}
-
-
 #ifndef WINCE
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -2766,18 +2766,25 @@ nsNativeThemeWin::GetWidgetNativeDrawing
     gfxWindowsNativeDrawing::CANNOT_DRAW_TO_COLOR_ALPHA |
     gfxWindowsNativeDrawing::CANNOT_AXIS_ALIGNED_SCALE |
     gfxWindowsNativeDrawing::CANNOT_COMPLEX_TRANSFORM;
 }
 
 ///////////////////////////////////////////
 // Creation Routine
 ///////////////////////////////////////////
+
+// from nsWindow.cpp
+extern PRBool gDisableNativeTheme;
+
 NS_METHOD NS_NewNativeTheme(nsISupports *aOuter, REFNSIID aIID, void **aResult)
 {
+  if (gDisableNativeTheme)
+    return NS_ERROR_NO_INTERFACE;
+
   if (aOuter)
     return NS_ERROR_NO_AGGREGATION;
 
   nsNativeThemeWin* theme = new nsNativeThemeWin();
   if (!theme)
     return NS_ERROR_OUT_OF_MEMORY;
   return theme->QueryInterface(aIID, aResult);
 }