else if (mClassID.Equals(kCFontList)) { nsFontList* fl; NS_NEWXPCOM(fl, nsFontList); inst = (nsISupports *)fl; }
nsresult nsGfxFactoryWin::CreateInstance(nsISupports *aOuter,                                            const nsIID &aIID,                                            void **aResult)  {   nsresult res;  if (aResult == NULL) {      return NS_ERROR_NULL_POINTER;    }    *aResult = NULL;      nsISupports *inst = nsnull;  PRBool already_addreffed = PR_FALSE;  if (mClassID.Equals(kCFontMetrics)) {    nsFontMetricsWin* fm;    if (gUseAFunctions) {      NS_NEWXPCOM(fm, nsFontMetricsWinA);    }    else {      NS_NEWXPCOM(fm, nsFontMetricsWin);    }    inst = (nsISupports *)fm;  }  else if (mClassID.Equals(kCDeviceContext)) {    nsDeviceContextWin* dc;    NS_NEWXPCOM(dc, nsDeviceContextWin);    inst = (nsISupports *)dc;  }  else if (mClassID.Equals(kCRenderingContext)) {    nsRenderingContextWin*  rc;    if (gUseAFunctions) {      NS_NEWXPCOM(rc, nsRenderingContextWinA);    }    else {      NS_NEWXPCOM(rc, nsRenderingContextWin);    }    inst = (nsISupports *)((nsIRenderingContext*)rc);  }  else if (mClassID.Equals(kCImage)) {    nsImageWin* image;    NS_NEWXPCOM(image, nsImageWin);    inst = (nsISupports *)image;  }  else if (mClassID.Equals(kCRegion)) {    nsRegionWin*  region;    NS_NEWXPCOM(region, nsRegionWin);    inst = (nsISupports *)region;  }  else if (mClassID.Equals(kCBlender)) {    nsBlender* blender;    NS_NEWXPCOM(blender, nsBlender);    inst = (nsISupports *)blender;  }  else if (mClassID.Equals(kCDrawingSurface)) {    nsDrawingSurfaceWin* ds;    NS_NEWXPCOM(ds, nsDrawingSurfaceWin);    inst = (nsISupports *)((nsIDrawingSurface *)ds);  }  else if (mClassID.Equals(kCDeviceContextSpec)) {    nsDeviceContextSpecWin* dcs;    NS_NEWXPCOM(dcs, nsDeviceContextSpecWin);    inst = (nsISupports *)dcs;  }  else if (mClassID.Equals(kCDeviceContextSpecFactory)) {    nsDeviceContextSpecFactoryWin* dcs;    NS_NEWXPCOM(dcs, nsDeviceContextSpecFactoryWin);    inst = (nsISupports *)dcs;  }   else if (mClassID.Equals(kCScriptableRegion)) {    nsCOMPtr<nsIRegion> rgn;    NS_NEWXPCOM(rgn, nsRegionWin);    if (rgn != nsnull) {      nsIScriptableRegion* scriptableRgn = new nsScriptableRegion(rgn);      inst = (nsISupports *)scriptableRgn;    }  }  else if (mClassID.Equals(kImageManagerImpl)) {    nsCOMPtr<nsIImageManager> iManager;    res = NS_NewImageManager(getter_AddRefs(iManager));    already_addreffed = PR_TRUE;    if (NS_SUCCEEDED(res))    {      res = iManager->QueryInterface(NS_GET_IID(nsISupports), (void**)&inst);    }  }  else if (mClassID.Equals(kCPrintOptions)) {    NS_NEWXPCOM(inst, nsPrintOptionsWin);  }  else if (mClassID.Equals(kCFontEnumerator)) {    nsFontEnumeratorWin* fe;    NS_NEWXPCOM(fe, nsFontEnumeratorWin);    inst = (nsISupports *)fe;  } 	else if (mClassID.Equals(kCScreenManager)) {		NS_NEWXPCOM(inst, nsScreenManagerWin);  }   if (inst == NULL) {      return NS_ERROR_OUT_OF_MEMORY;    }    if (already_addreffed == PR_FALSE)    NS_ADDREF(inst);  // Stabilize    res = inst->QueryInterface(aIID, aResult);  NS_RELEASE(inst); // Destabilize and avoid leaks. Avoid calling delete <interface pointer>    return res;  }  