Bug 458160 - Enable downloadable .otf fonts under Windows. r=roc, sr=vlad.
[wine-gecko.git] / layout / build / nsLayoutModule.cpp
blob31cf014cca7513762fbd62020fe2f58060315c15
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Pierre Phaneuf <pp@ludusdesign.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include "nsLayoutStatics.h"
40 #include "nsContentCID.h"
41 #include "nsContentDLF.h"
42 #include "nsContentPolicyUtils.h"
43 #include "nsDataDocumentContentPolicy.h"
44 #include "nsNoDataProtocolContentPolicy.h"
45 #include "nsDOMCID.h"
46 #include "nsCSSOMFactory.h"
47 #include "nsInspectorCSSUtils.h"
48 #include "nsHTMLContentSerializer.h"
49 #include "nsHTMLParts.h"
50 #include "nsGenericHTMLElement.h"
51 #include "nsICSSLoader.h"
52 #include "nsICSSParser.h"
53 #include "nsICSSStyleSheet.h"
54 #include "nsICategoryManager.h"
55 #include "nsIComponentManager.h"
56 #include "nsIComputedDOMStyle.h"
57 #include "nsIContentIterator.h"
58 #include "nsIContentSerializer.h"
59 #include "nsIController.h"
60 #include "nsIControllers.h"
61 #include "nsIDOMDOMImplementation.h"
62 #include "nsIDOMEventGroup.h"
63 #include "nsIDOMRange.h"
64 #include "nsIDocument.h"
65 #include "nsIDocumentEncoder.h"
66 #include "nsIDocumentViewer.h"
67 #include "nsIEventListenerManager.h"
68 #include "nsIFactory.h"
69 #include "nsFrameSelection.h"
70 #include "nsIFrameUtil.h"
71 #include "nsIGenericFactory.h"
72 #include "nsIHTMLCSSStyleSheet.h"
73 #include "nsIFragmentContentSink.h"
74 #include "nsHTMLStyleSheet.h"
75 #include "nsIHTMLToTextSink.h"
76 #include "nsILayoutDebugger.h"
77 #include "nsINameSpaceManager.h"
78 #include "nsINodeInfo.h"
79 #include "nsIObserver.h"
80 #include "nsIObserverService.h"
81 #include "nsPresContext.h"
82 #include "nsIPresShell.h"
83 #include "nsIPrivateDOMImplementation.h"
84 #include "nsIRangeUtils.h"
85 #include "nsIScriptNameSpaceManager.h"
86 #include "nsISelection.h"
87 #include "nsIXBLService.h"
88 #include "nsCaret.h"
89 #include "nsPlainTextSerializer.h"
90 #include "mozSanitizingSerializer.h"
91 #include "nsXMLContentSerializer.h"
92 #include "nsRuleNode.h"
93 #include "nsWyciwygProtocolHandler.h"
94 #include "nsContentAreaDragDrop.h"
95 #include "nsContentList.h"
96 #include "nsSyncLoadService.h"
97 #include "nsBox.h"
98 #include "nsIFrameTraversal.h"
99 #include "nsLayoutCID.h"
100 #include "nsILanguageAtomService.h"
101 #include "nsStyleSheetService.h"
102 #include "nsXULPopupManager.h"
104 // Transformiix stuff
105 #include "nsXPathEvaluator.h"
106 #include "txMozillaXSLTProcessor.h"
107 #include "txNodeSetAdaptor.h"
108 #include "nsXPath1Scheme.h"
110 #include "nsDOMParser.h"
111 #include "nsDOMSerializer.h"
112 #include "nsXMLHttpRequest.h"
114 // view stuff
115 #include "nsViewsCID.h"
116 #include "nsViewManager.h"
117 #include "nsContentCreatorFunctions.h"
119 // DOM includes
120 #include "nsDOMException.h"
121 #include "nsGlobalWindowCommands.h"
122 #include "nsIControllerCommandTable.h"
123 #include "nsJSProtocolHandler.h"
124 #include "nsScriptNameSpaceManager.h"
125 #include "nsIControllerContext.h"
126 #include "nsDOMScriptObjectFactory.h"
127 #include "nsDOMStorage.h"
128 #include "nsJSON.h"
130 #include "nsIFocusEventSuppressor.h"
132 // Editor stuff
133 #include "nsEditorCID.h"
134 #include "nsEditor.h"
135 #include "nsPlaintextEditor.h"
136 #include "nsEditorController.h" //CID
137 #include "nsIController.h"
138 #include "nsIControllerContext.h"
139 #include "nsIControllerCommandTable.h"
141 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
142 #include "nsHTMLEditor.h"
143 #include "nsTextServicesDocument.h"
144 #include "nsTextServicesCID.h"
145 #endif
147 #define NS_EDITORCOMMANDTABLE_CID \
148 { 0x4f5e62b8, 0xd659, 0x4156, { 0x84, 0xfc, 0x2f, 0x60, 0x99, 0x40, 0x03, 0x69 }}
150 static NS_DEFINE_CID(kEditorCommandTableCID, NS_EDITORCOMMANDTABLE_CID);
152 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlaintextEditor)
154 // Constructor of a controller which is set up to use, internally, a
155 // singleton command-table pre-filled with editor commands.
156 static NS_METHOD
157 nsEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
158 void **aResult)
160 nsresult rv;
161 nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
162 if (NS_FAILED(rv)) return rv;
164 nsCOMPtr<nsIControllerCommandTable> editorCommandTable = do_GetService(kEditorCommandTableCID, &rv);
165 if (NS_FAILED(rv)) return rv;
167 // this guy is a singleton, so make it immutable
168 editorCommandTable->MakeImmutable();
170 nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
171 if (NS_FAILED(rv)) return rv;
173 rv = controllerContext->Init(editorCommandTable);
174 if (NS_FAILED(rv)) return rv;
176 return controller->QueryInterface(aIID, aResult);
180 // Constructor for a command-table pref-filled with editor commands
181 static NS_METHOD
182 nsEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
183 void **aResult)
185 nsresult rv;
186 nsCOMPtr<nsIControllerCommandTable> commandTable =
187 do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
188 if (NS_FAILED(rv)) return rv;
190 rv = nsEditorController::RegisterEditorCommands(commandTable);
191 if (NS_FAILED(rv)) return rv;
193 // we don't know here whether we're being created as an instance,
194 // or a service, so we can't become immutable
196 return commandTable->QueryInterface(aIID, aResult);
200 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
201 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextServicesDocument)
202 #ifdef ENABLE_EDITOR_API_LOG
203 #include "nsHTMLEditorLog.h"
204 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLEditorLog)
205 #else
206 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLEditor)
207 #endif
208 #endif
210 #include "nsHTMLCanvasFrame.h"
212 #ifdef MOZ_ENABLE_CANVAS
213 #include "nsIDOMCanvasRenderingContext2D.h"
214 #endif
216 class nsIDocumentLoaderFactory;
218 #define PRODUCT_NAME "Gecko"
220 #define NS_HTMLIMGELEMENT_CONTRACTID \
221 "@mozilla.org/content/element/html;1?name=img"
223 #define NS_HTMLOPTIONELEMENT_CONTRACTID \
224 "@mozilla.org/content/element/html;1?name=option"
226 /* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */
227 #define NS_PLUGINDOCLOADERFACTORY_CID \
228 { 0x0ddf4df8, 0x4dbb, 0x4133, { 0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 } }
230 #define NS_WINDOWCOMMANDTABLE_CID \
231 { /* 0DE2FBFA-6B7F-11D7-BBBA-0003938A9D96 */ \
232 0x0DE2FBFA, 0x6B7F, 0x11D7, {0xBB, 0xBA, 0x00, 0x03, 0x93, 0x8A, 0x9D, 0x96} }
234 static NS_DEFINE_CID(kWindowCommandTableCID, NS_WINDOWCOMMANDTABLE_CID);
236 #include "nsIBoxObject.h"
238 #ifndef MOZ_NO_INSPECTOR_APIS
239 #ifdef MOZ_XUL
240 #include "inDOMView.h"
241 #endif /* MOZ_XUL */
243 #include "inDeepTreeWalker.h"
244 #include "inFlasher.h"
245 #include "inCSSValueSearch.h"
246 #include "inDOMUtils.h"
247 #endif /* MOZ_NO_INSPECTOR_APIS */
249 #ifdef MOZ_XUL
250 #include "nsIXULDocument.h"
251 #include "nsIXULPrototypeCache.h"
252 #include "nsIXULSortService.h"
254 NS_IMETHODIMP
255 NS_NewXULContentBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
257 NS_IMETHODIMP
258 NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
259 #endif
261 static nsresult Initialize(nsIModule* aSelf);
262 static void Shutdown();
264 #ifdef MOZ_XTF
265 #include "nsIXTFService.h"
266 #include "nsIXMLContentBuilder.h"
267 #endif
269 #include "nsGeolocation.h"
271 // Transformiix
272 /* {0C351177-0159-4500-86B0-A219DFDE4258} */
273 #define TRANSFORMIIX_XPATH1_SCHEME_CID \
274 { 0xc351177, 0x159, 0x4500, { 0x86, 0xb0, 0xa2, 0x19, 0xdf, 0xde, 0x42, 0x58 } }
276 /* 5d5d92cd-6bf8-11d9-bf4a-000a95dc234c */
277 #define TRANSFORMIIX_NODESET_CID \
278 { 0x5d5d92cd, 0x6bf8, 0x11d9, { 0xbf, 0x4a, 0x0, 0x0a, 0x95, 0xdc, 0x23, 0x4c } }
280 #define TRANSFORMIIX_NODESET_CONTRACTID \
281 "@mozilla.org/transformiix-nodeset;1"
283 NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPath1SchemeProcessor)
285 // Factory Constructor
286 NS_GENERIC_FACTORY_CONSTRUCTOR(txMozillaXSLTProcessor)
287 NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsXPathEvaluator, Init)
288 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
289 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
290 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsXMLHttpRequest, Init)
291 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMParser)
292 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDOMStorageManager,
293 nsDOMStorageManager::GetInstance)
295 //-----------------------------------------------------------------------------
297 // Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and
298 // perform shutdown of the layout modules at that time instead of waiting for
299 // our module destructor to run. If we do not do this, then we risk holding
300 // references to objects in other component libraries that have already been
301 // shutdown (and possibly unloaded if 60709 is ever fixed).
303 class LayoutShutdownObserver : public nsIObserver
305 public:
306 NS_DECL_ISUPPORTS
307 NS_DECL_NSIOBSERVER
310 NS_IMPL_ISUPPORTS1(LayoutShutdownObserver, nsIObserver)
312 NS_IMETHODIMP
313 LayoutShutdownObserver::Observe(nsISupports *aSubject,
314 const char *aTopic,
315 const PRUnichar *someData)
317 if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
318 Shutdown();
319 return NS_OK;
322 //-----------------------------------------------------------------------------
324 static PRBool gInitialized = PR_FALSE;
326 // Perform our one-time intialization for this module
328 // static
329 nsresult
330 Initialize(nsIModule* aSelf)
332 NS_PRECONDITION(!gInitialized, "module already initialized");
333 if (gInitialized) {
334 return NS_OK;
337 NS_ASSERTION(sizeof(PtrBits) == sizeof(void *),
338 "Eeek! You'll need to adjust the size of PtrBits to the size "
339 "of a pointer on your platform.");
341 gInitialized = PR_TRUE;
343 nsresult rv = nsLayoutStatics::Initialize();
344 if (NS_FAILED(rv)) {
345 Shutdown();
346 return rv;
349 // Add our shutdown observer.
350 nsCOMPtr<nsIObserverService> observerService =
351 do_GetService("@mozilla.org/observer-service;1");
353 if (observerService) {
354 LayoutShutdownObserver* observer = new LayoutShutdownObserver();
356 if (!observer) {
357 Shutdown();
359 return NS_ERROR_OUT_OF_MEMORY;
362 observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
363 } else {
364 NS_WARNING("Could not get an observer service. We will leak on shutdown.");
367 return NS_OK;
370 // Shutdown this module, releasing all of the module resources
372 // static
373 void
374 Shutdown()
376 NS_PRECONDITION(gInitialized, "module not initialized");
377 if (!gInitialized)
378 return;
380 gInitialized = PR_FALSE;
382 nsLayoutStatics::Release();
385 #ifdef NS_DEBUG
386 nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
387 nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
388 #endif
390 nsresult NS_NewBoxObject(nsIBoxObject** aResult);
392 #ifdef MOZ_XUL
393 nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
394 nsresult NS_NewScrollBoxObject(nsIBoxObject** aResult);
395 nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
396 nsresult NS_NewPopupBoxObject(nsIBoxObject** aResult);
397 nsresult NS_NewContainerBoxObject(nsIBoxObject** aResult);
398 nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
399 #endif
401 #ifdef MOZ_ENABLE_CANVAS
402 nsresult NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult);
403 #endif
405 nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
407 nsresult NS_NewSelection(nsFrameSelection** aResult);
408 nsresult NS_NewDomSelection(nsISelection** aResult);
409 nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
410 nsresult NS_NewRange(nsIDOMRange** aResult);
411 nsresult NS_NewRangeUtils(nsIRangeUtils** aResult);
412 nsresult NS_NewContentIterator(nsIContentIterator** aResult);
413 nsresult NS_NewPreContentIterator(nsIContentIterator** aResult);
414 nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
415 nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult);
416 nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
417 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
418 nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
419 nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
420 nsresult NS_NewXBLService(nsIXBLService** aResult);
421 nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
422 nsresult NS_NewDOMEventGroup(nsIDOMEventGroup** aResult);
423 nsresult NS_NewFocusEventSuppressorService(nsIFocusEventSuppressorService** aResult);
425 NS_IMETHODIMP NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
427 #define MAKE_CTOR(ctor_, iface_, func_) \
428 static NS_IMETHODIMP \
429 ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
431 *aResult = nsnull; \
432 if (aOuter) \
433 return NS_ERROR_NO_AGGREGATION; \
434 iface_* inst; \
435 nsresult rv = func_(&inst); \
436 if (NS_SUCCEEDED(rv)) { \
437 rv = inst->QueryInterface(aIID, aResult); \
438 NS_RELEASE(inst); \
440 return rv; \
443 #ifdef DEBUG
444 MAKE_CTOR(CreateNewFrameUtil, nsIFrameUtil, NS_NewFrameUtil)
445 MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
446 #endif
448 MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
449 MAKE_CTOR(CreateNewPresShell, nsIPresShell, NS_NewPresShell)
450 MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject)
452 #ifdef MOZ_XUL
453 MAKE_CTOR(CreateNewListBoxObject, nsIBoxObject, NS_NewListBoxObject)
454 MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject)
455 MAKE_CTOR(CreateNewPopupBoxObject, nsIBoxObject, NS_NewPopupBoxObject)
456 MAKE_CTOR(CreateNewScrollBoxObject, nsIBoxObject, NS_NewScrollBoxObject)
457 MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
458 MAKE_CTOR(CreateNewContainerBoxObject, nsIBoxObject, NS_NewContainerBoxObject)
459 #endif // MOZ_XUL
461 #ifndef MOZ_NO_INSPECTOR_APIS
462 #ifdef MOZ_XUL
463 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMView)
464 #endif
465 NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
466 NS_GENERIC_FACTORY_CONSTRUCTOR(inFlasher)
467 NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
468 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
469 #endif
471 MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_GetNameSpaceManager)
472 MAKE_CTOR(CreateEventListenerManager, nsIEventListenerManager, NS_NewEventListenerManager)
473 MAKE_CTOR(CreateDOMEventGroup, nsIDOMEventGroup, NS_NewDOMEventGroup)
474 MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
475 MAKE_CTOR(CreateCSSStyleSheet, nsICSSStyleSheet, NS_NewCSSStyleSheet)
476 MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
477 MAKE_CTOR(CreateHTMLCSSStyleSheet, nsIHTMLCSSStyleSheet, NS_NewHTMLCSSStyleSheet)
478 MAKE_CTOR(CreateDOMImplementation, nsIDOMDOMImplementation, NS_NewDOMImplementation)
479 MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
480 #ifdef MOZ_SVG
481 MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
482 #endif
483 MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
484 MAKE_CTOR(CreateCSSParser, nsICSSParser, NS_NewCSSParser)
485 MAKE_CTOR(CreateCSSLoader, nsICSSLoader, NS_NewCSSLoader)
486 MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
487 MAKE_CTOR(CreateSelection, nsFrameSelection, NS_NewSelection)
488 MAKE_CTOR(CreateRange, nsIDOMRange, NS_NewRange)
489 MAKE_CTOR(CreateRangeUtils, nsIRangeUtils, NS_NewRangeUtils)
490 MAKE_CTOR(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
491 MAKE_CTOR(CreatePreContentIterator, nsIContentIterator, NS_NewPreContentIterator)
492 MAKE_CTOR(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
493 // CreateHTMLImgElement, see below
494 // CreateHTMLOptionElement, see below
495 MAKE_CTOR(CreateTextEncoder, nsIDocumentEncoder, NS_NewTextEncoder)
496 MAKE_CTOR(CreateHTMLCopyTextEncoder, nsIDocumentEncoder, NS_NewHTMLCopyTextEncoder)
497 MAKE_CTOR(CreateXMLContentSerializer, nsIContentSerializer, NS_NewXMLContentSerializer)
498 MAKE_CTOR(CreateHTMLContentSerializer, nsIContentSerializer, NS_NewHTMLContentSerializer)
499 MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPlainTextSerializer)
500 MAKE_CTOR(CreateHTMLFragmentSink, nsIFragmentContentSink, NS_NewHTMLFragmentContentSink)
501 MAKE_CTOR(CreateHTMLFragmentSink2, nsIFragmentContentSink, NS_NewHTMLFragmentContentSink2)
502 MAKE_CTOR(CreateHTMLParanoidFragmentSink, nsIFragmentContentSink, NS_NewHTMLParanoidFragmentSink)
503 MAKE_CTOR(CreateXMLFragmentSink, nsIFragmentContentSink, NS_NewXMLFragmentContentSink)
504 MAKE_CTOR(CreateXMLFragmentSink2, nsIFragmentContentSink, NS_NewXMLFragmentContentSink2)
505 MAKE_CTOR(CreateXHTMLParanoidFragmentSink,nsIFragmentContentSink, NS_NewXHTMLParanoidFragmentSink)
506 MAKE_CTOR(CreateSanitizingHTMLSerializer, nsIContentSerializer, NS_NewSanitizingHTMLSerializer)
507 MAKE_CTOR(CreateXBLService, nsIXBLService, NS_NewXBLService)
508 MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy)
509 MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewComputedDOMStyle)
510 MAKE_CTOR(CreateFocusEventSuppressorService,nsIFocusEventSuppressorService,NS_NewFocusEventSuppressorService)
511 #ifdef MOZ_XUL
512 MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
513 // NS_NewXULContentBuilder
514 // NS_NewXULTreeBuilder
515 MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
516 // NS_NewXULControllers
517 // NS_NewXULPrototypeCache
518 MAKE_CTOR(CreateXULPopupManager, nsISupports, NS_NewXULPopupManager)
519 #endif
520 #ifdef MOZ_XTF
521 MAKE_CTOR(CreateXTFService, nsIXTFService, NS_NewXTFService)
522 MAKE_CTOR(CreateXMLContentBuilder, nsIXMLContentBuilder, NS_NewXMLContentBuilder)
523 #endif
524 MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
525 NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSSOMFactory)
526 NS_GENERIC_FACTORY_CONSTRUCTOR(nsInspectorCSSUtils)
527 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWyciwygProtocolHandler)
528 NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentAreaDragDrop)
529 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
530 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
531 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSyncLoadService)
532 MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument)
533 #ifdef MOZ_MEDIA
534 MAKE_CTOR(CreateVideoDocument, nsIDocument, NS_NewVideoDocument)
535 #endif
537 #ifdef MOZ_ENABLE_CANVAS
538 MAKE_CTOR(CreateCanvasRenderingContext2D, nsIDOMCanvasRenderingContext2D, NS_NewCanvasRenderingContext2D)
539 #endif
541 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStyleSheetService, Init)
543 NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURI)
545 // views are not refcounted, so this is the same as
546 // NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE
547 #define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass) \
548 static NS_IMETHODIMP \
549 _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
550 void **aResult) \
552 nsresult rv; \
554 _InstanceClass * inst; \
556 *aResult = NULL; \
557 if (NULL != aOuter) { \
558 rv = NS_ERROR_NO_AGGREGATION; \
559 return rv; \
562 NS_NEWXPCOM(inst, _InstanceClass); \
563 if (NULL == inst) { \
564 rv = NS_ERROR_OUT_OF_MEMORY; \
565 return rv; \
567 rv = inst->QueryInterface(aIID, aResult); \
569 return rv; \
572 NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager)
574 static NS_IMETHODIMP
575 CreateHTMLImgElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
577 *aResult = nsnull;
578 if (aOuter)
579 return NS_ERROR_NO_AGGREGATION;
580 // Note! NS_NewHTMLImageElement is special cased to handle a null nodeinfo
581 nsIContent* inst = NS_NewHTMLImageElement(nsnull);
582 nsresult rv = NS_ERROR_OUT_OF_MEMORY;
583 if (inst) {
584 NS_ADDREF(inst);
585 rv = inst->QueryInterface(aIID, aResult);
586 NS_RELEASE(inst);
588 return rv;
591 static NS_IMETHODIMP
592 RegisterHTMLImgElement(nsIComponentManager *aCompMgr,
593 nsIFile* aPath,
594 const char* aRegistryLocation,
595 const char* aComponentType,
596 const nsModuleComponentInfo* aInfo)
598 nsCOMPtr<nsICategoryManager> catman =
599 do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
601 if (!catman)
602 return NS_ERROR_FAILURE;
604 nsXPIDLCString previous;
605 nsresult rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
606 "Image", NS_HTMLIMGELEMENT_CONTRACTID,
607 PR_TRUE, PR_TRUE, getter_Copies(previous));
608 NS_ENSURE_SUCCESS(rv, rv);
610 return catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
611 "Image", "HTMLImageElement",
612 PR_TRUE, PR_TRUE, getter_Copies(previous));
615 static NS_IMETHODIMP
616 UnregisterHTMLImgElement(nsIComponentManager* aCompMgr,
617 nsIFile* aPath,
618 const char* aRegistryLocation,
619 const nsModuleComponentInfo* aInfo)
621 // XXX remove category entry
622 return NS_OK;
625 static NS_IMETHODIMP
626 CreateHTMLOptionElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
628 *aResult = nsnull;
629 if (aOuter)
630 return NS_ERROR_NO_AGGREGATION;
631 // Note! NS_NewHTMLOptionElement is special cased to handle a null nodeinfo
632 nsIContent* inst = NS_NewHTMLOptionElement(nsnull);
633 nsresult rv = NS_ERROR_OUT_OF_MEMORY;
634 if (inst) {
635 NS_ADDREF(inst);
636 rv = inst->QueryInterface(aIID, aResult);
637 NS_RELEASE(inst);
639 return rv;
642 static NS_IMETHODIMP
643 RegisterHTMLOptionElement(nsIComponentManager *aCompMgr,
644 nsIFile* aPath,
645 const char* aRegistryLocation,
646 const char* aComponentType,
647 const nsModuleComponentInfo* aInfo)
649 nsCOMPtr<nsICategoryManager> catman =
650 do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
652 if (!catman)
653 return NS_ERROR_FAILURE;
655 nsXPIDLCString previous;
656 nsresult rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
657 "Option", NS_HTMLOPTIONELEMENT_CONTRACTID,
658 PR_TRUE, PR_TRUE, getter_Copies(previous));
659 NS_ENSURE_SUCCESS(rv, rv);
661 return catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
662 "Option", "HTMLOptionElement",
663 PR_TRUE, PR_TRUE, getter_Copies(previous));
666 static NS_IMETHODIMP
667 UnregisterHTMLOptionElement(nsIComponentManager* aCompMgr,
668 nsIFile* aPath,
669 const char* aRegistryLocation,
670 const nsModuleComponentInfo* aInfo)
672 // XXX remove category entry
673 return NS_OK;
676 static NS_METHOD
677 RegisterDataDocumentContentPolicy(nsIComponentManager *aCompMgr,
678 nsIFile* aPath,
679 const char* aRegistryLocation,
680 const char* aComponentType,
681 const nsModuleComponentInfo* aInfo)
683 nsresult rv;
684 nsCOMPtr<nsICategoryManager> catman =
685 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
686 if (NS_FAILED(rv)) {
687 return rv;
689 nsXPIDLCString previous;
690 return catman->AddCategoryEntry("content-policy",
691 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
692 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
693 PR_TRUE, PR_TRUE, getter_Copies(previous));
696 static NS_METHOD
697 UnregisterDataDocumentContentPolicy(nsIComponentManager *aCompMgr,
698 nsIFile *aPath,
699 const char *registryLocation,
700 const nsModuleComponentInfo *info)
702 nsresult rv;
703 nsCOMPtr<nsICategoryManager> catman =
704 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
705 if (NS_FAILED(rv)) {
706 return rv;
709 return catman->DeleteCategoryEntry("content-policy",
710 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
711 PR_TRUE);
714 static NS_METHOD
715 RegisterNoDataProtocolContentPolicy(nsIComponentManager *aCompMgr,
716 nsIFile* aPath,
717 const char* aRegistryLocation,
718 const char* aComponentType,
719 const nsModuleComponentInfo* aInfo)
721 nsresult rv;
722 nsCOMPtr<nsICategoryManager> catman =
723 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
724 if (NS_FAILED(rv)) {
725 return rv;
727 nsXPIDLCString previous;
728 return catman->AddCategoryEntry("content-policy",
729 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
730 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
731 PR_TRUE, PR_TRUE, getter_Copies(previous));
734 static NS_METHOD
735 UnregisterNoDataProtocolContentPolicy(nsIComponentManager *aCompMgr,
736 nsIFile *aPath,
737 const char *registryLocation,
738 const nsModuleComponentInfo *info)
740 nsresult rv;
741 nsCOMPtr<nsICategoryManager> catman =
742 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
743 if (NS_FAILED(rv)) {
744 return rv;
747 return catman->DeleteCategoryEntry("content-policy",
748 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
749 PR_TRUE);
752 static NS_METHOD
753 CreateWindowCommandTableConstructor(nsISupports *aOuter,
754 REFNSIID aIID, void **aResult)
756 nsresult rv;
757 nsCOMPtr<nsIControllerCommandTable> commandTable =
758 do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
759 if (NS_FAILED(rv)) return rv;
761 rv = nsWindowCommandRegistration::RegisterWindowCommands(commandTable);
762 if (NS_FAILED(rv)) return rv;
764 return commandTable->QueryInterface(aIID, aResult);
767 static NS_METHOD
768 CreateWindowControllerWithSingletonCommandTable(nsISupports *aOuter,
769 REFNSIID aIID, void **aResult)
771 nsresult rv;
772 nsCOMPtr<nsIController> controller =
773 do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
775 if (NS_FAILED(rv)) return rv;
777 nsCOMPtr<nsIControllerCommandTable> windowCommandTable = do_GetService(kWindowCommandTableCID, &rv);
778 if (NS_FAILED(rv)) return rv;
780 // this is a singleton; make it immutable
781 windowCommandTable->MakeImmutable();
783 nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
784 if (NS_FAILED(rv)) return rv;
786 controllerContext->Init(windowCommandTable);
787 if (NS_FAILED(rv)) return rv;
789 return controller->QueryInterface(aIID, aResult);
792 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMScriptObjectFactory)
793 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBaseDOMException)
795 #define NS_GEOLOCATION_SERVICE_CID \
796 { 0x404d02a, 0x1CA, 0xAAAB, { 0x47, 0x62, 0x94, 0x4b, 0x1b, 0xf2, 0xf7, 0xb5 } }
798 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsGeolocationService, nsGeolocationService::GetGeolocationService)
800 // The list of components we register
801 static const nsModuleComponentInfo gComponents[] = {
802 #ifdef DEBUG
803 { "Frame utility",
804 NS_FRAME_UTIL_CID,
805 nsnull,
806 CreateNewFrameUtil },
807 { "Layout debugger",
808 NS_LAYOUT_DEBUGGER_CID,
809 nsnull,
810 CreateNewLayoutDebugger },
811 #endif
813 { "Frame Traversal",
814 NS_FRAMETRAVERSAL_CID,
815 nsnull,
816 CreateNewFrameTraversal },
818 // XXX ick
819 { "Presentation shell",
820 NS_PRESSHELL_CID,
821 nsnull,
822 CreateNewPresShell },
824 // XXX end ick
826 { "Box Object",
827 NS_BOXOBJECT_CID,
828 "@mozilla.org/layout/xul-boxobject;1",
829 CreateNewBoxObject },
831 #ifdef MOZ_XUL
832 { "XUL Listbox Box Object",
833 NS_LISTBOXOBJECT_CID,
834 "@mozilla.org/layout/xul-boxobject-listbox;1",
835 CreateNewListBoxObject },
837 { "XUL Menu Box Object",
838 NS_MENUBOXOBJECT_CID,
839 "@mozilla.org/layout/xul-boxobject-menu;1",
840 CreateNewMenuBoxObject },
842 { "XUL Popup Box Object",
843 NS_POPUPBOXOBJECT_CID,
844 "@mozilla.org/layout/xul-boxobject-popup;1",
845 CreateNewPopupBoxObject },
847 { "Container Box Object",
848 NS_CONTAINERBOXOBJECT_CID,
849 "@mozilla.org/layout/xul-boxobject-container;1",
850 CreateNewContainerBoxObject },
852 { "XUL ScrollBox Object",
853 NS_SCROLLBOXOBJECT_CID,
854 "@mozilla.org/layout/xul-boxobject-scrollbox;1",
855 CreateNewScrollBoxObject },
857 { "XUL Tree Box Object",
858 NS_TREEBOXOBJECT_CID,
859 "@mozilla.org/layout/xul-boxobject-tree;1",
860 CreateNewTreeBoxObject },
862 #endif // MOZ_XUL
864 #ifndef MOZ_NO_INSPECTOR_APIS
865 #ifdef MOZ_XUL
866 { "DOM View",
867 IN_DOMVIEW_CID,
868 "@mozilla.org/inspector/dom-view;1",
869 inDOMViewConstructor },
870 #endif
872 { "Deep Tree Walker",
873 IN_DEEPTREEWALKER_CID,
874 "@mozilla.org/inspector/deep-tree-walker;1",
875 inDeepTreeWalkerConstructor },
877 { "Flasher",
878 IN_FLASHER_CID,
879 "@mozilla.org/inspector/flasher;1",
880 inFlasherConstructor },
882 { "CSS Value Search",
883 IN_CSSVALUESEARCH_CID,
884 "@mozilla.org/inspector/search;1?type=cssvalue",
885 inCSSValueSearchConstructor },
887 { "DOM Utils",
888 IN_DOMUTILS_CID,
889 "@mozilla.org/inspector/dom-utils;1",
890 inDOMUtilsConstructor },
893 #endif // MOZ_NO_INSPECTOR_APIS
895 { "Namespace manager",
896 NS_NAMESPACEMANAGER_CID,
897 NS_NAMESPACEMANAGER_CONTRACTID,
898 CreateNameSpaceManager },
900 { "Event listener manager",
901 NS_EVENTLISTENERMANAGER_CID,
902 nsnull,
903 CreateEventListenerManager },
905 { "DOM Event group",
906 NS_DOMEVENTGROUP_CID,
907 nsnull,
908 CreateDOMEventGroup },
910 { "Document Viewer",
911 NS_DOCUMENT_VIEWER_CID,
912 nsnull,
913 CreateDocumentViewer },
915 { "CSS Style Sheet",
916 NS_CSS_STYLESHEET_CID,
917 nsnull,
918 CreateCSSStyleSheet },
920 { "HTML document",
921 NS_HTMLDOCUMENT_CID,
922 nsnull,
923 CreateHTMLDocument },
925 { "HTML-CSS style sheet",
926 NS_HTML_CSS_STYLESHEET_CID,
927 nsnull,
928 CreateHTMLCSSStyleSheet },
930 { "DOM implementation",
931 NS_DOM_IMPLEMENTATION_CID,
932 nsnull,
933 CreateDOMImplementation },
936 { "XML document",
937 NS_XMLDOCUMENT_CID,
938 "@mozilla.org/xml/xml-document;1",
939 CreateXMLDocument },
941 #ifdef MOZ_SVG
942 { "SVG document",
943 NS_SVGDOCUMENT_CID,
944 "@mozilla.org/svg/svg-document;1",
945 CreateSVGDocument },
946 #endif
948 { "Image document",
949 NS_IMAGEDOCUMENT_CID,
950 nsnull,
951 CreateImageDocument },
953 { "CSS parser",
954 NS_CSSPARSER_CID,
955 "@mozilla.org/content/css-parser;1",
956 CreateCSSParser },
958 { "CSS loader",
959 NS_CSS_LOADER_CID,
960 nsnull,
961 CreateCSSLoader },
963 { "Dom selection",
964 NS_DOMSELECTION_CID,
965 "@mozilla.org/content/dom-selection;1",
966 CreateDOMSelection },
968 { "Frame selection",
969 NS_FRAMESELECTION_CID,
970 nsnull,
971 CreateSelection },
973 { "Range",
974 NS_RANGE_CID,
975 "@mozilla.org/content/range;1",
976 CreateRange },
978 { "Range Utils",
979 NS_RANGEUTILS_CID,
980 "@mozilla.org/content/range-utils;1",
981 CreateRangeUtils },
983 { "Content iterator",
984 NS_CONTENTITERATOR_CID,
985 "@mozilla.org/content/post-content-iterator;1",
986 CreateContentIterator },
988 { "Pre Content iterator",
989 NS_PRECONTENTITERATOR_CID,
990 "@mozilla.org/content/pre-content-iterator;1",
991 CreatePreContentIterator },
993 { "Subtree iterator",
994 NS_SUBTREEITERATOR_CID,
995 "@mozilla.org/content/subtree-content-iterator;1",
996 CreateSubtreeIterator },
998 { "CSS Object Model Factory",
999 NS_CSSOMFACTORY_CID,
1000 nsnull,
1001 nsCSSOMFactoryConstructor },
1003 { "Inspector CSS Utils",
1004 NS_INSPECTORCSSUTILS_CID,
1005 nsnull,
1006 nsInspectorCSSUtilsConstructor },
1008 // Needed to support "new Option;" and "new Image;" in JavaScript
1009 { "HTML img element",
1010 NS_HTMLIMAGEELEMENT_CID,
1011 NS_HTMLIMGELEMENT_CONTRACTID,
1012 CreateHTMLImgElement,
1013 RegisterHTMLImgElement,
1014 UnregisterHTMLImgElement },
1016 { "HTML option element",
1017 NS_HTMLOPTIONELEMENT_CID,
1018 NS_HTMLOPTIONELEMENT_CONTRACTID,
1019 CreateHTMLOptionElement,
1020 RegisterHTMLOptionElement,
1021 UnregisterHTMLOptionElement },
1023 #ifdef MOZ_ENABLE_CANVAS
1024 { "Canvas 2D Rendering Context",
1025 NS_CANVASRENDERINGCONTEXT2D_CID,
1026 "@mozilla.org/content/canvas-rendering-context;1?id=2d",
1027 CreateCanvasRenderingContext2D },
1028 #endif
1030 { "XML document encoder",
1031 NS_TEXT_ENCODER_CID,
1032 NS_DOC_ENCODER_CONTRACTID_BASE "text/xml",
1033 CreateTextEncoder },
1035 { "XML document encoder",
1036 NS_TEXT_ENCODER_CID,
1037 NS_DOC_ENCODER_CONTRACTID_BASE "application/xml",
1038 CreateTextEncoder },
1040 { "XML document encoder",
1041 NS_TEXT_ENCODER_CID,
1042 NS_DOC_ENCODER_CONTRACTID_BASE "application/xhtml+xml",
1043 CreateTextEncoder },
1045 #ifdef MOZ_SVG
1046 { "SVG document encoder",
1047 NS_TEXT_ENCODER_CID,
1048 NS_DOC_ENCODER_CONTRACTID_BASE "image/svg+xml",
1049 CreateTextEncoder },
1050 #endif
1052 { "HTML document encoder",
1053 NS_TEXT_ENCODER_CID,
1054 NS_DOC_ENCODER_CONTRACTID_BASE "text/html",
1055 CreateTextEncoder },
1057 { "Plaintext document encoder",
1058 NS_TEXT_ENCODER_CID,
1059 NS_DOC_ENCODER_CONTRACTID_BASE "text/plain",
1060 CreateTextEncoder },
1062 { "HTML copy encoder",
1063 NS_HTMLCOPY_TEXT_ENCODER_CID,
1064 NS_HTMLCOPY_ENCODER_CONTRACTID,
1065 CreateHTMLCopyTextEncoder },
1067 { "XML content serializer",
1068 NS_XMLCONTENTSERIALIZER_CID,
1069 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml",
1070 CreateXMLContentSerializer },
1072 { "XML content serializer",
1073 NS_XMLCONTENTSERIALIZER_CID,
1074 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xml",
1075 CreateXMLContentSerializer },
1077 { "XML content serializer",
1078 NS_XMLCONTENTSERIALIZER_CID,
1079 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml",
1080 CreateXMLContentSerializer },
1082 #ifdef MOZ_SVG
1083 { "SVG content serializer",
1084 NS_XMLCONTENTSERIALIZER_CID,
1085 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml",
1086 CreateXMLContentSerializer },
1087 #endif
1089 { "HTML content serializer",
1090 NS_HTMLCONTENTSERIALIZER_CID,
1091 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html",
1092 CreateHTMLContentSerializer },
1094 { "XUL content serializer",
1095 NS_XMLCONTENTSERIALIZER_CID,
1096 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/vnd.mozilla.xul+xml",
1097 CreateXMLContentSerializer },
1099 { "plaintext content serializer",
1100 NS_PLAINTEXTSERIALIZER_CID,
1101 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain",
1102 CreatePlainTextSerializer },
1104 { "plaintext sink",
1105 NS_PLAINTEXTSERIALIZER_CID,
1106 NS_PLAINTEXTSINK_CONTRACTID,
1107 CreatePlainTextSerializer },
1109 { "html fragment sink",
1110 NS_HTMLFRAGMENTSINK_CID,
1111 NS_HTMLFRAGMENTSINK_CONTRACTID,
1112 CreateHTMLFragmentSink },
1114 { "html fragment sink 2",
1115 NS_HTMLFRAGMENTSINK2_CID,
1116 NS_HTMLFRAGMENTSINK2_CONTRACTID,
1117 CreateHTMLFragmentSink2 },
1119 { "html paranoid fragment sink",
1120 NS_HTMLPARANOIDFRAGMENTSINK_CID,
1121 NS_HTMLPARANOIDFRAGMENTSINK_CONTRACTID,
1122 CreateHTMLParanoidFragmentSink },
1124 { "HTML sanitizing content serializer",
1125 MOZ_SANITIZINGHTMLSERIALIZER_CID,
1126 MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID,
1127 CreateSanitizingHTMLSerializer },
1129 { "xml fragment sink",
1130 NS_XMLFRAGMENTSINK_CID,
1131 NS_XMLFRAGMENTSINK_CONTRACTID,
1132 CreateXMLFragmentSink },
1134 { "xml fragment sink 2",
1135 NS_XMLFRAGMENTSINK2_CID,
1136 NS_XMLFRAGMENTSINK2_CONTRACTID,
1137 CreateXMLFragmentSink2 },
1139 { "xhtml paranoid fragment sink",
1140 NS_XHTMLPARANOIDFRAGMENTSINK_CID,
1141 NS_XHTMLPARANOIDFRAGMENTSINK_CONTRACTID,
1142 CreateXHTMLParanoidFragmentSink },
1144 { "XBL Service",
1145 NS_XBLSERVICE_CID,
1146 "@mozilla.org/xbl;1",
1147 CreateXBLService },
1149 { "Content policy service",
1150 NS_CONTENTPOLICY_CID,
1151 NS_CONTENTPOLICY_CONTRACTID,
1152 CreateContentPolicy },
1154 { "Data document content policy",
1155 NS_DATADOCUMENTCONTENTPOLICY_CID,
1156 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
1157 nsDataDocumentContentPolicyConstructor,
1158 RegisterDataDocumentContentPolicy,
1159 UnregisterDataDocumentContentPolicy },
1161 { "No data protocol content policy",
1162 NS_NODATAPROTOCOLCONTENTPOLICY_CID,
1163 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
1164 nsNoDataProtocolContentPolicyConstructor,
1165 RegisterNoDataProtocolContentPolicy,
1166 UnregisterNoDataProtocolContentPolicy },
1168 { "DOM CSS Computed Style Declaration",
1169 NS_COMPUTEDDOMSTYLE_CID,
1170 "@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1",
1171 CreateComputedDOMStyle },
1173 { "XUL Controllers",
1174 NS_XULCONTROLLERS_CID,
1175 "@mozilla.org/xul/xul-controllers;1",
1176 NS_NewXULControllers },
1178 #ifdef MOZ_XUL
1179 { "XUL Sort Service",
1180 NS_XULSORTSERVICE_CID,
1181 "@mozilla.org/xul/xul-sort-service;1",
1182 CreateXULSortService },
1184 { "XUL Template Builder",
1185 NS_XULTEMPLATEBUILDER_CID,
1186 "@mozilla.org/xul/xul-template-builder;1",
1187 NS_NewXULContentBuilder },
1189 { "XUL Tree Builder",
1190 NS_XULTREEBUILDER_CID,
1191 "@mozilla.org/xul/xul-tree-builder;1",
1192 NS_NewXULTreeBuilder },
1194 { "XUL Popup Manager",
1195 NS_XULPOPUPMANAGER_CID,
1196 "@mozilla.org/xul/xul-popup-manager;1",
1197 CreateXULPopupManager },
1199 { "XUL Document",
1200 NS_XULDOCUMENT_CID,
1201 "@mozilla.org/xul/xul-document;1",
1202 CreateXULDocument },
1204 { "XUL Prototype Cache",
1205 NS_XULPROTOTYPECACHE_CID,
1206 "@mozilla.org/xul/xul-prototype-cache;1",
1207 NS_NewXULPrototypeCache },
1209 #endif
1211 #ifdef MOZ_XTF
1212 { "XTF Service",
1213 NS_XTFSERVICE_CID,
1214 NS_XTFSERVICE_CONTRACTID,
1215 CreateXTFService },
1217 { "XML Content Builder",
1218 NS_XMLCONTENTBUILDER_CID,
1219 NS_XMLCONTENTBUILDER_CONTRACTID,
1220 CreateXMLContentBuilder },
1221 #endif
1223 { "Document Loader Factory",
1224 NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID,
1225 "@mozilla.org/content/document-loader-factory;1",
1226 CreateContentDLF,
1227 nsContentDLF::RegisterDocumentFactories,
1228 nsContentDLF::UnregisterDocumentFactories },
1230 { "Wyciwyg Handler",
1231 NS_WYCIWYGPROTOCOLHANDLER_CID,
1232 NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wyciwyg",
1233 nsWyciwygProtocolHandlerConstructor },
1235 { "Content Area DragDrop",
1236 NS_CONTENTAREADRAGDROP_CID,
1237 NS_CONTENTAREADRAGDROP_CONTRACTID,
1238 nsContentAreaDragDropConstructor },
1240 { "SyncLoad DOM Service",
1241 NS_SYNCLOADDOMSERVICE_CID,
1242 NS_SYNCLOADDOMSERVICE_CONTRACTID,
1243 nsSyncLoadServiceConstructor },
1245 // DOM objects
1246 { "Script Object Factory",
1247 NS_DOM_SCRIPT_OBJECT_FACTORY_CID,
1248 nsnull,
1249 nsDOMScriptObjectFactoryConstructor
1251 { "Base DOM Exception",
1252 NS_BASE_DOM_EXCEPTION_CID,
1253 nsnull,
1254 nsBaseDOMExceptionConstructor
1256 { "JavaScript Protocol Handler",
1257 NS_JSPROTOCOLHANDLER_CID,
1258 NS_JSPROTOCOLHANDLER_CONTRACTID,
1259 nsJSProtocolHandler::Create },
1260 { "JavaScript URI",
1261 NS_JSURI_CID,
1262 nsnull,
1263 nsJSURIConstructor },
1264 { "Window Command Table",
1265 NS_WINDOWCOMMANDTABLE_CID,
1267 CreateWindowCommandTableConstructor
1269 { "Window Command Controller",
1270 NS_WINDOWCONTROLLER_CID,
1271 NS_WINDOWCONTROLLER_CONTRACTID,
1272 CreateWindowControllerWithSingletonCommandTable
1275 // view stuff
1276 { "View Manager", NS_VIEW_MANAGER_CID, "@mozilla.org/view-manager;1",
1277 nsViewManagerConstructor },
1279 { "Focus Event Suppressor",
1280 NS_NSIFOCUSEVENTSUPPRESSORSERVICE_CID,
1281 NS_NSIFOCUSEVENTSUPPRESSORSERVICE_CONTRACTID,
1282 CreateFocusEventSuppressorService },
1284 { "Plugin Document Loader Factory",
1285 NS_PLUGINDOCLOADERFACTORY_CID,
1286 "@mozilla.org/content/plugin/document-loader-factory;1",
1287 CreateContentDLF },
1289 { "Plugin Document",
1290 NS_PLUGINDOCUMENT_CID,
1291 nsnull,
1292 CreatePluginDocument },
1294 #ifdef MOZ_MEDIA
1295 { "Video Document",
1296 NS_VIDEODOCUMENT_CID,
1297 nsnull,
1298 CreateVideoDocument },
1299 #endif
1301 { "Style sheet service",
1302 NS_STYLESHEETSERVICE_CID,
1303 NS_STYLESHEETSERVICE_CONTRACTID,
1304 nsStyleSheetServiceConstructor },
1306 // transformiix
1308 { "XSLTProcessor",
1309 TRANSFORMIIX_XSLT_PROCESSOR_CID,
1310 TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID,
1311 txMozillaXSLTProcessorConstructor },
1313 { "XPathEvaluator",
1314 TRANSFORMIIX_XPATH_EVALUATOR_CID,
1315 NS_XPATH_EVALUATOR_CONTRACTID,
1316 nsXPathEvaluatorConstructor },
1318 { "XPath1 XPointer Scheme Processor",
1319 TRANSFORMIIX_XPATH1_SCHEME_CID,
1320 NS_XPOINTER_SCHEME_PROCESSOR_BASE "xpath1",
1321 nsXPath1SchemeProcessorConstructor },
1323 { "Transformiix NodeSet",
1324 TRANSFORMIIX_NODESET_CID,
1325 TRANSFORMIIX_NODESET_CONTRACTID,
1326 txNodeSetAdaptorConstructor },
1328 { "XML Serializer",
1329 NS_XMLSERIALIZER_CID,
1330 NS_XMLSERIALIZER_CONTRACTID,
1331 nsDOMSerializerConstructor },
1333 { "XMLHttpRequest",
1334 NS_XMLHTTPREQUEST_CID,
1335 NS_XMLHTTPREQUEST_CONTRACTID,
1336 nsXMLHttpRequestConstructor },
1338 { "DOM Parser",
1339 NS_DOMPARSER_CID,
1340 NS_DOMPARSER_CONTRACTID,
1341 nsDOMParserConstructor },
1343 { "DOM Storage",
1344 NS_DOMSTORAGE_CID,
1345 "@mozilla.org/dom/storage;1",
1346 NS_NewDOMStorage },
1348 { "DOM Storage Manager",
1349 NS_DOMSTORAGEMANAGER_CID,
1350 "@mozilla.org/dom/storagemanager;1",
1351 nsDOMStorageManagerConstructor },
1353 { "DOM JSON",
1354 NS_DOMJSON_CID,
1355 "@mozilla.org/dom/json;1",
1356 NS_NewJSON },
1358 { "Text Editor",
1359 NS_TEXTEDITOR_CID,
1360 "@mozilla.org/editor/texteditor;1",
1361 nsPlaintextEditorConstructor },
1363 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
1364 #ifdef ENABLE_EDITOR_API_LOG
1365 { "HTML Editor",
1366 NS_HTMLEDITOR_CID,
1367 "@mozilla.org/editor/htmleditor;1",
1368 nsHTMLEditorLogConstructor },
1369 #else
1370 { "HTML Editor",
1371 NS_HTMLEDITOR_CID,
1372 "@mozilla.org/editor/htmleditor;1",
1373 nsHTMLEditorConstructor },
1374 #endif
1375 #endif
1377 { "Editor Controller",
1378 NS_EDITORCONTROLLER_CID,
1379 "@mozilla.org/editor/editorcontroller;1",
1380 nsEditorControllerConstructor },
1382 { "Editor Command Table",
1383 NS_EDITORCOMMANDTABLE_CID,
1384 "", // no point in using a contract ID
1385 nsEditorCommandTableConstructor },
1387 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
1388 { NULL,
1389 NS_TEXTSERVICESDOCUMENT_CID,
1390 "@mozilla.org/textservices/textservicesdocument;1",
1391 nsTextServicesDocumentConstructor },
1392 #endif
1394 { "Geolocation Service",
1395 NS_GEOLOCATION_SERVICE_CID,
1396 "@mozilla.org/geolocation/service;1",
1397 nsGeolocationServiceConstructor },
1402 NS_IMPL_NSGETMODULE_WITH_CTOR(nsLayoutModule, gComponents, Initialize)