Compare commits

..

38 Commits

Author SHA1 Message Date
dkl%redhat.com
8c591d53e2 Removed some remaining SelectVisible calls in favor of CanSeeBug
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@121533 18797224-902f-48f8-a5cc-f745e15eee43
2002-05-15 18:36:31 +00:00
dkl%redhat.com
c1aa983fd5 Update to HEAD 2002/05/13
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@121401 18797224-902f-48f8-a5cc-f745e15eee43
2002-05-13 21:56:49 +00:00
dkl%redhat.com
3551227412 forgot one
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@121393 18797224-902f-48f8-a5cc-f745e15eee43
2002-05-13 20:49:00 +00:00
dkl%redhat.com
d0cc91f285 Fixed some template inconsistencies with current 2.16 Stable Branch
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@121392 18797224-902f-48f8-a5cc-f745e15eee43
2002-05-13 20:46:50 +00:00
(no author)
65ff7d56b3 This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@121370 18797224-902f-48f8-a5cc-f745e15eee43
2002-05-13 06:24:51 +00:00
dkl%redhat.com
800eccde9a Merge with HEAD 2002/04/26
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@119979 18797224-902f-48f8-a5cc-f745e15eee43
2002-04-26 18:59:37 +00:00
(no author)
5360e5b008 This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@119975 18797224-902f-48f8-a5cc-f745e15eee43
2002-04-26 18:12:55 +00:00
dkl%redhat.com
da759055dd Sync to HEAD 2002/03/21
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@117156 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-22 05:16:48 +00:00
(no author)
1f960bb1bd This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@116669 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-15 23:23:14 +00:00
dkl%redhat.com
e0f4b89db1 Update to HEAD 2002/02/26
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@115395 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-27 01:11:14 +00:00
(no author)
025b6e8e46 This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@115298 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-24 09:28:23 +00:00
dkl%redhat.com
704f46aa53 Update to HEAD 2002/02/04
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@113607 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-04 15:56:15 +00:00
(no author)
f26338df7e This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@113575 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-03 09:28:50 +00:00
dkl%redhat.com
58548c3f0d Update to HEAD 2002/01/30
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@113247 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-30 23:00:13 +00:00
(no author)
9a6b4393ad This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@113166 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-29 23:26:38 +00:00
dkl%redhat.com
4316819604 Fix runtests.sh error on processmail
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@112507 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-21 23:27:24 +00:00
dkl%redhat.com
9d93dfabb8 Fix botched earlier sync with HEAD
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@112499 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-21 20:42:30 +00:00
dkl%redhat.com
d2ddb07675 Update to HEAD 01/18/2002
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@112473 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-18 23:06:43 +00:00
dkl%redhat.com
66d426dc97 Lost the pgsetup.pl file somewhere along the line. Adding back properly.
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@111575 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-08 16:13:05 +00:00
dkl%redhat.com
b7e91cb3b6 Changes to CanSeeBug to allow multiple checks in one call for buglist.cgi
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@111509 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-07 23:20:15 +00:00
dkl%redhat.com
5ac0899827 Update to HEAD 2002-01-07
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@111508 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-07 23:14:41 +00:00
dkl%redhat.com
4f49e57a3b Merge 3 with HEAD: 2001/12/26
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@111103 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-27 07:26:12 +00:00
dkl%redhat.com
38c27be28f Merge 2 with HEAD: 2001/12/26
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@111102 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-27 06:02:04 +00:00
dkl%redhat.com
d60d3d6121 Merge fix. This is frustrating.
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@111101 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-27 05:29:04 +00:00
dkl%redhat.com
db0b87fb6c Merge with HEAD on 2001/12/26
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@111100 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-27 05:09:43 +00:00
(no author)
6e2791a4b7 This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@110404 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-12 22:41:21 +00:00
dkl%redhat.com
14542c62c7 Update to HEAD 2001-12-03
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@109510 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-03 04:06:19 +00:00
dkl%redhat.com
38ebcba576 Fixed error in AddFDef
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@108598 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-20 18:40:38 +00:00
dkl%redhat.com
a5502157a9 Update to HEAD - November 18, 2001
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@108470 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-19 05:57:30 +00:00
(no author)
ba69b37618 This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@108456 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-18 22:20:21 +00:00
dkl%redhat.com
22b863a5e9 Synced up with CVS HEAD and created Bugzilla_PgSQL_branch_sync tag
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@107700 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-08 23:03:10 +00:00
dkl%redhat.com
3e54979994 Fixed conflict in Bug.pm, removal of tabs from lots of files.
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@107385 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-06 01:21:11 +00:00
dkl%redhat.com
d73ca44c76 Add new cpan module dependencies
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@107356 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-05 21:43:11 +00:00
dkl%redhat.com
a4fc52b12e Updates and bug fixes
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@107354 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-05 21:10:15 +00:00
dkl%redhat.com
353baca797 New SQL utility functions. Changes in buglist.cgi to improve queries.
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@106967 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-01 15:35:03 +00:00
dkl%redhat.com
4618ab6c36 Initial checkin of pgsetup.pl. Utility for setting up Bugzilla database in PostgreSQL.
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@106569 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-29 20:15:50 +00:00
justdave%syndicomm.com
faaed9c15f initial commit of PgSQL megapatch v0.2
git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@106532 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-29 07:49:05 +00:00
(no author)
675f64d0ae This commit was manufactured by cvs2svn to create branch
'Bugzilla_PgSQL_branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_PgSQL_branch@106501 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-28 03:41:01 +00:00
571 changed files with 106012 additions and 144867 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,430 +0,0 @@
#
# The contents of this file are subject to the Mozilla 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/MPL/
#
# 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 this file as it was released upon August 6, 1998.
#
# The Initial Developer of the Original Code is Christopher
# Seawood. Portions created by Christopher Seawood are
# Copyright (C) 1998 Christopher Seawood. All
# Rights Reserved.
#
# Contributor(s):
# A netscape style .mk file for autoconf builds
INCLUDED_AUTOCONF_MK = 1
USE_AUTOCONF = 1
MOZILLA_CLIENT = 1
BUILD_MODULES = @BUILD_MODULES@
MOZILLA_VERSION = @MOZILLA_VERSION@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@/mozilla-$(MOZILLA_VERSION)
libdir = @libdir@
datadir = @datadir@
mandir = @mandir@
idldir = @datadir@/idl/mozilla-$(MOZILLA_VERSION)
mozappdir = $(libdir)/mozilla-$(MOZILLA_VERSION)
mredir = $(libdir)/mre/mre-$(MOZILLA_VERSION)
mrelibdir = $(mredir)/lib
DIST = $(DEPTH)/dist
MOZ_CHROME_FILE_FORMAT = @MOZ_CHROME_FILE_FORMAT@
MOZ_WIDGET_TOOLKIT = @MOZ_WIDGET_TOOLKIT@
MOZ_GFX_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)
MOZ_JS_LIBS = @MOZ_JS_LIBS@
MOZ_GFX_TOOLKIT_LDFLAGS = @MOZ_GFX_TOOLKIT_LDFLAGS@
MOZ_WIDGET_TOOLKIT_LDFLAGS = @MOZ_WIDGET_TOOLKIT_LDFLAGS@
MOZ_DEBUG = @MOZ_DEBUG@
MOZ_DEBUG_MODULES = @MOZ_DEBUG_MODULES@
MOZ_PROFILE_MODULES = @MOZ_PROFILE_MODULES@
MOZ_DEBUG_ENABLE_DEFS = @MOZ_DEBUG_ENABLE_DEFS@
MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@
MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@
MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@
MOZ_DBGRINFO_MODULES = @MOZ_DBGRINFO_MODULES@
MOZ_EXTENSIONS = @MOZ_EXTENSIONS@
MOZ_IMG_DECODERS= @MOZ_IMG_DECODERS@
MOZ_JSDEBUGGER = @MOZ_JSDEBUGGER@
MOZ_PERF_METRICS = @MOZ_PERF_METRICS@
MOZ_LEAKY = @MOZ_LEAKY@
MOZ_JPROF = @MOZ_JPROF@
MOZ_XPCTOOLS = @MOZ_XPCTOOLS@
ENABLE_EAZEL_PROFILER=@ENABLE_EAZEL_PROFILER@
EAZEL_PROFILER_CFLAGS=@EAZEL_PROFILER_CFLAGS@
EAZEL_PROFILER_LIBS=@EAZEL_PROFILER_LIBS@
GC_LEAK_DETECTOR = @GC_LEAK_DETECTOR@
NS_TRACE_MALLOC = @NS_TRACE_MALLOC@
USE_ELF_DYNSTR_GC = @USE_ELF_DYNSTR_GC@
USE_PREBINDING = @USE_PREBINDING@
INCREMENTAL_LINKER = @INCREMENTAL_LINKER@
MACOS_DEPLOYMENT_TARGET = @MACOS_DEPLOYMENT_TARGET@
MOZ_MAIL_NEWS = @MOZ_MAIL_NEWS@
MOZ_CALENDAR = @MOZ_CALENDAR@
MOZ_PLAINTEXT_EDITOR_ONLY = @MOZ_PLAINTEXT_EDITOR_ONLY@
MOZ_COMPOSER = @MOZ_COMPOSER@
BUILD_SHARED_LIBS = @BUILD_SHARED_LIBS@
BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@
MOZ_STATIC_COMPONENT_LOADER = @MOZ_STATIC_COMPONENT_LOADER@
MOZ_STATIC_COMPONENTS = @MOZ_STATIC_COMPONENTS@
MOZ_META_COMPONENTS = @MOZ_META_COMPONENTS@
MOZ_STATIC_COMPONENT_LIBS = @MOZ_STATIC_COMPONENT_LIBS@
ENABLE_TESTS = @ENABLE_TESTS@
IBMBIDI = @IBMBIDI@
SUNCTL = @SUNCTL@
ACCESSIBILITY = @ACCESSIBILITY@
MOZ_VIEW_SOURCE = @MOZ_VIEW_SOURCE@
MOZ_XPINSTALL = @MOZ_XPINSTALL@
MOZ_JSLOADER = @MOZ_JSLOADER@
MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@
MOZ_SINGLE_PROFILE = @MOZ_SINGLE_PROFILE@
MOZ_LDAP_XPCOM = @MOZ_LDAP_XPCOM@
MOZ_LDAP_XPCOM_EXPERIMENTAL = @MOZ_LDAP_XPCOM_EXPERIMENTAL@
XPCOM_USE_LEA = @XPCOM_USE_LEA@
JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@
MOZ_ENABLE_POSTSCRIPT = @MOZ_ENABLE_POSTSCRIPT@
MOZ_INSTALLER = @MOZ_INSTALLER@
MOZ_NO_ACTIVEX_SUPPORT = @MOZ_NO_ACTIVEX_SUPPORT@
MOZ_ACTIVEX_SCRIPTING_SUPPORT = @MOZ_ACTIVEX_SCRIPTING_SUPPORT@
XPC_IDISPATCH_SUPPORT = @MOZ_ACTIVEX_SCRIPTING_SUPPORT@
MOZ_XPFE_COMPONENTS = @MOZ_XPFE_COMPONENTS@
MOZ_IPCD = @MOZ_IPCD@
MOZ_PROFILESHARING = @MOZ_PROFILESHARING@
MOZ_PROFILELOCKING = @MOZ_PROFILELOCKING@
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS = @MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS@
MOZ_COMPONENT_NSPR_LIBS=@MOZ_COMPONENT_NSPR_LIBS@
MOZ_COMPONENT_XPCOM_LIBS=@MOZ_COMPONENT_XPCOM_LIBS@
XPCOM_LIBS=@XPCOM_LIBS@
MOZ_REORDER=@MOZ_REORDER@
MOZ_TIMELINE=@MOZ_TIMELINE@
ENABLE_STRIP = @ENABLE_STRIP@
ClientWallet=1
CookieManagement=1
SingleSignon=1
MOZ_OJI = @MOZ_OJI@
MOZ_POST_DSO_LIB_COMMAND = @MOZ_POST_DSO_LIB_COMMAND@
MOZ_POST_PROGRAM_COMMAND = @MOZ_POST_PROGRAM_COMMAND@
MOZ_BUILD_ROOT = @MOZ_BUILD_ROOT@
MOZ_XUL = @MOZ_XUL@
NECKO_PROTOCOLS = @NECKO_PROTOCOLS@
NECKO_DISK_CACHE = @NECKO_DISK_CACHE@
NECKO_SMALL_BUFFERS = @NECKO_SMALL_BUFFERS@
MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@
MOZ_NATIVE_JPEG = @SYSTEM_JPEG@
MOZ_NATIVE_PNG = @SYSTEM_PNG@
MOZ_INTERNAL_LIBART_LGPL = @MOZ_INTERNAL_LIBART_LGPL@
MOZ_UPDATE_XTERM = @MOZ_UPDATE_XTERM@
MOZ_MATHML = @MOZ_MATHML@
MOZ_SVG = @MOZ_SVG@
MOZ_SVG_RENDERER_GDIPLUS = @MOZ_SVG_RENDERER_GDIPLUS@
MOZ_SVG_RENDERER_LIBART = @MOZ_SVG_RENDERER_LIBART@
MOZ_LIBART_CFLAGS = @MOZ_LIBART_CFLAGS@
TX_EXE = @TX_EXE@
# Mac's don't like / in a #include, so we include the libart
# headers locally if we're using the external library
ifdef MOZ_LIBART_CFLAGS
ifndef MOZ_INTERNAL_LIBART_LGPL
MOZ_LIBART_CFLAGS := $(MOZ_LIBART_CFLAGS)/libart_lgpl
endif
endif
MOZ_LIBART_LIBS = @MOZ_LIBART_LIBS@
MOZ_INSURE = @MOZ_INSURE@
MOZ_INSURIFYING = @MOZ_INSURIFYING@
MOZ_INSURE_DIRS = @MOZ_INSURE_DIRS@
MOZ_INSURE_EXCLUDE_DIRS = @MOZ_INSURE_EXCLUDE_DIRS@
MOZ_NATIVE_NSPR = @MOZ_NATIVE_NSPR@
CROSS_COMPILE = @CROSS_COMPILE@
OS_CPPFLAGS = @CPPFLAGS@
OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@
OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@
OS_LDFLAGS = @LDFLAGS@
OS_COMPILE_CFLAGS = $(OS_CPPFLAGS) @COMPILE_CFLAGS@
OS_COMPILE_CXXFLAGS = $(OS_CPPFLAGS) @COMPILE_CXXFLAGS@
OS_INCLUDES = $(NSPR_CFLAGS) $(JPEG_CFLAGS) $(PNG_CFLAGS) $(ZLIB_CFLAGS)
OS_LIBS = @LIBS@
ACDEFINES = @MOZ_DEFINES@
MOZ_OPTIMIZE = @MOZ_OPTIMIZE@
MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@
MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@
XCFLAGS = @XCFLAGS@
XLDFLAGS = @XLDFLAGS@
XLIBS = @XLIBS@
CYGWIN_WRAPPER = @CYGWIN_WRAPPER@
CYGDRIVE_MOUNT = @CYGDRIVE_MOUNT@
AR = @AR@
AR_FLAGS = @AR_FLAGS@
AR_EXTRACT = @AR_EXTRACT@
AR_LIST = @AR_LIST@
AR_DELETE = @AR_DELETE@
AS = @AS@
ASFLAGS = @ASFLAGS@
AS_DASH_C_FLAG = @AS_DASH_C_FLAG@
LD = @LD@
RC = @RC@
RCFLAGS = @RCFLAGS@
WINDRES = @WINDRES@
USE_SHORT_LIBNAME = @USE_SHORT_LIBNAME@
IMPLIB = @IMPLIB@
FILTER = @FILTER@
BIN_FLAGS = @BIN_FLAGS@
MIDL = @MIDL@
MIDL_FLAGS = @MIDL_FLAGS@
DLL_PREFIX = @DLL_PREFIX@
LIB_PREFIX = @LIB_PREFIX@
OBJ_SUFFIX = @OBJ_SUFFIX@
LIB_SUFFIX = @LIB_SUFFIX@
DLL_SUFFIX = @DLL_SUFFIX@
BIN_SUFFIX = @BIN_SUFFIX@
ASM_SUFFIX = @ASM_SUFFIX@
IMPORT_LIB_SUFFIX = @IMPORT_LIB_SUFFIX@
USE_N32 = @USE_N32@
HAVE_64BIT_OS = @HAVE_64BIT_OS@
# Temp hack. It is not my intention to leave this crap in here for ever.
# Im talking to fur right now to solve the problem without introducing
# NS_USE_NATIVE to the build system -ramiro.
NS_USE_NATIVE = @NS_USE_NATIVE@
CC = @CC@
CXX = @CXX@
GNU_AS = @GNU_AS@
GNU_LD = @GNU_LD@
GNU_CC = @GNU_CC@
GNU_CXX = @GNU_CXX@
HAVE_GCC3_ABI = @HAVE_GCC3_ABI@
HOST_CC = @HOST_CC@
HOST_CXX = @HOST_CXX@
HOST_CFLAGS = @HOST_CFLAGS@
HOST_CXXFLAGS = @HOST_CXXFLAGS@
HOST_OPTIMIZE_FLAGS = @HOST_OPTIMIZE_FLAGS@
HOST_NSPR_MDCPUCFG = @HOST_NSPR_MDCPUCFG@
HOST_AR = @HOST_AR@
HOST_LD = @HOST_LD@
HOST_RANLIB = @HOST_RANLIB@
HOST_LIBIDL_CONFIG = @HOST_LIBIDL_CONFIG@
HOST_LIBIDL_CFLAGS = @HOST_LIBIDL_CFLAGS@
HOST_LIBIDL_LIBS = @HOST_LIBIDL_LIBS@
TARGET_NSPR_MDCPUCFG = @TARGET_NSPR_MDCPUCFG@
TARGET_CPU = @TARGET_CPU@
TARGET_VENDOR = @TARGET_VENDOR@
TARGET_OS = @TARGET_OS@
TARGET_MD_ARCH = @TARGET_MD_ARCH@
AUTOCONF = @AUTOCONF@
PERL = @PERL@
RANLIB = @RANLIB@
WHOAMI = @WHOAMI@
UNZIP = @UNZIP@
ZIP = @ZIP@
XARGS = @XARGS@
STRIP = @STRIP@
DOXYGEN = @DOXYGEN@
MAKE = @MAKE@
PBBUILD_BIN = @PBBUILD@
ifdef MOZ_NATIVE_JPEG
JPEG_CFLAGS = @JPEG_CFLAGS@
JPEG_LIBS = @JPEG_LIBS@
JPEG_REQUIRES =
else
JPEG_CFLAGS = @MOZ_JPEG_CFLAGS@
JPEG_LIBS = @MOZ_JPEG_LIBS@
JPEG_REQUIRES = jpeg
endif
ifdef MOZ_NATIVE_ZLIB
ZLIB_CFLAGS = @ZLIB_CFLAGS@
ZLIB_LIBS = @ZLIB_LIBS@
ZLIB_REQUIRES =
else
ZLIB_CFLAGS = @MOZ_ZLIB_CFLAGS@
ZLIB_LIBS = @MOZ_ZLIB_LIBS@
ZLIB_REQUIRES = zlib
endif
ifdef MOZ_NATIVE_PNG
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES =
else
PNG_CFLAGS = @MOZ_PNG_CFLAGS@
PNG_LIBS = @MOZ_PNG_LIBS@
PNG_REQUIRES = png
endif
NSPR_CFLAGS = @NSPR_CFLAGS@
NSPR_LIBS = @NSPR_LIBS@
LDAP_CFLAGS = @LDAP_CFLAGS@
LDAP_LIBS = @LDAP_LIBS@
XPCOM_GLUE_LIBS = @XPCOM_GLUE_LIBS@
MOZ_XPCOM_OBSOLETE_LIBS = @MOZ_XPCOM_OBSOLETE_LIBS@
USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
# UNIX98 iconv support
LIBICONV = @LIBICONV@
# MKSHLIB_FORCE_ALL is used to force the linker to include all object
# files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker
# to normal behavior. Makefile's that create shared libraries out of
# archives use these flags to force in all of the .o files in the
# archives into the shared library.
WRAP_MALLOC_LIB = @WRAP_MALLOC_LIB@
WRAP_MALLOC_CFLAGS = @WRAP_MALLOC_CFLAGS@
DSO_CFLAGS = @DSO_CFLAGS@
DSO_PIC_CFLAGS = @DSO_PIC_CFLAGS@
MKSHLIB = @MKSHLIB@
MKCSHLIB = @MKCSHLIB@
MKSHLIB_FORCE_ALL = @MKSHLIB_FORCE_ALL@
MKSHLIB_UNFORCE_ALL = @MKSHLIB_UNFORCE_ALL@
DSO_LDOPTS = @DSO_LDOPTS@
DLL_SUFFIX = @DLL_SUFFIX@
NO_LD_ARCHIVE_FLAGS = @NO_LD_ARCHIVE_FLAGS@
GTK_CONFIG = @GTK_CONFIG@
TK_CFLAGS = @TK_CFLAGS@
TK_LIBS = @TK_LIBS@
MOZ_TOOLKIT_REGISTRY_CFLAGS = \
-DWIDGET_DLL=@WIDGET_DLL@ \
-DGFXWIN_DLL=@GFXWIN_DLL@ \
$(TK_CFLAGS)
MOZ_ENABLE_GTK = @MOZ_ENABLE_GTK@
MOZ_ENABLE_GTK2 = @MOZ_ENABLE_GTK2@
MOZ_ENABLE_XLIB = @MOZ_ENABLE_XLIB@
MOZ_ENABLE_PHOTON = @MOZ_ENABLE_PHOTON@
MOZ_ENABLE_COCOA = @MOZ_ENABLE_COCOA@
MOZ_ENABLE_XREMOTE = @MOZ_ENABLE_XREMOTE@
MOZ_GTK_CFLAGS = @MOZ_GTK_CFLAGS@
MOZ_GTK_LDFLAGS = @MOZ_GTK_LDFLAGS@
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@
MOZ_XLIB_CFLAGS = @MOZ_XLIB_CFLAGS@
MOZ_XLIB_LDFLAGS = @MOZ_XLIB_LDFLAGS@
MOZ_XPRINT_CFLAGS = @MOZ_XPRINT_CFLAGS@
MOZ_XPRINT_LDFLAGS = @MOZ_XPRINT_LDFLAGS@
MOZ_ENABLE_XPRINT = @MOZ_ENABLE_XPRINT@
MOZ_ENABLE_FREETYPE2 = @MOZ_ENABLE_FREETYPE2@
FT2_CFLAGS = @FT2_CFLAGS@
FT2_LIBS = @FT2_LIBS@
MOZ_ENABLE_XFT = @MOZ_ENABLE_XFT@
MOZ_XFT_CFLAGS = @MOZ_XFT_CFLAGS@
MOZ_XFT_LIBS = @MOZ_XFT_LIBS@
MOZ_ENABLE_COREXFONTS = @MOZ_ENABLE_COREXFONTS@
MOZ_EXTRA_X11CONVERTERS = @MOZ_EXTRA_X11CONVERTERS@
MOZ_ENABLE_XINERAMA = @MOZ_ENABLE_XINERAMA@
MOZ_XINERAMA_LIBS = @MOZ_XINERAMA_LIBS@
MOZ_XIE_LIBS = @MOZ_XIE_LIBS@
XT_LIBS = @XT_LIBS@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GLIB_GMODULE_LIBS = @GLIB_GMODULE_LIBS@
LIBIDL_CFLAGS = @LIBIDL_CFLAGS@
LIBIDL_LIBS = @LIBIDL_LIBS@
MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@
# Used for LD_LIBRARY_PATH
LIBS_PATH = @LIBS_PATH@
MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@
COMPILER_DEPEND = @COMPILER_DEPEND@
MDDEPDIR := @MDDEPDIR@
MOZ_DEMANGLE_SYMBOLS = @MOZ_DEMANGLE_SYMBOLS@
# XXX - these need to be cleaned up and have real checks added -cls
CM_BLDTYPE=dbg
AWT_11=1
MOZ_BITS=32
OS_TARGET=@OS_TARGET@
OS_ARCH=@OS_ARCH@
OS_RELEASE=@OS_RELEASE@
OS_TEST=@OS_TEST@
# For OS/2 build
MOZ_OS2_TOOLS = @MOZ_OS2_TOOLS@
MOZ_OS2_EMX_OBJECTFORMAT = @MOZ_OS2_EMX_OBJECTFORMAT@
HAVE_XIE=@HAVE_XIE@
MOZ_MOVEMAIL=@MOZ_MOVEMAIL@
MOZ_PSM=@MOZ_PSM@
# for Qt build
MOC=@MOC@
# Win32 options
MOZ_PROFILE = @MOZ_PROFILE@
MOZ_COVERAGE = @MOZ_COVERAGE@
MOZ_BROWSE_INFO = @MOZ_BROWSE_INFO@
MOZ_TOOLS_DIR = @MOZ_TOOLS_DIR@
# Codesighs tools option, enables win32 mapfiles.
MOZ_MAPINFO = @MOZ_MAPINFO@
MOZ_PHOENIX = @MOZ_PHOENIX@
MOZ_XUL_APP = @MOZ_XUL_APP@
MOZ_THUNDERBIRD = @MOZ_THUNDERBIRD@
MOZ_STANDALONE_COMPOSER= @MOZ_STANDALONE_COMPOSER@
MOZ_STATIC_MAIL_BUILD = @MOZ_STATIC_MAIL_BUILD@
MINIMO = @MINIMO@
MOZ_COMPONENTLIB = @MOZ_COMPONENTLIB@
MACOS_SDK_DIR = @MACOS_SDK_DIR@

16390
mozilla/configure vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,318 +0,0 @@
/* -*- 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 } }
#define NS_CONTENTITERATOR_CID \
{/* {a6cf90e3-15b3-11d2-932e-00805f8add32}*/ \
0xa6cf90e3, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
#define NS_PRECONTENTITERATOR_CID \
{/* {80D7E247-D4B8-45d7-BB59-6F1DD56F384C} */ \
0x80d7e247, 0xd4b8, 0x45d7, { 0xbb, 0x59, 0x6f, 0x1d, 0xd5, 0x6f, 0x38, 0x4c } }
#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 } }
// {66856477-6596-40eb-bb87-59ca2dabb6f7}
#define NS_DOMEVENTGROUP_CID \
{ 0x66856477, 0x6596, 0x40eb, { 0xbb, 0x87, 0x59, 0xca, 0x2d, 0xab, 0xb6, 0xf7 } }
// {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 } }
// {13111d00-ce81-11d6-8082-ecf3665af67c}
#define NS_HTMLFRAGMENTSINK2_CID \
{ 0x13111d00, 0xce81, 0x11d6, { 0x80, 0x82, 0xec, 0xf3, 0x66, 0x5a, 0xf6, 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 } }
// {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
// {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"
// {f96f5ec9-755b-447e-b1f3-717d1a84bb41}
#define NS_PLUGINDOCUMENT_CID \
{ 0xf96f5ec9, 0x755b, 0x447e, { 0xb1, 0xf3, 0x71, 0x7d, 0x1a, 0x84, 0xbb, 0x41 } }
#endif /* nsContentCID_h__ */

View File

@@ -1,81 +0,0 @@
/* -*- 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):
*
*
* 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 nsIElementFactory_h___
#define nsIElementFactory_h___
#include "nsISupports.h"
class nsIContent;
class nsINodeInfo;
/* a6cf90fb-15b3-11d2-932e-00805f8add32 */
#define NS_IELEMENT_FACTORY_IID \
{ 0xa6cf90fb, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/**
* An API for creating html content objects
*/
class nsIElementFactory : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IELEMENT_FACTORY_IID)
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult) = 0;
};
// ContractIDs for element factory registration
#define NS_ELEMENT_FACTORY_CONTRACTID "@mozilla.org/layout/element-factory;1"
#define NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_ELEMENT_FACTORY_CONTRACTID "?namespace="
#define NS_HTML_NAMESPACE "http://www.w3.org/1999/xhtml"
#define NS_XML_NAMESPACE "http://www.w3.org/XML/1998/namespace"
#define NS_HTML_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_HTML_NAMESPACE
#define NS_XML_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_XML_NAMESPACE
#ifdef MOZ_MATHML
#define NS_MATHML_NAMESPACE "http://www.w3.org/1998/Math/MathML"
#define NS_MATHML_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_MATHML_NAMESPACE
#endif
#ifdef MOZ_SVG
#define NS_SVG_NAMESPACE "http://www.w3.org/2000/svg"
#define NS_SVG_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_SVG_NAMESPACE
#endif
#endif /* nsIElementFactory_h___ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,883 +0,0 @@
/* -*- 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):
* David Hyatt <hyatt@netscape.com>
* 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 "nsStyleConsts.h"
#include "nsString.h"
#include "nsIPresContext.h"
#include "nsIStyleRule.h"
#include "nsISupportsArray.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsStyleSet.h"
#include "nsIPresShell.h"
#include "nsLayoutAtoms.h"
#include "prenv.h"
#include "nsRuleNode.h"
#include "nsUnitConversion.h"
#include "nsStyleContext.h"
#ifdef DEBUG
// #define NOISY_DEBUG
#endif
//----------------------------------------------------------------------
nsStyleContext::nsStyleContext(nsStyleContext* aParent,
nsIAtom* aPseudoTag,
nsRuleNode* aRuleNode,
nsIPresContext* aPresContext)
: mParent((nsStyleContext*)aParent),
mChild(nsnull),
mEmptyChild(nsnull),
mPseudoTag(aPseudoTag),
mRuleNode(aRuleNode),
mBits(0),
mRefCnt(0)
{
mNextSibling = this;
mPrevSibling = this;
if (mParent) {
mParent->AddRef();
mParent->AppendChild(this);
}
ApplyStyleFixups(aPresContext);
NS_ASSERTION(NS_STYLE_INHERIT_MASK &
(1 << PRInt32(nsStyleStructID_Length - 1)) != 0,
"NS_STYLE_INHERIT_MASK must be bigger, and other bits shifted");
}
nsStyleContext::~nsStyleContext()
{
NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children");
nsIPresContext *presContext = mRuleNode->GetPresContext();
presContext->PresShell()->StyleSet()->
NotifyStyleContextDestroyed(presContext, this);
if (mParent) {
mParent->RemoveChild(this);
mParent->Release();
}
// Free up our data structs.
if (mCachedStyleData.mResetData || mCachedStyleData.mInheritedData) {
mCachedStyleData.Destroy(mBits, presContext);
}
}
void nsStyleContext::AppendChild(nsStyleContext* aChild)
{
if (aChild->mRuleNode->IsRoot()) {
// The child matched no rules.
if (!mEmptyChild) {
mEmptyChild = aChild;
}
else {
aChild->mNextSibling = mEmptyChild;
aChild->mPrevSibling = mEmptyChild->mPrevSibling;
mEmptyChild->mPrevSibling->mNextSibling = aChild;
mEmptyChild->mPrevSibling = aChild;
}
}
else {
if (!mChild) {
mChild = aChild;
}
else {
aChild->mNextSibling = mChild;
aChild->mPrevSibling = mChild->mPrevSibling;
mChild->mPrevSibling->mNextSibling = aChild;
mChild->mPrevSibling = aChild;
}
}
}
void nsStyleContext::RemoveChild(nsStyleContext* aChild)
{
NS_PRECONDITION(nsnull != aChild && this == aChild->mParent, "bad argument");
if (aChild->mRuleNode->IsRoot()) { // is empty
if (aChild->mPrevSibling != aChild) { // has siblings
if (mEmptyChild == aChild) {
mEmptyChild = mEmptyChild->mNextSibling;
}
}
else {
NS_ASSERTION(mEmptyChild == aChild, "bad sibling pointers");
mEmptyChild = nsnull;
}
}
else { // isn't empty
if (aChild->mPrevSibling != aChild) { // has siblings
if (mChild == aChild) {
mChild = mChild->mNextSibling;
}
}
else {
NS_ASSERTION(mChild == aChild, "bad sibling pointers");
if (mChild == aChild) {
mChild = nsnull;
}
}
}
aChild->mPrevSibling->mNextSibling = aChild->mNextSibling;
aChild->mNextSibling->mPrevSibling = aChild->mPrevSibling;
aChild->mNextSibling = aChild;
aChild->mPrevSibling = aChild;
}
already_AddRefed<nsStyleContext>
nsStyleContext::FindChildWithRules(const nsIAtom* aPseudoTag,
nsRuleNode* aRuleNode)
{
PRUint32 threshold = 10; // The # of siblings we're willing to examine
// before just giving this whole thing up.
nsStyleContext* aResult = nsnull;
if ((nsnull != mChild) || (nsnull != mEmptyChild)) {
nsStyleContext* child;
if (aRuleNode->IsRoot()) {
if (nsnull != mEmptyChild) {
child = mEmptyChild;
do {
if (aPseudoTag == child->mPseudoTag) {
aResult = child;
break;
}
child = child->mNextSibling;
threshold--;
if (threshold == 0)
break;
} while (child != mEmptyChild);
}
}
else if (nsnull != mChild) {
child = mChild;
do {
if (child->mRuleNode == aRuleNode && child->mPseudoTag == aPseudoTag) {
aResult = child;
break;
}
child = child->mNextSibling;
threshold--;
if (threshold == 0)
break;
} while (child != mChild);
}
}
if (aResult)
aResult->AddRef();
return aResult;
}
PRBool nsStyleContext::Equals(const nsStyleContext* aOther) const
{
PRBool result = PR_TRUE;
const nsStyleContext* other = (nsStyleContext*)aOther;
if (other != this) {
if (mParent != other->mParent) {
result = PR_FALSE;
}
else if (mBits != other->mBits) {
result = PR_FALSE;
}
else if (mPseudoTag != other->mPseudoTag) {
result = PR_FALSE;
}
else if (mRuleNode != other->mRuleNode) {
result = PR_FALSE;
}
}
return result;
}
//=========================================================================================================
const nsStyleStruct* nsStyleContext::GetStyleData(nsStyleStructID aSID)
{
const nsStyleStruct* cachedData = mCachedStyleData.GetStyleData(aSID);
if (cachedData)
return cachedData; // We have computed data stored on this node in the context tree.
return mRuleNode->GetStyleData(aSID, this, PR_TRUE); // Our rule node will take care of it for us.
}
inline const nsStyleStruct* nsStyleContext::PeekStyleData(nsStyleStructID aSID)
{
const nsStyleStruct* cachedData = mCachedStyleData.GetStyleData(aSID);
if (cachedData)
return cachedData; // We have computed data stored on this node in the context tree.
return mRuleNode->GetStyleData(aSID, this, PR_FALSE); // Our rule node will take care of it for us.
}
void
nsStyleContext::GetBorderPaddingFor(nsStyleBorderPadding& aBorderPadding)
{
nsMargin border, padding;
if (GetStyleBorder()->GetBorder(border)) {
if (GetStylePadding()->GetPadding(padding)) {
border += padding;
aBorderPadding.SetBorderPadding(border);
}
}
}
// This is an evil evil function, since it forces you to alloc your own separate copy of
// style data! Do not use this function unless you absolutely have to! You should avoid
// this at all costs! -dwh
nsStyleStruct*
nsStyleContext::GetUniqueStyleData(nsIPresContext* aPresContext, const nsStyleStructID& aSID)
{
nsStyleStruct* result = nsnull;
switch (aSID) {
case eStyleStruct_Display: {
const nsStyleDisplay* dis = GetStyleDisplay();
nsStyleDisplay* newDis = new (aPresContext) nsStyleDisplay(*dis);
SetStyle(aSID, newDis);
result = newDis;
mBits &= ~NS_STYLE_INHERIT_BIT(Display);
break;
}
case eStyleStruct_Background: {
const nsStyleBackground* bg = GetStyleBackground();
nsStyleBackground* newBG = new (aPresContext) nsStyleBackground(*bg);
SetStyle(aSID, newBG);
result = newBG;
mBits &= ~NS_STYLE_INHERIT_BIT(Background);
break;
}
case eStyleStruct_Text: {
const nsStyleText* text = GetStyleText();
nsStyleText* newText = new (aPresContext) nsStyleText(*text);
SetStyle(aSID, newText);
result = newText;
mBits &= ~NS_STYLE_INHERIT_BIT(Text);
break;
}
case eStyleStruct_TextReset: {
const nsStyleTextReset* reset = GetStyleTextReset();
nsStyleTextReset* newReset = new (aPresContext) nsStyleTextReset(*reset);
SetStyle(aSID, newReset);
result = newReset;
mBits &= ~NS_STYLE_INHERIT_BIT(TextReset);
break;
}
default:
NS_ERROR("Struct type not supported. Please find another way to do this if you can!\n");
}
return result;
}
void
nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct)
{
// This method should only be called from nsRuleNode! It is not a public
// method!
NS_ASSERTION(aSID >= 0 && aSID < nsStyleStructID_Length, "out of bounds");
// NOTE: nsCachedStyleData::GetStyleData works roughly the same way.
// See the comments there (in nsRuleNode.h) for more details about
// what this is doing and why.
const nsCachedStyleData::StyleStructInfo& info =
nsCachedStyleData::gInfo[aSID];
char* resetOrInheritSlot = NS_REINTERPRET_CAST(char*, &mCachedStyleData) +
info.mCachedStyleDataOffset;
char* resetOrInherit = NS_REINTERPRET_CAST(char*,
*NS_REINTERPRET_CAST(void**, resetOrInheritSlot));
if (!resetOrInherit) {
nsIPresContext *presContext = mRuleNode->GetPresContext();
if (mCachedStyleData.IsReset(aSID)) {
mCachedStyleData.mResetData = new (presContext) nsResetStyleData;
resetOrInherit = NS_REINTERPRET_CAST(char*, mCachedStyleData.mResetData);
} else {
mCachedStyleData.mInheritedData =
new (presContext) nsInheritedStyleData;
resetOrInherit =
NS_REINTERPRET_CAST(char*, mCachedStyleData.mInheritedData);
}
}
char* dataSlot = resetOrInherit + info.mInheritResetOffset;
*NS_REINTERPRET_CAST(nsStyleStruct**, dataSlot) = aStruct;
}
void
nsStyleContext::ApplyStyleFixups(nsIPresContext* aPresContext)
{
// See if we have any text decorations.
// First see if our parent has text decorations. If our parent does, then we inherit the bit.
if (mParent && mParent->HasTextDecorations())
mBits |= NS_STYLE_HAS_TEXT_DECORATIONS;
else {
// We might have defined a decoration.
const nsStyleTextReset* text = GetStyleTextReset();
if (text->mTextDecoration != NS_STYLE_TEXT_DECORATION_NONE &&
text->mTextDecoration != NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL)
mBits |= NS_STYLE_HAS_TEXT_DECORATIONS;
}
// Correct tables.
const nsStyleDisplay* disp = GetStyleDisplay();
if (disp->mDisplay == NS_STYLE_DISPLAY_TABLE) {
// -moz-center and -moz-right are used for HTML's alignment
// This is covering the <div align="right"><table>...</table></div> case.
// In this case, we don't want to inherit the text alignment into the table.
const nsStyleText* text = GetStyleText();
if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_CENTER ||
text->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_RIGHT)
{
nsStyleText* uniqueText = (nsStyleText*)GetUniqueStyleData(aPresContext, eStyleStruct_Text);
uniqueText->mTextAlign = NS_STYLE_TEXT_ALIGN_DEFAULT;
}
}
}
void
nsStyleContext::ClearStyleData(nsIPresContext* aPresContext)
{
// First we need to clear out all of our style data.
if (mCachedStyleData.mResetData || mCachedStyleData.mInheritedData)
mCachedStyleData.Destroy(mBits, aPresContext);
mBits = 0; // Clear all bits.
ApplyStyleFixups(aPresContext);
if (mChild) {
nsStyleContext* child = mChild;
do {
child->ClearStyleData(aPresContext);
child = child->mNextSibling;
} while (mChild != child);
}
if (mEmptyChild) {
nsStyleContext* child = mEmptyChild;
do {
child->ClearStyleData(aPresContext);
child = child->mNextSibling;
} while (mEmptyChild != child);
}
}
nsChangeHint
nsStyleContext::CalcStyleDifference(nsStyleContext* aOther)
{
nsChangeHint hint = NS_STYLE_HINT_NONE;
NS_ENSURE_TRUE(aOther, hint);
// We must always ensure that we populate the structs on the new style
// context that are filled in on the old context, so that if we get
// two style changes in succession, the second of which causes a real
// style change, the PeekStyleData doesn't fail.
// If our rule nodes are the same, then we are looking at the same
// style data. We know this because CalcStyleDifference is always
// called on two style contexts that point to the same element, so we
// know that our position in the style context tree is the same and
// our position in the rule node tree is also the same.
PRBool compare = mRuleNode != aOther->mRuleNode;
nsChangeHint maxHint = NS_STYLE_HINT_FRAMECHANGE;
#define DO_STRUCT_DIFFERENCE(struct_) \
PR_BEGIN_MACRO \
const nsStyle##struct_* this##struct_ = \
NS_STATIC_CAST(const nsStyle##struct_*, \
PeekStyleData(NS_GET_STYLESTRUCTID(nsStyle##struct_))); \
if (this##struct_) { \
const nsStyle##struct_* other##struct_ = \
NS_STATIC_CAST(const nsStyle##struct_*, \
aOther->GetStyleData(NS_GET_STYLESTRUCTID(nsStyle##struct_))); \
if (compare && \
!NS_IsHintSubset(maxHint, hint) && \
this##struct_ != other##struct_) { \
NS_UpdateHint(hint, this##struct_->CalcDifference(*other##struct_)); \
} \
} \
PR_END_MACRO
// We begin by examining those style structs that are capable of
// causing the maximal difference, a FRAMECHANGE.
// FRAMECHANGE Structs: Display, XUL, Content, UserInterface,
// Visibility, Quotes
DO_STRUCT_DIFFERENCE(Display);
DO_STRUCT_DIFFERENCE(XUL);
DO_STRUCT_DIFFERENCE(Content);
DO_STRUCT_DIFFERENCE(UserInterface);
DO_STRUCT_DIFFERENCE(Visibility);
#ifdef MOZ_SVG
DO_STRUCT_DIFFERENCE(SVG);
#endif
// If the quotes implementation is ever going to change we might not need
// a framechange here and a reflow should be sufficient. See bug 35768.
DO_STRUCT_DIFFERENCE(Quotes);
// At this point, we know that the worst kind of damage we could do is
// a reflow.
maxHint = NS_STYLE_HINT_REFLOW;
// The following structs cause (as their maximal difference) a reflow
// to occur. REFLOW Structs: Font, Margin, Padding, Border, List,
// Position, Text, TextReset, Table, TableBorder
DO_STRUCT_DIFFERENCE(Font);
DO_STRUCT_DIFFERENCE(Margin);
DO_STRUCT_DIFFERENCE(Padding);
DO_STRUCT_DIFFERENCE(Border);
DO_STRUCT_DIFFERENCE(List);
DO_STRUCT_DIFFERENCE(Position);
DO_STRUCT_DIFFERENCE(Text);
DO_STRUCT_DIFFERENCE(TextReset);
DO_STRUCT_DIFFERENCE(Table);
DO_STRUCT_DIFFERENCE(TableBorder);
// At this point, we know that the worst kind of damage we could do is
// a re-render (i.e., a VISUAL change).
maxHint = NS_STYLE_HINT_VISUAL;
// The following structs cause (as their maximal difference) a
// re-render to occur. VISUAL Structs: Color, Background, Outline,
// UIReset
DO_STRUCT_DIFFERENCE(Color);
DO_STRUCT_DIFFERENCE(Background);
DO_STRUCT_DIFFERENCE(Outline);
DO_STRUCT_DIFFERENCE(UIReset);
#undef DO_STRUCT_DIFFERENCE
return hint;
}
void
nsStyleContext::Mark()
{
// Mark our rule node.
mRuleNode->Mark();
// Mark our children (i.e., tell them to mark their rule nodes, etc.).
if (mChild) {
nsStyleContext* child = mChild;
do {
child->Mark();
child = child->mNextSibling;
} while (mChild != child);
}
if (mEmptyChild) {
nsStyleContext* child = mEmptyChild;
do {
child->Mark();
child = child->mNextSibling;
} while (mEmptyChild != child);
}
}
#ifdef DEBUG
class URICString : public nsCAutoString {
public:
URICString(nsIURI* aURI) {
if (aURI) {
aURI->GetSpec(*this);
} else {
Assign("[none]");
}
}
URICString& operator=(const URICString& aOther) {
Assign(aOther);
return *this;
}
};
void nsStyleContext::List(FILE* out, PRInt32 aIndent)
{
// Indent
PRInt32 ix;
for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fprintf(out, "%p(%d) parent=%p ",
(void*)this, mRefCnt, (void *)mParent);
if (mPseudoTag) {
nsAutoString buffer;
mPseudoTag->ToString(buffer);
fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
fputs(" ", out);
}
if (mRuleNode) {
fputs("{\n", out);
nsRuleNode* ruleNode = mRuleNode;
while (ruleNode) {
nsIStyleRule *styleRule = ruleNode->GetRule();
if (styleRule) {
styleRule->List(out, aIndent + 1);
}
ruleNode = ruleNode->GetParent();
}
for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fputs("}\n", out);
}
else {
fputs("{}\n", out);
}
if (nsnull != mChild) {
nsStyleContext* child = mChild;
do {
child->List(out, aIndent + 1);
child = child->mNextSibling;
} while (mChild != child);
}
if (nsnull != mEmptyChild) {
nsStyleContext* child = mEmptyChild;
do {
child->List(out, aIndent + 1);
child = child->mNextSibling;
} while (mEmptyChild != child);
}
}
static void IndentBy(FILE* out, PRInt32 aIndent) {
while (--aIndent >= 0) fputs(" ", out);
}
// virtual
void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent)
{
nsAutoString str;
// FONT
IndentBy(out,aIndent);
const nsStyleFont* font = GetStyleFont();
fprintf(out, "<font %s %d %d %d />\n",
NS_ConvertUCS2toUTF8(font->mFont.name).get(),
font->mFont.size,
font->mSize,
font->mFlags);
// COLOR
IndentBy(out,aIndent);
const nsStyleColor* color = GetStyleColor();
fprintf(out, "<color data=\"%ld\"/>\n",
(long)color->mColor);
// BACKGROUND
IndentBy(out,aIndent);
const nsStyleBackground* bg = GetStyleBackground();
fprintf(out, "<background data=\"%d %d %d %ld %ld %ld %s\"/>\n",
(int)bg->mBackgroundAttachment,
(int)bg->mBackgroundFlags,
(int)bg->mBackgroundRepeat,
(long)bg->mBackgroundColor,
(long)bg->mBackgroundXPosition.mCoord, // potentially lossy on some platforms
(long)bg->mBackgroundYPosition.mCoord, // potentially lossy on some platforms
URICString(bg->mBackgroundImage).get());
// SPACING (ie. margin, padding, border, outline)
IndentBy(out,aIndent);
fprintf(out, "<spacing data=\"");
const nsStyleMargin* margin = GetStyleMargin();
margin->mMargin.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
const nsStylePadding* padding = GetStylePadding();
padding->mPadding.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
const nsStyleBorder* border = GetStyleBorder();
border->mBorder.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
border->mBorderRadius.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
const nsStyleOutline* outline = GetStyleOutline();
outline->mOutlineRadius.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
outline->mOutlineWidth.ToString(str);
fprintf(out, "%s", NS_ConvertUCS2toUTF8(str).get());
fprintf(out, "%d", (int)border->mFloatEdge);
fprintf(out, "\" />\n");
// LIST
IndentBy(out,aIndent);
const nsStyleList* list = GetStyleList();
fprintf(out, "<list data=\"%d %d %s\" />\n",
(int)list->mListStyleType,
(int)list->mListStyleType,
URICString(list->mListStyleImage).get());
// POSITION
IndentBy(out,aIndent);
const nsStylePosition* pos = GetStylePosition();
fprintf(out, "<position data=\"");
pos->mOffset.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
pos->mWidth.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
pos->mMinWidth.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
pos->mMaxWidth.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
pos->mHeight.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
pos->mMinHeight.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
pos->mMaxHeight.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
fprintf(out, "%d ", (int)pos->mBoxSizing);
pos->mZIndex.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
fprintf(out, "\" />\n");
// TEXT
IndentBy(out,aIndent);
const nsStyleText* text = GetStyleText();
fprintf(out, "<text data=\"%d %d %d ",
(int)text->mTextAlign,
(int)text->mTextTransform,
(int)text->mWhiteSpace);
text->mLetterSpacing.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
text->mLineHeight.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
text->mTextIndent.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
text->mWordSpacing.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
fprintf(out, "\" />\n");
// TEXT RESET
IndentBy(out,aIndent);
const nsStyleTextReset* textReset = GetStyleTextReset();
fprintf(out, "<textreset data=\"%d ",
(int)textReset->mTextDecoration);
textReset->mVerticalAlign.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
fprintf(out, "\" />\n");
// DISPLAY
IndentBy(out,aIndent);
const nsStyleDisplay* disp = GetStyleDisplay();
fprintf(out, "<display data=\"%d %d %f %d %d %d %d %d %d %ld %ld %ld %ld %s\" />\n",
(int)disp->mPosition,
(int)disp->mDisplay,
(float)disp->mOpacity,
(int)disp->mFloats,
(int)disp->mBreakType,
(int)disp->mBreakBefore,
(int)disp->mBreakAfter,
(int)disp->mOverflow,
(int)disp->mClipFlags,
(long)disp->mClip.x,
(long)disp->mClip.y,
(long)disp->mClip.width,
(long)disp->mClip.height,
URICString(disp->mBinding).get()
);
// VISIBILITY
IndentBy(out,aIndent);
const nsStyleVisibility* vis = GetStyleVisibility();
fprintf(out, "<visibility data=\"%d %d\" />\n",
(int)vis->mDirection,
(int)vis->mVisible
);
// TABLE
IndentBy(out,aIndent);
const nsStyleTable* table = GetStyleTable();
fprintf(out, "<table data=\"%d %d %d ",
(int)table->mLayoutStrategy,
(int)table->mFrame,
(int)table->mRules);
fprintf(out, "%ld %ld ",
(long)table->mCols,
(long)table->mSpan);
fprintf(out, "\" />\n");
// TABLEBORDER
IndentBy(out,aIndent);
const nsStyleTableBorder* tableBorder = GetStyleTableBorder();
fprintf(out, "<tableborder data=\"%d ",
(int)tableBorder->mBorderCollapse);
tableBorder->mBorderSpacingX.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
tableBorder->mBorderSpacingY.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
fprintf(out, "%d %d ",
(int)tableBorder->mCaptionSide,
(int)tableBorder->mEmptyCells);
fprintf(out, "\" />\n");
// CONTENT
IndentBy(out,aIndent);
const nsStyleContent* content = GetStyleContent();
fprintf(out, "<content data=\"%ld %ld %ld ",
(long)content->ContentCount(),
(long)content->CounterIncrementCount(),
(long)content->CounterResetCount());
// XXX: iterate over the content and counters...
content->mMarkerOffset.ToString(str);
fprintf(out, "%s ", NS_ConvertUCS2toUTF8(str).get());
fprintf(out, "\" />\n");
// QUOTES
IndentBy(out,aIndent);
const nsStyleQuotes* quotes = GetStyleQuotes();
fprintf(out, "<quotes data=\"%ld ",
(long)quotes->QuotesCount());
// XXX: iterate over the quotes...
fprintf(out, "\" />\n");
// UI
IndentBy(out,aIndent);
const nsStyleUserInterface* ui = GetStyleUserInterface();
fprintf(out, "<ui data=\"%d %d %d %d\" />\n",
(int)ui->mUserInput,
(int)ui->mUserModify,
(int)ui->mUserFocus,
(int)ui->mCursor);
// UIReset
IndentBy(out,aIndent);
const nsStyleUIReset* uiReset = GetStyleUIReset();
fprintf(out, "<uireset data=\"%d %d %d\" />\n",
(int)uiReset->mUserSelect,
(int)uiReset->mKeyEquivalent,
(int)uiReset->mResizer);
// XUL
IndentBy(out,aIndent);
const nsStyleXUL* xul = GetStyleXUL();
fprintf(out, "<xul data=\"%d %d %d %d %d %d",
(int)xul->mBoxAlign,
(int)xul->mBoxDirection,
(int)xul->mBoxFlex,
(int)xul->mBoxOrient,
(int)xul->mBoxPack,
(int)xul->mBoxOrdinal);
fprintf(out, "\" />\n");
#ifdef MOZ_SVG
// SVG
IndentBy(out,aIndent);
const nsStyleSVG* svg = GetStyleSVG();
fprintf(out, "<svg data=\"%d %ld %f %d %d %d %d %ld %s %f %d %d %f %f %f %d %d\" />\n",
(int)svg->mFill.mType,
(long)svg->mFill.mColor,
svg->mFillOpacity,
(int)svg->mFillRule,
(int)svg->mPointerEvents,
(int)svg->mShapeRendering,
(int)svg->mStroke.mType,
(long)svg->mStroke.mColor,
NS_ConvertUCS2toUTF8(svg->mStrokeDasharray).get(),
svg->mStrokeDashoffset,
(int)svg->mStrokeLinecap,
(int)svg->mStrokeLinejoin,
svg->mStrokeMiterlimit,
svg->mStrokeOpacity,
svg->mStrokeWidth,
(int)svg->mTextAnchor,
(int)svg->mTextRendering);
// SVGReset
IndentBy(out,aIndent);
const nsStyleSVGReset* svgReset = GetStyleSVGReset();
fprintf(out, "<svgreset data=\"%d\" />\n",
(int)svgReset->mDominantBaseline);
#endif
//#insert new style structs here#
}
#endif
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
// (which comes from the presShell) to perform the allocation.
void*
nsStyleContext::operator new(size_t sz, nsIPresContext* aPresContext) CPP_THROW_NEW
{
// Check the recycle list first.
void* result = nsnull;
aPresContext->AllocateFromShell(sz, &result);
return result;
}
// Overridden to prevent the global delete from being called, since the memory
// came out of an nsIArena instead of the global delete operator's heap.
void
nsStyleContext::Destroy()
{
// Get the pres context from our rule node.
nsCOMPtr<nsIPresContext> presContext = mRuleNode->GetPresContext();
// Call our destructor.
this->~nsStyleContext();
// Don't let the memory be freed, since it will be recycled
// instead. Don't call the global operator delete.
presContext->FreeToShell(sizeof(nsStyleContext), this);
}
already_AddRefed<nsStyleContext>
NS_NewStyleContext(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsRuleNode* aRuleNode,
nsIPresContext* aPresContext)
{
nsStyleContext* context = new (aPresContext) nsStyleContext(aParentContext, aPseudoTag,
aRuleNode, aPresContext);
if (context)
context->AddRef();
return context;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,250 +0,0 @@
/* -*- 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):
* Daniel Glazman <glazman@netscape.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 ***** */
#ifndef nsCSSDeclaration_h___
#define nsCSSDeclaration_h___
#include "nsISupports.h"
#include "nsColor.h"
#include <stdio.h>
#include "nsString.h"
#include "nsCoord.h"
#include "nsCSSValue.h"
#include "nsCSSProps.h"
#include "nsVoidArray.h"
#include "nsValueArray.h"
#include "nsCSSDataBlock.h"
#include "nsCSSStruct.h"
class nsCSSDeclaration {
public:
/**
* Construct an |nsCSSDeclaration| that is in an invalid state (null
* |mData|) and cannot be used until its |CompressFrom| method or
* |InitializeEmpty| method is called.
*/
nsCSSDeclaration();
nsCSSDeclaration(const nsCSSDeclaration& aCopy);
/**
* |ValueAppended| must be called to maintain this declaration's
* |mOrder| whenever a property is parsed into an expanded data block
* for this declaration.
*/
nsresult ValueAppended(nsCSSProperty aProperty);
nsresult AppendComment(const nsAString& aComment);
nsresult RemoveProperty(nsCSSProperty aProperty);
nsresult GetValue(nsCSSProperty aProperty, nsAString& aValue) const;
nsresult GetValue(const nsAString& aProperty, nsAString& aValue) const;
PRBool HasImportantData() const { return mImportantData != nsnull; }
PRBool GetValueIsImportant(nsCSSProperty aProperty) const;
PRBool GetValueIsImportant(const nsAString& aProperty) const;
PRUint32 Count() const;
nsresult GetNthProperty(PRUint32 aIndex, nsAString& aReturn) const;
nsresult ToString(nsAString& aString) const;
nsCSSDeclaration* Clone() const;
nsresult MapRuleInfoInto(nsRuleData *aRuleData) const {
return mData->MapRuleInfoInto(aRuleData);
}
nsresult MapImportantRuleInfoInto(nsRuleData *aRuleData) const {
return mImportantData->MapRuleInfoInto(aRuleData);
}
/**
* Initialize this declaration as holding no data. Return false on
* out-of-memory.
*/
PRBool InitializeEmpty();
/**
* Transfer all of the state from |aExpandedData| into this declaration.
* After calling, |aExpandedData| should be in its initial state.
*/
void CompressFrom(nsCSSExpandedDataBlock *aExpandedData) {
NS_ASSERTION(!mData, "oops");
NS_ASSERTION(!mImportantData, "oops");
aExpandedData->Compress(&mData, &mImportantData);
}
/**
* Transfer all of the state from this declaration into
* |aExpandedData| and put this declaration temporarily into an
* invalid state (ended by |CompressFrom| or |InitializeEmpty|) that
* should last only during parsing. During this time only
* |ValueAppended| should be called.
*/
void ExpandTo(nsCSSExpandedDataBlock *aExpandedData) {
aExpandedData->AssertInitialState();
NS_ASSERTION(mData, "oops");
aExpandedData->Expand(&mData, &mImportantData);
NS_ASSERTION(!mData && !mImportantData,
"Expand didn't null things out");
}
/**
* Clear the data, in preparation for its replacement with entirely
* new data by a call to |CompressFrom|.
*/
void ClearData() {
mData->Destroy();
mData = nsnull;
if (mImportantData) {
mImportantData->Destroy();
mImportantData = nsnull;
}
}
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
private:
// Not implemented, and not supported.
nsCSSDeclaration& operator=(const nsCSSDeclaration& aCopy);
PRBool operator==(const nsCSSDeclaration& aCopy) const;
void AppendImportanceToString(PRBool aIsImportant, nsAString& aString) const;
// return whether there was a value in |aValue| (i.e., it had a non-null unit)
PRBool AppendValueToString(nsCSSProperty aProperty, nsAString& aResult) const;
// return whether there was a value in |aValue| (i.e., it had a non-null unit)
PRBool AppendCSSValueToString(nsCSSProperty aProperty, const nsCSSValue& aValue, nsAString& aResult) const;
// May be called only for properties whose type is eCSSType_Value.
nsresult GetValueOrImportantValue(nsCSSProperty aProperty, nsCSSValue& aValue) const;
void PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue) const;
PRBool TryBorderShorthand(nsAString & aString, PRUint32 aPropertiesSet,
PRInt32 aBorderTopWidth,
PRInt32 aBorderTopStyle,
PRInt32 aBorderTopColor,
PRInt32 aBorderBottomWidth,
PRInt32 aBorderBottomStyle,
PRInt32 aBorderBottomColor,
PRInt32 aBorderLeftWidth,
PRInt32 aBorderLeftStyle,
PRInt32 aBorderLeftColor,
PRInt32 aBorderRightWidth,
PRInt32 aBorderRightStyle,
PRInt32 aBorderRightColor) const;
PRBool TryBorderSideShorthand(nsAString & aString,
nsCSSProperty aShorthand,
PRInt32 aBorderWidth,
PRInt32 aBorderStyle,
PRInt32 aBorderColor) const;
PRBool TryFourSidesShorthand(nsAString & aString,
nsCSSProperty aShorthand,
PRInt32 & aTop,
PRInt32 & aBottom,
PRInt32 & aLeft,
PRInt32 & aRight,
PRBool aClearIndexes) const;
void TryBackgroundShorthand(nsAString & aString,
PRInt32 & aBgColor, PRInt32 & aBgImage,
PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
PRInt32 & aBgPositionX,
PRInt32 & aBgPositionY) const;
void UseBackgroundPosition(nsAString & aString,
PRInt32 & aBgPositionX,
PRInt32 & aBgPositionY) const;
PRBool AllPropertiesSameImportance(PRInt32 aFirst, PRInt32 aSecond,
PRInt32 aThird, PRInt32 aFourth,
PRInt32 aFifth, PRInt32 aSixth,
PRBool & aImportance) const;
PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
PRInt32 aThird, PRInt32 aFourth) const;
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
nsAString& aResult) const
{
AppendPropertyAndValueToString(aProperty, aProperty, aResult);
}
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
nsCSSProperty aPropertyName,
nsAString& aResult) const;
private:
//
// Specialized ref counting.
// We do not want everyone to ref count us, only the rules which hold
// onto us (our well defined lifetime is when the last rule releases
// us).
// It's worth a comment here that the main nsCSSDeclaration is refcounted,
// but it's |mImportant| is not refcounted, but just owned by the
// non-important declaration.
//
friend class CSSStyleRuleImpl;
void AddRef(void) {
++mRefCnt;
}
void Release(void) {
NS_ASSERTION(0 < mRefCnt, "bad Release");
if (0 == --mRefCnt) {
delete this;
}
}
public:
void RuleAbort(void) {
NS_ASSERTION(0 == mRefCnt, "bad RuleAbort");
delete this;
}
private:
// Block everyone, except us or a derivative, from deleting us.
~nsCSSDeclaration(void);
nsCSSProperty OrderValueAt(nsValueArrayIndex aValue) const {
return nsCSSProperty(mOrder.ValueAt(aValue));
}
private:
nsValueArray mOrder;
nsAutoRefCnt mRefCnt;
nsCSSCompressedDataBlock *mData; // never null, except while expanded
nsCSSCompressedDataBlock *mImportantData; // may be null
};
#endif /* nsCSSDeclaration_h___ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,531 +0,0 @@
/* -*- 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):
* Daniel Glazman <glazman@netscape.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 ***** */
#ifndef nsCSSStruct_h___
#define nsCSSStruct_h___
#include "nsCSSValue.h"
#include <stdio.h>
struct nsCSSStruct {
// EMPTY on purpose. ABSTRACT with no virtuals (typedef void nsCSSStruct?)
};
// We use the nsCSS* structures for storing nsCSSDeclaration's
// *temporary* data during parsing and modification. (They are too big
// for permanent storage.) We also use them for nsRuleData, with some
// additions of things that the style system must cascade, but that
// aren't CSS properties. Thus we use typedefs and inheritance
// (forwards, when the rule data needs extra data) to make the rule data
// structs from the declaration structs.
typedef nsCSSStruct nsRuleDataStruct;
struct nsCSSFont : public nsCSSStruct {
nsCSSFont(void);
nsCSSFont(const nsCSSFont& aCopy);
~nsCSSFont(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mFamily;
nsCSSValue mStyle;
nsCSSValue mVariant;
nsCSSValue mWeight;
nsCSSValue mSize;
nsCSSValue mSizeAdjust; // NEW
nsCSSValue mStretch; // NEW
};
struct nsRuleDataFont : public nsCSSFont {
PRBool mFamilyFromHTML; // Is the family from an HTML FONT element
};
struct nsCSSValueList {
nsCSSValueList(void);
nsCSSValueList(const nsCSSValueList& aCopy);
~nsCSSValueList(void);
static PRBool Equal(nsCSSValueList* aList1, nsCSSValueList* aList2);
nsCSSValue mValue;
nsCSSValueList* mNext;
};
struct nsCSSColor : public nsCSSStruct {
nsCSSColor(void);
nsCSSColor(const nsCSSColor& aCopy);
~nsCSSColor(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mColor;
nsCSSValue mBackColor;
nsCSSValue mBackImage;
nsCSSValue mBackRepeat;
nsCSSValue mBackAttachment;
nsCSSValue mBackPositionX;
nsCSSValue mBackPositionY;
nsCSSValue mBackClip;
nsCSSValue mBackOrigin;
nsCSSValue mBackInlinePolicy;
};
struct nsRuleDataColor : public nsCSSColor {
};
struct nsCSSShadow {
nsCSSShadow(void);
nsCSSShadow(const nsCSSShadow& aCopy);
~nsCSSShadow(void);
static PRBool Equal(nsCSSShadow* aList1, nsCSSShadow* aList2);
nsCSSValue mColor;
nsCSSValue mXOffset;
nsCSSValue mYOffset;
nsCSSValue mRadius;
nsCSSShadow* mNext;
};
struct nsCSSText : public nsCSSStruct {
nsCSSText(void);
nsCSSText(const nsCSSText& aCopy);
~nsCSSText(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mWordSpacing;
nsCSSValue mLetterSpacing;
nsCSSValue mVerticalAlign;
nsCSSValue mTextTransform;
nsCSSValue mTextAlign;
nsCSSValue mTextIndent;
nsCSSValue mDecoration;
nsCSSShadow* mTextShadow; // NEW
nsCSSValue mUnicodeBidi; // NEW
nsCSSValue mLineHeight;
nsCSSValue mWhiteSpace;
};
struct nsRuleDataText : public nsCSSText {
};
#define FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
~nsCSSRect();
#ifdef DEBUG
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
#endif
PRBool operator==(const nsCSSRect& aOther) const {
return mTop == aOther.mTop &&
mRight == aOther.mRight &&
mBottom == aOther.mBottom &&
mLeft == aOther.mLeft;
}
PRBool operator!=(const nsCSSRect& aOther) const {
return mTop != aOther.mTop ||
mRight != aOther.mRight ||
mBottom != aOther.mBottom ||
mLeft != aOther.mLeft;
}
void SetAllSidesTo(const nsCSSValue& aValue);
nsCSSValue mTop;
nsCSSValue mRight;
nsCSSValue mBottom;
nsCSSValue mLeft;
typedef nsCSSValue nsCSSRect::*side_type;
static const side_type sides[4];
};
struct nsCSSValueListRect {
nsCSSValueListRect(void);
nsCSSValueListRect(const nsCSSValueListRect& aCopy);
~nsCSSValueListRect();
#ifdef DEBUG
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
#endif
nsCSSValueList* mTop;
nsCSSValueList* mRight;
nsCSSValueList* mBottom;
nsCSSValueList* mLeft;
typedef nsCSSValueList* nsCSSValueListRect::*side_type;
static const side_type sides[4];
};
struct nsCSSDisplay : public nsCSSStruct {
nsCSSDisplay(void);
nsCSSDisplay(const nsCSSDisplay& aCopy);
~nsCSSDisplay(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mDirection;
nsCSSValue mDisplay;
nsCSSValue mBinding;
nsCSSValue mAppearance;
nsCSSValue mPosition;
nsCSSValue mFloat;
nsCSSValue mClear;
nsCSSRect mClip;
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
// temp fix for bug 24000
nsCSSValue mBreakBefore;
nsCSSValue mBreakAfter;
// end temp fix
};
struct nsRuleDataDisplay : public nsCSSDisplay {
nsCSSValue mLang;
};
struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(void);
nsCSSMargin(const nsCSSMargin& aCopy);
~nsCSSMargin(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSRect mMargin;
nsCSSValue mMarginStart;
nsCSSValue mMarginEnd;
nsCSSValue mMarginLeftLTRSource;
nsCSSValue mMarginLeftRTLSource;
nsCSSValue mMarginRightLTRSource;
nsCSSValue mMarginRightRTLSource;
nsCSSRect mPadding;
nsCSSValue mPaddingStart;
nsCSSValue mPaddingEnd;
nsCSSValue mPaddingLeftLTRSource;
nsCSSValue mPaddingLeftRTLSource;
nsCSSValue mPaddingRightLTRSource;
nsCSSValue mPaddingRightRTLSource;
nsCSSRect mBorderWidth;
nsCSSRect mBorderColor;
nsCSSValueListRect mBorderColors;
nsCSSRect mBorderStyle;
nsCSSRect mBorderRadius; // (extension)
nsCSSValue mOutlineWidth;
nsCSSValue mOutlineColor;
nsCSSValue mOutlineStyle;
nsCSSRect mOutlineRadius; // (extension)
nsCSSValue mFloatEdge; // NEW
};
struct nsRuleDataMargin : public nsCSSMargin {
};
struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(void);
nsCSSPosition(const nsCSSPosition& aCopy);
~nsCSSPosition(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mWidth;
nsCSSValue mMinWidth;
nsCSSValue mMaxWidth;
nsCSSValue mHeight;
nsCSSValue mMinHeight;
nsCSSValue mMaxHeight;
nsCSSValue mBoxSizing; // NEW
nsCSSRect mOffset;
nsCSSValue mZIndex;
};
struct nsRuleDataPosition : public nsCSSPosition {
};
struct nsCSSList : public nsCSSStruct {
nsCSSList(void);
nsCSSList(const nsCSSList& aCopy);
~nsCSSList(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mType;
nsCSSValue mImage;
nsCSSValue mPosition;
nsCSSRect mImageRegion;
};
struct nsRuleDataList : public nsCSSList {
};
struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(void);
nsCSSTable(const nsCSSTable& aCopy);
~nsCSSTable(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mBorderCollapse;
nsCSSValue mBorderSpacingX;
nsCSSValue mBorderSpacingY;
nsCSSValue mCaptionSide;
nsCSSValue mEmptyCells;
nsCSSValue mLayout;
nsCSSValue mFrame; // Not mappable via CSS, only using HTML4 table attrs.
nsCSSValue mRules; // Not mappable via CSS, only using HTML4 table attrs.
nsCSSValue mSpan; // Not mappable via CSS, only using HTML4 table attrs.
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
};
struct nsRuleDataTable : public nsCSSTable {
};
struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(void);
nsCSSBreaks(const nsCSSBreaks& aCopy);
~nsCSSBreaks(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mOrphans;
nsCSSValue mWidows;
nsCSSValue mPage;
// temp fix for bug 24000
//nsCSSValue mPageBreakAfter;
//nsCSSValue mPageBreakBefore;
nsCSSValue mPageBreakInside;
};
struct nsRuleDataBreaks : public nsCSSBreaks {
};
struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(void);
nsCSSPage(const nsCSSPage& aCopy);
~nsCSSPage(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mMarks;
nsCSSValue mSizeWidth;
nsCSSValue mSizeHeight;
};
struct nsRuleDataPage : public nsCSSPage {
};
struct nsCSSCounterData {
nsCSSCounterData(void);
nsCSSCounterData(const nsCSSCounterData& aCopy);
~nsCSSCounterData(void);
static PRBool Equal(nsCSSCounterData* aList1, nsCSSCounterData* aList2);
nsCSSValue mCounter;
nsCSSValue mValue;
nsCSSCounterData* mNext;
};
struct nsCSSQuotes {
nsCSSQuotes(void);
nsCSSQuotes(const nsCSSQuotes& aCopy);
~nsCSSQuotes(void);
static PRBool Equal(nsCSSQuotes* aList1, nsCSSQuotes* aList2);
nsCSSValue mOpen;
nsCSSValue mClose;
nsCSSQuotes* mNext;
};
struct nsCSSContent : public nsCSSStruct {
nsCSSContent(void);
nsCSSContent(const nsCSSContent& aCopy);
~nsCSSContent(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValueList* mContent;
nsCSSCounterData* mCounterIncrement;
nsCSSCounterData* mCounterReset;
nsCSSValue mMarkerOffset;
nsCSSQuotes* mQuotes;
};
struct nsRuleDataContent : public nsCSSContent {
};
struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(void);
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
~nsCSSUserInterface(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mUserInput;
nsCSSValue mUserModify;
nsCSSValue mUserSelect;
nsCSSValueList* mKeyEquivalent;
nsCSSValue mUserFocus;
nsCSSValue mResizer;
nsCSSValueList* mCursor;
nsCSSValue mForceBrokenImageIcon;
};
struct nsRuleDataUserInterface : public nsCSSUserInterface {
};
struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(void);
nsCSSAural(const nsCSSAural& aCopy);
~nsCSSAural(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mAzimuth;
nsCSSValue mElevation;
nsCSSValue mCueAfter;
nsCSSValue mCueBefore;
nsCSSValue mPauseAfter;
nsCSSValue mPauseBefore;
nsCSSValue mPitch;
nsCSSValue mPitchRange;
nsCSSValue mPlayDuring;
nsCSSValue mPlayDuringFlags;
nsCSSValue mRichness;
nsCSSValue mSpeak;
nsCSSValue mSpeakHeader;
nsCSSValue mSpeakNumeral;
nsCSSValue mSpeakPunctuation;
nsCSSValue mSpeechRate;
nsCSSValue mStress;
nsCSSValue mVoiceFamily;
nsCSSValue mVolume;
};
struct nsRuleDataAural : public nsCSSAural {
};
struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(void);
nsCSSXUL(const nsCSSXUL& aCopy);
~nsCSSXUL(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mBoxAlign;
nsCSSValue mBoxDirection;
nsCSSValue mBoxFlex;
nsCSSValue mBoxOrient;
nsCSSValue mBoxPack;
nsCSSValue mBoxOrdinal;
};
struct nsRuleDataXUL : public nsCSSXUL {
};
#ifdef MOZ_SVG
struct nsCSSSVG : public nsCSSStruct {
nsCSSSVG(void);
nsCSSSVG(const nsCSSSVG& aCopy);
~nsCSSSVG(void);
#ifdef DEBUG
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsCSSValue mDominantBaseline;
nsCSSValue mFill;
nsCSSValue mFillOpacity;
nsCSSValue mFillRule;
nsCSSValue mPointerEvents;
nsCSSValue mShapeRendering;
nsCSSValue mStroke;
nsCSSValue mStrokeDasharray;
nsCSSValue mStrokeDashoffset;
nsCSSValue mStrokeLinecap;
nsCSSValue mStrokeLinejoin;
nsCSSValue mStrokeMiterlimit;
nsCSSValue mStrokeOpacity;
nsCSSValue mStrokeWidth;
nsCSSValue mTextAnchor;
nsCSSValue mTextRendering;
};
struct nsRuleDataSVG : public nsCSSSVG {
};
#endif
#endif /* nsCSSStruct_h___ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,538 +0,0 @@
/* -*- 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) 1999
* 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 ***** */
/******
This file contains the list of all parsed CSS keywords
See nsCSSKeywords.h for access to the enum values for keywords
It is designed to be used as inline input to nsCSSKeywords.cpp *only*
through the magic of C preprocessing.
All entires must be enclosed in the macro CSS_KEY which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
Requirements:
Entries are in the form: (name,id). 'id' must always be the same as 'name'
except that all hyphens ('-') in 'name' are converted to underscores ('_')
in 'id'. This lets us do nice things with the macros without having to
copy/convert strings at runtime.
'name' entries *must* use only lowercase characters.
** Break these invariants and bad things will happen. **
******/
// OUTPUT_CLASS=nsCSSKeywords
// MACRO_NAME=CSS_KEY
CSS_KEY(-moz-activehyperlinktext, _moz_activehyperlinktext)
CSS_KEY(-moz-alias, _moz_alias)
CSS_KEY(-moz-all, _moz_all)
CSS_KEY(-moz-anchor-decoration, _moz_anchor_decoration)
CSS_KEY(-moz-arabic-indic, _moz_arabic_indic)
CSS_KEY(-moz-bengali, _moz_bengali)
CSS_KEY(-moz-bg-inset, _moz_bg_inset)
CSS_KEY(-moz-bg-outset, _moz_bg_outset)
CSS_KEY(-moz-bg-solid, _moz_bg_solid)
CSS_KEY(-moz-box, _moz_box)
CSS_KEY(-moz-bulletinboard, _moz_bulletinboard)
CSS_KEY(-moz-button, _moz_button)
CSS_KEY(-moz-buttondefault, _moz_buttondefault)
CSS_KEY(-moz-cell, _moz_cell)
CSS_KEY(-moz-center, _moz_center)
CSS_KEY(-moz-cjk-earthly-branch, _moz_cjk_earthly_branch)
CSS_KEY(-moz-cjk-heavenly-stem, _moz_cjk_heavenly_stem)
CSS_KEY(-moz-compact, _moz_compact) // Disabled because not supported.
CSS_KEY(-moz-context-menu, _moz_context_menu)
CSS_KEY(-moz-copy, _moz_copy)
CSS_KEY(-moz-count-down, _moz_count_down)
CSS_KEY(-moz-count-up-down, _moz_count_up_down)
CSS_KEY(-moz-count-up, _moz_count_up)
CSS_KEY(-moz-deck, _moz_deck)
CSS_KEY(-moz-desktop, _moz_desktop)
CSS_KEY(-moz-devanagari, _moz_devanagari)
CSS_KEY(-moz-dialog, _moz_dialog)
CSS_KEY(-moz-dialogtext, _moz_dialogtext)
CSS_KEY(-moz-document, _moz_document)
CSS_KEY(-moz-dragtargetzone, _moz_dragtargetzone)
CSS_KEY(-moz-ethiopic-halehame, _moz_ethiopic_halehame)
CSS_KEY(-moz-ethiopic-numeric, _moz_ethiopic_numeric)
CSS_KEY(-moz-ethiopic-halehame-am, _moz_ethiopic_halehame_am)
CSS_KEY(-moz-ethiopic-halehame-ti-er, _moz_ethiopic_halehame_ti_er)
CSS_KEY(-moz-ethiopic-halehame-ti-et, _moz_ethiopic_halehame_ti_et)
CSS_KEY(-moz-field, _moz_field)
CSS_KEY(-moz-fieldtext, _moz_fieldtext)
CSS_KEY(-moz-grabbing, _moz_grabbing)
CSS_KEY(-moz-grab, _moz_grab)
CSS_KEY(-moz-grid-group, _moz_grid_group)
CSS_KEY(-moz-grid-line, _moz_grid_line)
CSS_KEY(-moz-grid, _moz_grid)
CSS_KEY(-moz-groupbox, _moz_groupbox)
CSS_KEY(-moz-gujarati, _moz_gujarati)
CSS_KEY(-moz-gurmukhi, _moz_gurmukhi)
CSS_KEY(-moz-hangul-consonant, _moz_hangul_consonant)
CSS_KEY(-moz-hidden-unscrollable, _moz_hidden_unscrollable)
CSS_KEY(-moz-hangul, _moz_hangul)
CSS_KEY(-moz-hyperlinktext, _moz_hyperlinktext)
CSS_KEY(-moz-info, _moz_info)
CSS_KEY(-moz-initial, _moz_initial)
CSS_KEY(-moz-inline-block, _moz_inline_block)
CSS_KEY(-moz-inline-box, _moz_inline_box)
CSS_KEY(-moz-inline-grid, _moz_inline_grid)
CSS_KEY(-moz-inline-stack, _moz_inline_stack)
CSS_KEY(-moz-inline-table, _moz_inline_table)
CSS_KEY(-moz-japanese-formal, _moz_japanese_formal)
CSS_KEY(-moz-japanese-informal, _moz_japanese_informal)
CSS_KEY(-moz-kannada, _moz_kannada)
CSS_KEY(-moz-khmer, _moz_khmer)
CSS_KEY(-moz-lao, _moz_lao)
CSS_KEY(-moz-list, _moz_list)
CSS_KEY(-moz-mac-accentdarkestshadow, _moz_mac_accentdarkestshadow)
CSS_KEY(-moz-mac-accentdarkshadow, _moz_mac_accentdarkshadow)
CSS_KEY(-moz-mac-accentface, _moz_mac_accentface)
CSS_KEY(-moz-mac-accentlightesthighlight, _moz_mac_accentlightesthighlight)
CSS_KEY(-moz-mac-accentlightshadow, _moz_mac_accentlightshadow)
CSS_KEY(-moz-mac-accentregularhighlight, _moz_mac_accentregularhighlight)
CSS_KEY(-moz-mac-accentregularshadow, _moz_mac_accentregularshadow)
CSS_KEY(-moz-mac-focusring, _moz_mac_focusring)
CSS_KEY(-moz-mac-menuselect, _moz_mac_menuselect)
CSS_KEY(-moz-mac-menushadow, _moz_mac_menushadow)
CSS_KEY(-moz-mac-menutextselect, _moz_mac_menutextselect)
CSS_KEY(-moz-malayalam, _moz_malayalam)
CSS_KEY(-moz-marker, _moz_marker) // Disabled because not supported correctly.
CSS_KEY(-moz-myanmar, _moz_myanmar)
CSS_KEY(-moz-oriya, _moz_oriya)
CSS_KEY(-moz-page-break, _moz_page_break)
CSS_KEY(-moz-persian, _moz_persian)
CSS_KEY(-moz-popup, _moz_popup)
CSS_KEY(-moz-pre-wrap, _moz_pre_wrap)
CSS_KEY(-moz-pull-down-menu, _moz_pull_down_menu)
CSS_KEY(-moz-right, _moz_right)
CSS_KEY(-moz-run-in, _moz_run_in) // Disabled because not supported.
CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal)
CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none)
CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical)
CSS_KEY(-moz-show-background, _moz_show_background)
CSS_KEY(-moz-simp-chinese-formal, _moz_simp_chinese_formal)
CSS_KEY(-moz-simp-chinese-informal, _moz_simp_chinese_informal)
CSS_KEY(-moz-spinning, _moz_spinning)
CSS_KEY(-moz-stack, _moz_stack)
CSS_KEY(-moz-tamil, _moz_tamil)
CSS_KEY(-moz-telugu, _moz_telugu)
CSS_KEY(-moz-thai, _moz_thai)
CSS_KEY(-moz-trad-chinese-formal, _moz_trad_chinese_formal)
CSS_KEY(-moz-trad-chinese-informal, _moz_trad_chinese_informal)
CSS_KEY(-moz-urdu, _moz_urdu)
CSS_KEY(-moz-use-text-color, _moz_use_text_color)
CSS_KEY(-moz-visitedhyperlinktext, _moz_visitedhyperlinktext)
CSS_KEY(-moz-window, _moz_window)
CSS_KEY(-moz-workspace, _moz_workspace)
CSS_KEY(-moz-zoom-in, _moz_zoom_in)
CSS_KEY(-moz-zoom-out, _moz_zoom_out)
CSS_KEY(above, above)
CSS_KEY(absolute, absolute)
CSS_KEY(activeborder, activeborder)
CSS_KEY(activecaption, activecaption)
CSS_KEY(all, all)
CSS_KEY(always, always)
CSS_KEY(appworkspace, appworkspace)
CSS_KEY(armenian, armenian)
CSS_KEY(auto, auto)
CSS_KEY(avoid, avoid)
CSS_KEY(background, background)
CSS_KEY(baseline, baseline)
CSS_KEY(behind, behind)
CSS_KEY(below, below)
CSS_KEY(bidi-override, bidi_override)
CSS_KEY(blink, blink)
CSS_KEY(block, block)
CSS_KEY(block-axis, block_axis)
CSS_KEY(bold, bold)
CSS_KEY(bolder, bolder)
CSS_KEY(border, border)
CSS_KEY(border-box, border_box)
CSS_KEY(both, both)
CSS_KEY(bottom, bottom)
CSS_KEY(bounding-box, bounding_box)
CSS_KEY(button, button)
CSS_KEY(buttonface, buttonface)
CSS_KEY(buttonhighlight, buttonhighlight)
CSS_KEY(buttonshadow, buttonshadow)
CSS_KEY(buttontext, buttontext)
CSS_KEY(capitalize, capitalize)
CSS_KEY(caption, caption)
CSS_KEY(captiontext, captiontext)
CSS_KEY(center, center)
CSS_KEY(center-left, center_left)
CSS_KEY(center-right, center_right)
CSS_KEY(ch, ch)
CSS_KEY(circle, circle)
CSS_KEY(cjk-ideographic, cjk_ideographic)
CSS_KEY(close-quote, close_quote)
CSS_KEY(cm, cm)
CSS_KEY(code, code)
CSS_KEY(collapse, collapse)
CSS_KEY(condensed, condensed)
CSS_KEY(content, content)
CSS_KEY(content-box, content_box)
CSS_KEY(continuous, continuous)
CSS_KEY(crop, crop)
CSS_KEY(cross, cross)
CSS_KEY(crosshair, crosshair)
CSS_KEY(dashed, dashed)
CSS_KEY(decimal, decimal)
CSS_KEY(decimal-leading-zero, decimal_leading_zero)
CSS_KEY(default, default)
CSS_KEY(deg, deg)
CSS_KEY(dialog, dialog)
CSS_KEY(digits, digits)
CSS_KEY(disabled, disabled)
CSS_KEY(disc, disc)
CSS_KEY(dotted, dotted)
CSS_KEY(double, double)
CSS_KEY(e-resize, e_resize)
CSS_KEY(each-box, each_box)
CSS_KEY(element, element)
CSS_KEY(elements, elements)
CSS_KEY(em, em)
CSS_KEY(embed, embed)
CSS_KEY(enabled, enabled)
CSS_KEY(end, end)
CSS_KEY(ex, ex)
CSS_KEY(expanded, expanded)
CSS_KEY(extra-condensed, extra_condensed)
CSS_KEY(extra-expanded, extra_expanded)
CSS_KEY(far-left, far_left)
CSS_KEY(far-right, far_right)
CSS_KEY(fast, fast)
CSS_KEY(faster, faster)
CSS_KEY(fixed, fixed)
CSS_KEY(georgian, georgian)
CSS_KEY(grad, grad)
CSS_KEY(graytext, graytext)
CSS_KEY(groove, groove)
CSS_KEY(hebrew, hebrew)
CSS_KEY(help, help)
CSS_KEY(hidden, hidden)
CSS_KEY(hide, hide)
CSS_KEY(high, high)
CSS_KEY(higher, higher)
CSS_KEY(highlight, highlight)
CSS_KEY(highlighttext, highlighttext)
CSS_KEY(hiragana, hiragana)
CSS_KEY(hiragana-iroha, hiragana_iroha)
CSS_KEY(horizontal, horizontal)
CSS_KEY(hz, hz)
CSS_KEY(icon, icon)
CSS_KEY(ignore, ignore)
CSS_KEY(in, in)
CSS_KEY(inactiveborder, inactiveborder)
CSS_KEY(inactivecaption, inactivecaption)
CSS_KEY(inactivecaptiontext, inactivecaptiontext)
CSS_KEY(infobackground, infobackground)
CSS_KEY(infotext, infotext)
CSS_KEY(inherit, inherit)
CSS_KEY(inline, inline)
CSS_KEY(inline-axis, inline_axis)
CSS_KEY(inset, inset)
CSS_KEY(inside, inside)
CSS_KEY(invert, invert)
CSS_KEY(italic, italic)
CSS_KEY(justify, justify)
CSS_KEY(katakana, katakana)
CSS_KEY(katakana-iroha, katakana_iroha)
CSS_KEY(khz, khz)
CSS_KEY(landscape, landscape)
CSS_KEY(large, large)
CSS_KEY(larger, larger)
CSS_KEY(left, left)
CSS_KEY(left-side, left_side)
CSS_KEY(leftwards, leftwards)
CSS_KEY(level, level)
CSS_KEY(lighter, lighter)
CSS_KEY(line-through, line_through)
CSS_KEY(list-item, list_item)
CSS_KEY(logical, logical)
CSS_KEY(loud, loud)
CSS_KEY(low, low)
CSS_KEY(lower, lower)
CSS_KEY(lower-alpha, lower_alpha)
CSS_KEY(lower-greek, lower_greek)
CSS_KEY(lower-latin, lower_latin)
CSS_KEY(lower-roman, lower_roman)
CSS_KEY(lowercase, lowercase)
CSS_KEY(ltr, ltr)
CSS_KEY(margin-box, margin_box)
CSS_KEY(medium, medium)
CSS_KEY(menu, menu)
CSS_KEY(menubar, menubar)
CSS_KEY(menutext, menutext)
CSS_KEY(message-box, message_box)
CSS_KEY(middle, middle)
CSS_KEY(mix, mix)
CSS_KEY(mm, mm)
CSS_KEY(move, move)
CSS_KEY(ms, ms)
CSS_KEY(n-resize, n_resize)
CSS_KEY(narrower, narrower)
CSS_KEY(ne-resize, ne_resize)
CSS_KEY(no-close-quote, no_close_quote)
CSS_KEY(no-open-quote, no_open_quote)
CSS_KEY(no-repeat, no_repeat)
CSS_KEY(none, none)
CSS_KEY(normal, normal)
CSS_KEY(nowrap, nowrap)
CSS_KEY(nw-resize, nw_resize)
CSS_KEY(oblique, oblique)
CSS_KEY(once, once)
CSS_KEY(open-quote, open_quote)
CSS_KEY(outset, outset)
CSS_KEY(outside, outside)
CSS_KEY(overline, overline)
CSS_KEY(padding, padding)
CSS_KEY(padding-box, padding_box)
CSS_KEY(pc, pc)
CSS_KEY(physical, physical)
CSS_KEY(pointer, pointer)
CSS_KEY(portrait, portrait)
CSS_KEY(pre, pre)
CSS_KEY(progress, progress)
CSS_KEY(pt, pt)
CSS_KEY(px, px)
CSS_KEY(rad, rad)
CSS_KEY(read-only, read_only)
CSS_KEY(read-write, read_write)
CSS_KEY(relative, relative)
CSS_KEY(repeat, repeat)
CSS_KEY(repeat-x, repeat_x)
CSS_KEY(repeat-y, repeat_y)
CSS_KEY(reverse, reverse)
CSS_KEY(ridge, ridge)
CSS_KEY(right, right)
CSS_KEY(right-side, right_side)
CSS_KEY(rightwards, rightwards)
CSS_KEY(rtl, rtl)
CSS_KEY(s, s)
CSS_KEY(s-resize, s_resize)
CSS_KEY(scroll, scroll)
CSS_KEY(scrollbar, scrollbar)
CSS_KEY(se-resize, se_resize)
CSS_KEY(select-after, select_after)
CSS_KEY(select-all, select_all)
CSS_KEY(select-before, select_before)
CSS_KEY(select-menu, select_menu)
CSS_KEY(select-same, select_same)
CSS_KEY(semi-condensed, semi_condensed)
CSS_KEY(semi-expanded, semi_expanded)
CSS_KEY(separate, separate)
CSS_KEY(show, show)
CSS_KEY(silent, silent)
CSS_KEY(slow, slow)
CSS_KEY(slower, slower)
CSS_KEY(small, small)
CSS_KEY(small-caps, small_caps)
CSS_KEY(small-caption, small_caption)
CSS_KEY(smaller, smaller)
CSS_KEY(soft, soft)
CSS_KEY(solid, solid)
CSS_KEY(spell-out, spell_out)
CSS_KEY(square, square)
CSS_KEY(start, start)
CSS_KEY(static, static)
CSS_KEY(status-bar, status_bar)
CSS_KEY(stretch, stretch)
CSS_KEY(sub, sub)
CSS_KEY(super, super)
CSS_KEY(sw-resize, sw_resize)
CSS_KEY(table, table)
CSS_KEY(table-caption, table_caption)
CSS_KEY(table-cell, table_cell)
CSS_KEY(table-column, table_column)
CSS_KEY(table-column-group, table_column_group)
CSS_KEY(table-footer-group, table_footer_group)
CSS_KEY(table-header-group, table_header_group)
CSS_KEY(table-row, table_row)
CSS_KEY(table-row-group, table_row_group)
CSS_KEY(text, text)
CSS_KEY(text-bottom, text_bottom)
CSS_KEY(text-top, text_top)
CSS_KEY(thick, thick)
CSS_KEY(thin, thin)
CSS_KEY(threeddarkshadow, threeddarkshadow)
CSS_KEY(threedface, threedface)
CSS_KEY(threedhighlight, threedhighlight)
CSS_KEY(threedlightshadow, threedlightshadow)
CSS_KEY(threedshadow, threedshadow)
CSS_KEY(toggle, toggle)
CSS_KEY(top, top)
CSS_KEY(transparent, transparent)
CSS_KEY(tri-state, tri_state)
CSS_KEY(ultra-condensed, ultra_condensed)
CSS_KEY(ultra-expanded, ultra_expanded)
CSS_KEY(underline, underline)
CSS_KEY(upper-alpha, upper_alpha)
CSS_KEY(upper-latin, upper_latin)
CSS_KEY(upper-roman, upper_roman)
CSS_KEY(uppercase, uppercase)
CSS_KEY(vertical, vertical)
CSS_KEY(visible, visible)
CSS_KEY(w-resize, w_resize)
CSS_KEY(wait, wait)
CSS_KEY(wider, wider)
CSS_KEY(window, window)
CSS_KEY(windowframe, windowframe)
CSS_KEY(windowtext, windowtext)
CSS_KEY(write-only, write_only)
CSS_KEY(x-fast, x_fast)
CSS_KEY(x-high, x_high)
CSS_KEY(x-large, x_large)
CSS_KEY(x-loud, x_loud)
CSS_KEY(x-low, x_low)
CSS_KEY(x-slow, x_slow)
CSS_KEY(x-small, x_small)
CSS_KEY(x-soft, x_soft)
CSS_KEY(xx-large, xx_large)
CSS_KEY(xx-small, xx_small)
// Appearance keywords for widget styles
CSS_KEY(radio, radio)
CSS_KEY(checkbox, checkbox)
CSS_KEY(radio-small, radio_small)
CSS_KEY(checkbox-small, checkbox_small)
CSS_KEY(button-small, button_small)
CSS_KEY(button-bevel, button_bevel)
CSS_KEY(toolbox, toolbox)
CSS_KEY(toolbar, toolbar)
CSS_KEY(toolbarbutton, toolbarbutton)
CSS_KEY(toolbargripper, toolbargripper)
CSS_KEY(dualbutton, dualbutton)
CSS_KEY(dualbutton-dropdown, dualbutton_dropdown)
CSS_KEY(separator, separator)
CSS_KEY(statusbar, statusbar)
CSS_KEY(statusbarpanel, statusbarpanel)
CSS_KEY(resizerpanel, resizerpanel)
CSS_KEY(resizer, resizer)
CSS_KEY(listbox, listbox)
CSS_KEY(listitem, listitem)
CSS_KEY(treeview, treeview)
CSS_KEY(treeitem, treeitem)
CSS_KEY(treetwisty, treetwisty)
CSS_KEY(treetwistyopen, treetwistyopen)
CSS_KEY(treeline, treeline)
CSS_KEY(treeheader, treeheader)
CSS_KEY(treeheadercell, treeheadercell)
CSS_KEY(treeheadersortarrow, treeheadersortarrow)
CSS_KEY(progressbar, progressbar)
CSS_KEY(progressbar-vertical, progressbar_vertical)
CSS_KEY(progresschunk, progresschunk)
CSS_KEY(progresschunk-vertical, progresschunk_vertical)
CSS_KEY(tab, tab)
CSS_KEY(tab-left-edge, tab_left_edge)
CSS_KEY(tab-right-edge, tab_right_edge)
CSS_KEY(tabpanels, tabpanels)
CSS_KEY(tabpanel, tabpanel)
CSS_KEY(tooltip, tooltip)
CSS_KEY(spinner, spinner)
CSS_KEY(spinner-upbutton, spinner_upbutton)
CSS_KEY(spinner-downbutton, spinner_downbutton)
CSS_KEY(scrollbarbutton-up, scrollbarbutton_up)
CSS_KEY(scrollbarbutton-down, scrollbarbutton_down)
CSS_KEY(scrollbarbutton-left, scrollbarbutton_left)
CSS_KEY(scrollbarbutton-right, scrollbarbutton_right)
CSS_KEY(scrollbartrack-horizontal, scrollbartrack_horizontal)
CSS_KEY(scrollbartrack-vertical, scrollbartrack_vertical)
CSS_KEY(scrollbarthumb-horizontal, scrollbarthumb_horizontal)
CSS_KEY(scrollbarthumb-vertical, scrollbarthumb_vertical)
CSS_KEY(scrollbargripper-horizontal, scrollbargripper_horizontal)
CSS_KEY(scrollbargripper-vertical, scrollbargripper_vertical)
CSS_KEY(textfield, textfield)
CSS_KEY(caret, caret)
CSS_KEY(menulist, menulist)
CSS_KEY(menulist-button, menulistbutton)
CSS_KEY(menulist-text, menulisttext)
CSS_KEY(menulist-textfield, menulisttextfield)
CSS_KEY(slider, slider)
CSS_KEY(sliderthumb, sliderthumb)
CSS_KEY(sliderthumbstart, sliderthumbstart)
CSS_KEY(sliderthumbend, sliderthumbend)
CSS_KEY(sliderthumbtick, sliderthumbtick)
CSS_KEY(checkbox-container, checkboxcontainer)
CSS_KEY(radio-container, radiocontainer)
#ifdef MOZ_SVG
//CSS_KEY(all, all)
CSS_KEY(alphabetic, alphabetic)
//CSS_KEY(auto, auto)
CSS_KEY(bevel, bevel)
CSS_KEY(butt, butt)
CSS_KEY(central, central)
CSS_KEY(crispedges, crispedges)
//CSS_KEY(end, end)
CSS_KEY(evenodd, evenodd)
CSS_KEY(fill, fill)
CSS_KEY(geometricprecision, geometricprecision)
CSS_KEY(hanging, hanging)
CSS_KEY(ideographic, ideographic)
CSS_KEY(mathematical, mathematical)
//CSS_KEY(middle, middle)
CSS_KEY(miter, miter)
CSS_KEY(no-change, no_change)
//CSS_KEY(none, none)
CSS_KEY(nonzero, nonzero)
CSS_KEY(optimizelegibility, optimizelegibility)
CSS_KEY(optimizespeed, optimizespeed)
CSS_KEY(painted, painted)
CSS_KEY(reset-size, reset_size)
CSS_KEY(round, round)
//CSS_KEY(square, square)
//CSS_KEY(start, start)
CSS_KEY(stroke, stroke)
CSS_KEY(text-after-edge, text_after_edge)
CSS_KEY(text-before-edge, text_before_edge)
CSS_KEY(use-script, use_script)
//CSS_KEY(visible, visible)
CSS_KEY(visiblefill, visiblefill)
CSS_KEY(visiblepainted, visiblepainted)
CSS_KEY(visiblestroke, visiblestroke)
#endif

View File

@@ -1,657 +0,0 @@
/* -*- 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) 1999
* 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 ***** */
/******
This file contains the list of all parsed CSS properties. It is
designed to be used as inline input through the magic of C
preprocessing. All entries must be enclosed in the appropriate
CSS_PROP_* macro which will have cruel and unusual things done to it.
It is recommended (but not strictly necessary) to keep all entries in
alphabetical order.
The arguments to CSS_PROP_* are:
1. 'name' entries represent a CSS property name and *must* use only
lowercase characters.
2. 'id' should be the same as 'name' except that all hyphens ('-')
in 'name' are converted to underscores ('_') in 'id'. This lets us
do nice things with the macros without having to copy/convert strings
at runtime. These are the names used for the enum values of the
nsCSSProperty enumeration defined in nsCSSProps.h.
3. 'method' is designed to be as input for CSS2Properties and similar
callers. It must always be the same as 'name' except it must use
InterCaps and all hyphens ('-') must be removed.
4. 'datastruct' says which nsRuleData* struct this property goes in.
5. 'member' gives the name of the member variable in the nsRuleData
struct.
6. 'type' gives the |nsCSSType| of the data in the nsRuleData struct
and in the nsCSSDeclaration backend.
7. 'iscoord' says whether the property is a coordinate property for
which we use an explicit inherit value in the *style structs* (since
inheritance requires knowledge of layout).
Which CSS_PROP_* macro a property is in depends on which nsStyle* its
computed value lives in (unless it is a shorthand, in which case it
gets CSS_PROP_SHORTHAND).
******/
/*************************************************************************/
// XXX Should we really be using CSS_PROP_SHORTHAND for 'border-spacing',
// 'background-position', and 'size'?
// All includers must explicitly define CSS_PROP_NOTIMPLEMENTED if they
// want this. (Only the DOM cares.)
#ifndef CSS_PROP_NOTIMPLEMENTED
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_) /* nothing */
#define DEFINED_CSS_PROP_NOTIMPLEMENTED
#endif
// All includers must explicitly define CSS_PROP_SHORTHAND if they
// want it.
#ifndef CSS_PROP_SHORTHAND
#define CSS_PROP_SHORTHAND(name_, id_, method_) /* nothing */
#define DEFINED_CSS_PROP_SHORTHAND
#endif
// Callers may define CSS_PROP_LIST_EXCLUDE_INTERNAL if they want to
// exclude internal properties that are not represented in the DOM (only
// the DOM style code defines this).
// A caller who wants all the properties can define the |CSS_PROP|
// macro.
#ifdef CSS_PROP
#define USED_CSS_PROP
#define CSS_PROP_FONT(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_COLOR(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_BACKGROUND(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_LIST(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_POSITION(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TEXT(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TEXTRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_DISPLAY(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_VISIBILITY(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_CONTENT(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_QUOTES(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_USERINTERFACE(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_UIRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TABLE(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_TABLEBORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_MARGIN(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_PADDING(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_BORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_OUTLINE(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_XUL(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#ifdef MOZ_SVG
#define CSS_PROP_SVG(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define CSS_PROP_SVGRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#endif
// For properties that are stored in the CSS backend but are not
// computed. An includer may define this in addition to CSS_PROP, but
// otherwise we treat it as the same.
#ifndef CSS_PROP_BACKENDONLY
#define CSS_PROP_BACKENDONLY(name_, id_, method_, datastruct_, member_, type_, iscoord_) CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_)
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
#else /* !defined(CSS_PROP) */
// An includer who does not define CSS_PROP can define any or all of the
// per-struct macros that are equivalent to it, and the rest will be
// ignored.
#ifndef CSS_PROP_FONT
#define CSS_PROP_FONT(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_FONT
#endif
#ifndef CSS_PROP_COLOR
#define CSS_PROP_COLOR(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_COLOR
#endif
#ifndef CSS_PROP_BACKGROUND
#define CSS_PROP_BACKGROUND(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BACKGROUND
#endif
#ifndef CSS_PROP_LIST
#define CSS_PROP_LIST(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_LIST
#endif
#ifndef CSS_PROP_POSITION
#define CSS_PROP_POSITION(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_POSITION
#endif
#ifndef CSS_PROP_TEXT
#define CSS_PROP_TEXT(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TEXT
#endif
#ifndef CSS_PROP_TEXTRESET
#define CSS_PROP_TEXTRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TEXTRESET
#endif
#ifndef CSS_PROP_DISPLAY
#define CSS_PROP_DISPLAY(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_DISPLAY
#endif
#ifndef CSS_PROP_VISIBILITY
#define CSS_PROP_VISIBILITY(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_VISIBILITY
#endif
#ifndef CSS_PROP_CONTENT
#define CSS_PROP_CONTENT(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_CONTENT
#endif
#ifndef CSS_PROP_QUOTES
#define CSS_PROP_QUOTES(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_QUOTES
#endif
#ifndef CSS_PROP_USERINTERFACE
#define CSS_PROP_USERINTERFACE(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_USERINTERFACE
#endif
#ifndef CSS_PROP_UIRESET
#define CSS_PROP_UIRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_UIRESET
#endif
#ifndef CSS_PROP_TABLE
#define CSS_PROP_TABLE(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TABLE
#endif
#ifndef CSS_PROP_TABLEBORDER
#define CSS_PROP_TABLEBORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_TABLEBORDER
#endif
#ifndef CSS_PROP_MARGIN
#define CSS_PROP_MARGIN(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_MARGIN
#endif
#ifndef CSS_PROP_PADDING
#define CSS_PROP_PADDING(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_PADDING
#endif
#ifndef CSS_PROP_BORDER
#define CSS_PROP_BORDER(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BORDER
#endif
#ifndef CSS_PROP_OUTLINE
#define CSS_PROP_OUTLINE(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_OUTLINE
#endif
#ifndef CSS_PROP_XUL
#define CSS_PROP_XUL(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_XUL
#endif
#ifdef MOZ_SVG
#ifndef CSS_PROP_SVG
#define CSS_PROP_SVG(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_SVG
#endif
#ifndef CSS_PROP_SVGRESET
#define CSS_PROP_SVGRESET(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_SVGRESET
#endif
#endif /* defined(MOZ_SVG) */
#ifndef CSS_PROP_BACKENDONLY
#define CSS_PROP_BACKENDONLY(name_, id_, method_, datastruct_, member_, type_, iscoord_) /* nothing */
#define DEFINED_CSS_PROP_BACKENDONLY
#endif
#endif /* !defined(CSS_PROP) */
/*************************************************************************/
// For notes XXX bug 3935 below, the names being parsed do not correspond
// to the constants used internally. It would be nice to bring the
// constants into line sometime.
// The parser will refuse to parse properties marked with -x-.
// Those marked XXX bug 48973 are CSS2 properties that we support
// differently from the spec for UI requirements. If we ever
// support them correctly the old constants need to be renamed and
// new ones should be entered.
CSS_PROP_DISPLAY(-moz-appearance, appearance, MozAppearance, Display, mAppearance, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(-moz-border-radius, _moz_border_radius, MozBorderRadius)
CSS_PROP_BORDER(-moz-border-radius-topleft, _moz_border_radius_topLeft, MozBorderRadiusTopleft, Margin, mBorderRadius.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-topright, _moz_border_radius_topRight, MozBorderRadiusTopright, Margin, mBorderRadius.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, MozBorderRadiusBottomleft, Margin, mBorderRadius.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_BORDER(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, MozBorderRadiusBottomright, Margin, mBorderRadius.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(-moz-outline-radius, _moz_outline_radius, MozOutlineRadius)
CSS_PROP_OUTLINE(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, MozOutlineRadiusTopleft, Margin, mOutlineRadius.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-topright, _moz_outline_radius_topRight, MozOutlineRadiusTopright, Margin, mOutlineRadius.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, MozOutlineRadiusBottomleft, Margin, mOutlineRadius.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_OUTLINE(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, MozOutlineRadiusBottomright, Margin, mOutlineRadius.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(azimuth, azimuth, Azimuth, Aural, mAzimuth, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(background, background, Background)
CSS_PROP_BACKGROUND(background-attachment, background_attachment, BackgroundAttachment, Color, mBackAttachment, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-clip, _moz_background_clip, MozBackgroundClip, Color, mBackClip, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(background-color, background_color, BackgroundColor, Color, mBackColor, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(background-image, background_image, BackgroundImage, Color, mBackImage, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-inline-policy, _moz_background_inline_policy, MozBackgroundInlinePolicy, Color, mBackInlinePolicy, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKGROUND(-moz-background-origin, _moz_background_origin, MozBackgroundOrigin, Color, mBackOrigin, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(background-position, background_position, BackgroundPosition)
CSS_PROP_BACKGROUND(background-repeat, background_repeat, BackgroundRepeat, Color, mBackRepeat, eCSSType_Value, PR_FALSE)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKGROUND(-x-background-x-position, background_x_position, BackgroundXPosition, Color, mBackPositionX, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKGROUND(-x-background-y-position, background_y_position, BackgroundYPosition, Color, mBackPositionY, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_DISPLAY(-moz-binding, binding, MozBinding, Display, mBinding, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_SHORTHAND(border, border, Border)
CSS_PROP_SHORTHAND(border-bottom, border_bottom, BorderBottom)
CSS_PROP_BORDER(border-bottom-color, border_bottom_color, BorderBottomColor, Margin, mBorderColor.mBottom, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-bottom-colors, border_bottom_colors, MozBorderBottomColors, Margin, mBorderColors.mBottom, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-bottom-style, border_bottom_style, BorderBottomStyle, Margin, mBorderStyle.mBottom, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-bottom-width, border_bottom_width, BorderBottomWidth, Margin, mBorderWidth.mBottom, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLEBORDER(border-collapse, border_collapse, BorderCollapse, Table, mBorderCollapse, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-color, border_color, BorderColor)
CSS_PROP_SHORTHAND(border-left, border_left, BorderLeft)
CSS_PROP_BORDER(border-left-color, border_left_color, BorderLeftColor, Margin, mBorderColor.mLeft, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-left-colors, border_left_colors, MozBorderLeftColors, Margin, mBorderColors.mLeft, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-left-style, border_left_style, BorderLeftStyle, Margin, mBorderStyle.mLeft, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-left-width, border_left_width, BorderLeftWidth, Margin, mBorderWidth.mLeft, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-right, border_right, BorderRight)
CSS_PROP_BORDER(border-right-color, border_right_color, BorderRightColor, Margin, mBorderColor.mRight, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-right-colors, border_right_colors, MozBorderRightColors, Margin, mBorderColors.mRight, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-right-style, border_right_style, BorderRightStyle, Margin, mBorderStyle.mRight, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-right-width, border_right_width, BorderRightWidth, Margin, mBorderWidth.mRight, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-spacing, border_spacing, BorderSpacing)
CSS_PROP_SHORTHAND(border-style, border_style, BorderStyle) // on/off will need reflow
CSS_PROP_SHORTHAND(border-top, border_top, BorderTop)
CSS_PROP_BORDER(border-top-color, border_top_color, BorderTopColor, Margin, mBorderColor.mTop, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-border-top-colors, border_top_colors, MozBorderTopColors, Margin, mBorderColors.mTop, eCSSType_ValueList, PR_FALSE)
CSS_PROP_BORDER(border-top-style, border_top_style, BorderTopStyle, Margin, mBorderStyle.mTop, eCSSType_Value, PR_FALSE) // on/off will need reflow
CSS_PROP_BORDER(border-top-width, border_top_width, BorderTopWidth, Margin, mBorderWidth.mTop, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(border-width, border_width, BorderWidth)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_TABLEBORDER(-x-border-x-spacing, border_x_spacing, BorderXSpacing, Table, mBorderSpacingX, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TABLEBORDER(-x-border-y-spacing, border_y_spacing, BorderYSpacing, Table, mBorderSpacingY, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_POSITION(bottom, bottom, Bottom, Position, mOffset.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(-moz-box-sizing, box_sizing, MozBoxSizing, Position, mBoxSizing, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TABLEBORDER(caption-side, caption_side, CaptionSide, Table, mCaptionSide, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(clear, clear, Clear, Display, mClear, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(clip, clip, Clip, Display, mClip, eCSSType_Rect, PR_FALSE)
CSS_PROP_COLOR(color, color, Color, Color, mColor, eCSSType_Value, PR_FALSE)
CSS_PROP_CONTENT(content, content, Content, Content, mContent, eCSSType_ValueList, PR_FALSE)
CSS_PROP_NOTIMPLEMENTED(counter-increment, counter_increment, CounterIncrement)
CSS_PROP_NOTIMPLEMENTED(counter-reset, counter_reset, CounterReset)
CSS_PROP_CONTENT(-moz-counter-increment, _moz_counter_increment, MozCounterIncrement, Content, mCounterIncrement, eCSSType_CounterData, PR_FALSE) // XXX bug 137285
CSS_PROP_CONTENT(-moz-counter-reset, _moz_counter_reset, MozCounterReset, Content, mCounterReset, eCSSType_CounterData, PR_FALSE) // XXX bug 137285
CSS_PROP_SHORTHAND(cue, cue, Cue)
CSS_PROP_BACKENDONLY(cue-after, cue_after, CueAfter, Aural, mCueAfter, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(cue-before, cue_before, CueBefore, Aural, mCueBefore, eCSSType_Value, PR_FALSE)
CSS_PROP_USERINTERFACE(cursor, cursor, Cursor, UserInterface, mCursor, eCSSType_ValueList, PR_FALSE)
CSS_PROP_VISIBILITY(direction, direction, Direction, Display, mDirection, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(display, display, Display, Display, mDisplay, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(elevation, elevation, Elevation, Aural, mElevation, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLEBORDER(empty-cells, empty_cells, EmptyCells, Table, mEmptyCells, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(float, float, CssFloat, Display, mFloat, eCSSType_Value, PR_FALSE)
CSS_PROP_BORDER(-moz-float-edge, float_edge, MozFloatEdge, Margin, mFloatEdge, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_SHORTHAND(font, font, Font)
CSS_PROP_FONT(font-family, font_family, FontFamily, Font, mFamily, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-size, font_size, FontSize, Font, mSize, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-size-adjust, font_size_adjust, FontSizeAdjust, Font, mSizeAdjust, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(font-stretch, font_stretch, FontStretch, Font, mStretch, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-style, font_style, FontStyle, Font, mStyle, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-variant, font_variant, FontVariant, Font, mVariant, eCSSType_Value, PR_FALSE)
CSS_PROP_FONT(font-weight, font_weight, FontWeight, Font, mWeight, eCSSType_Value, PR_FALSE)
CSS_PROP_UIRESET(-moz-force-broken-image-icon, force_broken_image_icon, MozForceBrokenImageIcon, UserInterface, mForceBrokenImageIcon, eCSSType_Value, PR_FALSE) // bug 58646
CSS_PROP_POSITION(height, height, Height, Position, mHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_LIST(-moz-image-region, image_region, MozImageRegion, List, mImageRegion, eCSSType_Rect, PR_TRUE)
CSS_PROP_UIRESET(-moz-key-equivalent, key_equivalent, MozKeyEquivalent, UserInterface, mKeyEquivalent, eCSSType_ValueList, PR_FALSE) // This will need some other notification, but what? // XXX bug 3935
CSS_PROP_POSITION(left, left, Left, Position, mOffset.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(letter-spacing, letter_spacing, LetterSpacing, Text, mLetterSpacing, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(line-height, line_height, LineHeight, Text, mLineHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(list-style, list_style, ListStyle)
CSS_PROP_LIST(list-style-image, list_style_image, ListStyleImage, List, mImage, eCSSType_Value, PR_FALSE)
CSS_PROP_LIST(list-style-position, list_style_position, ListStylePosition, List, mPosition, eCSSType_Value, PR_FALSE)
CSS_PROP_LIST(list-style-type, list_style_type, ListStyleType, List, mType, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(margin, margin, Margin)
CSS_PROP_MARGIN(margin-bottom, margin_bottom, MarginBottom, Margin, mMargin.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(-moz-margin-end, margin_end, MozMarginEnd)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_MARGIN(margin-end-value, margin_end_value, X, Margin, mMarginEnd, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_SHORTHAND(margin-left, margin_left, MarginLeft)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_MARGIN(margin-left-value, margin_left_value, X, Margin, mMargin.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-left-ltr-source, margin_left_ltr_source, X, Margin, mMarginLeftLTRSource, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-left-rtl-source, margin_left_rtl_source, X, Margin, mMarginLeftRTLSource, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_SHORTHAND(margin-right, margin_right, MarginRight)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_MARGIN(margin-right-value, margin_right_value, X, Margin, mMargin.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-right-ltr-source, margin_right_ltr_source, X, Margin, mMarginRightLTRSource, eCSSType_Value, PR_TRUE)
CSS_PROP_MARGIN(margin-right-rtl-source, margin_right_rtl_source, X, Margin, mMarginRightRTLSource, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_SHORTHAND(-moz-margin-start, margin_start, MozMarginStart)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_MARGIN(margin-start-value, margin_start_value, X, Margin, mMarginStart, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_MARGIN(margin-top, margin_top, MarginTop, Margin, mMargin.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_CONTENT(marker-offset, marker_offset, MarkerOffset, Content, mMarkerOffset, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(marks, marks, Marks, Page, mMarks, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(max-height, max_height, MaxHeight, Position, mMaxHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(max-width, max_width, MaxWidth, Position, mMaxWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(min-height, min_height, MinHeight, Position, mMinHeight, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(min-width, min_width, MinWidth, Position, mMinWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_DISPLAY(-moz-opacity, opacity, MozOpacity, Display, mOpacity, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(orphans, orphans, Orphans, Breaks, mOrphans, eCSSType_Value, PR_FALSE)
CSS_PROP_NOTIMPLEMENTED(outline, outline, Outline)
CSS_PROP_NOTIMPLEMENTED(outline-color, outline_color, OutlineColor)
CSS_PROP_NOTIMPLEMENTED(outline-style, outline_style, OutlineStyle)
CSS_PROP_NOTIMPLEMENTED(outline-width, outline_width, OutlineWidth)
CSS_PROP_SHORTHAND(-moz-outline, _moz_outline, MozOutline) // XXX This is temporary fix for nsbeta3+ Bug 48973, turning outline into -moz-outline XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-color, _moz_outline_color, MozOutlineColor, Margin, mOutlineColor, eCSSType_Value, PR_FALSE) // XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-style, _moz_outline_style, MozOutlineStyle, Margin, mOutlineStyle, eCSSType_Value, PR_FALSE) // XXX bug 48973
CSS_PROP_OUTLINE(-moz-outline-width, _moz_outline_width, MozOutlineWidth, Margin, mOutlineWidth, eCSSType_Value, PR_TRUE) // XXX bug 48973
CSS_PROP_DISPLAY(overflow, overflow, Overflow, Display, mOverflow, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(padding, padding, Padding)
CSS_PROP_PADDING(padding-bottom, padding_bottom, PaddingBottom, Margin, mPadding.mBottom, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(-moz-padding-end, padding_end, MozPaddingEnd)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_PADDING(padding-end-value, padding_end_value, X, Margin, mPaddingEnd, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_SHORTHAND(padding-left, padding_left, PaddingLeft)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_PADDING(padding-left-value, padding_left_value, X, Margin, mPadding.mLeft, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-left-ltr-source, padding_left_ltr_source, X, Margin, mPaddingLeftLTRSource, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-left-rtl-source, padding_left_rtl_source, X, Margin, mPaddingLeftRTLSource, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_SHORTHAND(padding-right, padding_right, PaddingRight)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_PADDING(padding-right-value, padding_right_value, X, Margin, mPadding.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-right-ltr-source, padding_right_ltr_source, X, Margin, mPaddingRightLTRSource, eCSSType_Value, PR_TRUE)
CSS_PROP_PADDING(padding-right-rtl-source, padding_right_rtl_source, X, Margin, mPaddingRightRTLSource, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_SHORTHAND(-moz-padding-start, padding_start, MozPaddingStart)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_PADDING(padding-start-value, padding_start_value, X, Margin, mPaddingStart, eCSSType_Value, PR_TRUE)
#endif
CSS_PROP_PADDING(padding-top, padding_top, PaddingTop, Margin, mPadding.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(page, page, Page, Breaks, mPage, eCSSType_Value, PR_FALSE)
CSS_PROP_DISPLAY(page-break-after, page_break_after, PageBreakAfter, Display, mBreakAfter, eCSSType_Value, PR_FALSE) // temp fix for bug 24000
CSS_PROP_DISPLAY(page-break-before, page_break_before, PageBreakBefore, Display, mBreakBefore, eCSSType_Value, PR_FALSE) // temp fix for bug 24000
CSS_PROP_BACKENDONLY(page-break-inside, page_break_inside, PageBreakInside, Breaks, mPageBreakInside, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(pause, pause, Pause)
CSS_PROP_BACKENDONLY(pause-after, pause_after, PauseAfter, Aural, mPauseAfter, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pause-before, pause_before, PauseBefore, Aural, mPauseBefore, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pitch, pitch, Pitch, Aural, mPitch, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(pitch-range, pitch_range, PitchRange, Aural, mPitchRange, eCSSType_Value, PR_FALSE)
CSS_PROP_SHORTHAND(play-during, play_during, PlayDuring)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKENDONLY(-x-play-during-flags, play_during_flags, PlayDuringFlags, Aural, mPlayDuringFlags, eCSSType_Value, PR_FALSE) // XXX why is this here?
CSS_PROP_BACKENDONLY(-x-play-during-uri, play_during_uri, PlayDuringURI, Aural, mPlayDuring, eCSSType_Value, PR_FALSE) // XXX why is this here?
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_DISPLAY(position, position, Position, Display, mPosition, eCSSType_Value, PR_FALSE)
CSS_PROP_QUOTES(quotes, quotes, Quotes, Content, mQuotes, eCSSType_Quotes, PR_FALSE)
CSS_PROP_UIRESET(-moz-resizer, resizer, MozResizer, UserInterface, mResizer, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(richness, richness, Richness, Aural, mRichness, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(right, right, Right, Position, mOffset.mRight, eCSSType_Value, PR_TRUE)
CSS_PROP_SHORTHAND(size, size, Size)
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_BACKENDONLY(-x-size-height, size_height, SizeHeight, Page, mSizeHeight, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_BACKENDONLY(-x-size-width, size_width, SizeWidth, Page, mSizeWidth, eCSSType_Value, PR_FALSE) // XXX bug 3935
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
CSS_PROP_BACKENDONLY(speak, speak, Speak, Aural, mSpeak, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-header, speak_header, SpeakHeader, Aural, mSpeakHeader, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-numeral, speak_numeral, SpeakNumeral, Aural, mSpeakNumeral, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speak-punctuation, speak_punctuation, SpeakPunctuation, Aural, mSpeakPunctuation, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(speech-rate, speech_rate, SpeechRate, Aural, mSpeechRate, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(stress, stress, Stress, Aural, mStress, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(table-layout, table_layout, TableLayout, Table, mLayout, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(text-align, text_align, TextAlign, Text, mTextAlign, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXTRESET(text-decoration, text_decoration, TextDecoration, Text, mDecoration, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(text-indent, text_indent, TextIndent, Text, mTextIndent, eCSSType_Value, PR_TRUE)
CSS_PROP_BACKENDONLY(text-shadow, text_shadow, TextShadow, Text, mTextShadow, eCSSType_Shadow, PR_FALSE)
CSS_PROP_TEXT(text-transform, text_transform, TextTransform, Text, mTextTransform, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(top, top, Top, Position, mOffset.mTop, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXTRESET(unicode-bidi, unicode_bidi, UnicodeBidi, Text, mUnicodeBidi, eCSSType_Value, PR_FALSE)
CSS_PROP_USERINTERFACE(-moz-user-focus, user_focus, MozUserFocus, UserInterface, mUserFocus, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_USERINTERFACE(-moz-user-input, user_input, MozUserInput, UserInterface, mUserInput, eCSSType_Value, PR_FALSE) // XXX ??? // XXX bug 3935
CSS_PROP_USERINTERFACE(-moz-user-modify, user_modify, MozUserModify, UserInterface, mUserModify, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_UIRESET(-moz-user-select, user_select, MozUserSelect, UserInterface, mUserSelect, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_TEXTRESET(vertical-align, vertical_align, VerticalAlign, Text, mVerticalAlign, eCSSType_Value, PR_TRUE)
CSS_PROP_VISIBILITY(visibility, visibility, Visibility, Display, mVisibility, eCSSType_Value, PR_FALSE) // reflow for collapse
CSS_PROP_BACKENDONLY(voice-family, voice_family, VoiceFamily, Aural, mVoiceFamily, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(volume, volume, Volume, Aural, mVolume, eCSSType_Value, PR_FALSE)
CSS_PROP_TEXT(white-space, white_space, WhiteSpace, Text, mWhiteSpace, eCSSType_Value, PR_FALSE)
CSS_PROP_BACKENDONLY(widows, widows, Widows, Breaks, mWidows, eCSSType_Value, PR_FALSE)
CSS_PROP_POSITION(width, width, Width, Position, mWidth, eCSSType_Value, PR_TRUE)
CSS_PROP_TEXT(word-spacing, word_spacing, WordSpacing, Text, mWordSpacing, eCSSType_Value, PR_TRUE)
CSS_PROP_POSITION(z-index, z_index, ZIndex, Position, mZIndex, eCSSType_Value, PR_FALSE)
CSS_PROP_XUL(-moz-box-align, box_align, MozBoxAlign, XUL, mBoxAlign, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-direction, box_direction, MozBoxDirection, XUL, mBoxDirection, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-flex, box_flex, MozBoxFlex, XUL, mBoxFlex, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-orient, box_orient, MozBoxOrient, XUL, mBoxOrient, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-pack, box_pack, MozBoxPack, XUL, mBoxPack, eCSSType_Value, PR_FALSE) // XXX bug 3935
CSS_PROP_XUL(-moz-box-ordinal-group, box_ordinal_group, MozBoxOrdinalGroup, XUL, mBoxOrdinal, eCSSType_Value, PR_FALSE)
#ifdef MOZ_SVG
// XXX treat SVG's CSS Properties as internal for now.
// Do we want to create an nsIDOMSVGCSS2Properties interface?
#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL
CSS_PROP_SVGRESET(dominant-baseline, dominant_baseline, DominantBaseline, SVG, mDominantBaseline, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(fill, fill, Fill, SVG, mFill, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(fill-opacity, fill_opacity, FillOpacity, SVG, mFillOpacity, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(fill-rule, fill_rule, FillRule, SVG, mFillRule, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(pointer-events, pointer_events, PointerEvents, SVG, mPointerEvents, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(shape-rendering, shape_rendering, ShapeRendering, SVG, mShapeRendering, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke, stroke, Stroke, SVG, mStroke, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-dasharray, stroke_dasharray, StrokeDasharray, SVG, mStrokeDasharray, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-dashoffset, stroke_dashoffset, StrokeDashoffset, SVG, mStrokeDashoffset, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-linecap, stroke_linecap, StrokeLinecap, SVG, mStrokeLinecap, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-linejoin, stroke_linejoin, StrokeLinejoin, SVG, mStrokeLinejoin, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-miterlimit, stroke_miterlimit, StrokeMiterlimit, SVG, mStrokeMiterlimit, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-opacity, stroke_opacity, StrokeOpacity, SVG, mStrokeOpacity, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(stroke-width, stroke_width, StrokeWidth, SVG, mStrokeWidth, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(text-anchor, text_anchor, TextAnchor, SVG, mTextAnchor, eCSSType_Value, PR_FALSE)
CSS_PROP_SVG(text-rendering, text_rendering, TextRendering, SVG, mTextRendering, eCSSType_Value, PR_FALSE)
#endif /* !defined (CSS_PROP_LIST_EXCLUDE_INTERNAL) */
#endif
// Callers that want information on the properties that are in
// the style structs but not in the nsCSS* structs should define
// |CSS_PROP_INCLUDE_NOT_CSS|. (Some of these are also in nsRuleData*,
// and a distinction might be needed at some point.)
// The first 3 parameters don't matter, but some compilers don't like
// empty arguments to macros.
#ifdef CSS_PROP_INCLUDE_NOT_CSS
CSS_PROP_VISIBILITY(X, X, X, Display, mLang, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(X, X, X, Table, mFrame, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(X, X, X, Table, mRules, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(X, X, X, Table, mCols, eCSSType_Value, PR_FALSE)
CSS_PROP_TABLE(X, X, X, Table, mSpan, eCSSType_Value, PR_FALSE)
#endif /* defined(CSS_PROP_INCLUDE_NOT_CSS) */
#ifdef USED_CSS_PROP
#undef USED_CSS_PROP
#undef CSS_PROP_FONT
#undef CSS_PROP_COLOR
#undef CSS_PROP_BACKGROUND
#undef CSS_PROP_LIST
#undef CSS_PROP_POSITION
#undef CSS_PROP_TEXT
#undef CSS_PROP_TEXTRESET
#undef CSS_PROP_DISPLAY
#undef CSS_PROP_VISIBILITY
#undef CSS_PROP_CONTENT
#undef CSS_PROP_QUOTES
#undef CSS_PROP_USERINTERFACE
#undef CSS_PROP_UIRESET
#undef CSS_PROP_TABLE
#undef CSS_PROP_TABLEBORDER
#undef CSS_PROP_MARGIN
#undef CSS_PROP_PADDING
#undef CSS_PROP_BORDER
#undef CSS_PROP_OUTLINE
#undef CSS_PROP_XUL
#ifdef MOZ_SVG
#undef CSS_PROP_SVG
#undef CSS_PROP_SVGRESET
#endif
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#else /* !defined(USED_CSS_PROP) */
#ifdef DEFINED_CSS_PROP_FONT
#undef CSS_PROP_FONT
#undef DEFINED_CSS_PROP_FONT
#endif
#ifdef DEFINED_CSS_PROP_COLOR
#undef CSS_PROP_COLOR
#undef DEFINED_CSS_PROP_COLOR
#endif
#ifdef DEFINED_CSS_PROP_BACKGROUND
#undef CSS_PROP_BACKGROUND
#undef DEFINED_CSS_PROP_BACKGROUND
#endif
#ifdef DEFINED_CSS_PROP_LIST
#undef CSS_PROP_LIST
#undef DEFINED_CSS_PROP_LIST
#endif
#ifdef DEFINED_CSS_PROP_POSITION
#undef CSS_PROP_POSITION
#undef DEFINED_CSS_PROP_POSITION
#endif
#ifdef DEFINED_CSS_PROP_TEXT
#undef CSS_PROP_TEXT
#undef DEFINED_CSS_PROP_TETEXTRESETT
#endif
#ifdef DEFINED_CSS_PROP_TEXTRESET
#undef CSS_PROP_TEXTRESET
#undef DEFINED_CSS_PROP_TEDISPLAYTRESET
#endif
#ifdef DEFINED_CSS_PROP_DISPLAY
#undef CSS_PROP_DISPLAY
#undef DEFINED_CSS_PROP_DISPLAY
#endif
#ifdef DEFINED_CSS_PROP_VISIBILITY
#undef CSS_PROP_VISIBILITY
#undef DEFINED_CSS_PROP_VISIBILITY
#endif
#ifdef DEFINED_CSS_PROP_CONTENT
#undef CSS_PROP_CONTENT
#undef DEFINED_CSS_PROP_CONTENT
#endif
#ifdef DEFINED_CSS_PROP_QUOTES
#undef CSS_PROP_QUOTES
#undef DEFINED_CSS_PROP_QUOTES
#endif
#ifdef DEFINED_CSS_PROP_USERINTERFACE
#undef CSS_PROP_USERINTERFACE
#undef DEFINED_CSS_PROP_USERINTERFACE
#endif
#ifdef DEFINED_CSS_PROP_UIRESET
#undef CSS_PROP_UIRESET
#undef DEFINED_CSS_PROP_UIRESET
#endif
#ifdef DEFINED_CSS_PROP_TABLE
#undef CSS_PROP_TABLE
#undef DEFINED_CSS_PROP_TABLE
#endif
#ifdef DEFINED_CSS_PROP_TABLEBORDER
#undef CSS_PROP_TABLEBORDER
#undef DEFINED_CSS_PROP_TABLEBORDER
#endif
#ifdef DEFINED_CSS_PROP_MARGIN
#undef CSS_PROP_MARGIN
#undef DEFINED_CSS_PROP_MARGIN
#endif
#ifdef DEFINED_CSS_PROP_PADDING
#undef CSS_PROP_PADDING
#undef DEFINED_CSS_PROP_PADDING
#endif
#ifdef DEFINED_CSS_PROP_BORDER
#undef CSS_PROP_BORDER
#undef DEFINED_CSS_PROP_BORDER
#endif
#ifdef DEFINED_CSS_PROP_OUTLINE
#undef CSS_PROP_OUTLINE
#undef DEFINED_CSS_PROP_OUTLINE
#endif
#ifdef DEFINED_CSS_PROP_XUL
#undef CSS_PROP_XUL
#undef DEFINED_CSS_PROP_XUL
#endif
#ifdef MOZ_SVG
#ifdef DEFINED_CSS_PROP_SVG
#undef CSS_PROP_SVG
#undef DEFINED_CSS_PROP_SVG
#endif
#ifdef DEFINED_CSS_PROP_SVGRESET
#undef CSS_PROP_SVGRESET
#undef DEFINED_CSS_PROP_SVGRESET
#endif
#endif /* defined(MOZ_SVG) */
#ifdef DEFINED_CSS_PROP_BACKENDONLY
#undef CSS_PROP_BACKENDONLY
#undef DEFINED_CSS_PROP_BACKENDONLY
#endif
#endif /* !defined(USED_CSS_PROP) */
#ifdef DEFINED_CSS_PROP_NOTIMPLEMENTED
#undef CSS_PROP_NOTIMPLEMENTED
#undef DEFINED_CSS_PROP_NOTIMPLEMENTED
#endif
#ifdef DEFINED_CSS_PROP_SHORTHAND
#undef CSS_PROP_SHORTHAND
#undef DEFINED_CSS_PROP_SHORTHAND
#endif

View File

@@ -1,180 +0,0 @@
/* -*- 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 nsCSSProps_h___
#define nsCSSProps_h___
#include "nsString.h"
#include "nsChangeHint.h"
#include "nsCSSProperty.h"
#include "nsStyleStruct.h"
class nsCSSProps {
public:
static void AddRefTable(void);
static void ReleaseTable(void);
// Given a property string, return the enum value
static nsCSSProperty LookupProperty(const nsAString& aProperty);
static nsCSSProperty LookupProperty(const nsACString& aProperty);
static inline PRBool IsShorthand(nsCSSProperty aProperty) {
NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT,
"out of range");
return (aProperty >= eCSSProperty_COUNT_no_shorthands);
}
// Given a property enum, get the string value
static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
// Given a CSS Property and a Property Enum Value
// Return back a const nsString& representation of the
// value. Return back nullstr if no value is found
static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue);
// Get a color name for a predefined color value like buttonhighlight or activeborder
// Sets the aStr param to the name of the propertyID
static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr);
static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]);
static const nsAFlatCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const nsCSSType kTypeTable[eCSSProperty_COUNT_no_shorthands];
static const nsStyleStructID kSIDTable[eCSSProperty_COUNT_no_shorthands];
// A table for shorthand properties. The appropriate index is the
// property ID minus eCSSProperty_COUNT_no_shorthands.
private:
static const nsCSSProperty *const
kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands];
public:
static inline
const nsCSSProperty *const SubpropertyEntryFor(nsCSSProperty aProperty) {
NS_ASSERTION(eCSSProperty_COUNT_no_shorthands <= aProperty &&
aProperty < eCSSProperty_COUNT,
"out of range");
return nsCSSProps::kSubpropertyTable[aProperty -
eCSSProperty_COUNT_no_shorthands];
}
#define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(iter_, prop_) \
for (const nsCSSProperty* iter_ = nsCSSProps::SubpropertyEntryFor(prop_); \
*iter_ != eCSSProperty_UNKNOWN; ++iter_)
// Keyword/Enum value tables
static const PRInt32 kAppearanceKTable[];
static const PRInt32 kAzimuthKTable[];
static const PRInt32 kBackgroundAttachmentKTable[];
static const PRInt32 kBackgroundClipKTable[];
static const PRInt32 kBackgroundColorKTable[];
static const PRInt32 kBackgroundInlinePolicyKTable[];
static const PRInt32 kBackgroundOriginKTable[];
static const PRInt32 kBackgroundRepeatKTable[];
static const PRInt32 kBackgroundXPositionKTable[];
static const PRInt32 kBackgroundYPositionKTable[];
static const PRInt32 kBorderCollapseKTable[];
static const PRInt32 kBorderColorKTable[];
static const PRInt32 kBorderStyleKTable[];
static const PRInt32 kBorderWidthKTable[];
static const PRInt32 kBoxAlignKTable[];
static const PRInt32 kBoxDirectionKTable[];
static const PRInt32 kBoxOrientKTable[];
static const PRInt32 kBoxPackKTable[];
#ifdef MOZ_SVG
static const PRInt32 kDominantBaselineKTable[];
static const PRInt32 kFillRuleKTable[];
static const PRInt32 kPointerEventsKTable[];
static const PRInt32 kShapeRenderingKTable[];
static const PRInt32 kStrokeLinecapKTable[];
static const PRInt32 kStrokeLinejoinKTable[];
static const PRInt32 kTextAnchorKTable[];
static const PRInt32 kTextRenderingKTable[];
#endif
static const PRInt32 kBoxPropSourceKTable[];
static const PRInt32 kBoxSizingKTable[];
static const PRInt32 kCaptionSideKTable[];
static const PRInt32 kClearKTable[];
static const PRInt32 kColorKTable[];
static const PRInt32 kContentKTable[];
static const PRInt32 kCursorKTable[];
static const PRInt32 kDirectionKTable[];
static const PRInt32 kDisplayKTable[];
static const PRInt32 kElevationKTable[];
static const PRInt32 kEmptyCellsKTable[];
static const PRInt32 kFloatKTable[];
static const PRInt32 kFloatEdgeKTable[];
static const PRInt32 kFontKTable[];
static const PRInt32 kFontSizeKTable[];
static const PRInt32 kFontStretchKTable[];
static const PRInt32 kFontStyleKTable[];
static const PRInt32 kFontVariantKTable[];
static const PRInt32 kFontWeightKTable[];
static const PRInt32 kKeyEquivalentKTable[];
static const PRInt32 kListStylePositionKTable[];
static const PRInt32 kListStyleKTable[];
static const PRInt32 kOutlineColorKTable[];
static const PRInt32 kOverflowKTable[];
static const PRInt32 kPageBreakKTable[];
static const PRInt32 kPageBreakInsideKTable[];
static const PRInt32 kPageMarksKTable[];
static const PRInt32 kPageSizeKTable[];
static const PRInt32 kPitchKTable[];
static const PRInt32 kPlayDuringKTable[];
static const PRInt32 kPositionKTable[];
static const PRInt32 kResizerKTable[];
static const PRInt32 kSpeakKTable[];
static const PRInt32 kSpeakHeaderKTable[];
static const PRInt32 kSpeakNumeralKTable[];
static const PRInt32 kSpeakPunctuationKTable[];
static const PRInt32 kSpeechRateKTable[];
static const PRInt32 kTableLayoutKTable[];
static const PRInt32 kTextAlignKTable[];
static const PRInt32 kTextDecorationKTable[];
static const PRInt32 kTextTransformKTable[];
static const PRInt32 kUnicodeBidiKTable[];
static const PRInt32 kUserFocusKTable[];
static const PRInt32 kUserInputKTable[];
static const PRInt32 kUserModifyKTable[];
static const PRInt32 kUserSelectKTable[];
static const PRInt32 kVerticalAlignKTable[];
static const PRInt32 kVisibilityKTable[];
static const PRInt32 kVolumeKTable[];
static const PRInt32 kWhitespaceKTable[];
};
#endif /* nsCSSProps_h___ */

View File

@@ -1,575 +0,0 @@
/* -*- 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):
* Original Author: David W. Hyatt (hyatt@netscape.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 ***** */
#ifndef nsRuleNode_h___
#define nsRuleNode_h___
#include "nsCOMPtr.h"
#include "nsIStyleRule.h"
#include "nsFixedSizeAllocator.h"
#include "nsIPresContext.h"
#include "nsCSSStruct.h"
#include "nsILanguageAtomService.h"
#include "nsStyleStruct.h"
class nsStyleContext;
struct nsRuleList;
struct PLDHashTable;
typedef void (*nsPostResolveFunc)(nsStyleStruct* aStyleStruct, nsRuleData* aData);
struct nsInheritedStyleData
{
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args) \
nsStyle##name * m##name##Data;
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_INHERITED
#undef STYLE_STRUCT_RESET
void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
return result;
};
void ClearInheritedData(PRUint32 aBits) {
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args) \
if (m##name##Data && (aBits & NS_STYLE_INHERIT_BIT(name))) \
m##name##Data = nsnull;
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_INHERITED
#undef STYLE_STRUCT_RESET
};
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args) \
if (m##name##Data && !(aBits & NS_STYLE_INHERIT_BIT(name))) \
m##name##Data->Destroy(aContext);
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_INHERITED
#undef STYLE_STRUCT_RESET
aContext->FreeToShell(sizeof(nsInheritedStyleData), this);
};
nsInheritedStyleData() {
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args) \
m##name##Data = nsnull;
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_INHERITED
#undef STYLE_STRUCT_RESET
};
};
struct nsResetStyleData
{
nsResetStyleData()
{
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args) \
m##name##Data = nsnull;
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
};
void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
return result;
}
void ClearInheritedData(PRUint32 aBits) {
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args) \
if (m##name##Data && (aBits & NS_STYLE_INHERIT_BIT(name))) \
m##name##Data = nsnull;
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
};
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args) \
if (m##name##Data && !(aBits & NS_STYLE_INHERIT_BIT(name))) \
m##name##Data->Destroy(aContext);
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
aContext->FreeToShell(sizeof(nsResetStyleData), this);
};
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args) \
nsStyle##name * m##name##Data;
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
#undef STYLE_STRUCT_INHERITED
};
struct nsCachedStyleData
{
struct StyleStructInfo {
ptrdiff_t mCachedStyleDataOffset;
ptrdiff_t mInheritResetOffset;
PRBool mIsReset;
};
static StyleStructInfo gInfo[];
nsInheritedStyleData* mInheritedData;
nsResetStyleData* mResetData;
static PRBool IsReset(const nsStyleStructID& aSID) {
return gInfo[aSID].mIsReset;
};
static PRUint32 GetBitForSID(const nsStyleStructID& aSID) {
return 1 << aSID;
};
nsStyleStruct* GetStyleData(const nsStyleStructID& aSID) {
// Each struct is stored at this.m##type##Data->m##name##Data where
// |type| is either Inherit or Reset, and |name| is the name of the
// style struct. The |gInfo| stores the offset of the appropriate
// m##type##Data for the struct within nsCachedStyleData (|this|)
// and the offset of the appropriate m##name##Data within the
// m##type##Data. Note that if we don't have any reset structs,
// then mResetData is null, and likewise for mInheritedData. This
// saves us from having to go through the long if-else cascade into
// which most compilers will turn a case statement.
// NOTE: nsStyleContext::SetStyle works roughly the same way.
const StyleStructInfo& info = gInfo[aSID];
// Get either &mInheritedData or &mResetData.
char* resetOrInheritSlot = NS_REINTERPRET_CAST(char*, this) + info.mCachedStyleDataOffset;
// Get either mInheritedData or mResetData.
char* resetOrInherit = NS_REINTERPRET_CAST(char*, *NS_REINTERPRET_CAST(void**, resetOrInheritSlot));
nsStyleStruct* data = nsnull;
if (resetOrInherit) {
// If we have the mInheritedData or mResetData, then we might have
// the struct, so get it.
char* dataSlot = resetOrInherit + info.mInheritResetOffset;
data = *NS_REINTERPRET_CAST(nsStyleStruct**, dataSlot);
}
return data;
};
void ClearInheritedData(PRUint32 aBits) {
if (mResetData)
mResetData->ClearInheritedData(aBits);
if (mInheritedData)
mInheritedData->ClearInheritedData(aBits);
}
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
if (mResetData)
mResetData->Destroy(aBits, aContext);
if (mInheritedData)
mInheritedData->Destroy(aBits, aContext);
mResetData = nsnull;
mInheritedData = nsnull;
}
nsCachedStyleData() :mInheritedData(nsnull), mResetData(nsnull) {};
~nsCachedStyleData() {};
};
struct nsRuleData
{
nsStyleStructID mSID;
PRPackedBool mCanStoreInRuleTree;
nsIPresContext* mPresContext;
nsStyleContext* mStyleContext;
nsPostResolveFunc mPostResolveCallback;
nsRuleDataFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsRuleDataDisplay* mDisplayData;
nsRuleDataMargin* mMarginData;
nsRuleDataList* mListData;
nsRuleDataPosition* mPositionData;
nsRuleDataTable* mTableData;
nsRuleDataColor* mColorData;
nsRuleDataContent* mContentData;
nsRuleDataText* mTextData;
nsRuleDataUserInterface* mUserInterfaceData;
nsRuleDataXUL* mXULData;
#ifdef MOZ_SVG
nsRuleDataSVG* mSVGData;
#endif
nsRuleData(const nsStyleStructID& aSID, nsIPresContext* aContext, nsStyleContext* aStyleContext)
:mSID(aSID), mPresContext(aContext), mStyleContext(aStyleContext), mPostResolveCallback(nsnull),
mFontData(nsnull), mDisplayData(nsnull), mMarginData(nsnull), mListData(nsnull),
mPositionData(nsnull), mTableData(nsnull), mColorData(nsnull), mContentData(nsnull), mTextData(nsnull),
mUserInterfaceData(nsnull)
{
mCanStoreInRuleTree = PR_TRUE;
mXULData = nsnull;
#ifdef MOZ_SVG
mSVGData = nsnull;
#endif
};
~nsRuleData() {};
};
class nsRuleNode {
public:
// for purposes of the RuleDetail (and related code),
// * a non-inherited value is one that is specified as a
// non-"inherit" value or as an "inherit" value that is reflected
// in the struct and to the user of the style system with an
// eCSSUnit_Inherit value
// * an inherited value is one that is specified as "inherit" and
// where the inheritance is computed by the style system
enum RuleDetail {
eRuleNone, // No props have been specified at all.
eRulePartialReset, // At least one prop with a non-inherited value
// has been specified. No props have been
// specified with an inherited value. At least
// one prop remains unspecified.
eRulePartialMixed, // At least one prop with a non-inherited value
// has been specified. Some props may also have
// been specified with an inherited value. At
// least one prop remains unspecified.
eRulePartialInherited, // Only props with inherited values have
// have been specified. At least one prop
// remains unspecified.
eRuleFullReset, // All props have been specified. None has an
// inherited value.
eRuleFullMixed, // All props have been specified. At least one has
// a non-inherited value.
eRuleFullInherited, // All props have been specified with inherited
// values.
eRuleUnknown // Information unknown (used as a result from a check
// callback to trigger the normal checking codepath)
};
private:
nsIPresContext* mPresContext; // Our pres context.
nsRuleNode* mParent; // A pointer to the parent node in the tree.
// This enables us to walk backwards from the
// most specific rule matched to the least
// specific rule (which is the optimal order to
// use for lookups of style properties.
nsCOMPtr<nsIStyleRule> mRule; // A pointer to our specific rule.
// The children of this node are stored in either a hashtable or list
// that maps from rules to our nsRuleNode children. When matching
// rules, we use this mapping to transition from node to node
// (constructing new nodes as needed to flesh out the tree).
void *mChildrenTaggedPtr; // Accessed only through the methods below.
enum {
kTypeMask = 0x1,
kListType = 0x0,
kHashType = 0x1
};
enum {
// Maximum to have in a list before converting to a hashtable.
// XXX Need to optimize this.
kMaxChildrenInList = 32
};
PRBool HaveChildren() {
return mChildrenTaggedPtr != nsnull;
}
PRBool ChildrenAreHashed() {
return (PRWord(mChildrenTaggedPtr) & kTypeMask) == kHashType;
}
nsRuleList* ChildrenList() {
return NS_REINTERPRET_CAST(nsRuleList*, mChildrenTaggedPtr);
}
nsRuleList** ChildrenListPtr() {
return NS_REINTERPRET_CAST(nsRuleList**, &mChildrenTaggedPtr);
}
PLDHashTable* ChildrenHash() {
return (PLDHashTable*) (PRWord(mChildrenTaggedPtr) & ~PRWord(kTypeMask));
}
void SetChildrenList(nsRuleList *aList) {
NS_ASSERTION(!(PRWord(aList) & kTypeMask),
"pointer not 2-byte aligned");
mChildrenTaggedPtr = aList;
}
void SetChildrenHash(PLDHashTable *aHashtable) {
NS_ASSERTION(!(PRWord(aHashtable) & kTypeMask),
"pointer not 2-byte aligned");
mChildrenTaggedPtr = (void*)(PRWord(aHashtable) | kHashType);
}
void ConvertChildrenToHash();
nsCachedStyleData mStyleData; // Any data we cached on the rule node.
PRUint32 mDependentBits; // Used to cache the fact that we can look up
// cached data under a parent rule.
PRUint32 mNoneBits; // Used to cache the fact that the branch to this
// node specifies no non-inherited data for a
// given struct type. (This usually implies that
// the entire branch specifies no non-inherited
// data, although not necessarily, if a
// non-inherited value is overridden by an
// explicit 'inherit' value.) For example, if an
// entire rule branch specifies no color
// information, then a bit will be set along every
// rule node on that branch, so that you can break
// out of the rule tree early and just inherit
// from the parent style context. The presence of
// this bit means we should just get inherited
// data from the parent style context, and it is
// never used for reset structs since their
// Compute*Data functions don't initialize from
// inherited data.
friend struct nsRuleList;
public:
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
// (which comes from the presShell) to perform the allocation.
void* operator new(size_t sz, nsIPresContext* aContext) CPP_THROW_NEW;
void Destroy();
static nsILanguageAtomService *gLangService;
protected:
void PropagateDependentBit(PRUint32 aBit, nsRuleNode* aHighestNode);
void PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode);
const nsStyleStruct* SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContext);
const nsStyleStruct* WalkRuleTree(const nsStyleStructID aSID, nsStyleContext* aContext,
nsRuleData* aRuleData,
nsRuleDataStruct* aSpecificData);
const nsStyleStruct* ComputeDisplayData(nsStyleStruct* aStartDisplay, const nsRuleDataStruct& aDisplayData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeVisibilityData(nsStyleStruct* aStartVisibility, const nsRuleDataStruct& aDisplayData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeFontData(nsStyleStruct* aStartFont, const nsRuleDataStruct& aFontData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeColorData(nsStyleStruct* aStartColor, const nsRuleDataStruct& aColorData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBackgroundData(nsStyleStruct* aStartBackground, const nsRuleDataStruct& aColorData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeMarginData(nsStyleStruct* aStartMargin, const nsRuleDataStruct& aMarginData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBorderData(nsStyleStruct* aStartBorder, const nsRuleDataStruct& aMarginData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePaddingData(nsStyleStruct* aStartPadding, const nsRuleDataStruct& aMarginData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeOutlineData(nsStyleStruct* aStartOutline, const nsRuleDataStruct& aMarginData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeListData(nsStyleStruct* aStartList, const nsRuleDataStruct& aListData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePositionData(nsStyleStruct* aStartPosition, const nsRuleDataStruct& aPositionData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableData(nsStyleStruct* aStartTable, const nsRuleDataStruct& aTableData,
nsStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableBorderData(nsStyleStruct* aStartTable, const nsRuleDataStruct& aTableData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeContentData(nsStyleStruct* aStartContent, const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeQuotesData(nsStyleStruct* aStartQuotes, const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextResetData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeUserInterfaceData(nsStyleStruct* aStartData,
const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail,
PRBool aInherited);
const nsStyleStruct* ComputeUIResetData(nsStyleStruct* aStartData, const nsRuleDataStruct& aData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeXULData(nsStyleStruct* aStartXUL, const nsRuleDataStruct& aXULData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#ifdef MOZ_SVG
const nsStyleStruct* ComputeSVGData(nsStyleStruct* aStartSVG, const nsRuleDataStruct& aSVGData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeSVGResetData(nsStyleStruct* aStartSVG, const nsRuleDataStruct& aSVGData,
nsStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#endif
// helpers for |ComputeFontData| that need access to |mNoneBits|:
static void SetFont(nsIPresContext* aPresContext, nsStyleContext* aContext,
nscoord aMinFontSize, PRBool aUseDocumentFonts,
PRBool aIsGeneric, const nsRuleDataFont& aFontData,
const nsFont& aDefaultFont,
const nsStyleFont* aParentFont,
nsStyleFont* aFont, PRBool& aInherited);
static void SetGenericFont(nsIPresContext* aPresContext,
nsStyleContext* aContext,
const nsRuleDataFont& aFontData,
PRUint8 aGenericFontID, nscoord aMinFontSize,
PRBool aUseDocumentFonts, nsStyleFont* aFont);
void AdjustLogicalBoxProp(nsStyleContext* aContext,
const nsCSSValue& aLTRSource,
const nsCSSValue& aRTLSource,
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
const nsStyleSides& aParentRect,
nsStyleSides& aRect,
PRUint8 aSide,
PRInt32 aMask,
PRBool& aInherited);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
const nsStyleStruct* GetParentData(const nsStyleStructID aSID);
const nsStyleStruct* GetDisplayData(nsStyleContext* aContext);
const nsStyleStruct* GetVisibilityData(nsStyleContext* aContext);
const nsStyleStruct* GetFontData(nsStyleContext* aContext);
const nsStyleStruct* GetColorData(nsStyleContext* aContext);
const nsStyleStruct* GetBackgroundData(nsStyleContext* aContext);
const nsStyleStruct* GetMarginData(nsStyleContext* aContext);
const nsStyleStruct* GetBorderData(nsStyleContext* aContext);
const nsStyleStruct* GetPaddingData(nsStyleContext* aContext);
const nsStyleStruct* GetOutlineData(nsStyleContext* aContext);
const nsStyleStruct* GetListData(nsStyleContext* aContext);
const nsStyleStruct* GetPositionData(nsStyleContext* aContext);
const nsStyleStruct* GetTableData(nsStyleContext* aContext);
const nsStyleStruct* GetTableBorderData(nsStyleContext* aContext);
const nsStyleStruct* GetContentData(nsStyleContext* aContext);
const nsStyleStruct* GetQuotesData(nsStyleContext* aContext);
const nsStyleStruct* GetTextData(nsStyleContext* aContext);
const nsStyleStruct* GetTextResetData(nsStyleContext* aContext);
const nsStyleStruct* GetUserInterfaceData(nsStyleContext* aContext);
const nsStyleStruct* GetUIResetData(nsStyleContext* aContext);
const nsStyleStruct* GetXULData(nsStyleContext* aContext);
#ifdef MOZ_SVG
const nsStyleStruct* GetSVGData(nsStyleContext* aContext);
const nsStyleStruct* GetSVGResetData(nsStyleContext* aContext);
#endif
public:
nsRuleNode(nsIPresContext* aPresContext, nsIStyleRule* aRule,
nsRuleNode* aParent);
virtual ~nsRuleNode();
static nsRuleNode* CreateRootNode(nsIPresContext* aPresContext);
nsresult Transition(nsIStyleRule* aRule, nsRuleNode** aResult);
nsRuleNode* GetParent() const { return mParent; }
PRBool IsRoot() const { return mParent == nsnull; }
// NOTE: Does not |AddRef|.
nsIStyleRule* GetRule() const { return mRule; }
// NOTE: Does not |AddRef|.
nsIPresContext* GetPresContext() const { return mPresContext; }
nsresult ClearStyleData();
const nsStyleStruct* GetStyleData(nsStyleStructID aSID,
nsStyleContext* aContext,
PRBool aComputeData);
/*
* Garbage collection. Mark walks up the tree, marking any unmarked
* ancestors until it reaches a marked one. Sweep recursively sweeps
* the children, destroys any that are unmarked, and clears marks,
* returning true if the node on which it was called was destroyed.
*/
void Mark();
PRBool Sweep();
};
#endif

View File

@@ -1,145 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Rod Spears (rods@netscape.com)
*
* Contributor(s):
*/
/******
This file contains the list of all SVG nsIAtoms and their values
It is designed to be used as inline input to nsSVGAtoms.cpp *only*
through the magic of C preprocessing.
All entires must be enclosed in the macro SVG_ATOM which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
The first argument to SVG_ATOM is the C++ identifier of the atom
The second argument is the string value of the atom
******/
// tags
SVG_ATOM(circle, "circle")
SVG_ATOM(defs, "defs")
SVG_ATOM(ellipse, "ellipse")
SVG_ATOM(foreignObject, "foreignObject")
SVG_ATOM(g, "g")
SVG_ATOM(generic, "generic")
SVG_ATOM(image, "image")
SVG_ATOM(line, "line")
SVG_ATOM(path, "path")
SVG_ATOM(polygon, "polygon")
SVG_ATOM(polyline, "polyline")
SVG_ATOM(rect, "rect")
SVG_ATOM(svg, "svg")
SVG_ATOM(text, "text")
SVG_ATOM(tref, "tref")
SVG_ATOM(tspan, "tspan")
// properties
SVG_ATOM(alignment_baseline, "alignment-baseline")
SVG_ATOM(baseline_shift, "baseline-shift")
SVG_ATOM(clip_path, "clip-path")
SVG_ATOM(clip_rule, "clip-rule")
SVG_ATOM(cursor, "cursor")
SVG_ATOM(cx, "cx")
SVG_ATOM(cy, "cy")
SVG_ATOM(d, "d")
SVG_ATOM(direction, "direction")
SVG_ATOM(display, "display")
SVG_ATOM(dominant_baseline, "dominant-baseline")
SVG_ATOM(fill, "fill")
SVG_ATOM(fill_opacity, "fill-opacity")
SVG_ATOM(fill_rule, "fill-rule")
SVG_ATOM(filter, "filter")
SVG_ATOM(font_family, "font-family")
SVG_ATOM(font_size, "font-size")
SVG_ATOM(font_size_adjust, "font-size-adjust")
SVG_ATOM(font_stretch, "font-stretch")
SVG_ATOM(font_style, "font-style")
SVG_ATOM(font_variant, "font-variant")
SVG_ATOM(font_weight, "font-weight")
SVG_ATOM(glyph_orientation_horizontal, "glyph-orientation-horizontal")
SVG_ATOM(glyph_orientation_vertical, "glyph-orientation-vertical")
SVG_ATOM(height, "height")
SVG_ATOM(href, "href")
SVG_ATOM(id, "id")
SVG_ATOM(image_rendering, "image-rendering")
SVG_ATOM(kerning, "kerning")
SVG_ATOM(letter_spacing, "letter-spacing")
SVG_ATOM(mask, "mask")
SVG_ATOM(opacity, "opacity")
SVG_ATOM(pathLength, "pathLength")
SVG_ATOM(pointer_events, "pointer-events")
SVG_ATOM(points, "points")
SVG_ATOM(r, "r")
SVG_ATOM(rx, "rx")
SVG_ATOM(ry, "ry")
SVG_ATOM(shape_rendering, "shape-rendering")
SVG_ATOM(stroke, "stroke")
SVG_ATOM(stroke_dasharray, "stroke-dasharray")
SVG_ATOM(stroke_dashoffset, "stroke-dashoffset")
SVG_ATOM(stroke_linecap, "stroke-linecap")
SVG_ATOM(stroke_linejoin, "stroke-linejoin")
SVG_ATOM(stroke_miterlimit, "stroke-miterlimit")
SVG_ATOM(stroke_opacity, "stroke-opacity")
SVG_ATOM(stroke_width, "stroke-width")
SVG_ATOM(style, "style")
SVG_ATOM(text_anchor, "text-anchor")
SVG_ATOM(text_decoration, "text-decoration")
SVG_ATOM(text_rendering, "text-rendering")
SVG_ATOM(transform, "transform")
SVG_ATOM(unicode_bidi, "unicode-bidi")
SVG_ATOM(viewBox, "viewBox")
SVG_ATOM(visibility, "visibility")
SVG_ATOM(width, "width")
SVG_ATOM(word_spacing, "word-spacing")
SVG_ATOM(x, "x")
SVG_ATOM(x1, "x1")
SVG_ATOM(x2, "x2")
SVG_ATOM(y, "y")
SVG_ATOM(y1, "y1")
SVG_ATOM(y2, "y2")
// transformation keywords
SVG_ATOM(matrix, "matrix")
SVG_ATOM(rotate, "rotate")
SVG_ATOM(scale, "scale")
SVG_ATOM(skewX, "skewX")
SVG_ATOM(skewY, "skewY")
SVG_ATOM(translate, "translate")
// length units
SVG_ATOM(cm, "cm")
SVG_ATOM(ems, "em")
SVG_ATOM(exs, "ex")
SVG_ATOM(in, "in")
SVG_ATOM(mm, "mm")
SVG_ATOM(pc, "pc")
SVG_ATOM(percentage, "%")
SVG_ATOM(pt, "pt")
SVG_ATOM(px, "px")

File diff suppressed because it is too large Load Diff

View File

@@ -1,165 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:cindent:ts=8:et:sw=4:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* This file is intended to be used by different parts of the code, with
* the STYLE_STRUCT macro (or the STYLE_STRUCT_INHERITED and
* STYLE_STRUCT_RESET pair of macros) defined in different ways.
*/
#ifndef STYLE_STRUCT_INHERITED
#define STYLE_STRUCT_INHERITED(name, checkdata_cb, ctor_args) \
STYLE_STRUCT(name, checkdata_cb, ctor_args)
#define UNDEF_STYLE_STRUCT_INHERITED
#endif
#ifndef STYLE_STRUCT_RESET
#define STYLE_STRUCT_RESET(name, checkdata_cb, ctor_args) \
STYLE_STRUCT(name, checkdata_cb, ctor_args)
#define UNDEF_STYLE_STRUCT_RESET
#endif
#ifdef STYLE_STRUCT_TEST
#define STYLE_STRUCT_TEST_CODE(c) c
#else
#define STYLE_STRUCT_TEST_CODE(c)
#endif
STYLE_STRUCT_TEST_CODE(if (STYLE_STRUCT_TEST < 8) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST < 4) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST < 2) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 0) {)
STYLE_STRUCT_INHERITED(Font, CheckFontCallback, (SSARG_PRESCONTEXT))
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_INHERITED(Color, nsnull, (SSARG_PRESCONTEXT))
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 2) {)
STYLE_STRUCT_RESET(Background, nsnull, (SSARG_PRESCONTEXT))
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_INHERITED(List, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST < 6) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 4) {)
STYLE_STRUCT_RESET(Position, nsnull, ())
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_INHERITED(Text, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 6) {)
STYLE_STRUCT_RESET(TextReset, nsnull, ())
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_RESET(Display, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE(} else if (STYLE_STRUCT_TEST < 16) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST < 12) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST < 10) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 8) {)
STYLE_STRUCT_INHERITED(Visibility, nsnull, (SSARG_PRESCONTEXT))
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_RESET(Content, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 10) {)
STYLE_STRUCT_INHERITED(Quotes, nsnull, ())
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_INHERITED(UserInterface, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST < 14) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 12) {)
STYLE_STRUCT_RESET(UIReset, nsnull, ())
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_RESET(Table, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 14) {)
STYLE_STRUCT_INHERITED(TableBorder, nsnull, (SSARG_PRESCONTEXT))
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_RESET(Margin, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE(} else {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST < 18) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 16) {)
STYLE_STRUCT_RESET(Padding, nsnull, ())
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_RESET(Border, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
#ifndef MOZ_SVG
STYLE_STRUCT_TEST_CODE( } else if (STYLE_STRUCT_TEST == 18) {)
STYLE_STRUCT_RESET(Outline, nsnull, (SSARG_PRESCONTEXT))
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( NS_ASSERTION(STYLE_STRUCT_TEST == 19, "out of range");)
STYLE_STRUCT_RESET(XUL, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE(})
#else // MOZ_SVG
STYLE_STRUCT_TEST_CODE( } else if (STYLE_STRUCT_TEST < 20) {)
STYLE_STRUCT_TEST_CODE( if (STYLE_STRUCT_TEST == 18) {)
STYLE_STRUCT_RESET(Outline, nsnull, (SSARG_PRESCONTEXT))
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_RESET(XUL, nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE( } else if (STYLE_STRUCT_TEST == 20) {)
STYLE_STRUCT_INHERITED(SVG, nsnull, ())
STYLE_STRUCT_TEST_CODE( } else {)
STYLE_STRUCT_TEST_CODE( NS_ASSERTION(STYLE_STRUCT_TEST == 21, "out of range");)
STYLE_STRUCT_RESET(SVGReset,nsnull, ())
STYLE_STRUCT_TEST_CODE( })
STYLE_STRUCT_TEST_CODE(})
#endif
#ifdef UNDEF_STYLE_STRUCT_INHERITED
#undef STYLE_STRUCT_INHERITED
#undef UNDEF_STYLE_STRUCT_INHERITED
#endif
#ifdef UNDEF_STYLE_STRUCT_RESET
#undef STYLE_STRUCT_RESET
#undef UNDEF_STYLE_STRUCT_RESET
#endif
#undef STYLE_STRUCT_TEST_CODE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,116 +0,0 @@
#
# The contents of this file are subject to the Mozilla 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/MPL/
#
# 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 Crocodile Clips Ltd code.
#
# The Initial Developer of the Original Code is
# Crocodile Clips Ltd. Portions created by Crocodile Clips are
# Copyright (C) 2001 Crocodile Clips Ltd. All
# Rights Reserved.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = content
LIBRARY_NAME = gkcontentsvg_s
REQUIRES = xpcom \
string \
layout \
content \
widget \
gfx \
dom \
js \
locale \
htmlparser \
view \
pref \
necko \
xpconnect \
webshell
CPPSRCS = \
nsSVGAnimatedLength.cpp \
nsSVGAnimatedLengthList.cpp \
nsSVGAnimatedRect.cpp \
nsSVGAnimatedString.cpp \
nsSVGAnimatedTransformList.cpp \
nsSVGAttributes.cpp \
nsSVGCircleElement.cpp \
nsSVGElement.cpp \
nsSVGElementFactory.cpp \
nsSVGEllipseElement.cpp \
nsSVGForeignObjectElement.cpp \
nsSVGGElement.cpp \
nsSVGGenericStringValue.cpp \
nsSVGGraphicElement.cpp \
nsSVGImageElement.cpp \
nsSVGLength.cpp \
nsSVGLengthList.cpp \
nsSVGLineElement.cpp \
nsSVGMatrix.cpp \
nsSVGNumber.cpp \
nsSVGPathDataParser.cpp \
nsSVGPathElement.cpp \
nsSVGPathSeg.cpp \
nsSVGPathSegList.cpp \
nsSVGPoint.cpp \
nsSVGPointList.cpp \
nsSVGPolygonElement.cpp \
nsSVGPolylineElement.cpp \
nsSVGStringProxyValue.cpp \
nsSVGRect.cpp \
nsSVGRectElement.cpp \
nsSVGSVGElement.cpp \
nsSVGStyleValue.cpp \
nsSVGTSpanElement.cpp \
nsSVGTextElement.cpp \
nsSVGTransform.cpp \
nsSVGTransformList.cpp \
nsSVGValue.cpp \
nsSVGViewportRect.cpp \
$(NULL)
include $(topsrcdir)/config/config.mk
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
EXPORTS = \
nsISVGAttribute.h \
nsISVGStyleValue.h \
nsISVGTextContentMetrics.h \
nsISVGValue.h \
nsISVGValueObserver.h \
nsISVGValueUtils.h \
nsSVGTypeCIDs.h \
nsISVGContent.h \
$(NULL)
include $(topsrcdir)/config/rules.mk
INCLUDES += \
-I$(srcdir)/../../../shared/public \
-I$(srcdir)/../../../html/base/src \
-I$(srcdir)/../../../xml/content/src \
-I$(srcdir)/../../../../dom \
-I$(srcdir)/../../../base/src \
-I$(srcdir)/../../../../layout/svg/base/src \
-I$(srcdir)/../../../html/style/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

View File

@@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGCONTENT__
#define __NS_ISVGCONTENT__
#include "nsISupports.h"
////////////////////////////////////////////////////////////////////////
// nsISVGContent
// {4473C9A8-4376-48A5-BF99-D5820A1FF14E}
#define NS_ISVGCONTENT_IID \
{ 0x4473c9a8, 0x4376, 0x48a5, { 0xbf, 0x99, 0xd5, 0x82, 0x0a, 0x1f, 0xf1, 0x4e } }
class nsISVGContent : public nsISupports
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGCONTENT_IID; return iid; }
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval)=0;
};
#endif // __NS_ISVGCONTENT__

View File

@@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGLENGTH_H__
#define __NS_ISVGLENGTH_H__
#include "nsIDOMSVGLength.h"
class nsISVGViewportAxis;
////////////////////////////////////////////////////////////////////////
// nsISVGLength: private interface for svg lengths
// {4DA3041C-7A32-4F81-A44F-E468D025AD7C}
#define NS_ISVGLENGTH_IID \
{ 0x4da3041c, 0x7a32, 0x4f81, { 0xa4, 0x4f, 0xe4, 0x68, 0xd0, 0x25, 0xad, 0x7c } }
class nsISVGLength : public nsIDOMSVGLength
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGLENGTH_IID; return iid; }
NS_IMETHOD SetContext(nsISVGViewportAxis* axis)=0;
};
#endif // __NS_ISVGLENGTH_H__

View File

@@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGLENGTHLIST_H__
#define __NS_ISVGLENGTHLIST_H__
#include "nsIDOMSVGLengthList.h"
class nsISVGViewportAxis;
////////////////////////////////////////////////////////////////////////
// nsISVGLengthList: private interface for svg lengthlists
// {3B57DE3C-A2C3-4C17-B47A-0791C2EE0BE1}
#define NS_ISVGLENGTHLIST_IID \
{ 0x3b57de3c, 0xa2c3, 0x4c17, { 0xb4, 0x7a, 0x07, 0x91, 0xc2, 0xee, 0x0b, 0xe1 } }
class nsISVGLengthList : public nsIDOMSVGLengthList
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGLENGTHLIST_IID; return iid; }
NS_IMETHOD SetContext(nsISVGViewportAxis* axis)=0;
};
#endif // __NS_ISVGLENGTHLIST_H__

View File

@@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGSVGELEMENT__
#define __NS_ISVGSVGELEMENT__
#include "nsISupports.h"
#include "nsIDOMSVGSVGElement.h"
class nsISVGViewportRect;
////////////////////////////////////////////////////////////////////////
// nsISVGSVGElement: private interface implemented by <svg>-elements
// {C82DA355-56DE-4DB0-B7A8-D9750BF0DDD9}
#define NS_ISVGSVGELEMENT_IID \
{ 0xc82da355, 0x56de, 0x4db0, { 0xb7, 0xa8, 0xd9, 0x75, 0x0b, 0xf0, 0xdd, 0xd9 } }
class nsISVGSVGElement : public nsIDOMSVGSVGElement
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGSVGELEMENT_IID; return iid; }
NS_IMETHOD GetParentViewportRect(nsISVGViewportRect **parentViewport)=0;
};
#endif // __NS_ISVGSVGELEMENT__

View File

@@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGTEXTCONTENTMETRICS_H__
#define __NS_ISVGTEXTCONTENTMETRICS_H__
#include "nsISupports.h"
class nsIDOMSVGRect;
////////////////////////////////////////////////////////////////////////
// nsISVGTextContentMetrics
// {351AC4D0-22B3-45F5-BA26-8B8CF21EF1D8}
#define NS_ISVGTEXTCONTENTMETRICS_IID \
{ 0x351ac4d0, 0x22b3, 0x45f5, { 0xba, 0x26, 0x8b, 0x8c, 0xf2, 0x1e, 0xf1, 0xd8 } }
class nsISVGTextContentMetrics : public nsISupports
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGTEXTCONTENTMETRICS_IID; return iid; }
NS_IMETHOD GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)=0;
};
#endif // __NS_ISVGTEXTCONTENTMETRICS_H__

View File

@@ -1,87 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGVALUE_H__
#define __NS_ISVGVALUE_H__
#include "nsISupports.h"
#include "nsString.h"
class nsISVGValueObserver;
////////////////////////////////////////////////////////////////////////
// nsISVGValue: private interface for svg values
/* This interface is implemented by all value-types (e.g. coords,
pointlists, matrices) that can be parsed from/to strings. This is
used for element-properties that are also XML attributes. E.g. the
'polyline'-element has a 'points'-attribute and a property
'animatedPoints' in the DOM.
XXX Observers
*/
// {79293232-F695-4bda-9FC7-C2679647B790}
#define NS_ISVGVALUE_IID \
{ 0x79293232, 0xf695, 0x4bda, { 0x9f, 0xc7, 0xc2, 0x67, 0x96, 0x47, 0xb7, 0x90 } }
class nsISVGValue : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISVGVALUE_IID)
NS_IMETHOD SetValueString(const nsAString& aValue)=0;
NS_IMETHOD GetValueString(nsAString& aValue)=0;
NS_IMETHOD AddObserver(nsISVGValueObserver* observer)=0;
NS_IMETHOD RemoveObserver(nsISVGValueObserver* observer)=0;
NS_IMETHOD BeginBatchUpdate()=0;
NS_IMETHOD EndBatchUpdate()=0;
};
nsresult
NS_CreateSVGGenericStringValue(const nsAString& aValue, nsISVGValue** aResult);
nsresult
NS_CreateSVGStringProxyValue(nsISVGValue* proxiedValue, nsISVGValue** aResult);
#endif // __NS_ISVGVALUE_H__

View File

@@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGVALUEUTILS_H__
#define __NS_ISVGVALUEUTILS_H__
// NS_ADD_SVGVALUE_OBSERVER() :
// add *this* as an observer to 'value'
#define NS_ADD_SVGVALUE_OBSERVER(value) \
PR_BEGIN_MACRO \
{ \
nsCOMPtr<nsISVGValue> v = do_QueryInterface(value); \
NS_ASSERTION(v, "can't find nsISVGValue interface on " #value ); \
if (v) \
v->AddObserver(this); \
} \
PR_END_MACRO
// NS_REMOVE_SVGVALUE_OBSERVER() :
// remove *this* as an observer to 'value'
#define NS_REMOVE_SVGVALUE_OBSERVER(value) \
PR_BEGIN_MACRO \
{ \
nsCOMPtr<nsISVGValue> v = do_QueryInterface(value); \
NS_ASSERTION(v, "can't find nsISVGValue interface on " #value ); \
if (v) \
v->RemoveObserver(this); \
} \
PR_END_MACRO
#endif // __NS_ISVGVALUEUTILS_H__

View File

@@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGVIEWPORTAXIS_H__
#define __NS_ISVGVIEWPORTAXIS_H__
#include "nsISupports.h"
class nsIDOMSVGNumber;
////////////////////////////////////////////////////////////////////////
// nsISVGViewportAxis: private interface used as a context for
// percentage/unit-based calculations on svg lengths
// {62C247BD-0CF0-43B6-A937-6BD7875B5E0E}
#define NS_ISVGVIEWPORTAXIS_IID \
{ 0x62c247bd, 0x0cf0, 0x43b6, { 0xa9, 0x37, 0x6b, 0xd7, 0x87, 0x5b, 0x5e, 0x0e } }
class nsISVGViewportAxis : public nsISupports
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGVIEWPORTAXIS_IID; return iid; }
NS_IMETHOD GetMillimeterPerPixel(nsIDOMSVGNumber **scale)=0;
NS_IMETHOD GetLength(nsIDOMSVGNumber **length)=0;
};
#endif // __NS_ISVGVIEWPORTAXIS_H__

View File

@@ -1,75 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGVIEWPORTRECT_H__
#define __NS_ISVGVIEWPORTRECT_H__
#include "nsIDOMSVGRect.h"
class nsISVGViewportAxis;
////////////////////////////////////////////////////////////////////////
// nsISVGViewportRect: private viewport interface
// {96547374-899B-434C-9566-0E23C58712F6}
#define NS_ISVGVIEWPORTRECT_IID \
{ 0x96547374, 0x899b, 0x434c, { 0x95, 0x66, 0x0e, 0x23, 0xc5, 0x87, 0x12, 0xf6 } }
class nsISVGViewportRect : public nsIDOMSVGRect
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGVIEWPORTRECT_IID; return iid; }
NS_IMETHOD GetXAxis(nsISVGViewportAxis **xaxis)=0;
NS_IMETHOD GetYAxis(nsISVGViewportAxis **yaxis)=0;
NS_IMETHOD GetUnspecifiedAxis(nsISVGViewportAxis **axis)=0;
};
//////////////////////////////////////////////////////////////////////
class nsIDOMSVGNumber;
extern nsresult
NS_NewSVGViewportRect(nsISVGViewportRect **result,
nsIDOMSVGNumber* scalex,
nsIDOMSVGNumber* scaley,
nsIDOMSVGNumber* lengthx,
nsIDOMSVGNumber* lengthy);
#endif // __NS_ISVGVIEWPORTRECT_H__

View File

@@ -1,202 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGValue.h"
#include "nsWeakReference.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
////////////////////////////////////////////////////////////////////////
// nsSVGAnimatedLength
class nsSVGAnimatedLength : public nsIDOMSVGAnimatedLength,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult NS_NewSVGAnimatedLength(nsIDOMSVGAnimatedLength** result,
nsIDOMSVGLength* baseVal);
nsSVGAnimatedLength();
~nsSVGAnimatedLength();
void Init(nsIDOMSVGLength* baseVal);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGAnimatedLength interface:
NS_DECL_NSIDOMSVGANIMATEDLENGTH
// remainder of nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
// nsISVGValueObserver
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
protected:
nsCOMPtr<nsIDOMSVGLength> mBaseVal;
};
//----------------------------------------------------------------------
// Implementation
nsSVGAnimatedLength::nsSVGAnimatedLength()
{
}
nsSVGAnimatedLength::~nsSVGAnimatedLength()
{
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
if (!val) return;
val->RemoveObserver(this);
}
void
nsSVGAnimatedLength::Init(nsIDOMSVGLength* baseVal)
{
mBaseVal = baseVal;
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
NS_ASSERTION(val, "baseval needs to implement nsISVGValue interface");
if (!val) return;
val->AddObserver(this);
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGAnimatedLength)
NS_IMPL_RELEASE(nsSVGAnimatedLength)
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedLength)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedLength)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedLength)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGAnimatedLength::SetValueString(const nsAString& aValue)
{
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->SetValueString(aValue);
}
NS_IMETHODIMP
nsSVGAnimatedLength::GetValueString(nsAString& aValue)
{
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->GetValueString(aValue);
}
//----------------------------------------------------------------------
// nsIDOMSVGAnimatedLength methods:
/* readonly attribute nsIDOMSVGLength baseVal; */
NS_IMETHODIMP
nsSVGAnimatedLength::GetBaseVal(nsIDOMSVGLength * *aBaseVal)
{
*aBaseVal = mBaseVal;
NS_ADDREF(*aBaseVal);
return NS_OK;
}
/* readonly attribute nsIDOMSVGLength animVal; */
NS_IMETHODIMP
nsSVGAnimatedLength::GetAnimVal(nsIDOMSVGLength * *aAnimVal)
{
*aAnimVal = mBaseVal;
NS_ADDREF(*aAnimVal);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGAnimatedLength::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGAnimatedLength::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions
nsresult
NS_NewSVGAnimatedLength(nsIDOMSVGAnimatedLength** aResult,
nsIDOMSVGLength* baseVal)
{
*aResult = nsnull;
nsSVGAnimatedLength* animatedLength = new nsSVGAnimatedLength();
if(!animatedLength) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(animatedLength);
// nsCOMPtr<nsIDOMSVGLength> baseVal;
// NS_NewSVGLength(getter_AddRefs(baseVal), context);
animatedLength->Init(baseVal);
*aResult = (nsIDOMSVGAnimatedLength*) animatedLength;
return NS_OK;
}

View File

@@ -1,200 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGAnimatedLengthList.h"
#include "nsSVGLengthList.h"
#include "nsSVGValue.h"
#include "nsWeakReference.h"
////////////////////////////////////////////////////////////////////////
// nsSVGAnimatedTransformList
class nsSVGAnimatedLengthList : public nsIDOMSVGAnimatedLengthList,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult
NS_NewSVGAnimatedLengthList(nsIDOMSVGAnimatedLengthList** result,
nsIDOMSVGLengthList* baseVal);
nsSVGAnimatedLengthList();
~nsSVGAnimatedLengthList();
void Init(nsIDOMSVGLengthList* baseVal);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGAnimatedLengthList interface:
NS_DECL_NSIDOMSVGANIMATEDLENGTHLIST
// remainder of nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
// nsISVGValueObserver
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
protected:
nsCOMPtr<nsIDOMSVGLengthList> mBaseVal;
};
//----------------------------------------------------------------------
// Implementation
nsSVGAnimatedLengthList::nsSVGAnimatedLengthList()
{
}
nsSVGAnimatedLengthList::~nsSVGAnimatedLengthList()
{
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
if (!val) return;
val->RemoveObserver(this);
}
void
nsSVGAnimatedLengthList::Init(nsIDOMSVGLengthList* baseVal)
{
mBaseVal = baseVal;
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
if (!val) return;
val->AddObserver(this);
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGAnimatedLengthList)
NS_IMPL_RELEASE(nsSVGAnimatedLengthList)
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedLengthList)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedLengthList)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedLengthList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGAnimatedLengthList::SetValueString(const nsAString& aValue)
{
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->SetValueString(aValue);
}
NS_IMETHODIMP
nsSVGAnimatedLengthList::GetValueString(nsAString& aValue)
{
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->GetValueString(aValue);
}
//----------------------------------------------------------------------
// nsIDOMSVGAnimatedLengthList methods:
/* readonly attribute nsIDOMSVGLengthList baseVal; */
NS_IMETHODIMP
nsSVGAnimatedLengthList::GetBaseVal(nsIDOMSVGLengthList * *aBaseVal)
{
*aBaseVal = mBaseVal;
NS_ADDREF(*aBaseVal);
return NS_OK;
}
/* readonly attribute nsIDOMSVGLengthList animVal; */
NS_IMETHODIMP
nsSVGAnimatedLengthList::GetAnimVal(nsIDOMSVGLengthList * *aAnimVal)
{
*aAnimVal = mBaseVal;
NS_ADDREF(*aAnimVal);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGAnimatedLengthList::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGAnimatedLengthList::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions:
nsresult
NS_NewSVGAnimatedLengthList(nsIDOMSVGAnimatedLengthList** result,
nsIDOMSVGLengthList* baseVal)
{
*result = nsnull;
nsSVGAnimatedLengthList* animatedLengthList = new nsSVGAnimatedLengthList();
if(!animatedLengthList) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(animatedLengthList);
animatedLengthList->Init(baseVal);
*result = (nsIDOMSVGAnimatedLengthList*) animatedLengthList;
return NS_OK;
}

View File

@@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGANIMATEDLENGTHLIST_H__
#define __NS_SVGANIMATEDLENGTHLIST_H__
#include "nsIDOMSVGAnimatedLengthList.h"
#include "nsIDOMSVGLengthList.h"
nsresult
NS_NewSVGAnimatedLengthList(nsIDOMSVGAnimatedLengthList** result,
nsIDOMSVGLengthList* baseVal);
#endif //__NS_SVGANIMATEDLENGTHLIST_H__

View File

@@ -1,164 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGValue.h"
#include "nsWeakReference.h"
#include "nsSVGAnimatedString.h"
////////////////////////////////////////////////////////////////////////
// nsSVGAnimatedString
class nsSVGAnimatedString : public nsIDOMSVGAnimatedString,
public nsSVGValue
{
protected:
friend nsresult NS_NewSVGAnimatedString(nsIDOMSVGAnimatedString** result);
nsSVGAnimatedString();
~nsSVGAnimatedString();
void Init();
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGAnimatedString interface:
NS_DECL_NSIDOMSVGANIMATEDSTRING
// remainder of nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
protected:
nsString mBaseVal;
};
//----------------------------------------------------------------------
// Implementation
nsSVGAnimatedString::nsSVGAnimatedString()
{
}
nsSVGAnimatedString::~nsSVGAnimatedString()
{
}
void
nsSVGAnimatedString::Init()
{
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGAnimatedString)
NS_IMPL_RELEASE(nsSVGAnimatedString)
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedString)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedString)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedString)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGAnimatedString::SetValueString(const nsAString& aValue)
{
WillModify();
mBaseVal = aValue;
DidModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGAnimatedString::GetValueString(nsAString& aValue)
{
aValue = mBaseVal;
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGAnimatedString methods:
/* attribute DOMString baseVal; */
NS_IMETHODIMP
nsSVGAnimatedString::GetBaseVal(nsAString & aBaseVal)
{
aBaseVal = mBaseVal;
return NS_OK;
}
NS_IMETHODIMP
nsSVGAnimatedString::SetBaseVal(const nsAString & aBaseVal)
{
mBaseVal = aBaseVal;
return NS_OK;
}
/* readonly attribute DOMString animVal; */
NS_IMETHODIMP
nsSVGAnimatedString::GetAnimVal(nsAString & aAnimVal)
{
aAnimVal = mBaseVal;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions
nsresult
NS_NewSVGAnimatedString(nsIDOMSVGAnimatedString** aResult)
{
*aResult = nsnull;
nsSVGAnimatedString* animatedString = new nsSVGAnimatedString();
if(!animatedString) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(animatedString);
animatedString->Init();
*aResult = (nsIDOMSVGAnimatedString*) animatedString;
return NS_OK;
}

View File

@@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGANIMATEDSTRING_H__
#define __NS_SVGANIMATEDSTRING_H__
#include "nsIDOMSVGAnimatedString.h"
nsresult NS_NewSVGAnimatedString(nsIDOMSVGAnimatedString** result);
#endif //__NS_SVGANIMATEDSTRING_H__

File diff suppressed because it is too large Load Diff

View File

@@ -1,218 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGATTRIBUTES_H__
#define __NS_SVGATTRIBUTES_H__
#include "nsCOMPtr.h"
#include "nsISVGAttribute.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsVoidArray.h"
#include "nsINodeInfo.h"
#include "nsISVGValue.h"
#include "nsISVGValueObserver.h"
#include "nsWeakReference.h"
#include "nsICSSStyleRule.h"
#include "nsINameSpaceManager.h"
#include "nsAttrName.h"
class nsIStyledContent;
class nsSVGAttributes;
////////////////////////////////////////////////////////////////////////
// SVG Attribute Flags
// XXX these flags are not used yet
typedef PRUint32 nsSVGAttributeFlags;
// This is a #REQUIRED-attribute. Should not be allowed to unset
#define NS_SVGATTRIBUTE_FLAGS_REQUIRED 0x0001
// This is a #FIXED-attribute. Should not be allowed to set/unset
#define NS_SVGATTRIBUTE_FLAGS_FIXED 0x0002
// this attribute is a mapped value. if it is being unset we keep it
// around to be reused:
#define NS_SVGATTRIBUTE_FLAGS_MAPPED 0x0004
////////////////////////////////////////////////////////////////////////
// nsSVGAttribute
class nsSVGAttribute : public nsISVGAttribute, // :nsIDOMAttr
public nsISVGValueObserver,
public nsSupportsWeakReference
{
public:
static nsresult
Create(const nsAttrName& aName,
nsISVGValue* value,
nsSVGAttributeFlags flags,
nsSVGAttribute** aResult);
// create a generic string attribute:
static nsresult
Create(const nsAttrName& aName,
const nsAString& value,
nsSVGAttribute** aResult);
protected:
nsSVGAttribute(const nsAttrName& aName,
nsISVGValue* value,
nsSVGAttributeFlags flags);
virtual ~nsSVGAttribute();
public:
// nsISupports interface
NS_DECL_ISUPPORTS
// nsIDOMNode interface
NS_DECL_NSIDOMNODE
// nsIDOMAttr interface
NS_DECL_NSIDOMATTR
// nsISVGAttribute interface
NS_IMETHOD GetSVGValue(nsISVGValue** value);
// nsISVGValueObserver
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
// other implementation functions
const nsAttrName* Name() const { return &mName; }
void GetQualifiedName(nsAString& aQualifiedName)const;
nsISVGValue* GetValue() { return mValue; }
void SetValueString(const nsAString& aValue);
nsSVGAttributeFlags GetFlags()const { return mFlags; }
PRBool IsRequired()const { return mFlags & NS_SVGATTRIBUTE_FLAGS_REQUIRED; }
PRBool IsFixed()const { return mFlags & NS_SVGATTRIBUTE_FLAGS_FIXED; }
protected:
friend class nsSVGAttributes;
nsSVGAttributeFlags mFlags;
nsSVGAttributes* mOwner;
nsAttrName mName;
nsCOMPtr<nsISVGValue> mValue;
};
////////////////////////////////////////////////////////////////////////
// nsSVGAttributes: the collection of attribs for one content element
class nsSVGAttributes : public nsIDOMNamedNodeMap
{
public:
static nsresult
Create(nsIStyledContent* aElement, nsSVGAttributes** aResult);
protected:
nsSVGAttributes(nsIStyledContent* aContent);
virtual ~nsSVGAttributes();
public:
// nsISupports interface
NS_DECL_ISUPPORTS
// nsIDOMNamedNodeMap interface
NS_DECL_NSIDOMNAMEDNODEMAP
// interface exposed to the content element:
PRInt32 Count() const;
nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString& aResult);
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix,
const nsAString& aValue, PRBool aNotify);
nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
PRBool aNotify);
NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID,
nsIAtom* aName) const;
const nsAttrName* GetExistingAttrNameFromQName(const nsAString& aStr);
nsresult GetAttrNameAt(PRInt32 aIndex,
PRInt32* aNameSpaceID,
nsIAtom** aName,
nsIAtom** aPrefix);
nsresult AddMappedSVGValue(nsIAtom* name, nsISupports* value,
PRInt32 namespaceID=kNameSpaceID_None);
nsresult CopyAttributes(nsSVGAttributes* dest);
void GetContentStyleRule(nsIStyleRule** rule);
// interface exposed to our attributes:
nsIStyledContent* GetContent(){ return mContent; }
void AttributeWasModified(nsSVGAttribute* caller);
protected:
// implementation helpers:
void ReleaseAttributes();
void ReleaseMappedAttributes();
PRBool GetMappedAttribute(PRInt32 aNamespaceID, nsIAtom* aName,
nsSVGAttribute** attrib);
PRBool IsExplicitAttribute(nsSVGAttribute* attrib);
PRBool IsMappedAttribute(nsSVGAttribute* attrib);
nsSVGAttribute* ElementAt(PRInt32 index) const;
void AppendElement(nsSVGAttribute* aElement);
void RemoveElementAt(PRInt32 aIndex);
PRBool AffectsContentStyleRule(const nsIAtom* aAttribute);
void UpdateContentStyleRule();
nsIStyledContent* mContent; // our owner
nsCOMPtr<nsICSSStyleRule> mContentStyleRule;
nsAutoVoidArray mAttributes;
nsAutoVoidArray mMappedAttributes;
};
#endif // __NS_SVGATTRIBUTES_H__

View File

@@ -1,318 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "nsIDOMSVGCircleElement.h"
#include "nsCOMPtr.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
typedef nsSVGGraphicElement nsSVGCircleElementBase;
class nsSVGCircleElement : public nsSVGCircleElementBase,
public nsIDOMSVGCircleElement
{
protected:
friend nsresult NS_NewSVGCircleElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGCircleElement();
virtual ~nsSVGCircleElement();
virtual nsresult Init();
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGCIRCLEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGCircleElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGCircleElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGCircleElementBase::)
protected:
virtual void ParentChainChanged();
nsCOMPtr<nsIDOMSVGAnimatedLength> mCx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mCy;
nsCOMPtr<nsIDOMSVGAnimatedLength> mR;
};
nsresult NS_NewSVGCircleElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGCircleElement* it = new nsSVGCircleElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGCircleElement,nsSVGCircleElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGCircleElement,nsSVGCircleElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGCircleElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGCircleElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGCircleElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGCircleElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGCircleElement::nsSVGCircleElement()
{
}
nsSVGCircleElement::~nsSVGCircleElement()
{
if (mCx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCx);
value->RemoveObserver(this);
}
if (mCy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCy);
value->RemoveObserver(this);
}
if (mR) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mR);
value->RemoveObserver(this);
}
}
nsresult
nsSVGCircleElement::Init()
{
nsresult rv;
rv = nsSVGCircleElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: cx , #IMPLIED attrib: cx
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length), 0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mCx), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::cx, mCx);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: cy , #IMPLIED attrib: cy
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length), 0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mCy), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::cy, mCy);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: r , #REQUIRED attrib: r
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length), 0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mR), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::r, mR);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGCircleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGCircleElement* it = new nsSVGCircleElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGCircleElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGCircleElement methods
/* readonly attribute nsIDOMSVGAnimatedLength cx; */
NS_IMETHODIMP nsSVGCircleElement::GetCx(nsIDOMSVGAnimatedLength * *aCx)
{
*aCx = mCx;
NS_IF_ADDREF(*aCx);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength cy; */
NS_IMETHODIMP nsSVGCircleElement::GetCy(nsIDOMSVGAnimatedLength * *aCy)
{
*aCy = mCy;
NS_IF_ADDREF(*aCy);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength r; */
NS_IMETHODIMP nsSVGCircleElement::GetR(nsIDOMSVGAnimatedLength * *aR)
{
*aR = mR;
NS_IF_ADDREF(*aR);
return NS_OK;
}
//----------------------------------------------------------------------
//
void nsSVGCircleElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// cx:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mCx->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// cy:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mCy->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// r:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mR->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetUnspecifiedAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
}

View File

@@ -1,646 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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):
* Alex Fritze <alex.fritze@crocodile-clips.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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGElement.h"
#include "nsIDocument.h"
#include "nsRange.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMMutationEvent.h"
#include "nsMutationEvent.h"
#include "nsIBindingManager.h"
#include "nsIXBLBinding.h"
#include "nsStyleConsts.h"
#include "nsDOMError.h"
#include "nsIPresShell.h"
#include "nsIDOMViewCSS.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIServiceManager.h"
#include "nsIXBLService.h"
#include "nsSVGAtoms.h"
#include "nsICSSStyleRule.h"
#include "nsISVGSVGElement.h"
#include "nsRuleWalker.h"
#include "nsSVGStyleValue.h"
nsSVGElement::nsSVGElement()
: mAttributes(nsnull)
{
}
nsSVGElement::~nsSVGElement()
{
PRInt32 count = mChildren.Count();
PRInt32 index;
for (index = 0; index < count; index++) {
mChildren[index]->SetParent(nsnull);
}
if (mAttributes)
NS_RELEASE(mAttributes);
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGElement,nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsSVGElement,nsGenericElement)
NS_INTERFACE_MAP_BEGIN(nsSVGElement)
NS_INTERFACE_MAP_ENTRY(nsIXMLContent)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY(nsISVGContent)
// provided by nsGenericElement:
// NS_INTERFACE_MAP_ENTRY(nsIStyledContent)
// NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_END_INHERITING(nsGenericElement)
//----------------------------------------------------------------------
// Implementation
nsresult
nsSVGElement::Init()
{
nsresult rv;
rv = nsSVGAttributes::Create(this,&mAttributes);
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsINodeInfo> ni;
// Create mapped properties:
// style #IMPLIED
rv = NS_NewSVGStyleValue(getter_AddRefs(mStyle));
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::style, mStyle);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIContent methods
void
nsSVGElement::SetParent(nsIContent* aParent)
{
nsGenericElement::SetParent(aParent);
ParentChainChanged();
}
PRBool
nsSVGElement::CanContainChildren() const
{
return PR_TRUE;
}
PRUint32
nsSVGElement::GetChildCount() const
{
return mChildren.Count();
}
nsIContent *
nsSVGElement::GetChildAt(PRUint32 aIndex) const
{
return mChildren.SafeObjectAt(aIndex);
}
PRInt32
nsSVGElement::IndexOf(nsIContent* aPossibleChild) const
{
return mChildren.IndexOf(aPossibleChild);
}
nsIAtom *
nsSVGElement::GetIDAttributeName() const
{
return nsSVGAtoms::id;
}
const nsAttrName*
nsSVGElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const
{
return mAttributes->GetExistingAttrNameFromQName(aStr);
}
nsresult
nsSVGElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName, nsIAtom* aPrefix,
const nsAString& aValue,
PRBool aNotify)
{
return mAttributes->SetAttr(aNamespaceID, aName, aPrefix, aValue, aNotify);
}
nsresult
nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString& aResult) const
{
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
return mAttributes->GetAttr(aNameSpaceID, aName, aResult);
}
nsresult
nsSVGElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
PRBool aNotify)
{
return mAttributes->UnsetAttr(aNameSpaceID, aName, aNotify);
}
PRBool
nsSVGElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const
{
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
return mAttributes->HasAttr(aNameSpaceID, aName);
}
nsresult
nsSVGElement::GetAttrNameAt(PRUint32 aIndex,
PRInt32* aNameSpaceID,
nsIAtom** aName,
nsIAtom** aPrefix) const
{
return mAttributes->GetAttrNameAt(aIndex, aNameSpaceID, aName, aPrefix);
}
PRUint32
nsSVGElement::GetAttrCount() const
{
return mAttributes->Count();
}
#ifdef DEBUG
void
nsSVGElement::List(FILE* out, PRInt32 aIndent) const
{
// XXX
fprintf(out, "some SVG element\n");
}
void
nsSVGElement::DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const
{
// XXX
fprintf(out, "some SVG element\n");
}
#endif // DEBUG
nsresult
nsSVGElement::SetBindingParent(nsIContent* aParent)
{
nsresult rv = nsGenericElement::SetBindingParent(aParent);
// XXX Are parent and bindingparent always in sync? (in which case
// we don't have to call ParentChainChanged() here)
ParentChainChanged();
return rv;
}
//----------------------------------------------------------------------
// nsIStyledContent methods
NS_IMETHODIMP
nsSVGElement::GetID(nsIAtom** aId)const
{
nsAutoString value;
nsresult rv = NS_CONST_CAST(nsSVGElement*,this)->
GetAttribute(NS_LITERAL_STRING("id"), value);
if (NS_SUCCEEDED(rv))
*aId = NS_NewAtom(value);
else
*aId = nsnull;
return rv;
}
NS_IMETHODIMP
nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{
#ifdef DEBUG
// printf("nsSVGElement(%p)::WalkContentStyleRules()\n", this);
#endif
nsCOMPtr<nsIStyleRule> rule;
mAttributes->GetContentStyleRule(getter_AddRefs(rule));
if (rule)
aRuleWalker->Forward(rule);
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetInlineStyleRule(nsICSSStyleRule** aStyleRule)
{
return mStyle->GetStyleRule(this, aStyleRule);
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGElement::GetNodeName(nsAString& aNodeName)
{
mNodeInfo->GetQualifiedName(aNodeName);
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetNodeValue(nsAString& aNodeValue)
{
SetDOMStringToNull(aNodeValue);
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::SetNodeValue(const nsAString& aNodeValue)
{
// The DOM spec says that when nodeValue is defined to be null "setting it
// has no effect", so we don't throw an exception.
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetNodeType(PRUint16* aNodeType)
{
*aNodeType = (PRUint16)nsIDOMNode::ELEMENT_NODE;
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetParentNode(nsIDOMNode** aParentNode)
{
if (GetParent()) {
return CallQueryInterface(GetParent(), aParentNode);
}
if (mDocument) {
// we're the root content
return CallQueryInterface(mDocument, aParentNode);
}
// A standalone element (i.e. one without a parent or a document)
*aParentNode = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetChildNodes(nsIDOMNodeList** aChildNodes)
{
nsDOMSlots *slots = GetDOMSlots();
if (!slots->mChildNodes) {
slots->mChildNodes = new nsChildContentList(this);
if (!slots->mChildNodes) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
NS_ADDREF(*aChildNodes = slots->mChildNodes);
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetFirstChild(nsIDOMNode** aNode)
{
nsIContent *child = mChildren.SafeObjectAt(0);
if (child) {
nsresult res = CallQueryInterface(child, aNode);
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
return res;
}
*aNode = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetLastChild(nsIDOMNode** aNode)
{
PRInt32 count = mChildren.Count();
if (count) {
nsresult res = CallQueryInterface(mChildren[count - 1], aNode);
NS_ASSERTION(NS_SUCCEEDED(res), "Must be a DOM Node"); // must be a DOM Node
return res;
}
*aNode = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
{
return nsGenericElement::GetPreviousSibling(aPreviousSibling);
}
NS_IMETHODIMP
nsSVGElement::GetNextSibling(nsIDOMNode** aNextSibling)
{
return nsGenericElement::GetNextSibling(aNextSibling);
}
NS_IMETHODIMP
nsSVGElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
{
*aAttributes = mAttributes;
NS_ADDREF(*aAttributes);
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{
return nsGenericElement::GetOwnerDocument(aOwnerDocument);
}
NS_IMETHODIMP
nsSVGElement::GetNamespaceURI(nsAString& aNamespaceURI)
{
return mNodeInfo->GetNamespaceURI(aNamespaceURI);
}
NS_IMETHODIMP
nsSVGElement::GetPrefix(nsAString& aPrefix)
{
return nsGenericElement::GetPrefix(aPrefix);
}
NS_IMETHODIMP
nsSVGElement::SetPrefix(const nsAString& aPrefix)
{
return nsGenericElement::SetPrefix(aPrefix);
}
NS_IMETHODIMP
nsSVGElement::GetLocalName(nsAString& aLocalName)
{
return nsGenericElement::GetLocalName(aLocalName);
}
NS_IMETHODIMP
nsSVGElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
{
return nsGenericElement::doInsertBefore(this, aNewChild, aRefChild, aReturn);
}
NS_IMETHODIMP
nsSVGElement::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsGenericElement::doReplaceChild(this, aNewChild, aOldChild, aReturn);
}
NS_IMETHODIMP
nsSVGElement::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
{
return nsGenericElement::doRemoveChild(this, aOldChild, aReturn);
}
NS_IMETHODIMP
nsSVGElement::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
{
return nsGenericElement::doInsertBefore(this, aNewChild, nsnull, aReturn);
}
NS_IMETHODIMP
nsSVGElement::HasChildNodes(PRBool* aReturn)
{
if (0 != mChildren.Count()) {
*aReturn = PR_TRUE;
}
else {
*aReturn = PR_FALSE;
}
return NS_OK;
}
NS_IMETHODIMP
nsSVGElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
NS_ASSERTION(1==0,"CloneNode must be implemented by subclass!");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsSVGElement::Normalize()
{
return nsGenericElement::Normalize();
}
NS_IMETHODIMP
nsSVGElement::IsSupported(const nsAString& aFeature, const nsAString& aVersion, PRBool* aReturn)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSVGElement::HasAttributes(PRBool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = GetAttrCount() > 0;
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMElement methods
// forwarded to nsGenericElement implementations
//----------------------------------------------------------------------
// nsIDOMSVGElement methods
/* attribute DOMString id; */
NS_IMETHODIMP nsSVGElement::GetId(nsAString & aId)
{
return GetAttribute(NS_LITERAL_STRING("id"), aId);
}
NS_IMETHODIMP nsSVGElement::SetId(const nsAString & aId)
{
return SetAttribute(NS_LITERAL_STRING("id"), aId);
}
/* readonly attribute nsIDOMSVGSVGElement ownerSVGElement; */
NS_IMETHODIMP
nsSVGElement::GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement)
{
*aOwnerSVGElement = nsnull;
nsIBindingManager *bindingManager = nsnull;
if (mDocument) {
bindingManager = mDocument->GetBindingManager();
}
nsCOMPtr<nsIContent> parent;
if (bindingManager) {
// we have a binding manager -- do we have an anonymous parent?
bindingManager->GetInsertionParent(this, getter_AddRefs(parent));
}
if (!parent) {
// if we didn't find an anonymous parent, use the explicit one,
// whether it's null or not...
parent = GetParent();
}
while (parent) {
nsCOMPtr<nsIDOMSVGSVGElement> SVGSVGElement = do_QueryInterface(parent);
if (SVGSVGElement) {
*aOwnerSVGElement = SVGSVGElement;
NS_ADDREF(*aOwnerSVGElement);
return NS_OK;
}
nsCOMPtr<nsIContent> next;
if (bindingManager) {
bindingManager->GetInsertionParent(parent, getter_AddRefs(next));
}
if (!next) {
// no anonymous parent, so use explicit one
next = parent->GetParent();
}
parent = next;
}
// we don't have a parent SVG element...
// are _we_ the outermost SVG element? If yes, return nsnull, but don't fail
nsCOMPtr<nsIDOMSVGSVGElement> SVGSVGElement = do_QueryInterface((nsIDOMSVGElement*)this);
if (SVGSVGElement) return NS_OK;
// no owner found and we aren't the outermost SVG element either.
// this situation can e.g. occur during content tree teardown.
return NS_ERROR_FAILURE;
}
/* readonly attribute nsIDOMSVGElement viewportElement; */
NS_IMETHODIMP
nsSVGElement::GetViewportElement(nsIDOMSVGElement * *aViewportElement)
{
*aViewportElement = nsnull;
nsCOMPtr<nsIDOMSVGSVGElement> SVGSVGElement;
nsresult rv = GetOwnerSVGElement(getter_AddRefs(SVGSVGElement));
NS_ENSURE_SUCCESS(rv,rv);
if (SVGSVGElement) {
nsCOMPtr<nsIDOMSVGElement> SVGElement = do_QueryInterface(SVGSVGElement);
*aViewportElement = SVGElement;
NS_IF_ADDREF(*aViewportElement);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods:
NS_IMETHODIMP
nsSVGElement::WillModifySVGObservable(nsISVGValue* observable)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSVGElement::DidModifySVGObservable (nsISVGValue* observable)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------
// Implementation Helpers:
nsresult
nsSVGElement::CopyNode(nsSVGElement* dest, PRBool deep)
{
nsresult rv;
// copy attributes:
NS_ASSERTION(mAttributes, "null pointer");
NS_ASSERTION(dest->mAttributes, "null pointer");
rv = mAttributes->CopyAttributes(dest->mAttributes);
NS_ENSURE_SUCCESS(rv,rv);
if (deep) {
// copy children:
PRInt32 count = mChildren.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIContent* child = mChildren[i];
NS_ASSERTION(child != nsnull, "null ptr");
if (!child)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDOMNode> domchild = do_QueryInterface(child);
NS_ASSERTION(domchild != nsnull, "child is not a DOM node");
if (! domchild)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDOMNode> newdomchild;
rv = domchild->CloneNode(PR_TRUE, getter_AddRefs(newdomchild));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIContent> newchild = do_QueryInterface(newdomchild);
NS_ASSERTION(newchild != nsnull, "newdomchild is not an nsIContent");
if (!newchild)
return NS_ERROR_UNEXPECTED;
rv = dest->AppendChildTo(newchild, PR_FALSE, PR_FALSE);
if (NS_FAILED(rv)) return rv;
}
}
return rv;
}

View File

@@ -1,161 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGELEMENT_H__
#define __NS_SVGELEMENT_H__
/*
nsSVGElement is the base class for all SVG content elements.
It implements all the common DOM interfaces and handles attributes.
*/
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsIDOMSVGElement.h"
#include "nsGenericElement.h"
#include "nsSVGAttributes.h"
#include "nsISVGValue.h"
#include "nsISVGValueObserver.h"
#include "nsWeakReference.h"
#include "nsISVGStyleValue.h"
#include "nsISVGContent.h"
class nsSVGElement : public nsGenericElement, // :nsIHTMLContent:nsIXMLContent:nsIStyledContent:nsIContent
public nsIDOMSVGElement, // :nsIDOMElement:nsIDOMNode
public nsISVGValueObserver,
public nsSupportsWeakReference, // :nsISupportsWeakReference
public nsISVGContent
{
protected:
nsSVGElement();
virtual ~nsSVGElement();
virtual nsresult Init();
public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIContent interface methods
virtual void SetParent(nsIContent* aParent);
virtual PRBool CanContainChildren() const;
virtual PRUint32 GetChildCount() const;
virtual nsIContent *GetChildAt(PRUint32 aIndex) const;
virtual PRInt32 IndexOf(nsIContent* aPossibleChild) const;
virtual nsIAtom *GetIDAttributeName() const;
nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString& aValue, PRBool aNotify)
{
return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
}
virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual nsresult GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAString& aResult) const;
virtual PRBool HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const;
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRBool aNotify);
virtual nsresult GetAttrNameAt(PRUint32 aIndex, PRInt32* aNameSpaceID,
nsIAtom** aName, nsIAtom** aPrefix) const;
virtual PRUint32 GetAttrCount() const;
#ifdef DEBUG
virtual void List(FILE* out, PRInt32 aIndent) const;
virtual void DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const;
#endif // DEBUG
// Child list modification hooks
virtual PRBool InternalInsertChildAt(nsIContent* aKid, PRUint32 aIndex) {
return mChildren.InsertObjectAt(aKid, aIndex);
}
virtual PRBool InternalReplaceChildAt(nsIContent* aKid, PRUint32 aIndex) {
return mChildren.ReplaceObjectAt(aKid, aIndex);
}
virtual PRBool InternalAppendChildTo(nsIContent* aKid) {
return mChildren.AppendObject(aKid);
}
virtual PRBool InternalRemoveChildAt(PRUint32 aIndex) {
return mChildren.RemoveObjectAt(aIndex);
}
virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
virtual nsresult SetBindingParent(nsIContent* aParent);
// nsIStyledContent
NS_IMETHOD GetID(nsIAtom** aResult) const;
// NS_IMETHOD GetClasses(nsVoidArray& aArray) const;
// NS_IMETHOD HasClass(nsIAtom* aClass) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetInlineStyleRule(nsICSSStyleRule** aStyleRule);
// nsIDOMNode
NS_DECL_NSIDOMNODE
// nsIDOMElement
// NS_DECL_IDOMELEMENT
NS_FORWARD_NSIDOMELEMENT(nsGenericElement::)
// nsIDOMSVGElement
NS_DECL_NSIDOMSVGELEMENT
// nsISVGValueObserver
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
// nsISVGContent interface
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval){*retval=PR_FALSE; return NS_OK;}
protected:
nsresult CopyNode(nsSVGElement* dest, PRBool deep);
virtual void ParentChainChanged(){};
nsCOMArray<nsIContent> mChildren;
nsSVGAttributes* mAttributes;
nsCOMPtr<nsISVGStyleValue> mStyle;
};
#endif // __NS_SVGELEMENT_H__

View File

@@ -1,160 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsCOMPtr.h"
#include "nsIElementFactory.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
#include "nsSVGAtoms.h"
#include "nsIXMLContent.h"
nsresult
NS_NewSVGPolylineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGPolygonElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGCircleElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGEllipseElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGLineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGRectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGSVGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGForeignObjectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGPathElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGTextElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGTSpanElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGImageElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
class nsSVGElementFactory : public nsIElementFactory
{
protected:
nsSVGElementFactory();
virtual ~nsSVGElementFactory();
// nsISupports interface
NS_DECL_ISUPPORTS
// nsIElementFactory interface
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo, nsIContent** aResult);
public:
friend nsresult NS_NewSVGElementFactory(nsIElementFactory** aResult);
};
nsSVGElementFactory::nsSVGElementFactory()
{
}
nsSVGElementFactory::~nsSVGElementFactory()
{
}
NS_IMPL_ISUPPORTS1(nsSVGElementFactory, nsIElementFactory)
nsresult
NS_NewSVGElementFactory(nsIElementFactory** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
nsSVGElementFactory* result = new nsSVGElementFactory();
if (! result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
*aResult = result;
return NS_OK;
}
NS_IMETHODIMP
nsSVGElementFactory::CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult)
{
nsIAtom *name = aNodeInfo->NameAtom();
if (name == nsSVGAtoms::polyline)
return NS_NewSVGPolylineElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::polygon)
return NS_NewSVGPolygonElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::circle)
return NS_NewSVGCircleElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::ellipse)
return NS_NewSVGEllipseElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::line)
return NS_NewSVGLineElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::rect)
return NS_NewSVGRectElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::svg)
return NS_NewSVGSVGElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::g)
return NS_NewSVGGElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::foreignObject)
return NS_NewSVGForeignObjectElement(aResult, aNodeInfo);
if (name == nsSVGAtoms::path)
return NS_NewSVGPathElement(aResult, aNodeInfo);
else if (name == nsSVGAtoms::text)
return NS_NewSVGTextElement(aResult, aNodeInfo);
else if (name == nsSVGAtoms::tspan)
return NS_NewSVGTSpanElement(aResult, aNodeInfo);
else if (name == nsSVGAtoms::image)
return NS_NewSVGImageElement(aResult, aNodeInfo);
// if we don't know what to create, just create a standard xml element:
return NS_NewXMLElement(aResult, aNodeInfo);
}

View File

@@ -1,367 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Cook <william.cook@crocodile-clips.com> (original author)
* Alex Fritze <alex.fritze@crocodile-clips.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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "nsIDOMSVGEllipseElement.h"
#include "nsCOMPtr.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
typedef nsSVGGraphicElement nsSVGEllipseElementBase;
class nsSVGEllipseElement : public nsSVGEllipseElementBase,
public nsIDOMSVGEllipseElement
{
protected:
friend nsresult NS_NewSVGEllipseElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGEllipseElement();
virtual ~nsSVGEllipseElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGELLIPSEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGEllipseElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGEllipseElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGEllipseElementBase::)
protected:
virtual void ParentChainChanged();
nsCOMPtr<nsIDOMSVGAnimatedLength> mCx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mCy;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRy;
};
nsresult NS_NewSVGEllipseElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGEllipseElement* it = new nsSVGEllipseElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGEllipseElement,nsSVGEllipseElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGEllipseElement,nsSVGEllipseElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGEllipseElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGEllipseElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGEllipseElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGEllipseElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGEllipseElement::nsSVGEllipseElement()
{
}
nsSVGEllipseElement::~nsSVGEllipseElement()
{
if (mCx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCx);
value->RemoveObserver(this);
}
if (mCy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCy);
value->RemoveObserver(this);
}
if (mRx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRx);
value->RemoveObserver(this);
}
if (mRy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRy);
value->RemoveObserver(this);
}
}
nsresult
nsSVGEllipseElement::Init()
{
nsresult rv;
rv = nsSVGEllipseElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: cx , #IMPLIED attrib: cx
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mCx), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::cx, mCx);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: cy , #IMPLIED attrib: cy
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mCy), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::cy, mCy);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: rx , #REQUIRED attrib: rx
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mRx), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::rx, mRx);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: ry , #REQUIRED attrib: ry
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mRy), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::ry, mRy);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGEllipseElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGEllipseElement* it = new nsSVGEllipseElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGEllipseElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGEllipseElement methods
/* readonly attribute nsIDOMSVGAnimatedLength cx; */
NS_IMETHODIMP nsSVGEllipseElement::GetCx(nsIDOMSVGAnimatedLength * *aCx)
{
*aCx = mCx;
NS_IF_ADDREF(*aCx);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength cy; */
NS_IMETHODIMP nsSVGEllipseElement::GetCy(nsIDOMSVGAnimatedLength * *aCy)
{
*aCy = mCy;
NS_IF_ADDREF(*aCy);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength rx; */
NS_IMETHODIMP nsSVGEllipseElement::GetRx(nsIDOMSVGAnimatedLength * *aRx)
{
*aRx = mRx;
NS_IF_ADDREF(*aRx);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength ry; */
NS_IMETHODIMP nsSVGEllipseElement::GetRy(nsIDOMSVGAnimatedLength * *aRy)
{
*aRy = mRy;
NS_IF_ADDREF(*aRy);
return NS_OK;
}
//----------------------------------------------------------------------
//
void nsSVGEllipseElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// cx:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mCx->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// cy:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mCy->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// rx:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mRx->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// rx:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mRy->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
}

View File

@@ -1,363 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsIDOMSVGForeignObjectElem.h"
#include "nsSVGLength.h"
#include "nsSVGAnimatedLength.h"
#include "nsCOMPtr.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
typedef nsSVGGraphicElement nsSVGForeignObjectElementBase;
class nsSVGForeignObjectElement : public nsSVGForeignObjectElementBase,
public nsIDOMSVGForeignObjectElement
{
protected:
friend nsresult NS_NewSVGForeignObjectElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGForeignObjectElement();
virtual ~nsSVGForeignObjectElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGFOREIGNOBJECTELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGForeignObjectElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGForeignObjectElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::)
protected:
virtual void ParentChainChanged();
nsCOMPtr<nsIDOMSVGAnimatedLength> mX;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY;
nsCOMPtr<nsIDOMSVGAnimatedLength> mWidth;
nsCOMPtr<nsIDOMSVGAnimatedLength> mHeight;
};
nsresult NS_NewSVGForeignObjectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGForeignObjectElement* it = new nsSVGForeignObjectElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGForeignObjectElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGForeignObjectElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGForeignObjectElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGForeignObjectElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGForeignObjectElement::nsSVGForeignObjectElement()
{
}
nsSVGForeignObjectElement::~nsSVGForeignObjectElement()
{
if (mX) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX);
value->RemoveObserver(this);
}
if (mY) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY);
value->RemoveObserver(this);
}
if (mWidth) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mWidth);
value->RemoveObserver(this);
}
if (mHeight) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mHeight);
value->RemoveObserver(this);
}
}
nsresult
nsSVGForeignObjectElement::Init()
{
nsresult rv;
rv = nsSVGForeignObjectElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: x , #IMPLIED attrib: x
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mX), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::x, mX);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: y , #IMPLIED attrib: y
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mY), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::y, mY);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: width , #REQUIRED attrib: width
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
100.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mWidth), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::width, mWidth);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: height , #REQUIRED attrib: height
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
100.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mHeight), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::height, mHeight);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGForeignObjectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGForeignObjectElement* it = new nsSVGForeignObjectElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGForeignObjectElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGForeignObjectElement methods:
/* readonly attribute nsIDOMSVGAnimatedLength x; */
NS_IMETHODIMP nsSVGForeignObjectElement::GetX(nsIDOMSVGAnimatedLength * *aX)
{
*aX = mX;
NS_IF_ADDREF(*aX);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength y; */
NS_IMETHODIMP nsSVGForeignObjectElement::GetY(nsIDOMSVGAnimatedLength * *aY)
{
*aY = mY;
NS_IF_ADDREF(*aY);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength width; */
NS_IMETHODIMP nsSVGForeignObjectElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
{
*aWidth = mWidth;
NS_IF_ADDREF(*aWidth);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength height; */
NS_IMETHODIMP nsSVGForeignObjectElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
{
*aHeight = mHeight;
NS_IF_ADDREF(*aHeight);
return NS_OK;
}
//----------------------------------------------------------------------
//
void nsSVGForeignObjectElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// x:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mX->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// y:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mY->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// width:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mWidth->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// height:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mHeight->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
}

View File

@@ -1,209 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsIDOMSVGGElement.h"
#include "nsSVGAtoms.h"
typedef nsSVGGraphicElement nsSVGGElementBase;
class nsSVGGElement : public nsSVGGElementBase,
public nsIDOMSVGGElement
{
protected:
friend nsresult NS_NewSVGGElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGGElement();
virtual ~nsSVGGElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGGELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGGElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGGElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGGElementBase::)
// nsISVGContent interface
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
protected:
};
////////////////////////////////////////////////////////////////////////
// implementation
nsresult NS_NewSVGGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGGElement* it = new nsSVGGElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGGElement,nsSVGGElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGGElement,nsSVGGElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGGElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGGElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGGElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGGElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGGElement::nsSVGGElement()
{
}
nsSVGGElement::~nsSVGGElement()
{
}
nsresult
nsSVGGElement::Init()
{
nsresult rv;
rv = nsSVGGElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGGElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGGElement* it = new nsSVGGElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGGElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGContent methods
NS_IMETHODIMP
nsSVGGElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
{
if (
// PresentationAttributes-TextContentElements
name==nsSVGAtoms::alignment_baseline ||
name==nsSVGAtoms::baseline_shift ||
name==nsSVGAtoms::direction ||
name==nsSVGAtoms::dominant_baseline ||
name==nsSVGAtoms::glyph_orientation_horizontal ||
name==nsSVGAtoms::glyph_orientation_vertical ||
name==nsSVGAtoms::kerning ||
name==nsSVGAtoms::letter_spacing ||
name==nsSVGAtoms::text_anchor ||
name==nsSVGAtoms::text_decoration ||
name==nsSVGAtoms::unicode_bidi ||
name==nsSVGAtoms::word_spacing ||
// PresentationAttributes-FontSpecification
name==nsSVGAtoms::font_family ||
name==nsSVGAtoms::font_size ||
name==nsSVGAtoms::font_size_adjust ||
name==nsSVGAtoms::font_stretch ||
name==nsSVGAtoms::font_style ||
name==nsSVGAtoms::font_variant ||
name==nsSVGAtoms::font_weight
) {
*retval = PR_TRUE;
return NS_OK;
}
else
return nsSVGGElementBase::IsPresentationAttribute(name, retval);
}

View File

@@ -1,345 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGTransformList.h"
#include "nsSVGAnimatedTransformList.h"
#include "nsSVGAtoms.h"
#include "nsSVGMatrix.h"
#include "nsISVGSVGElement.h"
#include "nsIDOMEventTarget.h"
#include "nsIBindingManager.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsISVGChildFrame.h"
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGGraphicElement, nsSVGGraphicElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGGraphicElement, nsSVGGraphicElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGGraphicElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLocatable)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTransformable)
NS_INTERFACE_MAP_END_INHERITING(nsSVGGraphicElementBase)
//----------------------------------------------------------------------
// Implementation
nsresult
nsSVGGraphicElement::Init()
{
nsresult rv;
rv = nsSVGGraphicElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: transform, #IMPLIED attrib: transform
{
nsCOMPtr<nsIDOMSVGTransformList> transformList;
rv = nsSVGTransformList::Create(getter_AddRefs(transformList));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mTransforms),
transformList);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::transform, mTransforms);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGLocatable methods
/* readonly attribute nsIDOMSVGElement nearestViewportElement; */
NS_IMETHODIMP nsSVGGraphicElement::GetNearestViewportElement(nsIDOMSVGElement * *aNearestViewportElement)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMSVGElement farthestViewportElement; */
NS_IMETHODIMP nsSVGGraphicElement::GetFarthestViewportElement(nsIDOMSVGElement * *aFarthestViewportElement)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGRect getBBox (); */
NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval)
{
*_retval = nsnull;
if (!mDocument) return NS_ERROR_FAILURE;
nsIPresShell *presShell = mDocument->GetShellAt(0);
NS_ASSERTION(presShell, "no presShell");
if (!presShell) return NS_ERROR_FAILURE;
nsIFrame* frame;
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
NS_ASSERTION(frame, "can't get bounding box for element without frame");
if (frame) {
nsISVGChildFrame* svgframe;
frame->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&svgframe);
NS_ASSERTION(svgframe, "wrong frame type");
if (svgframe) {
return svgframe->GetBBox(_retval);
}
}
return NS_ERROR_FAILURE;
}
/* nsIDOMSVGMatrix getCTM (); */
NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval)
{
nsCOMPtr<nsIDOMSVGMatrix> CTM;
nsIBindingManager *bindingManager = nsnull;
if (mDocument) {
bindingManager = mDocument->GetBindingManager();
}
nsCOMPtr<nsIContent> parent;
if (bindingManager) {
// we have a binding manager -- do we have an anonymous parent?
bindingManager->GetInsertionParent(this, getter_AddRefs(parent));
}
if (!parent) {
// if we didn't find an anonymous parent, use the explicit one,
// whether it's null or not...
parent = GetParent();
}
while (parent) {
nsCOMPtr<nsIDOMSVGSVGElement> viewportElement = do_QueryInterface(parent);
if (viewportElement) {
// Our nearest SVG parent is a viewport element.
viewportElement->GetViewboxToViewportTransform(getter_AddRefs(CTM));
break;
}
nsCOMPtr<nsIDOMSVGLocatable> locatableElement = do_QueryInterface(parent);
if (locatableElement) {
// Our nearest SVG parent is a locatable object that is not a
// viewport. Its GetCTM function will give us a ctm from the
// viewport to itself:
locatableElement->GetCTM(getter_AddRefs(CTM));
break;
}
// Our parent was not svg content. We allow interdispersed non-SVG
// content to coexist with XBL. Loop until we find the first SVG
// parent.
nsCOMPtr<nsIContent> next;
if (bindingManager) {
bindingManager->GetInsertionParent(parent, getter_AddRefs(next));
}
if (!next) {
// no anonymous parent, so use explicit one
next = parent->GetParent();
}
parent = next;
}
if (!CTM) {
// We either didn't find an SVG parent, or our parent failed in
// giving us a CTM. In either case:
NS_WARNING("Couldn't get CTM");
nsSVGMatrix::Create(getter_AddRefs(CTM));
}
// append our local transformations:
nsCOMPtr<nsIDOMSVGTransformList> transforms;
mTransforms->GetAnimVal(getter_AddRefs(transforms));
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMSVGMatrix> matrix;
transforms->GetConsolidation(getter_AddRefs(matrix));
return CTM->Multiply(matrix, _retval);
}
/* nsIDOMSVGMatrix getScreenCTM (); */
NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix **_retval)
{
nsCOMPtr<nsIDOMSVGMatrix> screenCTM;
nsIBindingManager *bindingManager = nsnull;
if (mDocument) {
bindingManager = mDocument->GetBindingManager();
}
nsCOMPtr<nsIContent> parent;
if (bindingManager) {
// we have a binding manager -- do we have an anonymous parent?
bindingManager->GetInsertionParent(this, getter_AddRefs(parent));
}
if (!parent) {
// if we didn't find an anonymous parent, use the explicit one,
// whether it's null or not...
parent = GetParent();
}
while (parent) {
nsCOMPtr<nsIDOMSVGLocatable> locatableElement = do_QueryInterface(parent);
if (locatableElement) {
nsCOMPtr<nsIDOMSVGMatrix> ctm;
locatableElement->GetScreenCTM(getter_AddRefs(ctm));
if (!ctm) break;
nsCOMPtr<nsIDOMSVGSVGElement> viewportElement = do_QueryInterface(parent);
if (viewportElement) {
// It is a viewport element. we need to append the viewbox xform:
nsCOMPtr<nsIDOMSVGMatrix> matrix;
viewportElement->GetViewboxToViewportTransform(getter_AddRefs(matrix));
ctm->Multiply(matrix, getter_AddRefs(screenCTM));
}
else
screenCTM = ctm;
break;
}
// Our parent was not svg content. We allow interdispersed non-SVG
// content to coexist with XBL. Loop until we find the first SVG
// parent.
nsCOMPtr<nsIContent> next;
if (bindingManager) {
bindingManager->GetInsertionParent(parent, getter_AddRefs(next));
}
if (!next) {
// no anonymous parent, so use explicit one
next = parent->GetParent();
}
parent = next;
}
if (!screenCTM) {
// We either didn't find an SVG parent, or our parent failed in
// giving us a CTM. In either case:
NS_ERROR("couldn't get ctm");
nsSVGMatrix::Create(getter_AddRefs(screenCTM));
}
// append our local transformations:
nsCOMPtr<nsIDOMSVGTransformList> transforms;
mTransforms->GetAnimVal(getter_AddRefs(transforms));
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMSVGMatrix> matrix;
transforms->GetConsolidation(getter_AddRefs(matrix));
return screenCTM->Multiply(matrix, _retval);
}
/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
NS_IMETHODIMP nsSVGGraphicElement::GetTransformToElement(nsIDOMSVGElement *element, nsIDOMSVGMatrix **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------
// nsIDOMSVGTransformable methods
/* readonly attribute nsIDOMSVGAnimatedTransformList transform; */
NS_IMETHODIMP nsSVGGraphicElement::GetTransform(nsIDOMSVGAnimatedTransformList * *aTransform)
{
*aTransform = mTransforms;
NS_IF_ADDREF(*aTransform);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGContent methods
NS_IMETHODIMP
nsSVGGraphicElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
{
if (
// PresentationAttributes-FillStroke
name==nsSVGAtoms::fill ||
name==nsSVGAtoms::fill_opacity ||
name==nsSVGAtoms::fill_rule ||
name==nsSVGAtoms::stroke ||
name==nsSVGAtoms::stroke_dasharray ||
name==nsSVGAtoms::stroke_dashoffset ||
name==nsSVGAtoms::stroke_linecap ||
name==nsSVGAtoms::stroke_linejoin ||
name==nsSVGAtoms::stroke_miterlimit ||
name==nsSVGAtoms::stroke_opacity ||
name==nsSVGAtoms::stroke_width ||
// PresentationAttributes-Graphics
name==nsSVGAtoms::clip_path ||
name==nsSVGAtoms::clip_rule ||
name==nsSVGAtoms::cursor ||
name==nsSVGAtoms::display ||
name==nsSVGAtoms::filter ||
name==nsSVGAtoms::image_rendering ||
name==nsSVGAtoms::mask ||
name==nsSVGAtoms::opacity ||
name==nsSVGAtoms::pointer_events ||
name==nsSVGAtoms::shape_rendering ||
name==nsSVGAtoms::text_rendering ||
name==nsSVGAtoms::visibility
) {
*retval = PR_TRUE;
return NS_OK;
}
else
return nsSVGGraphicElementBase::IsPresentationAttribute(name, retval);
}

View File

@@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGGRAPHICELEMENT_H__
#define __NS_SVGGRAPHICELEMENT_H__
#include "nsSVGElement.h"
#include "nsIDOMSVGLocatable.h"
#include "nsIDOMSVGTransformable.h"
#include "nsIDOMSVGAnimTransformList.h"
typedef nsSVGElement nsSVGGraphicElementBase;
class nsSVGGraphicElement : public nsSVGGraphicElementBase,
public nsIDOMSVGTransformable // : nsIDOMSVGLocatable
{
protected:
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGLOCATABLE
NS_DECL_NSIDOMSVGTRANSFORMABLE
// nsISVGContent interface
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
protected:
nsCOMPtr<nsIDOMSVGAnimatedTransformList> mTransforms;
};
#endif // __NS_SVGGRAPHICELEMENT_H__

View File

@@ -1,427 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsIDOMSVGImageElement.h"
#include "nsIDOMSVGURIReference.h"
#include "nsSVGLength.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGAnimatedString.h"
#include "nsCOMPtr.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
typedef nsSVGGraphicElement nsSVGImageElementBase;
class nsSVGImageElement : public nsSVGImageElementBase,
public nsIDOMSVGImageElement,
public nsIDOMSVGURIReference
{
protected:
friend nsresult NS_NewSVGImageElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGImageElement();
virtual ~nsSVGImageElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGIMAGEELEMENT
NS_DECL_NSIDOMSVGURIREFERENCE
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGImageElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGImageElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGImageElementBase::)
protected:
void GetSrc(nsAString& src);
virtual void ParentChainChanged();
nsCOMPtr<nsIDOMSVGAnimatedLength> mX;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY;
nsCOMPtr<nsIDOMSVGAnimatedLength> mWidth;
nsCOMPtr<nsIDOMSVGAnimatedLength> mHeight;
nsCOMPtr<nsIDOMSVGAnimatedString> mHref;
};
nsresult NS_NewSVGImageElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGImageElement* it = new nsSVGImageElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGImageElement,nsSVGImageElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGImageElement,nsSVGImageElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGImageElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGImageElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGURIReference)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGImageElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGImageElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGImageElement::nsSVGImageElement()
{
}
nsSVGImageElement::~nsSVGImageElement()
{
if (mX) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX);
value->RemoveObserver(this);
}
if (mY) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY);
value->RemoveObserver(this);
}
if (mWidth) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mWidth);
value->RemoveObserver(this);
}
if (mHeight) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mHeight);
value->RemoveObserver(this);
}
}
nsresult
nsSVGImageElement::Init()
{
nsresult rv;
rv = nsSVGImageElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// nsIDOMSVGImage properties
// DOM property: x , #IMPLIED attrib: x
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mX), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::x, mX);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: y , #IMPLIED attrib: y
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mY), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::y, mY);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: width , #REQUIRED attrib: width
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
100.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mWidth), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::width, mWidth);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: height , #REQUIRED attrib: height
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
100.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mHeight), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::height, mHeight);
NS_ENSURE_SUCCESS(rv,rv);
}
// nsIDOMSVGURIReference properties
// DOM property: href , #REQUIRED attrib: xlink:href
// XXX: enforce requiredness
{
rv = NS_NewSVGAnimatedString(getter_AddRefs(mHref));
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::href, mHref, kNameSpaceID_XLink);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGImageElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGImageElement* it = new nsSVGImageElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGImageElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGImageElement methods:
/* readonly attribute nsIDOMSVGAnimatedLength x; */
NS_IMETHODIMP nsSVGImageElement::GetX(nsIDOMSVGAnimatedLength * *aX)
{
*aX = mX;
NS_IF_ADDREF(*aX);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength y; */
NS_IMETHODIMP nsSVGImageElement::GetY(nsIDOMSVGAnimatedLength * *aY)
{
*aY = mY;
NS_IF_ADDREF(*aY);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength width; */
NS_IMETHODIMP nsSVGImageElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
{
*aWidth = mWidth;
NS_IF_ADDREF(*aWidth);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength height; */
NS_IMETHODIMP nsSVGImageElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
{
*aHeight = mHeight;
NS_IF_ADDREF(*aHeight);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; */
NS_IMETHODIMP
nsSVGImageElement::GetPreserveAspectRatio(nsIDOMSVGAnimatedPreserveAspectRatio
**aPreserveAspectRatio)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
//----------------------------------------------------------------------
// nsIDOMSVGURIReference methods:
/* readonly attribute nsIDOMSVGAnimatedString href; */
NS_IMETHODIMP
nsSVGImageElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
{
*aHref = mHref;
NS_IF_ADDREF(*aHref);
return NS_OK;
}
//----------------------------------------------------------------------
//
void nsSVGImageElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// x:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mX->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// y:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mY->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// width:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mWidth->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// height:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mHeight->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
}
//----------------------------------------------------------------------
void nsSVGImageElement::GetSrc(nsAString& src)
{
// resolve href attribute
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
nsAutoString relURIStr;
mHref->GetAnimVal(relURIStr);
relURIStr.Trim(" \t\n\r");
if (baseURI && !relURIStr.IsEmpty())
NS_MakeAbsoluteURI(src, relURIStr, baseURI);
else
src = relURIStr;
}

View File

@@ -1,644 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGLength.h"
#include "prdtoa.h"
#include "nsIDOMSVGMatrix.h"
#include "nsSVGAtoms.h"
#include "nsSVGValue.h"
#include "nsReadableUtils.h"
#include "nsTextFormatter.h"
#include "nsCRT.h"
#include "nsISVGViewportAxis.h"
#include "nsIDOMSVGNumber.h"
#include "nsISVGValueUtils.h"
#include "nsWeakReference.h"
////////////////////////////////////////////////////////////////////////
// nsSVGLength class
class nsSVGLength : public nsISVGLength,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult NS_NewSVGLength(nsISVGLength** result,
float value,
PRUint16 unit);
friend nsresult NS_NewSVGLength(nsISVGLength** result,
const nsAString &value);
nsSVGLength(float value, PRUint16 unit);
nsSVGLength();
virtual ~nsSVGLength();
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGLength interface:
NS_DECL_NSIDOMSVGLENGTH
// nsISVGLength interface:
NS_IMETHOD SetContext(nsISVGViewportAxis* context);
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
// nsISVGValueObserver interface:
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
protected:
// implementation helpers:
float UserUnitsPerPixel();
float mmPerPixel();
float AxisLength();
void GetUnitString(nsAString& unit);
PRUint16 GetUnitTypeForString(const char* unitStr);
PRBool IsValidUnitType(PRUint16 unit);
void MaybeAddAsObserver();
void MaybeRemoveAsObserver();
float mValueInSpecifiedUnits;
PRUint16 mSpecifiedUnitType;
nsCOMPtr<nsISVGViewportAxis> mContext;
};
//----------------------------------------------------------------------
// Implementation
nsresult
NS_NewSVGLength(nsISVGLength** result,
float value,
PRUint16 unit)
{
nsSVGLength *pl = new nsSVGLength(value, unit);
NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(pl);
*result = pl;
return NS_OK;
}
nsresult
NS_NewSVGLength(nsISVGLength** result,
const nsAString &value)
{
*result = nsnull;
nsSVGLength *pl = new nsSVGLength();
NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(pl);
if (NS_FAILED(pl->SetValueAsString(value))) {
NS_RELEASE(pl);
return NS_ERROR_FAILURE;
}
*result = pl;
return NS_OK;
}
nsSVGLength::nsSVGLength(float value,
PRUint16 unit)
: mValueInSpecifiedUnits(value),
mSpecifiedUnitType(unit)
{
MaybeAddAsObserver();
}
nsSVGLength::nsSVGLength()
{
}
nsSVGLength::~nsSVGLength()
{
MaybeRemoveAsObserver();
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGLength)
NS_IMPL_RELEASE(nsSVGLength)
NS_INTERFACE_MAP_BEGIN(nsSVGLength)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY(nsISVGLength)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGLength)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGLength::SetValueString(const nsAString& aValue)
{
return SetValueAsString(aValue);
}
NS_IMETHODIMP
nsSVGLength::GetValueString(nsAString& aValue)
{
return GetValueAsString(aValue);
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGLength::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGLength::DidModifySVGObservable(nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGLength methods:
/* readonly attribute unsigned short unitType; */
NS_IMETHODIMP
nsSVGLength::GetUnitType(PRUint16 *aUnitType)
{
*aUnitType = mSpecifiedUnitType;
return NS_OK;
}
/* attribute float value; */
NS_IMETHODIMP
nsSVGLength::GetValue(float *aValue)
{
nsresult rv = NS_OK;
switch (mSpecifiedUnitType) {
case SVG_LENGTHTYPE_NUMBER:
*aValue = mValueInSpecifiedUnits;
break;
case SVG_LENGTHTYPE_PX:
*aValue = mValueInSpecifiedUnits * UserUnitsPerPixel();
break;
case SVG_LENGTHTYPE_MM:
*aValue = mValueInSpecifiedUnits / mmPerPixel() * UserUnitsPerPixel();
break;
case SVG_LENGTHTYPE_CM:
*aValue = mValueInSpecifiedUnits * 10.0f / mmPerPixel() * UserUnitsPerPixel();
break;
case SVG_LENGTHTYPE_IN:
*aValue = mValueInSpecifiedUnits * 25.4f / mmPerPixel() * UserUnitsPerPixel();
break;
case SVG_LENGTHTYPE_PT:
*aValue = mValueInSpecifiedUnits * 25.4f/72.0f / mmPerPixel() * UserUnitsPerPixel();
break;
case SVG_LENGTHTYPE_PC:
*aValue = mValueInSpecifiedUnits * 25.4f*12.0f/72.0f / mmPerPixel() * UserUnitsPerPixel();
break;
case SVG_LENGTHTYPE_PERCENTAGE:
*aValue = mValueInSpecifiedUnits * AxisLength() / 100.0f;
break;
case SVG_LENGTHTYPE_EMS:
case SVG_LENGTHTYPE_EXS:
//XXX
NS_ASSERTION(PR_FALSE, "unit not implemented yet");
default:
rv = NS_ERROR_FAILURE;
break;
}
return rv;
}
NS_IMETHODIMP
nsSVGLength::SetValue(float aValue)
{
nsresult rv = NS_OK;
WillModify();
switch (mSpecifiedUnitType) {
case SVG_LENGTHTYPE_NUMBER:
mValueInSpecifiedUnits = aValue;
break;
case SVG_LENGTHTYPE_PX:
mValueInSpecifiedUnits = aValue / UserUnitsPerPixel();
break;
case SVG_LENGTHTYPE_MM:
mValueInSpecifiedUnits = aValue / UserUnitsPerPixel() * mmPerPixel();
break;
case SVG_LENGTHTYPE_CM:
mValueInSpecifiedUnits = aValue / UserUnitsPerPixel() * mmPerPixel() / 10.0f;
break;
case SVG_LENGTHTYPE_IN:
mValueInSpecifiedUnits = aValue / UserUnitsPerPixel() * mmPerPixel() / 25.4f;
break;
case SVG_LENGTHTYPE_PT:
mValueInSpecifiedUnits = aValue / UserUnitsPerPixel() * mmPerPixel() * 72.0f/25.4f;
break;
case SVG_LENGTHTYPE_PC:
mValueInSpecifiedUnits = aValue / UserUnitsPerPixel() * mmPerPixel() * 72.0f/24.4f/12.0f;
break;
case SVG_LENGTHTYPE_PERCENTAGE:
mValueInSpecifiedUnits = aValue * 100.0f / AxisLength();
break;
case SVG_LENGTHTYPE_EMS:
case SVG_LENGTHTYPE_EXS:
//XXX
NS_ASSERTION(PR_FALSE, "unit not implemented yet");
default:
rv = NS_ERROR_FAILURE;
break;
}
DidModify();
return rv;
}
/* attribute float valueInSpecifiedUnits; */
NS_IMETHODIMP
nsSVGLength::GetValueInSpecifiedUnits(float *aValueInSpecifiedUnits)
{
*aValueInSpecifiedUnits = mValueInSpecifiedUnits;
return NS_OK;
}
NS_IMETHODIMP
nsSVGLength::SetValueInSpecifiedUnits(float aValueInSpecifiedUnits)
{
WillModify();
mValueInSpecifiedUnits = aValueInSpecifiedUnits;
DidModify();
return NS_OK;
}
/* attribute DOMString valueAsString; */
NS_IMETHODIMP
nsSVGLength::GetValueAsString(nsAString & aValueAsString)
{
aValueAsString.Truncate();
PRUnichar buf[24];
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("%g").get(),
(double)mValueInSpecifiedUnits);
aValueAsString.Append(buf);
nsAutoString unitString;
GetUnitString(unitString);
aValueAsString.Append(unitString);
return NS_OK;
}
NS_IMETHODIMP
nsSVGLength::SetValueAsString(const nsAString & aValueAsString)
{
nsresult rv = NS_OK;
char *str = ToNewCString(aValueAsString);
char* number = str;
while (*number && isspace(*number))
++number;
if (*number) {
char *rest;
double value = PR_strtod(number, &rest);
if (rest!=number) {
PRUint16 unitType = GetUnitTypeForString(nsCRT::strtok(rest, "\x20\x9\xD\xA", &rest));
if (IsValidUnitType(unitType)){
WillModify();
mValueInSpecifiedUnits = (float)value;
mSpecifiedUnitType = unitType;
DidModify();
}
else { // parse error
// not a valid unit type
rv = NS_ERROR_FAILURE;
NS_ERROR("invalid length type");
}
}
else { // parse error
// no number
rv = NS_ERROR_FAILURE;
}
}
nsMemory::Free(str);
return rv;
}
/* void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits); */
NS_IMETHODIMP
nsSVGLength::NewValueSpecifiedUnits(PRUint16 unitType, float valueInSpecifiedUnits)
{
if (!IsValidUnitType(unitType)) return NS_ERROR_FAILURE;
bool observer_change = (unitType != mSpecifiedUnitType);
WillModify();
if (observer_change)
MaybeRemoveAsObserver();
mValueInSpecifiedUnits = valueInSpecifiedUnits;
mSpecifiedUnitType = unitType;
if (observer_change)
MaybeAddAsObserver();
DidModify();
return NS_OK;
}
/* void convertToSpecifiedUnits (in unsigned short unitType); */
NS_IMETHODIMP
nsSVGLength::ConvertToSpecifiedUnits(PRUint16 unitType)
{
if (!IsValidUnitType(unitType)) return NS_ERROR_FAILURE;
bool observer_change = (unitType != mSpecifiedUnitType);
WillModify();
if (observer_change)
MaybeRemoveAsObserver();
float valueInUserUnits;
GetValue(&valueInUserUnits);
mSpecifiedUnitType = unitType;
SetValue(valueInUserUnits);
if (observer_change)
MaybeAddAsObserver();
DidModify();
return NS_OK;
}
/* float getTransformedValue (in nsIDOMSVGMatrix matrix); */
NS_IMETHODIMP
nsSVGLength::GetTransformedValue(nsIDOMSVGMatrix *matrix,
float *_retval)
{
// XXX we don't have enough information here. is it the length part of
// a coordinate pair (in which case it should transform like a point)
// or is it used like a vector-component (in which case it doesn't
// translate)
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
//----------------------------------------------------------------------
// nsISVGLength methods:
NS_IMETHODIMP
nsSVGLength::SetContext(nsISVGViewportAxis* context)
{
// XXX should we bracket this inbetween WillModify/DidModify pairs?
MaybeRemoveAsObserver();
mContext = context;
MaybeAddAsObserver();
return NS_OK;
}
//----------------------------------------------------------------------
// Implementation helpers:
float nsSVGLength::UserUnitsPerPixel()
{
float UUPerPx = 1.0f;
// SVG CR 20001102: New: A px unit and a user unit are defined to be
// equivalent in SVG. Thus, a length of "5px" is the same as a
// length of "5".
//
// old way of mapping pixels:
// if (!mOwnerElement) return UUPerPx;
// nsCOMPtr<nsIDOMSVGLocatable> locatable;
// locatable = do_QueryInterface(mOwnerElement);
// if (!locatable) return UUPerPx;
// nsCOMPtr<nsIDOMSVGMatrix> matrix;
// locatable->GetCTM( getter_AddRefs(matrix) );
// if (!matrix) return UUPerPx;
// nsCOMPtr<nsIDOMSVGPoint> point, XFormedPoint;
// nsSVGPoint::Create(1.0, 1.0, getter_AddRefs(point));
// point->MatrixTransform(matrix, getter_AddRefs(XFormedPoint));
// switch (mDirection) {
// case eXDirection:
// XFormedPoint->GetX(&UUPerPx);
// break;
// case eYDirection:
// XFormedPoint->GetY(&UUPerPx);
// break;
// case eNoDirection:
// {
// float x,y;
// XFormedPoint->GetX(&x);
// XFormedPoint->GetY(&y);
// UUPerPx = (x==y ? x : (x+y)/2);
// break;
// }
// }
// if (UUPerPx == 0.0f) {
// NS_ASSERTION(PR_FALSE, "invalid uu/pixels");
// UUPerPx = 1e-20f; // some small value
// }
return UUPerPx;
}
float nsSVGLength::mmPerPixel()
{
if (!mContext) {
NS_WARNING("no context in mmPerPixel()");
return 1e-20f;
}
nsCOMPtr<nsIDOMSVGNumber> num;
mContext->GetMillimeterPerPixel(getter_AddRefs(num));
NS_ASSERTION(num, "null interface");
float mmPerPx;
num->GetValue(&mmPerPx);
if (mmPerPx == 0.0f) {
NS_ASSERTION(PR_FALSE, "invalid mm/pixels");
mmPerPx = 1e-20f; // some small value
}
return mmPerPx;
}
float nsSVGLength::AxisLength()
{
if (!mContext) {
NS_WARNING("no context in AxisLength()");
return 1e-20f;
}
nsCOMPtr<nsIDOMSVGNumber> num;
mContext->GetLength(getter_AddRefs(num));
NS_ASSERTION(num, "null interface");
float d;
num->GetValue(&d);
NS_ASSERTION(d!=0.0f, "zero axis length");
if (d == 0.0f)
d = 1e-20f;
return d;
}
void nsSVGLength::GetUnitString(nsAString& unit)
{
nsIAtom* UnitAtom = nsnull;
switch (mSpecifiedUnitType) {
case SVG_LENGTHTYPE_NUMBER:
UnitAtom = nsnull;
break;
case SVG_LENGTHTYPE_PX:
UnitAtom = nsSVGAtoms::px;
break;
case SVG_LENGTHTYPE_MM:
UnitAtom = nsSVGAtoms::mm;
break;
case SVG_LENGTHTYPE_CM:
UnitAtom = nsSVGAtoms::cm;
break;
case SVG_LENGTHTYPE_IN:
UnitAtom = nsSVGAtoms::in;
break;
case SVG_LENGTHTYPE_PT:
UnitAtom = nsSVGAtoms::pt;
break;
case SVG_LENGTHTYPE_PC:
UnitAtom = nsSVGAtoms::pc;
break;
case SVG_LENGTHTYPE_EMS:
UnitAtom = nsSVGAtoms::ems;
break;
case SVG_LENGTHTYPE_EXS:
UnitAtom = nsSVGAtoms::exs;
break;
case SVG_LENGTHTYPE_PERCENTAGE:
UnitAtom = nsSVGAtoms::percentage;
break;
default:
NS_ASSERTION(PR_FALSE, "unknown unit");
break;
}
if (!UnitAtom) return;
UnitAtom->ToString(unit);
}
PRUint16 nsSVGLength::GetUnitTypeForString(const char* unitStr)
{
if (!unitStr || *unitStr=='\0') return SVG_LENGTHTYPE_NUMBER;
nsCOMPtr<nsIAtom> unitAtom = do_GetAtom(unitStr);
if (unitAtom == nsSVGAtoms::px)
return SVG_LENGTHTYPE_PX;
else if (unitAtom == nsSVGAtoms::mm)
return SVG_LENGTHTYPE_MM;
else if (unitAtom == nsSVGAtoms::cm)
return SVG_LENGTHTYPE_CM;
else if (unitAtom == nsSVGAtoms::in)
return SVG_LENGTHTYPE_IN;
else if (unitAtom == nsSVGAtoms::pt)
return SVG_LENGTHTYPE_PT;
else if (unitAtom == nsSVGAtoms::pc)
return SVG_LENGTHTYPE_PC;
else if (unitAtom == nsSVGAtoms::ems)
return SVG_LENGTHTYPE_EMS;
else if (unitAtom == nsSVGAtoms::exs)
return SVG_LENGTHTYPE_EXS;
else if (unitAtom == nsSVGAtoms::percentage)
return SVG_LENGTHTYPE_PERCENTAGE;
return SVG_LENGTHTYPE_UNKNOWN;
}
PRBool nsSVGLength::IsValidUnitType(PRUint16 unit)
{
if (unit>0 && unit<=10)
return PR_TRUE;
return PR_FALSE;
}
void nsSVGLength::MaybeAddAsObserver()
{
if ((mSpecifiedUnitType==SVG_LENGTHTYPE_PERCENTAGE) &&
mContext) {
nsCOMPtr<nsIDOMSVGNumber> num;
mContext->GetLength(getter_AddRefs(num));
NS_ADD_SVGVALUE_OBSERVER(num);
}
}
void nsSVGLength::MaybeRemoveAsObserver()
{
if ((mSpecifiedUnitType==SVG_LENGTHTYPE_PERCENTAGE) &&
mContext) {
nsCOMPtr<nsIDOMSVGNumber> num;
mContext->GetLength(getter_AddRefs(num));
NS_REMOVE_SVGVALUE_OBSERVER(num);
}
}

View File

@@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGLENGTH_H__
#define __NS_SVGLENGTH_H__
#include "nsISVGLength.h"
#include "nsAString.h"
nsresult
NS_NewSVGLength(nsISVGLength** result,
float value=0.0f,
PRUint16 unit=nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
nsresult
NS_NewSVGLength(nsISVGLength** result,
const nsAString &value);
// XXX we'll need this prototype-based stuff to support unsetting:
//nsresult NS_NewSVGLength(nsIDOMSVGLength** result,
// nsIDOMSVGLength* prototype);
#endif //__NS_SVGLENGTH_H__

View File

@@ -1,400 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGLengthList.h"
#include "nsSVGLength.h"
#include "nsSVGValue.h"
#include "nsWeakReference.h"
#include "nsVoidArray.h"
#include "nsDOMError.h"
#include "nsReadableUtils.h"
#include "nsISVGViewportAxis.h"
#include "nsCRT.h"
#include "nsISVGValueUtils.h"
////////////////////////////////////////////////////////////////////////
// nsSVGLengthList
class nsSVGLengthList : public nsISVGLengthList,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult NS_NewSVGLengthList(nsISVGLengthList** result);
nsSVGLengthList();
~nsSVGLengthList();
// void Init();
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGLengthList interface:
NS_DECL_NSIDOMSVGLENGTHLIST
// nsISVGLengthList interface:
NS_IMETHOD SetContext(nsISVGViewportAxis* context);
// remainder of nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
// nsISVGValueObserver interface:
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
protected:
// implementation helpers:
nsISVGLength* ElementAt(PRInt32 index);
void AppendElement(nsISVGLength* aElement);
void RemoveElementAt(PRInt32 index);
void InsertElementAt(nsISVGLength* aElement, PRInt32 index);
void ReleaseLengths();
nsAutoVoidArray mLengths;
nsCOMPtr<nsISVGViewportAxis> mContext;
};
//----------------------------------------------------------------------
// Implementation
nsSVGLengthList::nsSVGLengthList()
{
}
nsSVGLengthList::~nsSVGLengthList()
{
ReleaseLengths();
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGLengthList)
NS_IMPL_RELEASE(nsSVGLengthList)
NS_INTERFACE_MAP_BEGIN(nsSVGLengthList)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLengthList)
NS_INTERFACE_MAP_ENTRY(nsISVGLengthList)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGLengthList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGLengthList::SetValueString(const nsAString& aValue)
{
WillModify();
ReleaseLengths();
nsresult rv = NS_OK;
char* str;
str = ToNewCString(aValue);
char* rest = str;
char* token;
const char* delimiters = ",\x20\x9\xD\xA";
while ((token = nsCRT::strtok(rest, delimiters, &rest))) {
nsCOMPtr<nsISVGLength> length;
NS_NewSVGLength(getter_AddRefs(length), NS_ConvertASCIItoUCS2(token));
if (!length) {
rv = NS_ERROR_FAILURE;
break;
}
AppendElement(length);
}
nsMemory::Free(str);
DidModify();
return rv;
}
NS_IMETHODIMP
nsSVGLengthList::GetValueString(nsAString& aValue)
{
aValue.Truncate();
PRInt32 count = mLengths.Count();
if (count<=0) return NS_OK;
PRInt32 i = 0;
while (1) {
nsISVGLength* length = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(length);
NS_ASSERTION(val, "length doesn't implement required interface");
if (!val) continue;
nsAutoString str;
val->GetValueString(str);
aValue.Append(str);
if (++i >= count) break;
aValue.Append(NS_LITERAL_STRING(" "));
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGLengthList methods:
/* readonly attribute unsigned long numberOfItems; */
NS_IMETHODIMP nsSVGLengthList::GetNumberOfItems(PRUint32 *aNumberOfItems)
{
*aNumberOfItems = mLengths.Count();
return NS_OK;
}
/* void clear (); */
NS_IMETHODIMP nsSVGLengthList::Clear()
{
WillModify();
ReleaseLengths();
DidModify();
return NS_OK;
}
/* nsIDOMSVGLength initialize (in nsIDOMSVGLength newItem); */
NS_IMETHODIMP nsSVGLengthList::Initialize(nsIDOMSVGLength *newItem, nsIDOMSVGLength **_retval)
{
Clear();
return AppendItem(newItem, _retval);
}
/* nsIDOMSVGLength getItem (in unsigned long index); */
NS_IMETHODIMP nsSVGLengthList::GetItem(PRUint32 index, nsIDOMSVGLength **_retval)
{
if ((PRInt32)index >= mLengths.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIDOMSVGLength insertItemBefore (in nsIDOMSVGLength newItem, in unsigned long index); */
NS_IMETHODIMP
nsSVGLengthList::InsertItemBefore(nsIDOMSVGLength *newItem, PRUint32 index, nsIDOMSVGLength **_retval)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGLength replaceItem (in nsIDOMSVGLength newItem, in unsigned long index); */
NS_IMETHODIMP
nsSVGLengthList::ReplaceItem(nsIDOMSVGLength *newItem, PRUint32 index, nsIDOMSVGLength **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGLengthList removeItem (in unsigned long index); */
NS_IMETHODIMP nsSVGLengthList::RemoveItem(PRUint32 index, nsIDOMSVGLength **_retval)
{
if ((PRInt32)index >= mLengths.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
WillModify();
RemoveElementAt(index);
DidModify();
return NS_OK;
}
/* nsIDOMSVGLengthList appendItem (in nsIDOMSVGLengthList newItem); */
NS_IMETHODIMP
nsSVGLengthList::AppendItem(nsIDOMSVGLength *newItem, nsIDOMSVGLength **_retval)
{
nsCOMPtr<nsISVGLength> length = do_QueryInterface(newItem);
if (!length) {
NS_ERROR("length doesn't implement required interface");
*_retval = nsnull;
return NS_ERROR_FAILURE;
}
AppendElement(length);
*_retval = newItem;
NS_ADDREF(*_retval);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGLength methods:
NS_IMETHODIMP
nsSVGLengthList::SetContext(nsISVGViewportAxis *context)
{
mContext = context;
PRInt32 count = mLengths.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsISVGLength* length = ElementAt(i);
length->SetContext(mContext);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGLengthList::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGLengthList::DidModifySVGObservable(nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
//----------------------------------------------------------------------
// Implementation helpers
void
nsSVGLengthList::ReleaseLengths()
{
WillModify();
PRInt32 count = mLengths.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsISVGLength* length = ElementAt(i);
length->SetContext(nsnull);
NS_REMOVE_SVGVALUE_OBSERVER(length);
NS_RELEASE(length);
}
mLengths.Clear();
DidModify();
}
nsISVGLength*
nsSVGLengthList::ElementAt(PRInt32 index)
{
return (nsISVGLength*)mLengths.ElementAt(index);
}
void
nsSVGLengthList::AppendElement(nsISVGLength* aElement)
{
WillModify();
NS_ADDREF(aElement);
// The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list':
// aElement->SetListOwner(this);
aElement->SetContext(mContext);
mLengths.AppendElement((void*)aElement);
NS_ADD_SVGVALUE_OBSERVER(aElement);
DidModify();
}
void
nsSVGLengthList::RemoveElementAt(PRInt32 index)
{
WillModify();
nsISVGLength* length = ElementAt(index);
NS_ASSERTION(length, "null length");
NS_REMOVE_SVGVALUE_OBSERVER(length);
mLengths.RemoveElementAt(index);
NS_RELEASE(length);
DidModify();
}
void
nsSVGLengthList::InsertElementAt(nsISVGLength* aElement, PRInt32 index)
{
WillModify();
NS_ADDREF(aElement);
// The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list':
// aElement->SetListOwner(this);
aElement->SetContext(mContext);
mLengths.InsertElementAt((void*)aElement, index);
NS_ADD_SVGVALUE_OBSERVER(aElement);
DidModify();
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions:
nsresult
NS_NewSVGLengthList(nsISVGLengthList** result)
{
*result = nsnull;
nsSVGLengthList* lengthList = new nsSVGLengthList();
if (!lengthList) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(lengthList);
*result = lengthList;
return NS_OK;
}

View File

@@ -1,47 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGLENGTHLIST_H__
#define __NS_SVGLENGTHLIST_H__
#include "nsISVGLengthList.h"
nsresult
NS_NewSVGLengthList(nsISVGLengthList** result);
#endif //__NS_SVGLENGTHLIST_H__

View File

@@ -1,362 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Cook <william.cook@crocodile-clips.com> (original author)
* Alex Fritze <alex.fritze@crocodile-clips.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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "nsIDOMSVGLineElement.h"
#include "nsCOMPtr.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
typedef nsSVGGraphicElement nsSVGLineElementBase;
class nsSVGLineElement : public nsSVGLineElementBase,
public nsIDOMSVGLineElement
{
protected:
friend nsresult NS_NewSVGLineElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGLineElement();
virtual ~nsSVGLineElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGLINEELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGLineElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGLineElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGLineElementBase::)
protected:
virtual void ParentChainChanged();
nsCOMPtr<nsIDOMSVGAnimatedLength> mX1;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY1;
nsCOMPtr<nsIDOMSVGAnimatedLength> mX2;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY2;
};
nsresult NS_NewSVGLineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGLineElement* it = new nsSVGLineElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGLineElement,nsSVGLineElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGLineElement,nsSVGLineElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGLineElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLineElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGLineElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGLineElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGLineElement::nsSVGLineElement()
{
}
nsSVGLineElement::~nsSVGLineElement()
{
if (mX1) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX1);
value->RemoveObserver(this);
}
if (mY1) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY1);
value->RemoveObserver(this);
}
if (mX2) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX2);
value->RemoveObserver(this);
}
if (mY2) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY2);
value->RemoveObserver(this);
}
}
nsresult
nsSVGLineElement::Init()
{
nsresult rv;
rv = nsSVGLineElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: x1 , #IMPLIED attrib: x1
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mX1), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::x1, mX1);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: y1 , #IMPLIED attrib: y1
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mY1), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::y1, mY1);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: x2 , #IMPLIED attrib: x2
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mX2), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::x2, mX2);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: y2 , #IMPLIED attrib: y2
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mY2), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::y2, mY2);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGLineElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGLineElement* it = new nsSVGLineElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGLineElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGLineElement methods
/* readonly attribute nsIDOMSVGAnimatedLength cx; */
NS_IMETHODIMP nsSVGLineElement::GetX1(nsIDOMSVGAnimatedLength * *aX1)
{
*aX1 = mX1;
NS_IF_ADDREF(*aX1);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength cy; */
NS_IMETHODIMP nsSVGLineElement::GetY1(nsIDOMSVGAnimatedLength * *aY1)
{
*aY1 = mY1;
NS_IF_ADDREF(*aY1);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength rx; */
NS_IMETHODIMP nsSVGLineElement::GetX2(nsIDOMSVGAnimatedLength * *aX2)
{
*aX2 = mX2;
NS_IF_ADDREF(*aX2);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength ry; */
NS_IMETHODIMP nsSVGLineElement::GetY2(nsIDOMSVGAnimatedLength * *aY2)
{
*aY2 = mY2;
NS_IF_ADDREF(*aY2);
return NS_OK;
}
//----------------------------------------------------------------------
//
void nsSVGLineElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// x1:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mX1->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// y1:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mY1->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// x2:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mX2->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// y2:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mY2->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
}

View File

@@ -1,352 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGMatrix.h"
#include <math.h>
const double radPerDegree = 2.0*3.1415926535 / 360.0;
nsresult
nsSVGMatrix::Create(nsIDOMSVGMatrix** aResult,
float a, float b, float c,
float d, float e, float f)
{
*aResult = (nsIDOMSVGMatrix*) new nsSVGMatrix(a, b, c, d, e, f);
if(!*aResult) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}
nsSVGMatrix::nsSVGMatrix(float a, float b, float c,
float d, float e, float f)
: mA(a), mB(b), mC(c), mD(d), mE(e), mF(f)
{
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGMatrix)
NS_IMPL_RELEASE(nsSVGMatrix)
NS_INTERFACE_MAP_BEGIN(nsSVGMatrix)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGMatrix)
// NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
// NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGMatrix)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsIDOMSVGMatrix methods:
/* attribute float a; */
NS_IMETHODIMP nsSVGMatrix::GetA(float *aA)
{
*aA = mA;
return NS_OK;
}
NS_IMETHODIMP nsSVGMatrix::SetA(float aA)
{
WillModify();
mA = aA;
DidModify();
return NS_OK;
}
/* attribute float b; */
NS_IMETHODIMP nsSVGMatrix::GetB(float *aB)
{
*aB = mB;
return NS_OK;
}
NS_IMETHODIMP nsSVGMatrix::SetB(float aB)
{
WillModify();
mB = aB;
DidModify();
return NS_OK;
}
/* attribute float c; */
NS_IMETHODIMP nsSVGMatrix::GetC(float *aC)
{
*aC = mC;
return NS_OK;
}
NS_IMETHODIMP nsSVGMatrix::SetC(float aC)
{
WillModify();
mC = aC;
DidModify();
return NS_OK;
}
/* attribute float d; */
NS_IMETHODIMP nsSVGMatrix::GetD(float *aD)
{
*aD = mD;
return NS_OK;
}
NS_IMETHODIMP nsSVGMatrix::SetD(float aD)
{
WillModify();
mD = aD;
DidModify();
return NS_OK;
}
/* attribute float e; */
NS_IMETHODIMP nsSVGMatrix::GetE(float *aE)
{
*aE = mE;
return NS_OK;
}
NS_IMETHODIMP nsSVGMatrix::SetE(float aE)
{
WillModify();
mE = aE;
DidModify();
return NS_OK;
}
/* attribute float f; */
NS_IMETHODIMP nsSVGMatrix::GetF(float *aF)
{
*aF = mF;
return NS_OK;
}
NS_IMETHODIMP nsSVGMatrix::SetF(float aF)
{
WillModify();
mF = aF;
DidModify();
return NS_OK;
}
/* nsIDOMSVGMatrix multiply (in nsIDOMSVGMatrix secondMatrix); */
NS_IMETHODIMP nsSVGMatrix::Multiply(nsIDOMSVGMatrix *secondMatrix, nsIDOMSVGMatrix **_retval)
{
if (!secondMatrix) return NS_ERROR_FAILURE;
float sa,sb,sc,sd,se,sf;
secondMatrix->GetA(&sa);
secondMatrix->GetB(&sb);
secondMatrix->GetC(&sc);
secondMatrix->GetD(&sd);
secondMatrix->GetE(&se);
secondMatrix->GetF(&sf);
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
(*_retval)->SetA( mA*sa + mC*sb );
(*_retval)->SetB( mB*sa + mD*sb );
(*_retval)->SetC( mA*sc + mC*sd );
(*_retval)->SetD( mB*sc + mD*sd );
(*_retval)->SetE( mA*se + mC*sf + mE );
(*_retval)->SetF( mB*se + mD*sf + mF );
return NS_OK;
}
/* nsIDOMSVGMatrix inverse (); */
NS_IMETHODIMP nsSVGMatrix::Inverse(nsIDOMSVGMatrix **_retval)
{
double det = mA*mD - mC*mB;
if (det == 0.0) {
return NS_ERROR_FAILURE;
// XXX should return SVG_MATRIX_NOT_INVERTABLE
}
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
(*_retval)->SetA( (float)( mD/det) );
(*_retval)->SetB( (float)(-mB/det) );
(*_retval)->SetC( (float)(-mC/det) );
(*_retval)->SetD( (float)( mA/det) );
(*_retval)->SetE( (float)((mC*mF - mE*mD)/det) );
(*_retval)->SetF( (float)((mE*mB - mA*mF)/det) );
return NS_OK;
}
/* nsIDOMSVGMatrix translate (in float x, in float y); */
NS_IMETHODIMP nsSVGMatrix::Translate(float x, float y, nsIDOMSVGMatrix **_retval)
{
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
(*_retval)->SetA( mA );
(*_retval)->SetB( mB );
(*_retval)->SetC( mC );
(*_retval)->SetD( mD );
(*_retval)->SetE( mA*x + mC*y + mE );
(*_retval)->SetF( mB*x + mD*y + mF );
return NS_OK;
}
/* nsIDOMSVGMatrix scale (in float scaleFactor); */
NS_IMETHODIMP nsSVGMatrix::Scale(float scaleFactor, nsIDOMSVGMatrix **_retval)
{
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
(*_retval)->SetA( mA*scaleFactor );
(*_retval)->SetB( mB*scaleFactor );
(*_retval)->SetC( mC*scaleFactor );
(*_retval)->SetD( mD*scaleFactor );
(*_retval)->SetE( mE );
(*_retval)->SetF( mF );
return NS_OK;
}
/* nsIDOMSVGMatrix scaleNonUniform (in float scaleFactorX, in float scaleFactorY); */
NS_IMETHODIMP nsSVGMatrix::ScaleNonUniform(float scaleFactorX, float scaleFactorY, nsIDOMSVGMatrix **_retval)
{
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
(*_retval)->SetA( mA*scaleFactorX );
(*_retval)->SetB( mB*scaleFactorX );
(*_retval)->SetC( mC*scaleFactorY );
(*_retval)->SetD( mD*scaleFactorY );
(*_retval)->SetE( mE );
(*_retval)->SetF( mF );
return NS_OK;
}
/* nsIDOMSVGMatrix rotate (in float angle); */
NS_IMETHODIMP nsSVGMatrix::Rotate(float angle, nsIDOMSVGMatrix **_retval)
{
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
double ca = cos( angle*radPerDegree );
double sa = sin( angle*radPerDegree );
(*_retval)->SetA( (float) (mA*ca + mC*sa) );
(*_retval)->SetB( (float) (mB*ca + mD*sa) );
(*_retval)->SetC( (float) (mC*ca - mA*sa) );
(*_retval)->SetD( (float) (mD*ca - mB*sa) );
(*_retval)->SetE( mE );
(*_retval)->SetF( mF );
return NS_OK;
}
/* nsIDOMSVGMatrix rotateFromVector (in float x, in float y); */
NS_IMETHODIMP nsSVGMatrix::RotateFromVector(float x, float y, nsIDOMSVGMatrix **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGMatrix flipX (); */
NS_IMETHODIMP nsSVGMatrix::FlipX(nsIDOMSVGMatrix **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGMatrix flipY (); */
NS_IMETHODIMP nsSVGMatrix::FlipY(nsIDOMSVGMatrix **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGMatrix skewX (in float angle); */
NS_IMETHODIMP nsSVGMatrix::SkewX(float angle, nsIDOMSVGMatrix **_retval)
{
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
double ta = tan( angle*radPerDegree );
(*_retval)->SetA( mA );
(*_retval)->SetB( mB );
(*_retval)->SetC( (float) ( mC + mA*ta) );
(*_retval)->SetD( (float) ( mD + mB*ta) );
(*_retval)->SetE( mE );
(*_retval)->SetF( mF );
return NS_OK;
}
/* nsIDOMSVGMatrix skewY (in float angle); */
NS_IMETHODIMP nsSVGMatrix::SkewY(float angle, nsIDOMSVGMatrix **_retval)
{
Create(_retval);
if (!*_retval) return NS_ERROR_OUT_OF_MEMORY;
double ta = tan( angle*radPerDegree );
(*_retval)->SetA( (float) (mA + mC*ta) );
(*_retval)->SetB( (float) (mB + mD*ta) );
(*_retval)->SetC( mC );
(*_retval)->SetD( mD );
(*_retval)->SetE( mE );
(*_retval)->SetF( mF );
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGMatrix::SetValueString(const nsAString& aValue)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSVGMatrix::GetValueString(nsAString& aValue)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -1,80 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGMATRIX_H__
#define __NS_SVGMATRIX_H__
#include "nsIDOMSVGMatrix.h"
#include "nsSVGValue.h"
class nsSVGMatrix : public nsIDOMSVGMatrix,
public nsSVGValue
{
public:
// XXX the first parameter 'a' is renamed to 'xxx_a' to work around
// what seems to be a VC++ compiler problem; see bug#122363, comment#2
static nsresult Create(nsIDOMSVGMatrix** aResult,
float xxx_a=1.0f, float b=0.0f, float c=0.0f,
float d=1.0f, float e=0.0f, float f=0.0f);
protected:
nsSVGMatrix(float a=1.0f,
float b=0.0f,
float c=0.0f,
float d=1.0f,
float e=0.0f,
float f=0.0f);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGMatrix interface:
NS_DECL_NSIDOMSVGMATRIX
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
protected:
float mA, mB, mC, mD, mE, mF;
};
#endif //__NS_SVGMATRIX_H__

View File

@@ -1,133 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGNumber.h"
#include "prdtoa.h"
#include "nsSVGValue.h"
////////////////////////////////////////////////////////////////////////
// nsSVGNumber class
class nsSVGNumber : public nsIDOMSVGNumber,
public nsSVGValue
{
protected:
friend nsresult NS_NewSVGNumber(nsIDOMSVGNumber** result,
float val);
nsSVGNumber(float val);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGNumber interface:
NS_DECL_NSIDOMSVGNUMBER
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
protected:
float mValue;
};
//----------------------------------------------------------------------
// implementation:
nsresult
NS_NewSVGNumber(nsIDOMSVGNumber** result, float val)
{
*result = new nsSVGNumber(val);
if(!*result) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*result);
return NS_OK;
}
nsSVGNumber::nsSVGNumber(float val)
: mValue(val)
{
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGNumber)
NS_IMPL_RELEASE(nsSVGNumber)
NS_INTERFACE_MAP_BEGIN(nsSVGNumber)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGNumber)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGNumber)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGNumber::SetValueString(const nsAString& aValue)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
nsSVGNumber::GetValueString(nsAString& aValue)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
//----------------------------------------------------------------------
// nsIDOMSVGNumber methods:
/* attribute float value; */
NS_IMETHODIMP nsSVGNumber::GetValue(float *aValue)
{
*aValue = mValue;
return NS_OK;
}
NS_IMETHODIMP nsSVGNumber::SetValue(float aValue)
{
WillModify();
mValue = aValue;
DidModify();
return NS_OK;
}

View File

@@ -1,48 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGNUMBER_H__
#define __NS_SVGNUMBER_H__
#include "nsIDOMSVGNumber.h"
nsresult
NS_NewSVGNumber(nsIDOMSVGNumber** result,
float value=0.0f);
#endif //__NS_SVGNUMBER_H__

File diff suppressed because it is too large Load Diff

View File

@@ -1,164 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGPATHDATAPARSER_H__
#define __NS_SVGPATHDATAPARSER_H__
#include "nsCOMPtr.h"
#include "nsVoidArray.h"
#include "nsIDOMSVGPathSeg.h"
////////////////////////////////////////////////////////////////////////
// nsSVGPathDataParser: a simple recursive descent parser that builds
// nsIDOMPathSegs from path data strings. The grammar for path data
// can be found in SVG CR 20001102, chapter 8.
class nsSVGPathDataParser
{
public:
nsSVGPathDataParser(nsVoidArray* data);
nsresult Parse(const char* str);
protected:
nsVoidArray *mData;
const char* inputpos;
char tokenval;
const char* tokenpos;
enum { DIGIT, WSP, COMMA, POINT, SIGN, OTHER, END } tokentype;
// helpers
nsresult AppendSegment(nsIDOMSVGPathSeg* seg);
void getNextToken();
void windBack(const char* pos);
nsresult match(char tok);
nsresult matchSvgPath();
nsresult matchSubPaths();
PRBool isTokenSubPathsStarter();
nsresult matchSubPath();
PRBool isTokenSubPathStarter();
nsresult matchSubPathElements();
PRBool isTokenSubPathElementsStarter();
nsresult matchSubPathElement();
PRBool isTokenSubPathElementStarter();
nsresult matchMoveto();
nsresult matchMovetoArgSeq(PRBool absCoords);
nsresult matchClosePath();
nsresult matchLineto();
nsresult matchLinetoArgSeq(PRBool absCoords);
PRBool isTokenLinetoArgSeqStarter();
nsresult matchHorizontalLineto();
nsresult matchHorizontalLinetoArgSeq(PRBool absCoords);
nsresult matchVerticalLineto();
nsresult matchVerticalLinetoArgSeq(PRBool absCoords);
nsresult matchCurveto();
nsresult matchCurvetoArgSeq(PRBool absCoords);
nsresult matchCurvetoArg(float* x, float* y, float* x1,
float* y1, float* x2, float* y2);
PRBool isTokenCurvetoArgStarter();
nsresult matchSmoothCurveto();
nsresult matchSmoothCurvetoArgSeq(PRBool absCoords);
nsresult matchSmoothCurvetoArg(float* x, float* y, float* x2, float* y2);
PRBool isTokenSmoothCurvetoArgStarter();
nsresult matchQuadBezierCurveto();
nsresult matchQuadBezierCurvetoArgSeq(PRBool absCoords);
nsresult matchQuadBezierCurvetoArg(float* x, float* y, float* x1, float* y1);
PRBool isTokenQuadBezierCurvetoArgStarter();
nsresult matchSmoothQuadBezierCurveto();
nsresult matchSmoothQuadBezierCurvetoArgSeq(PRBool absCoords);
nsresult matchEllipticalArc();
nsresult matchEllipticalArcArgSeq(PRBool absCoords);
nsresult matchEllipticalArcArg(float* x, float* y,
float* r1, float* r2, float* angle,
PRBool* largeArcFlag, PRBool* sweepFlag);
PRBool isTokenEllipticalArcArgStarter();
nsresult matchCoordPair(float* x, float* y);
PRBool isTokenCoordPairStarter();
nsresult matchCoord(float* x);
PRBool isTokenCoordStarter();
nsresult matchNonNegativeNumber(float* x);
PRBool isTokenNonNegativeNumberStarter();
nsresult matchNumber(float* x);
PRBool isTokenNumberStarter();
nsresult matchFlag(PRBool* f);
nsresult matchCommaWsp();
PRBool isTokenCommaWspStarter();
nsresult matchIntegerConst();
nsresult matchFloatingPointConst();
nsresult matchFractConst();
nsresult matchExponent();
PRBool isTokenExponentStarter();
nsresult matchDigitSeq();
PRBool isTokenDigitSeqStarter();
nsresult matchWsp();
PRBool isTokenWspStarter();
};
#endif // __NS_SVGPATHDATAPARSER_H__

View File

@@ -1,386 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGPathSegList.h"
#include "nsIDOMSVGPathElement.h"
#include "nsIDOMSVGAnimatedPathData.h"
#include "nsIDOMSVGPathSeg.h"
#include "nsSVGPathSeg.h"
#include "nsCOMPtr.h"
typedef nsSVGGraphicElement nsSVGPathElementBase;
class nsSVGPathElement : public nsSVGPathElementBase,
public nsIDOMSVGPathElement,
public nsIDOMSVGAnimatedPathData
{
protected:
friend nsresult NS_NewSVGPathElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGPathElement();
virtual ~nsSVGPathElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGPATHELEMENT
NS_DECL_NSIDOMSVGANIMATEDPATHDATA
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGPathElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGPathElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPathElementBase::)
protected:
nsCOMPtr<nsIDOMSVGPathSegList> mSegments;
};
nsresult NS_NewSVGPathElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGPathElement* it = new nsSVGPathElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGPathElement,nsSVGPathElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGPathElement,nsSVGPathElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGPathElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPathElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedPathData)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPathElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGPathElement::nsSVGPathElement()
{
}
nsSVGPathElement::~nsSVGPathElement()
{
if (mSegments) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mSegments);
value->RemoveObserver(this);
}
}
nsresult
nsSVGPathElement::Init()
{
nsresult rv;
rv = nsSVGPathElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// d #REQUIRED
rv = NS_NewSVGPathSegList(getter_AddRefs(mSegments));
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::d, mSegments);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGPathElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGPathElement* it = new nsSVGPathElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGPathElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGPathElement methods:
/* readonly attribute nsIDOMSVGAnimatedNumber pathLength; */
NS_IMETHODIMP
nsSVGPathElement::GetPathLength(nsIDOMSVGAnimatedNumber * *aPathLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* float getTotalLength (); */
NS_IMETHODIMP
nsSVGPathElement::GetTotalLength(float *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPoint getPointAtLength (in float distance); */
NS_IMETHODIMP
nsSVGPathElement::GetPointAtLength(float distance, nsIDOMSVGPoint **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long getPathSegAtLength (in float distance); */
NS_IMETHODIMP
nsSVGPathElement::GetPathSegAtLength(float distance, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPathSegClosePath createSVGPathSegClosePath (); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegClosePath(nsIDOMSVGPathSegClosePath **_retval)
{
return NS_NewSVGPathSegClosePath(_retval);
}
/* nsIDOMSVGPathSegMovetoAbs createSVGPathSegMovetoAbs (in float x, in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegMovetoAbs(float x, float y, nsIDOMSVGPathSegMovetoAbs **_retval)
{
return NS_NewSVGPathSegMovetoAbs(_retval, x, y);
}
/* nsIDOMSVGPathSegMovetoRel createSVGPathSegMovetoRel (in float x, in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegMovetoRel(float x, float y, nsIDOMSVGPathSegMovetoRel **_retval)
{
return NS_NewSVGPathSegMovetoRel(_retval, x, y);
}
/* nsIDOMSVGPathSegLinetoAbs createSVGPathSegLinetoAbs (in float x, in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegLinetoAbs(float x, float y, nsIDOMSVGPathSegLinetoAbs **_retval)
{
return NS_NewSVGPathSegLinetoAbs(_retval, x, y);
}
/* nsIDOMSVGPathSegLinetoRel createSVGPathSegLinetoRel (in float x, in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegLinetoRel(float x, float y, nsIDOMSVGPathSegLinetoRel **_retval)
{
return NS_NewSVGPathSegLinetoRel(_retval, x, y);
}
/* nsIDOMSVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs (in float x, in float y, in float x1, in float y1, in float x2, in float y2); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2, nsIDOMSVGPathSegCurvetoCubicAbs **_retval)
{
return NS_NewSVGPathSegCurvetoCubicAbs(_retval, x, y, x1, y1, x2, y2);
}
/* nsIDOMSVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel (in float x, in float y, in float x1, in float y1, in float x2, in float y2); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2, nsIDOMSVGPathSegCurvetoCubicRel **_retval)
{
return NS_NewSVGPathSegCurvetoCubicRel(_retval, x, y, x1, y1, x2, y2);
}
/* nsIDOMSVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs (in float x, in float y, in float x1, in float y1); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1, nsIDOMSVGPathSegCurvetoQuadraticAbs **_retval)
{
return NS_NewSVGPathSegCurvetoQuadraticAbs(_retval, x, y, x1, y1);
}
/* nsIDOMSVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel (in float x, in float y, in float x1, in float y1); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1, nsIDOMSVGPathSegCurvetoQuadraticRel **_retval)
{
return NS_NewSVGPathSegCurvetoQuadraticRel(_retval, x, y, x1, y1);
}
/* nsIDOMSVGPathSegArcAbs createSVGPathSegArcAbs (in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, PRBool largeArcFlag, PRBool sweepFlag, nsIDOMSVGPathSegArcAbs **_retval)
{
return NS_NewSVGPathSegArcAbs(_retval, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
}
/* nsIDOMSVGPathSegArcRel createSVGPathSegArcRel (in float x, in float y, in float r1, in float r2, in float angle, in boolean largeArcFlag, in boolean sweepFlag); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, PRBool largeArcFlag, PRBool sweepFlag, nsIDOMSVGPathSegArcRel **_retval)
{
return NS_NewSVGPathSegArcRel(_retval, x, y, r1, r2, angle, largeArcFlag, sweepFlag);
}
/* nsIDOMSVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs (in float x); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegLinetoHorizontalAbs(float x, nsIDOMSVGPathSegLinetoHorizontalAbs **_retval)
{
return NS_NewSVGPathSegLinetoHorizontalAbs(_retval, x);
}
/* nsIDOMSVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel (in float x); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegLinetoHorizontalRel(float x, nsIDOMSVGPathSegLinetoHorizontalRel **_retval)
{
return NS_NewSVGPathSegLinetoHorizontalRel(_retval, x);
}
/* nsIDOMSVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs (in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegLinetoVerticalAbs(float y, nsIDOMSVGPathSegLinetoVerticalAbs **_retval)
{
return NS_NewSVGPathSegLinetoVerticalAbs(_retval, y);
}
/* nsIDOMSVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel (in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegLinetoVerticalRel(float y, nsIDOMSVGPathSegLinetoVerticalRel **_retval)
{
return NS_NewSVGPathSegLinetoVerticalRel(_retval, y);
}
/* nsIDOMSVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs (in float x, in float y, in float x2, in float y2); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2, nsIDOMSVGPathSegCurvetoCubicSmoothAbs **_retval)
{
return NS_NewSVGPathSegCurvetoCubicSmoothAbs(_retval, x, y, x2, y2);
}
/* nsIDOMSVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel (in float x, in float y, in float x2, in float y2); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2, nsIDOMSVGPathSegCurvetoCubicSmoothRel **_retval)
{
return NS_NewSVGPathSegCurvetoCubicSmoothRel(_retval, x, y, x2, y2);
}
/* nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs (in float x, in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs **_retval)
{
return NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(_retval, x, y);
}
/* nsIDOMSVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel (in float x, in float y); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, nsIDOMSVGPathSegCurvetoQuadraticSmoothRel **_retval)
{
return NS_NewSVGPathSegCurvetoQuadraticSmoothRel(_retval, x, y);
}
//----------------------------------------------------------------------
// nsIDOMSVGAnimatedPathData methods:
/* readonly attribute nsIDOMSVGPathSegList pathSegList; */
NS_IMETHODIMP nsSVGPathElement::GetPathSegList(nsIDOMSVGPathSegList * *aPathSegList)
{
*aPathSegList = mSegments;
NS_ADDREF(*aPathSegList);
return NS_OK;
}
/* readonly attribute nsIDOMSVGPathSegList normalizedPathSegList; */
NS_IMETHODIMP nsSVGPathElement::GetNormalizedPathSegList(nsIDOMSVGPathSegList * *aNormalizedPathSegList)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMSVGPathSegList animatedPathSegList; */
NS_IMETHODIMP nsSVGPathElement::GetAnimatedPathSegList(nsIDOMSVGPathSegList * *aAnimatedPathSegList)
{
*aAnimatedPathSegList = mSegments;
NS_ADDREF(*aAnimatedPathSegList);
return NS_OK;
}
/* readonly attribute nsIDOMSVGPathSegList animatedNormalizedPathSegList; */
NS_IMETHODIMP nsSVGPathElement::GetAnimatedNormalizedPathSegList(nsIDOMSVGPathSegList * *aAnimatedNormalizedPathSegList)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,132 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGPATHSEG_H__
#define __NS_SVGPATHSEG_H__
#include "nsIDOMSVGPathSeg.h"
nsresult
NS_NewSVGPathSegClosePath(nsIDOMSVGPathSegClosePath** result);
nsresult
NS_NewSVGPathSegMovetoAbs(nsIDOMSVGPathSegMovetoAbs** result,
float x, float y);
nsresult
NS_NewSVGPathSegMovetoRel(nsIDOMSVGPathSegMovetoRel** result,
float x, float y);
nsresult
NS_NewSVGPathSegLinetoAbs(nsIDOMSVGPathSegLinetoAbs** result,
float x, float y);
nsresult
NS_NewSVGPathSegLinetoRel(nsIDOMSVGPathSegLinetoRel** result,
float x, float y);
nsresult
NS_NewSVGPathSegCurvetoCubicAbs(nsIDOMSVGPathSegCurvetoCubicAbs** result,
float x, float y,
float x1, float y1,
float x2, float y2);
nsresult
NS_NewSVGPathSegCurvetoCubicRel(nsIDOMSVGPathSegCurvetoCubicRel** result,
float x, float y,
float x1, float y1,
float x2, float y2);
nsresult
NS_NewSVGPathSegCurvetoQuadraticAbs(nsIDOMSVGPathSegCurvetoQuadraticAbs** result,
float x, float y,
float x1, float y1);
nsresult
NS_NewSVGPathSegCurvetoQuadraticRel(nsIDOMSVGPathSegCurvetoQuadraticRel** result,
float x, float y,
float x1, float y1);
nsresult
NS_NewSVGPathSegArcAbs(nsIDOMSVGPathSegArcAbs** result,
float x, float y,
float r1, float r2, float angle,
PRBool largeArcFlag, PRBool sweepFlag);
nsresult
NS_NewSVGPathSegArcRel(nsIDOMSVGPathSegArcRel** result,
float x, float y,
float r1, float r2, float angle,
PRBool largeArcFlag, PRBool sweepFlag);
nsresult
NS_NewSVGPathSegLinetoHorizontalAbs(nsIDOMSVGPathSegLinetoHorizontalAbs** result,
float x);
nsresult
NS_NewSVGPathSegLinetoHorizontalRel(nsIDOMSVGPathSegLinetoHorizontalRel** result,
float x);
nsresult
NS_NewSVGPathSegLinetoVerticalAbs(nsIDOMSVGPathSegLinetoVerticalAbs** result,
float y);
nsresult
NS_NewSVGPathSegLinetoVerticalRel(nsIDOMSVGPathSegLinetoVerticalRel** result,
float y);
nsresult
NS_NewSVGPathSegCurvetoCubicSmoothAbs(nsIDOMSVGPathSegCurvetoCubicSmoothAbs** result,
float x, float y,
float x2, float y2);
nsresult
NS_NewSVGPathSegCurvetoCubicSmoothRel(nsIDOMSVGPathSegCurvetoCubicSmoothRel** result,
float x, float y,
float x2, float y2);
nsresult
NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs** result,
float x, float y);
nsresult
NS_NewSVGPathSegCurvetoQuadraticSmoothRel(nsIDOMSVGPathSegCurvetoQuadraticSmoothRel** result,
float x, float y);
#endif //__NS_SVGPATHSEG_H__

View File

@@ -1,371 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGPathSegList.h"
#include "nsSVGPathSeg.h"
#include "nsSVGValue.h"
#include "nsWeakReference.h"
#include "nsVoidArray.h"
#include "nsDOMError.h"
#include "nsSVGPathDataParser.h"
#include "nsReadableUtils.h"
////////////////////////////////////////////////////////////////////////
// nsSVGPathSegList
class nsSVGPathSegList : public nsIDOMSVGPathSegList,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult NS_NewSVGPathSegList(nsIDOMSVGPathSegList** result);
nsSVGPathSegList();
~nsSVGPathSegList();
// void Init();
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGPathSegList interface:
NS_DECL_NSIDOMSVGPATHSEGLIST
// remainder of nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
// nsISVGValueObserver
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
protected:
// implementation helpers:
nsIDOMSVGPathSeg* ElementAt(PRInt32 index);
void AppendElement(nsIDOMSVGPathSeg* aElement);
void RemoveElementAt(PRInt32 index);
void InsertElementAt(nsIDOMSVGPathSeg* aElement, PRInt32 index);
void ReleaseSegments();
nsVoidArray mSegments;
};
//----------------------------------------------------------------------
// Implementation
nsSVGPathSegList::nsSVGPathSegList()
{
}
nsSVGPathSegList::~nsSVGPathSegList()
{
ReleaseSegments();
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGPathSegList)
NS_IMPL_RELEASE(nsSVGPathSegList)
NS_INTERFACE_MAP_BEGIN(nsSVGPathSegList)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPathSegList)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPathSegList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGPathSegList::SetValueString(const nsAString& aValue)
{
nsresult rv;
char *str = ToNewCString(aValue);
nsVoidArray data;
nsSVGPathDataParser parser(&data);
rv = parser.Parse(str);
if (NS_SUCCEEDED(rv)) {
WillModify();
ReleaseSegments();
mSegments = data;
PRInt32 count = mSegments.Count();
for (PRInt32 i=0; i<count; ++i) {
nsIDOMSVGPathSeg* seg = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->AddObserver(this);
}
DidModify();
}
else {
NS_ERROR("path data parse error!");
PRInt32 count = data.Count();
for (PRInt32 i=0; i<count; ++i) {
nsIDOMSVGPathSeg* seg = ElementAt(i);
NS_RELEASE(seg);
}
}
nsMemory::Free(str);
return rv;
}
NS_IMETHODIMP
nsSVGPathSegList::GetValueString(nsAString& aValue)
{
aValue.Truncate();
PRInt32 count = mSegments.Count();
if (count<=0) return NS_OK;
PRInt32 i = 0;
while (1) {
nsIDOMSVGPathSeg* seg = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
NS_ASSERTION(val, "path segment doesn't implement required interface");
if (!val) continue;
nsAutoString str;
val->GetValueString(str);
aValue.Append(str);
if (++i >= count) break;
aValue.Append(NS_LITERAL_STRING(" "));
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGPathSegList methods:
/* readonly attribute unsigned long numberOfItems; */
NS_IMETHODIMP nsSVGPathSegList::GetNumberOfItems(PRUint32 *aNumberOfItems)
{
*aNumberOfItems = mSegments.Count();
return NS_OK;
}
/* void clear (); */
NS_IMETHODIMP nsSVGPathSegList::Clear()
{
WillModify();
ReleaseSegments();
DidModify();
return NS_OK;
}
/* nsIDOMSVGPathSeg initialize (in nsIDOMSVGPathSeg newItem); */
NS_IMETHODIMP nsSVGPathSegList::Initialize(nsIDOMSVGPathSeg *newItem, nsIDOMSVGPathSeg **_retval)
{
Clear();
return AppendItem(newItem, _retval);
}
/* nsIDOMSVGPathSeg getItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::GetItem(PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
if ((PRInt32)index >= mSegments.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIDOMSVGPathSeg insertItemBefore (in nsIDOMSVGPathSeg newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::InsertItemBefore(nsIDOMSVGPathSeg *newItem, PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPathSeg replaceItem (in nsIDOMSVGPathSeg newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *newItem, PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPathSeg removeItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::RemoveItem(PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
if ((PRInt32)index >= mSegments.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
WillModify();
RemoveElementAt(index);
DidModify();
return NS_OK;
}
/* nsIDOMSVGPathSeg appendItem (in nsIDOMSVGPathSeg newItem); */
NS_IMETHODIMP nsSVGPathSegList::AppendItem(nsIDOMSVGPathSeg *newItem, nsIDOMSVGPathSeg **_retval)
{
// XXX The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list'. We don't do that. Should we?
*_retval = newItem;
NS_ADDREF(*_retval);
AppendElement(newItem);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGPathSegList::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGPathSegList::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
//----------------------------------------------------------------------
// Implementation helpers
void
nsSVGPathSegList::ReleaseSegments()
{
WillModify();
PRInt32 count = mSegments.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIDOMSVGPathSeg* seg = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->RemoveObserver(this);
NS_RELEASE(seg);
}
mSegments.Clear();
DidModify();
}
nsIDOMSVGPathSeg*
nsSVGPathSegList::ElementAt(PRInt32 index)
{
return (nsIDOMSVGPathSeg*)mSegments.ElementAt(index);
}
void
nsSVGPathSegList::AppendElement(nsIDOMSVGPathSeg* aElement)
{
WillModify();
NS_ADDREF(aElement);
mSegments.AppendElement((void*)aElement);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
void
nsSVGPathSegList::RemoveElementAt(PRInt32 index)
{
WillModify();
nsIDOMSVGPathSeg* seg = ElementAt(index);
NS_ASSERTION(seg, "null pathsegment");
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->RemoveObserver(this);
mSegments.RemoveElementAt(index);
NS_RELEASE(seg);
DidModify();
}
void
nsSVGPathSegList::InsertElementAt(nsIDOMSVGPathSeg* aElement, PRInt32 index)
{
WillModify();
NS_ADDREF(aElement);
mSegments.InsertElementAt((void*)aElement, index);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions:
nsresult
NS_NewSVGPathSegList(nsIDOMSVGPathSegList** result)
{
*result = nsnull;
nsSVGPathSegList* pathSegList = new nsSVGPathSegList();
if (!pathSegList) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(pathSegList);
// pathSegList->Init();
*result = (nsIDOMSVGPathSegList*) pathSegList;
return NS_OK;
}

View File

@@ -1,342 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGPointList.h"
#include "nsSVGPoint.h"
#include "nsDOMError.h"
#include "prdtoa.h"
#include "nsReadableUtils.h"
#include "nsTextFormatter.h"
#include "nsCRT.h"
#include "nsCOMArray.h"
nsresult
nsSVGPointList::Create(const nsAString& aValue,
nsISVGValue** aResult)
{
*aResult = (nsISVGValue*) new nsSVGPointList();
if(!*aResult) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
(*aResult)->SetValueString(aValue);
return NS_OK;
}
nsresult
nsSVGPointList::Create(nsIDOMSVGPointList** aResult)
{
*aResult = (nsIDOMSVGPointList*) new nsSVGPointList();
if(!*aResult) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}
nsSVGPointList::nsSVGPointList()
{
}
nsSVGPointList::~nsSVGPointList()
{
ReleasePoints();
}
void
nsSVGPointList::ReleasePoints()
{
WillModify();
PRInt32 count = mPoints.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIDOMSVGPoint* point = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(point);
if (val)
val->RemoveObserver(this);
NS_RELEASE(point);
}
mPoints.Clear();
DidModify();
}
nsIDOMSVGPoint*
nsSVGPointList::ElementAt(PRInt32 index)
{
return (nsIDOMSVGPoint*)mPoints.ElementAt(index);
}
void
nsSVGPointList::AppendElement(nsIDOMSVGPoint* aElement)
{
WillModify();
NS_ADDREF(aElement);
mPoints.AppendElement((void*)aElement);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
void
nsSVGPointList::RemoveElementAt(PRInt32 index)
{
WillModify();
nsIDOMSVGPoint* point = ElementAt(index);
NS_ASSERTION(point, "null point");
nsCOMPtr<nsISVGValue> val = do_QueryInterface(point);
if (val)
val->RemoveObserver(this);
mPoints.RemoveElementAt(index);
NS_RELEASE(point);
DidModify();
}
void
nsSVGPointList::InsertElementAt(nsIDOMSVGPoint* aElement, PRInt32 index)
{
WillModify();
NS_ADDREF(aElement);
mPoints.InsertElementAt((void*)aElement, index);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGPointList)
NS_IMPL_RELEASE(nsSVGPointList)
NS_INTERFACE_MAP_BEGIN(nsSVGPointList)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPointList)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPointList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGPointList::SetValueString(const nsAString& aValue)
{
nsresult rv = NS_OK;
char* str = ToNewCString(aValue);
char* rest = str;
char* token1;
char* token2;
const char* delimiters = ",\x20\x9\xD\xA";
nsCOMArray<nsIDOMSVGPoint> points;
while ( (token1 = nsCRT::strtok(rest, delimiters, &rest)) &&
(token2 = nsCRT::strtok(rest, delimiters, &rest)) ) {
char *end;
double x = PR_strtod(token1, &end);
if (*end != '\0') {
rv = NS_ERROR_FAILURE;
break; // parse error
}
double y = PR_strtod(token2, &end);
if (*end != '\0') {
rv = NS_ERROR_FAILURE;
break; // parse error
}
nsCOMPtr<nsIDOMSVGPoint> point;
nsSVGPoint::Create((float)x, (float)y, getter_AddRefs(point));
if (!point) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
points.AppendObject(point);
}
if (token1 || NS_FAILED(rv)) {
// there was a parse error.
rv = NS_ERROR_FAILURE;
}
else {
WillModify();
ReleasePoints();
PRInt32 count = points.Count();
for (PRInt32 i=0; i<count; ++i) {
AppendElement(points.ObjectAt(i));
}
DidModify();
}
nsMemory::Free(str);
return rv;
}
NS_IMETHODIMP
nsSVGPointList::GetValueString(nsAString& aValue)
{
aValue.Truncate();
PRInt32 count = mPoints.Count();
if (count<=0) return NS_OK;
PRInt32 i = 0;
PRUnichar buf[48];
while (1) {
nsIDOMSVGPoint* point = ElementAt(i);
float x, y;
point->GetX(&x);
point->GetY(&y);
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), NS_LITERAL_STRING("%g,%g").get(), (double)x, (double)y);
aValue.Append(buf);
if (++i >= count) break;
aValue.Append(NS_LITERAL_STRING(" "));
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGPointList methods:
/* readonly attribute unsigned long numberOfItems; */
NS_IMETHODIMP nsSVGPointList::GetNumberOfItems(PRUint32 *aNumberOfItems)
{
*aNumberOfItems = mPoints.Count();
return NS_OK;
}
/* void clear (); */
NS_IMETHODIMP nsSVGPointList::Clear()
{
WillModify();
ReleasePoints();
DidModify();
return NS_OK;
}
/* nsIDOMSVGPoint initialize (in nsIDOMSVGPoint newItem); */
NS_IMETHODIMP nsSVGPointList::Initialize(nsIDOMSVGPoint *newItem, nsIDOMSVGPoint **_retval)
{
Clear();
return AppendItem(newItem, _retval);
}
/* nsIDOMSVGPoint getItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPointList::GetItem(PRUint32 index, nsIDOMSVGPoint **_retval)
{
if ((PRInt32)index >= mPoints.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIDOMSVGPoint insertItemBefore (in nsIDOMSVGPoint newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPointList::InsertItemBefore(nsIDOMSVGPoint *newItem, PRUint32 index, nsIDOMSVGPoint **_retval)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPoint replaceItem (in nsIDOMSVGPoint newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPointList::ReplaceItem(nsIDOMSVGPoint *newItem, PRUint32 index, nsIDOMSVGPoint **_retval)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPoint removeItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPointList::RemoveItem(PRUint32 index, nsIDOMSVGPoint **_retval)
{
if ((PRInt32)index >= mPoints.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
WillModify();
RemoveElementAt(index);
DidModify();
return NS_OK;
}
/* nsIDOMSVGPoint appendItem (in nsIDOMSVGPoint newItem); */
NS_IMETHODIMP nsSVGPointList::AppendItem(nsIDOMSVGPoint *newItem, nsIDOMSVGPoint **_retval)
{
// XXX The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list'. We don't do that. Should we?
*_retval = newItem;
NS_ADDREF(*_retval);
AppendElement(newItem);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGPointList::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGPointList::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}

View File

@@ -1,408 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGRect.h"
#include "prdtoa.h"
#include "nsSVGValue.h"
#include "nsTextFormatter.h"
#include "nsCRT.h"
////////////////////////////////////////////////////////////////////////
// nsSVGRect class
class nsSVGRect : public nsIDOMSVGRect,
public nsSVGValue
{
public:
static nsresult Create(nsIDOMSVGRect** result,
float x=0.0f, float y=0.0f,
float w=0.0f, float h=0.0f);
protected:
nsSVGRect(float x, float y, float w, float h);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGRect interface:
NS_DECL_NSIDOMSVGRECT
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
protected:
float mX, mY, mWidth, mHeight;
};
//----------------------------------------------------------------------
// implementation:
nsresult
nsSVGRect::Create(nsIDOMSVGRect** result,
float x, float y, float w, float h)
{
*result = (nsIDOMSVGRect*) new nsSVGRect(x,y,w,h);
if(!*result) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*result);
return NS_OK;
}
nsSVGRect::nsSVGRect(float x, float y, float w, float h)
: mX(x), mY(y), mWidth(w), mHeight(h)
{
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGRect)
NS_IMPL_RELEASE(nsSVGRect)
NS_INTERFACE_MAP_BEGIN(nsSVGRect)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRect)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGRect::SetValueString(const nsAString& aValue)
{
nsresult rv = NS_OK;
char* str = ToNewCString(aValue);
char* rest = str;
char* token;
const char* delimiters = ",\x20\x9\xD\xA";
double vals[4];
int i;
for (i=0;i<4;++i) {
if (!(token = nsCRT::strtok(rest, delimiters, &rest))) break; // parse error
char *end;
vals[i] = PR_strtod(token, &end);
if (*end != '\0') break; // parse error
}
if (i!=4 || (nsCRT::strtok(rest, delimiters, &rest)!=0)) {
// there was a parse error.
rv = NS_ERROR_FAILURE;
}
else {
WillModify();
mX = (double)vals[0];
mY = (double)vals[1];
mWidth = (double)vals[2];
mHeight = (double)vals[3];
DidModify();
}
return rv;
}
NS_IMETHODIMP
nsSVGRect::GetValueString(nsAString& aValue)
{
PRUnichar buf[200];
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("%g %g %g %g").get(),
(double)mX, (double)mY,
(double)mWidth, (double)mHeight);
aValue.Append(buf);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGRect methods:
/* attribute float x; */
NS_IMETHODIMP nsSVGRect::GetX(float *aX)
{
*aX = mX;
return NS_OK;
}
NS_IMETHODIMP nsSVGRect::SetX(float aX)
{
WillModify();
mX = aX;
DidModify();
return NS_OK;
}
/* attribute float y; */
NS_IMETHODIMP nsSVGRect::GetY(float *aY)
{
*aY = mY;
return NS_OK;
}
NS_IMETHODIMP nsSVGRect::SetY(float aY)
{
WillModify();
mY = aY;
DidModify();
return NS_OK;
}
/* attribute float width; */
NS_IMETHODIMP nsSVGRect::GetWidth(float *aWidth)
{
*aWidth = mWidth;
return NS_OK;
}
NS_IMETHODIMP nsSVGRect::SetWidth(float aWidth)
{
WillModify();
mWidth = aWidth;
DidModify();
return NS_OK;
}
/* attribute float height; */
NS_IMETHODIMP nsSVGRect::GetHeight(float *aHeight)
{
*aHeight = mHeight;
return NS_OK;
}
NS_IMETHODIMP nsSVGRect::SetHeight(float aHeight)
{
WillModify();
mHeight = aHeight;
DidModify();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// nsSVGRect prototype wrapper class
// delegates all 'getter' calls to the given prototype if the property
// hasn't been set on the object directly
class nsSVGRectPrototypeWrapper : public nsIDOMSVGRect,
public nsSVGValue
{
public:
static nsresult Create(nsIDOMSVGRect** result,
nsIDOMSVGRect* prototype,
nsIDOMSVGRect* body=nsnull);
protected:
nsSVGRectPrototypeWrapper(nsIDOMSVGRect* prototype,
nsIDOMSVGRect* body);
virtual ~nsSVGRectPrototypeWrapper();
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGRect interface:
NS_DECL_NSIDOMSVGRECT
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
protected:
void EnsureBody();
nsIDOMSVGRect* Delegate() { return mBody ? mBody.get() : mPrototype.get(); }
nsCOMPtr<nsIDOMSVGRect> mPrototype;
nsCOMPtr<nsIDOMSVGRect> mBody;
};
//----------------------------------------------------------------------
// implementation:
nsresult
nsSVGRectPrototypeWrapper::Create(nsIDOMSVGRect** result,
nsIDOMSVGRect* prototype,
nsIDOMSVGRect* body)
{
*result = (nsIDOMSVGRect*) new nsSVGRectPrototypeWrapper(prototype, body);
if(!*result) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*result);
return NS_OK;
}
nsSVGRectPrototypeWrapper::nsSVGRectPrototypeWrapper(nsIDOMSVGRect* prototype,
nsIDOMSVGRect* body)
: mPrototype(prototype), mBody(body)
{
NS_ASSERTION(mPrototype, "need prototype");
}
nsSVGRectPrototypeWrapper::~nsSVGRectPrototypeWrapper()
{
// if (mBody) {
// nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBody);
// if (val)
// val->RemoveObserver(this);
// }
}
void nsSVGRectPrototypeWrapper::EnsureBody()
{
if (mBody) return;
nsSVGRect::Create(getter_AddRefs(mBody));
NS_ASSERTION(mBody, "couldn't create body");
// nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBody);
// if (val)
// val->AddObserver(this);
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGRectPrototypeWrapper)
NS_IMPL_RELEASE(nsSVGRectPrototypeWrapper)
NS_INTERFACE_MAP_BEGIN(nsSVGRectPrototypeWrapper)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRect)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGRectPrototypeWrapper::SetValueString(const nsAString& aValue)
{
EnsureBody();
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBody);
NS_ASSERTION(val, "missing interface on body");
return val->SetValueString(aValue);
}
NS_IMETHODIMP
nsSVGRectPrototypeWrapper::GetValueString(nsAString& aValue)
{
nsCOMPtr<nsISVGValue> val = do_QueryInterface( Delegate() );
NS_ASSERTION(val, "missing interface on body");
return val->GetValueString(aValue);
}
//----------------------------------------------------------------------
// nsIDOMSVGRect methods:
/* attribute float x; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetX(float *aX)
{
return Delegate()->GetX(aX);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetX(float aX)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetX(aX);
DidModify();
return rv;
}
/* attribute float y; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetY(float *aY)
{
return Delegate()->GetY(aY);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetY(float aY)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetY(aY);
DidModify();
return rv;
}
/* attribute float width; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetWidth(float *aWidth)
{
return Delegate()->GetWidth(aWidth);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetWidth(float aWidth)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetWidth(aWidth);
DidModify();
return rv;
}
/* attribute float height; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetHeight(float *aHeight)
{
return Delegate()->GetHeight(aHeight);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetHeight(float aHeight)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetHeight(aHeight);
DidModify();
return rv;
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions:
nsresult
NS_NewSVGRect(nsIDOMSVGRect** result, float x, float y,
float width, float height)
{
return nsSVGRect::Create(result, x, y, width, height);
}
nsresult
NS_NewSVGRectPrototypeWrapper(nsIDOMSVGRect** result,
nsIDOMSVGRect* prototype)
{
return nsSVGRectPrototypeWrapper::Create(result, prototype);
}

View File

@@ -1,447 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* William Cook <william.cook@crocodile-clips.com> (original author)
* Alex Fritze <alex.fritze@crocodile-clips.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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "nsIDOMSVGRectElement.h"
#include "nsCOMPtr.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
typedef nsSVGGraphicElement nsSVGRectElementBase;
class nsSVGRectElement : public nsSVGRectElementBase,
public nsIDOMSVGRectElement
{
protected:
friend nsresult NS_NewSVGRectElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGRectElement();
virtual ~nsSVGRectElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGRECTELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGRectElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGRectElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGRectElementBase::)
protected:
virtual void ParentChainChanged();
nsCOMPtr<nsIDOMSVGAnimatedLength> mX;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY;
nsCOMPtr<nsIDOMSVGAnimatedLength> mWidth;
nsCOMPtr<nsIDOMSVGAnimatedLength> mHeight;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRy;
};
nsresult NS_NewSVGRectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGRectElement* it = new nsSVGRectElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGRectElement,nsSVGRectElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGRectElement,nsSVGRectElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGRectElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRectElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRectElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGRectElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGRectElement::nsSVGRectElement()
{
}
nsSVGRectElement::~nsSVGRectElement()
{
if (mX) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX);
value->RemoveObserver(this);
}
if (mY) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY);
value->RemoveObserver(this);
}
if (mWidth) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mWidth);
value->RemoveObserver(this);
}
if (mHeight) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mHeight);
value->RemoveObserver(this);
}
if (mRx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRx);
value->RemoveObserver(this);
}
if (mRy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRy);
value->RemoveObserver(this);
}
}
nsresult
nsSVGRectElement::Init()
{
nsresult rv;
rv = nsSVGRectElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: x , #IMPLIED attrib: x
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mX), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::x, mX);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: y , #IMPLIED attrib: y
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mY), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::y, mY);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: width , #REQUIRED attrib: width
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mWidth), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::width, mWidth);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: height , #REQUIRED attrib: height
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mHeight), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::height, mHeight);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: rx , #IMPLIED attrib: rx
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mRx), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::rx, mRx);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: ry , #IMPLIED attrib: ry
// XXX: enforce requiredness
{
nsCOMPtr<nsISVGLength> length;
rv = NS_NewSVGLength(getter_AddRefs(length),
0.0f);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLength(getter_AddRefs(mRy), length);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::ry, mRy);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGRectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGRectElement* it = new nsSVGRectElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGRectElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGRectElement methods
/* readonly attribute nsIDOMSVGAnimatedLength x; */
NS_IMETHODIMP nsSVGRectElement::GetX(nsIDOMSVGAnimatedLength * *aX)
{
*aX = mX;
NS_IF_ADDREF(*aX);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength y; */
NS_IMETHODIMP nsSVGRectElement::GetY(nsIDOMSVGAnimatedLength * *aY)
{
*aY = mY;
NS_IF_ADDREF(*aY);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength width; */
NS_IMETHODIMP nsSVGRectElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
{
*aWidth = mWidth;
NS_IF_ADDREF(*aWidth);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength height; */
NS_IMETHODIMP nsSVGRectElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
{
*aHeight = mHeight;
NS_IF_ADDREF(*aHeight);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength rx; */
NS_IMETHODIMP nsSVGRectElement::GetRx(nsIDOMSVGAnimatedLength * *aRx)
{
*aRx = mRx;
NS_IF_ADDREF(*aRx);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLength ry; */
NS_IMETHODIMP nsSVGRectElement::GetRy(nsIDOMSVGAnimatedLength * *aRy)
{
*aRy = mRy;
NS_IF_ADDREF(*aRy);
return NS_OK;
}
//----------------------------------------------------------------------
//
void nsSVGRectElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// x:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mX->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// y:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mY->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// width:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mWidth->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// height:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mHeight->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// rx:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mRx->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
// ry:
{
nsCOMPtr<nsIDOMSVGLength> dom_length;
mRy->GetBaseVal(getter_AddRefs(dom_length));
nsCOMPtr<nsISVGLength> length = do_QueryInterface(dom_length);
NS_ASSERTION(length, "svg length missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
length->SetContext(ctx);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,196 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex@croczilla.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGValue.h"
#include "nsWeakReference.h"
////////////////////////////////////////////////////////////////////////
// nsSVGStringProxyValue implementation
//
// This class is intended to sit between a client and an nsISVGValue object.
// It is used to allow mapped SVG attributes (which store their value in parsed
// form) to assume any string value. This is needed for SVG to work properly with
// XUL templates, where we have XML like this: <svg:circle r="?r"/>.
//
// When nsSVGStringProxyValue::SetValueString() will attempt to call its
// proxied object's SetValueString method. If that call fails, nsSVGStringProxyValue
// will cache the string and return it for subsequent invocations of GetValueString().
// If the call succeeds, however, invocations of GetValueString() will call the
// proxied objects's GetValueString() method.
// If the proxied object's data is changed internally, invocations of GetValueString()
// will also return the proxied object's GetValueString().
class nsSVGStringProxyValue : public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult
NS_CreateSVGStringProxyValue(nsISVGValue* proxiedValue, nsISVGValue** aResult);
nsSVGStringProxyValue();
virtual ~nsSVGStringProxyValue();
PRBool Init(nsISVGValue* proxiedValue);
public:
NS_DECL_ISUPPORTS
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
// nsISVGValueObserver
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
protected:
nsString mCachedValue;
nsCOMPtr<nsISVGValue> mProxiedValue;
PRBool mUseCachedValue;
};
//----------------------------------------------------------------------
nsresult
NS_CreateSVGStringProxyValue(nsISVGValue* proxiedValue,
nsISVGValue** aResult)
{
*aResult = nsnull;
nsSVGStringProxyValue *sp = new nsSVGStringProxyValue();
if(!sp) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(sp);
if (!sp->Init(proxiedValue)) {
NS_RELEASE(sp);
return NS_ERROR_FAILURE;
}
*aResult = sp;
return NS_OK;
}
nsSVGStringProxyValue::nsSVGStringProxyValue()
{
#ifdef DEBUG
printf("nsSVGStringProxyValue CTOR\n");
#endif
}
nsSVGStringProxyValue::~nsSVGStringProxyValue()
{
mProxiedValue->RemoveObserver(this);
#ifdef DEBUG
printf("nsSVGStringProxyValue DTOR\n");
#endif
}
PRBool nsSVGStringProxyValue::Init(nsISVGValue* proxiedValue)
{
mProxiedValue = proxiedValue;
mProxiedValue->AddObserver(this);
return PR_TRUE;
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGStringProxyValue)
NS_IMPL_RELEASE(nsSVGStringProxyValue)
NS_INTERFACE_MAP_BEGIN(nsSVGStringProxyValue)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGStringProxyValue::SetValueString(const nsAString& aValue)
{
#ifdef DEBUG
printf("nsSVGStringProxyValue(%p)::SetValueString(%s)\n", this, NS_ConvertUCS2toUTF8(aValue).get());
#endif
if (NS_FAILED(mProxiedValue->SetValueString(aValue))) {
#ifdef DEBUG
printf(" -> call failed, now using cached value\n");
#endif
mUseCachedValue = PR_TRUE; // mUseCachedValue will be reset in DidModifySVGObservable,
// should the inner object ever change state internally
mCachedValue = aValue;
}
return NS_OK;
}
NS_IMETHODIMP
nsSVGStringProxyValue::GetValueString(nsAString& aValue)
{
if (!mUseCachedValue)
return mProxiedValue->GetValueString(aValue);
aValue = mCachedValue;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGStringProxyValue::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGStringProxyValue::DidModifySVGObservable (nsISVGValue* observable)
{
// Our internal proxied object has set its state internally.
// Make sure its new value takes priority over our cached string:
mUseCachedValue = PR_FALSE;
DidModify();
return NS_OK;
}

View File

@@ -1,449 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGElement.h"
#include "nsSVGAtoms.h"
#include "nsIDOMSVGTSpanElement.h"
#include "nsCOMPtr.h"
#include "nsSVGAnimatedLengthList.h"
#include "nsSVGLengthList.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
typedef nsSVGElement nsSVGTSpanElementBase;
class nsSVGTSpanElement : public nsSVGTSpanElementBase,
public nsIDOMSVGTSpanElement // : nsIDOMSVGTextPositioningElement
// : nsIDOMSVGTextContentElement
{
protected:
friend nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGTSpanElement();
virtual ~nsSVGTSpanElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGTSPANELEMENT
NS_DECL_NSIDOMSVGTEXTPOSITIONINGELEMENT
NS_DECL_NSIDOMSVGTEXTCONTENTELEMENT
// xxx If xpcom allowed virtual inheritance we wouldn't need to
// forward here :-(
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGTSpanElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGTSpanElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::)
// nsISVGContent interface
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
protected:
virtual void ParentChainChanged();
// nsIDOMSVGTextPositioning properties:
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mX;
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mY;
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdX;
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdY;
};
nsresult NS_NewSVGTSpanElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGTSpanElement* it = new nsSVGTSpanElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGTSpanElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTSpanElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTextPositioningElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTextContentElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGTSpanElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGTSpanElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGTSpanElement::nsSVGTSpanElement()
{
}
nsSVGTSpanElement::~nsSVGTSpanElement()
{
}
nsresult
nsSVGTSpanElement::Init()
{
nsresult rv;
rv = nsSVGTSpanElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: nsIDOMSVGTextPositioningElement::x, #IMPLIED attrib: x
{
nsCOMPtr<nsISVGLengthList> lengthList;
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mX),
lengthList);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::x, mX);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: nsIDOMSVGTextPositioningElement::y, #IMPLIED attrib: y
{
nsCOMPtr<nsISVGLengthList> lengthList;
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mY),
lengthList);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::y, mY);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGTSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGTSpanElement* it = new nsSVGTSpanElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGTSpanElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGTSpanElement methods
// - no methods -
//----------------------------------------------------------------------
// nsIDOMSVGTextPositioningElement methods
/* readonly attribute nsIDOMSVGAnimatedLengthList x; */
NS_IMETHODIMP nsSVGTSpanElement::GetX(nsIDOMSVGAnimatedLengthList * *aX)
{
*aX = mX;
NS_IF_ADDREF(*aX);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLengthList y; */
NS_IMETHODIMP nsSVGTSpanElement::GetY(nsIDOMSVGAnimatedLengthList * *aY)
{
*aY = mY;
NS_IF_ADDREF(*aY);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLengthList dx; */
NS_IMETHODIMP nsSVGTSpanElement::GetDx(nsIDOMSVGAnimatedLengthList * *aDx)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* readonly attribute nsIDOMSVGAnimatedLengthList dy; */
NS_IMETHODIMP nsSVGTSpanElement::GetDy(nsIDOMSVGAnimatedLengthList * *aDy)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* readonly attribute nsIDOMSVGAnimatedNumberList rotate; */
NS_IMETHODIMP nsSVGTSpanElement::GetRotate(nsIDOMSVGAnimatedNumberList * *aRotate)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
//----------------------------------------------------------------------
// nsIDOMSVGTextContentElement methods
/* readonly attribute nsIDOMSVGAnimatedLength textLength; */
NS_IMETHODIMP nsSVGTSpanElement::GetTextLength(nsIDOMSVGAnimatedLength * *aTextLength)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration lengthAdjust; */
NS_IMETHODIMP nsSVGTSpanElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration * *aLengthAdjust)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* long getNumberOfChars (); */
NS_IMETHODIMP nsSVGTSpanElement::GetNumberOfChars(PRInt32 *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* float getComputedTextLength (); */
NS_IMETHODIMP nsSVGTSpanElement::GetComputedTextLength(float *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */
NS_IMETHODIMP nsSVGTSpanElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGPoint getStartPositionOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTSpanElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGPoint getEndPositionOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTSpanElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGRect getExtentOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTSpanElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* float getRotationOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTSpanElement::GetRotationOfChar(PRUint32 charnum, float *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* long getCharNumAtPosition (in nsIDOMSVGPoint point); */
NS_IMETHODIMP nsSVGTSpanElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* void selectSubString (in unsigned long charnum, in unsigned long nchars); */
NS_IMETHODIMP nsSVGTSpanElement::SelectSubString(PRUint32 charnum, PRUint32 nchars)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
//----------------------------------------------------------------------
// nsISVGContent methods
NS_IMETHODIMP
nsSVGTSpanElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
{
if (
// PresentationAttributes-FillStroke
name==nsSVGAtoms::fill ||
name==nsSVGAtoms::fill_opacity ||
name==nsSVGAtoms::fill_rule ||
name==nsSVGAtoms::stroke ||
name==nsSVGAtoms::stroke_dasharray ||
name==nsSVGAtoms::stroke_dashoffset ||
name==nsSVGAtoms::stroke_linecap ||
name==nsSVGAtoms::stroke_linejoin ||
name==nsSVGAtoms::stroke_miterlimit ||
name==nsSVGAtoms::stroke_opacity ||
name==nsSVGAtoms::stroke_width ||
// PresentationAttributes-Graphics
name==nsSVGAtoms::clip_path ||
name==nsSVGAtoms::clip_rule ||
name==nsSVGAtoms::cursor ||
name==nsSVGAtoms::display ||
name==nsSVGAtoms::filter ||
name==nsSVGAtoms::image_rendering ||
name==nsSVGAtoms::mask ||
name==nsSVGAtoms::opacity ||
name==nsSVGAtoms::pointer_events ||
name==nsSVGAtoms::shape_rendering ||
name==nsSVGAtoms::text_rendering ||
name==nsSVGAtoms::visibility ||
// PresentationAttributes-TextContentElements
name==nsSVGAtoms::alignment_baseline ||
name==nsSVGAtoms::baseline_shift ||
name==nsSVGAtoms::direction ||
name==nsSVGAtoms::dominant_baseline ||
name==nsSVGAtoms::glyph_orientation_horizontal ||
name==nsSVGAtoms::glyph_orientation_vertical ||
name==nsSVGAtoms::kerning ||
name==nsSVGAtoms::letter_spacing ||
name==nsSVGAtoms::text_anchor ||
name==nsSVGAtoms::text_decoration ||
name==nsSVGAtoms::unicode_bidi ||
name==nsSVGAtoms::word_spacing ||
// PresentationAttributes-FontSpecification
name==nsSVGAtoms::font_family ||
name==nsSVGAtoms::font_size ||
name==nsSVGAtoms::font_size_adjust ||
name==nsSVGAtoms::font_stretch ||
name==nsSVGAtoms::font_style ||
name==nsSVGAtoms::font_variant ||
name==nsSVGAtoms::font_weight
) {
*retval = PR_TRUE;
return NS_OK;
}
else
return nsSVGTSpanElementBase::IsPresentationAttribute(name, retval);
}
//----------------------------------------------------------------------
//
void nsSVGTSpanElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// x:
{
nsCOMPtr<nsIDOMSVGLengthList> dom_lengthlist;
mX->GetBaseVal(getter_AddRefs(dom_lengthlist));
nsCOMPtr<nsISVGLengthList> lengthlist = do_QueryInterface(dom_lengthlist);
NS_ASSERTION(lengthlist, "svg lengthlist missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
lengthlist->SetContext(ctx);
}
// y:
{
nsCOMPtr<nsIDOMSVGLengthList> dom_lengthlist;
mY->GetBaseVal(getter_AddRefs(dom_lengthlist));
nsCOMPtr<nsISVGLengthList> lengthlist = do_QueryInterface(dom_lengthlist);
NS_ASSERTION(lengthlist, "svg lengthlist missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
lengthlist->SetContext(ctx);
}
}

View File

@@ -1,461 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsIDOMSVGTextElement.h"
#include "nsCOMPtr.h"
#include "nsSVGAnimatedLengthList.h"
#include "nsSVGLengthList.h"
#include "nsISVGSVGElement.h"
#include "nsISVGViewportAxis.h"
#include "nsISVGViewportRect.h"
#include "nsISVGTextContentMetrics.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIDocument.h"
typedef nsSVGGraphicElement nsSVGTextElementBase;
class nsSVGTextElement : public nsSVGTextElementBase,
public nsIDOMSVGTextElement // : nsIDOMSVGTextPositioningElement
// : nsIDOMSVGTextContentElement
{
protected:
friend nsresult NS_NewSVGTextElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGTextElement();
virtual ~nsSVGTextElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGTEXTELEMENT
NS_DECL_NSIDOMSVGTEXTPOSITIONINGELEMENT
NS_DECL_NSIDOMSVGTEXTCONTENTELEMENT
// xxx If xpcom allowed virtual inheritance we wouldn't need to
// forward here :-(
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGTextElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGTextElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTextElementBase::)
// nsISVGContent interface
NS_IMETHOD IsPresentationAttribute(const nsIAtom* attribute, PRBool* retval);
protected:
virtual void ParentChainChanged();
already_AddRefed<nsISVGTextContentMetrics> GetTextContentMetrics();
// nsIDOMSVGTextPositioning properties:
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mX;
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mY;
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdX;
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdY;
};
nsresult NS_NewSVGTextElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGTextElement* it = new nsSVGTextElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGTextElement,nsSVGTextElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGTextElement,nsSVGTextElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGTextElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTextElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTextPositioningElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTextContentElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGTextElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGTextElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGTextElement::nsSVGTextElement()
{
}
nsSVGTextElement::~nsSVGTextElement()
{
}
nsresult
nsSVGTextElement::Init()
{
nsresult rv;
rv = nsSVGTextElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: nsIDOMSVGTextPositioningElement::x, #IMPLIED attrib: x
{
nsCOMPtr<nsISVGLengthList> lengthList;
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mX),
lengthList);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::x, mX);
NS_ENSURE_SUCCESS(rv,rv);
}
// DOM property: nsIDOMSVGTextPositioningElement::y, #IMPLIED attrib: y
{
nsCOMPtr<nsISVGLengthList> lengthList;
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mY),
lengthList);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::y, mY);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGTextElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGTextElement* it = new nsSVGTextElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGTextElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGTextElement methods
// - no methods -
//----------------------------------------------------------------------
// nsIDOMSVGTextPositioningElement methods
/* readonly attribute nsIDOMSVGAnimatedLengthList x; */
NS_IMETHODIMP nsSVGTextElement::GetX(nsIDOMSVGAnimatedLengthList * *aX)
{
*aX = mX;
NS_IF_ADDREF(*aX);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLengthList y; */
NS_IMETHODIMP nsSVGTextElement::GetY(nsIDOMSVGAnimatedLengthList * *aY)
{
*aY = mY;
NS_IF_ADDREF(*aY);
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedLengthList dx; */
NS_IMETHODIMP nsSVGTextElement::GetDx(nsIDOMSVGAnimatedLengthList * *aDx)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* readonly attribute nsIDOMSVGAnimatedLengthList dy; */
NS_IMETHODIMP nsSVGTextElement::GetDy(nsIDOMSVGAnimatedLengthList * *aDy)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* readonly attribute nsIDOMSVGAnimatedNumberList rotate; */
NS_IMETHODIMP nsSVGTextElement::GetRotate(nsIDOMSVGAnimatedNumberList * *aRotate)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
//----------------------------------------------------------------------
// nsIDOMSVGTextContentElement methods
/* readonly attribute nsIDOMSVGAnimatedLength textLength; */
NS_IMETHODIMP nsSVGTextElement::GetTextLength(nsIDOMSVGAnimatedLength * *aTextLength)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration lengthAdjust; */
NS_IMETHODIMP nsSVGTextElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration * *aLengthAdjust)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* long getNumberOfChars (); */
NS_IMETHODIMP nsSVGTextElement::GetNumberOfChars(PRInt32 *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* float getComputedTextLength (); */
NS_IMETHODIMP nsSVGTextElement::GetComputedTextLength(float *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */
NS_IMETHODIMP nsSVGTextElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGPoint getStartPositionOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTextElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGPoint getEndPositionOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTextElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGRect getExtentOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTextElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
return metrics->GetExtentOfChar(charnum, _retval);
}
/* float getRotationOfChar (in unsigned long charnum); */
NS_IMETHODIMP nsSVGTextElement::GetRotationOfChar(PRUint32 charnum, float *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* long getCharNumAtPosition (in nsIDOMSVGPoint point); */
NS_IMETHODIMP nsSVGTextElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* void selectSubString (in unsigned long charnum, in unsigned long nchars); */
NS_IMETHODIMP nsSVGTextElement::SelectSubString(PRUint32 charnum, PRUint32 nchars)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
//----------------------------------------------------------------------
// nsISVGContent methods
NS_IMETHODIMP
nsSVGTextElement::IsPresentationAttribute(const nsIAtom* name, PRBool *retval)
{
if (
// PresentationAttributes-TextContentElements
name==nsSVGAtoms::alignment_baseline ||
name==nsSVGAtoms::baseline_shift ||
name==nsSVGAtoms::direction ||
name==nsSVGAtoms::dominant_baseline ||
name==nsSVGAtoms::glyph_orientation_horizontal ||
name==nsSVGAtoms::glyph_orientation_vertical ||
name==nsSVGAtoms::kerning ||
name==nsSVGAtoms::letter_spacing ||
name==nsSVGAtoms::text_anchor ||
name==nsSVGAtoms::text_decoration ||
name==nsSVGAtoms::unicode_bidi ||
name==nsSVGAtoms::word_spacing ||
// PresentationAttributes-FontSpecification
name==nsSVGAtoms::font_family ||
name==nsSVGAtoms::font_size ||
name==nsSVGAtoms::font_size_adjust ||
name==nsSVGAtoms::font_stretch ||
name==nsSVGAtoms::font_style ||
name==nsSVGAtoms::font_variant ||
name==nsSVGAtoms::font_weight
) {
*retval = PR_TRUE;
return NS_OK;
}
else
return nsSVGTextElementBase::IsPresentationAttribute(name, retval);
}
//----------------------------------------------------------------------
//
void nsSVGTextElement::ParentChainChanged()
{
// set new context information on our length-properties:
nsCOMPtr<nsIDOMSVGSVGElement> dom_elem;
GetOwnerSVGElement(getter_AddRefs(dom_elem));
if (!dom_elem) return;
nsCOMPtr<nsISVGSVGElement> svg_elem = do_QueryInterface(dom_elem);
NS_ASSERTION(svg_elem, "<svg> element missing interface");
// x:
{
nsCOMPtr<nsIDOMSVGLengthList> dom_lengthlist;
mX->GetBaseVal(getter_AddRefs(dom_lengthlist));
nsCOMPtr<nsISVGLengthList> lengthlist = do_QueryInterface(dom_lengthlist);
NS_ASSERTION(lengthlist, "svg lengthlist missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetXAxis(getter_AddRefs(ctx));
lengthlist->SetContext(ctx);
}
// y:
{
nsCOMPtr<nsIDOMSVGLengthList> dom_lengthlist;
mY->GetBaseVal(getter_AddRefs(dom_lengthlist));
nsCOMPtr<nsISVGLengthList> lengthlist = do_QueryInterface(dom_lengthlist);
NS_ASSERTION(lengthlist, "svg lengthlist missing interface");
nsCOMPtr<nsIDOMSVGRect> vp_dom;
svg_elem->GetViewport(getter_AddRefs(vp_dom));
nsCOMPtr<nsISVGViewportRect> vp = do_QueryInterface(vp_dom);
nsCOMPtr<nsISVGViewportAxis> ctx;
vp->GetYAxis(getter_AddRefs(ctx));
lengthlist->SetContext(ctx);
}
}
already_AddRefed<nsISVGTextContentMetrics>
nsSVGTextElement::GetTextContentMetrics()
{
if (!mDocument) {
NS_ERROR("no document");
return nsnull;
}
nsIPresShell* presShell = mDocument->GetShellAt(0);
if (!presShell) {
NS_ERROR("no presshell");
return nsnull;
}
nsIFrame* frame;
presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);
if (!frame) {
NS_ERROR("no frame");
return nsnull;
}
nsISVGTextContentMetrics* metrics;
frame->QueryInterface(NS_GET_IID(nsISVGTextContentMetrics),(void**)&metrics);
NS_ASSERTION(metrics, "wrong frame type");
return metrics;
}

View File

@@ -1,352 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGTransform.h"
#include "prdtoa.h"
#include "nsSVGMatrix.h"
#include "nsSVGAtoms.h"
#include "nsSVGValue.h"
#include "nsIWeakReference.h"
#include "nsSVGMatrix.h"
#include "nsTextFormatter.h"
////////////////////////////////////////////////////////////////////////
// nsSVGTransform 'letter' class
class nsSVGTransform : public nsIDOMSVGTransform,
public nsSVGValue
{
public:
static nsresult Create(nsIDOMSVGTransform** aResult);
protected:
nsSVGTransform();
nsresult Init();
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGTransform interface:
NS_DECL_NSIDOMSVGTRANSFORM
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
protected:
nsCOMPtr<nsIDOMSVGMatrix> mMatrix;
float mAngle, mOriginX, mOriginY;
PRUint16 mType;
};
//----------------------------------------------------------------------
// Implementation
nsresult
nsSVGTransform::Create(nsIDOMSVGTransform** aResult)
{
nsSVGTransform *pl = new nsSVGTransform();
NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(pl);
if (NS_FAILED(pl->Init())) {
NS_RELEASE(pl);
return NS_ERROR_FAILURE;
}
*aResult = pl;
return NS_OK;
}
nsSVGTransform::nsSVGTransform()
: mAngle(0.0f),
mOriginX(0.0f),
mOriginY(0.0f),
mType( SVG_TRANSFORM_MATRIX )
{
}
nsresult nsSVGTransform::Init()
{
return nsSVGMatrix::Create(getter_AddRefs(mMatrix));
// XXX register as matrix observer
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGTransform)
NS_IMPL_RELEASE(nsSVGTransform)
NS_INTERFACE_MAP_BEGIN(nsSVGTransform)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTransform)
// NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
// NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGTransform)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGTransform::SetValueString(const nsAString& aValue)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
nsSVGTransform::GetValueString(nsAString& aValue)
{
aValue.Truncate();
PRUnichar buf[256];
switch (mType) {
case nsIDOMSVGTransform::SVG_TRANSFORM_TRANSLATE:
{
float dx, dy;
mMatrix->GetE(&dx);
mMatrix->GetF(&dy);
if (dy != 0.0f)
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), NS_LITERAL_STRING("translate(%g, %g)").get(), dx, dy);
else
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar), NS_LITERAL_STRING("translate(%g)").get(), dx);
}
break;
case nsIDOMSVGTransform::SVG_TRANSFORM_ROTATE:
{
if (mOriginX != 0.0f || mOriginY != 0.0f)
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("rotate(%g, %g, %g)").get(),
mAngle, mOriginX, mOriginY);
else
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("rotate(%g)").get(), mAngle);
}
break;
case nsIDOMSVGTransform::SVG_TRANSFORM_SCALE:
{
float sx, sy;
mMatrix->GetA(&sx);
mMatrix->GetD(&sy);
if (sy != 0.0f)
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("scale(%g, %g)").get(), sx, sy);
else
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("scale(%g)").get(), sx);
}
break;
case nsIDOMSVGTransform::SVG_TRANSFORM_SKEWX:
{
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("skewX(%g)").get(), mAngle);
}
break;
case nsIDOMSVGTransform::SVG_TRANSFORM_SKEWY:
{
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
NS_LITERAL_STRING("skewY(%g)").get(), mAngle);
}
break;
default:
buf[0] = '\0';
NS_NOTYETIMPLEMENTED("write me!");
break;
}
aValue.Append(buf);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGTransform methods:
/* readonly attribute unsigned short type; */
NS_IMETHODIMP nsSVGTransform::GetType(PRUint16 *aType)
{
*aType = mType;
return NS_OK;
}
/* readonly attribute nsIDOMSVGMatrix matrix; */
NS_IMETHODIMP nsSVGTransform::GetMatrix(nsIDOMSVGMatrix * *aMatrix)
{
// XXX should we make a copy here? is the matrix supposed to be live
// or not?
*aMatrix = mMatrix;
NS_IF_ADDREF(*aMatrix);
return NS_OK;
}
/* readonly attribute float angle; */
NS_IMETHODIMP nsSVGTransform::GetAngle(float *aAngle)
{
*aAngle = mAngle;
return NS_OK;
}
/* void setMatrix (in nsIDOMSVGMatrix matrix); */
NS_IMETHODIMP nsSVGTransform::SetMatrix(nsIDOMSVGMatrix *matrix)
{
WillModify();
mType = SVG_TRANSFORM_MATRIX;
mAngle = 0.0f;
mOriginX = 0.0f;
mOriginY = 0.0f;
// XXX should we copy the matrix instead of replacing?
mMatrix = matrix;
DidModify();
return NS_OK;
}
/* void setTranslate (in float tx, in float ty); */
NS_IMETHODIMP nsSVGTransform::SetTranslate(float tx, float ty)
{
WillModify();
mType = SVG_TRANSFORM_TRANSLATE;
mAngle = 0.0f;
mOriginX = 0.0f;
mOriginY = 0.0f;
mMatrix->SetA(1.0f);
mMatrix->SetB(0.0f);
mMatrix->SetC(0.0f);
mMatrix->SetD(1.0f);
mMatrix->SetE(tx);
mMatrix->SetF(ty);
DidModify();
return NS_OK;
}
/* void setScale (in float sx, in float sy); */
NS_IMETHODIMP nsSVGTransform::SetScale(float sx, float sy)
{
WillModify();
mType = SVG_TRANSFORM_SCALE;
mAngle = 0.0f;
mOriginX = 0.0f;
mOriginY = 0.0f;
mMatrix->SetA(sx);
mMatrix->SetB(0.0f);
mMatrix->SetC(0.0f);
mMatrix->SetD(sy);
mMatrix->SetE(0.0f);
mMatrix->SetF(0.0f);
DidModify();
return NS_OK;
}
/* void setRotate (in float angle, in float cx, in float cy); */
NS_IMETHODIMP nsSVGTransform::SetRotate(float angle, float cx, float cy)
{
WillModify();
mType = SVG_TRANSFORM_ROTATE;
mAngle = angle;
mOriginX = cx;
mOriginY = cy;
nsSVGMatrix::Create(getter_AddRefs(mMatrix));
nsCOMPtr<nsIDOMSVGMatrix> temp;
mMatrix->Translate(cx, cy, getter_AddRefs(temp));
mMatrix = temp;
mMatrix->Rotate(angle, getter_AddRefs(temp));
mMatrix = temp;
mMatrix->Translate(-cx,-cy, getter_AddRefs(temp));
mMatrix = temp;
DidModify();
return NS_OK;
}
/* void setSkewX (in float angle); */
NS_IMETHODIMP nsSVGTransform::SetSkewX(float angle)
{
WillModify();
mType = SVG_TRANSFORM_SKEWX;
mAngle = angle;
nsSVGMatrix::Create(getter_AddRefs(mMatrix));
nsCOMPtr<nsIDOMSVGMatrix> temp;
mMatrix->SkewX(angle, getter_AddRefs(temp));
mMatrix = temp;
DidModify();
return NS_OK;
}
/* void setSkewY (in float angle); */
NS_IMETHODIMP nsSVGTransform::SetSkewY(float angle)
{
WillModify();
mType = SVG_TRANSFORM_SKEWY;
mAngle = angle;
nsSVGMatrix::Create(getter_AddRefs(mMatrix));
nsCOMPtr<nsIDOMSVGMatrix> temp;
mMatrix->SkewY(angle, getter_AddRefs(temp));
mMatrix = temp;
DidModify();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions:
nsresult
NS_NewSVGTransform(nsIDOMSVGTransform** result)
{
return nsSVGTransform::Create(result);
}

View File

@@ -1,507 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGTransformList.h"
#include "nsSVGTransform.h"
#include "nsSVGMatrix.h"
#include "nsDOMError.h"
#include "prdtoa.h"
#include "nsSVGAtoms.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsCOMArray.h"
nsresult
nsSVGTransformList::Create(const nsAString& aValue,
nsISVGValue** aResult)
{
*aResult = (nsISVGValue*) new nsSVGTransformList();
if(!*aResult) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
(*aResult)->SetValueString(aValue);
return NS_OK;
}
nsresult
nsSVGTransformList::Create(nsIDOMSVGTransformList** aResult)
{
*aResult = (nsIDOMSVGTransformList*) new nsSVGTransformList();
if(!*aResult) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aResult);
return NS_OK;
}
nsSVGTransformList::nsSVGTransformList()
{
}
nsSVGTransformList::~nsSVGTransformList()
{
ReleaseTransforms();
}
void
nsSVGTransformList::ReleaseTransforms()
{
WillModify();
PRInt32 count = mTransforms.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIDOMSVGTransform* transform = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(transform);
if (val)
val->RemoveObserver(this);
NS_RELEASE(transform);
}
mTransforms.Clear();
DidModify();
}
nsIDOMSVGTransform*
nsSVGTransformList::ElementAt(PRInt32 index)
{
return (nsIDOMSVGTransform*)mTransforms.ElementAt(index);
}
void
nsSVGTransformList::AppendElement(nsIDOMSVGTransform* aElement)
{
WillModify();
NS_ADDREF(aElement);
mTransforms.AppendElement((void*)aElement);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
void
nsSVGTransformList::RemoveElementAt(PRInt32 index)
{
WillModify();
nsIDOMSVGTransform* transform = ElementAt(index);
NS_ASSERTION(transform, "null transform");
nsCOMPtr<nsISVGValue> val = do_QueryInterface(transform);
if (val)
val->RemoveObserver(this);
mTransforms.RemoveElementAt(index);
NS_RELEASE(transform);
DidModify();
}
void
nsSVGTransformList::InsertElementAt(nsIDOMSVGTransform* aElement, PRInt32 index)
{
WillModify();
NS_ADDREF(aElement);
mTransforms.InsertElementAt((void*)aElement, index);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
//----------------------------------------------------------------------
// XPConnect interface list
NS_CLASSINFO_MAP_BEGIN(SVGTransformList)
NS_CLASSINFO_MAP_ENTRY(nsIDOMSVGTransformList)
NS_CLASSINFO_MAP_END
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGTransformList)
NS_IMPL_RELEASE(nsSVGTransformList)
NS_INTERFACE_MAP_BEGIN(nsSVGTransformList)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTransformList)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGTransformList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGTransformList::SetValueString(const nsAString& aValue)
{
// XXX: we don't implement the _exact_ BNF given in the
// specs.
nsresult rv = NS_OK;
char *str = ToNewCString(aValue);
char* rest = str;
char* keyword;
char* args;
const char* delimiters1 = "\x20\x9\xD\xA,(";
const char* delimiters2 = "()";
const char* delimiters3 = "\x20\x9\xD\xA,";
nsCOMArray<nsIDOMSVGTransform> xforms;
while ((keyword = nsCRT::strtok(rest, delimiters1, &rest))) {
while (rest && isspace(*rest))
++rest;
if (!(args = nsCRT::strtok(rest, delimiters2, &rest))) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
nsCOMPtr<nsIDOMSVGTransform> transform;
NS_NewSVGTransform(getter_AddRefs(transform));
if (!transform) {
rv = NS_ERROR_OUT_OF_MEMORY;
break;
}
nsCOMPtr<nsIAtom> keyatom = do_GetAtom(keyword);
if (keyatom == nsSVGAtoms::translate) {
char* arg1 = nsCRT::strtok(args, delimiters3, &args);
if (!arg1) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
char* arg2 = nsCRT::strtok(args, delimiters3, &args);
char* end;
float tx = (float) PR_strtod(arg1, &end);
float ty = arg2 ? (float) PR_strtod(arg2, &end) : 0.0f;
transform->SetTranslate(tx, ty);
}
else if (keyatom == nsSVGAtoms::scale) {
char* arg1 = nsCRT::strtok(args, delimiters3, &args);
if (!arg1) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
char* arg2 = nsCRT::strtok(args, delimiters3, &args);
char* end;
float sx = (float) PR_strtod(arg1, &end);
float sy = arg2 ? (float) PR_strtod(arg2, &end) : sx;
transform->SetScale(sx, sy);
}
else if (keyatom == nsSVGAtoms::rotate) {
char* arg1 = nsCRT::strtok(args, delimiters3, &args);
if (!arg1) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
char* arg2 = nsCRT::strtok(args, delimiters3, &args);
char* arg3 = arg2 ? nsCRT::strtok(args, delimiters3, &args) : nsnull;
if (arg2 && !arg3) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
char* end;
float angle = (float) PR_strtod(arg1, &end);
float cx = arg2 ? (float) PR_strtod(arg2, &end) : 0.0f;
float cy = arg3 ? (float) PR_strtod(arg3, &end) : 0.0f;
transform->SetRotate(angle, cx, cy);
}
else if (keyatom == nsSVGAtoms::skewX) {
char* arg1 = nsCRT::strtok(args, delimiters3, &args);
if (!arg1) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
char* end;
float angle = (float) PR_strtod(arg1, &end);
transform->SetSkewX(angle);
}
else if (keyatom == nsSVGAtoms::skewY) {
char* arg1 = nsCRT::strtok(args, delimiters3, &args);
if (!arg1) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
char* end;
float angle = (float) PR_strtod(arg1, &end);
transform->SetSkewY(angle);
}
else if (keyatom == nsSVGAtoms::matrix) {
char *arg, *end;
arg = nsCRT::strtok(args, delimiters3, &args);
if (!arg) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
float a = (float) PR_strtod(arg, &end);
arg = nsCRT::strtok(args, delimiters3, &args);
if (!arg) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
float b = (float) PR_strtod(arg, &end);
arg = nsCRT::strtok(args, delimiters3, &args);
if (!arg) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
float c = (float) PR_strtod(arg, &end);
arg = nsCRT::strtok(args, delimiters3, &args);
if (!arg) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
float d = (float) PR_strtod(arg, &end);
arg = nsCRT::strtok(args, delimiters3, &args);
if (!arg) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
float e = (float) PR_strtod(arg, &end);
arg = nsCRT::strtok(args, delimiters3, &args);
if (!arg) {
rv = NS_ERROR_FAILURE;
break; // parse error
}
float f = (float) PR_strtod(arg, &end);
nsCOMPtr<nsIDOMSVGMatrix> matrix;
nsSVGMatrix::Create(getter_AddRefs(matrix),
a, b, c, d, e, f);
NS_ASSERTION(matrix, "couldn't create matrix");
transform->SetMatrix(matrix);
}
else { // parse error
rv = NS_ERROR_FAILURE;
break;
}
xforms.AppendObject(transform);
}
if (keyword || NS_FAILED(rv)) {
// there was a parse error.
rv = NS_ERROR_FAILURE;
NS_ERROR("transform-attribute parse error");
}
else {
WillModify();
ReleaseTransforms();
PRInt32 count = xforms.Count();
for (PRInt32 i=0; i<count; ++i) {
AppendElement(xforms.ObjectAt(i));
}
DidModify();
}
nsMemory::Free(str);
return rv;
}
NS_IMETHODIMP
nsSVGTransformList::GetValueString(nsAString& aValue)
{
aValue.Truncate();
PRInt32 count = mTransforms.Count();
if (count<=0) return NS_OK;
PRInt32 i = 0;
while (1) {
nsIDOMSVGTransform* transform = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(transform);
nsAutoString str;
val->GetValueString(str);
aValue.Append(str);
if (++i >= count) break;
aValue.Append(NS_LITERAL_STRING(" "));
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGTransformList methods:
/* readonly attribute unsigned long numberOfItems; */
NS_IMETHODIMP nsSVGTransformList::GetNumberOfItems(PRUint32 *aNumberOfItems)
{
*aNumberOfItems = mTransforms.Count();
return NS_OK;
}
/* void clear (); */
NS_IMETHODIMP nsSVGTransformList::Clear()
{
WillModify();
ReleaseTransforms();
DidModify();
return NS_OK;
}
/* nsIDOMSVGTransform initialize (in nsIDOMSVGTransform newItem); */
NS_IMETHODIMP nsSVGTransformList::Initialize(nsIDOMSVGTransform *newItem, nsIDOMSVGTransform **_retval)
{
Clear();
return AppendItem(newItem, _retval);
}
/* nsIDOMSVGTransform getItem (in unsigned long index); */
NS_IMETHODIMP nsSVGTransformList::GetItem(PRUint32 index, nsIDOMSVGTransform **_retval)
{
if ((PRInt32)index >= mTransforms.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIDOMSVGTransform insertItemBefore (in nsIDOMSVGTransform newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGTransformList::InsertItemBefore(nsIDOMSVGTransform *newItem, PRUint32 index, nsIDOMSVGTransform **_retval)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGTransform replaceItem (in nsIDOMSVGTransform newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGTransformList::ReplaceItem(nsIDOMSVGTransform *newItem, PRUint32 index, nsIDOMSVGTransform **_retval)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGTransform removeItem (in unsigned long index); */
NS_IMETHODIMP nsSVGTransformList::RemoveItem(PRUint32 index, nsIDOMSVGTransform **_retval)
{
if ((PRInt32)index >= mTransforms.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
WillModify();
RemoveElementAt(index);
DidModify();
return NS_OK;
}
/* nsIDOMSVGTransform appendItem (in nsIDOMSVGTransform newItem); */
NS_IMETHODIMP nsSVGTransformList::AppendItem(nsIDOMSVGTransform *newItem, nsIDOMSVGTransform **_retval)
{
// XXX The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list'. We don't do that. Should we?
*_retval = newItem;
NS_ADDREF(*_retval);
AppendElement(newItem);
return NS_OK;
}
/* nsIDOMSVGTransform createSVGTransformFromMatrix (in nsIDOMSVGMatrix matrix); */
NS_IMETHODIMP
nsSVGTransformList::CreateSVGTransformFromMatrix(nsIDOMSVGMatrix *matrix,
nsIDOMSVGTransform **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGTransform consolidate (); */
NS_IMETHODIMP nsSVGTransformList::Consolidate(nsIDOMSVGTransform **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_UNEXPECTED;
}
/* nsIDOMSVGMatrix getConsolidation (); */
NS_IMETHODIMP nsSVGTransformList::GetConsolidation(nsIDOMSVGMatrix **_retval)
{
PRInt32 count = mTransforms.Count();
nsCOMPtr<nsIDOMSVGMatrix> consolidation;
nsSVGMatrix::Create(getter_AddRefs(consolidation));
for (PRInt32 i = 0; i < count; ++i) {
nsIDOMSVGTransform* transform = ElementAt(i);
nsCOMPtr<nsIDOMSVGMatrix> matrix;
transform->GetMatrix(getter_AddRefs(matrix));
nsCOMPtr<nsIDOMSVGMatrix> temp;
consolidation->Multiply(matrix, getter_AddRefs(temp));
consolidation = temp;
}
*_retval = consolidation;
NS_ADDREF(*_retval);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGTransformList::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGTransformList::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}

View File

@@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGTYPECIDS_H__
#define __NS_SVGTYPECIDS_H__
// {AAD39B18-B9D3-45E1-B5A6-80C0EB12B23E}
#define NS_SVGRECT_CID \
{ 0xaad39b18, 0xb9d3, 0x45e1, { 0xb5, 0xa6, 0x80, 0xc0, 0xeb, 0x12, 0xb2, 0x3e } }
#define NS_SVGRECT_CONTRACTID \
"@mozilla.org/svg/rect;1"
#endif // __NS_SVGTYPECIDS_H__

View File

@@ -1,131 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGValue.h"
#include "nsIWeakReference.h"
nsSVGValue::nsSVGValue()
: mModifyNestCount(0)
{
}
nsSVGValue::~nsSVGValue()
{
ReleaseObservers();
}
void
nsSVGValue::ReleaseObservers()
{
PRInt32 count = mObservers.Count();
PRInt32 i;
for (i = 0; i < count; ++i) {
nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
NS_RELEASE(wr);
}
while (i)
mObservers.RemoveElementAt(--i);
}
void
nsSVGValue::NotifyObservers(SVGObserverNotifyFunction f)
{
PRInt32 count = mObservers.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
nsCOMPtr<nsISVGValueObserver> observer = do_QueryReferent(wr);
if(observer)
(NS_STATIC_CAST(nsISVGValueObserver*,observer)->*f)(this);
}
}
void
nsSVGValue::WillModify()
{
if (++mModifyNestCount == 1)
NotifyObservers(&nsISVGValueObserver::WillModifySVGObservable);
}
void
nsSVGValue::DidModify()
{
NS_ASSERTION(mModifyNestCount>0, "unbalanced Will/DidModify calls");
if (--mModifyNestCount == 0) {
OnDidModify();
NotifyObservers(&nsISVGValueObserver::DidModifySVGObservable);
}
}
NS_IMETHODIMP
nsSVGValue::AddObserver(nsISVGValueObserver* observer)
{
nsIWeakReference* wr = NS_GetWeakReference(observer);
if (!wr) return NS_ERROR_FAILURE;
mObservers.AppendElement((void*)wr);
return NS_OK;
}
NS_IMETHODIMP
nsSVGValue::RemoveObserver(nsISVGValueObserver* observer)
{
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(observer);
if (!wr) return NS_ERROR_FAILURE;
PRInt32 i = mObservers.IndexOf((void*)wr);
if (i<0) return NS_ERROR_FAILURE;
nsIWeakReference* wr2 = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
NS_RELEASE(wr2);
mObservers.RemoveElementAt(i);
return NS_OK;
}
NS_IMETHODIMP
nsSVGValue::BeginBatchUpdate()
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGValue::EndBatchUpdate()
{
DidModify();
return NS_OK;
}

View File

@@ -1,84 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGVALUE_H__
#define __NS_SVGVALUE_H__
#include "nscore.h"
#include "nsISVGValue.h"
#include "nsGenericElement.h" // for nsSmallVoidArray
#include "nsISVGValueObserver.h"
class nsSVGValue : public nsISVGValue
{
protected:
nsSVGValue();
virtual ~nsSVGValue();
// to be called by subclass whenever value is being modified.
// nested calls will be ignored, so calls need to be balanced
void WillModify();
void DidModify();
public:
// Partial Implementation of nsISVGValue interface:
NS_IMETHOD AddObserver(nsISVGValueObserver* observer);
NS_IMETHOD RemoveObserver(nsISVGValueObserver* observer);
NS_IMETHOD BeginBatchUpdate();
NS_IMETHOD EndBatchUpdate();
typedef
NS_STDCALL_FUNCPROTO(nsresult,
SVGObserverNotifyFunction,
nsISVGValueObserver, DidModifySVGObservable,
(nsISVGValue*));
protected:
// implementation helpers
void ReleaseObservers();
void NotifyObservers(SVGObserverNotifyFunction f);
PRInt32 GetModifyNestCount() { return mModifyNestCount; }
private:
virtual void OnDidModify(){}; // hook that will be called before observers are notified
nsSmallVoidArray mObservers;
PRInt32 mModifyNestCount;
};
#endif //__NS_SVGVALUE_H__

View File

@@ -1,504 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsISVGViewportAxis.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsISVGViewportRect.h"
#include "nsSVGNumber.h"
#include "nsISVGValue.h"
#include "nsSVGValue.h"
#include "nsISVGValueObserver.h"
#include "nsISVGValueUtils.h"
#include "nsDOMError.h"
#include <math.h>
////////////////////////////////////////////////////////////////////////
// nsSVGViewportAxis : helper class implementing nsISVGViewportAxis
class nsSVGViewportAxis : public nsISVGViewportAxis
// ,public nsISVGValueObserver,
// public nsSupportsWeakReference
{
protected:
friend nsresult NS_NewSVGViewportAxis(nsISVGViewportAxis **result,
nsIDOMSVGNumber* scale,
nsIDOMSVGNumber* length);
nsSVGViewportAxis();
nsresult Init(nsIDOMSVGNumber* scale, nsIDOMSVGNumber* length);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsISVGViewportAxis methods:
NS_IMETHOD GetMillimeterPerPixel(nsIDOMSVGNumber **scale);
NS_IMETHOD GetLength(nsIDOMSVGNumber **length);
// nsISVGValueObserver
// NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
// NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
private:
nsCOMPtr<nsIDOMSVGNumber> mScale;
nsCOMPtr<nsIDOMSVGNumber> mLength;
};
//----------------------------------------------------------------------
// Implementation
nsresult
NS_NewSVGViewportAxis(nsISVGViewportAxis **result, nsIDOMSVGNumber* scale,
nsIDOMSVGNumber* length)
{
*result = nsnull;
nsSVGViewportAxis *va = new nsSVGViewportAxis();
NS_ENSURE_TRUE(va, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(va);
nsresult rv = va->Init(scale, length);
if (NS_FAILED(rv)) {
NS_RELEASE(va);
return rv;
}
*result = va;
return rv;
}
nsSVGViewportAxis::nsSVGViewportAxis()
{
}
nsresult
nsSVGViewportAxis::Init(nsIDOMSVGNumber* scale,
nsIDOMSVGNumber* length)
{
mScale = scale;
mLength = length;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGViewportAxis)
NS_IMPL_RELEASE(nsSVGViewportAxis)
NS_INTERFACE_MAP_BEGIN(nsSVGViewportAxis)
NS_INTERFACE_MAP_ENTRY(nsISVGViewportAxis)
// NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
// NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGViewportAxis)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGViewportAxis methods:
NS_IMETHODIMP
nsSVGViewportAxis::GetMillimeterPerPixel(nsIDOMSVGNumber **scale)
{
*scale = mScale;
NS_ADDREF(*scale);
return NS_OK;
}
NS_IMETHODIMP
nsSVGViewportAxis::GetLength(nsIDOMSVGNumber **length)
{
*length = mLength;
NS_ADDREF(*length);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
// NS_IMETHODIMP
// nsSVGViewportAxis::WillModifySVGObservable(nsISVGValue* observable)
// {
// return NS_OK;
// }
// NS_IMETHODIMP
// nsSVGViewportAxis::DidModifySVGObservable(nsISVGValue* observable)
// {
// // we only listen in on changes to the length
// UpdateLength();
// return NS_OK;
// }
////////////////////////////////////////////////////////////////////////
// nsSVGViewportRect
class nsSVGViewportRect : public nsISVGViewportRect,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult
NS_NewSVGViewportRect(nsISVGViewportRect **result,
nsIDOMSVGNumber* scalex,
nsIDOMSVGNumber* scaley,
nsIDOMSVGNumber* lengthx,
nsIDOMSVGNumber* lengthy);
nsSVGViewportRect();
~nsSVGViewportRect();
nsresult Init(nsIDOMSVGNumber* scalex,
nsIDOMSVGNumber* scaley,
nsIDOMSVGNumber* lengthx,
nsIDOMSVGNumber* lengthy);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsISVGViewportRect interface:
NS_IMETHOD GetXAxis(nsISVGViewportAxis **xaxis);
NS_IMETHOD GetYAxis(nsISVGViewportAxis **yaxis);
NS_IMETHOD GetUnspecifiedAxis(nsISVGViewportAxis **axis);
// nsIDOMSVGRect interface:
NS_DECL_NSIDOMSVGRECT
// nsISVGValue interface:
NS_IMETHOD SetValueString(const nsAString& aValue);
NS_IMETHOD GetValueString(nsAString& aValue);
// nsISVGValueObserver interface:
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable);
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable);
// nsISupportsWeakReference
// implementation inherited from nsSupportsWeakReference
protected:
void UpdateGenericAxisScale();
void UpdateGenericAxisLength();
private:
virtual void OnDidModify();
nsCOMPtr<nsISVGViewportAxis> mAxisX;
nsCOMPtr<nsISVGViewportAxis> mAxisY;
nsCOMPtr<nsISVGViewportAxis> mAxisUnspecified;
};
//----------------------------------------------------------------------
// implementation:
nsresult
NS_NewSVGViewportRect(nsISVGViewportRect **result,
nsIDOMSVGNumber* scalex,
nsIDOMSVGNumber* scaley,
nsIDOMSVGNumber* lengthx,
nsIDOMSVGNumber* lengthy)
{
*result = nsnull;
nsSVGViewportRect *vr = new nsSVGViewportRect();
if (!vr) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(vr);
nsresult rv = vr->Init(scalex, scaley, lengthx, lengthy);
if (NS_FAILED(rv)) {
NS_RELEASE(vr);
return rv;
}
*result = vr;
return NS_OK;
}
nsSVGViewportRect::nsSVGViewportRect()
{
}
nsSVGViewportRect::~nsSVGViewportRect()
{
if (mAxisX) {
nsCOMPtr<nsIDOMSVGNumber> l;
mAxisX->GetLength(getter_AddRefs(l));
NS_REMOVE_SVGVALUE_OBSERVER(l);
nsCOMPtr<nsIDOMSVGNumber> s;
mAxisX->GetMillimeterPerPixel(getter_AddRefs(s));
NS_REMOVE_SVGVALUE_OBSERVER(s);
}
if (mAxisY) {
nsCOMPtr<nsIDOMSVGNumber> l;
mAxisY->GetLength(getter_AddRefs(l));
NS_REMOVE_SVGVALUE_OBSERVER(l);
nsCOMPtr<nsIDOMSVGNumber> s;
mAxisY->GetMillimeterPerPixel(getter_AddRefs(s));
NS_REMOVE_SVGVALUE_OBSERVER(s);
}
}
nsresult
nsSVGViewportRect::Init(nsIDOMSVGNumber* scalex, nsIDOMSVGNumber* scaley,
nsIDOMSVGNumber* lengthx, nsIDOMSVGNumber* lengthy)
{
nsresult rv;
rv = NS_NewSVGViewportAxis(getter_AddRefs(mAxisX), scalex,lengthx);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGViewportAxis(getter_AddRefs(mAxisY), scaley,lengthy);
NS_ENSURE_SUCCESS(rv,rv);
{
nsCOMPtr<nsIDOMSVGNumber> sqrt_scale;
rv = NS_NewSVGNumber(getter_AddRefs(sqrt_scale));
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsIDOMSVGNumber> sqrt_length;
rv = NS_NewSVGNumber(getter_AddRefs(sqrt_length));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGViewportAxis(getter_AddRefs(mAxisUnspecified),
sqrt_scale,sqrt_length);
NS_ENSURE_SUCCESS(rv,rv);
UpdateGenericAxisScale();
UpdateGenericAxisLength();
}
NS_ADD_SVGVALUE_OBSERVER(scalex);
NS_ADD_SVGVALUE_OBSERVER(scaley);
NS_ADD_SVGVALUE_OBSERVER(lengthx);
NS_ADD_SVGVALUE_OBSERVER(lengthy);
return rv;
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGViewportRect)
NS_IMPL_RELEASE(nsSVGViewportRect)
NS_INTERFACE_MAP_BEGIN(nsSVGViewportRect)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
NS_INTERFACE_MAP_ENTRY(nsISVGViewportRect)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRect)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGViewportRect methods:
NS_IMETHODIMP
nsSVGViewportRect::GetXAxis(nsISVGViewportAxis **xaxis)
{
*xaxis = mAxisX;
NS_ADDREF(*xaxis);
return NS_OK;
}
NS_IMETHODIMP
nsSVGViewportRect::GetYAxis(nsISVGViewportAxis **yaxis)
{
*yaxis = mAxisY;
NS_ADDREF(*yaxis);
return NS_OK;
}
NS_IMETHODIMP
nsSVGViewportRect::GetUnspecifiedAxis(nsISVGViewportAxis **axis)
{
*axis = mAxisUnspecified;
NS_ADDREF(*axis);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGRect methods:
/* attribute float x; */
NS_IMETHODIMP
nsSVGViewportRect::GetX(float *aX)
{
*aX = 0.0f;
return NS_OK;
}
NS_IMETHODIMP
nsSVGViewportRect::SetX(float aX)
{
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; // XXX return different error
}
/* attribute float y; */
NS_IMETHODIMP
nsSVGViewportRect::GetY(float *aY)
{
*aY = 0.0f;
return NS_OK;
}
NS_IMETHODIMP
nsSVGViewportRect::SetY(float aY)
{
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
/* attribute float width; */
NS_IMETHODIMP
nsSVGViewportRect::GetWidth(float *aWidth)
{
nsCOMPtr<nsIDOMSVGNumber> l;
mAxisX->GetLength(getter_AddRefs(l));
return l->GetValue(aWidth);
}
NS_IMETHODIMP
nsSVGViewportRect::SetWidth(float aWidth)
{
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
/* attribute float height; */
NS_IMETHODIMP
nsSVGViewportRect::GetHeight(float *aHeight)
{
nsCOMPtr<nsIDOMSVGNumber> l;
mAxisY->GetLength(getter_AddRefs(l));
return l->GetValue(aHeight);
}
NS_IMETHODIMP
nsSVGViewportRect::SetHeight(float aHeight)
{
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
}
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGViewportRect::SetValueString(const nsAString& aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSVGViewportRect::GetValueString(nsAString& aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods:
NS_IMETHODIMP
nsSVGViewportRect::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGViewportRect::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
//----------------------------------------------------------------------
// helpers:
void nsSVGViewportRect::UpdateGenericAxisLength()
{
float x;
{
nsCOMPtr<nsIDOMSVGNumber> l_x;
mAxisX->GetLength(getter_AddRefs(l_x));
l_x->GetValue(&x);
}
float y;
{
nsCOMPtr<nsIDOMSVGNumber> l_y;
mAxisY->GetLength(getter_AddRefs(l_y));
l_y->GetValue(&y);
}
nsCOMPtr<nsIDOMSVGNumber> l_sqrt;
mAxisUnspecified->GetLength (getter_AddRefs(l_sqrt));
l_sqrt->SetValue((float)sqrt((x*x + y*y)/2.0f));
}
void nsSVGViewportRect::UpdateGenericAxisScale()
{
float x;
{
nsCOMPtr<nsIDOMSVGNumber> s_x;
mAxisX->GetMillimeterPerPixel(getter_AddRefs(s_x));
s_x->GetValue(&x);
}
float y;
{
nsCOMPtr<nsIDOMSVGNumber> s_y;
mAxisY->GetMillimeterPerPixel(getter_AddRefs(s_y));
s_y->GetValue(&y);
}
nsCOMPtr<nsIDOMSVGNumber> s_sqrt;
mAxisUnspecified->GetMillimeterPerPixel(getter_AddRefs(s_sqrt));
s_sqrt->SetValue((float)sqrt(x*x + y*y));
}
void nsSVGViewportRect::OnDidModify()
{
UpdateGenericAxisLength();
UpdateGenericAxisScale();
}

View File

@@ -1,158 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Bradley Baetz.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bradley Baetz <bbaetz@cs.mcgill.ca> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGDocument.h"
#include "nsIDOMClassInfo.h"
#include "nsContentUtils.h"
#include "nsIHttpChannel.h"
#include "nsString.h"
#include "nsLiteralString.h"
#include "nsReadableUtils.h"
NS_INTERFACE_MAP_BEGIN(nsSVGDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGDocument)
NS_INTERFACE_MAP_END_INHERITING(nsXMLDocument)
NS_IMPL_ADDREF_INHERITED(nsSVGDocument, nsXMLDocument)
NS_IMPL_RELEASE_INHERITED(nsSVGDocument, nsXMLDocument)
nsSVGDocument::nsSVGDocument() {
}
nsSVGDocument::~nsSVGDocument() {
}
nsresult
nsSVGDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener **aDocListener,
PRBool aReset,
nsIContentSink* aSink) {
nsresult rv = nsXMLDocument::StartDocumentLoad(aCommand,
aChannel,
aLoadGroup,
aContainer,
aDocListener,
aReset,
aSink);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
if (httpChannel) {
nsCAutoString referrer;
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("referrer"), referrer);
if (NS_SUCCEEDED(rv)) {
CopyUTF8toUTF16(referrer, mReferrer);
}
}
return NS_OK;
}
// nsIDOMSVGDocument
NS_IMETHODIMP
nsSVGDocument::GetTitle(nsAString& aTitle) {
return nsXMLDocument::GetTitle(aTitle);
}
NS_IMETHODIMP
nsSVGDocument::GetReferrer(nsAString& aReferrer) {
aReferrer.Assign(mReferrer);
return NS_OK;
}
NS_IMETHODIMP
nsSVGDocument::GetDomain(nsAString& aDomain) {
nsCAutoString domain;
if (mDocumentURI) {
nsresult rv = mDocumentURI->GetHost(domain);
if (NS_FAILED(rv)) return rv;
}
CopyUTF8toUTF16(domain, aDomain);
return NS_OK;
}
NS_IMETHODIMP
nsSVGDocument::GetURL(nsAString& aURL) {
nsCAutoString url;
if (mDocumentURI) {
nsresult rv = mDocumentURI->GetSpec(url);
if (NS_FAILED(rv)) return rv;
}
CopyUTF8toUTF16(url, aURL);
return NS_OK;
}
NS_IMETHODIMP
nsSVGDocument::GetRootElement(nsIDOMSVGSVGElement** aRootElement) {
NS_NOTYETIMPLEMENTED("nsSVGDocument::GetRootElement");
// XXX - writeme
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NS_NewSVGDocument(nsIDocument** aInstancePtrResult)
{
nsSVGDocument* doc = new nsSVGDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(doc);
nsresult rv = doc->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(doc);
return rv;
}
*aInstancePtrResult = doc;
return rv;
}

View File

@@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Bradley Baetz.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bradley Baetz <bbaetz@cs.mcgill.ca> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef nsSVGDocument_h__
#define nsSVGDocument_h__
#include "nsXMLDocument.h"
#include "nsIDOMSVGDocument.h"
#include "nsString.h"
#include "nsIURI.h"
class nsSVGDocument : public nsXMLDocument,
public nsIDOMSVGDocument
{
public:
nsSVGDocument();
virtual ~nsSVGDocument();
// Most methods will just fall through to the XMLDocument
virtual nsresult StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener **aDocListener,
PRBool aReset = PR_TRUE,
nsIContentSink* aSink = nsnull);
NS_DECL_NSIDOMSVGDOCUMENT
NS_FORWARD_NSIDOMDOCUMENT(nsXMLDocument::)
NS_FORWARD_NSIDOMNODE(nsXMLDocument::)
NS_FORWARD_NSIDOMDOCUMENTEVENT(nsXMLDocument::)
NS_DECL_ISUPPORTS_INHERITED
protected:
nsString mReferrer;
};
#endif

View File

@@ -1,80 +0,0 @@
#!nmake
#
# The contents of this file are subject to the Mozilla 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/MPL/
#
# 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 Crocodile Clips Ltd code.
#
# The Initial Developer of the Original Code is
# Crocodile Clips Ltd. Portions created by Crocodile Clips are
# Copyright (C) 2001 Crocodile Clips Ltd. All
# Rights Reserved.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = dom
XPIDL_MODULE = dom_svg
XPIDLSRCS = \
nsIDOMSVGAnimatedEnum.idl \
nsIDOMSVGAnimatedLength.idl \
nsIDOMSVGAnimatedLengthList.idl \
nsIDOMSVGAnimatedNumberList.idl \
nsIDOMSVGAnimatedPathData.idl \
nsIDOMSVGAnimatedPoints.idl \
nsIDOMSVGAnimatedString.idl \
nsIDOMSVGAnimPresAspRatio.idl \
nsIDOMSVGAnimatedRect.idl \
nsIDOMSVGAnimTransformList.idl \
nsIDOMSVGCircleElement.idl \
nsIDOMSVGDocument.idl \
nsIDOMSVGElement.idl \
nsIDOMSVGEllipseElement.idl \
nsIDOMSVGFitToViewBox.idl \
nsIDOMSVGForeignObjectElem.idl \
nsIDOMSVGGElement.idl \
nsIDOMSVGImageElement.idl \
nsIDOMSVGLength.idl \
nsIDOMSVGLengthList.idl \
nsIDOMSVGLineElement.idl \
nsIDOMSVGLocatable.idl \
nsIDOMSVGMatrix.idl \
nsIDOMSVGNumber.idl \
nsIDOMSVGNumberList.idl \
nsIDOMSVGPathElement.idl \
nsIDOMSVGPathSeg.idl \
nsIDOMSVGPathSegList.idl \
nsIDOMSVGPoint.idl \
nsIDOMSVGPointList.idl \
nsIDOMSVGPolygonElement.idl \
nsIDOMSVGPolylineElement.idl \
nsIDOMSVGPresAspectRatio.idl \
nsIDOMSVGRect.idl \
nsIDOMSVGRectElement.idl \
nsIDOMSVGSVGElement.idl \
nsIDOMSVGStylable.idl \
nsIDOMSVGTextContentElement.idl \
nsIDOMSVGTextElement.idl \
nsIDOMSVGTextPositionElem.idl \
nsIDOMSVGTransform.idl \
nsIDOMSVGTransformList.idl \
nsIDOMSVGTransformable.idl \
nsIDOMSVGTSpanElement.idl \
nsIDOMSVGURIReference.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,48 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "domstubs.idl"
[scriptable, uuid(36f18f12-61a9-4529-8fa9-30050bd6ac00)]
interface nsIDOMSVGAnimatedString
: nsISupports
{
attribute DOMString baseVal;
// raises DOMException on setting
readonly attribute DOMString animVal;
};

View File

@@ -1,68 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsIDOMSVGElement.idl"
interface nsIDOMSVGAnimatedLength;
interface nsIDOMSVGAnimatedPreserveAspectRatio;
[scriptable, uuid(43ae4efe-2610-4cce-8242-279e556a78fa)]
interface nsIDOMSVGImageElement
: nsIDOMSVGElement
/*
The SVG DOM makes use of multiple interface inheritance.
Since XPCOM only supports single interface inheritance,
the best thing that we can do is to promise that whenever
an object implements _this_ interface it will also
implement the following interfaces. (We then have to QI to
hop between them.)
nsIDOMSVGURIReference,
nsIDOMSVGTests,
nsIDOMSVGLangSpace,
nsIDOMSVGExternalResourcesRequired,
nsIDOMSVGStylable,
nsIDOMSVGTransformable,
events::nsIDOMEventTarget
*/
{
readonly attribute nsIDOMSVGAnimatedLength x;
readonly attribute nsIDOMSVGAnimatedLength y;
readonly attribute nsIDOMSVGAnimatedLength width;
readonly attribute nsIDOMSVGAnimatedLength height;
readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio;
};

View File

@@ -1,48 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* 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 MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsISupports.idl"
interface nsIDOMSVGAnimatedString;
[scriptable, uuid(8092b5f3-dc8a-459c-94f1-92f8011f2438)]
interface nsIDOMSVGURIReference
: nsISupports
{
readonly attribute nsIDOMSVGAnimatedString href;
};

View File

@@ -1,474 +0,0 @@
/* -*- 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) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Johnny Stenback <jst@netscape.com> (original author)
*
*
* 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 nsIDOMClassInfo_h___
#define nsIDOMClassInfo_h___
#include "nsIClassInfo.h"
#include "nsVoidArray.h"
enum nsDOMClassInfoID {
// Base classes
eDOMClassInfo_Window_id,
eDOMClassInfo_Location_id,
eDOMClassInfo_Navigator_id,
eDOMClassInfo_Plugin_id,
eDOMClassInfo_PluginArray_id,
eDOMClassInfo_MimeType_id,
eDOMClassInfo_MimeTypeArray_id,
eDOMClassInfo_BarProp_id,
eDOMClassInfo_History_id,
eDOMClassInfo_Screen_id,
// Core classes
eDOMClassInfo_XMLDocument_id,
eDOMClassInfo_DocumentType_id,
eDOMClassInfo_DOMImplementation_id,
eDOMClassInfo_DOMException_id,
eDOMClassInfo_DocumentFragment_id,
eDOMClassInfo_Element_id,
eDOMClassInfo_Attr_id,
eDOMClassInfo_Text_id,
eDOMClassInfo_Comment_id,
eDOMClassInfo_CDATASection_id,
eDOMClassInfo_ProcessingInstruction_id,
eDOMClassInfo_Entity_id,
eDOMClassInfo_EntityReference_id,
eDOMClassInfo_Notation_id,
eDOMClassInfo_NodeList_id,
eDOMClassInfo_NamedNodeMap_id,
// StyleSheet classes
eDOMClassInfo_DocumentStyleSheetList_id,
// Event classes
eDOMClassInfo_Event_id,
eDOMClassInfo_MutationEvent_id,
// HTML classes
eDOMClassInfo_HTMLDocument_id,
eDOMClassInfo_HTMLCollection_id,
eDOMClassInfo_HTMLOptionsCollection_id,
eDOMClassInfo_HTMLFormControlCollection_id,
eDOMClassInfo_HTMLGenericCollection_id,
// HTML element classes
eDOMClassInfo_HTMLAnchorElement_id,
eDOMClassInfo_HTMLAppletElement_id,
eDOMClassInfo_HTMLAreaElement_id,
eDOMClassInfo_HTMLBRElement_id,
eDOMClassInfo_HTMLBaseElement_id,
eDOMClassInfo_HTMLBaseFontElement_id,
eDOMClassInfo_HTMLBodyElement_id,
eDOMClassInfo_HTMLButtonElement_id,
eDOMClassInfo_HTMLDListElement_id,
eDOMClassInfo_HTMLDelElement_id,
eDOMClassInfo_HTMLDirectoryElement_id,
eDOMClassInfo_HTMLDivElement_id,
eDOMClassInfo_HTMLEmbedElement_id,
eDOMClassInfo_HTMLFieldSetElement_id,
eDOMClassInfo_HTMLFontElement_id,
eDOMClassInfo_HTMLFormElement_id,
eDOMClassInfo_HTMLFrameElement_id,
eDOMClassInfo_HTMLFrameSetElement_id,
eDOMClassInfo_HTMLHRElement_id,
eDOMClassInfo_HTMLHeadElement_id,
eDOMClassInfo_HTMLHeadingElement_id,
eDOMClassInfo_HTMLHtmlElement_id,
eDOMClassInfo_HTMLIFrameElement_id,
eDOMClassInfo_HTMLImageElement_id,
eDOMClassInfo_HTMLInputElement_id,
eDOMClassInfo_HTMLInsElement_id,
eDOMClassInfo_HTMLIsIndexElement_id,
eDOMClassInfo_HTMLLIElement_id,
eDOMClassInfo_HTMLLabelElement_id,
eDOMClassInfo_HTMLLegendElement_id,
eDOMClassInfo_HTMLLinkElement_id,
eDOMClassInfo_HTMLMapElement_id,
eDOMClassInfo_HTMLMenuElement_id,
eDOMClassInfo_HTMLMetaElement_id,
eDOMClassInfo_HTMLModElement_id,
eDOMClassInfo_HTMLOListElement_id,
eDOMClassInfo_HTMLObjectElement_id,
eDOMClassInfo_HTMLOptGroupElement_id,
eDOMClassInfo_HTMLOptionElement_id,
eDOMClassInfo_HTMLParagraphElement_id,
eDOMClassInfo_HTMLParamElement_id,
eDOMClassInfo_HTMLPreElement_id,
eDOMClassInfo_HTMLQuoteElement_id,
eDOMClassInfo_HTMLScriptElement_id,
eDOMClassInfo_HTMLSelectElement_id,
eDOMClassInfo_HTMLSpacerElement_id,
eDOMClassInfo_HTMLSpanElement_id,
eDOMClassInfo_HTMLStyleElement_id,
eDOMClassInfo_HTMLTableCaptionElement_id,
eDOMClassInfo_HTMLTableCellElement_id,
eDOMClassInfo_HTMLTableColElement_id,
eDOMClassInfo_HTMLTableColGroupElement_id,
eDOMClassInfo_HTMLTableElement_id,
eDOMClassInfo_HTMLTableRowElement_id,
eDOMClassInfo_HTMLTableSectionElement_id,
eDOMClassInfo_HTMLTextAreaElement_id,
eDOMClassInfo_HTMLTitleElement_id,
eDOMClassInfo_HTMLUListElement_id,
eDOMClassInfo_HTMLUnknownElement_id,
eDOMClassInfo_HTMLWBRElement_id,
// CSS classes
eDOMClassInfo_CSSStyleRule_id,
eDOMClassInfo_CSSCharsetRule_id,
eDOMClassInfo_CSSImportRule_id,
eDOMClassInfo_CSSMediaRule_id,
eDOMClassInfo_CSSNameSpaceRule_id,
eDOMClassInfo_CSSRuleList_id,
eDOMClassInfo_CSSGroupRuleRuleList_id,
eDOMClassInfo_MediaList_id,
eDOMClassInfo_StyleSheetList_id,
eDOMClassInfo_CSSStyleSheet_id,
eDOMClassInfo_CSSStyleDeclaration_id,
eDOMClassInfo_ComputedCSSStyleDeclaration_id,
eDOMClassInfo_ROCSSPrimitiveValue_id,
// Range classes
eDOMClassInfo_Range_id,
eDOMClassInfo_Selection_id,
// XUL classes
#ifdef MOZ_XUL
eDOMClassInfo_XULDocument_id,
eDOMClassInfo_XULElement_id,
eDOMClassInfo_XULCommandDispatcher_id,
eDOMClassInfo_XULNodeList_id,
eDOMClassInfo_XULNamedNodeMap_id,
eDOMClassInfo_XULAttr_id,
#endif
eDOMClassInfo_XULControllers_id,
#ifdef MOZ_XUL
eDOMClassInfo_BoxObject_id,
eDOMClassInfo_TreeSelection_id,
eDOMClassInfo_TreeContentView_id,
#endif
// Crypto classes
eDOMClassInfo_Crypto_id,
eDOMClassInfo_CRMFObject_id,
eDOMClassInfo_Pkcs11_id,
// DOM Traversal classes
eDOMClassInfo_TreeWalker_id,
// We are now trying to preserve binary compat in classinfo. No
// more putting things in those categories up there. New entries
// are to be added right before eDOMClassInfoIDCount
// Rect object used by getComputedStyle
eDOMClassInfo_CSSRect_id,
// DOM Chrome Window class, almost identical to Window
eDOMClassInfo_ChromeWindow_id,
// RGBColor object used by getComputedStyle
eDOMClassInfo_CSSRGBColor_id,
eDOMClassInfo_RangeException_id,
// CSSValueList object that represents an nsIDOMCSSValueList, used
// by DOM CSS
eDOMClassInfo_CSSValueList_id,
// ContentList object used for various live NodeLists
eDOMClassInfo_ContentList_id,
// Processing-instruction with target "xml-stylesheet"
eDOMClassInfo_XMLStylesheetProcessingInstruction_id,
eDOMClassInfo_ImageDocument_id,
#ifdef MOZ_XUL
eDOMClassInfo_XULTreeBuilder_id,
#endif
// DOMStringList object
eDOMClassInfo_DOMStringList_id,
// NameList object used by the DOM
eDOMClassInfo_NameList_id,
#ifdef MOZ_SVG
// The SVG document
eDOMClassInfo_SVGDocument_id,
// SVG element classes
eDOMClassInfo_SVGSVGElement_id,
eDOMClassInfo_SVGPolygonElement_id,
eDOMClassInfo_SVGPolylineElement_id,
eDOMClassInfo_SVGCircleElement_id,
eDOMClassInfo_SVGEllipseElement_id,
eDOMClassInfo_SVGLineElement_id,
eDOMClassInfo_SVGRectElement_id,
eDOMClassInfo_SVGGElement_id,
eDOMClassInfo_SVGForeignObjectElement_id,
eDOMClassInfo_SVGPathElement_id,
// other SVG classes
eDOMClassInfo_SVGAnimatedLength_id,
eDOMClassInfo_SVGLength_id,
eDOMClassInfo_SVGAnimatedPoints_id,
eDOMClassInfo_SVGPointList_id,
eDOMClassInfo_SVGPoint_id,
eDOMClassInfo_SVGAnimatedTransformList_id,
eDOMClassInfo_SVGTransformList_id,
eDOMClassInfo_SVGTransform_id,
eDOMClassInfo_SVGMatrix_id,
eDOMClassInfo_SVGPathSegList_id,
eDOMClassInfo_SVGPathSegClosePath_id,
eDOMClassInfo_SVGPathSegMovetoAbs_id,
eDOMClassInfo_SVGPathSegMovetoRel_id,
eDOMClassInfo_SVGPathSegLinetoAbs_id,
eDOMClassInfo_SVGPathSegLinetoRel_id,
eDOMClassInfo_SVGPathSegCurvetoCubicAbs_id,
eDOMClassInfo_SVGPathSegCurvetoCubicRel_id,
eDOMClassInfo_SVGPathSegCurvetoQuadraticAbs_id,
eDOMClassInfo_SVGPathSegCurvetoQuadraticRel_id,
eDOMClassInfo_SVGPathSegArcAbs_id,
eDOMClassInfo_SVGPathSegArcRel_id,
eDOMClassInfo_SVGPathSegLinetoHorizontalAbs_id,
eDOMClassInfo_SVGPathSegLinetoHorizontalRel_id,
eDOMClassInfo_SVGPathSegLinetoVerticalAbs_id,
eDOMClassInfo_SVGPathSegLinetoVerticalRel_id,
eDOMClassInfo_SVGPathSegCurvetoCubicSmoothAbs_id,
eDOMClassInfo_SVGPathSegCurvetoCubicSmoothRel_id,
eDOMClassInfo_SVGPathSegCurvetoQuadraticSmoothAbs_id,
eDOMClassInfo_SVGPathSegCurvetoQuadraticSmoothRel_id,
eDOMClassInfo_SVGRect_id,
eDOMClassInfo_SVGAnimatedRect_id,
eDOMClassInfo_SVGAnimatedLengthList_id,
eDOMClassInfo_SVGLengthList_id,
eDOMClassInfo_SVGNumber_id,
eDOMClassInfo_SVGTextElement_id,
eDOMClassInfo_SVGTSpanElement_id,
eDOMClassInfo_SVGAnimatedString_id,
eDOMClassInfo_SVGImageElement_id,
#endif //MOZ_SVG
// This one better be the last one in this list
eDOMClassInfoIDCount
};
#include "nsIXPCScriptable.h"
#define DEFAULT_SCRIPTABLE_FLAGS \
(nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY | \
nsIXPCScriptable::USE_JSSTUB_FOR_DELPROPERTY | \
nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY | \
nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE | \
nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE | \
nsIXPCScriptable::DONT_ASK_INSTANCE_FOR_SCRIPTABLE | \
nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES | \
nsIXPCScriptable::WANT_NEWRESOLVE | \
nsIXPCScriptable::WANT_CHECKACCESS | \
nsIXPCScriptable::WANT_POSTCREATE)
#define DOM_DEFAULT_SCRIPTABLE_FLAGS \
(DEFAULT_SCRIPTABLE_FLAGS | \
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE | \
nsIXPCScriptable::CLASSINFO_INTERFACES_ONLY)
typedef nsIClassInfo* (*nsDOMClassInfoExternalConstructorFnc)
(const char* aName);
/**
* nsIClassInfo helper macros
*/
#define NS_CLASSINFO_MAP_BEGIN(_class)
#define NS_CLASSINFO_MAP_BEGIN_EXPORTED(_class)
#define NS_CLASSINFO_MAP_ENTRY(_interface)
#define NS_CLASSINFO_MAP_ENTRY_FUNCTION(_function)
#define NS_CLASSINFO_MAP_END
#include "nsIServiceManager.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsDOMCID.h"
#define NS_INTERFACE_MAP_ENTRY_DOM_CLASSINFO(_class) \
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); \
\
nsresult rv; \
nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID, \
&rv)); \
if (NS_FAILED(rv)) { \
*aInstancePtr = nsnull; \
return rv; \
} \
\
foundInterface = \
sof->GetClassInfoInstance(eDOMClassInfo_##_class##_id); \
} else
// Looks up the nsIClassInfo for a class name registered with the
// nsScriptNamespaceManager. Remember to release NS_CLASSINFO_NAME(_class)
// (eg. when your module unloads).
#define NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(_class) \
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
extern nsISupports *NS_CLASSINFO_NAME(_class); \
if (NS_CLASSINFO_NAME(_class)) { \
foundInterface = NS_CLASSINFO_NAME(_class); \
} else { \
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); \
\
nsresult rv; \
nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID, \
&rv)); \
if (NS_FAILED(rv)) { \
*aInstancePtr = nsnull; \
return rv; \
} \
\
foundInterface = \
sof->GetExternalClassInfoInstance(NS_LITERAL_STRING(#_class)); \
\
if (foundInterface) { \
NS_CLASSINFO_NAME(_class) = foundInterface; \
NS_CLASSINFO_NAME(_class)->AddRef(); \
} \
} \
} else
#define NS_DECL_DOM_CLASSINFO(_class) \
nsISupports *NS_CLASSINFO_NAME(_class) = nsnull;
// {891a7b01-1b61-11d6-a7f2-f690b638899c}
#define NS_IDOMCI_EXTENSION_IID \
{ 0x891a7b01, 0x1b61, 0x11d6, \
{ 0xa7, 0xf2, 0xf6, 0x90, 0xb6, 0x38, 0x89, 0x9c } }
class nsIDOMScriptObjectFactory;
class nsIDOMCIExtension : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCI_EXTENSION_IID)
NS_IMETHOD RegisterDOMCI(const char* aName,
nsIDOMScriptObjectFactory* aDOMSOFactory) = 0;
};
#define NS_DOMCI_EXTENSION_NAME(_module) ns##_module##DOMCIExtension
#define NS_DOMCI_EXTENSION_CONSTRUCTOR(_module) \
ns##_module##DOMCIExtensionConstructor
#define NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(_extension) \
NS_GENERIC_FACTORY_CONSTRUCTOR(_extension)
#define NS_DOMCI_EXTENSION(_module) \
class NS_DOMCI_EXTENSION_NAME(_module) : public nsIDOMCIExtension \
{ \
public: \
NS_DOMCI_EXTENSION_NAME(_module)(); \
virtual ~NS_DOMCI_EXTENSION_NAME(_module)(); \
\
NS_DECL_ISUPPORTS \
\
NS_IMETHOD RegisterDOMCI(const char* aName, \
nsIDOMScriptObjectFactory* aDOMSOFactory); \
}; \
\
NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(NS_DOMCI_EXTENSION_NAME(_module)) \
\
NS_DOMCI_EXTENSION_NAME(_module)::NS_DOMCI_EXTENSION_NAME(_module)() \
{ \
} \
\
NS_DOMCI_EXTENSION_NAME(_module)::~NS_DOMCI_EXTENSION_NAME(_module)() \
{ \
} \
\
NS_IMPL_ISUPPORTS1(NS_DOMCI_EXTENSION_NAME(_module), nsIDOMCIExtension) \
\
NS_IMETHODIMP \
NS_DOMCI_EXTENSION_NAME(_module)::RegisterDOMCI(const char* aName, \
nsIDOMScriptObjectFactory* aDOMSOFactory) \
{
#define NS_DOMCI_EXTENSION_ENTRY_BEGIN(_class) \
if (nsCRT::strcmp(aName, #_class) == 0) { \
static const nsIID* interfaces[] = {
#define NS_DOMCI_EXTENSION_ENTRY_INTERFACE(_interface) \
&NS_GET_IID(_interface),
// Don't forget to register the primary interface (_proto) in the
// JAVASCRIPT_DOM_INTERFACE category, or prototypes for this class
// won't work (except if the interface name starts with nsIDOM).
#define NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, _proto, _hasclassif, \
_constructorcid) \
nsnull \
}; \
aDOMSOFactory->RegisterDOMClassInfo(#_class, nsnull, _proto, \
interfaces, \
DOM_DEFAULT_SCRIPTABLE_FLAGS, \
_hasclassif, _constructorcid); \
return NS_OK; \
}
#define NS_DOMCI_EXTENSION_ENTRY_END(_class, _proto, _hasclassif, \
_constructorcid) \
NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, &NS_GET_IID(_proto), \
_hasclassif, _constructorcid)
#define NS_DOMCI_EXTENSION_ENTRY_END_NO_PRIMARY_IF(_class, _hasclassif, \
_constructorcid) \
NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, nsnull, _hasclassif, \
_constructorcid)
#define NS_DOMCI_EXTENSION_END \
return NS_ERROR_FAILURE; \
}
#endif /* nsIDOMClassInfo_h___ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,141 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Golden Hills Computer Services code.
*
* The Initial Developer of the Original Code is Brian Stell.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Stell <bstell@ix.netcom.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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
%{C++
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_CACHE_H
#include FT_CACHE_IMAGE_H
#include FT_OUTLINE_H
#include FT_TRUETYPE_TABLES_H
#define NS_FREETYPE2_CONTRACTID "@mozilla.org/freetype2;1"
#define NS_FREETYPE2_CID NS_IFREETYPE2_IID
// macros to handle FreeType2 26.6 numbers (26 bit number with 6 bit fraction)
#define FT_REG_TO_16_16(x) ((x)<<16)
#ifndef FT_MulFix
#define FT_MulFix(v, s) (((v)*(s))>>16)
#endif
#define FT_ROUND(x) (((x) + 32) & ~63) // 63 = 2^6 - 1
#define FT_TRUNC(x) ((x) >> 6)
#define FT_DESIGN_UNITS_TO_PIXELS(v, s) FT_TRUNC(FT_ROUND(FT_MulFix((v) , (s))))
%}
[ptr] native constCharPtr(const char);
native FT_Int(FT_Int);
native FT_Long(FT_Long);
native FT_UInt(FT_UInt);
native FT_ULong(FT_ULong);
native FT_BBox(FT_BBox);
native FT_CharMap(FT_CharMap);
native FT_Error(FT_Error);
native FT_Face(FT_Face);
native FT_Glyph(FT_Glyph);
native FT_GlyphSlot(FT_GlyphSlot);
native FT_Library(FT_Library);
[ptr] native FT_Outline_p(FT_Outline);
[ptr] native const_FT_Outline_Funcs_p(const FT_Outline_Funcs);
native FT_Pointer(FT_Pointer);
native FT_Sfnt_Tag(FT_Sfnt_Tag);
native FT_Size(FT_Size);
[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
native FTC_Face_Requester(FTC_Face_Requester);
native FTC_Font(FTC_Font);
native FTC_Image_Cache(FTC_Image_Cache);
native FTC_Manager(FTC_Manager);
#ifdef MOZ_SVG
[ptr] native FT_Matrix_p(FT_Matrix);
native FT_Vector(FT_Vector);
[ptr] native FT_Vector_p(FT_Vector);
native FT_Render_Mode(FT_Render_Mode);
native FT_Bool(FT_Bool);
#endif
/*
* A XPCOM interface to the run-time loaded functions
*/
[uuid(606eac78-16d4-486a-9f0e-f180aebd449b)]
interface nsIFreeType2 : nsISupports
{
readonly attribute FT_Library library;
readonly attribute FTC_Manager FTCacheManager;
readonly attribute FTC_Image_Cache ImageCache;
void doneFace(in FT_Face face);
void doneFreeType(in FT_Library lib);
void doneGlyph(in FT_Glyph glyph);
FT_UInt getCharIndex(in FT_Face face, in FT_ULong charcode);
void getGlyph(in FT_GlyphSlot slot, out FT_Glyph glyph);
voidPtr getSfntTable(in FT_Face face, in FT_Sfnt_Tag tag);
void glyphGetCBox(in FT_Glyph glyph, in FT_UInt mode, out FT_BBox box);
void initFreeType(out FT_Library lib);
void loadGlyph(in FT_Face face, in FT_UInt gindex, in FT_Int flags);
void newFace(in FT_Library lib, in constCharPtr filename,
in FT_Long face_num, out FT_Face face);
void outlineDecompose(in FT_Outline_p outline,
in const_FT_Outline_Funcs_p funcs, in voidPtr p);
void setCharmap(in FT_Face face, in FT_CharMap charmap);
void imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
in FT_UInt gindex, out FT_Glyph glyph);
void managerLookupSize(in FTC_Manager manager, in FTC_Font font,
out FT_Face face, out FT_Size size);
void managerDone(in FTC_Manager manager);
void managerNew(in FT_Library lib, in FT_UInt max_faces,
in FT_UInt max_sizes, in FT_ULong max_bytes,
in FTC_Face_Requester requester, in FT_Pointer req_data,
out FTC_Manager manager);
void imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
#ifdef MOZ_SVG
void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
in FT_Vector_p delta);
void getKerning(in FT_Face face, in FT_UInt left_glyph, in FT_UInt right_glyph,
in FT_UInt kern_mode, out FT_Vector akerning);
void glyphCopy(in FT_Glyph source, out FT_Glyph target);
void glyphToBitmap(inout FT_Glyph the_glyph, in FT_Render_Mode render_mode,
in FT_Vector_p origin, in FT_Bool destroy);
#endif
FT_ULong getFirstChar(in FT_Face face, out FT_UInt gindex);
FT_ULong getNextChar(in FT_Face face, in FT_ULong charcode, out FT_UInt gindex);
void supportsExtFunc(out PRBool res);
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,307 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* ex: set tabstop=8 softtabstop=2 shiftwidth=2 expandtab:
*
* 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):
*/
#ifndef nsFreeType_h__
#define nsFreeType_h__
#include "gfx-config.h"
#if (defined(MOZ_ENABLE_FREETYPE2))
#include "nspr.h"
#include "nsHashtable.h"
#include "nsICharsetConverterManager.h"
#include "nsIFontCatalogService.h"
#include "nsIFreeType2.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_CACHE_H
#include FT_CACHE_IMAGE_H
#include FT_TRUETYPE_TABLES_H
typedef struct FT_FaceRec_* FT_Face;
typedef struct {
const char *mFontFileName;
time_t mMTime;
PRUint32 mFlags;
const char *mFontType;
int mFaceIndex;
int mNumFaces;
const char *mFamilyName;
const char *mStyleName;
FT_UShort mWeight;
FT_UShort mWidth;
int mNumGlyphs;
int mNumUsableGlyphs;
FT_Long mFaceFlags;
FT_Long mStyleFlags;
FT_Long mCodePageRange1;
FT_Long mCodePageRange2;
char mVendorID[5];
const char *mFoundryName;
int mNumEmbeddedBitmaps;
int *mEmbeddedBitmapHeights;
PRUint16 *mCCMap; // compressed char map
} nsFontCatalogEntry;
#define FCE_FLAGS_ISVALID 0x01
#define FCE_FLAGS_UNICODE 0x02
#define FCE_FLAGS_SYMBOL 0x04
#define FCE_FLAGS_SURROGATE 0x08
#define FREE_IF(x) if(x) free((void*)x)
typedef struct {
const char *mConverterName;
PRUint8 mCmapPlatformID;
PRUint8 mCmapEncoding;
nsIUnicodeEncoder* mConverter;
} nsTTFontEncoderInfo;
typedef struct nsTTFontFamilyEncoderInfo {
const char *mFamilyName;
nsTTFontEncoderInfo *mEncodingInfo;
} nsTTFontFamilyEncoderInfo;
typedef struct {
unsigned long bit;
const char *charsetName;
} nsulCodePageRangeCharSetName;
//
// the FreeType2 function type declarations
//
typedef FT_Error (*FT_Done_Face_t)(FT_Face);
typedef FT_Error (*FT_Done_FreeType_t)(FT_Library);
typedef FT_Error (*FT_Done_Glyph_t)(FT_Glyph);
typedef FT_Error (*FT_Get_Char_Index_t)(FT_Face, FT_ULong);
typedef FT_Error (*FT_Get_Glyph_t)(FT_GlyphSlot, FT_Glyph*);
typedef void* (*FT_Get_Sfnt_Table_t)(FT_Face, FT_Sfnt_Tag);
typedef FT_Error (*FT_Glyph_Get_CBox_t)(FT_Glyph, FT_UInt, FT_BBox*);
typedef FT_Error (*FT_Init_FreeType_t)(FT_Library*);
typedef FT_Error (*FT_Load_Glyph_t)(FT_Face, FT_UInt, FT_Int);
typedef FT_Error (*FT_Outline_Decompose_t)
(FT_Outline*, const FT_Outline_Funcs*, void*);
typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap charmap);
typedef FT_Error (*FTC_Image_Cache_Lookup_t)
(FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
typedef FT_Error (*FTC_Manager_Lookup_Size_t)
(FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
FTC_Face_Requester, FT_Pointer, FTC_Manager*);
typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
#ifdef MOZ_SVG
typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
typedef FT_Error (*FT_Get_Kerning_t)
(FT_Face, FT_UInt, FT_UInt, FT_UInt, FT_Vector*);
typedef FT_Error (*FT_Glyph_Copy_t)(FT_Glyph, FT_Glyph*);
typedef FT_Error (*FT_Glyph_To_Bitmap_t)
(FT_Glyph*, FT_Render_Mode, FT_Vector*, FT_Bool);
#endif
typedef FT_ULong (*FT_Get_First_Char_t)(FT_Face, FT_UInt*);
typedef FT_ULong (*FT_Get_Next_Char_t)(FT_Face, FT_ULong, FT_UInt*);
class nsFreeTypeFace;
nsFreeTypeFace * nsFreeTypeGetFaceID(nsFontCatalogEntry *aFce);
typedef struct {
const char *FuncName;
int FuncOffset;
const PRBool Required;
} FtFuncList;
// class nsFreeType class definition
class nsFreeType2 : nsIFreeType2 {
NS_DECL_ISUPPORTS
public:
void FreeGlobals();
nsresult Init();
virtual ~nsFreeType2();
NS_DECL_NSIFREETYPE2
// these belong in nsFT2FontCatalog
static PRUint16* GetCCMap(nsFontCatalogEntry *aFce);
static const char* GetRange1CharSetName(unsigned long aBit);
static const char* GetRange2CharSetName(unsigned long aBit);
static nsTTFontFamilyEncoderInfo* GetCustomEncoderInfo(const char *);
protected:
// run time loaded function pointers
FT_Done_Face_t nsFT_Done_Face;
FT_Done_FreeType_t nsFT_Done_FreeType;
FT_Done_Glyph_t nsFT_Done_Glyph;
FT_Get_Char_Index_t nsFT_Get_Char_Index;
FT_Get_Glyph_t nsFT_Get_Glyph;
FT_Get_Sfnt_Table_t nsFT_Get_Sfnt_Table;
FT_Glyph_Get_CBox_t nsFT_Glyph_Get_CBox;
FT_Init_FreeType_t nsFT_Init_FreeType;
FT_Load_Glyph_t nsFT_Load_Glyph;
FT_New_Face_t nsFT_New_Face;
FT_Outline_Decompose_t nsFT_Outline_Decompose;
FT_Set_Charmap_t nsFT_Set_Charmap;
FTC_Image_Cache_Lookup_t nsFTC_Image_Cache_Lookup;
FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
FTC_Manager_Done_t nsFTC_Manager_Done;
FTC_Manager_New_t nsFTC_Manager_New;
FTC_Image_Cache_New_t nsFTC_Image_Cache_New;
#ifdef MOZ_SVG
FT_Glyph_Transform_t nsFT_Glyph_Transform;
FT_Get_Kerning_t nsFT_Get_Kerning;
FT_Glyph_Copy_t nsFT_Glyph_Copy;
FT_Glyph_To_Bitmap_t nsFT_Glyph_To_Bitmap;
#endif
FT_Get_First_Char_t nsFT_Get_First_Char;
FT_Get_Next_Char_t nsFT_Get_Next_Char;
// this array needs to be big enough to hold all the function pointers
// plus one extra for the null at the end
#ifdef MOZ_SVG
static FtFuncList FtFuncs[24];
#else
static FtFuncList FtFuncs[20];
#endif
protected:
PRBool mEnableFreeType2;
char* mFreeType2SharedLibraryName;
public:
// these belong in the nsFontFreeType code
static PRBool gFreeType2Autohinted;
static PRBool gFreeType2Unhinted;
static PRUint8 gAATTDarkTextMinValue;
static double gAATTDarkTextGain;
static PRInt32 gAntiAliasMinimum;
static PRInt32 gEmbeddedBitmapMaximumHeight;
static PRBool gHasExtFunc;
protected:
void ClearGlobals();
void ClearFunctions();
PRBool InitLibrary();
PRBool LoadSharedLib();
void UnloadSharedLib();
// this belongs in nsFT2FontCatalog
static nsICharsetConverterManager* GetCharSetManager();
PRLibrary *mSharedLib;
FT_Library mFreeTypeLibrary;
FTC_Manager mFTCacheManager;
FTC_Image_Cache mImageCache;
static nsHashtable *sFontFamilies;
static nsHashtable *sRange1CharSetNames;
static nsHashtable *sRange2CharSetNames;
static nsICharsetConverterManager* sCharSetManager;
};
/* this simple record is used to model a given `installed' face */
class nsFreeTypeFace : public nsITrueTypeFontCatalogEntry {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITRUETYPEFONTCATALOGENTRY
nsFreeTypeFace();
virtual ~nsFreeTypeFace();
virtual nsresult Init(nsFontCatalogEntry *aFce);
/* additional members */
NS_IMETHODIMP GetFontCatalogType(PRUint16 *aFontCatalogType);
static PRBool FreeFace(nsHashKey* aKey, void* aData, void* aClosure);
const char *GetFilename()
{ return mFce->mFontFileName; }
int *GetEmbeddedBitmapHeights()
{ return mFce->mEmbeddedBitmapHeights; } ;
int GetFaceIndex()
{ return mFce->mFaceIndex; }
int GetNumEmbeddedBitmaps()
{ return mFce->mNumEmbeddedBitmaps; } ;
PRUint16 *GetCCMap();
nsFontCatalogEntry* GetFce() { return mFce; };
PRBool mHasExtendFuncs;
protected:
nsFontCatalogEntry *mFce;
PRUint16 *mCCMap;
};
#endif /* MOZ_ENABLE_FREETYPE2 */
/*
* Defines for the TrueType codepage bits.
* Used as a hint for the languages supported in a TrueType font.
*/
/*
* ulCodePageRange1
*/
#define TT_OS2_CPR1_LATIN1 (0x00000001) /* Latin 1 */
#define TT_OS2_CPR1_LATIN2 (0x00000002) /* Latin 2: Eastern Europe */
#define TT_OS2_CPR1_CYRILLIC (0x00000004) /* Cyrillic */
#define TT_OS2_CPR1_GREEK (0x00000008) /* Greek */
#define TT_OS2_CPR1_TURKISH (0x00000010) /* Turkish */
#define TT_OS2_CPR1_HEBREW (0x00000020) /* Hebrew */
#define TT_OS2_CPR1_ARABIC (0x00000040) /* Arabic */
#define TT_OS2_CPR1_BALTIC (0x00000080) /* Windows Baltic */
#define TT_OS2_CPR1_VIETNAMESE (0x00000100) /* Vietnamese */
/* 9-15 Reserved for Alternate ANSI */
#define TT_OS2_CPR1_THAI (0x00010000) /* Thai */
#define TT_OS2_CPR1_JAPANESE (0x00020000) /* JIS/Japan */
#define TT_OS2_CPR1_CHINESE_SIMP (0x00040000) /* Chinese: Simplified */
#define TT_OS2_CPR1_KO_WANSUNG (0x00080000) /* Korean Wansung */
#define TT_OS2_CPR1_CHINESE_TRAD (0x00100000) /* Chinese: Traditional */
#define TT_OS2_CPR1_KO_JOHAB (0x00200000) /* Korean Johab */
/* 22-28 Reserved for Alternate ANSI&OEM */
#define TT_OS2_CPR1_MAC_ROMAN (0x20000000) /* Mac (US Roman) */
#define TT_OS2_CPR1_OEM (0x40000000) /* OEM Character Set */
#define TT_OS2_CPR1_SYMBOL (0x80000000) /* Symbol Character Set */
/*
* ulCodePageRange2
*/ /* 32-47 Reserved for OEM */
#define TT_OS2_CPR2_GREEK (0x00010000) /* IBM Greek */
#define TT_OS2_CPR2_RUSSIAN (0x00020000) /* MS-DOS Russian */
#define TT_OS2_CPR2_NORDIC (0x00040000) /* MS-DOS Nordic */
#define TT_OS2_CPR2_ARABIC (0x00080000) /* Arabic */
#define TT_OS2_CPR2_CA_FRENCH (0x00100000) /* MS-DOS Canadian French */
#define TT_OS2_CPR2_HEBREW (0x00200000) /* Hebrew */
#define TT_OS2_CPR2_ICELANDIC (0x00400000) /* MS-DOS Icelandic */
#define TT_OS2_CPR2_PORTUGESE (0x00800000) /* MS-DOS Portuguese */
#define TT_OS2_CPR2_TURKISH (0x01000000) /* IBM Turkish */
#define TT_OS2_CPR2_CYRILLIC (0x02000000)/*IBM Cyrillic; primarily Russian*/
#define TT_OS2_CPR2_LATIN2 (0x04000000) /* Latin 2 */
#define TT_OS2_CPR2_BALTIC (0x08000000) /* MS-DOS Baltic */
#define TT_OS2_CPR2_GREEK_437G (0x10000000) /* Greek; former 437 G */
#define TT_OS2_CPR2_ARABIC_708 (0x20000000) /* Arabic; ASMO 708 */
#define TT_OS2_CPR2_WE_LATIN1 (0x40000000) /* WE/Latin 1 */
#define TT_OS2_CPR2_US (0x80000000) /* US */
#endif

View File

@@ -1,942 +0,0 @@
/* -*- 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()
{
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);
if ( tbits != nsnull )
{
mLockedBitmap = (HBITMAP)::SelectObject(mDC, tbits);
// if the SelectObject fails, or there was no bitmap returned from this DC
if ( mLockedBitmap != nsnull )
{
::GetObject(mLockedBitmap, sizeof(BITMAP), &mBitmap);
if (aY < 0 || aY + aHeight > mBitmap.bmHeight) {
::DeleteObject(tbits);
return NS_ERROR_FAILURE;
}
// GetDIBits always seems to interpret the scanlines as bottom-to-top.
mLockHeight = (PRInt32)aHeight;
mLockOffset = mBitmap.bmHeight - (aY + aHeight);
mBitmapInfo = CreateBitmapInfo(mBitmap.bmWidth, mBitmap.bmHeight, mBitmap.bmBitsPixel, (void **)&mDIBits);
if ( mBitmapInfo != nsnull ) {
if (!(aFlags & NS_LOCK_SURFACE_WRITE_ONLY))
::GetDIBits(mDC, mLockedBitmap, mLockOffset, mLockHeight, mDIBits, mBitmapInfo, DIB_RGB_COLORS);
mBitmap.bmBits = mDIBits;
// Note the width of the DIB-bits rows. DIB rows are DWORD-aligned,
// the original bitmap's rows may not have been DWORD-aligned.
mBitmap.bmWidthBytes = RASWIDTH(mBitmap.bmWidth, mBitmap.bmBitsPixel);
} else {
::DeleteObject(tbits);
return NS_ERROR_FAILURE;
}
}
else
{
::DeleteObject(tbits);
return NS_ERROR_FAILURE;
}
}
else
{
return NS_ERROR_FAILURE;
}
}
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");
#if defined(MOZ_SVG) && defined(SVG_FORCE_PIXEL_ACCESS_SURFACES)
// force pixel access on all surfaces. Improves gdi+ performance
aFlags |= NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS;
#endif
#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);
if ( nsnull == *aBits ) {
PR_Free(rv);
rv = nsnull;
}
}
}
}
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

File diff suppressed because it is too large Load Diff

View File

@@ -1,191 +0,0 @@
/* -*- 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 ***** */
#include "nsIAtom.h"
#include "CParserContext.h"
#include "nsToken.h"
#include "prenv.h"
#include "nsHTMLTokenizer.h"
#include "nsExpatDriver.h"
MOZ_DECL_CTOR_COUNTER(CParserContext)
/**
* Your friendly little constructor. Ok, it's not the friendly, but the only guy
* using it is the parser.
* @update gess7/23/98
* @param aScanner
* @param aKey
* @param aListener
*/
CParserContext::CParserContext(nsScanner* aScanner,
void *aKey,
eParserCommands aCommand,
nsIRequestObserver* aListener,
nsIDTD *aDTD,
eAutoDetectResult aStatus,
PRBool aCopyUnused)
{
MOZ_COUNT_CTOR(CParserContext);
mScanner=aScanner;
mKey=aKey;
mPrevContext=0;
mListener=aListener;
NS_IF_ADDREF(mListener);
mDTDMode=eDTDMode_unknown;
mAutoDetectStatus=aStatus;
mTransferBuffer=0;
mDTD=aDTD;
NS_IF_ADDREF(mDTD);
mTokenizer = 0;
mTransferBufferSize=eTransferBufferSize;
mStreamListenerState=eNone;
mMultipart=PR_TRUE;
mContextType=eCTNone;
mCopyUnused=aCopyUnused;
mParserCommand=aCommand;
mRequest=0;
}
/**
* Your friendly little constructor. Ok, it's not the friendly, but the only guy
* using it is the parser.
* @update gess7/23/98
* @param aScanner
* @param aKey
* @param aListener
*/
CParserContext::CParserContext(const CParserContext &aContext) : mMimeType() {
MOZ_COUNT_CTOR(CParserContext);
mScanner=aContext.mScanner;
mKey=aContext.mKey;
mPrevContext=0;
mListener=aContext.mListener;
NS_IF_ADDREF(mListener);
mDTDMode=aContext.mDTDMode;
mAutoDetectStatus=aContext.mAutoDetectStatus;
mTransferBuffer=aContext.mTransferBuffer;
mDTD=aContext.mDTD;
NS_IF_ADDREF(mDTD);
mTokenizer = aContext.mTokenizer;
NS_IF_ADDREF(mTokenizer);
mTransferBufferSize=eTransferBufferSize;
mStreamListenerState=aContext.mStreamListenerState;
mMultipart=aContext.mMultipart;
mContextType=aContext.mContextType;
mRequest=aContext.mRequest;
mParserCommand=aContext.mParserCommand;
SetMimeType(aContext.mMimeType);
}
/**
* Destructor for parser context
* NOTE: DO NOT destroy the dtd here.
* @update gess7/11/98
*/
CParserContext::~CParserContext(){
MOZ_COUNT_DTOR(CParserContext);
if(mScanner) {
delete mScanner;
mScanner=nsnull;
}
if(mTransferBuffer)
delete [] mTransferBuffer;
NS_IF_RELEASE(mDTD);
NS_IF_RELEASE(mListener);
NS_IF_RELEASE(mTokenizer);
//Remember that it's ok to simply ingore the PrevContext.
}
/**
* Set's the mimetype for this context
* @update rickg 03.18.2000
*/
void CParserContext::SetMimeType(const nsACString& aMimeType){
mMimeType.Assign(aMimeType);
mDocType=ePlainText;
if(mMimeType.Equals(NS_LITERAL_CSTRING(kHTMLTextContentType)))
mDocType=eHTML_Strict;
else if (mMimeType.Equals(NS_LITERAL_CSTRING(kXMLTextContentType)) ||
mMimeType.Equals(NS_LITERAL_CSTRING(kXMLApplicationContentType)) ||
mMimeType.Equals(NS_LITERAL_CSTRING(kXHTMLApplicationContentType)) ||
mMimeType.Equals(NS_LITERAL_CSTRING(kXULTextContentType)) ||
#ifdef MOZ_SVG
mMimeType.Equals(NS_LITERAL_CSTRING(kSVGTextContentType)) ||
#endif
mMimeType.Equals(NS_LITERAL_CSTRING(kRDFTextContentType)))
mDocType=eXML;
}
nsresult
CParserContext::GetTokenizer(PRInt32 aType, nsITokenizer*& aTokenizer) {
nsresult result = NS_OK;
if(!mTokenizer) {
if (aType == NS_IPARSER_FLAG_HTML || mParserCommand == eViewSource) {
result = NS_NewHTMLTokenizer(&mTokenizer,mDTDMode,mDocType,mParserCommand);
// Propagate tokenizer state so that information is preserved
// between document.write. This fixes bug 99467
if (mTokenizer && mPrevContext)
mTokenizer->CopyState(mPrevContext->mTokenizer);
}
else if (aType == NS_IPARSER_FLAG_XML)
{
result = CallQueryInterface(mDTD, &mTokenizer);
}
}
aTokenizer = mTokenizer;
return result;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,698 +0,0 @@
/* -*- 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 nsStyleConsts_h___
#define nsStyleConsts_h___
#include "nsFont.h"
// XXX fold this into nsStyleContext and group by nsStyleXXX struct
// Indices into border/padding/margin arrays
#define NS_SIDE_TOP 0
#define NS_SIDE_RIGHT 1
#define NS_SIDE_BOTTOM 2
#define NS_SIDE_LEFT 3
// {margin,padding}-{left,right}-{ltr,rtl}-source
#define NS_BOXPROP_SOURCE_PHYSICAL 0
#define NS_BOXPROP_SOURCE_LOGICAL 1
// box-sizing
#define NS_STYLE_BOX_SIZING_CONTENT 0
#define NS_STYLE_BOX_SIZING_PADDING 1
#define NS_STYLE_BOX_SIZING_BORDER 2
// float-edge
#define NS_STYLE_FLOAT_EDGE_CONTENT 0
#define NS_STYLE_FLOAT_EDGE_PADDING 1
#define NS_STYLE_FLOAT_EDGE_BORDER 2
#define NS_STYLE_FLOAT_EDGE_MARGIN 3
// key-equivalent
#define NS_STYLE_KEY_EQUIVALENT_NONE 0
// resizer
#define NS_STYLE_RESIZER_NONE 0x00
#define NS_STYLE_RESIZER_HORIZONTAL 0x01 // bits
#define NS_STYLE_RESIZER_VERTICAL 0x02 // bits
#define NS_STYLE_RESIZER_BOTH 0x03 // bits
#define NS_STYLE_RESIZER_AUTO 0x04 // bits
// user-focus
#define NS_STYLE_USER_FOCUS_NONE 0
#define NS_STYLE_USER_FOCUS_IGNORE 1
#define NS_STYLE_USER_FOCUS_NORMAL 2
#define NS_STYLE_USER_FOCUS_SELECT_ALL 3
#define NS_STYLE_USER_FOCUS_SELECT_BEFORE 4
#define NS_STYLE_USER_FOCUS_SELECT_AFTER 5
#define NS_STYLE_USER_FOCUS_SELECT_SAME 6
#define NS_STYLE_USER_FOCUS_SELECT_MENU 7
// user-select
#define NS_STYLE_USER_SELECT_NONE 0
#define NS_STYLE_USER_SELECT_TEXT 1
#define NS_STYLE_USER_SELECT_ELEMENT 2
#define NS_STYLE_USER_SELECT_ELEMENTS 3
#define NS_STYLE_USER_SELECT_ALL 4
#define NS_STYLE_USER_SELECT_TOGGLE 5
#define NS_STYLE_USER_SELECT_TRI_STATE 6
#define NS_STYLE_USER_SELECT_AUTO 7 // internal value - please use nsFrame::IsSelectable()
#define NS_STYLE_USER_SELECT_MOZ_ALL 8 // force selection of all children - bug 48096
// user-input
#define NS_STYLE_USER_INPUT_NONE 0
#define NS_STYLE_USER_INPUT_ENABLED 1
#define NS_STYLE_USER_INPUT_DISABLED 2
#define NS_STYLE_USER_INPUT_AUTO 3
// user-modify
#define NS_STYLE_USER_MODIFY_READ_ONLY 0
#define NS_STYLE_USER_MODIFY_READ_WRITE 1
#define NS_STYLE_USER_MODIFY_WRITE_ONLY 2
// box-align
#define NS_STYLE_BOX_ALIGN_STRETCH 0
#define NS_STYLE_BOX_ALIGN_START 1
#define NS_STYLE_BOX_ALIGN_CENTER 2
#define NS_STYLE_BOX_ALIGN_BASELINE 3
#define NS_STYLE_BOX_ALIGN_END 4
// box-pack
#define NS_STYLE_BOX_PACK_START 0
#define NS_STYLE_BOX_PACK_CENTER 1
#define NS_STYLE_BOX_PACK_END 2
#define NS_STYLE_BOX_PACK_JUSTIFY 3
// box-direction
#define NS_STYLE_BOX_DIRECTION_NORMAL 0
#define NS_STYLE_BOX_DIRECTION_REVERSE 1
// box-orient
#define NS_STYLE_BOX_ORIENT_HORIZONTAL 0
#define NS_STYLE_BOX_ORIENT_VERTICAL 1
// Azimuth - See nsStyleAural
#define NS_STYLE_AZIMUTH_LEFT_SIDE 0x00
#define NS_STYLE_AZIMUTH_FAR_LEFT 0x01
#define NS_STYLE_AZIMUTH_LEFT 0x02
#define NS_STYLE_AZIMUTH_CENTER_LEFT 0x03
#define NS_STYLE_AZIMUTH_CENTER 0x04
#define NS_STYLE_AZIMUTH_CENTER_RIGHT 0x05
#define NS_STYLE_AZIMUTH_RIGHT 0x06
#define NS_STYLE_AZIMUTH_FAR_RIGHT 0x07
#define NS_STYLE_AZIMUTH_RIGHT_SIDE 0x08
#define NS_STYLE_AZIMUTH_BEHIND 0x80 // bits
#define NS_STYLE_AZIMUTH_LEFTWARDS 0x10 // bits
#define NS_STYLE_AZIMUTH_RIGHTWARDS 0x20 // bits
// See nsStyleAural
#define NS_STYLE_ELEVATION_BELOW 1
#define NS_STYLE_ELEVATION_LEVEL 2
#define NS_STYLE_ELEVATION_ABOVE 3
#define NS_STYLE_ELEVATION_HIGHER 4
#define NS_STYLE_ELEVATION_LOWER 5
// See nsStyleAural
#define NS_STYLE_PITCH_X_LOW 1
#define NS_STYLE_PITCH_LOW 2
#define NS_STYLE_PITCH_MEDIUM 3
#define NS_STYLE_PITCH_HIGH 4
#define NS_STYLE_PITCH_X_HIGH 5
// See nsStyleAural
#define NS_STYLE_PLAY_DURING_MIX 0x01 // bit field
#define NS_STYLE_PLAY_DURING_REPEAT 0x02
// See nsStyleAural
#define NS_STYLE_SPEAK_NONE 0
#define NS_STYLE_SPEAK_NORMAL 1
#define NS_STYLE_SPEAK_SPELL_OUT 2
// See nsStyleAural
#define NS_STYLE_SPEAK_HEADER_ONCE 0
#define NS_STYLE_SPEAK_HEADER_ALWAYS 1
// See nsStyleAural
#define NS_STYLE_SPEAK_NUMERAL_DIGITS 0
#define NS_STYLE_SPEAK_NUMERAL_CONTINUOUS 1
// See nsStyleAural
#define NS_STYLE_SPEAK_PUNCTUATION_NONE 0
#define NS_STYLE_SPEAK_PUNCTUATION_CODE 1
// See nsStyleAural
#define NS_STYLE_SPEECH_RATE_X_SLOW 0
#define NS_STYLE_SPEECH_RATE_SLOW 1
#define NS_STYLE_SPEECH_RATE_MEDIUM 2
#define NS_STYLE_SPEECH_RATE_FAST 3
#define NS_STYLE_SPEECH_RATE_X_FAST 4
#define NS_STYLE_SPEECH_RATE_FASTER 10
#define NS_STYLE_SPEECH_RATE_SLOWER 11
// See nsStyleAural
#define NS_STYLE_VOLUME_SILENT 0
#define NS_STYLE_VOLUME_X_SOFT 1
#define NS_STYLE_VOLUME_SOFT 2
#define NS_STYLE_VOLUME_MEDIUM 3
#define NS_STYLE_VOLUME_LOUD 4
#define NS_STYLE_VOLUME_X_LOUD 5
// See nsStyleColor
#define NS_STYLE_COLOR_TRANSPARENT 0
#define NS_STYLE_COLOR_INVERT 1
#define NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR 2
// See nsStyleColor
#define NS_COLOR_MOZ_HYPERLINKTEXT -1
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -2
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -3
// See nsStyleBackground
#define NS_STYLE_BG_COLOR_TRANSPARENT 0x01
#define NS_STYLE_BG_IMAGE_NONE 0x02
#define NS_STYLE_BG_X_POSITION_PERCENT 0x04
#define NS_STYLE_BG_X_POSITION_LENGTH 0x08
#define NS_STYLE_BG_Y_POSITION_PERCENT 0x10
#define NS_STYLE_BG_Y_POSITION_LENGTH 0x20
// See nsStyleBackground
#define NS_STYLE_BG_ATTACHMENT_SCROLL 0
#define NS_STYLE_BG_ATTACHMENT_FIXED 1
// See nsStyleBackground
#define NS_STYLE_BG_CLIP_BORDER 0
#define NS_STYLE_BG_CLIP_PADDING 1
// See nsStyleBackground
#define NS_STYLE_BG_INLINE_POLICY_EACH_BOX 0
#define NS_STYLE_BG_INLINE_POLICY_CONTINUOUS 1
#define NS_STYLE_BG_INLINE_POLICY_BOUNDING_BOX 2
// See nsStyleBackground
#define NS_STYLE_BG_ORIGIN_BORDER 0
#define NS_STYLE_BG_ORIGIN_PADDING 1
#define NS_STYLE_BG_ORIGIN_CONTENT 2
// See nsStyleBackground
#define NS_STYLE_BG_REPEAT_OFF 0x00
#define NS_STYLE_BG_REPEAT_X 0x01
#define NS_STYLE_BG_REPEAT_Y 0x02
#define NS_STYLE_BG_REPEAT_XY 0x03
// See nsStyleTable
#define NS_STYLE_BORDER_COLLAPSE 0
#define NS_STYLE_BORDER_SEPARATE 1
// See nsStyleBorder mBorder enum values
#define NS_STYLE_BORDER_WIDTH_THIN 0
#define NS_STYLE_BORDER_WIDTH_MEDIUM 1
#define NS_STYLE_BORDER_WIDTH_THICK 2
// XXX chopping block #define NS_STYLE_BORDER_WIDTH_LENGTH_VALUE 3
// See nsStyleBorder mBorderStyle
#define NS_STYLE_BORDER_STYLE_NONE 0
#define NS_STYLE_BORDER_STYLE_GROOVE 1
#define NS_STYLE_BORDER_STYLE_RIDGE 2
#define NS_STYLE_BORDER_STYLE_DOTTED 3
#define NS_STYLE_BORDER_STYLE_DASHED 4
#define NS_STYLE_BORDER_STYLE_SOLID 5
#define NS_STYLE_BORDER_STYLE_DOUBLE 6
#define NS_STYLE_BORDER_STYLE_BLANK 7
#define NS_STYLE_BORDER_STYLE_INSET 8
#define NS_STYLE_BORDER_STYLE_OUTSET 9
#define NS_STYLE_BORDER_STYLE_HIDDEN 10
#define NS_STYLE_BORDER_STYLE_BG_INSET 11
#define NS_STYLE_BORDER_STYLE_BG_OUTSET 12
#define NS_STYLE_BORDER_STYLE_BG_SOLID 13
// a bit ORed onto the style for table border collapsing indicating that the style was
// derived from a table with its rules attribute set
#define NS_STYLE_BORDER_STYLE_RULES_MASK 0x10
// See nsStyleDisplay
#define NS_STYLE_CLEAR_NONE 0
#define NS_STYLE_CLEAR_LEFT 1
#define NS_STYLE_CLEAR_RIGHT 2
#define NS_STYLE_CLEAR_LEFT_AND_RIGHT 3
#define NS_STYLE_CLEAR_LINE 4
#define NS_STYLE_CLEAR_BLOCK 5
#define NS_STYLE_CLEAR_COLUMN 6
#define NS_STYLE_CLEAR_PAGE 7
#define NS_STYLE_CLEAR_LAST_VALUE NS_STYLE_CLEAR_PAGE
// See
#define NS_STYLE_CONTENT_OPEN_QUOTE 0
#define NS_STYLE_CONTENT_CLOSE_QUOTE 1
#define NS_STYLE_CONTENT_NO_OPEN_QUOTE 2
#define NS_STYLE_CONTENT_NO_CLOSE_QUOTE 3
// See nsStyleColor
#define NS_STYLE_CURSOR_AUTO 1
#define NS_STYLE_CURSOR_CROSSHAIR 2
#define NS_STYLE_CURSOR_DEFAULT 3 // ie: an arrow
#define NS_STYLE_CURSOR_POINTER 4 // for links
#define NS_STYLE_CURSOR_MOVE 5
#define NS_STYLE_CURSOR_E_RESIZE 6
#define NS_STYLE_CURSOR_NE_RESIZE 7
#define NS_STYLE_CURSOR_NW_RESIZE 8
#define NS_STYLE_CURSOR_N_RESIZE 9
#define NS_STYLE_CURSOR_SE_RESIZE 10
#define NS_STYLE_CURSOR_SW_RESIZE 11
#define NS_STYLE_CURSOR_S_RESIZE 12
#define NS_STYLE_CURSOR_W_RESIZE 13
#define NS_STYLE_CURSOR_TEXT 14 // ie: i-beam
#define NS_STYLE_CURSOR_WAIT 15
#define NS_STYLE_CURSOR_HELP 16
#define NS_STYLE_CURSOR_COPY 17 // CSS3
#define NS_STYLE_CURSOR_ALIAS 18
#define NS_STYLE_CURSOR_CONTEXT_MENU 19
#define NS_STYLE_CURSOR_CELL 20
#define NS_STYLE_CURSOR_GRAB 21
#define NS_STYLE_CURSOR_GRABBING 22
#define NS_STYLE_CURSOR_SPINNING 23
#define NS_STYLE_CURSOR_COUNT_UP 24
#define NS_STYLE_CURSOR_COUNT_DOWN 25
#define NS_STYLE_CURSOR_COUNT_UP_DOWN 26
#define NS_STYLE_CURSOR_MOZ_ZOOM_IN 27
#define NS_STYLE_CURSOR_MOZ_ZOOM_OUT 28
// See nsStyleDisplay
#define NS_STYLE_DIRECTION_LTR 0
#define NS_STYLE_DIRECTION_RTL 1
#define NS_STYLE_DIRECTION_INHERIT 2
// See nsStyleDisplay
#define NS_STYLE_DISPLAY_NONE 0
#define NS_STYLE_DISPLAY_BLOCK 1
#define NS_STYLE_DISPLAY_INLINE 2
#define NS_STYLE_DISPLAY_INLINE_BLOCK 3
#define NS_STYLE_DISPLAY_LIST_ITEM 4
#define NS_STYLE_DISPLAY_MARKER 5
#define NS_STYLE_DISPLAY_RUN_IN 6
#define NS_STYLE_DISPLAY_COMPACT 7
#define NS_STYLE_DISPLAY_TABLE 8
#define NS_STYLE_DISPLAY_INLINE_TABLE 9
#define NS_STYLE_DISPLAY_TABLE_ROW_GROUP 10
#define NS_STYLE_DISPLAY_TABLE_COLUMN 11
#define NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP 12
#define NS_STYLE_DISPLAY_TABLE_HEADER_GROUP 13
#define NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP 14
#define NS_STYLE_DISPLAY_TABLE_ROW 15
#define NS_STYLE_DISPLAY_TABLE_CELL 16
#define NS_STYLE_DISPLAY_TABLE_CAPTION 17
#define NS_STYLE_DISPLAY_BOX 18
#define NS_STYLE_DISPLAY_INLINE_BOX 19
#define NS_STYLE_DISPLAY_GRID 20
#define NS_STYLE_DISPLAY_INLINE_GRID 21
#define NS_STYLE_DISPLAY_GRID_GROUP 22
#define NS_STYLE_DISPLAY_GRID_LINE 23
#define NS_STYLE_DISPLAY_STACK 24
#define NS_STYLE_DISPLAY_INLINE_STACK 25
#define NS_STYLE_DISPLAY_DECK 26
#define NS_STYLE_DISPLAY_BULLETINBOARD 27
#define NS_STYLE_DISPLAY_POPUP 28
#define NS_STYLE_DISPLAY_GROUPBOX 29
#define NS_STYLE_DISPLAY_PAGE_BREAK 30
// See nsStyleDisplay
#define NS_STYLE_FLOAT_NONE 0
#define NS_STYLE_FLOAT_LEFT 1
#define NS_STYLE_FLOAT_RIGHT 2
// See nsStyleFont
#define NS_STYLE_FONT_STYLE_NORMAL 0
#define NS_STYLE_FONT_STYLE_ITALIC 1
#define NS_STYLE_FONT_STYLE_OBLIQUE 2
// See nsStyleFont
#define NS_STYLE_FONT_VARIANT_NORMAL 0
#define NS_STYLE_FONT_VARIANT_SMALL_CAPS 1
// See nsStyleFont
#define NS_STYLE_FONT_WEIGHT_NORMAL 400
#define NS_STYLE_FONT_WEIGHT_BOLD 700
#define NS_STYLE_FONT_WEIGHT_BOLDER 1
#define NS_STYLE_FONT_WEIGHT_LIGHTER -1
// See nsStyleFont
#define NS_STYLE_FONT_SIZE_XXSMALL 0
#define NS_STYLE_FONT_SIZE_XSMALL 1
#define NS_STYLE_FONT_SIZE_SMALL 2
#define NS_STYLE_FONT_SIZE_MEDIUM 3
#define NS_STYLE_FONT_SIZE_LARGE 4
#define NS_STYLE_FONT_SIZE_XLARGE 5
#define NS_STYLE_FONT_SIZE_XXLARGE 6
#define NS_STYLE_FONT_SIZE_XXXLARGE 7 // Only used by <font size="7">. Not specifiable in CSS.
#define NS_STYLE_FONT_SIZE_LARGER 8
#define NS_STYLE_FONT_SIZE_SMALLER 9
// See nsStyleFont
#define NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED -4
#define NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED -3
#define NS_STYLE_FONT_STRETCH_CONDENSED -2
#define NS_STYLE_FONT_STRETCH_SEMI_CONDENSED -1
#define NS_STYLE_FONT_STRETCH_NORMAL 0
#define NS_STYLE_FONT_STRETCH_SEMI_EXPANDED 1
#define NS_STYLE_FONT_STRETCH_EXPANDED 2
#define NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED 3
#define NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED 4
#define NS_STYLE_FONT_STRETCH_WIDER 10
#define NS_STYLE_FONT_STRETCH_NARROWER -10
// See nsStyleFont mFlags
#define NS_STYLE_FONT_DEFAULT 0x00
#define NS_STYLE_FONT_FACE_MASK 0xFF // used to flag generic fonts
// See nsStyleFont - system fonts
#define NS_STYLE_FONT_CAPTION 1 // css2
#define NS_STYLE_FONT_ICON 2
#define NS_STYLE_FONT_MENU 3
#define NS_STYLE_FONT_MESSAGE_BOX 4
#define NS_STYLE_FONT_SMALL_CAPTION 5
#define NS_STYLE_FONT_STATUS_BAR 6
#define NS_STYLE_FONT_WINDOW 7 // css3
#define NS_STYLE_FONT_DOCUMENT 8
#define NS_STYLE_FONT_WORKSPACE 9
#define NS_STYLE_FONT_DESKTOP 10
#define NS_STYLE_FONT_INFO 11
#define NS_STYLE_FONT_DIALOG 12
#define NS_STYLE_FONT_BUTTON 13
#define NS_STYLE_FONT_PULL_DOWN_MENU 14
#define NS_STYLE_FONT_LIST 15
#define NS_STYLE_FONT_FIELD 16
// See nsStylePosition.mPosition
#define NS_STYLE_POSITION_STATIC 0
#define NS_STYLE_POSITION_RELATIVE 1
#define NS_STYLE_POSITION_ABSOLUTE 2
#define NS_STYLE_POSITION_FIXED 3
// See nsStylePosition.mClip
#define NS_STYLE_CLIP_AUTO 0x00
#define NS_STYLE_CLIP_RECT 0x01
#define NS_STYLE_CLIP_TYPE_MASK 0x0F
#define NS_STYLE_CLIP_LEFT_AUTO 0x10
#define NS_STYLE_CLIP_TOP_AUTO 0x20
#define NS_STYLE_CLIP_RIGHT_AUTO 0x40
#define NS_STYLE_CLIP_BOTTOM_AUTO 0x80
// FRAME/FRAMESET/IFRAME specific values including backward compatibility. Boolean values with
// the same meaning (e.g. 1 & yes) may need to be distinguished for correct mode processing
#define NS_STYLE_FRAME_YES 0
#define NS_STYLE_FRAME_NO 1
#define NS_STYLE_FRAME_0 2
#define NS_STYLE_FRAME_1 3
#define NS_STYLE_FRAME_ON 4
#define NS_STYLE_FRAME_OFF 5
#define NS_STYLE_FRAME_AUTO 6
#define NS_STYLE_FRAME_SCROLL 7
#define NS_STYLE_FRAME_NOSCROLL 8
// See nsStylePosition.mOverflow
#define NS_STYLE_OVERFLOW_VISIBLE 0
#define NS_STYLE_OVERFLOW_HIDDEN 1
#define NS_STYLE_OVERFLOW_SCROLL 2
#define NS_STYLE_OVERFLOW_AUTO 3
#define NS_STYLE_OVERFLOW_SCROLLBARS_NONE 4
#define NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL 5
#define NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL 6
// See nsStyleList
#define NS_STYLE_LIST_STYLE_NONE 0
#define NS_STYLE_LIST_STYLE_DISC 1
#define NS_STYLE_LIST_STYLE_CIRCLE 2
#define NS_STYLE_LIST_STYLE_SQUARE 3
#define NS_STYLE_LIST_STYLE_DECIMAL 4
#define NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO 5
#define NS_STYLE_LIST_STYLE_LOWER_ROMAN 6
#define NS_STYLE_LIST_STYLE_UPPER_ROMAN 7
#define NS_STYLE_LIST_STYLE_LOWER_GREEK 8
#define NS_STYLE_LIST_STYLE_LOWER_ALPHA 9
#define NS_STYLE_LIST_STYLE_LOWER_LATIN 9 // == ALPHA
#define NS_STYLE_LIST_STYLE_UPPER_ALPHA 10
#define NS_STYLE_LIST_STYLE_UPPER_LATIN 10 // == ALPHA
#define NS_STYLE_LIST_STYLE_HEBREW 11
#define NS_STYLE_LIST_STYLE_ARMENIAN 12
#define NS_STYLE_LIST_STYLE_GEORGIAN 13
#define NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC 14
#define NS_STYLE_LIST_STYLE_HIRAGANA 15
#define NS_STYLE_LIST_STYLE_KATAKANA 16
#define NS_STYLE_LIST_STYLE_HIRAGANA_IROHA 17
#define NS_STYLE_LIST_STYLE_KATAKANA_IROHA 18
#define NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN 19
#define NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN 20
#define NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA 21
#define NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA 22
#define NS_STYLE_LIST_STYLE_OLD_DECIMAL 23
#define NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM 24
#define NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH 25
#define NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL 26
#define NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL 27
#define NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL 28
#define NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL 29
#define NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL 30
#define NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL 31
#define NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC 32
#define NS_STYLE_LIST_STYLE_MOZ_PERSIAN 33
#define NS_STYLE_LIST_STYLE_MOZ_URDU 34
#define NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI 35
#define NS_STYLE_LIST_STYLE_MOZ_GURMUKHI 36
#define NS_STYLE_LIST_STYLE_MOZ_GUJARATI 37
#define NS_STYLE_LIST_STYLE_MOZ_ORIYA 38
#define NS_STYLE_LIST_STYLE_MOZ_KANNADA 39
#define NS_STYLE_LIST_STYLE_MOZ_MALAYALAM 40
#define NS_STYLE_LIST_STYLE_MOZ_BENGALI 41
#define NS_STYLE_LIST_STYLE_MOZ_TAMIL 42
#define NS_STYLE_LIST_STYLE_MOZ_TELUGU 43
#define NS_STYLE_LIST_STYLE_MOZ_THAI 44
#define NS_STYLE_LIST_STYLE_MOZ_LAO 45
#define NS_STYLE_LIST_STYLE_MOZ_MYANMAR 46
#define NS_STYLE_LIST_STYLE_MOZ_KHMER 47
#define NS_STYLE_LIST_STYLE_MOZ_HANGUL 48
#define NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT 49
#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME 50
#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC 51
#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM 52
#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER 53
#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET 54
// See nsStyleList
#define NS_STYLE_LIST_STYLE_POSITION_INSIDE 0
#define NS_STYLE_LIST_STYLE_POSITION_OUTSIDE 1
// See nsStyleMargin
#define NS_STYLE_MARGIN_SIZE_AUTO 0
// See nsStyleText
//
// Note: make sure the numbers are less than the numbers that start
// the vertical_align values below!
#define NS_STYLE_TEXT_ALIGN_DEFAULT 0
#define NS_STYLE_TEXT_ALIGN_LEFT 1
#define NS_STYLE_TEXT_ALIGN_RIGHT 2
#define NS_STYLE_TEXT_ALIGN_CENTER 3
#define NS_STYLE_TEXT_ALIGN_JUSTIFY 4
#define NS_STYLE_TEXT_ALIGN_CHAR 5 //align based on a certain character, for table cell
#define NS_STYLE_TEXT_ALIGN_MOZ_CENTER 6
#define NS_STYLE_TEXT_ALIGN_MOZ_RIGHT 7
// See nsStyleText, nsStyleFont
#define NS_STYLE_TEXT_DECORATION_NONE 0
#define NS_STYLE_TEXT_DECORATION_UNDERLINE NS_FONT_DECORATION_UNDERLINE
#define NS_STYLE_TEXT_DECORATION_OVERLINE NS_FONT_DECORATION_OVERLINE
#define NS_STYLE_TEXT_DECORATION_LINE_THROUGH NS_FONT_DECORATION_LINE_THROUGH
#define NS_STYLE_TEXT_DECORATION_BLINK 0x08
#define NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL 0x10
#define NS_STYLE_TEXT_DECORATION_PREF_ANCHORS 0x20
// See nsStyleText
#define NS_STYLE_TEXT_TRANSFORM_NONE 0
#define NS_STYLE_TEXT_TRANSFORM_CAPITALIZE 1
#define NS_STYLE_TEXT_TRANSFORM_LOWERCASE 2
#define NS_STYLE_TEXT_TRANSFORM_UPPERCASE 3
// See nsStyleText
// Note: these values pickup after the text-align values because there
// are a few html cases where an object can have both types of
// alignment applied with a single attribute
#define NS_STYLE_VERTICAL_ALIGN_BASELINE 10
#define NS_STYLE_VERTICAL_ALIGN_SUB 11
#define NS_STYLE_VERTICAL_ALIGN_SUPER 12
#define NS_STYLE_VERTICAL_ALIGN_TOP 13
#define NS_STYLE_VERTICAL_ALIGN_TEXT_TOP 14
#define NS_STYLE_VERTICAL_ALIGN_MIDDLE 15
#define NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM 16
#define NS_STYLE_VERTICAL_ALIGN_BOTTOM 17
// See nsStyleDisplay
#define NS_STYLE_VISIBILITY_HIDDEN 0
#define NS_STYLE_VISIBILITY_VISIBLE 1
#define NS_STYLE_VISIBILITY_COLLAPSE 2
// See nsStyleText
#define NS_STYLE_WHITESPACE_NORMAL 0
#define NS_STYLE_WHITESPACE_PRE 1
#define NS_STYLE_WHITESPACE_NOWRAP 2
#define NS_STYLE_WHITESPACE_MOZ_PRE_WRAP 3
// See nsStyleText
#define NS_STYLE_UNICODE_BIDI_NORMAL 0
#define NS_STYLE_UNICODE_BIDI_EMBED 1
#define NS_STYLE_UNICODE_BIDI_OVERRIDE 2
// See nsStyleTable (here for HTML 4.0 for now, should probably change to side flags)
#define NS_STYLE_TABLE_FRAME_NONE 0
#define NS_STYLE_TABLE_FRAME_ABOVE 1
#define NS_STYLE_TABLE_FRAME_BELOW 2
#define NS_STYLE_TABLE_FRAME_HSIDES 3
#define NS_STYLE_TABLE_FRAME_VSIDES 4
#define NS_STYLE_TABLE_FRAME_LEFT 5
#define NS_STYLE_TABLE_FRAME_RIGHT 6
#define NS_STYLE_TABLE_FRAME_BOX 7
#define NS_STYLE_TABLE_FRAME_BORDER 8
// See nsStyleTable
#define NS_STYLE_TABLE_RULES_NONE 0
#define NS_STYLE_TABLE_RULES_GROUPS 1
#define NS_STYLE_TABLE_RULES_ROWS 2
#define NS_STYLE_TABLE_RULES_COLS 3
#define NS_STYLE_TABLE_RULES_ALL 4
#define NS_STYLE_TABLE_COLS_NONE (-1)
#define NS_STYLE_TABLE_COLS_ALL PRInt32(1 << 30)
#define NS_STYLE_TABLE_LAYOUT_AUTO 0
#define NS_STYLE_TABLE_LAYOUT_FIXED 1
#define NS_STYLE_TABLE_EMPTY_CELLS_HIDE 0
#define NS_STYLE_TABLE_EMPTY_CELLS_SHOW 1
#define NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND 2
// CAPTION_SIDE uses NS_SIDE_*
// constants for cell "scope" attribute
#define NS_STYLE_CELL_SCOPE_ROW 0
#define NS_STYLE_CELL_SCOPE_COL 1
#define NS_STYLE_CELL_SCOPE_ROWGROUP 2
#define NS_STYLE_CELL_SCOPE_COLGROUP 3
// See nsStylePage
#define NS_STYLE_PAGE_MARKS_NONE 0x00
#define NS_STYLE_PAGE_MARKS_CROP 0x01
#define NS_STYLE_PAGE_MARKS_REGISTER 0x02
// See nsStylePage
#define NS_STYLE_PAGE_SIZE_AUTO 0
#define NS_STYLE_PAGE_SIZE_PORTRAIT 1
#define NS_STYLE_PAGE_SIZE_LANDSCAPE 2
// See nsStyleBreaks
#define NS_STYLE_PAGE_BREAK_AUTO 0
#define NS_STYLE_PAGE_BREAK_ALWAYS 1
#define NS_STYLE_PAGE_BREAK_AVOID 2
#define NS_STYLE_PAGE_BREAK_LEFT 3
#define NS_STYLE_PAGE_BREAK_RIGHT 4
#ifdef MOZ_SVG
// Some of our constants must map to the same values as those defined in
// nsISVG{,Path,Glyph}GeometrySource.idl/
// I don't want to add a dependency on the SVG module
// everywhere by #include'ing nsISVG{,Path,Glyph}GeometrySource.h, so these consts
// have to be kept in sync manually.
// dominant-baseline
#define NS_STYLE_DOMINANT_BASELINE_AUTO 0
#define NS_STYLE_DOMINANT_BASELINE_USE_SCRIPT 1
#define NS_STYLE_DOMINANT_BASELINE_NO_CHANGE 2
#define NS_STYLE_DOMINANT_BASELINE_RESET_SIZE 3
#define NS_STYLE_DOMINANT_BASELINE_ALPHABETIC 4
#define NS_STYLE_DOMINANT_BASELINE_HANGING 5
#define NS_STYLE_DOMINANT_BASELINE_IDEOGRAPHIC 6
#define NS_STYLE_DOMINANT_BASELINE_MATHEMATICAL 7
#define NS_STYLE_DOMINANT_BASELINE_CENTRAL 8
#define NS_STYLE_DOMINANT_BASELINE_MIDDLE 9
#define NS_STYLE_DOMINANT_BASELINE_TEXT_AFTER_EDGE 10
#define NS_STYLE_DOMINANT_BASELINE_TEXT_BEFORE_EDGE 11
#define NS_STYLE_DOMINANT_BASELINE_TEXT_TOP 12
#define NS_STYLE_DOMINANT_BASELINE_TEXT_BOTTOM 13
// fill-rule
#define NS_STYLE_FILL_RULE_NONZERO 0 /* == nsISVGGeometrySource::FILL_RULE_NONZERO */
#define NS_STYLE_FILL_RULE_EVENODD 1 /* == nsISVGGeometrySource::FILL_RULE_EVENODD */
// pointer-events
#define NS_STYLE_POINTER_EVENTS_NONE 0
#define NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED 1
#define NS_STYLE_POINTER_EVENTS_VISIBLEFILL 2
#define NS_STYLE_POINTER_EVENTS_VISIBLESTROKE 3
#define NS_STYLE_POINTER_EVENTS_VISIBLE 4
#define NS_STYLE_POINTER_EVENTS_PAINTED 5
#define NS_STYLE_POINTER_EVENTS_FILL 6
#define NS_STYLE_POINTER_EVENTS_STROKE 7
#define NS_STYLE_POINTER_EVENTS_ALL 8
// shape-rendering
#define NS_STYLE_SHAPE_RENDERING_AUTO 0 /* == nsISVGPathGeometrySource::SHAPE_RENDERING_AUTO */
#define NS_STYLE_SHAPE_RENDERING_OPTIMIZESPEED 1 /* == nsISVGPathGeometrySource::SHAPE_RENDERING_OPTIMIZESPEED */
#define NS_STYLE_SHAPE_RENDERING_CRISPEDGES 2 /* == nsISVGPathGeometrySource::SHAPE_RENDERING_CRISPEDGES */
#define NS_STYLE_SHAPE_RENDERING_GEOMETRICPRECISION 3 /* == nsISVGPathGeometrySource::SHAPE_RENDERING_GEOMETRICPRECISION */
// stroke-linecap
#define NS_STYLE_STROKE_LINECAP_BUTT 0 /* == nsISVGGeometrySource::STROKE_LINECAP_BUTT */
#define NS_STYLE_STROKE_LINECAP_ROUND 1 /* == nsISVGGeometrySource::STROKE_LINECAP_ROUND */
#define NS_STYLE_STROKE_LINECAP_SQUARE 2 /* == nsISVGGeometrySource::STROKE_LINECAP_SQUARE */
// stroke-linejoin
#define NS_STYLE_STROKE_LINEJOIN_MITER 0 /* == nsISVGGeometrySource::STROKE_LINEJOIN_MITER */
#define NS_STYLE_STROKE_LINEJOIN_ROUND 1 /* == nsISVGGeometrySource::STROKE_LINEJOIN_ROUND */
#define NS_STYLE_STROKE_LINEJOIN_BEVEL 2 /* == nsISVGGeometrySource::STROKE_LINEJOIN_BEVEL */
// text-anchor
#define NS_STYLE_TEXT_ANCHOR_START 0
#define NS_STYLE_TEXT_ANCHOR_MIDDLE 1
#define NS_STYLE_TEXT_ANCHOR_END 2
// text-rendering
#define NS_STYLE_TEXT_RENDERING_AUTO 0 /* == nsISVGGlyphGeometrySource::TEXT_RENDERING_AUTO */
#define NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED 1 /* == nsISVGG.G.S.::TEXT_RENDERING_OPTIMIZESPEED */
#define NS_STYLE_TEXT_RENDERING_OPTIMIZELEGIBILITY 2 /* == nsISVGG.G.S.::TEXT_RENDERING_OPTIMIZELEGIBILITY */
#define NS_STYLE_TEXT_RENDERING_GEOMETRICPRECISION 3 /* == nsISVGG.G.S.::TEXT_RENDERING_GEOMETRICPRECISION */
#endif // MOZ_SVG
#endif /* nsStyleConsts_h___ */

View File

@@ -1,209 +0,0 @@
#
# 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 = layout
LIBRARY_NAME = gklayout
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsLayoutModule
GRE_MODULE = 1
PACKAGE_FILE = layout.pkg
PACKAGE_VARS += MOZ_XUL
EXTRA_DSO_LIBS = gkgfx
ifdef MOZ_PERF_METRICS
EXTRA_DSO_LIBS += mozutil_s
endif
REQUIRES = xpcom \
string \
content \
gfx \
widget \
view \
locale \
necko \
dom \
editor \
webshell \
docshell \
htmlparser \
js \
xpconnect \
uriloader \
caps \
necko2 \
rdf \
xuldoc \
imglib2 \
pref \
unicharutil \
xul \
xultmpl \
lwbrk \
plugin \
$(NULL)
CPPSRCS = \
nsLayoutModule.cpp \
nsContentHTTPStartup.cpp \
nsContentDLF.cpp \
$(NULL)
EXPORTS = nsLayoutCID.h
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)gkhtmlbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkhtmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkhtmlforms_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkhtmlstyle_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkhtmltable_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkxulbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconbase_s.$(LIB_SUFFIX) \
$(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)gkconxbl_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxuldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconshared_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkview_s.$(LIB_SUFFIX) \
$(NULL)
ifdef MOZ_XUL
SHARED_LIBRARY_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)gkxultree_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkxulgrid_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxulcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconxultmpl_s.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_MATHML
SHARED_LIBRARY_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)gkmathmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkmathmlbase_s.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_SVG
SHARED_LIBRARY_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)gksvgbase_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkconsvgdoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)gkcontentsvg_s.$(LIB_SUFFIX) \
$(NULL)
ifdef MOZ_SVG_RENDERER_GDIPLUS
SHARED_LIBRARY_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)gksvgrenderergdiplus_s.$(LIB_SUFFIX) \
$(NULL)
OS_LIBS += \
Gdiplus.lib \
$(NULL)
endif
ifdef MOZ_SVG_RENDERER_LIBART
SHARED_LIBRARY_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)gksvgrendererlibart_s.$(LIB_SUFFIX) \
$(NULL)
endif
endif
EXTRA_DSO_LDOPTS = \
$(LIBS_DIR) \
$(EXTRA_DSO_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_JS_LIBS) \
$(NULL)
ifdef MOZ_SVG_RENDERER_LIBART
EXTRA_DSO_LDOPTS += $(MOZ_LIBART_LIBS) \
$(NULL)
ifdef MOZ_ENABLE_GTK2
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) \
$(NULL)
endif
endif
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
EXTRA_DSO_LDOPTS += \
$(TK_LIBS) \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(srcdir)/../base/src \
-I$(srcdir)/../html/base/src \
-I$(srcdir)/../html/forms/src \
-I$(srcdir)/../html/style/src \
-I$(srcdir)/../xul/content/src \
-I$(srcdir)/../xul/base/src \
-I$(srcdir)/../../content/base/src \
-I$(srcdir)/../../content/html/content/src \
-I$(srcdir)/../../content/html/document/src \
-I$(srcdir)/../../content/html/style/src \
-I$(srcdir)/../../content/xul/content/src \
-I$(srcdir)/../../content/xul/templates/src \
-I$(srcdir)/../../content/events/src \
-I$(topsrcdir)/view/src \
-I. \
$(NULL)
ifdef MOZ_MATHML
INCLUDES += -I$(srcdir)/../mathml/content/src
endif
ifdef MOZ_SVG
INCLUDES += -I$(srcdir)/../../content/svg/content/src
endif
DEFINES += -D_IMPL_NS_LAYOUT
GARBAGE += $(BUILD_DATE)
ifeq ($(OS_ARCH),IRIX)
ifeq ($(GNU_CXX),1)
LDFLAGS += -Wl,-LD_LAYOUT:lgot_buffer=50
endif
endif
export:: $(BUILD_DATE)
$(BUILD_DATE):: gbdate.pl $(wildcard $(SHARED_LIBRARY_LIBS))
$(RM) $@
$(PERL) $(srcdir)/gbdate.pl > $@

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,32 +0,0 @@
#
# 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
DIRS = base renderer
include $(topsrcdir)/config/rules.mk

Some files were not shown because too many files have changed in this diff Show More