1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/src/nsThebesGfxFactory.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "gfxPlatform.h" // for gfxPlatform 1.10 +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 1.11 +#include "mozilla/Attributes.h" // for MOZ_FINAL 1.12 +#include "mozilla/Module.h" // for Module, Module::CIDEntry, etc 1.13 +#include "mozilla/ModuleUtils.h" 1.14 +#include "mozilla/mozalloc.h" // for operator new 1.15 +#include "nsCOMPtr.h" // for nsCOMPtr 1.16 +#include "nsError.h" // for NS_ERROR_NO_AGGREGATION, etc 1.17 +#include "nsGfxCIID.h" // for NS_FONT_ENUMERATOR_CID, etc 1.18 +#include "nsID.h" // for NS_DEFINE_NAMED_CID, etc 1.19 +#include "nsIScriptableRegion.h" // for nsIScriptableRegion 1.20 +#include "nsISupports.h" // for NS_DECL_ISUPPORTS, etc 1.21 +#include "nsScriptableRegion.h" // for nsScriptableRegion 1.22 +#include "nsThebesFontEnumerator.h" // for nsThebesFontEnumerator 1.23 + 1.24 +NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator) 1.25 + 1.26 +static nsresult 1.27 +nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) 1.28 +{ 1.29 + if (!aResult) { 1.30 + return NS_ERROR_NULL_POINTER; 1.31 + } 1.32 + *aResult = nullptr; 1.33 + if (aOuter) { 1.34 + return NS_ERROR_NO_AGGREGATION; 1.35 + } 1.36 + 1.37 + nsCOMPtr<nsIScriptableRegion> scriptableRgn = new nsScriptableRegion(); 1.38 + return scriptableRgn->QueryInterface(aIID, aResult); 1.39 +} 1.40 + 1.41 +NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID); 1.42 +NS_DEFINE_NAMED_CID(NS_SCRIPTABLE_REGION_CID); 1.43 + 1.44 +static const mozilla::Module::CIDEntry kThebesCIDs[] = { 1.45 + { &kNS_FONT_ENUMERATOR_CID, false, nullptr, nsThebesFontEnumeratorConstructor }, 1.46 + { &kNS_SCRIPTABLE_REGION_CID, false, nullptr, nsScriptableRegionConstructor }, 1.47 + { nullptr } 1.48 +}; 1.49 + 1.50 +static const mozilla::Module::ContractIDEntry kThebesContracts[] = { 1.51 + { "@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID }, 1.52 + { "@mozilla.org/gfx/region;1", &kNS_SCRIPTABLE_REGION_CID }, 1.53 + { nullptr } 1.54 +}; 1.55 + 1.56 +static const mozilla::Module kThebesModule = { 1.57 + mozilla::Module::kVersion, 1.58 + kThebesCIDs, 1.59 + kThebesContracts, 1.60 + nullptr, 1.61 + nullptr, 1.62 + nullptr, 1.63 + nullptr 1.64 +}; 1.65 + 1.66 +NSMODULE_DEFN(nsGfxModule) = &kThebesModule;