Compare commits

..

193 Commits

Author SHA1 Message Date
bbaetz%cs.mcgill.ca
f8360005bf Adding mac build files, from peterv
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110383 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-12 07:55:11 +00:00
bbaetz%cs.mcgill.ca
20fe938123 Mac build changes by peterv
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110379 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-12 06:43:41 +00:00
bbaetz%cs.mcgill.ca
93ea0479fb Mac build changes, by peterv
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110377 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-12 06:40:46 +00:00
bbaetz%cs.mcgill.ca
db7136c2f9 Mac build changes, including mcp->xml. Patches by peterv.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110375 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-12 06:34:57 +00:00
bbaetz%cs.mcgill.ca
367d8a218f Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110350 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-12 03:56:16 +00:00
alex.fritze%crocodile-clips.com
ef95679a97 Changing to tri-license.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110271 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 18:58:50 +00:00
bbaetz%cs.mcgill.ca
5bb3c34c6b Bug 93217 - nsRenderingContextMac doesn't reference count offscreens
Patch by james.turner@crocodile-clips.com


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110268 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 18:04:30 +00:00
bbaetz%cs.mcgill.ca
acc57e20c4 Bug 114423. Evil evil evil hack to get ForeignObject working on linux.
Patch by <simm0@ii.net> - many thanks for tracking this down!


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110265 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 17:39:52 +00:00
bbaetz%cs.mcgill.ca
eca183a2f9 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110262 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 15:20:10 +00:00
bbaetz%cs.mcgill.ca
9fd3c113fe Comment out debugging code which re locks/unlocks the buffer.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110257 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 14:56:46 +00:00
bbaetz%cs.mcgill.ca
3e3f548669 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110246 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 08:42:00 +00:00
(no author)
08c9d9ee9a This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110173 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-10 20:42:23 +00:00
bbaetz%cs.mcgill.ca
ac8ff15d12 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110156 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-10 13:23:32 +00:00
bbaetz%cs.mcgill.ca
dd34ecd81e Bug 111152 - Support native pixel formats for libart. Original patch by
james.turner@crocodile-clips.com, perf improvements/minor tweaks by me.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110151 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-10 08:36:59 +00:00
bbaetz%cs.mcgill.ca
64b3172de8 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110117 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-09 08:30:20 +00:00
bbaetz%cs.mcgill.ca
5e45e2919f Add comment for libart_lgpl option
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110111 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-09 06:47:38 +00:00
bbaetz%cs.mcgill.ca
487e87b26e Fix silly typo, and add comment explaining why its not pulled by default
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110107 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-09 03:59:49 +00:00
bbaetz%cs.mcgill.ca
2b4ee02f52 Mac build changes (by James Turner <james.turner@crocodile-clips.com>).
Slightly tweaked by me.

Add new files to client.{mk,mak}, and start cleaning up for the trunk
commit.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110105 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-09 03:55:11 +00:00
bbaetz%cs.mcgill.ca
a9475fc6e9 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110068 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-08 03:08:06 +00:00
bbaetz%cs.mcgill.ca
360d97b62c Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@110067 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-08 03:05:48 +00:00
bbaetz%cs.mcgill.ca
99e4faee21 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109791 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-06 02:49:07 +00:00
bbaetz%cs.mcgill.ca
2156c04b31 Bug 113156 - close open subpaths before filling.
r=afri


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109755 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-05 21:45:03 +00:00
bbaetz%cs.mcgill.ca
c4781bb505 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109724 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-05 05:26:57 +00:00
bbaetz%cs.mcgill.ca
60892a5f6c Bug 113150 - closePath needs to update the current position
r=afri


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109618 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-04 05:49:53 +00:00
bbaetz%cs.mcgill.ca
6c64f66980 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109529 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-03 17:29:55 +00:00
bbaetz%cs.mcgill.ca
2adfde2f38 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109481 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-02 05:42:32 +00:00
bbaetz%cs.mcgill.ca
f388cc29e4 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109463 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-01 18:00:22 +00:00
bbaetz%cs.mcgill.ca
3c0bec44e6 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109218 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-29 14:53:52 +00:00
(no author)
6bc9ea8a99 This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109194 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-29 09:36:47 +00:00
bbaetz%cs.mcgill.ca
6188cee805 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109139 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-28 17:57:56 +00:00
bbaetz%cs.mcgill.ca
c2d02bf32b install:: -> libs::, for windows build changes.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109066 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-28 00:06:32 +00:00
bbaetz%cs.mcgill.ca
44d83b8a2c Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@109059 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-27 23:47:22 +00:00
bbaetz%cs.mcgill.ca
ed0d5159d7 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108937 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-26 23:18:25 +00:00
hwaara%chello.se
cf9828d135 #111492, make us do better (but not perfect) error checking on rx and ry values for rectangle elements.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108909 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-26 19:39:50 +00:00
bbaetz%cs.mcgill.ca
e6c4c5dd8b Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108867 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-25 01:26:42 +00:00
bbaetz%cs.mcgill.ca
f1288e7d01 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108860 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-24 21:28:50 +00:00
bbaetz%cs.mcgill.ca
99da2b4e86 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108832 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-23 05:36:30 +00:00
bbaetz%cs.mcgill.ca
2b1a7b4c65 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108820 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-22 21:25:35 +00:00
bbaetz%cs.mcgill.ca
182fb5f60d Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108789 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-22 03:12:33 +00:00
bbaetz%cs.mcgill.ca
b16a7bcbcb Add missing MOZ_SVG ifdefs, and fix a few minor mismerged changes to be
like the trunk is.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108679 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-21 08:15:14 +00:00
bbaetz%cs.mcgill.ca
4c19e5dbd5 Use unix line endings
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108676 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-21 07:24:28 +00:00
bbaetz%cs.mcgill.ca
7665c5179a These are under the NPL, not the MPL. This obviously got mistakenly
checked in somewhere along the way.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108674 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-21 07:21:03 +00:00
bbaetz%cs.mcgill.ca
60e6c708b7 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108671 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-21 06:56:42 +00:00
bbaetz%cs.mcgill.ca
ef4df9cdda Add trunk change which isn't on the branch
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108669 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-21 06:46:44 +00:00
bbaetz%cs.mcgill.ca
838cf3320f Change indentation for jst.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108666 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-21 03:58:17 +00:00
alex.fritze%crocodile-clips.com
84d094ba04 Make the Windows build use the internal libart at other-licenses/libart_lgpl.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108574 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-20 13:48:48 +00:00
bbaetz%cs.mcgill.ca
ecc6a7e156 Oops. Add Makefile.in to the branch
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108482 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-19 19:09:42 +00:00
bbaetz%cs.mcgill.ca
abe8506dbc Allow the in-tree libart to be used.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108462 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-19 01:35:56 +00:00
bbaetz%cs.mcgill.ca
30719c4382 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108445 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-18 18:25:05 +00:00
bbaetz%cs.mcgill.ca
91e6463956 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108444 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-18 17:51:45 +00:00
bbaetz%cs.mcgill.ca
4a969d1ae7 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108384 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-17 18:54:29 +00:00
bbaetz%cs.mcgill.ca
6bd9a818cb Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108348 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-17 03:47:47 +00:00
bbaetz%cs.mcgill.ca
2090eb96e1 Add mac build projects. Patch from james.turner@crocodile-clips.com
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108308 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-16 17:51:48 +00:00
bbaetz%cs.mcgill.ca
912a6aeb0d Bug 110053: use the correct art_XXX_free functions instead of just calling
art_free. Patch by james.turner@crocodile-clips.com, r=bbaetz


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108305 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-16 16:39:56 +00:00
(no author)
b20a8a4a9d This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108281 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-16 07:40:43 +00:00
bbaetz%cs.mcgill.ca
f69a1ac96d Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108274 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-16 06:11:35 +00:00
bbaetz%cs.mcgill.ca
ea9bdcb284 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@108075 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-14 20:56:25 +00:00
bbaetz%cs.mcgill.ca
9e878d9609 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107961 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-13 16:27:26 +00:00
alex.fritze%crocodile-clips.com
753164edaf Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107919 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-12 12:01:36 +00:00
bbaetz%cs.mcgill.ca
5fe3d49c9f Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107844 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-10 21:11:20 +00:00
alex.fritze%crocodile-clips.com
9c5e87416c Fixup reflow logic.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107607 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-07 17:44:16 +00:00
alex.fritze%crocodile-clips.com
e64ec861f8 Fix reflow of <foreignObject>s. Patch by david.smith@crocodile-clips.com.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107602 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-07 13:47:13 +00:00
bbaetz%cs.mcgill.ca
4a32b37605 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107601 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-07 08:38:28 +00:00
alex.fritze%crocodile-clips.com
d4ffe9820b Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107599 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-07 08:00:13 +00:00
alex.fritze%crocodile-clips.com
1aad01dc49 Remove debug spam.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107598 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-07 07:53:59 +00:00
alex.fritze%crocodile-clips.com
82c6543d6c Code cleanup.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107595 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-07 07:52:29 +00:00
alex.fritze%crocodile-clips.com
341ae61bf6 Make width and height of SVGSVGElement dynamic.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107353 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-05 20:50:08 +00:00
bbaetz%cs.mcgill.ca
7beb35a45f Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107287 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-04 03:42:55 +00:00
bbaetz%cs.mcgill.ca
b715389404 NS_LITERAL_STRING is better than converting at runtime...
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107196 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-03 03:16:59 +00:00
alex.fritze%crocodile-clips.com
752865cfee Fix Unichar bustage.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107103 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-02 13:30:43 +00:00
alex.fritze%crocodile-clips.com
f9e33ffde4 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@107102 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-02 12:23:41 +00:00
bbaetz%cs.mcgill.ca
97564fa61e Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106853 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-31 23:01:13 +00:00
bbaetz%cs.mcgill.ca
297edf9c14 Merge from Trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106698 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-30 17:47:56 +00:00
bbaetz%cs.mcgill.ca
1f78198ef7 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106492 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-27 21:27:19 +00:00
bbaetz%cs.mcgill.ca
bc59624bed merge from trunk, and fix resulting bustage.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106386 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-26 20:34:27 +00:00
bbaetz%cs.mcgill.ca
4f7ab8a1b3 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106251 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-25 06:26:20 +00:00
bbaetz%cs.mcgill.ca
1958688917 Merge from trunk (More file moves...)
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106172 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-24 16:28:10 +00:00
bbaetz%cs.mcgill.ca
775b53554d Merge from trunk (More file moves...)
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106171 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-24 16:22:11 +00:00
(no author)
6b0628ef69 This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106144 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-24 06:25:09 +00:00
bbaetz%cs.mcgill.ca
166e377bca Merge from trunk. Grabs hyatt's deCOMification of the rulenode stuff. It
compiles.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106136 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-24 05:26:12 +00:00
(no author)
fb8f0ac49d This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106128 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-24 02:22:41 +00:00
bbaetz%cs.mcgill.ca
983a3b270c Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@106048 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-23 14:12:44 +00:00
bbaetz%cs.mcgill.ca
c153280c32 Merge atom change from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105911 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-22 01:15:34 +00:00
bbaetz%cs.mcgill.ca
9a4f6a0838 Merge from trunk and fix bustage.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105886 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-20 21:53:06 +00:00
bbaetz%cs.mcgill.ca
24addd464a Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105785 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-19 18:52:51 +00:00
bbaetz%cs.mcgill.ca
095ee315eb Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105643 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-17 22:24:34 +00:00
bbaetz%cs.mcgill.ca
5c10aacebf Merge from trunk + fix resulting bustage.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105510 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-16 18:01:32 +00:00
bbaetz%cs.mcgill.ca
510e725ccd Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105389 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-14 14:11:00 +00:00
bbaetz%cs.mcgill.ca
78a4a1c09c Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105264 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-12 15:02:13 +00:00
bbaetz%cs.mcgill.ca
df1c51102a Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105016 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-10 06:16:59 +00:00
bbaetz%cs.mcgill.ca
2f0f65bae5 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@105003 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-10 04:11:43 +00:00
bbaetz%cs.mcgill.ca
72d875ffe0 Add svg mimetype to the list of those parsable, so that .svg files work.
This meant having this file on the branch, too.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104774 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-07 19:37:14 +00:00
bbaetz%cs.mcgill.ca
03d3efc7f9 merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104773 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-07 19:33:32 +00:00
bbaetz%cs.mcgill.ca
b10f241c6b Misc bitrot fixes to cover trunk changes.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104744 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-06 19:09:41 +00:00
bbaetz%cs.mcgill.ca
b41bb98ddb Link to the given libraries, don't hard code the name.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104739 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-06 16:35:10 +00:00
alex.fritze%crocodile-clips.com
63c074aa78 Setting up libart module dependency.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104582 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-04 10:25:15 +00:00
alex.fritze%crocodile-clips.com
c757ea8ad4 Backout LIBART environment variable for now, until build problems with external libart are addressed.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104581 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-04 09:27:37 +00:00
bbaetz%cs.mcgill.ca
0eacb96d52 Merge from trunk + fix resulting minor build bustage.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104459 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-02 23:18:48 +00:00
bbaetz%cs.mcgill.ca
7527b3f38b Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104266 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-30 19:07:09 +00:00
bbaetz%cs.mcgill.ca
453c8edff1 More trunk merges + bustage fixes.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104237 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-30 01:39:57 +00:00
bbaetz%cs.mcgill.ca
acde98368d Merge from trunk, and fix resulting bustage.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104220 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-29 15:26:02 +00:00
bbaetz%cs.mcgill.ca
de208fd7a3 Merge from trunk.
Includes patch by <jonsmirl@mediaone.net> for bug 101139 - REQUIRES stuff,
now that this is on by default. I used this to change the unix
Makefile.in's so that we build on that, too.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@104084 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-28 04:20:32 +00:00
alex.fritze%crocodile-clips.com
bd1db1af2b Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103841 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-26 15:56:50 +00:00
(no author)
20b4befce0 This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103777 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-26 00:40:46 +00:00
bbaetz%cs.mcgill.ca
42825c482f Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103765 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-25 23:34:54 +00:00
bbaetz%cs.mcgill.ca
42d2370254 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103650 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-24 22:49:23 +00:00
bbaetz%cs.mcgill.ca
53578ce9bd Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103565 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-23 00:23:35 +00:00
alex.fritze%crocodile-clips.com
ab2d01f8fe CreateSVGRect() implementation
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103351 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-20 21:43:18 +00:00
alex.fritze%crocodile-clips.com
058429201b getCTM()/getScreenCTM() implementations
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103322 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-20 17:00:54 +00:00
bbaetz%cs.mcgill.ca
d1513e3d3e Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103252 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-20 01:29:18 +00:00
alex.fritze%crocodile-clips.com
94dada6b36 Fix API change.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103229 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-19 22:02:52 +00:00
alex.fritze%crocodile-clips.com
81c124ad4b Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103214 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-19 19:08:54 +00:00
bbaetz%cs.mcgill.ca
cc3cea15c2 Fix API change from merge.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103122 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-18 22:52:18 +00:00
bbaetz%cs.mcgill.ca
888093a217 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@103103 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-18 20:06:24 +00:00
alex.fritze%crocodile-clips.com
4b51db1c2f Fixed stroke-linejoin and fill-rule css properties.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102868 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-13 12:11:01 +00:00
alex.fritze%crocodile-clips.com
06256969ab Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102866 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-13 11:10:33 +00:00
alex.fritze%crocodile-clips.com
0ef41fe9f7 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102803 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-12 13:42:21 +00:00
alex.fritze%crocodile-clips.com
ea91cdd11f Update code to changes in nsSpaceManager construction.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102801 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-12 12:42:07 +00:00
alex.fritze%crocodile-clips.com
978009eb17 Added support for Q, q, T and t path commands. Patch by <daniele@grinta.net>.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102629 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-10 04:52:05 +00:00
alex.fritze%crocodile-clips.com
58df013662 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102605 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-09 07:47:48 +00:00
alex.fritze%crocodile-clips.com
6988cc968a Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102587 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-08 13:55:18 +00:00
alex.fritze%crocodile-clips.com
6fb2cdcf8f Added support for fill-rule, stroke-dasharray, stroke-dashoffset, stroke-linejoin and stroke-miterlimit CSS properties.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102503 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-07 01:52:55 +00:00
alex.fritze%crocodile-clips.com
bdc487d6f7 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102467 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-06 22:05:22 +00:00
alex.fritze%crocodile-clips.com
ce352439a3 Fix merge bustage.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102403 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-06 11:46:47 +00:00
alex.fritze%crocodile-clips.com
e284a8665f Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102400 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-06 10:22:03 +00:00
alex.fritze%crocodile-clips.com
5375bd76ec Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102398 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-06 08:28:22 +00:00
alex.fritze%crocodile-clips.com
2829f53d09 Implementation of AppendFrames, etc. Patch by <Paul.Golz@crocodile-clips.com>.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102393 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-06 07:53:41 +00:00
alex.fritze%crocodile-clips.com
9f448791ba Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102299 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-05 16:02:27 +00:00
alex.fritze%crocodile-clips.com
98bf39d8ec Added support for 'stroke-linecap' property.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102211 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-04 22:25:44 +00:00
alex.fritze%crocodile-clips.com
238f4cfbd8 Merge from trunk and copy Bradley's handy branch maintenance tools from client.mk into client.mak
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102194 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-03 21:42:49 +00:00
alex.fritze%crocodile-clips.com
e366fa8556 Put '-f' into MOZ_CO_FLAGS, so that we pull head revisions alright.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@102184 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-03 14:20:06 +00:00
bbaetz%cs.mcgill.ca
2c529912c3 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101876 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-28 06:50:22 +00:00
bbaetz%cs.mcgill.ca
794b9369ba Merge from Trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101809 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-26 03:15:35 +00:00
bbaetz%cs.mcgill.ca
4bef31db4e Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101745 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-24 06:50:25 +00:00
bbaetz%cs.mcgill.ca
a3fe9a4350 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101641 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-22 08:08:35 +00:00
bbaetz%cs.mcgill.ca
f032acb7c6 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101482 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-21 05:10:37 +00:00
bbaetz%cs.mcgill.ca
165ecfedc8 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101423 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-19 17:52:01 +00:00
bbaetz%cs.mcgill.ca
167389c5ae We should compile with this.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101407 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-18 08:51:46 +00:00
bbaetz%cs.mcgill.ca
649c7b7e89 Whoops. Add back the CVS_CO_FLAGS addition to CVSCO. This should work...
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101406 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-18 08:21:09 +00:00
bbaetz%cs.mcgill.ca
2ad02d873f Merge from trunk. Probably won't build without other changes.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101395 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-18 02:37:07 +00:00
bbaetz%cs.mcgill.ca
369724dce7 Merge from trunk
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101180 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-16 03:37:23 +00:00
bbaetz%cs.mcgill.ca
5d6294248e Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101091 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-15 07:20:27 +00:00
bbaetz%cs.mcgill.ca
8e5632bfc4 Merge from trunk (pull new nspr)
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101087 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-15 06:28:53 +00:00
bbaetz%cs.mcgill.ca
51eda91852 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101023 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-14 15:20:50 +00:00
bbaetz%cs.mcgill.ca
68f54e05d5 Fix dom support for Rect and AnimatedRect, and remove obsolete classinfo
maps. Patch by <alex.fritze@crocodile-clips.com>


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@101022 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-14 15:14:44 +00:00
bbaetz%cs.mcgill.ca
f7e29e19f6 Merge from trunk, and add new files I forgot to add this afternoon as part
of william.cook@crocodile-clips.com's patch.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100892 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-12 05:55:43 +00:00
bbaetz%cs.mcgill.ca
d45d16a708 Line, rect, and ellipse support, as well as skew transform. Patch by
<william.cook@crocodile-clips.com>


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100885 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-12 02:26:11 +00:00
bbaetz%cs.mcgill.ca
abd9c2125f Support fill: none;
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100873 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-11 22:33:11 +00:00
bbaetz%cs.mcgill.ca
733a028f9a Merge from trunk, and remove a debgging printf from nsHTMLDocument.cpp
that should never have been on the branch.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100868 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-11 08:40:39 +00:00
bbaetz%cs.mcgill.ca
ee14ec1306 If we don't know anything about a tag, print its name in the debug
message.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100665 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-09 17:02:57 +00:00
bbaetz%cs.mcgill.ca
c7429988cb Change LLIBRARY_NAME for windows build. Patch by
<alex.fritze@crocodile-clips.com>.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100589 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-08 17:53:08 +00:00
bbaetz%cs.mcgill.ca
b50051a84a Only call ImageUpdated when we Render(), rather than once per item on the
stack. Since this is a noop for windows and mac, this only affects unix.
Unix is much much much faster now, though.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100578 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-08 08:45:06 +00:00
bbaetz%cs.mcgill.ca
5cfda1e4ad Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100572 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-08 07:20:37 +00:00
bbaetz%cs.mcgill.ca
1835aecd44 Fix botched client.mak merge, and add missing makefile.win. Both patches
by <jonsmirl@mediaone.net>.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100568 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-08 06:34:19 +00:00
bbaetz%cs.mcgill.ca
303e19dc5a Improve performance when not using <foreignobject>, and fix
<foreignobject> in xbl. Patch by <alex.fritze@crocodile-clips.com>.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100567 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-08 06:30:57 +00:00
bbaetz%cs.mcgill.ca
b6ce2f91a2 Mac build changes. Patch by <james.turner@crocodile-clips.com>.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100566 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-08 06:06:55 +00:00
bbaetz%cs.mcgill.ca
4671a312a1 Make .svg documents work again, after the layout/content build reorg.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100503 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-07 18:55:24 +00:00
bbaetz%cs.mcgill.ca
a4586d6e44 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100487 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-07 09:54:29 +00:00
bbaetz%cs.mcgill.ca
326f7b2c0d Not crashing on startup is Good. Patch by alex.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100444 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-07 00:15:59 +00:00
bbaetz%cs.mcgill.ca
f3cb6f2e56 The build files are checked out before MOZ_CO_FLAGS is looked at, so we
fail on a fresh build because those aren't on the branch. Noticed by
mop@globalpark.de.

One makefile.win patch alex left out.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100406 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-06 18:13:33 +00:00
bbaetz%cs.mcgill.ca
bf375d18cf Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100392 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-06 09:39:29 +00:00
bbaetz%cs.mcgill.ca
15a72e7653 Last part of Alex's patches.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100391 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-06 09:02:23 +00:00
bbaetz%cs.mcgill.ca
17670b031a SVG patches by <alex.fritze@crocodile-clips.com>
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100390 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-06 07:15:34 +00:00
bbaetz%cs.mcgill.ca
bed3b8dc0e Move files from content/svg/src/ to content/svg/content/src/. Part of
<alex.fritze@crocodile-clips.com>'s patch set.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100385 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-06 06:27:56 +00:00
bbaetz%cs.mcgill.ca
493702a133 Misc typo fixes. Make SVGdocuments work (really silly typo), and change
the tokenizer so that we can use the svg namespace when the dtd is
specified.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100379 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-06 00:04:42 +00:00
bbaetz%cs.mcgill.ca
4827bc185d More dos2unix changes; patch by <alex.fritze@crocodile-clips.com>
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100365 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-05 03:46:36 +00:00
bbaetz%cs.mcgill.ca
5f91dfc442 Removing some unused files, and running dos2unix over layout svg files.
Patch by <alex.fritze@crocodile-clips.com>


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100364 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-05 03:26:07 +00:00
bbaetz%cs.mcgill.ca
bb97b3aa09 DOM SVG patches by <alex.fritze@crocodile-clips.com>. (This set is mainly
whitespace + line ending + build changes)


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100363 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-05 02:28:59 +00:00
bbaetz%cs.mcgill.ca
2a155d1c80 Alex's misc patches.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100361 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-05 00:53:11 +00:00
bbaetz%cs.mcgill.ca
9b61785131 merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100360 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-05 00:52:22 +00:00
bbaetz%cs.mcgill.ca
5d9599f352 Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100353 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-04 10:25:12 +00:00
bbaetz%cs.mcgill.ca
223cb5fc9c Merge from trunk.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100352 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-04 09:55:37 +00:00
(no author)
ecba8a1fc4 This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100327 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-03 22:15:01 +00:00
bbaetz%cs.mcgill.ca
c4cf6d5931 merge
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100266 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-03 05:43:47 +00:00
bbaetz%cs.mcgill.ca
3764d78c7a Update from trunk again. This is getting annoying.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100206 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-02 16:38:09 +00:00
bbaetz%cs.mcgill.ca
3085846429 Now we build again. Always a good idea...
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100196 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-02 08:29:24 +00:00
bbaetz%cs.mcgill.ca
8d8a3d09f6 Merge to get fastload changes.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@100090 18797224-902f-48f8-a5cc-f745e15eee43
2001-08-01 07:37:53 +00:00
bbaetz%cs.mcgill.ca
a2c41a0092 Merged nsStyleUtil.cpp from Alex's latest diff. This is why things weren't
working correctly. Oops. This file is now also on the branch.
Removed debugging printf's, as well.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99998 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-28 21:56:06 +00:00
bbaetz%cs.mcgill.ca
2e8c836b69 Update from trunk, and change NS_WITH_SERVICE to do_GetService so that we build.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99921 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-25 21:07:53 +00:00
bbaetz%cs.mcgill.ca
5bcba1a93d Bah. I'll get this right eventually.
Fix up merge line, hopefully for the last time


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99919 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-25 21:02:46 +00:00
bbaetz%cs.mcgill.ca
11e711ffa0 merge from trunk.
add client.mk and client.mak to the list of modified files, and add some
helper bits in client.mk for me (tagging, and so on)


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99912 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-25 18:21:28 +00:00
(no author)
a176d0f928 This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99907 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-25 07:54:29 +00:00
bbaetz%cs.mcgill.ca
7b1d9b20cf oops
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99735 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-22 19:37:00 +00:00
bbaetz%cs.mcgill.ca
167116df5f Oops. Left out non-idl stuff in dom/
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99734 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-22 19:32:10 +00:00
bbaetz%cs.mcgill.ca
1c44b0b5e1 Oops, left this one out
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99722 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 22:50:01 +00:00
bbaetz%cs.mcgill.ca
9e22db8d4e I would really like to know why this went here.
Really, I would.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99721 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 22:48:16 +00:00
bbaetz%cs.mcgill.ca
6764c05179 I have no idea why cvs decided to place that in mailnews.
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99720 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 22:47:18 +00:00
bbaetz%cs.mcgill.ca
019c90d943 Initial checkin of new svg code onto the branch.
Patches mainly by alex.fritze@crocodile-clips.com, unix port + SVGDocument
stuff by me. This merge is from Alex's 8 June patch drop.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99719 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 22:39:40 +00:00
bbaetz%cs.mcgill.ca
dee6f5ee39 client.mk changes for the branch. I think I have everything...
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99718 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 22:14:42 +00:00
bbaetz%cs.mcgill.ca
6910fe5ed5 Initial checkin of new svg code onto the branch.
Patches mainly by alex.fritze@crocodile-clips.com, unix port + SVGDocument
stuff by me. This merge is from Alex's 8 June patch drop.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99717 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 21:55:23 +00:00
bbaetz%cs.mcgill.ca
457ef7da76 Initial checkin of new svg code onto the branch.
Patches mainly by alex.fritze@crocodile-clips.com, unix port + SVGDocument
stuff by me. This merge is from Alex's 8 June patch drop.


git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99716 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 21:40:19 +00:00
bbaetz%cs.mcgill.ca
57ee995560 configure.in changes for SVG branch
git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99714 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 21:16:14 +00:00
(no author)
d8259f77d9 This commit was manufactured by cvs2svn to create branch
'SVG_20010721_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/SVG_20010721_BRANCH@99703 18797224-902f-48f8-a5cc-f745e15eee43
2001-07-21 02:54:33 +00:00
497 changed files with 151729 additions and 105995 deletions

314
mozilla/Makefile.in Normal file
View File

@@ -0,0 +1,314 @@
#
# 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
include $(topsrcdir)/build/unix/modules.mk
ifneq ($(BUILD_MODULES),all)
DIRS = $(BUILD_MODULE_DIRS)
EXPORT_DIRS = $(BUILD_MODULE_DEP_DIRS)
else
#
# And now for something completely different...
# Divide the default build into tiers.
# Tiers must be defined on module boundaries
#
default: $(SUBMAKEFILES)
$(MAKE) nspr
$(MAKE) tier_0
ifdef MOZ_LDAP_XPCOM
$(MAKE) -C directory/c-sdk/ldap export
$(MAKE) -C directory/c-sdk/ldap install
endif
$(MAKE) tier_1
$(MAKE) tier_9
ifdef MOZ_PSM
$(MAKE) tier_95
endif
ifdef MOZ_MAIL_NEWS
$(MAKE) tier_97
endif
ifdef MOZ_CALENDAR
$(MAKE) tier_98
endif
$(MAKE) tier_99
# Make sure that the existing rulesets work
DIRS = $(NSPRPUB_DIR) \
$(tier_0_dirs) \
$(tier_1_dirs) \
$(tier_9_dirs) \
$(NULL)
ifdef MOZ_LDAP_XPCOM
DIRS += directory/c-sdk/ldap
endif
ifdef MOZ_PSM
DIRS += $(tier_95_dirs)
endif
ifdef MOZ_MAIL_NEWS
DIRS += $(tier_97_dirs)
endif
ifdef MOZ_CALENDAR
DIRS += $(tier_98_dirs)
endif
DIRS += $(tier_99_dirs)
#
# tier 0 - base build config dirs
#
tier_0_dirs = \
config \
build \
include \
$(NULL)
#
# tier 1 - base libraries
#
tier_1_dirs = js
# MacOSX needs to build lib for MoreFiles before xpcom
ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
tier_1_dirs += lib/mac/MoreFiles
endif
#
# tier 9 - core components (xpcom,necko,gecko)
#
# intl should not be in here - it's just temporary until
# xpconnect's dependency on intl is repaired - see bug 106130
tier_9_dirs += \
modules/libreg \
string \
xpcom \
intl \
$(NULL)
ifndef MOZ_NATIVE_ZLIB
tier_9_dirs += modules/zlib
endif
# Linux and Solaris installer needs standalone libjar, hence standalone zlib
ifneq (,$(filter Linux SunOS,$(OS_ARCH)))
tier_9_dirs += modules/zlib/standalone
endif
tier_9_dirs += \
modules/libjar \
$(NULL)
ifdef MOZ_JAVA_SUPPLEMENT
tier_9_dirs += \
java/util \
java/webclient \
$(NULL)
endif
ifndef MOZ_NATIVE_JPEG
tier_9_dirs += jpeg
endif
tier_9_dirs += dbm js/src/xpconnect
ifdef MOZ_OJI
tier_9_dirs += js/src/liveconnect
endif
ifdef MOZ_JSDEBUGGER
tier_9_dirs += js/jsd
endif
ifdef MOZ_ENABLE_XLIB
tier_9_dirs += gfx/src/xlibrgb widget/src/xlibxtbin
endif
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 \
netwerk \
modules/mpfilelocprovider \
uriloader \
modules/libpref \
modules/libimg \
modules/oji \
caps \
rdf \
expat \
htmlparser \
gfx \
gfx2 \
modules/libpr0n \
modules/plugin \
dom \
view \
widget \
content \
layout \
db \
docshell \
webshell \
embedding \
editor \
sun-java \
profile \
themes \
$(NULL)
ifdef ACCESSIBILITY
tier_9_dirs += accessible
endif
ifdef MOZ_LDAP_XPCOM
tier_9_dirs += directory/xpcom
endif
# This must preceed xpfe
ifdef MOZ_JPROF
tier_9_dirs += tools/jprof
endif
tier_9_dirs += xpfe xpinstall
ifdef MOZ_EXTENSIONS
tier_9_dirs += extensions
endif
ifdef MOZ_LEAKY
tier_9_dirs += tools/leaky
endif
ifdef ENABLE_TESTS
tier_9_dirs += xpcom/tests
endif
ifdef NS_TRACE_MALLOC
tier_9_dirs += tools/trace-malloc
endif
tier_9_dirs += l10n
#
# tier 9x - application features
#
ifdef MOZ_PSM
tier_95_dirs += security/manager
endif
ifdef MOZ_MAIL_NEWS
tier_97_dirs += mailnews
endif
ifdef MOZ_CALENDAR
tier_98_dirs += calendar
endif
#
# tier 99 - application binaries
#
ifneq (,$(MOZ_STATIC_COMPONENTS)$(MOZ_META_COMPONENTS))
tier_99_dirs += modules/staticmod
endif
tier_99_dirs += xpfe/bootstrap
endif # BUILD_MODULES == all
STATIC_MAKEFILES := $(NSPRPUB_DIR) directory/c-sdk/ldap
ifdef MOZ_PSM
STATIC_MAKEFILES += security/nss
endif
GARBAGE_DIRS += dist
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
dependencies.beos config/autoconf.mk config/myrules.mk config/myconfig.mk \
unallmakefiles \
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
include $(topsrcdir)/config/rules.mk
tier_%:
@echo "$@: $($@_dirs)"
@$(EXIT_ON_ERROR) \
for d in $($@_dirs); do $(UPDATE_TITLE) \
$(MAKE) -C $$d export; \
done ; \
$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include ;\
for d in $($@_dirs); do $(UPDATE_TITLE) \
$(MAKE) -C $$d libs; \
done
#
# Individual modules
#
boehm:
ifdef GC_LEAK_DETECTOR
$(MAKE) -C gc/boehm
endif
nspr: boehm
ifdef NSPRPUB_DIR
$(MAKE) -C $(NSPRPUB_DIR)
endif
# Ugly OS/2 gmake hack - create myconfig.mk and myrules.mk if they aren't there
ifeq ($(OS_ARCH),OS2)
export::
if test ! -f config/myrules.mk; then
touch config/myrules.mk
fi
if test ! -f config/myconfig.mk; then
touch config/myconfig.mk
fi
endif
# For modules.mk standalone build
export::
+$(LOOP_OVER_EXPORT_DIRS)
export::
@$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include
distclean::
cat unallmakefiles | $(XARGS) rm -f
rm -f unallmakefiles $(DIST_GARBAGE)

15
mozilla/aclocal.m4 vendored Normal file
View File

@@ -0,0 +1,15 @@
dnl
dnl Local autoconf macros used with mozilla
dnl The contents of this file are under the Public Domain.
dnl
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
builtin(include, build/autoconf/altoptions.m4)dnl

1190
mozilla/allmakefiles.sh Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,165 @@
# Configure paths for LIBART
# Raph Levien 98-11-18
# stolen from Manish Singh 98-9-30
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
dnl
AC_DEFUN(AM_PATH_LIBART,
[dnl
dnl Get the cflags and libraries from the libart-config script
dnl
AC_ARG_WITH(libart-prefix,[ --with-libart-prefix=PFX Prefix where LIBART is installed (optional)],
libart_prefix="$withval", libart_prefix="")
AC_ARG_WITH(libart-exec-prefix,[ --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
libart_exec_prefix="$withval", libart_exec_prefix="")
AC_ARG_ENABLE(libarttest, [ --disable-libarttest Do not try to compile and run a test LIBART program],
, enable_libarttest=yes)
if test x$libart_exec_prefix != x ; then
libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
if test x${LIBART_CONFIG+set} != xset ; then
LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
fi
fi
if test x$libart_prefix != x ; then
libart_args="$libart_args --prefix=$libart_prefix"
if test x${LIBART_CONFIG+set} != xset ; then
LIBART_CONFIG=$libart_prefix/bin/libart-config
fi
fi
AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
min_libart_version=ifelse([$1], ,0.2.5,$1)
AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
no_libart=""
if test "$LIBART_CONFIG" = "no" ; then
no_libart=yes
else
LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
libart_major_version=`$LIBART_CONFIG $libart_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_libarttest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBART_CFLAGS"
LIBS="$LIBS $LIBART_LIBS"
dnl
dnl Now check if the installed LIBART is sufficiently new. (Also sanity
dnl checks the results of libart-config to some extent
dnl
rm -f conf.libarttest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libart_lgpl/libart.h>
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.libarttest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_libart_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_libart_version");
exit(1);
}
if (($libart_major_version > major) ||
(($libart_major_version == major) && ($libart_minor_version > minor)) ||
(($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
printf("*** to point to the correct copy of libart-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_libart" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$LIBART_CONFIG" = "no" ; then
echo "*** The libart-config script installed by LIBART could not be found"
echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the LIBART_CONFIG environment variable to the"
echo "*** full path to libart-config."
else
if test -f conf.libarttest ; then
:
else
echo "*** Could not run LIBART test program, checking why..."
CFLAGS="$CFLAGS $LIBART_CFLAGS"
LIBS="$LIBS $LIBART_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <libart_lgpl/libart.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding LIBART or finding the wrong"
echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
LIBART_CFLAGS=""
LIBART_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBART_CFLAGS)
AC_SUBST(LIBART_LIBS)
rm -f conf.libarttest
])

View File

@@ -0,0 +1,85 @@
#-------------------------------------------------------------------------------
# These 3 lists are the 'master lists' to control what gets built.
#
# Ordering in these arrays is important; it has to reflect the order in
# which the build occurs.
#
# Setting containing spaces must be quoted with double quotes.
#-------------------------------------------------------------------------------
build_flags
all 1
pull 0
dist 0
config 0
xpidl 0
idl 0
stubs 0
runtime 0
common 0
imglib 0
libimg2 0
necko 0
security 0
browserutils 0
intl 0
nglayout 0
accessiblity 0
editor 0
embedding 0
viewer 0
xpapp 0
extensions 0
plugins 0
mailnews 0
apprunner 0
resources 0
options_flags
pull_by_date 0
chrome_jars 1
chrome_files 0
use_jars 1
transformiix 1
mathml 0 MOZ_MATHML
svg 0 MOZ_SVG
# svg requires libart, which is an lgpl library. You need to pull it
# explicitly.
libart_lgpl 0
mng 1
ldap 1 MOZ_LDAP_XPCOM
ldap_experimental 0 MOZ_LDAP_XPCOM_EXPERIMENTAL
xmlextras 1
soap 0 MOZ_SOAP
inspector 1
mailextras 1
xptlink 0
psm 0 ENABLE_SMIME
embedding_test 1
carbon 0 TARGET_CARBON
useimg2 1 USE_IMG2
lowmem 0 MOZ_MAC_LOWMEM
accessible 1 ACCESSIBILITY
bidi 1 IBMBIDI
p3p 0
jsd 1
venkman 1
moz_logging 1 MOZ_LOGGING
chatzilla 1
content_packs 1
xml_rpc 1
cview 1
help 1
timeline 0 MOZ_TIMELINE
static_build 0 MOZ_STATIC_COMPONENT_LIBS
string_debug 0 DEBUG_STRING
string_stats 0 DEBUG_STRING_STATS
xpctools 0 XPC_TOOLS_SUPPORT
smime 1
print_preview 1 NS_PRINT_PREVIEW
filepath_flags
idepath ":CodeWarrior IDE Path.txt"
sessionpath ":Mozilla session path.txt"
buildlogfilepath ":Build Logs:Mozilla build log.txt" # this is a path
scriptlogfilepath ":Build Logs:Mozilla script log.txt"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
# List of modules to check out. Format is
# module, (tag), (date)
# where tag and date are optional (non-trailing commas are required)
#
# Examples:
# mozilla/nsprpub, NSPRPUB_CLIENT_TAG
# mozilla/gc, , 10/25/2000 12:00:00
#
mozilla/nsprpub, NSPRPUB_PRE_4_2_CLIENT_BRANCH
mozilla/security/nss, NSS_CLIENT_TAG
mozilla/security/manager,
mozilla/accessible,
DirectorySDKSourceC, LDAPCSDK_40_BRANCH
mozilla/lib/mac/Instrumentation
mozilla/gfx2
mozilla/modules/libpr0n
SeaMonkeyAll
## You need this if you want to be able to use SVG
## Note that this library is under the LGPL, not the MPL
#mozilla/other-licenses/libart_lgpl

641
mozilla/client.mak Normal file
View File

@@ -0,0 +1,641 @@
# 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=.
!if !defined(MOZ_TOP)
#enable builds from changed top level directories
MOZ_TOP=mozilla
!endif
MOZ_SRC_FLIPPED = $(MOZ_SRC:\=/)
MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist
!ifdef MOZ_DEBUG
MOZ_OBJDIR = WIN32_D.OBJ
!else
MOZ_OBJDIR = WIN32_O.OBJ
!endif
#
# Command macro defines
#
#//------------------------------------------------------------------------
#// Figure out how to do the pull.
#//------------------------------------------------------------------------
# uncomment these, modify branch tag, and check in to branch for milestones
# pull the svg mini-branch:
MOZ_BRANCH=SVG_20010721_BRANCH
# we pull the head revision if a file is not tagged:
!ifndef MOZ_CO_FLAGS
MOZ_CO_FLAGS=-f
!else
MOZ_CO_FLAGS= $(MOZ_CO_FLAGS) -f
!endif
# list of all tagged files on the svg mini-branch. we use it for the
# branch maintenance targets below
SVG_BRANCH_FILES = \
content/svg \
layout/svg \
dom/public/idl/svg \
\
aclocal.m4 \
allmakefiles.sh \
build/autoconf/libart.m4 \
build/mac/build_scripts/MozillaBuildFlags.txt \
build/mac/build_scripts/MozillaBuildList.pm \
build/mac/build_scripts/MozillaCheckoutList.txt \
client.mk \
client.mak \
config/autoconf.mk.in \
configure \
configure.in \
content/Makefile.in \
content/base/public/nsIDocument.h \
content/base/public/nsIElementFactory.h \
content/base/src/nsRuleNode.cpp \
content/base/src/nsStyleContext.cpp \
content/build/Makefile.in \
content/build/makefile.win \
content/build/nsContentCID.h \
content/build/nsContentDLF.cpp \
content/build/nsContentModule.cpp \
content/html/document/src/nsHTMLDocument.cpp \
content/html/style/src/nsCSSDeclaration.cpp \
content/html/style/src/nsCSSParser.cpp \
content/html/style/src/nsCSSStyleRule.cpp \
content/html/style/src/nsICSSDeclaration.h \
content/macbuild/contentSVG.mcp \
content/makefile.win \
content/shared/public/MANIFEST \
content/shared/public/Makefile.in \
content/shared/public/makefile.win \
content/shared/public/nsCSSKeywordList.h \
content/shared/public/nsCSSPropList.h \
content/shared/public/nsCSSProps.h \
content/shared/public/nsRuleNode.h \
content/shared/public/nsSVGAtomList.h \
content/shared/public/nsSVGAtoms.h \
content/shared/public/nsStyleStruct.h \
content/shared/src/Makefile.in \
content/shared/src/makefile.win \
content/shared/src/nsCSSProps.cpp \
content/shared/src/nsSVGAtoms.cpp \
content/shared/src/nsStyleStruct.cpp \
content/shared/src/nsStyleUtil.cpp \
content/xml/document/src/nsXMLDocument.cpp \
content/xml/document/src/nsXMLDocument.h \
dom/macbuild/dom_svgIDL.mcp \
dom/public/idl/Makefile.in \
dom/public/idl/makefile.win \
dom/public/nsIDOMClassInfo.h \
dom/src/base/nsDOMClassInfo.cpp \
gfx/public/nsTransform2D.h \
gfx/src/mac/nsRenderingContextMac.cpp \
htmlparser/public/nsIParser.h \
htmlparser/src/nsExpatTokenizer.cpp \
htmlparser/src/nsViewSourceHTML.cpp \
htmlparser/src/nsWellFormedDTD.cpp \
layout/base/public/nsStyleConsts.h \
layout/build/Makefile.in \
layout/build/makefile.win \
layout/html/style/src/Makefile.in \
layout/html/style/src/makefile.win \
layout/html/style/src/nsCSSFrameConstructor.cpp \
layout/html/style/src/nsCSSFrameConstructor.h \
layout/html/tests/makefile.win \
layout/macbuild/layoutsvg.mcp \
Makefile.in \
makefile.win \
netwerk/mime/src/nsXMLMIMEDataSource.cpp \
uriloader/exthandler/nsExternalHelperAppService.cpp \
xpfe/browser/src/nsBrowserInstance.cpp
#NSPR_CO_TAG=SeaMonkey_M17_BRANCH
#PSM_CO_TAG=SeaMonkey_M17_BRANCH
#NSS_CO_TAG=SeaMonkey_M17_BRANCH
#LDAPCSDK_CO_TAG=SeaMonkey_M17_BRANCH
#ACCESSIBLE_CO_TAG=SeaMonkey_M17_BRANCH
#IMGLIB2_CO_TAG=SeaMonkey_M17_BRANCH
#GFX2_CO_TAG=SeaMonkey_M17_BRANCH
!ifdef MOZ_BRANCH
CVS_BRANCH=-r $(MOZ_BRANCH)
HAVE_BRANCH=1
!else
HAVE_BRANCH=0
!endif
!ifdef MOZ_DATE
CVS_BRANCH=-D "$(MOZ_DATE)"
HAVE_DATE=1
!else
HAVE_DATE=0
!endif
!if $(HAVE_DATE) && $(HAVE_BRANCH)
ERR_MESSAGE=$(ERR_MESSAGE)^
Cannot specify both MOZ_BRANCH and MOZ_DATE
!endif
# default pull is "quiet" but it can be overridden with MOZ_CVS_VERBOSE
!ifndef MOZ_CVS_VERBOSE
CVS_FLAGS=-q
!endif
# honor any user-defined CVS flags
!ifdef MOZ_CVS_FLAGS
CVS_FLAGS=$(CVS_FLAGS) $(MOZ_CVS_FLAGS)
!endif
# let's be explicit about CVSROOT... some windows cvs clients
# are too stupid to correctly work without the -d option
#
# if they are too stupid, they should fail. I am
# commenting this out because this does not work
# under 4nt. (%'s are evaluted differently)
#
# If it breaks you, mail dougt@netscape.com
# and leaf@mozilla.org
#
!if 0
!if defined(CVSROOT)
CVS_FLAGS=$(CVS_FLAGS) -d "$(CVSROOT)"
!endif
!endif
!ifndef MOZ_CO_FLAGS
MOZ_CO_FLAGS = -P
!endif
CVSCO = cvs $(CVS_FLAGS) co $(MOZ_CO_FLAGS) $(CVS_BRANCH) $(CVS_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull NSPR.
#// If no NSPR_CO_TAG is specified, use the default static tag
#//------------------------------------------------------------------------
!ifndef NSPR_CO_FLAGS
NSPR_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(NSPR_CO_TAG)" != ""
NSPR_CO_FLAGS=$(NSPR_CO_FLAGS) -r $(NSPR_CO_TAG)
!else
NSPR_CO_FLAGS=$(NSPR_CO_FLAGS) -r NSPRPUB_PRE_4_2_CLIENT_BRANCH
!endif
CVSCO_NSPR = cvs $(CVS_FLAGS) co $(NSPR_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull NSS and PSM libs.
#// If no NSS_CO_TAG or PSM_CO_TAG is specified, use the default static tag
#//------------------------------------------------------------------------
!ifndef NSS_CO_FLAGS
NSS_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(NSS_CO_TAG)" != ""
NSS_CO_FLAGS=$(NSS_CO_FLAGS) -r $(NSS_CO_TAG)
!else
NSS_CO_FLAGS=$(NSS_CO_FLAGS) -r NSS_CLIENT_TAG
!endif
CVSCO_NSS = cvs $(CVS_FLAGS) co $(NSS_CO_FLAGS)
!ifndef PSM_CO_FLAGS
PSM_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(PSM_CO_TAG)" != ""
PSM_CO_FLAGS=$(PSM_CO_FLAGS) -r $(PSM_CO_TAG)
!else
PSM_CO_FLAGS=$(PSM_CO_FLAGS) $(CVS_BRANCH)
!endif
CVSCO_PSM = cvs $(CVS_FLAGS) co $(PSM_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull LDAP C SDK client libs.
#// If no LDAPCSDK_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef LDAPCSDK_CO_FLAGS
LDAPCSDK_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(LDAPCSDK_CO_TAG)" != ""
LDAPCSDK_CO_FLAGS=$(LDAPCSDK_CO_FLAGS) -r $(LDAPCSDK_CO_TAG)
!else
LDAPCSDK_CO_FLAGS=$(LDAPCSDK_CO_FLAGS) -r LDAPCSDK_40_BRANCH
!endif
CVSCO_LDAPCSDK = cvs $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull accessibility libs.
#// If no ACCESSIBLE_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef ACCESSIBLE_CO_FLAGS
ACCESSIBLE_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(ACCESSIBLE_CO_TAG)" != ""
ACCESSIBLE_CO_FLAGS=$(ACCESSIBLE_CO_FLAGS) -r $(ACCESSIBLE_CO_TAG)
!else
ACCESSIBLE_CO_FLAGS=$(ACCESSIBLE_CO_FLAGS) $(CVS_BRANCH)
!endif
CVSCO_ACCESSIBLE = cvs $(CVS_FLAGS) co $(ACCESSIBLE_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull new image library.
#// If no IMGLIB2_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef IMGLIB2_CO_FLAGS
IMGLIB2_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(IMGLIB2_CO_TAG)" != ""
IMGLIB2_CO_FLAGS=$(IMGLIB2_CO_FLAGS) -r $(IMGLIB2_CO_TAG)
!else
IMGLIB2_CO_FLAGS=$(IMGLIB2_CO_FLAGS) $(CVS_BRANCH)
!endif
CVSCO_IMGLIB2 = cvs $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS)
#//------------------------------------------------------------------------
#// Figure out how to pull new image library.
#// If no GFX2_CO_TAG is specified, use the default tag
#//------------------------------------------------------------------------
!ifndef GFX2_CO_FLAGS
GFX2_CO_FLAGS=$(MOZ_CO_FLAGS)
!endif
!if "$(GFX2_CO_TAG)" != ""
GFX2_CO_FLAGS=$(GFX2_CO_FLAGS) -r $(GFX2_CO_TAG)
!else
GFX2_CO_FLAGS=$(GFX2_CO_FLAGS) $(CVS_BRANCH)
!endif
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
############################################################
pull_and_build_all: pull_all build_all_dep
## Rules for pulling the source from the cvs repository
############################################################
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)\.
$(CVSCO_NSPR) mozilla/nsprpub
pull_nss:
cd $(MOZ_SRC)\.
$(CVSCO_NSS) mozilla/security/coreconf
$(CVSCO_NSS) mozilla/security/nss
pull_psm: pull_nss
cd $(MOZ_SRC)\.
$(CVSCO_PSM) mozilla/security/manager
$(CVSCO_PSM) mozilla/security/makefile.win
pull_ldapcsdk:
cd $(MOZ_SRC)\.
$(CVSCO_LDAPCSDK) mozilla/directory/c-sdk
pull_accessible:
cd $(MOZ_SRC)\.
$(CVSCO_ACCESSIBLE) mozilla/accessible
pull_gfx2:
cd $(MOZ_SRC)\.
$(CVSCO_GFX2) mozilla/gfx2
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
$(CVSCO) mozilla/config
$(CVSCO) -l mozilla/js
$(CVSCO) -l mozilla/js/src
$(CVSCO) mozilla/js/src/fdlibm
$(CVSCO) mozilla/js/src/xpconnect
$(CVSCO) mozilla/modules/libreg
$(CVSCO) mozilla/xpcom
$(CVSCO) mozilla/string
# pull either layout only or seamonkey the browser
pull_layout:
cd $(MOZ_SRC)\.
$(CVSCO) RaptorWin
pull_seamonkey: pull_clientmak
cd $(MOZ_SRC)\.
$(CVSCO) SeaMonkeyAll
pull_clientmak:
cd $(MOZ_SRC)\.
$(CVSCO) mozilla/client.mak
############################################################
# nmake has to be hardcoded, or we have to depend on mozilla/config
# being pulled already to figure out what $(NMAKE) should be.
clobber_all: clobber_nspr clobber_psm clobber_seamonkey
build_all: build_nspr build_seamonkey
build_all_dep: depend libs
distclean:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)
nmake /f client.mak clobber_psm
nmake /f client.mak clobber_seamonkey
clobber_nspr:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
clobber_psm:
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
nmake -f makefile.win clobber_all
clobber_xpconnect:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
-rd /s /q dist
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\js
nmake -f makefile.win clobber_all
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
nmake -f makefile.win clobber_all
clobber_seamonkey:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
-rd /s /q dist
nmake -f makefile.win clobber_all
depend: export
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win depend
depend_xpconnect:
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
nmake -f makefile.win depend
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
nmake -f makefile.win depend
build_nspr:
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
build_psm:
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
nmake -f makefile.win
build_xpconnect: build_nspr
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win export
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
nmake -f makefile.win libs
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
nmake -f makefile.win all
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
nmake -f makefile.win all
build_seamonkey:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win all
build_client:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win all
build_layout:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win all
build_dist:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win all
libs:
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win libs
export: build_nspr
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
nmake -f makefile.win export
clobber_dist:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win clobber_all
clobber_client:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win clobber_all
clobber_layout:
@cd $(MOZ_SRC)\mozilla\.
nmake -f makefile.win clobber_all
browse_info::
cd $(MOZ_SRC)\$(MOZ_TOP)
-dir /s /b *.sbr > sbrlist.tmp
-bscmake /Es /o mozilla.bsc @sbrlist.tmp
-rm sbrlist.tmp
regchrome::
@cd $(MOZ_SRC)\mozilla\.
nmake /f makefile.win regchrome
deliver::
@cd $(MOZ_SRC)\mozilla\.
nmake /f makefile.win splitsymbols
# svg mini-branch maintenance targets:
merge:
cvs -z3 up -dP -jSVG_20010721_TAG -jHEAD $(SVG_BRANCH_FILES)
statictag:
cvs -z3 tag -F -rHEAD SVG_20010721_TAG $(SVG_BRANCH_FILES)
commitmerge:
cvs -z3 ci $(SVG_BRANCH_FILES)
diffsvg:
cvs -z3 diff -u $(SVG_BRANCH_FILES)
#//------------------------------------------------------------------------
#// Utility stuff...
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
# Verify that MOZ_SRC is set correctly
#//------------------------------------------------------------------------
# Check to see if it is set at all
!if "$(MOZ_SRC)"==""
MOZ_SRC = $(MAKEDIR)\..
!endif
#
# create a temp file at the root and make sure it is visible from MOZ_SRC
#
!if [copy $(MAKEDIR)\client.mak $(MAKEDIR)\xyzzy.tmp > NUL] == 0
!endif
!if !EXIST( $(MOZ_SRC)\mozilla\xyzzy.tmp )
ERR_MESSAGE=$(ERR_MESSAGE)^
MOZ_SRC isn't set correctly: [$(MOZ_SRC)\mozilla]!=[$(MAKEDIR)]
!endif
!if [del $(MAKEDIR)\xyzzy.tmp]
!endif
#//------------------------------------------------------------------------
# Verify that MOZ_BITS is set
#//------------------------------------------------------------------------
!if !defined(MOZ_BITS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_BITS isn't set.
!endif
!if !defined(MOZ_TOOLS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_TOOLS isn't set.
!endif
#//------------------------------------------------------------------------
#// Display error
#//------------------------------------------------------------------------
!if "$(ERR_MESSAGE)" != ""
ERR_MESSAGE = ^
client.mak: ^
$(ERR_MESSAGE) ^
^
client.mak: usage^
^
nmake -f client.mak [MOZ_BRANCH=<cvs_branch_name>] ^
[MOZ_DATE=<cvs_date>]^
[pull_and_build_all]^
[pull_all]^
[build_all]^
^
Environment variables:^
^
MOZ_BITS set to 32^
MOZ_TOOLS set to the directory containing the needed tools ^
!ERROR $(ERR_MESSAGE)
!endif

727
mozilla/client.mk Normal file
View File

@@ -0,0 +1,727 @@
# 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): Stephen Lamm
# Build the Mozilla client.
#
# This needs CVSROOT set to work, e.g.,
# setenv CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
# or
# setenv CVSROOT :pserver:username%somedomain.org@cvs.mozilla.org:/cvsroot
#
# To checkout and build a tree,
# 1. cvs co mozilla/client.mk
# 2. cd mozilla
# 3. gmake -f client.mk
#
# Other targets (gmake -f client.mk [targets...]),
# checkout
# build
# clean (realclean is now the same as clean)
# distclean
#
# See http://www.mozilla.org/build/unix.html for more information.
#
# Options:
# MOZ_OBJDIR - Destination object directory
# MOZ_CO_DATE - Date tag to use for checkout (default: none)
# MOZ_CO_MODULE - Module to checkout (default: SeaMonkeyAll)
# MOZ_CVS_FLAGS - Flags to pass cvs (default: -q -z3)
# MOZ_CO_FLAGS - Flags to pass after 'cvs co' (default: -P)
# MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
# MOZ_CO_BRANCH - Branch tag (Depricated. Use MOZ_CO_TAG below.)
#
#######################################################################
# Checkout Tags
#
# For branches, uncomment the MOZ_CO_TAG line with the proper tag,
# and commit this file on that tag.
# pull svg mini-branch
MOZ_CO_TAG = SVG_20010721_BRANCH
MOZ_CO_FLAGS := $(MOZ_CO_FLAGS) -f
NSPR_CO_TAG = NSPRPUB_PRE_4_2_CLIENT_BRANCH
PSM_CO_TAG = #We will now build PSM from the tip instead of a branch.
NSS_CO_TAG = NSS_CLIENT_TAG
LDAPCSDK_CO_TAG = LDAPCSDK_40_BRANCH
ACCESSIBLE_CO_TAG =
GFX2_CO_TAG =
IMGLIB2_CO_TAG =
BUILD_MODULES = all
#######################################################################
# Defines
#
CVS = cvs
CWD := $(shell pwd)
ifeq "$(CWD)" "/"
CWD := /.
endif
ifneq (, $(wildcard client.mk))
# Ran from mozilla directory
ROOTDIR := $(shell dirname $(CWD))
TOPSRCDIR := $(CWD)
else
# Ran from mozilla/.. directory (?)
ROOTDIR := $(CWD)
TOPSRCDIR := $(CWD)/mozilla
endif
# on os2, TOPSRCDIR may have two forward slashes in a row, which doesn't
# work; replace first instance with one forward slash
TOPSRCDIR := $(shell echo "$(TOPSRCDIR)" | sed -e 's%//%/%')
# if ROOTDIR equals only drive letter (i.e. "C:"), set to "/"
DIRNAME := $(shell echo "$(ROOTDIR)" | sed -e 's/^.://')
ifeq ($(DIRNAME),)
ROOTDIR := /.
endif
AUTOCONF := autoconf
MKDIR := mkdir
SH := /bin/sh
ifndef MAKE
MAKE := gmake
endif
CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
ifdef CONFIG_GUESS_SCRIPT
CONFIG_GUESS = $(shell $(CONFIG_GUESS_SCRIPT))
else
_IS_FIRST_CHECKOUT := 1
endif
####################################
# CVS
# Add the CVS root to CVS_FLAGS if needed
CVS_ROOT_IN_TREE := $(shell cat $(TOPSRCDIR)/CVS/Root 2>/dev/null)
ifneq ($(CVS_ROOT_IN_TREE),)
ifneq ($(CVS_ROOT_IN_TREE),$(CVSROOT))
CVS_FLAGS := -d $(CVS_ROOT_IN_TREE)
endif
endif
CVSCO = $(strip $(CVS) $(CVS_FLAGS) co $(CVS_CO_FLAGS))
CVSCO_LOGFILE := $(ROOTDIR)/cvsco.log
CVSCO_LOGFILE := $(shell echo $(CVSCO_LOGFILE) | sed s%//%/%)
ifdef MOZ_CO_TAG
CVS_CO_FLAGS := -f -r $(MOZ_CO_TAG)
endif
####################################
# Load mozconfig Options
# See build pages, http://www.mozilla.org/build/unix.html,
# for how to set up mozconfig.
MOZCONFIG_LOADER := mozilla/build/autoconf/mozconfig2client-mk
MOZCONFIG_FINDER := mozilla/build/autoconf/mozconfig-find
MOZCONFIG_MODULES := mozilla/build/unix/modules.mk
run_for_side_effects := \
$(shell cd $(ROOTDIR); \
if test "$(_IS_FIRST_CHECKOUT)"; then \
$(CVSCO) $(MOZCONFIG_FINDER) $(MOZCONFIG_LOADER) $(MOZCONFIG_MODULES); \
else true; \
fi; \
$(MOZCONFIG_LOADER) $(TOPSRCDIR) mozilla/.mozconfig.mk > mozilla/.mozconfig.out)
include $(TOPSRCDIR)/.mozconfig.mk
include $(TOPSRCDIR)/build/unix/modules.mk
####################################
# Options that may come from mozconfig
# Change CVS flags if anonymous root is requested
ifdef MOZ_CO_USE_MIRROR
CVS_FLAGS := -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
endif
# MOZ_CVS_FLAGS - Basic CVS flags
ifeq "$(origin MOZ_CVS_FLAGS)" "undefined"
CVS_FLAGS := $(CVS_FLAGS) -q -z 3
else
CVS_FLAGS := $(MOZ_CVS_FLAGS)
endif
# This option is depricated. The best way to have client.mk pull a tag
# is to set MOZ_CO_TAG (see above) and commit that change on the tag.
ifdef MOZ_CO_BRANCH
$(warning Use MOZ_CO_TAG instead of MOZ_CO_BRANCH)
CVS_CO_FLAGS := -r $(MOZ_CO_BRANCH)
endif
# MOZ_CO_FLAGS - Anything that we should use on all checkouts
ifeq "$(origin MOZ_CO_FLAGS)" "undefined"
CVS_CO_FLAGS := $(CVS_CO_FLAGS) -P
else
CVS_CO_FLAGS := $(CVS_CO_FLAGS) $(MOZ_CO_FLAGS)
endif
ifdef MOZ_CO_DATE
CVS_CO_DATE_FLAGS := -D "$(MOZ_CO_DATE)"
endif
ifdef MOZ_OBJDIR
OBJDIR := $(MOZ_OBJDIR)
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
else
OBJDIR := $(TOPSRCDIR)
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS)
endif
####################################
# CVS defines for PSM
#
PSM_CO_MODULE= mozilla/security/manager mozilla/security/makefile.win
PSM_CO_FLAGS := -P -A
ifdef MOZ_CO_FLAGS
PSM_CO_FLAGS := $(MOZ_CO_FLAGS)
endif
ifdef PSM_CO_TAG
PSM_CO_FLAGS := $(PSM_CO_FLAGS) -r $(PSM_CO_TAG)
endif
CVSCO_PSM = $(CVS) $(CVS_FLAGS) co $(PSM_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(PSM_CO_MODULE)
####################################
# CVS defines for NSS
#
NSS_CO_MODULE = mozilla/security/nss \
mozilla/security/coreconf \
$(NULL)
NSS_CO_FLAGS := -P
ifdef MOZ_CO_FLAGS
NSS_CO_FLAGS := $(MOZ_CO_FLAGS)
endif
ifdef NSS_CO_TAG
NSS_CO_FLAGS := $(NSS_CO_FLAGS) -r $(NSS_CO_TAG)
endif
# Cannot pull static tags by date
ifeq ($(NSS_CO_TAG),NSS_CLIENT_TAG)
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(NSS_CO_MODULE)
else
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSS_CO_MODULE)
endif
####################################
# CVS defines for NSPR
#
NSPR_CO_MODULE = mozilla/nsprpub
NSPR_CO_FLAGS := -P
ifdef MOZ_CO_FLAGS
NSPR_CO_FLAGS := $(MOZ_CO_FLAGS)
endif
ifdef NSPR_CO_TAG
NSPR_CO_FLAGS := $(NSPR_CO_FLAGS) -r $(NSPR_CO_TAG)
endif
# Cannot pull static tags by date
ifeq ($(NSPR_CO_TAG),NSPRPUB_CLIENT_TAG)
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(NSPR_CO_MODULE)
else
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSPR_CO_MODULE)
endif
####################################
# CVS defines for the C LDAP SDK
#
LDAPCSDK_CO_MODULE = mozilla/directory/c-sdk
LDAPCSDK_CO_FLAGS := -P
ifdef MOZ_CO_FLAGS
LDAPCSDK_CO_FLAGS := $(MOZ_CO_FLAGS)
endif
ifdef LDAPCSDK_CO_TAG
LDAPCSDK_CO_FLAGS := $(LDAPCSDK_CO_FLAGS) -r $(LDAPCSDK_CO_TAG)
endif
CVSCO_LDAPCSDK = $(CVS) $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(LDAPCSDK_CO_MODULE)
####################################
# CVS defines for the C LDAP SDK
#
ACCESSIBLE_CO_MODULE = mozilla/accessible
ACCESSIBLE_CO_FLAGS := -P
ifdef MOZ_CO_FLAGS
ACCESSIBLE_CO_FLAGS := $(MOZ_CO_FLAGS)
endif
ifdef ACCESSIBLE_CO_TAG
ACCESSIBLE_CO_FLAGS := $(ACCESSIBLE_CO_FLAGS) -r $(ACCESSIBLE_CO_TAG)
endif
CVSCO_ACCESSIBLE = $(CVS) $(CVS_FLAGS) co $(ACCESSIBLE_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(ACCESSIBLE_CO_MODULE)
####################################
# CVS defines for gfx2
#
GFX2_CO_MODULE = mozilla/gfx2
GFX2_CO_FLAGS := -P
ifdef MOZ_CO_FLAGS
GFX2_CO_FLAGS := $(MOZ_CO_FLAGS)
endif
ifdef GFX2_CO_TAG
GFX2_CO_FLAGS := $(GFX2_CO_FLAGS) -r $(GFX2_CO_TAG)
endif
CVSCO_GFX2 = $(CVS) $(CVS_FLAGS) co $(GFX2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(GFX2_CO_MODULE)
####################################
# CVS defines for new image library
#
IMGLIB2_CO_MODULE = mozilla/modules/libpr0n
IMGLIB2_CO_FLAGS := -P
ifdef MOZ_CO_FLAGS
IMGLIB2_CO_FLAGS := $(MOZ_CO_FLAGS)
endif
ifdef IMGLIB2_CO_TAG
IMGLIB2_CO_FLAGS := $(IMGLIB2_CO_FLAGS) -r $(IMGLIB2_CO_TAG)
endif
CVSCO_IMGLIB2 = $(CVS) $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(IMGLIB2_CO_MODULE)
####################################
# CVS defines for standalone modules
#
ifneq ($(BUILD_MODULES),all)
MOZ_CO_MODULE := $(filter-out $(NSPRPUB_DIR) security directory/c-sdk, $(BUILD_MODULE_CVS))
MOZ_CO_MODULE += allmakefiles.sh client.mk aclocal.m4 configure configure.in
MOZ_CO_MODULE += Makefile.in
MOZ_CO_MODULE := $(addprefix mozilla/, $(MOZ_CO_MODULE))
NOSUBDIRS_MODULE := $(addprefix mozilla/, $(BUILD_MODULE_CVS_NS))
ifneq ($(NOSUBDIRS_MODULE),)
CVSCO_NOSUBDIRS := $(CVSCO) -l $(CVS_CO_DATE_FLAGS) $(NOSUBDIRS_MODULE)
endif
ifeq (,$(filter $(NSPRPUB_DIR), $(BUILD_MODULE_CVS)))
CVSCO_NSPR :=
endif
ifeq (,$(filter security security/manager, $(BUILD_MODULE_CVS)))
CVSCO_PSM :=
CVSCO_NSS :=
endif
ifeq (,$(filter directory/c-sdk, $(BUILD_MODULE_CVS)))
CVSCO_LDAPCSDK :=
endif
ifeq (,$(filter accessible, $(BUILD_MODULE_CVS)))
CVSCO_ACCESSIBLE :=
endif
ifeq (,$(filter gfx2, $(BUILD_MODULE_CVS)))
CVSCO_GFX2 :=
endif
ifeq (,$(filter modules/libpr0n, $(BUILD_MODULE_CVS)))
CVSCO_IMGLIB2 :=
endif
endif
####################################
# CVS defines for SeaMonkey
#
ifeq ($(MOZ_CO_MODULE),)
MOZ_CO_MODULE := SeaMonkeyAll
endif
CVSCO_SEAMONKEY := $(CVSCO) $(CVS_CO_DATE_FLAGS) $(MOZ_CO_MODULE)
# HACK FOR SVG SEMI_BRANCH
# add new files here
SVG_BRANCH_FILES := \
content/svg \
layout/svg \
dom/public/idl/svg \
\
aclocal.m4 \
allmakefiles.sh \
build/autoconf/libart.m4 \
build/mac/build_scripts/MozillaBuildFlags.txt \
build/mac/build_scripts/MozillaBuildList.pm \
build/mac/build_scripts/MozillaCheckoutList.txt \
client.mk \
client.mak \
config/autoconf.mk.in \
configure \
configure.in \
content/Makefile.in \
content/base/public/nsIDocument.h \
content/base/public/nsIElementFactory.h \
content/base/src/nsRuleNode.cpp \
content/base/src/nsStyleContext.cpp \
content/build/Makefile.in \
content/build/makefile.win \
content/build/nsContentCID.h \
content/build/nsContentDLF.cpp \
content/build/nsContentModule.cpp \
content/html/document/src/nsHTMLDocument.cpp \
content/html/style/src/nsCSSDeclaration.cpp \
content/html/style/src/nsCSSParser.cpp \
content/html/style/src/nsCSSStyleRule.cpp \
content/html/style/src/nsICSSDeclaration.h \
content/macbuild/contentSVG.mcp \
content/makefile.win \
content/shared/public/MANIFEST \
content/shared/public/Makefile.in \
content/shared/public/makefile.win \
content/shared/public/nsCSSKeywordList.h \
content/shared/public/nsCSSPropList.h \
content/shared/public/nsCSSProps.h \
content/shared/public/nsRuleNode.h \
content/shared/public/nsSVGAtomList.h \
content/shared/public/nsSVGAtoms.h \
content/shared/public/nsStyleStruct.h \
content/shared/src/Makefile.in \
content/shared/src/makefile.win \
content/shared/src/nsCSSProps.cpp \
content/shared/src/nsSVGAtoms.cpp \
content/shared/src/nsStyleStruct.cpp \
content/shared/src/nsStyleUtil.cpp \
content/xml/document/src/nsXMLDocument.cpp \
content/xml/document/src/nsXMLDocument.h \
dom/macbuild/dom_svgIDL.mcp \
dom/public/idl/Makefile.in \
dom/public/idl/makefile.win \
dom/public/nsIDOMClassInfo.h \
dom/src/base/nsDOMClassInfo.cpp \
gfx/public/nsTransform2D.h \
gfx/src/mac/nsRenderingContextMac.cpp \
htmlparser/public/nsIParser.h \
htmlparser/src/nsExpatTokenizer.cpp \
htmlparser/src/nsViewSourceHTML.cpp \
htmlparser/src/nsWellFormedDTD.cpp \
layout/base/public/nsStyleConsts.h \
layout/build/Makefile.in \
layout/build/makefile.win \
layout/html/style/src/Makefile.in \
layout/html/style/src/makefile.win \
layout/html/style/src/nsCSSFrameConstructor.cpp \
layout/html/style/src/nsCSSFrameConstructor.h \
layout/html/tests/makefile.win \
layout/macbuild/layoutsvg.mcp \
Makefile.in \
makefile.win \
netwerk/mime/src/nsXMLMIMEDataSource.cpp \
uriloader/exthandler/nsExternalHelperAppService.cpp \
xpfe/browser/src/nsBrowserInstance.cpp
####################################
# 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)
#
CVSCO_CALENDAR := $(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/calendar
ifdef MOZ_CALENDAR
FASTUPDATE_CALENDAR := fast_update $(CVSCO_CALENDAR)
CHECKOUT_CALENDAR := cvs_co $(CVSCO_CALENDAR)
else
CHECKOUT_CALENDAR := true
FASTUPDATE_CALENDAR := true
endif
#######################################################################
# Rules
#
# Print out any options loaded from mozconfig.
all build checkout clean depend distclean export libs install realclean::
@if test -f .mozconfig.out; then \
cat .mozconfig.out; \
rm -f .mozconfig.out; \
else true; \
fi
ifdef _IS_FIRST_CHECKOUT
all:: checkout build
else
all:: checkout depend build
endif
# Windows equivalents
pull_all: checkout
build_all: build
clobber clobber_all: clean
pull_and_build_all: checkout depend build
# Do everything from scratch
everything: checkout clean build
####################################
# CVS checkout
#
checkout::
# @: Backup the last checkout log.
@if test -f $(CVSCO_LOGFILE) ; then \
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
else true; \
fi
ifdef RUN_AUTOCONF_LOCALLY
@echo "Removing local configures" ; \
cd $(ROOTDIR) && \
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
mozilla/directory/c-sdk/ldap/configure
endif
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
@echo '$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk'; \
cd $(ROOTDIR) && \
$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk
@cd $(ROOTDIR) && $(MAKE) -f mozilla/client.mk real_checkout
real_checkout:
# @: Start the checkout. Split the output to the tty and a log file. \
# : If it fails, touch an error file because "tee" hides the error.
@failed=.cvs-failed.tmp; rm -f $$failed*; \
cvs_co() { echo "$$@" ; \
("$$@" || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
if test -f $$failed; then false; else true; fi; }; \
cvs_co $(CVSCO_NSPR) && \
cvs_co $(CVSCO_NSS) && \
cvs_co $(CVSCO_PSM) && \
cvs_co $(CVSCO_LDAPCSDK) && \
cvs_co $(CVSCO_ACCESSIBLE) && \
cvs_co $(CVSCO_GFX2) && \
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. ;
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
if test "$$conflicts" ; then \
echo "$(MAKE): *** Conflicts during checkout." ;\
echo "$$conflicts" ;\
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
false; \
else true; \
fi
merge:
cvs up -dP -jSVG_20010721_TAG -jHEAD $(SVG_BRANCH_FILES)
statictag:
cvs tag -F -rHEAD SVG_20010721_TAG $(SVG_BRANCH_FILES)
commitmerge:
cvs ci $(SVG_BRANCH_FILES)
diffsvg:
cvs diff $(SVG_BRANCH_FILES)
trunkdiff:
cvs diff -N -rSVG_20010721_TAG -rSVG_20010721_BRANCH $(SVG_BRANCH_FILES)
ifdef RUN_AUTOCONF_LOCALLY
@echo Generating configures using $(AUTOCONF) ; \
cd $(TOPSRCDIR) && $(AUTOCONF) && \
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
cd $(TOPSRCDIR)/directory/c-sdk/ldap && $(AUTOCONF)
endif
fast-update:
# @: Backup the last checkout log.
@if test -f $(CVSCO_LOGFILE) ; then \
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
else true; \
fi
ifdef RUN_AUTOCONF_LOCALLY
@echo "Removing local configures" ; \
cd $(ROOTDIR) && \
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
mozilla/directory/c-sdk/ldap/configure
endif
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
@echo '$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk'; \
cd $(ROOTDIR) && \
$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk
@cd $(TOPSRCDIR) && \
$(MAKE) -f client.mk real_fast-update
real_fast-update:
# @: Start the update. Split the output to the tty and a log file. \
# : If it fails, touch an error file because "tee" hides the error.
@failed=.fast_update-failed.tmp; rm -f $$failed*; \
fast_update() { (config/cvsco-fast-update.pl $$@ || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
if test -f $$failed; then false; else true; fi; }; \
cvs_co() { echo "$$@" ; \
("$$@" || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
if test -f $$failed; then false; else true; fi; }; \
fast_update $(CVSCO_NSPR) && \
cd $(ROOTDIR) && \
cvs_co $(CVSCO_NSS) && \
cd mozilla && \
fast_update $(CVSCO_PSM) && \
fast_update $(CVSCO_LDAPCSDK) && \
fast_update $(CVSCO_ACCESSIBLE) && \
fast_update $(CVSCO_GFX2) && \
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. ;
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
if test "$$conflicts" ; then \
echo "$(MAKE): *** Conflicts during fast-update." ;\
echo "$$conflicts" ;\
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
false; \
else true; \
fi
ifdef RUN_AUTOCONF_LOCALLY
@echo Generating configures using $(AUTOCONF) ; \
cd $(TOPSRCDIR) && $(AUTOCONF) && \
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
cd $(TOPSRCDIR)/directory/c-sdk/ldap && $(AUTOCONF)
endif
####################################
# Web configure
WEBCONFIG_FILE := $(HOME)/.mozconfig
MOZCONFIG2CONFIGURATOR := build/autoconf/mozconfig2configurator
webconfig:
@cd $(TOPSRCDIR); \
url=`$(MOZCONFIG2CONFIGURATOR) $(TOPSRCDIR)`; \
echo Running mozilla with the following url: ;\
echo ;\
echo $$url ;\
mozilla -remote "openURL($$url)" || \
netscape -remote "openURL($$url)" || \
mozilla $$url || \
netscape $$url ;\
echo ;\
echo 1. Fill out the form on the browser. ;\
echo 2. Save the results to $(WEBCONFIG_FILE)
#####################################################
# First Checkout
ifdef _IS_FIRST_CHECKOUT
# First time, do build target in a new process to pick up new files.
build::
$(MAKE) -f $(TOPSRCDIR)/client.mk build
else
#####################################################
# After First Checkout
####################################
# Configure
CONFIG_STATUS := $(wildcard $(OBJDIR)/config.status)
CONFIG_CACHE := $(wildcard $(OBJDIR)/config.cache)
ifdef RUN_AUTOCONF_LOCALLY
EXTRA_CONFIG_DEPS := \
$(TOPSRCDIR)/aclocal.m4 \
$(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
$(NULL)
$(TOPSRCDIR)/configure: $(TOPSRCDIR)/configure.in $(EXTRA_CONFIG_DEPS)
@echo Generating $@ using autoconf
cd $(TOPSRCDIR); $(AUTOCONF)
endif
CONFIG_STATUS_DEPS_L10N := $(wildcard $(TOPSRCDIR)/l10n/makefiles.all)
CONFIG_STATUS_DEPS := \
$(TOPSRCDIR)/configure \
$(TOPSRCDIR)/allmakefiles.sh \
$(TOPSRCDIR)/.mozconfig.mk \
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
$(wildcard $(TOPSRCDIR)/directory/c-sdk/ldap/configure) \
$(wildcard $(TOPSRCDIR)/mailnews/makefiles) \
$(CONFIG_STATUS_DEPS_L10N) \
$(wildcard $(TOPSRCDIR)/themes/makefiles) \
$(NULL)
# configure uses the program name to determine @srcdir@. Calling it without
# $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
# path of $(TOPSRCDIR).
ifeq ($(TOPSRCDIR),$(OBJDIR))
CONFIGURE := ./configure
else
CONFIGURE := $(TOPSRCDIR)/configure
endif
$(OBJDIR)/Makefile $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
@if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
@echo cd $(OBJDIR);
@echo $(CONFIGURE)
@cd $(OBJDIR) && $(CONFIGURE_ENV_ARGS) $(CONFIGURE) \
|| ( echo "*** Fix above errors and then restart with\
\"$(MAKE) -f client.mk build\"" && exit 1 )
@touch $(OBJDIR)/Makefile
ifdef CONFIG_STATUS
$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
cd $(OBJDIR); \
CONFIG_FILES=config/autoconf.mk ./config.status
endif
####################################
# Depend
depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) export && $(MOZ_MAKE) depend
####################################
# Build it
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE)
####################################
# Other targets
# Pass these target onto the real build system
install export libs clean realclean distclean:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE) $@
cleansrcdir:
@cd $(TOPSRCDIR); \
if [ -f webshell/embed/gtk/Makefile ]; then \
$(MAKE) -C webshell/embed/gtk distclean; \
fi; \
if [ -f Makefile ]; then \
$(MAKE) distclean ; \
else \
echo "Removing object files from srcdir..."; \
rm -fr `find . -type d \( -name .deps -print -o -name CVS \
-o -exec test ! -d {}/CVS \; \) -prune \
-o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
build/autoconf/clean-config.sh; \
fi;
# (! IS_FIRST_CHECKOUT)
endif
.PHONY: checkout real_checkout depend build export libs install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything

View File

@@ -0,0 +1,366 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is this file as it was released upon August 6, 1998.
#
# The Initial Developer of the Original Code is Christopher
# Seawood. Portions created by Christopher Seawood are
# Copyright (C) 1998 Christopher Seawood. All
# Rights Reserved.
#
# Contributor(s):
# A netscape style .mk file for autoconf builds
INCLUDED_AUTOCONF_MK = 1
USE_AUTOCONF = 1
MOZILLA_CLIENT = 1
NO_MDUPDATE = 1
BUILD_MODULES = @BUILD_MODULES@
MOZILLA_VERSION = @MOZILLA_VERSION@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
datadir = @datadir@
DIST = $(DEPTH)/dist
MOZ_CHROME_FILE_FORMAT = @MOZ_CHROME_FILE_FORMAT@
MOZ_WIDGET_TOOLKIT = @MOZ_WIDGET_TOOLKIT@
MOZ_GFX_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)
MOZ_JS_LIBS = @MOZ_JS_LIBS@
MOZ_GFX_TOOLKIT_LDFLAGS = @MOZ_GFX_TOOLKIT_LDFLAGS@
MOZ_WIDGET_TOOLKIT_LDFLAGS = @MOZ_WIDGET_TOOLKIT_LDFLAGS@
MOZ_DEBUG = @MOZ_DEBUG@
MOZ_DEBUG_MODULES = @MOZ_DEBUG_MODULES@
MOZ_PROFILE_MODULES = @MOZ_PROFILE_MODULES@
MOZ_DEBUG_ENABLE_DEFS = @MOZ_DEBUG_ENABLE_DEFS@
MOZ_DEBUG_DISABLE_DEFS = @MOZ_DEBUG_DISABLE_DEFS@
MOZ_DEBUG_FLAGS = @MOZ_DEBUG_FLAGS@
MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@
MOZ_DBGRINFO_MODULES = @MOZ_DBGRINFO_MODULES@
MOZ_EXTENSIONS = @MOZ_EXTENSIONS@
MOZ_JSDEBUGGER = @MOZ_JSDEBUGGER@
MOZ_PERF_METRICS = @MOZ_PERF_METRICS@
MOZ_LEAKY = @MOZ_LEAKY@
MOZ_JPROF = @MOZ_JPROF@
MOZ_XPCTOOLS = @MOZ_XPCTOOLS@
ENABLE_EAZEL_PROFILER=@ENABLE_EAZEL_PROFILER@
EAZEL_PROFILER_CFLAGS=@EAZEL_PROFILER_CFLAGS@
EAZEL_PROFILER_LIBS=@EAZEL_PROFILER_LIBS@
GC_LEAK_DETECTOR = @GC_LEAK_DETECTOR@
NS_TRACE_MALLOC = @NS_TRACE_MALLOC@
USE_ELF_DYNSTR_GC = @USE_ELF_DYNSTR_GC@
MOZ_MAIL_NEWS = @MOZ_MAIL_NEWS@
MOZ_CALENDAR = @MOZ_CALENDAR@
MOZ_PLAINTEXT_EDITOR_ONLY = @MOZ_PLAINTEXT_EDITOR_ONLY@
BUILD_SHARED_LIBS = @BUILD_SHARED_LIBS@
BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@
MOZ_STATIC_COMPONENTS = @MOZ_STATIC_COMPONENTS@
MOZ_META_COMPONENTS = @MOZ_META_COMPONENTS@
MOZ_STATIC_COMPONENT_LIBS = @MOZ_STATIC_COMPONENT_LIBS@
ENABLE_TESTS = @ENABLE_TESTS@
IBMBIDI = @IBMBIDI@
SUNCTL = @SUNCTL@
ACCESSIBILITY = @ACCESSIBILITY@
MOZ_LDAP_XPCOM = @MOZ_LDAP_XPCOM@
MOZ_LDAP_XPCOM_EXPERIMENTAL = @MOZ_LDAP_XPCOM_EXPERIMENTAL@
XPCOM_USE_LEA = @XPCOM_USE_LEA@
JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS = @MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS@
MOZ_COMPONENT_NSPR_LIBS=@MOZ_COMPONENT_NSPR_LIBS@
MOZ_COMPONENT_XPCOM_LIBS=@MOZ_COMPONENT_XPCOM_LIBS@
XPCOM_LIBS=@XPCOM_LIBS@
MOZ_REORDER=@MOZ_REORDER@
MOZ_TIMELINE=@MOZ_TIMELINE@
ENABLE_STRIP = @ENABLE_STRIP@
ClientWallet=1
CookieManagement=1
SingleSignon=1
MOZ_OJI=1
MOZ_POST_DSO_LIB_COMMAND = @MOZ_POST_DSO_LIB_COMMAND@
MOZ_POST_PROGRAM_COMMAND = @MOZ_POST_PROGRAM_COMMAND@
MOZ_BUILD_ROOT = @MOZ_BUILD_ROOT@
MOZ_GLE = @MOZ_GLE@
MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@
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@
MOZ_INSURE_EXCLUDE_DIRS = @MOZ_INSURE_EXCLUDE_DIRS@
MOZ_NATIVE_NSPR = @MOZ_NATIVE_NSPR@
CROSS_COMPILE = @CROSS_COMPILE@
OS_CPPFLAGS = @CPPFLAGS@
OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@
OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@
OS_LDFLAGS = @LDFLAGS@
OS_COMPILE_CFLAGS = $(OS_CPPFLAGS) @COMPILE_CFLAGS@
OS_COMPILE_CXXFLAGS = $(OS_CPPFLAGS) @COMPILE_CXXFLAGS@
OS_INCLUDES = $(NSPR_CFLAGS) $(JPEG_CFLAGS) $(PNG_CFLAGS) $(MNG_CFLAGS) $(ZLIB_CFLAGS)
OS_LIBS = @LIBS@
ACDEFINES = @DEFS@
MOZ_OPTIMIZE = @MOZ_OPTIMIZE@
MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@
MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@
XCFLAGS = @XCFLAGS@
XLDFLAGS = @XLDFLAGS@
XLIBS = @XLIBS@
AIX_SHLIB_BIN = @AIX_SHLIB_BIN@
AR = @AR@
AR_FLAGS = @AR_FLAGS@
AR_EXTRACT = @AR_EXTRACT@
AR_LIST = @AR_LIST@
AR_DELETE = @AR_DELETE@
AS = @AS@
ASFLAGS = @ASFLAGS@
AS_DASH_C_FLAG = @AS_DASH_C_FLAG@
LD = @LD@
DLLTOOL = @DLLTOOL@
WINDRES = @WINDRES@
USE_SHORT_LIBNAME = @USE_SHORT_LIBNAME@
IMPLIB = @IMPLIB@
FILTER = @FILTER@
BIN_FLAGS = @BIN_FLAGS@
LIB_PREFIX = @LIB_PREFIX@
OBJ_SUFFIX = @OBJ_SUFFIX@
LIB_SUFFIX = @LIB_SUFFIX@
DLL_SUFFIX = @DLL_SUFFIX@
BIN_SUFFIX = @BIN_SUFFIX@
ASM_SUFFIX = @ASM_SUFFIX@
USE_N32 = @USE_N32@
HAVE_64BIT_OS = @HAVE_64BIT_OS@
# Temp hack. It is not my intention to leave this crap in here for ever.
# Im talking to fur right now to solve the problem without introducing
# NS_USE_NATIVE to the build system -ramiro.
NS_USE_NATIVE = @NS_USE_NATIVE@
CC = @CC@
CXX = @CXX@
GNU_AS = @GNU_AS@
GNU_LD = @GNU_LD@
GNU_CC = @GNU_CC@
GNU_CXX = @GNU_CXX@
HAVE_GCC3_ABI = @HAVE_GCC3_ABI@
HOST_CC = @HOST_CC@
HOST_CXX = @HOST_CXX@
HOST_CFLAGS = @HOST_CFLAGS@
HOST_CXXFLAGS = @HOST_CXXFLAGS@
HOST_NSPR_MDCPUCFG = @HOST_NSPR_MDCPUCFG@
HOST_AR = @HOST_AR@
HOST_RANLIB = @HOST_RANLIB@
HOST_LIBIDL_CONFIG = @HOST_LIBIDL_CONFIG@
HOST_LIBIDL_CFLAGS = @HOST_LIBIDL_CFLAGS@
HOST_LIBIDL_LIBS = @HOST_LIBIDL_LIBS@
TARGET_NSPR_MDCPUCFG = @TARGET_NSPR_MDCPUCFG@
TARGET_CPU = @TARGET_CPU@
TARGET_VENDOR = @TARGET_VENDOR@
TARGET_OS = @TARGET_OS@
TARGET_MD_ARCH = @TARGET_MD_ARCH@
AUTOCONF = @AUTOCONF@
EMACS = @EMACS@
PERL = @PERL@
RANLIB = @RANLIB@
WHOAMI = @WHOAMI@
UNZIP_PROG = @UNZIP@
ZIP_PROG = @ZIP@
XARGS = @XARGS@
STRIP = @STRIP@
ifdef MOZ_NATIVE_JPEG
JPEG_CFLAGS = @JPEG_CFLAGS@
JPEG_LIBS = @JPEG_LIBS@
JPEG_REQUIRES =
else
JPEG_CFLAGS = @MOZ_JPEG_CFLAGS@
JPEG_LIBS = @MOZ_JPEG_LIBS@
JPEG_REQUIRES = jpeg
endif
ifdef MOZ_NATIVE_ZLIB
ZLIB_CFLAGS = @ZLIB_CFLAGS@
ZLIB_LIBS = @ZLIB_LIBS@
ZLIB_REQUIRES =
else
ZLIB_CFLAGS = @MOZ_ZLIB_CFLAGS@
ZLIB_LIBS = @MOZ_ZLIB_LIBS@
ZLIB_REQUIRES = zlib
endif
ifdef MOZ_NATIVE_PNG
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES =
else
PNG_CFLAGS = @MOZ_PNG_CFLAGS@
PNG_LIBS = @MOZ_PNG_LIBS@
PNG_REQUIRES = png
endif
ifdef MOZ_NATIVE_MNG
MNG_CFLAGS = @MNG_CFLAGS@
MNG_LIBS = @MNG_LIBS@
MNG_REQUIRES =
else
MNG_CFLAGS = @MOZ_MNG_CFLAGS@
MNG_LIBS = @MOZ_MNG_LIBS@
MNG_REQUIRES = mng
endif
NSPR_CFLAGS = @NSPR_CFLAGS@
NSPR_LIBS = @NSPR_LIBS@
LDAP_CFLAGS = @LDAP_CFLAGS@
LDAP_LIBS = @LDAP_LIBS@
# MKSHLIB_FORCE_ALL is used to force the linker to include all object
# files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker
# to normal behavior. Makefile's that create shared libraries out of
# archives use these flags to force in all of the .o files in the
# archives into the shared library.
WRAP_MALLOC_LIB = @WRAP_MALLOC_LIB@
WRAP_MALLOC_CFLAGS = @WRAP_MALLOC_CFLAGS@
DSO_CFLAGS = @DSO_CFLAGS@
DSO_PIC_CFLAGS = @DSO_PIC_CFLAGS@
MKSHLIB = @MKSHLIB@
MKCSHLIB = @MKCSHLIB@
MKSHLIB_FORCE_ALL = @MKSHLIB_FORCE_ALL@
MKSHLIB_UNFORCE_ALL = @MKSHLIB_UNFORCE_ALL@
DSO_LDOPTS = @DSO_LDOPTS@
DLL_SUFFIX = @DLL_SUFFIX@
NO_LD_ARCHIVE_FLAGS = @NO_LD_ARCHIVE_FLAGS@
GTK_CONFIG = @GTK_CONFIG@
TK_CFLAGS = @TK_CFLAGS@
TK_LIBS = @TK_LIBS@
MOZ_TOOLKIT_REGISTRY_CFLAGS = \
-DWIDGET_DLL=@WIDGET_DLL@ \
-DGFXWIN_DLL=@GFXWIN_DLL@ \
$(TK_CFLAGS)
MOZ_ENABLE_GTK = @MOZ_ENABLE_GTK@
MOZ_ENABLE_GTK2 = @MOZ_ENABLE_GTK2@
MOZ_ENABLE_XLIB = @MOZ_ENABLE_XLIB@
MOZ_ENABLE_QT = @MOZ_ENABLE_QT@
MOZ_ENABLE_PHOTON = @MOZ_ENABLE_PHOTON@
MOZ_ENABLE_XREMOTE = @MOZ_ENABLE_XREMOTE@
MOZ_GTK_CFLAGS = @MOZ_GTK_CFLAGS@
MOZ_GTK_LDFLAGS = @MOZ_GTK_LDFLAGS@
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@
MOZ_XLIB_CFLAGS = @MOZ_XLIB_CFLAGS@
MOZ_XLIB_LDFLAGS = @MOZ_XLIB_LDFLAGS@
MOZ_QT_CFLAGS = @MOZ_QT_CFLAGS@
MOZ_QT_LDFLAGS = @MOZ_QT_LDFLAGS@
MOZ_XPRINT_CFLAGS = @MOZ_XPRINT_CFLAGS@
MOZ_XPRINT_LDFLAGS = @MOZ_XPRINT_LDFLAGS@
MOZ_ENABLE_XPRINT = @MOZ_ENABLE_XPRINT@
MOZ_ENABLE_XINERAMA = @MOZ_ENABLE_XINERAMA@
MOZ_XINERAMA_LIBS = @MOZ_XINERAMA_LIBS@
MOZ_XIE_LIBS = @MOZ_XIE_LIBS@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
LIBIDL_CFLAGS = @LIBIDL_CFLAGS@
LIBIDL_LIBS = @LIBIDL_LIBS@
MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@
# Used for LD_LIBRARY_PATH
LIBS_PATH = @LIBS_PATH@
MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@
COMPILER_DEPEND = @COMPILER_DEPEND@
MDDEPDIR := @MDDEPDIR@
MOZ_DISABLE_DTD_DEBUG = @MOZ_DISABLE_DTD_DEBUG@
MOZ_DEMANGLE_SYMBOLS = @MOZ_DEMANGLE_SYMBOLS@
# XXX - these need to be cleaned up and have real checks added -cls
CM_BLDTYPE=dbg
AWT_11=1
MOZ_BITS=32
OS_TARGET=@OS_TARGET@
OS_ARCH=@OS_ARCH@
OS_RELEASE=@OS_RELEASE@
OS_TEST=@OS_TEST@
# For OS/2 build
MOZ_OS2_TOOLS = @MOZ_OS2_TOOLS@
MOZ_OS2_EMX_OBJECTFORMAT = @MOZ_OS2_EMX_OBJECTFORMAT@
HAVE_XIE=@HAVE_XIE@
MOZ_MOVEMAIL=@MOZ_MOVEMAIL@
MOZ_PSM=@MOZ_PSM@
# for Qt build
MOC=@MOC@

13939
mozilla/configure vendored Executable file

File diff suppressed because it is too large Load Diff

4524
mozilla/configure.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = base html xml xul xbl xsl
ifdef MOZ_SVG
DIRS += svg
endif
DIRS += events shared build
include $(topsrcdir)/config/rules.mk

View File

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

View File

@@ -0,0 +1,409 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIDocument_h___
#define nsIDocument_h___
#include "nsISupports.h"
#include "nsEvent.h"
#include "nsAWritableString.h"
#include "nsString.h"
class nsIAtom;
class nsIArena;
class nsIContent;
class nsIDocumentContainer;
class nsIDocumentObserver;
class nsIPresContext;
class nsIPresShell;
class nsIStreamListener;
class nsIStreamObserver;
class nsIStyleSet;
class nsIStyleSheet;
class nsIStyleRule;
class nsIURI;
class nsILoadGroup;
class nsIViewManager;
class nsIScriptGlobalObject;
class nsIDOMEvent;
class nsIDeviceContext;
class nsIParser;
class nsIDOMNode;
class nsINameSpaceManager;
class nsIDOMDocumentFragment;
class nsILineBreaker;
class nsIWordBreaker;
class nsISelection;
class nsIChannel;
class nsIPrincipal;
class nsINodeInfoManager;
class nsIDOMDocument;
class nsIDOMDocumentType;
class nsIBindingManager;
class nsIObserver;
class nsISupportsArray;
class nsIScriptLoader;
class nsString;
class nsIFocusController;
class nsIContentSink;
// IID for the nsIDocument interface
#define NS_IDOCUMENT_IID \
{ 0x94c6ceb0, 0x9447, 0x11d1, \
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
// The base value for the content ID counter.
// This counter is used by the document to
// assign a monotonically increasing ID to each content
// object it creates
#define NS_CONTENT_ID_COUNTER_BASE 10000
//----------------------------------------------------------------------
// Document interface
class nsIDocument : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID)
// All documents have a memory arena associated with them which is
// used for memory allocation during document creation. This call
// returns the arena associated with this document.
NS_IMETHOD GetArena(nsIArena** aArena) = 0;
NS_IMETHOD StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener **aDocListener,
PRBool aReset,
nsIContentSink* aSink = nsnull) = 0;
NS_IMETHOD StopDocumentLoad() = 0;
/**
* Return the title of the document. May return null.
*/
virtual const nsString* GetDocumentTitle() const = 0;
/**
* Return the URL for the document. May return null.
*/
NS_IMETHOD GetDocumentURL(nsIURI** aURL) const = 0;
NS_IMETHOD SetDocumentURL(nsIURI* aURL) = 0;
/**
* Return the principal responsible for this document.
*/
NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal) = 0;
/**
* Update principal responsible for this document to the intersection
* of its previous value and aPrincipal.
*/
NS_IMETHOD AddPrincipal(nsIPrincipal *aPrincipal) = 0;
/**
* Return the LoadGroup for the document. May return null.
*/
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup** aGroup) const = 0;
/**
* Return the base URL for realtive URLs in the document. May return null (or the document URL).
*/
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const = 0;
NS_IMETHOD SetBaseURL(nsIURI* aURL) = 0;
/**
* Get/Set the base target of a link in a document.
*/
NS_IMETHOD GetBaseTarget(nsAWritableString &aBaseTarget)=0;
NS_IMETHOD SetBaseTarget(const nsAReadableString &aBaseTarget)=0;
/**
* Return a standard name for the document's character set. This will
* trigger a startDocumentLoad if necessary to answer the question.
*/
NS_IMETHOD GetDocumentCharacterSet(nsAWritableString& oCharSetID) = 0;
NS_IMETHOD SetDocumentCharacterSet(const nsAReadableString& aCharSetID) = 0;
/**
* Add an observer that gets notified whenever the charset changes.
*/
NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver) = 0;
/**
* Remove a charset observer.
*/
NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver) = 0;
/**
* Return the language of this document.
*/
NS_IMETHOD GetContentLanguage(nsAWritableString& aContentLanguage) const = 0;
#ifdef IBMBIDI
// The state BidiEnabled should persist across multiple views (screen, print)
// of the same document.
/**
* Check if the document contains bidi data.
* If so, we have to apply the Unicode Bidi Algorithm.
*/
NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const = 0;
/**
* Indicate the document contains bidi data.
* Currently, we cannot disable bidi, because once bidi is enabled,
* it affects a frame model irreversibly, and plays even though
* the document no longer contains bidi data.
*/
NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled) = 0;
#endif // IBMBIDI
/**
* Return the Line Breaker for the document
*/
NS_IMETHOD GetLineBreaker(nsILineBreaker** aResult) = 0;
NS_IMETHOD SetLineBreaker(nsILineBreaker* aLineBreaker) = 0;
NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) = 0;
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) = 0;
/**
* Access HTTP header data (this may also get set from other sources, like
* HTML META tags).
*/
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const = 0;
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData) = 0;
/**
* Create a new presentation shell that will use aContext for
* it's presentation context (presentation context's <b>must not</b> be
* shared among multiple presentation shell's).
*/
NS_IMETHOD CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult) = 0;
virtual PRBool DeleteShell(nsIPresShell* aShell) = 0;
virtual PRInt32 GetNumberOfShells() = 0;
NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell) = 0;
/**
* Return the parent document of this document. Will return null
* unless this document is within a compound document and has a parent.
*/
NS_IMETHOD GetParentDocument(nsIDocument** aParent) = 0;
NS_IMETHOD SetParentDocument(nsIDocument* aParent) = 0;
NS_IMETHOD AddSubDocument(nsIDocument* aSubDoc) = 0;
NS_IMETHOD GetNumberOfSubDocuments(PRInt32* aCount) = 0;
NS_IMETHOD GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc) = 0;
/**
* Return the root content object for this document.
*/
NS_IMETHOD GetRootContent(nsIContent** aRoot) = 0;
NS_IMETHOD SetRootContent(nsIContent* aRoot) = 0;
/**
* Get the direct children of the document - content in
* the prolog, the root content and content in the epilog.
*/
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const = 0;
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const = 0;
NS_IMETHOD GetChildCount(PRInt32& aCount) = 0;
/**
* Get the style sheets owned by this document.
* Style sheets are ordered, most significant last.
*/
NS_IMETHOD GetNumberOfStyleSheets(PRInt32* aCount) = 0;
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsIStyleSheet** aSheet) = 0;
NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex) = 0;
virtual void AddStyleSheet(nsIStyleSheet* aSheet) = 0;
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet) = 0;
NS_IMETHOD UpdateStyleSheets(nsISupportsArray* aOldSheets, nsISupportsArray* aNewSheets) = 0;
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool aNotify) = 0;
virtual void SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
PRBool mDisabled) = 0;
/**
* Set the object from which a document can get a script context.
* This is the context within which all scripts (during document
* creation and during event handling) will run.
*/
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject) = 0;
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject) = 0;
/**
* Get the name space manager for this document
*/
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) = 0;
/**
* Get the script loader for this document
*/
NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader) = 0;
/**
* Get the focus controller for this document
* This can usually be gotten through the ScriptGlobalObject, but
* it is set to null during document destruction, when we still might
* need to fire focus events.
*/
NS_IMETHOD GetFocusController(nsIFocusController** aFocusController) = 0;
//----------------------------------------------------------------------
// Document notification API's
/**
* Add a new observer of document change notifications. Whenever
* content is changed, appended, inserted or removed the observers are
* informed.
*/
virtual void AddObserver(nsIDocumentObserver* aObserver) = 0;
/**
* Remove an observer of document change notifications. This will
* return false if the observer cannot be found.
*/
virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver) = 0;
// Observation hooks used by content nodes to propagate
// notifications to document observers.
NS_IMETHOD BeginUpdate() = 0;
NS_IMETHOD EndUpdate() = 0;
NS_IMETHOD BeginLoad() = 0;
NS_IMETHOD EndLoad() = 0;
NS_IMETHOD ContentChanged(nsIContent* aContent,
nsISupports* aSubContent) = 0;
// notify that one or two content nodes changed state
// either may be nsnull, but not both
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2) = 0;
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute) = 0;
NS_IMETHOD AttributeChanged(nsIContent* aChild,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
NS_IMETHOD ContentAppended(nsIContent* aContainer,
PRInt32 aNewIndexInContainer) = 0;
NS_IMETHOD ContentInserted(nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) = 0;
NS_IMETHOD ContentReplaced(nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer) = 0;
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) = 0;
// Observation hooks for style data to propogate notifications
// to document observers
NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) = 0;
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) = 0;
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus) = 0;
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement) = 0;
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE,
PRBool aUpdateViews=PR_FALSE) = 0;
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID) = 0;
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult) = 0;
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0;
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) = 0;
NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup) = 0;
NS_IMETHOD AddReference(void *aKey, nsISupports *aReference) = 0;
NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference) = 0;
};
// XXX These belong somewhere else
extern NS_EXPORT nsresult
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult);
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);
extern NS_EXPORT nsresult
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
nsIDocument* aOwnerDocument);
extern NS_EXPORT nsresult
NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
const nsAReadableString& aNamespaceURI,
const nsAReadableString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
nsIURI* aBaseURI);
// Note: The buffer passed into NewPostData(...) becomes owned by the IPostData
// instance and is freed when the instance is destroyed...
//
#if 0
extern NS_EXPORT nsresult
NS_NewPostData(PRBool aIsFile, char *aData, nsIPostData** aInstancePtrResult);
#endif
#endif /* nsIDocument_h___ */

View File

@@ -0,0 +1,80 @@
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIElementFactory_h___
#define nsIElementFactory_h___
#include "nsISupports.h"
class nsIContent;
class nsINodeInfo;
/* a6cf90fb-15b3-11d2-932e-00805f8add32 */
#define NS_IELEMENT_FACTORY_IID \
{ 0xa6cf90fb, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/**
* An API for creating html content objects
*/
class nsIElementFactory : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IELEMENT_FACTORY_IID; return iid; }
NS_IMETHOD CreateInstanceByTag(nsINodeInfo *aNodeInfo,
nsIContent** aResult) = 0;
};
// ContractIDs for element factory registration
#define NS_ELEMENT_FACTORY_CONTRACTID "@mozilla.org/layout/element-factory;1"
#define NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_ELEMENT_FACTORY_CONTRACTID "?namespace="
#define NS_HTML_NAMESPACE "http://www.w3.org/1999/xhtml"
#define NS_XML_NAMESPACE "http://www.w3.org/XML/1998/namespace"
#define NS_HTML_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_HTML_NAMESPACE
#define NS_XML_ELEMENT_FACTORY_CONTRACTID NS_ELEMENT_FACTORY_CONTRACTID_PREFIX NS_XML_NAMESPACE
#ifdef MOZ_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___ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,138 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
BUILD_DATE = gbdate.h
MODULE = content
LIBRARY_NAME = gkcontent
EXPORT_LIBRARY = 1
SHORT_LIBNAME = gkcontnt
IS_COMPONENT = 1
MODULE_NAME = nsContentModule
EXTRA_DSO_LIBS = gkgfx
REQUIRES = xpcom \
string \
gfx \
layout \
widget \
necko \
rdf \
docshell \
dom \
htmlparser \
uriloader \
webshell \
locale \
unicharutil \
lwbrk \
js \
pref \
xul \
xuldoc \
xultmpl \
timer \
$(NULL)
CPPSRCS = \
nsContentDLF.cpp \
nsContentModule.cpp \
nsContentHTTPStartup.cpp \
$(NULL)
EXPORTS = nsContentCID.h
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/libgkconevents_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconhtmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconhtmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconhtmlstyle_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxmlcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxmldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxsldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxulcon_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxuldoc_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxultmpl_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconxbl_s.$(LIB_SUFFIX) \
$(DIST)/lib/libgkconbase_s.$(LIB_SUFFIX) \
$(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) \
$(NULL)
endif
EXTRA_DSO_LDOPTS = \
-L$(DIST)/bin \
$(EXTRA_DSO_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(MOZ_JS_LIBS) \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
EXPORT_OBJS = 1
endif
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),IRIX)
ifeq ($(GNU_CXX),1)
LDFLAGS += -Wl,-LD_LAYOUT:lgot_buffer=60
endif
endif
DEFINES += -D_IMPL_NS_HTML
INCLUDES += -I$(srcdir)/../base/src \
-I$(srcdir)/../html/base/src \
-I$(srcdir)/../html/style/src \
-I$(srcdir)/../xul/content/src \
-I$(srcdir)/../xul/base/src \
-I$(srcdir)/../xul/templates/src \
-I$(srcdir)/../events/src \
-I$(srcdir)/../html/content/src \
-I. \
$(NULL)
GARBAGE+=$(BUILD_DATE)
export:: $(BUILD_DATE)
$(BUILD_DATE): gbdate.pl
$(RM) $@
$(PERL) $(srcdir)/gbdate.pl > $@

View File

@@ -0,0 +1,112 @@
#!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=..\..
DEFINES=-D_IMPL_NS_HTML
CPP_OBJS= \
.\$(OBJDIR)\nsContentDLF.obj \
.\$(OBJDIR)\nsContentModule.obj \
.\$(OBJDIR)\nsContentHTTPStartup.obj \
$(NULL)
EXPORTS=nsContentCID.h
MODULE=content
LIBRARY_NAME=gkcontent
MODULE_NAME=nsContentModule
REQUIRES = xpcom \
string \
widget \
necko \
rdf \
docshell \
dom \
htmlparser \
uriloader \
webshell \
locale \
unicharutil \
lwbrk \
js \
pref \
timer \
layout \
gfx \
layout_xul \
content_xul \
$(NULL)
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
LINCS=-I..\html\base\src -I..\base\src \
-I..\html\style\src \
-I..\xul\content\src \
-I..\xul\templates\src \
-I..\xul\base\src \
-I..\events\src \
-I..\html\content\src
# These are the libraries we need to link with to create the dll
SUB_LIBRARIES=\
$(DIST)\lib\contentbase_s.lib \
$(DIST)\lib\contenthtmlcontent_s.lib \
$(DIST)\lib\contenthtmldoc_s.lib \
$(DIST)\lib\contenthtmlstyle_s.lib \
$(DIST)\lib\contentxmlcontent_s.lib \
$(DIST)\lib\contentxmldoc_s.lib \
$(DIST)\lib\contentxsldoc_s.lib \
$(DIST)\lib\contentxulcontent_s.lib \
$(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)
LLIBS=\
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\gkgfx.lib \
$(DIST)\lib\timer_s.lib \
$(DIST)\lib\unicharutil_s.lib \
$(DIST)\lib\js32$(VERSION_NUMBER).lib \
!if defined(MOZ_PERF)
$(DIST)\lib\util.lib \
!endif
$(LIBNSPR)
include <$(DEPTH)\config\rules.mak>
export:: gbdate.h
gbdate.h:: gbdate.pl
echo +++ make: Creating $@
$(PERL) gbdate.pl > gbdate.h

View File

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

View File

@@ -0,0 +1,665 @@
/* -*- 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 "nsCOMPtr.h"
#include "nsContentDLF.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsIComponentManager.h"
#include "nsICategoryManager.h"
#include "nsIDocumentLoader.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIDocument.h"
#include "nsIDocumentViewer.h"
#include "nsIHTMLContent.h"
#include "nsIURL.h"
#include "nsICSSStyleSheet.h"
#include "nsNodeInfo.h"
#include "nsNodeInfoManager.h"
#include "nsString.h"
#include "nsContentCID.h"
#include "prprf.h"
#include "nsNetUtil.h"
#include "nsICSSLoader.h"
#include "nsRDFCID.h"
#include "nsIRDFResource.h"
#include "nsIXULContentSink.h"
#include "nsIDocStreamLoaderFactory.h"
// URL for the "user agent" style sheet
#define UA_CSS_URL "resource:/res/ua.css"
// Factory code for creating variations on html documents
#undef NOISY_REGISTRY
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);
extern nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
static const char* const gHTMLTypes[] = {
"text/html",
"text/plain",
"text/css",
"text/javascript",
"application/x-javascript",
"text/html; x-view-type=view-source",
"text/plain; x-view-type=view-source",
"text/css; x-view-type=view-source",
"text/javascript; x-view-type=view-source",
"application/x-javascript; x-view-type=view-source",
0
};
static const char* const gXMLTypes[] = {
"text/xml",
"application/xml",
"application/xhtml+xml",
"text/xml; x-view-type=view-source",
"application/xml; x-view-type=view-source",
"application/xhtml+xml; x-view-type=view-source",
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",
"application/vnd.mozilla.xul+xml",
"mozilla.application/cached-xul",
"application/vnd.mozilla.xul+xml; x-view-type=view-source",
"mozilla.application/cached-xul; x-view-type=view-source",
0
};
static const char* const gImageTypes[] = {
"image/gif",
"image/jpeg",
"image/jpg",
"image/pjpeg",
"image/png",
"image/x-png",
"image/x-art",
"image/x-jg",
"image/bmp",
"image/x-icon",
0
};
nsICSSStyleSheet* nsContentDLF::gUAStyleSheet;
nsresult
NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult)
{
NS_PRECONDITION(aResult, "null OUT ptr");
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}
nsContentDLF* it = new nsContentDLF();
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(NS_GET_IID(nsIDocumentLoaderFactory), (void**)aResult);
}
nsContentDLF::nsContentDLF()
{
NS_INIT_REFCNT();
}
nsContentDLF::~nsContentDLF()
{
}
NS_IMPL_ISUPPORTS2(nsContentDLF,
nsIDocumentLoaderFactory,
nsIDocStreamLoaderFactory);
NS_IMETHODIMP
nsContentDLF::CreateInstance(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
const char* aContentType,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
{
nsresult rv = NS_OK;
if (!gUAStyleSheet) {
// Load the UA style sheet
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), UA_CSS_URL);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsICSSLoader> cssLoader;
NS_NewCSSLoader(getter_AddRefs(cssLoader));
if (cssLoader) {
PRBool complete;
rv = cssLoader->LoadAgentSheet(uri, gUAStyleSheet, complete, nsnull);
}
}
if (NS_FAILED(rv)) {
#ifdef DEBUG
printf("*** open of %s failed: error=%x\n", UA_CSS_URL, rv);
#endif
return rv;
}
}
// Check aContentType to see if it's a view-source type
//
// If it's a "view-source:", aContentType will be of the form
//
// <orig_type>; x-view-type=view-source
//
// where <orig_type> can be text/html, text/xml etc.
//
nsCAutoString strContentType; strContentType.Append(aContentType);
PRInt32 idx = strContentType.Find("; x-view-type=view-source", PR_TRUE, 0, -1);
if(idx != -1)
{ // Found "; x-view-type=view-source" param in content type.
// Set aCommand to view-source
aCommand = "view-source";
// Null terminate at the ";" in "text/html; x-view-type=view-source"
// The idea is to end up with the original content type i.e. without
// the x-view-type param was added to it.
strContentType.SetCharAt('\0', idx);
aContentType = strContentType.get(); //This will point to the "original" mime type
}
if(0==PL_strcmp(aCommand,"view-source")) {
NS_ENSURE_ARG(aChannel);
// It's a view-source. Reset channel's content type to the original
// type so as not to choke the parser when it asks the channel
// for the content type during the parse phase
aChannel->SetContentType(aContentType);
aContentType=gHTMLTypes[0];
}
// Try html
int typeIndex=0;
while(gHTMLTypes[typeIndex]) {
if (0== PL_strcmp(gHTMLTypes[typeIndex++], aContentType)) {
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kHTMLDocumentCID,
aDocListener, aDocViewer);
}
}
// Try XML
typeIndex = 0;
while(gXMLTypes[typeIndex]) {
if (0== PL_strcmp(gXMLTypes[typeIndex++], aContentType)) {
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kXMLDocumentCID,
aDocListener, aDocViewer);
}
}
#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]) {
if (0 == PL_strcmp(gRDFTypes[typeIndex++], aContentType)) {
return CreateRDFDocument(aCommand,
aChannel, aLoadGroup,
aContentType, aContainer,
aExtraInfo, aDocListener, aDocViewer);
}
}
// Try image types
typeIndex = 0;
while(gImageTypes[typeIndex]) {
if (0== PL_strcmp(gImageTypes[typeIndex++], aContentType)) {
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kImageDocumentCID,
aDocListener, aDocViewer);
}
}
// If we get here, then we weren't able to create anything. Sorry!
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsContentDLF::CreateInstanceForDocument(nsISupports* aContainer,
nsIDocument* aDocument,
const char *aCommand,
nsIContentViewer** aDocViewerResult)
{
nsresult rv = NS_ERROR_FAILURE;
do {
nsCOMPtr<nsIDocumentViewer> docv;
rv = NS_NewDocumentViewer(getter_AddRefs(docv));
if (NS_FAILED(rv))
break;
docv->SetUAStyleSheet(NS_STATIC_CAST(nsIStyleSheet*, gUAStyleSheet));
// Bind the document to the Content Viewer
nsIContentViewer* cv = NS_STATIC_CAST(nsIContentViewer*, docv.get());
rv = cv->LoadStart(aDocument);
NS_ADDREF(*aDocViewerResult = cv);
} while (PR_FALSE);
return rv;
}
NS_IMETHODIMP
nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup, nsIDocument **aDocument)
{
*aDocument = nsnull;
nsresult rv = NS_ERROR_FAILURE;
// create a new blank HTML document
nsCOMPtr<nsIDocument> blankDoc(do_CreateInstance(kHTMLDocumentCID));
if (blankDoc) {
// initialize
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), "about:blank", 0);
if (uri)
rv = blankDoc->ResetToURI(uri, aLoadGroup);
}
// add some simple content structure
if (NS_SUCCEEDED(rv)) {
rv = NS_ERROR_FAILURE;
nsCOMPtr<nsINodeInfoManager> nim;
blankDoc->GetNodeInfoManager(*getter_AddRefs(nim));
if (nim) {
nsCOMPtr<nsINodeInfo> htmlNodeInfo;
// generate an html html element
nsCOMPtr<nsIHTMLContent> htmlElement;
nim->GetNodeInfo(nsHTMLAtoms::html, 0, kNameSpaceID_None,
*getter_AddRefs(htmlNodeInfo));
NS_NewHTMLHtmlElement(getter_AddRefs(htmlElement), htmlNodeInfo);
// generate an html head element
nsCOMPtr<nsIHTMLContent> headElement;
nim->GetNodeInfo(nsHTMLAtoms::head, 0, kNameSpaceID_None,
*getter_AddRefs(htmlNodeInfo));
NS_NewHTMLHeadElement(getter_AddRefs(headElement), htmlNodeInfo);
// generate an html body element
nsCOMPtr<nsIHTMLContent> bodyElement;
nim->GetNodeInfo(nsHTMLAtoms::body, 0, kNameSpaceID_None,
*getter_AddRefs(htmlNodeInfo));
NS_NewHTMLBodyElement(getter_AddRefs(bodyElement), htmlNodeInfo);
// blat in the structure
if (htmlElement && headElement && bodyElement) {
htmlElement->SetDocument(blankDoc, PR_FALSE, PR_TRUE);
blankDoc->SetRootContent(htmlElement);
htmlElement->AppendChildTo(headElement, PR_FALSE, PR_FALSE);
PRInt32 id;
blankDoc->GetAndIncrementContentID(&id);
bodyElement->SetContentID(id);
htmlElement->AppendChildTo(bodyElement, PR_FALSE, PR_FALSE);
rv = NS_OK;
}
}
}
// add a nice bow
if (NS_SUCCEEDED(rv)) {
*aDocument = blankDoc;
NS_ADDREF(*aDocument);
}
return rv;
}
nsresult
nsContentDLF::CreateDocument(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
const nsCID& aDocumentCID,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
{
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIURI> aURL;
rv = aChannel->GetURI(getter_AddRefs(aURL));
if (NS_FAILED(rv)) return rv;
#ifdef NOISY_CREATE_DOC
if (nsnull != aURL) {
nsAutoString tmp;
aURL->ToString(tmp);
fputs(NS_LossyConvertUCS2toASCII(tmp).get(), stdout);
printf(": creating document\n");
}
#endif
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIDocumentViewer> docv;
do {
// Create the document
rv = nsComponentManager::CreateInstance(aDocumentCID, nsnull,
NS_GET_IID(nsIDocument),
getter_AddRefs(doc));
if (NS_FAILED(rv))
break;
// Create the document viewer XXX: could reuse document viewer here!
rv = NS_NewDocumentViewer(getter_AddRefs(docv));
if (NS_FAILED(rv))
break;
docv->SetUAStyleSheet(gUAStyleSheet);
// Initialize the document to begin loading the data. An
// nsIStreamListener connected to the parser is returned in
// aDocListener.
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
if (NS_FAILED(rv))
break;
// Bind the document to the Content Viewer
rv = docv->LoadStart(doc);
*aDocViewer = docv;
NS_IF_ADDREF(*aDocViewer);
} while (PR_FALSE);
return rv;
}
NS_IMETHODIMP
nsContentDLF::CreateInstance(nsIInputStream& aInputStream,
const char* aContentType,
const char* aCommand,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIContentViewer** aDocViewer)
{
nsresult status = NS_ERROR_FAILURE;
// Try RDF
int typeIndex = 0;
while (gRDFTypes[typeIndex]) {
if (0 == PL_strcmp(gRDFTypes[typeIndex++], aContentType)) {
return CreateXULDocumentFromStream(aInputStream,
aCommand,
aContainer,
aExtraInfo,
aDocViewer);
}
}
return status;
}
// ...common work for |CreateRDFDocument| and |CreateXULDocumentFromStream|
nsresult
nsContentDLF::CreateRDFDocument(nsISupports* aExtraInfo,
nsCOMPtr<nsIDocument>* doc,
nsCOMPtr<nsIDocumentViewer>* docv)
{
nsresult rv = NS_ERROR_FAILURE;
// Create the XUL document
rv = nsComponentManager::CreateInstance(kXULDocumentCID, nsnull,
NS_GET_IID(nsIDocument),
getter_AddRefs(*doc));
if (NS_FAILED(rv)) return rv;
// Create the image content viewer...
rv = NS_NewDocumentViewer(getter_AddRefs(*docv));
if (NS_FAILED(rv)) return rv;
// Load the UA style sheet if we haven't already done that
(*docv)->SetUAStyleSheet(gUAStyleSheet);
return NS_OK;
}
// ...note, this RDF document _may_ be XUL :-)
nsresult
nsContentDLF::CreateRDFDocument(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
const char* aContentType,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
{
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIDocumentViewer> docv;
nsresult rv = CreateRDFDocument(aExtraInfo, address_of(doc), address_of(docv));
if (NS_FAILED(rv)) {
return rv;
}
nsCOMPtr<nsIURI> aURL;
rv = aChannel->GetURI(getter_AddRefs(aURL));
if (NS_FAILED(rv)) return rv;
/*
* Initialize the document to begin loading the data...
*
* An nsIStreamListener connected to the parser is returned in
* aDocListener.
*/
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
/*
* Bind the document to the Content Viewer...
*/
rv = docv->LoadStart(doc);
*aDocViewer = docv;
NS_IF_ADDREF(*aDocViewer);
}
return rv;
}
nsresult
nsContentDLF::CreateXULDocumentFromStream(nsIInputStream& aXULStream,
const char* aCommand,
nsISupports* aContainer,
nsISupports* aExtraInfo,
nsIContentViewer** aDocViewer)
{
nsresult status = NS_OK;
#if 0 // XXX dead code; remove
do
{
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIDocumentViewer> docv;
if ( NS_FAILED(status = CreateRDFDocument(aExtraInfo, address_of(doc), address_of(docv))) )
break;
if ( NS_FAILED(status = docv->LoadStart(doc)) )
break;
*aDocViewer = docv;
NS_IF_ADDREF(*aDocViewer);
nsCOMPtr<nsIStreamLoadableDocument> loader = do_QueryInterface(doc, &status);
if ( NS_FAILED(status) )
break;
status = loader->LoadFromStream(aXULStream, aContainer, aCommand);
}
while (0);
#endif
return status;
}
static NS_DEFINE_IID(kDocumentFactoryImplCID, NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
static nsresult
RegisterTypes(nsIComponentManager* aCompMgr,
nsICategoryManager* aCatMgr,
const char* aCommand,
nsIFile* aPath,
const char *aLocation,
const char *aType,
const char* const* aTypes)
{
nsresult rv = NS_OK;
while (*aTypes) {
char contractid[500];
const char* contentType = *aTypes++;
PR_snprintf(contractid, sizeof(contractid),
NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "%s;1?type=%s",
aCommand, contentType);
#ifdef NOISY_REGISTRY
printf("Register %s => %s\n", contractid, aPath);
#endif
rv = aCompMgr->RegisterComponentWithType(kDocumentFactoryImplCID, "Layout",
contractid, aPath, aLocation,
PR_TRUE, PR_TRUE, aType);
if (NS_FAILED(rv)) break;
// add the MIME types layotu can handle to the handlers category.
// this allows users of layout's viewers (the docshell for example)
// to query the types of viewers layout can create.
nsXPIDLCString previous;
rv = aCatMgr->AddCategoryEntry("Gecko-Content-Viewers", contentType,
contractid,
PR_TRUE, PR_TRUE, getter_Copies(previous));
if (NS_FAILED(rv)) break;
}
return rv;
}
NS_IMETHODIMP
nsContentDLF::RegisterDocumentFactories(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char *aLocation,
const char *aType,
const nsModuleComponentInfo* aInfo)
{
nsresult rv;
nsCOMPtr<nsICategoryManager> catmgr(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
do {
rv = RegisterTypes(aCompMgr, catmgr, "view", aPath, aLocation, aType, gHTMLTypes);
if (NS_FAILED(rv))
break;
rv = RegisterTypes(aCompMgr, catmgr, "view-source", aPath, aLocation, aType, gHTMLTypes);
if (NS_FAILED(rv))
break;
rv = RegisterTypes(aCompMgr, catmgr, "view", aPath, aLocation, aType, gXMLTypes);
if (NS_FAILED(rv))
break;
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;
rv = RegisterTypes(aCompMgr, catmgr, "view", aPath, aLocation, aType, gRDFTypes);
if (NS_FAILED(rv))
break;
rv = RegisterTypes(aCompMgr, catmgr, "view-source", aPath, aLocation, aType, gRDFTypes);
if (NS_FAILED(rv))
break;
} while (PR_FALSE);
return rv;
}
NS_IMETHODIMP
nsContentDLF::UnregisterDocumentFactories(nsIComponentManager* aCompMgr,
nsIFile* aPath,
const char* aRegistryLocation,
const nsModuleComponentInfo* aInfo)
{
// XXXwaterson seems like this leaves the registry pretty dirty.
return aCompMgr->UnregisterComponentSpec(kDocumentFactoryImplCID, aPath);
}

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,515 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsICSSDeclaration_h___
#define nsICSSDeclaration_h___
#include "nsISupports.h"
#include "nsColor.h"
#include <stdio.h>
#include "nsString.h"
#include "nsCoord.h"
#include "nsCSSValue.h"
#include "nsCSSProps.h"
class nsISizeOfHandler;
struct nsCSSStruct {
virtual const nsID& GetID(void) = 0;
virtual ~nsCSSStruct();
};
// SID for the nsCSSFont struct {f645dbf8-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_FONT_SID \
{0xf645dbf8, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSColor struct {fd825f22-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_COLOR_SID \
{0xfd825f22, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSText struct {fe13ce94-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_TEXT_SID \
{0xfe13ce94, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSDisplay struct {fe13ce95-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_DISPLAY_SID \
{0xfe13ce95, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSMargin struct {fe6019d4-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_MARGIN_SID \
{0xfe6019d4, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSPosition struct {fee33b2a-b48a-11d1-9ca5-0060088f9ff7}
#define NS_CSS_POSITION_SID \
{0xfee33b2a, 0xb48a, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSList struct {603f8266-b48b-11d1-9ca5-0060088f9ff7}
#define NS_CSS_LIST_SID \
{0x603f8266, 0xb48b, 0x11d1, {0x9c, 0xa5, 0x00, 0x60, 0x08, 0x8f, 0x9f, 0xf7}}
// SID for the nsCSSTable struct {16aa4b30-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_TABLE_SID \
{0x16aa4b30, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSBreaks struct {15124c20-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_BREAKS_SID \
{0x15124c20, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSPage struct {15dd8810-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_PAGE_SID \
{0x15dd8810, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSContent struct {1629ef70-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_CONTENT_SID \
{0x1629ef70, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSUserInterface struct {4397c3a0-3efe-11d3-8060-006008159b5a}
#define NS_CSS_USER_INTERFACE_SID \
{0x4397c3a0, 0x3efe, 0x11d3, {0x80, 0x60, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
// SID for the nsCSSAural struct {166d2bb0-5a3b-11d2-803b-006008159b5a}
#define NS_CSS_AURAL_SID \
{0x166d2bb0, 0x5a3b, 0x11d2, {0x80, 0x3b, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
#ifdef INCLUDE_XUL
// {FC075D62-B1CF-47a1-AF4E-CB40E11A4314}
#define NS_CSS_XUL_SID \
{ 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}}
struct nsCSSFont : public nsCSSStruct {
nsCSSFont(void);
nsCSSFont(const nsCSSFont& aCopy);
virtual ~nsCSSFont(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mFamily;
nsCSSValue mStyle;
nsCSSValue mVariant;
nsCSSValue mWeight;
nsCSSValue mSize;
nsCSSValue mSizeAdjust; // NEW
nsCSSValue mStretch; // NEW
};
struct nsCSSValueList {
nsCSSValueList(void);
nsCSSValueList(const nsCSSValueList& aCopy);
~nsCSSValueList(void);
nsCSSValue mValue;
nsCSSValueList* mNext;
};
struct nsCSSColor : public nsCSSStruct {
nsCSSColor(void);
nsCSSColor(const nsCSSColor& aCopy);
virtual ~nsCSSColor(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mColor;
nsCSSValue mBackColor;
nsCSSValue mBackImage;
nsCSSValue mBackRepeat;
nsCSSValue mBackAttachment;
nsCSSValue mBackPositionX;
nsCSSValue mBackPositionY;
};
struct nsCSSShadow {
nsCSSShadow(void);
nsCSSShadow(const nsCSSShadow& aCopy);
~nsCSSShadow(void);
nsCSSValue mColor;
nsCSSValue mXOffset;
nsCSSValue mYOffset;
nsCSSValue mRadius;
nsCSSShadow* mNext;
};
struct nsCSSText : public nsCSSStruct {
nsCSSText(void);
nsCSSText(const nsCSSText& aCopy);
virtual ~nsCSSText(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mWordSpacing;
nsCSSValue mLetterSpacing;
nsCSSValue mVerticalAlign;
nsCSSValue mTextTransform;
nsCSSValue mTextAlign;
nsCSSValue mTextIndent;
nsCSSValue mDecoration;
nsCSSShadow* mTextShadow; // NEW
nsCSSValue mUnicodeBidi; // NEW
nsCSSValue mLineHeight;
nsCSSValue mWhiteSpace;
};
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);
~nsCSSRect();
void List(FILE* out = 0, nsCSSProperty aPropID = eCSSProperty_UNKNOWN, PRInt32 aIndent = 0) const;
void List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const;
nsCSSValue mTop;
nsCSSValue mRight;
nsCSSValue mBottom;
nsCSSValue mLeft;
};
struct nsCSSDisplay : public nsCSSStruct {
nsCSSDisplay(void);
nsCSSDisplay(const nsCSSDisplay& aCopy);
virtual ~nsCSSDisplay(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mDirection;
nsCSSValue mDisplay;
nsCSSValue mBinding;
nsCSSValue mPosition;
nsCSSValue mFloat;
nsCSSValue mClear;
nsCSSRect* mClip;
nsCSSValue mOverflow;
nsCSSValue mVisibility;
nsCSSValue mOpacity;
// mLang member variable is here not because in needs to be stored
// in nsCSSDeclaration objects but because it's needed on the
// stack when the struct is used in WalkRuleTree.
nsCSSValue mLang;
};
struct nsCSSMargin : public nsCSSStruct {
nsCSSMargin(void);
nsCSSMargin(const nsCSSMargin& aCopy);
virtual ~nsCSSMargin(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
void EnsureBorderColors();
nsCSSRect* mMargin;
nsCSSRect* mPadding;
nsCSSRect* mBorderWidth;
nsCSSRect* mBorderColor;
nsCSSValueList** mBorderColors;
nsCSSRect* mBorderStyle;
nsCSSRect* mBorderRadius; // (extension)
nsCSSValue mOutlineWidth;
nsCSSValue mOutlineColor;
nsCSSValue mOutlineStyle;
nsCSSRect* mOutlineRadius; // (extension)
nsCSSValue mFloatEdge; // NEW
};
struct nsCSSPosition : public nsCSSStruct {
nsCSSPosition(void);
nsCSSPosition(const nsCSSPosition& aCopy);
virtual ~nsCSSPosition(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mWidth;
nsCSSValue mMinWidth;
nsCSSValue mMaxWidth;
nsCSSValue mHeight;
nsCSSValue mMinHeight;
nsCSSValue mMaxHeight;
nsCSSValue mBoxSizing; // NEW
nsCSSRect* mOffset;
nsCSSValue mZIndex;
};
struct nsCSSList : public nsCSSStruct {
nsCSSList(void);
nsCSSList(const nsCSSList& aCopy);
virtual ~nsCSSList(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mType;
nsCSSValue mImage;
nsCSSValue mPosition;
nsCSSRect* mImageRegion;
};
struct nsCSSTable : public nsCSSStruct { // NEW
nsCSSTable(void);
nsCSSTable(const nsCSSTable& aCopy);
virtual ~nsCSSTable(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mBorderCollapse;
nsCSSValue mBorderSpacingX;
nsCSSValue mBorderSpacingY;
nsCSSValue mCaptionSide;
nsCSSValue mEmptyCells;
nsCSSValue mLayout;
nsCSSValue mFrame; // Not mappable via CSS, only using HTML4 table attrs.
nsCSSValue mRules; // Not mappable via CSS, only using HTML4 table attrs.
nsCSSValue mSpan; // Not mappable via CSS, only using HTML4 table attrs.
nsCSSValue mCols; // Not mappable via CSS, only using HTML4 table attrs.
};
struct nsCSSBreaks : public nsCSSStruct { // NEW
nsCSSBreaks(void);
nsCSSBreaks(const nsCSSBreaks& aCopy);
virtual ~nsCSSBreaks(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mOrphans;
nsCSSValue mWidows;
nsCSSValue mPage;
nsCSSValue mPageBreakAfter;
nsCSSValue mPageBreakBefore;
nsCSSValue mPageBreakInside;
};
struct nsCSSPage : public nsCSSStruct { // NEW
nsCSSPage(void);
nsCSSPage(const nsCSSPage& aCopy);
virtual ~nsCSSPage(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mMarks;
nsCSSValue mSizeWidth;
nsCSSValue mSizeHeight;
};
struct nsCSSCounterData {
nsCSSCounterData(void);
nsCSSCounterData(const nsCSSCounterData& aCopy);
~nsCSSCounterData(void);
nsCSSValue mCounter;
nsCSSValue mValue;
nsCSSCounterData* mNext;
};
struct nsCSSQuotes {
nsCSSQuotes(void);
nsCSSQuotes(const nsCSSQuotes& aCopy);
~nsCSSQuotes(void);
nsCSSValue mOpen;
nsCSSValue mClose;
nsCSSQuotes* mNext;
};
struct nsCSSContent : public nsCSSStruct {
nsCSSContent(void);
nsCSSContent(const nsCSSContent& aCopy);
virtual ~nsCSSContent(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValueList* mContent;
nsCSSCounterData* mCounterIncrement;
nsCSSCounterData* mCounterReset;
nsCSSValue mMarkerOffset;
nsCSSQuotes* mQuotes;
};
struct nsCSSUserInterface : public nsCSSStruct { // NEW
nsCSSUserInterface(void);
nsCSSUserInterface(const nsCSSUserInterface& aCopy);
virtual ~nsCSSUserInterface(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mUserInput;
nsCSSValue mUserModify;
nsCSSValue mUserSelect;
nsCSSValueList* mKeyEquivalent;
nsCSSValue mUserFocus;
nsCSSValue mResizer;
nsCSSValueList* mCursor;
};
struct nsCSSAural : public nsCSSStruct { // NEW
nsCSSAural(void);
nsCSSAural(const nsCSSAural& aCopy);
virtual ~nsCSSAural(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mAzimuth;
nsCSSValue mElevation;
nsCSSValue mCueAfter;
nsCSSValue mCueBefore;
nsCSSValue mPauseAfter;
nsCSSValue mPauseBefore;
nsCSSValue mPitch;
nsCSSValue mPitchRange;
nsCSSValue mPlayDuring;
nsCSSValue mPlayDuringFlags;
nsCSSValue mRichness;
nsCSSValue mSpeak;
nsCSSValue mSpeakHeader;
nsCSSValue mSpeakNumeral;
nsCSSValue mSpeakPunctuation;
nsCSSValue mSpeechRate;
nsCSSValue mStress;
nsCSSValue mVoiceFamily;
nsCSSValue mVolume;
};
#ifdef INCLUDE_XUL
struct nsCSSXUL : public nsCSSStruct {
nsCSSXUL(void);
nsCSSXUL(const nsCSSXUL& aCopy);
virtual ~nsCSSXUL(void);
const nsID& GetID(void);
void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
nsCSSValue mBoxAlign;
nsCSSValue mBoxDirection;
nsCSSValue mBoxFlex;
nsCSSValue mBoxOrient;
nsCSSValue mBoxPack;
nsCSSValue mBoxOrdinal;
};
#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);
NS_IMETHOD GetData(const nsID& aIID, nsCSSStruct** aData) = 0;
NS_IMETHOD EnsureData(const nsID& aSID, nsCSSStruct** aData) = 0;
NS_IMETHOD AppendValue(nsCSSProperty aProperty,
const nsCSSValue& aValue) = 0;
NS_IMETHOD AppendStructValue(nsCSSProperty aProperty, void* aStruct) = 0;
NS_IMETHOD SetValueImportant(nsCSSProperty aProperty) = 0;
NS_IMETHOD AppendComment(const nsAReadableString& aComment) = 0;
NS_IMETHOD RemoveProperty(nsCSSProperty aProperty, nsCSSValue& aValue) = 0;
// XXX make nscolor a struct to avoid type conflicts
NS_IMETHOD GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) = 0;
NS_IMETHOD GetValue(nsCSSProperty aProperty, nsAWritableString& aValue) = 0;
NS_IMETHOD GetValue(const nsAReadableString& aProperty,
nsAWritableString& aValue) = 0;
NS_IMETHOD GetImportantValues(nsICSSDeclaration*& aResult) = 0;
NS_IMETHOD GetValueIsImportant(nsCSSProperty aProperty,
PRBool& aIsImportant) = 0;
NS_IMETHOD GetValueIsImportant(const nsAReadableString& aProperty,
PRBool& aIsImportant) = 0;
NS_IMETHOD Count(PRUint32* aCount) = 0;
NS_IMETHOD GetNthProperty(PRUint32 aIndex, nsAWritableString& aReturn) = 0;
NS_IMETHOD GetStyleImpact(PRInt32* aHint) const = 0;
NS_IMETHOD ToString(nsAWritableString& aString) = 0;
NS_IMETHOD Clone(nsICSSDeclaration*& aClone) const = 0;
#ifdef DEBUG
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize) = 0;
#endif
};
extern NS_EXPORT nsresult
NS_NewCSSDeclaration(nsICSSDeclaration** aInstancePtrResult);
#endif /* nsICSSDeclaration_h___ */

View File

@@ -0,0 +1,922 @@
/* -*- 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 <math.h>
#include "nsStyleUtil.h"
#include "nsCRT.h"
#include "nsStyleConsts.h"
#include "nsUnitConversion.h"
#include "nsHTMLAtoms.h"
#include "nsILinkHandler.h"
#include "nsILink.h"
#include "nsIXMLContent.h"
#include "nsIHTMLContent.h"
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsReadableUtils.h"
// XXX This is here because nsCachedStyleData is accessed outside of
// the content module; e.g., by nsCSSFrameConstructor.
#include "nsRuleNode.h"
nsCachedStyleData::StyleStructInfo
nsCachedStyleData::gInfo[] = {
// Note that these must line up _exactly_ with the numeric values of
// the nsStyleStructID enum.
{ 0, 0, 0 },
/* eStyleStruct_Font */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mFontData),
PR_FALSE
},
/* eStyleStruct_Color */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mColorData),
PR_FALSE
},
/* eStyleStruct_Background */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mBackgroundData),
PR_TRUE
},
/* eStyleStruct_List */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mListData),
PR_FALSE
},
/* eStyleStruct_Position */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mPositionData),
PR_TRUE
},
/* eStyleStruct_Text */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mTextData),
PR_FALSE
},
/* eStyleStruct_TextReset */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mTextData),
PR_TRUE
},
/* eStyleStruct_Display */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mDisplayData),
PR_TRUE
},
/* eStyleStruct_Visibility */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mVisibilityData),
PR_FALSE
},
/* eStyleStruct_Content */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mContentData),
PR_TRUE
},
/* eStyleStruct_Quotes */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mQuotesData),
PR_FALSE
},
/* eStyleStruct_UserInterface */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mUIData),
PR_FALSE
},
/* eStyleStruct_UIReset */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mUIData),
PR_TRUE
},
/* eStyleStruct_Table */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mTableData),
PR_TRUE
},
/* eStyleStruct_TableBorder */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mTableData),
PR_FALSE
},
/* eStyleStruct_Margin */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mMarginData),
PR_TRUE
},
/* eStyleStruct_Padding */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mPaddingData),
PR_TRUE
},
/* eStyleStruct_Border */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mBorderData),
PR_TRUE
},
/* eStyleStruct_Outline */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mOutlineData),
PR_TRUE
},
#ifdef INCLUDE_XUL
/* eStyleStruct_XUL */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mXULData),
PR_TRUE
},
#endif
#ifdef MOZ_SVG
/* eStyleStruct_SVG */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mSVGData),
PR_FALSE
},
#endif
{ 0, 0, 0 }
};
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define POSITIVE_SCALE_FACTOR 1.10 /* 10% */
#define NEGATIVE_SCALE_FACTOR .90 /* 10% */
#if DEBUG
#define DUMP_FONT_SIZES 0
#endif
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
/*
* Return the scaling percentage given a font scaler
* Lifted from layutil.c
*/
float nsStyleUtil::GetScalingFactor(PRInt32 aScaler)
{
double scale = 1.0;
double mult;
PRInt32 count;
if(aScaler < 0) {
count = -aScaler;
mult = NEGATIVE_SCALE_FACTOR;
}
else {
count = aScaler;
mult = POSITIVE_SCALE_FACTOR;
}
/* use the percentage scaling factor to the power of the pref */
while(count--) {
scale *= mult;
}
return (float)scale;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
static PRBool gNavAlgorithmPref = PR_FALSE;
static int PR_CALLBACK NavAlgorithmPrefChangedCallback(const char * name, void * closure)
{
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
prefs->GetBoolPref(name, &gNavAlgorithmPref);
}
return 0;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
static PRBool UseNewFontAlgorithm()
{
static PRBool once = PR_TRUE;
if (once)
{
once = PR_FALSE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
prefs->GetBoolPref("font.size.nav4algorithm", &gNavAlgorithmPref);
prefs->RegisterCallback("font.size.nav4algorithm", NavAlgorithmPrefChangedCallback, NULL);
}
}
return (gNavAlgorithmPref ? PR_FALSE : PR_TRUE);
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
/*
* Lifted from winfe/cxdc.cpp
*/
static nscoord OldCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
float aScalingFactor)
{ // lifted directly from Nav 5.0 code to replicate rounding errors
double dFontSize;
switch(aHTMLSize) {
case 1:
dFontSize = 7 * aBasePointSize / 10;
break;
case 2:
dFontSize = 85 * aBasePointSize / 100;
break;
case 3:
dFontSize = aBasePointSize;
break;
case 4:
dFontSize = 12 * aBasePointSize / 10;
break;
case 5:
dFontSize = 3 * aBasePointSize / 2;
break;
case 6:
dFontSize = 2 * aBasePointSize;
break;
case 7:
dFontSize = 3 * aBasePointSize;
break;
default:
if (aHTMLSize < 1) {
dFontSize = (7 * aBasePointSize / 10) * pow(1.1, aHTMLSize - 1);
}
else { // aHTMLSize > 7
dFontSize = (3 * aBasePointSize) * pow(1.2, aHTMLSize - 7);
}
}
dFontSize *= aScalingFactor;
if (1.0 < dFontSize) {
return (nscoord)dFontSize;
}
return (nscoord)1;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
static nscoord NewCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
#define sFontSizeTableMin 9
#define sFontSizeTableMax 16
// This table seems to be the one used by MacIE5. We hope its adoption in Mozilla
// and eventually in WinIE5.5 will help to establish a standard rendering across
// platforms and browsers. For now, it is used only in Strict mode. More can be read
// in the document written by Todd Farhner at:
// http://style.verso.com/font_size_intervals/altintervals.html
//
static PRInt32 sStrictFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
{
{ 9, 9, 9, 9, 11, 14, 18, 27},
{ 9, 9, 9, 10, 12, 15, 20, 30},
{ 9, 9, 10, 11, 13, 17, 22, 33},
{ 9, 9, 10, 12, 14, 18, 24, 36},
{ 9, 10, 12, 13, 16, 20, 26, 39},
{ 9, 10, 12, 14, 17, 21, 28, 42},
{ 9, 10, 13, 15, 18, 23, 30, 45},
{ 9, 10, 13, 16, 18, 24, 32, 48}
};
// HTML 1 2 3 4 5 6 7
// CSS xxs xs s m l xl xxl
// |
// user pref
//
//------------------------------------------------------------
//
// This table gives us compatibility with WinNav4 for the default fonts only.
// In WinNav4, the default fonts were:
//
// Times/12pt == Times/16px at 96ppi
// Courier/10pt == Courier/13px at 96ppi
//
// The 2 lines below marked "anchored" have the exact pixel sizes used by
// WinNav4 for Times/12pt and Courier/10pt at 96ppi. As you can see, the
// HTML size 3 (user pref) for those 2 anchored lines is 13px and 16px.
//
// All values other than the anchored values were filled in by hand, never
// going below 9px, and maintaining a "diagonal" relationship. See for
// example the 13s -- they follow a diagonal line through the table.
//
static PRInt32 sQuirksFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
{
{ 9, 9, 9, 9, 11, 14, 18, 28 },
{ 9, 9, 9, 10, 12, 15, 20, 31 },
{ 9, 9, 9, 11, 13, 17, 22, 34 },
{ 9, 9, 10, 12, 14, 18, 24, 37 },
{ 9, 9, 10, 13, 16, 20, 26, 40 }, // anchored (13)
{ 9, 9, 11, 14, 17, 21, 28, 42 },
{ 9, 10, 12, 15, 17, 23, 30, 45 },
{ 9, 10, 13, 16, 18, 24, 32, 48 } // anchored (16)
};
// HTML 1 2 3 4 5 6 7
// CSS xxs xs s m l xl xxl
// |
// user pref
#if 0
//
// These are the exact pixel values used by WinIE5 at 96ppi.
//
{ ?, 8, 11, 12, 13, 16, 21, 32 }, // smallest
{ ?, 9, 12, 13, 16, 21, 27, 40 }, // smaller
{ ?, 10, 13, 16, 18, 24, 32, 48 }, // medium
{ ?, 13, 16, 19, 21, 27, 37, ?? }, // larger
{ ?, 16, 19, 21, 24, 32, 43, ?? } // largest
//
// HTML 1 2 3 4 5 6 7
// CSS ? ? ? ? ? ? ? ?
//
// (CSS not tested yet.)
//
#endif
static PRInt32 sFontSizeFactors[8] = { 60,75,89,100,120,150,200,300 };
static PRInt32 sCSSColumns[7] = {0, 1, 2, 3, 4, 5, 6}; // xxs...xxl
static PRInt32 sHTMLColumns[7] = {1, 2, 3, 4, 5, 6, 7}; // 1...7
double dFontSize;
if (aFontSizeType == eFontSize_HTML) {
aHTMLSize--; // input as 1-7
}
if (aHTMLSize < 0)
aHTMLSize = 0;
else if (aHTMLSize > 6)
aHTMLSize = 6;
PRInt32* column;
switch (aFontSizeType)
{
case eFontSize_HTML: column = sHTMLColumns; break;
case eFontSize_CSS: column = sCSSColumns; break;
}
// Make special call specifically for fonts (needed PrintPreview)
float t2p;
aPresContext->GetTwipsToPixelsForFonts(&t2p);
PRInt32 fontSize = NSTwipsToIntPixels(aBasePointSize, t2p);
if ((fontSize >= sFontSizeTableMin) && (fontSize <= sFontSizeTableMax))
{
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
PRInt32 row = fontSize - sFontSizeTableMin;
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
if (mode == eCompatibility_NavQuirks) {
dFontSize = NSIntPixelsToTwips(sQuirksFontSizeTable[row][column[aHTMLSize]], p2t);
} else {
dFontSize = NSIntPixelsToTwips(sStrictFontSizeTable[row][column[aHTMLSize]], p2t);
}
}
else
{
PRInt32 factor = sFontSizeFactors[column[aHTMLSize]];
dFontSize = (factor * aBasePointSize) / 100;
}
dFontSize *= aScalingFactor;
if (1.0 < dFontSize) {
return (nscoord)dFontSize;
}
return (nscoord)1;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
nscoord nsStyleUtil::CalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
#if DUMP_FONT_SIZES
extern void DumpFontSizes(nsIPresContext* aPresContext);
DumpFontSizes(aPresContext);
#endif
if (UseNewFontAlgorithm())
return NewCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType);
else
return OldCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor);
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
PRInt32 nsStyleUtil::FindNextSmallerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
PRInt32 index;
PRInt32 indexMin;
PRInt32 indexMax;
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
if (aFontSizeType == eFontSize_HTML) {
indexMin = 1;
indexMax = 7;
} else {
indexMin = 0;
indexMax = 6;
}
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) < fontSize) {
if (fontSize <= NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
for (index = indexMax; index > indexMin; index--)
if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
break;
}
else { // larger than HTML table
return indexMax;
// for (index = 8; ; index++)
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
// index--;
// break;
// }
}
}
else { // smaller than HTML table
return indexMin;
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
// break;
// }
}
return index;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
PRInt32 nsStyleUtil::FindNextLargerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
PRInt32 index;
PRInt32 indexMin;
PRInt32 indexMax;
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
if (aFontSizeType == eFontSize_HTML) {
indexMin = 1;
indexMax = 7;
} else {
indexMin = 0;
indexMax = 6;
}
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) <= fontSize) {
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
for (index = indexMin; index < indexMax; index++)
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
break;
}
else { // larger than HTML table
return indexMax;
// for (index = 8; ; index++)
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext)))
// break;
}
}
else { // smaller than HTML table
return indexMin;
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
// index++;
// break;
// }
}
return index;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
PRInt32
nsStyleUtil::ConstrainFontWeight(PRInt32 aWeight)
{
aWeight = ((aWeight < 100) ? 100 : ((aWeight > 900) ? 900 : aWeight));
PRInt32 base = ((aWeight / 100) * 100);
PRInt32 step = (aWeight % 100);
PRBool negativeStep = PRBool(50 < step);
PRInt32 maxStep;
if (negativeStep) {
step = 100 - step;
maxStep = (base / 100);
base += 100;
}
else {
maxStep = ((900 - base) / 100);
}
if (maxStep < step) {
step = maxStep;
}
return (base + ((negativeStep) ? -step : step));
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
const nsStyleBackground* nsStyleUtil::FindNonTransparentBackground(nsIStyleContext* aContext,
PRBool aStartAtParent /*= PR_FALSE*/)
{
const nsStyleBackground* result = nsnull;
nsIStyleContext* context;
if (aStartAtParent) {
context = aContext->GetParent(); // balance ending release
} else {
context = aContext;
NS_IF_ADDREF(context); // balance ending release
}
NS_ASSERTION( context != nsnull, "Cannot find NonTransparentBackground in a null context" );
while (nsnull != context) {
result = (const nsStyleBackground*)context->GetStyleData(eStyleStruct_Background);
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
break;
}
else {
nsIStyleContext* last = context;
context = context->GetParent();
NS_RELEASE(last);
}
}
NS_IF_RELEASE(context);
return result;
}
/*static*/
PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent, nsIAtom *aTag, nsIPresContext *aPresContext, nsLinkState *aState)
{
NS_ASSERTION(aContent && aState, "null arg in IsHTMLLink");
// check for:
// - HTML ANCHOR with valid HREF
// - HTML LINK with valid HREF
// - HTML AREA with valid HREF
PRBool result = PR_FALSE;
if ((aTag == nsHTMLAtoms::a) ||
(aTag == nsHTMLAtoms::link) ||
(aTag == nsHTMLAtoms::area)) {
nsCOMPtr<nsILink> link( do_QueryInterface(aContent) );
// In XML documents, this can be null.
if (link) {
nsLinkState linkState;
link->GetLinkState(linkState);
if (linkState == eLinkState_Unknown) {
// if it is an anchor, area or link then check the href attribute
// make sure this anchor has a link even if we are not testing state
// if there is no link, then this anchor is not really a linkpseudo.
// bug=23209
char* href;
link->GetHrefCString(href);
if (href) {
nsILinkHandler *linkHandler = nsnull;
aPresContext->GetLinkHandler(&linkHandler);
if (linkHandler) {
linkHandler->GetLinkState(href, linkState);
NS_RELEASE(linkHandler);
}
else {
// no link handler? then all links are unvisited
linkState = eLinkState_Unvisited;
}
nsCRT::free(href);
} else {
linkState = eLinkState_NotLink;
}
link->SetLinkState(linkState);
}
if (linkState != eLinkState_NotLink) {
*aState = linkState;
result = PR_TRUE;
}
}
}
return result;
}
/*static*/
PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresContext, nsLinkState *aState)
{
// XXX PERF This function will cause serious performance problems on
// pages with lots of XLinks. We should be caching the visited
// state of the XLinks. Where???
NS_ASSERTION(aContent && aState, "invalid call to IsXlink with null content");
PRBool rv = PR_FALSE;
if (aContent && aState) {
// first see if we have an XML element
nsCOMPtr<nsIXMLContent> xml(do_QueryInterface(aContent));
if (xml) {
// see if it is type=simple (we don't deal with other types)
nsAutoString val;
aContent->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::type, val);
if (val == NS_LITERAL_STRING("simple")) {
// see if there is an xlink namespace'd href attribute:
// - get it if there is, if not no big deal, it is not required for xlinks
// is it bad to re-use val here?
aContent->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, val);
// It's an XLink. Resolve it relative to its document.
nsCOMPtr<nsIURI> baseURI;
nsCOMPtr<nsIHTMLContent> htmlContent = do_QueryInterface(aContent);
if (htmlContent) {
// XXX why do this? will nsIHTMLContent's
// GetBaseURL() may return something different
// than the URL of the document it lives in?
htmlContent->GetBaseURL(*getter_AddRefs(baseURI));
}
else {
nsCOMPtr<nsIDocument> doc;
aContent->GetDocument(*getter_AddRefs(doc));
if (doc) {
doc->GetBaseURL(*getter_AddRefs(baseURI));
}
}
// convert here, rather than twice in NS_MakeAbsoluteURI and
// back again
char * href = ToNewCString(val);
char * absHREF = nsnull;
(void) NS_MakeAbsoluteURI(&absHREF, href, baseURI);
nsCRT::free(href);
nsILinkHandler *linkHandler = nsnull;
aPresContext->GetLinkHandler(&linkHandler);
if (linkHandler) {
linkHandler->GetLinkState(absHREF, *aState);
NS_RELEASE(linkHandler);
}
else {
// no link handler? then all links are unvisited
*aState = eLinkState_Unvisited;
}
nsCRT::free(absHREF);
rv = PR_TRUE;
}
}
}
return rv;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
#if DUMP_FONT_SIZES
#include "nsIDeviceContext.h"
PRInt32 RoundSize(nscoord aVal, nsIPresContext* aPresContext, bool aWinRounding)
{
PRInt32 lfHeight;
nsIDeviceContext* dc;
aPresContext->GetDeviceContext(&dc);
float app2dev, app2twip, scale;
dc->GetAppUnitsToDevUnits(app2dev);
if (aWinRounding)
{
dc->GetDevUnitsToTwips(app2twip);
dc->GetCanonicalPixelScale(scale);
app2twip *= app2dev * scale;
// This interesting bit of code rounds the font size off to the floor point
// value. This is necessary for proper font scaling under windows.
PRInt32 sizePoints = NSTwipsToFloorIntPoints(nscoord(aVal*app2twip));
float rounded = ((float)NSIntPointsToTwips(sizePoints)) / app2twip;
// round font size off to floor point size to be windows compatible
// this is proper (windows) rounding
// lfHeight = NSToIntRound(rounded * app2dev);
// this floor rounding is to make ours compatible with Nav 4.0
lfHeight = long(rounded * app2dev);
return lfHeight;
}
else
return NSToIntRound(aVal*app2dev);
}
#endif
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
#if DUMP_FONT_SIZES
void DumpFontSizes(nsIPresContext* aPresContext)
{
static gOnce = true;
if (gOnce)
{
gOnce = false;
PRInt32 baseSize;
PRInt32 htmlSize;
PRInt32 cssSize;
nscoord val;
nscoord oldVal;
nsIDeviceContext* dc;
aPresContext->GetDeviceContext(&dc);
float dev2app;
dc->GetDevUnitsToAppUnits(dev2app);
bool doWinRounding = true;
for (short i=0; i<2; i ++)
{
doWinRounding ^= true;
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" CSS \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
printf("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
}
printf("\n");
}
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" HTML \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
printf("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
}
printf("\n");
}
printf("\n\n\n");
}
}
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
#!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=..
DIRS= \
base \
html \
xml \
xsl \
xbl \
!ifdef MOZ_SVG
svg \
!endif
events \
xul \
shared \
build \
$(NULL)
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,29 @@
#
# This is a list of local files which get copied to the mozilla:dist:content directory
#
nsCSSAtomList.h
nsCSSAtoms.h
nsCSSKeywordList.h
nsCSSKeywords.h
nsCSSPropList.h
nsCSSProps.h
nsHTMLAtomList.h
nsHTMLAtoms.h
nsHTMLUtils.h
nsHTMLValue.h
nsImageMapUtils.h
nsLayoutAtomList.h
nsLayoutAtoms.h
nsRuleNode.h
nsRuleWalker.h
nsStyleCoord.h
nsStyleUtil.h
nsStyleStruct.h
nsTextFragment.h
nsXULAtomList.h
nsXULAtoms.h
nsSVGAtoms.h
nsSVGAtomList.h
nsXBLAtomList.h
nsXBLAtoms.h

View File

@@ -0,0 +1,64 @@
#
# 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 = content
EXPORTS = \
nsCSSAtomList.h \
nsCSSAtoms.h \
nsCSSKeywordList.h \
nsCSSKeywords.h \
nsCSSPropList.h \
nsCSSProps.h \
nsHTMLAtomList.h \
nsHTMLAtoms.h \
nsHTMLValue.h \
nsHTMLUtils.h \
nsImageMapUtils.h \
nsLayoutAtomList.h \
nsLayoutAtoms.h \
nsRuleNode.h \
nsRuleWalker.h \
nsStyleCoord.h \
nsStyleUtil.h \
nsStyleStruct.h \
nsTextFragment.h \
nsXULAtomList.h \
nsXULAtoms.h \
nsXBLAtomList.h \
nsXBLAtoms.h \
$(NULL)
ifdef MOZ_SVG
EXPORTS += nsSVGAtomList.h nsSVGAtoms.h
endif
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
include $(topsrcdir)/config/rules.mk

View File

@@ -0,0 +1,55 @@
#!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=..\..\..
MODULE=content
EXPORTS = \
nsCSSAtomList.h \
nsCSSAtoms.h \
nsCSSKeywordList.h \
nsCSSKeywords.h \
nsCSSPropList.h \
nsCSSProps.h \
nsHTMLAtomList.h \
nsHTMLAtoms.h \
nsHTMLUtils.h \
nsHTMLValue.h \
nsImageMapUtils.h \
nsLayoutAtomList.h \
nsLayoutAtoms.h \
nsRuleNode.h \
nsRuleWalker.h \
nsStyleCoord.h \
nsStyleUtil.h \
nsStyleStruct.h \
nsTextFragment.h \
nsXULAtomList.h \
nsXULAtoms.h \
!ifdef MOZ_SVG
nsSVGAtomList.h \
nsSVGAtoms.h \
!endif
nsXBLAtomList.h \
nsXBLAtoms.h \
$(NULL)
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,419 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/******
This file contains the list of all parsed CSS keywords
See nsCSSKeywords.h for access to the enum values for keywords
It is designed to be used as inline input to nsCSSKeywords.cpp *only*
through the magic of C preprocessing.
All entires must be enclosed in the macro CSS_KEY which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
Requirements:
Entries are in the form: (name,id). 'id' must always be the same as 'name'
except that all hyphens ('-') in 'name' are converted to underscores ('_')
in 'id'. This lets us do nice things with the macros without having to
copy/convert strings at runtime.
'name' entries *must* use only lowercase characters.
** Break these invarient and bad things will happen. **
******/
CSS_KEY(-moz-all, _moz_all)
CSS_KEY(-moz-bg-inset, _moz_bg_inset)
CSS_KEY(-moz-bg-outset, _moz_bg_outset)
CSS_KEY(-moz-center, _moz_center)
CSS_KEY(-moz-dialog, _moz_dialog)
CSS_KEY(-moz-dialogtext, _moz_dialogtext)
CSS_KEY(-moz-field, _moz_field)
CSS_KEY(-moz-fieldtext, _moz_fieldtext)
CSS_KEY(-moz-dragtargetzone, _moz_dragtargetzone)
CSS_KEY(-moz-initial, _moz_initial)
CSS_KEY(-moz-mac-focusring, _moz_mac_focusring)
CSS_KEY(-moz-mac-menuselect, _moz_mac_menuselect)
CSS_KEY(-moz-mac-menushadow, _moz_mac_menushadow)
CSS_KEY(-moz-mac-menutextselect, _moz_mac_menutextselect)
CSS_KEY(-moz-mac-accentlightesthighlight, _moz_mac_accentlightesthighlight)
CSS_KEY(-moz-mac-accentregularhighlight, _moz_mac_accentregularhighlight)
CSS_KEY(-moz-mac-accentface, _moz_mac_accentface)
CSS_KEY(-moz-mac-accentlightshadow, _moz_mac_accentlightshadow)
CSS_KEY(-moz-mac-accentregularshadow, _moz_mac_accentregularshadow)
CSS_KEY(-moz-mac-accentdarkshadow, _moz_mac_accentdarkshadow)
CSS_KEY(-moz-mac-accentdarkestshadow, _moz_mac_accentdarkestshadow)
CSS_KEY(-moz-right, _moz_right)
CSS_KEY(-moz-pre-wrap, _moz_pre_wrap)
CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none)
CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal)
CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical)
CSS_KEY(-moz-use-text-color, _moz_use_text_color)
CSS_KEY(-moz-box, _moz_box)
CSS_KEY(-moz-inline-box, _moz_inline_box)
CSS_KEY(-moz-bulletinboard, _moz_bulletinboard)
CSS_KEY(-moz-deck, _moz_deck)
CSS_KEY(-moz-grid, _moz_grid)
CSS_KEY(-moz-inline-grid, _moz_inline_grid)
CSS_KEY(-moz-grid-group, _moz_grid_group)
CSS_KEY(-moz-grid-line, _moz_grid_line)
CSS_KEY(-moz-groupbox, _moz_groupbox)
CSS_KEY(-moz-popup, _moz_popup)
CSS_KEY(-moz-stack, _moz_stack)
CSS_KEY(-moz-inline-stack, _moz_inline_stack)
CSS_KEY(above, above)
CSS_KEY(absolute, absolute)
CSS_KEY(activeborder, activeborder)
CSS_KEY(activecaption, activecaption)
CSS_KEY(alias, alias)
CSS_KEY(all, all)
CSS_KEY(always, always)
CSS_KEY(appworkspace, appworkspace)
CSS_KEY(-moz-arabic-indic, _moz_arabic_indic)
CSS_KEY(armenian, armenian)
CSS_KEY(auto, auto)
CSS_KEY(avoid, avoid)
CSS_KEY(background, background)
CSS_KEY(baseline, baseline)
CSS_KEY(behind, behind)
CSS_KEY(below, below)
CSS_KEY(-moz-bengali, _moz_bengali)
CSS_KEY(bidi-override, bidi_override)
CSS_KEY(blink, blink)
CSS_KEY(block, block)
CSS_KEY(block-axis, block_axis)
CSS_KEY(bold, bold)
CSS_KEY(bolder, bolder)
CSS_KEY(border-box, border_box)
CSS_KEY(both, both)
CSS_KEY(bottom, bottom)
CSS_KEY(button, button)
CSS_KEY(buttonface, buttonface)
CSS_KEY(buttonhighlight, buttonhighlight)
CSS_KEY(buttonshadow, buttonshadow)
CSS_KEY(buttontext, buttontext)
CSS_KEY(capitalize, capitalize)
CSS_KEY(caption, caption)
CSS_KEY(captiontext, captiontext)
CSS_KEY(cell, cell)
CSS_KEY(center, center)
CSS_KEY(center-left, center_left)
CSS_KEY(center-right, center_right)
CSS_KEY(ch, ch)
CSS_KEY(circle, circle)
CSS_KEY(-moz-cjk-earthly-branch, _moz_cjk_earthly_branch)
CSS_KEY(-moz-cjk-heavenly-stem, _moz_cjk_heavenly_stem)
CSS_KEY(cjk-ideographic, cjk_ideographic)
CSS_KEY(close-quote, close_quote)
CSS_KEY(cm, cm)
CSS_KEY(code, code)
CSS_KEY(collapse, collapse)
CSS_KEY(compact, compact)
CSS_KEY(condensed, condensed)
CSS_KEY(content-box, content_box)
CSS_KEY(context-menu, context_menu)
CSS_KEY(continuous, continuous)
CSS_KEY(copy, copy)
CSS_KEY(count-down, count_down)
CSS_KEY(count-up, count_up)
CSS_KEY(count-up-down, count_up_down)
CSS_KEY(crop, crop)
CSS_KEY(cross, cross)
CSS_KEY(crosshair, crosshair)
CSS_KEY(dashed, dashed)
CSS_KEY(decimal, decimal)
CSS_KEY(decimal-leading-zero, decimal_leading_zero)
CSS_KEY(default, default)
CSS_KEY(deg, deg)
CSS_KEY(desktop, desktop)
CSS_KEY(-moz-devanagari, _moz_devanagari)
CSS_KEY(dialog, dialog)
CSS_KEY(digits, digits)
CSS_KEY(disabled, disabled)
CSS_KEY(disc, disc)
CSS_KEY(document, document)
CSS_KEY(dotted, dotted)
CSS_KEY(double, double)
CSS_KEY(e-resize, e_resize)
CSS_KEY(element, element)
CSS_KEY(elements, elements)
CSS_KEY(em, em)
CSS_KEY(embed, embed)
CSS_KEY(enabled, enabled)
CSS_KEY(end, end)
CSS_KEY(ex, ex)
CSS_KEY(expanded, expanded)
CSS_KEY(extra-condensed, extra_condensed)
CSS_KEY(extra-expanded, extra_expanded)
CSS_KEY(far-left, far_left)
CSS_KEY(far-right, far_right)
CSS_KEY(fast, fast)
CSS_KEY(faster, faster)
CSS_KEY(field, field)
CSS_KEY(fixed, fixed)
CSS_KEY(georgian, georgian)
CSS_KEY(grab, grab)
CSS_KEY(grabbing, grabbing)
CSS_KEY(grad, grad)
CSS_KEY(graytext, graytext)
CSS_KEY(groove, groove)
CSS_KEY(-moz-gujarati, _moz_gujarati)
CSS_KEY(-moz-gurmukhi, _moz_gurmukhi)
CSS_KEY(-moz-hangul, _moz_hangul)
CSS_KEY(-moz-hangul-consonant, _moz_hangul_consonant)
CSS_KEY(hebrew, hebrew)
CSS_KEY(help, help)
CSS_KEY(hidden, hidden)
CSS_KEY(hide, hide)
CSS_KEY(high, high)
CSS_KEY(higher, higher)
CSS_KEY(highlight, highlight)
CSS_KEY(highlighttext, highlighttext)
CSS_KEY(hiragana, hiragana)
CSS_KEY(hiragana-iroha, hiragana_iroha)
CSS_KEY(horizontal, horizontal)
CSS_KEY(hz, hz)
CSS_KEY(icon, icon)
CSS_KEY(ignore, ignore)
CSS_KEY(in, in)
CSS_KEY(inactiveborder, inactiveborder)
CSS_KEY(inactivecaption, inactivecaption)
CSS_KEY(inactivecaptiontext, inactivecaptiontext)
CSS_KEY(info, info)
CSS_KEY(infobackground, infobackground)
CSS_KEY(infotext, infotext)
CSS_KEY(inherit, inherit)
CSS_KEY(inline, inline)
CSS_KEY(inline-axis, inline_axis)
CSS_KEY(inline-block, inline_block)
CSS_KEY(inline-table, inline_table)
CSS_KEY(inset, inset)
CSS_KEY(inside, inside)
CSS_KEY(invert, invert)
CSS_KEY(italic, italic)
CSS_KEY(-moz-japanese-formal, _moz_japanese_formal)
CSS_KEY(-moz-japanese-informal, _moz_japanese_informal)
CSS_KEY(justify, justify)
CSS_KEY(-moz-kannada, _moz_kannada)
CSS_KEY(katakana, katakana)
CSS_KEY(katakana-iroha, katakana_iroha)
CSS_KEY(-moz-khmer, _moz_khmer)
CSS_KEY(khz, khz)
CSS_KEY(landscape, landscape)
CSS_KEY(-moz-lao, _moz_lao)
CSS_KEY(large, large)
CSS_KEY(larger, larger)
CSS_KEY(left, left)
CSS_KEY(left-side, left_side)
CSS_KEY(leftwards, leftwards)
CSS_KEY(level, level)
CSS_KEY(lighter, lighter)
CSS_KEY(line-through, line_through)
CSS_KEY(list, list)
CSS_KEY(list-item, list_item)
CSS_KEY(loud, loud)
CSS_KEY(low, low)
CSS_KEY(lower, lower)
CSS_KEY(lower-alpha, lower_alpha)
CSS_KEY(lower-greek, lower_greek)
CSS_KEY(lower-latin, lower_latin)
CSS_KEY(lower-roman, lower_roman)
CSS_KEY(lowercase, lowercase)
CSS_KEY(ltr, ltr)
CSS_KEY(-moz-malayalam, _moz_malayalam)
CSS_KEY(margin-box, margin_box)
CSS_KEY(marker, marker)
CSS_KEY(medium, medium)
CSS_KEY(menu, menu)
CSS_KEY(menutext, menutext)
CSS_KEY(message-box, message_box)
CSS_KEY(middle, middle)
CSS_KEY(mix, mix)
CSS_KEY(mm, mm)
CSS_KEY(move, move)
CSS_KEY(ms, ms)
CSS_KEY(-moz-myanmar, _moz_myanmar)
CSS_KEY(n-resize, n_resize)
CSS_KEY(narrower, narrower)
CSS_KEY(ne-resize, ne_resize)
CSS_KEY(no-close-quote, no_close_quote)
CSS_KEY(no-open-quote, no_open_quote)
CSS_KEY(no-repeat, no_repeat)
CSS_KEY(none, none)
CSS_KEY(normal, normal)
CSS_KEY(noshade, noshade)
CSS_KEY(nowrap, nowrap)
CSS_KEY(nw-resize, nw_resize)
CSS_KEY(oblique, oblique)
CSS_KEY(once, once)
CSS_KEY(open-quote, open_quote)
CSS_KEY(-moz-oriya, _moz_oriya)
CSS_KEY(outset, outset)
CSS_KEY(outside, outside)
CSS_KEY(overline, overline)
CSS_KEY(padding-box, padding_box)
CSS_KEY(paragraph, paragraph)
CSS_KEY(pc, pc)
CSS_KEY(-moz-persian, _moz_persian)
CSS_KEY(pointer, pointer)
CSS_KEY(portrait, portrait)
CSS_KEY(pre, pre)
CSS_KEY(pt, pt)
CSS_KEY(pull-down-menu, pull_down_menu)
CSS_KEY(px, px)
CSS_KEY(rad, rad)
CSS_KEY(read-only, read_only)
CSS_KEY(read-write, read_write)
CSS_KEY(relative, relative)
CSS_KEY(repeat, repeat)
CSS_KEY(repeat-x, repeat_x)
CSS_KEY(repeat-y, repeat_y)
CSS_KEY(reverse, reverse)
CSS_KEY(ridge, ridge)
CSS_KEY(right, right)
CSS_KEY(right-side, right_side)
CSS_KEY(rightwards, rightwards)
CSS_KEY(rtl, rtl)
CSS_KEY(run-in, run_in)
CSS_KEY(s, s)
CSS_KEY(s-resize, s_resize)
CSS_KEY(scroll, scroll)
CSS_KEY(scrollbar, scrollbar)
CSS_KEY(se-resize, se_resize)
CSS_KEY(select-all, select_all)
CSS_KEY(select-before, select_before)
CSS_KEY(select-after, select_after)
CSS_KEY(select-same, select_same)
CSS_KEY(select-menu, select_menu)
CSS_KEY(semi-condensed, semi_condensed)
CSS_KEY(semi-expanded, semi_expanded)
CSS_KEY(separate, separate)
CSS_KEY(show, show)
CSS_KEY(-moz-show-background, show_background)
CSS_KEY(silent, silent)
CSS_KEY(-moz-simp-chinese-formal, _moz_simp_chinese_formal)
CSS_KEY(-moz-simp-chinese-informal, _moz_simp_chinese_informal)
CSS_KEY(slow, slow)
CSS_KEY(slower, slower)
CSS_KEY(small, small)
CSS_KEY(small-caps, small_caps)
CSS_KEY(small-caption, small_caption)
CSS_KEY(smaller, smaller)
CSS_KEY(soft, soft)
CSS_KEY(solid, solid)
CSS_KEY(spell-out, spell_out)
CSS_KEY(spinning, spinning)
CSS_KEY(square, square)
CSS_KEY(start, start)
CSS_KEY(static, static)
CSS_KEY(status-bar, status_bar)
CSS_KEY(stretch, stretch)
CSS_KEY(sub, sub)
CSS_KEY(super, super)
CSS_KEY(sw-resize, sw_resize)
CSS_KEY(table, table)
CSS_KEY(table-caption, table_caption)
CSS_KEY(table-cell, table_cell)
CSS_KEY(table-column, table_column)
CSS_KEY(table-column-group, table_column_group)
CSS_KEY(table-footer-group, table_footer_group)
CSS_KEY(table-header-group, table_header_group)
CSS_KEY(table-row, table_row)
CSS_KEY(table-row-group, table_row_group)
CSS_KEY(-moz-tamil, _moz_tamil)
CSS_KEY(-moz-telugu, _moz_telugu)
CSS_KEY(text, text)
CSS_KEY(text-bottom, text_bottom)
CSS_KEY(text-top, text_top)
CSS_KEY(-moz-thai, _moz_thai)
CSS_KEY(thick, thick)
CSS_KEY(thin, thin)
CSS_KEY(threeddarkshadow, threeddarkshadow)
CSS_KEY(threedface, threedface)
CSS_KEY(threedhighlight, threedhighlight)
CSS_KEY(threedlightshadow, threedlightshadow)
CSS_KEY(threedshadow, threedshadow)
CSS_KEY(toggle, toggle)
CSS_KEY(top, top)
CSS_KEY(-moz-trad-chinese-formal, _moz_trad_chinese_formal)
CSS_KEY(-moz-trad-chinese-informal, _moz_trad_chinese_informal)
CSS_KEY(transparent, transparent)
CSS_KEY(tri-state, tri_state)
CSS_KEY(ultra-condensed, ultra_condensed)
CSS_KEY(ultra-expanded, ultra_expanded)
CSS_KEY(underline, underline)
CSS_KEY(upper-alpha, upper_alpha)
CSS_KEY(upper-latin, upper_latin)
CSS_KEY(upper-roman, upper_roman)
CSS_KEY(uppercase, uppercase)
CSS_KEY(-moz-urdu, _moz_urdu)
CSS_KEY(vertical, vertical)
CSS_KEY(visible, visible)
CSS_KEY(w-resize, w_resize)
CSS_KEY(wait, wait)
CSS_KEY(wider, wider)
CSS_KEY(window, window)
CSS_KEY(windowframe, windowframe)
CSS_KEY(windowtext, windowtext)
CSS_KEY(workspace, workspace)
CSS_KEY(write-only, write_only)
CSS_KEY(x-fast, x_fast)
CSS_KEY(x-high, x_high)
CSS_KEY(x-large, x_large)
CSS_KEY(x-loud, x_loud)
CSS_KEY(x-low, x_low)
CSS_KEY(x-slow, x_slow)
CSS_KEY(x-small, x_small)
CSS_KEY(x-soft, x_soft)
CSS_KEY(xx-large, xx_large)
CSS_KEY(xx-small, xx_small)
#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

View File

@@ -0,0 +1,267 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/******
This file contains the list of all parsed CSS properties
See nsCSSProps.h for access to the enum values for properties
It is designed to be used as inline input to nsCSSProps.cpp *only*
through the magic of C preprocessing.
All entries must be enclosed in the macro CSS_PROP which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
Requirements:
Entries are in the form: (name,id,effect). 'id' must always be the same as
'name' except that all hyphens ('-') in 'name' are converted to underscores
('_') in 'id'. This lets us do nice things with the macros without having to
copy/convert strings at runtime.
'name' entries *must* use only lowercase characters.
** Break these invariants and bad things will happen. **
The third argument says what needs to be recomputed when the property
changes.
******/
// For notes XXX bug 3935 below, the names being parsed do not correspond
// to the constants used internally. It would be nice to bring the
// constants into line sometime.
// The parser will refuse to parse properties marked with -x-.
// Those marked XXX bug 48973 are CSS2 properties that we support
// differently from the spec for UI requirements. If we ever
// support them correctly the old constants need to be renamed and
// new ones should be entered.
CSS_PROP(-moz-border-radius, _moz_border_radius, VISUAL)
CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, VISUAL)
CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, VISUAL)
CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, VISUAL)
CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, VISUAL)
CSS_PROP(-moz-outline-radius, _moz_outline_radius, VISUAL)
CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, VISUAL)
CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, VISUAL)
CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, VISUAL)
CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, VISUAL)
CSS_PROP(azimuth, azimuth, AURAL)
CSS_PROP(background, background, VISUAL)
CSS_PROP(background-attachment, background_attachment, VISUAL)
CSS_PROP(background-color, background_color, VISUAL)
CSS_PROP(background-image, background_image, VISUAL)
CSS_PROP(background-position, background_position, VISUAL)
CSS_PROP(background-repeat, background_repeat, VISUAL)
CSS_PROP(-x-background-x-position, background_x_position, VISUAL) // XXX bug 3935
CSS_PROP(-x-background-y-position, background_y_position, VISUAL) // XXX bug 3935
CSS_PROP(-moz-binding, binding, FRAMECHANGE) // XXX bug 3935
CSS_PROP(border, border, REFLOW)
CSS_PROP(border-bottom, border_bottom, REFLOW)
CSS_PROP(border-bottom-color, border_bottom_color, VISUAL)
CSS_PROP(-moz-border-bottom-colors, border_bottom_colors, VISUAL)
CSS_PROP(border-bottom-style, border_bottom_style, REFLOW) // on/off will need reflow
CSS_PROP(border-bottom-width, border_bottom_width, REFLOW)
CSS_PROP(border-collapse, border_collapse, REFLOW)
CSS_PROP(border-color, border_color, VISUAL)
CSS_PROP(border-left, border_left, REFLOW)
CSS_PROP(border-left-color, border_left_color, VISUAL)
CSS_PROP(-moz-border-left-colors, border_left_colors, VISUAL)
CSS_PROP(border-left-style, border_left_style, REFLOW) // on/off will need reflow
CSS_PROP(border-left-width, border_left_width, REFLOW)
CSS_PROP(border-right, border_right, REFLOW)
CSS_PROP(border-right-color, border_right_color, VISUAL)
CSS_PROP(-moz-border-right-colors, border_right_colors, VISUAL)
CSS_PROP(border-right-style, border_right_style, REFLOW) // on/off will need reflow
CSS_PROP(border-right-width, border_right_width, REFLOW)
CSS_PROP(border-spacing, border_spacing, REFLOW)
CSS_PROP(border-style, border_style, REFLOW) // on/off will need reflow
CSS_PROP(border-top, border_top, REFLOW)
CSS_PROP(border-top-color, border_top_color, VISUAL)
CSS_PROP(-moz-border-top-colors, border_top_colors, VISUAL)
CSS_PROP(border-top-style, border_top_style, REFLOW) // on/off will need reflow
CSS_PROP(border-top-width, border_top_width, REFLOW)
CSS_PROP(border-width, border_width, REFLOW)
CSS_PROP(-x-border-x-spacing, border_x_spacing, REFLOW) // XXX bug 3935
CSS_PROP(-x-border-y-spacing, border_y_spacing, REFLOW) // XXX bug 3935
CSS_PROP(bottom, bottom, REFLOW)
CSS_PROP(-moz-box-align, box_align, REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-direction, box_direction, REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-flex, box_flex, REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-flex-group, box_flex_group, REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-orient, box_orient, REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-pack, box_pack, REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-sizing, box_sizing, REFLOW) // XXX bug 3935
CSS_PROP(-moz-box-ordinal-group, box_ordinal_group, FRAMECHANGE)
CSS_PROP(caption-side, caption_side, REFLOW)
CSS_PROP(clear, clear, REFLOW)
CSS_PROP(clip, clip, REFLOW)
CSS_PROP(-x-clip-bottom, clip_bottom, REFLOW) // XXX bug 3935
CSS_PROP(-x-clip-left, clip_left, REFLOW) // XXX bug 3935
CSS_PROP(-x-clip-right, clip_right, REFLOW) // XXX bug 3935
CSS_PROP(-x-clip-top, clip_top, REFLOW) // XXX bug 3935
CSS_PROP(color, color, VISUAL)
CSS_PROP(content, content, FRAMECHANGE)
CSS_PROP(counter-increment, counter_increment, REFLOW)
CSS_PROP(counter-reset, counter_reset, REFLOW)
CSS_PROP(cue, cue, AURAL)
CSS_PROP(cue-after, cue_after, AURAL)
CSS_PROP(cue-before, cue_before, AURAL)
CSS_PROP(cursor, cursor, VISUAL)
CSS_PROP(direction, direction, REFLOW)
CSS_PROP(display, display, FRAMECHANGE)
CSS_PROP(elevation, elevation, AURAL)
CSS_PROP(empty-cells, empty_cells, VISUAL)
CSS_PROP(float, float, FRAMECHANGE)
CSS_PROP(-moz-float-edge, float_edge, REFLOW) // XXX bug 3935
CSS_PROP(font, font, REFLOW)
CSS_PROP(font-family, font_family, REFLOW)
CSS_PROP(font-size, font_size, REFLOW)
CSS_PROP(font-size-adjust, font_size_adjust, REFLOW)
CSS_PROP(font-stretch, font_stretch, REFLOW)
CSS_PROP(font-style, font_style, REFLOW)
CSS_PROP(font-variant, font_variant, REFLOW)
CSS_PROP(font-weight, font_weight, REFLOW)
CSS_PROP(height, height, REFLOW)
CSS_PROP(-moz-image-region, image_region, REFLOW)
CSS_PROP(-x-image-region-bottom, image_region_bottom, REFLOW)
CSS_PROP(-x-image-region-left, image_region_left, REFLOW)
CSS_PROP(-x-image-region-right, image_region_right, REFLOW)
CSS_PROP(-x-image-region-top, image_region_top, REFLOW)
CSS_PROP(-moz-key-equivalent, key_equivalent, CONTENT) // This will need some other notification, but what? // XXX bug 3935
CSS_PROP(left, left, REFLOW)
CSS_PROP(letter-spacing, letter_spacing, REFLOW)
CSS_PROP(line-height, line_height, REFLOW)
CSS_PROP(list-style, list_style, REFLOW)
CSS_PROP(list-style-image, list_style_image, REFLOW)
CSS_PROP(list-style-position, list_style_position, REFLOW)
CSS_PROP(list-style-type, list_style_type, REFLOW)
CSS_PROP(margin, margin, REFLOW)
CSS_PROP(margin-bottom, margin_bottom, REFLOW)
CSS_PROP(margin-left, margin_left, REFLOW)
CSS_PROP(margin-right, margin_right, REFLOW)
CSS_PROP(margin-top, margin_top, REFLOW)
CSS_PROP(marker-offset, marker_offset, REFLOW)
CSS_PROP(marks, marks, VISUAL)
CSS_PROP(max-height, max_height, REFLOW)
CSS_PROP(max-width, max_width, REFLOW)
CSS_PROP(min-height, min_height, REFLOW)
CSS_PROP(min-width, min_width, REFLOW)
CSS_PROP(-moz-opacity, opacity, VISUAL) // XXX bug 3935
CSS_PROP(orphans, orphans, REFLOW)
CSS_PROP(-moz-outline, outline, VISUAL) // XXX This is temporary fix for nsbeta3+ Bug 48973, turning outline into -moz-outline XXX bug 48973
CSS_PROP(-moz-outline-color, outline_color, VISUAL) // XXX bug 48973
CSS_PROP(-moz-outline-style, outline_style, VISUAL) // XXX bug 48973
CSS_PROP(-moz-outline-width, outline_width, VISUAL) // XXX bug 48973
CSS_PROP(overflow, overflow, FRAMECHANGE)
CSS_PROP(padding, padding, REFLOW)
CSS_PROP(padding-bottom, padding_bottom, REFLOW)
CSS_PROP(padding-left, padding_left, REFLOW)
CSS_PROP(padding-right, padding_right, REFLOW)
CSS_PROP(padding-top, padding_top, REFLOW)
CSS_PROP(page, page, REFLOW)
CSS_PROP(page-break-after, page_break_after, REFLOW)
CSS_PROP(page-break-before, page_break_before, REFLOW)
CSS_PROP(page-break-inside, page_break_inside, REFLOW)
CSS_PROP(pause, pause, AURAL)
CSS_PROP(pause-after, pause_after, AURAL)
CSS_PROP(pause-before, pause_before, AURAL)
CSS_PROP(pitch, pitch, AURAL)
CSS_PROP(pitch-range, pitch_range, AURAL)
CSS_PROP(play-during, play_during, AURAL)
CSS_PROP(-x-play-during-flags, play_during_flags, AURAL) // XXX why is this here?
CSS_PROP(position, position, FRAMECHANGE)
CSS_PROP(quotes, quotes, REFLOW)
CSS_PROP(-x-quotes-close, quotes_close, REFLOW) // XXX bug 3935
CSS_PROP(-x-quotes-open, quotes_open, REFLOW) // XXX bug 3935
CSS_PROP(-moz-resizer, resizer, FRAMECHANGE) // XXX bug 3935
CSS_PROP(richness, richness, AURAL)
CSS_PROP(right, right, REFLOW)
CSS_PROP(size, size, REFLOW)
CSS_PROP(-x-size-height, size_height, REFLOW) // XXX bug 3935
CSS_PROP(-x-size-width, size_width, REFLOW) // XXX bug 3935
CSS_PROP(speak, speak, AURAL)
CSS_PROP(speak-header, speak_header, AURAL)
CSS_PROP(speak-numeral, speak_numeral, AURAL)
CSS_PROP(speak-punctuation, speak_punctuation, AURAL)
CSS_PROP(speech-rate, speech_rate, AURAL)
CSS_PROP(stress, stress, AURAL)
CSS_PROP(table-layout, table_layout, REFLOW)
CSS_PROP(text-align, text_align, REFLOW)
CSS_PROP(text-decoration, text_decoration, VISUAL)
CSS_PROP(text-indent, text_indent, REFLOW)
CSS_PROP(text-shadow, text_shadow, VISUAL)
CSS_PROP(-x-text-shadow-color, text_shadow_color, VISUAL) // XXX bug 3935
CSS_PROP(-x-text-shadow-radius, text_shadow_radius, VISUAL) // XXX bug 3935
CSS_PROP(-x-text-shadow-x, text_shadow_x, VISUAL) // XXX bug 3935
CSS_PROP(-x-text-shadow-y, text_shadow_y, VISUAL) // XXX bug 3935
CSS_PROP(text-transform, text_transform, REFLOW)
CSS_PROP(top, top, REFLOW)
CSS_PROP(unicode-bidi, unicode_bidi, REFLOW)
CSS_PROP(-moz-user-focus, user_focus, CONTENT) // XXX bug 3935
CSS_PROP(-moz-user-input, user_input, FRAMECHANGE) // XXX ??? // XXX bug 3935
CSS_PROP(-moz-user-modify, user_modify, FRAMECHANGE) // XXX bug 3935
CSS_PROP(-moz-user-select, user_select, CONTENT) // XXX bug 3935
CSS_PROP(vertical-align, vertical_align, REFLOW)
CSS_PROP(visibility, visibility, REFLOW) // reflow for collapse
CSS_PROP(voice-family, voice_family, AURAL)
CSS_PROP(volume, volume, AURAL)
CSS_PROP(white-space, white_space, REFLOW)
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

View File

@@ -0,0 +1,156 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCSSProps_h___
#define nsCSSProps_h___
#include "nsString.h"
/*
Declare the enum list using the magic of preprocessing
enum values are "eCSSProperty_foo" (where foo is the property)
To change the list of properties, see nsCSSPropList.h
*/
#define CSS_PROP(_name, _id, _hint) eCSSProperty_##_id,
enum nsCSSProperty {
eCSSProperty_UNKNOWN = -1,
#include "nsCSSPropList.h"
eCSSProperty_COUNT
};
#undef CSS_PROP
class nsCSSProps {
public:
static void AddRefTable(void);
static void ReleaseTable(void);
// Given a property string, return the enum value
static nsCSSProperty LookupProperty(const nsAReadableString& aProperty);
static nsCSSProperty LookupProperty(const nsACString& aProperty);
// Given a property enum, get the string value
static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
// Given a CSS Property and a Property Enum Value
// Return back a const nsString& representation of the
// value. Return back nullstr if no value is found
static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue);
// Get a color name for a predefined color value like buttonhighlight or activeborder
// Sets the aStr param to the name of the propertyID
static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr);
static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]);
static const nsAFlatCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]);
static const PRInt32 kHintTable[];
// Keyword/Enum value tables
static const PRInt32 kAzimuthKTable[];
static const PRInt32 kBackgroundAttachmentKTable[];
static const PRInt32 kBackgroundColorKTable[];
static const PRInt32 kBackgroundRepeatKTable[];
static const PRInt32 kBorderCollapseKTable[];
static const PRInt32 kBorderColorKTable[];
static const PRInt32 kBorderStyleKTable[];
static const PRInt32 kBorderWidthKTable[];
#ifdef INCLUDE_XUL
static const PRInt32 kBoxAlignKTable[];
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[];
static const PRInt32 kClearKTable[];
static const PRInt32 kColorKTable[];
static const PRInt32 kContentKTable[];
static const PRInt32 kCursorKTable[];
static const PRInt32 kDirectionKTable[];
static const PRInt32 kDisplayKTable[];
static const PRInt32 kElevationKTable[];
static const PRInt32 kEmptyCellsKTable[];
static const PRInt32 kFloatKTable[];
static const PRInt32 kFloatEdgeKTable[];
static const PRInt32 kFontKTable[];
static const PRInt32 kFontSizeKTable[];
static const PRInt32 kFontStretchKTable[];
static const PRInt32 kFontStyleKTable[];
static const PRInt32 kFontVariantKTable[];
static const PRInt32 kFontWeightKTable[];
static const PRInt32 kKeyEquivalentKTable[];
static const PRInt32 kListStylePositionKTable[];
static const PRInt32 kListStyleKTable[];
static const PRInt32 kOutlineColorKTable[];
static const PRInt32 kOverflowKTable[];
static const PRInt32 kPageBreakKTable[];
static const PRInt32 kPageBreakInsideKTable[];
static const PRInt32 kPageMarksKTable[];
static const PRInt32 kPageSizeKTable[];
static const PRInt32 kPitchKTable[];
static const PRInt32 kPlayDuringKTable[];
static const PRInt32 kPositionKTable[];
static const PRInt32 kResizerKTable[];
static const PRInt32 kSpeakKTable[];
static const PRInt32 kSpeakHeaderKTable[];
static const PRInt32 kSpeakNumeralKTable[];
static const PRInt32 kSpeakPunctuationKTable[];
static const PRInt32 kSpeechRateKTable[];
static const PRInt32 kTableLayoutKTable[];
static const PRInt32 kTextAlignKTable[];
static const PRInt32 kTextDecorationKTable[];
static const PRInt32 kTextTransformKTable[];
static const PRInt32 kUnicodeBidiKTable[];
static const PRInt32 kUserFocusKTable[];
static const PRInt32 kUserInputKTable[];
static const PRInt32 kUserModifyKTable[];
static const PRInt32 kUserSelectKTable[];
static const PRInt32 kVerticalAlignKTable[];
static const PRInt32 kVisibilityKTable[];
static const PRInt32 kVolumeKTable[];
static const PRInt32 kWhitespaceKTable[];
};
#endif /* nsCSSProps_h___ */

View File

@@ -0,0 +1,554 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsRuleNode_h___
#define nsRuleNode_h___
#include "nsCOMPtr.h"
#include "nsHashtable.h"
#include "nsIStyleRule.h"
#include "nsIFrame.h"
#include "nsFixedSizeAllocator.h"
#include "nsIPresContext.h"
#include "nsICSSDeclaration.h"
#include "nsILanguageAtomService.h"
class nsIStyleContext;
struct nsRuleList;
typedef void (*nsPostResolveFunc)(nsStyleStruct* aStyleStruct, nsRuleData* aData);
struct nsInheritedStyleData
{
nsStyleVisibility* mVisibilityData;
nsStyleFont* mFontData;
nsStyleList* mListData;
nsStyleTableBorder* mTableData;
nsStyleColor* mColorData;
nsStyleQuotes* mQuotesData;
nsStyleText* mTextData;
nsStyleUserInterface* mUIData;
#ifdef MOZ_SVG
nsStyleSVG* mSVGData;
#endif
void* operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
return result;
};
void ClearInheritedData(PRUint32 aBits) {
if (mVisibilityData && (aBits & NS_STYLE_INHERIT_VISIBILITY))
mVisibilityData = nsnull;
if (mFontData && (aBits & NS_STYLE_INHERIT_FONT))
mFontData = nsnull;
if (mListData && (aBits & NS_STYLE_INHERIT_LIST))
mListData = nsnull;
if (mTableData && (aBits & NS_STYLE_INHERIT_TABLE_BORDER))
mTableData = nsnull;
if (mColorData && (aBits & NS_STYLE_INHERIT_COLOR))
mColorData = nsnull;
if (mQuotesData && (aBits & NS_STYLE_INHERIT_QUOTES))
mQuotesData = nsnull;
if (mTextData && (aBits & NS_STYLE_INHERIT_TEXT))
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) {
if (mVisibilityData && !(aBits & NS_STYLE_INHERIT_VISIBILITY))
mVisibilityData->Destroy(aContext);
if (mFontData && !(aBits & NS_STYLE_INHERIT_FONT))
mFontData->Destroy(aContext);
if (mListData && !(aBits & NS_STYLE_INHERIT_LIST))
mListData->Destroy(aContext);
if (mTableData && !(aBits & NS_STYLE_INHERIT_TABLE_BORDER))
mTableData->Destroy(aContext);
if (mColorData && !(aBits & NS_STYLE_INHERIT_COLOR))
mColorData->Destroy(aContext);
if (mQuotesData && !(aBits & NS_STYLE_INHERIT_QUOTES))
mQuotesData->Destroy(aContext);
if (mTextData && !(aBits & NS_STYLE_INHERIT_TEXT))
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
{};
};
struct nsResetStyleData
{
nsResetStyleData()
:mDisplayData(nsnull), mMarginData(nsnull), mBorderData(nsnull), mPaddingData(nsnull),
mOutlineData(nsnull), mPositionData(nsnull), mTableData(nsnull), mBackgroundData(nsnull),
mContentData(nsnull), mTextData(nsnull), mUIData(nsnull)
{
#ifdef INCLUDE_XUL
mXULData = nsnull;
#endif
};
void* operator new(size_t sz, nsIPresContext* aContext) {
void* result = nsnull;
aContext->AllocateFromShell(sz, &result);
return result;
}
void ClearInheritedData(PRUint32 aBits) {
if (mDisplayData && (aBits & NS_STYLE_INHERIT_DISPLAY))
mDisplayData = nsnull;
if (mMarginData && (aBits & NS_STYLE_INHERIT_MARGIN))
mMarginData = nsnull;
if (mBorderData && (aBits & NS_STYLE_INHERIT_BORDER))
mBorderData = nsnull;
if (mPaddingData && (aBits & NS_STYLE_INHERIT_PADDING))
mPaddingData = nsnull;
if (mOutlineData && (aBits & NS_STYLE_INHERIT_OUTLINE))
mOutlineData = nsnull;
if (mPositionData && (aBits & NS_STYLE_INHERIT_POSITION))
mPositionData = nsnull;
if (mTableData && (aBits & NS_STYLE_INHERIT_TABLE))
mTableData = nsnull;
if (mBackgroundData && (aBits & NS_STYLE_INHERIT_BACKGROUND))
mBackgroundData = nsnull;
if (mContentData && (aBits & NS_STYLE_INHERIT_CONTENT))
mContentData = nsnull;
if (mTextData && (aBits & NS_STYLE_INHERIT_TEXT_RESET))
mTextData = nsnull;
if (mUIData && (aBits & NS_STYLE_INHERIT_UI_RESET))
mUIData = nsnull;
#ifdef INCLUDE_XUL
if (mXULData && (aBits & NS_STYLE_INHERIT_XUL))
mXULData = nsnull;
#endif
};
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
if (mDisplayData && !(aBits & NS_STYLE_INHERIT_DISPLAY))
mDisplayData->Destroy(aContext);
if (mMarginData && !(aBits & NS_STYLE_INHERIT_MARGIN))
mMarginData->Destroy(aContext);
if (mBorderData && !(aBits & NS_STYLE_INHERIT_BORDER))
mBorderData->Destroy(aContext);
if (mPaddingData && !(aBits & NS_STYLE_INHERIT_PADDING))
mPaddingData->Destroy(aContext);
if (mOutlineData && !(aBits & NS_STYLE_INHERIT_OUTLINE))
mOutlineData->Destroy(aContext);
if (mPositionData && !(aBits & NS_STYLE_INHERIT_POSITION))
mPositionData->Destroy(aContext);
if (mTableData && !(aBits & NS_STYLE_INHERIT_TABLE))
mTableData->Destroy(aContext);
if (mBackgroundData && !(aBits & NS_STYLE_INHERIT_BACKGROUND))
mBackgroundData->Destroy(aContext);
if (mContentData && !(aBits & NS_STYLE_INHERIT_CONTENT))
mContentData->Destroy(aContext);
if (mTextData && !(aBits & NS_STYLE_INHERIT_TEXT_RESET))
mTextData->Destroy(aContext);
if (mUIData && !(aBits & NS_STYLE_INHERIT_UI_RESET))
mUIData->Destroy(aContext);
#ifdef INCLUDE_XUL
if (mXULData && !(aBits & NS_STYLE_INHERIT_XUL))
mXULData->Destroy(aContext);
#endif
aContext->FreeToShell(sizeof(nsResetStyleData), this);
};
nsStyleDisplay* mDisplayData;
nsStyleMargin* mMarginData;
nsStyleBorder* mBorderData;
nsStylePadding* mPaddingData;
nsStyleOutline* mOutlineData;
nsStylePosition* mPositionData;
nsStyleTable* mTableData;
nsStyleBackground* mBackgroundData;
nsStyleContent* mContentData;
nsStyleTextReset* mTextData;
nsStyleUIReset* mUIData;
#ifdef INCLUDE_XUL
nsStyleXUL* mXULData;
#endif
};
struct nsCachedStyleData
{
struct StyleStructInfo {
ptrdiff_t mCachedStyleDataOffset;
ptrdiff_t mInheritResetOffset;
PRBool mIsReset;
};
static StyleStructInfo gInfo[];
nsInheritedStyleData* mInheritedData;
nsResetStyleData* mResetData;
static PRBool IsReset(const nsStyleStructID& aSID) {
return gInfo[aSID].mIsReset;
};
static PRUint32 GetBitForSID(const nsStyleStructID& aSID) {
return 1 << (aSID - 1);
};
nsStyleStruct* GetStyleData(const nsStyleStructID& aSID) {
const StyleStructInfo& info = gInfo[aSID];
char* resetOrInheritSlot = NS_REINTERPRET_CAST(char*, this) + info.mCachedStyleDataOffset;
char* resetOrInherit = NS_REINTERPRET_CAST(char*, *NS_REINTERPRET_CAST(void**, resetOrInheritSlot));
nsStyleStruct* data = nsnull;
if (resetOrInherit) {
char* dataSlot = resetOrInherit + info.mInheritResetOffset;
data = *NS_REINTERPRET_CAST(nsStyleStruct**, dataSlot);
}
return data;
};
void ClearInheritedData(PRUint32 aBits) {
if (mResetData)
mResetData->ClearInheritedData(aBits);
if (mInheritedData)
mInheritedData->ClearInheritedData(aBits);
}
void Destroy(PRUint32 aBits, nsIPresContext* aContext) {
if (mResetData)
mResetData->Destroy(aBits, aContext);
if (mInheritedData)
mInheritedData->Destroy(aBits, aContext);
mResetData = nsnull;
mInheritedData = nsnull;
}
nsCachedStyleData() :mInheritedData(nsnull), mResetData(nsnull) {};
~nsCachedStyleData() {};
};
struct nsRuleData
{
nsStyleStructID mSID;
nsIPresContext* mPresContext;
nsIStyleContext* mStyleContext;
nsPostResolveFunc mPostResolveCallback;
PRBool mCanStoreInRuleTree;
nsCSSFont* mFontData; // Should always be stack-allocated! We don't own these structures!
nsCSSDisplay* mDisplayData;
nsCSSMargin* mMarginData;
nsCSSList* mListData;
nsCSSPosition* mPositionData;
nsCSSTable* mTableData;
nsCSSColor* mColorData;
nsCSSContent* mContentData;
nsCSSText* mTextData;
nsCSSUserInterface* mUIData;
#ifdef INCLUDE_XUL
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),
mPositionData(nsnull), mTableData(nsnull), mColorData(nsnull), mContentData(nsnull), mTextData(nsnull),
mUIData(nsnull)
{
mCanStoreInRuleTree = PR_TRUE;
#ifdef INCLUDE_XUL
mXULData = nsnull;
#endif
#ifdef MOZ_SVG
mSVGData = nsnull;
#endif
};
~nsRuleData() {};
};
class nsRuleNode {
public:
// for purposes of the RuleDetail (and related code),
// * a non-inherited value is one that is specified as a
// non-"inherit" value or as an "inherit" value that is reflected
// in the struct and to the user of the style system with an
// eCSSUnit_Inherit value
// * an inherited value is one that is specified as "inherit" and
// where the inheritance is computed by the style system
enum RuleDetail {
eRuleNone, // No props have been specified at all.
eRulePartialMixed, // At least one prop with a non-inherited value
// has been specified. Some props may also have
// been specified with an inherited value. At
// least one prop remains unspecified.
eRulePartialInherited, // Only props with inherited values have
// have been specified. At least one prop
// remains unspecified.
eRuleFullMixed, // All props have been specified. At least one has
// a non-inherited value.
eRuleFullInherited, // All props have been specified with inherited
// values.
eRuleUnknown // Information unknown (used as a result from a check
// callback to trigger the normal checking codepath)
};
enum { // Types of RuleBits
eNoneBits,
eInheritBits
};
private:
nsIPresContext* mPresContext; // Our pres context.
nsRuleNode* mParent; // A pointer to the parent node in the tree. This enables us to
// walk backwards from the most specific rule matched to the least
// specific rule (which is the optimal order to use for lookups
// of style properties.
nsCOMPtr<nsIStyleRule> mRule; // A pointer to our specific rule.
union {
nsHashtable* mRootChildren; // A hashtable that maps from rules to our RuleNode children.
// When matching rules, we use this table to transition from
// node to node (constructing new nodes as needed to flesh out
// the tree).
nsRuleList* mChildren;
};
nsCachedStyleData mStyleData; // Any data we cached on the rule node.
PRUint32 mInheritBits; // Used to cache the fact that we can look up cached data under a parent
// rule. This is not the same thing as CSS inheritance.
PRUint32 mNoneBits; // Used to cache the fact that this entire branch specifies no data
// for a given struct type. For example, if an entire rule branch
// specifies no color information, then a bit will be set along every
// rule node on that branch, so that you can break out of the rule tree
// early.
friend struct nsRuleList;
protected:
// The callback function for deleting rule nodes from our rule tree.
static PRBool PR_CALLBACK DeleteChildren(nsHashKey *aKey, void *aData, void *closure);
public:
// Overloaded new operator. Initializes the memory to 0 and relies on an arena
// (which comes from the presShell) to perform the allocation.
void* operator new(size_t sz, nsIPresContext* aContext);
void Destroy();
static nsILanguageAtomService *gLangService;
protected:
void PropagateInheritBit(PRUint32 aBit, nsRuleNode* aHighestNode);
void PropagateNoneBit(PRUint32 aBit, nsRuleNode* aHighestNode);
PRBool InheritsFromParentRule(const nsStyleStructID aSID);
const nsStyleStruct* SetDefaultOnRoot(const nsStyleStructID aSID, nsIStyleContext* aContext);
const nsStyleStruct* WalkRuleTree(const nsStyleStructID aSID, nsIStyleContext* aContext,
nsRuleData* aRuleData,
nsCSSStruct* aSpecificData,
PRBool aComputeData);
const nsStyleStruct* ComputeDisplayData(nsStyleStruct* aStartDisplay, const nsCSSStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeVisibilityData(nsStyleStruct* aStartVisibility, const nsCSSStruct& aDisplayData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeFontData(nsStyleStruct* aStartFont, const nsCSSStruct& aFontData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeColorData(nsStyleStruct* aStartColor, const nsCSSStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBackgroundData(nsStyleStruct* aStartBackground, const nsCSSStruct& aColorData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeMarginData(nsStyleStruct* aStartMargin, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeBorderData(nsStyleStruct* aStartBorder, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePaddingData(nsStyleStruct* aStartPadding, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeOutlineData(nsStyleStruct* aStartOutline, const nsCSSStruct& aMarginData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeListData(nsStyleStruct* aStartList, const nsCSSStruct& aListData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputePositionData(nsStyleStruct* aStartPosition, const nsCSSStruct& aPositionData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
nsIStyleContext* aContext, nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTableBorderData(nsStyleStruct* aStartTable, const nsCSSStruct& aTableData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeContentData(nsStyleStruct* aStartContent, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeQuotesData(nsStyleStruct* aStartQuotes, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeTextResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeUIData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
const nsStyleStruct* ComputeUIResetData(nsStyleStruct* aStartData, const nsCSSStruct& aData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail, PRBool aInherited);
#ifdef INCLUDE_XUL
const nsStyleStruct* ComputeXULData(nsStyleStruct* aStartXUL, const nsCSSStruct& aXULData,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
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,
nsIStyleContext* aContext,
nsRuleNode* aHighestNode,
const RuleDetail& aRuleDetail,
PRBool aInherited);
static ComputeStyleDataFn gComputeStyleDataFn[];
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsCSSStruct& aCSSStruct);
const nsStyleStruct* GetParentData(const nsStyleStructID aSID);
const nsStyleStruct* GetDisplayData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetVisibilityData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetFontData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetColorData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetBackgroundData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetMarginData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetBorderData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetPaddingData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetOutlineData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetListData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetPositionData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetTableData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetTableBorderData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetContentData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetQuotesData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetTextData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetTextResetData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetUIData(nsIStyleContext* aContext, PRBool aComputeData);
const nsStyleStruct* GetUIResetData(nsIStyleContext* aContext, PRBool aComputeData);
#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[];
public:
nsRuleNode(nsIPresContext* aPresContext, nsIStyleRule* aRule=nsnull, nsRuleNode* aParent=nsnull);
virtual ~nsRuleNode();
static void CreateRootNode(nsIPresContext* aPresContext, nsRuleNode** aResult);
nsresult GetBits(PRInt32 aType, PRUint32* aResult);
nsresult Transition(nsIStyleRule* aRule, nsRuleNode** aResult);
nsRuleNode* GetParent() { return mParent; }
PRBool IsRoot() { return mParent == nsnull; }
nsresult GetRule(nsIStyleRule** aResult)
{
*aResult = mRule;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
nsresult ClearCachedData(nsIStyleRule* aRule);
nsresult ClearCachedDataInSubtree(nsIStyleRule* aRule);
nsresult GetPresContext(nsIPresContext** aResult);
nsresult PathContainsRule(nsIStyleRule* aRule, PRBool* aMatched);
const nsStyleStruct* GetStyleData(nsStyleStructID aSID,
nsIStyleContext* aContext,
PRBool aComputeData);
};
#endif

View File

@@ -0,0 +1,96 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Rod Spears (rods@netscape.com)
*
* Contributor(s):
*/
/******
This file contains the list of all SVG nsIAtoms and their values
It is designed to be used as inline input to nsSVGAtoms.cpp *only*
through the magic of C preprocessing.
All entires must be enclosed in the macro SVG_ATOM which will have cruel
and unusual things done to it
It is recommended (but not strictly necessary) to keep all entries
in alphabetical order
The first argument to SVG_ATOM is the C++ identifier of the atom
The second argument is the string value of the atom
******/
// tags
SVG_ATOM(circle, "circle")
SVG_ATOM(ellipse, "ellipse")
SVG_ATOM(foreignObject, "foreignObject")
SVG_ATOM(g, "g")
SVG_ATOM(generic, "generic")
SVG_ATOM(line, "line")
SVG_ATOM(path, "path")
SVG_ATOM(polygon, "polygon")
SVG_ATOM(polyline, "polyline")
SVG_ATOM(rect, "rect")
SVG_ATOM(svg, "svg")
// properties
SVG_ATOM(cx, "cx")
SVG_ATOM(cy, "cy")
SVG_ATOM(d, "d")
SVG_ATOM(fill, "fill")
SVG_ATOM(height, "height")
SVG_ATOM(id, "id")
SVG_ATOM(pathLength, "pathLength")
SVG_ATOM(points, "points")
SVG_ATOM(r, "r")
SVG_ATOM(rx, "rx")
SVG_ATOM(ry, "ry")
SVG_ATOM(style, "style")
SVG_ATOM(transform, "transform")
SVG_ATOM(viewBox, "viewBox")
SVG_ATOM(width, "width")
SVG_ATOM(x, "x")
SVG_ATOM(y, "y")
SVG_ATOM(x1, "x1")
SVG_ATOM(y1, "y1")
SVG_ATOM(x2, "x2")
SVG_ATOM(y2, "y2")
// transformation keywords
SVG_ATOM(rotate, "rotate")
SVG_ATOM(scale, "scale")
SVG_ATOM(skewX, "skewX")
SVG_ATOM(skewY, "skewY")
SVG_ATOM(translate, "translate")
// length units
SVG_ATOM(cm, "cm")
SVG_ATOM(ems, "em")
SVG_ATOM(exs, "ex")
SVG_ATOM(in, "in")
SVG_ATOM(mm, "mm")
SVG_ATOM(pc, "pc")
SVG_ATOM(percentage, "%")
SVG_ATOM(pt, "pt")
SVG_ATOM(px, "px")

View File

@@ -0,0 +1,61 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Rod Spears (rods@netscape.com)
*
* Contributor(s):
*/
#ifndef nsSVGAtoms_h___
#define nsSVGAtoms_h___
#include "prtypes.h"
#include "nsIAtom.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 {
public:
static void AddRefAtoms();
static void ReleaseAtoms();
// SVG namespace ID, good for the life of the nsSVGAtoms object
static PRInt32 nameSpaceID;
static PRInt32 nameSpaceDeprecatedID;
/* Declare all atoms
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
};
#endif /* nsSVGAtoms_h___ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
#
# 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 = content
LIBRARY_NAME = gkconshared_s
REQUIRES = xpcom \
string \
gfx \
layout \
widget \
locale \
dom \
webshell \
pref \
necko \
htmlparser \
unicharutil \
uconv \
$(NULL)
CPPSRCS = \
nsCSSAtoms.cpp \
nsCSSKeywords.cpp \
nsCSSProps.cpp \
nsHTMLAtoms.cpp \
nsHTMLUtils.cpp \
nsHTMLValue.cpp \
nsImageMapUtils.cpp \
nsLayoutAtoms.cpp \
nsStyleUtil.cpp \
nsTextFragment.cpp \
nsXULAtoms.cpp \
nsXBLAtoms.cpp \
nsStyleCoord.cpp \
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
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_LAYOUT

View File

@@ -0,0 +1,78 @@
#!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=..\..\..
MODULE=content
REQUIRES = xpcom \
string \
widget \
locale \
dom \
webshell \
pref \
necko \
htmlparser \
unicharutil \
layout \
gfx \
uconv \
$(NULL)
LIBRARY_NAME=contentshared_s
DEFINES=-D_IMPL_NS_LAYOUT -DWIN32_LEAN_AND_MEAN
!if defined(XP_NEW_SELECTION)
DEFINES = $(DEFINES) -DXP_NEW_SELECTION
!endif
CPP_OBJS= \
.\$(OBJDIR)\nsCSSAtoms.obj \
.\$(OBJDIR)\nsCSSKeywords.obj \
.\$(OBJDIR)\nsCSSProps.obj \
.\$(OBJDIR)\nsHTMLAtoms.obj \
.\$(OBJDIR)\nsHTMLUtils.obj \
.\$(OBJDIR)\nsHTMLValue.obj \
.\$(OBJDIR)\nsImageMapUtils.obj \
.\$(OBJDIR)\nsLayoutAtoms.obj \
.\$(OBJDIR)\nsStyleUtil.obj \
.\$(OBJDIR)\nsStyleStruct.obj \
.\$(OBJDIR)\nsTextFragment.obj \
.\$(OBJDIR)\nsXULAtoms.obj \
.\$(OBJDIR)\nsXBLAtoms.obj \
.\$(OBJDIR)\nsStyleCoord.obj \
!ifdef MOZ_SVG
.\$(OBJDIR)\nsSVGAtoms.obj \
!endif
$(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
rm -f $(PDBFILE).pdb

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Rod Spears (rods@netscape.com)
*
* Contributor(s):
*/
#include "nsString.h"
#include "nsINameSpaceManager.h"
#include "nsSVGAtoms.h"
#include "nsLayoutCID.h"
static const char kSVGNameSpace[] = "http://www.w3.org/2000/svg";
static const char kSVGDeprecatedNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.svg";
PRInt32 nsSVGAtoms::nameSpaceID;
PRInt32 nsSVGAtoms::nameSpaceDeprecatedID;
// 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<nsINameSpaceManager> nsmgr =
do_CreateInstance(kNameSpaceManagerCID);
if (nsmgr) {
nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kSVGNameSpace),
nameSpaceID);
nsmgr->RegisterNameSpace(NS_ConvertASCIItoUCS2(kSVGDeprecatedNameSpace),
nameSpaceDeprecatedID);
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);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,922 @@
/* -*- 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 <math.h>
#include "nsStyleUtil.h"
#include "nsCRT.h"
#include "nsStyleConsts.h"
#include "nsUnitConversion.h"
#include "nsHTMLAtoms.h"
#include "nsILinkHandler.h"
#include "nsILink.h"
#include "nsIXMLContent.h"
#include "nsIHTMLContent.h"
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsReadableUtils.h"
// XXX This is here because nsCachedStyleData is accessed outside of
// the content module; e.g., by nsCSSFrameConstructor.
#include "nsRuleNode.h"
nsCachedStyleData::StyleStructInfo
nsCachedStyleData::gInfo[] = {
// Note that these must line up _exactly_ with the numeric values of
// the nsStyleStructID enum.
{ 0, 0, 0 },
/* eStyleStruct_Font */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mFontData),
PR_FALSE
},
/* eStyleStruct_Color */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mColorData),
PR_FALSE
},
/* eStyleStruct_Background */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mBackgroundData),
PR_TRUE
},
/* eStyleStruct_List */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mListData),
PR_FALSE
},
/* eStyleStruct_Position */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mPositionData),
PR_TRUE
},
/* eStyleStruct_Text */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mTextData),
PR_FALSE
},
/* eStyleStruct_TextReset */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mTextData),
PR_TRUE
},
/* eStyleStruct_Display */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mDisplayData),
PR_TRUE
},
/* eStyleStruct_Visibility */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mVisibilityData),
PR_FALSE
},
/* eStyleStruct_Content */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mContentData),
PR_TRUE
},
/* eStyleStruct_Quotes */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mQuotesData),
PR_FALSE
},
/* eStyleStruct_UserInterface */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mUIData),
PR_FALSE
},
/* eStyleStruct_UIReset */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mUIData),
PR_TRUE
},
/* eStyleStruct_Table */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mTableData),
PR_TRUE
},
/* eStyleStruct_TableBorder */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mTableData),
PR_FALSE
},
/* eStyleStruct_Margin */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mMarginData),
PR_TRUE
},
/* eStyleStruct_Padding */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mPaddingData),
PR_TRUE
},
/* eStyleStruct_Border */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mBorderData),
PR_TRUE
},
/* eStyleStruct_Outline */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mOutlineData),
PR_TRUE
},
#ifdef INCLUDE_XUL
/* eStyleStruct_XUL */
{ offsetof(nsCachedStyleData, mResetData),
offsetof(nsResetStyleData, mXULData),
PR_TRUE
},
#endif
#ifdef MOZ_SVG
/* eStyleStruct_SVG */
{ offsetof(nsCachedStyleData, mInheritedData),
offsetof(nsInheritedStyleData, mSVGData),
PR_FALSE
},
#endif
{ 0, 0, 0 }
};
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
#define POSITIVE_SCALE_FACTOR 1.10 /* 10% */
#define NEGATIVE_SCALE_FACTOR .90 /* 10% */
#if DEBUG
#define DUMP_FONT_SIZES 0
#endif
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
/*
* Return the scaling percentage given a font scaler
* Lifted from layutil.c
*/
float nsStyleUtil::GetScalingFactor(PRInt32 aScaler)
{
double scale = 1.0;
double mult;
PRInt32 count;
if(aScaler < 0) {
count = -aScaler;
mult = NEGATIVE_SCALE_FACTOR;
}
else {
count = aScaler;
mult = POSITIVE_SCALE_FACTOR;
}
/* use the percentage scaling factor to the power of the pref */
while(count--) {
scale *= mult;
}
return (float)scale;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
static PRBool gNavAlgorithmPref = PR_FALSE;
static int PR_CALLBACK NavAlgorithmPrefChangedCallback(const char * name, void * closure)
{
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
prefs->GetBoolPref(name, &gNavAlgorithmPref);
}
return 0;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
static PRBool UseNewFontAlgorithm()
{
static PRBool once = PR_TRUE;
if (once)
{
once = PR_FALSE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
prefs->GetBoolPref("font.size.nav4algorithm", &gNavAlgorithmPref);
prefs->RegisterCallback("font.size.nav4algorithm", NavAlgorithmPrefChangedCallback, NULL);
}
}
return (gNavAlgorithmPref ? PR_FALSE : PR_TRUE);
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
/*
* Lifted from winfe/cxdc.cpp
*/
static nscoord OldCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
float aScalingFactor)
{ // lifted directly from Nav 5.0 code to replicate rounding errors
double dFontSize;
switch(aHTMLSize) {
case 1:
dFontSize = 7 * aBasePointSize / 10;
break;
case 2:
dFontSize = 85 * aBasePointSize / 100;
break;
case 3:
dFontSize = aBasePointSize;
break;
case 4:
dFontSize = 12 * aBasePointSize / 10;
break;
case 5:
dFontSize = 3 * aBasePointSize / 2;
break;
case 6:
dFontSize = 2 * aBasePointSize;
break;
case 7:
dFontSize = 3 * aBasePointSize;
break;
default:
if (aHTMLSize < 1) {
dFontSize = (7 * aBasePointSize / 10) * pow(1.1, aHTMLSize - 1);
}
else { // aHTMLSize > 7
dFontSize = (3 * aBasePointSize) * pow(1.2, aHTMLSize - 7);
}
}
dFontSize *= aScalingFactor;
if (1.0 < dFontSize) {
return (nscoord)dFontSize;
}
return (nscoord)1;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
static nscoord NewCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
#define sFontSizeTableMin 9
#define sFontSizeTableMax 16
// This table seems to be the one used by MacIE5. We hope its adoption in Mozilla
// and eventually in WinIE5.5 will help to establish a standard rendering across
// platforms and browsers. For now, it is used only in Strict mode. More can be read
// in the document written by Todd Farhner at:
// http://style.verso.com/font_size_intervals/altintervals.html
//
static PRInt32 sStrictFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
{
{ 9, 9, 9, 9, 11, 14, 18, 27},
{ 9, 9, 9, 10, 12, 15, 20, 30},
{ 9, 9, 10, 11, 13, 17, 22, 33},
{ 9, 9, 10, 12, 14, 18, 24, 36},
{ 9, 10, 12, 13, 16, 20, 26, 39},
{ 9, 10, 12, 14, 17, 21, 28, 42},
{ 9, 10, 13, 15, 18, 23, 30, 45},
{ 9, 10, 13, 16, 18, 24, 32, 48}
};
// HTML 1 2 3 4 5 6 7
// CSS xxs xs s m l xl xxl
// |
// user pref
//
//------------------------------------------------------------
//
// This table gives us compatibility with WinNav4 for the default fonts only.
// In WinNav4, the default fonts were:
//
// Times/12pt == Times/16px at 96ppi
// Courier/10pt == Courier/13px at 96ppi
//
// The 2 lines below marked "anchored" have the exact pixel sizes used by
// WinNav4 for Times/12pt and Courier/10pt at 96ppi. As you can see, the
// HTML size 3 (user pref) for those 2 anchored lines is 13px and 16px.
//
// All values other than the anchored values were filled in by hand, never
// going below 9px, and maintaining a "diagonal" relationship. See for
// example the 13s -- they follow a diagonal line through the table.
//
static PRInt32 sQuirksFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] =
{
{ 9, 9, 9, 9, 11, 14, 18, 28 },
{ 9, 9, 9, 10, 12, 15, 20, 31 },
{ 9, 9, 9, 11, 13, 17, 22, 34 },
{ 9, 9, 10, 12, 14, 18, 24, 37 },
{ 9, 9, 10, 13, 16, 20, 26, 40 }, // anchored (13)
{ 9, 9, 11, 14, 17, 21, 28, 42 },
{ 9, 10, 12, 15, 17, 23, 30, 45 },
{ 9, 10, 13, 16, 18, 24, 32, 48 } // anchored (16)
};
// HTML 1 2 3 4 5 6 7
// CSS xxs xs s m l xl xxl
// |
// user pref
#if 0
//
// These are the exact pixel values used by WinIE5 at 96ppi.
//
{ ?, 8, 11, 12, 13, 16, 21, 32 }, // smallest
{ ?, 9, 12, 13, 16, 21, 27, 40 }, // smaller
{ ?, 10, 13, 16, 18, 24, 32, 48 }, // medium
{ ?, 13, 16, 19, 21, 27, 37, ?? }, // larger
{ ?, 16, 19, 21, 24, 32, 43, ?? } // largest
//
// HTML 1 2 3 4 5 6 7
// CSS ? ? ? ? ? ? ? ?
//
// (CSS not tested yet.)
//
#endif
static PRInt32 sFontSizeFactors[8] = { 60,75,89,100,120,150,200,300 };
static PRInt32 sCSSColumns[7] = {0, 1, 2, 3, 4, 5, 6}; // xxs...xxl
static PRInt32 sHTMLColumns[7] = {1, 2, 3, 4, 5, 6, 7}; // 1...7
double dFontSize;
if (aFontSizeType == eFontSize_HTML) {
aHTMLSize--; // input as 1-7
}
if (aHTMLSize < 0)
aHTMLSize = 0;
else if (aHTMLSize > 6)
aHTMLSize = 6;
PRInt32* column;
switch (aFontSizeType)
{
case eFontSize_HTML: column = sHTMLColumns; break;
case eFontSize_CSS: column = sCSSColumns; break;
}
// Make special call specifically for fonts (needed PrintPreview)
float t2p;
aPresContext->GetTwipsToPixelsForFonts(&t2p);
PRInt32 fontSize = NSTwipsToIntPixels(aBasePointSize, t2p);
if ((fontSize >= sFontSizeTableMin) && (fontSize <= sFontSizeTableMax))
{
float p2t;
aPresContext->GetPixelsToTwips(&p2t);
PRInt32 row = fontSize - sFontSizeTableMin;
nsCompatibility mode;
aPresContext->GetCompatibilityMode(&mode);
if (mode == eCompatibility_NavQuirks) {
dFontSize = NSIntPixelsToTwips(sQuirksFontSizeTable[row][column[aHTMLSize]], p2t);
} else {
dFontSize = NSIntPixelsToTwips(sStrictFontSizeTable[row][column[aHTMLSize]], p2t);
}
}
else
{
PRInt32 factor = sFontSizeFactors[column[aHTMLSize]];
dFontSize = (factor * aBasePointSize) / 100;
}
dFontSize *= aScalingFactor;
if (1.0 < dFontSize) {
return (nscoord)dFontSize;
}
return (nscoord)1;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
nscoord nsStyleUtil::CalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
#if DUMP_FONT_SIZES
extern void DumpFontSizes(nsIPresContext* aPresContext);
DumpFontSizes(aPresContext);
#endif
if (UseNewFontAlgorithm())
return NewCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType);
else
return OldCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor);
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
PRInt32 nsStyleUtil::FindNextSmallerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
PRInt32 index;
PRInt32 indexMin;
PRInt32 indexMax;
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
if (aFontSizeType == eFontSize_HTML) {
indexMin = 1;
indexMax = 7;
} else {
indexMin = 0;
indexMax = 6;
}
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) < fontSize) {
if (fontSize <= NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
for (index = indexMax; index > indexMin; index--)
if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
break;
}
else { // larger than HTML table
return indexMax;
// for (index = 8; ; index++)
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
// index--;
// break;
// }
}
}
else { // smaller than HTML table
return indexMin;
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
// break;
// }
}
return index;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
PRInt32 nsStyleUtil::FindNextLargerFontSize(nscoord aFontSize, PRInt32 aBasePointSize,
float aScalingFactor, nsIPresContext* aPresContext,
nsFontSizeType aFontSizeType)
{
PRInt32 index;
PRInt32 indexMin;
PRInt32 indexMax;
PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize);
if (aFontSizeType == eFontSize_HTML) {
indexMin = 1;
indexMax = 7;
} else {
indexMin = 0;
indexMax = 6;
}
if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) <= fontSize) {
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table
for (index = indexMin; index < indexMax; index++)
if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)))
break;
}
else { // larger than HTML table
return indexMax;
// for (index = 8; ; index++)
// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext)))
// break;
}
}
else { // smaller than HTML table
return indexMin;
// for (index = 0; -25<index ; index--) //prevent infinite loop (bug 17045)
// if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) {
// index++;
// break;
// }
}
return index;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
PRInt32
nsStyleUtil::ConstrainFontWeight(PRInt32 aWeight)
{
aWeight = ((aWeight < 100) ? 100 : ((aWeight > 900) ? 900 : aWeight));
PRInt32 base = ((aWeight / 100) * 100);
PRInt32 step = (aWeight % 100);
PRBool negativeStep = PRBool(50 < step);
PRInt32 maxStep;
if (negativeStep) {
step = 100 - step;
maxStep = (base / 100);
base += 100;
}
else {
maxStep = ((900 - base) / 100);
}
if (maxStep < step) {
step = maxStep;
}
return (base + ((negativeStep) ? -step : step));
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
const nsStyleBackground* nsStyleUtil::FindNonTransparentBackground(nsIStyleContext* aContext,
PRBool aStartAtParent /*= PR_FALSE*/)
{
const nsStyleBackground* result = nsnull;
nsIStyleContext* context;
if (aStartAtParent) {
context = aContext->GetParent(); // balance ending release
} else {
context = aContext;
NS_IF_ADDREF(context); // balance ending release
}
NS_ASSERTION( context != nsnull, "Cannot find NonTransparentBackground in a null context" );
while (nsnull != context) {
result = (const nsStyleBackground*)context->GetStyleData(eStyleStruct_Background);
if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
break;
}
else {
nsIStyleContext* last = context;
context = context->GetParent();
NS_RELEASE(last);
}
}
NS_IF_RELEASE(context);
return result;
}
/*static*/
PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent, nsIAtom *aTag, nsIPresContext *aPresContext, nsLinkState *aState)
{
NS_ASSERTION(aContent && aState, "null arg in IsHTMLLink");
// check for:
// - HTML ANCHOR with valid HREF
// - HTML LINK with valid HREF
// - HTML AREA with valid HREF
PRBool result = PR_FALSE;
if ((aTag == nsHTMLAtoms::a) ||
(aTag == nsHTMLAtoms::link) ||
(aTag == nsHTMLAtoms::area)) {
nsCOMPtr<nsILink> link( do_QueryInterface(aContent) );
// In XML documents, this can be null.
if (link) {
nsLinkState linkState;
link->GetLinkState(linkState);
if (linkState == eLinkState_Unknown) {
// if it is an anchor, area or link then check the href attribute
// make sure this anchor has a link even if we are not testing state
// if there is no link, then this anchor is not really a linkpseudo.
// bug=23209
char* href;
link->GetHrefCString(href);
if (href) {
nsILinkHandler *linkHandler = nsnull;
aPresContext->GetLinkHandler(&linkHandler);
if (linkHandler) {
linkHandler->GetLinkState(href, linkState);
NS_RELEASE(linkHandler);
}
else {
// no link handler? then all links are unvisited
linkState = eLinkState_Unvisited;
}
nsCRT::free(href);
} else {
linkState = eLinkState_NotLink;
}
link->SetLinkState(linkState);
}
if (linkState != eLinkState_NotLink) {
*aState = linkState;
result = PR_TRUE;
}
}
}
return result;
}
/*static*/
PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresContext, nsLinkState *aState)
{
// XXX PERF This function will cause serious performance problems on
// pages with lots of XLinks. We should be caching the visited
// state of the XLinks. Where???
NS_ASSERTION(aContent && aState, "invalid call to IsXlink with null content");
PRBool rv = PR_FALSE;
if (aContent && aState) {
// first see if we have an XML element
nsCOMPtr<nsIXMLContent> xml(do_QueryInterface(aContent));
if (xml) {
// see if it is type=simple (we don't deal with other types)
nsAutoString val;
aContent->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::type, val);
if (val == NS_LITERAL_STRING("simple")) {
// see if there is an xlink namespace'd href attribute:
// - get it if there is, if not no big deal, it is not required for xlinks
// is it bad to re-use val here?
aContent->GetAttr(kNameSpaceID_XLink, nsHTMLAtoms::href, val);
// It's an XLink. Resolve it relative to its document.
nsCOMPtr<nsIURI> baseURI;
nsCOMPtr<nsIHTMLContent> htmlContent = do_QueryInterface(aContent);
if (htmlContent) {
// XXX why do this? will nsIHTMLContent's
// GetBaseURL() may return something different
// than the URL of the document it lives in?
htmlContent->GetBaseURL(*getter_AddRefs(baseURI));
}
else {
nsCOMPtr<nsIDocument> doc;
aContent->GetDocument(*getter_AddRefs(doc));
if (doc) {
doc->GetBaseURL(*getter_AddRefs(baseURI));
}
}
// convert here, rather than twice in NS_MakeAbsoluteURI and
// back again
char * href = ToNewCString(val);
char * absHREF = nsnull;
(void) NS_MakeAbsoluteURI(&absHREF, href, baseURI);
nsCRT::free(href);
nsILinkHandler *linkHandler = nsnull;
aPresContext->GetLinkHandler(&linkHandler);
if (linkHandler) {
linkHandler->GetLinkState(absHREF, *aState);
NS_RELEASE(linkHandler);
}
else {
// no link handler? then all links are unvisited
*aState = eLinkState_Unvisited;
}
nsCRT::free(absHREF);
rv = PR_TRUE;
}
}
}
return rv;
}
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
#if DUMP_FONT_SIZES
#include "nsIDeviceContext.h"
PRInt32 RoundSize(nscoord aVal, nsIPresContext* aPresContext, bool aWinRounding)
{
PRInt32 lfHeight;
nsIDeviceContext* dc;
aPresContext->GetDeviceContext(&dc);
float app2dev, app2twip, scale;
dc->GetAppUnitsToDevUnits(app2dev);
if (aWinRounding)
{
dc->GetDevUnitsToTwips(app2twip);
dc->GetCanonicalPixelScale(scale);
app2twip *= app2dev * scale;
// This interesting bit of code rounds the font size off to the floor point
// value. This is necessary for proper font scaling under windows.
PRInt32 sizePoints = NSTwipsToFloorIntPoints(nscoord(aVal*app2twip));
float rounded = ((float)NSIntPointsToTwips(sizePoints)) / app2twip;
// round font size off to floor point size to be windows compatible
// this is proper (windows) rounding
// lfHeight = NSToIntRound(rounded * app2dev);
// this floor rounding is to make ours compatible with Nav 4.0
lfHeight = long(rounded * app2dev);
return lfHeight;
}
else
return NSToIntRound(aVal*app2dev);
}
#endif
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
#if DUMP_FONT_SIZES
void DumpFontSizes(nsIPresContext* aPresContext)
{
static gOnce = true;
if (gOnce)
{
gOnce = false;
PRInt32 baseSize;
PRInt32 htmlSize;
PRInt32 cssSize;
nscoord val;
nscoord oldVal;
nsIDeviceContext* dc;
aPresContext->GetDeviceContext(&dc);
float dev2app;
dc->GetDevUnitsToAppUnits(dev2app);
bool doWinRounding = true;
for (short i=0; i<2; i ++)
{
doWinRounding ^= true;
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" CSS \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
printf("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" xx-small x-small small medium large x-large xx-large\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (cssSize = 0; cssSize <= 6; cssSize++) {
oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
}
printf("\n");
}
printf("\n\n\n");
printf("---------------------------------------------------------------\n");
printf(" HTML \n");
printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF"));
printf("---------------------------------------------------------------\n");
printf("\n");
printf("NEW SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
printf("%2d ", RoundSize(val, aPresContext, false));
}
printf("\n");
}
printf("\n");
printf("OLD SIZES:\n");
printf("----------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
printf("%2d ", RoundSize(val, aPresContext, doWinRounding));
}
printf("\n");
}
printf("\n");
printf("DIFFS:\n");
printf("------\n");
printf(" #1 #2 #3 #4 #5 #6 #7\n");
for (baseSize = 9; baseSize <= 20; baseSize++) {
printf("%2d: ", baseSize);
for (htmlSize = 1; htmlSize <= 7; htmlSize++) {
oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f);
val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML);
if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8)
printf(" .");
else
printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding)));
printf(" ");
}
printf("\n");
}
printf("\n\n\n");
}
}
}
#endif

View File

@@ -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

View File

@@ -1,4 +1,5 @@
#!/bin/sh
#!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
@@ -9,23 +10,26 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
# The Original Code is Crocodile Clips Ltd code.
#
# The Initial Developer of the Original Code is
# Andreas Franke <afranke@ags.uni-sb.de>.
# Corporation. Portions created by Andreas Franke are
# Copyright (C) 2001 Andreas Franke. All
# Crocodile Clips Ltd. Portions created by Crocodile Clips are
# Copyright (C) 2001 Crocodile Clips Ltd. All
# Rights Reserved.
#
# Contributor(s):
#
# Alex Fritze <alex.fritze@crocodile-clips.com>
#
buglist="`dirname $0`/buglist"
htmlfile="`dirname $0`/buglist.html"
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = src
include $(topsrcdir)/config/rules.mk
${buglist} "$@" 2>&1 1>${htmlfile}
if test ${?} == "0"; then
echo `grep 'TR VALIGN=TOP ALIGN=LEFT CLASS=' ${htmlfile} | sed -e 's/<TR.*id=//' | sed -e 's/".*//'` | sed -e 's/ /\,/g'
else
cat ${htmlfile} 1>&2
exit 1
fi

View File

@@ -0,0 +1,29 @@
#!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 <alex.fritze@crocodile-clips.com>
#
DEPTH=..\..\..
DIRS=src
include <$(DEPTH)\config\rules.mak>

View File

@@ -0,0 +1,4 @@
nsISVGValue.h
nsISVGValueObserver.h
nsISVGAttribute.h
nsISVGStyleValue.h

View File

@@ -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)

View File

@@ -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 <alex.fritze@crocodile-clips.com>
#
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

View File

@@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGATTRIBUTE_H__
#define __NS_ISVGATTRIBUTE_H__
#include "nsIDOMAttr.h"
class nsISVGValue;
////////////////////////////////////////////////////////////////////////
// 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 } }
class nsISVGAttribute : public nsIDOMAttr
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISVGATTRIBUTE_IID; return iid; }
NS_IMETHOD GetSVGValue(nsISVGValue** value) = 0;
};
#endif // __NS_ISVGATTRIBUTE_H__

View File

@@ -0,0 +1,61 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla SVG project.
*
* The Initial Developer of the Original Code is
* Crocodile Clips Ltd..
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_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; }
NS_IMETHOD GetStyleRule(nsIDocument* baseDocument, nsIStyleRule** rule)=0;
};
#endif // __NS_ISVGSTYLEVALUE_H__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_ISVGVALUE_H__
#define __NS_ISVGVALUE_H__
#include "nsISupports.h"
#include "nsString.h"
class nsISVGValueObserver;
////////////////////////////////////////////////////////////////////////
// nsISVGValue: private interface for svg values
/* This interface is implemented by all value-types (e.g. coords,
pointlists, matrices) that can be parsed from/to strings. This is
used for element-properties that are also XML attributes. E.g. the
'polyline'-element has a 'points'-attribute and a property
'animatedPoints' in the DOM.
XXX Observers
*/
// {79293232-F695-4bda-9FC7-C2679647B790}
#define NS_ISVGVALUE_IID \
{ 0x79293232, 0xf695, 0x4bda, { 0x9f, 0xc7, 0xc2, 0x67, 0x96, 0x47, 0xb7, 0x90 } }
class nsISVGValue : public nsISupports
{
public:
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__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_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__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGValue.h"
#include "nsWeakReference.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
////////////////////////////////////////////////////////////////////////
// nsSVGAnimatedLength
class nsSVGAnimatedLength : public nsIDOMSVGAnimatedLength,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult NS_NewSVGAnimatedLength(nsIDOMSVGAnimatedLength** result,
nsIDOMSVGLength* baseVal);
nsSVGAnimatedLength();
~nsSVGAnimatedLength();
void Init(nsIDOMSVGLength* baseVal);
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGAnimatedLength interface:
NS_DECL_NSIDOMSVGANIMATEDLENGTH
// remainder of nsISVGValue interface:
NS_IMETHOD SetValueString(const 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<nsIDOMSVGLength> mBaseVal;
};
//----------------------------------------------------------------------
// Implementation
nsSVGAnimatedLength::nsSVGAnimatedLength()
{
NS_INIT_ISUPPORTS();
}
nsSVGAnimatedLength::~nsSVGAnimatedLength()
{
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
if (!val) return;
val->RemoveObserver(this);
}
void
nsSVGAnimatedLength::Init(nsIDOMSVGLength* baseVal)
{
mBaseVal = baseVal;
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
NS_ASSERTION(val, "baseval needs to implement nsISVGValue interface");
if (!val) return;
val->AddObserver(this);
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGAnimatedLength)
NS_IMPL_RELEASE(nsSVGAnimatedLength)
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedLength)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedLength)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedLength)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGAnimatedLength::SetValueString(const nsAReadableString& aValue)
{
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->SetValueString(aValue);
}
NS_IMETHODIMP
nsSVGAnimatedLength::GetValueString(nsAWritableString& aValue)
{
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->GetValueString(aValue);
}
//----------------------------------------------------------------------
// nsIDOMSVGAnimatedLength methods:
/* readonly attribute nsIDOMSVGLength baseVal; */
NS_IMETHODIMP
nsSVGAnimatedLength::GetBaseVal(nsIDOMSVGLength * *aBaseVal)
{
*aBaseVal = mBaseVal;
NS_ADDREF(*aBaseVal);
return NS_OK;
}
/* readonly attribute nsIDOMSVGLength animVal; */
NS_IMETHODIMP
nsSVGAnimatedLength::GetAnimVal(nsIDOMSVGLength * *aAnimVal)
{
*aAnimVal = mBaseVal;
NS_ADDREF(*aAnimVal);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGAnimatedLength::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGAnimatedLength::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions
nsresult
NS_NewSVGAnimatedLength(nsIDOMSVGAnimatedLength** aResult,
nsIDOMSVGLength* baseVal)
{
*aResult = nsnull;
nsSVGAnimatedLength* animatedLength = new nsSVGAnimatedLength();
if(!animatedLength) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(animatedLength);
// nsCOMPtr<nsIDOMSVGLength> baseVal;
// NS_NewSVGLength(getter_AddRefs(baseVal), owner);
animatedLength->Init(baseVal);
*aResult = (nsIDOMSVGAnimatedLength*) animatedLength;
return NS_OK;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGANIMATEDLENGTH_H__
#define __NS_SVGANIMATEDLENGTH_H__
#include "nsIDOMSVGAnimatedLength.h"
#include "nsIDOMSVGLength.h"
nsresult NS_NewSVGAnimatedLength(nsIDOMSVGAnimatedLength** result,
nsIDOMSVGLength* baseVal);
#endif //__NS_SVGANIMATEDLENGTH_H__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "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<nsIDOMSVGRect> mBaseVal;
};
//----------------------------------------------------------------------
// Implementation
nsSVGAnimatedRect::nsSVGAnimatedRect()
{
NS_INIT_ISUPPORTS();
}
nsSVGAnimatedRect::~nsSVGAnimatedRect()
{
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
if (!val) return;
val->RemoveObserver(this);
}
void
nsSVGAnimatedRect::Init(nsIDOMSVGRect* baseVal)
{
mBaseVal = baseVal;
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> 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<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->SetValueString(aValue);
}
NS_IMETHODIMP
nsSVGAnimatedRect::GetValueString(nsAWritableString& aValue)
{
nsCOMPtr<nsISVGValue> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGANIMATEDRECT_H__
#define __NS_SVGANIMATEDRECT_H__
#include "nsIDOMSVGAnimatedRect.h"
#include "nsIDOMSVGRect.h"
nsresult
NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result,
nsIDOMSVGRect* baseVal);
#endif //__NS_SVGANIMATEDRECT_H__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "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<nsIDOMSVGTransformList> mBaseVal;
};
//----------------------------------------------------------------------
// Implementation
nsSVGAnimatedTransformList::nsSVGAnimatedTransformList()
{
NS_INIT_ISUPPORTS();
}
nsSVGAnimatedTransformList::~nsSVGAnimatedTransformList()
{
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
if (!val) return;
val->RemoveObserver(this);
}
void
nsSVGAnimatedTransformList::Init(nsIDOMSVGTransformList* baseVal)
{
mBaseVal = baseVal;
if (!mBaseVal) return;
nsCOMPtr<nsISVGValue> 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<nsISVGValue> value = do_QueryInterface(mBaseVal);
return value->SetValueString(aValue);
}
NS_IMETHODIMP
nsSVGAnimatedTransformList::GetValueString(nsAWritableString& aValue)
{
nsCOMPtr<nsISVGValue> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGANIMATEDTRANSFORMLIST_H__
#define __NS_SVGANIMATEDTRANSFORMLIST_H__
#include "nsIDOMSVGAnimTransformList.h"
#include "nsIDOMSVGTransformList.h"
nsresult
NS_NewSVGAnimatedTransformList(nsIDOMSVGAnimatedTransformList** result,
nsIDOMSVGTransformList* baseVal);
#endif //__NS_SVGANIMATEDTRANSFORMLIST_H__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "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<nsISVGValue> 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<nsIAtom> 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; i<count; ++i) {
if (mAttributes.ElementAt(i) == attrib)
return PR_TRUE;
}
return PR_FALSE;
}
PRBool
nsSVGAttributes::IsMappedAttribute(nsSVGAttribute* attrib)
{
PRInt32 count = mMappedAttributes.Count();
for (PRInt32 i=0; i<count; ++i) {
if (mMappedAttributes.ElementAt(i) == attrib)
return PR_TRUE;
}
return PR_FALSE;
}
nsSVGAttribute*
nsSVGAttributes::ElementAt(PRInt32 i) const
{
return (nsSVGAttribute*)mAttributes.ElementAt(i);
}
void
nsSVGAttributes::AppendElement(nsSVGAttribute* aElement)
{
aElement->mOwner = 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<nsIDocument> 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<nsIAtom> name;
PRInt32 nameSpaceID;
aNodeInfo->GetNameAtom(*getter_AddRefs(name));
aNodeInfo->GetNamespaceID(nameSpaceID);
nsCOMPtr<nsIBindingManager> bindingManager;
document->GetBindingManager(getter_AddRefs(bindingManager));
nsCOMPtr<nsIXBLBinding> 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<nsIDOMEventTarget> 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<nsIDOMEvent> 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<nsIDocument> 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<nsIDOMEventTarget> 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<nsIDOMEvent> 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<nsIBindingManager> bindingManager;
document->GetBindingManager(getter_AddRefs(bindingManager));
nsCOMPtr<nsIXBLBinding> 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<nsINodeInfo> contentNodeInfo;
mContent->GetNodeInfo(*getter_AddRefs(contentNodeInfo));
nsCOMPtr<nsINodeInfoManager> 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<nsISVGValue> 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<nsINodeInfo> contentNodeInfo;
mContent->GetNodeInfo(*getter_AddRefs(contentNodeInfo));
nsCOMPtr<nsINodeInfoManager> nimgr;
contentNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
nsCOMPtr<nsINodeInfo> 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<nsINodeInfo> 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<nsIDOMElement> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGATTRIBUTES_H__
#define __NS_SVGATTRIBUTES_H__
#include "nsCOMPtr.h"
#include "nsISVGAttribute.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsString.h"
#include "nsIAtom.h"
#include "nsVoidArray.h"
#include "nsINodeInfo.h"
#include "nsISVGValue.h"
#include "nsISVGValueObserver.h"
#include "nsWeakReference.h"
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<nsINodeInfo> mNodeInfo;
nsCOMPtr<nsISVGValue> 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__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "nsIDOMSVGCircleElement.h"
#include "nsCOMPtr.h"
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<nsIDOMSVGAnimatedLength> mCx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mCy;
nsCOMPtr<nsIDOMSVGAnimatedLength> mR;
};
nsresult NS_NewSVGCircleElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGCircleElement* it = new nsSVGCircleElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGCircleElement,nsSVGCircleElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGCircleElement,nsSVGCircleElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGCircleElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGCircleElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGCircleElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGCircleElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGCircleElement::nsSVGCircleElement()
{
}
nsSVGCircleElement::~nsSVGCircleElement()
{
if (mCx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCx);
value->RemoveObserver(this);
}
if (mCy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCy);
value->RemoveObserver(this);
}
if (mR) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mR);
value->RemoveObserver(this);
}
}
nsresult
nsSVGCircleElement::Init()
{
nsresult rv;
rv = nsSVGCircleElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: cx , #IMPLIED attrib: cx
{
nsCOMPtr<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGElement.h"
#include "nsIDocument.h"
#include "nsRange.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMMutationEvent.h"
#include "nsMutationEvent.h"
#include "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<nsINodeInfoManager> nimgr;
rv = mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsINodeInfo> ni;
// Create mapped properties:
// style #IMPLIED
rv = NS_NewSVGStyleValue(getter_AddRefs(mStyle));
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::style, mStyle);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIContent methods
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<nsIDOMEventTarget> node(do_QueryInterface(aKid));
nsMutationEvent mutation;
mutation.eventStructType = NS_MUTATION_EVENT;
mutation.message = NS_MUTATION_NODEINSERTED;
mutation.mTarget = node;
nsCOMPtr<nsIDOMNode> relNode(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
mutation.mRelatedNode = relNode;
nsEventStatus status = nsEventStatus_eIgnore;
nsCOMPtr<nsIDOMEvent> 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<nsIDOMEventTarget> node(do_QueryInterface(aKid));
nsMutationEvent mutation;
mutation.eventStructType = NS_MUTATION_EVENT;
mutation.message = NS_MUTATION_NODEINSERTED;
mutation.mTarget = node;
nsCOMPtr<nsIDOMNode> relNode(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
mutation.mRelatedNode = relNode;
nsEventStatus status = nsEventStatus_eIgnore;
nsCOMPtr<nsIDOMEvent> 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<nsIDOMEventTarget> node(do_QueryInterface(oldKid));
nsMutationEvent mutation;
mutation.eventStructType = NS_MUTATION_EVENT;
mutation.message = NS_MUTATION_NODEREMOVED;
mutation.mTarget = node;
nsCOMPtr<nsIDOMNode> relNode(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this)));
mutation.mRelatedNode = relNode;
nsEventStatus status = nsEventStatus_eIgnore;
nsCOMPtr<nsIDOMEvent> 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<nsINodeInfoManager> nimgr;
mNodeInfo->GetNodeInfoManager(*getter_AddRefs(nimgr));
NS_ENSURE_TRUE(nimgr, NS_ERROR_FAILURE);
nsCOMPtr<nsINodeInfo> 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<nsIAtom> 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<nsIStyleRule> 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<nsIBindingManager> bindingManager;
if (mDocument) {
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
}
nsCOMPtr<nsIContent> parent;
if (bindingManager) {
// we have a binding manager -- do we have an anonymous parent?
bindingManager->GetInsertionParent(this, getter_AddRefs(parent));
}
if (!parent) {
// if we didn't find an anonymous parent, use the explicit one,
// whether it's null or not...
parent = mParent;
}
while (parent) {
nsCOMPtr<nsIDOMSVGSVGElement> SVGSVGElement = do_QueryInterface(parent);
if (SVGSVGElement) {
*aOwnerSVGElement = SVGSVGElement;
NS_ADDREF(*aOwnerSVGElement);
return NS_OK;
}
nsCOMPtr<nsIContent> next;
if (bindingManager) {
bindingManager->GetInsertionParent(parent, getter_AddRefs(next));
}
if (!next) {
// no anonymous parent, so use explicit one
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<nsIDOMSVGSVGElement> 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<nsIDOMSVGSVGElement> SVGSVGElement;
nsresult rv = GetOwnerSVGElement(getter_AddRefs(SVGSVGElement));
NS_ENSURE_SUCCESS(rv,rv);
if (SVGSVGElement) {
nsCOMPtr<nsIDOMSVGElement> SVGElement = do_QueryInterface(SVGSVGElement);
*aViewportElement = SVGElement;
NS_IF_ADDREF(*aViewportElement);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods:
NS_IMETHODIMP
nsSVGElement::WillModifySVGObservable(nsISVGValue* observable)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSVGElement::DidModifySVGObservable (nsISVGValue* observable)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------
// Implementation Helpers:
nsresult
nsSVGElement::CopyNode(nsSVGElement* dest, PRBool deep)
{
nsresult rv;
// copy attributes:
NS_ASSERTION(mAttributes, "null pointer");
NS_ASSERTION(dest->mAttributes, "null pointer");
rv = mAttributes->CopyAttributes(dest->mAttributes);
NS_ENSURE_SUCCESS(rv,rv);
if (deep) {
// copy children:
PRInt32 count = mChildren.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIContent* child = NS_STATIC_CAST(nsIContent*, mChildren[i]);
NS_ASSERTION(child != nsnull, "null ptr");
if (!child)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDOMNode> domchild = do_QueryInterface(child);
NS_ASSERTION(domchild != nsnull, "child is not a DOM node");
if (! domchild)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIDOMNode> newdomchild;
rv = domchild->CloneNode(PR_TRUE, getter_AddRefs(newdomchild));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIContent> newchild = do_QueryInterface(newdomchild);
NS_ASSERTION(newchild != nsnull, "newdomchild is not an nsIContent");
if (!newchild)
return NS_ERROR_UNEXPECTED;
rv = dest->AppendChildTo(newchild, PR_FALSE, PR_FALSE);
if (NS_FAILED(rv)) return rv;
}
}
return rv;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGELEMENT_H__
#define __NS_SVGELEMENT_H__
/*
nsSVGElement is the base class for all SVG content elements.
It implements all the common DOM interfaces and handles attributes.
*/
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsIDOMSVGElement.h"
#include "nsGenericElement.h"
#include "nsSVGAttributes.h"
#include "nsISVGValue.h"
#include "nsISVGValueObserver.h"
#include "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<nsINameSpace> mNameSpace;
nsCOMPtr<nsISVGStyleValue> mStyle;
};
#endif // __NS_SVGELEMENT_H__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsCOMPtr.h"
#include "nsIElementFactory.h"
#include "nsIAtom.h"
#include "nsINodeInfo.h"
#include "nsSVGAtoms.h"
#include "nsIXMLContent.h"
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<nsIAtom> 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<nsIContent> xmlContent;
nsresult rv;
rv = NS_NewXMLElement(getter_AddRefs(xmlContent), aNodeInfo);
*aResult = xmlContent;
NS_IF_ADDREF(*aResult);
return rv;
}

View File

@@ -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 <william.cook@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "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<nsIDOMSVGAnimatedLength> mCx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mCy;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRy;
};
nsresult NS_NewSVGEllipseElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGEllipseElement* it = new nsSVGEllipseElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGEllipseElement,nsSVGEllipseElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGEllipseElement,nsSVGEllipseElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGEllipseElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGEllipseElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGEllipseElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGEllipseElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGEllipseElement::nsSVGEllipseElement()
{
}
nsSVGEllipseElement::~nsSVGEllipseElement()
{
if (mCx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCx);
value->RemoveObserver(this);
}
if (mCy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mCy);
value->RemoveObserver(this);
}
if (mRx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRx);
value->RemoveObserver(this);
}
if (mRy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRy);
value->RemoveObserver(this);
}
}
nsresult
nsSVGEllipseElement::Init()
{
nsresult rv;
rv = nsSVGEllipseElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: cx , #IMPLIED attrib: cx
{
nsCOMPtr<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsIDOMSVGForeignObjectElem.h"
#include "nsSVGLength.h"
#include "nsSVGAnimatedLength.h"
#include "nsCOMPtr.h"
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<nsIDOMSVGAnimatedLength> mX;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY;
nsCOMPtr<nsIDOMSVGAnimatedLength> mWidth;
nsCOMPtr<nsIDOMSVGAnimatedLength> mHeight;
};
nsresult NS_NewSVGForeignObjectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGForeignObjectElement* it = new nsSVGForeignObjectElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGForeignObjectElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGForeignObjectElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGForeignObjectElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGForeignObjectElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGForeignObjectElement::nsSVGForeignObjectElement()
{
}
nsSVGForeignObjectElement::~nsSVGForeignObjectElement()
{
if (mX) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX);
value->RemoveObserver(this);
}
if (mY) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY);
value->RemoveObserver(this);
}
if (mWidth) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mWidth);
value->RemoveObserver(this);
}
if (mHeight) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mHeight);
value->RemoveObserver(this);
}
}
nsresult
nsSVGForeignObjectElement::Init()
{
nsresult rv;
rv = nsSVGForeignObjectElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: x , #IMPLIED attrib: x
{
nsCOMPtr<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsIDOMSVGGElement.h"
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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGValue.h"
////////////////////////////////////////////////////////////////////////
// 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGTransformList.h"
#include "nsSVGAnimatedTransformList.h"
#include "nsSVGAtoms.h"
#include "nsSVGMatrix.h"
#include "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<nsIDOMSVGTransformList> transformList;
rv = nsSVGTransformList::Create(getter_AddRefs(transformList));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mTransforms),
transformList);
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::transform, mTransforms);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGLocatable methods
/* readonly attribute nsIDOMSVGElement nearestViewportElement; */
NS_IMETHODIMP nsSVGGraphicElement::GetNearestViewportElement(nsIDOMSVGElement * *aNearestViewportElement)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMSVGElement farthestViewportElement; */
NS_IMETHODIMP nsSVGGraphicElement::GetFarthestViewportElement(nsIDOMSVGElement * *aFarthestViewportElement)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGRect getBBox (); */
NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGMatrix getCTM (); */
NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval)
{
nsCOMPtr<nsIDOMSVGMatrix> CTM;
nsCOMPtr<nsIBindingManager> bindingManager;
if (mDocument) {
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
}
nsCOMPtr<nsIContent> parent;
if (bindingManager) {
// we have a binding manager -- do we have an anonymous parent?
bindingManager->GetInsertionParent(this, getter_AddRefs(parent));
}
if (!parent) {
// if we didn't find an anonymous parent, use the explicit one,
// whether it's null or not...
parent = mParent;
}
while (parent) {
nsCOMPtr<nsIDOMSVGSVGElement> viewportElement = do_QueryInterface(parent);
if (viewportElement) {
// Our nearest SVG parent is a viewport element.
viewportElement->GetViewboxToViewportTransform(getter_AddRefs(CTM));
break;
}
nsCOMPtr<nsIDOMSVGLocatable> locatableElement = do_QueryInterface(parent);
if (locatableElement) {
// Our nearest SVG parent is a locatable object that is not a
// viewport. Its GetCTM function will give us a ctm from the
// viewport to itself:
locatableElement->GetCTM(getter_AddRefs(CTM));
break;
}
// Our parent was not svg content. We allow interdispersed non-SVG
// content to coexist with XBL. Loop until we find the first SVG
// parent.
nsCOMPtr<nsIContent> next;
if (bindingManager) {
bindingManager->GetInsertionParent(parent, getter_AddRefs(next));
}
if (!next) {
// no anonymous parent, so use explicit one
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<nsIDOMSVGTransformList> transforms;
mTransforms->GetAnimVal(getter_AddRefs(transforms));
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMSVGMatrix> matrix;
transforms->GetConsolidation(getter_AddRefs(matrix));
return CTM->Multiply(matrix, _retval);
}
/* nsIDOMSVGMatrix getScreenCTM (); */
NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix **_retval)
{
nsCOMPtr<nsIDOMSVGMatrix> screenCTM;
nsCOMPtr<nsIBindingManager> bindingManager;
if (mDocument) {
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
}
nsCOMPtr<nsIContent> parent;
if (bindingManager) {
// we have a binding manager -- do we have an anonymous parent?
bindingManager->GetInsertionParent(this, getter_AddRefs(parent));
}
if (!parent) {
// if we didn't find an anonymous parent, use the explicit one,
// whether it's null or not...
parent = mParent;
}
while (parent) {
nsCOMPtr<nsIDOMSVGLocatable> locatableElement = do_QueryInterface(parent);
if (locatableElement) {
nsCOMPtr<nsIDOMSVGMatrix> ctm;
locatableElement->GetScreenCTM(getter_AddRefs(ctm));
if (!ctm) break;
nsCOMPtr<nsIDOMSVGSVGElement> viewportElement = do_QueryInterface(parent);
if (viewportElement) {
// It is a viewport element. we need to append the viewbox xform:
nsCOMPtr<nsIDOMSVGMatrix> matrix;
viewportElement->GetViewboxToViewportTransform(getter_AddRefs(matrix));
ctm->Multiply(matrix, getter_AddRefs(screenCTM));
}
else
screenCTM = ctm;
break;
}
// Our parent was not svg content. We allow interdispersed non-SVG
// content to coexist with XBL. Loop until we find the first SVG
// parent.
nsCOMPtr<nsIContent> next;
if (bindingManager) {
bindingManager->GetInsertionParent(parent, getter_AddRefs(next));
}
if (!next) {
// no anonymous parent, so use explicit one
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<nsIDOMSVGTransformList> transforms;
mTransforms->GetAnimVal(getter_AddRefs(transforms));
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMSVGMatrix> matrix;
transforms->GetConsolidation(getter_AddRefs(matrix));
return screenCTM->Multiply(matrix, _retval);
}
/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
NS_IMETHODIMP nsSVGGraphicElement::GetTransformToElement(nsIDOMSVGElement *element, nsIDOMSVGMatrix **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------
// nsIDOMSVGTransformable methods
/* readonly attribute nsIDOMSVGAnimatedTransformList transform; */
NS_IMETHODIMP nsSVGGraphicElement::GetTransform(nsIDOMSVGAnimatedTransformList * *aTransform)
{
*aTransform = mTransforms;
NS_IF_ADDREF(*aTransform);
return NS_OK;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGGRAPHICELEMENT_H__
#define __NS_SVGGRAPHICELEMENT_H__
#include "nsSVGElement.h"
#include "nsIDOMSVGLocatable.h"
#include "nsIDOMSVGTransformable.h"
#include "nsIDOMSVGAnimTransformList.h"
typedef nsSVGElement nsSVGGraphicElementBase;
class nsSVGGraphicElement : public nsSVGGraphicElementBase,
public nsIDOMSVGTransformable // : nsIDOMSVGLocatable
{
protected:
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGLOCATABLE
NS_DECL_NSIDOMSVGTRANSFORMABLE
protected:
nsCOMPtr<nsIDOMSVGAnimatedTransformList> mTransforms;
};
#endif // __NS_SVGGRAPHICELEMENT_H__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGLength.h"
#include "prdtoa.h"
#include "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 <math.h>
////////////////////////////////////////////////////////////////////////
// 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<nsIWeakReference> 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<nsIDOMSVGLocatable> locatable;
// locatable = do_QueryInterface(mOwnerElement);
// if (!locatable) return UUPerPx;
// nsCOMPtr<nsIDOMSVGMatrix> matrix;
// locatable->GetCTM( getter_AddRefs(matrix) );
// if (!matrix) return UUPerPx;
// nsCOMPtr<nsIDOMSVGPoint> point, XFormedPoint;
// nsSVGPoint::Create(1.0, 1.0, getter_AddRefs(point));
// point->MatrixTransform(matrix, getter_AddRefs(XFormedPoint));
// switch (mDirection) {
// case eXDirection:
// XFormedPoint->GetX(&UUPerPx);
// break;
// case eYDirection:
// XFormedPoint->GetY(&UUPerPx);
// break;
// case eNoDirection:
// {
// float x,y;
// XFormedPoint->GetX(&x);
// XFormedPoint->GetY(&y);
// UUPerPx = (x==y ? x : (x+y)/2);
// break;
// }
// }
// if (UUPerPx == 0.0f) {
// NS_ASSERTION(PR_FALSE, "invalid uu/pixels");
// UUPerPx = 1e-20f; // some small value
// }
return UUPerPx;
}
float nsSVGLength::mmPerPixel()
{
float mmPerPx = 0.28f; // 90dpi by default
if (!mOwnerElementRef) return mmPerPx;
nsCOMPtr<nsIDOMSVGElement> ownerElement = do_QueryReferent(mOwnerElementRef);
if (!ownerElement) return mmPerPx;
nsCOMPtr<nsIDOMSVGSVGElement> 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<nsIDOMSVGElement> ownerElement = do_QueryReferent(mOwnerElementRef);
NS_ASSERTION(ownerElement, "need owner");
if (!ownerElement) return d;
// find element that establishes the current viewport:
nsCOMPtr<nsIDOMSVGElement> 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<nsIDOMSVGSVGElement> SVGElement = do_QueryInterface(vpElement);
NS_ASSERTION(SVGElement, "need svg element to obtain vieport");
if (!SVGElement) return d;
nsCOMPtr<nsIDOMSVGRect> 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<nsIAtom> 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);
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGLENGTH_H__
#define __NS_SVGLENGTH_H__
#include "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__

View File

@@ -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 <william.cook@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "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<nsIDOMSVGAnimatedLength> mX1;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY1;
nsCOMPtr<nsIDOMSVGAnimatedLength> mX2;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY2;
};
nsresult NS_NewSVGLineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGLineElement* it = new nsSVGLineElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGLineElement,nsSVGLineElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGLineElement,nsSVGLineElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGLineElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLineElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGLineElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGLineElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGLineElement::nsSVGLineElement()
{
}
nsSVGLineElement::~nsSVGLineElement()
{
if (mX1) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX1);
value->RemoveObserver(this);
}
if (mY1) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY1);
value->RemoveObserver(this);
}
if (mX2) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX2);
value->RemoveObserver(this);
}
if (mY2) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY2);
value->RemoveObserver(this);
}
}
nsresult
nsSVGLineElement::Init()
{
nsresult rv;
rv = nsSVGLineElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: x1 , #IMPLIED attrib: x1
{
nsCOMPtr<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGMatrix.h"
#include <math.h>
const double radPerDegree = 2.0*3.1415926535 / 360.0;
nsresult
nsSVGMatrix::Create(nsIDOMSVGMatrix** aResult)
{
*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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGMATRIX_H__
#define __NS_SVGMATRIX_H__
#include "nsIDOMSVGMatrix.h"
#include "nsSVGValue.h"
class nsSVGMatrix : public nsIDOMSVGMatrix,
public nsSVGValue
{
public:
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__

File diff suppressed because it is too large Load Diff

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGPATHDATAPARSER_H__
#define __NS_SVGPATHDATAPARSER_H__
#include "nsCOMPtr.h"
#include "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<nsIDOMSVGPathSegList> 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__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGPathSegList.h"
#include "nsIDOMSVGPathElement.h"
#include "nsIDOMSVGAnimatedPathData.h"
#include "nsCOMPtr.h"
typedef nsSVGGraphicElement nsSVGPathElementBase;
class nsSVGPathElement : public nsSVGPathElementBase,
public nsIDOMSVGPathElement,
public nsIDOMSVGAnimatedPathData
{
protected:
friend nsresult NS_NewSVGPathElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo);
nsSVGPathElement();
virtual ~nsSVGPathElement();
virtual nsresult Init();
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGPATHELEMENT
NS_DECL_NSIDOMSVGANIMATEDPATHDATA
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsSVGPathElementBase::)
NS_FORWARD_NSIDOMELEMENT(nsSVGPathElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGPathElementBase::)
protected:
nsCOMPtr<nsIDOMSVGPathSegList> mSegments;
};
nsresult NS_NewSVGPathElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGPathElement* it = new nsSVGPathElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGPathElement,nsSVGPathElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGPathElement,nsSVGPathElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGPathElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPathElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedPathData)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPathElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGPathElement::nsSVGPathElement()
{
}
nsSVGPathElement::~nsSVGPathElement()
{
if (mSegments) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mSegments);
value->RemoveObserver(this);
}
}
nsresult
nsSVGPathElement::Init()
{
nsresult rv;
rv = nsSVGPathElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// d #REQUIRED
rv = NS_NewSVGPathSegList(getter_AddRefs(mSegments));
NS_ENSURE_SUCCESS(rv,rv);
rv = mAttributes->AddMappedSVGValue(nsSVGAtoms::d, mSegments);
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMETHODIMP
nsSVGPathElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
*aReturn = nsnull;
nsSVGPathElement* it = new nsSVGPathElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(mNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = CopyNode(it, aDeep);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aReturn = NS_STATIC_CAST(nsSVGPathElementBase*, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGPathElement methods:
/* readonly attribute nsIDOMSVGAnimatedNumber pathLength; */
NS_IMETHODIMP
nsSVGPathElement::GetPathLength(nsIDOMSVGAnimatedNumber * *aPathLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* float getTotalLength (); */
NS_IMETHODIMP
nsSVGPathElement::GetTotalLength(float *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPoint getPointAtLength (in float distance); */
NS_IMETHODIMP
nsSVGPathElement::GetPointAtLength(float distance, nsIDOMSVGPoint **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long getPathSegAtLength (in float distance); */
NS_IMETHODIMP
nsSVGPathElement::GetPathSegAtLength(float distance, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPathSegClosePath createSVGPathSegClosePath (); */
NS_IMETHODIMP
nsSVGPathElement::CreateSVGPathSegClosePath(nsIDOMSVGPathSegClosePath **_retval)
{
return NS_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;
}

File diff suppressed because it is too large Load Diff

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGPATHSEG_H__
#define __NS_SVGPATHSEG_H__
#include "nsIDOMSVGPathSeg.h"
nsresult
NS_NewSVGPathSegClosePath(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__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGPathSegList.h"
#include "nsSVGPathSeg.h"
#include "nsSVGValue.h"
#include "nsWeakReference.h"
#include "nsVoidArray.h"
#include "nsDOMError.h"
#include "nsSVGPathDataParser.h"
#include "nsReadableUtils.h"
////////////////////////////////////////////////////////////////////////
// nsSVGPathSegList
class nsSVGPathSegList : public nsIDOMSVGPathSegList,
public nsSVGValue,
public nsISVGValueObserver,
public nsSupportsWeakReference
{
protected:
friend nsresult NS_NewSVGPathSegList(nsIDOMSVGPathSegList** result);
nsSVGPathSegList();
~nsSVGPathSegList();
// void Init();
public:
// nsISupports interface:
NS_DECL_ISUPPORTS
// nsIDOMSVGPathSegList interface:
NS_DECL_NSIDOMSVGPATHSEGLIST
// remainder of nsISVGValue interface:
NS_IMETHOD SetValueString(const 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<nsISVGValue> val = do_QueryInterface(seg);
NS_ASSERTION(val, "path segment doesn't implement required interface");
if (!val) continue;
nsAutoString str;
val->GetValueString(str);
aValue.Append(str);
if (++i >= count) break;
aValue.Append(NS_LITERAL_STRING(" "));
}
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGPathSegList methods:
/* readonly attribute unsigned long numberOfItems; */
NS_IMETHODIMP nsSVGPathSegList::GetNumberOfItems(PRUint32 *aNumberOfItems)
{
*aNumberOfItems = mSegments.Count();
return NS_OK;
}
/* void clear (); */
NS_IMETHODIMP nsSVGPathSegList::Clear()
{
WillModify();
ReleaseSegments();
DidModify();
return NS_OK;
}
/* nsIDOMSVGPathSeg initialize (in nsIDOMSVGPathSeg newItem); */
NS_IMETHODIMP nsSVGPathSegList::Initialize(nsIDOMSVGPathSeg *newItem, nsIDOMSVGPathSeg **_retval)
{
Clear();
return AppendItem(newItem, _retval);
}
/* nsIDOMSVGPathSeg getItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::GetItem(PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
if ((PRInt32)index >= mSegments.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIDOMSVGPathSeg insertItemBefore (in nsIDOMSVGPathSeg newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::InsertItemBefore(nsIDOMSVGPathSeg *newItem, PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
NS_NOTYETIMPLEMENTED("write me");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPathSeg replaceItem (in nsIDOMSVGPathSeg newItem, in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::ReplaceItem(nsIDOMSVGPathSeg *newItem, PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
NS_NOTYETIMPLEMENTED("write me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGPathSeg removeItem (in unsigned long index); */
NS_IMETHODIMP nsSVGPathSegList::RemoveItem(PRUint32 index, nsIDOMSVGPathSeg **_retval)
{
if ((PRInt32)index >= mSegments.Count()) {
*_retval = nsnull;
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
*_retval = ElementAt(index);
NS_ADDREF(*_retval);
WillModify();
RemoveElementAt(index);
DidModify();
return NS_OK;
}
/* nsIDOMSVGPathSeg appendItem (in nsIDOMSVGPathSeg newItem); */
NS_IMETHODIMP nsSVGPathSegList::AppendItem(nsIDOMSVGPathSeg *newItem, nsIDOMSVGPathSeg **_retval)
{
// XXX The SVG specs state that 'if newItem is already in a list, it
// is removed from its previous list before it is inserted into this
// list'. We don't do that. Should we?
*_retval = newItem;
NS_ADDREF(*_retval);
AppendElement(newItem);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods
NS_IMETHODIMP
nsSVGPathSegList::WillModifySVGObservable(nsISVGValue* observable)
{
WillModify();
return NS_OK;
}
NS_IMETHODIMP
nsSVGPathSegList::DidModifySVGObservable (nsISVGValue* observable)
{
DidModify();
return NS_OK;
}
//----------------------------------------------------------------------
// Implementation helpers
void
nsSVGPathSegList::ReleaseSegments()
{
WillModify();
PRInt32 count = mSegments.Count();
for (PRInt32 i = 0; i < count; ++i) {
nsIDOMSVGPathSeg* seg = ElementAt(i);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->RemoveObserver(this);
NS_RELEASE(seg);
}
mSegments.Clear();
DidModify();
}
nsIDOMSVGPathSeg*
nsSVGPathSegList::ElementAt(PRInt32 index)
{
return (nsIDOMSVGPathSeg*)mSegments.ElementAt(index);
}
void
nsSVGPathSegList::AppendElement(nsIDOMSVGPathSeg* aElement)
{
WillModify();
NS_ADDREF(aElement);
mSegments.AppendElement((void*)aElement);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
void
nsSVGPathSegList::RemoveElementAt(PRInt32 index)
{
WillModify();
nsIDOMSVGPathSeg* seg = ElementAt(index);
NS_ASSERTION(seg, "null pathsegment");
nsCOMPtr<nsISVGValue> val = do_QueryInterface(seg);
if (val)
val->RemoveObserver(this);
mSegments.RemoveElementAt(index);
NS_RELEASE(seg);
DidModify();
}
void
nsSVGPathSegList::InsertElementAt(nsIDOMSVGPathSeg* aElement, PRInt32 index)
{
WillModify();
NS_ADDREF(aElement);
mSegments.InsertElementAt((void*)aElement, index);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions:
nsresult
NS_NewSVGPathSegList(nsIDOMSVGPathSegList** result)
{
*result = nsnull;
nsSVGPathSegList* pathSegList = new nsSVGPathSegList();
if (!pathSegList) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(pathSegList);
// pathSegList->Init();
*result = (nsIDOMSVGPathSegList*) pathSegList;
return NS_OK;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_SVGPATHSEGLIST_H__
#define __NS_SVGPATHSEGLIST_H__
#include "nsIDOMSVGPathSegList.h"
nsresult
NS_NewSVGPathSegList(nsIDOMSVGPathSegList** result);
#endif //__NS_SVGPATHSEGLIST_H__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_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__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGPointList.h"
#include "nsSVGPoint.h"
#include "nsDOMError.h"
#include "prdtoa.h"
#include "nsReadableUtils.h"
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<nsISVGValue> val = do_QueryInterface(point);
if (val)
val->RemoveObserver(this);
NS_RELEASE(point);
}
mPoints.Clear();
DidModify();
}
nsIDOMSVGPoint*
nsSVGPointList::ElementAt(PRInt32 index)
{
return (nsIDOMSVGPoint*)mPoints.ElementAt(index);
}
void
nsSVGPointList::AppendElement(nsIDOMSVGPoint* aElement)
{
WillModify();
NS_ADDREF(aElement);
mPoints.AppendElement((void*)aElement);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
void
nsSVGPointList::RemoveElementAt(PRInt32 index)
{
WillModify();
nsIDOMSVGPoint* point = ElementAt(index);
NS_ASSERTION(point, "null point");
nsCOMPtr<nsISVGValue> val = do_QueryInterface(point);
if (val)
val->RemoveObserver(this);
mPoints.RemoveElementAt(index);
NS_RELEASE(point);
DidModify();
}
void
nsSVGPointList::InsertElementAt(nsIDOMSVGPoint* aElement, PRInt32 index)
{
WillModify();
NS_ADDREF(aElement);
mPoints.InsertElementAt((void*)aElement, index);
nsCOMPtr<nsISVGValue> val = do_QueryInterface(aElement);
if (val)
val->AddObserver(this);
DidModify();
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGPointList)
NS_IMPL_RELEASE(nsSVGPointList)
NS_INTERFACE_MAP_BEGIN(nsSVGPointList)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGPointList)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGPointList)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGPointList::SetValueString(const 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<nsIDOMSVGPoint> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_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__

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "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<nsIDOMSVGPointList> 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<nsISVGValue> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "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<nsIDOMSVGPointList> 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<nsISVGValue> 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;
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGRect.h"
#include "prdtoa.h"
#include "nsSVGValue.h"
////////////////////////////////////////////////////////////////////////
// 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<nsIDOMSVGRect> mPrototype;
nsCOMPtr<nsIDOMSVGRect> mBody;
};
//----------------------------------------------------------------------
// implementation:
nsresult
nsSVGRectPrototypeWrapper::Create(nsIDOMSVGRect** result,
nsIDOMSVGRect* prototype,
nsIDOMSVGRect* body)
{
*result = (nsIDOMSVGRect*) new nsSVGRectPrototypeWrapper(prototype, body);
if(!*result) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*result);
return NS_OK;
}
nsSVGRectPrototypeWrapper::nsSVGRectPrototypeWrapper(nsIDOMSVGRect* prototype,
nsIDOMSVGRect* body)
: mPrototype(prototype), mBody(body)
{
NS_INIT_ISUPPORTS();
NS_ASSERTION(mPrototype, "need prototype");
}
nsSVGRectPrototypeWrapper::~nsSVGRectPrototypeWrapper()
{
// if (mBody) {
// nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBody);
// if (val)
// val->RemoveObserver(this);
// }
}
void nsSVGRectPrototypeWrapper::EnsureBody()
{
if (mBody) return;
nsSVGRect::Create(getter_AddRefs(mBody));
NS_ASSERTION(mBody, "couldn't create body");
// nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBody);
// if (val)
// val->AddObserver(this);
}
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF(nsSVGRectPrototypeWrapper)
NS_IMPL_RELEASE(nsSVGRectPrototypeWrapper)
NS_INTERFACE_MAP_BEGIN(nsSVGRectPrototypeWrapper)
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRect)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
// nsISVGValue methods:
NS_IMETHODIMP
nsSVGRectPrototypeWrapper::SetValueString(const nsAReadableString& aValue)
{
EnsureBody();
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBody);
NS_ASSERTION(val, "missing interface on body");
return val->SetValueString(aValue);
}
NS_IMETHODIMP
nsSVGRectPrototypeWrapper::GetValueString(nsAWritableString& aValue)
{
nsCOMPtr<nsISVGValue> val = do_QueryInterface( Delegate() );
NS_ASSERTION(val, "missing interface on body");
return val->GetValueString(aValue);
}
//----------------------------------------------------------------------
// nsIDOMSVGRect methods:
/* attribute float x; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetX(float *aX)
{
return Delegate()->GetX(aX);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetX(float aX)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetX(aX);
DidModify();
return rv;
}
/* attribute float y; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetY(float *aY)
{
return Delegate()->GetY(aY);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetY(float aY)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetY(aY);
DidModify();
return rv;
}
/* attribute float width; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetWidth(float *aWidth)
{
return Delegate()->GetWidth(aWidth);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetWidth(float aWidth)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetWidth(aWidth);
DidModify();
return rv;
}
/* attribute float height; */
NS_IMETHODIMP nsSVGRectPrototypeWrapper::GetHeight(float *aHeight)
{
return Delegate()->GetHeight(aHeight);
}
NS_IMETHODIMP nsSVGRectPrototypeWrapper::SetHeight(float aHeight)
{
WillModify();
EnsureBody();
nsresult rv = mBody->SetHeight(aHeight);
DidModify();
return rv;
}
////////////////////////////////////////////////////////////////////////
// Exported creation functions:
nsresult
NS_NewSVGRect(nsIDOMSVGRect** result, float x, float y,
float width, float height)
{
return nsSVGRect::Create(result, x, y, width, height);
}
nsresult
NS_NewSVGRectPrototypeWrapper(nsIDOMSVGRect** result,
nsIDOMSVGRect* prototype)
{
return nsSVGRectPrototypeWrapper::Create(result, prototype);
}

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#ifndef __NS_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__

View File

@@ -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 <william.cook@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGGraphicElement.h"
#include "nsSVGAtoms.h"
#include "nsSVGAnimatedLength.h"
#include "nsSVGLength.h"
#include "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<nsIDOMSVGAnimatedLength> mX;
nsCOMPtr<nsIDOMSVGAnimatedLength> mY;
nsCOMPtr<nsIDOMSVGAnimatedLength> mWidth;
nsCOMPtr<nsIDOMSVGAnimatedLength> mHeight;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRx;
nsCOMPtr<nsIDOMSVGAnimatedLength> mRy;
};
nsresult NS_NewSVGRectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo)
{
*aResult = nsnull;
nsSVGRectElement* it = new nsSVGRectElement();
if (!it) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(it);
nsresult rv = NS_STATIC_CAST(nsGenericElement*,it)->Init(aNodeInfo);
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
rv = it->Init();
if (NS_FAILED(rv)) {
it->Release();
return rv;
}
*aResult = NS_STATIC_CAST(nsIContent *, it);
return NS_OK;
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGRectElement,nsSVGRectElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGRectElement,nsSVGRectElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGRectElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRectElement)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGRectElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGRectElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGRectElement::nsSVGRectElement()
{
}
nsSVGRectElement::~nsSVGRectElement()
{
if (mX) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX);
value->RemoveObserver(this);
}
if (mY) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY);
value->RemoveObserver(this);
}
if (mWidth) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mWidth);
value->RemoveObserver(this);
}
if (mHeight) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mHeight);
value->RemoveObserver(this);
}
if (mRx) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRx);
value->RemoveObserver(this);
}
if (mRy) {
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mRy);
value->RemoveObserver(this);
}
}
nsresult
nsSVGRectElement::Init()
{
nsresult rv;
rv = nsSVGRectElementBase::Init();
NS_ENSURE_SUCCESS(rv,rv);
// Create mapped properties:
// DOM property: x , #IMPLIED attrib: x
{
nsCOMPtr<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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<nsIDOMSVGLength> 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;
}

File diff suppressed because it is too large Load Diff

View File

@@ -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 <alex.fritze@crocodile-clips.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsSVGValue.h"
#include "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<nsIStyleRule> 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 <nsIURI> docURL;
baseDoc->GetBaseURL(*getter_AddRefs(docURL));
nsCOMPtr<nsICSSParser> 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));
}

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