From e39041c9dda3160af62b44c2490bba9121a0a03e Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 5 Jan 2013 16:12:49 +1300 Subject: [PATCH] Bug 826632. Part 3: Create nsViewManagers directly instead of using XPCOM. r=tnikkel --HG-- extra : rebase_source : f6286a4bcffa2f80bd9d444f7c04005644b8cb2f --- layout/base/nsDocumentViewer.cpp | 10 ++-------- layout/base/nsPresShell.cpp | 5 +---- layout/build/nsLayoutModule.cpp | 7 ------- layout/printing/nsPrintEngine.cpp | 7 +------ view/public/Makefile.in | 1 - view/public/nsViewsCID.h | 17 ----------------- 6 files changed, 4 insertions(+), 43 deletions(-) delete mode 100644 view/public/nsViewsCID.h diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index d1a91c4702f..a8f3cfc4381 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -40,7 +40,6 @@ #include "nsLayoutStylesheetCache.h" #include "mozilla/Preferences.h" -#include "nsViewsCID.h" #include "nsIDeviceContextSpec.h" #include "nsViewManager.h" #include "nsView.h" @@ -497,8 +496,6 @@ private: //------------------------------------------------------------------ // nsDocumentViewer //------------------------------------------------------------------ -// Class IDs -static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID); //------------------------------------------------------------------ nsresult @@ -2272,14 +2269,11 @@ nsDocumentViewer::MakeWindow(const nsSize& aSize, nsView* aContainerView) DetachFromTopLevelWidget(); } - nsresult rv; - mViewManager = do_CreateInstance(kViewManagerCID, &rv); - if (NS_FAILED(rv)) - return rv; + mViewManager = new nsViewManager(); nsDeviceContext *dx = mPresContext->DeviceContext(); - rv = mViewManager->Init(dx); + nsresult rv = mViewManager->Init(dx); if (NS_FAILED(rv)) return rv; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 0d50d8092c0..427aecd9deb 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -72,7 +72,6 @@ #include "nsCaret.h" #include "nsIDOMHTMLDocument.h" #include "nsIDOMXMLDocument.h" -#include "nsViewsCID.h" #include "nsFrameManager.h" #include "nsEventStateManager.h" #include "nsIMEStateManager.h" @@ -7926,8 +7925,6 @@ nsIPresShell::RemoveRefreshObserverExternal(nsARefreshObserver* aObserver, #include "nsIURL.h" #include "nsILinkHandler.h" -static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID); - static void LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) { @@ -8270,7 +8267,7 @@ PresShell::VerifyIncrementalReflow() nsIWidget* parentWidget = rootView->GetWidget(); // Create a new view manager. - nsRefPtr vm = do_CreateInstance(kViewManagerCID); + nsRefPtr vm = new nsViewManager(); NS_ENSURE_TRUE(vm, false); rv = vm->Init(dc); NS_ENSURE_SUCCESS(rv, false); diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index ad41b6b499d..0589851d636 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -66,8 +66,6 @@ #include "nsChannelPolicy.h" // view stuff -#include "nsViewsCID.h" -#include "nsViewManager.h" #include "nsContentCreatorFunctions.h" // DOM includes @@ -594,8 +592,6 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \ return rv; \ } \ -NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager) - static nsresult CreateHTMLImgElement(nsISupports* aOuter, REFNSIID aIID, void** aResult) { @@ -755,7 +751,6 @@ NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_JSURI_CID); NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID); NS_DEFINE_NAMED_CID(NS_WINDOWCONTROLLER_CID); -NS_DEFINE_NAMED_CID(NS_VIEW_MANAGER_CID); NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID); NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID); #ifdef MOZ_MEDIA @@ -1039,7 +1034,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = { { &kNS_JSURI_CID, false, NULL, nsJSURIConstructor }, { &kNS_WINDOWCOMMANDTABLE_CID, false, NULL, CreateWindowCommandTableConstructor }, { &kNS_WINDOWCONTROLLER_CID, false, NULL, CreateWindowControllerWithSingletonCommandTable }, - { &kNS_VIEW_MANAGER_CID, false, NULL, nsViewManagerConstructor }, { &kNS_PLUGINDOCLOADERFACTORY_CID, false, NULL, CreateContentDLF }, { &kNS_PLUGINDOCUMENT_CID, false, NULL, CreatePluginDocument }, #ifdef MOZ_MEDIA @@ -1189,7 +1183,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = { { CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID }, { NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID }, { NS_WINDOWCONTROLLER_CONTRACTID, &kNS_WINDOWCONTROLLER_CID }, - { "@mozilla.org/view-manager;1", &kNS_VIEW_MANAGER_CID }, { PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID }, { NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID }, { TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID, &kTRANSFORMIIX_XSLT_PROCESSOR_CID }, diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 225ed61290b..2224765fddc 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -87,7 +87,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsLayoutUtils.h" #include "mozilla/Preferences.h" -#include "nsViewsCID.h" #include "nsWidgetsCID.h" #include "nsIDeviceContextSpec.h" #include "nsViewManager.h" @@ -216,9 +215,6 @@ protected: bool mSuppressed; }; -// Class IDs -static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID); - NS_IMPL_ISUPPORTS3(nsPrintEngine, nsIWebProgressListener, nsISupportsWeakReference, nsIObserver) @@ -2197,8 +2193,7 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO) nsresult rv = aPO->mPresContext->Init(mPrt->mPrintDC); NS_ENSURE_SUCCESS(rv, rv); - aPO->mViewManager = do_CreateInstance(kViewManagerCID, &rv); - NS_ENSURE_SUCCESS(rv,rv); + aPO->mViewManager = new nsViewManager(); rv = aPO->mViewManager->Init(mPrt->mPrintDC); NS_ENSURE_SUCCESS(rv,rv); diff --git a/view/public/Makefile.in b/view/public/Makefile.in index 15a90772c1f..49effdfb71a 100644 --- a/view/public/Makefile.in +++ b/view/public/Makefile.in @@ -15,7 +15,6 @@ MODULE = view EXPORTS = \ nsView.h \ nsViewManager.h \ - nsViewsCID.h \ nsIScrollPositionListener.h \ $(NULL) diff --git a/view/public/nsViewsCID.h b/view/public/nsViewsCID.h deleted file mode 100644 index 5c06871a423..00000000000 --- a/view/public/nsViewsCID.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsViewsCID_h__ -#define nsViewsCID_h__ - -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsIComponentManager.h" - -#define NS_VIEW_MANAGER_CID \ -{ 0xc95f1831, 0xc376, 0x11d1, \ - {0xb7, 0x21, 0x0, 0x60, 0x8, 0x91, 0xd8, 0xc9}} - -#endif // nsViewsCID_h__