This commit was manufactured by cvs2svn to create branch

'SVG_20020806_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20020806_BRANCH@131581 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
(no author)
2002-10-09 07:03:16 +00:00
parent deb2864a2a
commit bfb6485edc
5 changed files with 2572 additions and 0 deletions

View File

@@ -0,0 +1,316 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsContentCID_h__
#define nsContentCID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIComponentManager.h"
// {1691E1F7-EE41-11d4-9885-00C04FA0CF4B}
#define NS_STYLESET_CID \
{ 0x1691e1f7, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {96882B70-8A27-11d2-8EAF-00805F29F370}
#define NS_HTMLSTYLESHEET_CID \
{ 0x96882b70, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {972D8D8F-F0DA-11d4-9885-00C04FA0CF4B}
#define NS_DOCUMENT_VIEWER_CID \
{ 0x972d8d8f, 0xf0da, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {A5121627-EDB6-11d4-9885-00C04FA0CF4B}
#define NS_ANONYMOUSCONTENT_CID \
{ 0xa5121627, 0xedb6, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {FC886801-E768-11d4-9885-00C04FA0CF4B}
#define NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID \
{ 0xfc886801, 0xe768, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
/* a6cf90f9-15b3-11d2-932e-00805f8add32 */
#define NS_LAYOUT_DEBUGGER_CID \
{ 0xa6cf90f9, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/* a6cf90fc-15b3-11d2-932e-00805f8add32 */
#define NS_HTML_ELEMENT_FACTORY_CID \
{ 0xa6cf90fc, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#define NS_HTMLDOCUMENT_CID \
{ /* 5d0fcdd0-4daa-11d2-b328-00805f8a3859 */ \
0x5d0fcdd0, 0x4daa, 0x11d2, \
{0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
#define NS_WYCIWYGPROTOCOLHANDLER_CID \
{ /* e7509b46-2eB2-410a-9d7c-c3ce73284d01 */ \
0xe7509b46, 0x2eb2, 0x410a, \
{0x9d, 0x7c, 0xc3, 0xce, 0x73, 0x28, 0x4d, 0x01}}
#define NS_XMLDOCUMENT_CID \
{ /* a6cf9063-15b3-11d2-932e-00805f8add32 */ \
0xa6cf9063, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#define NS_XML_ELEMENT_FACTORY_CID \
{ /* CF170391-79CC-11d3-BE44-0020A6361667 */ \
0xcf170391, 0x79cc, 0x11d3, \
{0xbe, 0x44, 0x0, 0x20, 0xa6, 0x36, 0x16, 0x67}}
#define NS_IMAGEDOCUMENT_CID \
{ /* e11a6080-4daa-11d2-b328-00805f8a3859 */ \
0xe11a6080, 0x4daa, 0x11d2, \
{0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
// {A1FDE864-E802-11d4-9885-00C04FA0CF4B}
#define NS_HTMLHRELEMENT_CID \
{ 0xa1fde864, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {A1FDE865-E802-11d4-9885-00C04FA0CF4B}
#define NS_HTMLINPUTELEMENT_CID \
{ 0xa1fde865, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
#define NS_HTMLIMAGEELEMENT_CID \
{ /* d6008c40-4dad-11d2-b328-00805f8a3859 */ \
0xd6008c40, 0x4dad, 0x11d2, \
{0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
#define NS_HTMLOPTIONELEMENT_CID \
{ /* a6cf90f5-15b3-11d2-932e-00805f8add32 */ \
0xa6cf90f5, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#define NS_NAMESPACEMANAGER_CID \
{ /* d9783472-8fe9-11d2-9d3c-0060088f9ff7 */ \
0xd9783472, 0x8fe9, 0x11d2, \
{0x9d, 0x3c, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
/* a6cf90d7-15b3-11d2-932e-00805f8add32 */
#define NS_FRAME_UTIL_CID \
{ 0xa6cf90d5, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
// XXX This should really be factored into a style-specific DLL so
// that all the HTML, generic layout, and style stuff isn't munged
// together.
// {2E363D60-872E-11d2-B531-000000000000}
#define NS_CSSPARSER_CID \
{ 0x2e363d60, 0x872e, 0x11d2, { 0xb5, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
// {95F46161-D177-11d2-BF86-00105A1B0627}
#define NS_HTML_CSS_STYLESHEET_CID \
{ 0x95f46161, 0xd177, 0x11d2, { 0xbf, 0x86, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {A1FDE867-E802-11d4-9885-00C04FA0CF4B}
#define NS_CSS_STYLESHEET_CID \
{ 0xa1fde867, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {eaca2576-0d4a-11d3-9d7e-0060088f9ff7}
#define NS_CSS_LOADER_CID \
{ 0xeaca2576, 0x0d4a, 0x11d3, { 0x9d, 0x7e, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7 } }
// {96882B71-8A27-11d2-8EAF-00805F29F370}
#define NS_TEXTNODE_CID \
{ 0x96882b71, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {96882B72-8A27-11d2-8EAF-00805F29F370}
#define NS_SELECTION_CID \
{ 0x96882b72, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
#define NS_FRAMESELECTION_CID \
{/* {905F80F1-8A7B-11d2-918C-0080C8E44DB5}*/ \
0x905f80f1, 0x8a7b, 0x11d2, { 0x91, 0x8c, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
#define NS_DOMSELECTION_CID \
{/* {C87A37FC-8109-4ce2-A322-8CDEC925379F}*/ \
0xc87a37fc, 0x8109, 0x4ce2, { 0xa3, 0x22, 0x8c, 0xde, 0xc9, 0x25, 0x37, 0x9f } }
#define NS_RANGE_CID \
{/* {56AD2981-8A87-11d2-918C-0080C8E44DB5}*/ \
0x56ad2981, 0x8a87, 0x11d2, { 0x91, 0x8c, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
// {A1FDE868-E802-11d4-9885-00C04FA0CF4B}
#define NS_ATTRIBUTECONTENT_CID \
{ 0xa1fde868, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
#define NS_CONTENTITERATOR_CID \
{/* {a6cf90e3-15b3-11d2-932e-00805f8add32}*/ \
0xa6cf90e3, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
#define NS_GENERATEDSUBTREEITERATOR_CID \
{/* {9A45253B-EB8F-49f1-B925-E9EA90D3EB3A}*/ \
0x9a45253b, 0xeb8f, 0x49f1, { 0xb9, 0x25, 0xe9, 0xea, 0x90, 0xd3, 0xeb, 0x3a } }
#define NS_GENERATEDCONTENTITERATOR_CID \
{/* {A364930F-E353-49f1-AC69-91637EB8B757}*/ \
0xa364930f, 0xe353, 0x49f1, { 0xac, 0x69, 0x91, 0x63, 0x7e, 0xb8, 0xb7, 0x57 } }
#define NS_SUBTREEITERATOR_CID \
{/* {a6cf90e5-15b3-11d2-932e-00805f8add32}*/ \
0xa6cf90e5, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
// {09F689E0-B4DA-11d2-A68B-00104BDE6048}
#define NS_EVENTLISTENERMANAGER_CID \
{ 0x9f689e0, 0xb4da, 0x11d2, { 0xa6, 0x8b, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
// {A1FDE862-E802-11d4-9885-00C04FA0CF4B}
#define NS_EVENTSTATEMANAGER_CID \
{ 0xa1fde862, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {64F300A1-C88C-11d3-97FB-00400553EEF0}
#define NS_XBLSERVICE_CID \
{ 0x64f300a1, 0xc88c, 0x11d3, { 0x97, 0xfb, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } }
// {15671AF5-39F9-4c70-8CE3-72C97111B52D}
#define NS_BINDINGMANAGER_CID \
{ 0x15671af5, 0x39f9, 0x4c70, { 0x8c, 0xe3, 0x72, 0xc9, 0x71, 0x11, 0xb5, 0x2d } }
// 3a9cd622-264d-11d4-ba06-0060b0fc76dd
#define NS_DOM_IMPLEMENTATION_CID \
{ 0x3a9cd622, 0x264d, 0x11d4, {0xba, 0x06, 0x00, 0x60, 0xb0, 0xfc, 0x76, 0xdd } }
// {AE52FE52-683A-437D-B661-DE55F4E0A873}
#define NS_NODEINFOMANAGER_CID \
{ 0xae52fe52, 0x683a, 0x437d, { 0xb6, 0x61, 0xde, 0x55, 0xf4, 0xe0, 0xa8, 0x73 } }
// {ECEA1B28-AE54-4047-8BBE-C624235106B4}
#define NS_COMPUTEDDOMSTYLE_CID \
{ 0xecea1b28, 0xae54, 0x4047, { 0x8b, 0xbe, 0xc6, 0x24, 0x23, 0x51, 0x06, 0xb4 } }
// {4aef38b7-6364-4e23-a5e7-12f837fbbd9c}
#define NS_XMLCONTENTSERIALIZER_CID \
{ 0x4aef38b7, 0x6364, 0x4e23, { 0xa5, 0xe7, 0x12, 0xf8, 0x37, 0xfb, 0xbd, 0x9c } }
// {9d3f70da-86e9-11d4-95ec-00b0d03e37b7}
#define NS_HTMLCONTENTSERIALIZER_CID \
{ 0x9d3f70da, 0x86e9, 0x11d4, { 0x95, 0xec, 0x00, 0xb0, 0xd0, 0x3e, 0x37, 0xb7 } }
// {feca3c34-205e-4ae5-bd1c-03c686ff012b}
#define MOZ_SANITIZINGHTMLSERIALIZER_CID \
{ 0xfeca3c34, 0x205e, 0x4ae5, { 0xbd, 0x1c, 0x03, 0xc6, 0x86, 0xff, 0x01, 0x2b } }
// {6030f7ef-32ed-46a7-9a63-6a5d3f90445f}
#define NS_PLAINTEXTSERIALIZER_CID \
{ 0x6030f7ef, 0x32ed, 0x46a7, { 0x9a, 0x63, 0x6a, 0x5d, 0x3f, 0x90, 0x44, 0x5f } }
// {d4f2b600-b5c1-11d6-b483-cc97c63e567c}
#define NS_HTMLFRAGMENTSINK_CID \
{ 0xd4f2b600, 0xb5c1, 0x11d6, { 0xb4, 0x83, 0xcc, 0x97, 0xc6, 0x3e, 0x56, 0x7c } }
// {3986B301-097C-11d3-BF87-00105A1B0627}
#define NS_XULPOPUPLISTENER_CID \
{ 0x3986b301, 0x97c, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {1F5C1721-7DC3-11d3-BF87-00105A1B0627}
#define NS_XULCONTROLLERS_CID \
{ 0x1f5c1721, 0x7dc3, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {daedcb43-1dd1-11b2-b1d2-caf06cb40387}
#define NS_DLGDEFAULTKEYS_CID \
{ 0xdaedcb43, 0x1dd1, 0x11b2, { 0xb1, 0xd2, 0xca, 0xf0, 0x6c, 0xb4, 0x3, 0x87 } }
// {76E92881-CDDB-11d3-BF87-00105A1B0627}
#define NS_XULELEMENTFACTORY_CID \
{ 0x76e92881, 0xcddb, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {508f5601-e09b-11d3-9f7e-cf931f9f173c}
#define NS_CONTROLLERCOMMANDMANAGER_CID \
{ 0x508f5601, 0xe09b, 0x11d3, { 0x9f, 0x7e, 0xcf, 0x93, 0x1f, 0x9f, 0x17, 0x3c } }
// {BFD05264-834C-11d2-8EAC-00805F29F371}
#define NS_XULSORTSERVICE_CID \
{ 0xbfd05264, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x71 } }
// {3D262D00-8B5A-11d2-8EB0-00805F29F370}
#define NS_XULTEMPLATEBUILDER_CID \
{ 0x3d262d00, 0x8b5a, 0x11d2, { 0x8e, 0xb0, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {1abdcc96-1dd2-11b2-b520-f8f59cdd67bc}
#define NS_XULTREEBUILDER_CID \
{ 0x1abdcc96, 0x1dd2, 0x11b2, { 0xb5, 0x20, 0xf8, 0xf5, 0x9c, 0xdd, 0x67, 0xbc } }
// {CE058B21-BA9C-11d2-BF86-00105A1B0627}
#define NS_XULCONTENTSINK_CID \
{ 0xce058b21, 0xba9c, 0x11d2, { 0xbf, 0x86, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {541AFCB2-A9A3-11d2-8EC5-00805F29F370}
#define NS_XULDOCUMENT_CID \
{ 0x541afcb2, 0xa9a3, 0x11d2, { 0x8e, 0xc5, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {3A0A0FC1-8349-11d3-BE47-00104BDE6048}
#define NS_XULPROTOTYPECACHE_CID \
{ 0x3a0a0fc1, 0x8349, 0x11d3, { 0xbe, 0x47, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
// {a6cf9126-15b3-11d2-932e-00805f8add32}
#define NS_RANGEUTILS_CID \
{ 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
#ifdef MOZ_MATHML
// {68b9fbda-f230-45a9-bf92-dbbbd4ac8555}
#define NS_MATHMLELEMENTFACTORY_CID \
{ 0x68b9fbda, 0xf230, 0x45a9, {0xbf, 0x92, 0xdb, 0xbb, 0xd4, 0xac, 0x85, 0x55 } }
#endif // MOZ_MATHML
#ifdef MOZ_SVG
// {4E48C00A-E20F-4061-B869-2BAC285D68E8}
#define NS_SVGELEMENTFACTORY_DEPRECATED_CID \
{ 0x4e48c00a, 0xe20f, 0x4061, { 0xb8, 0x69, 0x2b, 0xac, 0x28, 0x5d, 0x68, 0xe8 } }
// {34D9B28A-FBFF-4bbd-8546-1822FE3FB8B5}
#define NS_SVGELEMENTFACTORY_CID \
{ 0x34d9b28a, 0xfbff, 0x4bbd, { 0x85, 0x46, 0x18, 0x22, 0xfe, 0x3f, 0xb8, 0xb5 } }
#define NS_SVGDOCUMENT_CID \
{ /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */ \
0xb7f44954, 0x11d1, 0x11b2, \
{0x8c, 0x2e, 0xc2, 0xfe, 0xab, 0x41, 0x86, 0xbc}}
#endif // MOZ_SVG
#define NS_SYNCLOADDOMSERVICE_CID \
{ /* 0e4e7d00-f71a-439f-9178-1a71ff11b55f */ \
0x0e4e7d00, 0xf71a, 0x439f, \
{0x91, 0x78, 0x1a, 0x71, 0xff, 0x11, 0xb5, 0x5f} }
#define NS_SYNCLOADDOMSERVICE_CONTRACTID \
"@mozilla.org/content/syncload-dom-service;1"
#endif /* nsContentCID_h__ */

View File

@@ -0,0 +1,145 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
BUILD_DATE = gbdate.h
MODULE = content
LIBRARY_NAME = gkcontent
EXPORT_LIBRARY = 1
ifneq ($(OS_ARCH),WINNT)
SHORT_LIBNAME = gkcontnt
endif
IS_COMPONENT = 1
MODULE_NAME = nsContentModule
EXTRA_DSO_LIBS = gkgfx
ifdef MOZ_PERF_METRICS
EXTRA_DSO_LIBS += mozutil_s
endif
REQUIRES = xpcom \
string \
gfx \
layout \
widget \
necko \
necko2 \
rdf \
docshell \
dom \
htmlparser \
uriloader \
webshell \
locale \
unicharutil \
lwbrk \
js \
pref \
xul \
xuldoc \
xultmpl \
webbrwsr \
caps \
xpconnect \
imglib2 \
$(NULL)
CPPSRCS = \
nsContentDLF.cpp \
nsContentModule.cpp \
nsContentHTTPStartup.cpp \
$(NULL)
EXPORTS = nsContentCID.h
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)gkconevents_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconhtmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconhtmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconhtmlstyle_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxsldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxulcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxuldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxultmpl_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxbl_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconshared_s.$(LIB_SUFFIX) \
$(NULL)
ifdef MOZ_SVG
SHARED_LIBRARY_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)gkconsvgdoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkcontentsvg_s.$(LIB_SUFFIX) \
$(NULL)
endif
EXTRA_DSO_LDOPTS = \
$(LIBS_DIR) \
$(EXTRA_DSO_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(MOZ_JS_LIBS) \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
EXPORT_OBJS = 1
endif
ifeq ($(OS_ARCH),Darwin)
EXTRA_DSO_LDOPTS += $(TK_LIBS)
endif
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),IRIX)
ifeq ($(GNU_CXX),1)
LDFLAGS += -Wl,-LD_LAYOUT:lgot_buffer=80
endif
endif
LOCAL_INCLUDES = -I$(srcdir)/../base/src \
-I$(srcdir)/../html/base/src \
-I$(srcdir)/../html/style/src \
-I$(srcdir)/../xul/content/src \
-I$(srcdir)/../xul/base/src \
-I$(srcdir)/../xul/templates/src \
-I$(srcdir)/../events/src \
-I$(srcdir)/../html/content/src \
-I$(srcdir)/../html/document/src \
-I. \
$(NULL)
GARBAGE+=$(BUILD_DATE)
export:: $(BUILD_DATE)
$(BUILD_DATE): gbdate.pl
$(RM) $@
$(PERL) $(srcdir)/gbdate.pl > $@

View File

@@ -0,0 +1,316 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsContentCID_h__
#define nsContentCID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIComponentManager.h"
// {1691E1F7-EE41-11d4-9885-00C04FA0CF4B}
#define NS_STYLESET_CID \
{ 0x1691e1f7, 0xee41, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {96882B70-8A27-11d2-8EAF-00805F29F370}
#define NS_HTMLSTYLESHEET_CID \
{ 0x96882b70, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {972D8D8F-F0DA-11d4-9885-00C04FA0CF4B}
#define NS_DOCUMENT_VIEWER_CID \
{ 0x972d8d8f, 0xf0da, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {A5121627-EDB6-11d4-9885-00C04FA0CF4B}
#define NS_ANONYMOUSCONTENT_CID \
{ 0xa5121627, 0xedb6, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {FC886801-E768-11d4-9885-00C04FA0CF4B}
#define NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID \
{ 0xfc886801, 0xe768, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
/* a6cf90f9-15b3-11d2-932e-00805f8add32 */
#define NS_LAYOUT_DEBUGGER_CID \
{ 0xa6cf90f9, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/* a6cf90fc-15b3-11d2-932e-00805f8add32 */
#define NS_HTML_ELEMENT_FACTORY_CID \
{ 0xa6cf90fc, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#define NS_HTMLDOCUMENT_CID \
{ /* 5d0fcdd0-4daa-11d2-b328-00805f8a3859 */ \
0x5d0fcdd0, 0x4daa, 0x11d2, \
{0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
#define NS_WYCIWYGPROTOCOLHANDLER_CID \
{ /* e7509b46-2eB2-410a-9d7c-c3ce73284d01 */ \
0xe7509b46, 0x2eb2, 0x410a, \
{0x9d, 0x7c, 0xc3, 0xce, 0x73, 0x28, 0x4d, 0x01}}
#define NS_XMLDOCUMENT_CID \
{ /* a6cf9063-15b3-11d2-932e-00805f8add32 */ \
0xa6cf9063, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#define NS_XML_ELEMENT_FACTORY_CID \
{ /* CF170391-79CC-11d3-BE44-0020A6361667 */ \
0xcf170391, 0x79cc, 0x11d3, \
{0xbe, 0x44, 0x0, 0x20, 0xa6, 0x36, 0x16, 0x67}}
#define NS_IMAGEDOCUMENT_CID \
{ /* e11a6080-4daa-11d2-b328-00805f8a3859 */ \
0xe11a6080, 0x4daa, 0x11d2, \
{0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
// {A1FDE864-E802-11d4-9885-00C04FA0CF4B}
#define NS_HTMLHRELEMENT_CID \
{ 0xa1fde864, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {A1FDE865-E802-11d4-9885-00C04FA0CF4B}
#define NS_HTMLINPUTELEMENT_CID \
{ 0xa1fde865, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
#define NS_HTMLIMAGEELEMENT_CID \
{ /* d6008c40-4dad-11d2-b328-00805f8a3859 */ \
0xd6008c40, 0x4dad, 0x11d2, \
{0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
#define NS_HTMLOPTIONELEMENT_CID \
{ /* a6cf90f5-15b3-11d2-932e-00805f8add32 */ \
0xa6cf90f5, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#define NS_NAMESPACEMANAGER_CID \
{ /* d9783472-8fe9-11d2-9d3c-0060088f9ff7 */ \
0xd9783472, 0x8fe9, 0x11d2, \
{0x9d, 0x3c, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
/* a6cf90d7-15b3-11d2-932e-00805f8add32 */
#define NS_FRAME_UTIL_CID \
{ 0xa6cf90d5, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
// XXX This should really be factored into a style-specific DLL so
// that all the HTML, generic layout, and style stuff isn't munged
// together.
// {2E363D60-872E-11d2-B531-000000000000}
#define NS_CSSPARSER_CID \
{ 0x2e363d60, 0x872e, 0x11d2, { 0xb5, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
// {95F46161-D177-11d2-BF86-00105A1B0627}
#define NS_HTML_CSS_STYLESHEET_CID \
{ 0x95f46161, 0xd177, 0x11d2, { 0xbf, 0x86, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {A1FDE867-E802-11d4-9885-00C04FA0CF4B}
#define NS_CSS_STYLESHEET_CID \
{ 0xa1fde867, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {eaca2576-0d4a-11d3-9d7e-0060088f9ff7}
#define NS_CSS_LOADER_CID \
{ 0xeaca2576, 0x0d4a, 0x11d3, { 0x9d, 0x7e, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7 } }
// {96882B71-8A27-11d2-8EAF-00805F29F370}
#define NS_TEXTNODE_CID \
{ 0x96882b71, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {96882B72-8A27-11d2-8EAF-00805F29F370}
#define NS_SELECTION_CID \
{ 0x96882b72, 0x8a27, 0x11d2, { 0x8e, 0xaf, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
#define NS_FRAMESELECTION_CID \
{/* {905F80F1-8A7B-11d2-918C-0080C8E44DB5}*/ \
0x905f80f1, 0x8a7b, 0x11d2, { 0x91, 0x8c, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
#define NS_DOMSELECTION_CID \
{/* {C87A37FC-8109-4ce2-A322-8CDEC925379F}*/ \
0xc87a37fc, 0x8109, 0x4ce2, { 0xa3, 0x22, 0x8c, 0xde, 0xc9, 0x25, 0x37, 0x9f } }
#define NS_RANGE_CID \
{/* {56AD2981-8A87-11d2-918C-0080C8E44DB5}*/ \
0x56ad2981, 0x8a87, 0x11d2, { 0x91, 0x8c, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
// {A1FDE868-E802-11d4-9885-00C04FA0CF4B}
#define NS_ATTRIBUTECONTENT_CID \
{ 0xa1fde868, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
#define NS_CONTENTITERATOR_CID \
{/* {a6cf90e3-15b3-11d2-932e-00805f8add32}*/ \
0xa6cf90e3, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
#define NS_GENERATEDSUBTREEITERATOR_CID \
{/* {9A45253B-EB8F-49f1-B925-E9EA90D3EB3A}*/ \
0x9a45253b, 0xeb8f, 0x49f1, { 0xb9, 0x25, 0xe9, 0xea, 0x90, 0xd3, 0xeb, 0x3a } }
#define NS_GENERATEDCONTENTITERATOR_CID \
{/* {A364930F-E353-49f1-AC69-91637EB8B757}*/ \
0xa364930f, 0xe353, 0x49f1, { 0xac, 0x69, 0x91, 0x63, 0x7e, 0xb8, 0xb7, 0x57 } }
#define NS_SUBTREEITERATOR_CID \
{/* {a6cf90e5-15b3-11d2-932e-00805f8add32}*/ \
0xa6cf90e5, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
// {09F689E0-B4DA-11d2-A68B-00104BDE6048}
#define NS_EVENTLISTENERMANAGER_CID \
{ 0x9f689e0, 0xb4da, 0x11d2, { 0xa6, 0x8b, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
// {A1FDE862-E802-11d4-9885-00C04FA0CF4B}
#define NS_EVENTSTATEMANAGER_CID \
{ 0xa1fde862, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
// {64F300A1-C88C-11d3-97FB-00400553EEF0}
#define NS_XBLSERVICE_CID \
{ 0x64f300a1, 0xc88c, 0x11d3, { 0x97, 0xfb, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } }
// {15671AF5-39F9-4c70-8CE3-72C97111B52D}
#define NS_BINDINGMANAGER_CID \
{ 0x15671af5, 0x39f9, 0x4c70, { 0x8c, 0xe3, 0x72, 0xc9, 0x71, 0x11, 0xb5, 0x2d } }
// 3a9cd622-264d-11d4-ba06-0060b0fc76dd
#define NS_DOM_IMPLEMENTATION_CID \
{ 0x3a9cd622, 0x264d, 0x11d4, {0xba, 0x06, 0x00, 0x60, 0xb0, 0xfc, 0x76, 0xdd } }
// {AE52FE52-683A-437D-B661-DE55F4E0A873}
#define NS_NODEINFOMANAGER_CID \
{ 0xae52fe52, 0x683a, 0x437d, { 0xb6, 0x61, 0xde, 0x55, 0xf4, 0xe0, 0xa8, 0x73 } }
// {ECEA1B28-AE54-4047-8BBE-C624235106B4}
#define NS_COMPUTEDDOMSTYLE_CID \
{ 0xecea1b28, 0xae54, 0x4047, { 0x8b, 0xbe, 0xc6, 0x24, 0x23, 0x51, 0x06, 0xb4 } }
// {4aef38b7-6364-4e23-a5e7-12f837fbbd9c}
#define NS_XMLCONTENTSERIALIZER_CID \
{ 0x4aef38b7, 0x6364, 0x4e23, { 0xa5, 0xe7, 0x12, 0xf8, 0x37, 0xfb, 0xbd, 0x9c } }
// {9d3f70da-86e9-11d4-95ec-00b0d03e37b7}
#define NS_HTMLCONTENTSERIALIZER_CID \
{ 0x9d3f70da, 0x86e9, 0x11d4, { 0x95, 0xec, 0x00, 0xb0, 0xd0, 0x3e, 0x37, 0xb7 } }
// {feca3c34-205e-4ae5-bd1c-03c686ff012b}
#define MOZ_SANITIZINGHTMLSERIALIZER_CID \
{ 0xfeca3c34, 0x205e, 0x4ae5, { 0xbd, 0x1c, 0x03, 0xc6, 0x86, 0xff, 0x01, 0x2b } }
// {6030f7ef-32ed-46a7-9a63-6a5d3f90445f}
#define NS_PLAINTEXTSERIALIZER_CID \
{ 0x6030f7ef, 0x32ed, 0x46a7, { 0x9a, 0x63, 0x6a, 0x5d, 0x3f, 0x90, 0x44, 0x5f } }
// {d4f2b600-b5c1-11d6-b483-cc97c63e567c}
#define NS_HTMLFRAGMENTSINK_CID \
{ 0xd4f2b600, 0xb5c1, 0x11d6, { 0xb4, 0x83, 0xcc, 0x97, 0xc6, 0x3e, 0x56, 0x7c } }
// {3986B301-097C-11d3-BF87-00105A1B0627}
#define NS_XULPOPUPLISTENER_CID \
{ 0x3986b301, 0x97c, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {1F5C1721-7DC3-11d3-BF87-00105A1B0627}
#define NS_XULCONTROLLERS_CID \
{ 0x1f5c1721, 0x7dc3, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {daedcb43-1dd1-11b2-b1d2-caf06cb40387}
#define NS_DLGDEFAULTKEYS_CID \
{ 0xdaedcb43, 0x1dd1, 0x11b2, { 0xb1, 0xd2, 0xca, 0xf0, 0x6c, 0xb4, 0x3, 0x87 } }
// {76E92881-CDDB-11d3-BF87-00105A1B0627}
#define NS_XULELEMENTFACTORY_CID \
{ 0x76e92881, 0xcddb, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {508f5601-e09b-11d3-9f7e-cf931f9f173c}
#define NS_CONTROLLERCOMMANDMANAGER_CID \
{ 0x508f5601, 0xe09b, 0x11d3, { 0x9f, 0x7e, 0xcf, 0x93, 0x1f, 0x9f, 0x17, 0x3c } }
// {BFD05264-834C-11d2-8EAC-00805F29F371}
#define NS_XULSORTSERVICE_CID \
{ 0xbfd05264, 0x834c, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x71 } }
// {3D262D00-8B5A-11d2-8EB0-00805F29F370}
#define NS_XULTEMPLATEBUILDER_CID \
{ 0x3d262d00, 0x8b5a, 0x11d2, { 0x8e, 0xb0, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {1abdcc96-1dd2-11b2-b520-f8f59cdd67bc}
#define NS_XULTREEBUILDER_CID \
{ 0x1abdcc96, 0x1dd2, 0x11b2, { 0xb5, 0x20, 0xf8, 0xf5, 0x9c, 0xdd, 0x67, 0xbc } }
// {CE058B21-BA9C-11d2-BF86-00105A1B0627}
#define NS_XULCONTENTSINK_CID \
{ 0xce058b21, 0xba9c, 0x11d2, { 0xbf, 0x86, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
// {541AFCB2-A9A3-11d2-8EC5-00805F29F370}
#define NS_XULDOCUMENT_CID \
{ 0x541afcb2, 0xa9a3, 0x11d2, { 0x8e, 0xc5, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {3A0A0FC1-8349-11d3-BE47-00104BDE6048}
#define NS_XULPROTOTYPECACHE_CID \
{ 0x3a0a0fc1, 0x8349, 0x11d3, { 0xbe, 0x47, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
// {a6cf9126-15b3-11d2-932e-00805f8add32}
#define NS_RANGEUTILS_CID \
{ 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
#ifdef MOZ_MATHML
// {68b9fbda-f230-45a9-bf92-dbbbd4ac8555}
#define NS_MATHMLELEMENTFACTORY_CID \
{ 0x68b9fbda, 0xf230, 0x45a9, {0xbf, 0x92, 0xdb, 0xbb, 0xd4, 0xac, 0x85, 0x55 } }
#endif // MOZ_MATHML
#ifdef MOZ_SVG
// {4E48C00A-E20F-4061-B869-2BAC285D68E8}
#define NS_SVGELEMENTFACTORY_DEPRECATED_CID \
{ 0x4e48c00a, 0xe20f, 0x4061, { 0xb8, 0x69, 0x2b, 0xac, 0x28, 0x5d, 0x68, 0xe8 } }
// {34D9B28A-FBFF-4bbd-8546-1822FE3FB8B5}
#define NS_SVGELEMENTFACTORY_CID \
{ 0x34d9b28a, 0xfbff, 0x4bbd, { 0x85, 0x46, 0x18, 0x22, 0xfe, 0x3f, 0xb8, 0xb5 } }
#define NS_SVGDOCUMENT_CID \
{ /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */ \
0xb7f44954, 0x11d1, 0x11b2, \
{0x8c, 0x2e, 0xc2, 0xfe, 0xab, 0x41, 0x86, 0xbc}}
#endif // MOZ_SVG
#define NS_SYNCLOADDOMSERVICE_CID \
{ /* 0e4e7d00-f71a-439f-9178-1a71ff11b55f */ \
0x0e4e7d00, 0xf71a, 0x439f, \
{0x91, 0x78, 0x1a, 0x71, 0xff, 0x11, 0xb5, 0x5f} }
#define NS_SYNCLOADDOMSERVICE_CONTRACTID \
"@mozilla.org/content/syncload-dom-service;1"
#endif /* nsContentCID_h__ */

View File

@@ -0,0 +1,891 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsXBLAtoms.h" // to addref/release table
#include "nsCSSAtoms.h" // to addref/release table
#include "nsCSSKeywords.h" // to addref/release table
#include "nsCSSProps.h" // to addref/release table
#include "nsColorNames.h" // to addref/release table
#include "nsContentCID.h"
#include "nsContentHTTPStartup.h"
#include "nsContentDLF.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
#include "nsDOMCID.h"
#include "nsCSSOMFactory.h"
#include "nsInspectorCSSUtils.h"
#include "nsEventStateManager.h"
#include "nsEventListenerManager.h"
#include "nsGenericElement.h"
#include "nsGenericDOMDataNode.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLContentSerializer.h"
#include "nsGenericHTMLElement.h"
#include "nsIBindingManager.h"
#include "nsICSSLoader.h"
#include "nsICSSParser.h"
#include "nsICSSStyleSheet.h"
#include "nsICategoryManager.h"
#include "nsIComponentManager.h"
#include "nsIComputedDOMStyle.h"
#include "nsIContentIterator.h"
#include "nsIContentSerializer.h"
#include "nsIController.h"
#include "nsIControllers.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMRange.h"
#include "nsIDocument.h"
#include "nsIDocumentEncoder.h"
#include "nsIDocumentViewer.h"
#include "nsIElementFactory.h"
#include "nsIEventListenerManager.h"
#include "nsIFactory.h"
#include "nsIFrameSelection.h"
#include "nsIFrameUtil.h"
#include "nsIGenericFactory.h"
#include "nsHTMLAttributes.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIHTMLContent.h"
#include "nsIHTMLFragmentContentSink.h"
#include "nsIHTMLStyleSheet.h"
#include "nsIHTMLToTextSink.h"
#include "nsILayoutDebugger.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIPrivateDOMImplementation.h"
#include "nsIRangeUtils.h"
#include "nsIScriptNameSpaceManager.h"
#include "nsISelection.h"
#include "nsITextContent.h"
#include "nsIXBLService.h"
#include "nsIFrameLoader.h"
#include "nsLayoutAtoms.h"
#include "nsPlainTextSerializer.h"
#include "mozSanitizingSerializer.h"
#include "nsRange.h"
#include "nsComputedDOMStyle.h"
#include "nsXMLContentSerializer.h"
#include "nsRuleNode.h"
#include "nsWyciwygProtocolHandler.h"
#include "nsContentAreaDragDrop.h"
#include "nsContentList.h"
#include "nsISyncLoadDOMService.h"
class nsIDocumentLoaderFactory;
#define PRODUCT_NAME "Gecko"
#define NS_HTMLIMGELEMENT_CONTRACTID \
"@mozilla.org/content/element/html;1?name=img"
#define NS_HTMLOPTIONELEMENT_CONTRACTID \
"@mozilla.org/content/element/html;1?name=option"
#ifdef MOZ_XUL
#include "nsIXULContentSink.h"
#include "nsIXULDocument.h"
#include "nsIXULPopupListener.h"
#include "nsIXULPrototypeCache.h"
#include "nsIXULPrototypeDocument.h"
#include "nsIXULPrototypeDocument.h"
#include "nsIXULSortService.h"
#include "nsXULAtoms.h"
#include "nsXULContentUtils.h"
#include "nsXULElement.h"
extern NS_IMETHODIMP
NS_NewXULContentBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
extern NS_IMETHODIMP
NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
#endif
#ifdef MOZ_SVG
#include "nsSVGAtoms.h"
#endif
// jst says, ``we need this to avoid holding on to XPConnect past its
// destruction. By being an XPCOM shutdown observer we can make sure
// we release the content global reference to XPConnect before
// XPConnect is shutdown, which cuts down on leaks n' whatnot...''
class ContentShutdownObserver : public nsIObserver
{
public:
ContentShutdownObserver() { NS_INIT_ISUPPORTS(); }
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
};
NS_IMPL_ISUPPORTS1(ContentShutdownObserver, nsIObserver)
NS_IMETHODIMP
ContentShutdownObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *someData)
{
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
nsContentUtils::Shutdown();
return NS_OK;
}
static PRBool gInitialized = PR_FALSE;
// Perform our one-time intialization for this module
PR_STATIC_CALLBACK(nsresult)
Initialize(nsIModule* aSelf)
{
// XXXwaterson turns out we initialize the module twice, because
// nsXULAtoms::AddRefAtoms() creates a namespace manager using the
// component manager. We should probably fix that.
//NS_PRECONDITION(! gInitialized, "module already initialized");
if (gInitialized)
return NS_OK;
gInitialized = PR_TRUE;
// Register all of our atoms once
nsCSSAtoms::AddRefAtoms();
nsCSSKeywords::AddRefTable();
nsCSSProps::AddRefTable();
nsColorNames::AddRefTable();
nsHTMLAtoms::AddRefAtoms();
nsXBLAtoms::AddRefAtoms();
nsLayoutAtoms::AddRefAtoms();
#ifdef MOZ_XUL
nsXULAtoms::AddRefAtoms();
nsXULContentUtils::Init();
#endif
#ifdef MOZ_SVG
nsSVGAtoms::AddRefAtoms();
#endif
nsContentUtils::Init();
// Add our shutdown observer.
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
ContentShutdownObserver* observer =
new ContentShutdownObserver();
if (observer)
observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
}
return NS_OK;
}
// Shutdown this module, releasing all of the module resources
PR_STATIC_CALLBACK(void)
Shutdown(nsIModule* aSelf)
{
NS_PRECONDITION(gInitialized, "module not initialized");
if (! gInitialized)
return;
gInitialized = PR_FALSE;
nsRange::Shutdown();
nsGenericElement::Shutdown();
nsGenericDOMDataNode::Shutdown();
nsEventListenerManager::Shutdown();
nsContentList::Shutdown();
nsComputedDOMStyle::Shutdown();
// Release all of our atoms
nsColorNames::ReleaseTable();
nsCSSProps::ReleaseTable();
nsCSSKeywords::ReleaseTable();
nsCSSAtoms::ReleaseAtoms();
nsHTMLAtoms::ReleaseAtoms();
nsXBLAtoms::ReleaseAtoms();
nsLayoutAtoms::ReleaseAtoms();
#ifdef MOZ_XUL
nsXULContentUtils::Finish();
nsXULAtoms::ReleaseAtoms();
nsXULElement::ReleaseGlobals();
nsXULPrototypeElement::ReleaseGlobals();
nsXULPrototypeScript::ReleaseGlobals();
#endif
#ifdef MOZ_SVG
nsSVGAtoms::ReleaseAtoms();
#endif
NS_IF_RELEASE(nsContentDLF::gUAStyleSheet);
NS_IF_RELEASE(nsRuleNode::gLangService);
nsContentUtils::Shutdown();
nsGenericHTMLElement::Shutdown();
NS_NameSpaceManagerShutdown();
}
extern nsresult NS_NewSelection(nsIFrameSelection** aResult);
extern nsresult NS_NewDomSelection(nsISelection** aResult);
extern nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
extern nsresult NS_NewRange(nsIDOMRange** aResult);
extern nsresult NS_NewRangeUtils(nsIRangeUtils** aResult);
extern nsresult NS_NewContentIterator(nsIContentIterator** aResult);
extern nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
extern nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult);
extern nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
extern nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
extern nsresult NS_NewHTMLElementFactory(nsIElementFactory** aResult);
extern nsresult NS_NewXMLElementFactory(nsIElementFactory** aResult);
extern nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
extern nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
extern nsresult NS_NewXBLService(nsIXBLService** aResult);
extern nsresult NS_NewBindingManager(nsIBindingManager** aResult);
extern nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult);
extern nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
extern nsresult NS_NewFrameLoader(nsIFrameLoader** aResult);
extern nsresult NS_NewSyncLoadDOMService(nsISyncLoadDOMService** aResult);
#ifdef MOZ_XUL
extern nsresult NS_NewXULElementFactory(nsIElementFactory** aResult);
extern NS_IMETHODIMP NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
#endif
#ifdef MOZ_MATHML
extern nsresult NS_NewMathMLElementFactory(nsIElementFactory** aResult);
#endif
#ifdef MOZ_SVG
extern nsresult NS_NewSVGElementFactory(nsIElementFactory** aResult);
#endif
#define MAKE_CTOR(ctor_, iface_, func_) \
static NS_IMETHODIMP \
ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
{ \
*aResult = nsnull; \
if (aOuter) \
return NS_ERROR_NO_AGGREGATION; \
iface_* inst; \
nsresult rv = func_(&inst); \
if (NS_SUCCEEDED(rv)) { \
rv = inst->QueryInterface(aIID, aResult); \
NS_RELEASE(inst); \
} \
return rv; \
}
MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_NewNameSpaceManager)
MAKE_CTOR(CreateEventListenerManager, nsIEventListenerManager, NS_NewEventListenerManager)
MAKE_CTOR(CreateEventStateManager, nsIEventStateManager, NS_NewEventStateManager)
MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
MAKE_CTOR(CreateHTMLStyleSheet, nsIHTMLStyleSheet, NS_NewHTMLStyleSheet)
MAKE_CTOR(CreateStyleSet, nsIStyleSet, NS_NewStyleSet)
MAKE_CTOR(CreateCSSStyleSheet, nsICSSStyleSheet, NS_NewCSSStyleSheet)
MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
MAKE_CTOR(CreateHTMLCSSStyleSheet, nsIHTMLCSSStyleSheet, NS_NewHTMLCSSStyleSheet)
MAKE_CTOR(CreateDOMImplementation, nsIDOMDOMImplementation, NS_NewDOMImplementation)
MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
#ifdef MOZ_SVG
MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
#endif
MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
MAKE_CTOR(CreateCSSParser, nsICSSParser, NS_NewCSSParser)
MAKE_CTOR(CreateCSSLoader, nsICSSLoader, NS_NewCSSLoader)
MAKE_CTOR(CreateHTMLElementFactory, nsIElementFactory, NS_NewHTMLElementFactory)
MAKE_CTOR(CreateTextNode, nsIContent, NS_NewTextNode)
//MAKE_CTOR(CreateAnonymousElement, nsIContent, NS_NewAnonymousElement)
MAKE_CTOR(CreateAttributeContent, nsIContent, NS_NewAttributeContent)
MAKE_CTOR(CreateXMLElementFactory, nsIElementFactory, NS_NewXMLElementFactory)
//MAKE_CTOR(CreateSelection, nsISelection, NS_NewSelection)
MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
MAKE_CTOR(CreateSelection, nsIFrameSelection, NS_NewSelection)
MAKE_CTOR(CreateRange, nsIDOMRange, NS_NewRange)
MAKE_CTOR(CreateRangeUtils, nsIRangeUtils, NS_NewRangeUtils)
MAKE_CTOR(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
MAKE_CTOR(CreateGeneratedContentIterator, nsIContentIterator, NS_NewGenRegularIterator)
MAKE_CTOR(CreateGeneratedSubtreeIterator, nsIContentIterator, NS_NewGenSubtreeIterator)
MAKE_CTOR(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
// CreateHTMLImgElement, see below
// CreateHTMLOptionElement, see below
MAKE_CTOR(CreateTextEncoder, nsIDocumentEncoder, NS_NewTextEncoder)
MAKE_CTOR(CreateHTMLCopyTextEncoder, nsIDocumentEncoder, NS_NewHTMLCopyTextEncoder)
MAKE_CTOR(CreateXMLContentSerializer, nsIContentSerializer, NS_NewXMLContentSerializer)
MAKE_CTOR(CreateHTMLContentSerializer, nsIContentSerializer, NS_NewHTMLContentSerializer)
MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPlainTextSerializer)
MAKE_CTOR(CreateHTMLFragmentSink, nsIHTMLFragmentContentSink, NS_NewHTMLFragmentContentSink)
MAKE_CTOR(CreateSanitizingHTMLSerializer, nsIContentSerializer, NS_NewSanitizingHTMLSerializer)
MAKE_CTOR(CreateXBLService, nsIXBLService, NS_NewXBLService)
MAKE_CTOR(CreateBindingManager, nsIBindingManager, NS_NewBindingManager)
MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy)
MAKE_CTOR(CreateFrameLoader, nsIFrameLoader, NS_NewFrameLoader)
MAKE_CTOR(CreateNodeInfoManager, nsINodeInfoManager, NS_NewNodeInfoManager)
MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewComputedDOMStyle)
#ifdef MOZ_XUL
MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
// NS_NewXULContentBuilder
// NS_NewXULTreeBuilder
MAKE_CTOR(CreateXULContentSink, nsIXULContentSink, NS_NewXULContentSink)
MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
MAKE_CTOR(CreateXULPopupListener, nsIXULPopupListener, NS_NewXULPopupListener)
// NS_NewXULControllers
// NS_NewXULPrototypeCache
MAKE_CTOR(CreateXULElementFactory, nsIElementFactory, NS_NewXULElementFactory)
#endif
#ifdef MOZ_MATHML
MAKE_CTOR(CreateMathMLElementFactory, nsIElementFactory, NS_NewMathMLElementFactory)
#endif
#ifdef MOZ_SVG
MAKE_CTOR(CreateSVGElementFactory, nsIElementFactory, NS_NewSVGElementFactory)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentHTTPStartup)
MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSSOMFactory)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsInspectorCSSUtils)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWyciwygProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentAreaDragDrop)
MAKE_CTOR(CreateSyncLoadDOMService, nsISyncLoadDOMService, NS_NewSyncLoadDOMService)
static NS_IMETHODIMP
CreateHTMLImgElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
*aResult = nsnull;
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
nsIHTMLContent* inst;
// Note! NS_NewHTMLImageElement is special cased to handle a null nodeinfo
nsresult rv = NS_NewHTMLImageElement(&inst, nsnull);
if (NS_SUCCEEDED(rv)) {
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
}
return rv;
}
static NS_IMETHODIMP
RegisterHTMLImgElement(nsIComponentManager *aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const char* aComponentType,
const nsModuleComponentInfo* aInfo)
{
nsCOMPtr<nsICategoryManager> catman =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
if (!catman)
return NS_ERROR_FAILURE;
nsXPIDLCString previous;
nsresult rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
"Image", NS_HTMLIMGELEMENT_CONTRACTID,
PR_TRUE, PR_TRUE, getter_Copies(previous));
NS_ENSURE_SUCCESS(rv, rv);
return catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
"Image", "HTMLImageElement",
PR_TRUE, PR_TRUE, getter_Copies(previous));
}
static NS_IMETHODIMP
UnregisterHTMLImgElement(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const nsModuleComponentInfo* aInfo)
{
// XXX remove category entry
return NS_OK;
}
static NS_IMETHODIMP
CreateHTMLOptionElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
{
*aResult = nsnull;
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
nsIHTMLContent* inst;
// Note! NS_NewHTMLOptionElement is special cased to handle a null nodeinfo
nsresult rv = NS_NewHTMLOptionElement(&inst, nsnull);
if (NS_SUCCEEDED(rv)) {
rv = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
}
return rv;
}
static NS_IMETHODIMP
RegisterHTMLOptionElement(nsIComponentManager *aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const char* aComponentType,
const nsModuleComponentInfo* aInfo)
{
nsCOMPtr<nsICategoryManager> catman =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
if (!catman)
return NS_ERROR_FAILURE;
nsXPIDLCString previous;
nsresult rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
"Option", NS_HTMLOPTIONELEMENT_CONTRACTID,
PR_TRUE, PR_TRUE, getter_Copies(previous));
NS_ENSURE_SUCCESS(rv, rv);
return catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
"Option", "HTMLOptionElement",
PR_TRUE, PR_TRUE, getter_Copies(previous));
}
static NS_IMETHODIMP
UnregisterHTMLOptionElement(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const nsModuleComponentInfo* aInfo)
{
// XXX remove category entry
return NS_OK;
}
// The list of components we register
static const nsModuleComponentInfo gComponents[] = {
{ "Namespace manager",
NS_NAMESPACEMANAGER_CID,
nsnull,
CreateNameSpaceManager },
{ "Event listener manager",
NS_EVENTLISTENERMANAGER_CID,
nsnull,
CreateEventListenerManager },
{ "Event state manager",
NS_EVENTSTATEMANAGER_CID,
nsnull,
CreateEventStateManager },
{ "Document Viewer",
NS_DOCUMENT_VIEWER_CID,
nsnull,
CreateDocumentViewer },
{ "HTML Style Sheet",
NS_HTMLSTYLESHEET_CID,
nsnull,
CreateHTMLStyleSheet },
{ "Style Set",
NS_STYLESET_CID,
nsnull,
CreateStyleSet },
{ "CSS Style Sheet",
NS_CSS_STYLESHEET_CID,
nsnull,
CreateCSSStyleSheet },
{ "HTML document",
NS_HTMLDOCUMENT_CID,
nsnull,
CreateHTMLDocument },
{ "HTML-CSS style sheet",
NS_HTML_CSS_STYLESHEET_CID,
nsnull,
CreateHTMLCSSStyleSheet },
{ "DOM implementation",
NS_DOM_IMPLEMENTATION_CID,
nsnull,
CreateDOMImplementation },
{ "XML document",
NS_XMLDOCUMENT_CID,
nsnull,
CreateXMLDocument },
#ifdef MOZ_SVG
{ "SVG document",
NS_SVGDOCUMENT_CID,
nsnull,
CreateSVGDocument },
#endif
{ "Image document",
NS_IMAGEDOCUMENT_CID,
nsnull,
CreateImageDocument },
{ "CSS parser",
NS_CSSPARSER_CID,
nsnull,
CreateCSSParser },
{ "CSS loader",
NS_CSS_LOADER_CID,
nsnull,
CreateCSSLoader },
{ "HTML element factory",
NS_HTML_ELEMENT_FACTORY_CID,
NS_HTML_ELEMENT_FACTORY_CONTRACTID,
CreateHTMLElementFactory },
{ "Text element",
NS_TEXTNODE_CID,
nsnull,
CreateTextNode },
#if 0 // XXX apparently there is no such thing?
{ "Anonymous Content",
NS_ANONYMOUSCONTENT_CID,
nsnull,
CreateAnonymousElement },
#endif
{ "Attribute Content",
NS_ATTRIBUTECONTENT_CID,
nsnull,
CreateAttributeContent },
{ "XML element factory",
NS_XML_ELEMENT_FACTORY_CID,
NS_XML_ELEMENT_FACTORY_CONTRACTID,
CreateXMLElementFactory },
#if 0 // XXX apparently there is no such thing?
{ "Selection",
NS_SELECTION_CID,
nsnull,
CreateSelection },
#endif
{ "Dom selection",
NS_DOMSELECTION_CID,
nsnull,
CreateDOMSelection },
{ "Frame selection",
NS_FRAMESELECTION_CID,
nsnull,
CreateSelection },
{ "Range",
NS_RANGE_CID,
nsnull,
CreateRange },
{ "Range Utils",
NS_RANGEUTILS_CID,
nsnull,
CreateRangeUtils },
{ "Content iterator",
NS_CONTENTITERATOR_CID,
nsnull,
CreateContentIterator },
{ "Generated Content iterator",
NS_GENERATEDCONTENTITERATOR_CID,
nsnull,
CreateGeneratedContentIterator },
{ "Generated Subtree iterator",
NS_GENERATEDSUBTREEITERATOR_CID,
nsnull,
CreateGeneratedSubtreeIterator },
{ "Subtree iterator",
NS_SUBTREEITERATOR_CID,
nsnull,
CreateSubtreeIterator },
{ "CSS Object Model Factory",
NS_CSSOMFACTORY_CID,
nsnull,
nsCSSOMFactoryConstructor },
{ "Inspector CSS Utils",
NS_INSPECTORCSSUTILS_CID,
nsnull,
nsInspectorCSSUtilsConstructor },
// Needed to support "new Option;" and "new Image;" in JavaScript
{ "HTML img element",
NS_HTMLIMAGEELEMENT_CID,
NS_HTMLIMGELEMENT_CONTRACTID,
CreateHTMLImgElement,
RegisterHTMLImgElement,
UnregisterHTMLImgElement },
{ "HTML option element",
NS_HTMLOPTIONELEMENT_CID,
NS_HTMLOPTIONELEMENT_CONTRACTID,
CreateHTMLOptionElement,
RegisterHTMLOptionElement,
UnregisterHTMLOptionElement },
{ "XML document encoder",
NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "text/xml",
CreateTextEncoder },
{ "XML document encoder",
NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "application/xml",
CreateTextEncoder },
{ "XML document encoder",
NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "application/xhtml+xml",
CreateTextEncoder },
#ifdef MOZ_SVG
{ "SVG document encoder",
NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "image/svg+xml",
CreateTextEncoder },
#endif
{ "HTML document encoder",
NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "text/html",
CreateTextEncoder },
{ "Plaintext document encoder",
NS_TEXT_ENCODER_CID,
NS_DOC_ENCODER_CONTRACTID_BASE "text/plain",
CreateTextEncoder },
{ "HTML copy encoder",
NS_HTMLCOPY_TEXT_ENCODER_CID,
NS_HTMLCOPY_ENCODER_CONTRACTID,
CreateHTMLCopyTextEncoder },
{ "XML content serializer",
NS_XMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml",
CreateXMLContentSerializer },
{ "XML content serializer",
NS_XMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xml",
CreateXMLContentSerializer },
{ "XML content serializer",
NS_XMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml",
CreateXMLContentSerializer },
#ifdef MOZ_SVG
{ "SVG content serializer",
NS_XMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml",
CreateXMLContentSerializer },
#endif
{ "HTML content serializer",
NS_HTMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html",
CreateHTMLContentSerializer },
{ "XUL content serializer",
NS_XMLCONTENTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/vnd.mozilla.xul+xml",
CreateXMLContentSerializer },
{ "plaintext content serializer",
NS_PLAINTEXTSERIALIZER_CID,
NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain",
CreatePlainTextSerializer },
{ "plaintext sink",
NS_PLAINTEXTSERIALIZER_CID,
NS_PLAINTEXTSINK_CONTRACTID,
CreatePlainTextSerializer },
{ "html fragment sink",
NS_HTMLFRAGMENTSINK_CID,
NS_HTMLFRAGMENTSINK_CONTRACTID,
CreateHTMLFragmentSink },
{ "HTML sanitizing content serializer",
MOZ_SANITIZINGHTMLSERIALIZER_CID,
MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID,
CreateSanitizingHTMLSerializer },
{ "XBL Service",
NS_XBLSERVICE_CID,
"@mozilla.org/xbl;1",
CreateXBLService },
{ "XBL Binding Manager",
NS_BINDINGMANAGER_CID,
"@mozilla.org/xbl/binding-manager;1",
CreateBindingManager },
{ "Content policy service",
NS_CONTENTPOLICY_CID,
NS_CONTENTPOLICY_CONTRACTID,
CreateContentPolicy },
{ "Frame Loader",
NS_FRAMELOADER_CID,
NS_FRAMELOADER_CONTRACTID,
CreateFrameLoader },
{ "NodeInfoManager",
NS_NODEINFOMANAGER_CID,
NS_NODEINFOMANAGER_CONTRACTID,
CreateNodeInfoManager },
{ "DOM CSS Computed Style Declaration",
NS_COMPUTEDDOMSTYLE_CID,
"@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1",
CreateComputedDOMStyle },
#ifdef MOZ_XUL
{ "XUL Sort Service",
NS_XULSORTSERVICE_CID,
"@mozilla.org/xul/xul-sort-service;1",
CreateXULSortService },
{ "XUL Template Builder",
NS_XULTEMPLATEBUILDER_CID,
"@mozilla.org/xul/xul-template-builder;1",
NS_NewXULContentBuilder },
{ "XUL Tree Builder",
NS_XULTREEBUILDER_CID,
"@mozilla.org/xul/xul-tree-builder;1",
NS_NewXULTreeBuilder },
{ "XUL Content Sink",
NS_XULCONTENTSINK_CID,
"@mozilla.org/xul/xul-content-sink;1",
CreateXULContentSink },
{ "XUL Document",
NS_XULDOCUMENT_CID,
"@mozilla.org/xul/xul-document;1",
CreateXULDocument },
{ "XUL PopupListener",
NS_XULPOPUPLISTENER_CID,
"@mozilla.org/xul/xul-popup-listener;1",
CreateXULPopupListener },
{ "XUL Controllers",
NS_XULCONTROLLERS_CID,
"@mozilla.org/xul/xul-controllers;1",
NS_NewXULControllers },
{ "XUL Prototype Cache",
NS_XULPROTOTYPECACHE_CID,
"@mozilla.org/xul/xul-prototype-cache;1",
NS_NewXULPrototypeCache },
{ NS_XULPROTOTYPEDOCUMENT_CLASSNAME,
NS_XULPROTOTYPEDOCUMENT_CID,
nsnull,
NS_NewXULPrototypeDocument },
{ "XUL Element Factory",
NS_XULELEMENTFACTORY_CID,
NS_ELEMENT_FACTORY_CONTRACTID_PREFIX "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
CreateXULElementFactory },
#endif
#ifdef MOZ_MATHML
{ "MathML Element Factory",
NS_MATHMLELEMENTFACTORY_CID,
NS_MATHML_ELEMENT_FACTORY_CONTRACTID,
CreateMathMLElementFactory },
#endif
#ifdef MOZ_SVG
{ "SVG element factory (deprecated namespace)",
NS_SVGELEMENTFACTORY_CID,
NS_SVG_DEPRECATED_ELEMENT_FACTORY_CONTRACTID,
CreateSVGElementFactory },
{ "SVG element factory",
NS_SVGELEMENTFACTORY_CID,
NS_SVG_ELEMENT_FACTORY_CONTRACTID,
CreateSVGElementFactory },
#endif
{ "Content HTTP Startup Listener",
NS_CONTENTHTTPSTARTUP_CID,
NS_CONTENTHTTPSTARTUP_CONTRACTID,
nsContentHTTPStartupConstructor,
nsContentHTTPStartup::RegisterHTTPStartup,
nsContentHTTPStartup::UnregisterHTTPStartup },
{ "Document Loader Factory",
NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID,
"@mozilla.org:/content/document-loader-factory;1",
CreateContentDLF,
nsContentDLF::RegisterDocumentFactories,
nsContentDLF::UnregisterDocumentFactories },
{ "Wyciwyg Handler",
NS_WYCIWYGPROTOCOLHANDLER_CID,
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wyciwyg",
nsWyciwygProtocolHandlerConstructor },
{ "Content Area DragDrop",
NS_CONTENTAREADRAGDROP_CID,
NS_CONTENTAREADRAGDROP_CONTRACTID,
nsContentAreaDragDropConstructor },
{ "SyncLoad DOM Service",
NS_SYNCLOADDOMSERVICE_CID,
NS_SYNCLOADDOMSERVICE_CONTRACTID,
CreateSyncLoadDOMService }
};
NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(nsContentModule, gComponents, Initialize, Shutdown)

View File

@@ -0,0 +1,904 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef NGLAYOUT_DDRAW
#define INITGUID
#endif
#include "nsDrawingSurfaceWin.h"
#include "prmem.h"
#include "nscrt.h"
//#define GFX_DEBUG
#ifdef GFX_DEBUG
#define BREAK_TO_DEBUGGER DebugBreak()
#else
#define BREAK_TO_DEBUGGER
#endif
#ifdef GFX_DEBUG
#define VERIFY(exp) ((exp) ? 0: (GetLastError(), BREAK_TO_DEBUGGER))
#else // !_DEBUG
#define VERIFY(exp) (exp)
#endif // !_DEBUG
static NS_DEFINE_IID(kIDrawingSurfaceIID, NS_IDRAWING_SURFACE_IID);
static NS_DEFINE_IID(kIDrawingSurfaceWinIID, NS_IDRAWING_SURFACE_WIN_IID);
#ifdef NGLAYOUT_DDRAW
IDirectDraw *nsDrawingSurfaceWin::mDDraw = NULL;
IDirectDraw2 *nsDrawingSurfaceWin::mDDraw2 = NULL;
nsresult nsDrawingSurfaceWin::mDDrawResult = NS_OK;
#endif
nsDrawingSurfaceWin :: nsDrawingSurfaceWin()
{
NS_INIT_ISUPPORTS();
mDC = NULL;
mOrigBitmap = nsnull;
mSelectedBitmap = nsnull;
mKillDC = PR_FALSE;
mBitmapInfo = nsnull;
mDIBits = nsnull;
mLockedBitmap = nsnull;
mWidth = mHeight = 0;
mLockOffset = mLockHeight = 0;
mLockFlags = 0;
#ifdef NGLAYOUT_DDRAW
CreateDDraw();
mSurface = NULL;
mSurfLockCnt = 0;
#endif
}
nsDrawingSurfaceWin :: ~nsDrawingSurfaceWin()
{
if ((nsnull != mDC) && (nsnull != mOrigBitmap))
{
HBITMAP tbits = (HBITMAP)::SelectObject(mDC, mOrigBitmap);
if (nsnull != tbits)
VERIFY(::DeleteObject(tbits));
mOrigBitmap = nsnull;
}
if (nsnull != mBitmapInfo)
{
PR_Free(mBitmapInfo);
mBitmapInfo = nsnull;
}
if ((nsnull != mDIBits) && (nsnull == mSelectedBitmap))
PR_Free(mDIBits);
mDIBits = nsnull;
mSelectedBitmap = nsnull;
#ifdef NGLAYOUT_DDRAW
if (NULL != mSurface)
{
if (NULL != mDC)
{
mSurface->ReleaseDC(mDC);
mDC = NULL;
}
NS_RELEASE(mSurface);
mSurface = NULL;
}
else
#endif
{
if (NULL != mDC)
{
if (PR_TRUE == mKillDC)
::DeleteDC(mDC);
mDC = NULL;
}
}
}
NS_IMETHODIMP nsDrawingSurfaceWin :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(kIDrawingSurfaceIID))
{
nsIDrawingSurface* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIDrawingSurfaceWinIID))
{
nsIDrawingSurfaceWin* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kISupportsIID))
{
nsIDrawingSurface* tmp = this;
nsISupports* tmp2 = tmp;
*aInstancePtr = (void*) tmp2;
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ADDREF(nsDrawingSurfaceWin)
NS_IMPL_RELEASE(nsDrawingSurfaceWin)
NS_IMETHODIMP nsDrawingSurfaceWin :: Lock(PRInt32 aX, PRInt32 aY,
PRUint32 aWidth, PRUint32 aHeight,
void **aBits, PRInt32 *aStride,
PRInt32 *aWidthBytes, PRUint32 aFlags)
{
#ifdef NGLAYOUT_DDRAW
if (mSurfLockCnt == 0)
{
RECT srect;
DWORD lockflags = 0;
srect.left = aX;
srect.top = aY;
srect.right = aX + aWidth;
srect.bottom = aY + aHeight;
if (aFlags & NS_LOCK_SURFACE_READ_ONLY)
lockflags |= DDLOCK_READONLY;
if (aFlags & NS_LOCK_SURFACE_WRITE_ONLY)
lockflags |= DDLOCK_WRITEONLY;
if (PR_TRUE == LockSurface(mSurface, &mSurfDesc, &mBitmap, &srect, lockflags, &mPixFormat))
mSurfLockCnt++;
}
else
{
NS_ASSERTION(0, "nested lock attempt");
return NS_ERROR_FAILURE;
}
if (mSurfLockCnt == 0)
#endif
{
if (nsnull == mLockedBitmap)
{
if (nsnull == mSelectedBitmap)
{
HBITMAP tbits = ::CreateCompatibleBitmap(mDC, 2, 2);
mLockedBitmap = (HBITMAP)::SelectObject(mDC, tbits);
::GetObject(mLockedBitmap, sizeof(BITMAP), &mBitmap);
mLockOffset = aY;
mLockHeight = min((PRInt32)aHeight, (mBitmap.bmHeight - aY));
mBitmapInfo = CreateBitmapInfo(mBitmap.bmWidth, mBitmap.bmHeight, mBitmap.bmBitsPixel, (void **)&mDIBits);
if (!(aFlags & NS_LOCK_SURFACE_WRITE_ONLY))
::GetDIBits(mDC, mLockedBitmap, mLockOffset, mLockHeight, mDIBits, mBitmapInfo, DIB_RGB_COLORS);
mBitmap.bmBits = mDIBits;
}
else
{
mLockedBitmap = mSelectedBitmap;
mBitmap.bmBits = mDIBits + mBitmap.bmWidthBytes * aY;
}
}
else
{
NS_ASSERTION(0, "nested lock attempt");
return NS_ERROR_FAILURE;
}
}
*aBits = (PRUint8 *)mBitmap.bmBits + (aX * (mBitmap.bmBitsPixel >> 3));
*aStride = mBitmap.bmWidthBytes;
*aWidthBytes = aWidth * (mBitmap.bmBitsPixel >> 3);
mLockFlags = aFlags;
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: Unlock(void)
{
#ifdef NGLAYOUT_DDRAW
NS_ASSERTION(!(mDC != nsnull), "attempt to unlock with dc");
if (nsnull == mDC)
{
mSurfLockCnt--;
NS_ASSERTION(!(mSurfLockCnt != 0), "nested surface locks");
if (mSurfLockCnt == 0)
mSurface->Unlock(mSurfDesc.lpSurface);
}
else
#endif
{
if (nsnull != mLockedBitmap)
{
if (nsnull == mSelectedBitmap)
{
HBITMAP tbits;
if (!(mLockFlags & NS_LOCK_SURFACE_READ_ONLY))
::SetDIBits(mDC, mLockedBitmap, mLockOffset, mLockHeight, mDIBits, mBitmapInfo, DIB_RGB_COLORS);
tbits = (HBITMAP)::SelectObject(mDC, mLockedBitmap);
::DeleteObject(tbits);
if (nsnull != mBitmapInfo)
{
PR_Free(mBitmapInfo);
mBitmapInfo = nsnull;
}
if (nsnull != mDIBits)
{
PR_Free(mDIBits);
mDIBits = nsnull;
}
}
mLockedBitmap = nsnull;
}
}
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: GetDimensions(PRUint32 *aWidth, PRUint32 *aHeight)
{
*aWidth = mWidth;
*aHeight = mHeight;
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: IsOffscreen(PRBool *aOffScreen)
{
*aOffScreen = mKillDC;
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: IsPixelAddressable(PRBool *aAddressable)
{
#ifdef NGLAYOUT_DDRAW
if (nsnull != mSurface)
*aAddressable = PR_TRUE;
else
#endif
if (nsnull != mSelectedBitmap)
*aAddressable = PR_TRUE;
else
*aAddressable = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: GetPixelFormat(nsPixelFormat *aFormat)
{
*aFormat = mPixFormat;
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: Init(HDC aDC)
{
mDC = aDC;
mTechnology = ::GetDeviceCaps(mDC, TECHNOLOGY);
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: Init(HDC aDC, PRUint32 aWidth,
PRUint32 aHeight, PRUint32 aFlags)
{
NS_ASSERTION(!(aDC == nsnull), "null DC");
#ifdef NGLAYOUT_DDRAW
if (aFlags & NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS)
{
LPDIRECTDRAWSURFACE ddsurf = nsnull;
if ((NULL != mDDraw2) && (aWidth > 0) && (aHeight > 0))
{
DDSURFACEDESC ddsd;
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN |
((aFlags & NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS) ?
DDSCAPS_SYSTEMMEMORY : 0);
ddsd.dwWidth = aWidth;
ddsd.dwHeight = aHeight;
mDDraw2->CreateSurface(&ddsd, &ddsurf, NULL);
}
if (NULL != ddsurf)
mSurface = ddsurf;
else
{
mDC = ::CreateCompatibleDC(aDC);
mKillDC = PR_TRUE;
}
}
else
#endif
{
mDC = ::CreateCompatibleDC(aDC);
mTechnology = ::GetDeviceCaps(mDC, TECHNOLOGY);
mKillDC = PR_TRUE;
}
#ifdef NGLAYOUT_DDRAW
if (nsnull == mSurface)
#endif
{
HBITMAP tbits;
if ((aWidth > 0) && (aHeight > 0))
{
if (aFlags & NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS)
{
void *bits;
BITMAPINFO *binfo;
int depth;
depth = ::GetDeviceCaps(aDC, BITSPIXEL);
binfo = CreateBitmapInfo(aWidth, aHeight, depth);
if (nsnull != binfo)
mSelectedBitmap = tbits = ::CreateDIBSection(aDC, binfo, DIB_RGB_COLORS, &bits, NULL, 0);
if (NULL == mSelectedBitmap)
tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
else
{
mBitmapInfo = binfo;
mDIBits = (PRUint8 *)bits;
mBitmap.bmWidthBytes = RASWIDTH(aWidth, depth);
mBitmap.bmBitsPixel = depth;
}
}
else
tbits = ::CreateCompatibleBitmap(aDC, aWidth, aHeight);
}
else
{
//we do this to make sure that the memory DC knows what the
//bitmap format of the original DC was. this way, later
//operations to create bitmaps from the memory DC will create
//bitmaps with the correct properties.
tbits = ::CreateCompatibleBitmap(aDC, 2, 2);
}
mOrigBitmap = (HBITMAP)::SelectObject(mDC, tbits);
}
mWidth = aWidth;
mHeight = aHeight;
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: GetDC(HDC *aDC)
{
#ifdef NGLAYOUT_DDRAW
if (nsnull != mSurface)
{
if (0 == mSurfLockCnt)
mSurface->GetDC(&mDC);
mSurfLockCnt++;
}
#endif
*aDC = mDC;
return NS_OK;
}
NS_IMETHODIMP
nsDrawingSurfaceWin::GetTECHNOLOGY(PRInt32 *aTechnology)
{
*aTechnology = mTechnology;
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: ReleaseDC(void)
{
#ifdef NGLAYOUT_DDRAW
if (nsnull != mSurface)
{
--mSurfLockCnt;
if ((nsnull != mDC) && (mSurfLockCnt == 0))
{
mSurface->ReleaseDC(mDC);
mDC = nsnull;
}
}
#endif
return NS_OK;
}
NS_IMETHODIMP nsDrawingSurfaceWin :: IsReleaseDCDestructive(PRBool *aDestructive)
{
#ifdef NGLAYOUT_DDRAW
if (nsnull != mSurface)
*aDestructive = PR_TRUE;
else
#endif
*aDestructive = PR_FALSE;
return NS_OK;
}
BITMAPINFO * nsDrawingSurfaceWin :: CreateBitmapInfo(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,
void **aBits)
{
PRInt32 palsize, imagesize, spanbytes, allocsize;
PRUint8 *colortable;
DWORD bicomp, masks[3];
BITMAPINFO *rv = nsnull;
switch (aDepth)
{
case 8:
palsize = 256;
allocsize = 256;
bicomp = BI_RGB;
break;
case 16:
palsize = 0;
allocsize = 3;
bicomp = BI_BITFIELDS;
masks[0] = 0xf800;
masks[1] = 0x07e0;
masks[2] = 0x001f;
mPixFormat.mRedZeroMask = 0x1f;
mPixFormat.mGreenZeroMask = 0x3f;
mPixFormat.mBlueZeroMask = 0x1f;
mPixFormat.mAlphaZeroMask = 0;
mPixFormat.mRedMask = masks[0];
mPixFormat.mGreenMask = masks[1];
mPixFormat.mBlueMask = masks[2];
mPixFormat.mAlphaMask = 0;
mPixFormat.mRedCount = 5;
mPixFormat.mGreenCount = 6;
mPixFormat.mBlueCount = 5;
mPixFormat.mAlphaCount = 0;
mPixFormat.mRedShift = 11;
mPixFormat.mGreenShift = 5;
mPixFormat.mBlueShift = 0;
mPixFormat.mAlphaShift = 0;
break;
case 24:
palsize = 0;
allocsize = 0;
bicomp = BI_RGB;
mPixFormat.mRedZeroMask = 0xff;
mPixFormat.mGreenZeroMask = 0xff;
mPixFormat.mBlueZeroMask = 0xff;
mPixFormat.mAlphaZeroMask = 0;
mPixFormat.mRedMask = 0xff;
mPixFormat.mGreenMask = 0xff00;
mPixFormat.mBlueMask = 0xff0000;
mPixFormat.mAlphaMask = 0;
mPixFormat.mRedCount = 8;
mPixFormat.mGreenCount = 8;
mPixFormat.mBlueCount = 8;
mPixFormat.mAlphaCount = 0;
mPixFormat.mRedShift = 0;
mPixFormat.mGreenShift = 8;
mPixFormat.mBlueShift = 16;
mPixFormat.mAlphaShift = 0;
break;
case 32:
palsize = 0;
allocsize = 3;
bicomp = BI_BITFIELDS;
masks[0] = 0xff0000;
masks[1] = 0x00ff00;
masks[2] = 0x0000ff;
mPixFormat.mRedZeroMask = 0xff;
mPixFormat.mGreenZeroMask = 0xff;
mPixFormat.mBlueZeroMask = 0xff;
mPixFormat.mAlphaZeroMask = 0xff;
mPixFormat.mRedMask = masks[0];
mPixFormat.mGreenMask = masks[1];
mPixFormat.mBlueMask = masks[2];
mPixFormat.mAlphaMask = 0xff000000;
mPixFormat.mRedCount = 8;
mPixFormat.mGreenCount = 8;
mPixFormat.mBlueCount = 8;
mPixFormat.mAlphaCount = 8;
mPixFormat.mRedShift = 16;
mPixFormat.mGreenShift = 8;
mPixFormat.mBlueShift = 0;
mPixFormat.mAlphaShift = 24;
break;
default:
palsize = -1;
break;
}
if (palsize >= 0)
{
spanbytes = RASWIDTH(aWidth, aDepth);
imagesize = spanbytes * aHeight;
rv = (BITMAPINFO *)PR_Malloc(sizeof(BITMAPINFOHEADER) + (sizeof(RGBQUAD) * allocsize));
if (nsnull != rv)
{
rv->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
rv->bmiHeader.biWidth = aWidth;
rv->bmiHeader.biHeight = -aHeight;
rv->bmiHeader.biPlanes = 1;
rv->bmiHeader.biBitCount = (unsigned short)aDepth;
rv->bmiHeader.biCompression = bicomp;
rv->bmiHeader.biSizeImage = imagesize;
rv->bmiHeader.biXPelsPerMeter = 0;
rv->bmiHeader.biYPelsPerMeter = 0;
rv->bmiHeader.biClrUsed = palsize;
rv->bmiHeader.biClrImportant = palsize;
// set the color table in the info header
colortable = (PRUint8 *)rv + sizeof(BITMAPINFOHEADER);
if ((aDepth == 16) || (aDepth == 32))
memcpy(colortable, masks, sizeof(DWORD) * allocsize);
else
memset(colortable, 0, sizeof(RGBQUAD) * palsize);
if (nsnull != aBits)
*aBits = PR_Malloc(imagesize);
}
}
return rv;
}
#ifdef NGLAYOUT_DDRAW
PRBool nsDrawingSurfaceWin :: LockSurface(IDirectDrawSurface *aSurface, DDSURFACEDESC *aDesc,
BITMAP *aBitmap, RECT *aRect, DWORD aLockFlags, nsPixelFormat *aPixFormat)
{
if (nsnull != aSurface)
{
aDesc->dwSize = sizeof(DDSURFACEDESC);
if (DD_OK == aSurface->Lock(aRect, aDesc, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | aLockFlags, NULL))
{
if ((aDesc->ddpfPixelFormat.dwFlags &
(DDPF_ALPHA | DDPF_PALETTEINDEXED1 |
DDPF_PALETTEINDEXED2 | DDPF_PALETTEINDEXED4 |
DDPF_PALETTEINDEXEDTO8 | DDPF_YUV | DDPF_ZBUFFER)) ||
(aDesc->ddpfPixelFormat.dwRGBBitCount < 8))
{
//this is a surface that we can't, or don't want to handle.
aSurface->Unlock(aDesc->lpSurface);
return PR_FALSE;
}
aBitmap->bmType = 0;
aBitmap->bmWidth = aDesc->dwWidth;
aBitmap->bmHeight = aDesc->dwHeight;
aBitmap->bmWidthBytes = aDesc->lPitch;
aBitmap->bmPlanes = 1;
aBitmap->bmBitsPixel = (PRUint16)aDesc->ddpfPixelFormat.dwRGBBitCount;
aBitmap->bmBits = aDesc->lpSurface;
if ((nsnull != aPixFormat) && (aBitmap->bmBitsPixel > 8))
{
DWORD btemp, shiftcnt;
btemp = aDesc->ddpfPixelFormat.dwRBitMask;
aPixFormat->mRedMask = btemp;
shiftcnt = 32;
if (!(btemp & 0xffff))
{
aPixFormat->mRedShift = 16;
btemp >>= 16;
shiftcnt = 16;
}
else if (!(btemp & 0xff))
{
aPixFormat->mRedShift = 8;
btemp >>= 8;
shiftcnt = 24;
}
else
{
aPixFormat->mRedShift = 0;
shiftcnt = 32;
}
while (!(btemp & 1) && shiftcnt--)
{
btemp >>= 1;
aPixFormat->mRedShift++;
}
aPixFormat->mRedZeroMask = btemp;
aPixFormat->mRedCount = 0;
while ((btemp & 1) && shiftcnt--)
{
btemp >>= 1;
aPixFormat->mRedCount++;
}
btemp = aDesc->ddpfPixelFormat.dwGBitMask;
aPixFormat->mGreenMask = btemp;
shiftcnt = 32;
if (!(btemp & 0xffff))
{
aPixFormat->mGreenShift = 16;
btemp >>= 16;
shiftcnt = 16;
}
else if (!(btemp & 0xff))
{
aPixFormat->mGreenShift = 8;
btemp >>= 8;
shiftcnt = 24;
}
else
{
aPixFormat->mGreenShift = 0;
shiftcnt = 32;
}
while (!(btemp & 1) && shiftcnt--)
{
btemp >>= 1;
aPixFormat->mGreenShift++;
}
aPixFormat->mGreenZeroMask = btemp;
aPixFormat->mGreenCount = 0;
while ((btemp & 1) && shiftcnt--)
{
btemp >>= 1;
aPixFormat->mGreenCount++;
}
btemp = aDesc->ddpfPixelFormat.dwBBitMask;
aPixFormat->mBlueMask = btemp;
shiftcnt = 32;
if (!(btemp & 0xffff))
{
aPixFormat->mBlueShift = 16;
btemp >>= 16;
shiftcnt = 16;
}
else if (!(btemp & 0xff))
{
aPixFormat->mBlueShift = 8;
btemp >>= 8;
shiftcnt = 24;
}
else
{
aPixFormat->mBlueShift = 0;
shiftcnt = 32;
}
while (!(btemp & 1) && shiftcnt--)
{
btemp >>= 1;
aPixFormat->mBlueShift++;
}
aPixFormat->mBlueZeroMask = btemp;
aPixFormat->mBlueCount = 0;
while ((btemp & 1) && shiftcnt--)
{
btemp >>= 1;
aPixFormat->mBlueCount++;
}
aPixFormat->mAlphaCount = (PRUint8)aDesc->ddpfPixelFormat.dwAlphaBitDepth;
if (aPixFormat->mAlphaCount > 0)
{
btemp = aDesc->ddpfPixelFormat.dwRGBAlphaBitMask;
aPixFormat->mAlphaMask = btemp;
shiftcnt = 32;
if (!(btemp & 0xffff))
{
aPixFormat->mAlphaShift = 16;
btemp >>= 16;
shiftcnt = 16;
}
else if (!(btemp & 0xff))
{
aPixFormat->mAlphaShift = 8;
btemp >>= 8;
shiftcnt = 24;
}
else
{
aPixFormat->mAlphaShift = 0;
shiftcnt = 32;
}
while (!(btemp & 1) && shiftcnt--)
{
btemp >>= 1;
aPixFormat->mAlphaShift++;
}
aPixFormat->mAlphaZeroMask = btemp;
}
else
{
aPixFormat->mAlphaMask = 0;
aPixFormat->mAlphaShift = 0;
aPixFormat->mAlphaZeroMask = 0;
}
}
return PR_TRUE;
}
else
return PR_FALSE;
}
else
return PR_FALSE;
}
nsresult nsDrawingSurfaceWin :: CreateDDraw()
{
if ((mDDraw2 == NULL) && (mDDrawResult == NS_OK))
{
CoInitialize(NULL);
mDDrawResult = DirectDrawCreate(NULL, &mDDraw, NULL);
if (mDDrawResult == NS_OK)
mDDrawResult = mDDraw->QueryInterface(IID_IDirectDraw2, (LPVOID *)&mDDraw2);
if (mDDrawResult == NS_OK)
{
mDDraw2->SetCooperativeLevel(NULL, DDSCL_NORMAL);
#ifdef NS_DEBUG
printf("using DirectDraw (%08X)\n", mDDraw2);
DDSCAPS ddscaps;
DWORD totalmem, freemem;
ddscaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
nsresult res = mDDraw2->GetAvailableVidMem(&ddscaps, &totalmem, &freemem);
if (NS_SUCCEEDED(res))
{
printf("total video memory: %d\n", totalmem);
printf("free video memory: %d\n", freemem);
}
else
{
printf("GetAvailableVidMem() returned %08x: %s\n", res,
(res == DDERR_NODIRECTDRAWHW) ?
"no hardware ddraw driver available" : "unknown error code");
}
#endif
}
}
return mDDrawResult;
}
nsresult nsDrawingSurfaceWin :: GetDDraw(IDirectDraw2 **aDDraw)
{
CreateDDraw();
if (NULL != mDDraw2)
{
NS_ADDREF(mDDraw2);
*aDDraw = mDDraw2;
}
else
*aDDraw = NULL;
return NS_OK;
}
#endif