diff --git a/Makefile.in b/Makefile.in index e1ff7749f543..457dd43da259 100644 --- a/Makefile.in +++ b/Makefile.in @@ -157,6 +157,10 @@ ifdef MOZ_ENABLE_GTK tier_9_dirs += widget/src/gtksuperwin widget/src/gtkxtbin endif +ifdef MOZ_INTERNAL_LIBART_LGPL +tier_9_dirs += other-licenses/libart_lgpl +endif + tier_9_dirs += \ widget/timer \ modules/libutil \ diff --git a/aclocal.m4 b/aclocal.m4 index 82055d9e6ca2..2b5b6feab05f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -7,6 +7,7 @@ builtin(include, build/autoconf/glib.m4)dnl builtin(include, build/autoconf/gtk.m4)dnl builtin(include, build/autoconf/libIDL.m4)dnl builtin(include, build/autoconf/nspr.m4)dnl +builtin(include, build/autoconf/libart.m4)dnl builtin(include, build/autoconf/pkg.m4)dnl dnl define(MOZ_TOPSRCDIR,.)dnl MOZ_TOPSRCDIR is used in altoptions.m4 diff --git a/allmakefiles.sh b/allmakefiles.sh index 288c2796d2e3..fecf21a99699 100755 --- a/allmakefiles.sh +++ b/allmakefiles.sh @@ -928,15 +928,27 @@ if [ "$MOZ_MATHML" ]; then " fi -# layout/svg +#libart +if [ "$MOZ_INTERNAL_LIBART_LGPL" ]; then + MAKEFILES_libart="other-licenses/libart_lgpl/Makefile" +fi + +# svg if [ "$MOZ_SVG" ]; then + MAKEFILES_content="$MAKEFILES_content + content/svg/Makefile + content/svg/document/Makefile + content/svg/document/src/Makefile + content/svg/content/Makefile + content/svg/content/src/Makefile +" + MAKEFILES_dom="$MAKEFILES_dom + dom/public/idl/svg/Makefile +" MAKEFILES_layout="$MAKEFILES_layout layout/svg/Makefile layout/svg/base/Makefile - layout/svg/base/public/Makefile layout/svg/base/src/Makefile - layout/svg/content/Makefile - layout/svg/content/src/Makefile " fi @@ -1107,6 +1119,7 @@ $MAKEFILES_l10n_lang $MAKEFILES_langpacks $MAKEFILES_content $MAKEFILES_layout +$MAKEFILES_libart $MAKEFILES_libreg $MAKEFILES_libimg $MAKEFILES_libpr0n diff --git a/build/mac/build_scripts/MozillaBuildList.pm b/build/mac/build_scripts/MozillaBuildList.pm index 52970dcfd8a4..a34fdf792c3d 100644 --- a/build/mac/build_scripts/MozillaBuildList.pm +++ b/build/mac/build_scripts/MozillaBuildList.pm @@ -711,10 +711,6 @@ sub BuildClientDist() InstallFromManifest(":mozilla:layout:html:base:src:MANIFEST", "$distdirectory:layout:"); InstallFromManifest(":mozilla:layout:html:forms:public:MANIFEST", "$distdirectory:layout:"); InstallFromManifest(":mozilla:layout:html:table:public:MANIFEST", "$distdirectory:layout:"); - if ($main::options{svg}) - { - InstallFromManifest(":mozilla:layout:svg:base:public:MANIFEST", "$distdirectory:layout:"); - } InstallFromManifest(":mozilla:layout:xul:base:public:Manifest", "$distdirectory:layout:"); #GFX @@ -737,6 +733,16 @@ sub BuildClientDist() InstallFromManifest(":mozilla:dom:public:idl:views:MANIFEST_IDL", "$distdirectory:idl:"); InstallFromManifest(":mozilla:dom:public:idl:xbl:MANIFEST_IDL", "$distdirectory:idl:"); InstallFromManifest(":mozilla:dom:public:idl:xul:MANIFEST_IDL", "$distdirectory:idl:"); + + # SVG + if ($main::options{libart_lgpl}) { + InstallFromManifest(":mozilla:other-licenses:libart_lgpl:MANIFEST", "$distdirectory:include:"); + } + if ($main::options{svg}) { + InstallFromManifest(":mozilla:content:svg:content:src:MANIFEST", "$distdirectory:content:"); + InstallFromManifest(":mozilla:layout:svg:base:src:MANIFEST", "$distdirectory:layout:"); + } + InstallFromManifest(":mozilla:dom:public:MANIFEST", "$distdirectory:dom:"); InstallFromManifest(":mozilla:dom:public:base:MANIFEST", "$distdirectory:dom:"); InstallFromManifest(":mozilla:dom:public:coreEvents:MANIFEST", "$distdirectory:dom:"); @@ -903,6 +909,11 @@ sub BuildClientDist() InstallFromManifest(":mozilla:js:jsd:MANIFEST", "$distdirectory:jsdebug:"); } + # libart + if ($main::options{libart_lgpl}) { + InstallFromManifest(":mozilla:modules:libart_lgpl:MANIFEST", "$distdirectory:include:"); + } + print("--- Client Dist export complete ----\n"); } @@ -1097,6 +1108,10 @@ sub BuildIDLProjects() BuildIDLProject(":mozilla:dom:macbuild:dom_xblIDL.xml", "dom_xbl"); BuildIDLProject(":mozilla:dom:macbuild:dom_xulIDL.xml", "dom_xul"); + if ($main::options{svg}) { + BuildIDLProject(":mozilla:dom:macbuild:dom_svgIDL.xml", "dom_svg"); + } + BuildIDLProject(":mozilla:dom:src:jsurl:macbuild:JSUrlDL.xml", "jsurl"); BuildIDLProject(":mozilla:gfx:macbuild:gfxIDL.xml", "gfx"); @@ -1592,6 +1607,15 @@ sub BuildLayoutProjects() BuildProject(":mozilla:content:macbuild:contentshared.xml", "contentshared$D.o"); MakeAlias(":mozilla:content:macbuild:contentshared$D.o", ":mozilla:dist:content:"); + if ($main::options{svg}) + { + BuildOneProject(":mozilla:content:macbuild:contentSVG.xml", "contentSVG$D.o", 0, 0, 0); + } + else + { + BuildOneProject(":mozilla:content:macbuild:contentSVG.xml", "contentSVG$D.o stub", 0, 0, 0); + } + BuildOneProject(":mozilla:content:macbuild:content.xml", "content$D.$S", 1, $main::ALIAS_SYM_FILES, 1); if ($main::options{mathml}) { @@ -1601,6 +1625,10 @@ sub BuildLayoutProjects() { BuildProject(":mozilla:layout:macbuild:layoutmathml.xml", "layoutmathml$D.o stub"); } + if ($main::options{libart_lgpl}) + { + BuildOneProject(":mozilla:other-licenses:libart_lgpl:macbuild:libart.xml", "libart$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + } if ($main::options{svg}) { BuildProject(":mozilla:layout:macbuild:layoutsvg.xml", "layoutsvg$D.o"); diff --git a/client.mak b/client.mak index 7fb735f20e44..24bd7e18ca5a 100644 --- a/client.mak +++ b/client.mak @@ -216,6 +216,40 @@ GFX2_CO_FLAGS=$(GFX2_CO_FLAGS) $(CVS_BRANCH) CVSCO_GFX2 = cvs $(CVS_FLAGS) co $(GFX2_CO_FLAGS) +#//------------------------------------------------------------------------ +#// Figure out how to pull the internal libart +#// (only pulled and built if MOZ_INTERNAL_LIBART_LGPL is set) +#// If no MOZ_INTERNAL_LIBART_CO_TAG is specified, use the default tag +#//------------------------------------------------------------------------ + +!if defined(MOZ_SVG) && !defined(MOZ_INTERNAL_LIBART_LGPL) +ERR_MESSAGE = ^ +You are trying to build Mozilla with SVG support (MOZ_SVG=1), but you ^ +haven not specified that mozilla/other-licenses/libart_lgpl should be ^ +pulled and built. At the moment Mozilla SVG builds need this patched ^ +version of libart. You either need to disable SVG support (unset MOZ_SVG) ^ +or enable pulling and building by setting MOZ_INTERNAL_LIBART_LGPL=1.^ +^ +If you choose to pull and build libart, note that it is only licensed^ +under the terms of the LGPL, not the MPL. (Which is why you have to opt^ +in explicitly.) +!endif + +!if defined(MOZ_INTERNAL_LIBART_LGPL) + +!ifndef MOZ_INTERNAL_LIBART_CO_FLAGS +MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_CO_FLAGS) +!endif + +!if "$(MOZ_INTERNAL_LIBART_CO_TAG)" != "" +MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) -r $(MOZ_INTERNAL_LIBART_CO_TAG) +!else +MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) $(CVS_BRANCH) +!endif + +CVSCO_MOZ_INTERNAL_LIBART = cvs $(CVS_FLAGS) co $(MOZ_INTERNAL_LIBART_CO_FLAGS) + +!endif ## The master target ############################################################ @@ -228,7 +262,11 @@ pull_and_build_all: pull_all build_all_dep pull_clobber_and_build_all: pull_all clobber_all build_all +!if !defined(MOZ_INTERNAL_LIBART_LGPL) pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_seamonkey +!else +pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_moz_internal_libart pull_seamonkey +!endif pull_nspr: pull_clientmak cd $(MOZ_SRC)\. @@ -260,6 +298,12 @@ pull_imglib2: cd $(MOZ_SRC)\. $(CVSCO_IMGLIB2) mozilla/modules/libpr0n +!if defined(MOZ_INTERNAL_LIBART_LGPL) +pull_moz_internal_libart: + cd $(MOZ_SRC)\. + $(CVSCO_MOZ_INTERNAL_LIBART) mozilla/other-licenses/libart_lgpl +!endif + pull_xpconnect: pull_nspr cd $(MOZ_SRC)\. $(CVSCO) mozilla/include diff --git a/client.mk b/client.mk index 1b826639112e..b6d6d12f5dde 100644 --- a/client.mk +++ b/client.mk @@ -332,6 +332,19 @@ ifeq ($(MOZ_CO_MODULE),) endif CVSCO_SEAMONKEY := $(CVSCO) $(CVS_CO_DATE_FLAGS) $(MOZ_CO_MODULE) +#################################### +# CVS defined for libart (pulled and built if MOZ_INTERNAL_LIBART_LGPL is set) +# +CVSCO_LIBART := $(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/other-licenses/libart_lgpl + +ifdef MOZ_INTERNAL_LIBART_LGPL +FASTUPDATE_LIBART := fast_update $(CVSCO_LIBART) +CHECKOUT_LIBART := cvs_co $(CVSCO_LIBART) +else +CHECKOUT_LIBART := true +FASTUPDATE_LIBART := true +endif + #################################### # CVS defines for Calendar (pulled and built if MOZ_CALENDAR is set) # @@ -409,6 +422,7 @@ real_checkout: cvs_co $(CVSCO_IMGLIB2) && \ cvs_co $(CVSCO_SEAMONKEY) && \ $(CHECKOUT_CALENDAR) && \ + $(CHECKOUT_LIBART) && \ cvs_co $(CVSCO_NOSUBDIRS) @echo "checkout finish: "`date` | tee -a $(CVSCO_LOGFILE) # @: Check the log for conflicts. ; @@ -466,6 +480,7 @@ real_fast-update: fast_update $(CVSCO_IMGLIB2) && \ fast_update $(CVSCO_SEAMONKEY) && \ $(FASTUPDATE_CALENDAR) && \ + $(FASTUPDATE_LIBART) && \ fast_update $(CVSCO_NOSUBDIRS) @echo "fast_update finish: "`date` | tee -a $(CVSCO_LOGFILE) # @: Check the log for conflicts. ; diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 839275e43fbe..96def992005e 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -111,11 +111,23 @@ MOZ_NATIVE_JPEG = @SYSTEM_JPEG@ MOZ_NATIVE_PNG = @SYSTEM_PNG@ MOZ_NATIVE_MNG = @SYSTEM_MNG@ +MOZ_INTERNAL_LIBART_LGPL = @MOZ_INTERNAL_LIBART_LGPL@ + MOZ_UPDATE_XTERM = @MOZ_UPDATE_XTERM@ MOZ_MATHML = @MOZ_MATHML@ MOZ_SVG = @MOZ_SVG@ +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@ diff --git a/configure b/configure index 240a2b360b01..1f32eb6986a7 100755 --- a/configure +++ b/configure @@ -894,6 +894,7 @@ LIBIDL_VERSION=0.6.3 PERL_VERSION=5.004 QT_VERSION=2.2.0 QT_VERSION_NUM=220 +LIBART_VERSION=2.3.4 GTK2_VERSION=1.3.7 MISSING_X= @@ -969,14 +970,14 @@ if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then _SAVE_LDFLAGS="$LDFLAGS" echo $ac_n "checking for host c compiler""... $ac_c" 1>&6 -echo "configure:973: checking for host c compiler" >&5 +echo "configure:974: checking for host c compiler" >&5 if test -z "$HOST_CC"; then for ac_prog in gcc cc /usr/ucb/cc icc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:980: checking for $ac_word" >&5 +echo "configure:981: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1012,14 +1013,14 @@ test -n "$HOST_CC" || HOST_CC="""" fi echo "$ac_t""$HOST_CC" 1>&6 echo $ac_n "checking for host c++ compiler""... $ac_c" 1>&6 -echo "configure:1016: checking for host c++ compiler" >&5 +echo "configure:1017: checking for host c++ compiler" >&5 if test -z "$HOST_CXX"; then for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl icc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1023: checking for $ac_word" >&5 +echo "configure:1024: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1068,7 +1069,7 @@ test -n "$HOST_CXX" || HOST_CXX="""" # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1072: checking for $ac_word" >&5 +echo "configure:1073: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1100,7 +1101,7 @@ fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1104: checking for $ac_word" >&5 +echo "configure:1105: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1133,16 +1134,16 @@ fi LDFLAGS="$HOST_LDFLAGS" echo $ac_n "checking whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1137: checking whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 +echo "configure:1138: checking whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1147: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_prog_hostcc_works=1 echo "$ac_t""yes" 1>&6 else @@ -1157,16 +1158,16 @@ rm -f conftest* CFLAGS="$HOST_CXXFLAGS" echo $ac_n "checking whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1161: checking whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works" >&5 +echo "configure:1162: checking whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_prog_hostcxx_works=1 echo "$ac_t""yes" 1>&6 else @@ -1187,7 +1188,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1191: checking for $ac_word" >&5 +echo "configure:1192: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1222,7 +1223,7 @@ test -n "$CC" || CC=":" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1226: checking for $ac_word" >&5 +echo "configure:1227: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1252,7 +1253,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1256: checking for $ac_word" >&5 +echo "configure:1257: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1303,7 +1304,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1307: checking for $ac_word" >&5 +echo "configure:1308: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1335,7 +1336,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1339: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1340: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1346,12 +1347,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1350 "configure" +#line 1351 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1377,12 +1378,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1381: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1382: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1386: checking whether we are using GNU C" >&5 +echo "configure:1387: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1391,7 +1392,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1396: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1410,7 +1411,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1414: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1415: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1447,7 +1448,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1451: checking for $ac_word" >&5 +echo "configure:1452: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1484,7 +1485,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1488: checking for $ac_word" >&5 +echo "configure:1489: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1516,7 +1517,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1520: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1521: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1527,12 +1528,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1531 "configure" +#line 1532 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1558,12 +1559,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1562: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1563: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1567: checking whether we are using GNU C++" >&5 +echo "configure:1568: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1572,7 +1573,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1591,7 +1592,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1595: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1596: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1622,13 +1623,64 @@ else fi fi +for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat > conftest.$ac_ext < +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:1645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + continue +fi +rm -f conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + + if test -z "$RANLIB"; then for ac_prog in "${target_alias}-ranlib" "${target}-ranlib" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1632: checking for $ac_word" >&5 +echo "configure:1684: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1665,7 +1717,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1669: checking for $ac_word" >&5 +echo "configure:1721: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1702,7 +1754,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1706: checking for $ac_word" >&5 +echo "configure:1758: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1739,7 +1791,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1743: checking for $ac_word" >&5 +echo "configure:1795: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1776,7 +1828,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1780: checking for $ac_word" >&5 +echo "configure:1832: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1813,7 +1865,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1817: checking for $ac_word" >&5 +echo "configure:1869: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1850,7 +1902,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1854: checking for $ac_word" >&5 +echo "configure:1906: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1889,7 +1941,7 @@ else # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1893: checking for $ac_word" >&5 +echo "configure:1945: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1919,7 +1971,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1923: checking for $ac_word" >&5 +echo "configure:1975: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1970,7 +2022,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1974: checking for $ac_word" >&5 +echo "configure:2026: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2002,7 +2054,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2006: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2058: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2013,12 +2065,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2017 "configure" +#line 2069 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2044,12 +2096,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2048: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2100: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2053: checking whether we are using GNU C" >&5 +echo "configure:2105: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2058,7 +2110,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2114: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2077,7 +2129,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2081: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2133: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2113,7 +2165,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2117: checking for $ac_word" >&5 +echo "configure:2169: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2145,7 +2197,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2149: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:2201: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2156,12 +2208,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 2160 "configure" +#line 2212 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:2165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2187,12 +2239,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2191: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2243: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:2196: checking whether we are using GNU C++" >&5 +echo "configure:2248: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2201,7 +2253,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2205: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2257: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -2220,7 +2272,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:2224: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:2276: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2251,10 +2303,61 @@ else fi fi +for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat > conftest.$ac_ext < +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:2325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + continue +fi +rm -f conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + + # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2258: checking for $ac_word" >&5 +echo "configure:2361: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2286,7 +2389,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2290: checking for $ac_word" >&5 +echo "configure:2393: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2327,7 +2430,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2331: checking for $ac_word" >&5 +echo "configure:2434: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2368,7 +2471,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2372: checking for $ac_word" >&5 +echo "configure:2475: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2409,7 +2512,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2413: checking for $ac_word" >&5 +echo "configure:2516: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2450,7 +2553,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2454: checking for $ac_word" >&5 +echo "configure:2557: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2512,10 +2615,10 @@ fi if test "$CC" != "icc"; then if test "x$CC" != xcc; then echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6 -echo "configure:2516: checking whether $CC and cc understand -c and -o together" >&5 +echo "configure:2619: checking whether $CC and cc understand -c and -o together" >&5 else echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6 -echo "configure:2519: checking whether cc understands -c and -o together" >&5 +echo "configure:2622: checking whether cc understands -c and -o together" >&5 fi set dummy $CC; ac_cc="`echo $2 | sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" @@ -2527,16 +2630,16 @@ else # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5' -if { (eval echo configure:2531: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:2532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; +if { (eval echo configure:2634: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:2635: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. - if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:2537: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:2640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then ac_try='cc -c conftest.c -o conftest.o 1>&5' - if { (eval echo configure:2539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:2540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; + if { (eval echo configure:2642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && + test -f conftest.o && { (eval echo configure:2643: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; then # cc works too. : @@ -2597,7 +2700,7 @@ fi # SKIP_COMPILER_CHECKS if test -z "$SKIP_PATH_CHECKS"; then echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2601: checking how to run the C preprocessor" >&5 +echo "configure:2704: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2612,13 +2715,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2622: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2629,13 +2732,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2646,13 +2749,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2677,7 +2780,7 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:2681: checking how to run the C++ preprocessor" >&5 +echo "configure:2784: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2690,12 +2793,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2731,7 +2834,7 @@ echo "$ac_t""$CXXCPP" 1>&6 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2735: checking for a BSD compatible install" >&5 +echo "configure:2838: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2784,7 +2887,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2788: checking whether ln -s works" >&5 +echo "configure:2891: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2809,7 +2912,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2813: checking for $ac_word" >&5 +echo "configure:2916: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2843,7 +2946,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2847: checking for $ac_word" >&5 +echo "configure:2950: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_EMACS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2884,7 +2987,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2888: checking for $ac_word" >&5 +echo "configure:2991: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2924,7 +3027,7 @@ if test -z "$PERL" || test "$PERL" = ":"; then fi echo $ac_n "checking for minimum required perl version >= $PERL_VERSION""... $ac_c" 1>&6 -echo "configure:2928: checking for minimum required perl version >= $PERL_VERSION" >&5 +echo "configure:3031: checking for minimum required perl version >= $PERL_VERSION" >&5 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5` _perl_res=$? echo "$ac_t""$_perl_version" 1>&6 @@ -2934,7 +3037,7 @@ if test "$_perl_res" != 0; then fi echo $ac_n "checking for full perl installation""... $ac_c" 1>&6 -echo "configure:2938: checking for full perl installation" >&5 +echo "configure:3041: checking for full perl installation" >&5 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5` _perl_res=$? if test "$_perl_res" != 0; then @@ -2947,7 +3050,7 @@ fi # Extract the first word of "whoami", so it can be a program name with args. set dummy whoami; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2951: checking for $ac_word" >&5 +echo "configure:3054: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2983,7 +3086,7 @@ fi # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2987: checking for $ac_word" >&5 +echo "configure:3090: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AUTOCONF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3019,7 +3122,7 @@ fi # Extract the first word of "unzip", so it can be a program name with args. set dummy unzip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3023: checking for $ac_word" >&5 +echo "configure:3126: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_UNZIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3057,7 +3160,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3061: checking for $ac_word" >&5 +echo "configure:3164: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ZIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3098,7 +3201,7 @@ fi # Extract the first word of "makedepend", so it can be a program name with args. set dummy makedepend; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3102: checking for $ac_word" >&5 +echo "configure:3205: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SYSTEM_MAKEDEPEND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3133,7 +3236,7 @@ fi # Extract the first word of "xargs", so it can be a program name with args. set dummy xargs; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3137: checking for $ac_word" >&5 +echo "configure:3240: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XARGS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3174,7 +3277,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3178: checking for $ac_word" >&5 +echo "configure:3281: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3230,7 +3333,7 @@ then fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:3234: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:3337: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3262,7 +3365,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:3266: checking for X" >&5 +echo "configure:3369: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -3324,12 +3427,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3333: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3398,14 +3501,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -3511,17 +3614,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:3515: checking whether -R must be followed by a space" >&5 +echo "configure:3618: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -3537,14 +3640,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -3576,7 +3679,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:3580: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:3683: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3584,7 +3687,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3617,7 +3720,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:3621: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:3724: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3625,7 +3728,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3665,12 +3768,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:3669: checking for gethostbyname" >&5 +echo "configure:3772: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -3714,7 +3817,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3718: checking for gethostbyname in -lnsl" >&5 +echo "configure:3821: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3722,7 +3825,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3763,12 +3866,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:3767: checking for connect" >&5 +echo "configure:3870: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -3812,7 +3915,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3816: checking for connect in -lsocket" >&5 +echo "configure:3919: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3820,7 +3923,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3855,12 +3958,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:3859: checking for remove" >&5 +echo "configure:3962: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -3904,7 +4007,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:3908: checking for remove in -lposix" >&5 +echo "configure:4011: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3912,7 +4015,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3947,12 +4050,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:3951: checking for shmat" >&5 +echo "configure:4054: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -3996,7 +4099,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:4000: checking for shmat in -lipc" >&5 +echo "configure:4103: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4004,7 +4107,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4048,7 +4151,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:4052: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4155: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4056,7 +4159,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4329,7 +4432,7 @@ MKSHLIB_FORCE_ALL= MKSHLIB_UNFORCE_ALL= if test "$GNU_CC"; then echo $ac_n "checking whether ld has archive extraction flags""... $ac_c" 1>&6 -echo "configure:4333: checking whether ld has archive extraction flags" >&5 +echo "configure:4436: checking whether ld has archive extraction flags" >&5 if eval "test \"`echo '$''{'ac_cv_mkshlib_force_and_unforce'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4346,14 +4449,14 @@ LOOP_INPUT LDFLAGS=$force LIBS=$unforce cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_mkshlib_force_and_unforce=$line; break else @@ -4417,7 +4520,7 @@ EOF TK_LIBS='-lbe -lroot' LIBS="$LIBS -lbe" echo $ac_n "checking for main in -lbind""... $ac_c" 1>&6 -echo "configure:4421: checking for main in -lbind" >&5 +echo "configure:4524: checking for main in -lbind" >&5 ac_lib_var=`echo bind'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4425,14 +4528,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5201,12 +5304,12 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5205: checking for ANSI C header files" >&5 +echo "configure:5308: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5214,7 +5317,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5218: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5321: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5231,7 +5334,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5249,7 +5352,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5270,7 +5373,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -5281,7 +5384,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:5285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5305,12 +5408,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5309: checking for working const" >&5 +echo "configure:5412: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5466: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -5380,12 +5483,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:5384: checking for mode_t" >&5 +echo "configure:5487: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5413,12 +5516,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:5417: checking for off_t" >&5 +echo "configure:5520: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5446,12 +5549,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:5450: checking for pid_t" >&5 +echo "configure:5553: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5479,12 +5582,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:5483: checking for size_t" >&5 +echo "configure:5586: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5512,12 +5615,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5516: checking for uid_t in sys/types.h" >&5 +echo "configure:5619: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -5546,12 +5649,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:5550: checking for st_blksize in struct stat" >&5 +echo "configure:5653: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5559,7 +5662,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:5563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5666: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -5592,12 +5695,12 @@ EOF fi echo $ac_n "checking for int16_t""... $ac_c" 1>&6 -echo "configure:5596: checking for int16_t" >&5 +echo "configure:5699: checking for int16_t" >&5 if eval "test \"`echo '$''{'ac_cv_int16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5605,7 +5708,7 @@ int main() { int16_t foo = 0; ; return 0; } EOF -if { (eval echo configure:5609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_int16_t=true else @@ -5627,12 +5730,12 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for int32_t""... $ac_c" 1>&6 -echo "configure:5631: checking for int32_t" >&5 +echo "configure:5734: checking for int32_t" >&5 if eval "test \"`echo '$''{'ac_cv_int32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5640,7 +5743,7 @@ int main() { int32_t foo = 0; ; return 0; } EOF -if { (eval echo configure:5644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_int32_t=true else @@ -5662,12 +5765,12 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for int64_t""... $ac_c" 1>&6 -echo "configure:5666: checking for int64_t" >&5 +echo "configure:5769: checking for int64_t" >&5 if eval "test \"`echo '$''{'ac_cv_int64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5675,7 +5778,7 @@ int main() { int64_t foo = 0; ; return 0; } EOF -if { (eval echo configure:5679: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_int64_t=true else @@ -5697,12 +5800,12 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for int64""... $ac_c" 1>&6 -echo "configure:5701: checking for int64" >&5 +echo "configure:5804: checking for int64" >&5 if eval "test \"`echo '$''{'ac_cv_int64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5710,7 +5813,7 @@ int main() { int64 foo = 0; ; return 0; } EOF -if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_int64=true else @@ -5732,12 +5835,12 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for uint""... $ac_c" 1>&6 -echo "configure:5736: checking for uint" >&5 +echo "configure:5839: checking for uint" >&5 if eval "test \"`echo '$''{'ac_cv_uint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5745,7 +5848,7 @@ int main() { uint foo = 0; ; return 0; } EOF -if { (eval echo configure:5749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_uint=true else @@ -5767,12 +5870,12 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for uint_t""... $ac_c" 1>&6 -echo "configure:5771: checking for uint_t" >&5 +echo "configure:5874: checking for uint_t" >&5 if eval "test \"`echo '$''{'ac_cv_uint_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5780,7 +5883,7 @@ int main() { uint_t foo = 0; ; return 0; } EOF -if { (eval echo configure:5784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_uint_t=true else @@ -5802,12 +5905,12 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for uint16_t""... $ac_c" 1>&6 -echo "configure:5806: checking for uint16_t" >&5 +echo "configure:5909: checking for uint16_t" >&5 if eval "test \"`echo '$''{'ac_cv_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5815,7 +5918,7 @@ int main() { uint16_t foo = 0; ; return 0; } EOF -if { (eval echo configure:5819: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_uint16_t=true else @@ -5846,12 +5949,12 @@ cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking for uname.domainname""... $ac_c" 1>&6 -echo "configure:5850: checking for uname.domainname" >&5 +echo "configure:5953: checking for uname.domainname" >&5 if eval "test \"`echo '$''{'ac_cv_have_uname_domainname_field'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -5859,7 +5962,7 @@ int main() { (void)uname(res); if (res != 0) { domain = res->domainname; } ; return 0; } EOF -if { (eval echo configure:5863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_uname_domainname_field=true else @@ -5883,12 +5986,12 @@ else fi echo $ac_n "checking for uname.__domainname""... $ac_c" 1>&6 -echo "configure:5887: checking for uname.__domainname" >&5 +echo "configure:5990: checking for uname.__domainname" >&5 if eval "test \"`echo '$''{'ac_cv_have_uname_us_domainname_field'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -5896,7 +5999,7 @@ int main() { (void)uname(res); if (res != 0) { domain = res->__domainname; } ; return 0; } EOF -if { (eval echo configure:5900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_uname_us_domainname_field=true else @@ -5928,17 +6031,17 @@ cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for 64-bit OS""... $ac_c" 1>&6 -echo "configure:5932: checking for 64-bit OS" >&5 +echo "configure:6035: checking for 64-bit OS" >&5 if test "$cross_compiling" = yes; then result="maybe" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then result="yes" else @@ -5968,7 +6071,7 @@ fi echo $ac_n "checking for usable wchar_t (2 bytes, unsigned)""... $ac_c" 1>&6 -echo "configure:5972: checking for usable wchar_t (2 bytes, unsigned)" >&5 +echo "configure:6075: checking for usable wchar_t (2 bytes, unsigned)" >&5 if eval "test \"`echo '$''{'ac_cv_have_usable_wchar'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5976,14 +6079,14 @@ else ac_cv_have_usable_wchar="maybe" else cat > conftest.$ac_ext < int main () { return (sizeof(wchar_t) != 2) || (wchar_t)-1 < (wchar_t) 0 ; } EOF -if { (eval echo configure:5987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_have_usable_wchar="yes" else @@ -6012,7 +6115,7 @@ else CFLAGS="$CFLAGS -fshort-wchar" echo $ac_n "checking for compiler -fshort-wchar option""... $ac_c" 1>&6 -echo "configure:6016: checking for compiler -fshort-wchar option" >&5 +echo "configure:6119: checking for compiler -fshort-wchar option" >&5 if eval "test \"`echo '$''{'ac_cv_have_usable_wchar_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6020,14 +6123,14 @@ else ac_cv_have_usable_wchar_option="maybe" else cat > conftest.$ac_ext < int main () { return (sizeof(wchar_t) != 2) || (wchar_t)-1 < (wchar_t) 0 ; } EOF -if { (eval echo configure:6031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_have_usable_wchar_option="yes" else @@ -6061,12 +6164,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:6065: checking for $ac_hdr that defines DIR" >&5 +echo "configure:6168: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -6074,7 +6177,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:6078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -6099,7 +6202,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:6103: checking for opendir in -ldir" >&5 +echo "configure:6206: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6107,7 +6210,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6140,7 +6243,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:6144: checking for opendir in -lx" >&5 +echo "configure:6247: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6148,7 +6251,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6190,17 +6293,17 @@ for ac_hdr in sys/byteorder.h compat.h getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6194: checking for $ac_hdr" >&5 +echo "configure:6297: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6230,17 +6333,17 @@ for ac_hdr in sys/bittypes.h memory.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6234: checking for $ac_hdr" >&5 +echo "configure:6337: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6270,17 +6373,17 @@ for ac_hdr in gnu/libc-version.h nl_types.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6274: checking for $ac_hdr" >&5 +echo "configure:6377: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6310,17 +6413,17 @@ for ac_hdr in X11/XKBlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6314: checking for $ac_hdr" >&5 +echo "configure:6417: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6351,17 +6454,17 @@ for ac_hdr in sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6355: checking for $ac_hdr" >&5 +echo "configure:6458: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6365: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6396,17 +6499,17 @@ case $target in do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6400: checking for $ac_hdr" >&5 +echo "configure:6503: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6440,7 +6543,7 @@ case $target in ;; *) echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6 -echo "configure:6444: checking for gethostbyname_r in -lc_r" >&5 +echo "configure:6547: checking for gethostbyname_r in -lc_r" >&5 ac_lib_var=`echo c_r'_'gethostbyname_r | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6448,7 +6551,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6489,7 +6592,7 @@ fi ;; esac echo $ac_n "checking for atan in -lm""... $ac_c" 1>&6 -echo "configure:6493: checking for atan in -lm" >&5 +echo "configure:6596: checking for atan in -lm" >&5 ac_lib_var=`echo m'_'atan | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6497,7 +6600,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6536,7 +6639,7 @@ else fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:6540: checking for dlopen in -ldl" >&5 +echo "configure:6643: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6544,7 +6647,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6587,7 +6690,7 @@ if test ! "$GNU_CXX"; then case $target in *-aix*) echo $ac_n "checking for demangle in -lC_r""... $ac_c" 1>&6 -echo "configure:6591: checking for demangle in -lC_r" >&5 +echo "configure:6694: checking for demangle in -lC_r" >&5 ac_lib_var=`echo C_r'_'demangle | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6595,7 +6698,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lC_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6636,7 +6739,7 @@ fi ;; *) echo $ac_n "checking for demangle in -lC""... $ac_c" 1>&6 -echo "configure:6640: checking for demangle in -lC" >&5 +echo "configure:6743: checking for demangle in -lC" >&5 ac_lib_var=`echo C'_'demangle | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6644,7 +6747,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lC $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6686,7 +6789,7 @@ fi esac fi echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:6690: checking for socket in -lsocket" >&5 +echo "configure:6793: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6694,7 +6797,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6746,7 +6849,7 @@ EOF _SAVE_LDFLAGS="$LDFLAGS" LDFLAGS="$XLDFLAGS $LDFLAGS" echo $ac_n "checking for XDrawLines in -lX11""... $ac_c" 1>&6 -echo "configure:6750: checking for XDrawLines in -lX11" >&5 +echo "configure:6853: checking for XDrawLines in -lX11" >&5 ac_lib_var=`echo X11'_'XDrawLines | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6754,7 +6857,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lX11 $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6787,7 +6890,7 @@ MISSING_X="$MISSING_X -lX11" fi echo $ac_n "checking for XextAddDisplay in -lXext""... $ac_c" 1>&6 -echo "configure:6791: checking for XextAddDisplay in -lXext" >&5 +echo "configure:6894: checking for XextAddDisplay in -lXext" >&5 ac_lib_var=`echo Xext'_'XextAddDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6795,7 +6898,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6828,7 +6931,7 @@ MISSING_X="$MISSING_X -lXext" fi echo $ac_n "checking for IceFlush in -lICE""... $ac_c" 1>&6 -echo "configure:6832: checking for IceFlush in -lICE" >&5 +echo "configure:6935: checking for IceFlush in -lICE" >&5 ac_lib_var=`echo ICE'_'IceFlush | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6836,7 +6939,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6868,7 +6971,7 @@ else fi echo $ac_n "checking for SmcCloseConnection in -lSM""... $ac_c" 1>&6 -echo "configure:6872: checking for SmcCloseConnection in -lSM" >&5 +echo "configure:6975: checking for SmcCloseConnection in -lSM" >&5 ac_lib_var=`echo SM'_'SmcCloseConnection | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6876,7 +6979,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lSM $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6908,7 +7011,7 @@ else fi echo $ac_n "checking for XtFree in -lXt""... $ac_c" 1>&6 -echo "configure:6912: checking for XtFree in -lXt" >&5 +echo "configure:7015: checking for XtFree in -lXt" >&5 ac_lib_var=`echo Xt'_'XtFree | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6916,7 +7019,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXt $X_PRE_LIBS $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6950,7 +7053,7 @@ fi echo $ac_n "checking for XineramaIsActive in -lXinerama""... $ac_c" 1>&6 -echo "configure:6954: checking for XineramaIsActive in -lXinerama" >&5 +echo "configure:7057: checking for XineramaIsActive in -lXinerama" >&5 ac_lib_var=`echo Xinerama'_'XineramaIsActive | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6958,7 +7061,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXinerama $XLIBS $XEXT_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6991,17 +7094,17 @@ fi ac_safe=`echo "X11/extensions/Xinerama.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/Xinerama.h""... $ac_c" 1>&6 -echo "configure:6995: checking for X11/extensions/Xinerama.h" >&5 +echo "configure:7098: checking for X11/extensions/Xinerama.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7108: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7024,7 +7127,7 @@ fi echo $ac_n "checking for XShmCreateImage in -lXext""... $ac_c" 1>&6 -echo "configure:7028: checking for XShmCreateImage in -lXext" >&5 +echo "configure:7131: checking for XShmCreateImage in -lXext" >&5 ac_lib_var=`echo Xext'_'XShmCreateImage | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7032,7 +7135,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext $XLIBS $XEXT_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7065,17 +7168,17 @@ fi ac_safe=`echo "X11/extensions/XShm.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XShm.h""... $ac_c" 1>&6 -echo "configure:7069: checking for X11/extensions/XShm.h" >&5 +echo "configure:7172: checking for X11/extensions/XShm.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7079: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7105,7 +7208,7 @@ EOF fi echo $ac_n "checking for XieFloGeometry in -lXIE""... $ac_c" 1>&6 -echo "configure:7109: checking for XieFloGeometry in -lXIE" >&5 +echo "configure:7212: checking for XieFloGeometry in -lXIE" >&5 ac_lib_var=`echo XIE'_'XieFloGeometry | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7113,7 +7216,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXIE $XLIBS $XEXT_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7146,17 +7249,17 @@ fi ac_safe=`echo "X11/extensions/XIElib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for X11/extensions/XIElib.h""... $ac_c" 1>&6 -echo "configure:7150: checking for X11/extensions/XIElib.h" >&5 +echo "configure:7253: checking for X11/extensions/XIElib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7193,7 +7296,7 @@ fi _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $XCFLAGS" cat > conftest.$ac_ext < @@ -7209,7 +7312,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:7213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -7228,7 +7331,7 @@ fi # $no_x echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:7232: checking for pthread_create in -lpthreads" >&5 +echo "configure:7335: checking for pthread_create in -lpthreads" >&5 echo " #include void *foo(void *v) { int a = 1; } @@ -7250,7 +7353,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:7254: checking for pthread_create in -lpthread" >&5 +echo "configure:7357: checking for pthread_create in -lpthread" >&5 echo " #include void *foo(void *v) { int a = 1; } @@ -7272,7 +7375,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:7276: checking for pthread_create in -lc_r" >&5 +echo "configure:7379: checking for pthread_create in -lc_r" >&5 echo " #include void *foo(void *v) { int a = 1; } @@ -7294,7 +7397,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:7298: checking for pthread_create in -lc" >&5 +echo "configure:7401: checking for pthread_create in -lc" >&5 echo " #include void *foo(void *v) { int a = 1; } @@ -7350,7 +7453,7 @@ then rm -f conftest* ac_cv_have_dash_pthread=no echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6 -echo "configure:7354: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:7457: checking whether ${CC-cc} accepts -pthread" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -7366,7 +7469,7 @@ echo "configure:7354: checking whether ${CC-cc} accepts -pthread" >&5 ac_cv_have_dash_pthreads=no if test "$ac_cv_have_dash_pthread" = "no"; then echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 -echo "configure:7370: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:7473: checking whether ${CC-cc} accepts -pthreads" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -7454,7 +7557,7 @@ EOF fi echo $ac_n "checking whether mmap() sees write()s""... $ac_c" 1>&6 -echo "configure:7458: checking whether mmap() sees write()s" >&5 +echo "configure:7561: checking whether mmap() sees write()s" >&5 mmap_test_prog=' @@ -7493,11 +7596,11 @@ if test "$cross_compiling" = yes; then result="yes" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then result="yes" else @@ -7522,13 +7625,13 @@ fi if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:7526: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:7629: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -7546,7 +7649,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -7568,7 +7671,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:7572: checking for 8-bit clean memcmp" >&5 +echo "configure:7675: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7576,7 +7679,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -7606,12 +7709,12 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" for ac_func in random strerror lchown fchmod snprintf localtime_r statvfs memmove rint do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7610: checking for $ac_func" >&5 +echo "configure:7713: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7661,12 +7764,12 @@ done for ac_func in nl_langinfo strtok_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7665: checking for $ac_func" >&5 +echo "configure:7768: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7722,12 +7825,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking for gnu_get_libc_version()""... $ac_c" 1>&6 -echo "configure:7726: checking for gnu_get_libc_version()" >&5 +echo "configure:7829: checking for gnu_get_libc_version()" >&5 if eval "test \"`echo '$''{'ac_cv_func_gnu_get_libc_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_gnu_get_libc_version=yes else @@ -7769,7 +7872,7 @@ cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether va_list assignments need array notation""... $ac_c" 1>&6 -echo "configure:7773: checking whether va_list assignments need array notation" >&5 +echo "configure:7876: checking whether va_list assignments need array notation" >&5 if eval "test \"`echo '$''{'ac_cv_valistisarray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7777,7 +7880,7 @@ else ac_cv_valistisarray=false else cat > conftest.$ac_ext < #include @@ -7790,7 +7893,7 @@ else } int main() { foo(0, 123); return(0); } EOF -if { (eval echo configure:7794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_valistisarray=false else @@ -7870,7 +7973,7 @@ if test "$GNU_CXX"; then _MOZ_RTTI_FLAGS=${_COMPILER_PREFIX}-fno-rtti echo $ac_n "checking for C++ exceptions flag""... $ac_c" 1>&6 -echo "configure:7874: checking for C++ exceptions flag" >&5 +echo "configure:7977: checking for C++ exceptions flag" >&5 if eval "test \"`echo '$''{'ac_cv_cxx_exceptions_flags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7907,12 +8010,12 @@ cross_compiling=$ac_cv_prog_cxx_cross HAVE_GCC3_ABI= if test "$GNU_CC"; then echo $ac_n "checking for gcc 3.0 ABI""... $ac_c" 1>&6 -echo "configure:7911: checking for gcc 3.0 ABI" >&5 +echo "configure:8014: checking for gcc 3.0 ABI" >&5 if eval "test \"`echo '$''{'ac_cv_gcc_three_abi'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8032: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_gcc_three_abi="yes" else @@ -7946,12 +8049,12 @@ fi echo $ac_n "checking for ios::binary""... $ac_c" 1>&6 -echo "configure:7950: checking for ios::binary" >&5 +echo "configure:8053: checking for ios::binary" >&5 if eval "test \"`echo '$''{'ac_cv_ios_binary'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -7960,7 +8063,7 @@ char *buffer = "config.log"; fstream *mFileStream=new fstream(buffer, ios::binary); ; return 0; } EOF -if { (eval echo configure:7964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_ios_binary=true else @@ -7984,12 +8087,12 @@ fi echo $ac_n "checking for ios::bin""... $ac_c" 1>&6 -echo "configure:7988: checking for ios::bin" >&5 +echo "configure:8091: checking for ios::bin" >&5 if eval "test \"`echo '$''{'ac_cv_ios_bin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -7998,7 +8101,7 @@ char *buffer = "config.log"; fstream *mFileStream=new fstream(buffer, ios::bin); ; return 0; } EOF -if { (eval echo configure:8002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_ios_bin=true else @@ -8021,12 +8124,12 @@ else fi echo $ac_n "checking for C++ \"explicit\" keyword""... $ac_c" 1>&6 -echo "configure:8025: checking for C++ \"explicit\" keyword" >&5 +echo "configure:8128: checking for C++ \"explicit\" keyword" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_explicit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_explicit=yes else @@ -8057,12 +8160,12 @@ EOF fi echo $ac_n "checking for C++ template specialization support""... $ac_c" 1>&6 -echo "configure:8061: checking for C++ template specialization support" >&5 +echo "configure:8164: checking for C++ template specialization support" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_template_specialization'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < struct X { int a; }; class Y {}; @@ -8072,7 +8175,7 @@ X int_x; X y_x; ; return 0; } EOF -if { (eval echo configure:8076: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_template_specialization=yes else @@ -8102,12 +8205,12 @@ EOF fi echo $ac_n "checking for modern C++ template specialization syntax support""... $ac_c" 1>&6 -echo "configure:8106: checking for modern C++ template specialization syntax support" >&5 +echo "configure:8209: checking for modern C++ template specialization syntax support" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_modern_specialize_template_syntax'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < struct X { int a; }; class Y {}; @@ -8117,7 +8220,7 @@ X int_x; X y_x; ; return 0; } EOF -if { (eval echo configure:8121: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_modern_specialize_template_syntax=yes else @@ -8139,12 +8242,12 @@ fi echo $ac_n "checking whether partial template specialization works""... $ac_c" 1>&6 -echo "configure:8143: checking whether partial template specialization works" >&5 +echo "configure:8246: checking whether partial template specialization works" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_partial_specialization'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < class Foo {}; template class Foo {}; @@ -8152,7 +8255,7 @@ int main() { return 0; ; return 0; } EOF -if { (eval echo configure:8156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_partial_specialization=yes else @@ -8174,12 +8277,12 @@ fi echo $ac_n "checking whether operators must be re-defined for templates derived from templates""... $ac_c" 1>&6 -echo "configure:8178: checking whether operators must be re-defined for templates derived from templates" >&5 +echo "configure:8281: checking whether operators must be re-defined for templates derived from templates" >&5 if eval "test \"`echo '$''{'ac_cv_need_derived_template_operators'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < class Base { }; template @@ -8191,7 +8294,7 @@ Derived a, b; return 0; ; return 0; } EOF -if { (eval echo configure:8195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8298: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_need_derived_template_operators=no else @@ -8213,12 +8316,12 @@ fi echo $ac_n "checking whether we need to cast a derived template to pass as its base class""... $ac_c" 1>&6 -echo "configure:8217: checking whether we need to cast a derived template to pass as its base class" >&5 +echo "configure:8320: checking whether we need to cast a derived template to pass as its base class" >&5 if eval "test \"`echo '$''{'ac_cv_need_cpp_template_cast_to_base'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < class Base { }; template class Derived : public Base { }; @@ -8227,7 +8330,7 @@ int main() { Derived bar; return foo(bar); ; return 0; } EOF -if { (eval echo configure:8231: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8334: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_need_cpp_template_cast_to_base=no else @@ -8248,12 +8351,12 @@ EOF fi echo $ac_n "checking whether the compiler can resolve const ambiguities for templates""... $ac_c" 1>&6 -echo "configure:8252: checking whether the compiler can resolve const ambiguities for templates" >&5 +echo "configure:8355: checking whether the compiler can resolve const ambiguities for templates" >&5 if eval "test \"`echo '$''{'ac_cv_can_resolve_const_ambiguity'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < class ptrClass { @@ -8274,7 +8377,7 @@ int main() { a(&i); ; return 0; } EOF -if { (eval echo configure:8278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_can_resolve_const_ambiguity=yes else @@ -8296,12 +8399,12 @@ fi echo $ac_n "checking whether the C++ \"using\" keyword can change access""... $ac_c" 1>&6 -echo "configure:8300: checking whether the C++ \"using\" keyword can change access" >&5 +echo "configure:8403: checking whether the C++ \"using\" keyword can change access" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_access_changing_using'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_access_changing_using=yes else @@ -8333,12 +8436,12 @@ EOF fi echo $ac_n "checking whether the C++ \"using\" keyword resolves ambiguity""... $ac_c" 1>&6 -echo "configure:8337: checking whether the C++ \"using\" keyword resolves ambiguity" >&5 +echo "configure:8440: checking whether the C++ \"using\" keyword resolves ambiguity" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_ambiguity_resolving_using'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_ambiguity_resolving_using=yes else @@ -8375,19 +8478,19 @@ EOF fi echo $ac_n "checking for \"std::\" namespace""... $ac_c" 1>&6 -echo "configure:8379: checking for \"std::\" namespace" >&5 +echo "configure:8482: checking for \"std::\" namespace" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_namespace_std'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return std::min(0, 1); ; return 0; } EOF -if { (eval echo configure:8391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_namespace_std=yes else @@ -8408,12 +8511,12 @@ EOF fi echo $ac_n "checking whether standard template operator!=() is ambiguous""... $ac_c" 1>&6 -echo "configure:8412: checking whether standard template operator!=() is ambiguous" >&5 +echo "configure:8515: checking whether standard template operator!=() is ambiguous" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_unambiguous_std_notequal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < struct T1 {}; @@ -8423,7 +8526,7 @@ int main() { T1 a,b; return a != b; ; return 0; } EOF -if { (eval echo configure:8427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8530: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_unambiguous_std_notequal=unambiguous else @@ -8445,12 +8548,12 @@ fi echo $ac_n "checking for C++ reinterpret_cast""... $ac_c" 1>&6 -echo "configure:8449: checking for C++ reinterpret_cast" >&5 +echo "configure:8552: checking for C++ reinterpret_cast" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_reinterpret_cast'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <(z); ; return 0; } EOF -if { (eval echo configure:8462: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8565: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cpp_reinterpret_cast=yes else @@ -8479,7 +8582,7 @@ EOF fi echo $ac_n "checking for C++ dynamic_cast to void*""... $ac_c" 1>&6 -echo "configure:8483: checking for C++ dynamic_cast to void*" >&5 +echo "configure:8586: checking for C++ dynamic_cast to void*" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_dynamic_cast_void_ptr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8487,11 +8590,8 @@ else ac_cv_cpp_dynamic_cast_void_ptr=no else cat > conftest.$ac_ext <(suby)))); } EOF -if { (eval echo configure:8510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_cpp_dynamic_cast_void_ptr=yes else @@ -8530,19 +8630,19 @@ fi echo $ac_n "checking whether C++ requires implementation of unused virtual methods""... $ac_c" 1>&6 -echo "configure:8534: checking whether C++ requires implementation of unused virtual methods" >&5 +echo "configure:8634: checking whether C++ requires implementation of unused virtual methods" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_unused_required'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_cpp_unused_required=no else @@ -8565,12 +8665,12 @@ fi echo $ac_n "checking for trouble comparing to zero near std::operator!=()""... $ac_c" 1>&6 -echo "configure:8569: checking for trouble comparing to zero near std::operator!=()" >&5 +echo "configure:8669: checking for trouble comparing to zero near std::operator!=()" >&5 if eval "test \"`echo '$''{'ac_cv_trouble_comparing_to_zero'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < template class Foo {}; @@ -8581,7 +8681,7 @@ int main() { Foo f; return (0 != f); ; return 0; } EOF -if { (eval echo configure:8585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_trouble_comparing_to_zero=no else @@ -8613,19 +8713,19 @@ cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:8617: checking for LC_MESSAGES" >&5 +echo "configure:8717: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'ac_cv_i18n_lc_messages'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int category = LC_MESSAGES; ; return 0; } EOF -if { (eval echo configure:8629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_i18n_lc_messages=yes else @@ -8705,7 +8805,7 @@ fi # Extract the first word of "nspr-config", so it can be a program name with args. set dummy nspr-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:8709: checking for $ac_word" >&5 +echo "configure:8809: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_NSPR_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8740,7 +8840,7 @@ fi min_nspr_version=4.0.0 echo $ac_n "checking for NSPR - version >= $min_nspr_version (skipping)""... $ac_c" 1>&6 -echo "configure:8744: checking for NSPR - version >= $min_nspr_version (skipping)" >&5 +echo "configure:8844: checking for NSPR - version >= $min_nspr_version (skipping)" >&5 no_nspr="" if test "$NSPR_CONFIG" = "no"; then @@ -8806,7 +8906,7 @@ if test "$JPEG_DIR" = no; then SYSTEM_JPEG= else echo $ac_n "checking for jpeg_destroy_compress in -ljpeg""... $ac_c" 1>&6 -echo "configure:8810: checking for jpeg_destroy_compress in -ljpeg" >&5 +echo "configure:8910: checking for jpeg_destroy_compress in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_destroy_compress | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8814,7 +8914,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ljpeg $JPEG_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8854,7 +8954,7 @@ if test "$SYSTEM_JPEG" = 1; then SYSTEM_JPEG= else cat > conftest.$ac_ext < #include @@ -8868,7 +8968,7 @@ else } EOF -if { (eval echo configure:8872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then SYSTEM_JPEG=1 else @@ -8911,16 +9011,16 @@ if test "$ZLIB_DIR" = no; then SYSTEM_ZLIB= else echo $ac_n "checking "for zlib.h"""... $ac_c" 1>&6 -echo "configure:8915: checking "for zlib.h"" >&5 +echo "configure:9015: checking "for zlib.h"" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9024: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* result="yes" SYSTEM_ZLIB=1 else @@ -8934,7 +9034,7 @@ rm -f conftest* fi if test "$SYSTEM_ZLIB" = 1; then echo $ac_n "checking for gzread in -lz""... $ac_c" 1>&6 -echo "configure:8938: checking for gzread in -lz" >&5 +echo "configure:9038: checking for gzread in -lz" >&5 ac_lib_var=`echo z'_'gzread | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8942,7 +9042,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $ZLIB_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9006,7 +9106,7 @@ if test "$PNG_DIR" = no; then SYSTEM_PNG= else echo $ac_n "checking for png_get_valid in -lpng""... $ac_c" 1>&6 -echo "configure:9010: checking for png_get_valid in -lpng" >&5 +echo "configure:9110: checking for png_get_valid in -lpng" >&5 ac_lib_var=`echo png'_'png_get_valid | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -9014,7 +9114,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpng $PNG_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9053,7 +9153,7 @@ if test "$SYSTEM_PNG" = 1; then SYSTEM_PNG= else cat > conftest.$ac_ext < #include @@ -9067,7 +9167,7 @@ else } EOF -if { (eval echo configure:9071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then SYSTEM_PNG=1 else @@ -9113,7 +9213,7 @@ if test "$MNG_DIR" = no; then SYSTEM_MNG= else echo $ac_n "checking for mng_initialize in -lmng""... $ac_c" 1>&6 -echo "configure:9117: checking for mng_initialize in -lmng" >&5 +echo "configure:9217: checking for mng_initialize in -lmng" >&5 ac_lib_var=`echo mng'_'mng_initialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -9121,7 +9221,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmng $MNG_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9160,7 +9260,7 @@ if test "$SYSTEM_MNG" = 1; then SYSTEM_MNG= else cat > conftest.$ac_ext < #include @@ -9174,7 +9274,7 @@ else } EOF -if { (eval echo configure:9178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then SYSTEM_MNG=1 else @@ -9386,7 +9486,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9390: checking for $ac_word" >&5 +echo "configure:9490: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9421,7 +9521,7 @@ fi min_gtk_version=$GTK_VERSION echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:9425: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:9525: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes @@ -9444,7 +9544,7 @@ echo "configure:9425: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -9522,7 +9622,7 @@ main () } EOF -if { (eval echo configure:9526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -9557,7 +9657,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext < @@ -9567,7 +9667,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:9571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" @@ -9690,7 +9790,7 @@ then # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9694: checking for $ac_word" >&5 +echo "configure:9794: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PKG_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9735,19 +9835,19 @@ fi echo "*** See http://www.freedesktop.org/software/pkgconfig" else echo $ac_n "checking for gtk+-2.0 >= 1.3.7""... $ac_c" 1>&6 -echo "configure:9739: checking for gtk+-2.0 >= 1.3.7" >&5 +echo "configure:9839: checking for gtk+-2.0 >= 1.3.7" >&5 if $PKG_CONFIG --exists "gtk+-2.0 >= 1.3.7" ; then echo "$ac_t""yes" 1>&6 succeeded=yes echo $ac_n "checking MOZ_GTK2_CFLAGS""... $ac_c" 1>&6 -echo "configure:9746: checking MOZ_GTK2_CFLAGS" >&5 +echo "configure:9846: checking MOZ_GTK2_CFLAGS" >&5 MOZ_GTK2_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 1.3.7"` echo "$ac_t""$MOZ_GTK2_CFLAGS" 1>&6 echo $ac_n "checking MOZ_GTK2_LIBS""... $ac_c" 1>&6 -echo "configure:9751: checking MOZ_GTK2_LIBS" >&5 +echo "configure:9851: checking MOZ_GTK2_LIBS" >&5 MOZ_GTK2_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 1.3.7"` echo "$ac_t""$MOZ_GTK2_LIBS" 1>&6 else @@ -9802,7 +9902,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9806: checking for $ac_word" >&5 +echo "configure:9906: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_MOC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9888,9 +9988,9 @@ cross_compiling=$ac_cv_prog_cxx_cross LIBS="$LIBS $QT_LIBS" echo $ac_n "checking Qt - version >= $QT_VERSION""... $ac_c" 1>&6 -echo "configure:9892: checking Qt - version >= $QT_VERSION" >&5 +echo "configure:9992: checking Qt - version >= $QT_VERSION" >&5 cat > conftest.$ac_ext < int main() { @@ -9901,7 +10001,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:9905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* result="yes" else @@ -9994,7 +10094,7 @@ fi if test "$MOZ_CALENDAR"; then echo $ac_n "checking for icalproperty_new_location in -lical""... $ac_c" 1>&6 -echo "configure:9998: checking for icalproperty_new_location in -lical" >&5 +echo "configure:10098: checking for icalproperty_new_location in -lical" >&5 ac_lib_var=`echo ical'_'icalproperty_new_location | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10002,7 +10102,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lical $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10045,7 +10145,7 @@ then _SAVE_LDFLAGS="$LDFLAGS" LDFLAGS="$XLDFLAGS $LDFLAGS" echo $ac_n "checking for XpGetPrinterList in -lXp""... $ac_c" 1>&6 -echo "configure:10049: checking for XpGetPrinterList in -lXp" >&5 +echo "configure:10149: checking for XpGetPrinterList in -lXp" >&5 ac_lib_var=`echo Xp'_'XpGetPrinterList | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10053,7 +10153,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXp $XEXT_LIBS $XLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10347,14 +10447,14 @@ if test "$TX_EXE"; then EOF echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:10351: checking whether byte ordering is bigendian" >&5 +echo "configure:10451: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -10365,11 +10465,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:10369: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -10380,7 +10480,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:10384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -10400,7 +10500,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -10840,7 +10940,7 @@ if test "${enable_efence+set}" = set; then enableval="$enable_efence" if test "$enableval" = "yes"; then echo $ac_n "checking for malloc in -lefence""... $ac_c" 1>&6 -echo "configure:10844: checking for malloc in -lefence" >&5 +echo "configure:10944: checking for malloc in -lefence" >&5 ac_lib_var=`echo efence'_'malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -10848,7 +10948,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lefence $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11066,7 +11166,7 @@ fi if test -z "$SKIP_LIBRARY_CHECKS"; then echo $ac_n "checking for cplus_demangle in -liberty""... $ac_c" 1>&6 -echo "configure:11070: checking for cplus_demangle in -liberty" >&5 +echo "configure:11170: checking for cplus_demangle in -liberty" >&5 ac_lib_var=`echo iberty'_'cplus_demangle | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11074,7 +11174,7 @@ else ac_save_LIBS="$LIBS" LIBS="-liberty "-liberty" $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11231,7 +11331,7 @@ if test -z "$SKIP_COMPILER_CHECKS"; then # Compiler Options echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6 -echo "configure:11235: checking for gcc -pipe support" >&5 +echo "configure:11335: checking for gcc -pipe support" >&5 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then echo '#include ' > dummy-hello.c echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c @@ -11246,14 +11346,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pipe" cat > conftest.$ac_ext < int main() { printf("Hello World\n"); ; return 0; } EOF -if { (eval echo configure:11257: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* _res_gcc_pipe="yes" else @@ -11302,21 +11402,18 @@ if test "$_PEDANTIC"; then _SAVE_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic" echo $ac_n "checking whether C++ compiler has -pedantic long long bug""... $ac_c" 1>&6 -echo "configure:11306: checking whether C++ compiler has -pedantic long long bug" >&5 +echo "configure:11406: checking whether C++ compiler has -pedantic long long bug" >&5 if test "$cross_compiling" = yes; then result="maybe" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then result="no" else @@ -11348,12 +11445,12 @@ fi _SAVE_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}" echo $ac_n "checking for correct overload resolution with const and templates""... $ac_c" 1>&6 -echo "configure:11352: checking for correct overload resolution with const and templates" >&5 +echo "configure:11449: checking for correct overload resolution with const and templates" >&5 if eval "test \"`echo '$''{'ac_nscap_nonconst_opeq_bug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -11383,7 +11480,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:11387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_nscap_nonconst_opeq_bug="no" else @@ -11423,16 +11520,16 @@ if test "$_IGNORE_LONG_LONG_WARNINGS"; then _SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long" echo $ac_n "checking whether compiler supports -Wno-long-long""... $ac_c" 1>&6 -echo "configure:11427: checking whether compiler supports -Wno-long-long" >&5 +echo "configure:11524: checking whether compiler supports -Wno-long-long" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long" _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long" @@ -11638,7 +11735,7 @@ case "$target" in # Extract the first word of "makeC++SharedLib_r", so it can be a program name with args. set dummy makeC++SharedLib_r; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:11642: checking for $ac_word" >&5 +echo "configure:11739: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AIX_SHLIB_BIN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11839,7 +11936,7 @@ fi # Extract the first word of "glib-config", so it can be a program name with args. set dummy glib-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:11843: checking for $ac_word" >&5 +echo "configure:11940: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11874,7 +11971,7 @@ fi min_glib_version=1.2.0 echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 -echo "configure:11878: checking for GLIB - version >= $min_glib_version" >&5 +echo "configure:11975: checking for GLIB - version >= $min_glib_version" >&5 no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes @@ -11897,7 +11994,7 @@ echo "configure:11878: checking for GLIB - version >= $min_glib_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -11973,7 +12070,7 @@ main () } EOF -if { (eval echo configure:11977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -12007,7 +12104,7 @@ fi CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat > conftest.$ac_ext < @@ -12017,7 +12114,7 @@ int main() { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } EOF -if { (eval echo configure:12021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" @@ -12061,7 +12158,7 @@ rm -f conftest* # Extract the first word of "libIDL-config", so it can be a program name with args. set dummy libIDL-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:12065: checking for $ac_word" >&5 +echo "configure:12162: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LIBIDL_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12096,7 +12193,7 @@ fi min_libIDL_version=$LIBIDL_VERSION echo $ac_n "checking for libIDL - version >= $min_libIDL_version""... $ac_c" 1>&6 -echo "configure:12100: checking for libIDL - version >= $min_libIDL_version" >&5 +echo "configure:12197: checking for libIDL - version >= $min_libIDL_version" >&5 no_libIDL="" if test "$LIBIDL_CONFIG" = "no" ; then no_libIDL=yes @@ -12123,7 +12220,7 @@ echo "configure:12100: checking for libIDL - version >= $min_libIDL_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -12209,7 +12306,7 @@ main () } EOF -if { (eval echo configure:12213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -12243,7 +12340,7 @@ fi CFLAGS="$CFLAGS $LIBIDL_CFLAGS" LIBS="$LIBS $LIBIDL_LIBS" cat > conftest.$ac_ext < @@ -12254,7 +12351,7 @@ int main() { return IDL_get_libver_string ? 1 : 0; ; return 0; } EOF -if { (eval echo configure:12258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding libIDL or finding the wrong" @@ -12293,7 +12390,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:12297: checking for $ac_word" >&5 +echo "configure:12394: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ORBIT_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12419,7 +12516,7 @@ fi # Extract the first word of "glib-config", so it can be a program name with args. set dummy glib-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:12423: checking for $ac_word" >&5 +echo "configure:12520: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12454,7 +12551,7 @@ fi min_glib_version=${GLIB_VERSION} echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 -echo "configure:12458: checking for GLIB - version >= $min_glib_version" >&5 +echo "configure:12555: checking for GLIB - version >= $min_glib_version" >&5 no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes @@ -12477,7 +12574,7 @@ echo "configure:12458: checking for GLIB - version >= $min_glib_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -12553,7 +12650,7 @@ main () } EOF -if { (eval echo configure:12557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -12587,7 +12684,7 @@ fi CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat > conftest.$ac_ext < @@ -12597,7 +12694,7 @@ int main() { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } EOF -if { (eval echo configure:12601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" @@ -12646,6 +12743,24 @@ fi +MOZ_LIBART_CFLAGS= +MOZ_LIBART_LIBS= + +if test "$MOZ_SVG"; then + if test "$MOZ_INTERNAL_LIBART_LGPL"; then + MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl' + MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm' + else + { echo "configure: error: SVG requires a modified version of libart. To pull and build +this LGPL library, set MOZ_INTERNAL_LIBART_LGPL, and then rerun the +checkout stage" 1>&2; exit 1; } + fi +fi + + + + + MOZ_XUL=1 # Check whether --enable-xul or --disable-xul was given. if test "${enable_xul+set}" = set; then @@ -13309,6 +13424,9 @@ s%@ORBIT_CONFIG@%$ORBIT_CONFIG%g s%@HOST_LIBIDL_CONFIG@%$HOST_LIBIDL_CONFIG%g s%@HOST_LIBIDL_CFLAGS@%$HOST_LIBIDL_CFLAGS%g s%@HOST_LIBIDL_LIBS@%$HOST_LIBIDL_LIBS%g +s%@MOZ_LIBART_CFLAGS@%$MOZ_LIBART_CFLAGS%g +s%@MOZ_LIBART_LIBS@%$MOZ_LIBART_LIBS%g +s%@MOZ_INTERNAL_LIBART_LGPL@%$MOZ_INTERNAL_LIBART_LGPL%g s%@MOZ_XUL@%$MOZ_XUL%g s%@AR_FLAGS@%$AR_FLAGS%g s%@AR_LIST@%$AR_LIST%g diff --git a/configure.in b/configure.in index 3e80a6521de1..014d1749050e 100644 --- a/configure.in +++ b/configure.in @@ -90,6 +90,7 @@ LIBIDL_VERSION=0.6.3 PERL_VERSION=5.004 QT_VERSION=2.2.0 QT_VERSION_NUM=220 +LIBART_VERSION=2.3.4 GTK2_VERSION=1.3.7 dnl Set various checks @@ -4051,6 +4052,35 @@ AC_SUBST(HOST_LIBIDL_CONFIG) AC_SUBST(HOST_LIBIDL_CFLAGS) AC_SUBST(HOST_LIBIDL_LIBS) +dnl ======================================================== +dnl Check for libart +dnl ======================================================== +MOZ_LIBART_CFLAGS= +MOZ_LIBART_LIBS= + +if test "$MOZ_SVG"; then + if test "$MOZ_INTERNAL_LIBART_LGPL"; then + dnl libart's configure hasn't been run yet, but we know what the + dnl answer should be anyway + MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl' + MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm' + else +dnl Disable system libart until the pixel format changes are merged upstream + AC_MSG_ERROR([SVG requires a modified version of libart. To pull and build +this LGPL library, set MOZ_INTERNAL_LIBART_LGPL, and then rerun the +checkout stage]) +dnl AM_PATH_LIBART($LIBART_VERSION, +dnl AC_MSG_ERROR(SVG requires at least version $LIBART_VERSION of libart)) +dnl +dnl MOZ_LIBART_CFLAGS=$LIBART_CFLAGS +dnl MOZ_LIBART_LIBS=$LIBART_LIBS + fi +fi + +AC_SUBST(MOZ_LIBART_CFLAGS) +AC_SUBST(MOZ_LIBART_LIBS) +AC_SUBST(MOZ_INTERNAL_LIBART_LGPL) + dnl ======================================================== dnl disable xul dnl ======================================================== diff --git a/content/Makefile.in b/content/Makefile.in index e22ad53b614a..c966173682f8 100644 --- a/content/Makefile.in +++ b/content/Makefile.in @@ -28,6 +28,10 @@ include $(DEPTH)/config/autoconf.mk DIRS = base html xml xul xbl xsl +ifdef MOZ_SVG +DIRS += svg +endif + DIRS += events shared build include $(topsrcdir)/config/rules.mk diff --git a/content/base/public/nsContentCID.h b/content/base/public/nsContentCID.h index 3fd33680f70a..8e40ce20d964 100644 --- a/content/base/public/nsContentCID.h +++ b/content/base/public/nsContentCID.h @@ -269,4 +269,22 @@ #define NS_RANGEUTILS_CID \ { 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } +#ifdef MOZ_SVG + +// {4E48C00A-E20F-4061-B869-2BAC285D68E8} +#define NS_SVGELEMENTFACTORY_DEPRECATED_CID \ +{ 0x4e48c00a, 0xe20f, 0x4061, { 0xb8, 0x69, 0x2b, 0xac, 0x28, 0x5d, 0x68, 0xe8 } } + + +// {34D9B28A-FBFF-4bbd-8546-1822FE3FB8B5} +#define NS_SVGELEMENTFACTORY_CID \ +{ 0x34d9b28a, 0xfbff, 0x4bbd, { 0x85, 0x46, 0x18, 0x22, 0xfe, 0x3f, 0xb8, 0xb5 } } + +#define NS_SVGDOCUMENT_CID \ +{ /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */ \ + 0xb7f44954, 0x11d1, 0x11b2, \ + {0x8c, 0x2e, 0xc2, 0xfe, 0xab, 0x41, 0x86, 0xbc}} + +#endif // MOZ_SVG + #endif /* nsContentCID_h__ */ diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index bb4268fa9fec..ae37e4f0aea2 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -380,6 +380,11 @@ extern NS_EXPORT nsresult extern NS_EXPORT nsresult NS_NewXMLDocument(nsIDocument** aInstancePtrResult); +#ifdef MOZ_SVG +extern NS_EXPORT nsresult + NS_NewSVGDocument(nsIDocument** aInstancePtrResult); +#endif + extern NS_EXPORT nsresult NS_NewImageDocument(nsIDocument** aInstancePtrResult); diff --git a/content/base/public/nsIElementFactory.h b/content/base/public/nsIElementFactory.h index d497c24ae86a..74cd042c9a15 100644 --- a/content/base/public/nsIElementFactory.h +++ b/content/base/public/nsIElementFactory.h @@ -68,4 +68,13 @@ public: #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_SVG +#define NS_SVG_DEPRECATED_NAMESPACE "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.svg" +#define NS_SVG_DEPRECATED_ELEMENT_FACTORY_CONTRACTID \ + NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_SVG_DEPRECATED_NAMESPACE + +#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___ */ diff --git a/content/base/src/nsRuleNode.cpp b/content/base/src/nsRuleNode.cpp index 1b647378ca12..b74c170b486d 100644 --- a/content/base/src/nsRuleNode.cpp +++ b/content/base/src/nsRuleNode.cpp @@ -913,6 +913,22 @@ static const PropertyCheckData XULCheckProperties[] = { }; #endif +#ifdef MOZ_SVG +static const PropertyCheckData SVGCheckProperties[] = { + CHECKDATA_PROP(nsCSSSVG, mFill, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mFillOpacity, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mFillRule, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStroke, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeDasharray, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeDashoffset, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeLinecap, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeLinejoin, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeMiterlimit, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeOpacity, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeWidth, CHECKDATA_VALUE, PR_FALSE) +}; +#endif + // These are indexed by style struct ID and must stay in order! static const StructCheckData gCheckProperties[] = { { nsnull, 0, nsnull}, /* empty, since no 0th SID */ @@ -937,6 +953,9 @@ static const StructCheckData gCheckProperties[] = { CHECKDATA_STRUCT(OutlineCheckProperties), #ifdef INCLUDE_XUL CHECKDATA_STRUCT(XULCheckProperties), +#endif +#ifdef MOZ_SVG + CHECKDATA_STRUCT(SVGCheckProperties), #endif { nsnull, 0, nsnull} /* empty, so at least we crash reliably if someone passes in the BorderPaddingShortcut ID */ @@ -1400,6 +1419,18 @@ nsRuleNode::GetXULData(nsIStyleContext* aContext, PRBool aComputeData) } #endif +#ifdef MOZ_SVG +const nsStyleStruct* +nsRuleNode::GetSVGData(nsIStyleContext* aContext, PRBool aComputeData) +{ + nsCSSSVG svgData; // Declare a struct with null CSS values. + nsRuleData ruleData(eStyleStruct_SVG, mPresContext, aContext); + ruleData.mSVGData = &svgData; + + return WalkRuleTree(eStyleStruct_SVG, aContext, &ruleData, &svgData, aComputeData); +} +#endif + const nsStyleStruct* nsRuleNode::WalkRuleTree(const nsStyleStructID aSID, nsIStyleContext* aContext, @@ -1676,6 +1707,15 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aConte } #endif +#ifdef MOZ_SVG + case eStyleStruct_SVG: + { + nsStyleSVG* svg = new (mPresContext) nsStyleSVG(); + aContext->SetStyle(eStyleStruct_SVG, *svg); + return svg; + } +#endif + case eStyleStruct_BorderPaddingShortcut: NS_ERROR("unexpected SID"); } @@ -1708,6 +1748,9 @@ nsRuleNode::gComputeStyleDataFn[] = { &nsRuleNode::ComputeOutlineData, #ifdef INCLUDE_XUL &nsRuleNode::ComputeXULData, +#endif +#ifdef MOZ_SVG + &nsRuleNode::ComputeSVGData, #endif nsnull }; @@ -4425,6 +4468,180 @@ nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData } #endif +#ifdef MOZ_SVG +static void +SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint, + nsIPresContext* aPresContext, nsStyleSVGPaint& aResult, PRBool& aInherited) +{ + if (aValue.GetUnit() == eCSSUnit_Inherit) { + aResult = parentPaint; + aInherited = PR_TRUE; + } else if (aValue.GetUnit() == eCSSUnit_None) { + aResult.mType = eStyleSVGPaintType_None; + } else if (SetColor(aValue, parentPaint.mColor, aPresContext, aResult.mColor, aInherited)) { + aResult.mType = eStyleSVGPaintType_Color; + } +} + +static void +SetSVGOpacity(const nsCSSValue& aValue, float parentOpacity, float& opacity, PRBool& aInherited) +{ + if (aValue.GetUnit() == eCSSUnit_Inherit) { + opacity = parentOpacity; + aInherited = PR_TRUE; + } + else if (aValue.GetUnit() == eCSSUnit_Number) { + opacity = aValue.GetFloatValue(); + } +} + +static void +SetSVGLength(const nsCSSValue& aValue, float parentLength, float& length, + nsIStyleContext* aContext, nsIPresContext* aPresContext, PRBool& aInherited) +{ + nsStyleCoord coord; + PRBool dummy; + if (SetCoord(aValue, coord, coord, + SETCOORD_LP | SETCOORD_FACTOR, + aContext, aPresContext, dummy)) { + if (coord.GetUnit() == eStyleUnit_Factor) { // user units + length = (float) coord.GetFactorValue(); + } + else { + length = (float) coord.GetCoordValue(); + float twipsPerPix; + aPresContext->GetScaledPixelsToTwips(&twipsPerPix); + if (twipsPerPix == 0.0f) + twipsPerPix = 1e-20f; + length /= twipsPerPix; + } + } + else if (aValue.GetUnit() == eCSSUnit_Inherit) { + length = parentLength; + aInherited = PR_TRUE; + } +} + +const nsStyleStruct* +nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData, + nsIStyleContext* aContext, + nsRuleNode* aHighestNode, + const RuleDetail& aRuleDetail, PRBool aInherited) +{ + nsCOMPtr parentContext = getter_AddRefs(aContext->GetParent()); + + nsStyleSVG* svg = nsnull; + nsStyleSVG* parentSVG = svg; + PRBool inherited = aInherited; + const nsCSSSVG& SVGData = NS_STATIC_CAST(const nsCSSSVG&, aData); + + if (aStartStruct) + // We only need to compute the delta between this computed data and our + // computed data. + svg = new (mPresContext) nsStyleSVG(*NS_STATIC_CAST(nsStyleSVG*,aStartStruct)); + else { + if (aRuleDetail != eRuleFullMixed) { + // No question. We will have to inherit. Go ahead and init + // with inherited vals from parent. + inherited = PR_TRUE; + if (parentContext) + parentSVG = (nsStyleSVG*)parentContext->GetStyleData(eStyleStruct_SVG); + if (parentSVG) + svg = new (mPresContext) nsStyleSVG(*parentSVG); + } + } + + if (!svg) + svg = parentSVG = new (mPresContext) nsStyleSVG(); + + // fill: + SetSVGPaint(SVGData.mFill, parentSVG->mFill, mPresContext, svg->mFill, inherited); + + // fill-opacity: + SetSVGOpacity(SVGData.mFillOpacity, parentSVG->mFillOpacity, svg->mFillOpacity, inherited); + + // fill-rule: enum, inherit + if (eCSSUnit_Enumerated == SVGData.mFillRule.GetUnit()) { + svg->mFillRule = SVGData.mFillRule.GetIntValue(); + } + else if (eCSSUnit_Inherit == SVGData.mFillRule.GetUnit()) { + inherited = PR_TRUE; + svg->mFillRule = parentSVG->mFillRule; + } + + // stroke: + SetSVGPaint(SVGData.mStroke, parentSVG->mStroke, mPresContext, svg->mStroke, inherited); + + // stroke-dasharray: , none, inherit + if (eCSSUnit_String == SVGData.mStrokeDasharray.GetUnit()) { + SVGData.mStrokeDasharray.GetStringValue(svg->mStrokeDasharray); + } + else if (eCSSUnit_None == SVGData.mStrokeDasharray.GetUnit()) { + svg->mStrokeDasharray.Truncate(); + } + else if (eCSSUnit_Inherit == SVGData.mStrokeDasharray.GetUnit()) { + inherited = PR_TRUE; + svg->mStrokeDasharray = parentSVG->mStrokeDasharray; + } + + // stroke-dashoffset: , inherit + SetSVGLength(SVGData.mStrokeDashoffset, parentSVG->mStrokeDashoffset, + svg->mStrokeDashoffset, aContext, mPresContext, inherited); + + // stroke-linecap: enum, inherit + if (eCSSUnit_Enumerated == SVGData.mStrokeLinecap.GetUnit()) { + svg->mStrokeLinecap = SVGData.mStrokeLinecap.GetIntValue(); + } + else if (eCSSUnit_Inherit == SVGData.mStrokeLinecap.GetUnit()) { + inherited = PR_TRUE; + svg->mStrokeLinecap = parentSVG->mStrokeLinecap; + } + + // stroke-linejoin: enum, inherit + if (eCSSUnit_Enumerated == SVGData.mStrokeLinejoin.GetUnit()) { + svg->mStrokeLinejoin = SVGData.mStrokeLinejoin.GetIntValue(); + } + else if (eCSSUnit_Inherit == SVGData.mStrokeLinejoin.GetUnit()) { + inherited = PR_TRUE; + svg->mStrokeLinejoin = parentSVG->mStrokeLinejoin; + } + + // stroke-miterlimit: , inherit + if (eCSSUnit_Number == SVGData.mStrokeMiterlimit.GetUnit()) { + float value = SVGData.mStrokeMiterlimit.GetFloatValue(); + if (value > 1) { // XXX this check should probably be in nsCSSParser + svg->mStrokeMiterlimit = value; + } + } + else if (eCSSUnit_Inherit == SVGData.mStrokeMiterlimit.GetUnit()) { + svg->mStrokeMiterlimit = parentSVG->mStrokeMiterlimit; + inherited = PR_TRUE; + } + + // stroke-opacity: + SetSVGOpacity(SVGData.mStrokeOpacity, parentSVG->mStrokeOpacity, svg->mStrokeOpacity, inherited); + + // stroke-width: + SetSVGLength(SVGData.mStrokeWidth, parentSVG->mStrokeWidth, + svg->mStrokeWidth, aContext, mPresContext, inherited); + + if (inherited) + // We inherited, and therefore can't be cached in the rule node. We have to be put right on the + // style context. + aContext->SetStyle(eStyleStruct_SVG, *svg); + else { + // We were fully specified and can therefore be cached right on the rule node. + if (!aHighestNode->mStyleData.mInheritedData) + aHighestNode->mStyleData.mInheritedData = new (mPresContext) nsInheritedStyleData; + aHighestNode->mStyleData.mInheritedData->mSVGData = svg; + // Propagate the bit down. + PropagateInheritBit(NS_STYLE_INHERIT_SVG, aHighestNode); + } + + return svg; +} +#endif + inline const nsStyleStruct* nsRuleNode::GetParentData(const nsStyleStructID aSID) { @@ -4468,6 +4685,9 @@ nsRuleNode::gGetStyleDataFn[] = { &nsRuleNode::GetOutlineData, #ifdef INCLUDE_XUL &nsRuleNode::GetXULData, +#endif +#ifdef MOZ_SVG + &nsRuleNode::GetSVGData, #endif nsnull }; diff --git a/content/base/src/nsStyleContext.cpp b/content/base/src/nsStyleContext.cpp index b3eb7be82184..edc98008e9c3 100644 --- a/content/base/src/nsStyleContext.cpp +++ b/content/base/src/nsStyleContext.cpp @@ -519,6 +519,11 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct) case eStyleStruct_XUL: mCachedStyleData.mResetData->mXULData = (nsStyleXUL*)(const nsStyleXUL*)(&aStruct); break; +#endif +#ifdef MOZ_SVG + case eStyleStruct_SVG: + mCachedStyleData.mInheritedData->mSVGData = (nsStyleSVG*)(const nsStyleSVG*)(&aStruct); + break; #endif default: NS_ERROR("Invalid style struct id"); @@ -683,6 +688,20 @@ nsStyleContext::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint) } } +#ifdef MOZ_SVG + if (aHint < maxHint) { + const nsStyleSVG* svg = (const nsStyleSVG*)PeekStyleData(eStyleStruct_SVG); + if (svg) { + const nsStyleSVG* otherSVG = (const nsStyleSVG*)aOther->GetStyleData(eStyleStruct_SVG); + if (svg != otherSVG) { + hint = svg->CalcDifference(*otherSVG); + if (aHint < hint) + aHint = hint; + } + } + } +#endif + // At this point, we know that the worst kind of damage we could do is a reflow. maxHint = NS_STYLE_HINT_REFLOW; @@ -808,7 +827,7 @@ nsStyleContext::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint) } } } - + if (aHint < maxHint) { const nsStyleTableBorder* table = (const nsStyleTableBorder*)PeekStyleData(eStyleStruct_TableBorder); if (table) { @@ -1223,6 +1242,18 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out, (int)xul->mBoxOrient, (int)xul->mBoxPack, (int)xul->mBoxOrdinal); +#endif + + // SVG +#ifdef MOZ_SVG + IndentBy(out,aIndent); + const nsStyleSVG* svg = (const nsStyleSVG*)GetStyleData(eStyleStruct_SVG); + fprintf(out, "mStroke.mType, + svg->mStrokeWidth, + svg->mStrokeOpacity, + (int)svg->mFill.mType, + svg->mFillOpacity); fprintf(out, "\" />\n"); #endif //#insert new style structs here# diff --git a/content/build/Makefile.in b/content/build/Makefile.in index 474457de06a8..929d9c98fc2a 100644 --- a/content/build/Makefile.in +++ b/content/build/Makefile.in @@ -82,6 +82,13 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/libgkconshared_s.$(LIB_SUFFIX) \ $(NULL) +ifdef MOZ_SVG +SHARED_LIBRARY_LIBS += \ + $(DIST)/lib/libgkconsvgdoc_s.$(LIB_SUFFIX) \ + $(DIST)/lib/libgkcontentsvg_s.$(LIB_SUFFIX) \ + $(NULL) +endif + ifdef MOZ_PERF_METRICS SHARED_LIBRARY_LIBS += \ $(DIST)/lib/libmozutil_s.$(LIB_SUFFIX) \ diff --git a/content/build/makefile.win b/content/build/makefile.win index 10a91c6a3be3..54611cb0a96f 100644 --- a/content/build/makefile.win +++ b/content/build/makefile.win @@ -82,6 +82,10 @@ SUB_LIBRARIES=\ $(DIST)\lib\contentxuldocument_s.lib \ $(DIST)\lib\contentxultemplates_s.lib \ $(DIST)\lib\contentxbl_s.lib \ +!ifdef MOZ_SVG + $(DIST)\lib\contentsvgdoc_s.lib \ + $(DIST)\lib\contentsvg_s.lib \ +!endif $(DIST)\lib\contentevents_s.lib \ $(DIST)\lib\contentshared_s.lib \ $(NULL) diff --git a/content/build/nsContentCID.h b/content/build/nsContentCID.h index 3fd33680f70a..8e40ce20d964 100644 --- a/content/build/nsContentCID.h +++ b/content/build/nsContentCID.h @@ -269,4 +269,22 @@ #define NS_RANGEUTILS_CID \ { 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } +#ifdef MOZ_SVG + +// {4E48C00A-E20F-4061-B869-2BAC285D68E8} +#define NS_SVGELEMENTFACTORY_DEPRECATED_CID \ +{ 0x4e48c00a, 0xe20f, 0x4061, { 0xb8, 0x69, 0x2b, 0xac, 0x28, 0x5d, 0x68, 0xe8 } } + + +// {34D9B28A-FBFF-4bbd-8546-1822FE3FB8B5} +#define NS_SVGELEMENTFACTORY_CID \ +{ 0x34d9b28a, 0xfbff, 0x4bbd, { 0x85, 0x46, 0x18, 0x22, 0xfe, 0x3f, 0xb8, 0xb5 } } + +#define NS_SVGDOCUMENT_CID \ +{ /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */ \ + 0xb7f44954, 0x11d1, 0x11b2, \ + {0x8c, 0x2e, 0xc2, 0xfe, 0xab, 0x41, 0x86, 0xbc}} + +#endif // MOZ_SVG + #endif /* nsContentCID_h__ */ diff --git a/content/build/nsContentDLF.cpp b/content/build/nsContentDLF.cpp index 1870aaf1937e..de286eeed496 100644 --- a/content/build/nsContentDLF.cpp +++ b/content/build/nsContentDLF.cpp @@ -70,6 +70,9 @@ static NS_DEFINE_IID(kHTMLDocumentCID, NS_HTMLDOCUMENT_CID); static NS_DEFINE_IID(kXMLDocumentCID, NS_XMLDOCUMENT_CID); +#ifdef MOZ_SVG +static NS_DEFINE_IID(kSVGDocumentCID, NS_SVGDOCUMENT_CID); +#endif static NS_DEFINE_IID(kImageDocumentCID, NS_IMAGEDOCUMENT_CID); static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID); @@ -99,6 +102,13 @@ static const char* const gXMLTypes[] = { 0 }; +#ifdef MOZ_SVG +static char* gSVGTypes[] = { + "image/svg+xml", + "image/svg+xml; x-view-type=view-source", + 0 +}; +#endif static const char* const gRDFTypes[] = { "text/rdf", @@ -241,6 +251,19 @@ nsContentDLF::CreateInstance(const char* aCommand, } } +#ifdef MOZ_SVG + // Try SVG + typeIndex = 0; + while(gSVGTypes[typeIndex]) { + if (!PL_strcmp(gSVGTypes[typeIndex++], aContentType)) { + return CreateDocument(aCommand, + aChannel, aLoadGroup, + aContainer, kSVGDocumentCID, + aDocListener, aDocViewer); + } + } +#endif + // Try RDF typeIndex = 0; while (gRDFTypes[typeIndex]) { @@ -610,6 +633,14 @@ nsContentDLF::RegisterDocumentFactories(nsIComponentManager* aCompMgr, rv = RegisterTypes(aCompMgr, catmgr, "view-source", aPath, aLocation, aType, gXMLTypes); if (NS_FAILED(rv)) break; +#ifdef MOZ_SVG + rv = RegisterTypes(aCompMgr, catmgr, "view", aPath, aLocation, aType, gSVGTypes); + if (NS_FAILED(rv)) + break; + rv = RegisterTypes(aCompMgr, catmgr, "view-source", aPath, aLocation, aType, gSVGTypes); + if (NS_FAILED(rv)) + break; +#endif rv = RegisterTypes(aCompMgr, catmgr, "view", aPath, aLocation, aType, gImageTypes); if (NS_FAILED(rv)) break; diff --git a/content/build/nsContentModule.cpp b/content/build/nsContentModule.cpp index 93d85f2fc580..4acb106a343d 100644 --- a/content/build/nsContentModule.cpp +++ b/content/build/nsContentModule.cpp @@ -126,6 +126,10 @@ class nsIDocumentLoaderFactory; #include "nsXULElement.h" #endif +#ifdef MOZ_SVG +#include "nsSVGAtoms.h" +#endif + // jst says, ``we need this to avoid holding on to XPConnect past its // destruction. By being an XPCOM shutdown observer we can make sure // we release the content global reference to XPConnect before @@ -181,6 +185,10 @@ Initialize(nsIModule* aSelf) nsXULContentUtils::Init(); #endif +#ifdef MOZ_SVG + nsSVGAtoms::AddRefAtoms(); +#endif + nsContentUtils::Init(); // Add our shutdown observer. @@ -226,6 +234,10 @@ Shutdown(nsIModule* aSelf) nsXULElement::ReleaseGlobals(); #endif +#ifdef MOZ_SVG + nsSVGAtoms::ReleaseAtoms(); +#endif + NS_IF_RELEASE(nsContentDLF::gUAStyleSheet); NS_IF_RELEASE(nsRuleNode::gLangService); nsContentUtils::Shutdown(); @@ -257,6 +269,10 @@ extern nsresult NS_NewXULElementFactory(nsIElementFactory** aResult); extern NS_IMETHODIMP NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult); #endif +#ifdef MOZ_SVG +extern nsresult NS_NewSVGElementFactory(nsIElementFactory** aResult); +#endif + #define MAKE_CTOR(ctor_, iface_, func_) \ static NS_IMETHODIMP \ ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \ @@ -284,6 +300,9 @@ MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTM MAKE_CTOR(CreateHTMLCSSStyleSheet, nsIHTMLCSSStyleSheet, NS_NewHTMLCSSStyleSheet) MAKE_CTOR(CreateDOMImplementation, nsIDOMDOMImplementation, NS_NewDOMImplementation) MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument) +#ifdef MOZ_SVG +MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument) +#endif MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument) MAKE_CTOR(CreateCSSParser, nsICSSParser, NS_NewCSSParser) MAKE_CTOR(CreateCSSLoader, nsICSSLoader, NS_NewCSSLoader) @@ -324,6 +343,9 @@ MAKE_CTOR(CreateXULPopupListener, nsIXULPopupListener, NS_NewXUL // NS_NewXULPrototypeCache MAKE_CTOR(CreateXULElementFactory, nsIElementFactory, NS_NewXULElementFactory) #endif +#ifdef MOZ_SVG +MAKE_CTOR(CreateSVGElementFactory, nsIElementFactory, NS_NewSVGElementFactory) +#endif MAKE_CTOR(CreateControllerCommandManager, nsIControllerCommandManager, NS_NewControllerCommandManager) NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentHTTPStartup) MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory) @@ -477,6 +499,13 @@ static nsModuleComponentInfo gComponents[] = { nsnull, CreateXMLDocument }, +#ifdef MOZ_SVG + { "SVG document", + NS_SVGDOCUMENT_CID, + nsnull, + CreateSVGDocument }, +#endif + { "Image document", NS_IMAGEDOCUMENT_CID, nsnull, @@ -601,6 +630,13 @@ static nsModuleComponentInfo gComponents[] = { NS_DOC_ENCODER_CONTRACTID_BASE "application/xhtml+xml", CreateTextEncoder }, +#ifdef MOZ_SVG + { "SVG document encoder", + NS_TEXT_ENCODER_CID, + NS_DOC_ENCODER_CONTRACTID_BASE "image/svg+xml", + CreateTextEncoder }, +#endif + { "HTML document encoder", NS_TEXT_ENCODER_CID, NS_DOC_ENCODER_CONTRACTID_BASE "text/html", @@ -631,6 +667,13 @@ static nsModuleComponentInfo gComponents[] = { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml", CreateXMLContentSerializer }, +#ifdef MOZ_SVG + { "SVG content serializer", + NS_XMLCONTENTSERIALIZER_CID, + NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml", + CreateXMLContentSerializer }, +#endif + { "HTML content serializer", NS_HTMLCONTENTSERIALIZER_CID, NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html", @@ -728,6 +771,18 @@ static nsModuleComponentInfo gComponents[] = { CreateXULElementFactory }, #endif +#ifdef MOZ_SVG + { "SVG element factory (deprecated namespace)", + NS_SVGELEMENTFACTORY_CID, + NS_SVG_DEPRECATED_ELEMENT_FACTORY_CONTRACTID, + CreateSVGElementFactory }, + + { "SVG element factory", + NS_SVGELEMENTFACTORY_CID, + NS_SVG_ELEMENT_FACTORY_CONTRACTID, + CreateSVGElementFactory }, +#endif + { "Controller Command Manager", NS_CONTROLLERCOMMANDMANAGER_CID, "@mozilla.org/content/controller-command-manager;1", diff --git a/content/html/style/src/nsCSSDeclaration.cpp b/content/html/style/src/nsCSSDeclaration.cpp index b94ff1bff5f2..5cea645e1016 100644 --- a/content/html/style/src/nsCSSDeclaration.cpp +++ b/content/html/style/src/nsCSSDeclaration.cpp @@ -70,6 +70,10 @@ static NS_DEFINE_IID(kCSSAuralSID, NS_CSS_AURAL_SID); static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID); #endif +#ifdef MOZ_SVG +static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID); +#endif + #define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; } nsCSSStruct::~nsCSSStruct() @@ -1075,6 +1079,62 @@ void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const #endif // INCLUDE_XUL +#ifdef MOZ_SVG +// --- nsCSSSVG ----------------- + +nsCSSSVG::nsCSSSVG(void) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::nsCSSSVG(const nsCSSSVG& aCopy) + : mFill(aCopy.mFill), + mFillOpacity(aCopy.mFillOpacity), + mFillRule(aCopy.mFillRule), + mStroke(aCopy.mStroke), + mStrokeDasharray(aCopy.mStrokeDasharray), + mStrokeDashoffset(aCopy.mStrokeDashoffset), + mStrokeLinecap(aCopy.mStrokeLinecap), + mStrokeLinejoin(aCopy.mStrokeLinejoin), + mStrokeMiterlimit(aCopy.mStrokeMiterlimit), + mStrokeOpacity(aCopy.mStrokeOpacity), + mStrokeWidth(aCopy.mStrokeWidth) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::~nsCSSSVG(void) +{ + MOZ_COUNT_DTOR(nsCSSSVG); +} + +const nsID& nsCSSSVG::GetID(void) +{ + return kCSSSVGSID; +} + +void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const +{ + for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out); + + nsAutoString buffer; + + mFill.AppendToString(buffer, eCSSProperty_fill); + mFillOpacity.AppendToString(buffer, eCSSProperty_fill_opacity); + mFillRule.AppendToString(buffer, eCSSProperty_fill_rule); + mStroke.AppendToString(buffer, eCSSProperty_stroke); + mStrokeDasharray.AppendToString(buffer, eCSSProperty_stroke_dasharray); + mStrokeDashoffset.AppendToString(buffer, eCSSProperty_stroke_dashoffset); + mStrokeLinecap.AppendToString(buffer, eCSSProperty_stroke_linecap); + mStrokeLinejoin.AppendToString(buffer, eCSSProperty_stroke_linejoin); + mStrokeMiterlimit.AppendToString(buffer, eCSSProperty_stroke_miterlimit); + mStrokeOpacity.AppendToString(buffer, eCSSProperty_stroke_opacity); + mStrokeWidth.AppendToString(buffer, eCSSProperty_stroke_width); + fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); +} + +#endif // MOZ_SVG + // --- nsCSSDeclaration ----------------- @@ -1185,6 +1245,10 @@ protected: nsCSSXUL* mXUL; #endif +#ifdef MOZ_SVG + nsCSSSVG* mSVG; +#endif + CSSDeclarationImpl* mImportant; nsVoidArray* mOrder; @@ -1230,6 +1294,10 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) DECL_IF_COPY(XUL); #endif +#ifdef MOZ_SVG + DECL_IF_COPY(SVG); +#endif + #ifdef DEBUG_REFS ++gInstanceCount; fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); @@ -1275,6 +1343,10 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) CSS_IF_DELETE(mXUL); #endif +#ifdef MOZ_SVG + CSS_IF_DELETE(mSVG); +#endif + NS_IF_RELEASE(mImportant); CSS_IF_DELETE(mOrder); CSS_IF_DELETE(mComments); @@ -1312,6 +1384,9 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr) CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) #ifdef INCLUDE_XUL CSS_IF_GET_ELSE(aSID, XUL, aDataPtr) +#endif +#ifdef MOZ_SVG + CSS_IF_GET_ELSE(aSID, SVG, aDataPtr) #endif { return NS_NOINTERFACE; @@ -1884,7 +1959,40 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_ENSURE(SVG) { + switch (aProperty) { + case eCSSProperty_fill: mSVG->mFill = aValue; break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity = aValue; break; + case eCSSProperty_fill_rule: mSVG->mFillRule = aValue; break; + case eCSSProperty_stroke: mSVG->mStroke = aValue; break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray = aValue; break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset = aValue; break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap = aValue; break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin = aValue; break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit = aValue; break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity = aValue; break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + break; +#endif + + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -2747,7 +2855,41 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + CSS_ENSURE_IMPORTANT(SVG) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty_fill, mSVG->mFill); + CSS_CASE_IMPORTANT(eCSSProperty_fill_opacity, mSVG->mFillOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_fill_rule, mSVG->mFillRule); + CSS_CASE_IMPORTANT(eCSSProperty_stroke, mSVG->mStroke); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dasharray, mSVG->mStrokeDasharray); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dashoffset, mSVG->mStrokeDashoffset); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linecap, mSVG->mStrokeLinecap); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linejoin, mSVG->mStrokeLinejoin); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_miterlimit, mSVG->mStrokeMiterlimit); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_opacity, mSVG->mStrokeOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_width, mSVG->mStrokeWidth); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -3483,6 +3625,39 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty) break; #endif +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_CHECK(SVG) { + switch(aProperty) { + case eCSSProperty_fill: mSVG->mFill.Reset(); break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity.Reset(); break; + case eCSSProperty_fill_rule: mSVG->mFillRule.Reset(); break; + case eCSSProperty_stroke: mSVG->mStroke.Reset(); break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray.Reset(); break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset.Reset(); break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap.Reset(); break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin.Reset(); break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit.Reset(); break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity.Reset(); break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth.Reset(); break; + CSS_BOGUS_DEFAULT; // Make compiler happy + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: @@ -4258,7 +4433,42 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + switch (aProperty) { + case eCSSProperty_fill: aValue = mSVG->mFill; break; + case eCSSProperty_fill_opacity: aValue = mSVG->mFillOpacity; break; + case eCSSProperty_fill_rule: aValue = mSVG->mFillRule; break; + case eCSSProperty_stroke: aValue = mSVG->mStroke; break; + case eCSSProperty_stroke_dasharray: aValue = mSVG->mStrokeDasharray; break; + case eCSSProperty_stroke_dashoffset: aValue = mSVG->mStrokeDashoffset; break; + case eCSSProperty_stroke_linecap: aValue = mSVG->mStrokeLinecap; break; + case eCSSProperty_stroke_linejoin: aValue = mSVG->mStrokeLinejoin; break; + case eCSSProperty_stroke_miterlimit: aValue = mSVG->mStrokeMiterlimit; break; + case eCSSProperty_stroke_opacity: aValue = mSVG->mStrokeOpacity; break; + case eCSSProperty_stroke_width: aValue = mSVG->mStrokeWidth; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -5438,6 +5648,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz if(mXUL && uniqueItems->AddItem(mXUL)){ aSize += sizeof(*mXUL); } +#endif +#ifdef MOZ_SVG + if(mSVG && uniqueItems->AddItem(mSVG)){ + aSize += sizeof(*mSVG); + } #endif if(mAural && uniqueItems->AddItem(mAural)){ aSize += sizeof(*mAural); diff --git a/content/html/style/src/nsCSSParser.cpp b/content/html/style/src/nsCSSParser.cpp index 1f3d104a983b..36b7a314d3c6 100644 --- a/content/html/style/src/nsCSSParser.cpp +++ b/content/html/style/src/nsCSSParser.cpp @@ -3672,6 +3672,41 @@ PRBool CSSParserImpl::ParseSingleValueProperty(PRInt32& aErrorCode, nsCSSProps::kBoxPackKTable); case eCSSProperty_box_ordinal_group: return ParseVariant(aErrorCode, aValue, VARIANT_INTEGER, nsnull); +#endif +#ifdef MOZ_SVG + case eCSSProperty_fill: + return ParseVariant(aErrorCode, aValue, VARIANT_HC | VARIANT_NONE, + nsnull); + case eCSSProperty_fill_opacity: + return ParseVariant(aErrorCode, aValue, VARIANT_HN, + nsnull); + case eCSSProperty_fill_rule: + return ParseVariant(aErrorCode, aValue, VARIANT_HK, + nsCSSProps::kFillRuleKTable); + case eCSSProperty_stroke: + return ParseVariant(aErrorCode, aValue, VARIANT_HC | VARIANT_NONE, + nsnull); + case eCSSProperty_stroke_dasharray: + return ParseVariant(aErrorCode, aValue, VARIANT_HOS, + nsnull); // XXX parse into new CSS value type, not string + case eCSSProperty_stroke_dashoffset: + return ParseVariant(aErrorCode, aValue, VARIANT_HLPN, + nsnull); + case eCSSProperty_stroke_linecap: + return ParseVariant(aErrorCode, aValue, VARIANT_HK, + nsCSSProps::kStrokeLinecapKTable); + case eCSSProperty_stroke_linejoin: + return ParseVariant(aErrorCode, aValue, VARIANT_HK, + nsCSSProps::kStrokeLinejoinKTable); + case eCSSProperty_stroke_miterlimit: + return ParsePositiveVariant(aErrorCode, aValue, VARIANT_HN, + nsnull); // XXX value > 1 + case eCSSProperty_stroke_opacity: + return ParseVariant(aErrorCode, aValue, VARIANT_HN, + nsnull); + case eCSSProperty_stroke_width: + return ParsePositiveVariant(aErrorCode, aValue, VARIANT_HLPN, + nsnull); #endif case eCSSProperty_box_sizing: return ParseVariant(aErrorCode, aValue, VARIANT_HK, diff --git a/content/html/style/src/nsCSSStruct.cpp b/content/html/style/src/nsCSSStruct.cpp index b94ff1bff5f2..5cea645e1016 100644 --- a/content/html/style/src/nsCSSStruct.cpp +++ b/content/html/style/src/nsCSSStruct.cpp @@ -70,6 +70,10 @@ static NS_DEFINE_IID(kCSSAuralSID, NS_CSS_AURAL_SID); static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID); #endif +#ifdef MOZ_SVG +static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID); +#endif + #define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; } nsCSSStruct::~nsCSSStruct() @@ -1075,6 +1079,62 @@ void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const #endif // INCLUDE_XUL +#ifdef MOZ_SVG +// --- nsCSSSVG ----------------- + +nsCSSSVG::nsCSSSVG(void) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::nsCSSSVG(const nsCSSSVG& aCopy) + : mFill(aCopy.mFill), + mFillOpacity(aCopy.mFillOpacity), + mFillRule(aCopy.mFillRule), + mStroke(aCopy.mStroke), + mStrokeDasharray(aCopy.mStrokeDasharray), + mStrokeDashoffset(aCopy.mStrokeDashoffset), + mStrokeLinecap(aCopy.mStrokeLinecap), + mStrokeLinejoin(aCopy.mStrokeLinejoin), + mStrokeMiterlimit(aCopy.mStrokeMiterlimit), + mStrokeOpacity(aCopy.mStrokeOpacity), + mStrokeWidth(aCopy.mStrokeWidth) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::~nsCSSSVG(void) +{ + MOZ_COUNT_DTOR(nsCSSSVG); +} + +const nsID& nsCSSSVG::GetID(void) +{ + return kCSSSVGSID; +} + +void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const +{ + for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out); + + nsAutoString buffer; + + mFill.AppendToString(buffer, eCSSProperty_fill); + mFillOpacity.AppendToString(buffer, eCSSProperty_fill_opacity); + mFillRule.AppendToString(buffer, eCSSProperty_fill_rule); + mStroke.AppendToString(buffer, eCSSProperty_stroke); + mStrokeDasharray.AppendToString(buffer, eCSSProperty_stroke_dasharray); + mStrokeDashoffset.AppendToString(buffer, eCSSProperty_stroke_dashoffset); + mStrokeLinecap.AppendToString(buffer, eCSSProperty_stroke_linecap); + mStrokeLinejoin.AppendToString(buffer, eCSSProperty_stroke_linejoin); + mStrokeMiterlimit.AppendToString(buffer, eCSSProperty_stroke_miterlimit); + mStrokeOpacity.AppendToString(buffer, eCSSProperty_stroke_opacity); + mStrokeWidth.AppendToString(buffer, eCSSProperty_stroke_width); + fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); +} + +#endif // MOZ_SVG + // --- nsCSSDeclaration ----------------- @@ -1185,6 +1245,10 @@ protected: nsCSSXUL* mXUL; #endif +#ifdef MOZ_SVG + nsCSSSVG* mSVG; +#endif + CSSDeclarationImpl* mImportant; nsVoidArray* mOrder; @@ -1230,6 +1294,10 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) DECL_IF_COPY(XUL); #endif +#ifdef MOZ_SVG + DECL_IF_COPY(SVG); +#endif + #ifdef DEBUG_REFS ++gInstanceCount; fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); @@ -1275,6 +1343,10 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) CSS_IF_DELETE(mXUL); #endif +#ifdef MOZ_SVG + CSS_IF_DELETE(mSVG); +#endif + NS_IF_RELEASE(mImportant); CSS_IF_DELETE(mOrder); CSS_IF_DELETE(mComments); @@ -1312,6 +1384,9 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr) CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) #ifdef INCLUDE_XUL CSS_IF_GET_ELSE(aSID, XUL, aDataPtr) +#endif +#ifdef MOZ_SVG + CSS_IF_GET_ELSE(aSID, SVG, aDataPtr) #endif { return NS_NOINTERFACE; @@ -1884,7 +1959,40 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_ENSURE(SVG) { + switch (aProperty) { + case eCSSProperty_fill: mSVG->mFill = aValue; break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity = aValue; break; + case eCSSProperty_fill_rule: mSVG->mFillRule = aValue; break; + case eCSSProperty_stroke: mSVG->mStroke = aValue; break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray = aValue; break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset = aValue; break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap = aValue; break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin = aValue; break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit = aValue; break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity = aValue; break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + break; +#endif + + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -2747,7 +2855,41 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + CSS_ENSURE_IMPORTANT(SVG) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty_fill, mSVG->mFill); + CSS_CASE_IMPORTANT(eCSSProperty_fill_opacity, mSVG->mFillOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_fill_rule, mSVG->mFillRule); + CSS_CASE_IMPORTANT(eCSSProperty_stroke, mSVG->mStroke); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dasharray, mSVG->mStrokeDasharray); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dashoffset, mSVG->mStrokeDashoffset); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linecap, mSVG->mStrokeLinecap); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linejoin, mSVG->mStrokeLinejoin); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_miterlimit, mSVG->mStrokeMiterlimit); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_opacity, mSVG->mStrokeOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_width, mSVG->mStrokeWidth); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -3483,6 +3625,39 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty) break; #endif +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_CHECK(SVG) { + switch(aProperty) { + case eCSSProperty_fill: mSVG->mFill.Reset(); break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity.Reset(); break; + case eCSSProperty_fill_rule: mSVG->mFillRule.Reset(); break; + case eCSSProperty_stroke: mSVG->mStroke.Reset(); break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray.Reset(); break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset.Reset(); break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap.Reset(); break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin.Reset(); break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit.Reset(); break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity.Reset(); break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth.Reset(); break; + CSS_BOGUS_DEFAULT; // Make compiler happy + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: @@ -4258,7 +4433,42 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + switch (aProperty) { + case eCSSProperty_fill: aValue = mSVG->mFill; break; + case eCSSProperty_fill_opacity: aValue = mSVG->mFillOpacity; break; + case eCSSProperty_fill_rule: aValue = mSVG->mFillRule; break; + case eCSSProperty_stroke: aValue = mSVG->mStroke; break; + case eCSSProperty_stroke_dasharray: aValue = mSVG->mStrokeDasharray; break; + case eCSSProperty_stroke_dashoffset: aValue = mSVG->mStrokeDashoffset; break; + case eCSSProperty_stroke_linecap: aValue = mSVG->mStrokeLinecap; break; + case eCSSProperty_stroke_linejoin: aValue = mSVG->mStrokeLinejoin; break; + case eCSSProperty_stroke_miterlimit: aValue = mSVG->mStrokeMiterlimit; break; + case eCSSProperty_stroke_opacity: aValue = mSVG->mStrokeOpacity; break; + case eCSSProperty_stroke_width: aValue = mSVG->mStrokeWidth; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -5438,6 +5648,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz if(mXUL && uniqueItems->AddItem(mXUL)){ aSize += sizeof(*mXUL); } +#endif +#ifdef MOZ_SVG + if(mSVG && uniqueItems->AddItem(mSVG)){ + aSize += sizeof(*mSVG); + } #endif if(mAural && uniqueItems->AddItem(mAural)){ aSize += sizeof(*mAural); diff --git a/content/html/style/src/nsCSSStyleRule.cpp b/content/html/style/src/nsCSSStyleRule.cpp index 91c41871f600..15ad7073de48 100644 --- a/content/html/style/src/nsCSSStyleRule.cpp +++ b/content/html/style/src/nsCSSStyleRule.cpp @@ -95,6 +95,9 @@ static NS_DEFINE_IID(kCSSPageSID, NS_CSS_PAGE_SID); #ifdef INCLUDE_XUL static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID); #endif +#ifdef MOZ_SVG +static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID); +#endif // -- nsCSSSelector ------------------------------- @@ -875,6 +878,10 @@ static nsresult MapUIForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStruc static nsresult MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL); #endif +#ifdef MOZ_SVG +static nsresult MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG); +#endif + class CSSStyleRuleImpl; class CSSImportantRule : public nsIStyleRule { @@ -986,6 +993,10 @@ CSSImportantRule::MapRuleInfoInto(nsRuleData* aRuleData) else if (aRuleData->mXULData) return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData); #endif +#ifdef MOZ_SVG + else if (aRuleData->mSVGData) + return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData); +#endif return NS_OK; } @@ -1722,6 +1733,10 @@ CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData) else if (aRuleData->mXULData) return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData); #endif +#ifdef MOZ_SVG + else if (aRuleData->mSVGData) + return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData); +#endif return NS_OK; } @@ -1798,6 +1813,57 @@ MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL) } #endif +#ifdef MOZ_SVG +static nsresult +MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG) +{ + if (!aDecl) + return NS_OK; // The rule must have a declaration. + + nsCSSSVG* ourSVG; + aDecl->GetData(kCSSSVGSID, (nsCSSStruct**)&ourSVG); + if (!ourSVG) + return NS_OK; // We don't have any rules for SVG. + + // fill: + if (aSVG.mFill.GetUnit() == eCSSUnit_Null && ourSVG->mFill.GetUnit() != eCSSUnit_Null) + aSVG.mFill = ourSVG->mFill; + // fill-opacity: + if (aSVG.mFillOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mFillOpacity.GetUnit() != eCSSUnit_Null) + aSVG.mFillOpacity = ourSVG->mFillOpacity; + // fill-rule: + if (aSVG.mFillRule.GetUnit() == eCSSUnit_Null && ourSVG->mFillRule.GetUnit() != eCSSUnit_Null) + aSVG.mFillRule = ourSVG->mFillRule; + // stroke: + if (aSVG.mStroke.GetUnit() == eCSSUnit_Null && ourSVG->mStroke.GetUnit() != eCSSUnit_Null) + aSVG.mStroke = ourSVG->mStroke; + // stroke-dasharray: + if (aSVG.mStrokeDasharray.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDasharray.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeDasharray = ourSVG->mStrokeDasharray; + // stroke-dashoffset: + if (aSVG.mStrokeDashoffset.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDashoffset.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeDashoffset = ourSVG->mStrokeDashoffset; + // stroke-linecap: enum, inherit + if (aSVG.mStrokeLinecap.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinecap.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeLinecap = ourSVG->mStrokeLinecap; + // stroke-linejoin + if (aSVG.mStrokeLinejoin.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinejoin.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeLinejoin = ourSVG->mStrokeLinejoin; + // stroke-miterlimit: + if (aSVG.mStrokeMiterlimit.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeMiterlimit.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeMiterlimit = ourSVG->mStrokeMiterlimit; + // stroke-opacity: + if (aSVG.mStrokeOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeOpacity.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeOpacity = ourSVG->mStrokeOpacity; + // stroke-width: + if (aSVG.mStrokeWidth.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeWidth.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeWidth = ourSVG->mStrokeWidth; + + return NS_OK; +} +#endif + + static nsresult MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition) { diff --git a/content/html/style/src/nsICSSDeclaration.h b/content/html/style/src/nsICSSDeclaration.h index 6719b1e688c0..fe32585884fd 100644 --- a/content/html/style/src/nsICSSDeclaration.h +++ b/content/html/style/src/nsICSSDeclaration.h @@ -112,6 +112,12 @@ struct nsCSSStruct { { 0xfc075d62, 0xb1cf, 0x47a1, { 0xaf, 0x4e, 0xcb, 0x40, 0xe1, 0x1a, 0x43, 0x14 } } #endif +#ifdef MOZ_SVG +// {9A41A036-027B-45ef-89C9-6E32797839E7} +#define NS_CSS_SVG_SID \ +{ 0x9a41a036, 0x27b, 0x45ef, { 0x89, 0xc9, 0x6e, 0x32, 0x79, 0x78, 0x39, 0xe7 } } +#endif + // IID for the nsICSSDeclaration interface {7b36b9ac-b48d-11d1-9ca5-0060088f9ff7} #define NS_ICSS_DECLARATION_IID \ {0x7b36b9ac, 0xb48d, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}} @@ -436,6 +442,29 @@ struct nsCSSXUL : public nsCSSStruct { }; #endif +#ifdef MOZ_SVG +struct nsCSSSVG : public nsCSSStruct { + nsCSSSVG(void); + nsCSSSVG(const nsCSSSVG& aCopy); + virtual ~nsCSSSVG(void); + + const nsID& GetID(void); + void List(FILE* out = stdout, PRInt32 aIndent = 0) const; + + nsCSSValue mFill; + nsCSSValue mFillOpacity; + nsCSSValue mFillRule; + nsCSSValue mStroke; + nsCSSValue mStrokeDasharray; + nsCSSValue mStrokeDashoffset; + nsCSSValue mStrokeLinecap; + nsCSSValue mStrokeLinejoin; + nsCSSValue mStrokeMiterlimit; + nsCSSValue mStrokeOpacity; + nsCSSValue mStrokeWidth; +}; +#endif + class nsICSSDeclaration : public nsISupports { public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSS_DECLARATION_IID); diff --git a/content/html/style/src/nsStyleUtil.cpp b/content/html/style/src/nsStyleUtil.cpp index fb0ca01200fd..4cc8c4da8160 100644 --- a/content/html/style/src/nsStyleUtil.cpp +++ b/content/html/style/src/nsStyleUtil.cpp @@ -169,6 +169,14 @@ nsCachedStyleData::gInfo[] = { }, #endif +#ifdef MOZ_SVG + /* eStyleStruct_SVG */ + { offsetof(nsCachedStyleData, mInheritedData), + offsetof(nsInheritedStyleData, mSVGData), + PR_FALSE + }, +#endif + { 0, 0, 0 } }; diff --git a/content/macbuild/content.xml b/content/macbuild/content.xml index c3f993fd999b..e2f799e7b15d 100644 --- a/content/macbuild/content.xml +++ b/content/macbuild/content.xml @@ -2366,6 +2366,13 @@ Text Debug + + Name + contentSVG.o + MacOS + Library + Debug + @@ -3408,6 +3415,11 @@ nsXBLProtoImplProperty.cpp MacOS + + Name + contentSVG.o + MacOS + @@ -5723,6 +5735,13 @@ Text Debug + + Name + contentSVGDebug.o + MacOS + Library + Debug + @@ -6765,6 +6784,11 @@ nsXBLProtoImplProperty.cpp MacOS + + Name + contentSVGDebug.o + MacOS + @@ -7985,8 +8009,20 @@ Options Debug + + contentDebug.shlb + Name + contentSVGDebug.o + MacOS + Optimized + + content.shlb + Name + contentSVG.o + MacOS + Static Libs diff --git a/content/macbuild/contentSVG.xml b/content/macbuild/contentSVG.xml new file mode 100644 index 000000000000..f3ec1bad3bc1 --- /dev/null +++ b/content/macbuild/contentSVG.xml @@ -0,0 +1,4402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + contentSVGDebug.o + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::dist: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path:MacOS Support: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:MSL: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + LinkerMacOS PPC Linker + PreLinker + PostLinker + TargetnamecontentSVGDebug.o + OutputDirectory + Path: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeAPPL + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeAppl + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeMMLB + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMPLF + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMWCD + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeRSRC + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cc + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cpp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.exp + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.h + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.pch + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.pch++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.s + CompilerPPCAsm + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeXCOF + FileExtension + CompilerXCOFF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypedocu + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypersrc + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeshlb + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypestub + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.doc + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFilefalse + IgnoredByMaketrue + + + + + CacheModDatesfalse + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos1 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixnamecontentSharedPrefix_debug.h + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI0 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse0 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma1 + MWWarning_C_warn_emptydecl1 + MWWarning_C_warn_possunwant1 + MWWarning_C_warn_unusedvar1 + MWWarning_C_warn_unusedarg1 + MWWarning_C_warn_extracomma1 + MWWarning_C_pedantic1 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual1 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion0 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut10 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1463898714 + MWJava_Proj_HTMLAppName + MWJava_Proj_PathVersion0 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32Name + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentPPC + MWCodeGen_PPC_tracebacktablesInline + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings1 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix1 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsPragma + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentnameSVG_O + MWPEF_collapsereloads0 + + + MWProject_PPC_typeLibrary + MWProject_PPC_outfilecontentSVGDebug.o + MWProject_PPC_filecreator???? + MWProject_PPC_filetype???? + MWProject_PPC_size0 + MWProject_PPC_minsize0 + MWProject_PPC_stacksize0 + MWProject_PPC_flags0 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosefalse + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 0001000101000000000000000000000000000000000000000000000000000000 + 0000000000000000 + + + + + Name + nsSVGAnimatedLength.cpp + MacOS + Text + + + + Name + nsSVGAnimatedTransformList.cpp + MacOS + Text + + + + Name + nsSVGAttributes.cpp + MacOS + Text + + + + Name + nsSVGCircleElement.cpp + MacOS + Text + + + + Name + nsSVGElement.cpp + MacOS + Text + + + + Name + nsSVGElementFactory.cpp + MacOS + Text + + + + Name + nsSVGForeignObjectElement.cpp + MacOS + Text + + + + Name + nsSVGGElement.cpp + MacOS + Text + + + + Name + nsSVGGenericStringValue.cpp + MacOS + Text + + + + Name + nsSVGGraphicElement.cpp + MacOS + Text + + + + Name + nsSVGLength.cpp + MacOS + Text + + + + Name + nsSVGPathDataParser.cpp + MacOS + Text + + + + Name + nsSVGPathElement.cpp + MacOS + Text + + + + Name + nsSVGPathSeg.cpp + MacOS + Text + + + + Name + nsSVGPathSegList.cpp + MacOS + Text + + + + Name + nsSVGPoint.cpp + MacOS + Text + + + + Name + nsSVGPointList.cpp + MacOS + Text + + + + Name + nsSVGPolygonElement.cpp + MacOS + Text + + + + Name + nsSVGPolylineElement.cpp + MacOS + Text + + + + Name + nsSVGRect.cpp + MacOS + Text + + + + Name + nsSVGStyleValue.cpp + MacOS + Text + + + + Name + nsSVGSVGElement.cpp + MacOS + Text + + + + Name + nsSVGTransform.cpp + MacOS + Text + + + + Name + nsSVGTransformList.cpp + MacOS + Text + + + + Name + nsSVGValue.cpp + MacOS + Text + + + + Name + nsSVGMatrix.cpp + MacOS + Text + + + + Name + nsSVGAnimatedRect.cpp + MacOS + Text + + + + Name + nsSVGDocument.cpp + MacOS + Text + + + + Name + nsSVGEllipseElement.cpp + MacOS + Text + + + + Name + nsSVGLineElement.cpp + MacOS + Text + + + + Name + nsSVGRectElement.cpp + MacOS + Text + + + + Name + nsSVGAtoms.cpp + MacOS + Text + + + + + + Name + nsSVGAnimatedLength.cpp + MacOS + + + Name + nsSVGAnimatedTransformList.cpp + MacOS + + + Name + nsSVGAttributes.cpp + MacOS + + + Name + nsSVGCircleElement.cpp + MacOS + + + Name + nsSVGElement.cpp + MacOS + + + Name + nsSVGElementFactory.cpp + MacOS + + + Name + nsSVGForeignObjectElement.cpp + MacOS + + + Name + nsSVGGElement.cpp + MacOS + + + Name + nsSVGGenericStringValue.cpp + MacOS + + + Name + nsSVGGraphicElement.cpp + MacOS + + + Name + nsSVGLength.cpp + MacOS + + + Name + nsSVGPathDataParser.cpp + MacOS + + + Name + nsSVGPathElement.cpp + MacOS + + + Name + nsSVGPathSeg.cpp + MacOS + + + Name + nsSVGPathSegList.cpp + MacOS + + + Name + nsSVGPoint.cpp + MacOS + + + Name + nsSVGPointList.cpp + MacOS + + + Name + nsSVGPolygonElement.cpp + MacOS + + + Name + nsSVGPolylineElement.cpp + MacOS + + + Name + nsSVGRect.cpp + MacOS + + + Name + nsSVGStyleValue.cpp + MacOS + + + Name + nsSVGSVGElement.cpp + MacOS + + + Name + nsSVGTransform.cpp + MacOS + + + Name + nsSVGTransformList.cpp + MacOS + + + Name + nsSVGValue.cpp + MacOS + + + Name + nsSVGMatrix.cpp + MacOS + + + Name + nsSVGAnimatedRect.cpp + MacOS + + + Name + nsSVGDocument.cpp + MacOS + + + Name + nsSVGEllipseElement.cpp + MacOS + + + Name + nsSVGLineElement.cpp + MacOS + + + Name + nsSVGRectElement.cpp + MacOS + + + Name + nsSVGAtoms.cpp + MacOS + + + + + contentSVG.o + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::dist: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path:MacOS Support: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:MSL: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + LinkerMacOS PPC Linker + PreLinker + PostLinker + TargetnamecontentSVG.o + OutputDirectory + Path: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeAPPL + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeAppl + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeMMLB + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMPLF + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMWCD + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeRSRC + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cc + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cpp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.exp + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.h + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.pch + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.pch++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.s + CompilerPPCAsm + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeXCOF + FileExtension + CompilerXCOFF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypedocu + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypersrc + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeshlb + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypestub + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.doc + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFilefalse + IgnoredByMaketrue + + + + + CacheModDatesfalse + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos1 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixnamecontentSharedPrefix.h + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI0 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse0 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma1 + MWWarning_C_warn_emptydecl1 + MWWarning_C_warn_possunwant1 + MWWarning_C_warn_unusedvar1 + MWWarning_C_warn_unusedarg1 + MWWarning_C_warn_extracomma1 + MWWarning_C_pedantic1 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual1 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion0 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut10 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1463898714 + MWJava_Proj_HTMLAppName + MWJava_Proj_PathVersion0 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32Name + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentPPC + MWCodeGen_PPC_tracebacktablesNone + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings1 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix0 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsPragma + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentnameSVG_O + MWPEF_collapsereloads0 + + + MWProject_PPC_typeLibrary + MWProject_PPC_outfilecontentSVG.o + MWProject_PPC_filecreator???? + MWProject_PPC_filetype???? + MWProject_PPC_size0 + MWProject_PPC_minsize0 + MWProject_PPC_stacksize0 + MWProject_PPC_flags0 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosefalse + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 0001000101000000000000000000000000000000000000000000000000000000 + 0000000000000000 + + + + + Name + nsSVGAnimatedLength.cpp + MacOS + Text + + + + Name + nsSVGAnimatedTransformList.cpp + MacOS + Text + + + + Name + nsSVGAttributes.cpp + MacOS + Text + + + + Name + nsSVGCircleElement.cpp + MacOS + Text + + + + Name + nsSVGElement.cpp + MacOS + Text + + + + Name + nsSVGElementFactory.cpp + MacOS + Text + + + + Name + nsSVGForeignObjectElement.cpp + MacOS + Text + + + + Name + nsSVGGElement.cpp + MacOS + Text + + + + Name + nsSVGGenericStringValue.cpp + MacOS + Text + + + + Name + nsSVGGraphicElement.cpp + MacOS + Text + + + + Name + nsSVGLength.cpp + MacOS + Text + + + + Name + nsSVGPathDataParser.cpp + MacOS + Text + + + + Name + nsSVGPathElement.cpp + MacOS + Text + + + + Name + nsSVGPathSeg.cpp + MacOS + Text + + + + Name + nsSVGPathSegList.cpp + MacOS + Text + + + + Name + nsSVGPoint.cpp + MacOS + Text + + + + Name + nsSVGPointList.cpp + MacOS + Text + + + + Name + nsSVGPolygonElement.cpp + MacOS + Text + + + + Name + nsSVGPolylineElement.cpp + MacOS + Text + + + + Name + nsSVGRect.cpp + MacOS + Text + + + + Name + nsSVGStyleValue.cpp + MacOS + Text + + + + Name + nsSVGSVGElement.cpp + MacOS + Text + + + + Name + nsSVGTransform.cpp + MacOS + Text + + + + Name + nsSVGTransformList.cpp + MacOS + Text + + + + Name + nsSVGValue.cpp + MacOS + Text + + + + Name + nsSVGMatrix.cpp + MacOS + Text + + + + Name + nsSVGAnimatedRect.cpp + MacOS + Text + + + + Name + nsSVGDocument.cpp + MacOS + Text + + + + Name + nsSVGEllipseElement.cpp + MacOS + Text + + + + Name + nsSVGLineElement.cpp + MacOS + Text + + + + Name + nsSVGRectElement.cpp + MacOS + Text + + + + Name + nsSVGAtoms.cpp + MacOS + Text + + + + + + Name + nsSVGAnimatedLength.cpp + MacOS + + + Name + nsSVGAnimatedTransformList.cpp + MacOS + + + Name + nsSVGAttributes.cpp + MacOS + + + Name + nsSVGCircleElement.cpp + MacOS + + + Name + nsSVGElement.cpp + MacOS + + + Name + nsSVGElementFactory.cpp + MacOS + + + Name + nsSVGForeignObjectElement.cpp + MacOS + + + Name + nsSVGGElement.cpp + MacOS + + + Name + nsSVGGenericStringValue.cpp + MacOS + + + Name + nsSVGGraphicElement.cpp + MacOS + + + Name + nsSVGLength.cpp + MacOS + + + Name + nsSVGPathDataParser.cpp + MacOS + + + Name + nsSVGPathElement.cpp + MacOS + + + Name + nsSVGPathSeg.cpp + MacOS + + + Name + nsSVGPathSegList.cpp + MacOS + + + Name + nsSVGPoint.cpp + MacOS + + + Name + nsSVGPointList.cpp + MacOS + + + Name + nsSVGPolygonElement.cpp + MacOS + + + Name + nsSVGPolylineElement.cpp + MacOS + + + Name + nsSVGRect.cpp + MacOS + + + Name + nsSVGStyleValue.cpp + MacOS + + + Name + nsSVGSVGElement.cpp + MacOS + + + Name + nsSVGTransform.cpp + MacOS + + + Name + nsSVGTransformList.cpp + MacOS + + + Name + nsSVGValue.cpp + MacOS + + + Name + nsSVGMatrix.cpp + MacOS + + + Name + nsSVGAnimatedRect.cpp + MacOS + + + Name + nsSVGDocument.cpp + MacOS + + + Name + nsSVGEllipseElement.cpp + MacOS + + + Name + nsSVGLineElement.cpp + MacOS + + + Name + nsSVGRectElement.cpp + MacOS + + + Name + nsSVGAtoms.cpp + MacOS + + + + + contentSVGDebug.o stub + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::dist: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path:MacOS Support: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:MSL: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + LinkerMacOS PPC Linker + PreLinker + PostLinker + TargetnamecontentSVGDebug.o stub + OutputDirectory + Path: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeAPPL + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeAppl + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeMMLB + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMPLF + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMWCD + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeRSRC + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cc + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cpp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.exp + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.h + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.pch + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.pch++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.s + CompilerPPCAsm + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeXCOF + FileExtension + CompilerXCOFF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypedocu + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypersrc + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeshlb + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypestub + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.doc + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFilefalse + IgnoredByMaketrue + + + + + CacheModDatesfalse + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos1 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixnamecontentSharedPrefix_debug.h + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI0 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse0 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma1 + MWWarning_C_warn_emptydecl1 + MWWarning_C_warn_possunwant1 + MWWarning_C_warn_unusedvar1 + MWWarning_C_warn_unusedarg1 + MWWarning_C_warn_extracomma1 + MWWarning_C_pedantic1 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual1 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion0 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut10 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1463898714 + MWJava_Proj_HTMLAppName + MWJava_Proj_PathVersion0 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32Name + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentPPC + MWCodeGen_PPC_tracebacktablesInline + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings1 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix1 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsPragma + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentnameSVG_O + MWPEF_collapsereloads0 + + + MWProject_PPC_typeLibrary + MWProject_PPC_outfilecontentSVGDebug.o + MWProject_PPC_filecreator???? + MWProject_PPC_filetype???? + MWProject_PPC_size0 + MWProject_PPC_minsize0 + MWProject_PPC_stacksize0 + MWProject_PPC_flags0 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosefalse + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 0001000101000000000000000000000000000000000000000000000000000000 + 0000000000000000 + + + + + + + + + contentSVG.o stub + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::dist: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path:MacOS Support: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:MSL: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + LinkerMacOS PPC Linker + PreLinker + PostLinker + TargetnamecontentSVG.o stub + OutputDirectory + Path: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeAPPL + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeAppl + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeMMLB + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMPLF + FileExtension + CompilerLib Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeMWCD + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeRSRC + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cc + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.cpp + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.exp + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.h + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMaketrue + + + FileTypeTEXT + FileExtension.pch + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.pch++ + CompilerMW C/C++ PPC + EditLanguageC/C++ + Precompiletrue + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.s + CompilerPPCAsm + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeXCOF + FileExtension + CompilerXCOFF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypedocu + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypersrc + FileExtension + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeshlb + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypestub + FileExtension + CompilerPEF Import PPC + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileExtension.doc + Compiler + EditLanguage + Precompilefalse + Launchabletrue + ResourceFilefalse + IgnoredByMaketrue + + + + + CacheModDatesfalse + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos1 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixnamecontentSharedPrefix.h + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI0 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse0 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma1 + MWWarning_C_warn_emptydecl1 + MWWarning_C_warn_possunwant1 + MWWarning_C_warn_unusedvar1 + MWWarning_C_warn_unusedarg1 + MWWarning_C_warn_extracomma1 + MWWarning_C_pedantic1 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual1 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion0 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut10 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1463898714 + MWJava_Proj_HTMLAppName + MWJava_Proj_PathVersion0 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32Name + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentPPC + MWCodeGen_PPC_tracebacktablesNone + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings1 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix0 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsPragma + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentnameSVG_O + MWPEF_collapsereloads0 + + + MWProject_PPC_typeLibrary + MWProject_PPC_outfilecontentSVG.o + MWProject_PPC_filecreator???? + MWProject_PPC_filetype???? + MWProject_PPC_size0 + MWProject_PPC_minsize0 + MWProject_PPC_stacksize0 + MWProject_PPC_flags0 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosefalse + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 0001000101000000000000000000000000000000000000000000000000000000 + 0000000000000000 + + + + + + + + + + + contentSVGDebug.o stub + contentSVG.o stub + contentSVGDebug.o + contentSVG.o + + + + document + svg + + contentSVGDebug.o + Name + nsSVGDocument.cpp + MacOS + + + + content + svg + + contentSVGDebug.o + Name + nsSVGEllipseElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGAnimatedLength.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGAnimatedTransformList.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGAttributes.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGCircleElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGElementFactory.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGForeignObjectElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGGElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGGenericStringValue.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGGraphicElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGLength.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPathDataParser.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPathElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPathSeg.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPathSegList.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPoint.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPointList.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPolygonElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGPolylineElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGRect.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGStyleValue.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGSVGElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGTransform.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGTransformList.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGValue.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGMatrix.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGAnimatedRect.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGRectElement.cpp + MacOS + + + contentSVGDebug.o + Name + nsSVGLineElement.cpp + MacOS + + + shared + + contentSVGDebug.o + Name + nsSVGAtoms.cpp + MacOS + + + + + + diff --git a/content/makefile.win b/content/makefile.win index dea804aeac5b..e618f66f4453 100644 --- a/content/makefile.win +++ b/content/makefile.win @@ -27,6 +27,9 @@ DIRS= \ xml \ xsl \ xbl \ +!ifdef MOZ_SVG + svg \ +!endif events \ xul \ shared \ diff --git a/content/shared/public/MANIFEST b/content/shared/public/MANIFEST index f94480fff62a..c6a698d80ff8 100644 --- a/content/shared/public/MANIFEST +++ b/content/shared/public/MANIFEST @@ -22,6 +22,8 @@ nsStyleStruct.h nsTextFragment.h nsXULAtomList.h nsXULAtoms.h +nsSVGAtoms.h +nsSVGAtomList.h nsXBLAtomList.h nsXBLAtoms.h diff --git a/content/shared/public/Makefile.in b/content/shared/public/Makefile.in index 781b7feaf4b1..0ddebd849b24 100644 --- a/content/shared/public/Makefile.in +++ b/content/shared/public/Makefile.in @@ -54,6 +54,10 @@ nsXBLAtomList.h \ nsXBLAtoms.h \ $(NULL) +ifdef MOZ_SVG +EXPORTS += nsSVGAtomList.h nsSVGAtoms.h +endif + EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) include $(topsrcdir)/config/rules.mk diff --git a/content/shared/public/makefile.win b/content/shared/public/makefile.win index b518d1937768..81b571ce9f08 100644 --- a/content/shared/public/makefile.win +++ b/content/shared/public/makefile.win @@ -43,6 +43,10 @@ EXPORTS = \ nsTextFragment.h \ nsXULAtomList.h \ nsXULAtoms.h \ +!ifdef MOZ_SVG + nsSVGAtomList.h \ + nsSVGAtoms.h \ +!endif nsXBLAtomList.h \ nsXBLAtoms.h \ $(NULL) diff --git a/content/shared/public/nsCSSKeywordList.h b/content/shared/public/nsCSSKeywordList.h index 91008cf4dff6..f9950dd32ab0 100644 --- a/content/shared/public/nsCSSKeywordList.h +++ b/content/shared/public/nsCSSKeywordList.h @@ -408,3 +408,12 @@ CSS_KEY(x-small, x_small) CSS_KEY(x-soft, x_soft) CSS_KEY(xx-large, xx_large) CSS_KEY(xx-small, xx_small) +#ifdef MOZ_SVG +CSS_KEY(bevel, bevel) +CSS_KEY(butt, butt) +CSS_KEY(evenodd, evenodd) +CSS_KEY(miter, miter) +CSS_KEY(nonzero, nonzero) +CSS_KEY(round, round) +//CSS_KEY(square, square) +#endif diff --git a/content/shared/public/nsCSSPropList.h b/content/shared/public/nsCSSPropList.h index 96f2860ef57f..d990fb8cc2d1 100644 --- a/content/shared/public/nsCSSPropList.h +++ b/content/shared/public/nsCSSPropList.h @@ -251,3 +251,17 @@ CSS_PROP(widows, widows, REFLOW) CSS_PROP(width, width, REFLOW) CSS_PROP(word-spacing, word_spacing, REFLOW) CSS_PROP(z-index, z_index, REFLOW) +#ifdef MOZ_SVG +CSS_PROP(fill, fill, VISUAL) +CSS_PROP(fill-opacity, fill_opacity, VISUAL) +CSS_PROP(fill-rule, fill_rule, VISUAL) +CSS_PROP(stroke, stroke, VISUAL) +CSS_PROP(stroke-dasharray, stroke_dasharray, VISUAL) +CSS_PROP(stroke-dashoffset, stroke_dashoffset, VISUAL) +CSS_PROP(stroke-linecap, stroke_linecap, VISUAL) +CSS_PROP(stroke-linejoin, stroke_linejoin, VISUAL) +CSS_PROP(stroke-miterlimit, stroke_miterlimit, VISUAL) +CSS_PROP(stroke-opacity, stroke_opacity, VISUAL) +CSS_PROP(stroke-width, stroke_width, VISUAL) +#endif + diff --git a/content/shared/public/nsCSSProps.h b/content/shared/public/nsCSSProps.h index cf430114901d..4990c767a190 100644 --- a/content/shared/public/nsCSSProps.h +++ b/content/shared/public/nsCSSProps.h @@ -96,6 +96,11 @@ public: static const PRInt32 kBoxDirectionKTable[]; static const PRInt32 kBoxOrientKTable[]; static const PRInt32 kBoxPackKTable[]; +#endif +#ifdef MOZ_SVG + static const PRInt32 kFillRuleKTable[]; + static const PRInt32 kStrokeLinecapKTable[]; + static const PRInt32 kStrokeLinejoinKTable[]; #endif static const PRInt32 kBoxSizingKTable[]; static const PRInt32 kCaptionSideKTable[]; diff --git a/content/shared/public/nsRuleNode.h b/content/shared/public/nsRuleNode.h index 4b4d19b6678e..7ea7f98fe94c 100644 --- a/content/shared/public/nsRuleNode.h +++ b/content/shared/public/nsRuleNode.h @@ -64,6 +64,9 @@ struct nsInheritedStyleData nsStyleQuotes* mQuotesData; nsStyleText* mTextData; nsStyleUserInterface* mUIData; +#ifdef MOZ_SVG + nsStyleSVG* mSVGData; +#endif void* operator new(size_t sz, nsIPresContext* aContext) { void* result = nsnull; @@ -88,6 +91,10 @@ struct nsInheritedStyleData mTextData = nsnull; if (mUIData && (aBits & NS_STYLE_INHERIT_UI)) mUIData = nsnull; +#ifdef MOZ_SVG + if (mSVGData && (aBits & NS_STYLE_INHERIT_SVG)) + mSVGData = nsnull; +#endif }; void Destroy(PRUint32 aBits, nsIPresContext* aContext) { @@ -107,12 +114,19 @@ struct nsInheritedStyleData mTextData->Destroy(aContext); if (mUIData && !(aBits & NS_STYLE_INHERIT_UI)) mUIData->Destroy(aContext); +#ifdef MOZ_SVG + if (mSVGData && !(aBits & NS_STYLE_INHERIT_SVG)) + mSVGData->Destroy(aContext); +#endif aContext->FreeToShell(sizeof(nsInheritedStyleData), this); }; nsInheritedStyleData() :mVisibilityData(nsnull), mFontData(nsnull), mListData(nsnull), mTableData(nsnull), mColorData(nsnull), mQuotesData(nsnull), mTextData(nsnull), mUIData(nsnull) +#ifdef MOZ_SVG + , mSVGData(nsnull) +#endif {}; }; @@ -284,6 +298,10 @@ struct nsRuleData nsCSSXUL* mXULData; #endif +#ifdef MOZ_SVG + nsCSSSVG* mSVGData; +#endif + nsRuleData(const nsStyleStructID& aSID, nsIPresContext* aContext, nsIStyleContext* aStyleContext) :mSID(aSID), mPresContext(aContext), mStyleContext(aStyleContext), mPostResolveCallback(nsnull), mFontData(nsnull), mDisplayData(nsnull), mMarginData(nsnull), mListData(nsnull), @@ -294,6 +312,9 @@ struct nsRuleData #ifdef INCLUDE_XUL mXULData = nsnull; +#endif +#ifdef MOZ_SVG + mSVGData = nsnull; #endif }; ~nsRuleData() {}; @@ -455,6 +476,13 @@ protected: const RuleDetail& aRuleDetail, PRBool aInherited); #endif +#ifdef MOZ_SVG + const nsStyleStruct* ComputeSVGData(nsStyleStruct* aStartSVG, const nsCSSStruct& aSVGData, + nsIStyleContext* aContext, + nsRuleNode* aHighestNode, + const RuleDetail& aRuleDetail, PRBool aInherited); +#endif + typedef const nsStyleStruct* (nsRuleNode::*ComputeStyleDataFn)(nsStyleStruct* aStartStruct, const nsCSSStruct& aStartData, @@ -490,6 +518,9 @@ protected: #ifdef INCLUDE_XUL const nsStyleStruct* GetXULData(nsIStyleContext* aContext, PRBool aComputeData); #endif +#ifdef MOZ_SVG + const nsStyleStruct* GetSVGData(nsIStyleContext* aContext, PRBool aComputeData); +#endif typedef const nsStyleStruct* (nsRuleNode::*GetStyleDataFn)(nsIStyleContext*, PRBool); static GetStyleDataFn gGetStyleDataFn[]; diff --git a/content/shared/public/nsStyleStruct.h b/content/shared/public/nsStyleStruct.h index 5c7dbb4b92b1..714c803cd467 100644 --- a/content/shared/public/nsStyleStruct.h +++ b/content/shared/public/nsStyleStruct.h @@ -76,9 +76,15 @@ enum nsStyleStructID { eStyleStruct_Border = 18, eStyleStruct_Outline = 19, eStyleStruct_XUL = 20, - eStyleStruct_Min = eStyleStruct_Font, +#ifdef MOZ_SVG + eStyleStruct_SVG = 21, + eStyleStruct_Max = eStyleStruct_SVG, + eStyleStruct_BorderPaddingShortcut = 22, // only for use in GetStyle() +#else eStyleStruct_Max = eStyleStruct_XUL, - eStyleStruct_BorderPaddingShortcut = 21 // only for use in GetStyle() + eStyleStruct_BorderPaddingShortcut = 21, // only for use in GetStyle() +#endif + eStyleStruct_Min = eStyleStruct_Font }; // Bits for each struct. @@ -103,15 +109,18 @@ enum nsStyleStructID { #define NS_STYLE_INHERIT_BORDER NS_STYLE_INHERIT_BIT(eStyleStruct_Border) #define NS_STYLE_INHERIT_OUTLINE NS_STYLE_INHERIT_BIT(eStyleStruct_Outline) #define NS_STYLE_INHERIT_XUL NS_STYLE_INHERIT_BIT(eStyleStruct_XUL) +#ifdef MOZ_SVG +#define NS_STYLE_INHERIT_SVG NS_STYLE_INHERIT_BIT(eStyleStruct_SVG) +#endif -#define NS_STYLE_INHERIT_MASK 0x0fffff +#define NS_STYLE_INHERIT_MASK 0x00ffffff // A bit to test whether or not a style context can be shared // by siblings. -#define NS_STYLE_UNIQUE_CONTEXT 0x100000 +#define NS_STYLE_UNIQUE_CONTEXT 0x01000000 // A bit to test whether or not we have any text decorations. -#define NS_STYLE_HAS_TEXT_DECORATIONS 0x200000 +#define NS_STYLE_HAS_TEXT_DECORATIONS 0x02000000 #define NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(the_sid) \ static const nsStyleStructID GetStyleStructID() {return the_sid;} @@ -1121,6 +1130,52 @@ struct nsStyleXUL : public nsStyleStruct { }; #endif +#ifdef MOZ_SVG +enum nsStyleSVGPaintType { + eStyleSVGPaintType_None = 0, + eStyleSVGPaintType_Color, + eStyleSVGPaintType_Server +}; + +struct nsStyleSVGPaint +{ + nsStyleSVGPaintType mType; + nscolor mColor; +}; + +struct nsStyleSVG : public nsStyleStruct { + nsStyleSVG(); + nsStyleSVG(const nsStyleSVG& aSource); + ~nsStyleSVG(); + + void* operator new(size_t sz, nsIPresContext* aContext) { + void* result = nsnull; + aContext->AllocateFromShell(sz, &result); + return result; + } + void Destroy(nsIPresContext* aContext) { + this->~nsStyleSVG(); + aContext->FreeToShell(sizeof(nsStyleSVG), this); + }; + + PRInt32 CalcDifference(const nsStyleSVG& aOther) const; + + // all [inherit]ed + nsStyleSVGPaint mFill; + float mFillOpacity; + PRUint8 mFillRule; // see nsStyleConsts.h + nsStyleSVGPaint mStroke; + nsString mStrokeDasharray; // XXX we want a parsed value here + float mStrokeDashoffset; + PRUint8 mStrokeLinecap; // see nsStyleConsts.h + PRUint8 mStrokeLinejoin; // see nsStyleConsts.h + float mStrokeMiterlimit; + float mStrokeOpacity; + float mStrokeWidth; // in pixels +}; +#endif + + #define BORDER_PRECEDENT_EQUAL 0 #define BORDER_PRECEDENT_LOWER 1 #define BORDER_PRECEDENT_HIGHER 2 diff --git a/content/shared/src/Makefile.in b/content/shared/src/Makefile.in index aaa26fa8bf75..c7338421c66f 100644 --- a/content/shared/src/Makefile.in +++ b/content/shared/src/Makefile.in @@ -60,6 +60,10 @@ CPPSRCS = \ nsStyleStruct.cpp \ $(NULL) +ifdef MOZ_SVG +CPPSRCS += nsSVGAtoms.cpp +endif + # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 diff --git a/content/shared/src/makefile.win b/content/shared/src/makefile.win index 510aa5a9ec26..3303f12b961c 100644 --- a/content/shared/src/makefile.win +++ b/content/shared/src/makefile.win @@ -58,6 +58,9 @@ CPP_OBJS= \ .\$(OBJDIR)\nsXULAtoms.obj \ .\$(OBJDIR)\nsXBLAtoms.obj \ .\$(OBJDIR)\nsStyleCoord.obj \ +!ifdef MOZ_SVG + .\$(OBJDIR)\nsSVGAtoms.obj \ +!endif $(NULL) LCFLAGS = \ diff --git a/content/shared/src/nsCSSProps.cpp b/content/shared/src/nsCSSProps.cpp index 04d2c354086a..af6ab4a70431 100644 --- a/content/shared/src/nsCSSProps.cpp +++ b/content/shared/src/nsCSSProps.cpp @@ -738,6 +738,29 @@ const PRInt32 nsCSSProps::kBoxPackKTable[] = { }; #endif +#ifdef MOZ_SVG +// keyword tables for SVG properties +const PRInt32 nsCSSProps::kFillRuleKTable[] = { + eCSSKeyword_nonzero, NS_STYLE_FILL_RULE_NONZERO, + eCSSKeyword_evenodd, NS_STYLE_FILL_RULE_EVENODD, + -1, -1 +}; + +const PRInt32 nsCSSProps::kStrokeLinecapKTable[] = { + eCSSKeyword_butt, NS_STYLE_STROKE_LINECAP_BUTT, + eCSSKeyword_round, NS_STYLE_STROKE_LINECAP_ROUND, + eCSSKeyword_square, NS_STYLE_STROKE_LINECAP_SQUARE, + -1, -1 +}; + +const PRInt32 nsCSSProps::kStrokeLinejoinKTable[] = { + eCSSKeyword_butt, NS_STYLE_STROKE_LINEJOIN_MITER, + eCSSKeyword_round, NS_STYLE_STROKE_LINEJOIN_ROUND, + eCSSKeyword_bevel, NS_STYLE_STROKE_LINEJOIN_BEVEL, + -1, -1 +}; +#endif + PRInt32 nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]) { @@ -835,6 +858,25 @@ static const PRInt32 kBackgroundYPositionKTable[] = { return SearchKeywordTable(aValue, kBoxPackKTable); #endif +#ifdef MOZ_SVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + break; + + case eCSSProperty_fill_rule: + return SearchKeywordTable(aValue, kFillRuleKTable); + case eCSSProperty_stroke_linecap: + return SearchKeywordTable(aValue, kStrokeLinecapKTable); + case eCSSProperty_stroke_linejoin: + return SearchKeywordTable(aValue, kStrokeLinejoinKTable); +#endif + case eCSSProperty_box_sizing: return SearchKeywordTable(aValue, kBoxSizingKTable); diff --git a/content/shared/src/nsStyleStruct.cpp b/content/shared/src/nsStyleStruct.cpp index 32524db8dc73..469353d552e7 100644 --- a/content/shared/src/nsStyleStruct.cpp +++ b/content/shared/src/nsStyleStruct.cpp @@ -717,6 +717,78 @@ nsStyleXUL::CalcDifference(const nsStyleXUL& aOther) const #endif // INCLUDE_XUL +#ifdef MOZ_SVG +// -------------------- +// nsStyleSVG +// +nsStyleSVG::nsStyleSVG() +{ + mFill.mType = eStyleSVGPaintType_None; + mFill.mColor = NS_RGB(0,0,0); + mFillOpacity = 1.0f; + mFillRule = NS_STYLE_FILL_RULE_NONZERO; + mStroke.mType = eStyleSVGPaintType_None; + mStroke.mColor = NS_RGB(0,0,0); + mStrokeDasharray.Truncate(); + mStrokeDashoffset = 0.0f; + mStrokeLinecap = NS_STYLE_STROKE_LINECAP_BUTT; + mStrokeLinejoin = NS_STYLE_STROKE_LINEJOIN_MITER; + mStrokeMiterlimit = 4.0f; + mStrokeOpacity = 1.0f; + mStrokeWidth = 1.0f; +} + +nsStyleSVG::~nsStyleSVG() +{ +} + +nsStyleSVG::nsStyleSVG(const nsStyleSVG& aSource) +{ + //nsCRT::memcpy((nsStyleSVG*)this, &aSource, sizeof(nsStyleSVG)); + + mFill.mType = aSource.mFill.mType; + if (mFill.mType == eStyleSVGPaintType_Color) + mFill.mColor = aSource.mFill.mColor; + mFillOpacity = aSource.mFillOpacity; + mFillRule = aSource.mFillRule; + mStroke.mType = aSource.mStroke.mType; + if (mStroke.mType == eStyleSVGPaintType_Color) + mStroke.mColor = aSource.mStroke.mColor; + mStrokeDasharray = aSource.mStrokeDasharray; + mStrokeDashoffset = aSource.mStrokeDashoffset; + mStrokeLinecap = aSource.mStrokeLinecap; + mStrokeLinejoin = aSource.mStrokeLinejoin; + mStrokeMiterlimit = aSource.mStrokeMiterlimit; + mStrokeOpacity = aSource.mStrokeOpacity; + mStrokeWidth = aSource.mStrokeWidth; +} + +PRInt32 +nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const +{ + if ( mFill.mType != aOther.mFill.mType || + mFillOpacity != aOther.mFillOpacity || + mFillRule != aOther.mFillRule || + mStroke.mType != aOther.mStroke.mType || + mStrokeDasharray != aOther.mStrokeDasharray || + mStrokeDashoffset != aOther.mStrokeDashoffset || + mStrokeLinecap != aOther.mStrokeLinecap || + mStrokeLinejoin != aOther.mStrokeLinejoin || + mStrokeMiterlimit != aOther.mStrokeMiterlimit || + mStrokeOpacity != aOther.mStrokeOpacity || + mStrokeWidth != aOther.mStrokeWidth ) + return NS_STYLE_HINT_VISUAL; + + if ( (mStroke.mType == eStyleSVGPaintType_Color && mStroke.mColor != aOther.mStroke.mColor) || + (mFill.mType == eStyleSVGPaintType_Color && mFill.mColor != aOther.mFill.mColor) ) + return NS_STYLE_HINT_VISUAL; + + return NS_STYLE_HINT_NONE; +} + +#endif // MOZ_SVG + + // -------------------- // nsStylePosition // diff --git a/content/shared/src/nsStyleUtil.cpp b/content/shared/src/nsStyleUtil.cpp index fb0ca01200fd..4cc8c4da8160 100644 --- a/content/shared/src/nsStyleUtil.cpp +++ b/content/shared/src/nsStyleUtil.cpp @@ -169,6 +169,14 @@ nsCachedStyleData::gInfo[] = { }, #endif +#ifdef MOZ_SVG + /* eStyleStruct_SVG */ + { offsetof(nsCachedStyleData, mInheritedData), + offsetof(nsInheritedStyleData, mSVGData), + PR_FALSE + }, +#endif + { 0, 0, 0 } }; diff --git a/layout/svg/base/public/.cvsignore b/content/svg/.cvsignore similarity index 100% rename from layout/svg/base/public/.cvsignore rename to content/svg/.cvsignore diff --git a/content/svg/Makefile.in b/content/svg/Makefile.in new file mode 100644 index 000000000000..e20a1703ab5c --- /dev/null +++ b/content/svg/Makefile.in @@ -0,0 +1,29 @@ +# +# 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 + +DIRS = document content + +include $(topsrcdir)/config/rules.mk diff --git a/layout/svg/content/.cvsignore b/content/svg/content/.cvsignore similarity index 100% rename from layout/svg/content/.cvsignore rename to content/svg/content/.cvsignore diff --git a/layout/svg/base/public/Makefile.in b/content/svg/content/Makefile.in similarity index 54% rename from layout/svg/base/public/Makefile.in rename to content/svg/content/Makefile.in index 400efac97a65..1448bbb2d375 100644 --- a/layout/svg/base/public/Makefile.in +++ b/content/svg/content/Makefile.in @@ -1,38 +1,35 @@ +#!nmake # -# The contents of this file are subject to the Netscape Public +# 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/NPL/ +# 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 Original Code is Crocodile Clips Ltd code. # -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All +# 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. # # Contributor(s): # +# Alex Fritze +# -DEPTH = ../../../.. +DEPTH = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = layout - -EXPORTS = \ - nsISVGFrame.h \ - $(NULL) - -EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) +DIRS = src include $(topsrcdir)/config/rules.mk diff --git a/layout/svg/content/makefile.win b/content/svg/content/makefile.win similarity index 56% rename from layout/svg/content/makefile.win rename to content/svg/content/makefile.win index 841cfcbc222c..8291e8ba82f6 100644 --- a/layout/svg/content/makefile.win +++ b/content/svg/content/makefile.win @@ -1,23 +1,26 @@ #!nmake # -# The contents of this file are subject to the Netscape Public +# 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/NPL/ +# 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 Original Code is Crocodile Clips Ltd code. # -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All +# 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. # # Contributor(s): +# +# Alex Fritze +# DEPTH=..\..\.. diff --git a/layout/svg/content/src/.cvsignore b/content/svg/content/src/.cvsignore similarity index 100% rename from layout/svg/content/src/.cvsignore rename to content/svg/content/src/.cvsignore diff --git a/content/svg/content/src/MANIFEST b/content/svg/content/src/MANIFEST new file mode 100644 index 000000000000..6d2b301f2a08 --- /dev/null +++ b/content/svg/content/src/MANIFEST @@ -0,0 +1,4 @@ +nsISVGValue.h +nsISVGValueObserver.h +nsISVGAttribute.h +nsISVGStyleValue.h diff --git a/content/svg/content/src/Makefile.in b/content/svg/content/src/Makefile.in new file mode 100644 index 000000000000..5346f0270504 --- /dev/null +++ b/content/svg/content/src/Makefile.in @@ -0,0 +1,102 @@ +# +# 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 \ + webshell + +CPPSRCS = \ + nsSVGAnimatedLength.cpp \ + nsSVGAnimatedRect.cpp \ + nsSVGAnimatedTransformList.cpp \ + nsSVGAttributes.cpp \ + nsSVGCircleElement.cpp \ + nsSVGElement.cpp \ + nsSVGElementFactory.cpp \ + nsSVGEllipseElement.cpp \ + nsSVGForeignObjectElement.cpp \ + nsSVGGElement.cpp \ + nsSVGGenericStringValue.cpp \ + nsSVGGraphicElement.cpp \ + nsSVGLength.cpp \ + nsSVGLineElement.cpp \ + nsSVGMatrix.cpp \ + nsSVGPathDataParser.cpp \ + nsSVGPathElement.cpp \ + nsSVGPathSeg.cpp \ + nsSVGPathSegList.cpp \ + nsSVGPoint.cpp \ + nsSVGPointList.cpp \ + nsSVGPolygonElement.cpp \ + nsSVGPolylineElement.cpp \ + nsSVGRect.cpp \ + nsSVGRectElement.cpp \ + nsSVGSVGElement.cpp \ + nsSVGStyleValue.cpp \ + nsSVGTransform.cpp \ + nsSVGTransformList.cpp \ + nsSVGValue.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 \ + nsISVGValue.h \ + nsISVGStyleValue.h \ + $(NULL) + +CFLAGS += $(MOZ_LIBART_CFLAGS) +CXXFLAGS += $(MOZ_LIBART_CFLAGS) + +include $(topsrcdir)/config/rules.mk + +DEFINES += -D_IMPL_NS_HTML + + +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 \ + $(NULL) diff --git a/content/svg/content/src/makefile.win b/content/svg/content/src/makefile.win new file mode 100644 index 000000000000..b94336f33b2d --- /dev/null +++ b/content/svg/content/src/makefile.win @@ -0,0 +1,110 @@ +#!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. +# +# Contributor(s): +# +# Alex Fritze +# + +DEPTH=..\..\..\.. + +LIBRARY_NAME=contentsvg_s +MODULE=raptor +REQUIRES = \ + xpcom \ + string \ + layout \ + content \ + widget \ + gfx \ + dom \ + js \ + locale \ + htmlparser \ + webshell \ + necko \ + view \ + libart_lgpl \ + $(NULL) + +DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN + + +CPP_OBJS= \ + .\$(OBJDIR)\nsSVGAnimatedLength.obj \ + .\$(OBJDIR)\nsSVGAnimatedRect.obj \ + .\$(OBJDIR)\nsSVGAnimatedTransformList.obj \ + .\$(OBJDIR)\nsSVGAttributes.obj \ + .\$(OBJDIR)\nsSVGCircleElement.obj \ + .\$(OBJDIR)\nsSVGElement.obj \ + .\$(OBJDIR)\nsSVGElementFactory.obj \ + .\$(OBJDIR)\nsSVGEllipseElement.obj \ + .\$(OBJDIR)\nsSVGForeignObjectElement.obj \ + .\$(OBJDIR)\nsSVGGElement.obj \ + .\$(OBJDIR)\nsSVGGenericStringValue.obj \ + .\$(OBJDIR)\nsSVGGraphicElement.obj \ + .\$(OBJDIR)\nsSVGLength.obj \ + .\$(OBJDIR)\nsSVGLineElement.obj \ + .\$(OBJDIR)\nsSVGMatrix.obj \ + .\$(OBJDIR)\nsSVGPathDataParser.obj \ + .\$(OBJDIR)\nsSVGPathElement.obj \ + .\$(OBJDIR)\nsSVGPathSeg.obj \ + .\$(OBJDIR)\nsSVGPathSegList.obj \ + .\$(OBJDIR)\nsSVGPoint.obj \ + .\$(OBJDIR)\nsSVGPointList.obj \ + .\$(OBJDIR)\nsSVGPolygonElement.obj \ + .\$(OBJDIR)\nsSVGPolylineElement.obj \ + .\$(OBJDIR)\nsSVGRect.obj \ + .\$(OBJDIR)\nsSVGRectElement.obj \ + .\$(OBJDIR)\nsSVGSVGElement.obj \ + .\$(OBJDIR)\nsSVGStyleValue.obj \ + .\$(OBJDIR)\nsSVGTransform.obj \ + .\$(OBJDIR)\nsSVGTransformList.obj \ + .\$(OBJDIR)\nsSVGValue.obj \ + $(NULL) + +EXPORTS = \ + nsISVGAttribute.h \ + nsISVGValue.h \ + nsISVGStyleValue.h \ + $(NULL) + +LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \ + -I..\..\..\shared\public -I..\..\..\html\base\src -I$(PUBLIC)\dom \ + -I..\..\..\html\document\src \ + -I$(PUBLIC)\netlib \ + -I$(PUBLIC)\pref \ + -I..\..\..\xml\document\src \ + -I..\..\..\base\src \ + -I..\..\..\xml\content\src \ + -I..\..\..\..\layout\svg\base\src\ \ + $(NULL) + +LCFLAGS = \ + $(LCFLAGS) \ + $(DEFINES) \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> + +libs:: $(LIBRARY) + $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib + +clobber:: + rm -f $(DIST)\lib\$(LIBRARY_NAME).lib diff --git a/layout/svg/base/src/nsPolylineFrame.h b/content/svg/content/src/nsISVGAttribute.h similarity index 54% rename from layout/svg/base/src/nsPolylineFrame.h rename to content/svg/content/src/nsISVGAttribute.h index 909fcc75da65..ea24b8f488c8 100644 --- a/layout/svg/base/src/nsPolylineFrame.h +++ b/content/svg/content/src/nsISVGAttribute.h @@ -1,25 +1,26 @@ /* -*- 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 +/* ----- BEGIN LICENSE BLOCK ----- + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * The contents of this file are subject to the Netscape Public License + * 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/NPL/ + * 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 Original Code is the Mozilla SVG project. * * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 + * Crocodile Clips Ltd.. + * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Alex Fritze (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 @@ -31,36 +32,32 @@ * 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. + * the terms of any one of the MPL, the GPL or the LGPL. * - * ***** END LICENSE BLOCK ***** */ - -// -// nsPolylineFrame -// - -#ifndef nsPolylineFrame_h__ -#define nsPolylineFrame_h__ + * ----- END LICENSE BLOCK ----- */ -#include "nsPolygonFrame.h" +#ifndef __NS_ISVGATTRIBUTE_H__ +#define __NS_ISVGATTRIBUTE_H__ -class nsString; +#include "nsIDOMAttr.h" +class nsISVGValue; -nsresult NS_NewPolylineFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ; +//////////////////////////////////////////////////////////////////////// +// nsISVGAttribute: private interface for svg attributes +// {6557CCDF-7252-481d-8AB0-7E083E7E7AB0} +#define NS_ISVGATTRIBUTE_IID \ +{ 0x6557ccdf, 0x7252, 0x481d, { 0x8a, 0xb0, 0x7e, 0x8, 0x3e, 0x7e, 0x7a, 0xb0 } } -// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// This should NOT be derived from nsLeafFrame -// we really want to create our own container class from the nsIFrame -// interface and not derive from any HTML Frames -// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -class nsPolylineFrame : public nsPolygonFrame +class nsISVGAttribute : public nsIDOMAttr { - NS_IMETHOD RenderPoints(nsIRenderingContext& aRenderingContext, - const nsPoint aPoints[], PRInt32 aNumPoints); - -}; // class nsPolylineFrame +public: + static const nsIID& GetIID() { static nsIID iid = NS_ISVGATTRIBUTE_IID; return iid; } + + NS_IMETHOD GetSVGValue(nsISVGValue** value) = 0; +}; + +#endif // __NS_ISVGATTRIBUTE_H__ -#endif diff --git a/layout/svg/content/src/nsSVGAtomList.h b/content/svg/content/src/nsISVGStyleValue.h similarity index 50% rename from layout/svg/content/src/nsSVGAtomList.h rename to content/svg/content/src/nsISVGStyleValue.h index 462c0172c3cd..d4a61d160ca6 100644 --- a/layout/svg/content/src/nsSVGAtomList.h +++ b/content/svg/content/src/nsISVGStyleValue.h @@ -1,26 +1,26 @@ /* -*- 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 +/* ----- BEGIN LICENSE BLOCK ----- + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * The contents of this file are subject to the Netscape Public License + * 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/NPL/ + * 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 Original Code is the Mozilla SVG project. * * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1999 + * Crocodile Clips Ltd.. + * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Original Author: Rod Spears (rods@netscape.com) + * Alex Fritze (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 @@ -32,42 +32,30 @@ * 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. + * the terms of any one of the MPL, the GPL or the LGPL. * - * ***** END LICENSE BLOCK ***** */ + * ----- END LICENSE BLOCK ----- */ -/****** - This file contains the list of all SVG nsIAtoms and their values +#ifndef __NS_ISVGSTYLEVALUE_H__ +#define __NS_ISVGSTYLEVALUE_H__ + +#include "nsISupports.h" + +class nsIStyleRule; +class nsIDocument; + +// {BD099C4C-8FA5-47c4-A44E-189B5AA5DBAF} +#define NS_ISVGSTYLEVALUE_IID \ +{ 0xbd099c4c, 0x8fa5, 0x47c4, { 0xa4, 0x4e, 0x18, 0x9b, 0x5a, 0xa5, 0xdb, 0xaf } } + +class nsISVGStyleValue : public nsISupports +{ +public: + static const nsIID& GetIID() { static nsIID iid = NS_ISVGSTYLEVALUE_IID; return iid; } - It is designed to be used as inline input to nsSVGAtoms.cpp *only* - through the magic of C preprocessing. + NS_IMETHOD GetStyleRule(nsIDocument* baseDocument, nsIStyleRule** rule)=0; +}; - All entires must be enclosed in the macro SVG_ATOM which will have cruel - and unusual things done to it +#endif // __NS_ISVGSTYLEVALUE_H__ - 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(path, "path") -SVG_ATOM(polygon, "polygon") -SVG_ATOM(polyline, "polyline") -SVG_ATOM(rect, "rect") -SVG_ATOM(circle, "circle") -SVG_ATOM(ellipse, "ellipse") -SVG_ATOM(line, "line") -SVG_ATOM(svg, "svg") -SVG_ATOM(g, "g") - -// properties -SVG_ATOM(points, "points") -SVG_ATOM(x, "x") -SVG_ATOM(y, "y") -SVG_ATOM(fill, "fill") -SVG_ATOM(d, "d") diff --git a/content/svg/content/src/nsISVGValue.h b/content/svg/content/src/nsISVGValue.h new file mode 100644 index 000000000000..7680b7336602 --- /dev/null +++ b/content/svg/content/src/nsISVGValue.h @@ -0,0 +1,81 @@ +/* -*- 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 (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: + static const nsIID& GetIID() { static nsIID iid = NS_ISVGVALUE_IID; return iid; } + + NS_IMETHOD SetValueString(const nsAReadableString& aValue)=0; + NS_IMETHOD GetValueString(nsAWritableString& aValue)=0; + + NS_IMETHOD AddObserver(nsISVGValueObserver* observer)=0; + NS_IMETHOD RemoveObserver(nsISVGValueObserver* observer)=0; +}; + +extern nsresult +NS_CreateSVGGenericStringValue(const nsAReadableString& aValue, nsISVGValue** aResult); + +#endif // __NS_ISVGVALUE_H__ + diff --git a/content/svg/content/src/nsISVGValueObserver.h b/content/svg/content/src/nsISVGValueObserver.h new file mode 100644 index 000000000000..95b772163c3c --- /dev/null +++ b/content/svg/content/src/nsISVGValueObserver.h @@ -0,0 +1,71 @@ +/* -*- 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 (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_ISVGVALUEOBSERVER_H__ +#define __NS_ISVGVALUEOBSERVER_H__ + +#include "nsISupports.h" + +class nsISVGValue; + +//////////////////////////////////////////////////////////////////////// +// nsISVGValueObserver + +/* + Implementors of this interface also need to implement + nsISupportsWeakReference so that svg-values can store safe owning + refs. +*/ + +// {33e46adb-9aa4-4903-9ede-699fae1107d8} +#define NS_ISVGVALUEOBSERVER_IID \ +{ 0x33e46adb, 0x9aa4, 0x4903, { 0x9e, 0xde, 0x69, 0x9f, 0xae, 0x11, 0x7, 0xd8 } } + + +class nsISVGValueObserver : public nsISupports +{ +public: + static const nsIID& GetIID() { static nsIID iid = NS_ISVGVALUEOBSERVER_IID; return iid; } + + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable)=0; + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable)=0; +}; + +#endif // __NS_ISVGVALUEOBSERVER_H__ + diff --git a/content/svg/content/src/nsSVGAnimatedLength.cpp b/content/svg/content/src/nsSVGAnimatedLength.cpp new file mode 100644 index 000000000000..b44fc4b6954d --- /dev/null +++ b/content/svg/content/src/nsSVGAnimatedLength.cpp @@ -0,0 +1,203 @@ +/* -*- 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 (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 nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + +protected: + nsCOMPtr mBaseVal; +}; + + + +//---------------------------------------------------------------------- +// Implementation + +nsSVGAnimatedLength::nsSVGAnimatedLength() +{ + NS_INIT_ISUPPORTS(); +} + +nsSVGAnimatedLength::~nsSVGAnimatedLength() +{ + if (!mBaseVal) return; + nsCOMPtr val = do_QueryInterface(mBaseVal); + if (!val) return; + val->RemoveObserver(this); +} + +void +nsSVGAnimatedLength::Init(nsIDOMSVGLength* baseVal) +{ + mBaseVal = baseVal; + if (!mBaseVal) return; + nsCOMPtr 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 nsAReadableString& aValue) +{ + nsCOMPtr value = do_QueryInterface(mBaseVal); + return value->SetValueString(aValue); +} + +NS_IMETHODIMP +nsSVGAnimatedLength::GetValueString(nsAWritableString& aValue) +{ + nsCOMPtr 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 baseVal; +// NS_NewSVGLength(getter_AddRefs(baseVal), owner); + + animatedLength->Init(baseVal); + + *aResult = (nsIDOMSVGAnimatedLength*) animatedLength; + + return NS_OK; +} diff --git a/content/svg/content/src/nsSVGAnimatedLength.h b/content/svg/content/src/nsSVGAnimatedLength.h new file mode 100644 index 000000000000..f79aa1be8efa --- /dev/null +++ b/content/svg/content/src/nsSVGAnimatedLength.h @@ -0,0 +1,51 @@ +/* -*- 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 (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_SVGANIMATEDLENGTH_H__ +#define __NS_SVGANIMATEDLENGTH_H__ + +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGLength.h" + +nsresult NS_NewSVGAnimatedLength(nsIDOMSVGAnimatedLength** result, + nsIDOMSVGLength* baseVal); + + + + +#endif //__NS_SVGANIMATEDLENGTH_H__ diff --git a/content/svg/content/src/nsSVGAnimatedRect.cpp b/content/svg/content/src/nsSVGAnimatedRect.cpp new file mode 100644 index 000000000000..8925e3c01538 --- /dev/null +++ b/content/svg/content/src/nsSVGAnimatedRect.cpp @@ -0,0 +1,193 @@ +/* -*- 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 (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 "nsSVGAnimatedRect.h" +#include "nsSVGRect.h" +#include "nsSVGValue.h" +#include "nsWeakReference.h" + +//////////////////////////////////////////////////////////////////////// +// nsSVGAnimatedRect + +class nsSVGAnimatedRect : public nsIDOMSVGAnimatedRect, + public nsSVGValue, + public nsISVGValueObserver, + public nsSupportsWeakReference +{ +protected: + friend nsresult NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result, + nsIDOMSVGRect* baseVal); + + nsSVGAnimatedRect(); + ~nsSVGAnimatedRect(); + void Init(nsIDOMSVGRect* baseVal); + +public: + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGAnimatedRect interface: + NS_DECL_NSIDOMSVGANIMATEDRECT + + // remainder of nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + +protected: + nsCOMPtr mBaseVal; +}; + + +//---------------------------------------------------------------------- +// Implementation + +nsSVGAnimatedRect::nsSVGAnimatedRect() +{ + NS_INIT_ISUPPORTS(); +} + +nsSVGAnimatedRect::~nsSVGAnimatedRect() +{ + if (!mBaseVal) return; + nsCOMPtr val = do_QueryInterface(mBaseVal); + if (!val) return; + val->RemoveObserver(this); +} + +void +nsSVGAnimatedRect::Init(nsIDOMSVGRect* baseVal) +{ + mBaseVal = baseVal; + if (!mBaseVal) return; + nsCOMPtr val = do_QueryInterface(mBaseVal); + if (!val) return; + val->AddObserver(this); +} + +//---------------------------------------------------------------------- +// nsISupports methods: + +NS_IMPL_ISUPPORTS4(nsSVGAnimatedRect, + nsISVGValue, + nsIDOMSVGAnimatedRect, + nsISupportsWeakReference, + nsISVGValueObserver); + +//---------------------------------------------------------------------- +// nsISVGValue methods: + +NS_IMETHODIMP +nsSVGAnimatedRect::SetValueString(const nsAReadableString& aValue) +{ + nsCOMPtr value = do_QueryInterface(mBaseVal); + return value->SetValueString(aValue); +} + +NS_IMETHODIMP +nsSVGAnimatedRect::GetValueString(nsAWritableString& aValue) +{ + nsCOMPtr value = do_QueryInterface(mBaseVal); + return value->GetValueString(aValue); +} + +//---------------------------------------------------------------------- +// nsIDOMSVGAnimatedRect methods: + +/* readonly attribute nsIDOMSVGRect baseVal; */ +NS_IMETHODIMP +nsSVGAnimatedRect::GetBaseVal(nsIDOMSVGRect * *aBaseVal) +{ + *aBaseVal = mBaseVal; + NS_ADDREF(*aBaseVal); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGRect animVal; */ +NS_IMETHODIMP +nsSVGAnimatedRect::GetAnimVal(nsIDOMSVGRect * *aAnimVal) +{ + *aAnimVal = mBaseVal; + NS_ADDREF(*aAnimVal); + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods + +NS_IMETHODIMP +nsSVGAnimatedRect::WillModifySVGObservable(nsISVGValue* observable) +{ + WillModify(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAnimatedRect::DidModifySVGObservable (nsISVGValue* observable) +{ + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// Exported creation functions: + +nsresult +NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result, + nsIDOMSVGRect* baseVal) +{ + *result = nsnull; + + nsSVGAnimatedRect* animatedRect = new nsSVGAnimatedRect(); + if(!animatedRect) return NS_ERROR_OUT_OF_MEMORY; + NS_ADDREF(animatedRect); + + animatedRect->Init(baseVal); + + *result = (nsIDOMSVGAnimatedRect*) animatedRect; + + return NS_OK; +} + diff --git a/content/svg/content/src/nsSVGAnimatedRect.h b/content/svg/content/src/nsSVGAnimatedRect.h new file mode 100644 index 000000000000..3502d8579bfb --- /dev/null +++ b/content/svg/content/src/nsSVGAnimatedRect.h @@ -0,0 +1,49 @@ +/* -*- 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 (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_SVGANIMATEDRECT_H__ +#define __NS_SVGANIMATEDRECT_H__ + +#include "nsIDOMSVGAnimatedRect.h" +#include "nsIDOMSVGRect.h" + +nsresult +NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result, + nsIDOMSVGRect* baseVal); + +#endif //__NS_SVGANIMATEDRECT_H__ diff --git a/content/svg/content/src/nsSVGAnimatedTransformList.cpp b/content/svg/content/src/nsSVGAnimatedTransformList.cpp new file mode 100644 index 000000000000..37275c7b2e67 --- /dev/null +++ b/content/svg/content/src/nsSVGAnimatedTransformList.cpp @@ -0,0 +1,201 @@ +/* -*- 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 (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 "nsSVGAnimatedTransformList.h" +#include "nsSVGTransformList.h" +#include "nsSVGValue.h" +#include "nsWeakReference.h" + +//////////////////////////////////////////////////////////////////////// +// nsSVGAnimatedTransformList + +class nsSVGAnimatedTransformList : public nsIDOMSVGAnimatedTransformList, + public nsSVGValue, + public nsISVGValueObserver, + public nsSupportsWeakReference +{ +protected: + friend nsresult + NS_NewSVGAnimatedTransformList(nsIDOMSVGAnimatedTransformList** result, + nsIDOMSVGTransformList* baseVal); + + nsSVGAnimatedTransformList(); + ~nsSVGAnimatedTransformList(); + void Init(nsIDOMSVGTransformList* baseVal); + +public: + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGAnimatedTransformList interface: + NS_DECL_NSIDOMSVGANIMATEDTRANSFORMLIST + + // remainder of nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + +protected: + nsCOMPtr mBaseVal; +}; + + +//---------------------------------------------------------------------- +// Implementation + +nsSVGAnimatedTransformList::nsSVGAnimatedTransformList() +{ + NS_INIT_ISUPPORTS(); +} + +nsSVGAnimatedTransformList::~nsSVGAnimatedTransformList() +{ + if (!mBaseVal) return; + nsCOMPtr val = do_QueryInterface(mBaseVal); + if (!val) return; + val->RemoveObserver(this); +} + +void +nsSVGAnimatedTransformList::Init(nsIDOMSVGTransformList* baseVal) +{ + mBaseVal = baseVal; + if (!mBaseVal) return; + nsCOMPtr val = do_QueryInterface(mBaseVal); + if (!val) return; + val->AddObserver(this); +} + +//---------------------------------------------------------------------- +// nsISupports methods: + +NS_IMPL_ADDREF(nsSVGAnimatedTransformList) +NS_IMPL_RELEASE(nsSVGAnimatedTransformList) + +NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedTransformList) + NS_INTERFACE_MAP_ENTRY(nsISVGValue) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedTransformList) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedTransformList) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue) +NS_INTERFACE_MAP_END + + +//---------------------------------------------------------------------- +// nsISVGValue methods: + +NS_IMETHODIMP +nsSVGAnimatedTransformList::SetValueString(const nsAReadableString& aValue) +{ + nsCOMPtr value = do_QueryInterface(mBaseVal); + return value->SetValueString(aValue); +} + +NS_IMETHODIMP +nsSVGAnimatedTransformList::GetValueString(nsAWritableString& aValue) +{ + nsCOMPtr value = do_QueryInterface(mBaseVal); + return value->GetValueString(aValue); +} + +//---------------------------------------------------------------------- +// nsIDOMSVGAnimatedTransformList methods: + +/* readonly attribute nsIDOMSVGTransformList baseVal; */ +NS_IMETHODIMP +nsSVGAnimatedTransformList::GetBaseVal(nsIDOMSVGTransformList * *aBaseVal) +{ + *aBaseVal = mBaseVal; + NS_ADDREF(*aBaseVal); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGTransformList animVal; */ +NS_IMETHODIMP +nsSVGAnimatedTransformList::GetAnimVal(nsIDOMSVGTransformList * *aAnimVal) +{ + *aAnimVal = mBaseVal; + NS_ADDREF(*aAnimVal); + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods + +NS_IMETHODIMP +nsSVGAnimatedTransformList::WillModifySVGObservable(nsISVGValue* observable) +{ + WillModify(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAnimatedTransformList::DidModifySVGObservable (nsISVGValue* observable) +{ + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// Exported creation functions: + +nsresult +NS_NewSVGAnimatedTransformList(nsIDOMSVGAnimatedTransformList** result, + nsIDOMSVGTransformList* baseVal) +{ + *result = nsnull; + + nsSVGAnimatedTransformList* animatedTransformList = new nsSVGAnimatedTransformList(); + if(!animatedTransformList) return NS_ERROR_OUT_OF_MEMORY; + NS_ADDREF(animatedTransformList); + + animatedTransformList->Init(baseVal); + + *result = (nsIDOMSVGAnimatedTransformList*) animatedTransformList; + + return NS_OK; +} + diff --git a/content/svg/content/src/nsSVGAnimatedTransformList.h b/content/svg/content/src/nsSVGAnimatedTransformList.h new file mode 100644 index 000000000000..7b0fb418f12b --- /dev/null +++ b/content/svg/content/src/nsSVGAnimatedTransformList.h @@ -0,0 +1,49 @@ +/* -*- 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 (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_SVGANIMATEDTRANSFORMLIST_H__ +#define __NS_SVGANIMATEDTRANSFORMLIST_H__ + +#include "nsIDOMSVGAnimTransformList.h" +#include "nsIDOMSVGTransformList.h" + +nsresult +NS_NewSVGAnimatedTransformList(nsIDOMSVGAnimatedTransformList** result, + nsIDOMSVGTransformList* baseVal); + +#endif //__NS_SVGANIMATEDTRANSFORMLIST_H__ diff --git a/content/svg/content/src/nsSVGAttributes.cpp b/content/svg/content/src/nsSVGAttributes.cpp new file mode 100644 index 000000000000..66ffb5cd2877 --- /dev/null +++ b/content/svg/content/src/nsSVGAttributes.cpp @@ -0,0 +1,974 @@ +/* -*- 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 (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 "nsSVGAttributes.h" + +#include "nsIContent.h" +#include "nsINodeInfo.h" +#include "nsIDOMElement.h" +#include "nsINameSpaceManager.h" +#include "nsIDocument.h" +#include "nsIBindingManager.h" +#include "nsIXBLBinding.h" +#include "nsMutationEvent.h" +#include "nsGenericElement.h" +#include "nsIDOMMutationEvent.h" +#include "nsStyleConsts.h" + +//////////////////////////////////////////////////////////////////////// +// nsSVGAttribute implementation + +nsresult +nsSVGAttribute::Create(nsINodeInfo* aNodeInfo, + nsISVGValue* value, + nsSVGAttributeFlags flags, + nsSVGAttribute** aResult) +{ + NS_ENSURE_ARG_POINTER(aNodeInfo); + NS_PRECONDITION(aResult != nsnull, "null ptr"); + if (! aResult) return NS_ERROR_NULL_POINTER; + + *aResult = (nsSVGAttribute*) new nsSVGAttribute(aNodeInfo, value, flags); + if(!*aResult) return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(*aResult); + + if ((*aResult)->mValue) + (*aResult)->mValue->AddObserver(*aResult); + + return NS_OK; +} + +nsresult +nsSVGAttribute::Create(nsINodeInfo* aNodeInfo, + const nsAReadableString& value, + nsSVGAttribute** aResult) +{ + nsCOMPtr svg_value; + NS_CreateSVGGenericStringValue(value, getter_AddRefs(svg_value)); + if(!svg_value) return NS_ERROR_OUT_OF_MEMORY; + + return nsSVGAttribute::Create(aNodeInfo, svg_value, 0, aResult); +} + + +nsSVGAttribute::nsSVGAttribute(nsINodeInfo* aNodeInfo, + nsISVGValue* value, + nsSVGAttributeFlags flags) + : mFlags(flags), + mOwner(0), + mNodeInfo(aNodeInfo), + mValue(value) +{ + NS_INIT_ISUPPORTS(); +} + +nsSVGAttribute::~nsSVGAttribute() +{ + if (mValue) + mValue->RemoveObserver(this); +} + +//---------------------------------------------------------------------- +// nsISupports interface + +NS_IMPL_ADDREF(nsSVGAttribute) +NS_IMPL_RELEASE(nsSVGAttribute) + +NS_INTERFACE_MAP_BEGIN(nsSVGAttribute) + NS_INTERFACE_MAP_ENTRY(nsIDOMNode) + NS_INTERFACE_MAP_ENTRY(nsIDOMAttr) + NS_INTERFACE_MAP_ENTRY(nsISVGAttribute) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNode) +NS_INTERFACE_MAP_END + +//---------------------------------------------------------------------- +// nsIDOMNode interface + +NS_IMETHODIMP +nsSVGAttribute::GetNodeName(nsAWritableString& aNodeName) +{ + GetQualifiedName(aNodeName); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetNodeValue(nsAWritableString& aNodeValue) +{ + return GetValue()->GetValueString(aNodeValue); +} + +NS_IMETHODIMP +nsSVGAttribute::SetNodeValue(const nsAReadableString& aNodeValue) +{ + return SetValue(aNodeValue); +} + +NS_IMETHODIMP +nsSVGAttribute::GetNodeType(PRUint16* aNodeType) +{ + *aNodeType = (PRUint16)nsIDOMNode::ATTRIBUTE_NODE; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetParentNode(nsIDOMNode** aParentNode) +{ + *aParentNode = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGAttribute::GetFirstChild(nsIDOMNode** aFirstChild) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGAttribute::GetLastChild(nsIDOMNode** aLastChild) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGAttribute::GetPreviousSibling(nsIDOMNode** aPreviousSibling) +{ + *aPreviousSibling = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetNextSibling(nsIDOMNode** aNextSibling) +{ + *aNextSibling = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes) +{ + *aAttributes = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGAttribute::GetNamespaceURI(nsAWritableString& aNamespaceURI) +{ + return mNodeInfo->GetNamespaceURI(aNamespaceURI); +} + +NS_IMETHODIMP +nsSVGAttribute::GetPrefix(nsAWritableString& aPrefix) +{ + return mNodeInfo->GetPrefix(aPrefix); +} + +NS_IMETHODIMP +nsSVGAttribute::SetPrefix(const nsAReadableString& aPrefix) +{ + // XXX: Validate the prefix string! + + nsINodeInfo *newNodeInfo = nsnull; + nsCOMPtr prefix; + + if (aPrefix.Length()) { + prefix = dont_AddRef(NS_NewAtom(aPrefix)); + NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY); + } + + nsresult rv = mNodeInfo->PrefixChanged(prefix, newNodeInfo); + NS_ENSURE_SUCCESS(rv, rv); + + mNodeInfo = newNodeInfo; + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetLocalName(nsAWritableString& aLocalName) +{ + return mNodeInfo->GetLocalName(aLocalName); +} + +NS_IMETHODIMP +nsSVGAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) +{ + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsSVGAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) +{ + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsSVGAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) +{ + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsSVGAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) +{ + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsSVGAttribute::HasChildNodes(PRBool* aReturn) +{ + NS_ENSURE_ARG_POINTER(aReturn); + *aReturn = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::HasAttributes(PRBool* aReturn) +{ + NS_ENSURE_ARG_POINTER(aReturn); + *aReturn = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGAttribute::Normalize() +{ + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::IsSupported(const nsAReadableString& aFeature, + const nsAReadableString& aVersion, + PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +//---------------------------------------------------------------------- +// nsIDOMAttr interface + +NS_IMETHODIMP +nsSVGAttribute::GetName(nsAWritableString& aName) +{ + GetQualifiedName(aName); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetSpecified(PRBool* aSpecified) +{ + // XXX this'll break when we make Clone() work + *aSpecified = PR_TRUE; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::GetValue(nsAWritableString& aValue) +{ + return GetValue()->GetValueString(aValue); +} + +NS_IMETHODIMP +nsSVGAttribute::SetValue(const nsAReadableString& aValue) +{ + if (mOwner) { + return mOwner->SetAttr(mNodeInfo, aValue, PR_TRUE); + } + + return GetValue()->SetValueString(aValue); +} + +NS_IMETHODIMP +nsSVGAttribute::GetOwnerElement(nsIDOMElement** aOwnerElement) +{ + NS_ENSURE_ARG_POINTER(aOwnerElement); + + nsIContent *content; + if (mOwner && (content = mOwner->GetContent())) { + return content->QueryInterface(NS_GET_IID(nsIDOMElement), + (void **)aOwnerElement); + } + + return NS_ERROR_FAILURE; +} + +//---------------------------------------------------------------------- +// nsISVGAttribute methods + +NS_IMETHODIMP +nsSVGAttribute::GetSVGValue(nsISVGValue** value) +{ + *value = mValue; + NS_IF_ADDREF(*value); + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods + +NS_IMETHODIMP +nsSVGAttribute::WillModifySVGObservable(nsISVGValue* observable) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttribute::DidModifySVGObservable (nsISVGValue* observable) +{ + if (!mOwner) return NS_OK; + + mOwner->AttributeWasModified(this); + + return NS_OK; +} + + + +//---------------------------------------------------------------------- +// Implementation functions + +void +nsSVGAttribute::GetQualifiedName(nsAWritableString& aQualifiedName)const +{ + mNodeInfo->GetQualifiedName(aQualifiedName); +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGAttributes +// + +nsSVGAttributes::nsSVGAttributes(nsIContent* aContent) + : mContent(aContent) +{ + NS_INIT_ISUPPORTS(); +} + + +nsSVGAttributes::~nsSVGAttributes() +{ + ReleaseAttributes(); + ReleaseMappedAttributes(); +} + + +nsresult +nsSVGAttributes::Create(nsIContent* aContent, nsSVGAttributes** aResult) +{ + NS_PRECONDITION(aResult != nsnull, "null ptr"); + if (! aResult) return NS_ERROR_NULL_POINTER; + + *aResult = new nsSVGAttributes(aContent); + if (! *aResult) return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(*aResult); + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISupports interface +NS_IMPL_ISUPPORTS1(nsSVGAttributes,nsIDOMNamedNodeMap); + +//---------------------------------------------------------------------- +// Implementation Helpers + +void +nsSVGAttributes::ReleaseAttributes() +{ + PRInt32 count = mAttributes.Count(); + for (PRInt32 index = 0; index < count; ++index) { + nsSVGAttribute* attr = NS_REINTERPRET_CAST(nsSVGAttribute*, mAttributes.ElementAt(index)); + attr->mOwner = nsnull; + NS_RELEASE(attr); + } + mAttributes.Clear(); +} + +void +nsSVGAttributes::ReleaseMappedAttributes() +{ + PRInt32 count = mMappedAttributes.Count(); + for (PRInt32 index = 0; index < count; ++index) { + nsSVGAttribute* attr = NS_REINTERPRET_CAST(nsSVGAttribute*, mMappedAttributes.ElementAt(index)); + attr->mOwner = nsnull; + NS_RELEASE(attr); + } + mMappedAttributes.Clear(); +} + +PRBool +nsSVGAttributes::GetMappedAttribute(nsINodeInfo* aNodeInfo, nsSVGAttribute** attrib) +{ + PRInt32 count = mMappedAttributes.Count(); + PRInt32 index; + for (index = 0; index < count; index++) { + *attrib = (nsSVGAttribute*)mMappedAttributes.ElementAt(index); + if ((*attrib)->GetNodeInfo()->Equals(aNodeInfo)) { // XXX is this the right test? (don't want to compare prefixes!) + NS_ADDREF(*attrib); + return PR_TRUE; + } + } + *attrib = nsnull; + return PR_FALSE; +} + +PRBool +nsSVGAttributes::IsExplicitAttribute(nsSVGAttribute* attrib) +{ + PRInt32 count = mAttributes.Count(); + for (PRInt32 i=0; imOwner = this; + NS_ADDREF(aElement); + mAttributes.AppendElement((void*)aElement); +} + +void +nsSVGAttributes::RemoveElementAt(PRInt32 aIndex) +{ + nsSVGAttribute* attrib = ElementAt(aIndex); + NS_ASSERTION(attrib,"null attrib"); + if (!IsMappedAttribute(attrib)) + attrib->mOwner = 0; + mAttributes.RemoveElementAt(aIndex); + NS_RELEASE(attrib); +} + + +//---------------------------------------------------------------------- +// interface used by the content element: + +PRInt32 +nsSVGAttributes::Count() const +{ + return mAttributes.Count(); +} + +NS_IMETHODIMP +nsSVGAttributes::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom*& aPrefix, + nsAWritableString& aResult) +{ + NS_ASSERTION(nsnull != aName, "must have attribute name"); + if (nsnull == aName) { + return NS_ERROR_NULL_POINTER; + } + + nsresult rv = NS_CONTENT_ATTR_NOT_THERE; + + PRInt32 count = Count(); + PRInt32 index; + for (index = 0; index < count; index++) { + nsSVGAttribute *attr = ElementAt(index); + if ((aNameSpaceID == kNameSpaceID_Unknown || + attr->GetNodeInfo()->NamespaceEquals(aNameSpaceID)) && + (attr->GetNodeInfo()->Equals(aName))) { + attr->GetNodeInfo()->GetPrefixAtom(aPrefix); + attr->GetValue()->GetValueString(aResult); + if (0 < aResult.Length()) { + rv = NS_CONTENT_ATTR_HAS_VALUE; + } + else { + rv = NS_CONTENT_ATTR_NO_VALUE; + } + break; + } + } + + if (rv == NS_CONTENT_ATTR_NOT_THERE) { + // In other cases we already set the out param. + // Since we are returning a success code we'd better do + // something about the out parameters (someone may have + // given us a non-empty string). + aResult.Truncate(); + } + + return rv; +} + +NS_IMETHODIMP +nsSVGAttributes::SetAttr(nsINodeInfo* aNodeInfo, + const nsAReadableString& aValue, + PRBool aNotify) +{ + NS_ENSURE_ARG_POINTER(aNodeInfo); + PRBool modification = PR_FALSE; + nsAutoString oldValue; + nsresult rv = NS_ERROR_OUT_OF_MEMORY; + + nsCOMPtr document; + if (mContent) + mContent->GetDocument(*getter_AddRefs(document)); + + if (aNotify && document) { + document->BeginUpdate(); + } + + nsSVGAttribute* attr; + PRInt32 index; + PRInt32 count; + + count = Count(); + for (index = 0; index < count; index++) { + attr = ElementAt(index); + if (attr->GetNodeInfo() == aNodeInfo) { + attr->GetValue()->GetValueString(oldValue); + modification = PR_TRUE; + attr->GetValue()->SetValueString(aValue); + rv = NS_OK; + break; + } + } + + if (index >= count) { // didn't find it + + if (GetMappedAttribute(aNodeInfo, &attr)) { + AppendElement(attr); + attr->GetValue()->SetValueString(aValue); + } + else { + rv = nsSVGAttribute::Create(aNodeInfo, aValue, &attr); + NS_ENSURE_TRUE(attr, rv); + AppendElement(attr); + } + attr->Release(); + rv = NS_OK; + } + + if (document && NS_SUCCEEDED(rv)) { + nsCOMPtr name; + PRInt32 nameSpaceID; + + aNodeInfo->GetNameAtom(*getter_AddRefs(name)); + aNodeInfo->GetNamespaceID(nameSpaceID); + + nsCOMPtr bindingManager; + document->GetBindingManager(getter_AddRefs(bindingManager)); + nsCOMPtr binding; + bindingManager->GetBinding(mContent, getter_AddRefs(binding)); + if (binding) + binding->AttributeChanged(name, nameSpaceID, PR_FALSE); + + if (nsGenericElement::HasMutationListeners(mContent, NS_EVENT_BITS_MUTATION_ATTRMODIFIED)) { + nsCOMPtr node(do_QueryInterface(mContent)); + nsMutationEvent mutation; + mutation.eventStructType = NS_MUTATION_EVENT; + mutation.message = NS_MUTATION_ATTRMODIFIED; + mutation.mTarget = node; + +//XXX mutation.mRelatedNode = do_QueryInterface(attr); + attr->QueryInterface(NS_GET_IID(nsIDOMNode), getter_AddRefs(mutation.mRelatedNode)); + mutation.mAttrName = name; + if (!oldValue.IsEmpty()) + mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(oldValue)); + if (!aValue.IsEmpty()) + mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue)); + mutation.mAttrChange = modification ? nsIDOMMutationEvent::MODIFICATION : + nsIDOMMutationEvent::ADDITION; + nsEventStatus status = nsEventStatus_eIgnore; + nsCOMPtr domEvent; + mContent->HandleDOMEvent(nsnull, &mutation, getter_AddRefs(domEvent), + NS_EVENT_FLAG_INIT, &status); + } + + if (aNotify) { + PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) + : PRInt32(nsIDOMMutationEvent::ADDITION); + document->AttributeChanged(mContent, nameSpaceID, name, + modHint, NS_STYLE_HINT_UNKNOWN); + document->EndUpdate(); + } + } + + return rv; +} + +NS_IMETHODIMP +nsSVGAttributes::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + PRBool aNotify) +{ + NS_ASSERTION(nsnull != aName, "must have attribute name"); + if (nsnull == aName) { + return NS_ERROR_NULL_POINTER; + } + + nsresult rv = NS_OK; + + nsCOMPtr document; + if (mContent) + mContent->GetDocument(*getter_AddRefs(document)); + + PRInt32 count = Count(); + PRInt32 index; + PRBool found = PR_FALSE; + for (index = 0; index < count; index++) { + nsSVGAttribute* attr = ElementAt(index); + if ((aNameSpaceID == kNameSpaceID_Unknown || + attr->GetNodeInfo()->NamespaceEquals(aNameSpaceID)) && + attr->GetNodeInfo()->Equals(aName) && + !attr->IsRequired() && + !attr->IsFixed()) { + if (aNotify && document) { + document->BeginUpdate(); + } + + if (mContent && nsGenericElement::HasMutationListeners(mContent, NS_EVENT_BITS_MUTATION_ATTRMODIFIED)) { + nsCOMPtr node(do_QueryInterface(mContent)); + nsMutationEvent mutation; + mutation.eventStructType = NS_MUTATION_EVENT; + mutation.message = NS_MUTATION_ATTRMODIFIED; + mutation.mTarget = node; + +//XXX mutation.mRelatedNode = do_QueryInterface(attr); + attr->QueryInterface(NS_GET_IID(nsIDOMNode), getter_AddRefs(mutation.mRelatedNode)); + mutation.mAttrName = aName; + nsAutoString str; + attr->GetValue()->GetValueString(str); + if (!str.IsEmpty()) + mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(str)); + mutation.mAttrChange = nsIDOMMutationEvent::REMOVAL; + + nsEventStatus status = nsEventStatus_eIgnore; + nsCOMPtr domEvent; + mContent->HandleDOMEvent(nsnull, &mutation, getter_AddRefs(domEvent), + NS_EVENT_FLAG_INIT, &status); + } + + RemoveElementAt(index); + found = PR_TRUE; + break; + } + } + + if (NS_SUCCEEDED(rv) && found && document) { + nsCOMPtr bindingManager; + document->GetBindingManager(getter_AddRefs(bindingManager)); + nsCOMPtr binding; + bindingManager->GetBinding(mContent, getter_AddRefs(binding)); + if (binding) + binding->AttributeChanged(aName, aNameSpaceID, PR_TRUE); + + if (aNotify) { + document->AttributeChanged(mContent, aNameSpaceID, aName, + nsIDOMMutationEvent::REMOVAL, + NS_STYLE_HINT_UNKNOWN); + document->EndUpdate(); + } + } + + return rv; +} + +NS_IMETHODIMP_(PRBool) +nsSVGAttributes::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const +{ + // XXX - this should be hashed, or something + PRInt32 count = Count(); + PRInt32 index; + for (index = 0; index < count; index++) { + nsSVGAttribute *attr = ElementAt(index); + if ((aNameSpaceID == kNameSpaceID_Unknown || + attr->GetNodeInfo()->NamespaceEquals(aNameSpaceID)) && + (attr->GetNodeInfo()->Equals(aName))) { + return PR_TRUE; + } + } + return PR_FALSE; +} + +NS_IMETHODIMP +nsSVGAttributes::NormalizeAttrString(const nsAReadableString& aStr, + nsINodeInfo*& aNodeInfo) +{ + PRInt32 indx, count = Count(); + for (indx = 0; indx < count; indx++) { + nsSVGAttribute* attr = ElementAt(indx); + if (attr->GetNodeInfo()->QualifiedNameEquals(aStr)) { + aNodeInfo = attr->GetNodeInfo(); + NS_ADDREF(aNodeInfo); + + return NS_OK; + } + } + + NS_ASSERTION(mContent,"no owner content"); + if (!mContent) return NS_ERROR_FAILURE; + + nsCOMPtr contentNodeInfo; + mContent->GetNodeInfo(*getter_AddRefs(contentNodeInfo)); + + nsCOMPtr nimgr; + contentNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); + NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE); + + return nimgr->GetNodeInfo(aStr, nsnull, kNameSpaceID_None, aNodeInfo); +} + +NS_IMETHODIMP +nsSVGAttributes::GetAttrNameAt(PRInt32 aIndex, + PRInt32& aNameSpaceID, + nsIAtom*& aName, + nsIAtom*& aPrefix) +{ + nsSVGAttribute* attr = ElementAt(aIndex); + if (attr) { + attr->GetNodeInfo()->GetNamespaceID(aNameSpaceID); + attr->GetNodeInfo()->GetNameAtom(aName); + attr->GetNodeInfo()->GetPrefixAtom(aPrefix); + + return NS_OK; + } + + aNameSpaceID = kNameSpaceID_None; + aName = nsnull; + return NS_ERROR_ILLEGAL_VALUE; +} + +NS_IMETHODIMP +nsSVGAttributes::AddMappedSVGValue(nsIAtom* name, nsISupports* value) +{ + nsCOMPtr svg_value = do_QueryInterface(value); + NS_ENSURE_TRUE(svg_value, NS_ERROR_FAILURE); + + NS_ASSERTION(mContent,"no owner content"); + if (!mContent) return NS_ERROR_FAILURE; + + nsCOMPtr contentNodeInfo; + mContent->GetNodeInfo(*getter_AddRefs(contentNodeInfo)); + + nsCOMPtr nimgr; + contentNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); + NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE); + + nsCOMPtr ni; + nimgr->GetNodeInfo(name, nsnull, kNameSpaceID_None, *getter_AddRefs(ni)); + NS_ENSURE_TRUE(ni, NS_ERROR_FAILURE); + + nsSVGAttribute* attrib = nsnull; + nsSVGAttribute::Create(ni, svg_value, NS_SVGATTRIBUTE_FLAGS_MAPPED, &attrib); + NS_ENSURE_TRUE(attrib, NS_ERROR_FAILURE); + attrib->mOwner = this; + mMappedAttributes.AppendElement((void*)attrib); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttributes::CopyAttributes(nsSVGAttributes* dest) +{ + nsresult rv; + NS_ENSURE_TRUE(dest, NS_ERROR_FAILURE); + PRInt32 count = Count(); + for (PRInt32 i = 0; i < count; ++i) { + nsSVGAttribute* attr = ElementAt(i); + nsAutoString value; + rv = attr->GetValue()->GetValueString(value); + NS_ENSURE_SUCCESS(rv,rv); + rv = dest->SetAttr(attr->GetNodeInfo(), value, PR_FALSE); + NS_ENSURE_SUCCESS(rv,rv); + } + return NS_OK; +} + + +//---------------------------------------------------------------------- +// interface used by our attributes: + +void +nsSVGAttributes::AttributeWasModified(nsSVGAttribute* caller) +{ + if (!IsExplicitAttribute(caller)) { + NS_ASSERTION(IsMappedAttribute(caller), "unknown attribute"); + AppendElement(caller); + } + // XXX Mutation events +} + +//---------------------------------------------------------------------- +// nsIDOMNamedNodeMap interface: + + NS_IMETHODIMP +nsSVGAttributes::GetLength(PRUint32* aLength) +{ + NS_PRECONDITION(aLength != nsnull, "null ptr"); + if (! aLength) + return NS_ERROR_NULL_POINTER; + + *aLength = mAttributes.Count(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttributes::GetNamedItem(const nsAReadableString& aName, + nsIDOMNode** aReturn) +{ + NS_PRECONDITION(aReturn != nsnull, "null ptr"); + if (! aReturn) + return NS_ERROR_NULL_POINTER; + + nsresult rv; + *aReturn = nsnull; + + nsCOMPtr inpNodeInfo; + + if (NS_FAILED(rv = mContent->NormalizeAttrString(aName, *getter_AddRefs(inpNodeInfo)))) + return rv; + + for (PRInt32 i = mAttributes.Count() - 1; i >= 0; --i) { + nsSVGAttribute* attr = (nsSVGAttribute*) mAttributes[i]; + nsINodeInfo *ni = attr->GetNodeInfo(); + + if (inpNodeInfo->Equals(ni)) { + NS_ADDREF(attr); + *aReturn = attr; + break; + } + } + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGAttributes::SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGAttributes::RemoveNamedItem(const nsAReadableString& aName, + nsIDOMNode** aReturn) +{ + nsCOMPtr element( do_QueryInterface(mContent) ); + if (element) { + return element->RemoveAttribute(aName); + *aReturn = nsnull; // XXX should be the element we just removed + return NS_OK; + } + else { + return NS_ERROR_FAILURE; + } +} + +NS_IMETHODIMP +nsSVGAttributes::Item(PRUint32 aIndex, nsIDOMNode** aReturn) +{ + *aReturn = (nsSVGAttribute*) mAttributes[aIndex]; + NS_IF_ADDREF(*aReturn); + return NS_OK; +} + +nsresult +nsSVGAttributes::GetNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsresult +nsSVGAttributes::SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +nsresult +nsSVGAttributes::RemoveNamedItemNS(const nsAReadableString& aNamespaceURI, + const nsAReadableString& aLocalName, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + + + diff --git a/content/svg/content/src/nsSVGAttributes.h b/content/svg/content/src/nsSVGAttributes.h new file mode 100644 index 000000000000..43cbd55b742d --- /dev/null +++ b/content/svg/content/src/nsSVGAttributes.h @@ -0,0 +1,213 @@ +/* -*- 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 (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" + +class nsIContent; +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(nsINodeInfo* aNodeInfo, + nsISVGValue* value, + nsSVGAttributeFlags flags, + nsSVGAttribute** aResult); + + // create a generic string attribute: + static nsresult + Create(nsINodeInfo* aNodeInfo, + const nsAReadableString& value, + nsSVGAttribute** aResult); + +protected: + + nsSVGAttribute(nsINodeInfo* aNodeInfo, + 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 + nsINodeInfo* GetNodeInfo()const { return mNodeInfo; } + void GetQualifiedName(nsAWritableString& aQualifiedName)const; + + nsISVGValue* GetValue() { return mValue; } + + 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; + nsCOMPtr mNodeInfo; + nsCOMPtr mValue; +}; + +//////////////////////////////////////////////////////////////////////// +// nsSVGAttributes: the collection of attribs for one content element + +class nsSVGAttributes : public nsIDOMNamedNodeMap +{ +public: + static nsresult + Create(nsIContent* aElement, nsSVGAttributes** aResult); + +protected: + nsSVGAttributes(nsIContent* aContent); + virtual ~nsSVGAttributes(); + +public: + // nsISupports interface + NS_DECL_ISUPPORTS + + // nsIDOMNamedNodeMap interface + NS_DECL_NSIDOMNAMEDNODEMAP + + // interface for the content element: + + PRInt32 Count() const; + NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom*& aPrefix, + nsAWritableString& aResult); + NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, + const nsAReadableString& aValue, + PRBool aNotify); + NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + PRBool aNotify); + NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, + nsIAtom* aName) const; + NS_IMETHOD NormalizeAttrString(const nsAReadableString& aStr, + nsINodeInfo*& aNodeInfo); + NS_IMETHOD GetAttrNameAt(PRInt32 aIndex, + PRInt32& aNameSpaceID, + nsIAtom*& aName, + nsIAtom*& aPrefix); + + NS_IMETHOD AddMappedSVGValue(nsIAtom* name, nsISupports* value); + + NS_IMETHOD CopyAttributes(nsSVGAttributes* dest); + + // interface for our attributes: + nsIContent* GetContent(){ return mContent; } + void AttributeWasModified(nsSVGAttribute* caller); + +protected: + // implementation helpers: + void ReleaseAttributes(); + void ReleaseMappedAttributes(); + PRBool GetMappedAttribute(nsINodeInfo* aNodeInfo, nsSVGAttribute** +attrib); + + PRBool IsExplicitAttribute(nsSVGAttribute* attrib); + PRBool IsMappedAttribute(nsSVGAttribute* attrib); + + nsSVGAttribute* ElementAt(PRInt32 index) const; + void AppendElement(nsSVGAttribute* aElement); + void RemoveElementAt(PRInt32 aIndex); + + + nsIContent* mContent; // our owner + + nsAutoVoidArray mAttributes; + nsAutoVoidArray mMappedAttributes; +}; + + +#endif // __NS_SVGATTRIBUTES_H__ + diff --git a/content/svg/content/src/nsSVGCircleElement.cpp b/content/svg/content/src/nsSVGCircleElement.cpp new file mode 100644 index 000000000000..664c3d5492e5 --- /dev/null +++ b/content/svg/content/src/nsSVGCircleElement.cpp @@ -0,0 +1,258 @@ +/* -*- 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 (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" + +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: + // interfaces: + + 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: + nsCOMPtr mCx; + nsCOMPtr mCy; + nsCOMPtr 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 value = do_QueryInterface(mCx); + value->RemoveObserver(this); + } + if (mCy) { + nsCOMPtr value = do_QueryInterface(mCy); + value->RemoveObserver(this); + } + if (mR) { + nsCOMPtr 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eNoDirection, + 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; +} diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp new file mode 100644 index 000000000000..f12f2968b0f4 --- /dev/null +++ b/content/svg/content/src/nsSVGElement.cpp @@ -0,0 +1,862 @@ +/* -*- 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 + * + * 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 "nsINameSpaceManager.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 "nsIStyleRule.h" +#include "nsIDOMSVGSVGElement.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++) { + nsIContent* kid = (nsIContent *)mChildren.ElementAt(index); + kid->SetParent(nsnull); + NS_RELEASE(kid); + } + + 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, nsNode3Tearoff(this)) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) +// 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 nimgr; + rv = mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); + NS_ENSURE_SUCCESS(rv,rv); + + nsCOMPtr 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 + +NS_IMETHODIMP +nsSVGElement::CanContainChildren(PRBool& aResult) const +{ + aResult = PR_TRUE; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::ChildCount(PRInt32& aResult) const +{ + aResult = mChildren.Count(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::ChildAt(PRInt32 aIndex, nsIContent*& aResult) const +{ + nsIContent *child = (nsIContent *)mChildren.ElementAt(aIndex); + if (nsnull != child) { + NS_ADDREF(child); + } + aResult = child; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const +{ + NS_PRECONDITION(nsnull != aPossibleChild, "null ptr"); + aResult = mChildren.IndexOf(aPossibleChild); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::InsertChildAt(nsIContent* aKid, PRInt32 aIndex, + PRBool aNotify, + PRBool aDeepSetDocument) +{ + NS_PRECONDITION(nsnull != aKid, "null ptr"); + nsIDocument* doc = mDocument; + if (aNotify && (nsnull != doc)) { + doc->BeginUpdate(); + } + PRBool rv = mChildren.InsertElementAt(aKid, aIndex);/* XXX fix up void array api to use nsresult's*/ + if (rv) { + NS_ADDREF(aKid); + aKid->SetParent(this); + nsRange::OwnerChildInserted(this, aIndex); + if (nsnull != doc) { + aKid->SetDocument(doc, aDeepSetDocument, PR_TRUE); + if (aNotify) { + doc->ContentInserted(this, aKid, aIndex); + } + + if (nsGenericElement::HasMutationListeners(this, NS_EVENT_BITS_MUTATION_NODEINSERTED)) { + nsCOMPtr node(do_QueryInterface(aKid)); + nsMutationEvent mutation; + mutation.eventStructType = NS_MUTATION_EVENT; + mutation.message = NS_MUTATION_NODEINSERTED; + mutation.mTarget = node; + + nsCOMPtr relNode(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this))); + mutation.mRelatedNode = relNode; + + nsEventStatus status = nsEventStatus_eIgnore; + nsCOMPtr domEvent; + aKid->HandleDOMEvent(nsnull, &mutation, getter_AddRefs(domEvent), NS_EVENT_FLAG_INIT, &status); + } + } + } + if (aNotify && (nsnull != doc)) { + doc->EndUpdate(); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, + PRBool aNotify, + PRBool aDeepSetDocument) +{ + NS_PRECONDITION(nsnull != aKid, "null ptr"); + nsIDocument* doc = mDocument; + if (aNotify && (nsnull != mDocument)) { + doc->BeginUpdate(); + } + nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex); + nsRange::OwnerChildReplaced(this, aIndex, oldKid); + PRBool rv = mChildren.ReplaceElementAt(aKid, aIndex); + if (rv) { + NS_ADDREF(aKid); + aKid->SetParent(this); + if (nsnull != doc) { + aKid->SetDocument(doc, aDeepSetDocument, PR_TRUE); + if (aNotify) { + doc->ContentReplaced(this, oldKid, aKid, aIndex); + } + } + oldKid->SetDocument(nsnull, PR_TRUE, PR_TRUE); + oldKid->SetParent(nsnull); + NS_RELEASE(oldKid); + } + if (aNotify && (nsnull != mDocument)) { + doc->EndUpdate(); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument) +{ + NS_PRECONDITION(nsnull != aKid && this != aKid, "null ptr"); + nsIDocument* doc = mDocument; + if (aNotify && (nsnull != doc)) { + doc->BeginUpdate(); + } + PRBool rv = mChildren.AppendElement(aKid); + if (rv) { + NS_ADDREF(aKid); + aKid->SetParent(this); + // ranges don't need adjustment since new child is at end of list + if (nsnull != doc) { + aKid->SetDocument(doc, aDeepSetDocument, PR_TRUE); + if (aNotify) { + doc->ContentAppended(this, mChildren.Count() - 1); + } + + if (nsGenericElement::HasMutationListeners(this, NS_EVENT_BITS_MUTATION_NODEINSERTED)) { + nsCOMPtr node(do_QueryInterface(aKid)); + nsMutationEvent mutation; + mutation.eventStructType = NS_MUTATION_EVENT; + mutation.message = NS_MUTATION_NODEINSERTED; + mutation.mTarget = node; + + nsCOMPtr relNode(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this))); + mutation.mRelatedNode = relNode; + + nsEventStatus status = nsEventStatus_eIgnore; + nsCOMPtr domEvent; + aKid->HandleDOMEvent(nsnull, &mutation, getter_AddRefs(domEvent), NS_EVENT_FLAG_INIT, &status); + } + } + } + if (aNotify && (nsnull != doc)) { + doc->EndUpdate(); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify) +{ + nsIDocument* doc = mDocument; + if (aNotify && (nsnull != doc)) { + doc->BeginUpdate(); + } + nsIContent* oldKid = (nsIContent *)mChildren.ElementAt(aIndex); + if (nsnull != oldKid ) { + + if (nsGenericElement::HasMutationListeners(this, NS_EVENT_BITS_MUTATION_NODEREMOVED)) { + nsCOMPtr node(do_QueryInterface(oldKid)); + nsMutationEvent mutation; + mutation.eventStructType = NS_MUTATION_EVENT; + mutation.message = NS_MUTATION_NODEREMOVED; + mutation.mTarget = node; + + nsCOMPtr relNode(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this))); + mutation.mRelatedNode = relNode; + + nsEventStatus status = nsEventStatus_eIgnore; + nsCOMPtr domEvent; + oldKid->HandleDOMEvent(nsnull, &mutation, getter_AddRefs(domEvent), + NS_EVENT_FLAG_INIT, &status); + } + + nsRange::OwnerChildRemoved(this, aIndex, oldKid); + + mChildren.RemoveElementAt(aIndex); + if (aNotify) { + if (nsnull != doc) { + doc->ContentRemoved(this, oldKid, aIndex); + } + } + oldKid->SetDocument(nsnull, PR_TRUE, PR_TRUE); + oldKid->SetParent(nsnull); + NS_RELEASE(oldKid); + } + if (aNotify && (nsnull != doc)) { + doc->EndUpdate(); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::NormalizeAttrString(const nsAReadableString& aStr, + nsINodeInfo*& aNodeInfo) +{ + return mAttributes->NormalizeAttrString(aStr, aNodeInfo); +} + +NS_IMETHODIMP +nsSVGElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAReadableString& aValue, + PRBool aNotify) +{ + nsCOMPtr nimgr; + + mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr)); + NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE); + + nsCOMPtr ni; + nimgr->GetNodeInfo(aName, nsnull, aNameSpaceID, *getter_AddRefs(ni)); + + return SetAttr(ni, aValue, aNotify); +} + +NS_IMETHODIMP +nsSVGElement::SetAttr(nsINodeInfo* aNodeInfo, + const nsAReadableString& aValue, + PRBool aNotify) +{ + return mAttributes->SetAttr(aNodeInfo, aValue, aNotify); +} + +NS_IMETHODIMP +nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAWritableString& aResult) const +{ + nsCOMPtr prefix; + return GetAttr(aNameSpaceID, aName, *getter_AddRefs(prefix), aResult); +} + +NS_IMETHODIMP +nsSVGElement::GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom*& aPrefix, + nsAWritableString& aResult) const +{ + return mAttributes->GetAttr(aNameSpaceID, aName, aPrefix, aResult); +} + +NS_IMETHODIMP +nsSVGElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + PRBool aNotify) +{ + return mAttributes->UnsetAttr(aNameSpaceID, aName, aNotify); +} + +NS_IMETHODIMP_(PRBool) +nsSVGElement::HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const +{ + return mAttributes->HasAttr(aNameSpaceID, aName); +} + +NS_IMETHODIMP +nsSVGElement::GetAttrNameAt(PRInt32 aIndex, + PRInt32& aNameSpaceID, + nsIAtom*& aName, + nsIAtom*& aPrefix) const +{ + return mAttributes->GetAttrNameAt(aIndex, aNameSpaceID, aName, aPrefix); +} + +NS_IMETHODIMP +nsSVGElement::GetAttrCount(PRInt32& aResult) const +{ + aResult = mAttributes->Count(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::List(FILE* out, PRInt32 aIndent) const +{ + // XXX + fprintf(out, "some SVG element\n"); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const +{ + // XXX + fprintf(out, "some SVG element\n"); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const +{ +// NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + + +//---------------------------------------------------------------------- +// nsIXMLContent methods + +NS_IMETHODIMP +nsSVGElement::SetContainingNameSpace(nsINameSpace* aNameSpace) +{ + mNameSpace = aNameSpace; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::GetContainingNameSpace(nsINameSpace*& aNameSpace) const +{ + aNameSpace = mNameSpace; + NS_IF_ADDREF(aNameSpace); + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsIStyledContent methods + +NS_IMETHODIMP +nsSVGElement::GetID(nsIAtom*& aId)const +{ + nsresult rv; + nsAutoString value; + + rv = NS_CONST_CAST(nsSVGElement*,this)->GetAttribute(NS_LITERAL_STRING("id"), value); + if (NS_SUCCEEDED(rv)) + aId = NS_NewAtom(value); + + return rv; +} + +NS_IMETHODIMP +nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::WalkInlineStyleRules(nsRuleWalker* aRuleWalker) +{ + nsCOMPtr rule; + mStyle->GetStyleRule(mDocument, getter_AddRefs(rule)); + if (aRuleWalker && rule) { + aRuleWalker->Forward(rule); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, + PRInt32& aHint) const +{ + // we don't rely on the cssframeconstructor to map attribute changes + // to changes in our frames. an exception is css. + // style_hint_content will trigger a re-resolve of the style context + // if the attribute is used in a css selector: + aHint = NS_STYLE_HINT_CONTENT; + + // ... and we special case the style attribute + if (aAttribute == nsSVGAtoms::style) { + aHint = NS_STYLE_HINT_VISUAL; +// aHint = NS_STYLE_HINT_FRAMECHANGE; + } + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsIDOMNode methods + +NS_IMETHODIMP +nsSVGElement::GetNodeName(nsAWritableString& aNodeName) +{ + return mNodeInfo->GetQualifiedName(aNodeName); +} + +NS_IMETHODIMP +nsSVGElement::GetNodeValue(nsAWritableString& aNodeValue) +{ + aNodeValue.Truncate(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::SetNodeValue(const nsAReadableString& aNodeValue) +{ + return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; +} + +NS_IMETHODIMP +nsSVGElement::GetNodeType(PRUint16* aNodeType) +{ + *aNodeType = (PRUint16)nsIDOMNode::ELEMENT_NODE; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::GetParentNode(nsIDOMNode** aParentNode) +{ + if (mParent) { + return mParent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**) aParentNode); + } + else if (mDocument) { + // we're the root content + return mDocument->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)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 (nsnull == slots->mChildNodes) { + slots->mChildNodes = new nsChildContentList(this); + if (nsnull == slots->mChildNodes) { + return NS_ERROR_OUT_OF_MEMORY; + } + NS_ADDREF(slots->mChildNodes); + } + + return slots->mChildNodes->QueryInterface(NS_GET_IID(nsIDOMNodeList), + (void **)aChildNodes); +} + +NS_IMETHODIMP +nsSVGElement::GetFirstChild(nsIDOMNode** aNode) +{ + nsIContent *child = (nsIContent *)mChildren.ElementAt(0); + if (nsnull != child) { + nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode), + (void**)aNode); + NS_ASSERTION(NS_OK == res, "Must be a DOM Node"); // must be a DOM Node + return res; + } + *aNode = nsnull; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGElement::GetLastChild(nsIDOMNode** aNode) +{ + nsIContent *child = (nsIContent *)mChildren.ElementAt(mChildren.Count()-1); + if (nsnull != child) { + nsresult res = child->QueryInterface(NS_GET_IID(nsIDOMNode), + (void**)aNode); + NS_ASSERTION(NS_OK == 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(nsAWritableString& aNamespaceURI) +{ + return mNodeInfo->GetNamespaceURI(aNamespaceURI); +} + +NS_IMETHODIMP +nsSVGElement::GetPrefix(nsAWritableString& aPrefix) +{ + return nsGenericElement::GetPrefix(aPrefix); +} + +NS_IMETHODIMP +nsSVGElement::SetPrefix(const nsAReadableString& aPrefix) +{ + return nsGenericElement::SetPrefix(aPrefix); +} + +NS_IMETHODIMP +nsSVGElement::GetLocalName(nsAWritableString& aLocalName) +{ + return nsGenericElement::GetLocalName(aLocalName); +} + +NS_IMETHODIMP +nsSVGElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) +{ + return nsGenericElement::doInsertBefore(aNewChild, aRefChild, aReturn); +} + +NS_IMETHODIMP +nsSVGElement::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) +{ + return nsGenericElement::doReplaceChild(aNewChild, aOldChild, aReturn); +} + +NS_IMETHODIMP +nsSVGElement::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) +{ + return nsGenericElement::doRemoveChild(aOldChild, aReturn); +} + +NS_IMETHODIMP +nsSVGElement::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) +{ + return nsGenericElement::doInsertBefore(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 nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGElement::HasAttributes(PRBool* aReturn) +{ + NS_ENSURE_ARG_POINTER(aReturn); + + PRInt32 attrCount = 0; + + GetAttrCount(attrCount); + + *aReturn = (attrCount > 0); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMElement methods + +// forwarded to nsGenericElement implementations + + +//---------------------------------------------------------------------- +// nsIDOMSVGElement methods + +/* attribute DOMString id; */ +NS_IMETHODIMP nsSVGElement::GetId(nsAWritableString & aId) +{ + return GetAttribute(NS_LITERAL_STRING("id"), aId); +} + +NS_IMETHODIMP nsSVGElement::SetId(const nsAReadableString & aId) +{ + return SetAttribute(NS_LITERAL_STRING("id"), aId); +} + +/* readonly attribute nsIDOMSVGSVGElement ownerSVGElement; */ +NS_IMETHODIMP +nsSVGElement::GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement) +{ + *aOwnerSVGElement = nsnull; + + nsCOMPtr bindingManager; + if (mDocument) { + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + } + + nsCOMPtr 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 = mParent; + } + + while (parent) { + nsCOMPtr SVGSVGElement = do_QueryInterface(parent); + if (SVGSVGElement) { + *aOwnerSVGElement = SVGSVGElement; + NS_ADDREF(*aOwnerSVGElement); + return NS_OK; + } + nsCOMPtr next; + + if (bindingManager) { + bindingManager->GetInsertionParent(parent, getter_AddRefs(next)); + } + + if (!next) { + // no anonymous parent, so use explicit one + parent->GetParent(*getter_AddRefs(next)); + } + + 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 SVGSVGElement = do_QueryInterface((nsIDOMSVGElement*)this); + NS_ENSURE_TRUE(SVGSVGElement, NS_ERROR_FAILURE); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGElement viewportElement; */ +NS_IMETHODIMP +nsSVGElement::GetViewportElement(nsIDOMSVGElement * *aViewportElement) +{ + *aViewportElement = nsnull; + nsCOMPtr SVGSVGElement; + nsresult rv = GetOwnerSVGElement(getter_AddRefs(SVGSVGElement)); + NS_ENSURE_SUCCESS(rv,rv); + if (SVGSVGElement) { + nsCOMPtr 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 = NS_STATIC_CAST(nsIContent*, mChildren[i]); + + NS_ASSERTION(child != nsnull, "null ptr"); + if (!child) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr domchild = do_QueryInterface(child); + NS_ASSERTION(domchild != nsnull, "child is not a DOM node"); + if (! domchild) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr newdomchild; + rv = domchild->CloneNode(PR_TRUE, getter_AddRefs(newdomchild)); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr 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; +} + diff --git a/content/svg/content/src/nsSVGElement.h b/content/svg/content/src/nsSVGElement.h new file mode 100644 index 000000000000..8ccc27d64bb0 --- /dev/null +++ b/content/svg/content/src/nsSVGElement.h @@ -0,0 +1,181 @@ +/* -*- 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 (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 "nsINameSpace.h" +#include "nsWeakReference.h" +#include "nsISVGStyleValue.h" + +class nsSVGElement : public nsGenericElement, // :nsIHTMLContent:nsIStyledContent:nsIContent + public nsIDOMSVGElement, // :nsIDOMElement:nsIDOMNode + public nsISVGValueObserver, + public nsSupportsWeakReference // :nsISupportsWeakReference +{ +protected: + nsSVGElement(); + virtual ~nsSVGElement(); + + virtual nsresult Init(); + +public: + // nsISupports + NS_DECL_ISUPPORTS_INHERITED + + // nsIContent interface methods + + // NS_IMETHOD GetDocument(nsIDocument*& aResult) const; + // NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, + // PRBool aCompileEventHandlers); + // NS_IMETHOD GetParent(nsIContent*& aResult) const; + // NS_IMETHOD SetParent(nsIContent* aParent); + // NS_IMETHOD GetNameSpaceID(PRInt32& aNameSpaceID) const; + // NS_IMETHOD GetTag(nsIAtom*& aResult) const; + // NS_IMETHOD GetNodeInfo(nsINodeInfo*& aResult) const; + + NS_IMETHOD CanContainChildren(PRBool& aResult) const; + NS_IMETHOD ChildCount(PRInt32& aResult) const; + NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const; + NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const; + NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, + PRBool aNotify, + PRBool aDeepSetDocument); + NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, + PRBool aNotify, + PRBool aDeepSetDocument); + NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify, + PRBool aDeepSetDocument); + NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify); + NS_IMETHOD NormalizeAttrString(const nsAReadableString& aStr, + nsINodeInfo*& aNodeInfo); + NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAReadableString& aValue, + PRBool aNotify); + NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, + const nsAReadableString& aValue, + PRBool aNotify); + NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsAWritableString& aResult) const; + NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + nsIAtom*& aPrefix, + nsAWritableString& aResult) const; + NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const; + NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); + NS_IMETHOD GetAttrNameAt(PRInt32 aIndex, + PRInt32& aNameSpaceID, + nsIAtom*& aName, + nsIAtom*& aPrefix) const; + NS_IMETHOD GetAttrCount(PRInt32& aResult) const; + NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const; + + // NS_IMETHOD RangeAdd(nsIDOMRange& aRange); +// NS_IMETHOD RangeRemove(nsIDOMRange& aRange); +// NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const; +// NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, +// nsEvent* aEvent, +// nsIDOMEvent** aDOMEvent, +// PRUint32 aFlags, +// nsEventStatus* aEventStatus); +// NS_IMETHOD GetContentID(PRUint32* aID); +// NS_IMETHOD SetContentID(PRUint32 aID); +// NS_IMETHOD SetFocus(nsIPresContext* aContext); +// NS_IMETHOD RemoveFocus(nsIPresContext* aContext); +// NS_IMETHOD GetBindingParent(nsIContent** aContent); +// NS_IMETHOD SetBindingParent(nsIContent* aParent); + + NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; + + // nsIXMLContent + NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace); + NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const; +// NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell); + + // 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 WalkInlineStyleRules(nsRuleWalker* aRuleWalker); + + NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, + PRInt32& aHint) const; + + // 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 + +protected: + + nsresult CopyNode(nsSVGElement* dest, PRBool deep); + + nsVoidArray mChildren; + nsSVGAttributes* mAttributes; + nsCOMPtr mNameSpace; + nsCOMPtr mStyle; +}; + +#endif // __NS_SVGELEMENT_H__ diff --git a/content/svg/content/src/nsSVGElementFactory.cpp b/content/svg/content/src/nsSVGElementFactory.cpp new file mode 100644 index 000000000000..86f704f28003 --- /dev/null +++ b/content/svg/content/src/nsSVGElementFactory.cpp @@ -0,0 +1,146 @@ +/* -*- 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 (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" + +extern nsresult NS_NewSVGPolylineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGPolygonElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGCircleElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGEllipseElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGLineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGRectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGSVGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGForeignObjectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +extern nsresult NS_NewSVGPathElement(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() +{ + NS_INIT_ISUPPORTS(); +} + +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) +{ + nsCOMPtr name; + aNodeInfo->GetNameAtom(*getter_AddRefs(name)); + + if (name == nsSVGAtoms::polyline) + return NS_NewSVGPolylineElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::polygon) + return NS_NewSVGPolygonElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::circle) + return NS_NewSVGCircleElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::ellipse) + return NS_NewSVGEllipseElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::line) + return NS_NewSVGLineElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::rect) + return NS_NewSVGRectElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::svg) + return NS_NewSVGSVGElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::g) + return NS_NewSVGGElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::foreignObject) + return NS_NewSVGForeignObjectElement(aResult, aNodeInfo); + else if (name == nsSVGAtoms::path) + return NS_NewSVGPathElement(aResult, aNodeInfo); + + // if we don't know what to create, just create a standard xml element: + nsCOMPtr xmlContent; + nsresult rv; + rv = NS_NewXMLElement(getter_AddRefs(xmlContent), aNodeInfo); + + *aResult = xmlContent; + NS_IF_ADDREF(*aResult); + + return rv; +} + diff --git a/content/svg/content/src/nsSVGEllipseElement.cpp b/content/svg/content/src/nsSVGEllipseElement.cpp new file mode 100644 index 000000000000..c56ea2c69b2b --- /dev/null +++ b/content/svg/content/src/nsSVGEllipseElement.cpp @@ -0,0 +1,284 @@ +/* -*- 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 (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 "nsIDOMSVGEllipseElement.h" +#include "nsCOMPtr.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: + nsCOMPtr mCx; + nsCOMPtr mCy; + nsCOMPtr mRx; + nsCOMPtr 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 value = do_QueryInterface(mCx); + value->RemoveObserver(this); + } + if (mCy) { + nsCOMPtr value = do_QueryInterface(mCy); + value->RemoveObserver(this); + } + if (mRx) { + nsCOMPtr value = do_QueryInterface(mRx); + value->RemoveObserver(this); + } + if (mRy) { + nsCOMPtr 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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; +} diff --git a/content/svg/content/src/nsSVGForeignObjectElement.cpp b/content/svg/content/src/nsSVGForeignObjectElement.cpp new file mode 100644 index 000000000000..b5378e43fb46 --- /dev/null +++ b/content/svg/content/src/nsSVGForeignObjectElement.cpp @@ -0,0 +1,285 @@ +/* -*- 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 (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" + +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: + nsCOMPtr mX; + nsCOMPtr mY; + nsCOMPtr mWidth; + nsCOMPtr 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 value = do_QueryInterface(mX); + value->RemoveObserver(this); + } + if (mY) { + nsCOMPtr value = do_QueryInterface(mY); + value->RemoveObserver(this); + } + if (mWidth) { + nsCOMPtr value = do_QueryInterface(mWidth); + value->RemoveObserver(this); + } + if (mHeight) { + nsCOMPtr 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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; +} + diff --git a/content/svg/content/src/nsSVGGElement.cpp b/content/svg/content/src/nsSVGGElement.cpp new file mode 100644 index 000000000000..41508f1682fa --- /dev/null +++ b/content/svg/content/src/nsSVGGElement.cpp @@ -0,0 +1,169 @@ +/* -*- 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 (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" + +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::) + +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; +} diff --git a/content/svg/content/src/nsSVGGenericStringValue.cpp b/content/svg/content/src/nsSVGGenericStringValue.cpp new file mode 100644 index 000000000000..ecdc9f3e2214 --- /dev/null +++ b/content/svg/content/src/nsSVGGenericStringValue.cpp @@ -0,0 +1,113 @@ +/* -*- 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 (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" + +//////////////////////////////////////////////////////////////////////// +// nsSVGGenericStringValue implementation + +class nsSVGGenericStringValue : public nsSVGValue +{ +protected: + friend nsresult + NS_CreateSVGGenericStringValue(const nsAReadableString& aValue, nsISVGValue** aResult); + + nsSVGGenericStringValue(const nsAReadableString& aValue); + virtual ~nsSVGGenericStringValue(); + +public: + NS_DECL_ISUPPORTS + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + +protected: + nsString mValue; +}; + + +nsresult +NS_CreateSVGGenericStringValue(const nsAReadableString& aValue, + nsISVGValue** aResult) +{ + NS_PRECONDITION(aResult != nsnull, "null ptr"); + if (! aResult) return NS_ERROR_NULL_POINTER; + + *aResult = (nsISVGValue*) new nsSVGGenericStringValue(aValue); + if(!*aResult) return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(*aResult); + return NS_OK; +} + +nsSVGGenericStringValue::nsSVGGenericStringValue(const nsAReadableString& aValue) +{ + NS_INIT_ISUPPORTS(); + mValue = aValue; +} + +nsSVGGenericStringValue::~nsSVGGenericStringValue() +{ +} + + +// nsISupports methods: + +NS_IMPL_ISUPPORTS1(nsSVGGenericStringValue, nsISVGValue); + + +// nsISVGValue methods: + +NS_IMETHODIMP +nsSVGGenericStringValue::SetValueString(const nsAReadableString& aValue) +{ + WillModify(); + mValue = aValue; + DidModify(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGenericStringValue::GetValueString(nsAWritableString& aValue) +{ + aValue = mValue; + return NS_OK; +} + + diff --git a/content/svg/content/src/nsSVGGraphicElement.cpp b/content/svg/content/src/nsSVGGraphicElement.cpp new file mode 100644 index 000000000000..93f0f359f677 --- /dev/null +++ b/content/svg/content/src/nsSVGGraphicElement.cpp @@ -0,0 +1,282 @@ +/* -*- 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 (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 "nsIDOMSVGSVGElement.h" +#include "nsIDOMEventTarget.h" +#include "nsIBindingManager.h" +#include "nsIDocument.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 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) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGMatrix getCTM (); */ +NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval) +{ + nsCOMPtr CTM; + + nsCOMPtr bindingManager; + if (mDocument) { + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + } + + nsCOMPtr 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 = mParent; + } + + while (parent) { + nsCOMPtr viewportElement = do_QueryInterface(parent); + if (viewportElement) { + // Our nearest SVG parent is a viewport element. + viewportElement->GetViewboxToViewportTransform(getter_AddRefs(CTM)); + break; + } + + nsCOMPtr 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 next; + + if (bindingManager) { + bindingManager->GetInsertionParent(parent, getter_AddRefs(next)); + } + + if (!next) { + // no anonymous parent, so use explicit one + parent->GetParent(*getter_AddRefs(next)); + } + + 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 transforms; + mTransforms->GetAnimVal(getter_AddRefs(transforms)); + NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE); + nsCOMPtr matrix; + transforms->GetConsolidation(getter_AddRefs(matrix)); + + return CTM->Multiply(matrix, _retval); +} + +/* nsIDOMSVGMatrix getScreenCTM (); */ +NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix **_retval) +{ + nsCOMPtr screenCTM; + + nsCOMPtr bindingManager; + if (mDocument) { + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + } + + nsCOMPtr 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 = mParent; + } + + while (parent) { + + nsCOMPtr locatableElement = do_QueryInterface(parent); + if (locatableElement) { + nsCOMPtr ctm; + locatableElement->GetScreenCTM(getter_AddRefs(ctm)); + if (!ctm) break; + + nsCOMPtr viewportElement = do_QueryInterface(parent); + if (viewportElement) { + // It is a viewport element. we need to append the viewbox xform: + nsCOMPtr 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 next; + + if (bindingManager) { + bindingManager->GetInsertionParent(parent, getter_AddRefs(next)); + } + + if (!next) { + // no anonymous parent, so use explicit one + parent->GetParent(*getter_AddRefs(next)); + } + + 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 transforms; + mTransforms->GetAnimVal(getter_AddRefs(transforms)); + NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE); + nsCOMPtr 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; +} + diff --git a/content/svg/content/src/nsSVGGraphicElement.h b/content/svg/content/src/nsSVGGraphicElement.h new file mode 100644 index 000000000000..ac28acf6ab4a --- /dev/null +++ b/content/svg/content/src/nsSVGGraphicElement.h @@ -0,0 +1,65 @@ +/* -*- 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 (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 + +protected: + nsCOMPtr mTransforms; +}; + +#endif // __NS_SVGGRAPHICELEMENT_H__ diff --git a/content/svg/content/src/nsSVGLength.cpp b/content/svg/content/src/nsSVGLength.cpp new file mode 100644 index 000000000000..bf80e5a44649 --- /dev/null +++ b/content/svg/content/src/nsSVGLength.cpp @@ -0,0 +1,621 @@ +/* -*- 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 (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 "nsIDOMSVGLocatable.h" +#include "nsIDOMSVGMatrix.h" +#include "nsSVGPoint.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsSVGAtoms.h" +#include "nsIDOMSVGRect.h" +#include "nsSVGValue.h" +#include "nsIWeakReference.h" +#include "nsReadableUtils.h" +#include + +//////////////////////////////////////////////////////////////////////// +// nsSVGLength class + +class nsSVGLength : public nsIDOMSVGLength, + public nsSVGValue +{ +public: + static nsresult Create(nsIDOMSVGLength** aResult, + nsIDOMSVGElement* owner, + float value, PRUint16 unit, + nsSVGLengthDirection dir); + +protected: + nsSVGLength(float value, PRUint16 unit, + nsSVGLengthDirection dir); + nsresult Init(nsIDOMSVGElement* owner); +public: + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGLength interface: + NS_DECL_NSIDOMSVGLENGTH + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + // implementation helpers: + float UserUnitsPerPixel(); + float mmPerPixel(); + float ViewportDimension(); + void GetUnitString(nsAWritableString& unit); + PRUint16 GetUnitTypeForString(const char* unitStr); + PRBool IsValidUnitType(PRUint16 unit); + + float mValueInSpecifiedUnits; + PRUint16 mSpecifiedUnitType; + nsCOMPtr mOwnerElementRef; + nsSVGLengthDirection mDirection; +}; + + +//---------------------------------------------------------------------- +// Implementation + +nsresult +nsSVGLength::Create(nsIDOMSVGLength** aResult, + nsIDOMSVGElement* owner, + float value, PRUint16 unit, + nsSVGLengthDirection dir) +{ + nsSVGLength *pl = new nsSVGLength(value, unit, dir); + NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(pl); + if (NS_FAILED(pl->Init(owner))) { + NS_RELEASE(pl); + return NS_ERROR_FAILURE; + } + *aResult = pl; + return NS_OK; +} + + +nsSVGLength::nsSVGLength(float value, + PRUint16 unit, + nsSVGLengthDirection dir) + : mValueInSpecifiedUnits(value), + mSpecifiedUnitType(unit), + mDirection(dir) +{ + NS_INIT_ISUPPORTS(); +} + +nsresult nsSVGLength::Init(nsIDOMSVGElement* owner) +{ + NS_ASSERTION(owner, "need owner"); + mOwnerElementRef = NS_GetWeakReference(owner); + NS_ENSURE_TRUE(mOwnerElementRef, NS_ERROR_FAILURE); + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISupports methods: + +NS_IMPL_ADDREF(nsSVGLength) +NS_IMPL_RELEASE(nsSVGLength) + +NS_INTERFACE_MAP_BEGIN(nsSVGLength) + NS_INTERFACE_MAP_ENTRY(nsISVGValue) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLength) + 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 nsAReadableString& aValue) +{ + return SetValueAsString(aValue); +} + +NS_IMETHODIMP +nsSVGLength::GetValueString(nsAWritableString& aValue) +{ + return GetValueAsString(aValue); +} + +//---------------------------------------------------------------------- +// 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 * ViewportDimension() / 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 / ViewportDimension(); + 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(nsAWritableString & aValueAsString) +{ + aValueAsString.Truncate(); + + char buf[80]; + sprintf(buf, "%g", (double)mValueInSpecifiedUnits); + aValueAsString.Append(NS_ConvertASCIItoUCS2(buf)); + + nsAutoString unitString; + GetUnitString(unitString); + aValueAsString.Append(unitString); + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGLength::SetValueAsString(const nsAReadableString & aValueAsString) +{ + nsresult rv = NS_OK; + + // XXX how am I supposed to do this ??? + // char* str = aValue.ToNewCString(); + char* str; + { + nsAutoString temp(aValueAsString); + str = ToNewCString(temp); + } + + 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 = ??? + } + } + else { // parse error + // no number + // rv = NS_ERROR_???; + } + } + + 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; + + WillModify(); + mValueInSpecifiedUnits = valueInSpecifiedUnits; + mSpecifiedUnitType = unitType; + DidModify(); + + return NS_OK; +} + +/* void convertToSpecifiedUnits (in unsigned short unitType); */ +NS_IMETHODIMP +nsSVGLength::ConvertToSpecifiedUnits(PRUint16 unitType) +{ + if (!IsValidUnitType(unitType)) return NS_ERROR_FAILURE; + + WillModify(); + + float valueInUserUnits; + GetValue(&valueInUserUnits); + mSpecifiedUnitType = unitType; + SetValue(valueInUserUnits); + + 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 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; +} + + +//---------------------------------------------------------------------- +// 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 locatable; +// locatable = do_QueryInterface(mOwnerElement); +// if (!locatable) return UUPerPx; + +// nsCOMPtr matrix; +// locatable->GetCTM( getter_AddRefs(matrix) ); +// if (!matrix) return UUPerPx; + +// nsCOMPtr 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() +{ + float mmPerPx = 0.28f; // 90dpi by default + + if (!mOwnerElementRef) return mmPerPx; + nsCOMPtr ownerElement = do_QueryReferent(mOwnerElementRef); + if (!ownerElement) return mmPerPx; + + nsCOMPtr SVGElement; + ownerElement->GetOwnerSVGElement(getter_AddRefs(SVGElement)); + if (!SVGElement) { // maybe our owner is the svg element... + SVGElement = do_QueryInterface(ownerElement); + } + + if (!SVGElement) return mmPerPx; + + switch (mDirection) { + case eXDirection: + SVGElement->GetPixelUnitToMillimeterX(&mmPerPx); + break; + case eYDirection: + SVGElement->GetPixelUnitToMillimeterY(&mmPerPx); + break; + case eNoDirection: + { + float x,y; + SVGElement->GetPixelUnitToMillimeterX(&x); + SVGElement->GetPixelUnitToMillimeterY(&y); + mmPerPx = (x==y ? x : (x+y)/2); + break; + } + } + + if (mmPerPx == 0.0f) { + NS_ASSERTION(PR_FALSE, "invalid mm/pixels"); + mmPerPx = 1e-20f; // some small value + } + + return mmPerPx; +} + +float nsSVGLength::ViewportDimension() +{ + float d = 1e-20f; + + NS_ASSERTION(mOwnerElementRef, "need owner"); + if (!mOwnerElementRef) return d; + nsCOMPtr ownerElement = do_QueryReferent(mOwnerElementRef); + NS_ASSERTION(ownerElement, "need owner"); + if (!ownerElement) return d; + + // find element that establishes the current viewport: + nsCOMPtr vpElement; + ownerElement->GetViewportElement(getter_AddRefs(vpElement)); + if (!vpElement) { // maybe our owner is the outermost svg element... + vpElement = ownerElement; + } + + // only 'svg' elements establish explicit viewports ? XXX + nsCOMPtr SVGElement = do_QueryInterface(vpElement); + NS_ASSERTION(SVGElement, "need svg element to obtain vieport"); + if (!SVGElement) return d; + + nsCOMPtr vp; + SVGElement->GetViewport(getter_AddRefs(vp)); + if (!vp) return d; + + switch (mDirection) { + case eXDirection: + vp->GetWidth(&d); + break; + case eYDirection: + vp->GetHeight(&d); + break; + case eNoDirection: + { + float x,y; + vp->GetWidth(&x); + vp->GetHeight(&y); + d = (float) sqrt(x*x+y*y); + break; + } + } + + NS_ASSERTION(d!=0.0f, "zero viewport w/h?"); + + if (d == 0.0f) + d = 1e-20f; + return d; +} + +void nsSVGLength::GetUnitString(nsAWritableString& 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 unitAtom = NS_NewAtom(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; +} + +//////////////////////////////////////////////////////////////////////// +// Exported creation functions: + +nsresult +NS_NewSVGLength(nsIDOMSVGLength** result, + nsIDOMSVGElement* owner, + nsSVGLengthDirection dir, + float value, + PRUint16 unit) +{ + return nsSVGLength::Create(result, owner, value, unit, dir); +} diff --git a/content/svg/content/src/nsSVGLength.h b/content/svg/content/src/nsSVGLength.h new file mode 100644 index 000000000000..565621b34aa6 --- /dev/null +++ b/content/svg/content/src/nsSVGLength.h @@ -0,0 +1,60 @@ +/* -*- 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 (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 "nsIDOMSVGLength.h" +#include "nsIDOMSVGElement.h" + +enum nsSVGLengthDirection { eXDirection, eYDirection, eNoDirection }; + + +nsresult +NS_NewSVGLength(nsIDOMSVGLength** result, + nsIDOMSVGElement* owner, + nsSVGLengthDirection dir = eNoDirection, + float value=0.0f, + PRUint16 unit=nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER); + +// XXX we'll need this prototype-based stuff to support unsetting: +//nsresult NS_NewSVGLength(nsIDOMSVGLength** result, +// nsIDOMSVGLength* prototype); + + +#endif //__NS_SVGLENGTH_H__ diff --git a/content/svg/content/src/nsSVGLineElement.cpp b/content/svg/content/src/nsSVGLineElement.cpp new file mode 100644 index 000000000000..65b26de1f0fb --- /dev/null +++ b/content/svg/content/src/nsSVGLineElement.cpp @@ -0,0 +1,282 @@ +/* -*- 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 (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 "nsIDOMSVGLineElement.h" +#include "nsCOMPtr.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: + nsCOMPtr mX1; + nsCOMPtr mY1; + nsCOMPtr mX2; + nsCOMPtr 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 value = do_QueryInterface(mX1); + value->RemoveObserver(this); + } + if (mY1) { + nsCOMPtr value = do_QueryInterface(mY1); + value->RemoveObserver(this); + } + if (mX2) { + nsCOMPtr value = do_QueryInterface(mX2); + value->RemoveObserver(this); + } + if (mY2) { + nsCOMPtr 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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; +} diff --git a/content/svg/content/src/nsSVGMatrix.cpp b/content/svg/content/src/nsSVGMatrix.cpp new file mode 100644 index 000000000000..9365d4fd769e --- /dev/null +++ b/content/svg/content/src/nsSVGMatrix.cpp @@ -0,0 +1,351 @@ +/* -*- 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 (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 + +const double radPerDegree = 2.0*3.1415926535 / 360.0; + +nsresult +nsSVGMatrix::Create(nsIDOMSVGMatrix** aResult) +{ + *aResult = (nsIDOMSVGMatrix*) new nsSVGMatrix(); + 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) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// 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 nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGMatrix::GetValueString(nsAWritableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} diff --git a/content/svg/content/src/nsSVGMatrix.h b/content/svg/content/src/nsSVGMatrix.h new file mode 100644 index 000000000000..cb9722c85fca --- /dev/null +++ b/content/svg/content/src/nsSVGMatrix.h @@ -0,0 +1,76 @@ +/* -*- 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 (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: + static nsresult Create(nsIDOMSVGMatrix** aResult); + +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 nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mA, mB, mC, mD, mE, mF; +}; + + +#endif //__NS_SVGMATRIX_H__ diff --git a/content/svg/content/src/nsSVGPathDataParser.cpp b/content/svg/content/src/nsSVGPathDataParser.cpp new file mode 100644 index 000000000000..8d18e4697134 --- /dev/null +++ b/content/svg/content/src/nsSVGPathDataParser.cpp @@ -0,0 +1,1217 @@ +/* -*- 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 (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 "nsSVGPathDataParser.h" +#include "nsSVGPathSeg.h" +#include "prdtoa.h" + +//---------------------------------------------------------------------- +// helper macros +#define ENSURE_MATCHED(exp) { nsresult rv = exp; if (NS_FAILED(rv)) return rv; } + + +//---------------------------------------------------------------------- +// public interface + +nsSVGPathDataParser::nsSVGPathDataParser(nsIDOMSVGPathSegList* segList) + : mSegList(segList) +{ +} + +nsresult nsSVGPathDataParser::Parse(const char* str) +{ + nsresult rv = NS_OK; + inputpos = str; + getNextToken(); + rv = matchSvgPath(); + if (tokentype != END) + rv = NS_ERROR_FAILURE; // not all tokens were consumed + + return rv; +} + +//---------------------------------------------------------------------- +// helpers +nsresult nsSVGPathDataParser::AppendSegment(nsIDOMSVGPathSeg* seg) +{ + nsCOMPtr dummy; + return mSegList->AppendItem(seg, getter_AddRefs(dummy)); +} + + +void nsSVGPathDataParser::getNextToken() +{ + tokenpos = inputpos; + tokenval = *inputpos; + + switch (tokenval) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + tokentype = DIGIT; + break; + case '\x20': case '\x9': case '\xd': case '\xa': + tokentype = WSP; + break; + case ',': + tokentype = COMMA; + break; + case '+': case '-': + tokentype = SIGN; + break; + case '.': + tokentype = POINT; + break; + case '\0': + tokentype = END; + break; + default: + tokentype = OTHER; + } + + if (*inputpos != '\0') { + ++inputpos; + } +} + +void nsSVGPathDataParser::windBack(const char* pos) +{ + inputpos = pos; + getNextToken(); +} + +nsresult nsSVGPathDataParser::match(char tok) +{ + if (tokenval != tok) return NS_ERROR_FAILURE; + getNextToken(); + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchSvgPath() +{ + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + if (isTokenSubPathsStarter()) { + ENSURE_MATCHED(matchSubPaths()); + } + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchSubPaths() +{ + ENSURE_MATCHED(matchSubPath()); + + while (1) { + const char* pos = tokenpos; + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + if (isTokenSubPathStarter()) { + ENSURE_MATCHED(matchSubPath()); + } + else { + if (pos != tokenpos) windBack(pos); + break; + } + } + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenSubPathsStarter() +{ + return isTokenSubPathStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchSubPath() +{ + ENSURE_MATCHED(matchMoveto()); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + if (isTokenSubPathElementsStarter()) + ENSURE_MATCHED(matchSubPathElements()); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenSubPathStarter() +{ + return (tolower(tokenval) == 'm'); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchSubPathElements() +{ + ENSURE_MATCHED(matchSubPathElement()); + + while (1) { + const char* pos = tokenpos; + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + + if (isTokenSubPathElementStarter()) { + ENSURE_MATCHED(matchSubPathElement()); + } + else { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenSubPathElementsStarter() +{ + return isTokenSubPathElementStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchSubPathElement() +{ + switch (tolower(tokenval)) { + case 'z': + ENSURE_MATCHED(matchClosePath()); + break; + case 'l': + ENSURE_MATCHED(matchLineto()); + break; + case 'h': + ENSURE_MATCHED(matchHorizontalLineto()); + break; + case 'v': + ENSURE_MATCHED(matchVerticalLineto()); + break; + case 'c': + ENSURE_MATCHED(matchCurveto()); + break; + case 's': + ENSURE_MATCHED(matchSmoothCurveto()); + break; + case 'q': + ENSURE_MATCHED(matchQuadBezierCurveto()); + break; + case 't': + ENSURE_MATCHED(matchSmoothQuadBezierCurveto()); + break; + case 'a': + ENSURE_MATCHED(matchEllipticalArc()); + break; + default: + return NS_ERROR_FAILURE; + break; + } + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenSubPathElementStarter() +{ + switch (tolower(tokenval)) { + case 'z': case 'l': case 'h': case 'v': case 'c': + case 's': case 'q': case 't': case 'a': + return PR_TRUE; + break; + default: + return PR_FALSE; + break; + } + return PR_FALSE; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchMoveto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'M': + absCoords = PR_TRUE; + break; + case 'm': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchMovetoArgSeq(absCoords)); + + return NS_OK; +} + +// typedef nsresult MovetoSegCreationFunc(nsIDOMSVGPathSeg** res, float x, float y); +// MovetoSegCreationFunc *creationFunc; + + +nsresult nsSVGPathDataParser::matchMovetoArgSeq(PRBool absCoords) +{ + + float x, y; + ENSURE_MATCHED(matchCoordPair(&x, &y)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegMovetoAbs(getter_AddRefs(seg), x, y); + } + else { + rv = NS_NewSVGPathSegMovetoRel(getter_AddRefs(seg), x, y); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (isTokenLinetoArgSeqStarter()) { + ENSURE_MATCHED(matchLinetoArgSeq(absCoords)); + } + else { + if (pos != tokenpos) windBack(pos); + } + + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchClosePath() +{ + switch (tokenval) { + case 'Z': + case 'z': + getNextToken(); + break; + default: + return NS_ERROR_FAILURE; + } + + nsresult rv; + nsCOMPtr seg; + rv = NS_NewSVGPathSegClosePath(getter_AddRefs(seg)); + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchLineto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'L': + absCoords = PR_TRUE; + break; + case 'l': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchLinetoArgSeq(absCoords)); + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchLinetoArgSeq(PRBool absCoords) +{ + while(1) { + float x, y; + ENSURE_MATCHED(matchCoordPair(&x, &y)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegLinetoAbs(getter_AddRefs(seg), x, y); + } + else { + rv = NS_NewSVGPathSegLinetoRel(getter_AddRefs(seg), x, y); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenCoordPairStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenLinetoArgSeqStarter() +{ + return isTokenCoordPairStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchHorizontalLineto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'H': + absCoords = PR_TRUE; + break; + case 'h': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchHorizontalLinetoArgSeq(absCoords)); + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchHorizontalLinetoArgSeq(PRBool absCoords) +{ + while(1) { + float x; + ENSURE_MATCHED(matchCoord(&x)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegLinetoHorizontalAbs(getter_AddRefs(seg), x); + } + else { + rv = NS_NewSVGPathSegLinetoHorizontalRel(getter_AddRefs(seg), x); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenCoordStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchVerticalLineto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'V': + absCoords = PR_TRUE; + break; + case 'v': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchVerticalLinetoArgSeq(absCoords)); + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchVerticalLinetoArgSeq(PRBool absCoords) +{ + while(1) { + float y; + ENSURE_MATCHED(matchCoord(&y)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegLinetoVerticalAbs(getter_AddRefs(seg), y); + } + else { + rv = NS_NewSVGPathSegLinetoVerticalRel(getter_AddRefs(seg), y); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenCoordStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchCurveto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'C': + absCoords = PR_TRUE; + break; + case 'c': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchCurvetoArgSeq(absCoords)); + + return NS_OK; +} + + +nsresult nsSVGPathDataParser::matchCurvetoArgSeq(PRBool absCoords) +{ + while(1) { + float x, y, x1, y1, x2, y2; + ENSURE_MATCHED(matchCurvetoArg(&x, &y, &x1, &y1, &x2, &y2)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegCurvetoCubicAbs(getter_AddRefs(seg), x, y, x1, y1, x2, y2); + } + else { + rv = NS_NewSVGPathSegCurvetoCubicRel(getter_AddRefs(seg), x, y, x1, y1, x2, y2); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenCurvetoArgStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +nsresult +nsSVGPathDataParser::matchCurvetoArg(float* x, float* y, float* x1, + float* y1, float* x2, float* y2) +{ + ENSURE_MATCHED(matchCoordPair(x1, y1)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchCoordPair(x2, y2)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchCoordPair(x, y)); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenCurvetoArgStarter() +{ + return isTokenCoordPairStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchSmoothCurveto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'S': + absCoords = PR_TRUE; + break; + case 's': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchSmoothCurvetoArgSeq(absCoords)); + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchSmoothCurvetoArgSeq(PRBool absCoords) +{ + while(1) { + float x, y, x2, y2; + ENSURE_MATCHED(matchSmoothCurvetoArg(&x, &y, &x2, &y2)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegCurvetoCubicSmoothAbs(getter_AddRefs(seg), x, y, x2, y2); + } + else { + rv = NS_NewSVGPathSegCurvetoCubicSmoothRel(getter_AddRefs(seg), x, y, x2, y2); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenSmoothCurvetoArgStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchSmoothCurvetoArg(float* x, float* y, float* x2, float* y2) +{ + ENSURE_MATCHED(matchCoordPair(x2, y2)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchCoordPair(x, y)); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenSmoothCurvetoArgStarter() +{ + return isTokenCoordPairStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchQuadBezierCurveto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'Q': + absCoords = PR_TRUE; + break; + case 'q': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchQuadBezierCurvetoArgSeq(absCoords)); + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchQuadBezierCurvetoArgSeq(PRBool absCoords) +{ + while(1) { + float x, y, x1, y1; + ENSURE_MATCHED(matchQuadBezierCurvetoArg(&x, &y, &x1, &y1)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegCurvetoQuadraticAbs(getter_AddRefs(seg), x, y, x1, y1); + } + else { + rv = NS_NewSVGPathSegCurvetoQuadraticRel(getter_AddRefs(seg), x, y, x1, y1); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenQuadBezierCurvetoArgStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchQuadBezierCurvetoArg(float* x, float* y, float* x1, float* y1) +{ + ENSURE_MATCHED(matchCoordPair(x1, y1)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchCoordPair(x, y)); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenQuadBezierCurvetoArgStarter() +{ + return isTokenCoordPairStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchSmoothQuadBezierCurveto() +{ + PRBool absCoords; + + switch (tokenval) { + case 'T': + absCoords = PR_TRUE; + break; + case 't': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchSmoothQuadBezierCurvetoArgSeq(absCoords)); + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchSmoothQuadBezierCurvetoArgSeq(PRBool absCoords) +{ + while(1) { + float x, y; + ENSURE_MATCHED(matchCoordPair(&x, &y)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(getter_AddRefs(seg), x, y); + } + else { + rv = NS_NewSVGPathSegCurvetoQuadraticSmoothRel(getter_AddRefs(seg), x, y); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenCoordPairStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchEllipticalArc() +{ + PRBool absCoords; + + switch (tokenval) { + case 'A': + absCoords = PR_TRUE; + break; + case 'a': + absCoords = PR_FALSE; + break; + default: + return NS_ERROR_FAILURE; + } + + getNextToken(); + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + + ENSURE_MATCHED(matchEllipticalArcArgSeq(absCoords)); + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchEllipticalArcArgSeq(PRBool absCoords) +{ + while(1) { + float x, y, r1, r2, angle; + PRBool largeArcFlag, sweepFlag; + + ENSURE_MATCHED(matchEllipticalArcArg(&x, &y, &r1, &r2, &angle, &largeArcFlag, &sweepFlag)); + + nsresult rv; + nsCOMPtr seg; + if (absCoords) { + rv = NS_NewSVGPathSegArcAbs(getter_AddRefs(seg), x, y, r1, r2, angle, + largeArcFlag, sweepFlag); + } + else { + rv = NS_NewSVGPathSegArcRel(getter_AddRefs(seg), x, y, r1, r2, angle, + largeArcFlag, sweepFlag); + } + if (NS_FAILED(rv)) return rv; + rv = AppendSegment(seg); + if (NS_FAILED(rv)) return rv; + + const char* pos = tokenpos; + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + if (!isTokenEllipticalArcArgStarter()) { + if (pos != tokenpos) windBack(pos); + return NS_OK; + } + } + + return NS_OK; +} + +nsresult nsSVGPathDataParser::matchEllipticalArcArg(float* x, float* y, + float* r1, float* r2, float* angle, + PRBool* largeArcFlag, PRBool* sweepFlag) +{ + ENSURE_MATCHED(matchNonNegativeNumber(r1)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchNonNegativeNumber(r2)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchNumber(angle)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchFlag(largeArcFlag)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchFlag(sweepFlag)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchCoordPair(x, y)); + + return NS_OK; + +} + +PRBool nsSVGPathDataParser::isTokenEllipticalArcArgStarter() +{ + return isTokenNonNegativeNumberStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchCoordPair(float* x, float* y) +{ + ENSURE_MATCHED(matchCoord(x)); + + if (isTokenCommaWspStarter()) { + ENSURE_MATCHED(matchCommaWsp()); + } + + ENSURE_MATCHED(matchCoord(y)); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenCoordPairStarter() +{ + return isTokenCoordStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchCoord(float* x) +{ + ENSURE_MATCHED(matchNumber(x)); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenCoordStarter() +{ + return isTokenNumberStarter(); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchNonNegativeNumber(float* x) +{ + // XXX inefficient implementation. We probably hit the windback case + // often. + + const char* pos = tokenpos; + + nsresult rv = matchFloatingPointConst(); + + if (NS_FAILED(rv)) { + windBack(pos); + ENSURE_MATCHED(matchIntegerConst()); + } + + char* end; + *x = (float) PR_strtod(pos, &end); + NS_ASSERTION(end == tokenpos, "number parse error"); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenNonNegativeNumberStarter() +{ + return (tokentype == DIGIT || tokentype == POINT); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchNumber(float* x) +{ + const char* pos = tokenpos; + + if (tokentype == SIGN) + getNextToken(); + + const char* pos2 = tokenpos; + + nsresult rv = matchFloatingPointConst(); + + if (NS_FAILED(rv)) { + windBack(pos); + ENSURE_MATCHED(matchIntegerConst()); + } + + char* end; + *x = (float) PR_strtod(pos, &end); + NS_ASSERTION(end == tokenpos, "number parse error"); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenNumberStarter() +{ + return (tokentype == DIGIT || tokentype == POINT || tokentype == SIGN); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchFlag(PRBool* f) +{ + switch (tokenval) { + case '0': + *f = PR_FALSE; + break; + case '1': + *f = PR_TRUE; + break; + default: + return NS_ERROR_FAILURE; + } + getNextToken(); + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchCommaWsp() +{ + switch (tokentype) { + case WSP: + ENSURE_MATCHED(matchWsp()); + if (tokentype == COMMA) + getNextToken(); + break; + case COMMA: + getNextToken(); + break; + default: + return NS_ERROR_FAILURE; + } + + while (isTokenWspStarter()) { + ENSURE_MATCHED(matchWsp()); + } + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenCommaWspStarter() +{ + return (isTokenWspStarter() || tokentype == COMMA); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchIntegerConst() +{ + ENSURE_MATCHED(matchDigitSeq()); + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchFloatingPointConst() +{ + // XXX inefficient implementation. It would be nice if we could make + // this predictive and wouldn't have to backtrack... + + const char* pos = tokenpos; + + nsresult rv = matchFractConst(); + if (NS_SUCCEEDED(rv)) { + if (isTokenExponentStarter()) + ENSURE_MATCHED(matchExponent()); + } + else { + windBack(pos); + ENSURE_MATCHED(matchDigitSeq()); + ENSURE_MATCHED(matchExponent()); + } + + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchFractConst() +{ + if (tokentype == POINT) { + getNextToken(); + ENSURE_MATCHED(matchDigitSeq()); + } + else { + ENSURE_MATCHED(matchDigitSeq()); + if (tokentype == POINT) { + getNextToken(); + if (isTokenDigitSeqStarter()) { + ENSURE_MATCHED(matchDigitSeq()); + } + } + } + return NS_OK; +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchExponent() +{ + if (!(tolower(tokenval) == 'e')) return NS_ERROR_FAILURE; + + getNextToken(); + + if (tokentype == SIGN) + getNextToken(); + + ENSURE_MATCHED(matchDigitSeq()); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenExponentStarter() +{ + return (tolower(tokenval) == 'e'); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchDigitSeq() +{ + if (!(tokentype == DIGIT)) return NS_ERROR_FAILURE; + + do { + getNextToken(); + } while (tokentype == DIGIT); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenDigitSeqStarter() +{ + return (tokentype == DIGIT); +} + +//---------------------------------------------------------------------- + +nsresult nsSVGPathDataParser::matchWsp() +{ + if (!(tokentype == WSP)) return NS_ERROR_FAILURE; + + do { + getNextToken(); + } while (tokentype == WSP); + + return NS_OK; +} + +PRBool nsSVGPathDataParser::isTokenWspStarter() +{ + return (tokentype == WSP); +} + diff --git a/content/svg/content/src/nsSVGPathDataParser.h b/content/svg/content/src/nsSVGPathDataParser.h new file mode 100644 index 000000000000..46ab2e36bb7c --- /dev/null +++ b/content/svg/content/src/nsSVGPathDataParser.h @@ -0,0 +1,163 @@ +/* -*- 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 (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 "nsIDOMSVGPathSegList.h" + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathDataParser: a simple recurvice 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(nsIDOMSVGPathSegList* segList); + nsresult Parse(const char* str); + +protected: + const char* inputpos; + + char tokenval; + const char* tokenpos; + enum { DIGIT, WSP, COMMA, POINT, SIGN, OTHER, END } tokentype; + + nsCOMPtr mSegList; + + + // 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__ diff --git a/content/svg/content/src/nsSVGPathElement.cpp b/content/svg/content/src/nsSVGPathElement.cpp new file mode 100644 index 000000000000..d76384ab1761 --- /dev/null +++ b/content/svg/content/src/nsSVGPathElement.cpp @@ -0,0 +1,384 @@ +/* -*- 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 (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 "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 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 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_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegMovetoAbs createSVGPathSegMovetoAbs (in float x, in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegMovetoAbs(float x, float y, nsIDOMSVGPathSegMovetoAbs **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegMovetoRel createSVGPathSegMovetoRel (in float x, in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegMovetoRel(float x, float y, nsIDOMSVGPathSegMovetoRel **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegLinetoAbs createSVGPathSegLinetoAbs (in float x, in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegLinetoAbs(float x, float y, nsIDOMSVGPathSegLinetoAbs **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegLinetoRel createSVGPathSegLinetoRel (in float x, in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegLinetoRel(float x, float y, nsIDOMSVGPathSegLinetoRel **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs (in float x); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegLinetoHorizontalAbs(float x, nsIDOMSVGPathSegLinetoHorizontalAbs **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel (in float x); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegLinetoHorizontalRel(float x, nsIDOMSVGPathSegLinetoHorizontalRel **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs (in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegLinetoVerticalAbs(float y, nsIDOMSVGPathSegLinetoVerticalAbs **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel (in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegLinetoVerticalRel(float y, nsIDOMSVGPathSegLinetoVerticalRel **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* 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_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs (in float x, in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel (in float x, in float y); */ +NS_IMETHODIMP +nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, nsIDOMSVGPathSegCurvetoQuadraticSmoothRel **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + + +//---------------------------------------------------------------------- +// 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; +} diff --git a/content/svg/content/src/nsSVGPathSeg.cpp b/content/svg/content/src/nsSVGPathSeg.cpp new file mode 100644 index 000000000000..7a554dde4044 --- /dev/null +++ b/content/svg/content/src/nsSVGPathSeg.cpp @@ -0,0 +1,2442 @@ +/* -*- 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 (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 "nsSVGPathSeg.h" +#include "prdtoa.h" +#include "nsSVGValue.h" + +//---------------------------------------------------------------------- +// implementation helper macros + +#define NS_IMPL_NSIDOMSVGPATHSEG(cname, type, letter) \ +NS_IMETHODIMP \ +cname::GetPathSegType(PRUint16 *aPathSegType) \ +{ \ + *aPathSegType = type; \ + return NS_OK; \ +} \ + \ +NS_IMETHODIMP \ +cname::GetPathSegTypeAsLetter(nsAWritableString & aPathSegTypeAsLetter) \ +{ \ + aPathSegTypeAsLetter.Truncate(); \ + aPathSegTypeAsLetter.Append(NS_LITERAL_STRING(letter)); \ + return NS_OK; \ +} + +#define NS_IMPL_NSISUPPORTS_SVGPATHSEG(basename) \ +NS_IMPL_ADDREF(ns##basename) \ +NS_IMPL_RELEASE(ns##basename) \ + \ +NS_INTERFACE_MAP_BEGIN(ns##basename) \ + NS_INTERFACE_MAP_ENTRY(nsISVGValue) \ + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPathSeg) \ + NS_INTERFACE_MAP_ENTRY(nsIDOM##basename) \ + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(basename) \ + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue) \ +NS_INTERFACE_MAP_END + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegClosePath + +class nsSVGPathSegClosePath : public nsIDOMSVGPathSegClosePath, + public nsSVGValue +{ +public: + nsSVGPathSegClosePath(); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsIDOMSVGPathSegClosePath interface: + NS_DECL_NSIDOMSVGPATHSEGCLOSEPATH + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegClosePath(nsIDOMSVGPathSeg** result) +{ + nsSVGPathSegClosePath *ps = new nsSVGPathSegClosePath(); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegClosePath::nsSVGPathSegClosePath() +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegClosePath) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegClosePath::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegClosePath::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + aValue.Append(NS_LITERAL_STRING("z")); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegClosePath, PATHSEG_CLOSEPATH, "z"); + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegMovetoAbs + +class nsSVGPathSegMovetoAbs : public nsIDOMSVGPathSegMovetoAbs, + public nsSVGValue +{ +public: + nsSVGPathSegMovetoAbs(float x, float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegMovetoAbs interface: + NS_DECL_NSIDOMSVGPATHSEGMOVETOABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegMovetoAbs(nsIDOMSVGPathSeg** result, + float x, float y) +{ + nsSVGPathSegMovetoAbs *ps = new nsSVGPathSegMovetoAbs(x, y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegMovetoAbs::nsSVGPathSegMovetoAbs(float x, float y) + : mX(x), mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegMovetoAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegMovetoAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegMovetoAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[80]; + sprintf(buf, "M%g,%g", mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegMovetoAbs, PATHSEG_MOVETO_ABS, "M"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegMovetoAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegMovetoAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegMovetoAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegMovetoAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegMovetoAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegMovetoRel + +class nsSVGPathSegMovetoRel : public nsIDOMSVGPathSegMovetoRel, + public nsSVGValue +{ +public: + nsSVGPathSegMovetoRel(float x, float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegMovetoRel interface: + NS_DECL_NSIDOMSVGPATHSEGMOVETOREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegMovetoRel(nsIDOMSVGPathSeg** result, + float x, float y) +{ + nsSVGPathSegMovetoRel *ps = new nsSVGPathSegMovetoRel(x, y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegMovetoRel::nsSVGPathSegMovetoRel(float x, float y) + : mX(x), mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegMovetoRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegMovetoRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegMovetoRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[80]; + sprintf(buf, "m%g,%g", mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegMovetoRel, PATHSEG_MOVETO_REL, "m"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegMovetoRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegMovetoRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegMovetoRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegMovetoRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegMovetoRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegLinetoAbs + +class nsSVGPathSegLinetoAbs : public nsIDOMSVGPathSegLinetoAbs, + public nsSVGValue +{ +public: + nsSVGPathSegLinetoAbs(float x, float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegLinetoAbs interface: + NS_DECL_NSIDOMSVGPATHSEGLINETOABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegLinetoAbs(nsIDOMSVGPathSeg** result, + float x, float y) +{ + nsSVGPathSegLinetoAbs *ps = new nsSVGPathSegLinetoAbs(x, y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegLinetoAbs::nsSVGPathSegLinetoAbs(float x, float y) + : mX(x), mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegLinetoAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegLinetoAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegLinetoAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[80]; + sprintf(buf, "L%g,%g", mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegLinetoAbs, PATHSEG_LINETO_ABS, "L"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegLinetoAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegLinetoAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegLinetoAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegLinetoRel + +class nsSVGPathSegLinetoRel : public nsIDOMSVGPathSegLinetoRel, + public nsSVGValue +{ +public: + nsSVGPathSegLinetoRel(float x, float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegLinetoRel interface: + NS_DECL_NSIDOMSVGPATHSEGLINETOREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegLinetoRel(nsIDOMSVGPathSeg** result, + float x, float y) +{ + nsSVGPathSegLinetoRel *ps = new nsSVGPathSegLinetoRel(x, y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegLinetoRel::nsSVGPathSegLinetoRel(float x, float y) + : mX(x), mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegLinetoRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegLinetoRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegLinetoRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[80]; + sprintf(buf, "l%g,%g", mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegLinetoRel, PATHSEG_LINETO_REL, "l"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegLinetoRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegLinetoRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegLinetoRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoCubicAbs + +class nsSVGPathSegCurvetoCubicAbs : public nsIDOMSVGPathSegCurvetoCubicAbs, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoCubicAbs(float x, float y, + float x1, float y1, + float x2, float y2); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoCubicAbs interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mX1, mY1, mX2, mY2; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoCubicAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1, + float x2, float y2) +{ + nsSVGPathSegCurvetoCubicAbs *ps = new nsSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoCubicAbs::nsSVGPathSegCurvetoCubicAbs(float x, float y, + float x1, float y1, + float x2, float y2) + : mX(x), mY(y), mX1(x1), mY1(y1), mX2(x2), mY2(y2) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoCubicAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "C%g,%g %g,%g %g,%g", mX1, mY1, mX2, mY2, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoCubicAbs, PATHSEG_CURVETO_CUBIC_ABS, "C"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoCubicAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float x1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::GetX1(float *aX1) +{ + *aX1 = mX1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::SetX1(float aX1) +{ + WillModify(); + mX1 = aX1; + DidModify(); + return NS_OK; +} + +/* attribute float y1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::GetY1(float *aY1) +{ + *aY1 = mY1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::SetY1(float aY1) +{ + WillModify(); + mY1 = aY1; + DidModify(); + return NS_OK; +} + +/* attribute float x2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::GetX2(float *aX2) +{ + *aX2 = mX2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::SetX2(float aX2) +{ + WillModify(); + mX2 = aX2; + DidModify(); + return NS_OK; +} + +/* attribute float y2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::GetY2(float *aY2) +{ + *aY2 = mY2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicAbs::SetY2(float aY2) +{ + WillModify(); + mY2 = aY2; + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoCubicRel + +class nsSVGPathSegCurvetoCubicRel : public nsIDOMSVGPathSegCurvetoCubicRel, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoCubicRel(float x, float y, + float x1, float y1, + float x2, float y2); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoCubicRel interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mX1, mY1, mX2, mY2; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoCubicRel(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1, + float x2, float y2) +{ + nsSVGPathSegCurvetoCubicRel *ps = new nsSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoCubicRel::nsSVGPathSegCurvetoCubicRel(float x, float y, + float x1, float y1, + float x2, float y2) + : mX(x), mY(y), mX1(x1), mY1(y1), mX2(x2), mY2(y2) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoCubicRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "c%g,%g %g,%g %g,%g", mX1, mY1, mX2, mY2, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoCubicRel, PATHSEG_CURVETO_CUBIC_REL, "c"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoCubicRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float x1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::GetX1(float *aX1) +{ + *aX1 = mX1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::SetX1(float aX1) +{ + WillModify(); + mX1 = aX1; + DidModify(); + return NS_OK; +} + +/* attribute float y1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::GetY1(float *aY1) +{ + *aY1 = mY1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::SetY1(float aY1) +{ + WillModify(); + mY1 = aY1; + DidModify(); + return NS_OK; +} + +/* attribute float x2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::GetX2(float *aX2) +{ + *aX2 = mX2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::SetX2(float aX2) +{ + WillModify(); + mX2 = aX2; + DidModify(); + return NS_OK; +} + +/* attribute float y2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::GetY2(float *aY2) +{ + *aY2 = mY2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicRel::SetY2(float aY2) +{ + WillModify(); + mY2 = aY2; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoQuadraticAbs + +class nsSVGPathSegCurvetoQuadraticAbs : public nsIDOMSVGPathSegCurvetoQuadraticAbs, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoQuadraticAbs(float x, float y, + float x1, float y1); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoQuadraticAbs interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mX1, mY1; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoQuadraticAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1) +{ + nsSVGPathSegCurvetoQuadraticAbs *ps = new nsSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoQuadraticAbs::nsSVGPathSegCurvetoQuadraticAbs(float x, float y, + float x1, float y1) + : mX(x), mY(y), mX1(x1), mY1(y1) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoQuadraticAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "Q%g,%g %g,%g", mX1, mY1, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoQuadraticAbs, PATHSEG_CURVETO_QUADRATIC_ABS, "Q"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoQuadraticAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float x1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::GetX1(float *aX1) +{ + *aX1 = mX1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::SetX1(float aX1) +{ + WillModify(); + mX1 = aX1; + DidModify(); + return NS_OK; +} + +/* attribute float y1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::GetY1(float *aY1) +{ + *aY1 = mY1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticAbs::SetY1(float aY1) +{ + WillModify(); + mY1 = aY1; + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoQuadraticRel + +class nsSVGPathSegCurvetoQuadraticRel : public nsIDOMSVGPathSegCurvetoQuadraticRel, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoQuadraticRel(float x, float y, + float x1, float y1); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoQuadraticRel interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mX1, mY1; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoQuadraticRel(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1) +{ + nsSVGPathSegCurvetoQuadraticRel *ps = new nsSVGPathSegCurvetoQuadraticRel(x, y, x1, y1); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoQuadraticRel::nsSVGPathSegCurvetoQuadraticRel(float x, float y, + float x1, float y1) + : mX(x), mY(y), mX1(x1), mY1(y1) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoQuadraticRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "q%g,%g %g,%g", mX1, mY1, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoQuadraticRel, PATHSEG_CURVETO_QUADRATIC_REL, "q"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoQuadraticRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float x1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::GetX1(float *aX1) +{ + *aX1 = mX1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::SetX1(float aX1) +{ + WillModify(); + mX1 = aX1; + DidModify(); + return NS_OK; +} + +/* attribute float y1; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::GetY1(float *aY1) +{ + *aY1 = mY1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticRel::SetY1(float aY1) +{ + WillModify(); + mY1 = aY1; + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegArcAbs + +class nsSVGPathSegArcAbs : public nsIDOMSVGPathSegArcAbs, + public nsSVGValue +{ +public: + nsSVGPathSegArcAbs(float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegArcAbs interface: + NS_DECL_NSIDOMSVGPATHSEGARCABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mR1, mR2, mAngle; + PRBool mLargeArcFlag, mSweepFlag; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegArcAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag) +{ + nsSVGPathSegArcAbs *ps = new nsSVGPathSegArcAbs(x, y, r1, r2, angle, + largeArcFlag, sweepFlag); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegArcAbs::nsSVGPathSegArcAbs(float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag) + : mX(x), mY(y), mR1(r1), mR2(r2), mAngle(angle), + mLargeArcFlag(largeArcFlag), mSweepFlag(sweepFlag) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegArcAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegArcAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegArcAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "A%g,%g %g %d,%d %g,%g", mR1, mR2, + mAngle, mLargeArcFlag, mSweepFlag, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegArcAbs, PATHSEG_ARC_ABS, "A"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegArcAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegArcAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegArcAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float r1; */ +NS_IMETHODIMP nsSVGPathSegArcAbs::GetR1(float *aR1) +{ + *aR1 = mR1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcAbs::SetR1(float aR1) +{ + WillModify(); + mR1 = aR1; + DidModify(); + return NS_OK; +} + +/* attribute float r2; */ +NS_IMETHODIMP nsSVGPathSegArcAbs::GetR2(float *aR2) +{ + *aR2 = mR2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcAbs::SetR2(float aR2) +{ + WillModify(); + mR2 = aR2; + DidModify(); + return NS_OK; +} + + +/* attribute float angle; */ +NS_IMETHODIMP nsSVGPathSegArcAbs::GetAngle(float *aAngle) +{ + *aAngle = mAngle; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcAbs::SetAngle(float aAngle) +{ + WillModify(); + mAngle = aAngle; + DidModify(); + return NS_OK; +} + +/* attribute boolean largeArcFlag; */ +NS_IMETHODIMP nsSVGPathSegArcAbs::GetLargeArcFlag(PRBool *aLargeArcFlag) +{ + *aLargeArcFlag = mLargeArcFlag; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcAbs::SetLargeArcFlag(PRBool aLargeArcFlag) +{ + WillModify(); + mLargeArcFlag = aLargeArcFlag; + DidModify(); + return NS_OK; +} + +/* attribute boolean sweepFlag; */ +NS_IMETHODIMP nsSVGPathSegArcAbs::GetSweepFlag(PRBool *aSweepFlag) +{ + *aSweepFlag = mSweepFlag; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcAbs::SetSweepFlag(PRBool aSweepFlag) +{ + WillModify(); + mSweepFlag = aSweepFlag; + DidModify(); + return NS_OK; +} + + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegArcRel + +class nsSVGPathSegArcRel : public nsIDOMSVGPathSegArcRel, + public nsSVGValue +{ +public: + nsSVGPathSegArcRel(float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegArcRel interface: + NS_DECL_NSIDOMSVGPATHSEGARCREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mR1, mR2, mAngle; + PRBool mLargeArcFlag, mSweepFlag; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegArcRel(nsIDOMSVGPathSeg** result, + float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag) +{ + nsSVGPathSegArcRel *ps = new nsSVGPathSegArcRel(x, y, r1, r2, angle, + largeArcFlag, sweepFlag); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegArcRel::nsSVGPathSegArcRel(float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag) + : mX(x), mY(y), mR1(r1), mR2(r2), mAngle(angle), + mLargeArcFlag(largeArcFlag), mSweepFlag(sweepFlag) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegArcRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegArcRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegArcRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "a%g,%g %g %d,%d %g,%g", mR1, mR2, + mAngle, mLargeArcFlag, mSweepFlag, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegArcRel, PATHSEG_ARC_REL, "a"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegArcRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegArcRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegArcRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float r1; */ +NS_IMETHODIMP nsSVGPathSegArcRel::GetR1(float *aR1) +{ + *aR1 = mR1; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcRel::SetR1(float aR1) +{ + WillModify(); + mR1 = aR1; + DidModify(); + return NS_OK; +} + +/* attribute float r2; */ +NS_IMETHODIMP nsSVGPathSegArcRel::GetR2(float *aR2) +{ + *aR2 = mR2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcRel::SetR2(float aR2) +{ + WillModify(); + mR2 = aR2; + DidModify(); + return NS_OK; +} + + +/* attribute float angle; */ +NS_IMETHODIMP nsSVGPathSegArcRel::GetAngle(float *aAngle) +{ + *aAngle = mAngle; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcRel::SetAngle(float aAngle) +{ + WillModify(); + mAngle = aAngle; + DidModify(); + return NS_OK; +} + +/* attribute boolean largeArcFlag; */ +NS_IMETHODIMP nsSVGPathSegArcRel::GetLargeArcFlag(PRBool *aLargeArcFlag) +{ + *aLargeArcFlag = mLargeArcFlag; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcRel::SetLargeArcFlag(PRBool aLargeArcFlag) +{ + WillModify(); + mLargeArcFlag = aLargeArcFlag; + DidModify(); + return NS_OK; +} + +/* attribute boolean sweepFlag; */ +NS_IMETHODIMP nsSVGPathSegArcRel::GetSweepFlag(PRBool *aSweepFlag) +{ + *aSweepFlag = mSweepFlag; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegArcRel::SetSweepFlag(PRBool aSweepFlag) +{ + WillModify(); + mSweepFlag = aSweepFlag; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegLinetoHorizontalAbs + +class nsSVGPathSegLinetoHorizontalAbs : public nsIDOMSVGPathSegLinetoHorizontalAbs, + public nsSVGValue +{ +public: + nsSVGPathSegLinetoHorizontalAbs(float x); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegLinetoHorizontalAbs interface: + NS_DECL_NSIDOMSVGPATHSEGLINETOHORIZONTALABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegLinetoHorizontalAbs(nsIDOMSVGPathSeg** result, float x) +{ + nsSVGPathSegLinetoHorizontalAbs *ps = new nsSVGPathSegLinetoHorizontalAbs(x); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegLinetoHorizontalAbs::nsSVGPathSegLinetoHorizontalAbs(float x) + : mX(x) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegLinetoHorizontalAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegLinetoHorizontalAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegLinetoHorizontalAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "H%g", mX); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegLinetoHorizontalAbs, PATHSEG_LINETO_HORIZONTAL_ABS, "H"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegLinetoHorizontalAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegLinetoHorizontalAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoHorizontalAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegLinetoHorizontalRel + +class nsSVGPathSegLinetoHorizontalRel : public nsIDOMSVGPathSegLinetoHorizontalRel, + public nsSVGValue +{ +public: + nsSVGPathSegLinetoHorizontalRel(float x); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegLinetoHorizontalRel interface: + NS_DECL_NSIDOMSVGPATHSEGLINETOHORIZONTALREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegLinetoHorizontalRel(nsIDOMSVGPathSeg** result, float x) +{ + nsSVGPathSegLinetoHorizontalRel *ps = new nsSVGPathSegLinetoHorizontalRel(x); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegLinetoHorizontalRel::nsSVGPathSegLinetoHorizontalRel(float x) + : mX(x) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegLinetoHorizontalRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegLinetoHorizontalRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegLinetoHorizontalRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "h%g", mX); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegLinetoHorizontalRel, PATHSEG_LINETO_HORIZONTAL_REL, "h"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegLinetoHorizontalRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegLinetoHorizontalRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoHorizontalRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegLinetoVerticalAbs + +class nsSVGPathSegLinetoVerticalAbs : public nsIDOMSVGPathSegLinetoVerticalAbs, + public nsSVGValue +{ +public: + nsSVGPathSegLinetoVerticalAbs(float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegLinetoVerticalAbs interface: + NS_DECL_NSIDOMSVGPATHSEGLINETOVERTICALABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegLinetoVerticalAbs(nsIDOMSVGPathSeg** result, float y) +{ + nsSVGPathSegLinetoVerticalAbs *ps = new nsSVGPathSegLinetoVerticalAbs(y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegLinetoVerticalAbs::nsSVGPathSegLinetoVerticalAbs(float y) + : mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegLinetoVerticalAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegLinetoVerticalAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegLinetoVerticalAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "V%g", mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegLinetoVerticalAbs, PATHSEG_LINETO_VERTICAL_ABS, "V"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegLinetoVerticalAbs methods: + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegLinetoVerticalAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoVerticalAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegLinetoVerticalRel + +class nsSVGPathSegLinetoVerticalRel : public nsIDOMSVGPathSegLinetoVerticalRel, + public nsSVGValue +{ +public: + nsSVGPathSegLinetoVerticalRel(float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegLinetoVerticalRel interface: + NS_DECL_NSIDOMSVGPATHSEGLINETOVERTICALREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegLinetoVerticalRel(nsIDOMSVGPathSeg** result, float y) +{ + nsSVGPathSegLinetoVerticalRel *ps = new nsSVGPathSegLinetoVerticalRel(y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegLinetoVerticalRel::nsSVGPathSegLinetoVerticalRel(float y) + : mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegLinetoVerticalRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegLinetoVerticalRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegLinetoVerticalRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "v%g", mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegLinetoVerticalRel, PATHSEG_LINETO_VERTICAL_REL, "v"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegLinetoVerticalRel methods: + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegLinetoVerticalRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegLinetoVerticalRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoCubicSmoothAbs + +class nsSVGPathSegCurvetoCubicSmoothAbs : public nsIDOMSVGPathSegCurvetoCubicSmoothAbs, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoCubicSmoothAbs(float x, float y, + float x2, float y2); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoCubicSmoothAbs interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICSMOOTHABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mX2, mY2; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoCubicSmoothAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float x2, float y2) +{ + nsSVGPathSegCurvetoCubicSmoothAbs *ps = new nsSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoCubicSmoothAbs::nsSVGPathSegCurvetoCubicSmoothAbs(float x, float y, + float x2, float y2) + : mX(x), mY(y), mX2(x2), mY2(y2) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoCubicSmoothAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicSmoothAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicSmoothAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "S%g,%g %g,%g", mX2, mY2, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoCubicSmoothAbs, PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, "S"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoCubicSmoothAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float x2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::GetX2(float *aX2) +{ + *aX2 = mX2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::SetX2(float aX2) +{ + WillModify(); + mX2 = aX2; + DidModify(); + return NS_OK; +} + +/* attribute float y2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::GetY2(float *aY2) +{ + *aY2 = mY2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothAbs::SetY2(float aY2) +{ + WillModify(); + mY2 = aY2; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoCubicSmoothRel + +class nsSVGPathSegCurvetoCubicSmoothRel : public nsIDOMSVGPathSegCurvetoCubicSmoothRel, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoCubicSmoothRel(float x, float y, + float x2, float y2); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoCubicSmoothRel interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOCUBICSMOOTHREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY, mX2, mY2; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoCubicSmoothRel(nsIDOMSVGPathSeg** result, + float x, float y, + float x2, float y2) +{ + nsSVGPathSegCurvetoCubicSmoothRel *ps = new nsSVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoCubicSmoothRel::nsSVGPathSegCurvetoCubicSmoothRel(float x, float y, + float x2, float y2) + : mX(x), mY(y), mX2(x2), mY2(y2) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoCubicSmoothRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicSmoothRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoCubicSmoothRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "s%g,%g %g,%g", mX2, mY2, mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoCubicSmoothRel, PATHSEG_CURVETO_CUBIC_SMOOTH_REL, "s"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoCubicSmoothRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +/* attribute float x2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::GetX2(float *aX2) +{ + *aX2 = mX2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::SetX2(float aX2) +{ + WillModify(); + mX2 = aX2; + DidModify(); + return NS_OK; +} + +/* attribute float y2; */ +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::GetY2(float *aY2) +{ + *aY2 = mY2; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoCubicSmoothRel::SetY2(float aY2) +{ + WillModify(); + mY2 = aY2; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoQuadraticSmoothAbs + +class nsSVGPathSegCurvetoQuadraticSmoothAbs : public nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICSMOOTHABS + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(nsIDOMSVGPathSeg** result, + float x, float y) +{ + nsSVGPathSegCurvetoQuadraticSmoothAbs *ps = new nsSVGPathSegCurvetoQuadraticSmoothAbs(x, y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoQuadraticSmoothAbs::nsSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y) + : mX(x), mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoQuadraticSmoothAbs) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticSmoothAbs::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticSmoothAbs::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "T%g,%g", mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoQuadraticSmoothAbs, PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, "T"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothAbs::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothAbs::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothAbs::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothAbs::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// +// nsSVGPathSegCurvetoQuadraticSmoothRel + +class nsSVGPathSegCurvetoQuadraticSmoothRel : public nsIDOMSVGPathSegCurvetoQuadraticSmoothRel, + public nsSVGValue +{ +public: + nsSVGPathSegCurvetoQuadraticSmoothRel(float x, float y); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPathSegCurvetoQuadraticSmoothRel interface: + NS_DECL_NSIDOMSVGPATHSEGCURVETOQUADRATICSMOOTHREL + + // nsIDOMSVGPathSeg interface: + NS_DECL_NSIDOMSVGPATHSEG + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX, mY; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathSegCurvetoQuadraticSmoothRel(nsIDOMSVGPathSeg** result, + float x, float y) +{ + nsSVGPathSegCurvetoQuadraticSmoothRel *ps = new nsSVGPathSegCurvetoQuadraticSmoothRel(x, y); + NS_ENSURE_TRUE(ps, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(ps); + *result = ps; + return NS_OK; +} + + +nsSVGPathSegCurvetoQuadraticSmoothRel::nsSVGPathSegCurvetoQuadraticSmoothRel(float x, float y) + : mX(x), mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: +NS_IMPL_NSISUPPORTS_SVGPATHSEG(SVGPathSegCurvetoQuadraticSmoothRel) + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticSmoothRel::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGPathSegCurvetoQuadraticSmoothRel::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + char buf[200]; + sprintf(buf, "t%g,%g", mX, mY); + aValue.Append(NS_ConvertASCIItoUCS2(buf)); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSeg methods: +NS_IMPL_NSIDOMSVGPATHSEG(nsSVGPathSegCurvetoQuadraticSmoothRel, PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "t"); + +//---------------------------------------------------------------------- +// nsIDOMSVGPathSegCurvetoQuadraticSmoothRel methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothRel::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothRel::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothRel::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPathSegCurvetoQuadraticSmoothRel::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + return NS_OK; +} + diff --git a/content/svg/content/src/nsSVGPathSeg.h b/content/svg/content/src/nsSVGPathSeg.h new file mode 100644 index 000000000000..e3ec1b0cc56c --- /dev/null +++ b/content/svg/content/src/nsSVGPathSeg.h @@ -0,0 +1,132 @@ +/* -*- 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 (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(nsIDOMSVGPathSeg** result); + +nsresult +NS_NewSVGPathSegMovetoAbs(nsIDOMSVGPathSeg** result, + float x, float y); + +nsresult +NS_NewSVGPathSegMovetoRel(nsIDOMSVGPathSeg** result, + float x, float y); + +nsresult +NS_NewSVGPathSegLinetoAbs(nsIDOMSVGPathSeg** result, + float x, float y); + +nsresult +NS_NewSVGPathSegLinetoRel(nsIDOMSVGPathSeg** result, + float x, float y); + +nsresult +NS_NewSVGPathSegCurvetoCubicAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1, + float x2, float y2); + +nsresult +NS_NewSVGPathSegCurvetoCubicRel(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1, + float x2, float y2); + +nsresult +NS_NewSVGPathSegCurvetoQuadraticAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1); + +nsresult +NS_NewSVGPathSegCurvetoQuadraticRel(nsIDOMSVGPathSeg** result, + float x, float y, + float x1, float y1); + +nsresult +NS_NewSVGPathSegArcAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag); + +nsresult +NS_NewSVGPathSegArcRel(nsIDOMSVGPathSeg** result, + float x, float y, + float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag); + +nsresult +NS_NewSVGPathSegLinetoHorizontalAbs(nsIDOMSVGPathSeg** result, + float x); + +nsresult +NS_NewSVGPathSegLinetoHorizontalRel(nsIDOMSVGPathSeg** result, + float x); + +nsresult +NS_NewSVGPathSegLinetoVerticalAbs(nsIDOMSVGPathSeg** result, + float y); + +nsresult +NS_NewSVGPathSegLinetoVerticalRel(nsIDOMSVGPathSeg** result, + float y); + +nsresult +NS_NewSVGPathSegCurvetoCubicSmoothAbs(nsIDOMSVGPathSeg** result, + float x, float y, + float x2, float y2); + +nsresult +NS_NewSVGPathSegCurvetoCubicSmoothRel(nsIDOMSVGPathSeg** result, + float x, float y, + float x2, float y2); + +nsresult +NS_NewSVGPathSegCurvetoQuadraticSmoothAbs(nsIDOMSVGPathSeg** result, + float x, float y); + +nsresult +NS_NewSVGPathSegCurvetoQuadraticSmoothRel(nsIDOMSVGPathSeg** result, + float x, float y); + + +#endif //__NS_SVGPATHSEG_H__ diff --git a/content/svg/content/src/nsSVGPathSegList.cpp b/content/svg/content/src/nsSVGPathSegList.cpp new file mode 100644 index 000000000000..814b4db4f57c --- /dev/null +++ b/content/svg/content/src/nsSVGPathSegList.cpp @@ -0,0 +1,362 @@ +/* -*- 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 (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 nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& 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(); + + nsAutoVoidArray mSegments; +}; + + +//---------------------------------------------------------------------- +// Implementation + +nsSVGPathSegList::nsSVGPathSegList() +{ + NS_INIT_ISUPPORTS(); +} + +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 nsAReadableString& aValue) +{ + WillModify(); + + ReleaseSegments(); + + nsresult rv = NS_OK; + + // XXX how am I supposed to do this ??? + // char* str = aValue.ToNewCString(); + char* str; + { + nsAutoString temp(aValue); + str = ToNewCString(temp); + } + + nsSVGPathDataParser parser(this); + rv = parser.Parse(str); + NS_ASSERTION(NS_SUCCEEDED(rv), "path data parse error!"); + nsMemory::Free(str); + + DidModify(); + return rv; + +} + +NS_IMETHODIMP +nsSVGPathSegList::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + PRInt32 count = mSegments.Count(); + + if (count<=0) return NS_OK; + + PRInt32 i = 0; + + while (1) { + nsIDOMSVGPathSeg* seg = ElementAt(i); + nsCOMPtr 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 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 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 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 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; +} + diff --git a/content/svg/content/src/nsSVGPathSegList.h b/content/svg/content/src/nsSVGPathSegList.h new file mode 100644 index 000000000000..b18ec9d29684 --- /dev/null +++ b/content/svg/content/src/nsSVGPathSegList.h @@ -0,0 +1,47 @@ +/* -*- 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 (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_SVGPATHSEGLIST_H__ +#define __NS_SVGPATHSEGLIST_H__ + +#include "nsIDOMSVGPathSegList.h" + +nsresult +NS_NewSVGPathSegList(nsIDOMSVGPathSegList** result); + +#endif //__NS_SVGPATHSEGLIST_H__ diff --git a/content/svg/content/src/nsSVGPoint.cpp b/content/svg/content/src/nsSVGPoint.cpp new file mode 100644 index 000000000000..c9f2e0f369da --- /dev/null +++ b/content/svg/content/src/nsSVGPoint.cpp @@ -0,0 +1,134 @@ +/* -*- 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 (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 "nsSVGPoint.h" +#include "nsIDOMSVGMatrix.h" + +nsresult +nsSVGPoint::Create(float x, float y, nsIDOMSVGPoint** aResult) +{ + *aResult = (nsIDOMSVGPoint*) new nsSVGPoint(x, y); + if(!*aResult) return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(*aResult); + return NS_OK; +} + +nsSVGPoint::nsSVGPoint(float x, float y) + : mX(x), mY(y) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: + +NS_IMPL_ADDREF(nsSVGPoint) +NS_IMPL_RELEASE(nsSVGPoint) + +NS_INTERFACE_MAP_BEGIN(nsSVGPoint) + NS_INTERFACE_MAP_ENTRY(nsISVGValue) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPoint) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPoint) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue) +NS_INTERFACE_MAP_END + +//---------------------------------------------------------------------- +// nsIDOMSVGPoint methods: + +/* attribute float x; */ +NS_IMETHODIMP nsSVGPoint::GetX(float *aX) +{ + *aX = mX; + return NS_OK; +} +NS_IMETHODIMP nsSVGPoint::SetX(float aX) +{ + WillModify(); + mX = aX; + DidModify(); + + return NS_OK; +} + +/* attribute float y; */ +NS_IMETHODIMP nsSVGPoint::GetY(float *aY) +{ + *aY = mY; + return NS_OK; +} +NS_IMETHODIMP nsSVGPoint::SetY(float aY) +{ + WillModify(); + mY = aY; + DidModify(); + + return NS_OK; +} + +/* nsIDOMSVGPoint matrixTransform (in nsIDOMSVGMatrix matrix); */ +NS_IMETHODIMP nsSVGPoint::MatrixTransform(nsIDOMSVGMatrix *matrix, nsIDOMSVGPoint **_retval) +{ + if (!matrix) return NS_ERROR_FAILURE; + + float a, b, c, d, e, f; + matrix->GetA(&a); + matrix->GetB(&b); + matrix->GetC(&c); + matrix->GetD(&d); + matrix->GetE(&e); + matrix->GetF(&f); + + return Create( a*mX + c*mY + e, b*mX + d*mY + f, _retval); +} + +//---------------------------------------------------------------------- +// nsISVGValue methods: +NS_IMETHODIMP +nsSVGPoint::SetValueString(const nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGPoint::GetValueString(nsAWritableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} diff --git a/content/svg/content/src/nsSVGPoint.h b/content/svg/content/src/nsSVGPoint.h new file mode 100644 index 000000000000..e9d36bfed89c --- /dev/null +++ b/content/svg/content/src/nsSVGPoint.h @@ -0,0 +1,72 @@ +/* -*- 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 (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_SVGPOINT_H__ +#define __NS_SVGPOINT_H__ + +#include "nsIDOMSVGPoint.h" +#include "nsSVGValue.h" + +class nsSVGPoint : public nsIDOMSVGPoint, + public nsSVGValue +{ +public: + static nsresult Create(float x, float y, nsIDOMSVGPoint** aResult); + +protected: + nsSVGPoint(float x, float y); + +public: + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPoint interface: + NS_DECL_NSIDOMSVGPOINT + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + float mX; + float mY; +}; + + +#endif //__NS_SVGPOINT_H__ diff --git a/content/svg/content/src/nsSVGPointList.cpp b/content/svg/content/src/nsSVGPointList.cpp new file mode 100644 index 000000000000..fedbc9b28277 --- /dev/null +++ b/content/svg/content/src/nsSVGPointList.cpp @@ -0,0 +1,336 @@ +/* -*- 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 (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" + +nsresult +nsSVGPointList::Create(const nsAReadableString& 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() +{ + NS_INIT_ISUPPORTS(); +} + +nsSVGPointList::~nsSVGPointList() +{ + ReleasePoints(); +} + +void +nsSVGPointList::ReleasePoints() +{ + WillModify(); + PRInt32 count = mPoints.Count(); + for (PRInt32 i = 0; i < count; ++i) { + nsIDOMSVGPoint* point = ElementAt(i); + nsCOMPtr 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 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 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 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 nsAReadableString& aValue) +{ + WillModify(); + + ReleasePoints(); + + nsresult rv = NS_OK; + + // XXX how am I supposed to do this ??? + // char* str = aValue.ToNewCString(); + char* str; + { + nsAutoString temp(aValue); + str = ToNewCString(temp); + } + + char* rest = str; + char* token1; + char* token2; + const char* delimiters = ",\x20\x9\xD\xA"; + + while ( (token1 = nsCRT::strtok(rest, delimiters, &rest)) && + (token2 = nsCRT::strtok(rest, delimiters, &rest)) ) { + + char *end; + + double x = PR_strtod(token1, &end); + if (*end != '\0') break; // parse error + + double y = PR_strtod(token2, &end); + if (*end != '\0') break; // parse error + + nsCOMPtr point; + nsSVGPoint::Create((float)x, (float)y, getter_AddRefs(point)); + if (!point) { + rv = NS_ERROR_OUT_OF_MEMORY; + break; + } + AppendElement(point); + } + + if (token1) { + // there was a parse error. should we return an error? + // rv = NS_ERROR_???; + } + + nsMemory::Free(str); + + DidModify(); + return rv; +} + +NS_IMETHODIMP +nsSVGPointList::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + PRInt32 count = mPoints.Count(); + + if (count<=0) return NS_OK; + + PRInt32 i = 0; + char buf[80]; + + while (1) { + nsIDOMSVGPoint* point = ElementAt(i); + float x, y; + point->GetX(&x); + point->GetY(&y); + + sprintf(buf, "%g,%g", (double)x, (double)y); + aValue.Append(NS_ConvertASCIItoUCS2(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; +} diff --git a/content/svg/content/src/nsSVGPointList.h b/content/svg/content/src/nsSVGPointList.h new file mode 100644 index 000000000000..29eb4943e52d --- /dev/null +++ b/content/svg/content/src/nsSVGPointList.h @@ -0,0 +1,94 @@ +/* -*- 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 (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_SVGPOINTLIST_H__ +#define __NS_SVGPOINTLIST_H__ + +#include "nsSVGValue.h" +#include "nsISVGValueObserver.h" +#include "nsWeakReference.h" +#include "nsIDOMSVGPointList.h" +#include "nsVoidArray.h" + + +class nsSVGPointList : public nsSVGValue, + public nsIDOMSVGPointList, + public nsISVGValueObserver, + public nsSupportsWeakReference +{ +public: + static nsresult Create(const nsAReadableString& aValue, nsISVGValue** aResult); + static nsresult Create(nsIDOMSVGPointList** aResult); + +protected: + nsSVGPointList(); + virtual ~nsSVGPointList(); + +public: + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGPointList interface: + NS_DECL_NSIDOMSVGPOINTLIST + + // remainder of nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + + + // other methods: + nsIDOMSVGPoint* ElementAt(PRInt32 index); + void AppendElement(nsIDOMSVGPoint* aElement); + void RemoveElementAt(PRInt32 index); + void InsertElementAt(nsIDOMSVGPoint* aElement, PRInt32 index); + +protected: + void ReleasePoints(); + + nsAutoVoidArray mPoints; +}; + + +#endif //__NS_SVGPOINTLIST_H__ diff --git a/content/svg/content/src/nsSVGPolygonElement.cpp b/content/svg/content/src/nsSVGPolygonElement.cpp new file mode 100644 index 000000000000..181f9cefbe2d --- /dev/null +++ b/content/svg/content/src/nsSVGPolygonElement.cpp @@ -0,0 +1,207 @@ +/* -*- 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 (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 "nsSVGPointList.h" +#include "nsIDOMSVGPolygonElement.h" +#include "nsIDOMSVGAnimatedPoints.h" +#include "nsCOMPtr.h" + +typedef nsSVGGraphicElement nsSVGPolygonElementBase; + +class nsSVGPolygonElement : public nsSVGPolygonElementBase, + public nsIDOMSVGPolygonElement, + public nsIDOMSVGAnimatedPoints +{ +protected: + friend nsresult NS_NewSVGPolygonElement(nsIContent **aResult, + nsINodeInfo *aNodeInfo); + nsSVGPolygonElement(); + virtual ~nsSVGPolygonElement(); + virtual nsresult Init(); + +public: + // interfaces: + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIDOMSVGPOLYGONELEMENT + NS_DECL_NSIDOMSVGANIMATEDPOINTS + + // xxx I wish we could use virtual inheritance + NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGPolygonElementBase::) + NS_FORWARD_NSIDOMELEMENT(nsSVGPolygonElementBase::) + NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolygonElementBase::) + +protected: + nsCOMPtr mPoints; +}; + + +nsresult NS_NewSVGPolygonElement(nsIContent **aResult, nsINodeInfo *aNodeInfo) +{ + *aResult = nsnull; + nsSVGPolygonElement* it = new nsSVGPolygonElement(); + + 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(nsSVGPolygonElement,nsSVGPolygonElementBase) +NS_IMPL_RELEASE_INHERITED(nsSVGPolygonElement,nsSVGPolygonElementBase) + +NS_INTERFACE_MAP_BEGIN(nsSVGPolygonElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPolygonElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedPoints) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPolygonElement) +NS_INTERFACE_MAP_END_INHERITING(nsSVGPolygonElementBase) + +//---------------------------------------------------------------------- +// Implementation + +nsSVGPolygonElement::nsSVGPolygonElement() +{ + +} + +nsSVGPolygonElement::~nsSVGPolygonElement() +{ + if (mPoints) { + nsCOMPtr value = do_QueryInterface(mPoints); + value->RemoveObserver(this); + } +} + + +nsresult +nsSVGPolygonElement::Init() +{ + nsresult rv; + rv = nsSVGPolygonElementBase::Init(); + NS_ENSURE_SUCCESS(rv,rv); + + // Create mapped properties: + + // points #IMPLIED + rv = nsSVGPointList::Create(getter_AddRefs(mPoints)); + NS_ENSURE_SUCCESS(rv,rv); + rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::points, mPoints); + NS_ENSURE_SUCCESS(rv,rv); + + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMNode methods + +NS_IMETHODIMP +nsSVGPolygonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +{ + *aReturn = nsnull; + nsSVGPolygonElement* it = new nsSVGPolygonElement(); + + 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(nsSVGPolygonElementBase*, it); + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsIDOMSGAnimatedPoints methods: + +/* readonly attribute nsIDOMSVGPointList points; */ +NS_IMETHODIMP nsSVGPolygonElement::GetPoints(nsIDOMSVGPointList * *aPoints) +{ + *aPoints = mPoints; + NS_ADDREF(*aPoints); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGPointList animatedPoints; */ +NS_IMETHODIMP nsSVGPolygonElement::GetAnimatedPoints(nsIDOMSVGPointList * *aAnimatedPoints) +{ + *aAnimatedPoints = mPoints; + NS_ADDREF(*aAnimatedPoints); + return NS_OK; +} diff --git a/content/svg/content/src/nsSVGPolylineElement.cpp b/content/svg/content/src/nsSVGPolylineElement.cpp new file mode 100644 index 000000000000..0580aca06b28 --- /dev/null +++ b/content/svg/content/src/nsSVGPolylineElement.cpp @@ -0,0 +1,206 @@ +/* -*- 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 (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 "nsSVGPointList.h" +#include "nsIDOMSVGPolylineElement.h" +#include "nsIDOMSVGAnimatedPoints.h" +#include "nsCOMPtr.h" + +typedef nsSVGGraphicElement nsSVGPolylineElementBase; + +class nsSVGPolylineElement : public nsSVGPolylineElementBase, + public nsIDOMSVGPolylineElement, + public nsIDOMSVGAnimatedPoints +{ +protected: + friend nsresult NS_NewSVGPolylineElement(nsIContent **aResult, + nsINodeInfo *aNodeInfo); + nsSVGPolylineElement(); + virtual ~nsSVGPolylineElement(); + virtual nsresult Init(); + +public: + // interfaces: + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIDOMSVGPOLYLINEELEMENT + NS_DECL_NSIDOMSVGANIMATEDPOINTS + + // xxx I wish we could use virtual inheritance + NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGPolylineElementBase::) + NS_FORWARD_NSIDOMELEMENT(nsSVGPolylineElementBase::) + NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPolylineElementBase::) + +protected: + nsCOMPtr mPoints; +}; + + +nsresult NS_NewSVGPolylineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo) +{ + *aResult = nsnull; + nsSVGPolylineElement* it = new nsSVGPolylineElement(); + + 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(nsSVGPolylineElement,nsSVGPolylineElementBase) +NS_IMPL_RELEASE_INHERITED(nsSVGPolylineElement,nsSVGPolylineElementBase) + +NS_INTERFACE_MAP_BEGIN(nsSVGPolylineElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPolylineElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedPoints) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPolylineElement) +NS_INTERFACE_MAP_END_INHERITING(nsSVGPolylineElementBase) + +//---------------------------------------------------------------------- +// Implementation + +nsSVGPolylineElement::nsSVGPolylineElement() +{ + +} + +nsSVGPolylineElement::~nsSVGPolylineElement() +{ + if (mPoints) { + nsCOMPtr value = do_QueryInterface(mPoints); + value->RemoveObserver(this); + } +} + + +nsresult +nsSVGPolylineElement::Init() +{ + nsresult rv; + rv = nsSVGPolylineElementBase::Init(); + NS_ENSURE_SUCCESS(rv,rv); + + // Create mapped properties: + + // points #IMPLIED + rv = nsSVGPointList::Create(getter_AddRefs(mPoints)); + NS_ENSURE_SUCCESS(rv,rv); + rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::points, mPoints); + NS_ENSURE_SUCCESS(rv,rv); + + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMNode methods + +NS_IMETHODIMP +nsSVGPolylineElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +{ + *aReturn = nsnull; + nsSVGPolylineElement* it = new nsSVGPolylineElement(); + + 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(nsSVGPolylineElementBase*, it); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMSGAnimatedPoints methods: + +/* readonly attribute nsIDOMSVGPointList points; */ +NS_IMETHODIMP nsSVGPolylineElement::GetPoints(nsIDOMSVGPointList * *aPoints) +{ + *aPoints = mPoints; + NS_ADDREF(*aPoints); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGPointList animatedPoints; */ +NS_IMETHODIMP nsSVGPolylineElement::GetAnimatedPoints(nsIDOMSVGPointList * *aAnimatedPoints) +{ + *aAnimatedPoints = mPoints; + NS_ADDREF(*aAnimatedPoints); + return NS_OK; +} diff --git a/content/svg/content/src/nsSVGRect.cpp b/content/svg/content/src/nsSVGRect.cpp new file mode 100644 index 000000000000..fa8c7f0ae3fc --- /dev/null +++ b/content/svg/content/src/nsSVGRect.cpp @@ -0,0 +1,371 @@ +/* -*- 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 (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" + +//////////////////////////////////////////////////////////////////////// +// 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 nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& 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) +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// 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 nsAReadableString& aValue) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsSVGRect::GetValueString(nsAWritableString& aValue) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +//---------------------------------------------------------------------- +// 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 nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + void EnsureBody(); + nsIDOMSVGRect* Delegate() { return mBody ? mBody.get() : mPrototype.get(); } + + nsCOMPtr mPrototype; + nsCOMPtr 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_INIT_ISUPPORTS(); + NS_ASSERTION(mPrototype, "need prototype"); +} + +nsSVGRectPrototypeWrapper::~nsSVGRectPrototypeWrapper() +{ +// if (mBody) { +// nsCOMPtr 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 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 nsAReadableString& aValue) +{ + EnsureBody(); + nsCOMPtr val = do_QueryInterface(mBody); + NS_ASSERTION(val, "missing interface on body"); + + return val->SetValueString(aValue); +} + +NS_IMETHODIMP +nsSVGRectPrototypeWrapper::GetValueString(nsAWritableString& aValue) +{ + nsCOMPtr 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); +} diff --git a/content/svg/content/src/nsSVGRect.h b/content/svg/content/src/nsSVGRect.h new file mode 100644 index 000000000000..d05f05c54274 --- /dev/null +++ b/content/svg/content/src/nsSVGRect.h @@ -0,0 +1,58 @@ +/* -*- 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 (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_SVGRECT_H__ +#define __NS_SVGRECT_H__ + +#include "nsIDOMSVGRect.h" + +nsresult +NS_NewSVGRect(nsIDOMSVGRect** result, + float x=0.0f, float y=0.0f, + float width=0.0f, float height=0.0f); + + +// create an SVGRect wrapper object that delegates all 'getter' calls +// to the given prototype if the property hasn't been set on the +// object directly +nsresult +NS_NewSVGRectPrototypeWrapper(nsIDOMSVGRect** result, + nsIDOMSVGRect* prototype); + + +#endif //__NS_SVGRECT_H__ diff --git a/content/svg/content/src/nsSVGRectElement.cpp b/content/svg/content/src/nsSVGRectElement.cpp new file mode 100644 index 000000000000..7ddd59e4a5eb --- /dev/null +++ b/content/svg/content/src/nsSVGRectElement.cpp @@ -0,0 +1,337 @@ +/* -*- 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 (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 "nsIDOMSVGRectElement.h" +#include "nsCOMPtr.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: + nsCOMPtr mX; + nsCOMPtr mY; + nsCOMPtr mWidth; + nsCOMPtr mHeight; + nsCOMPtr mRx; + nsCOMPtr 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 value = do_QueryInterface(mX); + value->RemoveObserver(this); + } + if (mY) { + nsCOMPtr value = do_QueryInterface(mY); + value->RemoveObserver(this); + } + if (mWidth) { + nsCOMPtr value = do_QueryInterface(mWidth); + value->RemoveObserver(this); + } + if (mHeight) { + nsCOMPtr value = do_QueryInterface(mHeight); + value->RemoveObserver(this); + } + if (mRx) { + nsCOMPtr value = do_QueryInterface(mRx); + value->RemoveObserver(this); + } + if (mRy) { + nsCOMPtr 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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; +} diff --git a/content/svg/content/src/nsSVGSVGElement.cpp b/content/svg/content/src/nsSVGSVGElement.cpp new file mode 100644 index 000000000000..35a476a27adf --- /dev/null +++ b/content/svg/content/src/nsSVGSVGElement.cpp @@ -0,0 +1,1034 @@ +/* -*- 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 (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 "nsIDOMSVGSVGElement.h" +#include "nsIDOMSVGFitToViewBox.h" +#include "nsIDOMSVGLocatable.h" +#include "nsSVGAnimatedLength.h" +#include "nsSVGLength.h" +#include "nsCOMPtr.h" +#include "nsIPresShell.h" +#include "nsIDocument.h" +#include "nsIPresContext.h" +#include "nsSVGRect.h" +#include "nsSVGAnimatedRect.h" +#include "nsSVGMatrix.h" +#include "nsSVGPoint.h" +#include "nsSVGTransform.h" +#include "nsIDOMEventTarget.h" +#include "nsIViewManager.h" +#include "nsIBindingManager.h" +#include "nsIWidget.h" +#include "nsIFrame.h" +#include "nsIScrollableView.h" +#include "nsISVGFrame.h" //XXX + +class nsSVGSVGElement : public nsSVGElement, + public nsIDOMSVGSVGElement, + public nsIDOMSVGFitToViewBox, + public nsIDOMSVGLocatable +{ +protected: + friend nsresult NS_NewSVGSVGElement(nsIContent **aResult, + nsINodeInfo *aNodeInfo); + nsSVGSVGElement(); + virtual ~nsSVGSVGElement(); + virtual nsresult Init(); + +public: + // interfaces: + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIDOMSVGSVGELEMENT + NS_DECL_NSIDOMSVGFITTOVIEWBOX + NS_DECL_NSIDOMSVGLOCATABLE + + // xxx I wish we could use virtual inheritance + NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGElement::) + NS_FORWARD_NSIDOMELEMENT(nsSVGElement::) + NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::) + +protected: + // implementation helpers: + void GetScreenPosition(PRInt32 &x, PRInt32 &y); + + nsCOMPtr mWidth; + nsCOMPtr mHeight; + nsCOMPtr mViewport; + nsCOMPtr mViewBox; + nsCOMPtr mX; + nsCOMPtr mY; + + PRInt32 mRedrawSuspendCount; +}; + + +nsresult NS_NewSVGSVGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo) +{ + *aResult = nsnull; + nsSVGSVGElement* it = new nsSVGSVGElement(); + + 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(nsSVGSVGElement,nsSVGElement) +NS_IMPL_RELEASE_INHERITED(nsSVGSVGElement,nsSVGElement) + +NS_INTERFACE_MAP_BEGIN(nsSVGSVGElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGSVGElement) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGFitToViewBox) + NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLocatable) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGSVGElement) +NS_INTERFACE_MAP_END_INHERITING(nsSVGElement) + +//---------------------------------------------------------------------- +// Implementation + +nsSVGSVGElement::nsSVGSVGElement() + : mRedrawSuspendCount(0) +{ +} + +nsSVGSVGElement::~nsSVGSVGElement() +{ +} + + +nsresult +nsSVGSVGElement::Init() +{ + nsresult rv; + rv = nsSVGElement::Init(); + NS_ENSURE_SUCCESS(rv,rv); + + // nsIDOMSVGSVGElement attributes ------: + + // DOM property: width , #IMPLIED attrib: width + { + nsCOMPtr length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 100.0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE); + 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 , #IMPLIED attrib: height + { + nsCOMPtr length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 100.0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE); + 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); + } + // readonly (XXX) DOM property: viewport + { + rv = NS_NewSVGRect(getter_AddRefs(mViewport)); + NS_ENSURE_SUCCESS(rv,rv); + } + + // DOM property: x , #IMPLIED attrib: x + { + nsCOMPtr length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eXDirection, + 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 length; + rv = NS_NewSVGLength(getter_AddRefs(length), + (nsSVGElement*)this, eYDirection, + 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); + } + + // nsIDOMSVGFitToViewBox attributes ------: + + // DOM property: viewBox , #IMPLIED attrib: viewBox + { + // ----------------- + // | SVGAnimatedRect | + // ----------------- + // < > + // | + // ------------------------- + // | SVGRectPrototypeWrapper | + // ------------------------- + // < > + // | + // | prototype + // ----------- + // | mViewport | + // ----------- + + nsCOMPtr wrapperRect; + rv = NS_NewSVGRectPrototypeWrapper(getter_AddRefs(wrapperRect), mViewport); + NS_ENSURE_SUCCESS(rv,rv); + rv = NS_NewSVGAnimatedRect(getter_AddRefs(mViewBox), wrapperRect); + NS_ENSURE_SUCCESS(rv,rv); + rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::viewBox, mViewBox); + NS_ENSURE_SUCCESS(rv,rv); + } + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsIDOMNode methods + +NS_IMETHODIMP +nsSVGSVGElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +{ + *aReturn = nsnull; + nsSVGSVGElement* it = new nsSVGSVGElement(); + + 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(nsSVGElement*, it); + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsIDOMSVGSVGElement methods: + +/* readonly attribute nsIDOMSVGAnimatedLength x; */ +NS_IMETHODIMP +nsSVGSVGElement::GetX(nsIDOMSVGAnimatedLength * *aX) +{ + *aX = mX; + NS_ADDREF(*aX); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGAnimatedLength y; */ +NS_IMETHODIMP +nsSVGSVGElement::GetY(nsIDOMSVGAnimatedLength * *aY) +{ + *aY = mY; + NS_ADDREF(*aY); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGAnimatedLength width; */ +NS_IMETHODIMP +nsSVGSVGElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth) +{ + *aWidth = mWidth; + NS_ADDREF(*aWidth); + return NS_OK; +} + +/* readonly attribute nsIDOMSVGAnimatedLength height; */ +NS_IMETHODIMP +nsSVGSVGElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight) +{ + *aHeight = mHeight; + NS_ADDREF(*aHeight); + return NS_OK; +} + +/* attribute DOMString contentScriptType; */ +NS_IMETHODIMP +nsSVGSVGElement::GetContentScriptType(nsAWritableString & aContentScriptType) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP +nsSVGSVGElement::SetContentScriptType(const nsAReadableString & aContentScriptType) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute DOMString contentStyleType; */ +NS_IMETHODIMP +nsSVGSVGElement::GetContentStyleType(nsAWritableString & aContentStyleType) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP +nsSVGSVGElement::SetContentStyleType(const nsAReadableString & aContentStyleType) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMSVGRect viewport; */ +NS_IMETHODIMP +nsSVGSVGElement::GetViewport(nsIDOMSVGRect * *aViewport) +{ + *aViewport = mViewport; + NS_ADDREF(*aViewport); + return NS_OK; +} + +/* readonly attribute float pixelUnitToMillimeterX; */ +NS_IMETHODIMP +nsSVGSVGElement::GetPixelUnitToMillimeterX(float *aPixelUnitToMillimeterX) +{ + // to correctly determine this, the caller would need to pass in the + // right PresContext... + + *aPixelUnitToMillimeterX = 0.28f; // 90dpi + + if (!mDocument) return NS_OK; + // Get Presentation shell 0 + nsCOMPtr presShell; + mDocument->GetShellAt(0,getter_AddRefs(presShell)); + if (!presShell) return NS_OK; + + // Get the Presentation Context from the Shell + nsCOMPtr context; + presShell->GetPresContext(getter_AddRefs(context)); + if (!context) return NS_OK; + + float TwipsPerPx; + context->GetScaledPixelsToTwips(&TwipsPerPx); + *aPixelUnitToMillimeterX = TwipsPerPx / TWIPS_PER_POINT_FLOAT / (72.0f * 0.03937f); + return NS_OK; +} + +/* readonly attribute float pixelUnitToMillimeterY; */ +NS_IMETHODIMP +nsSVGSVGElement::GetPixelUnitToMillimeterY(float *aPixelUnitToMillimeterY) +{ + return GetPixelUnitToMillimeterX(aPixelUnitToMillimeterY); +} + +/* readonly attribute float screenPixelToMillimeterX; */ +NS_IMETHODIMP +nsSVGSVGElement::GetScreenPixelToMillimeterX(float *aScreenPixelToMillimeterX) +{ + // to correctly determine this, the caller would need to pass in the + // right PresContext... + + *aScreenPixelToMillimeterX = 0.28f; // 90dpi + + if (!mDocument) return NS_OK; + // Get Presentation shell 0 + nsCOMPtr presShell; + mDocument->GetShellAt(0, getter_AddRefs(presShell)); + if (!presShell) return NS_OK; + + // Get the Presentation Context from the Shell + nsCOMPtr context; + presShell->GetPresContext(getter_AddRefs(context)); + if (!context) return NS_OK; + + float TwipsPerPx; + context->GetPixelsToTwips(&TwipsPerPx); + *aScreenPixelToMillimeterX = TwipsPerPx / TWIPS_PER_POINT_FLOAT / (72.0f * 0.03937f); + return NS_OK; +} + +/* readonly attribute float screenPixelToMillimeterY; */ +NS_IMETHODIMP +nsSVGSVGElement::GetScreenPixelToMillimeterY(float *aScreenPixelToMillimeterY) +{ + return GetScreenPixelToMillimeterX(aScreenPixelToMillimeterY); +} + +/* attribute boolean useCurrentView; */ +NS_IMETHODIMP +nsSVGSVGElement::GetUseCurrentView(PRBool *aUseCurrentView) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP +nsSVGSVGElement::SetUseCurrentView(PRBool aUseCurrentView) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMSVGViewSpec currentView; */ +NS_IMETHODIMP +nsSVGSVGElement::GetCurrentView(nsIDOMSVGViewSpec * *aCurrentView) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute float currentScale; */ +NS_IMETHODIMP +nsSVGSVGElement::GetCurrentScale(float *aCurrentScale) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP +nsSVGSVGElement::SetCurrentScale(float aCurrentScale) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMSVGPoint currentTranslate; */ +NS_IMETHODIMP +nsSVGSVGElement::GetCurrentTranslate(nsIDOMSVGPoint * *aCurrentTranslate) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* unsigned long suspendRedraw (in unsigned long max_wait_milliseconds); */ +NS_IMETHODIMP +nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval) +{ + *_retval = 1; + + if (++mRedrawSuspendCount > 1) + return NS_OK; + + if (!mDocument) return NS_ERROR_FAILURE; + nsCOMPtr presShell; + mDocument->GetShellAt(0, getter_AddRefs(presShell)); + NS_ASSERTION(presShell, "need presShell to suspend redraw"); + if (!presShell) return NS_ERROR_FAILURE; + + nsIFrame* frame; + presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame); +#ifdef DEBUG + // XXX We sometimes hit this assertion when the svg:svg element is + // in a binding and svg children are inserted underneath it using + // . If the svg children then call suspendRedraw, the + // above function call fails although the svg:svg's frame has been + // build. Strange... + +// NS_ASSERTION(frame, "suspending redraw w/o frame"); + printf("suspending redraw w/o frame\n"); +#endif + if (frame) { + nsISVGFrame* svgframe; + frame->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&svgframe); + NS_ASSERTION(svgframe, "wrong frame type"); + if (svgframe) { + svgframe->NotifyRedrawSuspended(); + } + } + + return NS_OK; +} + +/* void unsuspendRedraw (in unsigned long suspend_handle_id); */ +NS_IMETHODIMP +nsSVGSVGElement::UnsuspendRedraw(PRUint32 suspend_handle_id) +{ + if (mRedrawSuspendCount == 0) { + NS_ASSERTION(1==0, "unbalanced suspend/unsuspend calls"); + return NS_ERROR_FAILURE; + } + + if (mRedrawSuspendCount > 1) { + --mRedrawSuspendCount; + return NS_OK; + } + + return UnsuspendRedrawAll(); +} + +/* void unsuspendRedrawAll (); */ +NS_IMETHODIMP +nsSVGSVGElement::UnsuspendRedrawAll() +{ + mRedrawSuspendCount = 0; + + if (!mDocument) return NS_ERROR_FAILURE; + nsCOMPtr presShell; + mDocument->GetShellAt(0, getter_AddRefs(presShell)); + NS_ASSERTION(presShell, "need presShell to unsuspend redraw"); + if (!presShell) return NS_ERROR_FAILURE; + + nsIFrame* frame; + presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame); +#ifdef DEBUG +// NS_ASSERTION(frame, "unsuspending redraw w/o frame"); + printf("unsuspending redraw w/o frame\n"); +#endif + if (frame) { + nsISVGFrame* svgframe; + frame->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&svgframe); + NS_ASSERTION(svgframe, "wrong frame type"); + if (svgframe) { + svgframe->NotifyRedrawUnsuspended(); + } + } + return NS_OK; +} + +/* void forceRedraw (); */ +NS_IMETHODIMP +nsSVGSVGElement::ForceRedraw() +{ + if (!mDocument) return NS_ERROR_FAILURE; + + nsCOMPtr presShell; + mDocument->GetShellAt(0, getter_AddRefs(presShell)); + NS_ASSERTION(presShell, "need presShell to unsuspend redraw"); + if (!presShell) return NS_ERROR_FAILURE; + + nsCOMPtr vm; + presShell->GetViewManager(getter_AddRefs(vm)); + NS_ASSERTION(vm, "need viewmanager to unsuspend redraw"); + if (!vm) return NS_ERROR_FAILURE; + + vm->UpdateAllViews(NS_VMREFRESH_IMMEDIATE); + + return NS_OK; +} + +/* void pauseAnimations (); */ +NS_IMETHODIMP +nsSVGSVGElement::PauseAnimations() +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void unpauseAnimations (); */ +NS_IMETHODIMP +nsSVGSVGElement::UnpauseAnimations() +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* boolean animationsPaused (); */ +NS_IMETHODIMP +nsSVGSVGElement::AnimationsPaused(PRBool *_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* float getCurrentTime (); */ +NS_IMETHODIMP +nsSVGSVGElement::GetCurrentTime(float *_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void setCurrentTime (in float seconds); */ +NS_IMETHODIMP +nsSVGSVGElement::SetCurrentTime(float seconds) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMNodeList getIntersectionList (in nsIDOMSVGRect rect, in nsIDOMSVGElement referenceElement); */ +NS_IMETHODIMP +nsSVGSVGElement::GetIntersectionList(nsIDOMSVGRect *rect, nsIDOMSVGElement *referenceElement, nsIDOMNodeList **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMNodeList getEnclosureList (in nsIDOMSVGRect rect, in nsIDOMSVGElement referenceElement); */ +NS_IMETHODIMP +nsSVGSVGElement::GetEnclosureList(nsIDOMSVGRect *rect, nsIDOMSVGElement *referenceElement, nsIDOMNodeList **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* boolean checkIntersection (in nsIDOMSVGElement element, in nsIDOMSVGRect rect); */ +NS_IMETHODIMP +nsSVGSVGElement::CheckIntersection(nsIDOMSVGElement *element, nsIDOMSVGRect *rect, PRBool *_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* boolean checkEnclosure (in nsIDOMSVGElement element, in nsIDOMSVGRect rect); */ +NS_IMETHODIMP +nsSVGSVGElement::CheckEnclosure(nsIDOMSVGElement *element, nsIDOMSVGRect *rect, PRBool *_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void deSelectAll (); */ +NS_IMETHODIMP +nsSVGSVGElement::DeSelectAll() +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGNumber createSVGNumber (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGNumber(nsIDOMSVGNumber **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGLength createSVGLength (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGLength(nsIDOMSVGLength **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGAngle createSVGAngle (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGAngle(nsIDOMSVGAngle **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGPoint createSVGPoint (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGPoint(nsIDOMSVGPoint **_retval) +{ + return nsSVGPoint::Create(0.0f, 0.0f, _retval); +} + +/* nsIDOMSVGMatrix createSVGMatrix (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGMatrix(nsIDOMSVGMatrix **_retval) +{ + return nsSVGMatrix::Create(_retval); +} + +/* nsIDOMSVGRect createSVGRect (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGRect(nsIDOMSVGRect **_retval) +{ + return NS_NewSVGRect(_retval); +} + +/* nsIDOMSVGTransform createSVGTransform (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGTransform(nsIDOMSVGTransform **_retval) +{ + return NS_NewSVGTransform(_retval); +} + +/* nsIDOMSVGTransform createSVGTransformFromMatrix (in nsIDOMSVGMatrix matrix); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGTransformFromMatrix(nsIDOMSVGMatrix *matrix, nsIDOMSVGTransform **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* DOMString createSVGString (); */ +NS_IMETHODIMP +nsSVGSVGElement::CreateSVGString(nsAWritableString & _retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMElement getElementById (in DOMString elementId); */ +NS_IMETHODIMP +nsSVGSVGElement::GetElementById(const nsAReadableString & elementId, nsIDOMElement **_retval) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGMatrix getViewboxToViewportTransform (); */ +NS_IMETHODIMP +nsSVGSVGElement::GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval) +{ + // XXX + return CreateSVGMatrix(_retval); +} + +//---------------------------------------------------------------------- +// nsIDOMSVGFitToViewBox methods + +/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */ +NS_IMETHODIMP +nsSVGSVGElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; */ +NS_IMETHODIMP +nsSVGSVGElement::GetPreserveAspectRatio(nsIDOMSVGAnimatedPreserveAspectRatio * *aPreserveAspectRatio) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +//---------------------------------------------------------------------- +// nsIDOMSVGLocatable methods + +/* readonly attribute nsIDOMSVGElement nearestViewportElement; */ +NS_IMETHODIMP +nsSVGSVGElement::GetNearestViewportElement(nsIDOMSVGElement * *aNearestViewportElement) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMSVGElement farthestViewportElement; */ +NS_IMETHODIMP +nsSVGSVGElement::GetFarthestViewportElement(nsIDOMSVGElement * *aFarthestViewportElement) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGRect getBBox (); */ +NS_IMETHODIMP +nsSVGSVGElement::GetBBox(nsIDOMSVGRect **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* nsIDOMSVGMatrix getCTM (); */ +NS_IMETHODIMP +nsSVGSVGElement::GetCTM(nsIDOMSVGMatrix **_retval) +{ + nsCOMPtr CTM; + + nsCOMPtr bindingManager; + if (mDocument) { + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + } + + nsCOMPtr 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 = mParent; + } + + while (parent) { + nsCOMPtr viewportElement = do_QueryInterface(parent); + if (viewportElement) { + // Our nearest SVG parent is a viewport element. + viewportElement->GetViewboxToViewportTransform(getter_AddRefs(CTM)); + break; + } + + nsCOMPtr 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 next; + + if (bindingManager) { + bindingManager->GetInsertionParent(parent, getter_AddRefs(next)); + } + + if (!next) { + // no anonymous parent, so use explicit one + parent->GetParent(*getter_AddRefs(next)); + } + + parent = next; + } + + if (!CTM) { + // We either didn't find an SVG parent, or our parent failed in + // giving us a CTM. In either case: + nsSVGMatrix::Create(getter_AddRefs(CTM)); + } + + // XXX do we have to append our viewboxToViewport transformation? + // if we do we have to change nsSVGGraphicElement::GetCTM() + + *_retval = CTM; + NS_IF_ADDREF(*_retval); + return NS_OK; +} + +/* nsIDOMSVGMatrix getScreenCTM (); */ +NS_IMETHODIMP +nsSVGSVGElement::GetScreenCTM(nsIDOMSVGMatrix **_retval) +{ + nsCOMPtr screenCTM; + + nsCOMPtr bindingManager; + if (mDocument) { + mDocument->GetBindingManager(getter_AddRefs(bindingManager)); + } + + nsCOMPtr 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 = mParent; + } + + while (parent) { + + nsCOMPtr locatableElement = do_QueryInterface(parent); + if (locatableElement) { + nsCOMPtr ctm; + locatableElement->GetScreenCTM(getter_AddRefs(ctm)); + if (!ctm) { + NS_ERROR("couldn't get CTM"); + break; + } + + nsCOMPtr viewportElement = do_QueryInterface(parent); + if (viewportElement) { + // It is a viewport element. we need to append the viewbox xform: + nsCOMPtr 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 next; + + if (bindingManager) { + bindingManager->GetInsertionParent(parent, getter_AddRefs(next)); + } + + if (!next) { + // no anonymous parent, so use explicit one + parent->GetParent(*getter_AddRefs(next)); + } + + parent = next; + } + + if (!screenCTM) { + // We either didn't find an SVG parent, or our parent failed in + // giving us a CTM. + // In either case, we'll just assume that we are the outermost element: + nsCOMPtr matrix; + nsSVGMatrix::Create(getter_AddRefs(matrix)); + PRInt32 x, y; + GetScreenPosition(x, y); + matrix->Translate((float)x, (float)y, getter_AddRefs(screenCTM)); + } + + // XXX do we have to append our viewboxToViewport transformation? + // if we do we have to change nsSVGGraphicElement::GetScreenCTM() + + *_retval = screenCTM; + NS_IF_ADDREF(*_retval); + return NS_OK; +} + +/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */ +NS_IMETHODIMP +nsSVGSVGElement::GetTransformToElement(nsIDOMSVGElement *element, nsIDOMSVGMatrix **_retval) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_NOT_IMPLEMENTED; +} + + +// ---------------------------------------------------------------------- +// implementation helpers +void nsSVGSVGElement::GetScreenPosition(PRInt32 &x, PRInt32 &y) +{ + x = 0; + y = 0; + + if (!mDocument) return; + + nsCOMPtr presShell; + mDocument->GetShellAt(0, getter_AddRefs(presShell)); + if (!presShell) { + NS_ERROR("couldn't get presshell"); + return; + } + + nsCOMPtr context; + presShell->GetPresContext(getter_AddRefs(context)); + if (!context) { + NS_ERROR("couldn't get prescontext"); + return; + } + + // Flush all pending notifications so that our frames are uptodate + presShell->FlushPendingNotifications(PR_FALSE); + + nsIFrame* frame; + nsresult rv = presShell->GetPrimaryFrameFor(this, &frame); + + float t2p; + context->GetTwipsToPixels(&t2p); + + + nsCOMPtr widget; + + while (frame) { + // Look for a widget so we can get screen coordinates + nsIView* view; + rv = frame->GetView(context, &view); + if (view) { + // handle scrolled views along the way: + nsIScrollableView* scrollableView = nsnull; + view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollableView); + if (scrollableView) { + nscoord scrollX, scrollY; + scrollableView->GetScrollPosition(scrollX, scrollY); + x -= scrollX; + y -= scrollY; + } + + // if this is a widget we break and get screen coords from it: + rv = view->GetWidget(*getter_AddRefs(widget)); + if (widget) + break; + } + + // No widget yet, so count up the coordinates of the frame + nsPoint origin; + frame->GetOrigin(origin); + x += origin.x; + y += origin.y; + + frame->GetParent(&frame); + } + + + // Convert to pixels using that scale + x = NSTwipsToIntPixels(x, t2p); + y = NSTwipsToIntPixels(y, t2p); + + if (widget) { + // Add the widget's screen coordinates to the offset we've counted + nsRect client(0,0,0,0); + nsRect screen; + widget->WidgetToScreen(client, screen); + x += screen.x; + y += screen.y; + } +} diff --git a/content/svg/content/src/nsSVGStyleValue.cpp b/content/svg/content/src/nsSVGStyleValue.cpp new file mode 100644 index 000000000000..fa8bb410fa48 --- /dev/null +++ b/content/svg/content/src/nsSVGStyleValue.cpp @@ -0,0 +1,169 @@ +/* -*- 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 (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 "nsISVGStyleValue.h" +#include "nsSVGStyleValue.h" +#include "nsIStyleRule.h" +#include "nsIDocument.h" +#include "nsIURI.h" +#include "nsICSSParser.h" +#include "nsIServiceManager.h" +#include "nsLayoutCID.h" + +static NS_DEFINE_CID(kCSSParserCID, NS_CSSPARSER_CID); + +class nsSVGStyleValue : public nsSVGValue, + public nsISVGStyleValue +{ +protected: + friend nsresult + NS_NewSVGStyleValue(nsISVGStyleValue** aResult); + + nsSVGStyleValue(); + +public: + NS_DECL_ISUPPORTS + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + // nsISVGStyleValue interface: + NS_IMETHOD GetStyleRule(nsIDocument* baseDoc, nsIStyleRule** rule); + +protected: + // Implementation helpers: + void UpdateStyleRule(nsIDocument* baseDoc); + + nsString mValue; + nsCOMPtr mRule; // lazily cached +}; + +//---------------------------------------------------------------------- +// Implementation: + +nsresult +NS_NewSVGStyleValue(nsISVGStyleValue** aResult) +{ + NS_PRECONDITION(aResult != nsnull, "null ptr"); + if (! aResult) return NS_ERROR_NULL_POINTER; + + *aResult = (nsISVGStyleValue*) new nsSVGStyleValue(); + if(!*aResult) return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(*aResult); + return NS_OK; +} + +nsSVGStyleValue::nsSVGStyleValue() +{ + NS_INIT_ISUPPORTS(); +} + +//---------------------------------------------------------------------- +// nsISupports methods: + +NS_IMPL_ISUPPORTS2(nsSVGStyleValue, + nsISVGValue, + nsISVGStyleValue); + + +//---------------------------------------------------------------------- +// nsISVGValue methods: + +NS_IMETHODIMP +nsSVGStyleValue::SetValueString(const nsAReadableString& aValue) +{ + WillModify(); + mValue = aValue; + mRule = nsnull; + DidModify(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGStyleValue::GetValueString(nsAWritableString& aValue) +{ + aValue = mValue; + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISVGStyleValue interface: + +NS_IMETHODIMP +nsSVGStyleValue::GetStyleRule(nsIDocument* baseDoc, nsIStyleRule** rule) +{ + if (!mRule) { + UpdateStyleRule(baseDoc); + } + + *rule = mRule; + NS_IF_ADDREF(*rule); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// Implementation helpers: + +void +nsSVGStyleValue::UpdateStyleRule(nsIDocument* baseDoc) +{ + + if (mValue.IsEmpty()) { + // XXX: Removing the rule. Is this sufficient? + mRule = nsnull; + return; + } + + NS_ASSERTION(baseDoc,"need base document"); + nsCOMPtr docURL; + baseDoc->GetBaseURL(*getter_AddRefs(docURL)); + + nsCOMPtr css; + nsComponentManager::CreateInstance(kCSSParserCID, + nsnull, + NS_GET_IID(nsICSSParser), + getter_AddRefs(css)); + NS_ASSERTION(css, "can't get a css parser"); + if (!css) return; + + css->ParseStyleAttribute(mValue, docURL, getter_AddRefs(mRule)); +} diff --git a/content/svg/content/src/nsSVGStyleValue.h b/content/svg/content/src/nsSVGStyleValue.h new file mode 100644 index 000000000000..902e378d57d8 --- /dev/null +++ b/content/svg/content/src/nsSVGStyleValue.h @@ -0,0 +1,49 @@ +/* -*- 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 (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_SVGSTYLEVALUE_H__ +#define __NS_SVGSTYLEVALUE_H__ + +class nsISVGStyleValue; + +nsresult +NS_NewSVGStyleValue(nsISVGStyleValue** aResult); + +#endif // __NS_SVGSTYLEVALUE_H__ + diff --git a/content/svg/content/src/nsSVGTransform.cpp b/content/svg/content/src/nsSVGTransform.cpp new file mode 100644 index 000000000000..446f329aa91d --- /dev/null +++ b/content/svg/content/src/nsSVGTransform.cpp @@ -0,0 +1,349 @@ +/* -*- 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 (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" + + +//////////////////////////////////////////////////////////////////////// +// 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 nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + +protected: + nsCOMPtr 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 ) +{ + NS_INIT_ISUPPORTS(); +} + +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 nsAReadableString& aValue) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGTransform::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + char buf[256]; + + switch (mType) { + case nsIDOMSVGTransform::SVG_TRANSFORM_TRANSLATE: + { + float dx, dy; + mMatrix->GetE(&dx); + mMatrix->GetF(&dy); + if (dy != 0.0f) + sprintf(buf, "translate(%g, %g)", dx, dy); + else + sprintf(buf, "translate(%g)", dx); + } + break; + case nsIDOMSVGTransform::SVG_TRANSFORM_ROTATE: + { + if (mOriginX != 0.0f || mOriginY != 0.0f) + sprintf(buf, "rotate(%g, %g, %g)", mAngle, mOriginX, mOriginY); + else + sprintf(buf, "rotate(%g)", mAngle); + } + break; + case nsIDOMSVGTransform::SVG_TRANSFORM_SCALE: + { + float sx, sy; + mMatrix->GetA(&sx); + mMatrix->GetD(&sy); + if (sy != 0.0f) + sprintf(buf, "scale(%g, %g)", sx, sy); + else + sprintf(buf, "scale(%g)", sx); + } + break; + case nsIDOMSVGTransform::SVG_TRANSFORM_SKEWX: + { + float sx; + mMatrix->GetC(&sx); + sprintf(buf, "skewX(%g)", sx); + } + break; + case nsIDOMSVGTransform::SVG_TRANSFORM_SKEWY: + { + float sy; + mMatrix->GetB(&sy); + sprintf(buf, "skewY(%g)", sy); + } + break; + default: + buf[0] = '\0'; + NS_NOTYETIMPLEMENTED("write me!"); + break; + } + + aValue.Append(NS_ConvertASCIItoUCS2(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 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 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 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); +} diff --git a/content/svg/content/src/nsSVGTransform.h b/content/svg/content/src/nsSVGTransform.h new file mode 100644 index 000000000000..7b3e7b46ca7c --- /dev/null +++ b/content/svg/content/src/nsSVGTransform.h @@ -0,0 +1,52 @@ +/* -*- 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 (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_SVGTRANSFORM_H__ +#define __NS_SVGTRANSFORM_H__ + +#include "nsIDOMSVGTransform.h" + +nsresult +NS_NewSVGTransform(nsIDOMSVGTransform** result); + +// XXX we'll need this prototype-based stuff to support unsetting: +//nsresult NS_NewSVGTransform(nsIDOMSVGTransform** result, +// nsIDOMSVGTransform* prototype); + + +#endif //__NS_SVGTRANSFORM_H__ diff --git a/content/svg/content/src/nsSVGTransformList.cpp b/content/svg/content/src/nsSVGTransformList.cpp new file mode 100644 index 000000000000..48538228fdf8 --- /dev/null +++ b/content/svg/content/src/nsSVGTransformList.cpp @@ -0,0 +1,440 @@ +/* -*- 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 (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" + +nsresult +nsSVGTransformList::Create(const nsAReadableString& 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() +{ + NS_INIT_ISUPPORTS(); +} + +nsSVGTransformList::~nsSVGTransformList() +{ + ReleaseTransforms(); +} + +void +nsSVGTransformList::ReleaseTransforms() +{ + WillModify(); + PRInt32 count = mTransforms.Count(); + for (PRInt32 i = 0; i < count; ++i) { + nsIDOMSVGTransform* transform = ElementAt(i); + nsCOMPtr 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 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 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 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 nsAReadableString& aValue) +{ + // XXX: we don't implement the _exact_ BNF given in the + // specs. + + WillModify(); + + ReleaseTransforms(); + + nsresult rv = NS_OK; + + // XXX how am I supposed to do this ??? + // char* str = aValue.ToNewCString(); + char* str; + { + nsAutoString temp(aValue); + str = ToNewCString(temp); + } + + char* rest = str; + char* keyword; + char* args; + const char* delimiters1 = "\x20\x9\xD\xA,("; + const char* delimiters2 = "()"; + const char* delimiters3 = "\x20\x9\xD\xA,"; + + while ((keyword = nsCRT::strtok(rest, delimiters1, &rest))) { + + while (rest && isspace(*rest)) + ++rest; + + if (!(args = nsCRT::strtok(rest, delimiters2, &rest))) + break; // parse error + + nsCOMPtr transform; + NS_NewSVGTransform(getter_AddRefs(transform)); + if (!transform) { + rv = NS_ERROR_OUT_OF_MEMORY; + break; + } + + nsCOMPtr keyatom = dont_AddRef(NS_NewAtom(keyword)); + + if (keyatom == nsSVGAtoms::translate) { + char* arg1 = nsCRT::strtok(args, delimiters3, &args); + if (!arg1) 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) 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) break; // parse error + char* arg2 = nsCRT::strtok(args, delimiters3, &args); + char* arg3 = arg2 ? nsCRT::strtok(args, delimiters3, &args) : nsnull; + if (arg2 && !arg3) 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) 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) break; // parse error + + char* end; + float angle = (float) PR_strtod(arg1, &end); + transform->SetSkewY(angle); + } + else { // parse error + break; + } + AppendElement(transform); + } + + if (keyword) { + // there was a parse error. should we return an error? + // rv = NS_ERROR_???; +#ifdef DEBUG + printf("transform-attribute parse error\n"); +#endif + } + + nsMemory::Free(str); + + DidModify(); + return rv; +} + +NS_IMETHODIMP +nsSVGTransformList::GetValueString(nsAWritableString& aValue) +{ + aValue.Truncate(); + + PRInt32 count = mTransforms.Count(); + + if (count<=0) return NS_OK; + + PRInt32 i = 0; + + while (1) { + nsIDOMSVGTransform* transform = ElementAt(i); + + nsCOMPtr 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 consolidation; + nsSVGMatrix::Create(getter_AddRefs(consolidation)); + + for (PRInt32 i = 0; i < count; ++i) { + nsIDOMSVGTransform* transform = ElementAt(i); + nsCOMPtr matrix; + transform->GetMatrix(getter_AddRefs(matrix)); + nsCOMPtr 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; +} diff --git a/content/svg/content/src/nsSVGTransformList.h b/content/svg/content/src/nsSVGTransformList.h new file mode 100644 index 000000000000..de1a13a89af2 --- /dev/null +++ b/content/svg/content/src/nsSVGTransformList.h @@ -0,0 +1,93 @@ +/* -*- 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 (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_SVGTRANSFORMLIST_H__ +#define __NS_SVGTRANSFORMLIST_H__ + +#include "nsSVGValue.h" +#include "nsISVGValueObserver.h" +#include "nsWeakReference.h" +#include "nsIDOMSVGTransformList.h" +#include "nsVoidArray.h" + +class nsSVGTransformList : public nsSVGValue, + public nsIDOMSVGTransformList, + public nsISVGValueObserver, + public nsSupportsWeakReference +{ +public: + static nsresult Create(const nsAReadableString& aValue, nsISVGValue** aResult); + static nsresult Create(nsIDOMSVGTransformList** aResult); + +protected: + nsSVGTransformList(); + virtual ~nsSVGTransformList(); + +public: + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGTransformList interface: + NS_DECL_NSIDOMSVGTRANSFORMLIST + + // remainder of nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAReadableString& aValue); + NS_IMETHOD GetValueString(nsAWritableString& aValue); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + + + // other methods: + nsIDOMSVGTransform* ElementAt(PRInt32 index); + void AppendElement(nsIDOMSVGTransform* aElement); + void RemoveElementAt(PRInt32 index); + void InsertElementAt(nsIDOMSVGTransform* aElement, PRInt32 index); + +protected: + void ReleaseTransforms(); + + nsAutoVoidArray mTransforms; +}; + + +#endif //__NS_SVGTRANSFORMLIST_H__ diff --git a/content/svg/content/src/nsSVGValue.cpp b/content/svg/content/src/nsSVGValue.cpp new file mode 100644 index 000000000000..06423597a6e4 --- /dev/null +++ b/content/svg/content/src/nsSVGValue.cpp @@ -0,0 +1,114 @@ +/* -*- 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 (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 observer = do_QueryReferent(wr); + if(observer) + (observer.get()->*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) + 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 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; +} + diff --git a/content/svg/content/src/nsSVGValue.h b/content/svg/content/src/nsSVGValue.h new file mode 100644 index 000000000000..0971b6a3d8c4 --- /dev/null +++ b/content/svg/content/src/nsSVGValue.h @@ -0,0 +1,85 @@ +/* -*- 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 (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 "nsISVGValue.h" +#include "nsGenericElement.h" // for CheapVoidArray +#include "nsISVGValueObserver.h" + +// XXX this should be somewhere else +#if defined(XP_PC) && !defined(XP_OS2) +#define STDCALL __stdcall +#else +#define STDCALL +#endif + +typedef nsresult +(STDCALL nsISVGValueObserver::*SVGObserverNotifyFunction)(nsISVGValue*); + + +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); + +protected: + // implementation helpers + void ReleaseObservers(); + + void NotifyObservers(SVGObserverNotifyFunction f); + +private: + nsCheapVoidArray mObservers; + PRInt32 mModifyNestCount; +}; + + +#endif //__NS_SVGVALUE_H__ diff --git a/content/svg/document/.cvsignore b/content/svg/document/.cvsignore new file mode 100644 index 000000000000..f3c7a7c5da68 --- /dev/null +++ b/content/svg/document/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/layout/svg/content/Makefile.in b/content/svg/document/Makefile.in similarity index 61% rename from layout/svg/content/Makefile.in rename to content/svg/document/Makefile.in index 0b4d2a90ab5d..7bf05ddc743e 100644 --- a/layout/svg/content/Makefile.in +++ b/content/svg/document/Makefile.in @@ -1,20 +1,19 @@ # -# The contents of this file are subject to the Netscape Public +# 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/NPL/ +# 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 Original Code is the mozilla svg 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. +# The Initial Developer of the Original Code is Bradley Baetz +# Portions created by Bradley Baetz are Copyright (C) 2001 +# All Rights Reserved. # # Contributor(s): # diff --git a/content/svg/document/makefile.win b/content/svg/document/makefile.win new file mode 100644 index 000000000000..d3c5139e16cb --- /dev/null +++ b/content/svg/document/makefile.win @@ -0,0 +1,25 @@ +#!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 the mozilla SVG project. +# +# The Initial Developer of the Original Code is Bradley Baetz +# Portions created by Bradley Baetz are Copyright (C) 2001 Bradley +# Baetz. All Rights Reserved. +# +# Contributor(s): + +DEPTH=..\..\.. + +DIRS=src + +include <$(DEPTH)\config\rules.mak> diff --git a/content/svg/document/src/.cvsignore b/content/svg/document/src/.cvsignore new file mode 100644 index 000000000000..f3c7a7c5da68 --- /dev/null +++ b/content/svg/document/src/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/content/svg/document/src/Makefile.in b/content/svg/document/src/Makefile.in new file mode 100644 index 000000000000..e6fa6699afb4 --- /dev/null +++ b/content/svg/document/src/Makefile.in @@ -0,0 +1,65 @@ +# +# 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 code. +# +# The Initial Developer of the Original Code is Bradley Baetz +# Portions created by Bradley Baetz are Copyright (C) 2001 +# All Rights Reserved. +# +# Contributor(s): +# + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = svg_doc +LIBRARY_NAME = gkconsvgdoc_s +REQUIRES = content \ + layout \ + widget \ + xpcom \ + string \ + gfx \ + dom \ + webshell \ + htmlparser \ + lwbrk \ + necko \ + js \ + caps \ + locale \ + view + +CPPSRCS = \ + nsSVGDocument.cpp \ + $(NULL) + +# we don't want the shared lib, but we want to force the creation of a static lib. +FORCE_STATIC_LIB = 1 + +include $(topsrcdir)/config/rules.mk + +DEFINES += -D_IMPL_NS_HTML + +INCLUDES += \ + -I$(srcdir) \ + -I$(srcdir)/../../../xml/document/src \ + -I$(srcdir)/../../../xsl/document/src \ + -I$(srcdir)/../../../html/base/src \ + -I$(srcdir)/../../../html/document/src \ + -I$(srcdir)/../../../base/src \ + $(NULL) + diff --git a/content/svg/document/src/makefile.win b/content/svg/document/src/makefile.win new file mode 100644 index 000000000000..440509dccc8b --- /dev/null +++ b/content/svg/document/src/makefile.win @@ -0,0 +1,72 @@ +#!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. +# +# Contributor(s): +# +# Alex Fritze +# + +DEPTH=..\..\..\.. + +LIBRARY_NAME=contentsvgdoc_s +MODULE=raptor + +DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN +REQUIRES = content \ + layout \ + widget \ + xpcom \ + string \ + gfx \ + dom \ + webshell \ + htmlparser \ + lwbrk \ + necko \ + js \ + caps \ + locale \ + view \ + $(null) + + +CPP_OBJS= \ + .\$(OBJDIR)\nsSVGDocument.obj \ + $(NULL) + +LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \ + -I..\..\..\html\document\src -I..\..\..\html\base\src \ + -I..\..\..\xml\document\src \ + -I..\..\..\xsl\document\src \ + -I..\..\..\base\src \ + $(NULL) + +LCFLAGS = \ + $(LCFLAGS) \ + $(DEFINES) \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> + +libs:: $(LIBRARY) + $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib + +clobber:: + rm -f $(DIST)\lib\$(LIBRARY_NAME).lib + diff --git a/content/svg/document/src/nsSVGDocument.cpp b/content/svg/document/src/nsSVGDocument.cpp new file mode 100644 index 000000000000..c9a5f8892f1b --- /dev/null +++ b/content/svg/document/src/nsSVGDocument.cpp @@ -0,0 +1,146 @@ +/* -*- 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 (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 "nsXPIDLString.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() { + +} + +NS_IMETHODIMP +nsSVGDocument::StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset) { + nsresult rv = nsXMLDocument::StartDocumentLoad(aCommand, + aChannel, + aLoadGroup, + aContainer, + aDocListener, + aReset); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr httpChannel = do_QueryInterface(aChannel); + if (httpChannel) { + nsXPIDLCString referrer; + rv = httpChannel->GetResponseHeader("referrer", getter_Copies(referrer)); + if (NS_SUCCEEDED(rv)) { + mReferrer.AssignWithConversion(referrer); + } + } + + return NS_OK; +} + +// nsIDOMSVGDocument + +NS_IMETHODIMP +nsSVGDocument::GetTitle(nsAWritableString& aTitle) { + return nsXMLDocument::GetTitle(aTitle); +} + +NS_IMETHODIMP +nsSVGDocument::GetReferrer(nsAWritableString& aReferrer) { + aReferrer.Assign(mReferrer); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGDocument::GetDomain(nsAWritableString& aDomain) { + if (!mDocumentURL) { + aDomain.Truncate(); + } else { + nsXPIDLCString domain; + nsresult rv = mDocumentURL->GetHost(getter_Copies(domain)); + if (NS_FAILED(rv)) return rv; + + aDomain.Assign(NS_ConvertASCIItoUCS2(domain)); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGDocument::GetURL(nsAWritableString& aURL) { + if (!mDocumentURL) { + aURL.Truncate(); + } else { + nsXPIDLCString url; + nsresult rv = mDocumentURL->GetSpec(getter_Copies(url)); + if (NS_FAILED(rv)) return rv; + aURL.Assign(NS_ConvertASCIItoUCS2(url)); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGDocument::GetRootElement(nsIDOMSVGSVGElement** aRootElement) { + NS_NOTYETIMPLEMENTED("nsSVGDocument::GetRootElement"); + // XXX - writeme + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_EXPORT nsresult +NS_NewSVGDocument(nsIDocument** aInstancePtrResult) +{ + nsSVGDocument* doc = new nsSVGDocument(); + if (!doc) + return NS_ERROR_OUT_OF_MEMORY; + return doc->QueryInterface(NS_GET_IID(nsIDocument), + (void**) aInstancePtrResult); +} diff --git a/content/svg/document/src/nsSVGDocument.h b/content/svg/document/src/nsSVGDocument.h new file mode 100644 index 000000000000..95bfc3db4ed9 --- /dev/null +++ b/content/svg/document/src/nsSVGDocument.h @@ -0,0 +1,73 @@ +/* -*- 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 (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 + + NS_IMETHOD StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener **aDocListener, + PRBool aReset = PR_TRUE); + + NS_DECL_NSIDOMSVGDOCUMENT + NS_FORWARD_NSIDOMDOCUMENT(nsXMLDocument::) + NS_FORWARD_NSIDOMNODE(nsXMLDocument::) + NS_FORWARD_NSIDOMDOCUMENTEVENT(nsXMLDocument::) + NS_DECL_ISUPPORTS_INHERITED + +protected: + nsString mReferrer; +}; + +#endif diff --git a/layout/svg/base/public/makefile.win b/content/svg/makefile.win similarity index 52% rename from layout/svg/base/public/makefile.win rename to content/svg/makefile.win index b72e6b4db442..5cc906cf089b 100644 --- a/layout/svg/base/public/makefile.win +++ b/content/svg/makefile.win @@ -1,30 +1,29 @@ #!nmake # -# The contents of this file are subject to the Netscape Public +# 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/NPL/ +# 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 Original Code is Crocodile Clips Ltd code. # -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All +# 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. # # Contributor(s): +# +# Alex Fritze +# -DEPTH=..\..\..\.. +DEPTH=..\.. -EXPORTS = \ - nsISVGFrame.h \ - $(NULL) - -MODULE=layout +DIRS= document content include <$(DEPTH)\config\rules.mak> diff --git a/dom/macbuild/dom_svgIDL.xml b/dom/macbuild/dom_svgIDL.xml new file mode 100644 index 000000000000..2049d710ec18 --- /dev/null +++ b/dom/macbuild/dom_svgIDL.xml @@ -0,0 +1,2348 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> + + + + + headers + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:::dist:idl: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path::public: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + Linkerxpt Linker + PreLinker + PostLinker + Targetnameheaders + OutputDirectory + Path:::dist:dom:dom_svg: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeRSRC + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerRunTSScript + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.idl + Compilerxpidl + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypersrc + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileExtension.xpt + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + + + CacheModDatestrue + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos0 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixname + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI1 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse1 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma0 + MWWarning_C_warn_emptydecl0 + MWWarning_C_warn_possunwant0 + MWWarning_C_warn_unusedvar0 + MWWarning_C_warn_unusedarg0 + MWWarning_C_warn_extracomma0 + MWWarning_C_pedantic0 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual0 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion1 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut10 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1145457748 + MWJava_Proj_HTMLAppNameMetrowerks Java + MWJava_Proj_PathVersion1 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32NameInternet Explorer + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentMC68K + MWCodeGen_PPC_tracebacktablesNone + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings0 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix0 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname__start + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsNone + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentname + MWPEF_collapsereloads0 + + + MWProject_PPC_typeApplication + MWProject_PPC_outfilea.out + MWProject_PPC_filecreator???? + MWProject_PPC_filetypeAPPL + MWProject_PPC_size384 + MWProject_PPC_minsize384 + MWProject_PPC_stacksize64 + MWProject_PPC_flags22720 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosefalse + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 0001000101010F646F6D5F7376672E6865616465727373000000000000000000 + 0000000000000000 + + + + + Name + nsIDOMSVGAnimatedLength.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimatedPathData.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimatedPoints.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimatedRect.idl + MacOS + Text + + + + Name + nsIDOMSVGCircleElement.idl + MacOS + Text + + + + Name + nsIDOMSVGElement.idl + MacOS + Text + + + + Name + nsIDOMSVGFitToViewBox.idl + MacOS + Text + + + + Name + nsIDOMSVGGElement.idl + MacOS + Text + + + + Name + nsIDOMSVGLength.idl + MacOS + Text + + + + Name + nsIDOMSVGLineElement.idl + MacOS + Text + + + + Name + nsIDOMSVGLocatable.idl + MacOS + Text + + + + Name + nsIDOMSVGMatrix.idl + MacOS + Text + + + + Name + nsIDOMSVGPathElement.idl + MacOS + Text + + + + Name + nsIDOMSVGPathSeg.idl + MacOS + Text + + + + Name + nsIDOMSVGPathSegList.idl + MacOS + Text + + + + Name + nsIDOMSVGPoint.idl + MacOS + Text + + + + Name + nsIDOMSVGPointList.idl + MacOS + Text + + + + Name + nsIDOMSVGPolygonElement.idl + MacOS + Text + + + + Name + nsIDOMSVGPolylineElement.idl + MacOS + Text + + + + Name + nsIDOMSVGRect.idl + MacOS + Text + + + + Name + nsIDOMSVGRectElement.idl + MacOS + Text + + + + Name + nsIDOMSVGStylable.idl + MacOS + Text + + + + Name + nsIDOMSVGSVGElement.idl + MacOS + Text + + + + Name + nsIDOMSVGTransform.idl + MacOS + Text + + + + Name + nsIDOMSVGTransformable.idl + MacOS + Text + + + + Name + nsIDOMSVGTransformList.idl + MacOS + Text + + + + Name + nsIDOMSVGDocument.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimPresAspRatio.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimTransformList.idl + MacOS + Text + + + + Name + nsIDOMSVGForeignObjectElem.idl + MacOS + Text + + + + Name + nsIDOMSVGPresAspectRatio.idl + MacOS + Text + + + + Name + nsIDOMSVGEllipseElement.idl + MacOS + Text + + + + + + Name + nsIDOMSVGAnimatedLength.idl + MacOS + + + Name + nsIDOMSVGAnimatedPathData.idl + MacOS + + + Name + nsIDOMSVGAnimatedPoints.idl + MacOS + + + Name + nsIDOMSVGAnimatedRect.idl + MacOS + + + Name + nsIDOMSVGCircleElement.idl + MacOS + + + Name + nsIDOMSVGElement.idl + MacOS + + + Name + nsIDOMSVGFitToViewBox.idl + MacOS + + + Name + nsIDOMSVGGElement.idl + MacOS + + + Name + nsIDOMSVGLength.idl + MacOS + + + Name + nsIDOMSVGLineElement.idl + MacOS + + + Name + nsIDOMSVGLocatable.idl + MacOS + + + Name + nsIDOMSVGMatrix.idl + MacOS + + + Name + nsIDOMSVGPathElement.idl + MacOS + + + Name + nsIDOMSVGPathSeg.idl + MacOS + + + Name + nsIDOMSVGPathSegList.idl + MacOS + + + Name + nsIDOMSVGPoint.idl + MacOS + + + Name + nsIDOMSVGPointList.idl + MacOS + + + Name + nsIDOMSVGPolygonElement.idl + MacOS + + + Name + nsIDOMSVGPolylineElement.idl + MacOS + + + Name + nsIDOMSVGRect.idl + MacOS + + + Name + nsIDOMSVGRectElement.idl + MacOS + + + Name + nsIDOMSVGStylable.idl + MacOS + + + Name + nsIDOMSVGSVGElement.idl + MacOS + + + Name + nsIDOMSVGTransform.idl + MacOS + + + Name + nsIDOMSVGTransformable.idl + MacOS + + + Name + nsIDOMSVGTransformList.idl + MacOS + + + Name + nsIDOMSVGDocument.idl + MacOS + + + Name + nsIDOMSVGAnimPresAspRatio.idl + MacOS + + + Name + nsIDOMSVGAnimTransformList.idl + MacOS + + + Name + nsIDOMSVGForeignObjectElem.idl + MacOS + + + Name + nsIDOMSVGPresAspectRatio.idl + MacOS + + + Name + nsIDOMSVGEllipseElement.idl + MacOS + + + + + dom_svg.xpt + + + + UserSourceTrees + + + AlwaysSearchUserPathsfalse + InterpretDOSAndUnixPathsfalse + RequireFrameworkStyleIncludesfalse + UserSearchPaths + + SearchPath + Path:::dist:idl: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path::public: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SystemSearchPaths + + SearchPath + Path: + PathFormatMacOS + PathRootCodeWarrior + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + + + MWRuntimeSettings_WorkingDirectory + MWRuntimeSettings_CommandLine + MWRuntimeSettings_HostApplication + Path + PathFormatGeneric + PathRootAbsolute + + MWRuntimeSettings_EnvVars + + + Linkerxpt Linker + PreLinker + PostLinker + Targetnamedom_svg.xpt + OutputDirectory + Path: + PathFormatMacOS + PathRootProject + + SaveEntriesUsingRelativePathsfalse + + + FileMappings + + FileTypeRSRC + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.bh + CompilerBalloon Help + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.c + CompilerRunTSScript + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.idl + Compilerxpidl + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypeTEXT + FileExtension.r + CompilerRez + EditLanguageRez + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + FileTypersrc + FileExtension + CompilerRez + EditLanguage + Precompilefalse + Launchabletrue + ResourceFiletrue + IgnoredByMakefalse + + + FileExtension.xpt + Compiler + EditLanguage + Precompilefalse + Launchablefalse + ResourceFilefalse + IgnoredByMakefalse + + + + + CacheModDatestrue + ActivateBrowsertrue + DumpBrowserInfofalse + CacheSubprojectstrue + UseThirdPartyDebuggerfalse + DebuggerAppPath + Path + PathFormatGeneric + PathRootAbsolute + + DebuggerCmdLineArgs + DebuggerWorkingDir + Path + PathFormatGeneric + PathRootAbsolute + + + + LogSystemMessagestrue + AutoTargetDLLsfalse + StopAtWatchpointstrue + PauseWhileRunningfalse + PauseInterval5 + PauseUIFlags0 + AltExePath + Path + PathFormatGeneric + PathRootAbsolute + + StopAtTempBPOnLaunchtrue + CacheSymbolicstrue + TempBPFunctionNamemain + TempBPType0 + + + Enabledfalse + ConnectionName + DownloadPath + LaunchRemoteAppfalse + RemoteAppPath + + + OtherExecutables + + + CustomColor1 + Red0 + Green32767 + Blue0 + + CustomColor2 + Red0 + Green32767 + Blue0 + + CustomColor3 + Red0 + Green32767 + Blue0 + + CustomColor4 + Red0 + Green32767 + Blue0 + + + + MWFrontEnd_C_cplusplus0 + MWFrontEnd_C_checkprotos0 + MWFrontEnd_C_arm0 + MWFrontEnd_C_trigraphs0 + MWFrontEnd_C_onlystdkeywords0 + MWFrontEnd_C_enumsalwaysint0 + MWFrontEnd_C_mpwpointerstyle0 + MWFrontEnd_C_prefixname + MWFrontEnd_C_ansistrict0 + MWFrontEnd_C_mpwcnewline0 + MWFrontEnd_C_wchar_type1 + MWFrontEnd_C_enableexceptions1 + MWFrontEnd_C_dontreusestrings0 + MWFrontEnd_C_poolstrings0 + MWFrontEnd_C_dontinline0 + MWFrontEnd_C_useRTTI1 + MWFrontEnd_C_multibyteaware0 + MWFrontEnd_C_unsignedchars0 + MWFrontEnd_C_autoinline0 + MWFrontEnd_C_booltruefalse1 + MWFrontEnd_C_direct_to_som0 + MWFrontEnd_C_som_env_check0 + MWFrontEnd_C_alwaysinline0 + MWFrontEnd_C_inlinelevel0 + MWFrontEnd_C_ecplusplus0 + MWFrontEnd_C_objective_c0 + MWFrontEnd_C_defer_codegen0 + + + MWWarning_C_warn_illpragma0 + MWWarning_C_warn_emptydecl0 + MWWarning_C_warn_possunwant0 + MWWarning_C_warn_unusedvar0 + MWWarning_C_warn_unusedarg0 + MWWarning_C_warn_extracomma0 + MWWarning_C_pedantic0 + MWWarning_C_warningerrors0 + MWWarning_C_warn_hidevirtual0 + MWWarning_C_warn_implicitconv0 + MWWarning_C_warn_notinlined0 + MWWarning_C_warn_structclass0 + + + MWFTP_Post_hostName + MWFTP_Post_username + MWFTP_Post_password0 + MWFTP_Post_remoteDir + MWFTP_Post_ftp_PathVersion0 + MWFTP_Post_ftp_PathType0 + MWFTP_Post_ftp_PathFormat0 + MWFTP_Post_ftp_tree + MWFTP_Post_uploadDir + MWFTP_Post_ftp_port21 + MWFTP_Post_SendBin1 + MWFTP_Post_ShouldLog1 + + + MWCommandLine_Java_clsName + MWCommandLine_Java_args + + + MWVJavaDebugging_Protocol1 + MWVJavaDebugging_JDKVersion1 + MWVJavaDebugging_TimeOut10 + MWVJavaDebugging_SupportSlowDevicesfalse + + + MWJava_Language_optimizefalse + MWJava_Language_warnDeprecatedfalse + MWJava_Language_emitMapfalse + MWJava_Language_strictFileNamesfalse + MWJava_Language_strictFileHierarchyfalse + MWJava_Language_1_1_Compatiblefalse + MWJava_Language_emitHeaders0 + MWJava_Language_headerTypeJNINativeHeaders + MWJava_Language_packageFilter + MWJava_Language_genCommentstrue + MWJava_Language_genHeadersfalse + + + MWJava_MRJAppBuilder_outFileMRJApplication + MWJava_MRJAppBuilder_mergefalse + MWJava_MRJAppBuilder_quitMenutrue + MWJava_MRJAppBuilder_growfalse + MWJava_MRJAppBuilder_stdoutTypeConsole + MWJava_MRJAppBuilder_stderrTypeConsole + MWJava_MRJAppBuilder_stdinTypeConsole + MWJava_MRJAppBuilder_appIconPVersion0 + MWJava_MRJAppBuilder_appIconPType0 + MWJava_MRJAppBuilder_appIconPFormat0 + MWJava_MRJAppBuilder_appIconPTree + MWJava_MRJAppBuilder_appIconFile + MWJava_MRJAppBuilder_splashScreenPVersion0 + MWJava_MRJAppBuilder_splashScreenPType0 + MWJava_MRJAppBuilder_splashScreenPFormat0 + MWJava_MRJAppBuilder_splashScreenPTree + MWJava_MRJAppBuilder_splashScreenPICTFile + MWJava_MRJAppBuilder_aboutName + MWJava_MRJAppBuilder_stdoutPVersion0 + MWJava_MRJAppBuilder_stdoutPType0 + MWJava_MRJAppBuilder_stdoutPFormat0 + MWJava_MRJAppBuilder_stdoutPTree + MWJava_MRJAppBuilder_stdoutFile + MWJava_MRJAppBuilder_stdoutAppendfalse + MWJava_MRJAppBuilder_stderrPType0 + MWJava_MRJAppBuilder_stderrPFormat0 + MWJava_MRJAppBuilder_stderrPTree + MWJava_MRJAppBuilder_stderrFile + MWJava_MRJAppBuilder_stderrAppendfalse + MWJava_MRJAppBuilder_stdinPType0 + MWJava_MRJAppBuilder_stdinPFormat0 + MWJava_MRJAppBuilder_stdinPTree + MWJava_MRJAppBuilder_stdinFile + + + MWJava_Output_outputtypeJarFile + MWJava_Output_outfileJavaClasses.jar + MWJava_Output_ftype1514754080 + MWJava_Output_fcreator1297570384 + MWJava_Output_compress0 + MWJava_Output_genManifest0 + MWJava_Output_trunctypeFront + MWJava_Output_deleteClasses0 + MWJava_Output_consoleApp1 + + + MWJava_Proj_projtypeApplet + MWJava_Proj_mainClassName + MWJava_Proj_HTMLAppCreator1463898714 + MWJava_Proj_HTMLAppName + MWJava_Proj_PathVersion0 + MWJava_Proj_PathType0 + MWJava_Proj_PathFormat0 + MWJava_Proj_tree + MWJava_Proj_HTMLAppWin32Name + MWJava_Proj_compress0 + MWJava_Proj_useVM1 + MWJava_Proj_vmarguments + MWJava_Proj_vmName + MWJava_Proj_simPropFile + + + MWJavaDoc_Proj_Version1 + MWJavaDoc_Proj_Depricated1 + MWJavaDoc_Proj_Author1 + MWJavaDoc_Proj_Index1 + MWJavaDoc_Proj_Tree1 + MWJavaDoc_Proj_SunResolveToSame0 + MWJavaDoc_Proj_Shortnames1 + MWJavaDoc_Proj_Folder0 + MWJavaDoc_Proj_GenerateAPILinks0 + MWJavaDoc_Proj_scopePublic + MWJavaDoc_Proj_fcreator1297303877 + MWJavaDoc_Proj_encodingName + MWJavaDoc_Proj_decodingName + MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ + + + MWMerge_MacOS_projectTypeApplication + MWMerge_MacOS_outputNameMerge Out + MWMerge_MacOS_outputCreator???? + MWMerge_MacOS_outputTypeAPPL + MWMerge_MacOS_suppressWarning0 + MWMerge_MacOS_copyFragments1 + MWMerge_MacOS_copyResources1 + MWMerge_MacOS_flattenResource0 + MWMerge_MacOS_flatFileNamea.rsrc + MWMerge_MacOS_flatFileOutputPath + Path: + PathFormatMacOS + PathRootProject + + MWMerge_MacOS_skipResources + DLGX + ckid + Proj + WSPC + + + + FileLockedfalse + ResourcesMapIsReadOnlyfalse + PrinterDriverIsMultiFinderCompatiblefalse + Invisiblefalse + HasBundlefalse + NameLockedfalse + Stationeryfalse + HasCustomIconfalse + Sharedfalse + HasBeenInitedfalse + Label0 + Comments + + + MWMacOSPackager_UsePackager0 + MWMacOSPackager_FolderToPackage + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreateClassicAlias0 + MWMacOSPackager_ClassicAliasMethodUseTargetOutput + MWMacOSPackager_ClassicAliasPath + Path: + PathFormatMacOS + PathRootProject + + MWMacOSPackager_CreatePkgInfo0 + MWMacOSPackager_PkgCreatorType???? + MWMacOSPackager_PkgFileTypeAPPL + + + MWCodeGen_PPC_structalignmentMC68K + MWCodeGen_PPC_tracebacktablesNone + MWCodeGen_PPC_processorGeneric + MWCodeGen_PPC_readonlystrings0 + MWCodeGen_PPC_tocdata1 + MWCodeGen_PPC_profiler0 + MWCodeGen_PPC_fpcontract1 + MWCodeGen_PPC_schedule0 + MWCodeGen_PPC_peephole1 + MWCodeGen_PPC_processorspecific0 + MWCodeGen_PPC_altivec0 + MWCodeGen_PPC_vectortocdata0 + MWCodeGen_PPC_vrsave0 + + + MWCodeGen_MachO_structalignmentPPC + MWCodeGen_MachO_tracebacktablesNone + MWCodeGen_MachO_processorGeneric + MWCodeGen_MachO_readonlystrings0 + MWCodeGen_MachO_profiler0 + MWCodeGen_MachO_fpcontract1 + MWCodeGen_MachO_schedule0 + MWCodeGen_MachO_peephole1 + MWCodeGen_MachO_processorspecific0 + MWCodeGen_MachO_altivec0 + MWCodeGen_MachO_vrsave1 + MWCodeGen_MachO_common0 + MWCodeGen_MachO_implicit_templates1 + + + MWDisassembler_PPC_showcode1 + MWDisassembler_PPC_extended1 + MWDisassembler_PPC_mix0 + MWDisassembler_PPC_nohex0 + MWDisassembler_PPC_showdata1 + MWDisassembler_PPC_showexceptions1 + MWDisassembler_PPC_showsym0 + MWDisassembler_PPC_shownames1 + + + GlobalOptimizer_PPC_optimizationlevelLevel0 + GlobalOptimizer_PPC_optforSpeed + + + MWLinker_PPC_linksym1 + MWLinker_PPC_symfullpath1 + MWLinker_PPC_linkmap0 + MWLinker_PPC_nolinkwarnings0 + MWLinker_PPC_dontdeadstripinitcode0 + MWLinker_PPC_permitmultdefs0 + MWLinker_PPC_linkmodeFast + MWLinker_PPC_initname + MWLinker_PPC_mainname__start + MWLinker_PPC_termname + + + MWLinker_MachO_exportsNone + MWLinker_MachO_mainnamestart + MWLinker_MachO_currentversion0 + MWLinker_MachO_compatibleversion0 + MWLinker_MachO_symfullpath0 + MWLinker_MachO_supresswarnings0 + MWLinker_MachO_multisymerror0 + MWLinker_MachO_prebind1 + MWLinker_MachO_deadstrip1 + MWLinker_MachO_objectivecsemantics0 + MWLinker_MachO_whichfileloaded0 + MWLinker_MachO_whyfileloaded0 + MWLinker_MachO_readonlyrelocsErrors + MWLinker_MachO_undefinedsymbolsErrors + MWLinker_MachO_twolevelnamespace1 + MWLinker_MachO_stripdebugsymbols0 + + + MWProject_MachO_typeExecutable + MWProject_MachO_outfilea.exe + MWProject_MachO_filecreator???? + MWProject_MachO_filetypeMEXE + MWProject_MachO_stacksize64 + MWProject_MachO_stackaddress0 + MWProject_MachO_flatrsrc1 + MWProject_MachO_flatrsrcfilenamea.rsrc + MWProject_MachO_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_MachO_installpath./ + + + MWPEF_exportsNone + MWPEF_libfolder0 + MWPEF_sortcodeNone + MWPEF_expandbss0 + MWPEF_sharedata0 + MWPEF_olddefversion0 + MWPEF_oldimpversion0 + MWPEF_currentversion0 + MWPEF_fragmentname + MWPEF_collapsereloads0 + + + MWProject_PPC_typeApplication + MWProject_PPC_outfilea.out + MWProject_PPC_filecreator???? + MWProject_PPC_filetypeAPPL + MWProject_PPC_size384 + MWProject_PPC_minsize384 + MWProject_PPC_stacksize64 + MWProject_PPC_flags22720 + MWProject_PPC_symfilename + MWProject_PPC_rsrcname + MWProject_PPC_rsrcheaderNative + MWProject_PPC_rsrctype???? + MWProject_PPC_rsrcid0 + MWProject_PPC_rsrcflags0 + MWProject_PPC_rsrcstore0 + MWProject_PPC_rsrcmerge0 + MWProject_PPC_flatrsrc0 + MWProject_PPC_flatrsrcoutputdir + Path: + PathFormatMacOS + PathRootProject + + MWProject_PPC_flatrsrcfilename + + + MWAssembler_PPC_auxheader0 + MWAssembler_PPC_symmodeMac + MWAssembler_PPC_dialectPPC + MWAssembler_PPC_prefixfile + MWAssembler_PPC_typecheck0 + MWAssembler_PPC_warnings0 + MWAssembler_PPC_casesensitive0 + + + MWRez_Language_maxwidth80 + MWRez_Language_scriptRoman + MWRez_Language_alignmentAlign1 + MWRez_Language_filtermodeFilterSkip + MWRez_Language_suppresswarnings0 + MWRez_Language_escapecontrolchars1 + MWRez_Language_prefixname + MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' + + + MWWinRC_prefixname + + + MWCodeGen_X86_processorGeneric + MWCodeGen_X86_alignmentbytes8 + MWCodeGen_X86_exceptionsZeroOverhead + MWCodeGen_X86_extinst_mmx0 + MWCodeGen_X86_extinst_3dnow0 + MWCodeGen_X86_use_mmx_3dnow_convention0 + MWCodeGen_X86_machinecodelisting0 + MWCodeGen_X86_intrinsics0 + MWCodeGen_X86_syminfo0 + MWCodeGen_X86_codeviewinfo1 + MWCodeGen_X86_extinst_cmov_fcomi0 + MWCodeGen_X86_extinst_sse0 + + + PDisasmX86_showHeaderstrue + PDisasmX86_showSymTabtrue + PDisasmX86_showCodetrue + PDisasmX86_showSourcefalse + PDisasmX86_showHextrue + PDisasmX86_showRelocationtrue + PDisasmX86_showCommentsfalse + PDisasmX86_showDebugfalse + PDisasmX86_showExceptionsfalse + PDisasmX86_showDatatrue + PDisasmX86_showRawfalse + PDisasmX86_verbosefalse + + + MWDebugger_X86_Exceptions + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + GlobalOptimizer_X86_optimizationlevelLevel0 + GlobalOptimizer_X86_optforSpeed + + + MWLinker_X86_entrypointusageDefault + MWLinker_X86_entrypoint + MWLinker_X86_subsystemWinGUI + MWLinker_X86_subsysmajorid4 + MWLinker_X86_subsysminorid0 + MWLinker_X86_usrmajorid0 + MWLinker_X86_usrminorid0 + MWLinker_X86_commandfile + MWLinker_X86_generatemap0 + MWLinker_X86_linksym0 + MWLinker_X86_linkCV1 + + + MWProject_X86_typeApplication + MWProject_X86_outfilenoname.exe + MWProject_X86_baseaddress4194304 + MWProject_X86_maxstacksize1024 + MWProject_X86_minstacksize4 + MWProject_X86_size1024 + MWProject_X86_minsize4 + MWProject_X86_importlib + xpidl Settings + 0001000301010B646F6D5F7376672E7870747470740000000000000000000000 + 0000000000000000 + + + + + Name + nsIDOMSVGAnimatedLength.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimatedPathData.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimatedPoints.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimatedRect.idl + MacOS + Text + + + + Name + nsIDOMSVGCircleElement.idl + MacOS + Text + + + + Name + nsIDOMSVGElement.idl + MacOS + Text + + + + Name + nsIDOMSVGFitToViewBox.idl + MacOS + Text + + + + Name + nsIDOMSVGGElement.idl + MacOS + Text + + + + Name + nsIDOMSVGLength.idl + MacOS + Text + + + + Name + nsIDOMSVGLineElement.idl + MacOS + Text + + + + Name + nsIDOMSVGLocatable.idl + MacOS + Text + + + + Name + nsIDOMSVGMatrix.idl + MacOS + Text + + + + Name + nsIDOMSVGPathElement.idl + MacOS + Text + + + + Name + nsIDOMSVGPathSeg.idl + MacOS + Text + + + + Name + nsIDOMSVGPathSegList.idl + MacOS + Text + + + + Name + nsIDOMSVGPoint.idl + MacOS + Text + + + + Name + nsIDOMSVGPointList.idl + MacOS + Text + + + + Name + nsIDOMSVGPolygonElement.idl + MacOS + Text + + + + Name + nsIDOMSVGPolylineElement.idl + MacOS + Text + + + + Name + nsIDOMSVGRect.idl + MacOS + Text + + + + Name + nsIDOMSVGRectElement.idl + MacOS + Text + + + + Name + nsIDOMSVGStylable.idl + MacOS + Text + + + + Name + nsIDOMSVGSVGElement.idl + MacOS + Text + + + + Name + nsIDOMSVGTransform.idl + MacOS + Text + + + + Name + nsIDOMSVGTransformable.idl + MacOS + Text + + + + Name + nsIDOMSVGTransformList.idl + MacOS + Text + + + + Name + nsIDOMSVGDocument.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimPresAspRatio.idl + MacOS + Text + + + + Name + nsIDOMSVGAnimTransformList.idl + MacOS + Text + + + + Name + nsIDOMSVGForeignObjectElem.idl + MacOS + Text + + + + Name + nsIDOMSVGPresAspectRatio.idl + MacOS + Text + + + + Name + nsIDOMSVGEllipseElement.idl + MacOS + Text + + + + + + Name + nsIDOMSVGAnimatedLength.idl + MacOS + + + Name + nsIDOMSVGAnimatedPathData.idl + MacOS + + + Name + nsIDOMSVGAnimatedPoints.idl + MacOS + + + Name + nsIDOMSVGAnimatedRect.idl + MacOS + + + Name + nsIDOMSVGCircleElement.idl + MacOS + + + Name + nsIDOMSVGElement.idl + MacOS + + + Name + nsIDOMSVGFitToViewBox.idl + MacOS + + + Name + nsIDOMSVGGElement.idl + MacOS + + + Name + nsIDOMSVGLength.idl + MacOS + + + Name + nsIDOMSVGLineElement.idl + MacOS + + + Name + nsIDOMSVGLocatable.idl + MacOS + + + Name + nsIDOMSVGMatrix.idl + MacOS + + + Name + nsIDOMSVGPathElement.idl + MacOS + + + Name + nsIDOMSVGPathSeg.idl + MacOS + + + Name + nsIDOMSVGPathSegList.idl + MacOS + + + Name + nsIDOMSVGPoint.idl + MacOS + + + Name + nsIDOMSVGPointList.idl + MacOS + + + Name + nsIDOMSVGPolygonElement.idl + MacOS + + + Name + nsIDOMSVGPolylineElement.idl + MacOS + + + Name + nsIDOMSVGRect.idl + MacOS + + + Name + nsIDOMSVGRectElement.idl + MacOS + + + Name + nsIDOMSVGStylable.idl + MacOS + + + Name + nsIDOMSVGSVGElement.idl + MacOS + + + Name + nsIDOMSVGTransform.idl + MacOS + + + Name + nsIDOMSVGTransformable.idl + MacOS + + + Name + nsIDOMSVGTransformList.idl + MacOS + + + Name + nsIDOMSVGDocument.idl + MacOS + + + Name + nsIDOMSVGAnimPresAspRatio.idl + MacOS + + + Name + nsIDOMSVGAnimTransformList.idl + MacOS + + + Name + nsIDOMSVGForeignObjectElem.idl + MacOS + + + Name + nsIDOMSVGPresAspectRatio.idl + MacOS + + + Name + nsIDOMSVGEllipseElement.idl + MacOS + + + + + + + headers + dom_svg.xpt + + + + + headers + Name + nsIDOMSVGEllipseElement.idl + MacOS + + + headers + Name + nsIDOMSVGAnimatedLength.idl + MacOS + + + headers + Name + nsIDOMSVGAnimatedPathData.idl + MacOS + + + headers + Name + nsIDOMSVGAnimatedPoints.idl + MacOS + + + headers + Name + nsIDOMSVGAnimatedRect.idl + MacOS + + + headers + Name + nsIDOMSVGCircleElement.idl + MacOS + + + headers + Name + nsIDOMSVGElement.idl + MacOS + + + headers + Name + nsIDOMSVGFitToViewBox.idl + MacOS + + + headers + Name + nsIDOMSVGGElement.idl + MacOS + + + headers + Name + nsIDOMSVGLength.idl + MacOS + + + headers + Name + nsIDOMSVGLineElement.idl + MacOS + + + headers + Name + nsIDOMSVGLocatable.idl + MacOS + + + headers + Name + nsIDOMSVGMatrix.idl + MacOS + + + headers + Name + nsIDOMSVGPathElement.idl + MacOS + + + headers + Name + nsIDOMSVGPathSeg.idl + MacOS + + + headers + Name + nsIDOMSVGPathSegList.idl + MacOS + + + headers + Name + nsIDOMSVGPoint.idl + MacOS + + + headers + Name + nsIDOMSVGPointList.idl + MacOS + + + headers + Name + nsIDOMSVGPolygonElement.idl + MacOS + + + headers + Name + nsIDOMSVGPolylineElement.idl + MacOS + + + headers + Name + nsIDOMSVGRect.idl + MacOS + + + headers + Name + nsIDOMSVGRectElement.idl + MacOS + + + headers + Name + nsIDOMSVGStylable.idl + MacOS + + + headers + Name + nsIDOMSVGSVGElement.idl + MacOS + + + headers + Name + nsIDOMSVGTransform.idl + MacOS + + + headers + Name + nsIDOMSVGTransformable.idl + MacOS + + + headers + Name + nsIDOMSVGTransformList.idl + MacOS + + + headers + Name + nsIDOMSVGDocument.idl + MacOS + + + headers + Name + nsIDOMSVGAnimPresAspRatio.idl + MacOS + + + headers + Name + nsIDOMSVGAnimTransformList.idl + MacOS + + + headers + Name + nsIDOMSVGForeignObjectElem.idl + MacOS + + + headers + Name + nsIDOMSVGPresAspectRatio.idl + MacOS + + + + diff --git a/dom/public/idl/Makefile.in b/dom/public/idl/Makefile.in index 56faadb0936b..c484fd5c07e5 100644 --- a/dom/public/idl/Makefile.in +++ b/dom/public/idl/Makefile.in @@ -26,7 +26,22 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = base core html events stylesheets views css traversal range xbl xul +DIRS = \ + base \ + core \ + html \ + events \ + stylesheets \ + views \ + css \ + traversal \ + range \ + xbl \ + xul + +ifdef MOZ_SVG +DIRS += svg +endif include $(topsrcdir)/config/rules.mk diff --git a/dom/public/idl/makefile.win b/dom/public/idl/makefile.win index 94a1adb21631..ce1e0bb4ef96 100644 --- a/dom/public/idl/makefile.win +++ b/dom/public/idl/makefile.win @@ -22,7 +22,21 @@ DEPTH=..\..\.. -DIRS=base core html events stylesheets views css traversal range xbl xul +DIRS= \ + base \ + core \ + html \ + events \ + stylesheets \ + views \ + css \ + traversal \ + range \ + xbl \ +!ifdef MOZ_SVG + svg \ +!endif + xul include <$(DEPTH)\config\rules.mak> diff --git a/dom/public/idl/svg/.cvsignore b/dom/public/idl/svg/.cvsignore new file mode 100644 index 000000000000..f3c7a7c5da68 --- /dev/null +++ b/dom/public/idl/svg/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/dom/public/idl/svg/MANIFEST_IDL b/dom/public/idl/svg/MANIFEST_IDL new file mode 100644 index 000000000000..c3d0d755d3b1 --- /dev/null +++ b/dom/public/idl/svg/MANIFEST_IDL @@ -0,0 +1,32 @@ +nsIDOMSVGAnimatedLength.idl +nsIDOMSVGAnimatedPathData.idl +nsIDOMSVGAnimatedPoints.idl +nsIDOMSVGAnimPresAspRatio.idl +nsIDOMSVGAnimatedRect.idl +nsIDOMSVGAnimTransformList.idl +nsIDOMSVGCircleElement.idl +nsIDOMSVGDocument.idl +nsIDOMSVGElement.idl +nsIDOMSVGEllipseElement.idl +nsIDOMSVGFitToViewBox.idl +nsIDOMSVGForeignObjectElem.idl +nsIDOMSVGGElement.idl +nsIDOMSVGLength.idl +nsIDOMSVGLineElement.idl +nsIDOMSVGLocatable.idl +nsIDOMSVGMatrix.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 +nsIDOMSVGTransform.idl +nsIDOMSVGTransformList.idl +nsIDOMSVGTransformable.idl diff --git a/dom/public/idl/svg/Makefile.in b/dom/public/idl/svg/Makefile.in new file mode 100644 index 000000000000..42aa20769ef2 --- /dev/null +++ b/dom/public/idl/svg/Makefile.in @@ -0,0 +1,67 @@ +#!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 = \ + nsIDOMSVGAnimatedLength.idl \ + nsIDOMSVGAnimatedPathData.idl \ + nsIDOMSVGAnimatedPoints.idl \ + nsIDOMSVGAnimPresAspRatio.idl \ + nsIDOMSVGAnimatedRect.idl \ + nsIDOMSVGAnimTransformList.idl \ + nsIDOMSVGCircleElement.idl \ + nsIDOMSVGDocument.idl \ + nsIDOMSVGElement.idl \ + nsIDOMSVGEllipseElement.idl \ + nsIDOMSVGFitToViewBox.idl \ + nsIDOMSVGForeignObjectElem.idl \ + nsIDOMSVGGElement.idl \ + nsIDOMSVGLength.idl \ + nsIDOMSVGLineElement.idl \ + nsIDOMSVGLocatable.idl \ + nsIDOMSVGMatrix.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 \ + nsIDOMSVGTransform.idl \ + nsIDOMSVGTransformList.idl \ + nsIDOMSVGTransformable.idl \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/dom/public/idl/svg/makefile.win b/dom/public/idl/svg/makefile.win new file mode 100644 index 000000000000..acaf36526c88 --- /dev/null +++ b/dom/public/idl/svg/makefile.win @@ -0,0 +1,65 @@ +#!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. +# +# Contributor(s): +# +# Alex Fritze +# + +DEPTH=..\..\..\.. + +MODULE=dom +XPIDL_MODULE=dom_svg + +XPIDLSRCS = \ + .\nsIDOMSVGAnimatedLength.idl \ + .\nsIDOMSVGAnimatedPathData.idl \ + .\nsIDOMSVGAnimatedPoints.idl \ + .\nsIDOMSVGAnimPresAspRatio.idl \ + .\nsIDOMSVGAnimatedRect.idl \ + .\nsIDOMSVGAnimTransformList.idl \ + .\nsIDOMSVGCircleElement.idl \ + .\nsIDOMSVGDocument.idl \ + .\nsIDOMSVGElement.idl \ + .\nsIDOMSVGEllipseElement.idl \ + .\nsIDOMSVGFitToViewBox.idl \ + .\nsIDOMSVGForeignObjectElem.idl \ + .\nsIDOMSVGGElement.idl \ + .\nsIDOMSVGLength.idl \ + .\nsIDOMSVGLineElement.idl \ + .\nsIDOMSVGLocatable.idl \ + .\nsIDOMSVGMatrix.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 \ + .\nsIDOMSVGTransform.idl \ + .\nsIDOMSVGTransformList.idl \ + .\nsIDOMSVGTransformable.idl \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> diff --git a/dom/public/idl/svg/nsIDOMSVGAnimPresAspRatio.idl b/dom/public/idl/svg/nsIDOMSVGAnimPresAspRatio.idl new file mode 100644 index 000000000000..7cecc74b9d88 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGAnimPresAspRatio.idl @@ -0,0 +1,48 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGPreserveAspectRatio; + +[scriptable, uuid(afcd7cd4-d74d-492f-b3b1-d71bfa36874f)] +interface nsIDOMSVGAnimatedPreserveAspectRatio : nsISupports +{ + readonly attribute nsIDOMSVGPreserveAspectRatio baseVal; + readonly attribute nsIDOMSVGPreserveAspectRatio animVal; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGAnimTransformList.idl b/dom/public/idl/svg/nsIDOMSVGAnimTransformList.idl new file mode 100644 index 000000000000..496e0c8b57ac --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGAnimTransformList.idl @@ -0,0 +1,48 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGTransformList; + +[scriptable, uuid(fd54c8c4-2eb4-4849-8df6-79985c2491da)] +interface nsIDOMSVGAnimatedTransformList : nsISupports +{ + readonly attribute nsIDOMSVGTransformList baseVal; + readonly attribute nsIDOMSVGTransformList animVal; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGAnimatedLength.idl b/dom/public/idl/svg/nsIDOMSVGAnimatedLength.idl new file mode 100644 index 000000000000..34e3eb6e66ed --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGAnimatedLength.idl @@ -0,0 +1,49 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGLength; + +[scriptable, uuid(a52f0322-7f4d-418d-af6d-a7b14abd5cdf)] +interface nsIDOMSVGAnimatedLength : nsISupports +{ + readonly attribute nsIDOMSVGLength baseVal; + readonly attribute nsIDOMSVGLength animVal; +}; + diff --git a/dom/public/idl/svg/nsIDOMSVGAnimatedPathData.idl b/dom/public/idl/svg/nsIDOMSVGAnimatedPathData.idl new file mode 100644 index 000000000000..2fb587615292 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGAnimatedPathData.idl @@ -0,0 +1,51 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGPathSegList; + +[scriptable, uuid(6ef2b400-dbf4-4c12-8787-fe15caac5648)] +interface nsIDOMSVGAnimatedPathData : nsISupports +{ + readonly attribute nsIDOMSVGPathSegList pathSegList; + readonly attribute nsIDOMSVGPathSegList normalizedPathSegList; + readonly attribute nsIDOMSVGPathSegList animatedPathSegList; + readonly attribute nsIDOMSVGPathSegList animatedNormalizedPathSegList; +}; + diff --git a/dom/public/idl/svg/nsIDOMSVGAnimatedPoints.idl b/dom/public/idl/svg/nsIDOMSVGAnimatedPoints.idl new file mode 100644 index 000000000000..19102752bf96 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGAnimatedPoints.idl @@ -0,0 +1,49 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGPointList; + +[scriptable, uuid(ebf334b3-86ef-4bf3-8a92-d775c72defa4)] +interface nsIDOMSVGAnimatedPoints : nsISupports +{ + readonly attribute nsIDOMSVGPointList points; + readonly attribute nsIDOMSVGPointList animatedPoints; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGAnimatedRect.idl b/dom/public/idl/svg/nsIDOMSVGAnimatedRect.idl new file mode 100644 index 000000000000..3dfa5a5e8b44 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGAnimatedRect.idl @@ -0,0 +1,48 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGRect; + +[scriptable, uuid(ca45959e-f1da-46f6-af19-1ecdc322285a)] +interface nsIDOMSVGAnimatedRect : nsISupports +{ + readonly attribute nsIDOMSVGRect baseVal; + readonly attribute nsIDOMSVGRect animVal; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGCircleElement.idl b/dom/public/idl/svg/nsIDOMSVGCircleElement.idl new file mode 100644 index 000000000000..12c1dd34b91f --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGCircleElement.idl @@ -0,0 +1,65 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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; + +[scriptable, uuid(0f89f2a4-b168-4602-90f5-1874418c0a6a)] +interface nsIDOMSVGCircleElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget +*/ +{ + readonly attribute nsIDOMSVGAnimatedLength cx; + readonly attribute nsIDOMSVGAnimatedLength cy; + readonly attribute nsIDOMSVGAnimatedLength r; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGDocument.idl b/dom/public/idl/svg/nsIDOMSVGDocument.idl new file mode 100644 index 000000000000..8a4d029ed65f --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGDocument.idl @@ -0,0 +1,51 @@ +/* -*- 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 code. + * + * 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): + * + * 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 "nsIDOMDocument.idl" + +interface nsIDOMSVGSVGElement; + +[scriptable, uuid(12d3b664-1dd2-11b2-a7cf-ceee7e90f396)] +interface nsIDOMSVGDocument : nsIDOMDocument + /* , nsIDOMDocumentEvent */ +{ + readonly attribute DOMString title; + readonly attribute DOMString referrer; + readonly attribute DOMString domain; + readonly attribute DOMString URL; + readonly attribute nsIDOMSVGSVGElement rootElement; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGElement.idl b/dom/public/idl/svg/nsIDOMSVGElement.idl new file mode 100644 index 000000000000..6c1daca0828c --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGElement.idl @@ -0,0 +1,50 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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 "nsIDOMElement.idl" + +interface nsIDOMSVGSVGElement; + +[scriptable, uuid(e0be7cbb-81c1-4663-8f95-109d96a60b6b)] +interface nsIDOMSVGElement : nsIDOMElement +{ + attribute DOMString id; + // raises DOMException on setting + readonly attribute nsIDOMSVGSVGElement ownerSVGElement; + readonly attribute nsIDOMSVGElement viewportElement; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGEllipseElement.idl b/dom/public/idl/svg/nsIDOMSVGEllipseElement.idl new file mode 100644 index 000000000000..694b121d8784 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGEllipseElement.idl @@ -0,0 +1,66 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * William Cook (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; + +[scriptable, uuid(5D1CD1E6-4A14-4056-ACC0-2F78C1672898)] +interface nsIDOMSVGEllipseElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget +*/ +{ + readonly attribute nsIDOMSVGAnimatedLength cx; + readonly attribute nsIDOMSVGAnimatedLength cy; + readonly attribute nsIDOMSVGAnimatedLength rx; + readonly attribute nsIDOMSVGAnimatedLength ry; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGFitToViewBox.idl b/dom/public/idl/svg/nsIDOMSVGFitToViewBox.idl new file mode 100644 index 000000000000..d6455d16a72b --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGFitToViewBox.idl @@ -0,0 +1,49 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGAnimatedRect; +interface nsIDOMSVGAnimatedPreserveAspectRatio; + +[scriptable, uuid(089410F3-9777-44f1-A882-AB4225696434)] +interface nsIDOMSVGFitToViewBox : nsISupports +{ + readonly attribute nsIDOMSVGAnimatedRect viewBox; + readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGForeignObjectElem.idl b/dom/public/idl/svg/nsIDOMSVGForeignObjectElem.idl new file mode 100644 index 000000000000..70994a46576b --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGForeignObjectElem.idl @@ -0,0 +1,66 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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; + +[scriptable, uuid(fd9c9871-23fd-48eb-a65b-3842e9b0acbd)] +interface nsIDOMSVGForeignObjectElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget +*/ +{ + readonly attribute nsIDOMSVGAnimatedLength x; + readonly attribute nsIDOMSVGAnimatedLength y; + readonly attribute nsIDOMSVGAnimatedLength width; + readonly attribute nsIDOMSVGAnimatedLength height; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGGElement.idl b/dom/public/idl/svg/nsIDOMSVGGElement.idl new file mode 100644 index 000000000000..342dbd891a0f --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGGElement.idl @@ -0,0 +1,61 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +[scriptable, uuid(0bd57cbd-a090-44aa-a61b-2fb876841194)] +interface nsIDOMSVGGElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget +*/ +{ + +}; diff --git a/dom/public/idl/svg/nsIDOMSVGLength.idl b/dom/public/idl/svg/nsIDOMSVGLength.idl new file mode 100644 index 000000000000..5ee464db16ef --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGLength.idl @@ -0,0 +1,77 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGMatrix; + +[scriptable, uuid(10231b04-7482-4960-bada-3dced0d586fc)] +interface nsIDOMSVGLength : nsISupports +{ + // Length Unit Types + const unsigned short SVG_LENGTHTYPE_UNKNOWN = 0; + const unsigned short SVG_LENGTHTYPE_NUMBER = 1; + const unsigned short SVG_LENGTHTYPE_PERCENTAGE = 2; + const unsigned short SVG_LENGTHTYPE_EMS = 3; + const unsigned short SVG_LENGTHTYPE_EXS = 4; + const unsigned short SVG_LENGTHTYPE_PX = 5; + const unsigned short SVG_LENGTHTYPE_CM = 6; + const unsigned short SVG_LENGTHTYPE_MM = 7; + const unsigned short SVG_LENGTHTYPE_IN = 8; + const unsigned short SVG_LENGTHTYPE_PT = 9; + const unsigned short SVG_LENGTHTYPE_PC = 10; + + readonly attribute unsigned short unitType; + attribute float value; + // raises DOMException on setting + attribute float valueInSpecifiedUnits; + // raises DOMException on setting + attribute DOMString valueAsString; + // raises DOMException on setting + + void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits); + void convertToSpecifiedUnits(in unsigned short unitType); + + // Mozilla extension, not part of W3 SVG DOM: + float getTransformedValue(in nsIDOMSVGMatrix matrix); + +}; + + + + diff --git a/dom/public/idl/svg/nsIDOMSVGLineElement.idl b/dom/public/idl/svg/nsIDOMSVGLineElement.idl new file mode 100644 index 000000000000..49a678d5b75f --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGLineElement.idl @@ -0,0 +1,66 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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; + +[scriptable, uuid(4ea07ef3-ed66-4b41-8119-4afc6d0ed5af)] +interface nsIDOMSVGLineElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget +*/ +{ + readonly attribute nsIDOMSVGAnimatedLength x1; + readonly attribute nsIDOMSVGAnimatedLength y1; + readonly attribute nsIDOMSVGAnimatedLength x2; + readonly attribute nsIDOMSVGAnimatedLength y2; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGLocatable.idl b/dom/public/idl/svg/nsIDOMSVGLocatable.idl new file mode 100644 index 000000000000..d7a21ab957fb --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGLocatable.idl @@ -0,0 +1,56 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGRect; +interface nsIDOMSVGMatrix; +interface nsIDOMSVGElement; + +[scriptable, uuid(9cf4fc9c-90b2-4d66-88f5-35049b558aee)] +interface nsIDOMSVGLocatable : nsISupports +{ + readonly attribute nsIDOMSVGElement nearestViewportElement; + readonly attribute nsIDOMSVGElement farthestViewportElement; + + nsIDOMSVGRect getBBox(); + nsIDOMSVGMatrix getCTM(); + nsIDOMSVGMatrix getScreenCTM(); + nsIDOMSVGMatrix getTransformToElement(in nsIDOMSVGElement element); + // raises( SVGException ); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGMatrix.idl b/dom/public/idl/svg/nsIDOMSVGMatrix.idl new file mode 100644 index 000000000000..5ab23c286f41 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGMatrix.idl @@ -0,0 +1,70 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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(ec2da3ef-5a99-49ed-aaef-b5af916c14ac)] +interface nsIDOMSVGMatrix : nsISupports +{ + attribute float a; + // raises DOMException on setting + attribute float b; + // raises DOMException on setting + attribute float c; + // raises DOMException on setting + attribute float d; + // raises DOMException on setting + attribute float e; + // raises DOMException on setting + attribute float f; + // raises DOMException on setting + + nsIDOMSVGMatrix multiply(in nsIDOMSVGMatrix secondMatrix); + nsIDOMSVGMatrix inverse(); + // raises( SVGException ); + nsIDOMSVGMatrix translate(in float x, in float y); + nsIDOMSVGMatrix scale(in float scaleFactor); + nsIDOMSVGMatrix scaleNonUniform(in float scaleFactorX, in float scaleFactorY); + nsIDOMSVGMatrix rotate(in float angle); + nsIDOMSVGMatrix rotateFromVector(in float x, in float y); + // raises( SVGException ); + nsIDOMSVGMatrix flipX(); + nsIDOMSVGMatrix flipY(); + nsIDOMSVGMatrix skewX(in float angle); + nsIDOMSVGMatrix skewY(in float angle); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGPathElement.idl b/dom/public/idl/svg/nsIDOMSVGPathElement.idl new file mode 100644 index 000000000000..b4dc84db53df --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPathElement.idl @@ -0,0 +1,142 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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 nsIDOMSVGAnimatedNumber; +interface nsIDOMSVGPoint; +interface nsIDOMSVGPathSegClosePath; +interface nsIDOMSVGPathSegMovetoAbs; +interface nsIDOMSVGPathSegMovetoRel; +interface nsIDOMSVGPathSegLinetoAbs; +interface nsIDOMSVGPathSegLinetoRel; +interface nsIDOMSVGPathSegCurvetoCubicAbs; +interface nsIDOMSVGPathSegCurvetoCubicRel; +interface nsIDOMSVGPathSegCurvetoQuadraticAbs; +interface nsIDOMSVGPathSegCurvetoQuadraticRel; +interface nsIDOMSVGPathSegArcAbs; +interface nsIDOMSVGPathSegArcRel; +interface nsIDOMSVGPathSegLinetoHorizontalAbs; +interface nsIDOMSVGPathSegLinetoHorizontalRel; +interface nsIDOMSVGPathSegLinetoVerticalAbs; +interface nsIDOMSVGPathSegLinetoVerticalRel; +interface nsIDOMSVGPathSegCurvetoCubicSmoothAbs; +interface nsIDOMSVGPathSegCurvetoCubicSmoothRel; +interface nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs; +interface nsIDOMSVGPathSegCurvetoQuadraticSmoothRel; + +[scriptable, uuid(2b19e692-3338-440f-a998-3cb1e8474999)] +interface nsIDOMSVGPathElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget, + nsIDOMSVGAnimatedPathData +*/ +{ + readonly attribute nsIDOMSVGAnimatedNumber pathLength; + + float getTotalLength(); + nsIDOMSVGPoint getPointAtLength(in float distance); + unsigned long getPathSegAtLength(in float distance); + + nsIDOMSVGPathSegClosePath createSVGPathSegClosePath(); + nsIDOMSVGPathSegMovetoAbs createSVGPathSegMovetoAbs(in float x, in float y); + nsIDOMSVGPathSegMovetoRel createSVGPathSegMovetoRel(in float x, in float y); + nsIDOMSVGPathSegLinetoAbs createSVGPathSegLinetoAbs(in float x, in float y); + nsIDOMSVGPathSegLinetoRel createSVGPathSegLinetoRel(in float x, in float y); + + nsIDOMSVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs(in float x, + in float y, + in float x1, + in float y1, + in float x2, + in float y2); + nsIDOMSVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel(in float x, + in float y, + in float x1, + in float y1, + in float x2, + in float y2); + nsIDOMSVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs(in float x, + in float y, + in float x1, + in float y1); + nsIDOMSVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel(in float x, + in float y, + in float x1, + in float y1); + + nsIDOMSVGPathSegArcAbs createSVGPathSegArcAbs(in float x, in float y, in float r1, + in float r2, in float angle, + in boolean largeArcFlag, + in boolean sweepFlag); + nsIDOMSVGPathSegArcRel createSVGPathSegArcRel(in float x, in float y, in float r1, + in float r2, in float angle, + in boolean largeArcFlag, + in boolean sweepFlag); + + nsIDOMSVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(in float x); + nsIDOMSVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(in float x); + nsIDOMSVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(in float y); + nsIDOMSVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(in float y); + + nsIDOMSVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(in float x, + in float y, + in float x2, + in float y2); + nsIDOMSVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(in float x, + in float y, + in float x2, + in float y2); + nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(in float x, + in float y); + nsIDOMSVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(in float x, + in float y); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGPathSeg.idl b/dom/public/idl/svg/nsIDOMSVGPathSeg.idl new file mode 100644 index 000000000000..37b349a9bb74 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPathSeg.idl @@ -0,0 +1,281 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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(b9022da7-e26d-4df3-8c94-b45c4aedda7c)] +interface nsIDOMSVGPathSeg : nsISupports +{ + // Path Segment Types + const unsigned short PATHSEG_UNKNOWN = 0; + const unsigned short PATHSEG_CLOSEPATH = 1; + const unsigned short PATHSEG_MOVETO_ABS = 2; + const unsigned short PATHSEG_MOVETO_REL = 3; + const unsigned short PATHSEG_LINETO_ABS = 4; + const unsigned short PATHSEG_LINETO_REL = 5; + const unsigned short PATHSEG_CURVETO_CUBIC_ABS = 6; + const unsigned short PATHSEG_CURVETO_CUBIC_REL = 7; + const unsigned short PATHSEG_CURVETO_QUADRATIC_ABS = 8; + const unsigned short PATHSEG_CURVETO_QUADRATIC_REL = 9; + const unsigned short PATHSEG_ARC_ABS = 10; + const unsigned short PATHSEG_ARC_REL = 11; + const unsigned short PATHSEG_LINETO_HORIZONTAL_ABS = 12; + const unsigned short PATHSEG_LINETO_HORIZONTAL_REL = 13; + const unsigned short PATHSEG_LINETO_VERTICAL_ABS = 14; + const unsigned short PATHSEG_LINETO_VERTICAL_REL = 15; + const unsigned short PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16; + const unsigned short PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17; + const unsigned short PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18; + const unsigned short PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19; + + readonly attribute unsigned short pathSegType; + readonly attribute DOMString pathSegTypeAsLetter; +}; + + +[scriptable, uuid(2b72d033-f115-45aa-9748-8c11ea07b845)] +interface nsIDOMSVGPathSegClosePath : nsIDOMSVGPathSeg +{ +}; + + +[scriptable, uuid(b0106d01-9746-440b-b067-68ee043dabc3)] +interface nsIDOMSVGPathSegMovetoAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(c6ee1ddd-8b35-4e1b-b381-c063a28012d9)] +interface nsIDOMSVGPathSegMovetoRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(bac3648d-55a3-491b-9863-a18fd7506689)] +interface nsIDOMSVGPathSegLinetoAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(3294d20e-c707-4e59-a625-bde93fc0b25f)] +interface nsIDOMSVGPathSegLinetoRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(ad929b96-ef81-4002-b596-c6a8b3a878e9)] +interface nsIDOMSVGPathSegCurvetoCubicAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float x1; + // raises nsIDOMDOMException on setting + attribute float y1; + // raises nsIDOMDOMException on setting + attribute float x2; + // raises nsIDOMDOMException on setting + attribute float y2; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(dc7ba13f-8cb6-48d2-9e22-a4a6817abbb9)] +interface nsIDOMSVGPathSegCurvetoCubicRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float x1; + // raises nsIDOMDOMException on setting + attribute float y1; + // raises nsIDOMDOMException on setting + attribute float x2; + // raises nsIDOMDOMException on setting + attribute float y2; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(ec4e8f65-5f4a-495e-a5f2-00e18d5e5f96)] +interface nsIDOMSVGPathSegCurvetoQuadraticAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float x1; + // raises nsIDOMDOMException on setting + attribute float y1; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(7007113c-e06b-4256-8530-4884d5d769c6)] +interface nsIDOMSVGPathSegCurvetoQuadraticRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float x1; + // raises nsIDOMDOMException on setting + attribute float y1; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(c26e1779-604b-4bad-8a29-02d2a2113769)] +interface nsIDOMSVGPathSegArcAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float r1; + // raises nsIDOMDOMException on setting + attribute float r2; + // raises nsIDOMDOMException on setting + attribute float angle; + // raises nsIDOMDOMException on setting + attribute boolean largeArcFlag; + // raises nsIDOMDOMException on setting + attribute boolean sweepFlag; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(a685997e-fb47-47c0-a34c-5da11cb66537)] +interface nsIDOMSVGPathSegArcRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float r1; + // raises nsIDOMDOMException on setting + attribute float r2; + // raises nsIDOMDOMException on setting + attribute float angle; + // raises nsIDOMDOMException on setting + attribute boolean largeArcFlag; + // raises nsIDOMDOMException on setting + attribute boolean sweepFlag; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(e74b55ef-1c44-4a40-9f51-a2196b11283a)] +interface nsIDOMSVGPathSegLinetoHorizontalAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(0a797fdc-8b60-4cb3-a0da-4c898832ba30)] +interface nsIDOMSVGPathSegLinetoHorizontalRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(0811d434-3d90-4eec-8fa2-066dde037917)] +interface nsIDOMSVGPathSegLinetoVerticalAbs : nsIDOMSVGPathSeg +{ + attribute float y; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(93db35b1-6b33-49d5-ad25-1ed1a7611ad2)] +interface nsIDOMSVGPathSegLinetoVerticalRel : nsIDOMSVGPathSeg +{ + attribute float y; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(eb422132-514e-4a1c-81ec-b84a5df5fb96)] +interface nsIDOMSVGPathSegCurvetoCubicSmoothAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float x2; + // raises nsIDOMDOMException on setting + attribute float y2; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(5860bccd-f86b-47f8-86c1-cb1245b6a8e1)] +interface nsIDOMSVGPathSegCurvetoCubicSmoothRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting + attribute float x2; + // raises nsIDOMDOMException on setting + attribute float y2; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(3ce86063-0a35-48ec-b372-f198b7d04755)] +interface nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting +}; + +[scriptable, uuid(5c0e4d25-a9f1-4aab-936c-2b61ed6c085f)] +interface nsIDOMSVGPathSegCurvetoQuadraticSmoothRel : nsIDOMSVGPathSeg +{ + attribute float x; + // raises nsIDOMDOMException on setting + attribute float y; + // raises nsIDOMDOMException on setting +}; diff --git a/dom/public/idl/svg/nsIDOMSVGPathSegList.idl b/dom/public/idl/svg/nsIDOMSVGPathSegList.idl new file mode 100644 index 000000000000..8ec0da63137a --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPathSegList.idl @@ -0,0 +1,63 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGPathSeg; + +[scriptable, uuid(94a6db98-3f34-4529-a35f-89ef49713795)] +interface nsIDOMSVGPathSegList : nsISupports +{ + readonly attribute unsigned long numberOfItems; + + void clear(); + // raises(nsIDOMDOMException); + nsIDOMSVGPathSeg initialize(in nsIDOMSVGPathSeg newItem ); + // raises(nsIDOMDOMException, nsIDOMSVGException); + nsIDOMSVGPathSeg getItem(in unsigned long index); + // raises(nsIDOMDOMException); + nsIDOMSVGPathSeg insertItemBefore(in nsIDOMSVGPathSeg newItem, in unsigned long index); + // raises(nsIDOMDOMException, nsIDOMSVGException); + nsIDOMSVGPathSeg replaceItem(in nsIDOMSVGPathSeg newItem, in unsigned long index); + // raises(nsIDOMDOMException, nsIDOMSVGException); + nsIDOMSVGPathSeg removeItem(in unsigned long index); + // raises(nsIDOMDOMException); + nsIDOMSVGPathSeg appendItem(in nsIDOMSVGPathSeg newItem); + // raises(nsIDOMDOMException, nsIDOMSVGException); +}; + diff --git a/dom/public/idl/svg/nsIDOMSVGPoint.idl b/dom/public/idl/svg/nsIDOMSVGPoint.idl new file mode 100644 index 000000000000..69ae0b5c6e63 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPoint.idl @@ -0,0 +1,52 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGMatrix; + +[scriptable, uuid(45f18f8f-1315-4447-a7d5-8aeca77bdcaf)] +interface nsIDOMSVGPoint : nsISupports +{ + attribute float x; + // raises DOMException on setting + attribute float y; + // raises DOMException on setting + + nsIDOMSVGPoint matrixTransform(in nsIDOMSVGMatrix matrix); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGPointList.idl b/dom/public/idl/svg/nsIDOMSVGPointList.idl new file mode 100644 index 000000000000..185ce8cb7ba8 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPointList.idl @@ -0,0 +1,62 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGPoint; + +[scriptable, uuid(4c12af24-0fc2-4fe7-b71d-5d6b41d463c1)] +interface nsIDOMSVGPointList : nsISupports +{ + readonly attribute unsigned long numberOfItems; + + void clear(); + // raises( DOMException ); + nsIDOMSVGPoint initialize(in nsIDOMSVGPoint newItem); + // raises( DOMException, SVGException ); + nsIDOMSVGPoint getItem (in unsigned long index); + // raises( DOMException ); + nsIDOMSVGPoint insertItemBefore(in nsIDOMSVGPoint newItem, in unsigned long index); + // raises( DOMException, SVGException ); + nsIDOMSVGPoint replaceItem(in nsIDOMSVGPoint newItem, in unsigned long index); + // raises( DOMException, SVGException ); + nsIDOMSVGPoint removeItem(in unsigned long index); + // raises( DOMException ); + nsIDOMSVGPoint appendItem(in nsIDOMSVGPoint newItem); + // raises( DOMException, SVGException ); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGPolygonElement.idl b/dom/public/idl/svg/nsIDOMSVGPolygonElement.idl new file mode 100644 index 000000000000..d5ee97d45245 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPolygonElement.idl @@ -0,0 +1,63 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +[scriptable, uuid(9de04775-77c5-48b5-9f4a-8996a936bfb2)] +interface nsIDOMSVGPolygonElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget, + nsIDOMSVGAnimatedPoints +*/ +{ + +}; diff --git a/dom/public/idl/svg/nsIDOMSVGPolylineElement.idl b/dom/public/idl/svg/nsIDOMSVGPolylineElement.idl new file mode 100644 index 000000000000..3a66c85f8249 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPolylineElement.idl @@ -0,0 +1,62 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +[scriptable, uuid(7b6e15cf-9793-41ee-adcc-cc1c206c80e6)] +interface nsIDOMSVGPolylineElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGTransformable, + events::nsIDOMEventTarget, + nsIDOMSVGAnimatedPoints +*/ +{ + +}; diff --git a/dom/public/idl/svg/nsIDOMSVGPresAspectRatio.idl b/dom/public/idl/svg/nsIDOMSVGPresAspectRatio.idl new file mode 100644 index 000000000000..f7ef82e941a4 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGPresAspectRatio.idl @@ -0,0 +1,65 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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(7ae42f27-4799-4e7c-86c6-e1dae6ad5157)] +interface nsIDOMSVGPreserveAspectRatio : nsISupports +{ + // Alignment Types + const unsigned short SVG_PRESERVEASPECTRATIO_UNKNOWN = 0; + const unsigned short SVG_PRESERVEASPECTRATIO_NONE = 1; + const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMIN = 2; + const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3; + const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4; + const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMID = 5; + const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMID = 6; + const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMID = 7; + const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMAX = 8; + const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9; + const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10; + // Meet-or-slice Types + const unsigned short SVG_MEETORSLICE_UNKNOWN = 0; + const unsigned short SVG_MEETORSLICE_MEET = 1; + const unsigned short SVG_MEETORSLICE_SLICE = 2; + + attribute unsigned short align; + // raises DOMException on setting + attribute unsigned short meetOrSlice; + // raises DOMException on setting +}; diff --git a/dom/public/idl/svg/nsIDOMSVGRect.idl b/dom/public/idl/svg/nsIDOMSVGRect.idl new file mode 100644 index 000000000000..5dc8ef19d0d7 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGRect.idl @@ -0,0 +1,52 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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(5b912111-c10e-498f-a44c-c713c1843007)] +interface nsIDOMSVGRect : nsISupports +{ + attribute float x; + // raises DOMException on setting + attribute float y; + // raises DOMException on setting + attribute float width; + // raises DOMException on setting + attribute float height; + // raises DOMException on setting +}; diff --git a/dom/public/idl/svg/nsIDOMSVGRectElement.idl b/dom/public/idl/svg/nsIDOMSVGRectElement.idl new file mode 100644 index 000000000000..3f97cd048859 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGRectElement.idl @@ -0,0 +1,68 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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; + +[scriptable, uuid(1695ca39-e40d-44dc-81db-a51b6fd234fa)] +interface nsIDOMSVGRectElement + : 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.) + + 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 nsIDOMSVGAnimatedLength rx; + readonly attribute nsIDOMSVGAnimatedLength ry; +}; diff --git a/dom/public/idl/svg/nsIDOMSVGSVGElement.idl b/dom/public/idl/svg/nsIDOMSVGSVGElement.idl new file mode 100644 index 000000000000..ef17fcdc1390 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGSVGElement.idl @@ -0,0 +1,129 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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 nsIDOMSVGRect; +interface nsIDOMSVGViewSpec; +interface nsIDOMSVGPoint; +interface nsIDOMSVGNumber; +interface nsIDOMSVGLength; +interface nsIDOMSVGAngle; +interface nsIDOMSVGMatrix; +interface nsIDOMSVGTransform; + +[scriptable, uuid(67b8f41e-3577-4c8a-b1de-bef51186fe08)] +interface nsIDOMSVGSVGElement + : 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.) + + nsIDOMSVGTests, + nsIDOMSVGLangSpace, + nsIDOMSVGExternalResourcesRequired, + nsIDOMSVGStylable, + nsIDOMSVGLocatable, + nsIDOMSVGFitToViewBox, + nsIDOMSVGZoomAndPan, + events::nsIDOMEventTarget, + events::nsIDOMDocumentEvent, + css::nsIDOMViewCSS, + css::nsIDOMDocumentCSS +*/ +{ + readonly attribute nsIDOMSVGAnimatedLength x; + readonly attribute nsIDOMSVGAnimatedLength y; + readonly attribute nsIDOMSVGAnimatedLength width; + readonly attribute nsIDOMSVGAnimatedLength height; + attribute DOMString contentScriptType; + // raises DOMException on setting + attribute DOMString contentStyleType; + // raises DOMException on setting + readonly attribute nsIDOMSVGRect viewport; + readonly attribute float pixelUnitToMillimeterX; + readonly attribute float pixelUnitToMillimeterY; + readonly attribute float screenPixelToMillimeterX; + readonly attribute float screenPixelToMillimeterY; + attribute boolean useCurrentView; + // raises DOMException on setting + readonly attribute nsIDOMSVGViewSpec currentView; + attribute float currentScale; + // raises DOMException on setting + readonly attribute nsIDOMSVGPoint currentTranslate; + + unsigned long suspendRedraw(in unsigned long max_wait_milliseconds); + void unsuspendRedraw(in unsigned long suspend_handle_id); + // raises( DOMException ); + void unsuspendRedrawAll(); + void forceRedraw(); + void pauseAnimations(); + void unpauseAnimations(); + boolean animationsPaused(); + float getCurrentTime(); + void setCurrentTime(in float seconds); + nsIDOMNodeList getIntersectionList(in nsIDOMSVGRect rect, + in nsIDOMSVGElement referenceElement); + nsIDOMNodeList getEnclosureList(in nsIDOMSVGRect rect, in nsIDOMSVGElement referenceElement); + boolean checkIntersection(in nsIDOMSVGElement element, in nsIDOMSVGRect rect); + boolean checkEnclosure(in nsIDOMSVGElement element, in nsIDOMSVGRect rect); + void deSelectAll(); + nsIDOMSVGNumber createSVGNumber(); + nsIDOMSVGLength createSVGLength(); + nsIDOMSVGAngle createSVGAngle(); + nsIDOMSVGPoint createSVGPoint(); + nsIDOMSVGMatrix createSVGMatrix(); + nsIDOMSVGRect createSVGRect(); + nsIDOMSVGTransform createSVGTransform(); + nsIDOMSVGTransform createSVGTransformFromMatrix(in nsIDOMSVGMatrix matrix); + DOMString createSVGString(); + nsIDOMElement getElementById(in DOMString elementId); + + // Mozilla extension, not part of W3 SVG DOM: + nsIDOMSVGMatrix getViewboxToViewportTransform(); +}; + + + + + diff --git a/dom/public/idl/svg/nsIDOMSVGStylable.idl b/dom/public/idl/svg/nsIDOMSVGStylable.idl new file mode 100644 index 000000000000..6226530dffb1 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGStylable.idl @@ -0,0 +1,52 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGAnimatedString; +interface nsIDOMCSSStyleDeclaration; +interface nsIDOMCSSValue; + +[scriptable, uuid(ea8a6cb1-9176-45db-989d-d0e89f563d7e)] +interface nsIDOMSVGStylable : nsISupports +{ + readonly attribute nsIDOMSVGAnimatedString className; + readonly attribute nsIDOMCSSStyleDeclaration style; + + nsIDOMCSSValue getPresentationAttribute(in DOMString name); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGTransform.idl b/dom/public/idl/svg/nsIDOMSVGTransform.idl new file mode 100644 index 000000000000..bc8c8f98fc55 --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGTransform.idl @@ -0,0 +1,65 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGMatrix; + +[scriptable, uuid(29cc2e14-6d18-4710-bda9-a88d9d3bc8dc)] +interface nsIDOMSVGTransform : nsISupports +{ + // Transform Types + const unsigned short SVG_TRANSFORM_UNKNOWN = 0; + const unsigned short SVG_TRANSFORM_MATRIX = 1; + const unsigned short SVG_TRANSFORM_TRANSLATE = 2; + const unsigned short SVG_TRANSFORM_SCALE = 3; + const unsigned short SVG_TRANSFORM_ROTATE = 4; + const unsigned short SVG_TRANSFORM_SKEWX = 5; + const unsigned short SVG_TRANSFORM_SKEWY = 6; + + readonly attribute unsigned short type; + readonly attribute nsIDOMSVGMatrix matrix; + readonly attribute float angle; + + void setMatrix(in nsIDOMSVGMatrix matrix); + void setTranslate(in float tx, in float ty); + void setScale(in float sx, in float sy); + void setRotate(in float angle, in float cx, in float cy); + void setSkewX(in float angle); + void setSkewY(in float angle); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGTransformList.idl b/dom/public/idl/svg/nsIDOMSVGTransformList.idl new file mode 100644 index 000000000000..a55377f29dad --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGTransformList.idl @@ -0,0 +1,70 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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" + +interface nsIDOMSVGTransform; +interface nsIDOMSVGMatrix; + +[scriptable, uuid(df41474c-a4f8-4ec3-ae79-4342e6f56d8e)] +interface nsIDOMSVGTransformList : nsISupports +{ + readonly attribute unsigned long numberOfItems; + + void clear(); + // raises( DOMException ); + nsIDOMSVGTransform initialize(in nsIDOMSVGTransform newItem); + // raises( DOMException, SVGException ); + nsIDOMSVGTransform getItem(in unsigned long index); + // raises( DOMException ); + nsIDOMSVGTransform insertItemBefore(in nsIDOMSVGTransform newItem, + in unsigned long index); + // raises( DOMException, SVGException ); + nsIDOMSVGTransform replaceItem(in nsIDOMSVGTransform newItem, + in unsigned long index); + // raises( DOMException, SVGException ); + nsIDOMSVGTransform removeItem(in unsigned long index); + // raises( DOMException ); + nsIDOMSVGTransform appendItem(in nsIDOMSVGTransform newItem); + // raises( DOMException, SVGException ); + nsIDOMSVGTransform createSVGTransformFromMatrix(in nsIDOMSVGMatrix matrix); + nsIDOMSVGTransform consolidate(); + + // Mozilla extension, not part of W3 SVG DOM: + nsIDOMSVGMatrix getConsolidation(); +}; diff --git a/dom/public/idl/svg/nsIDOMSVGTransformable.idl b/dom/public/idl/svg/nsIDOMSVGTransformable.idl new file mode 100644 index 000000000000..2bdae614d23a --- /dev/null +++ b/dom/public/idl/svg/nsIDOMSVGTransformable.idl @@ -0,0 +1,47 @@ +/* -*- 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (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 "nsIDOMSVGLocatable.idl" + +interface nsIDOMSVGAnimatedTransformList; + +[scriptable, uuid(b81f6e37-1842-4534-a546-1ab86e59a3c6)] +interface nsIDOMSVGTransformable : nsIDOMSVGLocatable +{ + readonly attribute nsIDOMSVGAnimatedTransformList transform; +}; diff --git a/dom/public/nsIDOMClassInfo.h b/dom/public/nsIDOMClassInfo.h index f6a966d2a77b..d29c6b953a48 100644 --- a/dom/public/nsIDOMClassInfo.h +++ b/dom/public/nsIDOMClassInfo.h @@ -191,6 +191,56 @@ enum nsDOMClassInfoID { eDOMClassInfo_DOMSerializer_id, eDOMClassInfo_DOMParser_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, +#endif + // Transformiix classes eDOMClassInfo_XSLTProcessor_id, eDOMClassInfo_XPathProcessor_id, diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp index 2790ffd669d1..5a9e4cb00296 100644 --- a/dom/src/base/nsDOMClassInfo.cpp +++ b/dom/src/base/nsDOMClassInfo.cpp @@ -266,6 +266,37 @@ #include "nsIDocumentTransformer.h" #include "nsIXPathNodeSelector.h" +#ifdef MOZ_SVG +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGAnimatedPoints.h" +#include "nsIDOMSVGAnimatedPathData.h" +#include "nsIDOMSVGAnimTransformList.h" +#include "nsIDOMSVGCircleElement.h" +#include "nsIDOMSVGEllipseElement.h" +#include "nsIDOMSVGLineElement.h" +#include "nsIDOMSVGRectElement.h" +#include "nsIDOMSVGDocument.h" +#include "nsIDOMSVGElement.h" +#include "nsIDOMSVGGElement.h" +#include "nsIDOMSVGFitToViewBox.h" +#include "nsIDOMSVGForeignObjectElem.h" +#include "nsIDOMSVGMatrix.h" +#include "nsIDOMSVGLength.h" +#include "nsIDOMSVGLocatable.h" +#include "nsIDOMSVGPathElement.h" +#include "nsIDOMSVGPathSeg.h" +#include "nsIDOMSVGPathSegList.h" +#include "nsIDOMSVGPoint.h" +#include "nsIDOMSVGPointList.h" +#include "nsIDOMSVGPolygonElement.h" +#include "nsIDOMSVGPolylineElement.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsIDOMSVGTransformable.h" +#include "nsIDOMSVGTransform.h" +#include "nsIDOMSVGTransformList.h" +#include "nsIDOMSVGRect.h" +#include "nsIDOMSVGAnimatedRect.h" +#endif static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); @@ -657,6 +688,99 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(DOMParser, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) +#ifdef MOZ_SVG + // SVG document + NS_DEFINE_CLASSINFO_DATA(SVGDocument, nsDocumentSH, + NODE_SCRIPTABLE_FLAGS) + + // SVG element classes + NS_DEFINE_CLASSINFO_DATA(SVGSVGElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPolygonElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPolylineElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGCircleElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGEllipseElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGLineElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGRectElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGGElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGForeignObjectElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) + + + // other SVG classes + NS_DEFINE_CLASSINFO_DATA(SVGAnimatedLength, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGLength, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGAnimatedPoints, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPointList, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPoint, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGAnimatedTransformList, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGTransformList, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGTransform, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGMatrix, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegList, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegClosePath, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegMovetoAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegMovetoRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegLinetoAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegLinetoRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoCubicAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoCubicRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoQuadraticAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoQuadraticRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegArcAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegArcRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegLinetoHorizontalAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegLinetoHorizontalRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegLinetoVerticalAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegLinetoVerticalRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoCubicSmoothAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoCubicSmoothRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoQuadraticSmoothAbs, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGPathSegCurvetoQuadraticSmoothRel, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGRect, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(SVGAnimatedRect, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) +#endif + // Transformiix classes NS_DEFINE_CLASSINFO_DATA(XSLTProcessor, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) @@ -1624,6 +1748,215 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMParser) DOM_CLASSINFO_MAP_END +#ifdef MOZ_SVG +#define DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES \ + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGElement) \ + DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node) + +#define DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES \ + DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \ + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLocatable) \ + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTransformable) \ + DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES + + // XXX - the proto chain stuff is sort of hackish, because of the MI in + // the SVG interfaces. I doubt that extending the proto on one interface + // works properly on an element which inherits off multiple interfaces. + // Tough luck. - bbaetz + DOM_CLASSINFO_MAP_BEGIN(SVGDocument, nsIDOMSVGDocument) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGDocument) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMNode) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGSVGElement, nsIDOMSVGSVGElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGSVGElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFitToViewBox) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLocatable) + DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPolygonElement, nsIDOMSVGPolygonElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPolygonElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedPoints) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPolylineElement, nsIDOMSVGPolylineElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPolylineElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedPoints) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGCircleElement, nsIDOMSVGCircleElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGCircleElement) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGEllipseElement, nsIDOMSVGEllipseElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGEllipseElement) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGLineElement, nsIDOMSVGLineElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLineElement) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGRectElement, nsIDOMSVGRectElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGRectElement) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGGElement, nsIDOMSVGGElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGGElement) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGForeignObjectElement, nsIDOMSVGForeignObjectElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGForeignObjectElement) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathElement, nsIDOMSVGPathElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedPathData) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedLength, nsIDOMSVGAnimatedLength) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedLength) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGLength, nsIDOMSVGLength) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLength) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedPoints, nsIDOMSVGAnimatedPoints) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedPoints) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPointList, nsIDOMSVGPointList) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPointList) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPoint, nsIDOMSVGPoint) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPoint) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedTransformList, nsIDOMSVGAnimatedTransformList) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedTransformList) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGTransformList, nsIDOMSVGTransformList) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTransformList) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGTransform, nsIDOMSVGTransform) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTransform) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGMatrix, nsIDOMSVGMatrix) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGMatrix) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegList, nsIDOMSVGPathSegList) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegList) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegClosePath, nsIDOMSVGPathSegClosePath) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegClosePath) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegMovetoAbs, nsIDOMSVGPathSegMovetoAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegMovetoAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegMovetoRel, nsIDOMSVGPathSegMovetoRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegMovetoRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegLinetoAbs, nsIDOMSVGPathSegLinetoAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegLinetoAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegLinetoRel, nsIDOMSVGPathSegLinetoRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegLinetoRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoCubicAbs, nsIDOMSVGPathSegCurvetoCubicAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoCubicAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoCubicRel, nsIDOMSVGPathSegCurvetoCubicRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoCubicRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoQuadraticAbs, nsIDOMSVGPathSegCurvetoQuadraticAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoQuadraticAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoQuadraticRel, nsIDOMSVGPathSegCurvetoQuadraticRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoQuadraticRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegArcAbs, nsIDOMSVGPathSegArcAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegArcAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegArcRel, nsIDOMSVGPathSegArcRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegArcRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegLinetoHorizontalAbs, nsIDOMSVGPathSegLinetoHorizontalAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegLinetoHorizontalAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegLinetoHorizontalRel, nsIDOMSVGPathSegLinetoHorizontalRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegLinetoHorizontalRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegLinetoVerticalAbs, nsIDOMSVGPathSegLinetoVerticalAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegLinetoVerticalAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegLinetoVerticalRel, nsIDOMSVGPathSegLinetoVerticalRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegLinetoVerticalRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoCubicSmoothAbs, nsIDOMSVGPathSegCurvetoCubicSmoothAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoCubicSmoothAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoCubicSmoothRel, nsIDOMSVGPathSegCurvetoCubicSmoothRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoCubicSmoothRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoQuadraticSmoothAbs, nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoQuadraticSmoothAbs) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGPathSegCurvetoQuadraticSmoothRel, nsIDOMSVGPathSegCurvetoQuadraticSmoothRel) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGPathSegCurvetoQuadraticSmoothRel) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGRect, nsIDOMSVGRect) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGRect) + DOM_CLASSINFO_MAP_END + + DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedRect, nsIDOMSVGAnimatedRect) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedRect) + DOM_CLASSINFO_MAP_END +#endif + DOM_CLASSINFO_MAP_BEGIN_NO_PRIMARY_INTERFACE(XSLTProcessor) DOM_CLASSINFO_MAP_ENTRY(nsIDocumentTransformer) DOM_CLASSINFO_MAP_END diff --git a/gfx/src/mac/nsRenderingContextMac.cpp b/gfx/src/mac/nsRenderingContextMac.cpp index e9f055eb0870..7e30501f0085 100644 --- a/gfx/src/mac/nsRenderingContextMac.cpp +++ b/gfx/src/mac/nsRenderingContextMac.cpp @@ -524,6 +524,12 @@ NS_IMETHODIMP nsRenderingContextMac::CreateDrawingSurface(nsRect *aBounds, PRUin if (!surface) return NS_ERROR_OUT_OF_MEMORY; + // Bug 93217. Needed for SVG, but possible side effects, so ifdef + // for now. +#ifdef MOZ_SVG + NS_ADDREF(surface); +#endif + nsresult rv = surface->Init(depth, macRect.right, macRect.bottom, aSurfFlags); if (NS_SUCCEEDED(rv)) aSurface = surface; @@ -554,8 +560,16 @@ NS_IMETHODIMP nsRenderingContextMac::DestroyDrawingSurface(nsDrawingSurface aSur ::UnlockPixels(::GetGWorldPixMap(offscreenGWorld)); ::DisposeGWorld(offscreenGWorld); */ + + // Bug 93217. Needed for SVG, but possible side effects, so ifdef + // for now. +#ifdef MOZ_SVG + // release the surface (used to delete when CreateOffscreen didn't AddRef) + NS_IF_RELEASE(surface); +#else // delete the surface delete surface; +#endif return NS_OK; } diff --git a/htmlparser/public/nsIParser.h b/htmlparser/public/nsIParser.h index b559101335f6..e344cfbed9ca 100644 --- a/htmlparser/public/nsIParser.h +++ b/htmlparser/public/nsIParser.h @@ -373,7 +373,7 @@ const PRUnichar kNullCh = '\0'; #define kApplicationJSContentType "application/x-javascript" #define kTextJSContentType "text/javascript" #define kSGMLTextContentType "text/sgml" - +#define kSVGTextContentType "image/svg+xml" #define NS_IPARSER_FLAG_UNKNOWN_MODE 0x00000000 #define NS_IPARSER_FLAG_QUIRKS_MODE 0x00000002 diff --git a/htmlparser/src/nsExpatTokenizer.cpp b/htmlparser/src/nsExpatTokenizer.cpp index fe1fca530f10..9742f7bbd341 100644 --- a/htmlparser/src/nsExpatTokenizer.cpp +++ b/htmlparser/src/nsExpatTokenizer.cpp @@ -929,29 +929,53 @@ int Tokenizer_HandleExternalEntityRef(XML_Parser parser, // Load the external entity into a buffer nsCOMPtr in; nsAutoString absURL; + nsresult rv = NS_OK; + PRUnichar *uniBuf = nsnull; + PRUint32 retLen = 0; + +#ifdef MOZ_SVG + // yuck. I don't know of any other way to do this, though, since we don't + // read external dtd's, and we need the #FIXED xmlns attribute, so we + // can't do this later based on what namespace we're in - bbaetz - nsresult rv = nsExpatTokenizer::OpenInputStream(systemId, base, getter_AddRefs(in), &absURL); + // The alternative is remapping the systemId, and installing an svg.dtd file + // in the dtd directory. This is simpler, for now. + + // XXX - need to do this for the other #FIXED attribuues as well + NS_NAMED_LITERAL_STRING(svgDtd, + ""); + +#define svgPublicIdPrefix "-//W3C//DTD SVG " + + if (publicId && !nsCRT::strncmp((const PRUnichar*)publicId, + NS_LITERAL_STRING(svgPublicIdPrefix).get(), + sizeof(svgPublicIdPrefix)-1)) { + uniBuf = ToNewUnicode(svgDtd); + retLen = svgDtd.Length(); + } else { +#endif + rv = nsExpatTokenizer::OpenInputStream(systemId, base, getter_AddRefs(in), &absURL); + + if (NS_SUCCEEDED(rv) && in) + rv = nsExpatTokenizer::LoadStream(in, uniBuf, retLen); +#ifdef MOZ_SVG + } +#endif - if (NS_SUCCEEDED(rv) && in) { - PRUint32 retLen = 0; - PRUnichar *uniBuf = nsnull; - rv = nsExpatTokenizer::LoadStream(in, uniBuf, retLen); + // Pass the buffer to expat for parsing + if (NS_SUCCEEDED(rv) && uniBuf) { + // Create a parser for parsing the external entity + XML_Parser entParser = XML_ExternalEntityParserCreate(parser, 0, + (const XML_Char*) NS_LITERAL_STRING("UTF-16").get()); - // Pass the buffer to expat for parsing - if (NS_SUCCEEDED(rv) && uniBuf) { - // Create a parser for parsing the external entity - XML_Parser entParser = XML_ExternalEntityParserCreate(parser, 0, - (const XML_Char*) NS_LITERAL_STRING("UTF-16").get()); - - if (entParser) { - XML_SetBase(entParser, (const XML_Char*) absURL.get()); - result = XML_Parse(entParser, (char *)uniBuf, retLen * sizeof(PRUnichar), 1); - XML_ParserFree(entParser); - } - - PR_FREEIF(uniBuf); + if (entParser) { + XML_SetBase(entParser, (const XML_Char*) absURL.get()); + result = XML_Parse(entParser, (char *)uniBuf, retLen * sizeof(PRUnichar), 1); + XML_ParserFree(entParser); } } + PR_FREEIF(uniBuf); + #else /* ! XML_DTD */ NS_NOTYETIMPLEMENTED("Error: Tokenizer_HandleExternalEntityRef() not yet implemented."); diff --git a/htmlparser/src/nsViewSourceHTML.cpp b/htmlparser/src/nsViewSourceHTML.cpp index b1ffb781c1aa..c06ddd98d412 100644 --- a/htmlparser/src/nsViewSourceHTML.cpp +++ b/htmlparser/src/nsViewSourceHTML.cpp @@ -431,6 +431,9 @@ CViewSourceHTML::CanParse(CParserContext& aParserContext, aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) || aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType) || aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType) || +#ifdef MOZ_SVG + aParserContext.mMimeType.Equals(NS_LITERAL_STRING(kSVGTextContentType)) || +#endif aParserContext.mMimeType.EqualsWithConversion(kSGMLTextContentType)) { result=ePrimaryDetect; } diff --git a/htmlparser/src/nsWellFormedDTD.cpp b/htmlparser/src/nsWellFormedDTD.cpp index 9993a945c799..68b676b18cfa 100644 --- a/htmlparser/src/nsWellFormedDTD.cpp +++ b/htmlparser/src/nsWellFormedDTD.cpp @@ -198,7 +198,11 @@ CWellFormedDTD::CanParse(CParserContext& aParserContext, aParserContext.mMimeType.EqualsWithConversion(kXMLApplicationContentType) || aParserContext.mMimeType.EqualsWithConversion(kXHTMLApplicationContentType) || aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) || - aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) { + aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType) +#ifdef MOZ_SVG + || aParserContext.mMimeType.Equals(NS_LITERAL_STRING(kSVGTextContentType)) +#endif + ) { result=ePrimaryDetect; } else if (aParserContext.mMimeType.IsEmpty()) { diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 77be2f98790d..0b94742b91e0 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -144,24 +144,32 @@ static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID); #ifdef MOZ_SVG #include "nsSVGAtoms.h" -#endif +#include "nsISVGAttribute.h" +#include "nsISVGValue.h" +#include "nsISVGStyleValue.h" -#ifdef MOZ_SVG -#include "nsSVGAtoms.h" -#include "nsSVGContainerFrame.h" -#include "nsPolygonFrame.h" -#include "nsPolylineFrame.h" - - - -nsresult -NS_NewSVGContainerFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot ); - -nsresult -NS_NewPolygonFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); - -nsresult -NS_NewPolylineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); #endif #include "nsIDocument.h" @@ -3274,8 +3282,10 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, contentFrame->GetStyleContext(getter_AddRefs(styleContext)); } else { // otherwise build a box or a block -#ifdef INCLUDE_XUL +#if defined(INCLUDE_XUL) || defined(MOZ_SVG) PRInt32 nameSpaceID; +#endif +#ifdef INCLUDE_XUL if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) && nameSpaceID == nsXULAtoms::nameSpaceID) { rv = NS_NewDocElementBoxFrame(aPresShell, &contentFrame); @@ -3285,6 +3295,18 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, } else #endif +#ifdef MOZ_SVG + if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) && + (nameSpaceID == nsSVGAtoms::nameSpaceID || + nameSpaceID == nsSVGAtoms::nameSpaceDeprecatedID)) { + rv = NS_NewSVGOuterSVGFrame(aPresShell, aDocElement, &contentFrame); + if (NS_FAILED(rv)) { + return rv; + } + isBlockFrame = PR_TRUE; + } + else +#endif { rv = NS_NewDocumentElementFrame(aPresShell, &contentFrame); if (NS_FAILED(rv)) { @@ -6826,17 +6848,17 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, nsIStyleContext* aStyleContext, nsFrameItems& aFrameItems) { - PRBool processChildren = PR_TRUE; // Whether we should process child content. - // MathML frames are inline frames. - // processChildren = PR_TRUE for inline frames. - // see case NS_STYLE_DISPLAY_INLINE in - // ConstructFrameByDisplayType() - - nsresult rv = NS_OK; - PRBool isAbsolutelyPositioned = PR_FALSE; - PRBool isFixedPositioned = PR_FALSE; - PRBool isReplaced = PR_FALSE; + // Make sure that we remain confined in the SVG world + if (aNameSpaceID != nsSVGAtoms::nameSpaceID) + return NS_OK; + nsresult rv = NS_OK; + PRBool isAbsolutelyPositioned = PR_FALSE; + PRBool isFixedPositioned = PR_FALSE; + PRBool forceView = PR_FALSE; + PRBool isBlock = PR_FALSE; + PRBool processChildren = PR_FALSE; + NS_ASSERTION(aTag != nsnull, "null SVG tag"); if (aTag == nsnull) return NS_OK; @@ -6858,22 +6880,57 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, else if (NS_STYLE_POSITION_FIXED == disp->mPosition) { isFixedPositioned = PR_TRUE; } - if (aTag == nsSVGAtoms::g) - rv = NS_NewSVGContainerFrame(aPresShell, &newFrame); - else if (aTag == nsSVGAtoms::polygon) - rv = NS_NewPolygonFrame(aPresShell, &newFrame); - else if (aTag == nsSVGAtoms::polyline) - rv = NS_NewPolylineFrame(aPresShell, &newFrame); + if (aTag == nsSVGAtoms::svg) { + forceView = PR_TRUE; + isBlock = PR_TRUE; + processChildren = PR_TRUE; + rv = NS_NewSVGOuterSVGFrame(aPresShell, aContent, &newFrame); + } + else if (aTag == nsSVGAtoms::g) { + processChildren = PR_TRUE; + rv = NS_NewSVGGFrame(aPresShell, aContent, &newFrame); + } + else if (aTag == nsSVGAtoms::polygon) + rv = NS_NewSVGPolygonFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::polyline) + rv = NS_NewSVGPolylineFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::circle) + rv = NS_NewSVGCircleFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::ellipse) + rv = NS_NewSVGEllipseFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::line) + rv = NS_NewSVGLineFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::rect) + rv = NS_NewSVGRectFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::foreignObject) { + processChildren = PR_TRUE; + rv = NS_NewSVGForeignObjectFrame(aPresShell, aContent, &newFrame); + } + else if (aTag == nsSVGAtoms::path) + rv = NS_NewSVGPathFrame(aPresShell, aContent, &newFrame); + + if (newFrame == nsnull) { + // Either we have an unknown tag, or construction of a frame + // failed. One reason why frame construction for a known tag might + // have failed is that the content element doesn't implement all + // interfaces required by the frame. This happens e.g. when using + // 'extends' in xbl to extend an xbl binding from an svg + // element. In that case, the bound content element will always be + // a standard xml element, and not be of the right type. + // The best we can do here is to create a generic svg container frame. +#ifdef DEBUG + printf("Warning: Creating SVGGenericContainerFrame for tag <"); + nsAutoString str; + aTag->ToString(str); + printf("%s>\n", NS_ConvertUCS2toUTF8(str).get()); +#endif + processChildren = PR_TRUE; + rv = NS_NewSVGGenericContainerFrame(aPresShell, aContent, &newFrame); + } // If we succeeded in creating a frame then initialize it, process its // children (if requested), and set the initial child list if (NS_SUCCEEDED(rv) && newFrame != nsnull) { - // If the frame is a replaced element, then set the frame state bit - if (isReplaced) { - nsFrameState state; - newFrame->GetFrameState(&state); - newFrame->SetFrameState(state | NS_FRAME_REPLACED_ELEMENT); - } nsIFrame* geometricParent = isAbsolutelyPositioned ? aState.mAbsoluteItems.containingBlock @@ -6881,9 +6938,9 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, InitAndRestoreFrame(aPresContext, aState, aContent, geometricParent, aStyleContext, nsnull, newFrame); - // See if we need to create a view, e.g. the frame is absolutely positioned nsHTMLContainerFrame::CreateViewForFrame(aPresContext, newFrame, - aStyleContext, aParentFrame, PR_FALSE); + aStyleContext, aParentFrame, + forceView); // Add the new frame to our list of frame items. aFrameItems.AddChild(newFrame); @@ -6891,8 +6948,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, // Process the child content if requested nsFrameItems childItems; if (processChildren) { - rv = ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE, - childItems, PR_FALSE); + rv = ProcessChildren(aPresShell, aPresContext, aState, aContent, + newFrame, PR_TRUE, childItems, isBlock); CreateAnonymousFrames(aPresShell, aPresContext, aTag, aState, aContent, newFrame, childItems); @@ -7087,8 +7144,11 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe // SVG #ifdef MOZ_SVG - if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || - (lastChild == aFrameItems.lastChild))) { + if (NS_SUCCEEDED(rv) && + ((nsnull == aFrameItems.childList) || + (lastChild == aFrameItems.lastChild)) && + (aNameSpaceID == nsSVGAtoms::nameSpaceID || + aNameSpaceID == nsSVGAtoms::nameSpaceDeprecatedID)) { rv = ConstructSVGFrame(aPresShell, aPresContext, aState, aContent, aParentFrame, aTag, aNameSpaceID, styleContext, aFrameItems); } @@ -10122,7 +10182,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); nsIFrame* primaryFrame; - + shell->GetPrimaryFrameFor(aContent, &primaryFrame); PRBool reconstruct = PR_FALSE; @@ -10240,6 +10300,63 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, } } } +#ifdef MOZ_SVG + else { // XXX should check we're in SVG NS + nsCOMPtr domel(do_QueryInterface(aContent)); + if (domel) { + // XXX there must be a better way of doing this + nsCOMPtr attr; + domel->GetAttributeNode(NS_LITERAL_STRING("style"), getter_AddRefs(attr)); + if (attr) { + nsCOMPtr svgattr(do_QueryInterface(attr)); + if (svgattr) { + nsCOMPtr value; + svgattr->GetSVGValue(getter_AddRefs(value)); + if (value) { + nsCOMPtr stylevalue(do_QueryInterface(value)); + if (stylevalue) { + nsCOMPtr doc; + aContent->GetDocument(*getter_AddRefs(doc)); + if (doc) { + stylevalue->GetStyleRule(doc, getter_AddRefs(rule)); + if (rule) { + inlineStyle = PR_TRUE; + + // ---- + if (primaryFrame) + primaryFrame->GetStyleContext(getter_AddRefs(styleContext)); + else { + // We might be in the undisplayed map. Retrieve the style context from there. + nsCOMPtr frameManager; + shell->GetFrameManager(getter_AddRefs(frameManager)); + frameManager->GetUndisplayedContent(aContent, getter_AddRefs(styleContext)); + if (!styleContext) { + // Well, we don't have a context to use as a guide. + // Attempt #3 will be to resolve style if we at least have a parent frame. + nsCOMPtr parent; + aContent->GetParent(*getter_AddRefs(parent)); + if (parent) { + nsIFrame* parentFrame; + shell->GetPrimaryFrameFor(parent, &parentFrame); + if (parentFrame) { + nsCOMPtr parentContext; + parentFrame->GetStyleContext(getter_AddRefs(parentContext)); + aPresContext->ResolveStyleContextFor(aContent, parentContext, PR_FALSE, + getter_AddRefs(styleContext)); + } + } + } + } + //----- + } + } + } + } + } + } + } + } +#endif } // first see if we need to manage the style system: @@ -10272,6 +10389,12 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, shell->GetFrameManager(getter_AddRefs(frameManager)); PRBool affects; +#ifdef MOZ_SVG + // XXX should check we're in SVG NS here + if (aAttribute == nsHTMLAtoms::style) + affects = PR_TRUE; + else +#endif frameManager->AttributeAffectsStyle(aAttribute, aContent, affects); if (affects) { #ifdef DEBUG_shaver diff --git a/layout/base/nsStyleConsts.h b/layout/base/nsStyleConsts.h index e9d395d66736..1545914a697c 100644 --- a/layout/base/nsStyleConsts.h +++ b/layout/base/nsStyleConsts.h @@ -611,4 +611,22 @@ #define NS_STYLE_PAGE_BREAK_LEFT 3 #define NS_STYLE_PAGE_BREAK_RIGHT 4 +#ifdef MOZ_SVG + +// fill-rule +#define NS_STYLE_FILL_RULE_NONZERO 0 +#define NS_STYLE_FILL_RULE_EVENODD 1 + +// stroke-linecap +#define NS_STYLE_STROKE_LINECAP_BUTT 0 +#define NS_STYLE_STROKE_LINECAP_ROUND 1 +#define NS_STYLE_STROKE_LINECAP_SQUARE 2 + +// stroke-linejoin +#define NS_STYLE_STROKE_LINEJOIN_MITER 0 +#define NS_STYLE_STROKE_LINEJOIN_ROUND 1 +#define NS_STYLE_STROKE_LINEJOIN_BEVEL 2 + +#endif // MOZ_SVG + #endif /* nsStyleConsts_h___ */ diff --git a/layout/base/public/nsStyleConsts.h b/layout/base/public/nsStyleConsts.h index e9d395d66736..1545914a697c 100644 --- a/layout/base/public/nsStyleConsts.h +++ b/layout/base/public/nsStyleConsts.h @@ -611,4 +611,22 @@ #define NS_STYLE_PAGE_BREAK_LEFT 3 #define NS_STYLE_PAGE_BREAK_RIGHT 4 +#ifdef MOZ_SVG + +// fill-rule +#define NS_STYLE_FILL_RULE_NONZERO 0 +#define NS_STYLE_FILL_RULE_EVENODD 1 + +// stroke-linecap +#define NS_STYLE_STROKE_LINECAP_BUTT 0 +#define NS_STYLE_STROKE_LINECAP_ROUND 1 +#define NS_STYLE_STROKE_LINECAP_SQUARE 2 + +// stroke-linejoin +#define NS_STYLE_STROKE_LINEJOIN_MITER 0 +#define NS_STYLE_STROKE_LINEJOIN_ROUND 1 +#define NS_STYLE_STROKE_LINEJOIN_BEVEL 2 + +#endif // MOZ_SVG + #endif /* nsStyleConsts_h___ */ diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index d73af80fbe3b..7595d316f8bb 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -33,6 +33,7 @@ SHORT_LIBNAME = gkhtml IS_COMPONENT = 1 MODULE_NAME = nsLayoutModule EXTRA_DSO_LIBS = gkgfx + REQUIRES = xpcom \ string \ content \ @@ -81,7 +82,6 @@ endif ifdef MOZ_SVG SHARED_LIBRARY_LIBS += \ - $(DIST)/lib/libgksvgcon_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgksvgbase_s.$(LIB_SUFFIX) \ $(NSNULL) endif @@ -94,6 +94,10 @@ EXTRA_DSO_LDOPTS = \ $(MOZ_JS_LIBS) \ $(NULL) +ifdef MOZ_SVG +EXTRA_DSO_LDOPTS += $(MOZ_LIBART_LIBS) +endif + ifeq ($(MOZ_WIDGET_TOOLKIT),os2) EXPORT_OBJS = 1 endif @@ -113,7 +117,3 @@ ifdef MOZ_MATHML INCLUDES += -I$(srcdir)/../mathml/content/src endif -ifdef MOZ_SVG -INCLUDES += -I$(srcdir)/../svg/content/src -endif - diff --git a/layout/build/makefile.win b/layout/build/makefile.win index f260407e5bd9..672915ef0949 100644 --- a/layout/build/makefile.win +++ b/layout/build/makefile.win @@ -31,6 +31,7 @@ REQUIRES = xpcom \ layout_xul \ necko \ $(NULL) + include <$(DEPTH)/config/config.mak> DEFINES=-D_IMPL_NS_HTML @@ -56,9 +57,6 @@ LINCS= -I..\html\base\src -I..\base\src \ -I..\xul\base\src \ !ifdef MOZ_MATHML -I..\mathml\content\src \ -!endif -!ifdef MOZ_SVG - -I..\svg\content\src \ !endif $(NULL) @@ -79,7 +77,7 @@ SUB_LIBRARIES= \ !endif !ifdef MOZ_SVG $(DIST)\lib\layoutsvgbase_s.lib \ - $(DIST)\lib\layoutsvgcontent_s.lib \ + $(DIST)\lib\moz_art_lgpl.lib \ !endif $(NULL) diff --git a/layout/build/nsContentDLF.cpp b/layout/build/nsContentDLF.cpp index 1870aaf1937e..de286eeed496 100644 --- a/layout/build/nsContentDLF.cpp +++ b/layout/build/nsContentDLF.cpp @@ -70,6 +70,9 @@ static NS_DEFINE_IID(kHTMLDocumentCID, NS_HTMLDOCUMENT_CID); static NS_DEFINE_IID(kXMLDocumentCID, NS_XMLDOCUMENT_CID); +#ifdef MOZ_SVG +static NS_DEFINE_IID(kSVGDocumentCID, NS_SVGDOCUMENT_CID); +#endif static NS_DEFINE_IID(kImageDocumentCID, NS_IMAGEDOCUMENT_CID); static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID); @@ -99,6 +102,13 @@ static const char* const gXMLTypes[] = { 0 }; +#ifdef MOZ_SVG +static char* gSVGTypes[] = { + "image/svg+xml", + "image/svg+xml; x-view-type=view-source", + 0 +}; +#endif static const char* const gRDFTypes[] = { "text/rdf", @@ -241,6 +251,19 @@ nsContentDLF::CreateInstance(const char* aCommand, } } +#ifdef MOZ_SVG + // Try SVG + typeIndex = 0; + while(gSVGTypes[typeIndex]) { + if (!PL_strcmp(gSVGTypes[typeIndex++], aContentType)) { + return CreateDocument(aCommand, + aChannel, aLoadGroup, + aContainer, kSVGDocumentCID, + aDocListener, aDocViewer); + } + } +#endif + // Try RDF typeIndex = 0; while (gRDFTypes[typeIndex]) { @@ -610,6 +633,14 @@ nsContentDLF::RegisterDocumentFactories(nsIComponentManager* aCompMgr, rv = RegisterTypes(aCompMgr, catmgr, "view-source", aPath, aLocation, aType, gXMLTypes); if (NS_FAILED(rv)) break; +#ifdef MOZ_SVG + rv = RegisterTypes(aCompMgr, catmgr, "view", aPath, aLocation, aType, gSVGTypes); + if (NS_FAILED(rv)) + break; + rv = RegisterTypes(aCompMgr, catmgr, "view-source", aPath, aLocation, aType, gSVGTypes); + if (NS_FAILED(rv)) + break; +#endif rv = RegisterTypes(aCompMgr, catmgr, "view", aPath, aLocation, aType, gImageTypes); if (NS_FAILED(rv)) break; diff --git a/layout/html/style/src/Makefile.in b/layout/html/style/src/Makefile.in index 5e2de8734da2..99d91fcc8e9c 100644 --- a/layout/html/style/src/Makefile.in +++ b/layout/html/style/src/Makefile.in @@ -86,6 +86,5 @@ endif ifdef MOZ_SVG INCLUDES += \ - -I$(srcdir)/../../../svg/content/src \ -I$(srcdir)/../../../svg/base/src endif diff --git a/layout/html/style/src/makefile.win b/layout/html/style/src/makefile.win index 29a941f909f5..964aa0222869 100644 --- a/layout/html/style/src/makefile.win +++ b/layout/html/style/src/makefile.win @@ -40,6 +40,7 @@ REQUIRES = xpcom \ gfx2 \ gfx \ content \ + raptor \ layout_xul \ !ifdef MOZ_SVG raptor \ @@ -69,7 +70,6 @@ LINCS= \ -I..\..\..\mathml\base\src \ !endif !ifdef MOZ_SVG - -I..\..\..\svg\content\src \ -I..\..\..\svg\base\src \ !endif -I..\..\forms\src \ diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 77be2f98790d..0b94742b91e0 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -144,24 +144,32 @@ static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID); #ifdef MOZ_SVG #include "nsSVGAtoms.h" -#endif +#include "nsISVGAttribute.h" +#include "nsISVGValue.h" +#include "nsISVGStyleValue.h" -#ifdef MOZ_SVG -#include "nsSVGAtoms.h" -#include "nsSVGContainerFrame.h" -#include "nsPolygonFrame.h" -#include "nsPolylineFrame.h" - - - -nsresult -NS_NewSVGContainerFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot ); - -nsresult -NS_NewPolygonFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); - -nsresult -NS_NewPolylineFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +extern nsresult +NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); #endif #include "nsIDocument.h" @@ -3274,8 +3282,10 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, contentFrame->GetStyleContext(getter_AddRefs(styleContext)); } else { // otherwise build a box or a block -#ifdef INCLUDE_XUL +#if defined(INCLUDE_XUL) || defined(MOZ_SVG) PRInt32 nameSpaceID; +#endif +#ifdef INCLUDE_XUL if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) && nameSpaceID == nsXULAtoms::nameSpaceID) { rv = NS_NewDocElementBoxFrame(aPresShell, &contentFrame); @@ -3285,6 +3295,18 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell, } else #endif +#ifdef MOZ_SVG + if (NS_SUCCEEDED(aDocElement->GetNameSpaceID(nameSpaceID)) && + (nameSpaceID == nsSVGAtoms::nameSpaceID || + nameSpaceID == nsSVGAtoms::nameSpaceDeprecatedID)) { + rv = NS_NewSVGOuterSVGFrame(aPresShell, aDocElement, &contentFrame); + if (NS_FAILED(rv)) { + return rv; + } + isBlockFrame = PR_TRUE; + } + else +#endif { rv = NS_NewDocumentElementFrame(aPresShell, &contentFrame); if (NS_FAILED(rv)) { @@ -6826,17 +6848,17 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, nsIStyleContext* aStyleContext, nsFrameItems& aFrameItems) { - PRBool processChildren = PR_TRUE; // Whether we should process child content. - // MathML frames are inline frames. - // processChildren = PR_TRUE for inline frames. - // see case NS_STYLE_DISPLAY_INLINE in - // ConstructFrameByDisplayType() - - nsresult rv = NS_OK; - PRBool isAbsolutelyPositioned = PR_FALSE; - PRBool isFixedPositioned = PR_FALSE; - PRBool isReplaced = PR_FALSE; + // Make sure that we remain confined in the SVG world + if (aNameSpaceID != nsSVGAtoms::nameSpaceID) + return NS_OK; + nsresult rv = NS_OK; + PRBool isAbsolutelyPositioned = PR_FALSE; + PRBool isFixedPositioned = PR_FALSE; + PRBool forceView = PR_FALSE; + PRBool isBlock = PR_FALSE; + PRBool processChildren = PR_FALSE; + NS_ASSERTION(aTag != nsnull, "null SVG tag"); if (aTag == nsnull) return NS_OK; @@ -6858,22 +6880,57 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, else if (NS_STYLE_POSITION_FIXED == disp->mPosition) { isFixedPositioned = PR_TRUE; } - if (aTag == nsSVGAtoms::g) - rv = NS_NewSVGContainerFrame(aPresShell, &newFrame); - else if (aTag == nsSVGAtoms::polygon) - rv = NS_NewPolygonFrame(aPresShell, &newFrame); - else if (aTag == nsSVGAtoms::polyline) - rv = NS_NewPolylineFrame(aPresShell, &newFrame); + if (aTag == nsSVGAtoms::svg) { + forceView = PR_TRUE; + isBlock = PR_TRUE; + processChildren = PR_TRUE; + rv = NS_NewSVGOuterSVGFrame(aPresShell, aContent, &newFrame); + } + else if (aTag == nsSVGAtoms::g) { + processChildren = PR_TRUE; + rv = NS_NewSVGGFrame(aPresShell, aContent, &newFrame); + } + else if (aTag == nsSVGAtoms::polygon) + rv = NS_NewSVGPolygonFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::polyline) + rv = NS_NewSVGPolylineFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::circle) + rv = NS_NewSVGCircleFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::ellipse) + rv = NS_NewSVGEllipseFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::line) + rv = NS_NewSVGLineFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::rect) + rv = NS_NewSVGRectFrame(aPresShell, aContent, &newFrame); + else if (aTag == nsSVGAtoms::foreignObject) { + processChildren = PR_TRUE; + rv = NS_NewSVGForeignObjectFrame(aPresShell, aContent, &newFrame); + } + else if (aTag == nsSVGAtoms::path) + rv = NS_NewSVGPathFrame(aPresShell, aContent, &newFrame); + + if (newFrame == nsnull) { + // Either we have an unknown tag, or construction of a frame + // failed. One reason why frame construction for a known tag might + // have failed is that the content element doesn't implement all + // interfaces required by the frame. This happens e.g. when using + // 'extends' in xbl to extend an xbl binding from an svg + // element. In that case, the bound content element will always be + // a standard xml element, and not be of the right type. + // The best we can do here is to create a generic svg container frame. +#ifdef DEBUG + printf("Warning: Creating SVGGenericContainerFrame for tag <"); + nsAutoString str; + aTag->ToString(str); + printf("%s>\n", NS_ConvertUCS2toUTF8(str).get()); +#endif + processChildren = PR_TRUE; + rv = NS_NewSVGGenericContainerFrame(aPresShell, aContent, &newFrame); + } // If we succeeded in creating a frame then initialize it, process its // children (if requested), and set the initial child list if (NS_SUCCEEDED(rv) && newFrame != nsnull) { - // If the frame is a replaced element, then set the frame state bit - if (isReplaced) { - nsFrameState state; - newFrame->GetFrameState(&state); - newFrame->SetFrameState(state | NS_FRAME_REPLACED_ELEMENT); - } nsIFrame* geometricParent = isAbsolutelyPositioned ? aState.mAbsoluteItems.containingBlock @@ -6881,9 +6938,9 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, InitAndRestoreFrame(aPresContext, aState, aContent, geometricParent, aStyleContext, nsnull, newFrame); - // See if we need to create a view, e.g. the frame is absolutely positioned nsHTMLContainerFrame::CreateViewForFrame(aPresContext, newFrame, - aStyleContext, aParentFrame, PR_FALSE); + aStyleContext, aParentFrame, + forceView); // Add the new frame to our list of frame items. aFrameItems.AddChild(newFrame); @@ -6891,8 +6948,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell, // Process the child content if requested nsFrameItems childItems; if (processChildren) { - rv = ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE, - childItems, PR_FALSE); + rv = ProcessChildren(aPresShell, aPresContext, aState, aContent, + newFrame, PR_TRUE, childItems, isBlock); CreateAnonymousFrames(aPresShell, aPresContext, aTag, aState, aContent, newFrame, childItems); @@ -7087,8 +7144,11 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe // SVG #ifdef MOZ_SVG - if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || - (lastChild == aFrameItems.lastChild))) { + if (NS_SUCCEEDED(rv) && + ((nsnull == aFrameItems.childList) || + (lastChild == aFrameItems.lastChild)) && + (aNameSpaceID == nsSVGAtoms::nameSpaceID || + aNameSpaceID == nsSVGAtoms::nameSpaceDeprecatedID)) { rv = ConstructSVGFrame(aPresShell, aPresContext, aState, aContent, aParentFrame, aTag, aNameSpaceID, styleContext, aFrameItems); } @@ -10122,7 +10182,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); nsIFrame* primaryFrame; - + shell->GetPrimaryFrameFor(aContent, &primaryFrame); PRBool reconstruct = PR_FALSE; @@ -10240,6 +10300,63 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, } } } +#ifdef MOZ_SVG + else { // XXX should check we're in SVG NS + nsCOMPtr domel(do_QueryInterface(aContent)); + if (domel) { + // XXX there must be a better way of doing this + nsCOMPtr attr; + domel->GetAttributeNode(NS_LITERAL_STRING("style"), getter_AddRefs(attr)); + if (attr) { + nsCOMPtr svgattr(do_QueryInterface(attr)); + if (svgattr) { + nsCOMPtr value; + svgattr->GetSVGValue(getter_AddRefs(value)); + if (value) { + nsCOMPtr stylevalue(do_QueryInterface(value)); + if (stylevalue) { + nsCOMPtr doc; + aContent->GetDocument(*getter_AddRefs(doc)); + if (doc) { + stylevalue->GetStyleRule(doc, getter_AddRefs(rule)); + if (rule) { + inlineStyle = PR_TRUE; + + // ---- + if (primaryFrame) + primaryFrame->GetStyleContext(getter_AddRefs(styleContext)); + else { + // We might be in the undisplayed map. Retrieve the style context from there. + nsCOMPtr frameManager; + shell->GetFrameManager(getter_AddRefs(frameManager)); + frameManager->GetUndisplayedContent(aContent, getter_AddRefs(styleContext)); + if (!styleContext) { + // Well, we don't have a context to use as a guide. + // Attempt #3 will be to resolve style if we at least have a parent frame. + nsCOMPtr parent; + aContent->GetParent(*getter_AddRefs(parent)); + if (parent) { + nsIFrame* parentFrame; + shell->GetPrimaryFrameFor(parent, &parentFrame); + if (parentFrame) { + nsCOMPtr parentContext; + parentFrame->GetStyleContext(getter_AddRefs(parentContext)); + aPresContext->ResolveStyleContextFor(aContent, parentContext, PR_FALSE, + getter_AddRefs(styleContext)); + } + } + } + } + //----- + } + } + } + } + } + } + } + } +#endif } // first see if we need to manage the style system: @@ -10272,6 +10389,12 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext, shell->GetFrameManager(getter_AddRefs(frameManager)); PRBool affects; +#ifdef MOZ_SVG + // XXX should check we're in SVG NS here + if (aAttribute == nsHTMLAtoms::style) + affects = PR_TRUE; + else +#endif frameManager->AttributeAffectsStyle(aAttribute, aContent, affects); if (affects) { #ifdef DEBUG_shaver diff --git a/layout/html/tests/makefile.win b/layout/html/tests/makefile.win index 450227fa6610..07c7dc619706 100644 --- a/layout/html/tests/makefile.win +++ b/layout/html/tests/makefile.win @@ -61,7 +61,6 @@ LLIBS= \ !endif !ifdef MOZ_SVG $(DIST)\lib\layoutsvgbase_s.lib \ - $(DIST)\lib\layoutsvgcontent_s.lib \ !endif $(DIST)\lib\util.lib \ $(DIST)\lib\xpcom.lib \ diff --git a/layout/macbuild/layout.xml b/layout/macbuild/layout.xml index 4d529b032903..ffbc9bc241aa 100644 --- a/layout/macbuild/layout.xml +++ b/layout/macbuild/layout.xml @@ -6956,6 +6956,18 @@ UnicharUtilsStaticDebug.o MacOS + + layoutDebug.shlb + Name + contentsharedDebug.o + MacOS + + + layout.shlb + Name + contentshared.o + MacOS + Options Debug @@ -6989,12 +7001,6 @@ NS Libraries Debug - - layoutDebug.shlb - Name - contentsharedDebug.o - MacOS - layoutDebug.shlb Name @@ -7039,12 +7045,6 @@ Optimized - - layout.shlb - Name - contentshared.o - MacOS - layout.shlb Name diff --git a/layout/macbuild/layoutsvg.xml b/layout/macbuild/layoutsvg.xml index 4dd3eeec2197..6fb855961c29 100644 --- a/layout/macbuild/layoutsvg.xml +++ b/layout/macbuild/layoutsvg.xml @@ -65,6 +65,16 @@ InterpretDOSAndUnixPathsfalse RequireFrameworkStyleIncludesfalse UserSearchPaths + + SearchPath + Path:::dist: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + SearchPath Path:: @@ -77,7 +87,7 @@ SearchPath - Path:::dist: + Path:::content:shared:src: PathFormatMacOS PathRootProject @@ -892,54 +902,189 @@ Name - nsPolygonFrame.cpp + nsSVGBPathBuilder.cpp MacOS Text - + Debug Name - nsPolylineFrame.cpp + nsSVGCircleFrame.cpp MacOS Text - + Debug Name - nsSVGContainerFrame.cpp + nsSVGFill.cpp MacOS Text - + Debug + + + Name + nsSVGForeignObjectFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGGenericContainerFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGGFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGGraphic.cpp + MacOS + Text + Debug + + + Name + nsSVGGraphicFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGOuterSVGFrame.cpp + MacOS + Text + Debug Name nsSVGPathFrame.cpp MacOS Text - + Debug + + + Name + nsSVGPolygonFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGPolylineFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGRenderingContext.cpp + MacOS + Text + Debug + + + Name + nsSVGRenderItem.cpp + MacOS + Text + Debug + + + Name + nsSVGStroke.cpp + MacOS + Text + Debug + + + Name + nsSVGEllipseFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGLineFrame.cpp + MacOS + Text + Debug + + + Name + nsSVGRectFrame.cpp + MacOS + Text + Debug Name nsSVGAtoms.cpp MacOS Text - + Debug + + + Name + libartDebug.shlb + MacOS + Library + Debug Name - nsPolygonFrame.cpp + nsSVGBPathBuilder.cpp MacOS Name - nsPolylineFrame.cpp + nsSVGCircleFrame.cpp MacOS Name - nsSVGContainerFrame.cpp + nsSVGFill.cpp + MacOS + + + Name + nsSVGForeignObjectFrame.cpp + MacOS + + + Name + nsSVGGenericContainerFrame.cpp + MacOS + + + Name + nsSVGGFrame.cpp + MacOS + + + Name + nsSVGGraphic.cpp + MacOS + + + Name + nsSVGGraphicFrame.cpp + MacOS + + + Name + nsSVGOuterSVGFrame.cpp MacOS @@ -947,11 +1092,56 @@ nsSVGPathFrame.cpp MacOS + + Name + nsSVGPolygonFrame.cpp + MacOS + + + Name + nsSVGPolylineFrame.cpp + MacOS + + + Name + nsSVGRenderingContext.cpp + MacOS + + + Name + nsSVGRenderItem.cpp + MacOS + + + Name + nsSVGStroke.cpp + MacOS + + + Name + nsSVGEllipseFrame.cpp + MacOS + + + Name + nsSVGLineFrame.cpp + MacOS + + + Name + nsSVGRectFrame.cpp + MacOS + Name nsSVGAtoms.cpp MacOS + + Name + libartDebug.shlb + MacOS + @@ -986,6 +1176,36 @@ FrameworkPathfalse HostFlagsAll + + SearchPath + Path:::content:svg: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::content:macbuild: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + + + SearchPath + Path:::content:shared:src: + PathFormatMacOS + PathRootProject + + Recursivetrue + FrameworkPathfalse + HostFlagsAll + SystemSearchPaths @@ -1793,21 +2013,63 @@ Name - nsPolygonFrame.cpp + nsSVGBPathBuilder.cpp MacOS Text Name - nsPolylineFrame.cpp + nsSVGCircleFrame.cpp MacOS Text Name - nsSVGContainerFrame.cpp + nsSVGFill.cpp + MacOS + Text + + + + Name + nsSVGForeignObjectFrame.cpp + MacOS + Text + + + + Name + nsSVGGenericContainerFrame.cpp + MacOS + Text + + + + Name + nsSVGGFrame.cpp + MacOS + Text + + + + Name + nsSVGGraphic.cpp + MacOS + Text + + + + Name + nsSVGGraphicFrame.cpp + MacOS + Text + + + + Name + nsSVGOuterSVGFrame.cpp MacOS Text @@ -1819,6 +2081,62 @@ Text + + Name + nsSVGPolygonFrame.cpp + MacOS + Text + + + + Name + nsSVGPolylineFrame.cpp + MacOS + Text + + + + Name + nsSVGRenderingContext.cpp + MacOS + Text + + + + Name + nsSVGRenderItem.cpp + MacOS + Text + + + + Name + nsSVGStroke.cpp + MacOS + Text + + + + Name + nsSVGEllipseFrame.cpp + MacOS + Text + + + + Name + nsSVGLineFrame.cpp + MacOS + Text + + + + Name + nsSVGRectFrame.cpp + MacOS + Text + + Name nsSVGAtoms.cpp @@ -1826,21 +2144,58 @@ Text + + Name + libart.shlb + MacOS + Library + + Name - nsPolygonFrame.cpp + nsSVGBPathBuilder.cpp MacOS Name - nsPolylineFrame.cpp + nsSVGCircleFrame.cpp MacOS Name - nsSVGContainerFrame.cpp + nsSVGFill.cpp + MacOS + + + Name + nsSVGForeignObjectFrame.cpp + MacOS + + + Name + nsSVGGenericContainerFrame.cpp + MacOS + + + Name + nsSVGGFrame.cpp + MacOS + + + Name + nsSVGGraphic.cpp + MacOS + + + Name + nsSVGGraphicFrame.cpp + MacOS + + + Name + nsSVGOuterSVGFrame.cpp MacOS @@ -1848,11 +2203,56 @@ nsSVGPathFrame.cpp MacOS + + Name + nsSVGPolygonFrame.cpp + MacOS + + + Name + nsSVGPolylineFrame.cpp + MacOS + + + Name + nsSVGRenderingContext.cpp + MacOS + + + Name + nsSVGRenderItem.cpp + MacOS + + + Name + nsSVGStroke.cpp + MacOS + + + Name + nsSVGEllipseFrame.cpp + MacOS + + + Name + nsSVGLineFrame.cpp + MacOS + + + Name + nsSVGRectFrame.cpp + MacOS + Name nsSVGAtoms.cpp MacOS + + Name + libart.shlb + MacOS + @@ -3553,19 +3953,73 @@ layoutsvgDebug.o Name - nsPolygonFrame.cpp + nsSVGBPathBuilder.cpp MacOS layoutsvgDebug.o Name - nsPolylineFrame.cpp + nsSVGCircleFrame.cpp MacOS layoutsvgDebug.o Name - nsSVGContainerFrame.cpp + nsSVGFill.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGForeignObjectFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGGenericContainerFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGGFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGGraphic.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGGraphicFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGOuterSVGFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGEllipseFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGLineFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGRectFrame.cpp MacOS @@ -3574,17 +4028,67 @@ nsSVGPathFrame.cpp MacOS - - content layoutsvgDebug.o Name - nsSVGAtoms.cpp + nsSVGPolygonFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGPolylineFrame.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGRenderingContext.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGRenderItem.cpp + MacOS + + + layoutsvgDebug.o + Name + nsSVGStroke.cpp MacOS + content + shared + + layoutsvgDebug.o + Name + nsSVGAtoms.cpp + MacOS + + + + Libraries + Debug + + layoutsvgDebug.o + Name + libartDebug.shlb + MacOS + + + Optimized + + layoutsvg.o + Name + libart.shlb + MacOS + + + diff --git a/layout/style/nsCSSDeclaration.cpp b/layout/style/nsCSSDeclaration.cpp index b94ff1bff5f2..5cea645e1016 100644 --- a/layout/style/nsCSSDeclaration.cpp +++ b/layout/style/nsCSSDeclaration.cpp @@ -70,6 +70,10 @@ static NS_DEFINE_IID(kCSSAuralSID, NS_CSS_AURAL_SID); static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID); #endif +#ifdef MOZ_SVG +static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID); +#endif + #define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; } nsCSSStruct::~nsCSSStruct() @@ -1075,6 +1079,62 @@ void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const #endif // INCLUDE_XUL +#ifdef MOZ_SVG +// --- nsCSSSVG ----------------- + +nsCSSSVG::nsCSSSVG(void) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::nsCSSSVG(const nsCSSSVG& aCopy) + : mFill(aCopy.mFill), + mFillOpacity(aCopy.mFillOpacity), + mFillRule(aCopy.mFillRule), + mStroke(aCopy.mStroke), + mStrokeDasharray(aCopy.mStrokeDasharray), + mStrokeDashoffset(aCopy.mStrokeDashoffset), + mStrokeLinecap(aCopy.mStrokeLinecap), + mStrokeLinejoin(aCopy.mStrokeLinejoin), + mStrokeMiterlimit(aCopy.mStrokeMiterlimit), + mStrokeOpacity(aCopy.mStrokeOpacity), + mStrokeWidth(aCopy.mStrokeWidth) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::~nsCSSSVG(void) +{ + MOZ_COUNT_DTOR(nsCSSSVG); +} + +const nsID& nsCSSSVG::GetID(void) +{ + return kCSSSVGSID; +} + +void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const +{ + for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out); + + nsAutoString buffer; + + mFill.AppendToString(buffer, eCSSProperty_fill); + mFillOpacity.AppendToString(buffer, eCSSProperty_fill_opacity); + mFillRule.AppendToString(buffer, eCSSProperty_fill_rule); + mStroke.AppendToString(buffer, eCSSProperty_stroke); + mStrokeDasharray.AppendToString(buffer, eCSSProperty_stroke_dasharray); + mStrokeDashoffset.AppendToString(buffer, eCSSProperty_stroke_dashoffset); + mStrokeLinecap.AppendToString(buffer, eCSSProperty_stroke_linecap); + mStrokeLinejoin.AppendToString(buffer, eCSSProperty_stroke_linejoin); + mStrokeMiterlimit.AppendToString(buffer, eCSSProperty_stroke_miterlimit); + mStrokeOpacity.AppendToString(buffer, eCSSProperty_stroke_opacity); + mStrokeWidth.AppendToString(buffer, eCSSProperty_stroke_width); + fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); +} + +#endif // MOZ_SVG + // --- nsCSSDeclaration ----------------- @@ -1185,6 +1245,10 @@ protected: nsCSSXUL* mXUL; #endif +#ifdef MOZ_SVG + nsCSSSVG* mSVG; +#endif + CSSDeclarationImpl* mImportant; nsVoidArray* mOrder; @@ -1230,6 +1294,10 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) DECL_IF_COPY(XUL); #endif +#ifdef MOZ_SVG + DECL_IF_COPY(SVG); +#endif + #ifdef DEBUG_REFS ++gInstanceCount; fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); @@ -1275,6 +1343,10 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) CSS_IF_DELETE(mXUL); #endif +#ifdef MOZ_SVG + CSS_IF_DELETE(mSVG); +#endif + NS_IF_RELEASE(mImportant); CSS_IF_DELETE(mOrder); CSS_IF_DELETE(mComments); @@ -1312,6 +1384,9 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr) CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) #ifdef INCLUDE_XUL CSS_IF_GET_ELSE(aSID, XUL, aDataPtr) +#endif +#ifdef MOZ_SVG + CSS_IF_GET_ELSE(aSID, SVG, aDataPtr) #endif { return NS_NOINTERFACE; @@ -1884,7 +1959,40 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_ENSURE(SVG) { + switch (aProperty) { + case eCSSProperty_fill: mSVG->mFill = aValue; break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity = aValue; break; + case eCSSProperty_fill_rule: mSVG->mFillRule = aValue; break; + case eCSSProperty_stroke: mSVG->mStroke = aValue; break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray = aValue; break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset = aValue; break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap = aValue; break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin = aValue; break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit = aValue; break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity = aValue; break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + break; +#endif + + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -2747,7 +2855,41 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + CSS_ENSURE_IMPORTANT(SVG) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty_fill, mSVG->mFill); + CSS_CASE_IMPORTANT(eCSSProperty_fill_opacity, mSVG->mFillOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_fill_rule, mSVG->mFillRule); + CSS_CASE_IMPORTANT(eCSSProperty_stroke, mSVG->mStroke); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dasharray, mSVG->mStrokeDasharray); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dashoffset, mSVG->mStrokeDashoffset); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linecap, mSVG->mStrokeLinecap); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linejoin, mSVG->mStrokeLinejoin); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_miterlimit, mSVG->mStrokeMiterlimit); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_opacity, mSVG->mStrokeOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_width, mSVG->mStrokeWidth); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -3483,6 +3625,39 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty) break; #endif +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_CHECK(SVG) { + switch(aProperty) { + case eCSSProperty_fill: mSVG->mFill.Reset(); break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity.Reset(); break; + case eCSSProperty_fill_rule: mSVG->mFillRule.Reset(); break; + case eCSSProperty_stroke: mSVG->mStroke.Reset(); break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray.Reset(); break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset.Reset(); break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap.Reset(); break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin.Reset(); break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit.Reset(); break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity.Reset(); break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth.Reset(); break; + CSS_BOGUS_DEFAULT; // Make compiler happy + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: @@ -4258,7 +4433,42 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + switch (aProperty) { + case eCSSProperty_fill: aValue = mSVG->mFill; break; + case eCSSProperty_fill_opacity: aValue = mSVG->mFillOpacity; break; + case eCSSProperty_fill_rule: aValue = mSVG->mFillRule; break; + case eCSSProperty_stroke: aValue = mSVG->mStroke; break; + case eCSSProperty_stroke_dasharray: aValue = mSVG->mStrokeDasharray; break; + case eCSSProperty_stroke_dashoffset: aValue = mSVG->mStrokeDashoffset; break; + case eCSSProperty_stroke_linecap: aValue = mSVG->mStrokeLinecap; break; + case eCSSProperty_stroke_linejoin: aValue = mSVG->mStrokeLinejoin; break; + case eCSSProperty_stroke_miterlimit: aValue = mSVG->mStrokeMiterlimit; break; + case eCSSProperty_stroke_opacity: aValue = mSVG->mStrokeOpacity; break; + case eCSSProperty_stroke_width: aValue = mSVG->mStrokeWidth; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -5438,6 +5648,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz if(mXUL && uniqueItems->AddItem(mXUL)){ aSize += sizeof(*mXUL); } +#endif +#ifdef MOZ_SVG + if(mSVG && uniqueItems->AddItem(mSVG)){ + aSize += sizeof(*mSVG); + } #endif if(mAural && uniqueItems->AddItem(mAural)){ aSize += sizeof(*mAural); diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 91008cf4dff6..f9950dd32ab0 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -408,3 +408,12 @@ CSS_KEY(x-small, x_small) CSS_KEY(x-soft, x_soft) CSS_KEY(xx-large, xx_large) CSS_KEY(xx-small, xx_small) +#ifdef MOZ_SVG +CSS_KEY(bevel, bevel) +CSS_KEY(butt, butt) +CSS_KEY(evenodd, evenodd) +CSS_KEY(miter, miter) +CSS_KEY(nonzero, nonzero) +CSS_KEY(round, round) +//CSS_KEY(square, square) +#endif diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 1f3d104a983b..36b7a314d3c6 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -3672,6 +3672,41 @@ PRBool CSSParserImpl::ParseSingleValueProperty(PRInt32& aErrorCode, nsCSSProps::kBoxPackKTable); case eCSSProperty_box_ordinal_group: return ParseVariant(aErrorCode, aValue, VARIANT_INTEGER, nsnull); +#endif +#ifdef MOZ_SVG + case eCSSProperty_fill: + return ParseVariant(aErrorCode, aValue, VARIANT_HC | VARIANT_NONE, + nsnull); + case eCSSProperty_fill_opacity: + return ParseVariant(aErrorCode, aValue, VARIANT_HN, + nsnull); + case eCSSProperty_fill_rule: + return ParseVariant(aErrorCode, aValue, VARIANT_HK, + nsCSSProps::kFillRuleKTable); + case eCSSProperty_stroke: + return ParseVariant(aErrorCode, aValue, VARIANT_HC | VARIANT_NONE, + nsnull); + case eCSSProperty_stroke_dasharray: + return ParseVariant(aErrorCode, aValue, VARIANT_HOS, + nsnull); // XXX parse into new CSS value type, not string + case eCSSProperty_stroke_dashoffset: + return ParseVariant(aErrorCode, aValue, VARIANT_HLPN, + nsnull); + case eCSSProperty_stroke_linecap: + return ParseVariant(aErrorCode, aValue, VARIANT_HK, + nsCSSProps::kStrokeLinecapKTable); + case eCSSProperty_stroke_linejoin: + return ParseVariant(aErrorCode, aValue, VARIANT_HK, + nsCSSProps::kStrokeLinejoinKTable); + case eCSSProperty_stroke_miterlimit: + return ParsePositiveVariant(aErrorCode, aValue, VARIANT_HN, + nsnull); // XXX value > 1 + case eCSSProperty_stroke_opacity: + return ParseVariant(aErrorCode, aValue, VARIANT_HN, + nsnull); + case eCSSProperty_stroke_width: + return ParsePositiveVariant(aErrorCode, aValue, VARIANT_HLPN, + nsnull); #endif case eCSSProperty_box_sizing: return ParseVariant(aErrorCode, aValue, VARIANT_HK, diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 96f2860ef57f..d990fb8cc2d1 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -251,3 +251,17 @@ CSS_PROP(widows, widows, REFLOW) CSS_PROP(width, width, REFLOW) CSS_PROP(word-spacing, word_spacing, REFLOW) CSS_PROP(z-index, z_index, REFLOW) +#ifdef MOZ_SVG +CSS_PROP(fill, fill, VISUAL) +CSS_PROP(fill-opacity, fill_opacity, VISUAL) +CSS_PROP(fill-rule, fill_rule, VISUAL) +CSS_PROP(stroke, stroke, VISUAL) +CSS_PROP(stroke-dasharray, stroke_dasharray, VISUAL) +CSS_PROP(stroke-dashoffset, stroke_dashoffset, VISUAL) +CSS_PROP(stroke-linecap, stroke_linecap, VISUAL) +CSS_PROP(stroke-linejoin, stroke_linejoin, VISUAL) +CSS_PROP(stroke-miterlimit, stroke_miterlimit, VISUAL) +CSS_PROP(stroke-opacity, stroke_opacity, VISUAL) +CSS_PROP(stroke-width, stroke_width, VISUAL) +#endif + diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 04d2c354086a..af6ab4a70431 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -738,6 +738,29 @@ const PRInt32 nsCSSProps::kBoxPackKTable[] = { }; #endif +#ifdef MOZ_SVG +// keyword tables for SVG properties +const PRInt32 nsCSSProps::kFillRuleKTable[] = { + eCSSKeyword_nonzero, NS_STYLE_FILL_RULE_NONZERO, + eCSSKeyword_evenodd, NS_STYLE_FILL_RULE_EVENODD, + -1, -1 +}; + +const PRInt32 nsCSSProps::kStrokeLinecapKTable[] = { + eCSSKeyword_butt, NS_STYLE_STROKE_LINECAP_BUTT, + eCSSKeyword_round, NS_STYLE_STROKE_LINECAP_ROUND, + eCSSKeyword_square, NS_STYLE_STROKE_LINECAP_SQUARE, + -1, -1 +}; + +const PRInt32 nsCSSProps::kStrokeLinejoinKTable[] = { + eCSSKeyword_butt, NS_STYLE_STROKE_LINEJOIN_MITER, + eCSSKeyword_round, NS_STYLE_STROKE_LINEJOIN_ROUND, + eCSSKeyword_bevel, NS_STYLE_STROKE_LINEJOIN_BEVEL, + -1, -1 +}; +#endif + PRInt32 nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]) { @@ -835,6 +858,25 @@ static const PRInt32 kBackgroundYPositionKTable[] = { return SearchKeywordTable(aValue, kBoxPackKTable); #endif +#ifdef MOZ_SVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + break; + + case eCSSProperty_fill_rule: + return SearchKeywordTable(aValue, kFillRuleKTable); + case eCSSProperty_stroke_linecap: + return SearchKeywordTable(aValue, kStrokeLinecapKTable); + case eCSSProperty_stroke_linejoin: + return SearchKeywordTable(aValue, kStrokeLinejoinKTable); +#endif + case eCSSProperty_box_sizing: return SearchKeywordTable(aValue, kBoxSizingKTable); diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index cf430114901d..4990c767a190 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -96,6 +96,11 @@ public: static const PRInt32 kBoxDirectionKTable[]; static const PRInt32 kBoxOrientKTable[]; static const PRInt32 kBoxPackKTable[]; +#endif +#ifdef MOZ_SVG + static const PRInt32 kFillRuleKTable[]; + static const PRInt32 kStrokeLinecapKTable[]; + static const PRInt32 kStrokeLinejoinKTable[]; #endif static const PRInt32 kBoxSizingKTable[]; static const PRInt32 kCaptionSideKTable[]; diff --git a/layout/style/nsCSSStruct.cpp b/layout/style/nsCSSStruct.cpp index b94ff1bff5f2..5cea645e1016 100644 --- a/layout/style/nsCSSStruct.cpp +++ b/layout/style/nsCSSStruct.cpp @@ -70,6 +70,10 @@ static NS_DEFINE_IID(kCSSAuralSID, NS_CSS_AURAL_SID); static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID); #endif +#ifdef MOZ_SVG +static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID); +#endif + #define CSS_IF_DELETE(ptr) if (nsnull != ptr) { delete ptr; ptr = nsnull; } nsCSSStruct::~nsCSSStruct() @@ -1075,6 +1079,62 @@ void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const #endif // INCLUDE_XUL +#ifdef MOZ_SVG +// --- nsCSSSVG ----------------- + +nsCSSSVG::nsCSSSVG(void) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::nsCSSSVG(const nsCSSSVG& aCopy) + : mFill(aCopy.mFill), + mFillOpacity(aCopy.mFillOpacity), + mFillRule(aCopy.mFillRule), + mStroke(aCopy.mStroke), + mStrokeDasharray(aCopy.mStrokeDasharray), + mStrokeDashoffset(aCopy.mStrokeDashoffset), + mStrokeLinecap(aCopy.mStrokeLinecap), + mStrokeLinejoin(aCopy.mStrokeLinejoin), + mStrokeMiterlimit(aCopy.mStrokeMiterlimit), + mStrokeOpacity(aCopy.mStrokeOpacity), + mStrokeWidth(aCopy.mStrokeWidth) +{ + MOZ_COUNT_CTOR(nsCSSSVG); +} + +nsCSSSVG::~nsCSSSVG(void) +{ + MOZ_COUNT_DTOR(nsCSSSVG); +} + +const nsID& nsCSSSVG::GetID(void) +{ + return kCSSSVGSID; +} + +void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const +{ + for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out); + + nsAutoString buffer; + + mFill.AppendToString(buffer, eCSSProperty_fill); + mFillOpacity.AppendToString(buffer, eCSSProperty_fill_opacity); + mFillRule.AppendToString(buffer, eCSSProperty_fill_rule); + mStroke.AppendToString(buffer, eCSSProperty_stroke); + mStrokeDasharray.AppendToString(buffer, eCSSProperty_stroke_dasharray); + mStrokeDashoffset.AppendToString(buffer, eCSSProperty_stroke_dashoffset); + mStrokeLinecap.AppendToString(buffer, eCSSProperty_stroke_linecap); + mStrokeLinejoin.AppendToString(buffer, eCSSProperty_stroke_linejoin); + mStrokeMiterlimit.AppendToString(buffer, eCSSProperty_stroke_miterlimit); + mStrokeOpacity.AppendToString(buffer, eCSSProperty_stroke_opacity); + mStrokeWidth.AppendToString(buffer, eCSSProperty_stroke_width); + fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out); +} + +#endif // MOZ_SVG + // --- nsCSSDeclaration ----------------- @@ -1185,6 +1245,10 @@ protected: nsCSSXUL* mXUL; #endif +#ifdef MOZ_SVG + nsCSSSVG* mSVG; +#endif + CSSDeclarationImpl* mImportant; nsVoidArray* mOrder; @@ -1230,6 +1294,10 @@ CSSDeclarationImpl::CSSDeclarationImpl(const CSSDeclarationImpl& aCopy) DECL_IF_COPY(XUL); #endif +#ifdef MOZ_SVG + DECL_IF_COPY(SVG); +#endif + #ifdef DEBUG_REFS ++gInstanceCount; fprintf(stdout, "CSSDeclaration Instances (cp-ctor): %ld\n", (long)gInstanceCount); @@ -1275,6 +1343,10 @@ CSSDeclarationImpl::~CSSDeclarationImpl(void) CSS_IF_DELETE(mXUL); #endif +#ifdef MOZ_SVG + CSS_IF_DELETE(mSVG); +#endif + NS_IF_RELEASE(mImportant); CSS_IF_DELETE(mOrder); CSS_IF_DELETE(mComments); @@ -1312,6 +1384,9 @@ CSSDeclarationImpl::GetData(const nsID& aSID, nsCSSStruct** aDataPtr) CSS_IF_GET_ELSE(aSID, Aural, aDataPtr) #ifdef INCLUDE_XUL CSS_IF_GET_ELSE(aSID, XUL, aDataPtr) +#endif +#ifdef MOZ_SVG + CSS_IF_GET_ELSE(aSID, SVG, aDataPtr) #endif { return NS_NOINTERFACE; @@ -1884,7 +1959,40 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_ENSURE(SVG) { + switch (aProperty) { + case eCSSProperty_fill: mSVG->mFill = aValue; break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity = aValue; break; + case eCSSProperty_fill_rule: mSVG->mFillRule = aValue; break; + case eCSSProperty_stroke: mSVG->mStroke = aValue; break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray = aValue; break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset = aValue; break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap = aValue; break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin = aValue; break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit = aValue; break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity = aValue; break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + break; +#endif + + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -2747,7 +2855,41 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + CSS_ENSURE_IMPORTANT(SVG) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty_fill, mSVG->mFill); + CSS_CASE_IMPORTANT(eCSSProperty_fill_opacity, mSVG->mFillOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_fill_rule, mSVG->mFillRule); + CSS_CASE_IMPORTANT(eCSSProperty_stroke, mSVG->mStroke); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dasharray, mSVG->mStrokeDasharray); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_dashoffset, mSVG->mStrokeDashoffset); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linecap, mSVG->mStrokeLinecap); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_linejoin, mSVG->mStrokeLinejoin); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_miterlimit, mSVG->mStrokeMiterlimit); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_opacity, mSVG->mStrokeOpacity); + CSS_CASE_IMPORTANT(eCSSProperty_stroke_width, mSVG->mStrokeWidth); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -3483,6 +3625,39 @@ CSSDeclarationImpl::RemoveProperty(nsCSSProperty aProperty) break; #endif +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + CSS_CHECK(SVG) { + switch(aProperty) { + case eCSSProperty_fill: mSVG->mFill.Reset(); break; + case eCSSProperty_fill_opacity: mSVG->mFillOpacity.Reset(); break; + case eCSSProperty_fill_rule: mSVG->mFillRule.Reset(); break; + case eCSSProperty_stroke: mSVG->mStroke.Reset(); break; + case eCSSProperty_stroke_dasharray: mSVG->mStrokeDasharray.Reset(); break; + case eCSSProperty_stroke_dashoffset: mSVG->mStrokeDashoffset.Reset(); break; + case eCSSProperty_stroke_linecap: mSVG->mStrokeLinecap.Reset(); break; + case eCSSProperty_stroke_linejoin: mSVG->mStrokeLinejoin.Reset(); break; + case eCSSProperty_stroke_miterlimit: mSVG->mStrokeMiterlimit.Reset(); break; + case eCSSProperty_stroke_opacity: mSVG->mStrokeOpacity.Reset(); break; + case eCSSProperty_stroke_width: mSVG->mStrokeWidth.Reset(); break; + CSS_BOGUS_DEFAULT; // Make compiler happy + } + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: @@ -4258,7 +4433,42 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) break; #endif - // nsCSSAural +#ifdef MOZ_SVG + // nsCSSSVG + case eCSSProperty_fill: + case eCSSProperty_fill_opacity: + case eCSSProperty_fill_rule: + case eCSSProperty_stroke: + case eCSSProperty_stroke_dasharray: + case eCSSProperty_stroke_dashoffset: + case eCSSProperty_stroke_linecap: + case eCSSProperty_stroke_linejoin: + case eCSSProperty_stroke_miterlimit: + case eCSSProperty_stroke_opacity: + case eCSSProperty_stroke_width: + if (nsnull != mSVG) { + switch (aProperty) { + case eCSSProperty_fill: aValue = mSVG->mFill; break; + case eCSSProperty_fill_opacity: aValue = mSVG->mFillOpacity; break; + case eCSSProperty_fill_rule: aValue = mSVG->mFillRule; break; + case eCSSProperty_stroke: aValue = mSVG->mStroke; break; + case eCSSProperty_stroke_dasharray: aValue = mSVG->mStrokeDasharray; break; + case eCSSProperty_stroke_dashoffset: aValue = mSVG->mStrokeDashoffset; break; + case eCSSProperty_stroke_linecap: aValue = mSVG->mStrokeLinecap; break; + case eCSSProperty_stroke_linejoin: aValue = mSVG->mStrokeLinejoin; break; + case eCSSProperty_stroke_miterlimit: aValue = mSVG->mStrokeMiterlimit; break; + case eCSSProperty_stroke_opacity: aValue = mSVG->mStrokeOpacity; break; + case eCSSProperty_stroke_width: aValue = mSVG->mStrokeWidth; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; +#endif + + // nsCSSAural case eCSSProperty_azimuth: case eCSSProperty_elevation: case eCSSProperty_cue_after: @@ -5438,6 +5648,11 @@ void CSSDeclarationImpl::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSiz if(mXUL && uniqueItems->AddItem(mXUL)){ aSize += sizeof(*mXUL); } +#endif +#ifdef MOZ_SVG + if(mSVG && uniqueItems->AddItem(mSVG)){ + aSize += sizeof(*mSVG); + } #endif if(mAural && uniqueItems->AddItem(mAural)){ aSize += sizeof(*mAural); diff --git a/layout/style/nsCSSStyleRule.cpp b/layout/style/nsCSSStyleRule.cpp index 91c41871f600..15ad7073de48 100644 --- a/layout/style/nsCSSStyleRule.cpp +++ b/layout/style/nsCSSStyleRule.cpp @@ -95,6 +95,9 @@ static NS_DEFINE_IID(kCSSPageSID, NS_CSS_PAGE_SID); #ifdef INCLUDE_XUL static NS_DEFINE_IID(kCSSXULSID, NS_CSS_XUL_SID); #endif +#ifdef MOZ_SVG +static NS_DEFINE_IID(kCSSSVGSID, NS_CSS_SVG_SID); +#endif // -- nsCSSSelector ------------------------------- @@ -875,6 +878,10 @@ static nsresult MapUIForDeclaration(nsICSSDeclaration* aDecl, const nsStyleStruc static nsresult MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL); #endif +#ifdef MOZ_SVG +static nsresult MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG); +#endif + class CSSStyleRuleImpl; class CSSImportantRule : public nsIStyleRule { @@ -986,6 +993,10 @@ CSSImportantRule::MapRuleInfoInto(nsRuleData* aRuleData) else if (aRuleData->mXULData) return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData); #endif +#ifdef MOZ_SVG + else if (aRuleData->mSVGData) + return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData); +#endif return NS_OK; } @@ -1722,6 +1733,10 @@ CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData) else if (aRuleData->mXULData) return MapXULForDeclaration(mDeclaration, *aRuleData->mXULData); #endif +#ifdef MOZ_SVG + else if (aRuleData->mSVGData) + return MapSVGForDeclaration(mDeclaration, *aRuleData->mSVGData); +#endif return NS_OK; } @@ -1798,6 +1813,57 @@ MapXULForDeclaration(nsICSSDeclaration* aDecl, nsCSSXUL& aXUL) } #endif +#ifdef MOZ_SVG +static nsresult +MapSVGForDeclaration(nsICSSDeclaration* aDecl, nsCSSSVG& aSVG) +{ + if (!aDecl) + return NS_OK; // The rule must have a declaration. + + nsCSSSVG* ourSVG; + aDecl->GetData(kCSSSVGSID, (nsCSSStruct**)&ourSVG); + if (!ourSVG) + return NS_OK; // We don't have any rules for SVG. + + // fill: + if (aSVG.mFill.GetUnit() == eCSSUnit_Null && ourSVG->mFill.GetUnit() != eCSSUnit_Null) + aSVG.mFill = ourSVG->mFill; + // fill-opacity: + if (aSVG.mFillOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mFillOpacity.GetUnit() != eCSSUnit_Null) + aSVG.mFillOpacity = ourSVG->mFillOpacity; + // fill-rule: + if (aSVG.mFillRule.GetUnit() == eCSSUnit_Null && ourSVG->mFillRule.GetUnit() != eCSSUnit_Null) + aSVG.mFillRule = ourSVG->mFillRule; + // stroke: + if (aSVG.mStroke.GetUnit() == eCSSUnit_Null && ourSVG->mStroke.GetUnit() != eCSSUnit_Null) + aSVG.mStroke = ourSVG->mStroke; + // stroke-dasharray: + if (aSVG.mStrokeDasharray.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDasharray.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeDasharray = ourSVG->mStrokeDasharray; + // stroke-dashoffset: + if (aSVG.mStrokeDashoffset.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeDashoffset.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeDashoffset = ourSVG->mStrokeDashoffset; + // stroke-linecap: enum, inherit + if (aSVG.mStrokeLinecap.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinecap.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeLinecap = ourSVG->mStrokeLinecap; + // stroke-linejoin + if (aSVG.mStrokeLinejoin.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeLinejoin.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeLinejoin = ourSVG->mStrokeLinejoin; + // stroke-miterlimit: + if (aSVG.mStrokeMiterlimit.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeMiterlimit.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeMiterlimit = ourSVG->mStrokeMiterlimit; + // stroke-opacity: + if (aSVG.mStrokeOpacity.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeOpacity.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeOpacity = ourSVG->mStrokeOpacity; + // stroke-width: + if (aSVG.mStrokeWidth.GetUnit() == eCSSUnit_Null && ourSVG->mStrokeWidth.GetUnit() != eCSSUnit_Null) + aSVG.mStrokeWidth = ourSVG->mStrokeWidth; + + return NS_OK; +} +#endif + + static nsresult MapPositionForDeclaration(nsICSSDeclaration* aDecl, nsCSSPosition& aPosition) { diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 1b647378ca12..b74c170b486d 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -913,6 +913,22 @@ static const PropertyCheckData XULCheckProperties[] = { }; #endif +#ifdef MOZ_SVG +static const PropertyCheckData SVGCheckProperties[] = { + CHECKDATA_PROP(nsCSSSVG, mFill, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mFillOpacity, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mFillRule, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStroke, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeDasharray, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeDashoffset, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeLinecap, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeLinejoin, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeMiterlimit, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeOpacity, CHECKDATA_VALUE, PR_FALSE), + CHECKDATA_PROP(nsCSSSVG, mStrokeWidth, CHECKDATA_VALUE, PR_FALSE) +}; +#endif + // These are indexed by style struct ID and must stay in order! static const StructCheckData gCheckProperties[] = { { nsnull, 0, nsnull}, /* empty, since no 0th SID */ @@ -937,6 +953,9 @@ static const StructCheckData gCheckProperties[] = { CHECKDATA_STRUCT(OutlineCheckProperties), #ifdef INCLUDE_XUL CHECKDATA_STRUCT(XULCheckProperties), +#endif +#ifdef MOZ_SVG + CHECKDATA_STRUCT(SVGCheckProperties), #endif { nsnull, 0, nsnull} /* empty, so at least we crash reliably if someone passes in the BorderPaddingShortcut ID */ @@ -1400,6 +1419,18 @@ nsRuleNode::GetXULData(nsIStyleContext* aContext, PRBool aComputeData) } #endif +#ifdef MOZ_SVG +const nsStyleStruct* +nsRuleNode::GetSVGData(nsIStyleContext* aContext, PRBool aComputeData) +{ + nsCSSSVG svgData; // Declare a struct with null CSS values. + nsRuleData ruleData(eStyleStruct_SVG, mPresContext, aContext); + ruleData.mSVGData = &svgData; + + return WalkRuleTree(eStyleStruct_SVG, aContext, &ruleData, &svgData, aComputeData); +} +#endif + const nsStyleStruct* nsRuleNode::WalkRuleTree(const nsStyleStructID aSID, nsIStyleContext* aContext, @@ -1676,6 +1707,15 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aConte } #endif +#ifdef MOZ_SVG + case eStyleStruct_SVG: + { + nsStyleSVG* svg = new (mPresContext) nsStyleSVG(); + aContext->SetStyle(eStyleStruct_SVG, *svg); + return svg; + } +#endif + case eStyleStruct_BorderPaddingShortcut: NS_ERROR("unexpected SID"); } @@ -1708,6 +1748,9 @@ nsRuleNode::gComputeStyleDataFn[] = { &nsRuleNode::ComputeOutlineData, #ifdef INCLUDE_XUL &nsRuleNode::ComputeXULData, +#endif +#ifdef MOZ_SVG + &nsRuleNode::ComputeSVGData, #endif nsnull }; @@ -4425,6 +4468,180 @@ nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData } #endif +#ifdef MOZ_SVG +static void +SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint, + nsIPresContext* aPresContext, nsStyleSVGPaint& aResult, PRBool& aInherited) +{ + if (aValue.GetUnit() == eCSSUnit_Inherit) { + aResult = parentPaint; + aInherited = PR_TRUE; + } else if (aValue.GetUnit() == eCSSUnit_None) { + aResult.mType = eStyleSVGPaintType_None; + } else if (SetColor(aValue, parentPaint.mColor, aPresContext, aResult.mColor, aInherited)) { + aResult.mType = eStyleSVGPaintType_Color; + } +} + +static void +SetSVGOpacity(const nsCSSValue& aValue, float parentOpacity, float& opacity, PRBool& aInherited) +{ + if (aValue.GetUnit() == eCSSUnit_Inherit) { + opacity = parentOpacity; + aInherited = PR_TRUE; + } + else if (aValue.GetUnit() == eCSSUnit_Number) { + opacity = aValue.GetFloatValue(); + } +} + +static void +SetSVGLength(const nsCSSValue& aValue, float parentLength, float& length, + nsIStyleContext* aContext, nsIPresContext* aPresContext, PRBool& aInherited) +{ + nsStyleCoord coord; + PRBool dummy; + if (SetCoord(aValue, coord, coord, + SETCOORD_LP | SETCOORD_FACTOR, + aContext, aPresContext, dummy)) { + if (coord.GetUnit() == eStyleUnit_Factor) { // user units + length = (float) coord.GetFactorValue(); + } + else { + length = (float) coord.GetCoordValue(); + float twipsPerPix; + aPresContext->GetScaledPixelsToTwips(&twipsPerPix); + if (twipsPerPix == 0.0f) + twipsPerPix = 1e-20f; + length /= twipsPerPix; + } + } + else if (aValue.GetUnit() == eCSSUnit_Inherit) { + length = parentLength; + aInherited = PR_TRUE; + } +} + +const nsStyleStruct* +nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct, const nsCSSStruct& aData, + nsIStyleContext* aContext, + nsRuleNode* aHighestNode, + const RuleDetail& aRuleDetail, PRBool aInherited) +{ + nsCOMPtr parentContext = getter_AddRefs(aContext->GetParent()); + + nsStyleSVG* svg = nsnull; + nsStyleSVG* parentSVG = svg; + PRBool inherited = aInherited; + const nsCSSSVG& SVGData = NS_STATIC_CAST(const nsCSSSVG&, aData); + + if (aStartStruct) + // We only need to compute the delta between this computed data and our + // computed data. + svg = new (mPresContext) nsStyleSVG(*NS_STATIC_CAST(nsStyleSVG*,aStartStruct)); + else { + if (aRuleDetail != eRuleFullMixed) { + // No question. We will have to inherit. Go ahead and init + // with inherited vals from parent. + inherited = PR_TRUE; + if (parentContext) + parentSVG = (nsStyleSVG*)parentContext->GetStyleData(eStyleStruct_SVG); + if (parentSVG) + svg = new (mPresContext) nsStyleSVG(*parentSVG); + } + } + + if (!svg) + svg = parentSVG = new (mPresContext) nsStyleSVG(); + + // fill: + SetSVGPaint(SVGData.mFill, parentSVG->mFill, mPresContext, svg->mFill, inherited); + + // fill-opacity: + SetSVGOpacity(SVGData.mFillOpacity, parentSVG->mFillOpacity, svg->mFillOpacity, inherited); + + // fill-rule: enum, inherit + if (eCSSUnit_Enumerated == SVGData.mFillRule.GetUnit()) { + svg->mFillRule = SVGData.mFillRule.GetIntValue(); + } + else if (eCSSUnit_Inherit == SVGData.mFillRule.GetUnit()) { + inherited = PR_TRUE; + svg->mFillRule = parentSVG->mFillRule; + } + + // stroke: + SetSVGPaint(SVGData.mStroke, parentSVG->mStroke, mPresContext, svg->mStroke, inherited); + + // stroke-dasharray: , none, inherit + if (eCSSUnit_String == SVGData.mStrokeDasharray.GetUnit()) { + SVGData.mStrokeDasharray.GetStringValue(svg->mStrokeDasharray); + } + else if (eCSSUnit_None == SVGData.mStrokeDasharray.GetUnit()) { + svg->mStrokeDasharray.Truncate(); + } + else if (eCSSUnit_Inherit == SVGData.mStrokeDasharray.GetUnit()) { + inherited = PR_TRUE; + svg->mStrokeDasharray = parentSVG->mStrokeDasharray; + } + + // stroke-dashoffset: , inherit + SetSVGLength(SVGData.mStrokeDashoffset, parentSVG->mStrokeDashoffset, + svg->mStrokeDashoffset, aContext, mPresContext, inherited); + + // stroke-linecap: enum, inherit + if (eCSSUnit_Enumerated == SVGData.mStrokeLinecap.GetUnit()) { + svg->mStrokeLinecap = SVGData.mStrokeLinecap.GetIntValue(); + } + else if (eCSSUnit_Inherit == SVGData.mStrokeLinecap.GetUnit()) { + inherited = PR_TRUE; + svg->mStrokeLinecap = parentSVG->mStrokeLinecap; + } + + // stroke-linejoin: enum, inherit + if (eCSSUnit_Enumerated == SVGData.mStrokeLinejoin.GetUnit()) { + svg->mStrokeLinejoin = SVGData.mStrokeLinejoin.GetIntValue(); + } + else if (eCSSUnit_Inherit == SVGData.mStrokeLinejoin.GetUnit()) { + inherited = PR_TRUE; + svg->mStrokeLinejoin = parentSVG->mStrokeLinejoin; + } + + // stroke-miterlimit: , inherit + if (eCSSUnit_Number == SVGData.mStrokeMiterlimit.GetUnit()) { + float value = SVGData.mStrokeMiterlimit.GetFloatValue(); + if (value > 1) { // XXX this check should probably be in nsCSSParser + svg->mStrokeMiterlimit = value; + } + } + else if (eCSSUnit_Inherit == SVGData.mStrokeMiterlimit.GetUnit()) { + svg->mStrokeMiterlimit = parentSVG->mStrokeMiterlimit; + inherited = PR_TRUE; + } + + // stroke-opacity: + SetSVGOpacity(SVGData.mStrokeOpacity, parentSVG->mStrokeOpacity, svg->mStrokeOpacity, inherited); + + // stroke-width: + SetSVGLength(SVGData.mStrokeWidth, parentSVG->mStrokeWidth, + svg->mStrokeWidth, aContext, mPresContext, inherited); + + if (inherited) + // We inherited, and therefore can't be cached in the rule node. We have to be put right on the + // style context. + aContext->SetStyle(eStyleStruct_SVG, *svg); + else { + // We were fully specified and can therefore be cached right on the rule node. + if (!aHighestNode->mStyleData.mInheritedData) + aHighestNode->mStyleData.mInheritedData = new (mPresContext) nsInheritedStyleData; + aHighestNode->mStyleData.mInheritedData->mSVGData = svg; + // Propagate the bit down. + PropagateInheritBit(NS_STYLE_INHERIT_SVG, aHighestNode); + } + + return svg; +} +#endif + inline const nsStyleStruct* nsRuleNode::GetParentData(const nsStyleStructID aSID) { @@ -4468,6 +4685,9 @@ nsRuleNode::gGetStyleDataFn[] = { &nsRuleNode::GetOutlineData, #ifdef INCLUDE_XUL &nsRuleNode::GetXULData, +#endif +#ifdef MOZ_SVG + &nsRuleNode::GetSVGData, #endif nsnull }; diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index 4b4d19b6678e..7ea7f98fe94c 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -64,6 +64,9 @@ struct nsInheritedStyleData nsStyleQuotes* mQuotesData; nsStyleText* mTextData; nsStyleUserInterface* mUIData; +#ifdef MOZ_SVG + nsStyleSVG* mSVGData; +#endif void* operator new(size_t sz, nsIPresContext* aContext) { void* result = nsnull; @@ -88,6 +91,10 @@ struct nsInheritedStyleData mTextData = nsnull; if (mUIData && (aBits & NS_STYLE_INHERIT_UI)) mUIData = nsnull; +#ifdef MOZ_SVG + if (mSVGData && (aBits & NS_STYLE_INHERIT_SVG)) + mSVGData = nsnull; +#endif }; void Destroy(PRUint32 aBits, nsIPresContext* aContext) { @@ -107,12 +114,19 @@ struct nsInheritedStyleData mTextData->Destroy(aContext); if (mUIData && !(aBits & NS_STYLE_INHERIT_UI)) mUIData->Destroy(aContext); +#ifdef MOZ_SVG + if (mSVGData && !(aBits & NS_STYLE_INHERIT_SVG)) + mSVGData->Destroy(aContext); +#endif aContext->FreeToShell(sizeof(nsInheritedStyleData), this); }; nsInheritedStyleData() :mVisibilityData(nsnull), mFontData(nsnull), mListData(nsnull), mTableData(nsnull), mColorData(nsnull), mQuotesData(nsnull), mTextData(nsnull), mUIData(nsnull) +#ifdef MOZ_SVG + , mSVGData(nsnull) +#endif {}; }; @@ -284,6 +298,10 @@ struct nsRuleData nsCSSXUL* mXULData; #endif +#ifdef MOZ_SVG + nsCSSSVG* mSVGData; +#endif + nsRuleData(const nsStyleStructID& aSID, nsIPresContext* aContext, nsIStyleContext* aStyleContext) :mSID(aSID), mPresContext(aContext), mStyleContext(aStyleContext), mPostResolveCallback(nsnull), mFontData(nsnull), mDisplayData(nsnull), mMarginData(nsnull), mListData(nsnull), @@ -294,6 +312,9 @@ struct nsRuleData #ifdef INCLUDE_XUL mXULData = nsnull; +#endif +#ifdef MOZ_SVG + mSVGData = nsnull; #endif }; ~nsRuleData() {}; @@ -455,6 +476,13 @@ protected: const RuleDetail& aRuleDetail, PRBool aInherited); #endif +#ifdef MOZ_SVG + const nsStyleStruct* ComputeSVGData(nsStyleStruct* aStartSVG, const nsCSSStruct& aSVGData, + nsIStyleContext* aContext, + nsRuleNode* aHighestNode, + const RuleDetail& aRuleDetail, PRBool aInherited); +#endif + typedef const nsStyleStruct* (nsRuleNode::*ComputeStyleDataFn)(nsStyleStruct* aStartStruct, const nsCSSStruct& aStartData, @@ -490,6 +518,9 @@ protected: #ifdef INCLUDE_XUL const nsStyleStruct* GetXULData(nsIStyleContext* aContext, PRBool aComputeData); #endif +#ifdef MOZ_SVG + const nsStyleStruct* GetSVGData(nsIStyleContext* aContext, PRBool aComputeData); +#endif typedef const nsStyleStruct* (nsRuleNode::*GetStyleDataFn)(nsIStyleContext*, PRBool); static GetStyleDataFn gGetStyleDataFn[]; diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index b3eb7be82184..edc98008e9c3 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -519,6 +519,11 @@ nsStyleContext::SetStyle(nsStyleStructID aSID, const nsStyleStruct& aStruct) case eStyleStruct_XUL: mCachedStyleData.mResetData->mXULData = (nsStyleXUL*)(const nsStyleXUL*)(&aStruct); break; +#endif +#ifdef MOZ_SVG + case eStyleStruct_SVG: + mCachedStyleData.mInheritedData->mSVGData = (nsStyleSVG*)(const nsStyleSVG*)(&aStruct); + break; #endif default: NS_ERROR("Invalid style struct id"); @@ -683,6 +688,20 @@ nsStyleContext::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint) } } +#ifdef MOZ_SVG + if (aHint < maxHint) { + const nsStyleSVG* svg = (const nsStyleSVG*)PeekStyleData(eStyleStruct_SVG); + if (svg) { + const nsStyleSVG* otherSVG = (const nsStyleSVG*)aOther->GetStyleData(eStyleStruct_SVG); + if (svg != otherSVG) { + hint = svg->CalcDifference(*otherSVG); + if (aHint < hint) + aHint = hint; + } + } + } +#endif + // At this point, we know that the worst kind of damage we could do is a reflow. maxHint = NS_STYLE_HINT_REFLOW; @@ -808,7 +827,7 @@ nsStyleContext::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint) } } } - + if (aHint < maxHint) { const nsStyleTableBorder* table = (const nsStyleTableBorder*)PeekStyleData(eStyleStruct_TableBorder); if (table) { @@ -1223,6 +1242,18 @@ void nsStyleContext::DumpRegressionData(nsIPresContext* aPresContext, FILE* out, (int)xul->mBoxOrient, (int)xul->mBoxPack, (int)xul->mBoxOrdinal); +#endif + + // SVG +#ifdef MOZ_SVG + IndentBy(out,aIndent); + const nsStyleSVG* svg = (const nsStyleSVG*)GetStyleData(eStyleStruct_SVG); + fprintf(out, "mStroke.mType, + svg->mStrokeWidth, + svg->mStrokeOpacity, + (int)svg->mFill.mType, + svg->mFillOpacity); fprintf(out, "\" />\n"); #endif //#insert new style structs here# diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 32524db8dc73..469353d552e7 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -717,6 +717,78 @@ nsStyleXUL::CalcDifference(const nsStyleXUL& aOther) const #endif // INCLUDE_XUL +#ifdef MOZ_SVG +// -------------------- +// nsStyleSVG +// +nsStyleSVG::nsStyleSVG() +{ + mFill.mType = eStyleSVGPaintType_None; + mFill.mColor = NS_RGB(0,0,0); + mFillOpacity = 1.0f; + mFillRule = NS_STYLE_FILL_RULE_NONZERO; + mStroke.mType = eStyleSVGPaintType_None; + mStroke.mColor = NS_RGB(0,0,0); + mStrokeDasharray.Truncate(); + mStrokeDashoffset = 0.0f; + mStrokeLinecap = NS_STYLE_STROKE_LINECAP_BUTT; + mStrokeLinejoin = NS_STYLE_STROKE_LINEJOIN_MITER; + mStrokeMiterlimit = 4.0f; + mStrokeOpacity = 1.0f; + mStrokeWidth = 1.0f; +} + +nsStyleSVG::~nsStyleSVG() +{ +} + +nsStyleSVG::nsStyleSVG(const nsStyleSVG& aSource) +{ + //nsCRT::memcpy((nsStyleSVG*)this, &aSource, sizeof(nsStyleSVG)); + + mFill.mType = aSource.mFill.mType; + if (mFill.mType == eStyleSVGPaintType_Color) + mFill.mColor = aSource.mFill.mColor; + mFillOpacity = aSource.mFillOpacity; + mFillRule = aSource.mFillRule; + mStroke.mType = aSource.mStroke.mType; + if (mStroke.mType == eStyleSVGPaintType_Color) + mStroke.mColor = aSource.mStroke.mColor; + mStrokeDasharray = aSource.mStrokeDasharray; + mStrokeDashoffset = aSource.mStrokeDashoffset; + mStrokeLinecap = aSource.mStrokeLinecap; + mStrokeLinejoin = aSource.mStrokeLinejoin; + mStrokeMiterlimit = aSource.mStrokeMiterlimit; + mStrokeOpacity = aSource.mStrokeOpacity; + mStrokeWidth = aSource.mStrokeWidth; +} + +PRInt32 +nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const +{ + if ( mFill.mType != aOther.mFill.mType || + mFillOpacity != aOther.mFillOpacity || + mFillRule != aOther.mFillRule || + mStroke.mType != aOther.mStroke.mType || + mStrokeDasharray != aOther.mStrokeDasharray || + mStrokeDashoffset != aOther.mStrokeDashoffset || + mStrokeLinecap != aOther.mStrokeLinecap || + mStrokeLinejoin != aOther.mStrokeLinejoin || + mStrokeMiterlimit != aOther.mStrokeMiterlimit || + mStrokeOpacity != aOther.mStrokeOpacity || + mStrokeWidth != aOther.mStrokeWidth ) + return NS_STYLE_HINT_VISUAL; + + if ( (mStroke.mType == eStyleSVGPaintType_Color && mStroke.mColor != aOther.mStroke.mColor) || + (mFill.mType == eStyleSVGPaintType_Color && mFill.mColor != aOther.mFill.mColor) ) + return NS_STYLE_HINT_VISUAL; + + return NS_STYLE_HINT_NONE; +} + +#endif // MOZ_SVG + + // -------------------- // nsStylePosition // diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 5c7dbb4b92b1..714c803cd467 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -76,9 +76,15 @@ enum nsStyleStructID { eStyleStruct_Border = 18, eStyleStruct_Outline = 19, eStyleStruct_XUL = 20, - eStyleStruct_Min = eStyleStruct_Font, +#ifdef MOZ_SVG + eStyleStruct_SVG = 21, + eStyleStruct_Max = eStyleStruct_SVG, + eStyleStruct_BorderPaddingShortcut = 22, // only for use in GetStyle() +#else eStyleStruct_Max = eStyleStruct_XUL, - eStyleStruct_BorderPaddingShortcut = 21 // only for use in GetStyle() + eStyleStruct_BorderPaddingShortcut = 21, // only for use in GetStyle() +#endif + eStyleStruct_Min = eStyleStruct_Font }; // Bits for each struct. @@ -103,15 +109,18 @@ enum nsStyleStructID { #define NS_STYLE_INHERIT_BORDER NS_STYLE_INHERIT_BIT(eStyleStruct_Border) #define NS_STYLE_INHERIT_OUTLINE NS_STYLE_INHERIT_BIT(eStyleStruct_Outline) #define NS_STYLE_INHERIT_XUL NS_STYLE_INHERIT_BIT(eStyleStruct_XUL) +#ifdef MOZ_SVG +#define NS_STYLE_INHERIT_SVG NS_STYLE_INHERIT_BIT(eStyleStruct_SVG) +#endif -#define NS_STYLE_INHERIT_MASK 0x0fffff +#define NS_STYLE_INHERIT_MASK 0x00ffffff // A bit to test whether or not a style context can be shared // by siblings. -#define NS_STYLE_UNIQUE_CONTEXT 0x100000 +#define NS_STYLE_UNIQUE_CONTEXT 0x01000000 // A bit to test whether or not we have any text decorations. -#define NS_STYLE_HAS_TEXT_DECORATIONS 0x200000 +#define NS_STYLE_HAS_TEXT_DECORATIONS 0x02000000 #define NS_DEFINE_STATIC_STYLESTRUCTID_ACCESSOR(the_sid) \ static const nsStyleStructID GetStyleStructID() {return the_sid;} @@ -1121,6 +1130,52 @@ struct nsStyleXUL : public nsStyleStruct { }; #endif +#ifdef MOZ_SVG +enum nsStyleSVGPaintType { + eStyleSVGPaintType_None = 0, + eStyleSVGPaintType_Color, + eStyleSVGPaintType_Server +}; + +struct nsStyleSVGPaint +{ + nsStyleSVGPaintType mType; + nscolor mColor; +}; + +struct nsStyleSVG : public nsStyleStruct { + nsStyleSVG(); + nsStyleSVG(const nsStyleSVG& aSource); + ~nsStyleSVG(); + + void* operator new(size_t sz, nsIPresContext* aContext) { + void* result = nsnull; + aContext->AllocateFromShell(sz, &result); + return result; + } + void Destroy(nsIPresContext* aContext) { + this->~nsStyleSVG(); + aContext->FreeToShell(sizeof(nsStyleSVG), this); + }; + + PRInt32 CalcDifference(const nsStyleSVG& aOther) const; + + // all [inherit]ed + nsStyleSVGPaint mFill; + float mFillOpacity; + PRUint8 mFillRule; // see nsStyleConsts.h + nsStyleSVGPaint mStroke; + nsString mStrokeDasharray; // XXX we want a parsed value here + float mStrokeDashoffset; + PRUint8 mStrokeLinecap; // see nsStyleConsts.h + PRUint8 mStrokeLinejoin; // see nsStyleConsts.h + float mStrokeMiterlimit; + float mStrokeOpacity; + float mStrokeWidth; // in pixels +}; +#endif + + #define BORDER_PRECEDENT_EQUAL 0 #define BORDER_PRECEDENT_LOWER 1 #define BORDER_PRECEDENT_HIGHER 2 diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index fb0ca01200fd..4cc8c4da8160 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -169,6 +169,14 @@ nsCachedStyleData::gInfo[] = { }, #endif +#ifdef MOZ_SVG + /* eStyleStruct_SVG */ + { offsetof(nsCachedStyleData, mInheritedData), + offsetof(nsInheritedStyleData, mSVGData), + PR_FALSE + }, +#endif + { 0, 0, 0 } }; diff --git a/layout/svg/Makefile.in b/layout/svg/Makefile.in index 99462291edc4..29d9e870f7eb 100644 --- a/layout/svg/Makefile.in +++ b/layout/svg/Makefile.in @@ -26,7 +26,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = content base +DIRS = base include $(topsrcdir)/config/rules.mk diff --git a/layout/svg/base/Makefile.in b/layout/svg/base/Makefile.in index 8e79579887a6..0b4d2a90ab5d 100644 --- a/layout/svg/base/Makefile.in +++ b/layout/svg/base/Makefile.in @@ -26,7 +26,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +DIRS = src include $(topsrcdir)/config/rules.mk diff --git a/layout/svg/base/makefile.win b/layout/svg/base/makefile.win index 09d593e23d0f..741a62e3f9c4 100644 --- a/layout/svg/base/makefile.win +++ b/layout/svg/base/makefile.win @@ -21,6 +21,6 @@ DEPTH=..\..\.. -DIRS=public src +DIRS= src include <$(DEPTH)\config\rules.mak> diff --git a/layout/svg/base/public/MANIFEST b/layout/svg/base/public/MANIFEST deleted file mode 100644 index faa7cb5462f9..000000000000 --- a/layout/svg/base/public/MANIFEST +++ /dev/null @@ -1,4 +0,0 @@ -# -# This is a list of local files which get copied to the mozilla:dist:layout directory -# -nsISVGFrame.h diff --git a/layout/svg/base/src/MANIFEST b/layout/svg/base/src/MANIFEST new file mode 100644 index 000000000000..432ca882ac15 --- /dev/null +++ b/layout/svg/base/src/MANIFEST @@ -0,0 +1,3 @@ +nsISVGFrame.h +nsArtUtaRef.h +libart-incs.h diff --git a/layout/svg/base/src/Makefile.in b/layout/svg/base/src/Makefile.in index e1a06375d80f..93e9a1a2ceee 100644 --- a/layout/svg/base/src/Makefile.in +++ b/layout/svg/base/src/Makefile.in @@ -1,8 +1,8 @@ # -# The contents of this file are subject to the Netscape Public +# 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/NPL/ +# 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 @@ -42,10 +42,24 @@ REQUIRES = xpcom \ $(NULL) CPPSRCS = \ - nsSVGContainerFrame.cpp \ - nsPolygonFrame.cpp \ - nsPolylineFrame.cpp \ - nsSVGPathFrame.cpp \ + nsSVGBPathBuilder.cpp \ + nsSVGEllipseFrame.cpp \ + nsSVGCircleFrame.cpp \ + nsSVGFill.cpp \ + nsSVGForeignObjectFrame.cpp \ + nsSVGGFrame.cpp \ + nsSVGGenericContainerFrame.cpp \ + nsSVGGraphic.cpp \ + nsSVGGraphicFrame.cpp \ + nsSVGLineFrame.cpp \ + nsSVGOuterSVGFrame.cpp \ + nsSVGPathFrame.cpp \ + nsSVGPolygonFrame.cpp \ + nsSVGPolylineFrame.cpp \ + nsSVGRectFrame.cpp \ + nsSVGRenderItem.cpp \ + nsSVGRenderingContext.cpp \ + nsSVGStroke.cpp \ $(NULL) include $(topsrcdir)/config/config.mk @@ -57,13 +71,16 @@ include $(topsrcdir)/config/rules.mk DEFINES += -D_IMPL_NS_HTML -LOCAL_INCLUDES = \ +CFLAGS += $(MOZ_LIBART_CFLAGS) +CXXFLAGS += $(MOZ_LIBART_CFLAGS) + +INCLUDES += \ -I$(srcdir)/../../../base/src \ -I$(srcdir)/../../../html/table/src \ -I$(srcdir)/../../../html/style/src \ -I$(srcdir)/../../../html/base/src \ -I$(srcdir)/../../../html/forms/src \ - -I$(srcdir)/../../content/src \ + -I$(srcdir)/../../../../content/svg/content/src \ -I$(srcdir)/../../../html/content/src \ -I$(srcdir)/../../../xml/content/src \ -I$(srcdir)/../../../base/public \ diff --git a/layout/svg/base/src/install-svg-css.pl b/layout/svg/base/src/install-svg-css.pl new file mode 100644 index 000000000000..1a2df2b88469 --- /dev/null +++ b/layout/svg/base/src/install-svg-css.pl @@ -0,0 +1,20 @@ +# script to add svg.css to the ua.css +# blatently stolen from the mathml code +# + +$sep = '/'; # directory separator + +$ua = $ARGV[0]; $ua =~ s|\\|$sep|g; + +open(UA, $ua) || die "Cannot find ua.css\n"; +$css = join("", ); +close(UA); + +if (!($css =~ m|\@import.*svg\.css|)) +{ + $css =~ s/\cM\n/\n/g; # dos2unix end of line + $css =~ s|(\@import[^\@]+\;)\n\n|$1\n\@import url\(resource:/res/svg\.css\);\n\n|; + open(UA, ">$ua"); + print UA $css; + close(UA); +} diff --git a/layout/svg/base/src/libart-incs.h b/layout/svg/base/src/libart-incs.h new file mode 100644 index 000000000000..5308c17f1537 --- /dev/null +++ b/layout/svg/base/src/libart-incs.h @@ -0,0 +1,75 @@ +/* -*- 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 (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 __LIBART_INCS_H__ +#define __LIBART_INCS_H__ + +#define LIBART_COMPILATION + +#include "art_misc.h" +#include "art_vpath.h" +#include "art_svp.h" +#include "art_svp_vpath.h" +#include "art_gray_svp.h" +#include "art_rgb_svp.h" +#include "art_svp_vpath_stroke.h" +#include "art_svp_ops.h" +#include "art_affine.h" +#include "art_rgb_affine.h" +#include "art_rgb_bitmap_affine.h" +#include "art_rgb_rgba_affine.h" +#include "art_alphagamma.h" +#include "art_svp_point.h" +#include "art_vpath_dash.h" +#include "art_pathcode.h" +#include "art_render.h" +#include "art_render_gradient.h" +#include "art_render_svp.h" +#include "art_rgb.h" +#include "art_uta.h" +#include "art_uta_ops.h" +#include "art_uta_rect.h" +#include "art_uta_svp.h" +#include "art_uta_vpath.h" +#include "art_rect_uta.h" +#include "art_svp_wind.h" +#include "art_bpath.h" +#include "art_vpath_bpath.h" + +#endif //__LIBART_INCS_H__ diff --git a/layout/svg/base/src/makefile.win b/layout/svg/base/src/makefile.win index ac6947903724..a0454b5ac496 100644 --- a/layout/svg/base/src/makefile.win +++ b/layout/svg/base/src/makefile.win @@ -1,9 +1,9 @@ #!nmake # -# The contents of this file are subject to the Netscape Public +# 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/NPL/ +# 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 @@ -23,27 +23,42 @@ DEPTH=..\..\..\.. LIBRARY_NAME=layoutsvgbase_s MODULE=layout -REQUIRES = xpcom \ - widget \ - content \ - gfx \ - string \ - locale \ - dom \ - pref \ - view \ - necko \ - unicharutil \ +REQUIRES = xpcom \ + widget \ + content \ + gfx \ + string \ + locale \ + dom \ + pref \ + view \ + libart_lgpl \ + necko \ + unicharutil \ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN -CPP_OBJS= \ - .\$(OBJDIR)\nsSVGContainerFrame.obj \ - .\$(OBJDIR)\nsPolygonFrame.obj \ - .\$(OBJDIR)\nsPolylineFrame.obj \ - .\$(OBJDIR)\nsSVGPathFrame.obj \ - $(NULL) +CPP_OBJS= \ + .\$(OBJDIR)\nsSVGBPathBuilder.obj \ + .\$(OBJDIR)\nsSVGCircleFrame.obj \ + .\$(OBJDIR)\nsSVGEllipseFrame.obj \ + .\$(OBJDIR)\nsSVGFill.obj \ + .\$(OBJDIR)\nsSVGForeignObjectFrame.obj \ + .\$(OBJDIR)\nsSVGGFrame.obj \ + .\$(OBJDIR)\nsSVGGenericContainerFrame.obj \ + .\$(OBJDIR)\nsSVGGraphic.obj \ + .\$(OBJDIR)\nsSVGGraphicFrame.obj \ + .\$(OBJDIR)\nsSVGLineFrame.obj \ + .\$(OBJDIR)\nsSVGOuterSVGFrame.obj \ + .\$(OBJDIR)\nsSVGPathFrame.obj \ + .\$(OBJDIR)\nsSVGPolygonFrame.obj \ + .\$(OBJDIR)\nsSVGPolylineFrame.obj \ + .\$(OBJDIR)\nsSVGRectFrame.obj \ + .\$(OBJDIR)\nsSVGRenderItem.obj \ + .\$(OBJDIR)\nsSVGRenderingContext.obj \ + .\$(OBJDIR)\nsSVGStroke.obj \ + $(NULL) EXPORTS = \ $(NULL) @@ -57,17 +72,24 @@ LINCS= \ -I..\..\..\html\forms\src \ -I..\..\..\base\src \ -I..\..\..\xml\content\src \ - -I..\..\..\base\public + -I..\..\..\base\public \ + -I..\..\..\..\content\svg\content\src \ + $(NULL) + LCFLAGS = \ $(LCFLAGS) \ $(DEFINES) \ $(NULL) + include <$(DEPTH)\config\rules.mak> libs:: $(LIBRARY) $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib + $(MAKE_INSTALL) svg.css $(DIST)\bin\res + $(PERL) install-svg-css.pl $(DIST)\bin\res\ua.css clobber:: rm -f $(DIST)\lib\$(LIBRARY_NAME).lib + rm -f $(DIST)\bin\res\svg.css diff --git a/layout/svg/base/src/nsASVGGraphicSource.h b/layout/svg/base/src/nsASVGGraphicSource.h new file mode 100644 index 000000000000..79200a9bca54 --- /dev/null +++ b/layout/svg/base/src/nsASVGGraphicSource.h @@ -0,0 +1,60 @@ +/* -*- 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 (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_ASVGGRAPHICSOURCE_H__ +#define __NS_ASVGGRAPHICSOURCE_H__ + +#include "nscore.h" + +class nsASVGPathBuilder; +class nsIDOMSVGMatrix; +struct nsStyleSVG; + +// abstract svg graphic source 'interface' class. +// XXX one day this will become a proper interface + +class nsASVGGraphicSource +{ +public: + virtual void ConstructPath(nsASVGPathBuilder* pathBuilder)=0; + virtual void GetCTM(nsIDOMSVGMatrix** ctm)=0; + virtual const nsStyleSVG* GetStyle()=0; +}; + + +#endif // __NS_ASVGGRAPHICSOURCE_H__ diff --git a/layout/svg/base/src/nsASVGPathBuilder.h b/layout/svg/base/src/nsASVGPathBuilder.h new file mode 100644 index 000000000000..f2585ce63bbf --- /dev/null +++ b/layout/svg/base/src/nsASVGPathBuilder.h @@ -0,0 +1,64 @@ +/* -*- 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 (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_ASVGPATHBUILDER_H__ +#define __NS_ASVGPATHBUILDER_H__ + +#include "nscore.h" + +// abstract path builder 'interface' class. +// XXX one day this will become a proper interface + +// Why do we need a virtual class at all???? It provides +// theoretical flexability (eg we can plug in a postscript renderer) +// I'm not convinved that the overhead is worth it, though - not all the +// SVG logic is in this file... - bbaetz + +class nsASVGPathBuilder +{ +public: + virtual void Moveto(float x, float y)=0; + virtual void Lineto(float x, float y)=0; + virtual void Curveto(float x, float y, float x1, float y1, float x2, float y2)=0; + virtual void Arcto(float x, float y, float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag)=0; + virtual void ClosePath(float *newX, float* newY)=0; +}; + + +#endif // __NS_ASVGPATHBUILDER_H__ diff --git a/layout/svg/base/public/nsISVGFrame.h b/layout/svg/base/src/nsISVGFrame.h similarity index 69% rename from layout/svg/base/public/nsISVGFrame.h rename to layout/svg/base/src/nsISVGFrame.h index b56a850655fc..54a1f193258e 100644 --- a/layout/svg/base/public/nsISVGFrame.h +++ b/layout/svg/base/src/nsISVGFrame.h @@ -1,11 +1,11 @@ /* -*- 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 +/* ----- BEGIN LICENSE BLOCK ----- + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * The contents of this file are subject to the Netscape Public License + * 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/NPL/ + * 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 @@ -31,16 +31,19 @@ * 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. + * the terms of any one of the MPL, the GPL or the LGPL. * - * ***** END LICENSE BLOCK ***** */ + * ----- END LICENSE BLOCK ----- */ #ifndef nsISVGFrame_h__ #define nsISVGFrame_h__ #include "nsISupports.h" -#include "nsCoord.h" +#include "libart-incs.h" + +class nsSVGRenderingContext; +class nsIFrame; #define NS_ISVGFRAME_IID \ {0x84957983, 0x712, 0x11d4, \ @@ -51,8 +54,17 @@ public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISVGFRAME_IID) - NS_IMETHOD GetXY(nscoord* aX, nscoord* aY) = 0; + // down the tree + + NS_IMETHOD Paint(nsSVGRenderingContext* renderingContext)=0; + NS_IMETHOD GetFrameForPoint(float x, float y, nsIFrame** hit)=0; + NS_IMETHOD NotifyCTMChanged()=0; + NS_IMETHOD NotifyRedrawSuspended()=0; + NS_IMETHOD NotifyRedrawUnsuspended()=0; + // up the tree. these should really go into a separate nsISVGContainerFrame interface + NS_IMETHOD InvalidateRegion(ArtUta* uta, PRBool bRedraw)=0; + NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended)=0; }; #endif diff --git a/layout/svg/base/src/nsPolygonFrame.cpp b/layout/svg/base/src/nsPolygonFrame.cpp deleted file mode 100644 index 60b95bc71c15..000000000000 --- a/layout/svg/base/src/nsPolygonFrame.cpp +++ /dev/null @@ -1,429 +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 "nsPolygonFrame.h" - -#include "nsIDOMElement.h" -#include "nsIContent.h" -#include "prtypes.h" -#include "nsIAtom.h" -#include "nsHTMLAtoms.h" -#include "nsIPresContext.h" -#include "nsIStyleContext.h" -#include "nsCSSRendering.h" -#include "nsINameSpaceManager.h" -#include "nsColor.h" -#include "nsIServiceManager.h" -#include "nsPoint.h" -#include "nsSVGAtoms.h" -#include "nsIDeviceContext.h" -#include "nsGUIEvent.h" -#include "nsReadableUtils.h" -#include "nsUnicharUtils.h" -#include "nsIReflowCommand.h" -extern nsresult -NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult, - nsIFrame* aTargetFrame, - nsIReflowCommand::ReflowType aReflowType, - nsIFrame* aChildFrame = nsnull, - nsIAtom* aAttribute = nsnull); -//#include "nsPolygonCID.h" -// -// NS_NewPolygonFrame -// -// Wrapper for creating a new color picker -// -nsresult -NS_NewPolygonFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) -{ - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsPolygonFrame* it = new (aPresShell) nsPolygonFrame; - if ( !it ) - return NS_ERROR_OUT_OF_MEMORY; - *aNewFrame = it; - return NS_OK; -} - -// static NS_DEFINE_IID(kDefPolygonCID, NS_DEFCOLORPICKER_CID); - -// -// nsPolygonFrame cntr -// -nsPolygonFrame::nsPolygonFrame() : - mPnts(nsnull), - mNumPnts(0), - mX(0), - mY(0), - mPresContext(nsnull) -{ - -} - -nsPolygonFrame::~nsPolygonFrame() -{ - if (mPnts) { - delete [] mPnts; - } - NS_IF_RELEASE(mPresContext); -} - - -NS_IMETHODIMP -nsPolygonFrame::Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsIStyleContext* aContext, - nsIFrame* aPrevInFlow) -{ - mPresContext = aPresContext; - NS_ADDREF(mPresContext); - - nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext, - aPrevInFlow); - - - nsAutoString type; - mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); - - if ((Compare(type, - NS_LITERAL_STRING("swatch"), - nsCaseInsensitiveStringComparator()) == 0) || - type.IsEmpty()) - { - //mPolygon = new nsStdPolygon(); - //mPolygon->Init(mContent); - } - - return rv; -} - -//-------------------------------------------------------------- -// Frames are not refcounted, no need to AddRef -NS_IMETHODIMP -nsPolygonFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - NS_PRECONDITION(0 != aInstancePtr, "null ptr"); - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if (aIID.Equals(NS_GET_IID(nsISVGFrame))) { - *aInstancePtr = (void*) ((nsISVGFrame*) this); - return NS_OK; - } - return nsLeafFrame::QueryInterface(aIID, aInstancePtr); -} - - -//------------------------------------------------------------------- -//-- Main Reflow for the Polygon -//------------------------------------------------------------------- -NS_IMETHODIMP -nsPolygonFrame::Reflow(nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus) -{ - aStatus = NS_FRAME_COMPLETE; - - nsCOMPtr dx; - aPresContext->GetDeviceContext(getter_AddRefs(dx)); - float p2t = 1.0; - float scale = 1.0; - if (dx) { - aPresContext->GetPixelsToTwips(&p2t); - dx->GetCanonicalPixelScale(scale); - } - - nsAutoString coordStr; - nsresult res = mContent->GetAttr(kNameSpaceID_None, nsSVGAtoms::x, coordStr); - if (NS_SUCCEEDED(res)) { - char * s = ToNewCString(coordStr); - mX = NSIntPixelsToTwips(atoi(s), p2t*scale); - delete [] s; - } - - res = mContent->GetAttr(kNameSpaceID_None, nsSVGAtoms::y, coordStr); - if (NS_SUCCEEDED(res)) { - char * s = ToNewCString(coordStr); - mY = NSIntPixelsToTwips(atoi(s), p2t*scale); - delete [] s; - } - - if (mPoints.Count() == 0) { - GetPoints(); - // Convert points from Pixels to twips - // and these points are relative to the X & Y - // then find max width and height - nscoord maxWidth = 0; - nscoord maxHeight = 0; - for (PRInt32 i=0;iwidth = aDesiredSize.width; - aDesiredSize.maxElementSize->height = aDesiredSize.height; - } - //nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height); - //Invalidate(aPresContext, rect, PR_TRUE); - return NS_OK; -} - -NS_IMETHODIMP -nsPolygonFrame::HandleEvent(nsIPresContext* aPresContext, - nsGUIEvent* aEvent, - nsEventStatus* aEventStatus) -{ - NS_ENSURE_ARG_POINTER(aEventStatus); - *aEventStatus = nsEventStatus_eConsumeDoDefault; - if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) - HandleMouseDownEvent(aPresContext, aEvent, aEventStatus); - - return NS_OK; -} - -nsresult -nsPolygonFrame::HandleMouseDownEvent(nsIPresContext* aPresContext, - nsGUIEvent* aEvent, - nsEventStatus* aEventStatus) -{ - - return NS_OK; -} - -// XXX - Quick and Dirty impl to get somethinf working -// this should be rewritten -NS_METHOD -nsPolygonFrame::GetPoints() -{ - if (mPnts != nsnull) { - delete [] mPnts; - mNumPnts = 0; - mPoints.Clear(); - } - - nsAutoString pointsStr; - nsresult res = mContent->GetAttr(kNameSpaceID_None, nsSVGAtoms::points, pointsStr); - - char * ps = ToNewCString(pointsStr); - char seps[] = " "; - char *token = strtok(ps, seps); - PRInt32 cnt = 0; - nsPoint * pnt = nsnull; - while (token != NULL) { - if (cnt % 2 == 0) { - pnt = new nsPoint; - mPoints.AppendElement((void*)pnt); - pnt->x = atoi(token); - } else { - pnt->y = atoi(token); - } - token = strtok( NULL, seps ); - cnt++; - } - - delete [] ps; - - mNumPnts = mPoints.Count()+1; - mPnts = new nsPoint[mNumPnts]; - for (cnt=0;cnt [%d,%d]\n", i, mPnts[i].x, mPnts[i].y); - //} - - return NS_OK; -} - -NS_IMETHODIMP nsPolygonFrame::SetProperty(nsIPresContext* aPresContext, - nsIAtom* aName, - const nsString& aValue) -{ - if (aName == nsSVGAtoms::points) { - } else if (aName == nsSVGAtoms::x) { - } else if (aName == nsSVGAtoms::y) { - } - return NS_OK; -} - -NS_IMETHODIMP -nsPolygonFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) -{ - if (aAttribute == nsSVGAtoms::points) { - //GetPoints(); - mPoints.Clear(); - - nsCOMPtr shell; - aPresContext->GetShell(getter_AddRefs(shell)); - - nsIReflowCommand* reflowCmd; - nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, this, - nsIReflowCommand::ContentChanged); - if (NS_SUCCEEDED(rv)) { - shell->AppendReflowCommand(reflowCmd); - NS_RELEASE(reflowCmd); - rv = shell->FlushPendingNotifications(PR_FALSE); - } - } else if (aAttribute == nsSVGAtoms::x) { - } else if (aAttribute == nsSVGAtoms::y) { - } - return nsLeafFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); -} - -NS_METHOD nsPolygonFrame::RenderPoints(nsIRenderingContext& aRenderingContext, - const nsPoint aPoints[], PRInt32 aNumPoints) -{ - //nsAutoString fillStr; - //nsresult res = mContent->GetAttr(kNameSpaceID_None, nsSVGAtoms::fill, fillStr); - //if (NS_SUCCEEDED(res)) { - aRenderingContext.FillPolygon(aPoints, aNumPoints); - //} else { - // aRenderingContext.DrawPolygon(aPoints, aNumPoints); - //} - return NS_OK; -} - -// -// Paint -// -// -NS_METHOD -nsPolygonFrame::Paint(nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags) -{ - - // if we aren't visible then we are done. - const nsStyleVisibility* visib = NS_STATIC_CAST(const nsStyleVisibility*, - mStyleContext->GetStyleData(eStyleStruct_Visibility)); - if (!visib->IsVisibleOrCollapsed()) - return NS_OK; - - if (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND) { - // if we are visible then tell our superclass to paint - nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, - aWhichLayer); - } - - if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) { - - // get our border - const nsStyleBorder* borderStyle = (const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border); - nsMargin border(0,0,0,0); - borderStyle->CalcBorderFor(this, border); - - - // XXX - Color needs to comes from new style property fill - // and not mColor - const nsStyleColor* colorStyle = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - nscolor color = colorStyle->mColor; - - - aRenderingContext.PushState(); - - // set the clip region - nsRect rect; - - PRBool clipState; - GetRect(rect); - - // Clip so we don't render outside the inner rect - rect.x = 0; - rect.y = 0; - aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipState); - aRenderingContext.SetColor(color); - - /////////////////////////////////////////// - // XXX - This is all just a quick hack - // needs to be rewritten - nsPoint points[256]; - for (PRInt32 i=0;i (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 "nsSVGBPathBuilder.h" +#include +#include +nsSVGBPathBuilder::nsSVGBPathBuilder() + : mBPath(nsnull), + mBPathSize(0), + mBPathEnd(0) +{ + +} + +PRBool nsSVGBPathBuilder::IsEmpty() +{ + return (!mBPath); +} + +ArtBpath* nsSVGBPathBuilder::GetBPath() +{ + if (mBPath) + EnsureBPathTerminated(); + return mBPath; +} + +//---------------------------------------------------------------------- +// nsASVGPathBuilder methods + +void nsSVGBPathBuilder::Moveto(float x, float y) +{ + EnsureBPathSpace(); + + mBPath[mBPathEnd].code = ART_MOVETO_OPEN; + mBPath[mBPathEnd].x3 = x; + mBPath[mBPathEnd].y3 = y; + + ++mBPathEnd; +} + +void nsSVGBPathBuilder::Lineto(float x, float y) +{ + EnsureBPathSpace(); + + mBPath[mBPathEnd].code = ART_LINETO; + mBPath[mBPathEnd].x3 = x; + mBPath[mBPathEnd].y3 = y; + + ++mBPathEnd; +} + +void nsSVGBPathBuilder::Curveto(float x, float y, float x1, float y1, float x2, float y2) +{ + EnsureBPathSpace(); + + mBPath[mBPathEnd].code = ART_CURVETO; + mBPath[mBPathEnd].x1 = x1; + mBPath[mBPathEnd].y1 = y1; + mBPath[mBPathEnd].x2 = x2; + mBPath[mBPathEnd].y2 = y2; + mBPath[mBPathEnd].x3 = x; + mBPath[mBPathEnd].y3 = y; + + ++mBPathEnd; +} + +void nsSVGBPathBuilder::Arcto(float x2, float y2, float rx, float ry, float angle, + PRBool largeArcFlag, PRBool sweepFlag) +{ + const double pi = 3.14159265359; + const double radPerDeg = pi/180.0; + + float x1=0.0f, y1=0.0f; + NS_ASSERTION(mBPathEnd > 0, "Arcto needs a start position"); + if (mBPathEnd > 0) { + x1 = (float)(mBPath[mBPathEnd-1].x3); + y1 = (float)(mBPath[mBPathEnd-1].y3); + } + + // 1. Treat out-of-range parameters as described in + // http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes + + // If the endpoints (x1, y1) and (x2, y2) are identical, then this + // is equivalent to omitting the elliptical arc segment entirely + if (x1 == x2 && y1 == y2) return; + + // If rX = 0 or rY = 0 then this arc is treated as a straight line + // segment (a "lineto") joining the endpoints. + if (rx == 0.0f || ry == 0.0f) { + Lineto(x2, y2); + return; + } + + // If rX or rY have negative signs, these are dropped; the absolute + // value is used instead. + if (rx<0.0) rx = -rx; + if (ry<0.0) ry = -ry; + + // 2. convert to center parameterization as shown in + // http://www.w3.org/TR/SVG/implnote.html + double sinPhi = sin(angle*radPerDeg); + double cosPhi = cos(angle*radPerDeg); + + double x1dash = cosPhi * (x1-x2)/2.0 + sinPhi * (y1-y2)/2.0; + double y1dash = -sinPhi * (x1-x2)/2.0 + cosPhi * (y1-y2)/2.0; + + double root; + double numerator = rx*rx*ry*ry - rx*rx*y1dash*y1dash - ry*ry*x1dash*x1dash; + + if (numerator < 0.0) { + // If rX , rY and are such that there is no solution (basically, + // the ellipse is not big enough to reach from (x1, y1) to (x2, + // y2)) then the ellipse is scaled up uniformly until there is + // exactly one solution (until the ellipse is just big enough). + + // -> find factor s, such that numerator' with rx'=s*rx and + // ry'=s*ry becomes 0 : + float s = (float)sqrt(1.0 - numerator/(rx*rx*ry*ry)); + + rx *= s; + ry *= s; + root = 0.0; + + } + else { + root = (largeArcFlag == sweepFlag ? -1.0 : 1.0) * + sqrt( numerator/(rx*rx*y1dash*y1dash+ry*ry*x1dash*x1dash) ); + } + + double cxdash = root*rx*y1dash/ry; + double cydash = -root*ry*x1dash/rx; + + double cx = cosPhi * cxdash - sinPhi * cydash + (x1+x2)/2.0; + double cy = sinPhi * cxdash + cosPhi * cydash + (y1+y2)/2.0; + double theta1 = CalcVectorAngle(1.0, 0.0, (x1dash-cxdash)/rx, (y1dash-cydash)/ry); + double dtheta = CalcVectorAngle((x1dash-cxdash)/rx, (y1dash-cydash)/ry, + (-x1dash-cxdash)/rx, (-y1dash-cydash)/ry); + if (!sweepFlag && dtheta>0) + dtheta -= 2.0*pi; + else if (sweepFlag && dtheta<0) + dtheta += 2.0*pi; + + // 3. convert into cubic bezier segments <= 90deg + int segments = (int)ceil(fabs(dtheta/(pi/2.0))); + double delta = dtheta/segments; + double t = 8.0/3.0 * sin(delta/4.0) * sin(delta/4.0) / sin(delta/2.0); + + for (int i = 0; i < segments; ++i) { + double cosTheta1 = cos(theta1); + double sinTheta1 = sin(theta1); + double theta2 = theta1 + delta; + double cosTheta2 = cos(theta2); + double sinTheta2 = sin(theta2); + + // a) calculate endpoint of the segment: + double xe = cosPhi * rx*cosTheta2 - sinPhi * ry*sinTheta2 + cx; + double ye = sinPhi * rx*cosTheta2 + cosPhi * ry*sinTheta2 + cy; + + // b) calculate gradients at start/end points of segment: + double dx1 = t * ( - cosPhi * rx*sinTheta1 - sinPhi * ry*cosTheta1); + double dy1 = t * ( - sinPhi * rx*sinTheta1 + cosPhi * ry*cosTheta1); + + double dxe = t * ( cosPhi * rx*sinTheta2 + sinPhi * ry*cosTheta2); + double dye = t * ( sinPhi * rx*sinTheta2 - cosPhi * ry*cosTheta2); + + // c) draw the cubic bezier: + Curveto((float)xe, (float)ye, (float)(x1+dx1), (float)(y1+dy1), + (float)(xe+dxe), (float)(ye+dye)); + + // do next segment + theta1 = theta2; + x1 = (float)xe; + y1 = (float)ye; + } +} + +void nsSVGBPathBuilder::ClosePath(float *currX, float *currY) +{ + PRInt32 subpath = GetLastOpenBPath(); + NS_ASSERTION(subpath>=0, "no open subpath"); + if (subpath<0) return; + + // insert closing line if needed: + if (mBPath[subpath].x3 != mBPath[mBPathEnd-1].x3 || + mBPath[subpath].y3 != mBPath[mBPathEnd-1].y3) { + Lineto((float)mBPath[subpath].x3, (float)mBPath[subpath].y3); + } + + mBPath[subpath].code = ART_MOVETO; + + *currX = mBPath[subpath].x3; + *currY = mBPath[subpath].y3; +} + +//---------------------------------------------------------------------- +// helpers + +void nsSVGBPathBuilder::EnsureBPathSpace(PRUint32 space) +{ + const PRInt32 minGrowSize = 10; + + if (mBPathSize - mBPathEnd >= space) + return; + + if (space < minGrowSize) + space = minGrowSize; + + mBPathSize += space; + + if (!mBPath) { + mBPath = art_new(ArtBpath, mBPathSize); + } + else { + mBPath = art_renew(mBPath, ArtBpath, mBPathSize); + } +} + +void nsSVGBPathBuilder::EnsureBPathTerminated() +{ + NS_ASSERTION (mBPath, "no bpath"); + NS_ASSERTION (mBPathEnd>0, "trying to terminate empty bpath"); + + if (mBPathEnd>0 && mBPath[mBPathEnd-1].code == ART_END) return; + + EnsureBPathSpace(1); + mBPath[mBPathEnd++].code = ART_END; +} + +PRInt32 nsSVGBPathBuilder::GetLastOpenBPath() +{ + if (!mBPath) return -1; + + PRInt32 i = mBPathEnd; + while (--i >= 0) { + if (mBPath[i].code == ART_MOVETO_OPEN) + return i; + } + return -1; +} + + +double nsSVGBPathBuilder::CalcVectorAngle(double ux, double uy, double vx, double vy) +{ + double ta = atan2(uy, ux); + double tb = atan2(vy, vx); + if (tb >= ta) + return tb-ta; + return 6.28318530718 - (ta-tb); +} + diff --git a/layout/svg/base/src/nsSVGBPathBuilder.h b/layout/svg/base/src/nsSVGBPathBuilder.h new file mode 100644 index 000000000000..4afb5cd237f5 --- /dev/null +++ b/layout/svg/base/src/nsSVGBPathBuilder.h @@ -0,0 +1,75 @@ +/* -*- 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 (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_SVGBPATHBUILDER_H__ +#define __NS_SVGBPATHBUILDER_H__ + +#include "nscore.h" +#include "libart-incs.h" +#include "nsASVGPathBuilder.h" + +class nsSVGBPathBuilder : public nsASVGPathBuilder +{ +public: + nsSVGBPathBuilder(); + + PRBool IsEmpty(); + ArtBpath* GetBPath(); + + // nsASVGPathBuilder methods: + virtual void Moveto(float x, float y); + virtual void Lineto(float x, float y); + virtual void Curveto(float x, float y, float x1, float y1, float x2, float y2); + virtual void Arcto(float x, float y, float r1, float r2, float angle, + PRBool largeArcFlag, PRBool sweepFlag); + virtual void ClosePath(float *newX, float *newY); + +protected: + + // helpers + void EnsureBPathSpace(PRUint32 space=1); + void EnsureBPathTerminated(); + PRInt32 GetLastOpenBPath(); + double CalcVectorAngle(double ux, double uy, double vx, double vy); + + ArtBpath* mBPath; + PRUint32 mBPathSize; + PRUint32 mBPathEnd; // one-past-the-end + +}; +#endif // __NS_SVGBPATHBUILDER_H__ diff --git a/layout/svg/base/src/nsSVGCircleFrame.cpp b/layout/svg/base/src/nsSVGCircleFrame.cpp new file mode 100644 index 000000000000..b9564cf92c2c --- /dev/null +++ b/layout/svg/base/src/nsSVGCircleFrame.cpp @@ -0,0 +1,154 @@ +/* -*- 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 (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 "nsSVGGraphicFrame.h" +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGLength.h" +#include "nsIDOMSVGPoint.h" +#include "nsIDOMSVGCircleElement.h" +#include "nsIDOMSVGElement.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsASVGPathBuilder.h" + +class nsSVGCircleFrame : public nsSVGGraphicFrame +{ + friend nsresult + NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + + virtual ~nsSVGCircleFrame(); + + virtual nsresult Init(); + virtual void ConstructPath(nsASVGPathBuilder* pathBuilder); + + nsCOMPtr mCx; + nsCOMPtr mCy; + nsCOMPtr mR; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGCircleFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr circle = do_QueryInterface(aContent); + if (!circle) { +#ifdef DEBUG + printf("warning: trying to construct an SVGCircleFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGCircleFrame* it = new (aPresShell) nsSVGCircleFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + return NS_OK; +} + +nsSVGCircleFrame::~nsSVGCircleFrame() +{ + nsCOMPtr value; + if (mCx && (value = do_QueryInterface(mCx))) + value->RemoveObserver(this); + if (mCy && (value = do_QueryInterface(mCy))) + value->RemoveObserver(this); + if (mR && (value = do_QueryInterface(mR))) + value->RemoveObserver(this); +} + +nsresult nsSVGCircleFrame::Init() +{ + nsCOMPtr circle = do_QueryInterface(mContent); + NS_ASSERTION(circle,"wrong content element"); + + { + nsCOMPtr length; + circle->GetCx(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mCx)); + NS_ASSERTION(mCx, "no cx"); + if (!mCx) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mCx); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + circle->GetCy(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mCy)); + NS_ASSERTION(mCx, "no cy"); + if (!mCx) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mCy); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + circle->GetR(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mR)); + NS_ASSERTION(mCx, "no r"); + if (!mCx) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mR); + if (value) + value->AddObserver(this); + } + + return nsSVGGraphicFrame::Init(); +} + +void nsSVGCircleFrame::ConstructPath(nsASVGPathBuilder* pathBuilder) +{ + float x,y,r; + + mCx->GetValue(&x); + mCy->GetValue(&y); + mR->GetValue(&r); + + // we should be able to build this as a single arc with startpoints + // and endpoints infinitesimally separated. Let's use two arcs + // though, so that the builder doesn't get confused: + pathBuilder->Moveto(x, y-r); + pathBuilder->Arcto(x-r, y , r, r, 0.0, 0, 0); + pathBuilder->Arcto(x , y-r, r, r, 0.0, 1, 0); + pathBuilder->ClosePath(&x,&y); +} diff --git a/layout/svg/base/src/nsSVGContainerFrame.cpp b/layout/svg/base/src/nsSVGContainerFrame.cpp deleted file mode 100644 index 0fa445815ec3..000000000000 --- a/layout/svg/base/src/nsSVGContainerFrame.cpp +++ /dev/null @@ -1,561 +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 ***** */ - -#include "nsSVGContainerFrame.h" -#include "nsIStyleContext.h" -#include "nsIPresContext.h" -#include "nsCOMPtr.h" -#include "nsHTMLIIDs.h" -#include "nsUnitConversion.h" -#include "nsINameSpaceManager.h" -#include "nsHTMLAtoms.h" -#include "nsSVGAtoms.h" -#include "nsIReflowCommand.h" -#include "nsIContent.h" -#include "nsHTMLParts.h" -#include "nsIViewManager.h" -#include "nsIView.h" -#include "nsIPresShell.h" -#include "nsCSSRendering.h" -#include "nsIPref.h" -#include "nsIServiceManager.h" -#include "nsISVGFrame.h" - - -nsresult -NS_NewSVGContainerFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot) -{ - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; - } - nsSVGContainerFrame* it = new (aPresShell) nsSVGContainerFrame(aPresShell, aIsRoot); - if (nsnull == it) - return NS_ERROR_OUT_OF_MEMORY; - - *aNewFrame = it; - return NS_OK; - -} // NS_NewSVGContainerFrame - -nsSVGContainerFrame::nsSVGContainerFrame(nsIPresShell* aPresShell, PRBool aIsRoot) -{ -} - - -nsSVGContainerFrame::~nsSVGContainerFrame() -{ -} - - -NS_IMETHODIMP -nsSVGContainerFrame::SetInitialChildList(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame* aChildList) -{ - - nsresult r = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList); - - return r; -} - - -/** - * Initialize us. - */ -NS_IMETHODIMP -nsSVGContainerFrame::Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsIStyleContext* aContext, - nsIFrame* aPrevInFlow) -{ - nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); - - - - return rv; -} - - -NS_IMETHODIMP -nsSVGContainerFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) -{ - // if we are not dirty mark ourselves dirty and tell our parent we are dirty too. - if (!(mState & NS_FRAME_IS_DIRTY)) { - // Mark yourself as dirty - mState |= NS_FRAME_IS_DIRTY; - return mParent->ReflowDirtyChild(aPresShell, this); - } - - return NS_OK; -} - - - - - -/** - * Ok what we want to do here is get all the children, figure out - * their flexibility, preferred, min, max sizes and then stretch or - * shrink them to fit in the given space. - * - * So we will have 3 passes. - * 1) get our min,max,preferred size. - * 2) flow all our children to fit into the size we are given layout in - * 3) move all the children to the right locations. - */ -NS_IMETHODIMP -nsSVGContainerFrame::Reflow(nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus) -{ - aStatus = NS_FRAME_COMPLETE; - if (eReflowReason_Incremental == aReflowState.reason) { - nsIFrame* targetFrame; - aReflowState.reflowCommand->GetTarget(targetFrame); - // Check to see if we are the target of the Incremental Reflow - if (targetFrame == this) { - NS_ASSERTION(0, "Incremental reflow on nsSVGContainerFrame"); - } else { - nsIFrame * incrementalChild; - aReflowState.reflowCommand->GetNext(incrementalChild); - nscoord maxWidth = 0; - nscoord maxHeight = 0; - - nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowMetrics kidSize(&availSize); - nsHTMLReflowState kidReflowState(aPresContext, aReflowState, incrementalChild, availSize); - - incrementalChild->WillReflow(aPresContext); - incrementalChild->MoveTo(aPresContext, aReflowState.mComputedBorderPadding.left, aReflowState.mComputedBorderPadding.top); - nsIView* view; - incrementalChild->GetView(aPresContext, &view); - if (view) { - //nsHTMLContainerFrame::PositionFrameView(aPresContext, child, view); - } - nsReflowStatus status; - nsresult rv = incrementalChild->Reflow(aPresContext, kidSize, kidReflowState, status); - - nsRect rect; - incrementalChild->GetRect(rect); - nsCOMPtr svgFrame = do_QueryInterface(incrementalChild); - if (svgFrame) { - svgFrame->GetXY(&rect.x, &rect.y); - } - rect.width = kidSize.width; - rect.height = kidSize.height; - maxWidth = PR_MAX(maxWidth, rect.x+rect.width); - maxHeight = PR_MAX(maxHeight, rect.y+rect.height); - - incrementalChild->SetRect(aPresContext, rect); - if (NS_FAILED(rv)) return rv; - rv = incrementalChild->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED); - if (NS_FAILED(rv)) return rv; - - nsIFrame * child = mFrames.FirstChild(); - while (child != nsnull) { - child->GetRect(rect); - nsCOMPtr svgFrame = do_QueryInterface(child); - if (svgFrame) { - svgFrame->GetXY(&rect.x, &rect.y); - } - maxWidth = PR_MAX(maxWidth, rect.x+rect.width); - maxHeight = PR_MAX(maxHeight, rect.y+rect.height); - child->GetNextSibling(&child); - } - - aDesiredSize.width = maxWidth; - aDesiredSize.height = maxHeight; - aDesiredSize.ascent = aDesiredSize.height; - aDesiredSize.descent = 0; - } - } else { - - nscoord maxWidth = 0; - nscoord maxHeight = 0; - - nsIFrame * child = mFrames.FirstChild(); - - while (child != nsnull) { - - nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight); - nsHTMLReflowMetrics kidSize(&availSize); - nsHTMLReflowState kidReflowState(aPresContext, aReflowState, child, availSize); - - child->WillReflow(aPresContext); - child->MoveTo(aPresContext, aReflowState.mComputedBorderPadding.left, aReflowState.mComputedBorderPadding.top); - nsIView* view; - child->GetView(aPresContext, &view); - if (view) { - //nsHTMLContainerFrame::PositionFrameView(aPresContext, child, view); - } - nsReflowStatus status; - nsresult rv = child->Reflow(aPresContext, kidSize, kidReflowState, status); - - nsRect rect; - child->GetRect(rect); - nsCOMPtr svgFrame = do_QueryInterface(child); - if (svgFrame) { - svgFrame->GetXY(&rect.x, &rect.y); - } - rect.width = kidSize.width; - rect.height = kidSize.height; - maxWidth = PR_MAX(maxWidth, rect.x+rect.width); - maxHeight = PR_MAX(maxHeight, rect.y+rect.height); - - child->SetRect(aPresContext, rect); - if (NS_FAILED(rv)) return rv; - rv = child->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED); - if (NS_FAILED(rv)) return rv; - child->GetNextSibling(&child); - } - - - aDesiredSize.width = maxWidth; - aDesiredSize.height = maxHeight; - aDesiredSize.ascent = aDesiredSize.height; - aDesiredSize.descent = 0; - } - - if (nsnull != aDesiredSize.maxElementSize) { - aDesiredSize.maxElementSize->width = aDesiredSize.width; - aDesiredSize.maxElementSize->height = aDesiredSize.height; - } - - return NS_OK; -} - - -NS_IMETHODIMP -nsSVGContainerFrame::DidReflow(nsIPresContext* aPresContext, - const nsHTMLReflowState* aReflowState, - nsDidReflowStatus aStatus) -{ - nsresult rv = nsHTMLContainerFrame::DidReflow(aPresContext, aReflowState, aStatus); - NS_ASSERTION(rv == NS_OK,"DidReflow failed"); - - return rv; -} - - -// Marks the frame as dirty and generates an incremental reflow -// command targeted at this frame -nsresult -nsSVGContainerFrame::GenerateDirtyReflowCommand(nsIPresContext* aPresContext, - nsIPresShell& aPresShell) -{ - if (mState & NS_FRAME_IS_DIRTY) - return NS_OK; - - // ask out parent to dirty things. - mState |= NS_FRAME_IS_DIRTY; - return mParent->ReflowDirtyChild(&aPresShell, this); -} - -NS_IMETHODIMP -nsSVGContainerFrame::RemoveFrame(nsIPresContext* aPresContext, - nsIPresShell& aPresShell, - nsIAtom* aListName, - nsIFrame* aOldFrame) -{ - - // remove the child frame - mFrames.DestroyFrame(aPresContext, aOldFrame); - - // mark us dirty and generate a reflow command - return GenerateDirtyReflowCommand(aPresContext, aPresShell); -} - -NS_IMETHODIMP -nsSVGContainerFrame::Destroy(nsIPresContext* aPresContext) -{ - - return nsHTMLContainerFrame::Destroy(aPresContext); -} - - -NS_IMETHODIMP -nsSVGContainerFrame::InsertFrames(nsIPresContext* aPresContext, - nsIPresShell& aPresShell, - nsIAtom* aListName, - nsIFrame* aPrevFrame, - nsIFrame* aFrameList) -{ - // insert the frames in out regular frame list - mFrames.InsertFrames(this, aPrevFrame, aFrameList); - - // mark us dirty and generate a reflow command - return GenerateDirtyReflowCommand(aPresContext, aPresShell); - -} - - -NS_IMETHODIMP -nsSVGContainerFrame::AppendFrames(nsIPresContext* aPresContext, - nsIPresShell& aPresShell, - nsIAtom* aListName, - nsIFrame* aFrameList) -{ - // append in regular frames - mFrames.AppendFrames(this, aFrameList); - - // mark us dirty and generate a reflow command - return GenerateDirtyReflowCommand(aPresContext, aPresShell); -} - - - -NS_IMETHODIMP -nsSVGContainerFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) -{ - nsresult rv = nsHTMLContainerFrame::AttributeChanged(aPresContext, aChild, - aNameSpaceID, aAttribute, aModType, aHint); -#if 0 - if (aAttribute == nsHTMLAtoms::width || - aAttribute == nsHTMLAtoms::height || - aAttribute == nsHTMLAtoms::align || - aAttribute == nsHTMLAtoms::valign || - aAttribute == nsXULAtoms::flex || - aAttribute == nsXULAtoms::orient) { - - if (aAttribute == nsXULAtoms::orient || aAttribute == nsXULAtoms::debug || aAttribute == nsHTMLAtoms::align || aAttribute == nsHTMLAtoms::valign) { - mInner->mValign = nsSVGContainerFrame::vAlign_Top; - mInner->mHalign = nsSVGContainerFrame::hAlign_Left; - - GetInitialVAlignment(mInner->mValign); - GetInitialHAlignment(mInner->mHalign); - - PRBool orient = mState & NS_STATE_IS_HORIZONTAL; - GetInitialOrientation(orient); - if (orient) - mState |= NS_STATE_IS_HORIZONTAL; - else - mState &= ~NS_STATE_IS_HORIZONTAL; - - PRBool debug = mState & NS_STATE_SET_TO_DEBUG; - PRBool debugSet = mInner->GetInitialDebug(debug); - if (debugSet) { - mState |= NS_STATE_DEBUG_WAS_SET; - if (debug) - mState |= NS_STATE_SET_TO_DEBUG; - else - mState &= ~NS_STATE_SET_TO_DEBUG; - } else { - mState &= ~NS_STATE_DEBUG_WAS_SET; - } - - - PRBool autostretch = mState & NS_STATE_AUTO_STRETCH; - GetInitialAutoStretch(autostretch); - if (autostretch) - mState |= NS_STATE_AUTO_STRETCH; - else - mState &= ~NS_STATE_AUTO_STRETCH; - } - - nsCOMPtr shell; - aPresContext->GetShell(getter_AddRefs(shell)); - GenerateDirtyReflowCommand(aPresContext, *shell); - } -#endif - - return rv; -} - - -NS_IMETHODIMP -nsSVGContainerFrame::Paint (nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags) -{ - const nsStyleVisibility* visib = (const nsStyleVisibility*) - mStyleContext->GetStyleData(eStyleStruct_Visibility); - - // if we aren't visible then we are done. - if (!visib->IsVisibleOrCollapsed()) - return NS_OK; - //printf("nsSVGContainerFrame::Paint Start\n"); - // if we are visible then tell our superclass to paint - nsresult r = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, - aWhichLayer); - //printf("nsSVGContainerFrame::Paint End\n"); - - return r; -} - -// Paint one child frame -void -nsSVGContainerFrame::PaintChild(nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsIFrame* aFrame, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags) -{ - const nsStyleVisibility* visib; - aFrame->GetStyleData(eStyleStruct_Visibility, ((const nsStyleStruct *&)visib)); - - // if collapsed don't paint the child. - if (visib->mVisible == NS_STYLE_VISIBILITY_COLLAPSE) - return; - - nsHTMLContainerFrame::PaintChild(aPresContext, aRenderingContext, aDirtyRect, aFrame, aWhichLayer); -} - -void -nsSVGContainerFrame::PaintChildren(nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags) -{ - const nsStyleDisplay* disp = (const nsStyleDisplay*) - mStyleContext->GetStyleData(eStyleStruct_Display); - - // Child elements have the opportunity to override the visibility property - // of their parent and display even if the parent is hidden - PRBool clipState; - - nsRect r(0,0,mRect.width, mRect.height); - PRBool hasClipped = PR_FALSE; - - // If overflow is hidden then set the clip rect so that children - // don't leak out of us - if (NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { - //nsMargin dm(0,0,0,0); - //mInner->GetDebugInset(dm); - nsMargin im(0,0,0,0); - GetInset(im); - nsMargin border(0,0,0,0); - nsStyleBorderPadding borderpadding; - mStyleContext->GetBorderPaddingFor(borderpadding); - borderpadding.GetBorderPadding(border); - r.Deflate(im); - //r.Deflate(dm); - r.Deflate(border); - } - - nsIFrame* kid = mFrames.FirstChild(); - while (nsnull != kid) { - if (!hasClipped && NS_STYLE_OVERFLOW_HIDDEN == disp->mOverflow) { - // if we haven't already clipped and we should - // check to see if the child is in out bounds. If not then - // we begin clipping. - nsRect cr(0,0,0,0); - kid->GetRect(cr); - - // if our rect does not contain the childs then begin clipping - if (!r.Contains(cr)) { - aRenderingContext.PushState(); - aRenderingContext.SetClipRect(r, - nsClipCombine_kIntersect, clipState); - hasClipped = PR_TRUE; - } - } - - PaintChild(aPresContext, aRenderingContext, aDirtyRect, kid, aWhichLayer); - kid->GetNextSibling(&kid); - } - - if (hasClipped) { - aRenderingContext.PopState(clipState); - } -} - - - -NS_IMETHODIMP_(nsrefcnt) -nsSVGContainerFrame::AddRef(void) -{ - return NS_OK; -} - -NS_IMETHODIMP_(nsrefcnt) -nsSVGContainerFrame::Release(void) -{ - return NS_OK; -} - -NS_IMETHODIMP -nsSVGContainerFrame::GetFrameName(nsAString& aResult) const -{ - aResult = NS_LITERAL_STRING("nsSVGContainerFrame"); - return NS_OK; -} - - -NS_IMETHODIMP -nsSVGContainerFrame::GetFrameForPoint(nsIPresContext* aPresContext, - const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame) -{ - // this should act like a block, so we need to override - return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame); - -} - - - - -NS_IMETHODIMP -nsSVGContainerFrame::GetCursor(nsIPresContext* aPresContext, - nsPoint& aPoint, - PRInt32& aCursor) -{ - - return nsHTMLContainerFrame::GetCursor(aPresContext, aPoint, aCursor); -} - -void -nsSVGContainerFrame::GetInset(nsMargin& margin) -{ - margin.top = 0; - margin.left = 0; - margin.right = 0; - margin.bottom = 0; -} - diff --git a/layout/svg/base/src/nsSVGContainerFrame.h b/layout/svg/base/src/nsSVGContainerFrame.h deleted file mode 100644 index b80c819ed0c6..000000000000 --- a/layout/svg/base/src/nsSVGContainerFrame.h +++ /dev/null @@ -1,161 +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 nsSVGContainerFrame_h___ -#define nsSVGContainerFrame_h___ - -#include "nsCOMPtr.h" -#include "nsHTMLContainerFrame.h" - -class nsHTMLReflowCommand; -class nsHTMLInfo; - -// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// This should be NOT derived from nsHTMLContainerFrame -// we really want to create our own container class from the nsIFrame -// interface and not derive from any HTML Frames -// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -class nsSVGContainerFrame : public nsHTMLContainerFrame -{ -public: - - friend nsresult NS_NewSVGContainerFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRBool aIsRoot = PR_FALSE); - - NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, - const nsPoint& aPoint, - nsFramePaintLayer aWhichLayer, - nsIFrame** aFrame); - - NS_IMETHOD GetCursor(nsIPresContext* aPresContext, - nsPoint& aPoint, - PRInt32& aCursor); - - - NS_IMETHOD DidReflow(nsIPresContext* aPresContext, - const nsHTMLReflowState* aReflowState, - nsDidReflowStatus aStatus); - - NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild); - - NS_IMETHOD Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsIStyleContext* aContext, - nsIFrame* asPrevInFlow); - - - NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); - - NS_IMETHOD Paint ( nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags = 0); - - - - NS_IMETHOD Reflow(nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus); - - NS_IMETHOD AppendFrames(nsIPresContext* aPresContext, - nsIPresShell& aPresShell, - nsIAtom* aListName, - nsIFrame* aFrameList); - - NS_IMETHOD InsertFrames(nsIPresContext* aPresContext, - nsIPresShell& aPresShell, - nsIAtom* aListName, - nsIFrame* aPrevFrame, - nsIFrame* aFrameList); - - NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext, - nsIPresShell& aPresShell, - nsIAtom* aListName, - nsIFrame* aOldFrame); - - NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext, - nsIAtom* aListName, - nsIFrame* aChildList); - - - NS_IMETHOD GetFrameName(nsAString& aResult) const; - - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - virtual ~nsSVGContainerFrame(); - - virtual PRIntn GetSkipSides() const { return 0; } - virtual void GetInset(nsMargin& margin); - NS_IMETHOD Destroy(nsIPresContext* aPresContext); - - -protected: - nsSVGContainerFrame(nsIPresShell* aPresShell, PRBool aIsRoot = PR_FALSE); - - // Paint one child frame - virtual void PaintChild(nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsIFrame* aFrame, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags = 0); - - virtual void PaintChildren(nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags = 0); - - - nsresult GenerateDirtyReflowCommand(nsIPresContext* aPresContext, - nsIPresShell& aPresShell); - - -private: - -}; // class nsSVGContainerFrame - -#endif - diff --git a/layout/svg/base/src/nsSVGEllipseFrame.cpp b/layout/svg/base/src/nsSVGEllipseFrame.cpp new file mode 100644 index 000000000000..d0da150869f4 --- /dev/null +++ b/layout/svg/base/src/nsSVGEllipseFrame.cpp @@ -0,0 +1,167 @@ +/* -*- 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 (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 "nsSVGGraphicFrame.h" +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGLength.h" +#include "nsIDOMSVGPoint.h" +#include "nsIDOMSVGEllipseElement.h" +#include "nsIDOMSVGElement.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsASVGPathBuilder.h" + +class nsSVGEllipseFrame : public nsSVGGraphicFrame +{ + friend nsresult + NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + + virtual ~nsSVGEllipseFrame(); + + virtual nsresult Init(); + virtual void ConstructPath(nsASVGPathBuilder* pathBuilder); + + nsCOMPtr mCx; + nsCOMPtr mCy; + nsCOMPtr mRx; + nsCOMPtr mRy; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGEllipseFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr ellipse = do_QueryInterface(aContent); + if (!ellipse) { +#ifdef DEBUG + printf("warning: trying to construct an SVGEllipseFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGEllipseFrame* it = new (aPresShell) nsSVGEllipseFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + return NS_OK; +} + +nsSVGEllipseFrame::~nsSVGEllipseFrame() +{ + nsCOMPtr value; + if (mCx && (value = do_QueryInterface(mCx))) + value->RemoveObserver(this); + if (mCy && (value = do_QueryInterface(mCy))) + value->RemoveObserver(this); + if (mRx && (value = do_QueryInterface(mRx))) + value->RemoveObserver(this); + if (mRy && (value = do_QueryInterface(mRy))) + value->RemoveObserver(this); +} + +nsresult nsSVGEllipseFrame::Init() +{ + nsCOMPtr ellipse = do_QueryInterface(mContent); + NS_ASSERTION(ellipse,"wrong content element"); + + { + nsCOMPtr length; + ellipse->GetCx(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mCx)); + NS_ASSERTION(mCx, "no cx"); + if (!mCx) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mCx); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + ellipse->GetCy(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mCy)); + NS_ASSERTION(mCy, "no cy"); + if (!mCy) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mCy); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + ellipse->GetRx(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mRx)); + NS_ASSERTION(mRx, "no rx"); + if (!mRx) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mRx); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + ellipse->GetRy(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mRy)); + NS_ASSERTION(mRy, "no ry"); + if (!mRy) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mRy); + if (value) + value->AddObserver(this); + } + + return nsSVGGraphicFrame::Init(); +} + +void nsSVGEllipseFrame::ConstructPath(nsASVGPathBuilder* pathBuilder) +{ + float x,y,rx,ry; + + mCx->GetValue(&x); + mCy->GetValue(&y); + mRx->GetValue(&rx); + mRy->GetValue(&ry); + + // build ellipse from two arcs + pathBuilder->Moveto(x-rx, y); + pathBuilder->Arcto(x+rx, y, rx, ry, 0.0, 0, 0); + pathBuilder->Arcto(x-rx, y, rx, ry, 0.0, 1, 0); + pathBuilder->ClosePath(&x,&y); +} diff --git a/layout/svg/base/src/nsSVGFill.cpp b/layout/svg/base/src/nsSVGFill.cpp new file mode 100644 index 000000000000..5cabe5efaf93 --- /dev/null +++ b/layout/svg/base/src/nsSVGFill.cpp @@ -0,0 +1,151 @@ +/* -*- 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 (original author) + * Bradley Baetz + * + * 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 + +#include "nsSVGFill.h" + +// static helper functions + +#define EPSILON 1e-6 + +static PRBool ContainsOpenPath(ArtVpath* src) +{ + int pos; + for(pos=0;src[pos].code != ART_END;++pos) { + if (src[pos].code==ART_MOVETO_OPEN) + return PR_TRUE; + } + return PR_FALSE; +} + +// Closes an open path, returning a new one +static ArtVpath* CloseOpenPath(ArtVpath* src) +{ + // We need to insert something extra for each open subpath + // So we realloc stuff as needed + int currSize = 0; + int maxSize = 4; + ArtVpath *ret = art_new(ArtVpath, maxSize); + + PRBool isOpenSubpath = PR_FALSE; + double startX=0; + double startY=0; + + int srcPos; + for (srcPos=0;src[srcPos].code != ART_END;++srcPos) { + if (currSize==maxSize) + art_expand(ret, ArtVpath, maxSize); + if (src[srcPos].code == ART_MOVETO_OPEN) + ret[currSize].code = ART_MOVETO; // close it + else + ret[currSize].code = src[srcPos].code; + ret[currSize].x = src[srcPos].x; + ret[currSize].y = src[srcPos].y; + ++currSize; + + // OK, it was open + if (src[srcPos].code == ART_MOVETO_OPEN) { + startX = src[srcPos].x; + startY = src[srcPos].y; + isOpenSubpath = PR_TRUE; + } else if (src[srcPos+1].code != ART_LINETO) { + if (isOpenSubpath && + ((fabs(startX - src[srcPos].x) > EPSILON) || + (fabs(startY - src[srcPos].y) > EPSILON))) { + // The next one isn't a line, so lets close this + if (currSize == maxSize) + art_expand(ret, ArtVpath, maxSize); + ret[currSize].code = ART_LINETO; + ret[currSize].x = startX; + ret[currSize].y = startY; + ++currSize; + } + isOpenSubpath = PR_FALSE; + } + } + if (currSize == maxSize) + art_expand(ret, ArtVpath, maxSize); + ret[currSize].code = ART_END; + ret[currSize].x = 0; + ret[currSize].y = 0; + return ret; +} + +// nsSVGFill members + +void +nsSVGFill::Build(ArtVpath* path, const nsSVGFillStyle& style) +{ + if (mSvp) { + art_svp_free(mSvp); + mSvp = nsnull; + } + + PRBool hasOpen = ContainsOpenPath(path); + if (hasOpen) + path = CloseOpenPath(path); + + ArtVpath* perturbedVP = art_vpath_perturb(path); + + if (hasOpen) + art_free(path); + + ArtSVP* svp = art_svp_from_vpath(perturbedVP); + art_free(perturbedVP); + + ArtSVP* uncrossedSVP = art_svp_uncross(svp); + art_svp_free(svp); + + ArtWindRule wind; + switch (style.fillrule) { + case NS_STYLE_FILL_RULE_NONZERO: + wind = ART_WIND_RULE_NONZERO; + break; + case NS_STYLE_FILL_RULE_EVENODD: + wind = ART_WIND_RULE_ODDEVEN; + break; + default: + NS_ERROR("not reached"); + } + + mSvp = art_svp_rewind_uncrossed (uncrossedSVP, wind); + art_svp_free (uncrossedSVP); +} + diff --git a/layout/svg/base/src/nsSVGFill.h b/layout/svg/base/src/nsSVGFill.h new file mode 100644 index 000000000000..d1b3a6b0818a --- /dev/null +++ b/layout/svg/base/src/nsSVGFill.h @@ -0,0 +1,57 @@ +/* -*- 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 (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_SVGFILL_H__ +#define __NS_SVGFILL_H__ + +#include "nsSVGRenderItem.h" +#include "libart-incs.h" +#include "nsStyleConsts.h" + +struct nsSVGFillStyle +{ + PRInt8 fillrule; // see nsStyleConsts.h +}; + +class nsSVGFill : public nsSVGRenderItem +{ +public: + void Build(ArtVpath* path, const nsSVGFillStyle& style); +}; + +#endif // __NS_SVGFILL_H__ diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp new file mode 100644 index 000000000000..16062ea8811a --- /dev/null +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -0,0 +1,715 @@ +/* -*- 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 (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 "nsBlockFrame.h" +#include "nsIDOMSVGGElement.h" +#include "nsIPresContext.h" +#include "nsISVGFrame.h" +#include "nsSVGRenderingContext.h" +#include "nsWeakReference.h" +#include "nsISVGValue.h" +#include "nsISVGValueObserver.h" +#include "nsIDOMSVGTransformable.h" +#include "nsIDOMSVGAnimTransformList.h" +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGLength.h" +#include "nsIDOMSVGForeignObjectElem.h" +#include "nsIDOMSVGMatrix.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsIDOMSVGPoint.h" +#include "libart-incs.h" +#include "nsSpaceManager.h" + +typedef nsBlockFrame nsSVGForeignObjectFrameBase; + +class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase, + public nsISVGFrame, + public nsISVGValueObserver, + public nsSupportsWeakReference +{ + friend nsresult + NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +protected: + nsSVGForeignObjectFrame(); + virtual ~nsSVGForeignObjectFrame(); + nsresult Init(); + + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } +public: + // nsIFrame: + NS_IMETHOD Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow); + + NS_IMETHOD Reflow(nsIPresContext* aPresContext, + nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aReflowState, + nsReflowStatus& aStatus); + + NS_IMETHOD AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList); + + NS_IMETHOD InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList); + + NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame); + + NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + + // nsISVGFrame interface: + NS_IMETHOD Paint(nsSVGRenderingContext* renderingContext); + NS_IMETHOD InvalidateRegion(ArtUta* uta, PRBool bRedraw); + NS_IMETHOD GetFrameForPoint(float x, float y, nsIFrame** hit); + NS_IMETHOD NotifyCTMChanged(); + NS_IMETHOD NotifyRedrawSuspended(); + NS_IMETHOD NotifyRedrawUnsuspended(); + NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended); + +protected: + // implementation helpers: + void Update(); + ArtUta* DoReflow(); + ArtUta* GetUta(); + float GetPxPerTwips(); + float GetTwipsPerPx(); + void TransformPoint(float& x, float& y); + void TransformVector(float& x, float& y); + void GetCTM(nsIDOMSVGMatrix** ctm); + static void AccumulateUta(ArtUta** accu, ArtUta* uta); + + PRBool mIsDirty; + nsIPresShell* mPresShell; // XXX is a non-owning ref ok? + nsCOMPtr mX; + nsCOMPtr mY; + nsCOMPtr mWidth; + nsCOMPtr mHeight; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr foreignObject = do_QueryInterface(aContent); + if (!foreignObject) { +#ifdef DEBUG + printf("warning: trying to construct an SVGForeignObjectFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGForeignObjectFrame* it = new (aPresShell) nsSVGForeignObjectFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + + // XXX is this ok? + it->mPresShell = aPresShell; + + return NS_OK; +} + +nsSVGForeignObjectFrame::nsSVGForeignObjectFrame() + : mIsDirty(PR_TRUE) +{ +} + +nsSVGForeignObjectFrame::~nsSVGForeignObjectFrame() +{ +// nsCOMPtr transformable = do_QueryInterface(mContent); +// NS_ASSERTION(transformable, "wrong content element"); +// nsCOMPtr transforms; +// transformable->GetTransform(getter_AddRefs(transforms)); +// nsCOMPtr value = do_QueryInterface(transforms); +// NS_ASSERTION(value, "interface not found"); +// if (value) +// value->RemoveObserver(this); + nsCOMPtr value; + if (mX && (value = do_QueryInterface(mX))) + value->RemoveObserver(this); + if (mY && (value = do_QueryInterface(mY))) + value->RemoveObserver(this); + if (mWidth && (value = do_QueryInterface(mWidth))) + value->RemoveObserver(this); + if (mHeight && (value = do_QueryInterface(mHeight))) + value->RemoveObserver(this); +} + +nsresult nsSVGForeignObjectFrame::Init() +{ + nsCOMPtr foreignObject = do_QueryInterface(mContent); + NS_ASSERTION(foreignObject, "wrong content element"); + + { + nsCOMPtr length; + foreignObject->GetX(getter_AddRefs(length)); + length->GetAnimVal(getter_AddRefs(mX)); + NS_ASSERTION(mX, "no x"); + if (!mX) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mX); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + foreignObject->GetY(getter_AddRefs(length)); + length->GetAnimVal(getter_AddRefs(mY)); + NS_ASSERTION(mY, "no y"); + if (!mY) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mY); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + foreignObject->GetWidth(getter_AddRefs(length)); + length->GetAnimVal(getter_AddRefs(mWidth)); + NS_ASSERTION(mWidth, "no width"); + if (!mWidth) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mWidth); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + foreignObject->GetHeight(getter_AddRefs(length)); + length->GetAnimVal(getter_AddRefs(mHeight)); + NS_ASSERTION(mHeight, "no height"); + if (!mHeight) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mHeight); + if (value) + value->AddObserver(this); + } + +// XXX +// nsCOMPtr transformable = do_QueryInterface(mContent); +// NS_ASSERTION(transformable, "wrong content element"); +// nsCOMPtr transforms; +// transformable->GetTransform(getter_AddRefs(transforms)); +// nsCOMPtr value = do_QueryInterface(transforms); +// NS_ASSERTION(value, "interface not found"); +// if (value) +// value->AddObserver(this); + + // XXX for some reason updating fails when done here. Why is this too early? + // anyway - we use a less desirable mechanism now of updating in paint(). +// Update(); + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_INTERFACE_MAP_BEGIN(nsSVGForeignObjectFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGFrame) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) +NS_INTERFACE_MAP_END_INHERITING(nsSVGForeignObjectFrameBase) + + +//---------------------------------------------------------------------- +// nsIFrame methods +NS_IMETHODIMP +nsSVGForeignObjectFrame::Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv; + rv = nsSVGForeignObjectFrameBase::Init(aPresContext, aContent, aParent, + aContext, aPrevInFlow); + + Init(); + + return rv; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::Reflow(nsIPresContext* aPresContext, + nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aReflowState, + nsReflowStatus& aStatus) +{ +#ifdef DEBUG +// printf("nsSVGForeignObjectFrame(%p)::Reflow\n", this); +#endif + + float twipsPerPx = GetTwipsPerPx(); + + NS_ENSURE_TRUE(mX && mY && mWidth && mHeight, NS_ERROR_FAILURE); + + float x, y, width, height; + mX->GetValue(&x); + mY->GetValue(&y); + mWidth->GetValue(&width); + mHeight->GetValue(&height); + + // transform x,y,width,height according to the current ctm: + // XXX we're ignoring rotation at the moment + + TransformPoint(x, y); + + float e1x = 1, e1y = 0, e2x = 0, e2y = 1; + TransformVector(e1x, e1y); + TransformVector(e2x, e2y); + width *= (float)sqrt(e1x*e1x + e1y*e1y); + height *= (float)sqrt(e2x*e2x + e2y*e2y); + + // move ourselves to (x,y): + MoveTo(aPresContext, (nscoord) (x*twipsPerPx), (nscoord) (y*twipsPerPx)); + // XXX: if we have a view, move that + + // create a new reflow state, setting our max size to (width,height): + nsSize availableSpace((nscoord)(width*twipsPerPx), (nscoord)(height*twipsPerPx)); + nsHTMLReflowState sizedReflowState(aPresContext, + aReflowState, + this, + availableSpace); + + // XXX Not sure the dirty-state should be cleared here. We should + // re-examine how the reflow is driven from nsSVGOuterSVGFrame. I + // think we're missing a call to DidReflow somewhere ? + mState &= ~NS_FRAME_IS_DIRTY; + + // leverage our base class' reflow function to do all the work: + return nsSVGForeignObjectFrameBase::Reflow(aPresContext, aDesiredSize, + sizedReflowState, aStatus); +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList) +{ + nsresult rv; + rv = nsSVGForeignObjectFrameBase::AppendFrames(aPresContext, aPresShell, + aListName, aFrameList); + Update(); + return rv; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList) +{ + nsresult rv; + rv = nsSVGForeignObjectFrameBase::InsertFrames(aPresContext, aPresShell, + aListName, aPrevFrame, aFrameList); + Update(); + return rv; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame) +{ + nsresult rv; + rv = nsSVGForeignObjectFrameBase::RemoveFrame(aPresContext, aPresShell, + aListName, aOldFrame); + Update(); + return rv; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame) +{ + nsresult rv; + rv = nsSVGForeignObjectFrameBase::ReplaceFrame(aPresContext, aPresShell, + aListName, aOldFrame, aNewFrame); + Update(); + return rv; +} + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods: + +NS_IMETHODIMP +nsSVGForeignObjectFrame::WillModifySVGObservable(nsISVGValue* observable) +{ + return NS_OK; +} + + +NS_IMETHODIMP +nsSVGForeignObjectFrame::DidModifySVGObservable (nsISVGValue* observable) +{ + Update(); + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGFrame methods + +NS_IMETHODIMP +nsSVGForeignObjectFrame::Paint(nsSVGRenderingContext* renderingContext) +{ +#ifdef XP_UNIX + //XXX - Workaround to make sure that ForeignObject's are displayed on unix + // even when they are not preloaded in cache. + mIsDirty = PR_TRUE; +#endif + + if (mIsDirty) { + ArtUta* dirtyRegion = DoReflow(); + if (dirtyRegion) { + art_uta_free(dirtyRegion); + } + } + + nsIRenderingContext* ctx = renderingContext->LockMozRenderingContext(); + nsRect dirtyRect = renderingContext->GetDirtyRectTwips(); + + ctx->Translate(mRect.x, mRect.y); + dirtyRect.x -= mRect.x; + dirtyRect.y -= mRect.y; + + nsSVGForeignObjectFrameBase::Paint(renderingContext->GetPresContext(), + *ctx, + dirtyRect, + NS_FRAME_PAINT_LAYER_BACKGROUND, + 0); + + nsSVGForeignObjectFrameBase::Paint(renderingContext->GetPresContext(), + *ctx, + dirtyRect, + NS_FRAME_PAINT_LAYER_FLOATERS, + 0); + + nsSVGForeignObjectFrameBase::Paint(renderingContext->GetPresContext(), + *ctx, + dirtyRect, + NS_FRAME_PAINT_LAYER_FOREGROUND, + 0); + + renderingContext->UnlockMozRenderingContext(); + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::InvalidateRegion(ArtUta* uta, PRBool bRedraw) +{ + if (!uta && !bRedraw) return NS_OK; + + if (!mParent) { + NS_ERROR("invalidating region without parent"); + if (uta) + art_uta_free(uta); + return NS_OK; + } + + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + if (!SVGFrame) { + if (uta) + art_uta_free(uta); + return NS_OK; + } + + return SVGFrame->InvalidateRegion(uta, bRedraw); +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) +{ + *hit = nsnull; + + NS_ASSERTION(mPresShell, "need presshell"); + if (!mPresShell) return NS_ERROR_FAILURE; + + nsCOMPtr presContext; + mPresShell->GetPresContext(getter_AddRefs(presContext)); + + nsPoint p( (nscoord)(x*GetTwipsPerPx()), + (nscoord)(y*GetTwipsPerPx())); + + nsresult rv; + + rv = nsSVGForeignObjectFrameBase::GetFrameForPoint(presContext, p, + NS_FRAME_PAINT_LAYER_FOREGROUND, hit); + if (NS_SUCCEEDED(rv) && *hit) return rv; + + rv = nsSVGForeignObjectFrameBase::GetFrameForPoint(presContext, p, + NS_FRAME_PAINT_LAYER_FLOATERS, hit); + if (NS_SUCCEEDED(rv) && *hit) return rv; + + return nsSVGForeignObjectFrameBase::GetFrameForPoint(presContext, p, + NS_FRAME_PAINT_LAYER_BACKGROUND, hit); +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::NotifyCTMChanged() +{ + Update(); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::NotifyRedrawSuspended() +{ + return NS_OK; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::NotifyRedrawUnsuspended() +{ + if (mIsDirty) { + ArtUta* dirtyRegion = DoReflow(); + if (dirtyRegion) { + InvalidateRegion(dirtyRegion, PR_TRUE); + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGForeignObjectFrame::IsRedrawSuspended(PRBool* isSuspended) +{ + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + if (!SVGFrame) { + *isSuspended = PR_FALSE; + return NS_OK; + } + + return SVGFrame->IsRedrawSuspended(isSuspended); +} + +//---------------------------------------------------------------------- +// Implementation helpers + +void nsSVGForeignObjectFrame::Update() +{ + mIsDirty = PR_TRUE; + + PRBool suspended; + IsRedrawSuspended(&suspended); + if (!suspended) { + ArtUta* dirtyRegion = DoReflow(); + if (dirtyRegion) { + InvalidateRegion(dirtyRegion, PR_TRUE); + } + } +} + +ArtUta* nsSVGForeignObjectFrame::DoReflow() +{ + NS_ASSERTION(mPresShell, "need a presshell"); + + nsCOMPtr presContext; + mPresShell->GetPresContext(getter_AddRefs(presContext)); + + // remember the area we have to invalidate after this reflow: + ArtUta* dirtyRegion = nsnull; + AccumulateUta(&dirtyRegion, GetUta()); + + // initiate a synchronous reflow here and now: + nsSize availableSpace(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); + nsCOMPtr renderingContext; + mPresShell->CreateRenderingContext(this,getter_AddRefs(renderingContext)); + + // XXX we always pass this off as an initial reflow. is that a problem? + nsHTMLReflowState reflowState(presContext, this, eReflowReason_Initial, + renderingContext, availableSpace); + + nsSpaceManager* spaceManager = new nsSpaceManager(mPresShell, this); + if (!spaceManager) { + return dirtyRegion; + } + reflowState.mSpaceManager = spaceManager; + + nsHTMLReflowMetrics desiredSize(nsnull); + nsReflowStatus status; + + WillReflow(presContext); + Reflow(presContext, desiredSize, reflowState, status); + SizeTo(presContext, desiredSize.width, desiredSize.height); + DidReflow(presContext, &reflowState, NS_FRAME_REFLOW_FINISHED); + + AccumulateUta(&dirtyRegion, GetUta()); + + mIsDirty = PR_FALSE; + + return dirtyRegion; +} + +ArtUta* nsSVGForeignObjectFrame::GetUta() +{ + // get a uta from our mRect + + if (mRect.width==0 || mRect.height==0) return nsnull; + float pxPerTwips = GetPxPerTwips(); + ArtIRect irect; + irect.x0 = (int)((mRect.x-1) * pxPerTwips); + irect.y0 = (int)((mRect.y-1) * pxPerTwips); + irect.x1 = (int)((mRect.x+mRect.width+2) * pxPerTwips); + irect.y1 = (int)((mRect.y+mRect.height+2) * pxPerTwips); + + return art_uta_from_irect(&irect); +} + +float nsSVGForeignObjectFrame::GetPxPerTwips() +{ + float val = GetTwipsPerPx(); + + NS_ASSERTION(val!=0.0f, "invalid px/twips"); + if (val == 0.0) val = 1e-20f; + + return 1.0f/val; +} + +float nsSVGForeignObjectFrame::GetTwipsPerPx() +{ + float twipsPerPx=16.0f; + NS_ASSERTION(mPresShell, "need presshell"); + if (mPresShell) { + nsCOMPtr presContext; + mPresShell->GetPresContext(getter_AddRefs(presContext)); + presContext->GetScaledPixelsToTwips(&twipsPerPx); + } + return twipsPerPx; +} + +void nsSVGForeignObjectFrame::TransformPoint(float& x, float& y) +{ + nsCOMPtr ctm; + GetCTM(getter_AddRefs(ctm)); + if (!ctm) return; + + // XXX this is absurd! we need to add another method (interface + // even?) to nsIDOMSVGMatrix to make this easier. (something like + // nsIDOMSVGMatrix::TransformPoint(float*x,float*y)) + + nsCOMPtr el = do_QueryInterface(mContent); + nsCOMPtr svg_el; + el->GetOwnerSVGElement(getter_AddRefs(svg_el)); + if (!svg_el) return; + nsCOMPtr point; + svg_el->CreateSVGPoint(getter_AddRefs(point)); + NS_ASSERTION(point, "couldn't create point!"); + if (!point) return; + + point->SetX(x); + point->SetY(y); + nsCOMPtr xfpoint; + point->MatrixTransform(ctm, getter_AddRefs(xfpoint)); + xfpoint->GetX(&x); + xfpoint->GetY(&y); +} + +void nsSVGForeignObjectFrame::TransformVector(float& x, float& y) +{ + // XXX This is crazy. What we really want is + // nsIDOMSVGMatrix::TransformVector(x,y); + + float x0,y0; + TransformPoint(x0, y0); + TransformPoint(x,y); + x -= x0; + y -= y0; +} + +void nsSVGForeignObjectFrame::GetCTM(nsIDOMSVGMatrix** ctm) +{ + *ctm = nsnull; + + nsCOMPtr transformable = do_QueryInterface(mContent); + NS_ASSERTION(transformable, "wrong content type"); + + transformable->GetCTM(ctm); +} + +void nsSVGForeignObjectFrame::AccumulateUta(ArtUta** accu, ArtUta* uta) +{ + if (uta == nsnull) return; + + if (*accu == nsnull) { + *accu = uta; + return ; + } + + ArtUta* temp = *accu; + *accu = art_uta_union(*accu, uta); + art_uta_free(temp); + art_uta_free(uta); +} + diff --git a/layout/svg/base/src/nsSVGGFrame.cpp b/layout/svg/base/src/nsSVGGFrame.cpp new file mode 100644 index 000000000000..ee7dc71bb76a --- /dev/null +++ b/layout/svg/base/src/nsSVGGFrame.cpp @@ -0,0 +1,420 @@ +/* -*- 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 (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 "nsContainerFrame.h" +#include "nsIDOMSVGGElement.h" +#include "nsIPresContext.h" +#include "nsISVGFrame.h" +#include "nsSVGRenderingContext.h" +#include "nsWeakReference.h" +#include "nsISVGValue.h" +#include "nsISVGValueObserver.h" +#include "nsIDOMSVGTransformable.h" +#include "nsIDOMSVGAnimTransformList.h" + +typedef nsContainerFrame nsSVGGFrameBase; + +class nsSVGGFrame : public nsSVGGFrameBase, + public nsISVGFrame, + public nsISVGValueObserver, + public nsSupportsWeakReference +{ + friend nsresult + NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +protected: + nsSVGGFrame(); + virtual ~nsSVGGFrame(); + nsresult Init(); + + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } +public: + // nsIFrame: + + NS_IMETHOD AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList); + NS_IMETHOD InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList); + NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame); + NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame); + NS_IMETHOD Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow); + + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + + // nsISVGFrame interface: + NS_IMETHOD Paint(nsSVGRenderingContext* renderingContext); + NS_IMETHOD InvalidateRegion(ArtUta* uta, PRBool bRedraw); + NS_IMETHOD GetFrameForPoint(float x, float y, nsIFrame** hit); + NS_IMETHOD NotifyCTMChanged(); + NS_IMETHOD NotifyRedrawSuspended(); + NS_IMETHOD NotifyRedrawUnsuspended(); + NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended); + +protected: +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr transformable = do_QueryInterface(aContent); + if (!transformable) { +#ifdef DEBUG + printf("warning: trying to construct an SVGGFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGGFrame* it = new (aPresShell) nsSVGGFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + + return NS_OK; +} + +nsSVGGFrame::nsSVGGFrame() +{ +} + +nsSVGGFrame::~nsSVGGFrame() +{ + nsCOMPtr transformable = do_QueryInterface(mContent); + NS_ASSERTION(transformable, "wrong content element"); + nsCOMPtr transforms; + transformable->GetTransform(getter_AddRefs(transforms)); + nsCOMPtr value = do_QueryInterface(transforms); + NS_ASSERTION(value, "interface not found"); + if (value) + value->RemoveObserver(this); +} + +nsresult nsSVGGFrame::Init() +{ + nsCOMPtr transformable = do_QueryInterface(mContent); + NS_ASSERTION(transformable, "wrong content element"); + nsCOMPtr transforms; + transformable->GetTransform(getter_AddRefs(transforms)); + nsCOMPtr value = do_QueryInterface(transforms); + NS_ASSERTION(value, "interface not found"); + if (value) + value->AddObserver(this); + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_INTERFACE_MAP_BEGIN(nsSVGGFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGFrame) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) +NS_INTERFACE_MAP_END_INHERITING(nsSVGGFrameBase) + + +//---------------------------------------------------------------------- +// nsIFrame methods +NS_IMETHODIMP +nsSVGGFrame::Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv; + rv = nsSVGGFrameBase::Init(aPresContext, aContent, aParent, + aContext, aPrevInFlow); + + Init(); + + return rv; +} + +NS_IMETHODIMP +nsSVGGFrame::AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList) +{ + nsresult rv = NS_OK; + + // Insert the new frames + mFrames.AppendFrames(this, aFrameList); + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); //XXX use different function + } + kid->GetNextSibling(&kid); + } + + return rv; +} + +NS_IMETHODIMP +nsSVGGFrame::InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList) +{ + nsresult rv = NS_OK; + + // Insert the new frames +#ifdef NS_DEBUG + nsFrame::VerifyDirtyBitSet(aFrameList); +#endif + mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList); + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); //XXX use different function + } + kid->GetNextSibling(&kid); + } + + return rv; +} + +NS_IMETHODIMP +nsSVGGFrame::RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame) +{ + PRBool result = mFrames.DestroyFrame(aPresContext, aOldFrame); + NS_ASSERTION(result, "didn't find frame to delete"); + // Because positioned frames aren't part of a flow, there's no + // additional work to do, e.g. reflowing sibling frames. And because + // positioned frames have a view, we don't need to repaint + return result ? NS_OK : NS_ERROR_FAILURE; + +} + +NS_IMETHODIMP +nsSVGGFrame::ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods: + +NS_IMETHODIMP +nsSVGGFrame::WillModifySVGObservable(nsISVGValue* observable) +{ + return NS_OK; +} + + +NS_IMETHODIMP +nsSVGGFrame::DidModifySVGObservable (nsISVGValue* observable) +{ + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) + SVGFrame->NotifyCTMChanged(); + kid->GetNextSibling(&kid); + } + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGFrame methods + +NS_IMETHODIMP +nsSVGGFrame::Paint(nsSVGRenderingContext* renderingContext) +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) + SVGFrame->Paint(renderingContext); + kid->GetNextSibling(&kid); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGFrame::InvalidateRegion(ArtUta* uta, PRBool bRedraw) +{ + if (!uta && !bRedraw) return NS_OK; + + if (!mParent) { + if (uta) + art_uta_free(uta); + return NS_OK; + } + + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + if (!SVGFrame) { + if (uta) + art_uta_free(uta); + return NS_OK; + } + + return SVGFrame->InvalidateRegion(uta, bRedraw); +} + +NS_IMETHODIMP +nsSVGGFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) +{ + *hit = nsnull; + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + nsIFrame* temp=nsnull; + nsresult rv = SVGFrame->GetFrameForPoint(x, y, &temp); + if (NS_SUCCEEDED(rv) && temp) { + *hit = temp; + // return NS_OK; can't return. we need reverse order but only + // have a singly linked list... + } + } + kid->GetNextSibling(&kid); + } + + return *hit ? NS_OK : NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsSVGGFrame::NotifyCTMChanged() +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); + } + kid->GetNextSibling(&kid); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGFrame::NotifyRedrawSuspended() +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyRedrawSuspended(); + } + kid->GetNextSibling(&kid); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGFrame::NotifyRedrawUnsuspended() +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyRedrawUnsuspended(); + } + kid->GetNextSibling(&kid); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGFrame::IsRedrawSuspended(PRBool* isSuspended) +{ + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + if (!SVGFrame) { + *isSuspended = PR_FALSE; + return NS_OK; + } + + return SVGFrame->IsRedrawSuspended(isSuspended); +} + diff --git a/layout/svg/base/src/nsSVGGenericContainerFrame.cpp b/layout/svg/base/src/nsSVGGenericContainerFrame.cpp new file mode 100644 index 000000000000..9e875fea7349 --- /dev/null +++ b/layout/svg/base/src/nsSVGGenericContainerFrame.cpp @@ -0,0 +1,428 @@ +/* -*- 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 (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 "nsContainerFrame.h" +#include "nsIDOMSVGGElement.h" +#include "nsIPresContext.h" +#include "nsISVGFrame.h" +#include "nsSVGRenderingContext.h" +#include "nsWeakReference.h" +#include "nsISVGValue.h" +#include "nsISVGValueObserver.h" + +typedef nsContainerFrame nsSVGGenericContainerFrameBase; + +class nsSVGGenericContainerFrame : public nsSVGGenericContainerFrameBase, + public nsISVGFrame, + public nsISVGValueObserver, + public nsSupportsWeakReference + +{ + friend nsresult + NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +protected: + nsSVGGenericContainerFrame(); + virtual ~nsSVGGenericContainerFrame(); + nsresult Init(); + + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } +public: + // nsIFrame: + + NS_IMETHOD AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList); + NS_IMETHOD InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList); + NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame); + NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame); + NS_IMETHOD Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow); + + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + + // nsISVGFrame interface: + NS_IMETHOD Paint(nsSVGRenderingContext* renderingContext); + NS_IMETHOD InvalidateRegion(ArtUta* uta, PRBool bRedraw); + NS_IMETHOD GetFrameForPoint(float x, float y, nsIFrame** hit); + NS_IMETHOD NotifyCTMChanged(); + NS_IMETHOD NotifyRedrawSuspended(); + NS_IMETHOD NotifyRedrawUnsuspended(); + NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended); + +protected: +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + nsSVGGenericContainerFrame* it = new (aPresShell) nsSVGGenericContainerFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + + return NS_OK; +} + +nsSVGGenericContainerFrame::nsSVGGenericContainerFrame() +{ +#ifdef DEBUG +// printf("nsSVGGenericContainerFrame CTOR\n"); +#endif +} + +nsSVGGenericContainerFrame::~nsSVGGenericContainerFrame() +{ +#ifdef DEBUG +// printf("~nsSVGGenericContainerFrame\n"); +#endif +} + +nsresult nsSVGGenericContainerFrame::Init() +{ + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_INTERFACE_MAP_BEGIN(nsSVGGenericContainerFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGFrame) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) +NS_INTERFACE_MAP_END_INHERITING(nsSVGGenericContainerFrameBase) + + +//---------------------------------------------------------------------- +// nsIFrame methods +NS_IMETHODIMP +nsSVGGenericContainerFrame::Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv; + rv = nsSVGGenericContainerFrameBase::Init(aPresContext, aContent, aParent, + aContext, aPrevInFlow); + + Init(); + + return rv; +} + + +NS_IMETHODIMP +nsSVGGenericContainerFrame::AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList) +{ + nsresult rv = NS_OK; + + // Insert the new frames + mFrames.AppendFrames(this, aFrameList); + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); //XXX use different function + } + kid->GetNextSibling(&kid); + } + + return rv; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList) +{ + nsresult rv = NS_OK; + + // Insert the new frames +#ifdef NS_DEBUG + nsFrame::VerifyDirtyBitSet(aFrameList); +#endif + mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList); + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); //XXX use different function + } + kid->GetNextSibling(&kid); + } + + return rv; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame) +{ + PRBool result = mFrames.DestroyFrame(aPresContext, aOldFrame); + NS_ASSERTION(result, "didn't find frame to delete"); + // Because positioned frames aren't part of a flow, there's no + // additional work to do, e.g. reflowing sibling frames. And because + // positioned frames have a view, we don't need to repaint + return result ? NS_OK : NS_ERROR_FAILURE; + +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint) +{ +#ifdef DEBUG + printf("** nsSVGGenericContainerFrame::AttributeChanged("); + nsAutoString str; + aAttribute->ToString(str); + nsCAutoString cstr; + cstr.AssignWithConversion(str); + printf(cstr.get()); + printf(", hint:%d)\n",aHint); +#endif + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods: + +NS_IMETHODIMP +nsSVGGenericContainerFrame::WillModifySVGObservable(nsISVGValue* observable) +{ + return NS_OK; +} + + +NS_IMETHODIMP +nsSVGGenericContainerFrame::DidModifySVGObservable(nsISVGValue* observable) +{ + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) + SVGFrame->NotifyCTMChanged(); + kid->GetNextSibling(&kid); + } + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGFrame methods + +NS_IMETHODIMP +nsSVGGenericContainerFrame::Paint(nsSVGRenderingContext* renderingContext) +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) + SVGFrame->Paint(renderingContext); + kid->GetNextSibling(&kid); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::InvalidateRegion(ArtUta* uta, PRBool bRedraw) +{ + if (!uta && !bRedraw) return NS_OK; + + if (!mParent) { + if (uta) + art_uta_free(uta); + return NS_OK; + } + + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + if (!SVGFrame) { + if (uta) + art_uta_free(uta); + return NS_OK; + } + + return SVGFrame->InvalidateRegion(uta, bRedraw); +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) +{ + *hit = nsnull; + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + nsIFrame* temp=nsnull; + nsresult rv = SVGFrame->GetFrameForPoint(x, y, &temp); + if (NS_SUCCEEDED(rv) && temp) { + *hit = temp; + // return NS_OK; can't return. we need reverse order but only + // have a singly linked list... + } + } + kid->GetNextSibling(&kid); + } + + return *hit ? NS_OK : NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::NotifyCTMChanged() +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); + } + kid->GetNextSibling(&kid); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::NotifyRedrawSuspended() +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyRedrawSuspended(); + } + kid->GetNextSibling(&kid); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::NotifyRedrawUnsuspended() +{ + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyRedrawUnsuspended(); + } + kid->GetNextSibling(&kid); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGenericContainerFrame::IsRedrawSuspended(PRBool* isSuspended) +{ + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + if (!SVGFrame) { + *isSuspended = PR_FALSE; + return NS_OK; + } + + return SVGFrame->IsRedrawSuspended(isSuspended); +} + diff --git a/layout/svg/base/src/nsSVGGraphic.cpp b/layout/svg/base/src/nsSVGGraphic.cpp new file mode 100644 index 000000000000..5f5243ebc401 --- /dev/null +++ b/layout/svg/base/src/nsSVGGraphic.cpp @@ -0,0 +1,255 @@ +/* -*- 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 (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 "nsSVGGraphic.h" +#include "nsSVGRenderingContext.h" +#include "nsSVGBPathBuilder.h" +#include "nsIDOMSVGMatrix.h" +#include "nsCOMPtr.h" +#include "nsASVGGraphicSource.h" +#include "nsStyleStruct.h" +#include "nsIServiceManager.h" +#include "nsIPref.h" +#include "prdtoa.h" + +nsSVGGraphic::nsSVGGraphic() + : mVPath(nsnull), mExpansion(1.0) +{ + +} + +nsSVGGraphic::~nsSVGGraphic() +{ + if (mVPath != nsnull) + art_free(mVPath); +} + +void +nsSVGGraphic::Paint(nsSVGRenderingContext* ctx) +{ + if (!mFill.IsEmpty()) { + ctx->PaintSVGRenderItem(&mFill); + } + + if (!mStroke.IsEmpty()) + ctx->PaintSVGRenderItem(&mStroke); +} + +PRBool +nsSVGGraphic::IsMouseHit(float x, float y) +{ + return (mFill.Contains(x,y) || mStroke.Contains(x,y)); +} + +ArtUta* +nsSVGGraphic::Update(nsSVGGraphicUpdateFlags flags, nsASVGGraphicSource* source) +{ + ArtUta* dirtyRegion = nsnull; + + if ((flags & NS_SVGGRAPHIC_UPDATE_FLAGS_PATHCHANGE) != 0 || + (flags & NS_SVGGRAPHIC_UPDATE_FLAGS_CTMCHANGE ) != 0 || + !mVPath ) { + // 1. get a Bezier path from the graphic source: + ArtBpath* bpath; + { + nsSVGBPathBuilder BPathBuilder; + source->ConstructPath(&BPathBuilder); + bpath = BPathBuilder.GetBPath(); + } + + // 2. transform the bpath into global coords: + { + nsCOMPtr ctm; + source->GetCTM(getter_AddRefs(ctm)); + NS_ASSERTION(ctm, "graphic source didn't have a ctm"); + + double matrix[6]; + float val; + ctm->GetA(&val); + matrix[0] = val; + + ctm->GetB(&val); + matrix[1] = val; + + ctm->GetC(&val); + matrix[2] = val; + + ctm->GetD(&val); + matrix[3] = val; + + ctm->GetE(&val); + matrix[4] = val; + + ctm->GetF(&val); + matrix[5] = val; + + // cache the expansion factor. we use it to scale the stroke + // width: + mExpansion = sqrt((float)fabs(matrix[0]*matrix[3]-matrix[2]*matrix[1])); + + if ( bpath && + ( matrix[0] != 1.0 || matrix[2] != 0.0 || matrix[4] != 0.0 || + matrix[1] != 0.0 || matrix[3] != 1.0 || matrix[5] != 0.0 )) + { + ArtBpath* temp = bpath; + bpath = art_bpath_affine_transform(bpath, matrix); + art_free(temp); + } + } + + // 3. convert the bpath into a vpath and cache it: + if (mVPath != nsnull) { + art_free(mVPath); + mVPath = nsnull; + } + if (bpath != nsnull) + mVPath = art_bez_path_to_vec(bpath, GetBezierFlatness()); + + art_free(bpath); + } + + // update stroke and fill: + + if (!mVPath) { + AccumulateUta(&dirtyRegion, mStroke.GetUta()); + AccumulateUta(&dirtyRegion, mFill.GetUta()); + mStroke.Clear(); + mFill.Clear(); + return dirtyRegion; + } + + const nsStyleSVG* svgStyle = source->GetStyle(); + + if (!mStroke.IsEmpty()) { + AccumulateUta(&dirtyRegion, mStroke.GetUta()); + } + + if (svgStyle->mStroke.mType == eStyleSVGPaintType_Color && + svgStyle->mStrokeWidth > 0 && + mExpansion > 0) { + nsSVGStrokeStyle strokeStyle; + strokeStyle.dasharray = svgStyle->mStrokeDasharray; + strokeStyle.dashoffset = svgStyle->mStrokeDashoffset; + strokeStyle.linecap = svgStyle->mStrokeLinecap; + strokeStyle.linejoin = svgStyle->mStrokeLinejoin; + strokeStyle.miterlimit = svgStyle->mStrokeMiterlimit; + strokeStyle.width = svgStyle->mStrokeWidth * mExpansion; + + mStroke.SetColor(svgStyle->mStroke.mColor); + mStroke.SetOpacity(svgStyle->mStrokeOpacity); + + mStroke.Build(mVPath, strokeStyle); + AccumulateUta(&dirtyRegion, mStroke.GetUta()); + } + else { + mStroke.Clear(); + } + + if (!mFill.IsEmpty()) { + AccumulateUta(&dirtyRegion, mFill.GetUta()); + } + + if (svgStyle->mFill.mType == eStyleSVGPaintType_Color) { + nsSVGFillStyle fillStyle; + fillStyle.fillrule = svgStyle->mFillRule; + + mFill.SetColor(svgStyle->mFill.mColor); + mFill.SetOpacity(svgStyle->mFillOpacity); + + mFill.Build(mVPath, fillStyle); + AccumulateUta(&dirtyRegion, mFill.GetUta()); + } + else { + mFill.Clear(); + } + + return dirtyRegion; +} + +ArtUta* +nsSVGGraphic::GetUta() +{ + ArtUta* uta=nsnull; + AccumulateUta(&uta, mStroke.GetUta()); + AccumulateUta(&uta, mFill.GetUta()); + return uta; +} + + + +// helpers + +void nsSVGGraphic::AccumulateUta(ArtUta** accu, ArtUta* uta) +{ + if (uta == nsnull) return; + + if (*accu == nsnull) { + *accu = uta; + return ; + } + + ArtUta* temp = *accu; + *accu = art_uta_union(*accu, uta); + art_uta_free(temp); + art_uta_free(uta); +} + +double nsSVGGraphic::GetBezierFlatness() +{ +// comment from art_vpath_path.c: The Adobe PostScript reference +// manual defines flatness as the maximum deviation between the any +// point on the vpath approximation and the corresponding point on the +// "true" curve, and we follow this definition here. A value of 0.25 +// should ensure high quality for aa rendering. + + double flatness = 0.5; + + nsCOMPtr prefs(do_GetService(NS_PREF_CONTRACTID)); + if (!prefs) return flatness; + + // XXX: wouldn't it be great if nsIPref had a 'GetFloatPref()'-function? + char *valuestr = nsnull; + if (NS_SUCCEEDED(prefs->CopyCharPref("svg.bezier_flatness",&valuestr)) && (valuestr)) { + flatness = PR_strtod(valuestr, nsnull); + nsMemory::Free(valuestr); + } + + return flatness; +} + + diff --git a/layout/svg/base/src/nsSVGGraphic.h b/layout/svg/base/src/nsSVGGraphic.h new file mode 100644 index 000000000000..beea09b6d6cd --- /dev/null +++ b/layout/svg/base/src/nsSVGGraphic.h @@ -0,0 +1,85 @@ +/* -*- 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 (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_SVGGRAPHIC_H__ +#define __NS_SVGGRAPHIC_H__ + +#include "prtypes.h" +#include "libart-incs.h" +#include "nsSVGStroke.h" +#include "nsSVGFill.h" + +class nsSVGRenderingContext; +class nsASVGGraphicSource; + +//---------------------------------------------------------------------- + +typedef PRUint32 nsSVGGraphicUpdateFlags; + +#define NS_SVGGRAPHIC_UPDATE_FLAGS_PATHCHANGE 0x0001 +#define NS_SVGGRAPHIC_UPDATE_FLAGS_STYLECHANGE 0x0002 +#define NS_SVGGRAPHIC_UPDATE_FLAGS_CTMCHANGE 0x0004 + +//---------------------------------------------------------------------- + +class nsSVGGraphic +{ +public: + nsSVGGraphic(); + ~nsSVGGraphic(); + + void Paint(nsSVGRenderingContext* ctx); + PRBool IsMouseHit(float x, float y); + ArtUta* Update(nsSVGGraphicUpdateFlags flags, nsASVGGraphicSource* source); // returns dirty area + ArtUta* GetUta(); // calculates micro-tile array of whole area + +protected: + // helpers + static void AccumulateUta(ArtUta** accu, ArtUta* uta); + static double GetBezierFlatness(); + + // rendering items: + nsSVGStroke mStroke; + nsSVGFill mFill; + + // cached intermediate data: + ArtVpath* mVPath; + float mExpansion; +}; + +#endif // __NS_SVGGRAPHIC_H__ diff --git a/layout/svg/base/src/nsSVGGraphicFrame.cpp b/layout/svg/base/src/nsSVGGraphicFrame.cpp new file mode 100644 index 000000000000..4d9e329d7e41 --- /dev/null +++ b/layout/svg/base/src/nsSVGGraphicFrame.cpp @@ -0,0 +1,309 @@ +/* -*- 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 (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 "nsSVGGraphicFrame.h" +#include "nsIPresContext.h" +#include "nsISVGFrame.h" +#include "nsSVGRenderingContext.h" +#include "nsSVGAtoms.h" +#include "nsIDOMSVGTransformable.h" +#include "nsIDOMSVGAnimTransformList.h" +#include "nsIDOMSVGMatrix.h" +#include "nsIDOMSVGElement.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsIDOMSVGPoint.h" + +//////////////////////////////////////////////////////////////////////// +// nsSVGGraphicFrame + +nsSVGGraphicFrame::nsSVGGraphicFrame() + : mUpdateFlags(0) +{ +#ifdef DEBUG +// printf("nsSVGGraphicFrame %p CTOR\n", this); +#endif +} + +nsSVGGraphicFrame::~nsSVGGraphicFrame() +{ + nsCOMPtr transformable = do_QueryInterface(mContent); + NS_ASSERTION(transformable, "wrong content element"); + nsCOMPtr transforms; + transformable->GetTransform(getter_AddRefs(transforms)); + nsCOMPtr value = do_QueryInterface(transforms); + NS_ASSERTION(transformable, "interface not found"); + if (value) + value->RemoveObserver(this); + +#ifdef DEBUG +// printf("~nsSVGGraphicFrame %p\n", this); +#endif +} + + + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_INTERFACE_MAP_BEGIN(nsSVGGraphicFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGFrame) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) +NS_INTERFACE_MAP_END_INHERITING(nsSVGGraphicFrameBase) + +//---------------------------------------------------------------------- +// nsIFrame methods +NS_IMETHODIMP +nsSVGGraphicFrame::Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv; +// rv = nsSVGGraphicFrameBase::Init(aPresContext, aContent, aParent, +// aContext, aPrevInFlow); + + mContent = aContent; + NS_IF_ADDREF(mContent); + mParent = aParent; + + Init(); + + rv = SetStyleContext(aPresContext, aContext); + + return rv; +} + +NS_IMETHODIMP +nsSVGGraphicFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint) +{ + // we don't use this notification mechanism + +#ifdef DEBUG +// printf("** nsSVGGraphicFrame::AttributeChanged("); +// nsAutoString str; +// aAttribute->ToString(str); +// nsCAutoString cstr; +// cstr.AssignWithConversion(str); +// printf(cstr.get()); +// printf(")\n"); +#endif + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGraphicFrame::DidSetStyleContext(nsIPresContext* aPresContext) +{ + // XXX: we'd like to use the style_hint mechanism and the + // ContentStateChanged/AttributeChanged functions for style changes + // to get slightly finer granularity, but unfortunately the + // style_hints don't map very well onto svg. Here seems to be the + // best place to deal with style changes: + + UpdateGraphic(NS_SVGGRAPHIC_UPDATE_FLAGS_STYLECHANGE); + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods: + +NS_IMETHODIMP +nsSVGGraphicFrame::WillModifySVGObservable(nsISVGValue* observable) +{ + return NS_OK; +} + + +NS_IMETHODIMP +nsSVGGraphicFrame::DidModifySVGObservable (nsISVGValue* observable) +{ + // the observables we're listening in on affect the path by default. + // We can specialize in the subclasses when needed. + + UpdateGraphic(NS_SVGGRAPHIC_UPDATE_FLAGS_PATHCHANGE); + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGFrame methods + +NS_IMETHODIMP +nsSVGGraphicFrame::Paint(nsSVGRenderingContext* renderingContext) +{ + mGraphic.Paint(renderingContext); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGraphicFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) +{ + *hit = nsnull; + if (mGraphic.IsMouseHit(x, y)) { + *hit = this; + } + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGraphicFrame::NotifyCTMChanged() +{ + UpdateGraphic(NS_SVGGRAPHIC_UPDATE_FLAGS_CTMCHANGE); + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGraphicFrame::NotifyRedrawSuspended() +{ + // XXX should we cache the fact that redraw is suspended? + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGraphicFrame::NotifyRedrawUnsuspended() +{ + if (mUpdateFlags != 0) { + ArtUta* uta = nsnull; + uta = mGraphic.Update(mUpdateFlags, this); + if (uta) + InvalidateRegion(uta, PR_TRUE); + mUpdateFlags = 0; + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGGraphicFrame::IsRedrawSuspended(PRBool* isSuspended) +{ + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + if (!SVGFrame) { + NS_ASSERTION(SVGFrame, "no parent frame"); + *isSuspended = PR_FALSE; + return NS_OK; + } + + return SVGFrame->IsRedrawSuspended(isSuspended); +} + +NS_IMETHODIMP +nsSVGGraphicFrame::InvalidateRegion(ArtUta* uta, PRBool bRedraw) +{ + if (!uta && !bRedraw) return NS_OK; + + NS_ASSERTION(mParent, "need parent to invalidate!"); + if (!mParent) { + if (uta) + art_uta_free(uta); + return NS_OK; + } + + nsCOMPtr SVGFrame = do_QueryInterface(mParent); + NS_ASSERTION(SVGFrame, "wrong frame type!"); + if (!SVGFrame) { + if (uta) + art_uta_free(uta); + return NS_OK; + } + + return SVGFrame->InvalidateRegion(uta, bRedraw); +} + +//---------------------------------------------------------------------- +// nsASVGGraphicSource methods: + +void nsSVGGraphicFrame::GetCTM(nsIDOMSVGMatrix** ctm) +{ + *ctm = nsnull; + + nsCOMPtr transformable = do_QueryInterface(mContent); + NS_ASSERTION(transformable, "wrong content type"); + + transformable->GetCTM(ctm); +} + + +const nsStyleSVG* nsSVGGraphicFrame::GetStyle() +{ + return (const nsStyleSVG*) mStyleContext->GetStyleData(eStyleStruct_SVG); +} + + +//---------------------------------------------------------------------- +// + +nsresult nsSVGGraphicFrame::Init() +{ + nsCOMPtr transformable = do_QueryInterface(mContent); + NS_ASSERTION(transformable, "wrong content element"); + nsCOMPtr transforms; + transformable->GetTransform(getter_AddRefs(transforms)); + nsCOMPtr value = do_QueryInterface(transforms); + NS_ASSERTION(transformable, "interface not found"); + if (value) + value->AddObserver(this); + + return NS_OK; +} + +void nsSVGGraphicFrame::UpdateGraphic(nsSVGGraphicUpdateFlags flags) +{ + mUpdateFlags |= flags; + + PRBool suspended; + IsRedrawSuspended(&suspended); + if (!suspended) { + ArtUta* uta = nsnull; + uta = mGraphic.Update(mUpdateFlags, this); + if (uta) + InvalidateRegion(uta, PR_TRUE); + mUpdateFlags = 0; + } +} + diff --git a/layout/svg/base/src/nsSVGGraphicFrame.h b/layout/svg/base/src/nsSVGGraphicFrame.h new file mode 100644 index 000000000000..4300eb185157 --- /dev/null +++ b/layout/svg/base/src/nsSVGGraphicFrame.h @@ -0,0 +1,124 @@ +/* -*- 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 (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_SVGGRAPHICFRAME_H__ +#define __NS_SVGGRAPHICFRAME_H__ + +#include "nsFrame.h" +#include "nsISVGFrame.h" +#include "nsWeakReference.h" +#include "nsISVGValue.h" +#include "nsISVGValueObserver.h" +#include "nsASVGGraphicSource.h" +#include "nsSVGGraphic.h" +#include "libart-incs.h" + +class nsIPresContext; +class nsSVGRenderingContext; +class nsIDOMSVGMatrix; + +typedef nsFrame nsSVGGraphicFrameBase; + +class nsSVGGraphicFrame : public nsSVGGraphicFrameBase, + public nsISVGFrame, + public nsISVGValueObserver, + public nsSupportsWeakReference, + public nsASVGGraphicSource +{ +protected: + nsSVGGraphicFrame(); + virtual ~nsSVGGraphicFrame(); + +public: + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } +public: + + // nsIFrame interface: + NS_IMETHOD + Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow); + + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint); + + NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext); + + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + + // nsISVGFrame interface: + NS_IMETHOD Paint(nsSVGRenderingContext* renderingContext); + NS_IMETHOD GetFrameForPoint(float x, float y, nsIFrame** hit); + NS_IMETHOD NotifyCTMChanged(); + NS_IMETHOD NotifyRedrawSuspended(); + NS_IMETHOD NotifyRedrawUnsuspended(); + NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended); + NS_IMETHOD InvalidateRegion(ArtUta* uta, PRBool bRedraw); + + // nsASVGGraphicSource methods: + virtual void GetCTM(nsIDOMSVGMatrix** ctm); + virtual const nsStyleSVG* GetStyle(); + // to be implemented by subclass: + //virtual void ConstructPath(nsASVGPathBuilder* pathBuilder)=0; + +protected: + virtual nsresult Init(); + void UpdateGraphic(nsSVGGraphicUpdateFlags flags); + +private: + nsSVGGraphicUpdateFlags mUpdateFlags; + nsSVGGraphic mGraphic; +}; + +#endif // __NS_SVGGRAPHICFRAME_H__ diff --git a/layout/svg/base/src/nsSVGLineFrame.cpp b/layout/svg/base/src/nsSVGLineFrame.cpp new file mode 100644 index 000000000000..28d2b2f5cc7e --- /dev/null +++ b/layout/svg/base/src/nsSVGLineFrame.cpp @@ -0,0 +1,172 @@ +/* -*- 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 (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 "nsSVGGraphicFrame.h" +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGLength.h" +#include "nsIDOMSVGPoint.h" +#include "nsIDOMSVGLineElement.h" +#include "nsIDOMSVGElement.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsASVGPathBuilder.h" + +class nsSVGLineFrame : public nsSVGGraphicFrame +{ + friend nsresult + NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + + virtual ~nsSVGLineFrame(); + + virtual nsresult Init(); + virtual void ConstructPath(nsASVGPathBuilder* pathBuilder); + virtual const nsStyleSVG* GetStyle(); + + nsCOMPtr mX1; + nsCOMPtr mY1; + nsCOMPtr mX2; + nsCOMPtr mY2; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr line = do_QueryInterface(aContent); + if (!line) { +#ifdef DEBUG + printf("warning: trying to construct an SVGLineFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGLineFrame* it = new (aPresShell) nsSVGLineFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + return NS_OK; +} + +nsSVGLineFrame::~nsSVGLineFrame() +{ + nsCOMPtr value; + if (mX1 && (value = do_QueryInterface(mX1))) + value->RemoveObserver(this); + if (mY1 && (value = do_QueryInterface(mY1))) + value->RemoveObserver(this); + if (mX2 && (value = do_QueryInterface(mX2))) + value->RemoveObserver(this); + if (mY2 && (value = do_QueryInterface(mY2))) + value->RemoveObserver(this); +} + +nsresult nsSVGLineFrame::Init() +{ + nsCOMPtr line = do_QueryInterface(mContent); + NS_ASSERTION(line,"wrong content element"); + + { + nsCOMPtr length; + line->GetX1(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mX1)); + NS_ASSERTION(mX1, "no x1"); + if (!mX1) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mX1); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + line->GetY1(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mY1)); + NS_ASSERTION(mY1, "no y1"); + if (!mY1) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mY1); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + line->GetX2(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mX2)); + NS_ASSERTION(mX2, "no x2"); + if (!mX2) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mX2); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + line->GetY2(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mY2)); + NS_ASSERTION(mY2, "no y2"); + if (!mY2) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mY2); + if (value) + value->AddObserver(this); + } + + return nsSVGGraphicFrame::Init(); +} + +void nsSVGLineFrame::ConstructPath(nsASVGPathBuilder* pathBuilder) +{ + float x1,y1,x2,y2; + + mX1->GetValue(&x1); + mY1->GetValue(&y1); + mX2->GetValue(&x2); + mY2->GetValue(&y2); + + // move to start coordinates then draw line to end coordinates + pathBuilder->Moveto(x1, y1); + pathBuilder->Lineto(x2, y2); +} + +const nsStyleSVG* nsSVGLineFrame::GetStyle() +{ + // XXX TODO: strip out any fill color as per svg specs + return nsSVGGraphicFrame::GetStyle(); +} diff --git a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp new file mode 100644 index 000000000000..d3cebb58eaa7 --- /dev/null +++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -0,0 +1,1060 @@ +/* -*- 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 (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 "nsHTMLContainerFrame.h" +#include "nsContainerFrame.h" +#include "nsCSSRendering.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsIPresContext.h" +#include "nsIDOMSVGRect.h" +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGLength.h" +#include "nsISVGFrame.h" +#include "nsSVGRenderingContext.h" +#include "nsIView.h" +#include "nsIViewManager.h" +#include "nsWeakReference.h" +#include "nsISVGValue.h" +#include "nsISVGValueObserver.h" +#include "nsHTMLParts.h" + +//typedef nsHTMLContainerFrame nsSVGOuterSVGFrameBase; +typedef nsContainerFrame nsSVGOuterSVGFrameBase; + +class nsSVGOuterSVGFrame : public nsSVGOuterSVGFrameBase, + public nsISVGFrame, + public nsISVGValueObserver, + public nsSupportsWeakReference +{ + friend nsresult + NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +protected: + nsSVGOuterSVGFrame(); + virtual ~nsSVGOuterSVGFrame(); + nsresult Init(); + + // nsISupports interface: + NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: + NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } + NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } +public: + // nsIFrame: + NS_IMETHOD Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow); + + NS_IMETHOD Reflow(nsIPresContext* aPresContext, + nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aReflowState, + nsReflowStatus& aStatus); + + NS_IMETHOD DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus); + + + NS_IMETHOD AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList); + NS_IMETHOD InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList); + NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame); + NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame); + + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint); + +// NS_IMETHOD SetView(nsIPresContext* aPresContext, nsIView* aView); + + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer, + nsIFrame** aFrame); + + + NS_IMETHOD Paint(nsIPresContext* aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + PRUint32 aFlags = 0); + + // nsISVGValueObserver + NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable); + NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable); + + // nsISupportsWeakReference + // implementation inherited from nsSupportsWeakReference + + // nsISVGFrame interface: + NS_IMETHOD Paint(nsSVGRenderingContext* renderingContext); + NS_IMETHOD InvalidateRegion(ArtUta* uta, PRBool bRedraw); + NS_IMETHOD GetFrameForPoint(float x, float y, nsIFrame** hit); + NS_IMETHOD NotifyCTMChanged(); + + NS_IMETHOD NotifyRedrawSuspended(); + NS_IMETHOD NotifyRedrawUnsuspended(); + NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended); + +protected: + // implementation helpers: + void InitiateReflow(); + + float GetPxPerTwips(); + float GetTwipsPerPx(); + + +// nsIView* mView; + nsIPresShell* mPresShell; // XXX is a non-owning ref ok? + PRBool mRedrawSuspended; + PRBool mNeedsReflow; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr svgElement = do_QueryInterface(aContent); + if (!svgElement) { +#ifdef DEBUG + printf("warning: trying to construct an SVGOuterSVGFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGOuterSVGFrame* it = new (aPresShell) nsSVGOuterSVGFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + + // XXX is this ok? + it->mPresShell = aPresShell; + + return NS_OK; +} + +nsSVGOuterSVGFrame::nsSVGOuterSVGFrame() + : mRedrawSuspended(PR_FALSE), + mNeedsReflow(PR_FALSE) +{ +} + +nsSVGOuterSVGFrame::~nsSVGOuterSVGFrame() +{ +#ifdef DEBUG +// printf("~nsSVGOuterSVGFrame %p\n", this); +#endif + + nsCOMPtr svgElement = do_QueryInterface(mContent); + NS_ASSERTION(svgElement, "wrong content element"); + + { + nsCOMPtr animLength; + svgElement->GetWidth(getter_AddRefs(animLength)); + NS_ASSERTION(animLength, "null length object"); + nsCOMPtr length; + animLength->GetAnimVal(getter_AddRefs(length)); + NS_ASSERTION(length, "null length object"); + nsCOMPtr value = do_QueryInterface(length); + if (value) + value->RemoveObserver(this); + } + + { + nsCOMPtr animLength; + svgElement->GetHeight(getter_AddRefs(animLength)); + NS_ASSERTION(animLength, "null length object"); + nsCOMPtr length; + animLength->GetAnimVal(getter_AddRefs(length)); + NS_ASSERTION(length, "null length object"); + nsCOMPtr value = do_QueryInterface(length); + if (value) + value->RemoveObserver(this); + } +} + +nsresult nsSVGOuterSVGFrame::Init() +{ + nsCOMPtr svgElement = do_QueryInterface(mContent); + NS_ASSERTION(svgElement, "wrong content element"); + + { + nsCOMPtr animLength; + svgElement->GetWidth(getter_AddRefs(animLength)); + NS_ENSURE_TRUE(animLength, NS_ERROR_FAILURE); + nsCOMPtr length; + animLength->GetAnimVal(getter_AddRefs(length)); + NS_ENSURE_TRUE(length, NS_ERROR_FAILURE); + nsCOMPtr value = do_QueryInterface(length); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr animLength; + svgElement->GetHeight(getter_AddRefs(animLength)); + NS_ENSURE_TRUE(animLength, NS_ERROR_FAILURE); + nsCOMPtr length; + animLength->GetAnimVal(getter_AddRefs(length)); + NS_ENSURE_TRUE(length, NS_ERROR_FAILURE); + nsCOMPtr value = do_QueryInterface(length); + if (value) + value->AddObserver(this); + } + + return NS_OK; +} + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_INTERFACE_MAP_BEGIN(nsSVGOuterSVGFrame) + NS_INTERFACE_MAP_ENTRY(nsISVGFrame) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver) +NS_INTERFACE_MAP_END_INHERITING(nsSVGOuterSVGFrameBase) + +//---------------------------------------------------------------------- +// nsIFrame methods + +NS_IMETHODIMP +nsSVGOuterSVGFrame::Init(nsIPresContext* aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) +{ + nsresult rv; + rv = nsSVGOuterSVGFrameBase::Init(aPresContext, aContent, aParent, + aContext, aPrevInFlow); + + Init(); + + return rv; +} + + + +//---------------------------------------------------------------------- +// reflowing + +NS_IMETHODIMP +nsSVGOuterSVGFrame::Reflow(nsIPresContext* aPresContext, + nsHTMLReflowMetrics& aDesiredSize, + const nsHTMLReflowState& aReflowState, + nsReflowStatus& aStatus) +{ + // check whether this reflow request is targeted at us or a child + // frame (e.g. a foreignObject): + nsIFrame* target; + if (aReflowState.reflowCommand) { + aReflowState.reflowCommand->GetTarget(target); + if (target != this) { + nsIFrame* nextFrame; + // Get the next frame in the reflow chain + aReflowState.reflowCommand->GetNext(nextFrame); + + if (nextFrame != nsnull) + { + // The actual target of this reflow is one of our child + // frames. Since SVG as such doesn't use reflow, this will + // probably be the child of a . Some HTML|XUL + // content frames target reflow events at themselves when they + // need to be redrawn in response to e.g. a style change. For + // correct visual updating, we must make sure the reflow + // reaches its intended target. + + // Since it is an svg frame (probably an nsSVGForeignObjectFrame), + // we might as well pass in our aDesiredSize and aReflowState + // objects - they are ignored by svg frames: + nextFrame->Reflow (aPresContext, + aDesiredSize, + aReflowState, + aStatus); + + // XXX do we really have to return our metrics although we're + // not affected by the reflow? Is there a way of telling our + // parent that we don't want anything changed? + aDesiredSize.width = mRect.width; + aDesiredSize.height = mRect.height; + aDesiredSize.ascent = aDesiredSize.height; + aDesiredSize.descent = 0; + + aStatus = NS_FRAME_COMPLETE; + return NS_OK; + } + } + } + + // SVG CR 20001102: When the SVG content is embedded inline within + // a containing document, and that document is styled using CSS, + // then if there are CSS positioning properties specified on the + // outermost 'svg' element that are sufficient to establish the + // width of the viewport, then these positioning properties + // establish the viewport's width; otherwise, the width attribute + // on the outermost 'svg' element establishes the viewport's width. + // Similarly, if there are CSS positioning properties specified on + // the outermost 'svg' element that are sufficient to establish the + // height of the viewport, then these positioning properties + // establish the viewport's height; otherwise, the height attribute + // on the outermost 'svg' element establishes the viewport's + // height. +#ifdef DEBUG + // printf("--- nsSVGOuterSVGFrame(%p)::Reflow(frame:%p,reason:%d) ---\n",this,aReflowState.frame,aReflowState.reason); +#endif + + NS_ENSURE_TRUE(mContent, NS_ERROR_FAILURE); + + nsCOMPtr SVGElement = do_QueryInterface(mContent); + NS_ENSURE_TRUE(SVGElement, NS_ERROR_FAILURE); + + float pxPerTwips = GetPxPerTwips(); + float twipsPerPx = GetTwipsPerPx(); + + // Temporarily set the viewport to the available size in + // case percentage width/height attribs have been given: + nsCOMPtr viewport; + SVGElement->GetViewport(getter_AddRefs(viewport)); + NS_ENSURE_TRUE(viewport, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(aReflowState.parentReflowState, NS_ERROR_FAILURE); + viewport->SetWidth(aReflowState.parentReflowState->mComputedWidth * pxPerTwips); + if (aReflowState.parentReflowState->mComputedHeight != NS_UNCONSTRAINEDSIZE) + viewport->SetHeight(aReflowState.parentReflowState->mComputedHeight * pxPerTwips); + else + viewport->SetHeight(aReflowState.parentReflowState->mComputedWidth * pxPerTwips); + +#ifdef DEBUG + // some debug stuff: +// { +// nsRect r; +// aPresContext->GetVisibleArea(r); +// printf("******* aw: %d, ah: %d visiw: %d, visih: %d\n", +// aReflowState.availableWidth, +// aReflowState.availableHeight, +// r.width, r.height); +// printf("******* cw: %d, ch: %d \n cmaxw: %d, cmaxh: %d\n", +// aReflowState.mComputedWidth, +// aReflowState.mComputedHeight, +// aReflowState.mComputedMaxWidth, +// aReflowState.mComputedMaxHeight); + +// if (aReflowState.parentReflowState) { +// printf("******* parent aw: %d, parent ah: %d \n", +// aReflowState.parentReflowState->availableWidth, +// aReflowState.parentReflowState->availableHeight); +// printf("******* parent cw: %d, parent ch: %d \n parent cmaxw: %d, parent cmaxh: %d\n", +// aReflowState.parentReflowState->mComputedWidth, +// aReflowState.parentReflowState->mComputedHeight, +// aReflowState.parentReflowState->mComputedMaxWidth, +// aReflowState.parentReflowState->mComputedMaxHeight); +// } +// } +#endif + + // calculate width: +// if (aReflowState.mComputedWidth == NS_INTRINSICSIZE) + { + nsCOMPtr animLength; + SVGElement->GetWidth(getter_AddRefs(animLength)); + NS_ENSURE_TRUE(animLength, NS_ERROR_FAILURE); + nsCOMPtr length; + animLength->GetAnimVal(getter_AddRefs(length)); + NS_ENSURE_TRUE(length, NS_ERROR_FAILURE); + + float w; + length->GetValue(&w); +#ifdef DEBUG +// printf(" *intrinsic width:%f*\n",(double)w); +#endif + aDesiredSize.width = (int) (twipsPerPx * w); + } +// else { +// aDesiredSize.width = aReflowState.mComputedWidth; +// } + + // calculate height: +// if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) + { + nsCOMPtr animLength; + SVGElement->GetHeight(getter_AddRefs(animLength)); + NS_ENSURE_TRUE(animLength, NS_ERROR_FAILURE); + nsCOMPtr length; + animLength->GetAnimVal(getter_AddRefs(length)); + NS_ENSURE_TRUE(length, NS_ERROR_FAILURE); + + float h; + length->GetValue(&h); +#ifdef DEBUG +// printf(" *intrinsic height:%f*\n",(double)h); +#endif + aDesiredSize.height = (int) (twipsPerPx * h); + } +// else { +// aDesiredSize.height = aReflowState.mComputedHeight; +// } + + aDesiredSize.ascent = aDesiredSize.height; + aDesiredSize.descent = 0; + + // XXX add in CSS borders ?? + + aStatus = NS_FRAME_COMPLETE; + return NS_OK; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::DidReflow(nsIPresContext* aPresContext, + const nsHTMLReflowState* aReflowState, + nsDidReflowStatus aStatus) +{ + // Set the viewport. We want the x, y coords relative to the + // document element, so that we can use them (in conjunction with + // scrollX, scrollY) to transform mouse event coords into the svg + // element's viewport coord system. + + NS_ENSURE_TRUE(mContent, NS_ERROR_FAILURE); + + nsCOMPtr SVGElement = do_QueryInterface(mContent); + NS_ENSURE_TRUE(SVGElement, NS_ERROR_FAILURE); + + nsCOMPtr viewport; + SVGElement->GetViewport(getter_AddRefs(viewport)); + NS_ENSURE_TRUE(viewport, NS_ERROR_FAILURE); + + nsIFrame* frame = this; + nsPoint origin(0,0); + do { + nsPoint tmpOrigin; + frame->GetOrigin(tmpOrigin); + origin += tmpOrigin; + + nsFrameState state; + frame->GetFrameState(&state); + if(state & NS_FRAME_OUT_OF_FLOW) + break; + + frame->GetParent(&frame); + } while(frame); + + float pxPerTwips = GetPxPerTwips(); + + viewport->SetX(origin.x * pxPerTwips); + viewport->SetY(origin.y * pxPerTwips); + viewport->SetWidth(mRect.width * pxPerTwips); + viewport->SetHeight(mRect.height * pxPerTwips); + +#ifdef DEBUG +// printf("reflowed nsSVGOuterSVGFrame viewport: (%f, %f, %f, %f)\n", +// origin.x * pxPerTwips, +// origin.y * pxPerTwips, +// mRect.width * pxPerTwips, +// mRect.height * pxPerTwips); +#endif + + return nsSVGOuterSVGFrameBase::DidReflow(aPresContext,aReflowState,aStatus); +} + +//---------------------------------------------------------------------- +// container methods + +NS_IMETHODIMP +nsSVGOuterSVGFrame::AppendFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aFrameList) +{ + nsresult rv = NS_OK; + + // Insert the new frames + mFrames.AppendFrames(this, aFrameList); + + // XXX Get all new frames updated. Should really have a separate + // function for this and not use NotifyCTMChanged(). For now this + // will do the trick though: + + // get the view manager, so that we can wrap this up in a batch + // update. + NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); + nsCOMPtr presCtx; + mPresShell->GetPresContext(getter_AddRefs(presCtx)); + NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE); + nsIView* view = nsnull; + GetView(presCtx, &view); + if (!view) { + nsIFrame* frame; + GetParentWithView(presCtx, &frame); + if (frame) + frame->GetView(presCtx, &view); + } + NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); + + nsCOMPtr vm; + view->GetViewManager(*getter_AddRefs(vm)); + + vm->BeginUpdateViewBatch(); + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); //XXX use different function + } + kid->GetNextSibling(&kid); + } + + vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); + + // Generate a reflow command to reflow the dirty frames + //nsIReflowCommand* reflowCmd; + //rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty); + //if (NS_SUCCEEDED(rv)) { + // reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList); + // aPresShell.AppendReflowCommand(reflowCmd); + // NS_RELEASE(reflowCmd); + //} + + return rv; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::InsertFrames(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aPrevFrame, + nsIFrame* aFrameList) +{ + nsresult rv = NS_OK; + + // Insert the new frames + mFrames.InsertFrames(this, aPrevFrame, aFrameList); + + // XXX Get all new frames updated. Should really have a separate + // function for this and not use NotifyCTMChanged(). For now this + // will do the trick though: + + // get the view manager, so that we can wrap this up in a batch + // update. + NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); + nsCOMPtr presCtx; + mPresShell->GetPresContext(getter_AddRefs(presCtx)); + NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE); + nsIView* view = nsnull; + GetView(presCtx, &view); + if (!view) { + nsIFrame* frame; + GetParentWithView(presCtx, &frame); + if (frame) + frame->GetView(presCtx, &view); + } + NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); + + nsCOMPtr vm; + view->GetViewManager(*getter_AddRefs(vm)); + + vm->BeginUpdateViewBatch(); + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); //XXX use different function + } + kid->GetNextSibling(&kid); + } + + vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); + + // Generate a reflow command to reflow the dirty frames + //nsIReflowCommand* reflowCmd; + //rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty); + //if (NS_SUCCEEDED(rv)) { + // reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList); + // aPresShell.AppendReflowCommand(reflowCmd); + // NS_RELEASE(reflowCmd); + //} + + return rv; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::RemoveFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame) +{ + PRBool rv = mFrames.DestroyFrame(aPresContext, aOldFrame); + NS_ASSERTION(rv, "didn't find frame to delete"); + if (NS_FAILED(rv)) return rv; + + // XXX Get all new frames updated. Should really have a separate + // function for this and not use NotifyCTMChanged(). For now this + // will do the trick though: + + // get the view manager, so that we can wrap this up in a batch + // update. + NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); + nsCOMPtr presCtx; + mPresShell->GetPresContext(getter_AddRefs(presCtx)); + NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE); + nsIView* view = nsnull; + GetView(presCtx, &view); + if (!view) { + nsIFrame* frame; + GetParentWithView(presCtx, &frame); + if (frame) + frame->GetView(presCtx, &view); + } + NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); + + nsCOMPtr vm; + view->GetViewManager(*getter_AddRefs(vm)); + + vm->BeginUpdateViewBatch(); + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyCTMChanged(); //XXX use different function + } + kid->GetNextSibling(&kid); + } + + vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); + + // Generate a reflow command to reflow the dirty frames + //nsIReflowCommand* reflowCmd; + //rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty); + //if (NS_SUCCEEDED(rv)) { + // reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList); + // aPresShell.AppendReflowCommand(reflowCmd); + // NS_RELEASE(reflowCmd); + //} + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::ReplaceFrame(nsIPresContext* aPresContext, + nsIPresShell& aPresShell, + nsIAtom* aListName, + nsIFrame* aOldFrame, + nsIFrame* aNewFrame) +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aModType, + PRInt32 aHint) +{ +#ifdef DEBUG +// { +// printf("** nsSVGOuterSVGFrame::AttributeChanged("); +// nsAutoString str; +// aAttribute->ToString(str); +// nsCAutoString cstr; +// cstr.AssignWithConversion(str); +// printf(cstr.get()); +// printf(", hint:%d)\n",aHint); +// } +#endif + return NS_OK; +} + + +//---------------------------------------------------------------------- +// +// NS_IMETHODIMP +// nsSVGOuterSVGFrame::SetView(nsIPresContext* aPresContext, nsIView* aView) +// { +// mView = aView; +// return nsSVGOuterSVGFrameBase::SetView(aPresContext, aView); +// } + +nsresult +nsSVGOuterSVGFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsFramePaintLayer aWhichLayer, + nsIFrame** aFrame) +{ + //printf("nsSVGOuterSVGFrame::GetFrameForPoint(%d)\n", aWhichLayer); + *aFrame = nsnull; + if (aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND) return NS_ERROR_FAILURE; + + float x = GetPxPerTwips() * ( aPoint.x - mRect.x); + float y = GetPxPerTwips() * ( aPoint.y - mRect.y); + + PRBool inThisFrame = mRect.Contains(aPoint); + + if (!inThisFrame) { + return NS_ERROR_FAILURE; + } + + *aFrame = this; + nsIFrame* kid = mFrames.FirstChild(); + nsIFrame* hit = nsnull; + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + nsresult rv = SVGFrame->GetFrameForPoint(x, y, &hit); + if (NS_SUCCEEDED(rv) && hit) { + *aFrame = hit; + // return NS_OK; can't return. we need reverse order but only + // have a singly linked list... + } + } + kid->GetNextSibling(&kid); + } + + return NS_OK; +} + + + +//---------------------------------------------------------------------- +// painting + +NS_IMETHODIMP +nsSVGOuterSVGFrame::Paint(nsIPresContext* aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + PRUint32 aFlags) +{ + +// if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) { +// const nsStyleDisplay* disp = (const nsStyleDisplay*) +// mStyleContext->GetStyleData(eStyleStruct_Display); +// if (disp->IsVisible() && mRect.width && mRect.height) { +// // Paint our background and border +// const nsStyleColor* color = (const nsStyleColor*) +// mStyleContext->GetStyleData(eStyleStruct_Color); +// const nsStyleBorder* border = (const nsStyleBorder*) +// mStyleContext->GetStyleData(eStyleStruct_Border); +// const nsStyleOutline* outline = (const nsStyleOutline*) +// mStyleContext->GetStyleData(eStyleStruct_Outline); + +// nsRect rect(0, 0, mRect.width, mRect.height); +// // nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, +// // aDirtyRect, rect, *color, *border, 0, 0); +// nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, +// aDirtyRect, rect, *border, mStyleContext, 0); +// nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, +// aDirtyRect, rect, *border, *outline, mStyleContext, 0); + +// } +// } + + + if (aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND) return NS_OK; + if (aDirtyRect.width<=0 || aDirtyRect.height<=0) return NS_OK; + + nsSVGRenderingContext SVGCtx(aPresContext, &aRenderingContext, aDirtyRect); + Paint(&SVGCtx); + + // paint children: + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) + SVGFrame->Paint(&SVGCtx); + kid->GetNextSibling(&kid); + } + + SVGCtx.Render(); + + return NS_OK; + // see if we have to draw a selection frame around this container + //return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); +} + +//---------------------------------------------------------------------- +// nsISVGValueObserver methods: + +NS_IMETHODIMP +nsSVGOuterSVGFrame::WillModifySVGObservable(nsISVGValue* observable) +{ + return NS_OK; +} + + +NS_IMETHODIMP +nsSVGOuterSVGFrame::DidModifySVGObservable(nsISVGValue* observable) +{ + mNeedsReflow = PR_TRUE; + if (!mRedrawSuspended) { + InitiateReflow(); + } + + return NS_OK; +} + + +//---------------------------------------------------------------------- +// nsISVGFrame methods + +NS_IMETHODIMP +nsSVGOuterSVGFrame::Paint(nsSVGRenderingContext* renderingContext) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::InvalidateRegion(ArtUta* uta, PRBool bRedraw) +{ +// NS_ASSERTION(mView, "need a view!"); +// if (!mView) return NS_ERROR_FAILURE; + + NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); + nsCOMPtr presCtx; + mPresShell->GetPresContext(getter_AddRefs(presCtx)); + NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE); + nsIView* view = nsnull; + GetView(presCtx, &view); + if (!view) { + nsIFrame* frame; + GetParentWithView(presCtx, &frame); + if (frame) + frame->GetView(presCtx, &view); + } + NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); + + + if (!uta && !bRedraw) return NS_OK; + + nsCOMPtr vm; + view->GetViewManager(*getter_AddRefs(vm)); + + vm->BeginUpdateViewBatch(); + if (uta) { + int twipsPerPx = (int)(GetTwipsPerPx()+0.5f); + + int nRects=0; + ArtIRect* rectList = art_rect_list_from_uta(uta, 200, 200, &nRects); + for (int i=0; iUpdateView(view, rect, NS_VMREFRESH_NO_SYNC); + } + + art_free(rectList); + art_uta_free(uta); + } + vm->EndUpdateViewBatch(bRedraw ? NS_VMREFRESH_IMMEDIATE : NS_VMREFRESH_NO_SYNC); + + return NS_OK; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::GetFrameForPoint(float x, float y, nsIFrame** hit) +{ + NS_ASSERTION(PR_FALSE, "shouldn't be called!"); + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::NotifyCTMChanged() +{ + NS_NOTYETIMPLEMENTED("write me!"); + return NS_ERROR_UNEXPECTED; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::NotifyRedrawSuspended() +{ + mRedrawSuspended = PR_TRUE; + + // get the view manager, so that we can wrap this up in a batch + // update. + NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); + nsCOMPtr presCtx; + mPresShell->GetPresContext(getter_AddRefs(presCtx)); + NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE); + nsIView* view = nsnull; + GetView(presCtx, &view); + if (!view) { + nsIFrame* frame; + GetParentWithView(presCtx, &frame); + if (frame) + frame->GetView(presCtx, &view); + } + NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); + + nsCOMPtr vm; + view->GetViewManager(*getter_AddRefs(vm)); + + vm->BeginUpdateViewBatch(); + + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyRedrawSuspended(); + } + kid->GetNextSibling(&kid); + } + return NS_OK; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::NotifyRedrawUnsuspended() +{ + // If we need to reflow, do so before we update any of our + // children. Reflows are likely to affect the display of children: + if (mNeedsReflow) + InitiateReflow(); + + mRedrawSuspended = PR_FALSE; + + // get the view manager, so that we can wrap this up in a batch + // update. + NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); + nsCOMPtr presCtx; + mPresShell->GetPresContext(getter_AddRefs(presCtx)); + NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE); + nsIView* view = nsnull; + GetView(presCtx, &view); + if (!view) { + nsIFrame* frame; + GetParentWithView(presCtx, &frame); + if (frame) + frame->GetView(presCtx, &view); + } + NS_ENSURE_TRUE(view, NS_ERROR_FAILURE); + + nsCOMPtr vm; + view->GetViewManager(*getter_AddRefs(vm)); + + + nsIFrame* kid = mFrames.FirstChild(); + while (kid) { + nsISVGFrame* SVGFrame=0; + kid->QueryInterface(NS_GET_IID(nsISVGFrame),(void**)&SVGFrame); + if (SVGFrame) { + SVGFrame->NotifyRedrawUnsuspended(); + } + kid->GetNextSibling(&kid); + } + + vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); + return NS_OK; +} + +NS_IMETHODIMP +nsSVGOuterSVGFrame::IsRedrawSuspended(PRBool* isSuspended) +{ + *isSuspended = mRedrawSuspended; + return NS_OK; +} + +//---------------------------------------------------------------------- +// Implementation helpers + +float nsSVGOuterSVGFrame::GetPxPerTwips() +{ + float val = GetTwipsPerPx(); + + NS_ASSERTION(val!=0.0f, "invalid px/twips"); + if (val == 0.0) val = 1e-20f; + + return 1.0f/val; +} + +float nsSVGOuterSVGFrame::GetTwipsPerPx() +{ + float twipsPerPx=16.0f; + NS_ASSERTION(mPresShell, "need presshell"); + if (mPresShell) { + nsCOMPtr presContext; + mPresShell->GetPresContext(getter_AddRefs(presContext)); + presContext->GetScaledPixelsToTwips(&twipsPerPx); + } + return twipsPerPx; +} + +void nsSVGOuterSVGFrame::InitiateReflow() +{ + mNeedsReflow = PR_FALSE; + + // Generate a reflow command to reflow ourselves + nsCOMPtr reflowCmd; + NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this, nsIReflowCommand::ReflowDirty); + if (!reflowCmd) { + NS_ERROR("error creating reflow command object"); + return; + } + + mPresShell->AppendReflowCommand(reflowCmd); + mPresShell->FlushPendingNotifications(PR_FALSE); +} diff --git a/layout/svg/base/src/nsSVGPathFrame.cpp b/layout/svg/base/src/nsSVGPathFrame.cpp index 7f85cc81f9a4..c881e61b1743 100644 --- a/layout/svg/base/src/nsSVGPathFrame.cpp +++ b/layout/svg/base/src/nsSVGPathFrame.cpp @@ -1,25 +1,27 @@ /* -*- 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 +/* ----- BEGIN LICENSE BLOCK ----- + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * The contents of this file are subject to the Netscape Public License + * 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/NPL/ + * 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 Original Code is the Mozilla SVG project. * * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 + * Crocodile Clips Ltd.. + * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Alex Fritze (original author) + * Daniele Nicolodi * * 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 @@ -31,295 +33,415 @@ * 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. + * the terms of any one of the MPL, the GPL or the LGPL. * - * ***** END LICENSE BLOCK ***** */ + * ----- END LICENSE BLOCK ----- */ +#include "nsSVGGraphicFrame.h" +#include "nsIDOMSVGAnimatedPathData.h" +#include "nsIDOMSVGPathSegList.h" +#include "nsIDOMSVGPathSeg.h" +#include "nsASVGPathBuilder.h" +#include "nsIDOMSVGMatrix.h" +#include -#include "nsSVGPathFrame.h" - -#include "nsIDOMElement.h" -#include "nsIContent.h" -#include "prtypes.h" -#include "nsIAtom.h" -#include "nsHTMLAtoms.h" -#include "nsIPresContext.h" -#include "nsIStyleContext.h" -#include "nsCSSRendering.h" -#include "nsINameSpaceManager.h" -#include "nsColor.h" -#include "nsIServiceManager.h" -#include "nsPoint.h" -#include "nsSVGAtoms.h" -#include "nsIDeviceContext.h" -#include "nsGUIEvent.h" -//#include "nsSVGPathCID.h" -#include "nsReadableUtils.h" -#include "nsUnicharUtils.h" -// -// NS_NewSVGPathFrame -// -// Wrapper for creating a new color picker -// -nsresult -NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame) +class nsSVGPathFrame : public nsSVGGraphicFrame { - NS_PRECONDITION(aNewFrame, "null OUT ptr"); - if (nsnull == aNewFrame) { - return NS_ERROR_NULL_POINTER; + friend nsresult + NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + + ~nsSVGPathFrame(); + + virtual nsresult Init(); + virtual void ConstructPath(nsASVGPathBuilder* pathBuilder); + + nsCOMPtr mSegments; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr anim_data = do_QueryInterface(aContent); + if (!anim_data) { +#ifdef DEBUG + printf("warning: trying to construct an SVGPathFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; } + nsSVGPathFrame* it = new (aPresShell) nsSVGPathFrame; - if ( !it ) + if (nsnull == it) return NS_ERROR_OUT_OF_MEMORY; + *aNewFrame = it; return NS_OK; } -// static NS_DEFINE_IID(kDefSVGPathCID, NS_DEFCOLORPICKER_CID); - -// -// nsSVGPathFrame cntr -// -nsSVGPathFrame::nsSVGPathFrame() : - mX(0), - mY(0), - mPath(nsnull) -{ - -} - nsSVGPathFrame::~nsSVGPathFrame() { -// if (mPath) { -// delete mPath; -// } + nsCOMPtr value; + if (mSegments && (value = do_QueryInterface(mSegments))) + value->RemoveObserver(this); } - -NS_IMETHODIMP -nsSVGPathFrame::Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsIStyleContext* aContext, - nsIFrame* aPrevInFlow) +nsresult nsSVGPathFrame::Init() { - - nsresult rv = nsLeafFrame::Init(aPresContext, aContent, aParent, aContext, - aPrevInFlow); - - - nsAutoString type; - mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type); - - if ((Compare(type, - NS_LITERAL_STRING("swatch"), - nsCaseInsensitiveStringComparator()) == 0) || - type.IsEmpty()) - { - //mSVGPath = new nsStdSVGPath(); - //mSVGPath->Init(mContent); - } - - return rv; -} - -//-------------------------------------------------------------- -// Frames are not refcounted, no need to AddRef -NS_IMETHODIMP -nsSVGPathFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - NS_PRECONDITION(0 != aInstancePtr, "null ptr"); - if (NULL == aInstancePtr) { - return NS_ERROR_NULL_POINTER; - } - - if (aIID.Equals(NS_GET_IID(nsISVGFrame))) { - *aInstancePtr = (void*) ((nsISVGFrame*) this); - return NS_OK; - } - return nsLeafFrame::QueryInterface(aIID, aInstancePtr); -} - - -//------------------------------------------------------------------- -//-- Main Reflow for the SVGPath -//------------------------------------------------------------------- -NS_IMETHODIMP -nsSVGPathFrame::Reflow(nsIPresContext* aPresContext, - nsHTMLReflowMetrics& aDesiredSize, - const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus) -{ - aStatus = NS_FRAME_COMPLETE; - - nsCOMPtr dx; - aPresContext->GetDeviceContext(getter_AddRefs(dx)); - float p2t = 1.0; - float scale = 1.0; - if (dx) { - aPresContext->GetPixelsToTwips(&p2t); - dx->GetCanonicalPixelScale(scale); - } + nsCOMPtr anim_data = do_QueryInterface(mContent); + NS_ASSERTION(anim_data,"wrong content element"); + anim_data->GetAnimatedPathSegList(getter_AddRefs(mSegments)); + NS_ASSERTION(mSegments, "no pathseglist"); + if (!mSegments) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mSegments); + if (value) + value->AddObserver(this); - nsAutoString coordStr; - nsresult res = mContent->GetAttr(kNameSpaceID_None, nsSVGAtoms::x, coordStr); - if (NS_SUCCEEDED(res)) { - char * s = ToNewCString(coordStr); - mX = NSIntPixelsToTwips(atoi(s), p2t*scale); - delete [] s; - } + return nsSVGGraphicFrame::Init(); +} - res = mContent->GetAttr(kNameSpaceID_None, nsSVGAtoms::y, coordStr); - if (NS_SUCCEEDED(res)) { - char * s = ToNewCString(coordStr); - mY = NSIntPixelsToTwips(atoi(s), p2t*scale); - delete [] s; - } - - nsAutoString pathStr; - res = mContent->GetAttr(kNameSpaceID_None, nsSVGAtoms::d, pathStr); - if (NS_SUCCEEDED(res)) { - char * s = ToNewCString(pathStr); - // parse path commands here - delete [] s; - } - - // Create Path object here; - //mPath = new nsPathObject(); - // - // iterate thru path commands here and load up path - // calculate the rect the the path owns - - //aDesiredSize.width = maxWidth + nscoord(p2t*scale); - //aDesiredSize.height = maxHeight + nscoord(p2t*scale); - aDesiredSize.ascent = aDesiredSize.height; - aDesiredSize.descent = 0; - - if (nsnull != aDesiredSize.maxElementSize) { - aDesiredSize.maxElementSize->width = aDesiredSize.width; - aDesiredSize.maxElementSize->height = aDesiredSize.height; - } - return NS_OK; -} - -NS_IMETHODIMP -nsSVGPathFrame::HandleEvent(nsIPresContext* aPresContext, - nsGUIEvent* aEvent, - nsEventStatus* aEventStatus) +void nsSVGPathFrame::ConstructPath(nsASVGPathBuilder* pathBuilder) { - NS_ENSURE_ARG_POINTER(aEventStatus); - *aEventStatus = nsEventStatus_eConsumeDoDefault; - if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN) - HandleMouseDownEvent(aPresContext, aEvent, aEventStatus); - - return NS_OK; -} - -nsresult -nsSVGPathFrame::HandleMouseDownEvent(nsIPresContext* aPresContext, - nsGUIEvent* aEvent, - nsEventStatus* aEventStatus) -{ - - return NS_OK; -} - -NS_IMETHODIMP nsSVGPathFrame::SetProperty(nsIPresContext* aPresContext, - nsIAtom* aName, - const nsString& aValue) -{ - if (aName == nsSVGAtoms::d) { - } - return NS_OK; -} - -NS_IMETHODIMP -nsSVGPathFrame::AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint) -{ - return nsLeafFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); -} + PRUint32 count; + mSegments->GetNumberOfItems(&count); + if (count == 0) return; - -// -// Paint -// -// -NS_METHOD -nsSVGPathFrame::Paint(nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags) -{ - const nsStyleVisibility* visib = NS_STATIC_CAST(const nsStyleVisibility*, - mStyleContext->GetStyleData(eStyleStruct_Visibility)); - - // if we aren't visible then we are done. - if (!visib->IsVisibleOrCollapsed()) - return NS_OK; - - // if we are visible then tell our superclass to paint - nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, - aWhichLayer); - - // get our border - const nsStyleBorder* borderStyle = (const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border); - nsMargin border(0,0,0,0); - borderStyle->CalcBorderFor(this, border); - + float cx = 0.0f; // current point + float cy = 0.0f; - // XXX - Color needs to comes from new style property fill - // and not mColor - const nsStyleColor* colorStyle = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); - nscolor color = colorStyle->mColor; + float cx1 = 0.0f; // last controlpoint (for s,S,t,T) + float cy1 = 0.0f; + + PRUint16 lastSegmentType = nsIDOMSVGPathSeg::PATHSEG_UNKNOWN; + PRUint32 i; + for (i = 0; i < count; ++i) { + nsCOMPtr segment; + mSegments->GetItem(i, getter_AddRefs(segment)); - aRenderingContext.PushState(); + PRUint16 type = nsIDOMSVGPathSeg::PATHSEG_UNKNOWN; + segment->GetPathSegType(&type); - // set the clip region - nsRect rect; + PRBool absCoords = PR_FALSE; + + switch (type) { + case nsIDOMSVGPathSeg::PATHSEG_CLOSEPATH: + pathBuilder->ClosePath(&cx,&cy); + break; + + case nsIDOMSVGPathSeg::PATHSEG_MOVETO_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_MOVETO_REL: + { + float x, y; + if (!absCoords) { + nsCOMPtr moveseg = do_QueryInterface(segment); + NS_ASSERTION(moveseg, "interface not implemented"); + moveseg->GetX(&x); + moveseg->GetY(&y); + x += cx; + y += cy; + } else { + nsCOMPtr moveseg = do_QueryInterface(segment); + NS_ASSERTION(moveseg, "interface not implemented"); + moveseg->GetX(&x); + moveseg->GetY(&y); + } + cx = x; + cy = y; + pathBuilder->Moveto(x,y); + } + break; + + case nsIDOMSVGPathSeg::PATHSEG_LINETO_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_LINETO_REL: + { + float x, y; + if (!absCoords) { + nsCOMPtr lineseg = do_QueryInterface(segment); + NS_ASSERTION(lineseg, "interface not implemented"); + lineseg->GetX(&x); + lineseg->GetY(&y); + x += cx; + y += cy; + } else { + nsCOMPtr lineseg = do_QueryInterface(segment); + NS_ASSERTION(lineseg, "interface not implemented"); + lineseg->GetX(&x); + lineseg->GetY(&y); + } + cx = x; + cy = y; + pathBuilder->Lineto(x,y); + } + break; - PRBool clipState; - GetRect(rect); + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_REL: + { + float x, y, x1, y1, x2, y2; + if (!absCoords) { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + curveseg->GetX1(&x1); + curveseg->GetY1(&y1); + curveseg->GetX2(&x2); + curveseg->GetY2(&y2); + x += cx; + y += cy; + x1 += cx; + y1 += cy; + x2 += cx; + y2 += cy; + } else { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + curveseg->GetX1(&x1); + curveseg->GetY1(&y1); + curveseg->GetX2(&x2); + curveseg->GetY2(&y2); + } + cx = x; + cy = y; + cx1 = x2; + cy1 = y2; + pathBuilder->Curveto(x, y, x1, y1, x2, y2); + } + break; + + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL: + { + float x, y, x1, y1, x31, y31, x32, y32; + if (!absCoords) { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + curveseg->GetX1(&x1); + curveseg->GetY1(&y1); + x += cx; + y += cy; + x1 += cx; + y1 += cy; + } else { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + curveseg->GetX1(&x1); + curveseg->GetY1(&y1); + } - // Clip so we don't render outside the inner rect - aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipState); - aRenderingContext.SetColor(color); + // conversion of quadratic bezier curve to cubic bezier curve: + x31 = cx + (x1 - cx) * 2 / 3; + y31 = cy + (y1 - cy) * 2 / 3; + x32 = x1 + (x - x1) / 3; + y32 = y1 + (y - y1) / 3; + + cx = x; + cy = y; + cx1 = x1; + cy1 = y1; + + pathBuilder->Curveto(x, y, x31, y31, x32, y32); + } + break; + + case nsIDOMSVGPathSeg::PATHSEG_ARC_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_ARC_REL: + { + float x0, y0, x, y, r1, r2, angle; + PRBool largeArcFlag, sweepFlag; + + x0 = cx; + y0 = cy; + + if (!absCoords) { + nsCOMPtr arcseg = do_QueryInterface(segment); + NS_ASSERTION(arcseg, "interface not implemented"); + arcseg->GetX(&x); + arcseg->GetY(&y); + arcseg->GetR1(&r1); + arcseg->GetR2(&r2); + arcseg->GetAngle(&angle); + arcseg->GetLargeArcFlag(&largeArcFlag); + arcseg->GetSweepFlag(&sweepFlag); + + x += cx; + y += cy; + } else { + nsCOMPtr arcseg = do_QueryInterface(segment); + NS_ASSERTION(arcseg, "interface not implemented"); + arcseg->GetX(&x); + arcseg->GetY(&y); + arcseg->GetR1(&r1); + arcseg->GetR2(&r2); + arcseg->GetAngle(&angle); + arcseg->GetLargeArcFlag(&largeArcFlag); + arcseg->GetSweepFlag(&sweepFlag); + } + cx = x; + cy = y; + + pathBuilder->Arcto(x, y, r1, r2, angle, largeArcFlag, sweepFlag); + } + break; + + case nsIDOMSVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL: + { + float x; + float y = cy; + if (!absCoords) { + nsCOMPtr lineseg = do_QueryInterface(segment); + NS_ASSERTION(lineseg, "interface not implemented"); + lineseg->GetX(&x); + x += cx; + } else { + nsCOMPtr lineseg = do_QueryInterface(segment); + NS_ASSERTION(lineseg, "interface not implemented"); + lineseg->GetX(&x); + } + cx = x; + pathBuilder->Lineto(x,y); + } + break; + + case nsIDOMSVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_LINETO_VERTICAL_REL: + { + float x = cx; + float y; + if (!absCoords) { + nsCOMPtr lineseg = do_QueryInterface(segment); + NS_ASSERTION(lineseg, "interface not implemented"); + lineseg->GetY(&y); + y += cy; + } else { + nsCOMPtr lineseg = do_QueryInterface(segment); + NS_ASSERTION(lineseg, "interface not implemented"); + lineseg->GetY(&y); + } + cy = y; + pathBuilder->Lineto(x,y); + } + break; + + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL: + { + float x, y, x1, y1, x2, y2; + + if (lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_REL || + lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS || + lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL || + lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS ) { + // the first controlpoint is the reflection of the last one about the current point: + x1 = 2*cx - cx1; + y1 = 2*cy - cy1; + } + else { + // the first controlpoint is equal to the current point: + x1 = cx; + y1 = cy; + } + + if (!absCoords) { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + curveseg->GetX2(&x2); + curveseg->GetY2(&y2); + x += cx; + y += cy; + x2 += cx; + y2 += cy; + } else { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + curveseg->GetX2(&x2); + curveseg->GetY2(&y2); + } + cx = x; + cy = y; + cx1 = x2; + cy1 = y2; + pathBuilder->Curveto(x, y, x1, y1, x2, y2); + } + break; + + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: + absCoords = PR_TRUE; + case nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: + { + float x, y, x1, y1, x31, y31, x32, y32; + + if (lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL || + lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS || + lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL || + lastSegmentType == nsIDOMSVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS ) { + // the first controlpoint is the reflection of the last one about the current point: + x1 = 2*cx - cx1; + y1 = 2*cy - cy1; + } + else { + // the first controlpoint is equal to the current point: + x1 = cx; + y1 = cy; + } + + if (!absCoords) { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + x += cx; + y += cy; + } else { + nsCOMPtr curveseg = do_QueryInterface(segment); + NS_ASSERTION(curveseg, "interface not implemented"); + curveseg->GetX(&x); + curveseg->GetY(&y); + } + + // conversion of quadratic bezier curve to cubic bezier curve: + x31 = cx + (x1 - cx) * 2 / 3; + y31 = cy + (y1 - cy) * 2 / 3; + x32 = x1 + (x - x1) / 3; + y32 = y1 + (y - y1) / 3; + + cx = x; + cy = y; + cx1 = x1; + cy1 = y1; + + pathBuilder->Curveto(x, y, x31, y31, x32, y32); + } + break; + + default: + NS_ASSERTION(1==0, "unknown path segment"); + break; + } + lastSegmentType = type; + } - /////////////////////////////////////////// - // XXX - This is all just a quick hack - // needs to be rewritten - nsCOMPtr dx; - aPresContext->GetDeviceContext(getter_AddRefs(dx)); - float p2t = 1.0; - float scale = 1.0; - if (dx) { - aPresContext->GetPixelsToTwips(&p2t); - dx->GetCanonicalPixelScale(scale); - } - - // render path here - - aRenderingContext.PopState(clipState); - - return NS_OK; } - - -// -// GetDesiredSize -// -// For now, be as big as CSS wants us to be, or some small default size. -// -void -nsSVGPathFrame::GetDesiredSize(nsIPresContext* aPresContext, - const nsHTMLReflowState& aReflowState, - nsHTMLReflowMetrics& aDesiredSize) -{ - NS_ASSERTION(0, "Who called this? and Why?"); -} // GetDesiredSize diff --git a/layout/svg/base/src/nsSVGPathFrame.h b/layout/svg/base/src/nsSVGPathFrame.h deleted file mode 100644 index 8a973a117acc..000000000000 --- a/layout/svg/base/src/nsSVGPathFrame.h +++ /dev/null @@ -1,131 +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 ***** */ - -// -// nsSVGPathFrame -// - -#ifndef nsSVGPathFrame_h__ -#define nsSVGPathFrame_h__ - - -#include "nsLeafFrame.h" -#include "prtypes.h" -#include "nsIAtom.h" -#include "nsCOMPtr.h" -#include "nsVoidArray.h" -#include "nsISVGFrame.h" - -class nsString; - - -nsresult NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ; - - -// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -// This should NOT be derived from nsLeafFrame -// we really want to create our own container class from the nsIFrame -// interface and not derive from any HTML Frames -// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -class nsSVGPathFrame : public nsLeafFrame, public nsISVGFrame -{ -public: - nsSVGPathFrame(); - virtual ~nsSVGPathFrame(); - - NS_IMETHOD Init(nsIPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsIStyleContext* aContext, - nsIFrame* aPrevInFlow); - - NS_IMETHOD Reflow(nsIPresContext* aCX, - nsHTMLReflowMetrics& aDesiredSize, - const nsHTMLReflowState& aReflowState, - nsReflowStatus& aStatus); - // nsISVGFrame - NS_IMETHOD GetXY(nscoord* aX, nscoord* aY) { *aX = mX; *aY = mY; return NS_OK; } - - // nsISupports - NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - -#ifdef DEBUG - NS_IMETHOD GetFrameName(nsAString& aResult) const { - return MakeFrameName(NS_LITERAL_STRING("SVGPathFrame"), aResult); - } -#endif - - // nsIFrame overrides - NS_IMETHOD HandleEvent(nsIPresContext* aPresContext, - nsGUIEvent* aEvent, - nsEventStatus* aEventStatus); - nsresult HandleMouseDownEvent(nsIPresContext* aPresContext, - nsGUIEvent* aEvent, - nsEventStatus* aEventStatus); - - NS_IMETHOD Paint(nsIPresContext* aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - PRUint32 aFlags = 0); - - NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, - nsIContent* aChild, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aModType, - PRInt32 aHint); - NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); - -protected: - - virtual void GetDesiredSize(nsIPresContext* aPresContext, - const nsHTMLReflowState& aReflowState, - nsHTMLReflowMetrics& aDesiredSize) ; - - - nscoord mX; - nscoord mY; - // make this a path object - void * mPath; - -private: - NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } - NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; } -}; // class nsSVGPathFrame - -#endif diff --git a/layout/svg/base/src/nsSVGPolygonFrame.cpp b/layout/svg/base/src/nsSVGPolygonFrame.cpp new file mode 100644 index 000000000000..983783cda479 --- /dev/null +++ b/layout/svg/base/src/nsSVGPolygonFrame.cpp @@ -0,0 +1,125 @@ +/* -*- 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 (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 "nsSVGGraphicFrame.h" +#include "nsIDOMSVGAnimatedPoints.h" +#include "nsIDOMSVGPointList.h" +#include "nsIDOMSVGPoint.h" +#include "nsASVGPathBuilder.h" + +class nsSVGPolygonFrame : public nsSVGGraphicFrame +{ + friend nsresult + NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + + ~nsSVGPolygonFrame(); + + virtual nsresult Init(); + void ConstructPath(nsASVGPathBuilder* pathBuilder); + + nsCOMPtr mPoints; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPolygonFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + nsCOMPtr anim_points = do_QueryInterface(aContent); + if (!anim_points) { +#ifdef DEBUG + printf("warning: trying to construct an SVGPolygonFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGPolygonFrame* it = new (aPresShell) nsSVGPolygonFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + return NS_OK; +} + +nsSVGPolygonFrame::~nsSVGPolygonFrame() +{ + nsCOMPtr value; + if (mPoints && (value = do_QueryInterface(mPoints))) + value->RemoveObserver(this); +} + +nsresult nsSVGPolygonFrame::Init() +{ + nsCOMPtr anim_points = do_QueryInterface(mContent); + NS_ASSERTION(anim_points,"wrong content element"); + anim_points->GetPoints(getter_AddRefs(mPoints)); + NS_ASSERTION(mPoints, "no points"); + if (!mPoints) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mPoints); + if (value) + value->AddObserver(this); + return nsSVGGraphicFrame::Init(); +} + +void nsSVGPolygonFrame::ConstructPath(nsASVGPathBuilder* pathBuilder) +{ + if (!mPoints) return; + + PRUint32 count; + mPoints->GetNumberOfItems(&count); + if (count == 0) return; + + PRUint32 i; + for (i = 0; i < count; ++i) { + nsCOMPtr point; + mPoints->GetItem(i, getter_AddRefs(point)); + + float x, y; + point->GetX(&x); + point->GetY(&y); + if (i == 0) + pathBuilder->Moveto(x, y); + else + pathBuilder->Lineto(x, y); + } + // the difference between a polyline and a polygon is that the + // polygon is closed: + float x,y; + pathBuilder->ClosePath(&x,&y); +} diff --git a/layout/svg/base/src/nsSVGPolylineFrame.cpp b/layout/svg/base/src/nsSVGPolylineFrame.cpp new file mode 100644 index 000000000000..04b12ada990f --- /dev/null +++ b/layout/svg/base/src/nsSVGPolylineFrame.cpp @@ -0,0 +1,121 @@ +/* -*- 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 (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 "nsSVGGraphicFrame.h" +#include "nsIDOMSVGAnimatedPoints.h" +#include "nsIDOMSVGPointList.h" +#include "nsIDOMSVGPoint.h" +#include "nsASVGPathBuilder.h" + +class nsSVGPolylineFrame : public nsSVGGraphicFrame +{ + friend nsresult + NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + + virtual ~nsSVGPolylineFrame(); + virtual nsresult Init(); + + virtual void ConstructPath(nsASVGPathBuilder* pathBuilder); + + nsCOMPtr mPoints; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGPolylineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + nsCOMPtr anim_points = do_QueryInterface(aContent); + if (!anim_points) { +#ifdef DEBUG + printf("warning: trying to construct an SVGPolylineFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGPolylineFrame* it = new (aPresShell) nsSVGPolylineFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + return NS_OK; +} + +nsSVGPolylineFrame::~nsSVGPolylineFrame() +{ + nsCOMPtr value; + if (mPoints && (value = do_QueryInterface(mPoints))) + value->RemoveObserver(this); +} + +nsresult nsSVGPolylineFrame::Init() +{ + nsCOMPtr anim_points = do_QueryInterface(mContent); + NS_ASSERTION(anim_points,"wrong content element"); + anim_points->GetPoints(getter_AddRefs(mPoints)); + NS_ASSERTION(mPoints, "no points"); + if (!mPoints) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mPoints); + if (value) + value->AddObserver(this); + return nsSVGGraphicFrame::Init(); +} + +void nsSVGPolylineFrame::ConstructPath(nsASVGPathBuilder* pathBuilder) +{ + if (!mPoints) return; + + PRUint32 count; + mPoints->GetNumberOfItems(&count); + if (count == 0) return; + + PRUint32 i; + for (i = 0; i < count; ++i) { + nsCOMPtr point; + mPoints->GetItem(i, getter_AddRefs(point)); + + float x, y; + point->GetX(&x); + point->GetY(&y); + if (i == 0) + pathBuilder->Moveto(x, y); + else + pathBuilder->Lineto(x, y); + } +} diff --git a/layout/svg/base/src/nsSVGRectFrame.cpp b/layout/svg/base/src/nsSVGRectFrame.cpp new file mode 100644 index 000000000000..84810e937929 --- /dev/null +++ b/layout/svg/base/src/nsSVGRectFrame.cpp @@ -0,0 +1,225 @@ +/* -*- 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 (original author) + * Håkan Waara + * + * 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 "nsSVGGraphicFrame.h" +#include "nsIDOMSVGAnimatedLength.h" +#include "nsIDOMSVGLength.h" +#include "nsIDOMSVGPoint.h" +#include "nsIDOMSVGRectElement.h" +#include "nsIDOMSVGElement.h" +#include "nsIDOMSVGSVGElement.h" +#include "nsASVGPathBuilder.h" + +class nsSVGRectFrame : public nsSVGGraphicFrame +{ + friend nsresult + NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); + + virtual ~nsSVGRectFrame(); + + virtual nsresult Init(); + virtual void ConstructPath(nsASVGPathBuilder* pathBuilder); + + nsCOMPtr mX; + nsCOMPtr mY; + nsCOMPtr mWidth; + nsCOMPtr mHeight; + nsCOMPtr mRx; + nsCOMPtr mRy; +}; + +//---------------------------------------------------------------------- +// Implementation + +nsresult +NS_NewSVGRectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame) +{ + *aNewFrame = nsnull; + + nsCOMPtr Rect = do_QueryInterface(aContent); + if (!Rect) { +#ifdef DEBUG + printf("warning: trying to construct an SVGRectFrame for a content element that doesn't support the right interfaces\n"); +#endif + return NS_ERROR_FAILURE; + } + + nsSVGRectFrame* it = new (aPresShell) nsSVGRectFrame; + if (nsnull == it) + return NS_ERROR_OUT_OF_MEMORY; + + *aNewFrame = it; + return NS_OK; +} + +nsSVGRectFrame::~nsSVGRectFrame() +{ + nsCOMPtr value; + if (mX && (value = do_QueryInterface(mX))) + value->RemoveObserver(this); + if (mY && (value = do_QueryInterface(mY))) + value->RemoveObserver(this); + if (mWidth && (value = do_QueryInterface(mWidth))) + value->RemoveObserver(this); + if (mHeight && (value = do_QueryInterface(mHeight))) + value->RemoveObserver(this); + if (mRx && (value = do_QueryInterface(mRx))) + value->RemoveObserver(this); + if (mRy && (value = do_QueryInterface(mRy))) + value->RemoveObserver(this); +} + +nsresult nsSVGRectFrame::Init() +{ + nsCOMPtr Rect = do_QueryInterface(mContent); + NS_ASSERTION(Rect,"wrong content element"); + + { + nsCOMPtr length; + Rect->GetX(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mX)); + NS_ASSERTION(mX, "no x"); + if (!mX) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mX); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + Rect->GetY(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mY)); + NS_ASSERTION(mY, "no y"); + if (!mY) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mY); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + Rect->GetWidth(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mWidth)); + NS_ASSERTION(mWidth, "no width"); + if (!mWidth) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mWidth); + if (value) + value->AddObserver(this); + } + { + nsCOMPtr length; + Rect->GetHeight(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mHeight)); + NS_ASSERTION(mHeight, "no height"); + if (!mHeight) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mHeight); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + Rect->GetRx(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mRx)); + NS_ASSERTION(mRx, "no rx"); + if (!mRx) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mRx); + if (value) + value->AddObserver(this); + } + + { + nsCOMPtr length; + Rect->GetRy(getter_AddRefs(length)); + length->GetBaseVal(getter_AddRefs(mRy)); + NS_ASSERTION(mRy, "no ry"); + if (!mRy) return NS_ERROR_FAILURE; + nsCOMPtr value = do_QueryInterface(mRy); + if (value) + value->AddObserver(this); + } + + return nsSVGGraphicFrame::Init(); +} + +void nsSVGRectFrame::ConstructPath(nsASVGPathBuilder* pathBuilder) +{ + float x, y, width, height, rx, ry; + + mX->GetValue(&x); + mY->GetValue(&y); + mWidth->GetValue(&width); + mHeight->GetValue(&height); + mRx->GetValue(&rx); + mRy->GetValue(&ry); + + /* In a perfect world, this would be handled by the DOM, and + return a DOM exception. */ + if (width == 0 || height == 0 || ry < 0 || rx < 0) + return; + + /* If any of the attributes are not set, we need to set it to the corresponding + attribute's value (e.g. if rx is not set, assign ry's value to rx). */ + if (!rx || !ry) + { + if (rx < ry) + rx = ry; + else + ry = rx; + } + + // Rx/ry must not be values higher than half the rectangle's width/height + if (rx > (width/2)) + rx = width/2; + + if (ry > (height/2)) + ry = height/2; + + pathBuilder->Moveto(x+rx, y); + pathBuilder->Lineto(x+width-rx, y); + pathBuilder->Arcto(x+width, y+ry , rx, ry, 0.0, 0, 1); + pathBuilder->Lineto(x+width, y+height-ry); + pathBuilder->Arcto(x+width-rx, y+height , rx, ry, 0.0, 0, 1); + pathBuilder->Lineto(x+rx,y+height); + pathBuilder->Arcto(x, y+height-ry , rx, ry, 0.0, 0, 1); + pathBuilder->Lineto(x,y+ry); + pathBuilder->Arcto(x+rx, y, rx, ry, 0.0, 0, 1); + pathBuilder->ClosePath(&x,&y); + +} diff --git a/layout/svg/base/src/nsSVGRenderItem.cpp b/layout/svg/base/src/nsSVGRenderItem.cpp new file mode 100644 index 000000000000..d0a9bbaa1187 --- /dev/null +++ b/layout/svg/base/src/nsSVGRenderItem.cpp @@ -0,0 +1,71 @@ +/* -*- 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 (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 "nsSVGRenderItem.h" + +nsSVGRenderItem::nsSVGRenderItem() + : mSvp(nsnull) +{ + +} + +nsSVGRenderItem::~nsSVGRenderItem() +{ + Clear(); +} + +void nsSVGRenderItem::Clear() +{ + if (mSvp) + art_free(mSvp); + mSvp = nsnull; +} + +ArtUta* +nsSVGRenderItem::GetUta() +{ + if (!mSvp) return nsnull; + return art_uta_from_svp(mSvp); +} + +PRBool +nsSVGRenderItem::Contains(float x, float y) +{ + if (!mSvp) return PR_FALSE; + return (art_svp_point_wind(GetSvp(), x, y) != 0); +} diff --git a/layout/svg/content/src/nsSVGAtoms.h b/layout/svg/base/src/nsSVGRenderItem.h similarity index 50% rename from layout/svg/content/src/nsSVGAtoms.h rename to layout/svg/base/src/nsSVGRenderItem.h index 4d21424a7726..452c034df04b 100644 --- a/layout/svg/content/src/nsSVGAtoms.h +++ b/layout/svg/base/src/nsSVGRenderItem.h @@ -1,26 +1,26 @@ /* -*- 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 +/* ----- BEGIN LICENSE BLOCK ----- + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * The contents of this file are subject to the Netscape Public License + * 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/NPL/ + * 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 Original Code is the Mozilla SVG project. * * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 + * Crocodile Clips Ltd.. + * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Original Author: Rod Spears (rods@netscape.com) + * Alex Fritze (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 @@ -32,43 +32,42 @@ * 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. + * the terms of any one of the MPL, the GPL or the LGPL. * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsSVGAtoms_h___ -#define nsSVGAtoms_h___ + * ----- END LICENSE BLOCK ----- */ + +#ifndef __NS_SVGRENDERITEM_H__ +#define __NS_SVGRENDERITEM_H__ #include "prtypes.h" -#include "nsIAtom.h" +#include "nsColor.h" +#include "libart-incs.h" -class nsINameSpaceManager; - -/** - * This class wraps up the creation and destruction of the standard - * set of SVG atoms used during normal SVG handling. This object - * is created when the first SVG content object is created, and - * destroyed when the last such content object is destroyed. - */ -class nsSVGAtoms { +class nsSVGRenderItem +{ public: + nsSVGRenderItem(); + virtual ~nsSVGRenderItem(); - static void AddRefAtoms(); - static void ReleaseAtoms(); + void Clear(); + + ArtSVP* GetSvp() { return mSvp; } + ArtUta* GetUta(); // calculates micro-tile array - // XUL namespace ID, good for the life of the nsSVGAtoms object - static PRInt32 nameSpaceID; + PRBool IsEmpty() { return (mSvp == nsnull); } - /* Declare all atoms + void SetOpacity(float opacity) { mOpacity=opacity; } + float GetOpacity() { return mOpacity; } - The atom names and values are stored in nsCSSAtomList.h and - are brought to you by the magic of C preprocessing - - Add new atoms to nsCSSAtomList and all support logic will be auto-generated - */ -#define SVG_ATOM(_name, _value) static nsIAtom* _name; -#include "nsSVGAtomList.h" -#undef SVG_ATOM + void SetColor(nscolor color) { mColor = color; } + nscolor GetColor() { return mColor; } + PRBool Contains(float x, float y); + +protected: + ArtSVP* mSvp; + float mOpacity; + nscolor mColor; }; -#endif /* nsSVGAtoms_h___ */ +#endif // __NS_SVGRENDERITEM_H__ diff --git a/layout/svg/base/src/nsSVGRenderingContext.cpp b/layout/svg/base/src/nsSVGRenderingContext.cpp new file mode 100644 index 000000000000..f495d8c0df31 --- /dev/null +++ b/layout/svg/base/src/nsSVGRenderingContext.cpp @@ -0,0 +1,324 @@ +/* -*- 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 (original author) + * Bradley Baetz + * + * 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 "nsSVGRenderingContext.h" +#include "nsSVGRenderItem.h" +#include "nsIDeviceContext.h" +#include "nsGfxCIID.h" +#include "nsIRegion.h" + +#include "libart-incs.h" + +//////////////////////////////////////////////////////////////////////// +// nsSVGRenderingContext + +nsSVGRenderingContext::nsSVGRenderingContext(nsIPresContext* presContext, + nsIRenderingContext *renderingContext, + const nsRect& dirtyRectTwips) + : mRenderingContext(renderingContext), + mPresContext(presContext), + mDirtyRect(dirtyRectTwips), + mDirtyRectTwips(dirtyRectTwips), + mTempBuffer(nsnull) +{ + float twipsToPixels; + mPresContext->GetTwipsToPixels(&twipsToPixels); + mDirtyRect *= twipsToPixels; + if (mDirtyRect.width < 1) + mDirtyRect.width = 1; + + if (mDirtyRect.height < 1) + mDirtyRect.height = 1; + + // Set up our buffer. Do it here, because this is *SLOW* on some + // platforms + InitializeBuffer(); +} + +nsSVGRenderingContext::~nsSVGRenderingContext() +{ + +} + +//---------------------------------------------------------------------- + +void +nsSVGRenderingContext::PaintSVGRenderItem(nsSVGRenderItem* item) +{ + if (!item->GetSvp()) return; + + ArtRender* render = NewRender(); + if (!render) return; + + art_render_mask_solid(render, (int)(0x10000 * item->GetOpacity())); + + art_render_svp(render, item->GetSvp()); + + nscolor rgb = item->GetColor(); + ArtPixMaxDepth col[3]; + + col[0] = ART_PIX_MAX_FROM_8(NS_GET_R(rgb)); + col[1] = ART_PIX_MAX_FROM_8(NS_GET_G(rgb)); + col[2] = ART_PIX_MAX_FROM_8(NS_GET_B(rgb)); + + art_render_image_solid(render, col); + + InvokeRender(render); +} + +void nsSVGRenderingContext::ClearBuffer(nscolor color) +{ + // XXX - should use art_render_clear, but that crashes on non-24 bit + // displays, still + nsIRenderingContext* ctx = LockMozRenderingContext(); + ctx->PushState(); + ctx->SetColor(color); + ctx->FillRect(mDirtyRectTwips); + PRBool aClipEmpty; + ctx->PopState(aClipEmpty); + UnlockMozRenderingContext(); +} + +nsIRenderingContext* nsSVGRenderingContext::LockMozRenderingContext() +{ + NS_ASSERTION(mTempBuffer==0, "nested LockMozRenderingContext() calls?"); + mRenderingContext->GetDrawingSurface(&mTempBuffer); + mBuffer->Unlock(); // We don't own this any more + mRenderingContext->SelectOffScreenDrawingSurface(mBuffer); + + // prepare the context for the new surface: + mRenderingContext->PushState(); + nsTransform2D* xform; + mRenderingContext->GetCurrentTransform(xform); + + xform->SetTranslation((float)-mDirtyRect.x, (float)-mDirtyRect.y); + + // setting the clip rectangle is essential here. If we don't, and + // none of the saved parent states has a valid clip rect, then bad + // things can happen if our caller (usually a ) sets + // up a clip rect. In that case, the rendering context (at least on + // Windows) doesn't know which clip area to restore when the state + // is popped and we're stuck with the caller's clip rect for all + // eternity. The result is erratic redraw-behaviour... + PRBool aClipEmpty; + mRenderingContext->SetClipRect(mDirtyRectTwips, nsClipCombine_kReplace, aClipEmpty); + + return mRenderingContext; +} + +void nsSVGRenderingContext::UnlockMozRenderingContext() +{ + NS_ASSERTION(mTempBuffer, "no drawing surface to restore"); + PRBool aClipEmpty; + mRenderingContext->PopState(aClipEmpty); + mRenderingContext->SelectOffScreenDrawingSurface(mTempBuffer); + mTempBuffer = nsnull; + + PRInt32 bytesPerWidth; + // Reclaim ownership + mBuffer->Lock(0, 0, mDirtyRect.width, mDirtyRect.height,(void **)&mBitBuf, + &mStride, &bytesPerWidth,0); +} + +// Define this to get the image dumped to file. This is slow. +// Its _really_ useful for debugging, though +//#define DUMP_IMAGE + +void nsSVGRenderingContext::DumpImage() { +#ifdef DUMP_IMAGE + static int numOut=0; + char buf[30]; + sprintf(buf,"svg%d.ppm",numOut); + ++numOut; + + printf("dumping %s\n",buf); + + FILE* f = fopen(buf, "wb"); + + PRUint32 width = mDirtyRect.width; + PRUint32 height = mDirtyRect.height; + + fprintf(f,"P3\n%d %d\n255\n",width,height); + + nsPixelFormat format; + mBuffer->GetPixelFormat(&format); + + for(int row=0; row < mDirtyRect.height;++row) { + for (int col=0;col> format.mRedShift; + rgb[1] = (val&format.mGreenMask) >> format.mGreenShift; + rgb[2] = (val&format.mBlueMask) >> format.mBlueShift; + fprintf(f,"%d %d %d ",rgb[0],rgb[1],rgb[2]); + //fprintf(f,"%d ",val); + } + fprintf(f,"\n"); + } + + fclose(f); +#endif +} + +void nsSVGRenderingContext::Render() +{ + DumpImage(); + mBuffer->Unlock(); // OK, its not ours any more + + /* This is usefull to debug clip region problems + PRInt32 bytesPerWidth; + mBuffer->Lock(0, 0, mDirtyRect.width, mDirtyRect.height,(void **)&mBitBuf, + &mStride, &bytesPerWidth,0); + DumpImage(); + mBuffer->Unlock(); + */ + + PRBool clip; + mRenderingContext->PopState(clip); + + mRenderingContext->CopyOffScreenBits(mBuffer, 0, 0, mDirtyRectTwips, + NS_COPYBITS_TO_BACK_BUFFER | + NS_COPYBITS_XFORM_DEST_VALUES); +} + +//---------------------------------------------------------------------- +// implementation helpers: + + +ArtRender* nsSVGRenderingContext::NewRender() +{ + ArtRender* render=nsnull; + + nsPixelFormat format; + mBuffer->GetPixelFormat(&format); + + render = art_render_new(mDirtyRect.x, mDirtyRect.y, + mDirtyRect.x+ mDirtyRect.width, + mDirtyRect.y+ mDirtyRect.height, + mBitBuf, + mStride, + NS_STATIC_CAST(ArtDestinationPixelFormat, + mArtPixelFormat), + ART_ALPHA_NONE, // alpha + NULL); + + static int foo=0; + //art_render_clear_rgb(render,NS_RGB(0,255,foo?255:0)); + foo = 1-foo; + return render; +} + +void nsSVGRenderingContext::InvokeRender(ArtRender* render) +{ + art_render_invoke(render); // also frees the render +} + + +void nsSVGRenderingContext::InitializeBuffer() +{ + // OK. We need to reset the clip rect. I think this sucks: + // a) I shouldn't have to do this manually + // b) I should be able to clear a clip rect directly... + // That would probably speed things up, too, because (at least with X) + // I'd be able to reuse the GC + // Apparently (a) isn't a bug, though + mRenderingContext->PushState(); + + nsRect r; + r.x = r.y = 0; + r.width = mDirtyRectTwips.width; + r.height = mDirtyRectTwips.height; + + nsTransform2D* xform; + mRenderingContext->GetCurrentTransform(xform); + xform->TransformCoord(&r.x,&r.y); + + // And -> twips! + float twipsPerPx; + mPresContext->GetPixelsToTwips(&twipsPerPx); + r.x *= (int)-twipsPerPx; + r.y *= (int)-twipsPerPx; + + PRBool clipEmpty; + mRenderingContext->SetClipRect(r,nsClipCombine_kReplace,clipEmpty); + + mRenderingContext->CreateDrawingSurface(&mDirtyRect, + NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS, + (void*&)*getter_AddRefs(mBuffer)); + nsCOMPtr dc; + mRenderingContext->GetDeviceContext(*getter_AddRefs(dc)); + + unsigned int depth; + dc->GetDepth(depth); + + switch (depth) { + case 16: { + nsPixelFormat format; + mBuffer->GetPixelFormat(&format); + + if (format.mGreenCount == 5) + mArtPixelFormat = ART_PF_555; + else + mArtPixelFormat = ART_PF_565; + + } break; + + case 24: + mArtPixelFormat = ART_PF_RGB8; + break; + + case 32: + // need to be sure it isn't RGBA8 ? + mArtPixelFormat = ART_PF_ARGB8; + break; + + default: + NS_ASSERTION(false, "unsupported pixel depth"); + } + + PRInt32 bytesPerWidth; + + // And set up the locked bits + //RenderingContext->PushState(); + mBuffer->Lock(0, 0, + mDirtyRect.width, mDirtyRect.height,(void **)&mBitBuf, + &mStride, &bytesPerWidth,0); + + ClearBuffer(NS_RGB(255,255,255)); +} diff --git a/layout/svg/base/src/nsSVGRenderingContext.h b/layout/svg/base/src/nsSVGRenderingContext.h new file mode 100644 index 000000000000..69e5c985f977 --- /dev/null +++ b/layout/svg/base/src/nsSVGRenderingContext.h @@ -0,0 +1,100 @@ +/* -*- 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 (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_SVGRENDERINGCONTEXT_H__ +#define __NS_SVGRENDERINGCONTEXT_H__ + +#include "nsCOMPtr.h" +#include "nsIRenderingContext.h" +#include "nsTransform2D.h" +#include "nsIPresContext.h" +#include "nsColor.h" +#include "nsRect.h" + +#include "libart-incs.h" + +class nsSVGRenderItem; + +/* This is a rendering context wrapper. Grabbing one of these LOCKS the context + * To draw to it directly (or to the underlying buffer), you need + * to call LockMozRenderingContext, and then call UnlockMozRenderingContext + * before drawing to it again. + */ +class nsSVGRenderingContext +{ +public: + nsSVGRenderingContext(nsIPresContext* presContext, + nsIRenderingContext *renderingContext, + const nsRect& dirtyRectTwips); + ~nsSVGRenderingContext(); + + void PaintSVGRenderItem(nsSVGRenderItem* item); + void ClearBuffer(nscolor color); + + // return an nsIRenderingContext for our pixel buffer. + // Calling these can be expensive. + nsIRenderingContext* LockMozRenderingContext(); + void UnlockMozRenderingContext(); + + nsIPresContext* GetPresContext() { return mPresContext; } + const nsRect& GetDirtyRectTwips() { return mDirtyRectTwips; } + + void Render(); // blt our pixel buffer to the rendering context + +protected: + ArtRender* NewRender(); + void InvokeRender(ArtRender* render); + + void InitializeBuffer(); + + void DumpImage(); + + nsCOMPtr mRenderingContext; + nsCOMPtr mPresContext; + nsRect mDirtyRect; + nsRect mDirtyRectTwips; + + nsCOMPtr mBuffer; + nsDrawingSurface mTempBuffer; // temp storage for during DC locking + int mArtPixelFormat; + PRInt32 mStride; + PRUint8* mBitBuf; +}; + +#endif // __NS_SVGRENDERINGCONTEXT_H__ + diff --git a/layout/svg/base/src/nsSVGStroke.cpp b/layout/svg/base/src/nsSVGStroke.cpp new file mode 100644 index 000000000000..d494565b2804 --- /dev/null +++ b/layout/svg/base/src/nsSVGStroke.cpp @@ -0,0 +1,153 @@ +/* -*- 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 (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 "nsSVGStroke.h" +#include "nsCOMPtr.h" +#include "nsIServiceManager.h" +#include "nsIPref.h" +#include "prdtoa.h" +#include "nsMemory.h" +#include "nsReadableUtils.h" + +void +nsSVGStroke::Build(ArtVpath* path, const nsSVGStrokeStyle& style) +{ + if (mSvp) + art_svp_free(mSvp); + + ArtPathStrokeCapType captype; + switch(style.linecap) { + case NS_STYLE_STROKE_LINECAP_BUTT: + captype = ART_PATH_STROKE_CAP_BUTT; + break; + case NS_STYLE_STROKE_LINECAP_ROUND: + captype = ART_PATH_STROKE_CAP_ROUND; + break; + case NS_STYLE_STROKE_LINECAP_SQUARE: + captype = ART_PATH_STROKE_CAP_SQUARE; + break; + default: + NS_ERROR("not reached"); + } + + ArtPathStrokeJoinType jointype; + switch(style.linejoin) { + case NS_STYLE_STROKE_LINEJOIN_MITER: + jointype = ART_PATH_STROKE_JOIN_MITER; + break; + case NS_STYLE_STROKE_LINEJOIN_ROUND: + jointype = ART_PATH_STROKE_JOIN_ROUND; + break; + case NS_STYLE_STROKE_LINEJOIN_BEVEL: + jointype = ART_PATH_STROKE_JOIN_BEVEL; + break; + default: + NS_ERROR("not reached"); + } + + if (style.dasharray.Length() > 0) { + ArtVpathDash dash; + dash.offset = style.dashoffset; + + // XXX parsing of the dasharray string should be done elsewhere + + char* str; + { + nsAutoString temp(style.dasharray); + str = ToNewCString(temp); + } + + // array elements are separated by commas. count them to get our + // max no of elems. + dash.n_dash = 0; + char* cp = str; + while (*cp) { + if (*cp == ',') + ++dash.n_dash; + ++cp; + } + ++dash.n_dash; + + if (dash.n_dash > 0) { + // get the elements + dash.dash = new double[dash.n_dash]; + cp = str; + char *elem; + int count = 0; + while ((elem = nsCRT::strtok(cp, "',", &cp))) { + char *end; + dash.dash[count++] = PR_strtod(elem, &end); +#ifdef DEBUG + printf("[%f]",dash.dash[count-1]); +#endif + } + dash.n_dash = count; + nsMemory::Free(str); + + // create a dashed vpath: + path = art_vpath_dash(path, &dash); + + // clean up + delete[] dash.dash; + } + } + + + mSvp = art_svp_vpath_stroke(path, + jointype, + captype, + style.width, + style.miterlimit, + getFlatness()); +} + +double nsSVGStroke::getFlatness() +{ + double flatness = 0.5; + + nsCOMPtr prefs(do_GetService(NS_PREF_CONTRACTID)); + if (!prefs) return flatness; + + // XXX: wouldn't it be great if nsIPref had a 'GetFloatPref()'-function? + char *valuestr = nsnull; + if (NS_SUCCEEDED(prefs->CopyCharPref("svg.stroke_flatness",&valuestr)) && (valuestr)) { + flatness = PR_strtod(valuestr, nsnull); + nsMemory::Free(valuestr); + } + return flatness; +} diff --git a/layout/svg/base/src/nsSVGStroke.h b/layout/svg/base/src/nsSVGStroke.h new file mode 100644 index 000000000000..e1e8bb22298e --- /dev/null +++ b/layout/svg/base/src/nsSVGStroke.h @@ -0,0 +1,65 @@ +/* -*- 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 (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_SVGSTROKE_H__ +#define __NS_SVGSTROKE_H__ + +#include "nsSVGRenderItem.h" +#include "libart-incs.h" +#include "nsStyleConsts.h" + +struct nsSVGStrokeStyle +{ + nsString dasharray; // XXX + float dashoffset; + PRInt8 linecap; // see nsStyleConsts.h + PRInt8 linejoin; // see nsStyleConsts.h + float miterlimit; + float width; +}; + +class nsSVGStroke : public nsSVGRenderItem +{ +public: + void Build(ArtVpath* path, const nsSVGStrokeStyle& style); + +protected: + double getFlatness(); +}; + +#endif // __NS_SVGSTROKE_H__ diff --git a/layout/svg/base/src/svg.css b/layout/svg/base/src/svg.css new file mode 100644 index 000000000000..ddaf83a37fe6 --- /dev/null +++ b/layout/svg/base/src/svg.css @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * 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 Crocodile Clips are + * Copyright (C) 2001 Crocodile Clips Ltd. All + * Rights Reserved. + * + * Contributor(s): + * + * Alex Fritze (original author) + * + */ + + +@namespace url(http://www.w3.org/2000/svg); + +/* maybe we don't need this after all! */ + + + diff --git a/layout/svg/content/src/Makefile.in b/layout/svg/content/src/Makefile.in deleted file mode 100644 index 124246ddb195..000000000000 --- a/layout/svg/content/src/Makefile.in +++ /dev/null @@ -1,46 +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 - -MODULE = layout -LIBRARY_NAME = gksvgcon_s -REQUIRES = xpcom \ - string \ - content \ - $(NULL) - -CPPSRCS = nsSVGAtoms.cpp - -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - -DEFINES += -D_IMPL_NS_HTML - -INCLUDES += -I$(srcdir)/../../../base/src - diff --git a/layout/svg/content/src/makefile.win b/layout/svg/content/src/makefile.win deleted file mode 100644 index 7c75d17fcf28..000000000000 --- a/layout/svg/content/src/makefile.win +++ /dev/null @@ -1,56 +0,0 @@ -#!nmake -# -# 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=..\..\..\.. - -LIBRARY_NAME=layoutsvgcontent_s -MODULE=layout -REQUIRES = \ - string \ - xpcom \ - content \ - $(NULL) - -DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN - -CPP_OBJS= \ - .\$(OBJDIR)\nsSVGAtoms.obj \ - $(NULL) - -EXPORTS = \ - $(NULL) - -LINCS=-I..\..\..\html\style\src -I..\..\..\html\base\src \ - -I..\..\..\html\document\src \ - -I..\..\..\base\src - -LCFLAGS = \ - $(LCFLAGS) \ - $(DEFINES) \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> - -libs:: $(LIBRARY) - $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib - -clobber:: - rm -f $(DIST)\lib\$(LIBRARY_NAME).lib diff --git a/layout/svg/content/src/nsSVGAtoms.cpp b/layout/svg/content/src/nsSVGAtoms.cpp deleted file mode 100644 index 39d4aaafa5d5..000000000000 --- a/layout/svg/content/src/nsSVGAtoms.cpp +++ /dev/null @@ -1,96 +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): - * Original Author: Rod Spears (rods@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 ***** */ - -#include "nsString.h" -#include "nsINameSpaceManager.h" -#include "nsSVGAtoms.h" -#include "nsLayoutCID.h" - -static const char kSVGNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.svg"; - -PRInt32 nsSVGAtoms::nameSpaceID; - -// define storage for all atoms -#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name; -#include "nsSVGAtomList.h" -#undef SVG_ATOM - - -static nsrefcnt gRefCnt = 0; -static nsINameSpaceManager* gNameSpaceManager; - -void nsSVGAtoms::AddRefAtoms() { - - if (gRefCnt == 0) { - /* SVG Atoms registers the SVG name space ID because it's a convenient - place to do this, if you don't want a permanent, "well-known" ID. - */ - - NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID); - nsCOMPtr nsmgr = - do_CreateInstance(kNameSpaceManagerCID); - - if (nsmgr) { - nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kSVGNameSpace), - nameSpaceID); - - gNameSpaceManager = nsmgr; - NS_ADDREF(gNameSpaceManager); - } else { - NS_ASSERTION(0, "failed to create SVG atoms namespace manager"); - } - - // now register the atoms -#define SVG_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value); -#include "nsSVGAtomList.h" -#undef SVG_ATOM - } - ++gRefCnt; -} - -void nsSVGAtoms::ReleaseAtoms() { - - NS_PRECONDITION(gRefCnt != 0, "bad release of SVG atoms"); - if (--gRefCnt == 0) { -#define SVG_ATOM(_name, _value) NS_RELEASE(_name); -#include "nsSVGAtomList.h" -#undef SVG_ATOM - - NS_IF_RELEASE(gNameSpaceManager); - } -} diff --git a/layout/svg/makefile.win b/layout/svg/makefile.win index ad181aa813c3..c08f22f8fb26 100644 --- a/layout/svg/makefile.win +++ b/layout/svg/makefile.win @@ -21,6 +21,6 @@ DEPTH=..\.. -DIRS = base content +DIRS = base include <$(DEPTH)\config\rules.mak> diff --git a/makefile.win b/makefile.win index fc4230b1ba98..29b45418b928 100644 --- a/makefile.win +++ b/makefile.win @@ -78,6 +78,9 @@ DIRS = \ expat \ gfx \ gfx2 \ +!ifdef MOZ_INTERNAL_LIBART_LGPL + other-licenses\libart_lgpl \ +!endif modules\libpr0n \ modules\plugin \ uriloader \ diff --git a/netwerk/mime/src/nsXMLMIMEDataSource.cpp b/netwerk/mime/src/nsXMLMIMEDataSource.cpp index 82802c0ff1ec..c0fca37c9cf4 100644 --- a/netwerk/mime/src/nsXMLMIMEDataSource.cpp +++ b/netwerk/mime/src/nsXMLMIMEDataSource.cpp @@ -471,6 +471,11 @@ nsXMLMIMEDataSource::InitFromHack() { rv = AppendExtension(TEXT_XML, "xsl"); if (NS_FAILED(rv)) return rv; +#ifdef MOZ_SVG + rv = AddMapping("image/svg+xml", "svg", "Scalable Vector Graphics", nsnull, 'svg ', 'ttxt'); + if (NS_FAILED(rv)) return rv; +#endif + rv = AddMapping(TEXT_CSS, "css", "Style Sheet", nsnull, 'TEXT','ttxt'); if (NS_FAILED(rv)) return rv; diff --git a/parser/htmlparser/public/nsIParser.h b/parser/htmlparser/public/nsIParser.h index b559101335f6..e344cfbed9ca 100644 --- a/parser/htmlparser/public/nsIParser.h +++ b/parser/htmlparser/public/nsIParser.h @@ -373,7 +373,7 @@ const PRUnichar kNullCh = '\0'; #define kApplicationJSContentType "application/x-javascript" #define kTextJSContentType "text/javascript" #define kSGMLTextContentType "text/sgml" - +#define kSVGTextContentType "image/svg+xml" #define NS_IPARSER_FLAG_UNKNOWN_MODE 0x00000000 #define NS_IPARSER_FLAG_QUIRKS_MODE 0x00000002 diff --git a/parser/htmlparser/src/nsExpatTokenizer.cpp b/parser/htmlparser/src/nsExpatTokenizer.cpp index fe1fca530f10..9742f7bbd341 100644 --- a/parser/htmlparser/src/nsExpatTokenizer.cpp +++ b/parser/htmlparser/src/nsExpatTokenizer.cpp @@ -929,29 +929,53 @@ int Tokenizer_HandleExternalEntityRef(XML_Parser parser, // Load the external entity into a buffer nsCOMPtr in; nsAutoString absURL; + nsresult rv = NS_OK; + PRUnichar *uniBuf = nsnull; + PRUint32 retLen = 0; + +#ifdef MOZ_SVG + // yuck. I don't know of any other way to do this, though, since we don't + // read external dtd's, and we need the #FIXED xmlns attribute, so we + // can't do this later based on what namespace we're in - bbaetz - nsresult rv = nsExpatTokenizer::OpenInputStream(systemId, base, getter_AddRefs(in), &absURL); + // The alternative is remapping the systemId, and installing an svg.dtd file + // in the dtd directory. This is simpler, for now. + + // XXX - need to do this for the other #FIXED attribuues as well + NS_NAMED_LITERAL_STRING(svgDtd, + ""); + +#define svgPublicIdPrefix "-//W3C//DTD SVG " + + if (publicId && !nsCRT::strncmp((const PRUnichar*)publicId, + NS_LITERAL_STRING(svgPublicIdPrefix).get(), + sizeof(svgPublicIdPrefix)-1)) { + uniBuf = ToNewUnicode(svgDtd); + retLen = svgDtd.Length(); + } else { +#endif + rv = nsExpatTokenizer::OpenInputStream(systemId, base, getter_AddRefs(in), &absURL); + + if (NS_SUCCEEDED(rv) && in) + rv = nsExpatTokenizer::LoadStream(in, uniBuf, retLen); +#ifdef MOZ_SVG + } +#endif - if (NS_SUCCEEDED(rv) && in) { - PRUint32 retLen = 0; - PRUnichar *uniBuf = nsnull; - rv = nsExpatTokenizer::LoadStream(in, uniBuf, retLen); + // Pass the buffer to expat for parsing + if (NS_SUCCEEDED(rv) && uniBuf) { + // Create a parser for parsing the external entity + XML_Parser entParser = XML_ExternalEntityParserCreate(parser, 0, + (const XML_Char*) NS_LITERAL_STRING("UTF-16").get()); - // Pass the buffer to expat for parsing - if (NS_SUCCEEDED(rv) && uniBuf) { - // Create a parser for parsing the external entity - XML_Parser entParser = XML_ExternalEntityParserCreate(parser, 0, - (const XML_Char*) NS_LITERAL_STRING("UTF-16").get()); - - if (entParser) { - XML_SetBase(entParser, (const XML_Char*) absURL.get()); - result = XML_Parse(entParser, (char *)uniBuf, retLen * sizeof(PRUnichar), 1); - XML_ParserFree(entParser); - } - - PR_FREEIF(uniBuf); + if (entParser) { + XML_SetBase(entParser, (const XML_Char*) absURL.get()); + result = XML_Parse(entParser, (char *)uniBuf, retLen * sizeof(PRUnichar), 1); + XML_ParserFree(entParser); } } + PR_FREEIF(uniBuf); + #else /* ! XML_DTD */ NS_NOTYETIMPLEMENTED("Error: Tokenizer_HandleExternalEntityRef() not yet implemented."); diff --git a/parser/htmlparser/src/nsViewSourceHTML.cpp b/parser/htmlparser/src/nsViewSourceHTML.cpp index b1ffb781c1aa..c06ddd98d412 100644 --- a/parser/htmlparser/src/nsViewSourceHTML.cpp +++ b/parser/htmlparser/src/nsViewSourceHTML.cpp @@ -431,6 +431,9 @@ CViewSourceHTML::CanParse(CParserContext& aParserContext, aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) || aParserContext.mMimeType.EqualsWithConversion(kHTMLTextContentType) || aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType) || +#ifdef MOZ_SVG + aParserContext.mMimeType.Equals(NS_LITERAL_STRING(kSVGTextContentType)) || +#endif aParserContext.mMimeType.EqualsWithConversion(kSGMLTextContentType)) { result=ePrimaryDetect; } diff --git a/parser/htmlparser/src/nsWellFormedDTD.cpp b/parser/htmlparser/src/nsWellFormedDTD.cpp index 9993a945c799..68b676b18cfa 100644 --- a/parser/htmlparser/src/nsWellFormedDTD.cpp +++ b/parser/htmlparser/src/nsWellFormedDTD.cpp @@ -198,7 +198,11 @@ CWellFormedDTD::CanParse(CParserContext& aParserContext, aParserContext.mMimeType.EqualsWithConversion(kXMLApplicationContentType) || aParserContext.mMimeType.EqualsWithConversion(kXHTMLApplicationContentType) || aParserContext.mMimeType.EqualsWithConversion(kRDFTextContentType) || - aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType)) { + aParserContext.mMimeType.EqualsWithConversion(kXULTextContentType) +#ifdef MOZ_SVG + || aParserContext.mMimeType.Equals(NS_LITERAL_STRING(kSVGTextContentType)) +#endif + ) { result=ePrimaryDetect; } else if (aParserContext.mMimeType.IsEmpty()) { diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 508199b4de36..ad34bd27dc19 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -96,6 +96,9 @@ static nsDefaultMimeTypeEntry defaultMimeEntries [] = { TEXT_XUL, "xul", "XML-Based User Interface Language", 'TEXT', 'ttxt' }, { TEXT_XML, "xml,xsl", "Extensible Markup Language", 'TEXT', 'ttxt' }, { "application/xhtml+xml", "xhtml,xht", "Extensible HyperText Markup Language", 'TEXT', 'ttxt' }, +#ifdef MOZ_SVG + { "image/svg+xml", "svg", "Scalable Vector Graphics", 'svg ', 'ttxt' }, +#endif { TEXT_CSS, "css", "Style Sheet", 'TEXT', 'ttxt' }, { APPLICATION_JAVASCRIPT, "js", "Javascript Source File", 'TEXT', 'ttxt' }, { MESSAGE_RFC822, "eml", "RFC-822 data", 'TEXT', 'MOSS' }, diff --git a/xpfe/browser/src/nsBrowserInstance.cpp b/xpfe/browser/src/nsBrowserInstance.cpp index e366b990e6b9..16f5d974606f 100644 --- a/xpfe/browser/src/nsBrowserInstance.cpp +++ b/xpfe/browser/src/nsBrowserInstance.cpp @@ -1027,6 +1027,13 @@ static nsModuleComponentInfo components[] = { NS_CONTENT_HANDLER_CONTRACTID_PREFIX"application/vnd.mozilla.xul+xml", nsBrowserContentHandlerConstructor }, +#ifdef MOZ_SVG + { "Browser Content Handler", + NS_BROWSERCONTENTHANDLER_CID, + NS_CONTENT_HANDLER_CONTRACTID_PREFIX"image/svg+xml", + nsBrowserContentHandlerConstructor + }, +#endif { "Browser Content Handler", NS_BROWSERCONTENTHANDLER_CID, NS_CONTENT_HANDLER_CONTRACTID_PREFIX"text/rdf",