Compare commits
2875 Commits
M15-patch
...
TABLE_REWO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1afe654efd | ||
|
|
99eff8e223 | ||
|
|
b5781d5136 | ||
|
|
c4c022f347 | ||
|
|
c5754fd621 | ||
|
|
a90bf72a3b | ||
|
|
e0965c1072 | ||
|
|
44fe1931e7 | ||
|
|
bcb253d821 | ||
|
|
c7deef58ae | ||
|
|
d72f2ab06c | ||
|
|
89a77df4bd | ||
|
|
1f72cdf182 | ||
|
|
b46ebb9cae | ||
|
|
80de098422 | ||
|
|
9491f9c3a6 | ||
|
|
485df3bbf4 | ||
|
|
81585a34d8 | ||
|
|
2472063f36 | ||
|
|
6a98427539 | ||
|
|
713ec6e9e3 | ||
|
|
b0b0fcbf47 | ||
|
|
3385a09d75 | ||
|
|
1e8a3a110f | ||
|
|
c351bdb38e | ||
|
|
f96dbfc87b | ||
|
|
024a3fce2d | ||
|
|
7bb84238de | ||
|
|
c6d00331d3 | ||
|
|
8efe8bcc68 | ||
|
|
f55b31ca34 | ||
|
|
6ffe908f39 | ||
|
|
2d6a83bc0f | ||
|
|
09cb8a8254 | ||
|
|
b78c738e4a | ||
|
|
89f8ed5563 | ||
|
|
58b99ebb6d | ||
|
|
bee383e96d | ||
|
|
44332cf660 | ||
|
|
fb8e28c9c4 | ||
|
|
17cbeb77e7 | ||
|
|
3000b1086d | ||
|
|
faf3f4fe4d | ||
|
|
43df393342 | ||
|
|
35f90e65d1 | ||
|
|
8070111007 | ||
|
|
7f42ef6e64 | ||
|
|
af242334cb | ||
|
|
933fcf7691 | ||
|
|
2e299693a9 | ||
|
|
0807b27f4a | ||
|
|
847ca747b9 | ||
|
|
4503d0b854 | ||
|
|
1eb50dbb5a | ||
|
|
17e69911b9 | ||
|
|
51a5a2178c | ||
|
|
a7f2f7297e | ||
|
|
7dd0882349 | ||
|
|
2db3a56287 | ||
|
|
c060132cb3 | ||
|
|
cd242b3880 | ||
|
|
39b8a113bc | ||
|
|
c9b94e3585 | ||
|
|
caad17c5c1 | ||
|
|
9d54abd105 | ||
|
|
29ac9e98a4 | ||
|
|
b1a59b34b6 | ||
|
|
b968087d92 | ||
|
|
ab9b4eea01 | ||
|
|
c324cc9a00 | ||
|
|
36ac6160d7 | ||
|
|
05ee546aab | ||
|
|
628b5a327a | ||
|
|
c495b6f2e3 | ||
|
|
504d65b327 | ||
|
|
b45d74d4d2 | ||
|
|
0e27256814 | ||
|
|
b540121b9c | ||
|
|
96f6a637ae | ||
|
|
206c576508 | ||
|
|
ef0b5871a1 | ||
|
|
6166390376 | ||
|
|
69a77612e3 | ||
|
|
0a6117621f | ||
|
|
18e2c469eb | ||
|
|
0a027ef185 | ||
|
|
63871c1621 | ||
|
|
0c869fbdc6 | ||
|
|
29a679225a | ||
|
|
bc74704a55 | ||
|
|
828f199f1f | ||
|
|
142b602c9a | ||
|
|
78a1c7b0e7 | ||
|
|
6a13d9018d | ||
|
|
eec8017035 | ||
|
|
989e73d3d7 | ||
|
|
1a11f42023 | ||
|
|
53ccb20483 | ||
|
|
61cd4d00a4 | ||
|
|
a6d5ab0a18 | ||
|
|
af51a3ae47 | ||
|
|
a945951480 | ||
|
|
6d4433d5b4 | ||
|
|
224dcfd32b | ||
|
|
8354ebec04 | ||
|
|
0ecef6293a | ||
|
|
cc504ba0d1 | ||
|
|
1f6f03d26d | ||
|
|
abd7542a33 | ||
|
|
2426564a47 | ||
|
|
94bdfd96ef | ||
|
|
59b22cff6c | ||
|
|
f9a5876d9f | ||
|
|
ea6abb3de2 | ||
|
|
d02bcc7362 | ||
|
|
f63c611cd5 | ||
|
|
9b0d9085aa | ||
|
|
64692d9456 | ||
|
|
5c7ccdf2f5 | ||
|
|
3ba6bb1158 | ||
|
|
7db2c3e16f | ||
|
|
63749e1875 | ||
|
|
48dd7c0e78 | ||
|
|
43ad4d5101 | ||
|
|
3ef0b5bddd | ||
|
|
f6869e82d6 | ||
|
|
079e07a0a2 | ||
|
|
b58a3dc6a6 | ||
|
|
9f13914779 | ||
|
|
e9f618e116 | ||
|
|
0abfa57047 | ||
|
|
7ddd31965b | ||
|
|
4cf56cb8b9 | ||
|
|
f5f1bfbb66 | ||
|
|
39c81e6a36 | ||
|
|
91b948026e | ||
|
|
da12438e7e | ||
|
|
072f9f11f5 | ||
|
|
5399053fa1 | ||
|
|
6c6ee14d9d | ||
|
|
c1175067d7 | ||
|
|
9b31b01640 | ||
|
|
396cb6ad29 | ||
|
|
bc7a07fc3e | ||
|
|
20082f719f | ||
|
|
2bad26f150 | ||
|
|
dfefa3f9af | ||
|
|
c5faa05ac6 | ||
|
|
3bc497b41c | ||
|
|
6cccc8adfc | ||
|
|
236069891b | ||
|
|
607ad6701a | ||
|
|
c6e18b6ab7 | ||
|
|
81456654a1 | ||
|
|
52cc206f36 | ||
|
|
cfddb992ee | ||
|
|
4fca64717e | ||
|
|
6e46435b1d | ||
|
|
21e078823e | ||
|
|
f2724c2ff8 | ||
|
|
26e8a2307e | ||
|
|
c31311ba6f | ||
|
|
d29bd37163 | ||
|
|
ecc5dfb4b0 | ||
|
|
090fcb3c8f | ||
|
|
1a5079d1e3 | ||
|
|
5c304f97bf | ||
|
|
c007a0cb70 | ||
|
|
831c6bfb9e | ||
|
|
be158e5272 | ||
|
|
25d1324f5d | ||
|
|
b75d99c004 | ||
|
|
5d12f78ef8 | ||
|
|
b8e383026e | ||
|
|
2d4baee02f | ||
|
|
13076f014b | ||
|
|
ce2cc76fc2 | ||
|
|
1131f006d6 | ||
|
|
dcd55638ce | ||
|
|
c2a1156e3a | ||
|
|
a9ac48d020 | ||
|
|
cbd61feda9 | ||
|
|
46da1618bb | ||
|
|
59909e378d | ||
|
|
a8b311c760 | ||
|
|
03c20d1e01 | ||
|
|
99c4caf811 | ||
|
|
2fba19da79 | ||
|
|
44195d4a3a | ||
|
|
8872d98f17 | ||
|
|
add4ae6745 | ||
|
|
53f36f30cd | ||
|
|
d588c49e49 | ||
|
|
f3d79059c0 | ||
|
|
cecf6e4a28 | ||
|
|
9e042dd8f4 | ||
|
|
c9f292ae14 | ||
|
|
6c64d3eef2 | ||
|
|
585a18d18e | ||
|
|
5d87289302 | ||
|
|
c3389c553d | ||
|
|
b7fb654fc5 | ||
|
|
1587680a3d | ||
|
|
43b6924a32 | ||
|
|
890403cbf7 | ||
|
|
8b74bb1667 | ||
|
|
9a91bb81d5 | ||
|
|
ad9344c946 | ||
|
|
e58378dccf | ||
|
|
803b71ef81 | ||
|
|
b940d79526 | ||
|
|
44af9f8dc9 | ||
|
|
2e9da7699f | ||
|
|
8b025929f6 | ||
|
|
0e1753ad3a | ||
|
|
fafc5636c1 | ||
|
|
afa3d3cd7c | ||
|
|
15a02bd1bb | ||
|
|
c222ee0416 | ||
|
|
0f170515eb | ||
|
|
8457a544b0 | ||
|
|
e4df3888e3 | ||
|
|
d2f12fe684 | ||
|
|
4b790c8861 | ||
|
|
1e228e93e0 | ||
|
|
d500130ed8 | ||
|
|
1af24d307c | ||
|
|
58eb0d520f | ||
|
|
2bb806a610 | ||
|
|
0ed5b2154b | ||
|
|
611f907a2e | ||
|
|
32ad1437d2 | ||
|
|
b80e941838 | ||
|
|
19c88edad4 | ||
|
|
360bd398f3 | ||
|
|
fa04a5ff42 | ||
|
|
9bf44ed131 | ||
|
|
f01bf79f81 | ||
|
|
a0be83af64 | ||
|
|
37849accbb | ||
|
|
ed448bc490 | ||
|
|
a0ece36ce6 | ||
|
|
f73d070bdf | ||
|
|
cba391ac74 | ||
|
|
4f5266923d | ||
|
|
aba17d157e | ||
|
|
d50cb261de | ||
|
|
811976b56b | ||
|
|
2c134c2abf | ||
|
|
44972576e3 | ||
|
|
2ea5ceca9c | ||
|
|
a49bbb28e9 | ||
|
|
4ce3a6b853 | ||
|
|
72c9eb90d8 | ||
|
|
6201f3cc96 | ||
|
|
1c1c8ceac0 | ||
|
|
19c5c7d1b9 | ||
|
|
0389d17f64 | ||
|
|
f09059d2c6 | ||
|
|
3243eb2b51 | ||
|
|
bdf5ee5913 | ||
|
|
c02259352d | ||
|
|
bbd22b783a | ||
|
|
889e3c29da | ||
|
|
c125f8fc68 | ||
|
|
c5ce9eb5f0 | ||
|
|
653960b7d1 | ||
|
|
c7aa643d96 | ||
|
|
4ca11f608c | ||
|
|
22a132a417 | ||
|
|
d630910cd9 | ||
|
|
2097758f51 | ||
|
|
0dce9c7a7c | ||
|
|
bd78970365 | ||
|
|
5bb07d651f | ||
|
|
aa8d28386b | ||
|
|
e8028087e0 | ||
|
|
60684c56a2 | ||
|
|
3a1086bffa | ||
|
|
0419f0e310 | ||
|
|
945d82f2db | ||
|
|
23414d53c9 | ||
|
|
422c14fe78 | ||
|
|
c1ad24f646 | ||
|
|
76ba2b6544 | ||
|
|
af2c8ed503 | ||
|
|
542244281b | ||
|
|
791292ffa1 | ||
|
|
ef575728ae | ||
|
|
11acc154a5 | ||
|
|
42e4c9ee34 | ||
|
|
6573b9f779 | ||
|
|
a3f7091a2e | ||
|
|
ae0737cdba | ||
|
|
948cb30176 | ||
|
|
fca89c83ad | ||
|
|
65efe9489a | ||
|
|
2b21095fef | ||
|
|
5d10cfab17 | ||
|
|
729cc3439a | ||
|
|
a08bb3b046 | ||
|
|
07d6c2844b | ||
|
|
0082a081b1 | ||
|
|
5f2a780227 | ||
|
|
44dcb3f475 | ||
|
|
c1348b13c6 | ||
|
|
31895d9cb7 | ||
|
|
51ec2e3697 | ||
|
|
0e84614fdd | ||
|
|
57cf8da23c | ||
|
|
eac9d23719 | ||
|
|
e0687b7223 | ||
|
|
ff86accb12 | ||
|
|
52e7e2a0de | ||
|
|
3ce26e48f9 | ||
|
|
d129ce569d | ||
|
|
aa323aac76 | ||
|
|
a4c2e3c639 | ||
|
|
728af9c6ac | ||
|
|
83e21d3a65 | ||
|
|
b6eb1a0559 | ||
|
|
ac4eb59b78 | ||
|
|
85f82c8c63 | ||
|
|
618b8789ad | ||
|
|
795b69917e | ||
|
|
63059e699b | ||
|
|
ee277bdc54 | ||
|
|
ec0d246f33 | ||
|
|
0f12896f7b | ||
|
|
aa3a7a5a2a | ||
|
|
a2ff8a9338 | ||
|
|
a44e398c1f | ||
|
|
96145b994f | ||
|
|
84acce94c4 | ||
|
|
679b925a44 | ||
|
|
e59b30372e | ||
|
|
c5e57a05f3 | ||
|
|
154c1a78d8 | ||
|
|
27cbf1994b | ||
|
|
692f5f92bd | ||
|
|
44649e28d3 | ||
|
|
9c9a6b4b15 | ||
|
|
1943eb7204 | ||
|
|
f106ee6a5b | ||
|
|
1a846f0e84 | ||
|
|
6206005f5f | ||
|
|
e3fe383557 | ||
|
|
4ad31c92ef | ||
|
|
76708977b8 | ||
|
|
5639bf7c12 | ||
|
|
d2ded9c6d9 | ||
|
|
68ab808ffd | ||
|
|
5cfe68fe2e | ||
|
|
0adbaf9a98 | ||
|
|
9166d76d8b | ||
|
|
0b8e72cc74 | ||
|
|
a2bb22f4c2 | ||
|
|
d7ad1303c5 | ||
|
|
f875003fef | ||
|
|
6611de1186 | ||
|
|
1d5ae86d11 | ||
|
|
b6a95f1ac7 | ||
|
|
9878fd34ac | ||
|
|
13377b59e5 | ||
|
|
73348f285b | ||
|
|
04118508dc | ||
|
|
82331502dc | ||
|
|
52856beb12 | ||
|
|
1622daf8ef | ||
|
|
b231c3df4d | ||
|
|
dba31d43b3 | ||
|
|
e23f78e0d1 | ||
|
|
d35ae0e781 | ||
|
|
5344c3abe4 | ||
|
|
d82bf53dc0 | ||
|
|
fd67f20a6a | ||
|
|
35f11dec0f | ||
|
|
a1dd1bbd91 | ||
|
|
9568c0a1e2 | ||
|
|
e2cc250b30 | ||
|
|
11eb90ae0b | ||
|
|
0109b97c9b | ||
|
|
592665b4d9 | ||
|
|
111e27ee79 | ||
|
|
f8e3595435 | ||
|
|
2ae24d5c5f | ||
|
|
01769cf0b5 | ||
|
|
edba5add24 | ||
|
|
4727d6ae47 | ||
|
|
43f3345a6b | ||
|
|
a0a4987a35 | ||
|
|
a793371759 | ||
|
|
3be34bfeff | ||
|
|
e232c6c064 | ||
|
|
cf7c17f944 | ||
|
|
21799bdf04 | ||
|
|
d580800895 | ||
|
|
1d0d491d3d | ||
|
|
e09cc4c51d | ||
|
|
8775c2609c | ||
|
|
15b1fec8af | ||
|
|
ef1cd092e1 | ||
|
|
ffaac3e9e6 | ||
|
|
0f75f23440 | ||
|
|
152b822223 | ||
|
|
7a2ef93455 | ||
|
|
359944da48 | ||
|
|
9317da9e42 | ||
|
|
1b51bd36a3 | ||
|
|
33de5e1c80 | ||
|
|
dbb80e2d33 | ||
|
|
b5e7662905 | ||
|
|
a60b2a2d65 | ||
|
|
356f03c947 | ||
|
|
0bf5246e2c | ||
|
|
4bb18e4e27 | ||
|
|
1bf01b249e | ||
|
|
562e044a96 | ||
|
|
4713b64ef5 | ||
|
|
f39ecfd904 | ||
|
|
2589b7864d | ||
|
|
2b18cdd84a | ||
|
|
7773253d6f | ||
|
|
9de0f9e097 | ||
|
|
2cccb5c8ab | ||
|
|
cfe011edf5 | ||
|
|
7fd9c18f5f | ||
|
|
03bfa48dc1 | ||
|
|
c42e11df4b | ||
|
|
0f8dec295e | ||
|
|
fea7b82523 | ||
|
|
3c52ac7a68 | ||
|
|
d0ed1c4035 | ||
|
|
188b1759d3 | ||
|
|
30ea3a1c5f | ||
|
|
edbfd05a90 | ||
|
|
ad0daefa8e | ||
|
|
481374c04f | ||
|
|
7574588de7 | ||
|
|
235da90d92 | ||
|
|
d82be4211b | ||
|
|
08601657ad | ||
|
|
ab390d9a24 | ||
|
|
3b7e795657 | ||
|
|
cb8d4be3b8 | ||
|
|
aadd0fb038 | ||
|
|
f512f2dbb4 | ||
|
|
4f7ac1c445 | ||
|
|
4369043f13 | ||
|
|
2050d69f72 | ||
|
|
2c74c6fb06 | ||
|
|
199df01b45 | ||
|
|
9484110b36 | ||
|
|
d8a67fa3b9 | ||
|
|
d0dbb9cc6d | ||
|
|
d23f087f32 | ||
|
|
3f5ec35ce8 | ||
|
|
b82eb95e33 | ||
|
|
4fa40f0133 | ||
|
|
1bb107dcda | ||
|
|
a13d7b5d8f | ||
|
|
17158c4189 | ||
|
|
51c4bb8682 | ||
|
|
5e0931af82 | ||
|
|
fd5f7b2e1a | ||
|
|
997f01f69a | ||
|
|
af658423e2 | ||
|
|
521e62ba06 | ||
|
|
82ba7cc6a4 | ||
|
|
23db9bcbb7 | ||
|
|
0c1eb4f76c | ||
|
|
489f5b804a | ||
|
|
0875663ade | ||
|
|
f0328f2b2a | ||
|
|
f861dab0c8 | ||
|
|
5b4c24a5a0 | ||
|
|
cc1f31cb8e | ||
|
|
f73794234b | ||
|
|
f971abeac7 | ||
|
|
c5c2e469e6 | ||
|
|
657a44f76d | ||
|
|
823976d121 | ||
|
|
31b5649f91 | ||
|
|
34b37eb441 | ||
|
|
b7d94f969c | ||
|
|
1f742a3284 | ||
|
|
f23980eeb6 | ||
|
|
d035392759 | ||
|
|
ea7c0c0563 | ||
|
|
8d56484c5e | ||
|
|
8bbd947552 | ||
|
|
5e2d02cad7 | ||
|
|
238cb44868 | ||
|
|
27e5d5d519 | ||
|
|
cad9903a6b | ||
|
|
b61d6c2bdb | ||
|
|
654bf6ac36 | ||
|
|
2913f83f05 | ||
|
|
870db29d54 | ||
|
|
17576453d3 | ||
|
|
1e97cfb9b6 | ||
|
|
2f490e6acb | ||
|
|
132680033c | ||
|
|
238a3616c4 | ||
|
|
ec87243cd6 | ||
|
|
944d1180a4 | ||
|
|
4a3e063195 | ||
|
|
639f9e68d3 | ||
|
|
3b29e0e253 | ||
|
|
2871746d83 | ||
|
|
e1d3b6f5c2 | ||
|
|
c99a01bbd4 | ||
|
|
ff7a3079f8 | ||
|
|
0ed0a6ba1a | ||
|
|
d56aa87800 | ||
|
|
3e212de2a9 | ||
|
|
52084caad8 | ||
|
|
a8d6ce613a | ||
|
|
98b3316ae5 | ||
|
|
f9cf743937 | ||
|
|
3eb31bbb1e | ||
|
|
2b66e98597 | ||
|
|
ebb4a10cfb | ||
|
|
da52293f7e | ||
|
|
08e89aca70 | ||
|
|
ed3c921a9a | ||
|
|
f599ff75ef | ||
|
|
99f3232c3e | ||
|
|
b59c7b6165 | ||
|
|
94fa330a81 | ||
|
|
303386ba94 | ||
|
|
3785d66606 | ||
|
|
8470f98104 | ||
|
|
94a988fc93 | ||
|
|
a87bed1342 | ||
|
|
357ff16580 | ||
|
|
f5f37cbce1 | ||
|
|
6168011fe2 | ||
|
|
cb1db91e06 | ||
|
|
8bebec4c4c | ||
|
|
e3a62ebe86 | ||
|
|
cf83b01b5f | ||
|
|
272cee0c80 | ||
|
|
58fdf4bb36 | ||
|
|
9fface217d | ||
|
|
509d1e72ed | ||
|
|
6130dcc35b | ||
|
|
25848ab739 | ||
|
|
78aaa53a28 | ||
|
|
78f2d4bf20 | ||
|
|
947c3cd8c1 | ||
|
|
f5e27dc7bc | ||
|
|
d362b39624 | ||
|
|
586fad3e08 | ||
|
|
87a9a9877c | ||
|
|
a7d3631f72 | ||
|
|
1fa69507a8 | ||
|
|
7a55d88518 | ||
|
|
dc5c34441e | ||
|
|
52cc20d7d0 | ||
|
|
c4e4448cdb | ||
|
|
90081b7cbd | ||
|
|
189360dda0 | ||
|
|
c21a371d52 | ||
|
|
5d4910785f | ||
|
|
f29c9f241f | ||
|
|
1929e1adb0 | ||
|
|
d9fa32f51f | ||
|
|
11b56eb688 | ||
|
|
b86bdbfe72 | ||
|
|
efef32ce6e | ||
|
|
85fa6d507e | ||
|
|
f056c26c3c | ||
|
|
92e15f8c3b | ||
|
|
6663542fca | ||
|
|
904e8dfba3 | ||
|
|
69cfc3a581 | ||
|
|
ff1e9211fe | ||
|
|
da7cd80889 | ||
|
|
13ceb41576 | ||
|
|
ff46654732 | ||
|
|
7685824c32 | ||
|
|
d5295d7b10 | ||
|
|
5d86e14eda | ||
|
|
f556dc2114 | ||
|
|
5cbe773170 | ||
|
|
bb7b3ba135 | ||
|
|
be773295ae | ||
|
|
db00ef793b | ||
|
|
7ae9896327 | ||
|
|
820584eef4 | ||
|
|
ec38667076 | ||
|
|
ff063a65a9 | ||
|
|
f26e7d057e | ||
|
|
cfa29e85b7 | ||
|
|
3634b4908f | ||
|
|
9e4be4cdca | ||
|
|
e3a0197217 | ||
|
|
81e58c6c55 | ||
|
|
4f92e21cc4 | ||
|
|
d3ad1a51a2 | ||
|
|
7eefbb611d | ||
|
|
e2ffa1474b | ||
|
|
7e1bb9e358 | ||
|
|
3d70eed61d | ||
|
|
ec40cdfc6a | ||
|
|
822df69500 | ||
|
|
9d18559818 | ||
|
|
f775b525e1 | ||
|
|
9622913ee0 | ||
|
|
565b4458eb | ||
|
|
d7908baef5 | ||
|
|
a2d6c52697 | ||
|
|
61709561e8 | ||
|
|
3443fbb03c | ||
|
|
c211707ae9 | ||
|
|
c031503852 | ||
|
|
4b448ed210 | ||
|
|
7e24c61109 | ||
|
|
42c76a9aa9 | ||
|
|
09db2943e9 | ||
|
|
f9c8c503ca | ||
|
|
15474bfb1f | ||
|
|
f795458a79 | ||
|
|
d53721b599 | ||
|
|
f02bbaedf2 | ||
|
|
0d8a2640a3 | ||
|
|
48af9701f2 | ||
|
|
968ecae850 | ||
|
|
e875c61670 | ||
|
|
8c0c6fbd74 | ||
|
|
14a73bf9f8 | ||
|
|
a0c246098c | ||
|
|
b65b77f70c | ||
|
|
979d516b73 | ||
|
|
d0d5a225b0 | ||
|
|
96447b4c8f | ||
|
|
1e339b4e2b | ||
|
|
4d2a6f1b34 | ||
|
|
76418ad5cd | ||
|
|
3037a5639d | ||
|
|
c2e9a22340 | ||
|
|
6190edd8d7 | ||
|
|
6d45fb32c0 | ||
|
|
65533e576e | ||
|
|
45612f1413 | ||
|
|
292b7e59ef | ||
|
|
e289f4bdbb | ||
|
|
de66758325 | ||
|
|
5520183969 | ||
|
|
7efeed2ec5 | ||
|
|
fb5ba5251b | ||
|
|
c7d8a4a439 | ||
|
|
a2b15af9ef | ||
|
|
9175f05517 | ||
|
|
dfb4125a91 | ||
|
|
c3f1556235 | ||
|
|
909b55effa | ||
|
|
cfccd460a5 | ||
|
|
40b96f684e | ||
|
|
23207ef36f | ||
|
|
77c4947349 | ||
|
|
2ced75f311 | ||
|
|
394c83b71d | ||
|
|
86daa4e348 | ||
|
|
c5f151e490 | ||
|
|
2d679461dc | ||
|
|
6f390f3338 | ||
|
|
5de0d41de9 | ||
|
|
c39011af4c | ||
|
|
b41374aee6 | ||
|
|
c9aecf9327 | ||
|
|
46824fda78 | ||
|
|
d3cd2afa84 | ||
|
|
9d454dc56b | ||
|
|
7538581ccc | ||
|
|
55bc378ad7 | ||
|
|
9ee1970a3d | ||
|
|
499a48d730 | ||
|
|
d8d4af67e3 | ||
|
|
f471f3544d | ||
|
|
384c4df814 | ||
|
|
14c162f6df | ||
|
|
450067e8ae | ||
|
|
a68ed6e2a5 | ||
|
|
4662ada89f | ||
|
|
6eb67e93bd | ||
|
|
26d3075a56 | ||
|
|
91481fd052 | ||
|
|
be4026f658 | ||
|
|
fe5547695c | ||
|
|
94ecbedb06 | ||
|
|
fef8da8a31 | ||
|
|
2f147d0a55 | ||
|
|
7e9fc11c82 | ||
|
|
2bf770f3af | ||
|
|
9381ffc62d | ||
|
|
fa071fe1e3 | ||
|
|
8b15b44315 | ||
|
|
1411808b50 | ||
|
|
d194832bb2 | ||
|
|
e5a3102969 | ||
|
|
6631edc16e | ||
|
|
bcd916e231 | ||
|
|
090ff0afcb | ||
|
|
99b65a3bf8 | ||
|
|
82eaf33e41 | ||
|
|
b9c1422ef5 | ||
|
|
33c22ccfd8 | ||
|
|
e050a38db8 | ||
|
|
471748a3e5 | ||
|
|
40c2625df9 | ||
|
|
02d091a35c | ||
|
|
dd16ebd747 | ||
|
|
a9f2e413bb | ||
|
|
3b147ba16a | ||
|
|
8a8f67d122 | ||
|
|
c8140b55cb | ||
|
|
8d2a10ff82 | ||
|
|
a38c51c58b | ||
|
|
d8ce56167f | ||
|
|
ba77f32bb0 | ||
|
|
74631d734b | ||
|
|
79877efe0c | ||
|
|
732ca99228 | ||
|
|
c8a6b35854 | ||
|
|
3b2f68d99a | ||
|
|
10cc7b70fe | ||
|
|
2019e907c8 | ||
|
|
d0dea7b899 | ||
|
|
4d37e2b9e3 | ||
|
|
c876431511 | ||
|
|
668dd78cd3 | ||
|
|
8d97c39c31 | ||
|
|
559fbb1110 | ||
|
|
733ffbea94 | ||
|
|
9eb1037eba | ||
|
|
a222be8f31 | ||
|
|
b03d03932e | ||
|
|
2a3aa9fcb8 | ||
|
|
1f3dc8394a | ||
|
|
8d7b1630df | ||
|
|
94635420f7 | ||
|
|
3762ebc594 | ||
|
|
05b901315c | ||
|
|
d398de2dfa | ||
|
|
4698adc719 | ||
|
|
b92a506230 | ||
|
|
14bb6fa0ab | ||
|
|
7645dfa57c | ||
|
|
c2b90e3bbb | ||
|
|
2632a072f5 | ||
|
|
15809aa999 | ||
|
|
811cb761f4 | ||
|
|
3549f77d57 | ||
|
|
f6e0d56961 | ||
|
|
b2fedc2225 | ||
|
|
bdf7b78cd4 | ||
|
|
ab67ca9638 | ||
|
|
a54d7af00a | ||
|
|
52713ced88 | ||
|
|
5fb4c78072 | ||
|
|
067920c238 | ||
|
|
8a9940ec3c | ||
|
|
1aa351257b | ||
|
|
20ef5057f7 | ||
|
|
f23f7ad15d | ||
|
|
119acf2584 | ||
|
|
b6598f67f9 | ||
|
|
eab29136c1 | ||
|
|
cb3b6882b4 | ||
|
|
1dd0421880 | ||
|
|
48e25b8c33 | ||
|
|
2c11b83b75 | ||
|
|
7ad0076bfb | ||
|
|
2fb0f2979c | ||
|
|
b6473d8bd0 | ||
|
|
91ce25064d | ||
|
|
9fa5c74f98 | ||
|
|
22f407a483 | ||
|
|
4ccbd4b644 | ||
|
|
ac87ce19c4 | ||
|
|
a0cd849978 | ||
|
|
dac168d0d6 | ||
|
|
7b4ca31732 | ||
|
|
17121af6a9 | ||
|
|
34adf9eb4a | ||
|
|
5dabafa40b | ||
|
|
902d510731 | ||
|
|
02494ac189 | ||
|
|
2e324573c8 | ||
|
|
930e16ca97 | ||
|
|
e5aab9a82f | ||
|
|
37d2a5badf | ||
|
|
b36dd24985 | ||
|
|
30c6a5b9b5 | ||
|
|
1de1f8b535 | ||
|
|
9b457ca9da | ||
|
|
aa6b90d40e | ||
|
|
2f8584c230 | ||
|
|
96e330f279 | ||
|
|
6771abf254 | ||
|
|
5c27504038 | ||
|
|
cb7c76b9e0 | ||
|
|
88fc92f608 | ||
|
|
d3a9108ad8 | ||
|
|
a836e61b39 | ||
|
|
6d81d0e4d1 | ||
|
|
1cd55fd548 | ||
|
|
eea1811f0c | ||
|
|
ed0b376456 | ||
|
|
c0636b0f0d | ||
|
|
0fcdeec97a | ||
|
|
aac970f94c | ||
|
|
9abcd79da8 | ||
|
|
498dc1681d | ||
|
|
547e07303b | ||
|
|
d3a24645a8 | ||
|
|
12f1c79c88 | ||
|
|
809eeca85a | ||
|
|
2c278231ec | ||
|
|
94ee06fc74 | ||
|
|
15a90341d6 | ||
|
|
e313aaa0ab | ||
|
|
1d51b653fc | ||
|
|
82c4ad3f35 | ||
|
|
6080853d5d | ||
|
|
94f0737506 | ||
|
|
94d1e2f590 | ||
|
|
f272eeb07a | ||
|
|
89d1c55bef | ||
|
|
2f528b1160 | ||
|
|
2f60faf19d | ||
|
|
59b63e045b | ||
|
|
9145120320 | ||
|
|
e3e325da15 | ||
|
|
9520efcc7a | ||
|
|
87d7b8f23c | ||
|
|
37115d48b0 | ||
|
|
7fb638c5fe | ||
|
|
ad4471e3c6 | ||
|
|
84657b4391 | ||
|
|
94f75c64f9 | ||
|
|
10eaaa0963 | ||
|
|
c75ec68d38 | ||
|
|
693cc4f3c0 | ||
|
|
9f71844e59 | ||
|
|
6f46990bc8 | ||
|
|
8d420bdb8c | ||
|
|
06dcead5d1 | ||
|
|
b7c2823d4c | ||
|
|
ed399a586a | ||
|
|
52b17eda5e | ||
|
|
fd347bcedd | ||
|
|
f6184abf8e | ||
|
|
d86937364e | ||
|
|
6dbeca04a0 | ||
|
|
96222301bc | ||
|
|
1dad7c3d4a | ||
|
|
de3e84d435 | ||
|
|
67b2b41af0 | ||
|
|
34b0e9dc86 | ||
|
|
d129821369 | ||
|
|
188545d820 | ||
|
|
3471a1b69c | ||
|
|
b6cccbf28a | ||
|
|
c494d95016 | ||
|
|
38954dc714 | ||
|
|
c608419e2e | ||
|
|
0a160eb0a8 | ||
|
|
e99aad53d3 | ||
|
|
d85ad8e6a8 | ||
|
|
b73d858405 | ||
|
|
ce40600633 | ||
|
|
54464ea7ea | ||
|
|
557ca2808d | ||
|
|
116c31c15c | ||
|
|
8b5a6209f3 | ||
|
|
e699b3af5a | ||
|
|
c7a56395b0 | ||
|
|
9752ae7af4 | ||
|
|
b37e05608c | ||
|
|
bfe63e8f6e | ||
|
|
997f81d5d1 | ||
|
|
ab7173d18c | ||
|
|
9f59512919 | ||
|
|
b7a4eda34c | ||
|
|
699c20459c | ||
|
|
e8515e9237 | ||
|
|
89b340951c | ||
|
|
efb225519d | ||
|
|
36a060eb5a | ||
|
|
5b95d440f1 | ||
|
|
35be4c55b9 | ||
|
|
ead0de0810 | ||
|
|
9a83fb8aac | ||
|
|
40067e21e4 | ||
|
|
1c91ab1e0f | ||
|
|
77b7b8d32d | ||
|
|
bb74234246 | ||
|
|
d49511cab5 | ||
|
|
1a4ba72643 | ||
|
|
f534603937 | ||
|
|
c96f2a9ee0 | ||
|
|
471d32441c | ||
|
|
d5dbfe7527 | ||
|
|
1e0bcf01b1 | ||
|
|
30980f7406 | ||
|
|
eff33c6a8e | ||
|
|
aedfffde10 | ||
|
|
0d0d59430f | ||
|
|
0d1f1c16df | ||
|
|
1f0d69f6d9 | ||
|
|
7d7ac5b8ec | ||
|
|
94867bd9d6 | ||
|
|
067dc9aa6f | ||
|
|
8af29b1bde | ||
|
|
b98ae1c63e | ||
|
|
d1d215cecb | ||
|
|
738906d4eb | ||
|
|
4df51cacc5 | ||
|
|
029e0cffcd | ||
|
|
2d93e7b4bb | ||
|
|
b5f11bcccb | ||
|
|
cbd2a79d4f | ||
|
|
d809f93363 | ||
|
|
6e662dbdaa | ||
|
|
24d4124fee | ||
|
|
5697c39c4b | ||
|
|
9056e8e1e9 | ||
|
|
06e446d68a | ||
|
|
2baf3e9d35 | ||
|
|
3db2b20a4c | ||
|
|
fed44b6639 | ||
|
|
20b31fbdb0 | ||
|
|
d1024dbfb0 | ||
|
|
1bfb241814 | ||
|
|
4d5404d6d7 | ||
|
|
77889ffe9d | ||
|
|
20852fa4c9 | ||
|
|
4c959afc07 | ||
|
|
7af4dd377e | ||
|
|
3de7046bc3 | ||
|
|
029d334c68 | ||
|
|
1d3728d0fb | ||
|
|
336ce525d7 | ||
|
|
04e0bce867 | ||
|
|
c0e28dfae6 | ||
|
|
5eb28b95bc | ||
|
|
206f778c8d | ||
|
|
c56a65dcc6 | ||
|
|
576198eef1 | ||
|
|
7274e83c2a | ||
|
|
5fbd725988 | ||
|
|
14bd190690 | ||
|
|
750ce4d6ee | ||
|
|
063b52d390 | ||
|
|
3123910725 | ||
|
|
b5be3ce7d4 | ||
|
|
c04a9db3f1 | ||
|
|
a98d9b0127 | ||
|
|
a6025a81a4 | ||
|
|
871543dac7 | ||
|
|
aea7bfee72 | ||
|
|
72bb0cfa68 | ||
|
|
dba0c50104 | ||
|
|
b42d8b03c8 | ||
|
|
ca5cf8bbf4 | ||
|
|
846ba4a2c0 | ||
|
|
7d1ad2c74b | ||
|
|
63d2572917 | ||
|
|
82cc1b2bfd | ||
|
|
e680c6133b | ||
|
|
fc3e089fe6 | ||
|
|
d2b4f7de3c | ||
|
|
fb746fd393 | ||
|
|
6579122dbf | ||
|
|
b7c344e758 | ||
|
|
1ca4076923 | ||
|
|
37e650b1bc | ||
|
|
ebabdd99a7 | ||
|
|
22cd501286 | ||
|
|
9bfb5a41b9 | ||
|
|
60cd3e0147 | ||
|
|
d56a580bdd | ||
|
|
ef106149f7 | ||
|
|
2e3365386e | ||
|
|
b42d830267 | ||
|
|
6e1e05e1dd | ||
|
|
fba427b093 | ||
|
|
2f3dfb5dfd | ||
|
|
2cdd793b5e | ||
|
|
1ffa0ae294 | ||
|
|
8bafd8a0da | ||
|
|
a6db22e556 | ||
|
|
145c2179d6 | ||
|
|
a973331419 | ||
|
|
7a77b2df6c | ||
|
|
9fea4ab9f9 | ||
|
|
4cd9cfb812 | ||
|
|
3e9c78e028 | ||
|
|
51c05dec82 | ||
|
|
455cf1869c | ||
|
|
74d036322a | ||
|
|
8b853a2a1e | ||
|
|
b2170207ad | ||
|
|
3df7004da4 | ||
|
|
dbee1395e4 | ||
|
|
611f0cf65e | ||
|
|
644ab39a24 | ||
|
|
8c25a43ace | ||
|
|
6b22cfbbac | ||
|
|
20c2e81d68 | ||
|
|
9d79d50820 | ||
|
|
a4006c50ef | ||
|
|
1199dbe633 | ||
|
|
ff0abe5e37 | ||
|
|
38dab45950 | ||
|
|
667a10ed0f | ||
|
|
6d9b82c696 | ||
|
|
08f62964bd | ||
|
|
2c1a1037c6 | ||
|
|
32d3b7338e | ||
|
|
a5b61285a7 | ||
|
|
02ccab744b | ||
|
|
145139b012 | ||
|
|
66f4f249bf | ||
|
|
4259485ebf | ||
|
|
051dde06ae | ||
|
|
751f006ee2 | ||
|
|
5e3cd5ebb5 | ||
|
|
5804a0d54a | ||
|
|
86ff876887 | ||
|
|
df5187a91f | ||
|
|
148bbbc893 | ||
|
|
f2ac4044c8 | ||
|
|
43096baf33 | ||
|
|
9c0315ea57 | ||
|
|
33f1b79836 | ||
|
|
b6eaa766b6 | ||
|
|
b41126c325 | ||
|
|
74ae6fc2f8 | ||
|
|
fe665bdefe | ||
|
|
493237dbd1 | ||
|
|
8211edd675 | ||
|
|
afea6d35ec | ||
|
|
dc9ecb6a41 | ||
|
|
c9b4e1517b | ||
|
|
7ae6e6d444 | ||
|
|
f484decf70 | ||
|
|
5e071ed04d | ||
|
|
ca3f0133ef | ||
|
|
d1fc8c8465 | ||
|
|
ae475cb650 | ||
|
|
41d67eae8d | ||
|
|
908f796b86 | ||
|
|
595dfca752 | ||
|
|
1fc5121607 | ||
|
|
50952e0fee | ||
|
|
e119369082 | ||
|
|
96ab5555eb | ||
|
|
b047cad313 | ||
|
|
e85a4b93d4 | ||
|
|
1b8f60a970 | ||
|
|
69e6a8f7d3 | ||
|
|
4c1a325cf2 | ||
|
|
ad8a426d0f | ||
|
|
51687cf23b | ||
|
|
b5a2f9d664 | ||
|
|
8ed54079fe | ||
|
|
62b5734d6a | ||
|
|
b9c53f0450 | ||
|
|
ebcb5ad836 | ||
|
|
3518a79713 | ||
|
|
32cafeec0d | ||
|
|
fc5ff178f4 | ||
|
|
c9619810e9 | ||
|
|
6bdf96a634 | ||
|
|
c9ce94ef8e | ||
|
|
ddc473bcbf | ||
|
|
661a51c2e6 | ||
|
|
9fbc9294c1 | ||
|
|
117ded3835 | ||
|
|
7df87d2580 | ||
|
|
70c81873e0 | ||
|
|
58c25045be | ||
|
|
6724125aa5 | ||
|
|
d0ed7ceda0 | ||
|
|
3f178b45e9 | ||
|
|
2e7a23cebf | ||
|
|
89a73d6da4 | ||
|
|
53f0f48043 | ||
|
|
1cc9561b2e | ||
|
|
46b9d23028 | ||
|
|
915b573e3f | ||
|
|
47e1c7438c | ||
|
|
6a5ed67b18 | ||
|
|
b3d902ea74 | ||
|
|
8f88c967d6 | ||
|
|
7d74faa6ec | ||
|
|
07f07a9e71 | ||
|
|
b980a7a7e7 | ||
|
|
f864a0ff3d | ||
|
|
fd3d71879a | ||
|
|
694b0720be | ||
|
|
70d1511ad8 | ||
|
|
7e1229973c | ||
|
|
dae428b1cc | ||
|
|
8e1057b2cd | ||
|
|
3586079172 | ||
|
|
750a1e716e | ||
|
|
10355d147e | ||
|
|
845e776fb1 | ||
|
|
c904c1ae23 | ||
|
|
2f9153f71a | ||
|
|
eb56ef0b80 | ||
|
|
c53f870276 | ||
|
|
79db5ee378 | ||
|
|
99fa3b6ce3 | ||
|
|
777ccab296 | ||
|
|
9b0cfefb70 | ||
|
|
2af3ff840a | ||
|
|
3c27adc72c | ||
|
|
e1645749ce | ||
|
|
ed6fcf8e88 | ||
|
|
15e3a37879 | ||
|
|
6cc5706528 | ||
|
|
fd9dc6dc71 | ||
|
|
dc067d9d88 | ||
|
|
8d4304572e | ||
|
|
99c5bbc3af | ||
|
|
f2309b4c2d | ||
|
|
8912637526 | ||
|
|
f05a87b350 | ||
|
|
3ea2dc04ba | ||
|
|
452d6d03a6 | ||
|
|
228e53e8c6 | ||
|
|
6ee680af34 | ||
|
|
3c626fe220 | ||
|
|
38302c0c89 | ||
|
|
6b12459157 | ||
|
|
35e1ece68f | ||
|
|
7fe2f970fd | ||
|
|
f98271b612 | ||
|
|
cad997a424 | ||
|
|
d8e63b5bf9 | ||
|
|
86e6b675b0 | ||
|
|
1d98ae0543 | ||
|
|
11dd650525 | ||
|
|
b0b3c242cd | ||
|
|
35f85e5155 | ||
|
|
86572486f8 | ||
|
|
d992f3098b | ||
|
|
2aae6549e1 | ||
|
|
56df13b9c5 | ||
|
|
fd45ea4f85 | ||
|
|
b487d387e6 | ||
|
|
c45d366abf | ||
|
|
1ff427da29 | ||
|
|
06c8b34cbd | ||
|
|
f4bcc3e32f | ||
|
|
5723e151a5 | ||
|
|
e7bea855b6 | ||
|
|
c88f99faeb | ||
|
|
5657d76924 | ||
|
|
6e5ee99738 | ||
|
|
28f8181317 | ||
|
|
c3b10ef137 | ||
|
|
f82ef1e272 | ||
|
|
f02e6be746 | ||
|
|
82db77d4fb | ||
|
|
94f220927b | ||
|
|
639fbde2f5 | ||
|
|
d862db60a2 | ||
|
|
9d30a5d38d | ||
|
|
b464ace435 | ||
|
|
44ddc49826 | ||
|
|
82cca0d48b | ||
|
|
ae8be3e7b8 | ||
|
|
3752469ca6 | ||
|
|
89f1e5dc50 | ||
|
|
8b3b8b77f0 | ||
|
|
3f51838418 | ||
|
|
8ee08d337c | ||
|
|
e421099501 | ||
|
|
6deb227c9c | ||
|
|
ae8e7ba6e1 | ||
|
|
8892310c43 | ||
|
|
b54ab2026d | ||
|
|
97de07e73f | ||
|
|
7df07124f6 | ||
|
|
841f13b627 | ||
|
|
1e556db4a3 | ||
|
|
38a6405873 | ||
|
|
a99e18a526 | ||
|
|
783b66f200 | ||
|
|
4c36ab7089 | ||
|
|
4aa59d97bd | ||
|
|
de6431e60d | ||
|
|
e5b2451474 | ||
|
|
aa4a12d9d2 | ||
|
|
4451b69a36 | ||
|
|
de88fc736a | ||
|
|
1d923b140b | ||
|
|
2a40d45436 | ||
|
|
e1ca6b4aeb | ||
|
|
05d899f92a | ||
|
|
99c149db53 | ||
|
|
64a7b56d5e | ||
|
|
51881fbcea | ||
|
|
99fb5a522a | ||
|
|
42c75ca193 | ||
|
|
432c3ffc1f | ||
|
|
5b5c83c2d3 | ||
|
|
ead43e83c0 | ||
|
|
7b9a93526f | ||
|
|
cc0d698984 | ||
|
|
77c6e839a9 | ||
|
|
32bc1cd58a | ||
|
|
a37f8ac53e | ||
|
|
f7f16de3f9 | ||
|
|
ffb8e62846 | ||
|
|
19fcf86495 | ||
|
|
26b71f49eb | ||
|
|
a871c3927f | ||
|
|
6e18c894cf | ||
|
|
b687207b79 | ||
|
|
62f61ae822 | ||
|
|
7f467f3582 | ||
|
|
2a455361bb | ||
|
|
eb66d55337 | ||
|
|
8f32faf290 | ||
|
|
f7a9eab6cf | ||
|
|
b48b73e257 | ||
|
|
50cafea917 | ||
|
|
27e6bef1c6 | ||
|
|
3338188427 | ||
|
|
1ca8a0e08d | ||
|
|
0d3bd77be1 | ||
|
|
a2b3fa347d | ||
|
|
68aa9139e4 | ||
|
|
a418adda08 | ||
|
|
d8e27497af | ||
|
|
52d498cd64 | ||
|
|
8ecae333e4 | ||
|
|
8baaf0d305 | ||
|
|
ccdc1c4359 | ||
|
|
2304d41790 | ||
|
|
20d725c6eb | ||
|
|
ad32793254 | ||
|
|
31fbcda1ef | ||
|
|
2e13fc3c86 | ||
|
|
bac32c1b64 | ||
|
|
3c67876ec4 | ||
|
|
d4cca283a1 | ||
|
|
2b356bc5bb | ||
|
|
c4ef7d74c7 | ||
|
|
ea55eba0d3 | ||
|
|
a4e37230ea | ||
|
|
789c670fb3 | ||
|
|
148d5c122d | ||
|
|
b77e92c492 | ||
|
|
fff03075ad | ||
|
|
5149fa6a34 | ||
|
|
5ad397e2a0 | ||
|
|
ef3e01b2b4 | ||
|
|
257b47f01c | ||
|
|
4eb3e1a230 | ||
|
|
92fa603842 | ||
|
|
7e8ab58db1 | ||
|
|
e04535a449 | ||
|
|
a6f93c39c3 | ||
|
|
a62fed42a4 | ||
|
|
3dc781b67c | ||
|
|
d7ee22b271 | ||
|
|
33e8d9307c | ||
|
|
ece1d17e57 | ||
|
|
d675a717da | ||
|
|
0fa703a361 | ||
|
|
6f6977005c | ||
|
|
e9cb2134b8 | ||
|
|
fed797cf9d | ||
|
|
0bce1684c5 | ||
|
|
0c53e29d87 | ||
|
|
1eeb92635a | ||
|
|
28e0d36873 | ||
|
|
ff77d6d7c3 | ||
|
|
9a3ce86ab9 | ||
|
|
c2ccf084e3 | ||
|
|
9c5972cc6e | ||
|
|
81c4e5477a | ||
|
|
60f0d61f7e | ||
|
|
0a4e786ad8 | ||
|
|
69329e38fe | ||
|
|
54aadbcdf0 | ||
|
|
f277a4033c | ||
|
|
acd1ca8191 | ||
|
|
80b21e9dce | ||
|
|
c3a13e7ff6 | ||
|
|
75090d7b62 | ||
|
|
8c416d926e | ||
|
|
992d99ef43 | ||
|
|
69d46f87ef | ||
|
|
631e2d2034 | ||
|
|
2a4abf0dab | ||
|
|
8271d7284a | ||
|
|
153abf8b4d | ||
|
|
da35c506dd | ||
|
|
c439c8fcbb | ||
|
|
c58b2d99ca | ||
|
|
5c492dc32c | ||
|
|
df23f6d81e | ||
|
|
a613ecae8f | ||
|
|
79648966e4 | ||
|
|
6bd223eae3 | ||
|
|
ba7d99eef0 | ||
|
|
edb94a5acb | ||
|
|
d713f527bb | ||
|
|
002add50a8 | ||
|
|
2cf33bd3b4 | ||
|
|
7ad2f68067 | ||
|
|
35e7f3daaa | ||
|
|
4e2f156283 | ||
|
|
3f8b94159a | ||
|
|
cbd0bdfa96 | ||
|
|
62ff5ce10b | ||
|
|
7711fb73be | ||
|
|
fbcff1c752 | ||
|
|
7de4c964c0 | ||
|
|
4628d34d47 | ||
|
|
47f3cd4d99 | ||
|
|
67a7e9e385 | ||
|
|
f14c309400 | ||
|
|
fc583283d5 | ||
|
|
0d4ce41cf5 | ||
|
|
31ec3a3962 | ||
|
|
f67cc3b96f | ||
|
|
868de24bb5 | ||
|
|
5442b2e9b9 | ||
|
|
9da43ace6b | ||
|
|
eee1a99532 | ||
|
|
5d1fa83609 | ||
|
|
3cb5aae609 | ||
|
|
5a29159da7 | ||
|
|
27dabbd961 | ||
|
|
9e4e33053f | ||
|
|
390f55af09 | ||
|
|
30a9e22992 | ||
|
|
2060747c79 | ||
|
|
7e5647a068 | ||
|
|
69dd443d63 | ||
|
|
ff45bfaf14 | ||
|
|
4628698254 | ||
|
|
b6e7fb0d50 | ||
|
|
c8e236c42b | ||
|
|
00e9964d93 | ||
|
|
ca6783642d | ||
|
|
81777e8de7 | ||
|
|
57bcc5d977 | ||
|
|
ccdb1964d1 | ||
|
|
441b7717d1 | ||
|
|
1ca16c0791 | ||
|
|
3255f4c635 | ||
|
|
1f92049a42 | ||
|
|
71e137989b | ||
|
|
df20a09801 | ||
|
|
2c78142979 | ||
|
|
5d2117bae7 | ||
|
|
ed38a43f75 | ||
|
|
a4caa04804 | ||
|
|
1630fa09b2 | ||
|
|
2a95e241e9 | ||
|
|
dfb64c2671 | ||
|
|
caf7536557 | ||
|
|
a75802872d | ||
|
|
392a39500b | ||
|
|
ecf79b0ac2 | ||
|
|
4ef5544fff | ||
|
|
49000dbf99 | ||
|
|
a839a57ff8 | ||
|
|
d4c8f42880 | ||
|
|
b4694ec541 | ||
|
|
83d6fa9563 | ||
|
|
633d5407a8 | ||
|
|
15cf3ce767 | ||
|
|
b8e47d1355 | ||
|
|
c6505dafa7 | ||
|
|
aac42b0e3f | ||
|
|
e6626c027b | ||
|
|
2ba35ab26e | ||
|
|
134197fc4f | ||
|
|
7b22bed0bb | ||
|
|
8cf85733f6 | ||
|
|
5941ff2111 | ||
|
|
96b0c7d20d | ||
|
|
b09e389810 | ||
|
|
49a807da2d | ||
|
|
b27b31a03e | ||
|
|
0b48abec61 | ||
|
|
cdfb005941 | ||
|
|
6ac95efaf8 | ||
|
|
eb9a891946 | ||
|
|
6c48936998 | ||
|
|
bbe91002db | ||
|
|
908b6a0310 | ||
|
|
ed82f49d52 | ||
|
|
9114c4a449 | ||
|
|
8156facb79 | ||
|
|
b8be56336e | ||
|
|
7a0f207379 | ||
|
|
e3c482bdae | ||
|
|
235ae9db7b | ||
|
|
9d0148c5b0 | ||
|
|
e1f91d9c45 | ||
|
|
d0bc8065c7 | ||
|
|
6e05c5b1a4 | ||
|
|
167ae86d9e | ||
|
|
237c1f5bba | ||
|
|
4c79e2e9f5 | ||
|
|
40dccc102d | ||
|
|
e931c5925c | ||
|
|
f802362180 | ||
|
|
4a12193f5e | ||
|
|
544b6c33ab | ||
|
|
f4d16e3240 | ||
|
|
c4157fe996 | ||
|
|
d90a54c043 | ||
|
|
b37b8cb748 | ||
|
|
50834581e0 | ||
|
|
e6540f80cb | ||
|
|
2e6c4d782b | ||
|
|
214a0167f0 | ||
|
|
bf4ceb4a12 | ||
|
|
7d4f2d6a7c | ||
|
|
4cf924be09 | ||
|
|
34e586d5b9 | ||
|
|
e8adbc0279 | ||
|
|
54fb5586c4 | ||
|
|
6142074c52 | ||
|
|
df01636bd9 | ||
|
|
42b5777e9f | ||
|
|
e46614e6c8 | ||
|
|
77f37dc003 | ||
|
|
0c64d08ae7 | ||
|
|
2429ef124a | ||
|
|
143a1ccfd5 | ||
|
|
4059b56e74 | ||
|
|
ca2032e66d | ||
|
|
30da73de36 | ||
|
|
5248ab48c8 | ||
|
|
02e1cdf7e8 | ||
|
|
ba25bda682 | ||
|
|
fa23ac7310 | ||
|
|
bd6345ff1b | ||
|
|
9ba365f134 | ||
|
|
efe6e42352 | ||
|
|
8d21d11638 | ||
|
|
a6cd3f67c3 | ||
|
|
5020ab053b | ||
|
|
6bcc04a122 | ||
|
|
90674903c4 | ||
|
|
aaecc62dd9 | ||
|
|
2b3d123d93 | ||
|
|
e962647764 | ||
|
|
29607952c0 | ||
|
|
4fc2089b79 | ||
|
|
7611c6f483 | ||
|
|
d63d53e37b | ||
|
|
83242bfd2b | ||
|
|
97136e7647 | ||
|
|
f89521fdfe | ||
|
|
258f8c739b | ||
|
|
0d2ce02d14 | ||
|
|
91d3876ee2 | ||
|
|
238a498f13 | ||
|
|
50c0c63208 | ||
|
|
c270cdebcb | ||
|
|
d19314125e | ||
|
|
bb116685ba | ||
|
|
52425f1d69 | ||
|
|
73bbfb0072 | ||
|
|
27f103258b | ||
|
|
69af608285 | ||
|
|
98ace5c30f | ||
|
|
8a65131bee | ||
|
|
7aed734132 | ||
|
|
a904db796a | ||
|
|
4280a49ae3 | ||
|
|
bd76609759 | ||
|
|
0ca8329bcb | ||
|
|
daa6109f75 | ||
|
|
5466f34839 | ||
|
|
4695b284df | ||
|
|
435deb5588 | ||
|
|
c96d03d417 | ||
|
|
17d3e898d7 | ||
|
|
50d2a1f377 | ||
|
|
3394356c02 | ||
|
|
bcb564f007 | ||
|
|
4b174b6e6e | ||
|
|
5c6b93be9a | ||
|
|
f9ab270d0b | ||
|
|
0cead8187c | ||
|
|
f45da4fd55 | ||
|
|
4a0303df11 | ||
|
|
60161f1564 | ||
|
|
8f14c31189 | ||
|
|
1722fe906a | ||
|
|
8085b14742 | ||
|
|
258d555b23 | ||
|
|
f5b953ca85 | ||
|
|
9620dc7bda | ||
|
|
b38052fc61 | ||
|
|
dddce8c3b5 | ||
|
|
ecf4583b04 | ||
|
|
a779a909e7 | ||
|
|
e3ed25ca3f | ||
|
|
00600f316c | ||
|
|
cb0dd060c7 | ||
|
|
bed9c57e40 | ||
|
|
af805ec2ae | ||
|
|
acfc96d2e1 | ||
|
|
f59f13ab64 | ||
|
|
edca144500 | ||
|
|
2b1c75597f | ||
|
|
98eda3653c | ||
|
|
673fa8a01b | ||
|
|
28944d9cea | ||
|
|
180d39b774 | ||
|
|
ae5a81e394 | ||
|
|
081927560a | ||
|
|
f6aaeb2e77 | ||
|
|
a707b9e5a7 | ||
|
|
5d77bc1cb6 | ||
|
|
ca270e7d24 | ||
|
|
874ce0a211 | ||
|
|
b1fb63ece7 | ||
|
|
38810cabc0 | ||
|
|
eb7f11584f | ||
|
|
2d366736b9 | ||
|
|
bfd8c99664 | ||
|
|
5d78e5133b | ||
|
|
e10dd870c7 | ||
|
|
d46c8fbdd7 | ||
|
|
86a4f79c76 | ||
|
|
0298981187 | ||
|
|
a1c39e3041 | ||
|
|
b775f4788a | ||
|
|
da96140bff | ||
|
|
847ecec5d7 | ||
|
|
004b45dfbe | ||
|
|
fb3020db9c | ||
|
|
e1d1c67cf1 | ||
|
|
61d74e4fc7 | ||
|
|
48b07a2cf2 | ||
|
|
9adf99cc1d | ||
|
|
ac0b5e80b1 | ||
|
|
3676f93091 | ||
|
|
a1e0f1ac14 | ||
|
|
eb419dae48 | ||
|
|
beaaee18a3 | ||
|
|
e8ed6ef97b | ||
|
|
fbb6c3bec1 | ||
|
|
fcdf12aad5 | ||
|
|
d4264fcb05 | ||
|
|
b7a4ffa6c8 | ||
|
|
d4551c2a74 | ||
|
|
4c7a925272 | ||
|
|
2f3bf08c73 | ||
|
|
3bb09b961f | ||
|
|
9c200b4d28 | ||
|
|
92a2da4944 | ||
|
|
979c528441 | ||
|
|
df2218dd9e | ||
|
|
cd59b4628b | ||
|
|
c49fe9643c | ||
|
|
c13d4152e3 | ||
|
|
27803fc1b1 | ||
|
|
8e17e0f7de | ||
|
|
a29e9ad060 | ||
|
|
ebe6074d2f | ||
|
|
742ccc82f5 | ||
|
|
e0a2e408c8 | ||
|
|
a37d857f2e | ||
|
|
b0564cd829 | ||
|
|
dd7cf9b5b1 | ||
|
|
03a7be4590 | ||
|
|
b004a1a6d0 | ||
|
|
93087b4bea | ||
|
|
54b96b5a21 | ||
|
|
f486d713bc | ||
|
|
f0c4a41376 | ||
|
|
8bbe74eab0 | ||
|
|
5387fd9909 | ||
|
|
169ea81a2e | ||
|
|
230ce7b8c2 | ||
|
|
d896882605 | ||
|
|
33acdaea73 | ||
|
|
2c1ed40631 | ||
|
|
275e4a25ba | ||
|
|
38ba2d94d5 | ||
|
|
702135127e | ||
|
|
7e2dd62642 | ||
|
|
217a9a5ea0 | ||
|
|
59318f16fc | ||
|
|
256ffc06c6 | ||
|
|
5a854190a3 | ||
|
|
692f3375c4 | ||
|
|
92df2ccbd4 | ||
|
|
27199ce73f | ||
|
|
9875d94239 | ||
|
|
99464ce5fd | ||
|
|
1c02ee9f86 | ||
|
|
d400aa697f | ||
|
|
59a35bc32f | ||
|
|
8ca1787ffe | ||
|
|
4f301728a5 | ||
|
|
fa00d72bc4 | ||
|
|
e8af2119bd | ||
|
|
6eaf2d5023 | ||
|
|
5a10336b5a | ||
|
|
df32789d46 | ||
|
|
43a63010d1 | ||
|
|
5a557d72ae | ||
|
|
2bb9a33f4d | ||
|
|
7e10edeacf | ||
|
|
8a9274e9d6 | ||
|
|
59159e9dfe | ||
|
|
1f35e0a04c | ||
|
|
b275a73219 | ||
|
|
98b909eb6b | ||
|
|
34673b8f9e | ||
|
|
13ceb50706 | ||
|
|
412d0add5a | ||
|
|
4b40e12399 | ||
|
|
04aeafd41a | ||
|
|
a4eb901f54 | ||
|
|
a6d7ccf209 | ||
|
|
d5f402d8c6 | ||
|
|
94accb2fc7 | ||
|
|
b4d1d896af | ||
|
|
9f15cbd1bd | ||
|
|
5cd0db7fc2 | ||
|
|
2f8fb284e0 | ||
|
|
7a24d2b40b | ||
|
|
639dba992f | ||
|
|
8149fa4c9b | ||
|
|
f7854c4d17 | ||
|
|
57191011f6 | ||
|
|
80ea367e86 | ||
|
|
5a58d9854e | ||
|
|
1911c4e4d3 | ||
|
|
587185d7ca | ||
|
|
2589a07d5b | ||
|
|
96db249ec3 | ||
|
|
7cc3cd1861 | ||
|
|
f966e3dacd | ||
|
|
0257ba25ee | ||
|
|
d6e9e1b9ad | ||
|
|
8c143b9f1d | ||
|
|
580f31aa92 | ||
|
|
198220fee0 | ||
|
|
b27b4320eb | ||
|
|
50681e94de | ||
|
|
8d33404471 | ||
|
|
555f303d71 | ||
|
|
c10829cb59 | ||
|
|
75ef977af7 | ||
|
|
632f1cacc1 | ||
|
|
3ed13a724b | ||
|
|
d121ce38a0 | ||
|
|
6aca798337 | ||
|
|
7ca94fb86d | ||
|
|
7d6855108a | ||
|
|
43dcf964eb | ||
|
|
ac4f0092a0 | ||
|
|
7301979853 | ||
|
|
e7d7a8170e | ||
|
|
876498d1eb | ||
|
|
3be3d684c2 | ||
|
|
4d096639bc | ||
|
|
4003fcee5e | ||
|
|
24976b0b18 | ||
|
|
23b89f19c9 | ||
|
|
e1871db87e | ||
|
|
8085996e7f | ||
|
|
c0d856f5bb | ||
|
|
cb816ff88c | ||
|
|
5814ba61a0 | ||
|
|
47b0c08a9f | ||
|
|
988eaa952c | ||
|
|
4a74358841 | ||
|
|
35f41f6a1d | ||
|
|
d0aa909e23 | ||
|
|
ecb5a962fe | ||
|
|
170ebb1f69 | ||
|
|
818496052b | ||
|
|
593974c3ba | ||
|
|
bc14f0eb17 | ||
|
|
8fee3c22cb | ||
|
|
f040981a26 | ||
|
|
894f79e85e | ||
|
|
f96381c532 | ||
|
|
b60563f9ec | ||
|
|
4e4fe42d78 | ||
|
|
1d2a704d20 | ||
|
|
2e0d493a20 | ||
|
|
37207fe11e | ||
|
|
5846246979 | ||
|
|
917a5230d6 | ||
|
|
61f33305f8 | ||
|
|
cfd4928f35 | ||
|
|
89731ecc00 | ||
|
|
4d5f66b2ed | ||
|
|
9815e50527 | ||
|
|
2422c0617b | ||
|
|
7011fe7fc1 | ||
|
|
cbc140cc8e | ||
|
|
744ee56b12 | ||
|
|
ba8f7bc4e6 | ||
|
|
499fce381e | ||
|
|
eac0eb7881 | ||
|
|
24b5372b33 | ||
|
|
5c61905f0e | ||
|
|
32e419cc84 | ||
|
|
89257ed01f | ||
|
|
a51e13d781 | ||
|
|
963f1afd0a | ||
|
|
94e760238a | ||
|
|
e0baec67b1 | ||
|
|
ad383a25e0 | ||
|
|
0b0b1920dc | ||
|
|
b7ff04918d | ||
|
|
ab7e02511c | ||
|
|
b74f2a54b5 | ||
|
|
ddcef18796 | ||
|
|
962c93df68 | ||
|
|
4de6bf5f15 | ||
|
|
7b0173cd92 | ||
|
|
14ecc50063 | ||
|
|
3593d7e84c | ||
|
|
9a199b5e98 | ||
|
|
b2ac9c284d | ||
|
|
2606d77b9d | ||
|
|
a280eab275 | ||
|
|
515178a55d | ||
|
|
c2d530c6a9 | ||
|
|
5461495672 | ||
|
|
76bc7542e3 | ||
|
|
b383e76259 | ||
|
|
d60d874245 | ||
|
|
07a5141e0d | ||
|
|
3be554e7b5 | ||
|
|
4bf1438d37 | ||
|
|
1c8e0c82bf | ||
|
|
194286b793 | ||
|
|
ee323bff2a | ||
|
|
f23933cd51 | ||
|
|
f6b5e55922 | ||
|
|
c792dc00f2 | ||
|
|
71f8c3d7c7 | ||
|
|
a81f697336 | ||
|
|
52d4e80c00 | ||
|
|
d8260be26b | ||
|
|
0d66b135a6 | ||
|
|
1342afdcf1 | ||
|
|
241f3941de | ||
|
|
5d17ecc875 | ||
|
|
282c805eb7 | ||
|
|
3f987fbd74 | ||
|
|
1d825e8ba7 | ||
|
|
7391eeab16 | ||
|
|
153548e1c9 | ||
|
|
e6ffa26b48 | ||
|
|
30f925a33d | ||
|
|
8fd2d84fa4 | ||
|
|
df494570af | ||
|
|
f46e700a28 | ||
|
|
28a8c8cb2e | ||
|
|
4d4133db17 | ||
|
|
120e5dab7b | ||
|
|
4a5e0b9a0e | ||
|
|
147f733168 | ||
|
|
8842c9b930 | ||
|
|
6a7984adfe | ||
|
|
601e0eba5e | ||
|
|
4cacfb312f | ||
|
|
d5114737fd | ||
|
|
0ba3dca017 | ||
|
|
57e7c4d781 | ||
|
|
bf7832c37a | ||
|
|
2ab3181220 | ||
|
|
96fead56f4 | ||
|
|
d12a03afb2 | ||
|
|
f03cdb6370 | ||
|
|
895e006577 | ||
|
|
595ba7a05b | ||
|
|
c2064b42a2 | ||
|
|
f4bb014558 | ||
|
|
2d835e7e47 | ||
|
|
5753b4d3a0 | ||
|
|
87f68d993c | ||
|
|
3826889094 | ||
|
|
897d69d466 | ||
|
|
82f02c752b | ||
|
|
23f42fcb05 | ||
|
|
f5450155e1 | ||
|
|
fca312892f | ||
|
|
f9d42c747f | ||
|
|
70cb614dd9 | ||
|
|
44d8849387 | ||
|
|
06c62c95a3 | ||
|
|
5399e1ccb7 | ||
|
|
4914f9d8e4 | ||
|
|
1f624e8f04 | ||
|
|
44bfa2d248 | ||
|
|
01cb613ac1 | ||
|
|
5e76628a60 | ||
|
|
4d3ad643b8 | ||
|
|
36de2be344 | ||
|
|
7d57dfba18 | ||
|
|
70728b9425 | ||
|
|
e39ea41859 | ||
|
|
a9e59ceb15 | ||
|
|
440dcafbf3 | ||
|
|
c76f9909a2 | ||
|
|
fc62ea3678 | ||
|
|
6c9ae2df08 | ||
|
|
763bf1361e | ||
|
|
b31731e4ce | ||
|
|
25c5428af8 | ||
|
|
5edf678070 | ||
|
|
2031562612 | ||
|
|
22c153fe7b | ||
|
|
b52967df83 | ||
|
|
119fe2bfe8 | ||
|
|
d1e5d22bb2 | ||
|
|
ea96df6f46 | ||
|
|
561be072fd | ||
|
|
a940edf149 | ||
|
|
e1d17a6621 | ||
|
|
3346a5d069 | ||
|
|
034597aebe | ||
|
|
c9c6db0307 | ||
|
|
df7ad44038 | ||
|
|
9779740f37 | ||
|
|
de82a95c8c | ||
|
|
0aaaa64320 | ||
|
|
405cdd23c8 | ||
|
|
22c7977472 | ||
|
|
f1015223ed | ||
|
|
fbd0e803f5 | ||
|
|
5aaa3eaf10 | ||
|
|
47aa81f887 | ||
|
|
7a58577c40 | ||
|
|
aeadc2d08d | ||
|
|
f77a65d9d4 | ||
|
|
dfd39434e3 | ||
|
|
7790c1ad9c | ||
|
|
36947c99bc | ||
|
|
540481040b | ||
|
|
719918611c | ||
|
|
aa94e40f1a | ||
|
|
8b7f58ab3c | ||
|
|
7bb8856626 | ||
|
|
612e5331ad | ||
|
|
01e5cb02a3 | ||
|
|
cde014ca66 | ||
|
|
460bc80b0e | ||
|
|
e5529bf0b8 | ||
|
|
9edbe5b45d | ||
|
|
eff6e0fd5e | ||
|
|
f9c524f923 | ||
|
|
7a8a688789 | ||
|
|
891ac58db7 | ||
|
|
8c8ca254b1 | ||
|
|
915ece3cba | ||
|
|
a92eaad364 | ||
|
|
502cd1efc7 | ||
|
|
3b43f14bd3 | ||
|
|
aefedb080a | ||
|
|
0685de255a | ||
|
|
9dda965075 | ||
|
|
2cf255f928 | ||
|
|
ea6fe4f1f9 | ||
|
|
e3823e3854 | ||
|
|
ba5ee4bd59 | ||
|
|
07f4c06751 | ||
|
|
6e35da0794 | ||
|
|
46250d0a36 | ||
|
|
7e6fe21ee8 | ||
|
|
ad1f779a36 | ||
|
|
77eb37e301 | ||
|
|
49c320b36f | ||
|
|
73b63eb2a5 | ||
|
|
28621261c8 | ||
|
|
ac9efccb00 | ||
|
|
124bc20fe4 | ||
|
|
9e09ebcd19 | ||
|
|
8957836cb5 | ||
|
|
19bedc8578 | ||
|
|
adb9c767ca | ||
|
|
57c1298fdf | ||
|
|
5e7ca2acf8 | ||
|
|
dabfe59776 | ||
|
|
f5defbd9b7 | ||
|
|
9454f93684 | ||
|
|
025b1100d2 | ||
|
|
3f61543a91 | ||
|
|
853149f4fe | ||
|
|
ba3c92d1c5 | ||
|
|
a2aa9d8bb8 | ||
|
|
c75e5b7c82 | ||
|
|
c3252e964e | ||
|
|
d54f209fd6 | ||
|
|
d9cc300f3b | ||
|
|
764e441b81 | ||
|
|
08cb20b3f9 | ||
|
|
046103d30b | ||
|
|
292497ba01 | ||
|
|
3cd1a47af6 | ||
|
|
1eaa6d5152 | ||
|
|
bfced5ecee | ||
|
|
51faaf23bd | ||
|
|
349cc4710f | ||
|
|
bbde48daa1 | ||
|
|
7ee23780a4 | ||
|
|
1e648d27d6 | ||
|
|
d9fe797e65 | ||
|
|
43763bae6a | ||
|
|
322aab6269 | ||
|
|
9bc057e191 | ||
|
|
b84e9eae1a | ||
|
|
125f9f6a8a | ||
|
|
ef56beeb67 | ||
|
|
0914a1cddd | ||
|
|
a7cc2d6484 | ||
|
|
1049e53f4c | ||
|
|
0eab1dd930 | ||
|
|
3ddaab1812 | ||
|
|
8487fade66 | ||
|
|
9262567bff | ||
|
|
00dd235681 | ||
|
|
51e89c24b2 | ||
|
|
80c1f0da8e | ||
|
|
100d711362 | ||
|
|
5ac7366170 | ||
|
|
ae45afeab4 | ||
|
|
f5f94a1ba7 | ||
|
|
4e8d388799 | ||
|
|
a2f8d160d5 | ||
|
|
4306e0bc94 | ||
|
|
92928f5ea4 | ||
|
|
4c203ed17c | ||
|
|
d592b29ae7 | ||
|
|
fed38c19f8 | ||
|
|
03e774325c | ||
|
|
78cb9bc6ed | ||
|
|
e3d83679ec | ||
|
|
c9cba49af2 | ||
|
|
ca8584134a | ||
|
|
42df532834 | ||
|
|
4cacaf8f66 | ||
|
|
bc83f2f618 | ||
|
|
39a7ea650f | ||
|
|
29c06c6d6a | ||
|
|
4e42d460b0 | ||
|
|
361e24e1e7 | ||
|
|
c32a6e4c6f | ||
|
|
56f3b0c295 | ||
|
|
5a3213de7c | ||
|
|
a1926fa40c | ||
|
|
e8346601d8 | ||
|
|
816b8237e2 | ||
|
|
f6d1c72f04 | ||
|
|
09b51fab5d | ||
|
|
3fb7dc1743 | ||
|
|
f4b791db8c | ||
|
|
9cb44715ee | ||
|
|
34658f5bf6 | ||
|
|
1771f85608 | ||
|
|
0a9a9efcf3 | ||
|
|
b27c18fb1e | ||
|
|
4051528619 | ||
|
|
966f57e21c | ||
|
|
26547830fb | ||
|
|
b82556ae25 | ||
|
|
4c4d5c60ef | ||
|
|
0fca89625e | ||
|
|
47b10a7742 | ||
|
|
bd7fed59fd | ||
|
|
ac17cc58d4 | ||
|
|
f3af975808 | ||
|
|
08022abc2d | ||
|
|
cbd4c73f17 | ||
|
|
9ef040228f | ||
|
|
446af992dc | ||
|
|
372a9629c1 | ||
|
|
1e59708d57 | ||
|
|
d5e1a5239e | ||
|
|
341249e471 | ||
|
|
69182ebaed | ||
|
|
e6803347f5 | ||
|
|
0dbad7d852 | ||
|
|
8f787ac240 | ||
|
|
dd7e2539fd | ||
|
|
079ba173e7 | ||
|
|
720180b9d4 | ||
|
|
1c2d96a428 | ||
|
|
7fcea33960 | ||
|
|
62802829e3 | ||
|
|
cce10d19b3 | ||
|
|
f524df3661 | ||
|
|
53798ca2b2 | ||
|
|
5207ade415 | ||
|
|
0a7d0ef76e | ||
|
|
42d0b173ba | ||
|
|
dda3d32d70 | ||
|
|
1281db945a | ||
|
|
e5db30cabf | ||
|
|
c7ac536631 | ||
|
|
8246fb0177 | ||
|
|
1ec9b3aa0d | ||
|
|
affaaecfb9 | ||
|
|
cc7ba3518e | ||
|
|
d942732a0a | ||
|
|
bc032919d8 | ||
|
|
96675c27b8 | ||
|
|
c249dfa1b7 | ||
|
|
633876903d | ||
|
|
2dd5f95279 | ||
|
|
8a6fcaa4c8 | ||
|
|
c64b1cd2fe | ||
|
|
b817656159 | ||
|
|
5bccad4e4b | ||
|
|
67f780367f | ||
|
|
e90e4590f2 | ||
|
|
3ecbe6226f | ||
|
|
a71f08582e | ||
|
|
f719e4da75 | ||
|
|
bfd710100c | ||
|
|
8fe7da0cfd | ||
|
|
eeb0411736 | ||
|
|
f5fe45832f | ||
|
|
48fa4a66e0 | ||
|
|
38736ca7bd | ||
|
|
95b7561599 | ||
|
|
d546b36c84 | ||
|
|
ec2d81223e | ||
|
|
97fe1591d9 | ||
|
|
cbcd671c5d | ||
|
|
4eb376a28d | ||
|
|
04664370c7 | ||
|
|
ca68a03062 | ||
|
|
249eb0a085 | ||
|
|
00c26ba6bf | ||
|
|
0ed2e8850a | ||
|
|
5a97fd4572 | ||
|
|
446a6ec0c7 | ||
|
|
16d83b9a69 | ||
|
|
7bc4ae6da8 | ||
|
|
7e2aa68ab6 | ||
|
|
789312e427 | ||
|
|
ddfa8bd6a4 | ||
|
|
d81b34c48f | ||
|
|
00e07f6d85 | ||
|
|
82de57b51b | ||
|
|
8eb3297670 | ||
|
|
3436e5ab25 | ||
|
|
ad327ebf31 | ||
|
|
0d4f454ad5 | ||
|
|
c1237abda6 | ||
|
|
a66438f908 | ||
|
|
8136303d07 | ||
|
|
76b46ea633 | ||
|
|
5156796d61 | ||
|
|
c192307dcf | ||
|
|
5bf3169323 | ||
|
|
c0fcd98ef9 | ||
|
|
4b4bbf050c | ||
|
|
704976db95 | ||
|
|
8bd4b3f833 | ||
|
|
5993ff13a3 | ||
|
|
e76b531c35 | ||
|
|
af2b1bd863 | ||
|
|
5d934cf0b4 | ||
|
|
63ad96223a | ||
|
|
4aadb70b4d | ||
|
|
9fed8c5977 | ||
|
|
b0b5056241 | ||
|
|
ab3b3b9c03 | ||
|
|
66aeaeb6f5 | ||
|
|
861f45621b | ||
|
|
c2943700d3 | ||
|
|
4214c05a0a | ||
|
|
5e2156e1ac | ||
|
|
4bc17baa5a | ||
|
|
12204f19bc | ||
|
|
6f45f8a08a | ||
|
|
ec11858386 | ||
|
|
0f008d3a79 | ||
|
|
d90cc02dc7 | ||
|
|
67284c22a6 | ||
|
|
64020d1638 | ||
|
|
a3f0be31f8 | ||
|
|
67e5e83714 | ||
|
|
4faf756f66 | ||
|
|
bffbbd96e1 | ||
|
|
34cb340e23 | ||
|
|
e2e8a47460 | ||
|
|
0b192df612 | ||
|
|
4780a4d9a1 | ||
|
|
5612a50ae2 | ||
|
|
31b10b655b | ||
|
|
7fe343ca94 | ||
|
|
4c59ec23d1 | ||
|
|
ee50e06936 | ||
|
|
48b8a18ada | ||
|
|
68ed9f664b | ||
|
|
ebc5a3a800 | ||
|
|
6633399c6c | ||
|
|
74a76eef9b | ||
|
|
23981df7df | ||
|
|
816a23bea8 | ||
|
|
2bed62ce5c | ||
|
|
521eb32640 | ||
|
|
0eb755927a | ||
|
|
1ac394a5c2 | ||
|
|
b7feff7c3e | ||
|
|
fd8c6885d9 | ||
|
|
8e3d684f96 | ||
|
|
1b34dda41b | ||
|
|
a7b072071c | ||
|
|
07d4e1f07d | ||
|
|
9632e323b9 | ||
|
|
f77ab5063e | ||
|
|
7a9dd28d13 | ||
|
|
c47a7a261b | ||
|
|
b5b6d5c1a7 | ||
|
|
3374645a8a | ||
|
|
da2b769d83 | ||
|
|
d8627fe912 | ||
|
|
693b8201bd | ||
|
|
990558f3e9 | ||
|
|
eed562f89a | ||
|
|
997ba5b632 | ||
|
|
de8d2d027f | ||
|
|
b070a9eadf | ||
|
|
d63405a43c | ||
|
|
6104a72f93 | ||
|
|
8f321bdf52 | ||
|
|
3025de75af | ||
|
|
5c59e16c9d | ||
|
|
66fd5fc23b | ||
|
|
ec6dd06039 | ||
|
|
0dfaa7fc02 | ||
|
|
1f55285563 | ||
|
|
f961c5ff69 | ||
|
|
4c55bbe84e | ||
|
|
ffeade219f | ||
|
|
94ea44f86c | ||
|
|
1859c289d3 | ||
|
|
24449c4ccb | ||
|
|
54587cf6ec | ||
|
|
011da6cb8c | ||
|
|
47411053af | ||
|
|
6a35760f1f | ||
|
|
304a4f2540 | ||
|
|
c907eeaead | ||
|
|
7635ec807d | ||
|
|
976dc82e55 | ||
|
|
2ab3492319 | ||
|
|
28fcdb480a | ||
|
|
59166f5149 | ||
|
|
f4038863e2 | ||
|
|
ed99068e15 | ||
|
|
823c317c0c | ||
|
|
4a221cb89e | ||
|
|
80a6ae1e66 | ||
|
|
e3933da174 | ||
|
|
6af106def0 | ||
|
|
ecb6eb504e | ||
|
|
a5239931ae | ||
|
|
86b2124a20 | ||
|
|
4f4d69e894 | ||
|
|
c402c54b8b | ||
|
|
505b219276 | ||
|
|
69f12a0069 | ||
|
|
1f8ab9e606 | ||
|
|
20bec5b4fd | ||
|
|
5ca7bc097e | ||
|
|
a1350a3bf7 | ||
|
|
1013c44229 | ||
|
|
b893fe749d | ||
|
|
bd24478a5d | ||
|
|
45e1ab641f | ||
|
|
22559aaeb3 | ||
|
|
6760f395ea | ||
|
|
8bff78dad7 | ||
|
|
0b3f92395d | ||
|
|
04a7a748cc | ||
|
|
4f873f1237 | ||
|
|
218f4125de | ||
|
|
0a107d6b92 | ||
|
|
8f564b57fe | ||
|
|
34d1147eb0 | ||
|
|
4a0b42fe1e | ||
|
|
ef04a7c923 | ||
|
|
7ac7081499 | ||
|
|
39c4cb7c9e | ||
|
|
7d32b5b957 | ||
|
|
7dbb611a31 | ||
|
|
0a1ccf23c8 | ||
|
|
58a5834839 | ||
|
|
af93a2c7cc | ||
|
|
7acdb1ca78 | ||
|
|
14e4fb4755 | ||
|
|
6b0d991d1d | ||
|
|
7a81dae844 | ||
|
|
137d445d78 | ||
|
|
8216c17939 | ||
|
|
7e17ae6023 | ||
|
|
e2ce7a824b | ||
|
|
a9a3650565 | ||
|
|
2a61872f8a | ||
|
|
0a75ddd78f | ||
|
|
3bddcd9e3d | ||
|
|
23e6b96c43 | ||
|
|
a22048c5dc | ||
|
|
0cf9e74cb2 | ||
|
|
497837bc4d | ||
|
|
2db47f04c9 | ||
|
|
7404fb931a | ||
|
|
70eeead4ae | ||
|
|
2e8eac3e44 | ||
|
|
d650d0570b | ||
|
|
c120c60094 | ||
|
|
f5e4399856 | ||
|
|
b2d471038a | ||
|
|
bbeb961bd5 | ||
|
|
b023f23e6c | ||
|
|
f47ecdb4ad | ||
|
|
2529ac0ca6 | ||
|
|
44627def1e | ||
|
|
f578e0af93 | ||
|
|
bd208c9f1d | ||
|
|
56c7b4556f | ||
|
|
4bd89164cd | ||
|
|
2c0284aae5 | ||
|
|
542178bb95 | ||
|
|
ff6b97fb15 | ||
|
|
9fb2047017 | ||
|
|
ddad430b16 | ||
|
|
30b5b1f168 | ||
|
|
f19bcaf4f2 | ||
|
|
d5361306f3 | ||
|
|
f0c83b3d5a | ||
|
|
397e00067a | ||
|
|
2047a1c1f5 | ||
|
|
fa176863e4 | ||
|
|
9df9583dae | ||
|
|
9e9294757a | ||
|
|
331cf153db | ||
|
|
4c9d876f3f | ||
|
|
ca8ce3c748 | ||
|
|
c6bc213629 | ||
|
|
47e22673f7 | ||
|
|
6276c71d9a | ||
|
|
ad86958d59 | ||
|
|
3787e743f7 | ||
|
|
1cf6ec2327 | ||
|
|
f733c6b52e | ||
|
|
81c9c905de | ||
|
|
604b5b8c26 | ||
|
|
f12430fa5d | ||
|
|
06ba9debd2 | ||
|
|
19715623b3 | ||
|
|
d885ca903c | ||
|
|
5cafdc1ce6 | ||
|
|
eee2215bda | ||
|
|
2b188ce191 | ||
|
|
474d46c354 | ||
|
|
0c9c9d03e4 | ||
|
|
57de49ed0a | ||
|
|
7f55d09e97 | ||
|
|
f02610dd2c | ||
|
|
d7afcd0c19 | ||
|
|
7ee17cd116 | ||
|
|
dbb2d8683f | ||
|
|
c239249d8e | ||
|
|
fff58fb461 | ||
|
|
60be64bf5a | ||
|
|
7fd4abbfe1 | ||
|
|
5fdb81885f | ||
|
|
bd4795dba7 | ||
|
|
8f3477b6ce | ||
|
|
2976a83b9f | ||
|
|
073f65577b | ||
|
|
381644c5ab | ||
|
|
b1af1bd21f | ||
|
|
70a5cd9f40 | ||
|
|
dc881ea1fe | ||
|
|
3b57d51d53 | ||
|
|
371307ad92 | ||
|
|
5c9a062ecc | ||
|
|
de1f9925a5 | ||
|
|
b3fbe630a0 | ||
|
|
5bede10c9f | ||
|
|
86fcef5db0 | ||
|
|
238f78aa94 | ||
|
|
11b77c2fd6 | ||
|
|
76b80dff7f | ||
|
|
dfca085423 | ||
|
|
cf24576e46 | ||
|
|
62f1dbf3e2 | ||
|
|
6aaedc5fa5 | ||
|
|
bda092db4e | ||
|
|
50e9fca03a | ||
|
|
43a68dc75d | ||
|
|
3d8298ab28 | ||
|
|
4d4687361a | ||
|
|
de9cffd28a | ||
|
|
3903b93b15 | ||
|
|
41d58a79d2 | ||
|
|
3425b762fe | ||
|
|
fa26384174 | ||
|
|
67a365111c | ||
|
|
ee57201b52 | ||
|
|
9e4e911de1 | ||
|
|
241cf26867 | ||
|
|
0468fe6fcd | ||
|
|
078ded00e5 | ||
|
|
d6c5f3cedd | ||
|
|
a0c1d51635 | ||
|
|
87ce7ec67c | ||
|
|
7f586bd2bb | ||
|
|
251e30e5b4 | ||
|
|
07f823f19e | ||
|
|
78e08763c9 | ||
|
|
463edf202d | ||
|
|
df64dd2187 | ||
|
|
d15d40f8d9 | ||
|
|
52c12d5bf6 | ||
|
|
e2cbb7c81b | ||
|
|
20e2b36756 | ||
|
|
29e05f2b3f | ||
|
|
fa3ee309b4 | ||
|
|
037a9af08e | ||
|
|
0d37abe86b | ||
|
|
d9286fe159 | ||
|
|
9e22967825 | ||
|
|
fe968a4460 | ||
|
|
a321381b94 | ||
|
|
a22352015d | ||
|
|
91dceda3d5 | ||
|
|
6c106ec216 | ||
|
|
d93bf4b996 | ||
|
|
86e9616018 | ||
|
|
281122754e | ||
|
|
30e99e419b | ||
|
|
0fd71cf8f9 | ||
|
|
eb7f112fcb | ||
|
|
a0bb112ebc | ||
|
|
5e7ea957d8 | ||
|
|
036378e00c | ||
|
|
1de4cf33b3 | ||
|
|
8b92970433 | ||
|
|
c7ec051caa | ||
|
|
9697bc32c8 | ||
|
|
6870fd7681 | ||
|
|
5338fcdee4 | ||
|
|
702a9de01d | ||
|
|
381e5465e7 | ||
|
|
3332c74e48 | ||
|
|
a5283d2178 | ||
|
|
a2bc9a1e09 | ||
|
|
f553d5a1c9 | ||
|
|
820a1d39c8 | ||
|
|
9394028bd9 | ||
|
|
01a5d5daf9 | ||
|
|
c691aa7131 | ||
|
|
b3a7327bd2 | ||
|
|
698b534caa | ||
|
|
29f1545c98 | ||
|
|
38111aec46 | ||
|
|
e945cca3a4 | ||
|
|
3ce86bbc71 | ||
|
|
70bee2b278 | ||
|
|
9374c29050 | ||
|
|
85eff30f18 | ||
|
|
07cec86849 | ||
|
|
52ab5d0a4d | ||
|
|
13b7290eca | ||
|
|
3d105e77c7 | ||
|
|
88e87f8850 | ||
|
|
80cb90d4a4 | ||
|
|
9336c33e4f | ||
|
|
f33c6ad621 | ||
|
|
00192bb235 | ||
|
|
bcf8227c2a | ||
|
|
ddde4bb78a | ||
|
|
aaa3aafc43 | ||
|
|
0c7236fc65 | ||
|
|
27037be4db | ||
|
|
3a276447b6 | ||
|
|
538fc8b875 | ||
|
|
a01e50e17f | ||
|
|
6e4e20009b | ||
|
|
3256544542 | ||
|
|
c9334b0fcd | ||
|
|
fb2ed0031b | ||
|
|
36a6a1da9c | ||
|
|
9a5f66247d | ||
|
|
e915c380e1 | ||
|
|
00733493f8 | ||
|
|
ff8505d463 | ||
|
|
aff2ad4caa | ||
|
|
8de7b8fef1 | ||
|
|
3eb07b84ae | ||
|
|
1ae8aef62a | ||
|
|
0c8429dbc0 | ||
|
|
a2b4334717 | ||
|
|
1bed6fcc4e | ||
|
|
949d747bf6 | ||
|
|
fc50750177 | ||
|
|
c88c677147 | ||
|
|
996c3bcb67 | ||
|
|
287d557df6 | ||
|
|
6929a449e0 | ||
|
|
9e56ded383 | ||
|
|
80bdf7abcd | ||
|
|
f9dc85d792 | ||
|
|
52c3ea73a7 | ||
|
|
a79ed82edc | ||
|
|
ea15cf034d | ||
|
|
c60f524dfb | ||
|
|
44b3d23c6d | ||
|
|
0dddae74b6 | ||
|
|
50fd544966 | ||
|
|
c4a2b4eb53 | ||
|
|
6aeba41e73 | ||
|
|
48d75f5289 | ||
|
|
8f5bb2e4a0 | ||
|
|
1b5c5e872b | ||
|
|
3590e2325e | ||
|
|
fe40f4a5a5 | ||
|
|
fc9e43113e | ||
|
|
9e3940cd0d | ||
|
|
1e6fe5a7f5 | ||
|
|
ff9a5de363 | ||
|
|
af81ab813d | ||
|
|
9386a6d995 | ||
|
|
a62f6077ea | ||
|
|
d0c7a84da9 | ||
|
|
457995c98d | ||
|
|
f8f296d9bd | ||
|
|
c7d300d956 | ||
|
|
f4e3a02775 | ||
|
|
4ca7261c2d | ||
|
|
65de125a35 | ||
|
|
ffa3d44778 | ||
|
|
ad4953c21f | ||
|
|
fd7cff88d9 | ||
|
|
28bd8c8413 | ||
|
|
134c4195ec | ||
|
|
dc17bcb8fb | ||
|
|
489056f14a | ||
|
|
d8847a0d1c | ||
|
|
c2400d6df6 | ||
|
|
9d3b32781e | ||
|
|
f17b519acb | ||
|
|
87c867fae9 | ||
|
|
acf8eb3875 | ||
|
|
9d927bb510 | ||
|
|
b74ba16a95 | ||
|
|
589934792f | ||
|
|
3f552485cf | ||
|
|
69f9b6a11c | ||
|
|
393dab04e5 | ||
|
|
5dc1a4f316 | ||
|
|
846f71ee05 | ||
|
|
eecd5ec27f | ||
|
|
8f09c74c51 | ||
|
|
bcf693c827 | ||
|
|
ae59418657 | ||
|
|
33db2438de | ||
|
|
2d612a6ea6 | ||
|
|
7a3b237f3f | ||
|
|
a2f71091f4 | ||
|
|
db83163c81 | ||
|
|
f6f13004dc | ||
|
|
a5ce70aa7d | ||
|
|
bcc1dd2443 | ||
|
|
c380166172 | ||
|
|
9381966367 | ||
|
|
353db4a569 | ||
|
|
6d145b7f92 | ||
|
|
0aa1b10d0c | ||
|
|
6be51335c6 | ||
|
|
9d54835d01 | ||
|
|
9504c337e6 | ||
|
|
f4eb982ac0 | ||
|
|
d374c3916f | ||
|
|
bafdd8e2c0 | ||
|
|
78db3add9d | ||
|
|
59bdeee953 | ||
|
|
45fc90e1a6 | ||
|
|
511d60eba6 | ||
|
|
51f81a61e3 | ||
|
|
fe2c05f6bf | ||
|
|
7ffefe09f1 | ||
|
|
41849c2cc4 | ||
|
|
4695e1619c | ||
|
|
8dbfe8f78c | ||
|
|
abfb05cbb4 | ||
|
|
5d2eac8479 | ||
|
|
f7a4841081 | ||
|
|
7f77950d2c | ||
|
|
7f41209288 | ||
|
|
59453b1004 | ||
|
|
c82a2a497c | ||
|
|
a7392aecd3 | ||
|
|
2bc4a9c6c1 | ||
|
|
094b680736 | ||
|
|
e2d12eea92 | ||
|
|
20bee13047 | ||
|
|
b1b38d3c68 | ||
|
|
2318eebe99 | ||
|
|
9234b31058 | ||
|
|
af6af01717 | ||
|
|
fcb79a75fb | ||
|
|
01fb538344 | ||
|
|
807da9b463 | ||
|
|
5fb74436a0 | ||
|
|
d38cbcce10 | ||
|
|
0f253287ec | ||
|
|
4123508bb2 | ||
|
|
bd073773d8 | ||
|
|
81fbbedb2f | ||
|
|
1cf6a4cc7c | ||
|
|
8244e5ee1a | ||
|
|
b4112523b1 | ||
|
|
baa1b7bb9b | ||
|
|
19c16e67fa | ||
|
|
d56458321f | ||
|
|
4672b267d3 | ||
|
|
c43f45b36a | ||
|
|
93f188b106 | ||
|
|
76ab6dcf18 | ||
|
|
dce1458a65 | ||
|
|
bcef2c11d7 | ||
|
|
3f1097cdba | ||
|
|
f1b54be399 | ||
|
|
fab5246d20 | ||
|
|
bada3e794d | ||
|
|
8fba50ecbf | ||
|
|
6a4cc980af | ||
|
|
150c408da8 | ||
|
|
5827d109f3 | ||
|
|
b5058db9ab | ||
|
|
dca5057dcd | ||
|
|
5e0ee866f6 | ||
|
|
8add0018e4 | ||
|
|
5ede0750c6 | ||
|
|
bd944d09e0 | ||
|
|
b9fbf7f89f | ||
|
|
96f506169a | ||
|
|
09ff79c694 | ||
|
|
c3c5415b15 | ||
|
|
fb91b3114a | ||
|
|
2892308a61 | ||
|
|
d1e0d6a911 | ||
|
|
f5c24f5975 | ||
|
|
90b9a98a5d | ||
|
|
79d00d2acc | ||
|
|
ef0546a4d0 | ||
|
|
f999911691 | ||
|
|
d018396336 | ||
|
|
77cd5a0de0 | ||
|
|
df310de8ee | ||
|
|
783c2dc693 | ||
|
|
d83622d4ac | ||
|
|
ccf824f925 | ||
|
|
2e44257660 | ||
|
|
12e2deefa8 | ||
|
|
320c6e0037 | ||
|
|
03a8d14c26 | ||
|
|
c4e3217b72 | ||
|
|
b31e8409ff | ||
|
|
9d218e2b5b | ||
|
|
95b77ece6f | ||
|
|
f5fbb8684f | ||
|
|
a79c1a411f | ||
|
|
68a5a4a034 | ||
|
|
0a65915b40 | ||
|
|
12896a5964 | ||
|
|
4c84cb5563 | ||
|
|
03e9524b7e | ||
|
|
4e275828c5 | ||
|
|
165bb9b371 | ||
|
|
7a8b46a42e | ||
|
|
841c7049ce | ||
|
|
211c4f5a58 | ||
|
|
e87a4df2d5 | ||
|
|
ffe45c60a3 | ||
|
|
6455da26bd | ||
|
|
b6084ce6f1 | ||
|
|
91d7958a74 | ||
|
|
f388eedbe1 | ||
|
|
e17664b119 | ||
|
|
5765c7e4da | ||
|
|
13ffd6201b | ||
|
|
27b2501e65 | ||
|
|
3edd689e09 | ||
|
|
4de25d8087 | ||
|
|
bd2f2e88cc | ||
|
|
5ee5312f98 | ||
|
|
dc612cf329 | ||
|
|
5014b501c3 | ||
|
|
8c4c66b2c3 | ||
|
|
4c64ccdafa | ||
|
|
11a5136ce0 | ||
|
|
f6a76baaff | ||
|
|
3637aa5041 | ||
|
|
29fc759acb | ||
|
|
7b9aae2779 | ||
|
|
43745f1dd5 | ||
|
|
003aeba6b5 | ||
|
|
6dd010f54a | ||
|
|
edb7d70019 | ||
|
|
d167d070a0 | ||
|
|
f56fb5a896 | ||
|
|
31e06f152f | ||
|
|
22fff674e8 | ||
|
|
80fa125d68 | ||
|
|
d133d7f701 | ||
|
|
db7000695f | ||
|
|
0c0970ccab | ||
|
|
2f912ca46b | ||
|
|
ad61b6a672 | ||
|
|
8b75e6af56 | ||
|
|
0af0d697db | ||
|
|
74dce44ae9 | ||
|
|
db2a5c813e | ||
|
|
aec790d0e6 | ||
|
|
5432ae5d44 | ||
|
|
dcd9ca22e2 | ||
|
|
5514f3c5ea | ||
|
|
c4458f4151 | ||
|
|
8630e33bf6 | ||
|
|
f6bc0b70d1 | ||
|
|
56450ba26e | ||
|
|
f168e2ebc5 | ||
|
|
e923683866 | ||
|
|
91333ec8d3 | ||
|
|
65a646ea08 | ||
|
|
8e98416f47 | ||
|
|
e4e6e5b049 | ||
|
|
173dc604a4 | ||
|
|
a8c0e40278 | ||
|
|
90fdd6824c | ||
|
|
7955df305a | ||
|
|
783df58a3b | ||
|
|
f7d8c1e1aa | ||
|
|
a67d97f104 | ||
|
|
4e18984c5e | ||
|
|
d1e40118fa | ||
|
|
61cde1ceb0 | ||
|
|
2039a6d814 | ||
|
|
e994710532 | ||
|
|
cdc1e8d7c9 | ||
|
|
c359f1ed02 | ||
|
|
b5aebd8ca2 | ||
|
|
24b7b0cacd | ||
|
|
0f83368472 | ||
|
|
5b454a2e97 | ||
|
|
081fe363eb | ||
|
|
b604bfeeca | ||
|
|
358fa5f31d | ||
|
|
cf6a7895bf | ||
|
|
04b0f51565 | ||
|
|
79679411ae | ||
|
|
1ed04f3a7d | ||
|
|
9903ce8559 | ||
|
|
67d716f4fe | ||
|
|
b5d9e6f2e9 | ||
|
|
e1a9b1cf06 | ||
|
|
f9748dc756 | ||
|
|
cf9447c758 | ||
|
|
4c6642169a | ||
|
|
bf00e32685 | ||
|
|
a8792931ec | ||
|
|
be2a330da5 | ||
|
|
af2026ecdf | ||
|
|
3014976cd0 | ||
|
|
6d6e668a41 | ||
|
|
b45fc5c931 | ||
|
|
2707a601bc | ||
|
|
19850957f7 | ||
|
|
3eee221ecf | ||
|
|
cbb5dd663c | ||
|
|
109ce230c7 | ||
|
|
79de159da2 | ||
|
|
72a0898873 | ||
|
|
c66aeb5988 | ||
|
|
e2a5ab7e02 | ||
|
|
0e2fbc7315 | ||
|
|
577cd4ac84 | ||
|
|
a2031e92b9 | ||
|
|
c1eba56c75 | ||
|
|
85c58b7866 | ||
|
|
a0d9a56a3c | ||
|
|
7eb395e300 | ||
|
|
f4b0f0a51a | ||
|
|
ddd9e310c2 | ||
|
|
009c882c36 | ||
|
|
1c6454fbce | ||
|
|
6f4b49e030 | ||
|
|
5d1e46267a | ||
|
|
2466de998d | ||
|
|
35f00f3824 | ||
|
|
0cdb370274 | ||
|
|
acade41cee | ||
|
|
82330ef504 | ||
|
|
f4cad5fb6e | ||
|
|
d7c2ad3748 | ||
|
|
32f598b99e | ||
|
|
eafe3578c4 | ||
|
|
2a0808b97f | ||
|
|
12f6152a5f | ||
|
|
d4db03b390 | ||
|
|
9591e1ed1e | ||
|
|
3ab2c7be1a | ||
|
|
b7898d0469 | ||
|
|
b92f4aa57b | ||
|
|
8cecdb58e5 | ||
|
|
daa074a108 | ||
|
|
8e735f811d | ||
|
|
00e0da2712 | ||
|
|
b66961452f | ||
|
|
40bcf7296c | ||
|
|
80bf48903f | ||
|
|
f0c23a8611 | ||
|
|
1b0abe5c51 | ||
|
|
f274743ebb | ||
|
|
50c4711b2e | ||
|
|
d225f7052a | ||
|
|
272d724890 | ||
|
|
945350d58c | ||
|
|
1abcf5624a | ||
|
|
2bfa653735 | ||
|
|
4cad860e7c | ||
|
|
09fe028d90 | ||
|
|
e6a3cfb8fe | ||
|
|
742d5f1204 | ||
|
|
e03c3f1706 | ||
|
|
e67b7a69e7 | ||
|
|
c6b0353b9c | ||
|
|
08cbb3eb94 | ||
|
|
1759db8032 | ||
|
|
237439b927 | ||
|
|
6a23d1fc5a | ||
|
|
c3d2033a3a | ||
|
|
fcfedf2d17 | ||
|
|
bf63cc710d | ||
|
|
d9c238eacf | ||
|
|
ad1c6cded6 | ||
|
|
6896473ece | ||
|
|
51054c8b7a | ||
|
|
9fec22a94d | ||
|
|
34b13b24f7 | ||
|
|
79bbb292a0 | ||
|
|
e766d064ca | ||
|
|
f172a4e37a | ||
|
|
ae26eeb260 | ||
|
|
837d127dc1 | ||
|
|
3a02b027dc | ||
|
|
c148e9dbd8 | ||
|
|
5f4e4068eb | ||
|
|
bd3e148ac8 | ||
|
|
9c89d26c52 | ||
|
|
2f900ccff2 | ||
|
|
81352c0b3e | ||
|
|
254ba7fef5 | ||
|
|
0e7fba508d | ||
|
|
ccb285cb8c | ||
|
|
8fd91df808 | ||
|
|
5652546c52 | ||
|
|
459c2a4c80 | ||
|
|
41bcfc5972 | ||
|
|
f1c7032b4b | ||
|
|
bd038eb739 | ||
|
|
08b4a73117 | ||
|
|
99804f7160 | ||
|
|
2f8c89d340 | ||
|
|
90ac873269 | ||
|
|
2dfb0ef7b9 | ||
|
|
c8a56bd594 | ||
|
|
b8aec44d1a | ||
|
|
830bbaa157 | ||
|
|
e5e7dad23d | ||
|
|
6342265a22 | ||
|
|
6ab2c4bae1 | ||
|
|
64b63632a7 | ||
|
|
c11cf8f069 | ||
|
|
1e4724cd9d | ||
|
|
1d8dc5ef4f | ||
|
|
09261a2465 | ||
|
|
0b298978a3 | ||
|
|
a65d46563a | ||
|
|
b616783180 | ||
|
|
f49b0b03e5 | ||
|
|
51254cf0e7 | ||
|
|
2d80fbfdef | ||
|
|
453fa7fe38 | ||
|
|
7ad60e4687 | ||
|
|
a76ce97e81 | ||
|
|
0ec3cd2edd | ||
|
|
abcd90e75e | ||
|
|
0e99032636 | ||
|
|
58a222a49a | ||
|
|
23b419547b | ||
|
|
9d1753e49a | ||
|
|
b312375e6a | ||
|
|
5839aa32bc | ||
|
|
bf26e79236 | ||
|
|
0122906378 | ||
|
|
c168f50f60 | ||
|
|
f4d74e2669 | ||
|
|
731d3896e8 | ||
|
|
02c56cabf3 | ||
|
|
fa64dc6443 | ||
|
|
e8d7bbbd9e | ||
|
|
4f78ccf8ff | ||
|
|
56ec26df14 | ||
|
|
37ce7ee77c | ||
|
|
3a7a13822a | ||
|
|
31fab24987 | ||
|
|
6a65198e56 | ||
|
|
1b5b260da4 | ||
|
|
2261f0f56c | ||
|
|
0a957febc3 | ||
|
|
4f269a8b55 | ||
|
|
e404d42c5d | ||
|
|
545b7b24e3 | ||
|
|
1efff4fab2 | ||
|
|
95b2d5acdc | ||
|
|
8d635674d9 | ||
|
|
544ad333b3 | ||
|
|
75bcd345da | ||
|
|
9f6cc405c4 | ||
|
|
3760a92c43 | ||
|
|
948d77fe2c | ||
|
|
57aa5577da | ||
|
|
2464adcbbd | ||
|
|
b0a33033b6 | ||
|
|
efa7f84fde | ||
|
|
b96fcdaf82 | ||
|
|
0f553e90ae | ||
|
|
7cf62492a5 | ||
|
|
a3c35caefc | ||
|
|
5ccaaeea48 | ||
|
|
813d03c1d2 | ||
|
|
977c28a6da | ||
|
|
7be6ee6c2f | ||
|
|
790003c9ea | ||
|
|
bc53c85ca0 | ||
|
|
0efb7c174c | ||
|
|
92d791b7b0 | ||
|
|
b3b0de73e9 | ||
|
|
87caded68d | ||
|
|
5f0aaf354d | ||
|
|
ee4fb8f0ff | ||
|
|
4df7c35211 | ||
|
|
0f496fe790 |
46
mozilla/content/base/public/nsIAnonymousContent.h
Normal file
46
mozilla/content/base/public/nsIAnonymousContent.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIAnonymousContent_h___
|
||||
#define nsIAnonymousContent_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsISupportsArray;
|
||||
class nsIAtom;
|
||||
|
||||
#define NS_IANONYMOUS_CONTENT_IID { 0x41a69e00, 0x2d6d, 0x12d3, { 0xb0, 0x33, 0xa1, 0x38, 0x71, 0x39, 0x78, 0x7c } }
|
||||
|
||||
|
||||
/**
|
||||
* If a node is anonymous. Then it should implement this interface.
|
||||
*/
|
||||
class nsIAnonymousContent : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IANONYMOUS_CONTENT_IID; return iid; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
276
mozilla/content/base/public/nsIContent.h
Normal file
276
mozilla/content/base/public/nsIContent.h
Normal file
@@ -0,0 +1,276 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIContent_h___
|
||||
#define nsIContent_h___
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// Forward declarations
|
||||
class nsIAtom;
|
||||
class nsIDocument;
|
||||
class nsIPresContext;
|
||||
class nsString;
|
||||
class nsString;
|
||||
class nsVoidArray;
|
||||
class nsXIFConverter;
|
||||
class nsIDOMEvent;
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMRange;
|
||||
class nsISizeOfHandler;
|
||||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x78030220, 0x9447, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// A node of content in a documents content model. This interface
|
||||
// is supported by all content objects.
|
||||
class nsIContent : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ICONTENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep) = 0;
|
||||
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD SetParent(nsIContent* aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the namespace that this tag is defined in
|
||||
*/
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const = 0;
|
||||
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Test and see if this piece of content is synthetic. Synthetic content
|
||||
* is content generated stylistically and should normally be ignored
|
||||
* during content saving.
|
||||
*/
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Parses an attribute string into an atom that represents the
|
||||
* attribute name and an identifier that represents the namespace
|
||||
* of the attribute. The namespace identifier may be computed
|
||||
* from a namespace prefix that must be interpreted in the context
|
||||
* of the content itself.
|
||||
*
|
||||
* @param aStr the unparsed attribute string
|
||||
* @param aName out parameter representing the name of the attribute
|
||||
* @param aNameSpaceID out parameter reprsenting the namespace
|
||||
* of the attribute
|
||||
*/
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr,
|
||||
nsIAtom*& aName,
|
||||
PRInt32& aNameSpaceID) = 0;
|
||||
|
||||
/**
|
||||
* Returns the prefix for the specified name space identifier in
|
||||
* the context of the content element itself.
|
||||
*
|
||||
* @param aNameSpaceID identifier of the namespace
|
||||
* @param aPrefix out parameter representing the prefix for the namespace
|
||||
*/
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
|
||||
nsIAtom*& aPrefix) = 0;
|
||||
|
||||
/**
|
||||
* Set attribute values. All attribute values are assumed to have a
|
||||
* canonical String representation that can be used for these
|
||||
* methods. The setAttribute method is assumed to perform a translation
|
||||
* of the canonical form into the underlying content specific
|
||||
* form.
|
||||
*
|
||||
* @param aName the name of the attribute
|
||||
|
||||
* @param aValue may legitimately be the empty string.
|
||||
*
|
||||
* @param aUpdateMask specifies how whether or not the document should be
|
||||
* notified of the attribute change.
|
||||
*/
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsString& aValue,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Get the current value of the attribute. This returns a form that is
|
||||
* suitable for passing back into setAttribute.
|
||||
*
|
||||
* <UL>
|
||||
*
|
||||
* <LI>If the attribute is not set and has no default value, return
|
||||
* NS_CONTENT_ATTR_NOT_THERE.
|
||||
*
|
||||
* <LI>If the attribute exists, but has no value, return
|
||||
* NS_CONTENT_ATTR_NO_VALUE.
|
||||
*
|
||||
* <LI>If the attribute has a value, empty or otherwise, set ret to
|
||||
* be the value, and return NS_CONTENT_ATTR_HAS_VALUE (== NS_OK).
|
||||
*
|
||||
* </UL>
|
||||
*/
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsString& aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Remove an attribute so that it is no longer explicitly specified.
|
||||
*
|
||||
* @param aAttribute the name of the attribute to unset
|
||||
*
|
||||
* @param aNotify specifies whether or not the document should be
|
||||
* notified of the attribute change
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the namespace & name of a given attribute.
|
||||
*
|
||||
* @param aIndex the index of the attribute name
|
||||
* @param aNameSpace an out param of the name space ID of the attribute name
|
||||
* @param aName an out param if the attribute name
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
|
||||
PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName) const = 0;
|
||||
|
||||
/**
|
||||
* Get the number of all specified attributes.
|
||||
*
|
||||
* @param aCountResult an out parameter to be filled in with
|
||||
* the number of attributes
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aCountResult) const = 0;
|
||||
|
||||
/**
|
||||
* Get the size of the content object. The size value should include
|
||||
* all subordinate data referenced by the content that is not
|
||||
* accounted for by child content. However, this value should not
|
||||
* include the frame objects, style contexts, views or other data
|
||||
* that lies logically outside the content model.
|
||||
*
|
||||
* If the implementation so chooses, instead of returning the total
|
||||
* subordinate data it may instead use the sizeof handler to store
|
||||
* away subordinate data under its own key so that the subordinate
|
||||
* data may be tabulated independently of the frame itself.
|
||||
*
|
||||
* The caller is responsible for recursing over all children that
|
||||
* the content contains.
|
||||
*/
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
||||
|
||||
/**
|
||||
* List the content (and anything it contains) out to the given
|
||||
* file stream. Use aIndent as the base indent during formatting.
|
||||
* Returns NS_OK unless a file error occurs.
|
||||
*/
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
|
||||
/**
|
||||
* Translate the content object into the (XIF) XML Interchange Format
|
||||
* XIF is an intermediate form of the content model, the buffer
|
||||
* will then be parsed into any number of formats including HTML, TXT, etc.
|
||||
|
||||
* BeginConvertToXIF -- opens a container and writes out the attributes
|
||||
* ConvertContentToXIF -- typically does nothing unless there is text content
|
||||
* FinishConvertToXIF -- closes a container
|
||||
*/
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const = 0;
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const = 0;
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const = 0;
|
||||
|
||||
/**
|
||||
* Inform content of range ownership changes. This allows content
|
||||
* to do the right thing to ranges in the face of changes to the content
|
||||
* model.
|
||||
|
||||
* RangeAdd -- informs content that it owns one or both range endpoints
|
||||
* RangeRemove -- informs content that it no longer owns a range endpoint
|
||||
* GetRangeList -- returns the list of ranges that have one or both endpoints
|
||||
* within this content item
|
||||
*/
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange) = 0;
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange) = 0;
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Handle a DOM event for this piece of content.
|
||||
*/
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
/**
|
||||
* Get and set a unique ID for this piece of content.
|
||||
* This ID is used as a key to store state information
|
||||
* about this content object and its associated frame object.
|
||||
* The state information is stored in a dictionary that is
|
||||
* manipulated by the frame manager (nsIFrameManager) inside layout.
|
||||
* An opaque pointer to this dictionary is passed to the session
|
||||
* history as a handle associated with the current document's state
|
||||
*/
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) = 0;
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) = 0;
|
||||
|
||||
};
|
||||
|
||||
// nsresult codes for GetAttribute
|
||||
#define NS_CONTENT_ATTR_HAS_VALUE NS_OK
|
||||
|
||||
#define NS_CONTENT_ATTR_NO_VALUE \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT,0)
|
||||
|
||||
#define NS_CONTENT_ATTR_NOT_THERE \
|
||||
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_LAYOUT,1)
|
||||
|
||||
#endif /* nsIContent_h___ */
|
||||
91
mozilla/content/base/public/nsIContentIterator.h
Normal file
91
mozilla/content/base/public/nsIContentIterator.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsIContentIterator_h___
|
||||
#define __nsIContentIterator_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIDOMRange;
|
||||
|
||||
#define NS_ICONTENTITERTOR_IID \
|
||||
{0xa6cf90e4, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
class nsIContentIterator : public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ICONTENTITERTOR_IID; return iid; }
|
||||
|
||||
/* Initializes an iterator for the subtree rooted by the node aRoot
|
||||
*/
|
||||
NS_IMETHOD Init(nsIContent* aRoot)=0;
|
||||
|
||||
/* Initializes an iterator for the subtree defined by the range aRange
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDOMRange* aRange)=0;
|
||||
|
||||
/** First will reset the list. will return NS_FAILED if no items
|
||||
*/
|
||||
NS_IMETHOD First()=0;
|
||||
|
||||
/** Last will reset the list to the end. will return NS_FAILED if no items
|
||||
*/
|
||||
NS_IMETHOD Last()=0;
|
||||
|
||||
/** Next will advance the list. will return failed if allready at end
|
||||
*/
|
||||
NS_IMETHOD Next()=0;
|
||||
|
||||
/** Prev will decrement the list. will return failed if allready at beginning
|
||||
*/
|
||||
NS_IMETHOD Prev()=0;
|
||||
|
||||
/** CurrentItem will return the CurrentItem item it will fail if the list is empty
|
||||
* @param aItem return value
|
||||
*/
|
||||
NS_IMETHOD CurrentNode(nsIContent **aNode)=0;
|
||||
|
||||
/** return if the collection is at the end. that is the beginning following a call to Prev
|
||||
* and it is the end of the list following a call to next
|
||||
* @param aItem return value
|
||||
*/
|
||||
NS_IMETHOD IsDone()=0;
|
||||
|
||||
/** PositionAt will position the iterator to the supplied node
|
||||
*/
|
||||
NS_IMETHOD PositionAt(nsIContent* aCurNode)=0;
|
||||
|
||||
/** MakePre will make the iterator a pre-order iterator
|
||||
*/
|
||||
NS_IMETHOD MakePre()=0;
|
||||
|
||||
/** MakePost will make the iterator a post-order iterator
|
||||
*/
|
||||
NS_IMETHOD MakePost()=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __nsIContentIterator_h___
|
||||
|
||||
338
mozilla/content/base/public/nsIDocument.h
Normal file
338
mozilla/content/base/public/nsIDocument.h
Normal file
@@ -0,0 +1,338 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIDocument_h___
|
||||
#define nsIDocument_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIUnicharInputStream.h"
|
||||
#include "nsGUIEvent.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 nsString;
|
||||
class nsIScriptGlobalObject;
|
||||
class nsIDOMEvent;
|
||||
class nsIDeviceContext;
|
||||
class nsIParser;
|
||||
class nsIDOMNode;
|
||||
class nsXIFConverter;
|
||||
class nsINameSpaceManager;
|
||||
class nsIDOMDocumentFragment;
|
||||
class nsILineBreaker;
|
||||
class nsIWordBreaker;
|
||||
class nsIDOMSelection;
|
||||
class nsIChannel;
|
||||
class nsIPrincipal;
|
||||
|
||||
// IID for the nsIDocument interface
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x94c6ceb0, 0x9447, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
// specification for data to be sent via form "post"
|
||||
// IID for the nsIPostData interface - 152ab6e0-ff13-11d1-beb9-00805f8a66dc
|
||||
#define NS_IPOSTDATA_IID \
|
||||
{ 0x152ab6e0, 0xff13, 0x11d1, \
|
||||
{0xbe, 0xb9, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} }
|
||||
|
||||
#if 0
|
||||
class nsIPostData : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPOSTDATA_IID; return iid; }
|
||||
|
||||
virtual PRBool IsFile() = 0; // is the data a file (or raw data)
|
||||
virtual const char* GetData() = 0; // get the file name or raw data
|
||||
virtual PRInt32 GetDataLength() = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Document interface
|
||||
class nsIDocument : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOCUMENT_IID; return 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.
|
||||
virtual nsIArena* GetArena() = 0;
|
||||
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener) = 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.
|
||||
*/
|
||||
virtual nsIURI* GetDocumentURL() const = 0;
|
||||
|
||||
/**
|
||||
* Return the principal responsible for this document.
|
||||
*/
|
||||
virtual nsIPrincipal* GetDocumentPrincipal() = 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;
|
||||
|
||||
/**
|
||||
* Return the content (mime) type of this document.
|
||||
*/
|
||||
NS_IMETHOD GetContentType(nsString& aContentType) const = 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(nsString& oCharSetID) = 0;
|
||||
NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID) = 0;
|
||||
|
||||
/**
|
||||
* 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, nsString& aData) const = 0;
|
||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& 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;
|
||||
virtual nsIPresShell* GetShellAt(PRInt32 aIndex) = 0;
|
||||
|
||||
/**
|
||||
* Return the parent document of this document. Will return null
|
||||
* unless this document is within a compound document and has a parent.
|
||||
*/
|
||||
virtual nsIDocument* GetParentDocument() = 0;
|
||||
virtual void SetParentDocument(nsIDocument* aParent) = 0;
|
||||
virtual void AddSubDocument(nsIDocument* aSubDoc) = 0;
|
||||
virtual PRInt32 GetNumberOfSubDocuments() = 0;
|
||||
virtual nsIDocument* GetSubDocumentAt(PRInt32 aIndex) = 0;
|
||||
|
||||
/**
|
||||
* Return the root content object for this document.
|
||||
*/
|
||||
virtual nsIContent* GetRootContent() = 0;
|
||||
virtual void SetRootContent(nsIContent* aRoot) = 0;
|
||||
|
||||
/**
|
||||
* Methods to append to the prolog and epilog of
|
||||
* a document. The prolog is the content before the document
|
||||
* element, the epilog after.
|
||||
*/
|
||||
NS_IMETHOD AppendToProlog(nsIContent* aContent) = 0;
|
||||
NS_IMETHOD AppendToEpilog(nsIContent* aContent) = 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.
|
||||
*/
|
||||
virtual PRInt32 GetNumberOfStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
virtual PRInt32 GetIndexOfStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void AddStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet) = 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;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// 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 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 AttributeChanged(nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
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;
|
||||
|
||||
/**
|
||||
* Finds text in content
|
||||
*/
|
||||
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
|
||||
|
||||
/**
|
||||
* Converts the document or a selection of the
|
||||
* document to XIF (XML Interchange Format)
|
||||
* and places the result in aBuffer.
|
||||
|
||||
* NOTE: we may way to place the result in a stream,
|
||||
* but we will use a string for now -- gpk
|
||||
*/
|
||||
NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection = nsnull) = 0;
|
||||
NS_IMETHOD ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
|
||||
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
|
||||
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
|
||||
virtual void FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode) = 0;
|
||||
|
||||
/* Helper methods to help determine the logical positioning of content */
|
||||
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const = 0;
|
||||
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const = 0;
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const = 0;
|
||||
virtual void SetDisplaySelection(PRBool aToggle) = 0;
|
||||
virtual PRBool GetDisplaySelection() const = 0;
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// XXX These belong somewhere else
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult);
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewXMLDocument(nsIDocument** aInstancePtrResult);
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewImageDocument(nsIDocument** aInstancePtrResult);
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
|
||||
nsIDocument* aOwnerDocument);
|
||||
|
||||
// Note: The buffer passed into NewPostData(...) becomes owned by the IPostData
|
||||
// instance and is freed when the instance is destroyed...
|
||||
//
|
||||
#if 0
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewPostData(PRBool aIsFile, char *aData, nsIPostData** aInstancePtrResult);
|
||||
#endif
|
||||
|
||||
#endif /* nsIDocument_h___ */
|
||||
75
mozilla/content/base/public/nsIDocumentContainer.h
Normal file
75
mozilla/content/base/public/nsIDocumentContainer.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIDocumentContainer_h___
|
||||
#define nsIDocumentContainer_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsIScriptable;
|
||||
class nsIScriptEnvironment;
|
||||
class nsIURI;
|
||||
|
||||
#define NS_IDOCUMENT_CONTAINER_IID \
|
||||
{ 0x8efd4470, 0x944d, 0x11d1, \
|
||||
{0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
class nIDocumentContainer : public nsISupports {
|
||||
public:
|
||||
/**
|
||||
* Display the specified URL with the given connection.
|
||||
*
|
||||
* @param url the URL to display
|
||||
* @param connection the connection to use.
|
||||
*/
|
||||
virtual void Display(nsIURI* aURL) = 0;
|
||||
|
||||
/**
|
||||
* Returns a script environment for the specified language and version.
|
||||
* The expectation is that the script environment already has been
|
||||
* set up with a container object. If a script environment has already
|
||||
* been requested for the given language, the same instance should
|
||||
* be returned.
|
||||
*
|
||||
* @param language the scripting language for the environment. If this
|
||||
* is null, returns the default scripting environment.
|
||||
* @param majorVersion the major version number of the language
|
||||
* @param minorVersion the minor version number of the language
|
||||
* @return the script environment for the language
|
||||
* @see mg.magellan.script.IScriptEnvrionment
|
||||
*/
|
||||
virtual nsIScriptEnvironment*
|
||||
GetScriptEnvironment(nsString* aLanguage,
|
||||
PRInt32 aMajorVersion,
|
||||
PRInt32 aMinorVersion) = 0;
|
||||
|
||||
/**
|
||||
* Returns the scriptable container object for the document container.
|
||||
* The scriptable object will be used as the scoping object in the
|
||||
* definition of scriptable classes used in the Document Object Model.
|
||||
*
|
||||
* @return the scriptable container for the application
|
||||
* @see mg.magellan.script.IScriptable
|
||||
* @see mg.magellan.script.IScriptEnvrionment
|
||||
*/
|
||||
virtual nsIScriptable* GetScriptableContainer() = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIDocumentContainer_h___ */
|
||||
155
mozilla/content/base/public/nsIDocumentEncoder.h
Normal file
155
mozilla/content/base/public/nsIDocumentEncoder.h
Normal file
@@ -0,0 +1,155 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIDocumentEncoder_h__
|
||||
#define nsIDocumentEncoder_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIDocumentEncoder;
|
||||
class nsIDocument;
|
||||
class nsIDOMSelection;
|
||||
class nsIOutputStream;
|
||||
class nsISupportsArray;
|
||||
|
||||
|
||||
#define NS_IDOCUMENT_ENCODER_IID \
|
||||
{ /* a6cf9103-15b3-11d2-932e-00805f8add32 */ \
|
||||
0xa6cf9103, \
|
||||
0x15b3, \
|
||||
0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} \
|
||||
}
|
||||
|
||||
#define NS_TEXT_ENCODER_CID \
|
||||
{ /* e7ba1480-1dea-11d3-830f-00104bed045e */ \
|
||||
0xe7ba1480, \
|
||||
0x1dea, \
|
||||
0x11d3, \
|
||||
{0x83, 0x0f, 0x00, 0x10, 0x4b, 0xed, 0x04, 0x5e} \
|
||||
}
|
||||
|
||||
#define NS_DOC_ENCODER_PROGID_BASE "component://netscape/layout/documentEncoder?type="
|
||||
|
||||
class nsIDocumentEncoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Output methods flag bits.
|
||||
*
|
||||
* There are a frightening number of these,
|
||||
* because everyone wants something a little bit different!
|
||||
*
|
||||
* These should move to an idl file so that Javascript can
|
||||
* have access to the symbols, not just the constants.
|
||||
*/
|
||||
enum {
|
||||
// Output only the selection.
|
||||
OutputSelectionOnly = 1,
|
||||
|
||||
// Convert html to plaintext that looks like the html.
|
||||
// Implies wrap (except inside <pre>), since html wraps.
|
||||
OutputFormatted = 2,
|
||||
|
||||
// Don't output the html doctype and gecko output system comment headers
|
||||
OutputNoDoctype = 4,
|
||||
|
||||
// No html head tags
|
||||
OutputBodyOnly = 8,
|
||||
|
||||
// Wrap even if we're not doing formatted output (e.g. for text fields)
|
||||
OutputPreformatted = 16,
|
||||
|
||||
// Output as though the content is preformatted
|
||||
// (e.g. maybe it's wrapped in a MOZ_PRE or MOZ_PRE_WRAP style tag)
|
||||
OutputWrap = 32,
|
||||
|
||||
// Output for format flowed (RFC 2646). This is used when converting
|
||||
// to text for mail sending. This differs just slightly
|
||||
// but in an important way from normal formatted, and that is that
|
||||
// lines are space stuffed. This can't (correctly) be done later.
|
||||
OutputFormatFlowed = 64
|
||||
};
|
||||
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOCUMENT_ENCODER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Initialize with a pointer to the document and the mime type.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 flags) = 0;
|
||||
|
||||
/**
|
||||
* If the selection is set to a non-null value, then the
|
||||
* selection is used for encoding, otherwise the entire
|
||||
* document is encoded.
|
||||
*/
|
||||
NS_IMETHOD SetSelection(nsIDOMSelection* aSelection) = 0;
|
||||
|
||||
/**
|
||||
* Documents typically have an intrinsic character set.
|
||||
* If no intrinsic value is found, the platform character set
|
||||
* is used.
|
||||
* aCharset overrides the both the intrinsic or platform
|
||||
* character set when encoding the document.
|
||||
*
|
||||
* Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER
|
||||
*/
|
||||
NS_IMETHOD SetCharset(const nsString& aCharset) = 0;
|
||||
|
||||
/**
|
||||
* Set a wrap column. This may have no effect in some types of encoders.
|
||||
*/
|
||||
NS_IMETHOD SetWrapColumn(PRUint32 aWC) = 0;
|
||||
|
||||
/**
|
||||
* The document is encoded, the result is sent to the
|
||||
* to nsIOutputStream.
|
||||
*
|
||||
* Possible result codes are passing along whatever stream errors
|
||||
* might have been encountered.
|
||||
*/
|
||||
NS_IMETHOD EncodeToStream(nsIOutputStream* aStream) = 0;
|
||||
NS_IMETHOD EncodeToString(nsString& aOutputString) = 0;
|
||||
};
|
||||
|
||||
// XXXXXXXXXXXXXXXX nsITextEncoder is going away! XXXXXXXXXXXXXXXXXXXXXX
|
||||
#ifdef USE_OBSOLETE_TEXT_ENCODER
|
||||
// Example of a output service for a particular encoder.
|
||||
// The text encoder handles XIF, HTML, and plaintext.
|
||||
class nsITextEncoder : public nsIDocumentEncoder
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_TEXT_ENCODER_CID; return iid; }
|
||||
|
||||
// Get embedded objects -- images, links, etc.
|
||||
// NOTE: we may want to use an enumerator
|
||||
NS_IMETHOD PrettyPrint(PRBool aYes) = 0;
|
||||
NS_IMETHOD SetWrapColumn(PRUint32 aWC) = 0;
|
||||
NS_IMETHOD AddHeader(PRBool aYes) = 0;
|
||||
};
|
||||
#endif /* USE_OBSOLETE_TEXT_ENCODER */
|
||||
|
||||
|
||||
#endif /* nsIDocumentEncoder_h__ */
|
||||
|
||||
312
mozilla/content/base/public/nsIDocumentObserver.h
Normal file
312
mozilla/content/base/public/nsIDocumentObserver.h
Normal file
@@ -0,0 +1,312 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIDocumentObserver_h___
|
||||
#define nsIDocumentObserver_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIPresShell;
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleRule;
|
||||
class nsString;
|
||||
class nsIDocument;
|
||||
|
||||
#define NS_IDOCUMENT_OBSERVER_IID \
|
||||
{ 0xb3f92460, 0x944c, 0x11d1, {0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// Document observer interface
|
||||
class nsIDocumentObserver : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOCUMENT_OBSERVER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Notify that a content model update is beginning. This call can be
|
||||
* nested.
|
||||
*/
|
||||
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify that a content model update is finished. This call can be
|
||||
* nested.
|
||||
*/
|
||||
NS_IMETHOD EndUpdate(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that a document load is beginning.
|
||||
*/
|
||||
NS_IMETHOD BeginLoad(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that a document load has finished. Note that
|
||||
* the associated reflow of the document will be done <b>before</b>
|
||||
* EndLoad is invoked, not after.
|
||||
*/
|
||||
NS_IMETHOD EndLoad(nsIDocument *aDocument) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that the document is being reflowed in
|
||||
* the given presentation shell.
|
||||
*/
|
||||
NS_IMETHOD BeginReflow(nsIDocument *aDocument, nsIPresShell* aShell) = 0;
|
||||
|
||||
/**
|
||||
* Notify the observer that the document is done being reflowed in
|
||||
* the given presentation shell.
|
||||
*/
|
||||
NS_IMETHOD EndReflow(nsIDocument *aDocument, nsIPresShell* aShell) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the content model has changed. This method is
|
||||
* called automatically by content objects when their state is changed
|
||||
* (therefore there is normally no need to invoke this method
|
||||
* directly). The notification is passed to any
|
||||
* IDocumentObservers. The notification is passed on to all of the
|
||||
* document observers. <p>
|
||||
*
|
||||
* This notification is not sent when a piece of content is
|
||||
* added/removed from the document (the other notifications are used
|
||||
* for that).
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent the piece of content that changed
|
||||
* @param aSubContent subrange information about the piece of content
|
||||
* that changed
|
||||
*/
|
||||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the state of a content node has changed.
|
||||
* (ie: gained or lost focus, became active or hovered over)
|
||||
* This method is called automatically by content objects
|
||||
* when their state is changed (therefore there is normally
|
||||
* no need to invoke this method directly). The notification
|
||||
* is passed to any IDocumentObservers. The notification is
|
||||
* passed on to all of the document observers. <p>
|
||||
*
|
||||
* This notification is not sent when a piece of content is
|
||||
* added/removed from the document or the content itself changed
|
||||
* (the other notifications are used for that).
|
||||
*
|
||||
* The optional second content node is to allow optimization
|
||||
* of the case where state moves from one node to another
|
||||
* (as is likely for :focus and :hover)
|
||||
*
|
||||
* Either content node may be nsnull, but not both
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent1 the piece of content that changed
|
||||
* @param aContent2 optional second piece of content that changed
|
||||
*/
|
||||
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2) = 0;
|
||||
|
||||
/**
|
||||
* Notification that the content model has changed. This method is called
|
||||
* automatically by content objects when an attribute's value has changed
|
||||
* (therefore there is normally no need to invoke this method directly). The
|
||||
* notification is passed to any IDocumentObservers document observers. <p>
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContent the piece of content whose attribute changed
|
||||
* @param aAttribute the atom name of the attribute
|
||||
*/
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
/**
|
||||
* Notifcation that the content model has had data appended to the
|
||||
* given content object. This method is called automatically by the
|
||||
* content container objects when a new content object is appended to
|
||||
* the container (therefore there is normally no need to invoke this
|
||||
* method directly). The notification is passed on to all of the
|
||||
* document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that had a new child appended
|
||||
* @param aNewIndexInContainer the index in the container of the first
|
||||
* new child
|
||||
*/
|
||||
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content has been inserted. This method is called
|
||||
* automatically by the content container objects when a new content
|
||||
* object is inserted in the container (therefore there is normally no
|
||||
* need to invoke this method directly). The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that now contains aChild
|
||||
* @param aChild the child that was inserted
|
||||
* @param aIndexInContainer the index of the child in the container
|
||||
*/
|
||||
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Notification that content has been replaced. This method is called
|
||||
* automatically by the content container objects when a content object
|
||||
* is replaced in the container (therefore there is normally no need to
|
||||
* invoke this method directly). The notification is passed on to all
|
||||
* of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that now contains aChild
|
||||
* @param aOldChild the child that was replaced
|
||||
* @param aNewChild the child that replaced aOldChild
|
||||
* @param aIndexInContainer the index of the old and new child in the
|
||||
* container
|
||||
*/
|
||||
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* Content has just been removed. This method is called automatically
|
||||
* by content container objects when a content object has just been
|
||||
* removed from the container (therefore there is normally no need to
|
||||
* invoke this method directly). The notification is passed on to all
|
||||
* of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aContainer the container that had a child removed
|
||||
* @param aChild the child that was just removed
|
||||
* @param aIndexInContainer the index of the child in the container
|
||||
* before it was removed
|
||||
*/
|
||||
NS_IMETHOD ContentRemoved(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
/**
|
||||
* A StyleSheet has just been added to the document.
|
||||
* This method is called automatically when a StyleSheet gets added
|
||||
* to the document. The notification is passed on to all of the
|
||||
* document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been added
|
||||
*/
|
||||
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet) = 0;
|
||||
|
||||
/**
|
||||
* A StyleSheet has just been removed from the document.
|
||||
* This method is called automatically when a StyleSheet gets removed
|
||||
* from the document. The notification is passed on to all of the
|
||||
* document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been removed
|
||||
*/
|
||||
NS_IMETHOD StyleSheetRemoved(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet) = 0;
|
||||
|
||||
/**
|
||||
* A StyleSheet has just disabled or enabled.
|
||||
* This method is called automatically when the disabled state
|
||||
* of a StyleSheet gets changed. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been added
|
||||
* @param aDisabled PR_TRUE if the sheet is disabled, PR_FALSE if
|
||||
* it is enabled
|
||||
*/
|
||||
NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
PRBool aDisabled) = 0;
|
||||
|
||||
/**
|
||||
* A StyleRule has just been modified within a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* modified. The style sheet passes this notification to
|
||||
* the document. The notification is passed on to all of
|
||||
* the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that contians the rule
|
||||
* @param aStyleRule the rule that was modified
|
||||
* @param aHint some possible info about the nature of the change
|
||||
*/
|
||||
NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) = 0; // See nsStyleConsts fot hint values
|
||||
|
||||
/**
|
||||
* A StyleRule has just been added to a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* added to the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was added
|
||||
*/
|
||||
NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* A StyleRule has just been removed from a style sheet.
|
||||
* This method is called automatically when the rule gets
|
||||
* removed from the sheet. The style sheet passes this
|
||||
* notification to the document. The notification is passed on
|
||||
* to all of the document observers.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
* @param aStyleSheet the StyleSheet that has been modified
|
||||
* @param aStyleRule the rule that was removed
|
||||
*/
|
||||
NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) = 0;
|
||||
|
||||
/**
|
||||
* The document is in the process of being destroyed.
|
||||
* This method is called automatically during document
|
||||
* destruction.
|
||||
*
|
||||
* @param aDocument The document being observed
|
||||
*/
|
||||
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIDocumentObserver_h___ */
|
||||
56
mozilla/content/base/public/nsIDocumentViewer.h
Normal file
56
mozilla/content/base/public/nsIDocumentViewer.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIDocumentViewer_h___
|
||||
#define nsIDocumentViewer_h___
|
||||
|
||||
#include "nsIContentViewer.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIStyleSheet;
|
||||
|
||||
#define NS_IDOCUMENT_VIEWER_IID \
|
||||
{ 0xa6cf9057, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* A document viewer is a kind of content viewer that uses NGLayout
|
||||
* to manage the presentation of the content.
|
||||
*/
|
||||
class nsIDocumentViewer : public nsIContentViewer
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_VIEWER_IID)
|
||||
|
||||
NS_IMETHOD SetUAStyleSheet(nsIStyleSheet* aUAStyleSheet) = 0;
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresShell(nsIPresShell*& aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetPresContext(nsIPresContext*& aResult) = 0;
|
||||
|
||||
NS_IMETHOD CreateDocumentViewerUsing(nsIPresContext* aPresContext,
|
||||
nsIDocumentViewer*& aResult) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIDocumentViewer_h___ */
|
||||
75
mozilla/content/base/public/nsINameSpace.h
Normal file
75
mozilla/content/base/public/nsINameSpace.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsINameSpace_h___
|
||||
#define nsINameSpace_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nslayout.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsINameSpaceManager;
|
||||
|
||||
#define NS_INAMESPACE_IID \
|
||||
{ 0xa6cf90d4, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
|
||||
/**
|
||||
* A nsINameSpace registers the NameSpace URI with the NameSpaceManager
|
||||
* (creating or finding an ID), and manages the relationship between
|
||||
* the NameSpace ID and the (optional) Prefix.
|
||||
*
|
||||
* New NameSpaces are created as a child of an existing NameSpace. Searches
|
||||
* for NameSpaces based on prefix search up the chain of nested NameSpaces
|
||||
*
|
||||
* Each NameSpace keeps a live reference on its parent and its Manager.
|
||||
*
|
||||
*/
|
||||
class nsINameSpace : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_INAMESPACE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const = 0;
|
||||
|
||||
// Get data of this name space
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const = 0;
|
||||
NS_IMETHOD GetNameSpaceURI(nsString& aURI) const = 0;
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const = 0;
|
||||
|
||||
NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const = 0;
|
||||
|
||||
// find name space within self and parents (not children)
|
||||
NS_IMETHOD FindNameSpace(nsIAtom* aPrefix, nsINameSpace*& aNameSpace) const = 0;
|
||||
NS_IMETHOD FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const = 0;
|
||||
NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const = 0;
|
||||
|
||||
// create new child name space
|
||||
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI,
|
||||
nsINameSpace*& aChildNameSpace) = 0;
|
||||
|
||||
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID,
|
||||
nsINameSpace*& aChildNameSpace) = 0;
|
||||
};
|
||||
|
||||
#endif // nsINameSpace_h___
|
||||
83
mozilla/content/base/public/nsINameSpaceManager.h
Normal file
83
mozilla/content/base/public/nsINameSpaceManager.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsINameSpaceManager_h___
|
||||
#define nsINameSpaceManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nslayout.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsINameSpace;
|
||||
|
||||
#define kNameSpaceID_Unknown -1
|
||||
#define kNameSpaceID_None 0
|
||||
#define kNameSpaceID_XMLNS 1 // not really a namespace, but it needs to play the game
|
||||
#define kNameSpaceID_XML 2
|
||||
#define kNameSpaceID_HTML 3
|
||||
|
||||
// 'html' is by definition bound to the namespace name "urn:w3-org-ns:HTML" XXX ???
|
||||
// 'xml' is by definition bound to the namespace name "urn:Connolly:input:required" XXX
|
||||
|
||||
#define NS_INAMESPACEMANAGER_IID \
|
||||
{ 0xa6cf90d5, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* The Name Space Manager tracks the associtation between a NameSpace
|
||||
* URI and the PRInt32 runtime id. Mappings between NameSpaces and
|
||||
* NameSpace prefixes are managed by nsINameSpaces
|
||||
*
|
||||
* All NameSpace URIs are stored in a global table so that IDs are
|
||||
* consistent accross the app. NameSpace IDs are only consistent at runtime
|
||||
* ie: they are not guaranteed to be consistent accross app sessions.
|
||||
*
|
||||
* The nsINameSpaceManager needs to have a live reference for as long as
|
||||
* the NameSpace IDs are needed. Generally, a document keeps a reference to
|
||||
* a nsINameSpaceManager. Also, each nsINameSpace that comes from the manager
|
||||
* keeps a reference to it.
|
||||
*
|
||||
* To create a stack of NameSpaces, call CreateRootNameSpace, and then create
|
||||
* child NameSpaces from the root.
|
||||
*
|
||||
* The "html" and "xml" namespaces come "pre-canned" from the root.
|
||||
*
|
||||
*/
|
||||
class nsINameSpaceManager : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_INAMESPACEMANAGER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace) = 0;
|
||||
|
||||
NS_IMETHOD RegisterNameSpace(const nsString& aURI,
|
||||
PRInt32& aNameSpaceID) = 0;
|
||||
|
||||
NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI) = 0;
|
||||
NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID) = 0;
|
||||
};
|
||||
|
||||
extern NS_LAYOUT nsresult
|
||||
NS_NewNameSpaceManager(nsINameSpaceManager** aInstancePtrResult);
|
||||
|
||||
|
||||
#endif // nsINameSpaceManager_h___
|
||||
104
mozilla/content/base/public/nsISelectionControler.h
Normal file
104
mozilla/content/base/public/nsISelectionControler.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* !!Note this is for a javascriptable pres shell currently for accessing selection
|
||||
* the selection refers only to that which listens to keybindings which is the "NORMAL"
|
||||
* selection this will be IDLIZED LATER
|
||||
*/
|
||||
|
||||
#ifndef nsISelectionControler_h___
|
||||
#define nsISelectionControler_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
|
||||
#define NS_ISELECTIONCONTROLER_IID_STR "D2D1D179-85A7-11d3-9932-00108301233C"
|
||||
|
||||
#define NS_ISELECTIONCONTROLER_IID \
|
||||
{ 0xd2d1d179, 0x85a7, 0x11d3, \
|
||||
{ 0x99, 0x32, 0x0, 0x10, 0x83, 0x1, 0x23, 0x3c }}
|
||||
|
||||
|
||||
class nsISelectionControler : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISELECTIONCONTROLER_IID; return iid; }
|
||||
|
||||
/** CharacterMove will move the selection one character forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** WordMove will move the selection one word forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** LineMove will move the selection one line forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** IntraLineMove will move the selection to the front of the line or end of the line
|
||||
* in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** PageMove will move the selection one page forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend) = 0;
|
||||
|
||||
/** ScrollPage will scroll the page without affecting the selection.
|
||||
* @param aForward scroll forward or backwards in selection
|
||||
*/
|
||||
NS_IMETHOD ScrollPage(PRBool aForward) = 0;
|
||||
|
||||
/** SelectAll will select the whole page
|
||||
*/
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* nsISelectionControler_h___ */
|
||||
114
mozilla/content/base/public/nsISelectionController.idl
Normal file
114
mozilla/content/base/public/nsISelectionController.idl
Normal file
@@ -0,0 +1,114 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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):
|
||||
* Sammy Ford
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(D2D1D179-85A7-11d3-9932-00108301233C)]
|
||||
interface nsISelectionController : nsISupports
|
||||
{
|
||||
/** CharacterMove will move the selection one character forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void characterMove(in boolean aForward, in boolean aExtend);
|
||||
|
||||
/** WordMove will move the selection one word forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
|
||||
void wordMove(in boolean aForward, in boolean aExtend);
|
||||
|
||||
/** LineMove will move the selection one line forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void lineMove(in boolean aForward, in boolean aExtend);
|
||||
|
||||
/** IntraLineMove will move the selection to the front of the line or end of the line
|
||||
* in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void intraLineMove(in boolean aForward, in boolean aExtend);
|
||||
|
||||
/** PageMove will move the selection one page forward/backward in the document.
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void pageMove(in boolean aForward, in boolean aExtend);
|
||||
|
||||
/** CompleteScroll will move page view to the top or bottom of the document
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
*/
|
||||
void completeScroll(in boolean aForward);
|
||||
|
||||
/** CompleteMove will move page view to the top or bottom of the document
|
||||
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
||||
* the "point" of selection that is extended is considered the "focus" point.
|
||||
* or the last point adjusted by the selection.
|
||||
* @param aForward forward or backward if PR_FALSE
|
||||
* @param aExtend should it collapse the selection of extend it?
|
||||
*/
|
||||
void completeMove(in boolean aForward, in boolean aExtend);
|
||||
|
||||
|
||||
/** ScrollPage will scroll the page without affecting the selection.
|
||||
* @param aForward scroll forward or backwards in selection
|
||||
*/
|
||||
void scrollPage(in boolean aForward);
|
||||
|
||||
/** ScrolLine will scroll line up or down dependent on the boolean
|
||||
* @param aForward scroll forward or backwards in selection
|
||||
*/
|
||||
void scrollLine(in boolean aForward);
|
||||
|
||||
/** ScrolHorizontal will scroll left or right dependent on the boolean
|
||||
* @param aLeft if true will scroll left. if not will scroll right.
|
||||
*/
|
||||
void scrollHorizontal(in boolean aLeft);
|
||||
/** SelectAll will select the whole page
|
||||
*/
|
||||
void selectAll();
|
||||
};
|
||||
%{ C++
|
||||
#define NS_ISELECTIONCONTROLLER_CID \
|
||||
{ 0xd2d1d179, 0x85a7, 0x11d3, \
|
||||
{ 0x99, 0x32, 0x0, 0x10, 0x83, 0x1, 0x23, 0x3c }}
|
||||
%}
|
||||
56
mozilla/content/base/public/nsIStyleRule.h
Normal file
56
mozilla/content/base/public/nsIStyleRule.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIStyleRule_h___
|
||||
#define nsIStyleRule_h___
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIStyleSheet;
|
||||
class nsIMutableStyleContext;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
|
||||
// IID for the nsIStyleRule interface {40ae5c90-ad6a-11d1-8031-006008159b5a}
|
||||
#define NS_ISTYLE_RULE_IID \
|
||||
{0x40ae5c90, 0xad6a, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
class nsIStyleRule : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_RULE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const = 0;
|
||||
|
||||
// Strength is an out-of-band weighting, useful for mapping CSS ! important
|
||||
NS_IMETHOD GetStrength(PRInt32& aStrength) const = 0;
|
||||
|
||||
// Map only font data into style context
|
||||
NS_IMETHOD MapFontStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext) = 0;
|
||||
// Map all non-font info into style context
|
||||
NS_IMETHOD MapStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleRule_h___ */
|
||||
72
mozilla/content/base/public/nsIStyleRuleProcessor.h
Normal file
72
mozilla/content/base/public/nsIStyleRuleProcessor.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIStyleRuleProcessor_h___
|
||||
#define nsIStyleRuleProcessor_h___
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIStyleSheet;
|
||||
class nsIStyleContext;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
class nsIAtom;
|
||||
|
||||
// IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
|
||||
#define NS_ISTYLE_RULE_PROCESSOR_IID \
|
||||
{0x015575fe, 0x7b6c, 0x11d3, {0xba, 0x05, 0x00, 0x10, 0x83, 0x02, 0x3c, 0x2b}}
|
||||
|
||||
/* The style rule processor interface is a mechanism to seperate the matching
|
||||
* of style rules from style sheet instances.
|
||||
* Simple style sheets can and will act as their own processor.
|
||||
* Sheets where rule ordering interlaces between multiple sheets, will need to
|
||||
* share a single rule processor between them (CSS sheets do this for cascading order)
|
||||
*/
|
||||
class nsIStyleRuleProcessor : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_RULE_PROCESSOR_IID; return iid; }
|
||||
|
||||
// populate supports array with nsIStyleRule*
|
||||
// rules are ordered, those with higher precedence come last
|
||||
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aContent,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsISupportsArray* aResults) = 0;
|
||||
|
||||
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsISupportsArray* aResults) = 0;
|
||||
|
||||
// Test if style is dependent on content state
|
||||
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aContent) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleRuleProcessor_h___ */
|
||||
71
mozilla/content/base/public/nsIStyleSheet.h
Normal file
71
mozilla/content/base/public/nsIStyleSheet.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIStyleSheet_h___
|
||||
#define nsIStyleSheet_h___
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsISupports.h"
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsIURI;
|
||||
class nsIStyleRule;
|
||||
class nsISupportsArray;
|
||||
class nsIPresContext;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIStyleContext;
|
||||
class nsIStyleRuleProcessor;
|
||||
|
||||
// IID for the nsIStyleSheet interface {8c4a80a0-ad6a-11d1-8031-006008159b5a}
|
||||
#define NS_ISTYLE_SHEET_IID \
|
||||
{0x8c4a80a0, 0xad6a, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
class nsIStyleSheet : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_SHEET_IID; return iid; }
|
||||
|
||||
// basic style sheet data
|
||||
NS_IMETHOD GetURL(nsIURI*& aURL) const = 0;
|
||||
NS_IMETHOD GetTitle(nsString& aTitle) const = 0;
|
||||
NS_IMETHOD GetType(nsString& aType) const = 0;
|
||||
NS_IMETHOD GetMediumCount(PRInt32& aCount) const = 0;
|
||||
NS_IMETHOD GetMediumAt(PRInt32 aIndex, nsIAtom*& aMedium) const = 0;
|
||||
NS_IMETHOD UseForMedium(nsIAtom* aMedium) const = 0;
|
||||
|
||||
NS_IMETHOD GetEnabled(PRBool& aEnabled) const = 0;
|
||||
NS_IMETHOD SetEnabled(PRBool aEnabled) = 0;
|
||||
|
||||
// style sheet owner info
|
||||
NS_IMETHOD GetParentSheet(nsIStyleSheet*& aParent) const = 0; // may be null
|
||||
NS_IMETHOD GetOwningDocument(nsIDocument*& aDocument) const = 0; // may be null
|
||||
NS_IMETHOD SetOwningDocument(nsIDocument* aDocument) = 0;
|
||||
|
||||
// style rule processor access
|
||||
NS_IMETHOD GetStyleRuleProcessor(nsIStyleRuleProcessor*& aProcessor,
|
||||
nsIStyleRuleProcessor* aPrevProcessor) = 0;
|
||||
|
||||
// XXX style rule enumerations
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIStyleSheet_h___ */
|
||||
54
mozilla/content/base/public/nsIStyleSheetLinkingElement.h
Normal file
54
mozilla/content/base/public/nsIStyleSheetLinkingElement.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIStyleSheetLinkingElement_h__
|
||||
#define nsIStyleSheetLinkingElement_h__
|
||||
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_ISTYLESHEETLINKINGELEMENT_IID \
|
||||
{0xa6cf90e9, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
class nsIStyleSheet;
|
||||
|
||||
class nsIStyleSheetLinkingElement : public nsISupports {
|
||||
public:
|
||||
/**
|
||||
* Used to make the association between a style sheet and
|
||||
* the element that linked it to the document.
|
||||
*
|
||||
* @param aStyleSheet the style sheet associated with this
|
||||
* element.
|
||||
*/
|
||||
NS_IMETHOD SetStyleSheet(nsIStyleSheet* aStyleSheet) = 0;
|
||||
|
||||
/**
|
||||
* Used to obtain the style sheet linked in by this element.
|
||||
*
|
||||
* @param aStyleSheet out parameter that returns the style
|
||||
* sheet associated with this element.
|
||||
*/
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) = 0;
|
||||
};
|
||||
|
||||
#endif // nsILinkingElement_h__
|
||||
62
mozilla/content/base/public/nsIStyledContent.h
Normal file
62
mozilla/content/base/public/nsIStyledContent.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIStyledContent_h___
|
||||
#define nsIStyledContent_h___
|
||||
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsString;
|
||||
class nsIStyleRule;
|
||||
class nsIStyleContext;
|
||||
class nsISupportsArray;
|
||||
|
||||
// IID for the nsIStyledContent class
|
||||
#define NS_ISTYLEDCONTENT_IID \
|
||||
{ 0xc1e84e01, 0xcd15, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
|
||||
|
||||
// Abstract interface for all styled content (that supports ID, CLASS, STYLE, and
|
||||
// the ability to specify style hints on an attribute change).
|
||||
class nsIStyledContent : public nsIContent {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLEDCONTENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetID(nsIAtom*& aResult) const = 0;
|
||||
NS_IMETHOD GetClasses(nsVoidArray& aArray) const = 0;
|
||||
NS_IMETHOD HasClass(nsIAtom* aClass) const = 0;
|
||||
|
||||
NS_IMETHOD GetContentStyleRules(nsISupportsArray* aRules) = 0;
|
||||
NS_IMETHOD GetInlineStyleRules(nsISupportsArray* aRules) = 0;
|
||||
|
||||
/** NRA ***
|
||||
* Get a hint that tells the style system what to do when
|
||||
* an attribute on this node changes.
|
||||
* This only applies to attributes that map their value
|
||||
* DIRECTLY into style contexts via NON-CSS style rules
|
||||
* Only HTML currently does this.
|
||||
* All other attributes return NS_STYLE_HINT_CONTENT
|
||||
*/
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIStyledContent_h___ */
|
||||
122
mozilla/content/base/public/nsITextContent.h
Normal file
122
mozilla/content/base/public/nsITextContent.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsITextContent_h___
|
||||
#define nsITextContent_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
class nsString;
|
||||
class nsTextFragment;
|
||||
class nsIContent;
|
||||
|
||||
// IID for the nsITextContent interface
|
||||
#define NS_ITEXT_CONTENT_IID \
|
||||
{0xa6cf9065, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
/**
|
||||
* Interface for textual content. This interface is used to provide
|
||||
* an efficient access to text content.
|
||||
*/
|
||||
class nsITextContent : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_ITEXT_CONTENT_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Get direct access (but read only) to the text in the text content.
|
||||
*/
|
||||
NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the length of the text content.
|
||||
*/
|
||||
NS_IMETHOD GetTextLength(PRInt32* aLengthResult) = 0;
|
||||
|
||||
/**
|
||||
* Make a copy of the text content in aResult.
|
||||
*/
|
||||
NS_IMETHOD CopyText(nsString& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Set the text to the given value. If aNotify is PR_TRUE then
|
||||
* the document is notified of the content change.
|
||||
*/
|
||||
NS_IMETHOD SetText(const PRUnichar* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Set the text to the given value. If aNotify is PR_TRUE then
|
||||
* the document is notified of the content change.
|
||||
*/
|
||||
NS_IMETHOD SetText(const char* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
/**
|
||||
* Query method to see if the frame is nothing but whitespace
|
||||
*/
|
||||
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/* a6cf905e-15b3-11d2-932e-00805f8add32 */
|
||||
#define NS_ITEXT_CONTENT_CHANGE_DATA_IID \
|
||||
{0xa6cf905e, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
// Simple interface for encapsulating change data for a ContentChanged
|
||||
// notification.
|
||||
class nsITextContentChangeData : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXT_CONTENT_CHANGE_DATA_IID);
|
||||
|
||||
enum ChangeType {
|
||||
Insert,
|
||||
Append,
|
||||
Replace
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the type of change associated with the ContentChanged
|
||||
* notification.
|
||||
*/
|
||||
NS_IMETHOD GetChangeType(ChangeType* aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetInsertData(PRInt32* aOffset,
|
||||
PRInt32* aInsertLength) = 0;
|
||||
|
||||
NS_IMETHOD GetAppendData(PRInt32* aOffset,
|
||||
PRInt32* aAppendLength) = 0;
|
||||
|
||||
NS_IMETHOD GetReplaceData(PRInt32* aOffset,
|
||||
PRInt32* aSourceLength,
|
||||
PRInt32* aReplaceLength) = 0;
|
||||
};
|
||||
|
||||
// XXX These belong elsewhere
|
||||
extern nsresult
|
||||
NS_NewTextNode(nsIContent** aResult);
|
||||
|
||||
extern nsresult
|
||||
NS_NewCommentNode(nsIContent** aResult);
|
||||
|
||||
|
||||
#endif /* nsITextContent_h___ */
|
||||
241
mozilla/content/base/public/nsTextFragment.h
Normal file
241
mozilla/content/base/public/nsTextFragment.h
Normal file
@@ -0,0 +1,241 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsTextFragment_h___
|
||||
#define nsTextFragment_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
class nsString;
|
||||
|
||||
// XXX should this normalize the code to keep a \u0000 at the end?
|
||||
|
||||
// XXX nsTextFragmentPool?
|
||||
|
||||
// XXX these need I18N spankage
|
||||
#define XP_IS_SPACE(_ch) \
|
||||
(((_ch) == ' ') || ((_ch) == '\t') || ((_ch) == '\n'))
|
||||
|
||||
#define XP_IS_UPPERCASE(_ch) \
|
||||
(((_ch) >= 'A') && ((_ch) <= 'Z'))
|
||||
|
||||
#define XP_IS_LOWERCASE(_ch) \
|
||||
(((_ch) >= 'a') && ((_ch) <= 'z'))
|
||||
|
||||
#define XP_TO_LOWER(_ch) ((_ch) | 32)
|
||||
|
||||
#define XP_TO_UPPER(_ch) ((_ch) & ~32)
|
||||
|
||||
#define XP_IS_SPACE_W XP_IS_SPACE
|
||||
|
||||
/**
|
||||
* A fragment of text. If mIs2b is 1 then the m2b pointer is valid
|
||||
* otherwise the m1b pointer is valid. If m1b is used then each byte
|
||||
* of data represents a single ucs2 character with the high byte being
|
||||
* zero.
|
||||
*
|
||||
* This class does not have a virtual destructor therefore it is not
|
||||
* meant to be subclassed.
|
||||
*/
|
||||
class NS_LAYOUT nsTextFragment {
|
||||
public:
|
||||
/**
|
||||
* Default constructor. Initialize the fragment to be empty.
|
||||
*/
|
||||
nsTextFragment() {
|
||||
m1b = nsnull;
|
||||
mAllBits = 0;
|
||||
}
|
||||
|
||||
~nsTextFragment();
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument fragment.
|
||||
*/
|
||||
nsTextFragment(const nsTextFragment& aOther);
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument 7bit ascii string.
|
||||
*/
|
||||
nsTextFragment(const char* aString);
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument ucs2 string.
|
||||
*/
|
||||
nsTextFragment(const PRUnichar* aString);
|
||||
|
||||
/**
|
||||
* Initialize the contents of this fragment to be a copy of
|
||||
* the argument string.
|
||||
*/
|
||||
nsTextFragment(const nsString& aString);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument fragment.
|
||||
*/
|
||||
nsTextFragment& operator=(const nsTextFragment& aOther);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument 7bit ascii string.
|
||||
*/
|
||||
nsTextFragment& operator=(const char* aString);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument ucs2 string.
|
||||
*/
|
||||
nsTextFragment& operator=(const PRUnichar* aString);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the
|
||||
* the argument string.
|
||||
*/
|
||||
nsTextFragment& operator=(const nsString& aString);
|
||||
|
||||
/**
|
||||
* Return PR_TRUE if this fragment is represented by PRUnichar data
|
||||
*/
|
||||
PRBool Is2b() const {
|
||||
return mState.mIs2b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to constant PRUnichar data.
|
||||
*/
|
||||
const PRUnichar* Get2b() const {
|
||||
NS_ASSERTION(Is2b(), "not 2b text");
|
||||
return m2b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to constant char data.
|
||||
*/
|
||||
const char* Get1b() const {
|
||||
NS_ASSERTION(!Is2b(), "not 1b text");
|
||||
return (const char*) m1b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the fragment. The length is the number of logical
|
||||
* characters, not the number of bytes to store the characters.
|
||||
*/
|
||||
PRInt32 GetLength() const {
|
||||
return PRInt32(mState.mLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutable version of Get2b. Only works for a non-const object.
|
||||
* Returns a pointer to the PRUnichar data.
|
||||
*/
|
||||
PRUnichar* Get2b() {
|
||||
NS_ASSERTION(Is2b(), "not 2b text");
|
||||
return m2b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutable version of Get1b. Only works for a non-const object.
|
||||
* Returns a pointer to the char data.
|
||||
*/
|
||||
char* Get1b() {
|
||||
NS_ASSERTION(!Is2b(), "not 1b text");
|
||||
return (char*) m1b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be the given buffer and
|
||||
* length. The memory becomes owned by the fragment. In addition,
|
||||
* the memory for aBuffer must have been allocated using the "new[]"
|
||||
* because it will be released with "delete []".
|
||||
*/
|
||||
void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the given
|
||||
* buffer. Like operator= except a length is specified instead of
|
||||
* assuming 0 termination.
|
||||
*/
|
||||
void SetTo(const PRUnichar* aBuffer, PRInt32 aLength);
|
||||
|
||||
/**
|
||||
* Change the contents of this fragment to be a copy of the given
|
||||
* buffer. Like operator= except a length is specified instead of
|
||||
* assuming 0 termination.
|
||||
*/
|
||||
void SetTo(const char* aBuffer, PRInt32 aLength);
|
||||
|
||||
/**
|
||||
* Append the contents of this string fragment to aString
|
||||
*/
|
||||
void AppendTo(nsString& aString) const;
|
||||
|
||||
/**
|
||||
* Make a copy of the fragments contents starting at offset for
|
||||
* count characters. The offset and count will be adjusted to
|
||||
* lie within the fragments data. The fragments data is converted if
|
||||
* necessary.
|
||||
*/
|
||||
void CopyTo(PRUnichar* aDest, PRInt32 aOffset, PRInt32 aCount);
|
||||
|
||||
/**
|
||||
* Make a copy of the fragments contents starting at offset for
|
||||
* count characters. The offset and count will be adjusted to
|
||||
* lie within the fragments data. The fragments data is converted if
|
||||
* necessary.
|
||||
*/
|
||||
void CopyTo(char* aDest, PRInt32 aOffset, PRInt32 aCount);
|
||||
|
||||
/**
|
||||
* Return the character in the text-fragment at the given
|
||||
* index. This always returns a PRUnichar.
|
||||
*/
|
||||
PRUnichar CharAt(PRInt32 aIndex) const {
|
||||
NS_ASSERTION(PRUint32(aIndex) < mState.mLength, "bad index");
|
||||
return mState.mIs2b ? m2b[aIndex] : PRUnichar(m1b[aIndex]);
|
||||
}
|
||||
|
||||
protected:
|
||||
union {
|
||||
PRUnichar* m2b;
|
||||
unsigned char* m1b;
|
||||
};
|
||||
|
||||
public:
|
||||
struct FragmentBits {
|
||||
PRUint32 mInHeap : 1;
|
||||
PRUint32 mIs2b : 1;
|
||||
PRUint32 mLength : 30;
|
||||
};
|
||||
|
||||
protected:
|
||||
union {
|
||||
PRUint32 mAllBits;
|
||||
FragmentBits mState;
|
||||
};
|
||||
|
||||
void ReleaseText();
|
||||
};
|
||||
|
||||
#endif /* nsTextFragment_h___ */
|
||||
|
||||
505
mozilla/content/base/src/nsCommentNode.cpp
Normal file
505
mozilla/content/base/src/nsCommentNode.cpp
Normal file
@@ -0,0 +1,505 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMComment.h"
|
||||
#include "nsGenericDOMDataNode.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMSelection.h"
|
||||
#include "nsXIFConverter.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMRange.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMCommentIID, NS_IDOMCOMMENT_IID);
|
||||
static NS_DEFINE_IID(kIEnumeratorIID, NS_IENUMERATOR_IID);
|
||||
static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID);
|
||||
|
||||
class nsCommentNode : public nsIDOMComment,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIContent,
|
||||
public nsITextContent
|
||||
{
|
||||
public:
|
||||
nsCommentNode();
|
||||
virtual ~nsCommentNode();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIDOMCharacterData
|
||||
NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIDOMComment
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIContent
|
||||
//NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const {
|
||||
return mInner.GetDocument(aResult);
|
||||
}
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep) {
|
||||
return mInner.SetDocument(aDocument, aDeep);
|
||||
}
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const {
|
||||
return mInner.GetParent(aResult);
|
||||
}
|
||||
NS_IMETHOD SetParent(nsIContent* aParent) {
|
||||
return mInner.SetParent(aParent);
|
||||
}
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const {
|
||||
return mInner.CanContainChildren(aResult);
|
||||
}
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const {
|
||||
return mInner.ChildCount(aResult);
|
||||
}
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const {
|
||||
return mInner.ChildAt(aIndex, aResult);
|
||||
}
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const {
|
||||
return mInner.IndexOf(aPossibleChild, aResult);
|
||||
}
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify) {
|
||||
return mInner.InsertChildAt(aKid, aIndex, aNotify);
|
||||
}
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify) {
|
||||
return mInner.ReplaceChildAt(aKid, aIndex, aNotify);
|
||||
}
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) {
|
||||
return mInner.AppendChildTo(aKid, aNotify);
|
||||
}
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) {
|
||||
return mInner.RemoveChildAt(aIndex, aNotify);
|
||||
}
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) {
|
||||
return mInner.IsSynthetic(aResult);
|
||||
}
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const {
|
||||
return mInner.GetNameSpaceID(aID);
|
||||
}
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const;
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr,
|
||||
nsIAtom*& aName,
|
||||
PRInt32& aNameSpaceID) {
|
||||
return mInner.ParseAttributeString(aStr, aName, aNameSpaceID);
|
||||
}
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
|
||||
nsIAtom*& aPrefix) {
|
||||
return mInner.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix);
|
||||
}
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
|
||||
nsString &aResult) const {
|
||||
return mInner.GetAttribute(aNameSpaceID, aAttribute, aResult);
|
||||
}
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
const nsString& aValue, PRBool aNotify) {
|
||||
return mInner.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify);
|
||||
}
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify) {
|
||||
return mInner.UnsetAttribute(aNameSpaceID, aAttribute, aNotify);
|
||||
}
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
|
||||
PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName) const {
|
||||
return mInner.GetAttributeNameAt(aIndex, aNameSpaceID, aName);
|
||||
}
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const {
|
||||
return mInner.GetAttributeCount(aResult);
|
||||
}
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const {
|
||||
return mInner.BeginConvertToXIF(aConverter);
|
||||
}
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const;
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const {
|
||||
return mInner.FinishConvertToXIF(aConverter);
|
||||
}
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) {
|
||||
*aID = mContentID;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) {
|
||||
mContentID = aID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange){
|
||||
return mInner.RangeAdd(aRange);
|
||||
}
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange){
|
||||
return mInner.RangeRemove(aRange);
|
||||
}
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const {
|
||||
return mInner.GetRangeList(aResult);
|
||||
}
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
*aResult = sizeof(*this);
|
||||
#else
|
||||
*aResult = 0;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult)
|
||||
{ return mInner.GetText(aFragmentsResult); }
|
||||
NS_IMETHOD GetTextLength(PRInt32* aLengthResult) {
|
||||
return mInner.GetTextLength(aLengthResult);
|
||||
}
|
||||
NS_IMETHOD CopyText(nsString& aResult) {
|
||||
return mInner.CopyText(aResult);
|
||||
}
|
||||
NS_IMETHOD SetText(const PRUnichar* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify);
|
||||
NS_IMETHOD SetText(const char* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify);
|
||||
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult)
|
||||
{ return mInner.IsOnlyWhitespace(aResult); }
|
||||
|
||||
protected:
|
||||
nsGenericDOMDataNode mInner;
|
||||
PRUint32 mContentID;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewCommentNode(nsIContent** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIContent* it = new nsCommentNode();
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsCommentNode::nsCommentNode()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this);
|
||||
mContentID = 0;
|
||||
}
|
||||
|
||||
nsCommentNode::~nsCommentNode()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsCommentNode)
|
||||
|
||||
NS_IMPL_RELEASE(nsCommentNode)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_DOM_DATA_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMCommentIID)) {
|
||||
nsIDOMComment* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kITextContentIID)) {
|
||||
nsITextContent* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::GetTag(nsIAtom*& aResult) const
|
||||
{
|
||||
aResult = nsLayoutAtoms::commentTagName;
|
||||
NS_ADDREF(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
aNodeName.SetString("#comment");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::GetNodeType(PRUint16* aNodeType)
|
||||
{
|
||||
*aNodeType = (PRUint16)nsIDOMNode::COMMENT_NODE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsCommentNode* it = new nsCommentNode();
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
// XXX Increment the ref count before calling any
|
||||
// methods. If they do a QI and then a Release()
|
||||
// the instance will be deleted.
|
||||
result = it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
nsAutoString data;
|
||||
result = GetData(data);
|
||||
if (NS_FAILED(result)) {
|
||||
NS_RELEASE(*aReturn);
|
||||
return result;
|
||||
}
|
||||
result = it->SetData(data);
|
||||
if (NS_FAILED(result)) {
|
||||
NS_RELEASE(*aReturn);
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
NS_PRECONDITION(nsnull != mInner.mDocument, "bad content");
|
||||
|
||||
PRInt32 indx;
|
||||
for (indx = aIndent; --indx >= 0; ) fputs(" ", out);
|
||||
|
||||
fprintf(out, "Comment@%p refcount=%d<!--", this, mRefCnt);
|
||||
|
||||
nsAutoString tmp;
|
||||
mInner.ToCString(tmp, 0, mInner.mText.GetLength());
|
||||
fputs(tmp, out);
|
||||
|
||||
fputs("-->\n", out);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
nsresult NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame*& aResult);
|
||||
nsresult
|
||||
NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame*& aResult)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
NS_NewEmptyFrame(aPresShell, &frame);
|
||||
if (nsnull == frame) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aResult = frame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate the content object into the (XIF) XML Interchange Format
|
||||
* XIF is an intermediate form of the content model, the buffer
|
||||
* will then be parsed into any number of formats including HTML, TXT, etc.
|
||||
*/
|
||||
nsresult
|
||||
nsCommentNode::ConvertContentToXIF(nsXIFConverter& aConverter) const
|
||||
{
|
||||
const nsIContent* content = this;
|
||||
nsIDOMSelection* sel = aConverter.GetSelection();
|
||||
|
||||
nsIDocument* document;
|
||||
nsresult res;
|
||||
res = GetDocument(document);
|
||||
if (!NS_SUCCEEDED(res))
|
||||
return res;
|
||||
|
||||
const nsTextFragment* textFrag;
|
||||
|
||||
// XXX This method is const, but GetText() isn't,
|
||||
// XXX so cast away the constness of mInner:
|
||||
nsGenericDOMDataNode* inner = (nsGenericDOMDataNode*)&mInner;
|
||||
res = inner->GetText(&textFrag);
|
||||
if (!NS_SUCCEEDED(res))
|
||||
return res;
|
||||
|
||||
if (sel != nsnull && document->IsInSelection(sel,content))
|
||||
{
|
||||
nsIEnumerator *enumerator;
|
||||
if (NS_SUCCEEDED(sel->QueryInterface(kIEnumeratorIID, (void **)&enumerator))) {
|
||||
for (enumerator->First();NS_OK != enumerator->IsDone(); enumerator->Next()) {
|
||||
nsIDOMRange* range = nsnull;
|
||||
if (NS_SUCCEEDED(enumerator->CurrentItem((nsISupports**)&range))) {
|
||||
|
||||
nsCOMPtr<nsIDOMNode> startNode;
|
||||
nsCOMPtr<nsIDOMNode> endNode;
|
||||
PRInt32 startOffset = 0;
|
||||
PRInt32 endOffset = 0;
|
||||
|
||||
range->GetStartParent(getter_AddRefs(startNode));
|
||||
range->GetEndParent(getter_AddRefs(endNode));
|
||||
|
||||
range->GetStartOffset(&startOffset);
|
||||
range->GetEndOffset(&endOffset);
|
||||
|
||||
nsCOMPtr<nsIContent> startContent;
|
||||
nsCOMPtr<nsIContent> endContent;
|
||||
startContent = do_QueryInterface(startNode);
|
||||
endContent = do_QueryInterface(endNode);
|
||||
|
||||
|
||||
nsString buffer;
|
||||
textFrag->AppendTo(buffer);
|
||||
if (startContent.get() == content || endContent.get() == content)
|
||||
{
|
||||
// NOTE: ORDER MATTERS!
|
||||
// This must go before the Cut
|
||||
if (endContent.get() == content)
|
||||
buffer.Truncate(endOffset);
|
||||
|
||||
// This must go after the Trunctate
|
||||
if (startContent.get() == content)
|
||||
buffer.Cut(0,startOffset);
|
||||
}
|
||||
aConverter.AddContentComment(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nsString buffer;
|
||||
textFrag->AppendTo(buffer);
|
||||
aConverter.AddContentComment(buffer);
|
||||
}
|
||||
NS_IF_RELEASE(document);
|
||||
// XXX Possible mem leak: Do we need to delete textFrag?
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
nsresult
|
||||
nsCommentNode::BeginConvertToXIF(nsXIFConverter& aConverter) const
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCommentNode::FinishConvertToXIF(nsXIFConverter& aConverter) const
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// This would ideally be done by the parser, but for the sake
|
||||
// of "genericity" it's being done in the comment content code
|
||||
static void
|
||||
StripCommentDelimiters(nsString& aCommentString)
|
||||
{
|
||||
PRInt32 offset;
|
||||
static char* kCommentStart = "<!";
|
||||
static char* kCommentEnd = "->";
|
||||
static char* kCommentAlternateEnd = "--!>";
|
||||
static char kMinus = '-';
|
||||
|
||||
offset = aCommentString.Find(kCommentStart);
|
||||
if (-1 != offset) {
|
||||
// Take up to 2 '-' characters
|
||||
offset += strlen(kCommentStart);
|
||||
if (kMinus == aCommentString.CharAt(offset)) {
|
||||
offset++;
|
||||
if (kMinus == aCommentString.CharAt(offset)) {
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
aCommentString.Cut(0, offset);
|
||||
}
|
||||
|
||||
offset = aCommentString.RFind(kCommentEnd);
|
||||
if (-1 != offset) {
|
||||
// Take up to 1 more '-'
|
||||
if (kMinus == aCommentString.CharAt(offset-1)) {
|
||||
offset--;
|
||||
}
|
||||
aCommentString.Cut(offset, aCommentString.Length()-offset);
|
||||
}
|
||||
else {
|
||||
offset = aCommentString.RFind(kCommentAlternateEnd);
|
||||
if (-1 != offset) {
|
||||
aCommentString.Cut(offset, aCommentString.Length()-offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::SetText(const PRUnichar* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify)
|
||||
{
|
||||
nsAutoString str(aBuffer);
|
||||
|
||||
StripCommentDelimiters(str);
|
||||
return mInner.SetText(str.GetUnicode(), str.Length(), aNotify);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCommentNode::SetText(const char* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify)
|
||||
{
|
||||
nsAutoString str(aBuffer);
|
||||
|
||||
StripCommentDelimiters(str);
|
||||
return mInner.SetText(str.GetUnicode(), str.Length(), aNotify);
|
||||
}
|
||||
1088
mozilla/content/base/src/nsContentIterator.cpp
Normal file
1088
mozilla/content/base/src/nsContentIterator.cpp
Normal file
File diff suppressed because it is too large
Load Diff
545
mozilla/content/base/src/nsContentList.cpp
Normal file
545
mozilla/content/base/src/nsContentList.cpp
Normal file
@@ -0,0 +1,545 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsContentList.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsGenericElement.h"
|
||||
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsHTMLAtoms.h" // XXX until atoms get factored into nsLayoutAtoms
|
||||
|
||||
nsIAtom* nsContentList::gWildCardAtom = nsnull;
|
||||
|
||||
nsContentList::nsContentList(nsIDocument *aDocument)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mScriptObject = nsnull;
|
||||
mFunc = nsnull;
|
||||
mMatchAtom = nsnull;
|
||||
mDocument = aDocument;
|
||||
mData = nsnull;
|
||||
mMatchAll = PR_FALSE;
|
||||
}
|
||||
|
||||
nsContentList::nsContentList(nsIDocument *aDocument,
|
||||
nsIAtom* aMatchAtom,
|
||||
PRInt32 aMatchNameSpaceId,
|
||||
nsIContent* aRootContent)
|
||||
{
|
||||
mMatchAtom = aMatchAtom;
|
||||
NS_IF_ADDREF(mMatchAtom);
|
||||
if (nsnull == gWildCardAtom) {
|
||||
gWildCardAtom = NS_NewAtom("*");
|
||||
}
|
||||
if (gWildCardAtom == mMatchAtom) {
|
||||
mMatchAll = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
mMatchAll = PR_FALSE;
|
||||
}
|
||||
mMatchNameSpaceId = aMatchNameSpaceId;
|
||||
mFunc = nsnull;
|
||||
mData = nsnull;
|
||||
mRootContent = aRootContent;
|
||||
Init(aDocument);
|
||||
}
|
||||
|
||||
nsContentList::nsContentList(nsIDocument *aDocument,
|
||||
nsContentListMatchFunc aFunc,
|
||||
const nsString* aData,
|
||||
nsIContent* aRootContent)
|
||||
{
|
||||
mFunc = aFunc;
|
||||
if (nsnull != aData) {
|
||||
mData = new nsString(*aData);
|
||||
// If this fails, fail silently
|
||||
}
|
||||
else {
|
||||
mData = nsnull;
|
||||
}
|
||||
mMatchAtom = nsnull;
|
||||
mRootContent = aRootContent;
|
||||
mMatchAll = PR_FALSE;
|
||||
Init(aDocument);
|
||||
}
|
||||
|
||||
void nsContentList::Init(nsIDocument *aDocument)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mScriptObject = nsnull;
|
||||
// We don't reference count the reference to the document
|
||||
// If the document goes away first, we'll be informed and we
|
||||
// can drop our reference.
|
||||
// If we go away first, we'll get rid of ourselves from the
|
||||
// document's observer list.
|
||||
mDocument = aDocument;
|
||||
if (nsnull != mDocument) {
|
||||
mDocument->AddObserver(this);
|
||||
}
|
||||
PopulateSelf();
|
||||
}
|
||||
|
||||
nsContentList::~nsContentList()
|
||||
{
|
||||
if (nsnull != mDocument) {
|
||||
mDocument->RemoveObserver(this);
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(mMatchAtom);
|
||||
|
||||
if (nsnull != mData) {
|
||||
delete mData;
|
||||
}
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLCollectionIID, NS_IDOMHTMLCOLLECTION_IID);
|
||||
|
||||
nsresult nsContentList::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIDOMNodeListIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMNodeList*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMHTMLCollectionIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMHTMLCollection*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
*aInstancePtr = (void*)(nsIScriptObjectOwner*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIDOMNodeList*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsContentList)
|
||||
NS_IMPL_RELEASE(nsContentList)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::GetLength(PRUint32* aLength)
|
||||
{
|
||||
nsresult result = CheckDocumentExistence();
|
||||
if (NS_OK == result) {
|
||||
*aLength = mContent.Count();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult result = CheckDocumentExistence();
|
||||
if (NS_OK == result) {
|
||||
nsISupports *element = (nsISupports *)mContent.ElementAt(aIndex);
|
||||
|
||||
if (nsnull != element) {
|
||||
result = element->QueryInterface(kIDOMNodeIID, (void **)aReturn);
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult result = CheckDocumentExistence();
|
||||
|
||||
if (NS_OK == result) {
|
||||
PRInt32 i, count = mContent.Count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
nsIContent *content = (nsIContent *)mContent.ElementAt(i);
|
||||
if (nsnull != content) {
|
||||
nsAutoString name;
|
||||
// XXX Should it be an EqualsIgnoreCase?
|
||||
if (((content->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, name) == NS_CONTENT_ATTR_HAS_VALUE) &&
|
||||
(aName.Equals(name))) ||
|
||||
((content->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::id, name) == NS_CONTENT_ATTR_HAS_VALUE) &&
|
||||
(aName.Equals(name)))) {
|
||||
return content->QueryInterface(kIDOMNodeIID, (void **)aReturn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aReturn = nsnull;
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
|
||||
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
||||
if (NS_OK != res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = factory->NewScriptHTMLCollection(aContext,
|
||||
(nsISupports*)(nsIDOMHTMLCollection*)this,
|
||||
global,
|
||||
(void**)&mScriptObject);
|
||||
NS_RELEASE(factory);
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
|
||||
NS_RELEASE(global);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{
|
||||
PRInt32 i, count;
|
||||
aContainer->ChildCount(count);
|
||||
if ((count > 0) && IsDescendantOfRoot(aContainer)) {
|
||||
PRBool repopulate = PR_FALSE;
|
||||
for (i = aNewIndexInContainer; i <= count-1; i++) {
|
||||
nsIContent *content;
|
||||
aContainer->ChildAt(i, content);
|
||||
if (mMatchAll || MatchSelf(content)) {
|
||||
repopulate = PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(content);
|
||||
}
|
||||
if (repopulate) {
|
||||
PopulateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::ContentInserted(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
if (IsDescendantOfRoot(aContainer)) {
|
||||
if (mMatchAll || MatchSelf(aChild)) {
|
||||
PopulateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::ContentReplaced(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
if (IsDescendantOfRoot(aContainer)) {
|
||||
if (mMatchAll || MatchSelf(aOldChild) || MatchSelf(aNewChild)) {
|
||||
PopulateSelf();
|
||||
}
|
||||
}
|
||||
else if (ContainsRoot(aOldChild)) {
|
||||
DisconnectFromDocument();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::ContentRemoved(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
if (IsDescendantOfRoot(aContainer) && MatchSelf(aChild)) {
|
||||
PopulateSelf();
|
||||
}
|
||||
else if (ContainsRoot(aChild)) {
|
||||
DisconnectFromDocument();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::DocumentWillBeDestroyed(nsIDocument *aDocument)
|
||||
{
|
||||
if (nsnull != mDocument) {
|
||||
aDocument->RemoveObserver(this);
|
||||
mDocument = nsnull;
|
||||
}
|
||||
Reset();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Returns whether the content element matches the
|
||||
// criterion
|
||||
nsresult
|
||||
nsContentList::Match(nsIContent *aContent, PRBool *aMatch)
|
||||
{
|
||||
if (nsnull != mMatchAtom) {
|
||||
nsIAtom *name = nsnull;
|
||||
aContent->GetTag(name);
|
||||
|
||||
// If we have to match all, only do those that have
|
||||
// a tagName i.e. only the elements.
|
||||
if (mMatchAll && (nsLayoutAtoms::textTagName != name) &&
|
||||
(nsLayoutAtoms::commentTagName != name) &&
|
||||
(nsLayoutAtoms::processingInstructionTagName != name)) {
|
||||
*aMatch = PR_TRUE;
|
||||
}
|
||||
// XXX We don't yet match on namespace. Maybe we should??
|
||||
else if (name == mMatchAtom) {
|
||||
*aMatch = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
*aMatch = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(name);
|
||||
}
|
||||
else if (nsnull != mFunc) {
|
||||
*aMatch = (*mFunc)(aContent, mData);
|
||||
}
|
||||
else {
|
||||
*aMatch = PR_FALSE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentList::Add(nsIContent *aContent)
|
||||
{
|
||||
// Shouldn't hold a reference since we'll be
|
||||
// told when the content leaves the document or
|
||||
// the document will be destroyed.
|
||||
mContent.AppendElement(aContent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentList::Remove(nsIContent *aContent)
|
||||
{
|
||||
mContent.RemoveElement(aContent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentList::Reset()
|
||||
{
|
||||
mContent.Clear();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If we were created outside the context of a document and we
|
||||
// have root content, then check if our content has been added
|
||||
// to a document yet. If so, we'll become an observer of the document.
|
||||
nsresult
|
||||
nsContentList::CheckDocumentExistence()
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if ((nsnull == mDocument) && (nsnull != mRootContent)) {
|
||||
result = mRootContent->GetDocument(mDocument);
|
||||
if (nsnull != mDocument) {
|
||||
mDocument->AddObserver(this);
|
||||
PopulateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Match recursively. See if anything in the subtree
|
||||
// matches the criterion.
|
||||
PRBool
|
||||
nsContentList::MatchSelf(nsIContent *aContent)
|
||||
{
|
||||
PRBool match;
|
||||
PRInt32 i, count;
|
||||
|
||||
Match(aContent, &match);
|
||||
if (match) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
aContent->ChildCount(count);
|
||||
for (i = 0; i < count; i++) {
|
||||
nsIContent *child;
|
||||
aContent->ChildAt(i, child);
|
||||
if (MatchSelf(child)) {
|
||||
NS_RELEASE(child);
|
||||
return PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(child);
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// Add all elements in this subtree that match to
|
||||
// our list.
|
||||
void
|
||||
nsContentList::PopulateWith(nsIContent *aContent, PRBool aIncludeRoot)
|
||||
{
|
||||
PRBool match;
|
||||
PRInt32 i, count;
|
||||
|
||||
if (aIncludeRoot) {
|
||||
Match(aContent, &match);
|
||||
if (match) {
|
||||
Add(aContent);
|
||||
}
|
||||
}
|
||||
|
||||
aContent->ChildCount(count);
|
||||
for (i = 0; i < count; i++) {
|
||||
nsIContent *child;
|
||||
aContent->ChildAt(i, child);
|
||||
PopulateWith(child, PR_TRUE);
|
||||
NS_RELEASE(child);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear out our old list and build up a new one
|
||||
void
|
||||
nsContentList::PopulateSelf()
|
||||
{
|
||||
Reset();
|
||||
if (nsnull != mRootContent) {
|
||||
PopulateWith(mRootContent, PR_FALSE);
|
||||
}
|
||||
else if (nsnull != mDocument) {
|
||||
nsIContent *root;
|
||||
root = mDocument->GetRootContent();
|
||||
PopulateWith(root, PR_TRUE);
|
||||
NS_RELEASE(root);
|
||||
}
|
||||
}
|
||||
|
||||
// Is the specified element a descendant of the root? If there
|
||||
// is no root, then yes. Otherwise keep tracing up the tree from
|
||||
// the element till we find our root, or until we reach the
|
||||
// document root.
|
||||
PRBool
|
||||
nsContentList::IsDescendantOfRoot(nsIContent* aContainer)
|
||||
{
|
||||
if (nsnull == mRootContent) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (mRootContent == aContainer) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (nsnull == aContainer) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
nsIContent* parent;
|
||||
PRBool ret;
|
||||
|
||||
aContainer->GetParent(parent);
|
||||
ret = IsDescendantOfRoot(parent);
|
||||
NS_IF_RELEASE(parent);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// Does this subtree contain the root?
|
||||
PRBool
|
||||
nsContentList::ContainsRoot(nsIContent* aContent)
|
||||
{
|
||||
if (nsnull == mRootContent) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (mRootContent == aContent) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
else {
|
||||
PRInt32 i, count;
|
||||
|
||||
aContent->ChildCount(count);
|
||||
for (i = 0; i < count; i++) {
|
||||
nsIContent *child;
|
||||
aContent->ChildAt(i, child);
|
||||
if (ContainsRoot(child)) {
|
||||
NS_RELEASE(child);
|
||||
return PR_TRUE;
|
||||
}
|
||||
NS_RELEASE(child);
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Our root content has been disconnected from the
|
||||
// document, so stop observing. The list then becomes
|
||||
// a snapshot rather than a dynamic list.
|
||||
void
|
||||
nsContentList::DisconnectFromDocument()
|
||||
{
|
||||
if (nsnull != mDocument) {
|
||||
mDocument->RemoveObserver(this);
|
||||
mDocument = nsnull;
|
||||
}
|
||||
}
|
||||
149
mozilla/content/base/src/nsContentList.h
Normal file
149
mozilla/content/base/src/nsContentList.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsContentList_h___
|
||||
#define nsContentList_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent, nsString* aData);
|
||||
|
||||
class nsIDocument;
|
||||
|
||||
class nsContentList : public nsIDOMNodeList,
|
||||
public nsIDOMHTMLCollection,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDocumentObserver {
|
||||
protected:
|
||||
nsContentList(nsIDocument *aDocument);
|
||||
public:
|
||||
nsContentList(nsIDocument *aDocument,
|
||||
nsIAtom* aMatchAtom,
|
||||
PRInt32 aMatchNameSpaceId,
|
||||
nsIContent* aRootContent=nsnull);
|
||||
nsContentList(nsIDocument *aDocument,
|
||||
nsContentListMatchFunc aFunc,
|
||||
const nsString* aData,
|
||||
nsIContent* aRootContent=nsnull);
|
||||
virtual ~nsContentList();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMHTMLCollection
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// nsIDocumentObserver
|
||||
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
|
||||
NS_IMETHOD EndLoad(nsIDocument *aDocument) { return NS_OK; }
|
||||
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
|
||||
nsIPresShell* aShell) { return NS_OK; }
|
||||
NS_IMETHOD EndReflow(nsIDocument *aDocument,
|
||||
nsIPresShell* aShell) { return NS_OK; }
|
||||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) { return NS_OK; }
|
||||
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2) { return NS_OK; }
|
||||
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint) { return NS_OK; }
|
||||
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer);
|
||||
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
NS_IMETHOD ContentRemoved(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet) { return NS_OK; }
|
||||
NS_IMETHOD StyleSheetRemoved(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet) { return NS_OK; }
|
||||
NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
PRBool aDisabled) { return NS_OK; }
|
||||
NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint) { return NS_OK; }
|
||||
NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) { return NS_OK; }
|
||||
NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument,
|
||||
nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule) { return NS_OK; }
|
||||
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument);
|
||||
|
||||
protected:
|
||||
nsresult Match(nsIContent *aContent, PRBool *aMatch);
|
||||
nsresult Add(nsIContent *aContent);
|
||||
nsresult Remove(nsIContent *aContent);
|
||||
nsresult Reset();
|
||||
void Init(nsIDocument *aDocument);
|
||||
void PopulateWith(nsIContent *aContent, PRBool aIncludeRoot);
|
||||
PRBool MatchSelf(nsIContent *aContent);
|
||||
void PopulateSelf();
|
||||
void DisconnectFromDocument();
|
||||
PRBool IsDescendantOfRoot(nsIContent* aContainer);
|
||||
PRBool ContainsRoot(nsIContent* aContent);
|
||||
nsresult CheckDocumentExistence();
|
||||
|
||||
static nsIAtom* gWildCardAtom;
|
||||
|
||||
nsIAtom* mMatchAtom;
|
||||
PRInt32 mMatchNameSpaceId;
|
||||
nsContentListMatchFunc mFunc;
|
||||
nsString* mData;
|
||||
nsVoidArray mContent;
|
||||
void *mScriptObject;
|
||||
nsIDocument* mDocument;
|
||||
nsIContent* mRootContent;
|
||||
PRBool mMatchAll;
|
||||
};
|
||||
|
||||
#endif // nsContentList_h___
|
||||
480
mozilla/content/base/src/nsDOMAttribute.cpp
Normal file
480
mozilla/content/base/src/nsDOMAttribute.cpp
Normal file
@@ -0,0 +1,480 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
|
||||
#include "nsDOMAttribute.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID);
|
||||
static NS_DEFINE_IID(kIDOMAttributePrivateIID, NS_IDOMATTRIBUTEPRIVATE_IID);
|
||||
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsDOMAttribute::nsDOMAttribute(nsIContent* aContent,
|
||||
const nsString& aName,
|
||||
const nsString& aValue)
|
||||
: mName(aName), mValue(aValue)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
// We don't add a reference to our content. It will tell us
|
||||
// to drop our reference when it goes away.
|
||||
mContent = aContent;
|
||||
mScriptObject = nsnull;
|
||||
mChild = nsnull;
|
||||
mChildList = nsnull;
|
||||
}
|
||||
|
||||
nsDOMAttribute::~nsDOMAttribute()
|
||||
{
|
||||
NS_IF_RELEASE(mChild);
|
||||
NS_IF_RELEASE(mChildList);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIDOMAttrIID)) {
|
||||
nsIDOMAttr* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
nsIScriptObjectOwner* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMAttributePrivateIID)) {
|
||||
nsIDOMAttributePrivate* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMNodeIID)) {
|
||||
nsIDOMNode* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
nsIDOMAttr* tmp1 = this;
|
||||
nsISupports* tmp2 = tmp1;
|
||||
*aInstancePtr = (void*)tmp2;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMAttribute)
|
||||
NS_IMPL_RELEASE(nsDOMAttribute)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::DropReference()
|
||||
{
|
||||
mContent = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::SetContent(nsIContent* aContent)
|
||||
{
|
||||
mContent = aContent;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetContent(nsIContent** aContent)
|
||||
{
|
||||
*aContent = mContent;
|
||||
NS_IF_ADDREF(mContent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::SetName(const nsString& aName)
|
||||
{
|
||||
mName=aName;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::GetScriptObject(nsIScriptContext *aContext,
|
||||
void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
||||
if (NS_OK != res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = factory->NewScriptAttr(aContext,
|
||||
(nsISupports *)(nsIDOMAttr *)this,
|
||||
(nsISupports *)mContent,
|
||||
(void **)&mScriptObject);
|
||||
NS_RELEASE(factory);
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::GetName(nsString& aName)
|
||||
{
|
||||
aName=mName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::GetValue(nsString& aValue)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull != mContent) {
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
nsresult attrResult;
|
||||
|
||||
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, mValue);
|
||||
if (NS_CONTENT_ATTR_NOT_THERE == attrResult) {
|
||||
mValue.Truncate();
|
||||
}
|
||||
NS_IF_RELEASE(nameAtom);
|
||||
}
|
||||
aValue=mValue;
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::SetValue(const nsString& aValue)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull != mContent) {
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
|
||||
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
result = mContent->SetAttribute(nameSpaceID, nameAtom, aValue, PR_TRUE);
|
||||
NS_IF_RELEASE(nameAtom);
|
||||
}
|
||||
mValue=aValue;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttribute::GetSpecified(PRBool* aSpecified)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull == mContent) {
|
||||
*aSpecified = PR_FALSE;
|
||||
}
|
||||
else {
|
||||
nsAutoString value;
|
||||
nsresult attrResult;
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
|
||||
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
attrResult = mContent->GetAttribute(nameSpaceID, nameAtom, value);
|
||||
NS_IF_RELEASE(nameAtom);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == attrResult) {
|
||||
*aSpecified = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
*aSpecified = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
return GetName(aNodeName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetNodeValue(nsString& aNodeValue)
|
||||
{
|
||||
return GetValue(aNodeValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::SetNodeValue(const nsString& aNodeValue)
|
||||
{
|
||||
return SetValue(aNodeValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetNodeType(PRUint16* aNodeType)
|
||||
{
|
||||
*aNodeType = (PRUint16)nsIDOMNode::ATTRIBUTE_NODE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetParentNode(nsIDOMNode** aParentNode)
|
||||
{
|
||||
*aParentNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
{
|
||||
if (nsnull == mChildList) {
|
||||
mChildList = new nsAttributeChildList(this);
|
||||
if (nsnull == mChildList) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(mChildList);
|
||||
}
|
||||
|
||||
return mChildList->QueryInterface(kIDOMNodeListIID, (void**)aChildNodes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::HasChildNodes(PRBool* aHasChildNodes)
|
||||
{
|
||||
*aHasChildNodes = PR_FALSE;
|
||||
if (nsnull != mChild) {
|
||||
*aHasChildNodes = PR_TRUE;
|
||||
}
|
||||
else if (nsnull != mContent) {
|
||||
nsAutoString value;
|
||||
|
||||
GetValue(value);
|
||||
if (0 < value.Length()) {
|
||||
*aHasChildNodes = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
{
|
||||
nsAutoString value;
|
||||
nsresult result;
|
||||
|
||||
result = GetValue(value);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
if (0 < value.Length()) {
|
||||
if (nsnull == mChild) {
|
||||
nsIContent* content;
|
||||
|
||||
result = NS_NewTextNode(&content);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
result = content->QueryInterface(kIDOMTextIID, (void**)&mChild);
|
||||
NS_RELEASE(content);
|
||||
}
|
||||
mChild->SetData(value);
|
||||
result = mChild->QueryInterface(kIDOMNodeIID, (void**)aFirstChild);
|
||||
}
|
||||
else {
|
||||
*aFirstChild = nsnull;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetLastChild(nsIDOMNode** aLastChild)
|
||||
{
|
||||
return GetFirstChild(aLastChild);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
|
||||
{
|
||||
*aPreviousSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetNextSibling(nsIDOMNode** aNextSibling)
|
||||
{
|
||||
*aNextSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||
{
|
||||
*aAttributes = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsDOMAttribute* newAttr;
|
||||
|
||||
if (nsnull != mContent) {
|
||||
nsAutoString value;
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
|
||||
mContent->ParseAttributeString(mName, nameAtom, nameSpaceID);
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
mContent->GetAttribute(nameSpaceID, nameAtom, value);
|
||||
newAttr = new nsDOMAttribute(nsnull, mName, value);
|
||||
}
|
||||
else {
|
||||
newAttr = new nsDOMAttribute(nsnull, mName, mValue);
|
||||
}
|
||||
|
||||
if (nsnull == newAttr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return newAttr->QueryInterface(kIDOMNodeIID, (void**)aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull != mContent) {
|
||||
nsIDOMNode* node;
|
||||
result = mContent->QueryInterface(kIDOMNodeIID, (void**)&node);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = node->GetOwnerDocument(aOwnerDocument);
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*aOwnerDocument = nsnull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsAttributeChildList::nsAttributeChildList(nsDOMAttribute* aAttribute)
|
||||
{
|
||||
// Don't increment the reference count. The attribute will tell
|
||||
// us when it's going away
|
||||
mAttribute = aAttribute;
|
||||
}
|
||||
|
||||
nsAttributeChildList::~nsAttributeChildList()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAttributeChildList::GetLength(PRUint32* aLength)
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
*aLength = 0;
|
||||
if (nsnull != mAttribute) {
|
||||
mAttribute->GetValue(value);
|
||||
if (0 < value.Length()) {
|
||||
*aLength = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAttributeChildList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
*aReturn = nsnull;
|
||||
if ((nsnull != mAttribute) && (0 == aIndex)) {
|
||||
mAttribute->GetFirstChild(aReturn);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsAttributeChildList::DropReference()
|
||||
{
|
||||
mAttribute = nsnull;
|
||||
}
|
||||
128
mozilla/content/base/src/nsDOMAttribute.h
Normal file
128
mozilla/content/base/src/nsDOMAttribute.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsDOMAttribute_h___
|
||||
#define nsDOMAttribute_h___
|
||||
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsGenericDOMNodeList.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsDOMAttribute;
|
||||
|
||||
#define NS_IDOMATTRIBUTEPRIVATE_IID \
|
||||
{0xa6cf90dd, 0x15b3, 0x11d2, \
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
||||
|
||||
class nsIDOMAttributePrivate : public nsISupports {
|
||||
public:
|
||||
NS_IMETHOD DropReference() = 0;
|
||||
NS_IMETHOD SetContent(nsIContent* aContent) = 0;
|
||||
NS_IMETHOD GetContent(nsIContent** aContent) = 0;
|
||||
NS_IMETHOD SetName(const nsString& aName) = 0;
|
||||
};
|
||||
|
||||
// bogus child list for an attribute
|
||||
class nsAttributeChildList : public nsGenericDOMNodeList
|
||||
{
|
||||
public:
|
||||
nsAttributeChildList(nsDOMAttribute* aAttribute);
|
||||
virtual ~nsAttributeChildList();
|
||||
|
||||
// interface nsIDOMNodeList
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||
|
||||
void DropReference();
|
||||
|
||||
protected:
|
||||
nsDOMAttribute* mAttribute;
|
||||
};
|
||||
|
||||
// Attribute helper class used to wrap up an attribute with a dom
|
||||
// object that implements nsIDOMAttr and nsIDOMNode and
|
||||
// nsIScriptObjectOwner
|
||||
class nsDOMAttribute : public nsIDOMAttr,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMAttributePrivate
|
||||
{
|
||||
public:
|
||||
nsDOMAttribute(nsIContent* aContent,
|
||||
const nsString& aName,
|
||||
const nsString& aValue);
|
||||
virtual ~nsDOMAttribute();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// nsIDOMAttr interface
|
||||
NS_IMETHOD GetSpecified(PRBool* aSpecified);
|
||||
NS_IMETHOD GetName(nsString& aReturn);
|
||||
NS_IMETHOD GetValue(nsString& aReturn);
|
||||
NS_IMETHOD SetValue(const nsString& aValue);
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName);
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue);
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue);
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType);
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode);
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes);
|
||||
NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes);
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild);
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild);
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling);
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling);
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes);
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
|
||||
nsIDOMNode** aReturn);
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
|
||||
nsIDOMNode** aReturn);
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
||||
|
||||
// nsIDOMAttributePrivate interface
|
||||
NS_IMETHOD DropReference();
|
||||
NS_IMETHOD SetContent(nsIContent* aContent);
|
||||
NS_IMETHOD GetContent(nsIContent** aContent);
|
||||
NS_IMETHOD SetName(const nsString& aName);
|
||||
|
||||
private:
|
||||
nsIContent* mContent;
|
||||
nsString mName;
|
||||
nsString mValue;
|
||||
// XXX For now, there's only a single child - a text
|
||||
// element representing the value
|
||||
nsIDOMText* mChild;
|
||||
nsAttributeChildList* mChildList;
|
||||
void* mScriptObject;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsDOMAttribute_h___ */
|
||||
508
mozilla/content/base/src/nsDOMAttributeMap.cpp
Normal file
508
mozilla/content/base/src/nsDOMAttributeMap.cpp
Normal file
@@ -0,0 +1,508 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsDOMAttribute.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMNamedNodeMapIID, NS_IDOMNAMEDNODEMAP_IID);
|
||||
static NS_DEFINE_IID(kIDOMAttrIID, NS_IDOMATTR_IID);
|
||||
static NS_DEFINE_IID(kIDOMAttributePrivateIID, NS_IDOMATTRIBUTEPRIVATE_IID);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsDOMAttributeMap::nsDOMAttributeMap(nsIContent* aContent)
|
||||
: mContent(aContent)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mScriptObject = nsnull;
|
||||
mAttributes = nsnull;
|
||||
// We don't add a reference to our content. If it goes away,
|
||||
// we'll be told to drop our reference
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK (PRIntn)
|
||||
RemoveAttributes(PLHashEntry* he, PRIntn i, void* arg)
|
||||
{
|
||||
nsIDOMAttr* attr = (nsIDOMAttr*)he->value;
|
||||
char* str = (char*)he->key;
|
||||
|
||||
if (nsnull != attr) {
|
||||
nsIDOMAttributePrivate* attrPrivate;
|
||||
attr->QueryInterface(kIDOMAttributePrivateIID, (void**)&attrPrivate);
|
||||
attrPrivate->DropReference();
|
||||
NS_RELEASE(attrPrivate);
|
||||
NS_RELEASE(attr);
|
||||
}
|
||||
delete [] str;
|
||||
|
||||
return HT_ENUMERATE_REMOVE;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK (PRIntn)
|
||||
DropReferencesInAttributes(PLHashEntry* he, PRIntn i, void* arg)
|
||||
{
|
||||
nsDOMAttribute* attr = (nsDOMAttribute*)he->value;
|
||||
|
||||
if (nsnull != attr) {
|
||||
nsIDOMAttributePrivate* attrPrivate;
|
||||
attr->QueryInterface(kIDOMAttributePrivateIID, (void**)&attrPrivate);
|
||||
attrPrivate->DropReference();
|
||||
NS_RELEASE(attrPrivate);
|
||||
}
|
||||
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
nsDOMAttributeMap::~nsDOMAttributeMap()
|
||||
{
|
||||
if (nsnull != mAttributes) {
|
||||
PL_HashTableEnumerateEntries(mAttributes, RemoveAttributes, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMAttributeMap::DropReference()
|
||||
{
|
||||
mContent = nsnull;
|
||||
if (nsnull != mAttributes) {
|
||||
PL_HashTableEnumerateEntries(mAttributes, DropReferencesInAttributes, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIDOMNamedNodeMapIID)) {
|
||||
nsIDOMNamedNodeMap* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
nsIScriptObjectOwner* tmp = this;
|
||||
*aInstancePtr = (void*)tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
nsIDOMNamedNodeMap* tmp1 = this;
|
||||
nsISupports* tmp2 = tmp1;
|
||||
*aInstancePtr = (void*)tmp2;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMAttributeMap)
|
||||
NS_IMPL_RELEASE(nsDOMAttributeMap)
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::GetScriptObject(nsIScriptContext *aContext,
|
||||
void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
||||
if (NS_OK != res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = factory->NewScriptNamedNodeMap(aContext,
|
||||
(nsISupports *)(nsIDOMNamedNodeMap *)this,
|
||||
(nsISupports *)mContent,
|
||||
(void**)&mScriptObject);
|
||||
NS_RELEASE(factory);
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PLHashTable*
|
||||
nsDOMAttributeMap::GetAttributeTable()
|
||||
{
|
||||
if ((nsnull == mAttributes) && (nsnull != mContent)) {
|
||||
PRInt32 count;
|
||||
mContent->GetAttributeCount(count);
|
||||
mAttributes = PL_NewHashTable(count, PL_HashString, PL_CompareStrings,
|
||||
PL_CompareValues, nsnull, nsnull);
|
||||
}
|
||||
|
||||
return mAttributes;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::GetNamedItemCommon(const nsString& aAttrName,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aNameAtom,
|
||||
nsIDOMNode** aAttribute)
|
||||
{
|
||||
nsIDOMAttr* attribute;
|
||||
char buf[128];
|
||||
nsresult result = NS_OK;
|
||||
|
||||
PLHashTable* attrHash = GetAttributeTable();
|
||||
aAttrName.ToCString(buf, sizeof(buf));
|
||||
if (nsnull != attrHash) {
|
||||
attribute = (nsIDOMAttr*)PL_HashTableLookup(attrHash, buf);
|
||||
if (nsnull == attribute) {
|
||||
nsresult attrResult;
|
||||
nsAutoString value;
|
||||
attrResult = mContent->GetAttribute(aNameSpaceID, aNameAtom, value);
|
||||
if (NS_CONTENT_ATTR_NOT_THERE != attrResult) {
|
||||
nsDOMAttribute* domAttribute;
|
||||
domAttribute = new nsDOMAttribute(mContent, aAttrName, value);
|
||||
if (nsnull == domAttribute) {
|
||||
result = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else {
|
||||
result = domAttribute->QueryInterface(kIDOMAttrIID,
|
||||
(void **)&attribute);
|
||||
char* hashKey = aAttrName.ToNewCString();
|
||||
PL_HashTableAdd(attrHash, hashKey, attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull != attribute) {
|
||||
result = attribute->QueryInterface(kIDOMNodeIID, (void**)aAttribute);
|
||||
}
|
||||
else {
|
||||
*aAttribute = nsnull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMAttributeMap::GetNormalizedName(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aNameAtom,
|
||||
nsString& aAttrName)
|
||||
{
|
||||
nsIAtom* prefix;
|
||||
aAttrName.Truncate();
|
||||
mContent->GetNameSpacePrefixFromId(aNameSpaceID, prefix);
|
||||
|
||||
if (nsnull != prefix) {
|
||||
prefix->ToString(aAttrName);
|
||||
aAttrName.Append(":");
|
||||
NS_RELEASE(prefix);
|
||||
}
|
||||
|
||||
if (nsnull != aNameAtom) {
|
||||
nsAutoString tmp;
|
||||
|
||||
aNameAtom->ToString(tmp);
|
||||
aAttrName.Append(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::GetNamedItem(const nsString &aAttrName,
|
||||
nsIDOMNode** aAttribute)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull != mContent) {
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
nsAutoString normalizedName;
|
||||
|
||||
mContent->ParseAttributeString(aAttrName, nameAtom, nameSpaceID);
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
GetNormalizedName(nameSpaceID, nameAtom, normalizedName);
|
||||
result = GetNamedItemCommon(normalizedName,
|
||||
nameSpaceID,
|
||||
nameAtom,
|
||||
aAttribute);
|
||||
NS_IF_RELEASE(nameAtom);
|
||||
}
|
||||
else {
|
||||
*aAttribute = nsnull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::SetNamedItem(nsIDOMNode *aNode, nsIDOMNode **aReturn)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMAttr* attribute;
|
||||
|
||||
if (nsnull == aNode) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (nsnull != mContent) {
|
||||
result = aNode->QueryInterface(kIDOMAttrIID, (void**)&attribute);
|
||||
if (NS_OK == result) {
|
||||
PLHashTable* attrHash;
|
||||
|
||||
attrHash = GetAttributeTable();
|
||||
if (nsnull != attrHash) {
|
||||
nsIDOMNode* oldAttribute;
|
||||
nsIDOMAttributePrivate* attrPrivate;
|
||||
nsAutoString name, value;
|
||||
char buf[128];
|
||||
char* key;
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
|
||||
// Get normalized attribute name
|
||||
attribute->GetName(name);
|
||||
mContent->ParseAttributeString(name, nameAtom, nameSpaceID);
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
GetNormalizedName(nameSpaceID, nameAtom, name);
|
||||
name.ToCString(buf, sizeof(buf));
|
||||
result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &oldAttribute);
|
||||
|
||||
if (nsnull != oldAttribute) {
|
||||
nsIDOMAttributePrivate* oldAttributePrivate;
|
||||
PLHashEntry** he;
|
||||
|
||||
// Remove the attribute from the hash table, cleaning
|
||||
// the hash table entry as we go about it.
|
||||
he = PL_HashTableRawLookup(attrHash, PL_HashString(buf), buf);
|
||||
key = (char*)(*he)->key;
|
||||
PL_HashTableRemove(attrHash, buf);
|
||||
if (nsnull != key) {
|
||||
delete [] key;
|
||||
}
|
||||
|
||||
result = oldAttribute->QueryInterface(kIDOMAttributePrivateIID,
|
||||
(void **)&oldAttributePrivate);
|
||||
if (NS_OK == result) {
|
||||
oldAttributePrivate->DropReference();
|
||||
NS_RELEASE(oldAttributePrivate);
|
||||
}
|
||||
|
||||
*aReturn = oldAttribute;
|
||||
|
||||
// Drop the reference held in the hash table
|
||||
NS_RELEASE(oldAttribute);
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
}
|
||||
|
||||
attribute->GetValue(value);
|
||||
|
||||
// Associate the new attribute with the content
|
||||
key = name.ToNewCString();
|
||||
result = attribute->QueryInterface(kIDOMAttributePrivateIID,
|
||||
(void **)&attrPrivate);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsIContent* owner;
|
||||
|
||||
attrPrivate->GetContent(&owner);
|
||||
if (owner) {
|
||||
// The old attribute is already associated with another
|
||||
// piece of content.
|
||||
result = NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR;
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
else {
|
||||
attrPrivate->SetContent(mContent);
|
||||
attrPrivate->SetName(name);
|
||||
|
||||
// Add the new attribute node to the hash table (maintaining
|
||||
// a reference to it)
|
||||
PL_HashTableAdd(attrHash, key, attribute);
|
||||
|
||||
// Set the attribute on the content
|
||||
result = mContent->SetAttribute(nameSpaceID, nameAtom, value, PR_TRUE);
|
||||
NS_IF_RELEASE(nameAtom);
|
||||
}
|
||||
NS_RELEASE(attrPrivate);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMAttributeMap::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull != mContent) {
|
||||
PLHashTable* attrHash;
|
||||
|
||||
attrHash = GetAttributeTable();
|
||||
if (nsnull != attrHash) {
|
||||
nsIDOMNode* attribute;
|
||||
nsIDOMAttributePrivate* attrPrivate;
|
||||
char buf[128];
|
||||
char* key;
|
||||
nsIAtom* nameAtom;
|
||||
PRInt32 nameSpaceID;
|
||||
nsAutoString name;
|
||||
|
||||
mContent->ParseAttributeString(aName, nameAtom, nameSpaceID);
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
GetNormalizedName(nameSpaceID, nameAtom, name);
|
||||
name.ToCString(buf, sizeof(buf));
|
||||
result = GetNamedItemCommon(name, nameSpaceID, nameAtom, &attribute);
|
||||
|
||||
if (nsnull != attribute) {
|
||||
PLHashEntry** he;
|
||||
|
||||
// Remove the attribute from the hash table, cleaning
|
||||
// the hash table entry as we go about it.
|
||||
he = PL_HashTableRawLookup(attrHash, PL_HashString(buf), buf);
|
||||
key = (char*)(*he)->key;
|
||||
|
||||
PL_HashTableRemove(attrHash, buf);
|
||||
if (nsnull != key) {
|
||||
delete [] key;
|
||||
}
|
||||
|
||||
result = attribute->QueryInterface(kIDOMAttributePrivateIID,
|
||||
(void **)&attrPrivate);
|
||||
if (NS_OK == result) {
|
||||
attrPrivate->DropReference();
|
||||
NS_RELEASE(attrPrivate);
|
||||
}
|
||||
|
||||
*aReturn = attribute;
|
||||
|
||||
// Drop the reference held in the hash table
|
||||
NS_RELEASE(attribute);
|
||||
}
|
||||
else {
|
||||
result = NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
*aReturn = nsnull;
|
||||
}
|
||||
|
||||
// Unset the attribute in the content
|
||||
result = mContent->UnsetAttribute(nameSpaceID, nameAtom, PR_TRUE);
|
||||
NS_IF_RELEASE(nameAtom);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
PRInt32 nameSpaceID;
|
||||
nsIAtom* nameAtom = nsnull;
|
||||
nsresult result = NS_OK;
|
||||
if ((nsnull != mContent) &&
|
||||
NS_SUCCEEDED(mContent->GetAttributeNameAt(aIndex,
|
||||
nameSpaceID,
|
||||
nameAtom))) {
|
||||
nsAutoString attrName;
|
||||
|
||||
GetNormalizedName(nameSpaceID, nameAtom, attrName);
|
||||
result = GetNamedItemCommon(attrName, nameSpaceID, nameAtom, aReturn);
|
||||
NS_IF_RELEASE(nameAtom);
|
||||
}
|
||||
else {
|
||||
*aReturn = nsnull;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::GetLength(PRUint32 *aLength)
|
||||
{
|
||||
PRInt32 n;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (nsnull != mContent) {
|
||||
rv = mContent->GetAttributeCount(n);
|
||||
*aLength = PRUint32(n);
|
||||
}
|
||||
else {
|
||||
*aLength = 0;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
PR_STATIC_CALLBACK (PRIntn)
|
||||
SizeAttributes(PLHashEntry* he, PRIntn i, void* arg)
|
||||
{
|
||||
char* str = (char*)he->key;
|
||||
PRUint32 size = sizeof(PLHashEntry);
|
||||
if (str) {
|
||||
size += PL_strlen(str) + 1;
|
||||
}
|
||||
PRUint32* sump = (PRUint32*) arg;
|
||||
*sump = *sump + size;
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMAttributeMap::SizeOfNamedNodeMap(nsIDOMNamedNodeMap* aMap,
|
||||
nsISizeOfHandler* aSizer,
|
||||
PRUint32* aResult)
|
||||
{
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
||||
nsDOMAttributeMap* map = (nsDOMAttributeMap*) aMap;
|
||||
PRUint32 sum = sizeof(nsDOMAttributeMap);
|
||||
if (map->mAttributes) {
|
||||
sum += sizeof(*map->mAttributes);
|
||||
PRUint32 esize = 0;
|
||||
PL_HashTableEnumerateEntries(map->mAttributes, SizeAttributes,
|
||||
(void*) &esize);
|
||||
sum += esize;
|
||||
}
|
||||
*aResult = sum;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
80
mozilla/content/base/src/nsDOMAttributeMap.h
Normal file
80
mozilla/content/base/src/nsDOMAttributeMap.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsDOMAttributeMap_h___
|
||||
#define nsDOMAttributeMap_h___
|
||||
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsString.h"
|
||||
#include "plhash.h"
|
||||
|
||||
class nsIContent;
|
||||
|
||||
// Helper class that implements the nsIDOMNamedNodeMap interface.
|
||||
class nsDOMAttributeMap : public nsIDOMNamedNodeMap,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
nsDOMAttributeMap(nsIContent* aContent);
|
||||
virtual ~nsDOMAttributeMap();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// nsIDOMNamedNodeMap interface
|
||||
NS_IMETHOD GetLength(PRUint32* aSize);
|
||||
NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD SetNamedItem(nsIDOMNode* aNode, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||
|
||||
void DropReference();
|
||||
|
||||
#ifdef DEBUG
|
||||
static nsresult SizeOfNamedNodeMap(nsIDOMNamedNodeMap* aMap,
|
||||
nsISizeOfHandler* aSizer,
|
||||
PRUint32* aResult);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsresult GetNamedItemCommon(const nsString& aAttrName,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aNameAtom,
|
||||
nsIDOMNode** aAttribute);
|
||||
void GetNormalizedName(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aNameAtom,
|
||||
nsString& aAttrName);
|
||||
PLHashTable* GetAttributeTable();
|
||||
|
||||
private:
|
||||
nsIContent* mContent;
|
||||
// XXX We really don't need to use a hashtable here.
|
||||
// We generally deal with a small number of attributes
|
||||
PLHashTable* mAttributes;
|
||||
void* mScriptObject;
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsDOMAttributeMap_h___ */
|
||||
3100
mozilla/content/base/src/nsDocument.cpp
Normal file
3100
mozilla/content/base/src/nsDocument.cpp
Normal file
File diff suppressed because it is too large
Load Diff
488
mozilla/content/base/src/nsDocument.h
Normal file
488
mozilla/content/base/src/nsDocument.h
Normal file
@@ -0,0 +1,488 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsDocument_h___
|
||||
#define nsDocument_h___
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDiskDocument.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsXIFConverter.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsGenericDOMNodeList.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
class nsIEventListenerManager;
|
||||
class nsDOMStyleSheetCollection;
|
||||
class nsIOutputStream;
|
||||
class nsDocument;
|
||||
|
||||
#if 0
|
||||
class nsPostData : public nsIPostData {
|
||||
public:
|
||||
nsPostData(PRBool aIsFile, char* aData);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual PRBool IsFile();
|
||||
virtual const char* GetData();
|
||||
virtual PRInt32 GetDataLength();
|
||||
|
||||
protected:
|
||||
virtual ~nsPostData();
|
||||
|
||||
PRBool mIsFile;
|
||||
char* mData;
|
||||
PRInt32 mDataLen;
|
||||
};
|
||||
#endif
|
||||
|
||||
class nsDocHeaderData
|
||||
{
|
||||
public:
|
||||
nsDocHeaderData(nsIAtom* aField, const nsString& aData)
|
||||
{
|
||||
mField = aField;
|
||||
NS_IF_ADDREF(mField);
|
||||
mData = aData;
|
||||
mNext = nsnull;
|
||||
}
|
||||
~nsDocHeaderData(void)
|
||||
{
|
||||
NS_IF_RELEASE(mField);
|
||||
if (nsnull != mNext) {
|
||||
delete mNext;
|
||||
mNext = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsIAtom* mField;
|
||||
nsAutoString mData;
|
||||
nsDocHeaderData* mNext;
|
||||
};
|
||||
|
||||
// Represents the children of a document (prolog, epilog and
|
||||
// document element)
|
||||
class nsDocumentChildNodes : public nsGenericDOMNodeList
|
||||
{
|
||||
public:
|
||||
nsDocumentChildNodes(nsIDocument* aDocument);
|
||||
~nsDocumentChildNodes();
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||
|
||||
void DropReference();
|
||||
|
||||
protected:
|
||||
nsIDocument* mDocument;
|
||||
};
|
||||
|
||||
// Base class for our document implementations
|
||||
class nsDocument : public nsIDocument,
|
||||
public nsIDOMDocument,
|
||||
public nsIDOMNSDocument,
|
||||
public nsIDiskDocument,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIJSScriptObject,
|
||||
public nsSupportsWeakReference,
|
||||
public nsIDOMEventReceiver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual nsIArena* GetArena();
|
||||
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener);
|
||||
|
||||
/**
|
||||
* Return the title of the document. May return null.
|
||||
*/
|
||||
virtual const nsString* GetDocumentTitle() const;
|
||||
|
||||
/**
|
||||
* Return the URL for the document. May return null.
|
||||
*/
|
||||
virtual nsIURI* GetDocumentURL() const;
|
||||
|
||||
/**
|
||||
* Return the principal responsible for this document.
|
||||
*/
|
||||
virtual nsIPrincipal* GetDocumentPrincipal();
|
||||
|
||||
/**
|
||||
* Return the content (mime) type of this document.
|
||||
*/
|
||||
NS_IMETHOD GetContentType(nsString& aContentType) const;
|
||||
|
||||
/**
|
||||
* Return the LoadGroup for the document. May return null.
|
||||
*/
|
||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup **aGroup) const;
|
||||
|
||||
/**
|
||||
* Return the base URL for realtive URLs in the document. May return null (or the document URL).
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const;
|
||||
|
||||
/**
|
||||
* Return a standard name for the document's character set. This will
|
||||
* trigger a startDocumentLoad if necessary to answer the question.
|
||||
*/
|
||||
NS_IMETHOD GetDocumentCharacterSet(nsString& oCharsetID);
|
||||
NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID);
|
||||
|
||||
/**
|
||||
* Return the Line Breaker for the document
|
||||
*/
|
||||
NS_IMETHOD GetLineBreaker(nsILineBreaker** aResult) ;
|
||||
NS_IMETHOD SetLineBreaker(nsILineBreaker* aLineBreaker) ;
|
||||
NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) ;
|
||||
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) ;
|
||||
|
||||
/**
|
||||
* Access HTTP header data (this may also get set from other sources, like
|
||||
* HTML META tags).
|
||||
*/
|
||||
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const;
|
||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData);
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
#if 0
|
||||
// XXX Temp hack: moved to nsMarkupDocument
|
||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult);
|
||||
#endif
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
||||
virtual PRInt32 GetNumberOfShells();
|
||||
virtual nsIPresShell* GetShellAt(PRInt32 aIndex);
|
||||
|
||||
/**
|
||||
* Return the parent document of this document. Will return null
|
||||
* unless this document is within a compound document and has a parent.
|
||||
*/
|
||||
virtual nsIDocument* GetParentDocument();
|
||||
virtual void SetParentDocument(nsIDocument* aParent);
|
||||
virtual void AddSubDocument(nsIDocument* aSubDoc);
|
||||
virtual PRInt32 GetNumberOfSubDocuments();
|
||||
virtual nsIDocument* GetSubDocumentAt(PRInt32 aIndex);
|
||||
|
||||
/**
|
||||
* Return the root content object for this document.
|
||||
*/
|
||||
virtual nsIContent* GetRootContent();
|
||||
virtual void SetRootContent(nsIContent* aRoot);
|
||||
|
||||
/**
|
||||
* Methods to append to the prolog and epilog of
|
||||
* a document. The prolog is the content before the document
|
||||
* element, the epilog after.
|
||||
*/
|
||||
NS_IMETHOD AppendToProlog(nsIContent* aContent);
|
||||
NS_IMETHOD AppendToEpilog(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const;
|
||||
NS_IMETHOD GetChildCount(PRInt32& aCount);
|
||||
|
||||
/**
|
||||
* Get the style sheets owned by this document.
|
||||
* These are ordered, highest priority last
|
||||
*/
|
||||
virtual PRInt32 GetNumberOfStyleSheets();
|
||||
virtual nsIStyleSheet* GetStyleSheetAt(PRInt32 aIndex);
|
||||
virtual PRInt32 GetIndexOfStyleSheet(nsIStyleSheet* aSheet);
|
||||
virtual void AddStyleSheet(nsIStyleSheet* aSheet);
|
||||
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet);
|
||||
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool aNotify);
|
||||
virtual void SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
|
||||
PRBool mDisabled);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject);
|
||||
|
||||
/**
|
||||
* Get the name space manager for this document
|
||||
*/
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Remove an observer of document change notifications. This will
|
||||
* return false if the observer cannot be found.
|
||||
*/
|
||||
virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver);
|
||||
|
||||
// Observation hooks used by content nodes to propagate
|
||||
// notifications to document observers.
|
||||
NS_IMETHOD BeginLoad();
|
||||
NS_IMETHOD EndLoad();
|
||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2);
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint);
|
||||
NS_IMETHOD ContentAppended(nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer);
|
||||
NS_IMETHOD ContentInserted(nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
NS_IMETHOD ContentReplaced(nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
|
||||
NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint); // See nsStyleConsts fot hint values
|
||||
NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
|
||||
/**
|
||||
* Finds text in content
|
||||
*/
|
||||
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
|
||||
|
||||
/**
|
||||
* Converts the document or a selection of the
|
||||
* document to XIF (XML Interchange Format)
|
||||
* and places the result in aBuffer.
|
||||
*/
|
||||
NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
|
||||
NS_IMETHOD ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
virtual void FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// nsIDOMDocument interface
|
||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype);
|
||||
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation);
|
||||
NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement);
|
||||
|
||||
NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn);
|
||||
NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn);
|
||||
NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn);
|
||||
NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn);
|
||||
NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn);
|
||||
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn);
|
||||
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn);
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn);
|
||||
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets);
|
||||
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName,
|
||||
const nsString& aNameSpace,
|
||||
nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn);
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth);
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight);
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName);
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue);
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue);
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType);
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode);
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes);
|
||||
NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes);
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild);
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild);
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling);
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling);
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes);
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
|
||||
// nsIDOMEventReceiver interface
|
||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult);
|
||||
|
||||
// nsIDiskDocument inteface
|
||||
NS_IMETHOD InitDiskDocument(nsFileSpec *aFileSpec);
|
||||
NS_IMETHOD SaveFile( nsFileSpec* aFileSpec,
|
||||
PRBool aReplaceExisting,
|
||||
PRBool aSaveCopy,
|
||||
ESaveFileType aSaveFileType,
|
||||
const nsString& aSaveCharset);
|
||||
|
||||
NS_IMETHOD GetFileSpec(nsFileSpec& aFileSpec);
|
||||
NS_IMETHOD GetModCount(PRInt32 *outModCount);
|
||||
NS_IMETHOD ResetModCount();
|
||||
NS_IMETHOD IncrementModCount(PRInt32 aNumMods);
|
||||
|
||||
// nsIDOMEventTarget interface
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
|
||||
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
|
||||
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;
|
||||
virtual void SetDisplaySelection(PRBool aToggle);
|
||||
virtual PRBool GetDisplaySelection() const;
|
||||
|
||||
// nsIJSScriptObject interface
|
||||
virtual PRBool AddProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool DeleteProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool GetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool SetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool EnumerateProperty(JSContext *aContext);
|
||||
virtual PRBool Resolve(JSContext *aContext, jsval aID);
|
||||
virtual PRBool Convert(JSContext *aContext, jsval aID);
|
||||
virtual void Finalize(JSContext *aContext);
|
||||
|
||||
/**
|
||||
* Methods to output the document contents as Text or HTML, outputting into
|
||||
* the given output stream. If charset is not an empty string, the contents
|
||||
* will be converted into the given charset.
|
||||
*
|
||||
* If the selection is passed in is not null, only the selected content
|
||||
* will be output. Note that the selection is stored on a per-presentation
|
||||
* shell basis, not per document, hence it is a parameter here.
|
||||
* These should be exposed in an interface, but aren't yet.
|
||||
*/
|
||||
|
||||
virtual nsresult OutputDocumentAsText(nsIOutputStream* aStream, nsIDOMSelection* selection, const nsString& aCharset);
|
||||
virtual nsresult OutputDocumentAsHTML(nsIOutputStream* aStream, nsIDOMSelection* selection, const nsString& aCharset);
|
||||
|
||||
protected:
|
||||
nsIContent* FindContent(const nsIContent* aStartNode,
|
||||
const nsIContent* aTest1,
|
||||
const nsIContent* aTest2) const;
|
||||
virtual nsresult Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||
|
||||
// this enum is temporary; there should be no knowledge of HTML in
|
||||
// nsDocument. That will be fixed when content sink stream factories
|
||||
// are available.
|
||||
enum EOutputFormat {
|
||||
eOutputText,
|
||||
eOutputHTML
|
||||
};
|
||||
|
||||
virtual nsresult OutputDocumentAs(nsIOutputStream* aStream, nsIDOMSelection* selection, EOutputFormat aOutputFormat, const nsString& aCharset);
|
||||
|
||||
nsresult GetPixelDimensions(nsIPresShell* aShell,
|
||||
PRInt32* aWidth,
|
||||
PRInt32* aHeight);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); // subclass hooks for sheet ordering
|
||||
virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex);
|
||||
|
||||
nsDocument();
|
||||
virtual ~nsDocument();
|
||||
nsresult Init();
|
||||
|
||||
nsIArena* mArena;
|
||||
nsString* mDocumentTitle;
|
||||
nsIURI* mDocumentURL;
|
||||
nsIPrincipal* mPrincipal;
|
||||
nsWeakPtr mDocumentLoadGroup;
|
||||
nsString mCharacterSet;
|
||||
nsIDocument* mParentDocument;
|
||||
nsVoidArray mSubDocuments;
|
||||
nsVoidArray mPresShells;
|
||||
nsIContent* mRootContent;
|
||||
nsVoidArray mStyleSheets;
|
||||
nsVoidArray mObservers;
|
||||
void* mScriptObject;
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||
nsIEventListenerManager* mListenerManager;
|
||||
PRBool mDisplaySelection;
|
||||
PRBool mInDestructor;
|
||||
nsDOMStyleSheetCollection *mDOMStyleSheets;
|
||||
nsINameSpaceManager* mNameSpaceManager;
|
||||
nsDocHeaderData* mHeaderData;
|
||||
nsILineBreaker* mLineBreaker;
|
||||
nsVoidArray *mProlog;
|
||||
nsVoidArray *mEpilog;
|
||||
nsDocumentChildNodes* mChildNodes;
|
||||
nsIWordBreaker* mWordBreaker;
|
||||
|
||||
// disk file members
|
||||
nsFileSpec* mFileSpec;
|
||||
PRInt32 mModCount;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsDocument_h___ */
|
||||
361
mozilla/content/base/src/nsDocumentEncoder.cpp
Normal file
361
mozilla/content/base/src/nsDocumentEncoder.cpp
Normal file
@@ -0,0 +1,361 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIDocumentEncoder.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMSelection.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsXIFDTD.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsHTMLContentSinkStream.h"
|
||||
#include "nsHTMLToTXTSinkStream.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
|
||||
static NS_DEFINE_CID(kCTextEncoderCID, NS_TEXT_ENCODER_CID);
|
||||
|
||||
static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);
|
||||
static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
|
||||
|
||||
class nsTextEncoder : public nsIDocumentEncoder
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOCUMENT_ENCODER_IID; return iid; }
|
||||
|
||||
nsTextEncoder();
|
||||
virtual ~nsTextEncoder();
|
||||
|
||||
NS_IMETHOD Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags);
|
||||
|
||||
/* Interfaces for addref and release and queryinterface */
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// Inherited methods from nsIDocumentEncoder
|
||||
NS_IMETHOD SetSelection(nsIDOMSelection* aSelection);
|
||||
NS_IMETHOD SetWrapColumn(PRUint32 aWC);
|
||||
NS_IMETHOD SetCharset(const nsString& aCharset);
|
||||
|
||||
NS_IMETHOD EncodeToStream(nsIOutputStream* aStream);
|
||||
NS_IMETHOD EncodeToString(nsString& aOutputString);
|
||||
|
||||
protected:
|
||||
// Local methods to the text encoder -- used to be in nsITextEncoder,
|
||||
// but that interface is obsolete now.
|
||||
//NS_IMETHOD PrettyPrint(PRBool aYes);
|
||||
//NS_IMETHOD AddHeader(PRBool aYes);
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsIDOMSelection* mSelection;
|
||||
nsString mMimeType;
|
||||
nsString mCharset;
|
||||
PRUint32 mFlags;
|
||||
PRUint32 mWrapColumn;
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsTextEncoder)
|
||||
NS_IMPL_RELEASE(nsTextEncoder)
|
||||
|
||||
nsTextEncoder::nsTextEncoder() : mMimeType("text/plain")
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mDocument = 0;
|
||||
mSelection = 0;
|
||||
mFlags = 0;
|
||||
mWrapColumn = 72;
|
||||
}
|
||||
|
||||
nsTextEncoder::~nsTextEncoder()
|
||||
{
|
||||
NS_IF_RELEASE(mDocument);
|
||||
//NS_IF_RELEASE(mSelection); // no. we never addref'd it.
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEncoder::Init(nsIDocument* aDocument, const nsString& aMimeType, PRUint32 aFlags)
|
||||
{
|
||||
if (!aDocument)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
mDocument = aDocument;
|
||||
NS_ADDREF(mDocument);
|
||||
|
||||
mMimeType = aMimeType;
|
||||
|
||||
mFlags = aFlags;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsTextEncoder::QueryInterface(REFNSIID aIID,
|
||||
void **aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aInstancePtr = 0;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void *)(nsISupports*)this;
|
||||
} else if (aIID.Equals(nsIDocumentEncoder::GetIID())) {
|
||||
*aInstancePtr = (void *)(nsIDocumentEncoder*)this;
|
||||
}
|
||||
|
||||
if (nsnull == *aInstancePtr)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEncoder::SetWrapColumn(PRUint32 aWC)
|
||||
{
|
||||
mWrapColumn = aWC;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEncoder::SetSelection(nsIDOMSelection* aSelection)
|
||||
{
|
||||
mSelection = aSelection;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEncoder::SetCharset(const nsString& aCharset)
|
||||
{
|
||||
mCharset = aCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEncoder::EncodeToString(nsString& aOutputString)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!mDocument)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// xxx Also make sure mString is a mime type "text/html" or "text/plain"
|
||||
|
||||
if (mDocument)
|
||||
{
|
||||
nsString buffer;
|
||||
|
||||
if (mMimeType == "text/xif")
|
||||
{
|
||||
mDocument->CreateXIF(aOutputString, mSelection);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mDocument->CreateXIF(buffer, mSelection);
|
||||
|
||||
nsIParser* parser;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCParserCID,
|
||||
nsnull,
|
||||
kCParserIID,
|
||||
(void **)&parser);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsIHTMLContentSink* sink = nsnull;
|
||||
|
||||
if (mMimeType == "text/html")
|
||||
rv = NS_New_HTML_ContentSinkStream(&sink, &aOutputString, mFlags);
|
||||
|
||||
else // default to text/plain
|
||||
rv = NS_New_HTMLToTXT_SinkStream(&sink, &aOutputString,
|
||||
mWrapColumn, mFlags);
|
||||
|
||||
if (sink && NS_SUCCEEDED(rv))
|
||||
{
|
||||
parser->SetContentSink(sink);
|
||||
nsIDTD* dtd = nsnull;
|
||||
rv = NS_NewXIFDTD(&dtd);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
parser->RegisterDTD(dtd);
|
||||
parser->Parse(buffer, 0, "text/xif", PR_FALSE, PR_TRUE);
|
||||
}
|
||||
NS_IF_RELEASE(dtd);
|
||||
NS_IF_RELEASE(sink);
|
||||
}
|
||||
NS_RELEASE(parser);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextEncoder::EncodeToStream(nsIOutputStream* aStream)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (!mDocument)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// xxx Also make sure mString is a mime type "text/html" or "text/plain"
|
||||
|
||||
if (mDocument)
|
||||
{
|
||||
nsString buffer;
|
||||
|
||||
mDocument->CreateXIF(buffer,mSelection);
|
||||
|
||||
nsString* charset = nsnull;
|
||||
nsAutoString defaultCharset("ISO-8859-1");
|
||||
if (!mCharset.Equals("null") && !mCharset.Equals(""))
|
||||
charset = &mCharset;
|
||||
|
||||
nsIParser* parser;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCParserCID,
|
||||
nsnull,
|
||||
kCParserIID,
|
||||
(void **)&parser);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIHTMLContentSink* sink = nsnull;
|
||||
|
||||
if (mMimeType == "text/html")
|
||||
rv = NS_New_HTML_ContentSinkStream(&sink, aStream, charset, mFlags);
|
||||
|
||||
else
|
||||
rv = NS_New_HTMLToTXT_SinkStream(&sink, aStream, charset,
|
||||
mWrapColumn, mFlags);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
parser->SetContentSink(sink);
|
||||
|
||||
nsIDTD* dtd = nsnull;
|
||||
rv = NS_NewXIFDTD(&dtd);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
parser->RegisterDTD(dtd);
|
||||
parser->Parse(buffer, 0, "text/xif", PR_FALSE, PR_TRUE);
|
||||
}
|
||||
NS_IF_RELEASE(dtd);
|
||||
NS_IF_RELEASE(sink);
|
||||
}
|
||||
NS_RELEASE(parser);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewTextEncoder(nsIDocumentEncoder** aResult)
|
||||
{
|
||||
*aResult = new nsTextEncoder;
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
class nsDocumentEncoderFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
nsDocumentEncoderFactory();
|
||||
virtual ~nsDocumentEncoderFactory();
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult);
|
||||
};
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsDocumentEncoderFactory);
|
||||
|
||||
nsDocumentEncoderFactory::nsDocumentEncoderFactory()
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDocumentEncoderFactory);
|
||||
mRefCnt = 0;
|
||||
}
|
||||
|
||||
nsDocumentEncoderFactory::~nsDocumentEncoderFactory()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsDocumentEncoderFactory);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDocumentEncoderFactory)
|
||||
NS_IMPL_RELEASE(nsDocumentEncoderFactory)
|
||||
|
||||
nsresult nsDocumentEncoderFactory::QueryInterface(REFNSIID aIID,
|
||||
void **aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aInstancePtr = 0;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void *)(nsISupports*)this;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aInstancePtr = (void *)(nsIFactory*)this;
|
||||
}
|
||||
|
||||
if (nsnull == *aInstancePtr)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocumentEncoderFactory::CreateInstance(nsISupports *aOuter,
|
||||
REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aResult = 0;
|
||||
|
||||
if (aIID.Equals(kCTextEncoderCID))
|
||||
*aResult = new nsTextEncoder;
|
||||
else
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
if (*aResult == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
382
mozilla/content/base/src/nsDocumentFragment.cpp
Normal file
382
mozilla/content/base/src/nsDocumentFragment.cpp
Normal file
@@ -0,0 +1,382 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIDOMDocumentFragmentIID, NS_IDOMDOCUMENTFRAGMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
|
||||
|
||||
class nsDocumentFragment : public nsIContent,
|
||||
public nsIDOMDocumentFragment,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
nsDocumentFragment(nsIDocument* aOwnerDocument);
|
||||
virtual ~nsDocumentFragment();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// interface nsIDOMDocumentFragment
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName);
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue);
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue);
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType);
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode)
|
||||
{
|
||||
*aParentNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
{ return mInner.GetChildNodes(aChildNodes); }
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
{ return mInner.GetFirstChild(aFirstChild); }
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild)
|
||||
{ return mInner.GetLastChild(aLastChild); }
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling)
|
||||
{
|
||||
*aPreviousSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling)
|
||||
{
|
||||
*aNextSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||
{
|
||||
*aAttributes = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
|
||||
nsIDOMNode** aReturn)
|
||||
{ return mInner.InsertBefore(aNewChild, aRefChild, aReturn); }
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
|
||||
nsIDOMNode** aReturn)
|
||||
{ return mInner.ReplaceChild(aNewChild, aOldChild, aReturn); }
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
{ return mInner.RemoveChild(aOldChild, aReturn); }
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
|
||||
{ return mInner.AppendChild(aNewChild, aReturn); }
|
||||
NS_IMETHOD HasChildNodes(PRBool* aReturn)
|
||||
{ return mInner.HasChildNodes(aReturn); }
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
|
||||
// interface nsIScriptObjectOwner
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
// interface nsIContent
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr,
|
||||
nsIAtom*& aName,
|
||||
PRInt32& aNameSpaceID)
|
||||
{ aName = nsnull;
|
||||
aNameSpaceID = kNameSpaceID_None;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
|
||||
nsIAtom*& aPrefix)
|
||||
{
|
||||
aPrefix = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const
|
||||
{ return mInner.GetDocument(aResult); }
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep)
|
||||
{ return mInner.SetDocument(aDocument, aDeep); }
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const
|
||||
{
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetParent(nsIContent* aParent)
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aResult) const
|
||||
{
|
||||
aResult = kNameSpaceID_None;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const
|
||||
{
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const
|
||||
{ return mInner.CanContainChildren(aResult); }
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const
|
||||
{ return mInner.ChildCount(aResult); }
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const
|
||||
{ return mInner.ChildAt(aIndex, aResult); }
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const
|
||||
{ return mInner.IndexOf(aPossibleChild, aIndex); }
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify)
|
||||
{ return mInner.InsertChildAt(aKid, aIndex, aNotify); }
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,
|
||||
PRBool aNotify)
|
||||
{ return mInner.ReplaceChildAt(aKid, aIndex, aNotify); }
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify)
|
||||
{ return mInner.AppendChildTo(aKid, aNotify); }
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
|
||||
{ return mInner.RemoveChildAt(aIndex, aNotify); }
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult)
|
||||
{ return mInner.IsSynthetic(aResult); }
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsString& aValue,
|
||||
PRBool aNotify)
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsString& aResult) const
|
||||
{ return NS_CONTENT_ATTR_NOT_THERE; }
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify)
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex,
|
||||
PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName) const
|
||||
{
|
||||
aName = nsnull;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aCountResult) const
|
||||
{
|
||||
aCountResult = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const
|
||||
{ return mInner.List(out, aIndent); }
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
*aEventStatus = nsEventStatus_eIgnore;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) {
|
||||
*aID = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange)
|
||||
{ return mInner.RangeAdd(aRange); }
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange)
|
||||
{ return mInner.RangeRemove(aRange); }
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const
|
||||
{ return mInner.GetRangeList(aResult); }
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
*aResult = sizeof(*this);
|
||||
#else
|
||||
*aResult = 0;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsGenericContainerElement mInner;
|
||||
void* mScriptObject;
|
||||
nsIDocument* mOwnerDocument;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
|
||||
nsIDocument* aOwnerDocument)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsDocumentFragment* it = new nsDocumentFragment(aOwnerDocument);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIDOMDocumentFragmentIID,
|
||||
(void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsDocumentFragment::nsDocumentFragment(nsIDocument* aOwnerDocument)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, nsnull);
|
||||
mScriptObject = nsnull;
|
||||
mOwnerDocument = aOwnerDocument;
|
||||
NS_IF_ADDREF(mOwnerDocument);
|
||||
}
|
||||
|
||||
nsDocumentFragment::~nsDocumentFragment()
|
||||
{
|
||||
NS_IF_RELEASE(mOwnerDocument);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDocumentFragment)
|
||||
NS_IMPL_RELEASE(nsDocumentFragment)
|
||||
|
||||
nsresult
|
||||
nsDocumentFragment::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
nsIDOMDocumentFragment* tmp = this;
|
||||
nsISupports* tmp2 = tmp;
|
||||
*aInstancePtr = (void*) tmp2;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMDocumentFragmentIID)) {
|
||||
nsIDOMDocumentFragment* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMNodeIID)) {
|
||||
nsIDOMDocumentFragment* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
nsIScriptObjectOwner* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIContentIID)) {
|
||||
nsIContent* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
aNodeName.SetString("#document-fragment");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::GetNodeValue(nsString& aNodeValue)
|
||||
{
|
||||
aNodeValue.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::SetNodeValue(const nsString& aNodeValue)
|
||||
{
|
||||
// The node value can't be modified
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::GetNodeType(PRUint16* aNodeType)
|
||||
{
|
||||
*aNodeType = (PRUint16)nsIDOMNode::DOCUMENT_FRAGMENT_NODE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||
{
|
||||
if (nsnull != mOwnerDocument) {
|
||||
return mOwnerDocument->QueryInterface(kIDOMDocumentIID, (void **)aOwnerDocument);
|
||||
}
|
||||
else {
|
||||
*aOwnerDocument = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsDocumentFragment* it;
|
||||
it = new nsDocumentFragment(mOwnerDocument);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
//XXX mInner.CopyInnerTo(this, &it->mInner);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::GetScriptObject(nsIScriptContext* aContext,
|
||||
void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
res = mInner.GetScriptObjectFactory(&factory);
|
||||
if (NS_OK != res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = factory->NewScriptDocumentFragment(aContext,
|
||||
(nsISupports*)(nsIDOMDocumentFragment*)this,
|
||||
mOwnerDocument,
|
||||
(void**)&mScriptObject);
|
||||
NS_RELEASE(factory);
|
||||
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentFragment::SetScriptObject(void* aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
1510
mozilla/content/base/src/nsDocumentViewer.cpp
Normal file
1510
mozilla/content/base/src/nsDocumentViewer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
22
mozilla/content/base/src/nsGenericCaretProperties.cpp
Normal file
22
mozilla/content/base/src/nsGenericCaretProperties.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#include "nsCaretProperties.h"
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
nsCaretProperties::nsCaretProperties()
|
||||
: mCaretWidth(eDefaultCaretWidth)
|
||||
, mBlinkRate(eDefaulBlinkRate)
|
||||
{
|
||||
// in your platform-specific class, get data from the OS in your constructor
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
nsCaretProperties* NewCaretProperties()
|
||||
{
|
||||
return new nsCaretProperties();
|
||||
}
|
||||
1048
mozilla/content/base/src/nsGenericDOMDataNode.cpp
Normal file
1048
mozilla/content/base/src/nsGenericDOMDataNode.cpp
Normal file
File diff suppressed because it is too large
Load Diff
571
mozilla/content/base/src/nsGenericDOMDataNode.h
Normal file
571
mozilla/content/base/src/nsGenericDOMDataNode.h
Normal file
@@ -0,0 +1,571 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsGenericDOMDataNode_h___
|
||||
#define nsGenericDOMDataNode_h___
|
||||
|
||||
#include "nsIDOMCharacterData.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
extern const nsIID kIDOMCharacterDataIID;
|
||||
extern const nsIID kIDOMNodeIID;
|
||||
extern const nsIID kIDOMEventReceiverIID;
|
||||
extern const nsIID kIDOMEventTargetIID;
|
||||
extern const nsIID kIScriptObjectOwnerIID;
|
||||
extern const nsIID kISupportsIID;
|
||||
extern const nsIID kIContentIID;
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMEventListener;
|
||||
class nsIDOMNodeList;
|
||||
class nsIEventListenerManager;
|
||||
class nsIFrame;
|
||||
class nsIStyleContext;
|
||||
class nsIStyleRule;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMText;
|
||||
|
||||
struct nsGenericDOMDataNode {
|
||||
nsGenericDOMDataNode();
|
||||
virtual ~nsGenericDOMDataNode();
|
||||
|
||||
void Init(nsIContent* aOuterContentObject);
|
||||
|
||||
// Implementation for nsIDOMNode
|
||||
nsresult GetNodeValue(nsString& aNodeValue);
|
||||
nsresult SetNodeValue(const nsString& aNodeValue);
|
||||
nsresult GetParentNode(nsIDOMNode** aParentNode);
|
||||
nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes) {
|
||||
*aAttributes = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling);
|
||||
nsresult GetNextSibling(nsIDOMNode** aNextSibling);
|
||||
nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
|
||||
nsresult HasChildNodes(PRBool* aHasChildNodes) {
|
||||
*aHasChildNodes = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetFirstChild(nsIDOMNode** aFirstChild) {
|
||||
*aFirstChild = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetLastChild(nsIDOMNode** aLastChild) {
|
||||
*aLastChild = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
|
||||
nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
|
||||
nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
||||
|
||||
// Implementation for nsIDOMCharacterData
|
||||
nsresult GetData(nsString& aData);
|
||||
nsresult SetData(const nsString& aData);
|
||||
nsresult GetLength(PRUint32* aLength);
|
||||
nsresult SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn);
|
||||
nsresult AppendData(const nsString& aArg);
|
||||
nsresult InsertData(PRUint32 aOffset, const nsString& aArg);
|
||||
nsresult DeleteData(PRUint32 aOffset, PRUint32 aCount);
|
||||
nsresult ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg);
|
||||
|
||||
// nsIDOMEventReceiver interface
|
||||
nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
nsresult RemoveEventListenerByIID(nsIDOMEventListener* aListener,
|
||||
const nsIID& aIID);
|
||||
nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
nsresult GetNewListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
|
||||
// nsIDOMEventTarget interface
|
||||
nsresult AddEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
nsresult RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
nsresult SetScriptObject(void *aScriptObject);
|
||||
|
||||
// Implementation for nsIContent
|
||||
nsresult GetDocument(nsIDocument*& aResult) const;
|
||||
nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep);
|
||||
nsresult GetParent(nsIContent*& aResult) const;
|
||||
nsresult SetParent(nsIContent* aParent);
|
||||
nsresult IsSynthetic(PRBool& aResult) {
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetNameSpaceID(PRInt32& aID) const {
|
||||
aID = kNameSpaceID_None;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult ParseAttributeString(const nsString& aStr,
|
||||
nsIAtom*& aName,
|
||||
PRInt32& aNameSpaceID) {
|
||||
aName = nsnull;
|
||||
aNameSpaceID = kNameSpaceID_None;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
|
||||
nsIAtom*& aPrefix) {
|
||||
aPrefix = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue,
|
||||
PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
nsresult GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName) const {
|
||||
aName = nsnull;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
nsresult GetAttributeCount(PRInt32& aResult) const {
|
||||
aResult = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult List(FILE* out, PRInt32 aIndent) const;
|
||||
nsresult HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
nsresult RangeAdd(nsIDOMRange& aRange);
|
||||
nsresult RangeRemove(nsIDOMRange& aRange);
|
||||
nsresult GetRangeList(nsVoidArray*& aResult) const;
|
||||
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult,
|
||||
size_t aInstanceSize) const;
|
||||
|
||||
// Implementation for nsIContent
|
||||
nsresult BeginConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult ConvertContentToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult FinishConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult CanContainChildren(PRBool& aResult) const {
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult ChildCount(PRInt32& aResult) const {
|
||||
aResult = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult ChildAt(PRInt32 aIndex, nsIContent*& aResult) const {
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const {
|
||||
aResult = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult RemoveChildAt(PRInt32 aIndex, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult SplitText(PRUint32 aOffset, nsIDOMText** aReturn);
|
||||
|
||||
nsresult GetText(const nsTextFragment** aFragmentsResult);
|
||||
nsresult GetTextLength(PRInt32* aLengthResult);
|
||||
nsresult CopyText(nsString& aResult);
|
||||
nsresult SetText(const PRUnichar* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify);
|
||||
nsresult SetText(const char* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify);
|
||||
nsresult IsOnlyWhitespace(PRBool* aResult);
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const;
|
||||
|
||||
// Up pointer to the real content object that we are
|
||||
// supporting. Sometimes there is work that we just can't do
|
||||
// ourselves, so this is needed to ask the real object to do the
|
||||
// work.
|
||||
nsIContent* mContent;
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsIContent* mParent;
|
||||
void* mScriptObject;
|
||||
nsIEventListenerManager* mListenerManager;
|
||||
nsIContent* mCapturer;
|
||||
|
||||
nsTextFragment mText;
|
||||
nsVoidArray *mRangeList;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Mostly implement the nsIDOMNode API by forwarding the methods to a
|
||||
* generic content object (either nsGenericHTMLLeafElement or
|
||||
* nsGenericHTMLContainerContent)
|
||||
*
|
||||
* Note that classes using this macro will need to implement:
|
||||
* NS_IMETHOD GetNodeType(PRUint16* aNodeType);
|
||||
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
*/
|
||||
#define NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(_g) \
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName); \
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \
|
||||
return _g.GetNodeValue(aNodeValue); \
|
||||
} \
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \
|
||||
return _g.SetNodeValue(aNodeValue); \
|
||||
} \
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType); \
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) { \
|
||||
return _g.GetParentNode(aParentNode); \
|
||||
} \
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) { \
|
||||
return _g.GetChildNodes(aChildNodes); \
|
||||
} \
|
||||
NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes) { \
|
||||
return _g.HasChildNodes(aHasChildNodes); \
|
||||
} \
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild) { \
|
||||
return _g.GetFirstChild(aFirstChild); \
|
||||
} \
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild) { \
|
||||
return _g.GetLastChild(aLastChild); \
|
||||
} \
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling) { \
|
||||
return _g.GetPreviousSibling(aPreviousSibling); \
|
||||
} \
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) { \
|
||||
return _g.GetNextSibling(aNextSibling); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { \
|
||||
return _g.GetAttributes(aAttributes); \
|
||||
} \
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, \
|
||||
nsIDOMNode** aReturn) { \
|
||||
return _g.InsertBefore(aNewChild, aRefChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { \
|
||||
return _g.AppendChild(aOldChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, \
|
||||
nsIDOMNode** aReturn) { \
|
||||
return _g.ReplaceChild(aNewChild, aOldChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { \
|
||||
return _g.RemoveChild(aOldChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { \
|
||||
return _g.GetOwnerDocument(aOwnerDocument); \
|
||||
} \
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
|
||||
#define NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(_g) \
|
||||
NS_IMETHOD GetData(nsString& aData) { \
|
||||
return _g.GetData(aData); \
|
||||
} \
|
||||
NS_IMETHOD SetData(const nsString& aData) { \
|
||||
return _g.SetData(aData); \
|
||||
} \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { \
|
||||
return _g.GetLength(aLength); \
|
||||
} \
|
||||
NS_IMETHOD SubstringData(PRUint32 aStart, PRUint32 aEnd, nsString& aReturn) { \
|
||||
return _g.SubstringData(aStart, aEnd, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD AppendData(const nsString& aData) { \
|
||||
return _g.AppendData(aData); \
|
||||
} \
|
||||
NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aData) { \
|
||||
return _g.InsertData(aOffset, aData); \
|
||||
} \
|
||||
NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount) { \
|
||||
return _g.DeleteData(aOffset, aCount); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, \
|
||||
const nsString& aData) { \
|
||||
return _g.ReplaceData(aOffset, aCount, aData); \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implement the nsIDOMEventReceiver API by forwarding the methods to a
|
||||
* generic content object (either nsGenericHTMLLeafElement or
|
||||
* nsGenericHTMLContainerContent)
|
||||
*/
|
||||
#define NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(_g) \
|
||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, \
|
||||
const nsIID& aIID) { \
|
||||
return _g.AddEventListenerByIID(aListener, aIID); \
|
||||
} \
|
||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, \
|
||||
const nsIID& aIID) { \
|
||||
return _g.RemoveEventListenerByIID(aListener, aIID); \
|
||||
} \
|
||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aResult) { \
|
||||
return _g.GetListenerManager(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager** aResult) { \
|
||||
return _g.GetNewListenerManager(aResult); \
|
||||
} \
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, \
|
||||
nsIDOMEventListener* aListener, \
|
||||
PRBool aUseCapture) { \
|
||||
return _g.AddEventListener(aType, aListener, aUseCapture); \
|
||||
} \
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, \
|
||||
nsIDOMEventListener* aListener, \
|
||||
PRBool aUseCapture) { \
|
||||
return _g.RemoveEventListener(aType, aListener, aUseCapture); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the nsIScriptObjectOwner API by forwarding the methods to a
|
||||
* generic content object (either nsGenericHTMLLeafElement or
|
||||
* nsGenericHTMLContainerContent)
|
||||
*/
|
||||
#define NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(_g) \
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, \
|
||||
void** aScriptObject) { \
|
||||
return _g.GetScriptObject(aContext, aScriptObject); \
|
||||
} \
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject) { \
|
||||
return _g.SetScriptObject(aScriptObject); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(_g) \
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const { \
|
||||
return _g.GetDocument(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep) { \
|
||||
return _g.SetDocument(aDocument, aDeep); \
|
||||
} \
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const { \
|
||||
return _g.GetParent(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetParent(nsIContent* aParent) { \
|
||||
return _g.SetParent(aParent); \
|
||||
} \
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const { \
|
||||
return _g.CanContainChildren(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const { \
|
||||
return _g.ChildCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { \
|
||||
return _g.ChildAt(aIndex, aResult); \
|
||||
} \
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { \
|
||||
return _g.IndexOf(aPossibleChild, aResult); \
|
||||
} \
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.InsertChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.ReplaceChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) { \
|
||||
return _g.AppendChildTo(aKid, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) { \
|
||||
return _g.RemoveChildAt(aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) { \
|
||||
return _g.IsSynthetic(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const { \
|
||||
return _g.GetNameSpaceID(aID); \
|
||||
} \
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const; \
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
|
||||
nsIAtom*& aName, \
|
||||
PRInt32& aNameSpaceID) { \
|
||||
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, \
|
||||
nsIAtom*& aPrefix) { \
|
||||
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
|
||||
} \
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, \
|
||||
nsString &aResult) const { \
|
||||
return _g.GetAttribute(aNameSpaceID, aAttribute, aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
|
||||
const nsString& aValue, PRBool aNotify) { \
|
||||
return _g.SetAttribute(aNameSpaceID, aAttribute, aValue, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
|
||||
PRBool aNotify) { \
|
||||
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
|
||||
PRInt32& aNameSpaceID, \
|
||||
nsIAtom*& aName) const { \
|
||||
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
|
||||
return _g.GetAttributeCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; \
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.BeginConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.ConvertContentToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.FinishConvertToXIF(aConverter); \
|
||||
} \
|
||||
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 RangeAdd(nsIDOMRange& aRange){ \
|
||||
return _g.RangeAdd(aRange); \
|
||||
} \
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange){ \
|
||||
return _g.RangeRemove(aRange); \
|
||||
} \
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const { \
|
||||
return _g.GetRangeList(aResult); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the nsIDOMText API by forwarding the methods to a
|
||||
* generic character data content object.
|
||||
*/
|
||||
#define NS_IMPL_IDOMTEXT_USING_GENERIC_DOM_DATA(_g) \
|
||||
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn){ \
|
||||
return _g.SplitText(aOffset, aReturn); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the nsITextContent API by forwarding the methods to a
|
||||
* generic character data content object.
|
||||
*/
|
||||
#define NS_IMPL_ITEXTCONTENT_USING_GENERIC_DOM_DATA(_g) \
|
||||
NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult) { \
|
||||
return mInner.GetText(aFragmentsResult); \
|
||||
} \
|
||||
NS_IMETHOD GetTextLength(PRInt32* aLengthResult) { \
|
||||
return mInner.GetTextLength(aLengthResult); \
|
||||
} \
|
||||
NS_IMETHOD CopyText(nsString& aResult) { \
|
||||
return mInner.CopyText(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetText(const PRUnichar* aBuffer, \
|
||||
PRInt32 aLength, \
|
||||
PRBool aNotify){ \
|
||||
return mInner.SetText(aBuffer, aLength, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD SetText(const char* aBuffer, \
|
||||
PRInt32 aLength, \
|
||||
PRBool aNotify){ \
|
||||
return mInner.SetText(aBuffer, aLength, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult){ \
|
||||
return mInner.IsOnlyWhitespace(aResult); \
|
||||
}
|
||||
|
||||
/**
|
||||
* This macro implements the portion of query interface that is
|
||||
* generic to all html content objects.
|
||||
*/
|
||||
#define NS_IMPL_DOM_DATA_QUERY_INTERFACE(_id, _iptr, _this) \
|
||||
if (_id.Equals(kISupportsIID)) { \
|
||||
nsIContent* tmp = _this; \
|
||||
nsISupports* tmp2 = tmp; \
|
||||
*_iptr = (void*) tmp2; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMNodeIID)) { \
|
||||
nsIDOMNode* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMCharacterDataIID)) { \
|
||||
nsIDOMCharacterData* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMEventReceiverIID)) { \
|
||||
nsIDOMEventReceiver* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMEventTargetIID)) { \
|
||||
nsIDOMEventTarget* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIScriptObjectOwnerIID)) { \
|
||||
nsIScriptObjectOwner* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIContentIID)) { \
|
||||
nsIContent* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#endif /* nsGenericDOMDataNode_h___ */
|
||||
89
mozilla/content/base/src/nsGenericDOMNodeList.cpp
Normal file
89
mozilla/content/base/src/nsGenericDOMNodeList.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
|
||||
#include "nsGenericDOMNodeList.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsGenericElement.h"
|
||||
|
||||
nsGenericDOMNodeList::nsGenericDOMNodeList()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mScriptObject = nsnull;
|
||||
}
|
||||
|
||||
nsGenericDOMNodeList::~nsGenericDOMNodeList()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMNodeList::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);
|
||||
if (aIID.Equals(kIDOMNodeListIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMNodeList*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
*aInstancePtr = (void*)(nsIScriptObjectOwner*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIDOMNodeList*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsGenericDOMNodeList)
|
||||
NS_IMPL_RELEASE(nsGenericDOMNodeList)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericDOMNodeList::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
||||
if (NS_OK != res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = factory->NewScriptNodeList(aContext, (nsISupports *)(nsIDOMNodeList *)this, nsnull, (void**)&mScriptObject);
|
||||
NS_RELEASE(factory);
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericDOMNodeList::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
60
mozilla/content/base/src/nsGenericDOMNodeList.h
Normal file
60
mozilla/content/base/src/nsGenericDOMNodeList.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsGenericDOMNodeList_h__
|
||||
#define nsGenericDOMNodeList_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
/**
|
||||
* This is a base class for a generic DOM Node List. The base class
|
||||
* provides implementations for nsISupports and nsIScriptObjectOwner,
|
||||
* but it is up to the subclass to implement the core node list
|
||||
* methods:
|
||||
* GetLength
|
||||
* Item
|
||||
*
|
||||
*/
|
||||
class nsGenericDOMNodeList : public nsIDOMNodeList,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
nsGenericDOMNodeList();
|
||||
virtual ~nsGenericDOMNodeList();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// The following need to be defined in the subclass
|
||||
// nsIDOMNodeList interface
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
||||
|
||||
protected:
|
||||
void* mScriptObject;
|
||||
};
|
||||
|
||||
#endif // nsGenericDOMNodeList_h__
|
||||
2220
mozilla/content/base/src/nsGenericElement.cpp
Normal file
2220
mozilla/content/base/src/nsGenericElement.cpp
Normal file
File diff suppressed because it is too large
Load Diff
929
mozilla/content/base/src/nsGenericElement.h
Normal file
929
mozilla/content/base/src/nsGenericElement.h
Normal file
@@ -0,0 +1,929 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsGenericElement_h___
|
||||
#define nsGenericElement_h___
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsGenericDOMNodeList.h"
|
||||
|
||||
extern const nsIID kIDOMNodeIID;
|
||||
extern const nsIID kIDOMElementIID;
|
||||
extern const nsIID kIDOMEventReceiverIID;
|
||||
extern const nsIID kIDOMEventTargetIID;
|
||||
extern const nsIID kIScriptObjectOwnerIID;
|
||||
extern const nsIID kIJSScriptObjectIID;
|
||||
extern const nsIID kISupportsIID;
|
||||
extern const nsIID kIContentIID;
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMEventListener;
|
||||
class nsIEventListenerManager;
|
||||
class nsIFrame;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMScriptObjectFactory;
|
||||
class nsDOMCSSDeclaration;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
class nsDOMAttributeMap;
|
||||
class nsIURI;
|
||||
|
||||
|
||||
// Class that holds the child list of a content element and also
|
||||
// implements the nsIDOMNodeList interface.
|
||||
class nsChildContentList : public nsGenericDOMNodeList
|
||||
{
|
||||
public:
|
||||
nsChildContentList(nsIContent *aContent);
|
||||
virtual ~nsChildContentList();
|
||||
|
||||
// nsIDOMNodeList interface
|
||||
NS_DECL_IDOMNODELIST
|
||||
|
||||
void DropReference();
|
||||
|
||||
private:
|
||||
nsIContent *mContent;
|
||||
};
|
||||
|
||||
// There are a set of DOM- and scripting-specific instance variables
|
||||
// that may only be instantiated when a content object is accessed
|
||||
// through the DOM. Rather than burn actual slots in the content
|
||||
// objects for each of these instance variables, we put them off
|
||||
// in a side structure that's only allocated when the content is
|
||||
// accessed through the DOM.
|
||||
typedef struct {
|
||||
void *mScriptObject;
|
||||
nsChildContentList *mChildNodes;
|
||||
nsDOMCSSDeclaration *mStyle;
|
||||
nsDOMAttributeMap* mAttributeMap;
|
||||
nsVoidArray *mRangeList;
|
||||
nsIContent* mCapturer;
|
||||
} nsDOMSlots;
|
||||
|
||||
class nsGenericElement : public nsIJSScriptObject {
|
||||
public:
|
||||
nsGenericElement();
|
||||
#if 1
|
||||
virtual // XXX temporary until vidur fixes this up
|
||||
#endif
|
||||
~nsGenericElement();
|
||||
|
||||
void Init(nsIContent* aOuterContentObject, nsIAtom* aTag);
|
||||
|
||||
// Implementation for nsIDOMNode
|
||||
nsresult GetNodeName(nsString& aNodeName);
|
||||
nsresult GetNodeValue(nsString& aNodeValue);
|
||||
nsresult SetNodeValue(const nsString& aNodeValue);
|
||||
nsresult GetNodeType(PRUint16* aNodeType);
|
||||
nsresult GetParentNode(nsIDOMNode** aParentNode);
|
||||
nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes);
|
||||
nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling);
|
||||
nsresult GetNextSibling(nsIDOMNode** aNextSibling);
|
||||
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
||||
|
||||
// Implementation for nsIDOMElement
|
||||
nsresult GetTagName(nsString& aTagName);
|
||||
nsresult GetAttribute(const nsString& aName, nsString& aReturn);
|
||||
nsresult SetAttribute(const nsString& aName, const nsString& aValue);
|
||||
nsresult RemoveAttribute(const nsString& aName);
|
||||
nsresult GetAttributeNode(const nsString& aName,
|
||||
nsIDOMAttr** aReturn);
|
||||
nsresult SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn);
|
||||
nsresult RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn);
|
||||
nsresult GetElementsByTagName(const nsString& aTagname,
|
||||
nsIDOMNodeList** aReturn);
|
||||
nsresult Normalize();
|
||||
|
||||
// nsIDOMEventReceiver interface
|
||||
nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
nsresult RemoveEventListenerByIID(nsIDOMEventListener* aListener,
|
||||
const nsIID& aIID);
|
||||
nsresult GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
nsresult GetNewListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
|
||||
// nsIDOMEventTarget interface
|
||||
nsresult AddEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
nsresult RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
nsresult GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
nsresult SetScriptObject(void *aScriptObject);
|
||||
|
||||
// Implementation for nsIContent
|
||||
nsresult GetDocument(nsIDocument*& aResult) const;
|
||||
nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep);
|
||||
nsresult GetParent(nsIContent*& aResult) const;
|
||||
nsresult SetParent(nsIContent* aParent);
|
||||
nsresult IsSynthetic(PRBool& aResult) {
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetNameSpaceID(PRInt32& aNameSpaceID) const;
|
||||
nsresult GetTag(nsIAtom*& aResult) const;
|
||||
nsresult HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
nsresult GetContentID(PRUint32* aID) {
|
||||
*aID = mContentID;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult SetContentID(PRUint32 aID) {
|
||||
mContentID = aID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult RangeAdd(nsIDOMRange& aRange);
|
||||
nsresult RangeRemove(nsIDOMRange& aRange);
|
||||
nsresult GetRangeList(nsVoidArray*& aResult) const;
|
||||
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult,
|
||||
size_t aInstanceSize) const;
|
||||
|
||||
// Implementation for nsIJSScriptObject
|
||||
PRBool AddProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
PRBool DeleteProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
PRBool GetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
PRBool SetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
PRBool EnumerateProperty(JSContext *aContext);
|
||||
PRBool Resolve(JSContext *aContext, jsval aID);
|
||||
PRBool Convert(JSContext *aContext, jsval aID);
|
||||
void Finalize(JSContext *aContext);
|
||||
|
||||
// Implementation for nsISupports
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
nsresult RenderFrame(nsIPresContext*);
|
||||
|
||||
nsresult AddScriptEventListener(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
REFNSIID aIID);
|
||||
|
||||
void TriggerLink(nsIPresContext* aPresContext,
|
||||
nsLinkVerb aVerb,
|
||||
nsIURI* aBaseURL,
|
||||
const nsString& aURLSpec,
|
||||
const nsString& aTargetSpec,
|
||||
PRBool aClick);
|
||||
|
||||
nsresult JoinTextNodes(nsIContent* aFirst,
|
||||
nsIContent* aSecond);
|
||||
|
||||
static void SetDocumentInChildrenOf(nsIContent* aContent,
|
||||
nsIDocument* aDocument);
|
||||
|
||||
static nsresult GetScriptObjectFactory(nsIDOMScriptObjectFactory **aFactory);
|
||||
|
||||
static nsIDOMScriptObjectFactory *gScriptObjectFactory;
|
||||
|
||||
static nsIAtom* CutNameSpacePrefix(nsString& aString);
|
||||
|
||||
nsDOMSlots *GetDOMSlots();
|
||||
|
||||
// Up pointer to the real content object that we are
|
||||
// supporting. Sometimes there is work that we just can't do
|
||||
// ourselves, so this is needed to ask the real object to do the
|
||||
// work.
|
||||
nsIContent* mContent;
|
||||
|
||||
nsIDocument* mDocument;
|
||||
nsIContent* mParent;
|
||||
nsIAtom* mTag;
|
||||
nsIEventListenerManager* mListenerManager;
|
||||
nsDOMSlots *mDOMSlots;
|
||||
PRUint32 mContentID;
|
||||
};
|
||||
|
||||
class nsGenericContainerElement : public nsGenericElement {
|
||||
public:
|
||||
nsGenericContainerElement();
|
||||
~nsGenericContainerElement();
|
||||
|
||||
nsresult CopyInnerTo(nsIContent* aSrcContent,
|
||||
nsGenericContainerElement* aDest,
|
||||
PRBool aDeep);
|
||||
|
||||
// Remainder of nsIDOMHTMLElement (and nsIDOMNode)
|
||||
nsresult GetAttribute(const nsString& aName, nsString& aReturn)
|
||||
{
|
||||
return nsGenericElement::GetAttribute(aName, aReturn);
|
||||
}
|
||||
nsresult SetAttribute(const nsString& aName, const nsString& aValue)
|
||||
{
|
||||
return nsGenericElement::SetAttribute(aName, aValue);
|
||||
}
|
||||
nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
|
||||
nsresult HasChildNodes(PRBool* aHasChildNodes);
|
||||
nsresult GetFirstChild(nsIDOMNode** aFirstChild);
|
||||
nsresult GetLastChild(nsIDOMNode** aLastChild);
|
||||
|
||||
nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
|
||||
nsIDOMNode** aReturn);
|
||||
nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
|
||||
nsIDOMNode** aReturn);
|
||||
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
|
||||
nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
|
||||
|
||||
// Remainder of nsIContent
|
||||
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsString& aValue,
|
||||
PRBool aNotify);
|
||||
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
nsString& aResult) const;
|
||||
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
PRBool aNotify);
|
||||
nsresult GetAttributeNameAt(PRInt32 aIndex,
|
||||
PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName) const;
|
||||
nsresult GetAttributeCount(PRInt32& aResult) const;
|
||||
nsresult List(FILE* out, PRInt32 aIndent) const;
|
||||
nsresult CanContainChildren(PRBool& aResult) const;
|
||||
nsresult ChildCount(PRInt32& aResult) const;
|
||||
nsresult ChildAt(PRInt32 aIndex, nsIContent*& aResult) const;
|
||||
nsresult IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const;
|
||||
nsresult InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
|
||||
nsresult ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
|
||||
nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
|
||||
nsresult RemoveChildAt(PRInt32 aIndex, PRBool aNotify);
|
||||
nsresult BeginConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult ConvertContentToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult FinishConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult,
|
||||
size_t aInstanceSize) const;
|
||||
|
||||
void ListAttributes(FILE* out) const;
|
||||
|
||||
nsVoidArray* mAttributes;
|
||||
nsVoidArray mChildren;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Mostly implement the nsIDOMNode API by forwarding the methods to a
|
||||
* generic content object (either nsGenericHTMLLeafElement or
|
||||
* nsGenericHTMLContainerContent)
|
||||
*
|
||||
* Note that classes using this macro will need to implement:
|
||||
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
*/
|
||||
#define NS_IMPL_IDOMNODE_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName) { \
|
||||
return _g.GetNodeName(aNodeName); \
|
||||
} \
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue) { \
|
||||
return _g.GetNodeValue(aNodeValue); \
|
||||
} \
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { \
|
||||
return _g.SetNodeValue(aNodeValue); \
|
||||
} \
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType) { \
|
||||
return _g.GetNodeType(aNodeType); \
|
||||
} \
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) { \
|
||||
return _g.GetParentNode(aParentNode); \
|
||||
} \
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) { \
|
||||
return _g.GetChildNodes(aChildNodes); \
|
||||
} \
|
||||
NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes) { \
|
||||
return _g.HasChildNodes(aHasChildNodes); \
|
||||
} \
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild) { \
|
||||
return _g.GetFirstChild(aFirstChild); \
|
||||
} \
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild) { \
|
||||
return _g.GetLastChild(aLastChild); \
|
||||
} \
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling) { \
|
||||
return _g.GetPreviousSibling(aPreviousSibling); \
|
||||
} \
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) { \
|
||||
return _g.GetNextSibling(aNextSibling); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { \
|
||||
return _g.GetAttributes(aAttributes); \
|
||||
} \
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, \
|
||||
nsIDOMNode** aReturn) { \
|
||||
return _g.InsertBefore(aNewChild, aRefChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { \
|
||||
return _g.AppendChild(aOldChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, \
|
||||
nsIDOMNode** aReturn) { \
|
||||
return _g.ReplaceChild(aNewChild, aOldChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { \
|
||||
return _g.RemoveChild(aOldChild, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { \
|
||||
return _g.GetOwnerDocument(aOwnerDocument); \
|
||||
} \
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
|
||||
/**
|
||||
* Implement the nsIDOMElement API by forwarding the methods to a
|
||||
* generic content object (either nsGenericHTMLLeafElement or
|
||||
* nsGenericHTMLContainerContent)
|
||||
*/
|
||||
#define NS_IMPL_IDOMELEMENT_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetTagName(nsString& aTagName) { \
|
||||
return _g.GetTagName(aTagName); \
|
||||
} \
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { \
|
||||
return _g.GetAttribute(aName, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { \
|
||||
return _g.SetAttribute(aName, aValue); \
|
||||
} \
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName) { \
|
||||
return _g.RemoveAttribute(aName); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName, \
|
||||
nsIDOMAttr** aReturn) { \
|
||||
return _g.GetAttributeNode(aName, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { \
|
||||
return _g.SetAttributeNode(aNewAttr, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) {\
|
||||
return _g.RemoveAttributeNode(aOldAttr, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, \
|
||||
nsIDOMNodeList** aReturn) { \
|
||||
return _g.GetElementsByTagName(aTagname, aReturn); \
|
||||
} \
|
||||
NS_IMETHOD Normalize() { \
|
||||
return _g.Normalize(); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement the nsIDOMEventReceiver API by forwarding the methods to a
|
||||
* generic content object (either nsGenericHTMLLeafElement or
|
||||
* nsGenericHTMLContainerContent)
|
||||
*/
|
||||
#define NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(_g) \
|
||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, \
|
||||
const nsIID& aIID) { \
|
||||
return _g.AddEventListenerByIID(aListener, aIID); \
|
||||
} \
|
||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, \
|
||||
const nsIID& aIID) { \
|
||||
return _g.RemoveEventListenerByIID(aListener, aIID); \
|
||||
} \
|
||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aResult) { \
|
||||
return _g.GetListenerManager(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager** aResult) { \
|
||||
return _g.GetNewListenerManager(aResult); \
|
||||
} \
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, \
|
||||
nsIDOMEventListener* aListener, \
|
||||
PRBool aUseCapture) { \
|
||||
return _g.AddEventListener(aType, aListener, aUseCapture); \
|
||||
} \
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, \
|
||||
nsIDOMEventListener* aListener, \
|
||||
PRBool aUseCapture) { \
|
||||
return _g.RemoveEventListener(aType, aListener, aUseCapture); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_ICONTENT_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const { \
|
||||
return _g.GetDocument(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep) { \
|
||||
return _g.SetDocument(aDocument, aDeep); \
|
||||
} \
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const { \
|
||||
return _g.GetParent(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetParent(nsIContent* aParent) { \
|
||||
return _g.SetParent(aParent); \
|
||||
} \
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const { \
|
||||
return _g.CanContainChildren(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const { \
|
||||
return _g.ChildCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { \
|
||||
return _g.ChildAt(aIndex, aResult); \
|
||||
} \
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { \
|
||||
return _g.IndexOf(aPossibleChild, aResult); \
|
||||
} \
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.InsertChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.ReplaceChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) { \
|
||||
return _g.AppendChildTo(aKid, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) { \
|
||||
return _g.RemoveChildAt(aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) { \
|
||||
return _g.IsSynthetic(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aResult) const { \
|
||||
return _g.GetNameSpaceID(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const { \
|
||||
return _g.GetTag(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
|
||||
nsIAtom*& aName, \
|
||||
PRInt32& aNameSpaceID) { \
|
||||
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, \
|
||||
nsIAtom*& aPrefix) { \
|
||||
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
|
||||
} \
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
const nsString& aValue, PRBool aNotify) { \
|
||||
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
nsString& aResult) const { \
|
||||
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
|
||||
} \
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
|
||||
PRBool aNotify) { \
|
||||
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
|
||||
PRInt32& aNameSpaceID, \
|
||||
nsIAtom*& aName) const { \
|
||||
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
|
||||
return _g.GetAttributeCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { \
|
||||
return _g.List(out, aIndent); \
|
||||
} \
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.BeginConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.ConvertContentToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.FinishConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, \
|
||||
nsEvent* aEvent, \
|
||||
nsIDOMEvent** aDOMEvent, \
|
||||
PRUint32 aFlags, \
|
||||
nsEventStatus* aEventStatus); \
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) { \
|
||||
return _g.GetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) { \
|
||||
return _g.SetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange) { \
|
||||
return _g.RangeAdd(aRange); \
|
||||
} \
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange) { \
|
||||
return _g.RangeRemove(aRange); \
|
||||
} \
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const { \
|
||||
return _g.GetRangeList(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
|
||||
#define NS_IMPL_ICONTENT_NO_SETPARENT_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const { \
|
||||
return _g.GetDocument(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep) { \
|
||||
return _g.SetDocument(aDocument, aDeep); \
|
||||
} \
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const { \
|
||||
return _g.GetParent(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetParent(nsIContent* aParent); \
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const { \
|
||||
return _g.CanContainChildren(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const { \
|
||||
return _g.ChildCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { \
|
||||
return _g.ChildAt(aIndex, aResult); \
|
||||
} \
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { \
|
||||
return _g.IndexOf(aPossibleChild, aResult); \
|
||||
} \
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.InsertChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.ReplaceChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) { \
|
||||
return _g.AppendChildTo(aKid, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) { \
|
||||
return _g.RemoveChildAt(aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) { \
|
||||
return _g.IsSynthetic(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aResult) const { \
|
||||
return _g.GetNameSpaceID(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const { \
|
||||
return _g.GetTag(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
|
||||
nsIAtom*& aName, \
|
||||
PRInt32& aNameSpaceID) { \
|
||||
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, \
|
||||
nsIAtom*& aPrefix) { \
|
||||
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
|
||||
} \
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
const nsString& aValue, PRBool aNotify) { \
|
||||
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
nsString& aResult) const { \
|
||||
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
|
||||
} \
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
|
||||
PRBool aNotify) { \
|
||||
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
|
||||
PRInt32& aNameSpaceID, \
|
||||
nsIAtom*& aName) const { \
|
||||
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
|
||||
return _g.GetAttributeCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { \
|
||||
return _g.List(out, aIndent); \
|
||||
} \
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.BeginConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.ConvertContentToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.FinishConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, \
|
||||
nsEvent* aEvent, \
|
||||
nsIDOMEvent** aDOMEvent, \
|
||||
PRUint32 aFlags, \
|
||||
nsEventStatus* aEventStatus); \
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) { \
|
||||
return _g.GetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) { \
|
||||
return _g.SetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange) { \
|
||||
return _g.RangeAdd(aRange); \
|
||||
} \
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange) { \
|
||||
return _g.RangeRemove(aRange); \
|
||||
} \
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const { \
|
||||
return _g.GetRangeList(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
|
||||
#define NS_IMPL_ICONTENT_NO_SETDOCUMENT_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const { \
|
||||
return _g.GetDocument(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep); \
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const { \
|
||||
return _g.GetParent(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetParent(nsIContent* aParent) { \
|
||||
return _g.SetParent(aParent); \
|
||||
} \
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const { \
|
||||
return _g.CanContainChildren(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const { \
|
||||
return _g.ChildCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { \
|
||||
return _g.ChildAt(aIndex, aResult); \
|
||||
} \
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { \
|
||||
return _g.IndexOf(aPossibleChild, aResult); \
|
||||
} \
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.InsertChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.ReplaceChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) { \
|
||||
return _g.AppendChildTo(aKid, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) { \
|
||||
return _g.RemoveChildAt(aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) { \
|
||||
return _g.IsSynthetic(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aResult) const { \
|
||||
return _g.GetNameSpaceID(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const { \
|
||||
return _g.GetTag(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
|
||||
nsIAtom*& aName, \
|
||||
PRInt32& aNameSpaceID) { \
|
||||
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, \
|
||||
nsIAtom*& aPrefix) { \
|
||||
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
|
||||
} \
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
const nsString& aValue, PRBool aNotify) { \
|
||||
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
nsString& aResult) const { \
|
||||
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
|
||||
} \
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
|
||||
PRBool aNotify) { \
|
||||
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
|
||||
PRInt32& aNameSpaceID, \
|
||||
nsIAtom*& aName) const { \
|
||||
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
|
||||
return _g.GetAttributeCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { \
|
||||
return _g.List(out, aIndent); \
|
||||
} \
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.BeginConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.ConvertContentToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.FinishConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, \
|
||||
nsEvent* aEvent, \
|
||||
nsIDOMEvent** aDOMEvent, \
|
||||
PRUint32 aFlags, \
|
||||
nsEventStatus* aEventStatus); \
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) { \
|
||||
return _g.GetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) { \
|
||||
return _g.SetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange) { \
|
||||
return _g.RangeAdd(aRange); \
|
||||
} \
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange) { \
|
||||
return _g.RangeRemove(aRange); \
|
||||
} \
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const { \
|
||||
return _g.GetRangeList(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
|
||||
#define NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const { \
|
||||
return _g.GetDocument(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep); \
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const { \
|
||||
return _g.GetParent(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SetParent(nsIContent* aParent); \
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const { \
|
||||
return _g.CanContainChildren(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const { \
|
||||
return _g.ChildCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { \
|
||||
return _g.ChildAt(aIndex, aResult); \
|
||||
} \
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { \
|
||||
return _g.IndexOf(aPossibleChild, aResult); \
|
||||
} \
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.InsertChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, \
|
||||
PRBool aNotify) { \
|
||||
return _g.ReplaceChildAt(aKid, aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) { \
|
||||
return _g.AppendChildTo(aKid, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) { \
|
||||
return _g.RemoveChildAt(aIndex, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) { \
|
||||
return _g.IsSynthetic(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aResult) const { \
|
||||
return _g.GetNameSpaceID(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const { \
|
||||
return _g.GetTag(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr, \
|
||||
nsIAtom*& aName, \
|
||||
PRInt32& aNameSpaceID) { \
|
||||
return _g.ParseAttributeString(aStr, aName, aNameSpaceID); \
|
||||
} \
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, \
|
||||
nsIAtom*& aPrefix) { \
|
||||
return _g.GetNameSpacePrefixFromId(aNameSpaceID, aPrefix); \
|
||||
} \
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
const nsString& aValue, PRBool aNotify) { \
|
||||
return _g.SetAttribute(aNameSpaceID, aName, aValue, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, \
|
||||
nsString& aResult) const { \
|
||||
return _g.GetAttribute(aNameSpaceID, aName, aResult); \
|
||||
} \
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, \
|
||||
PRBool aNotify) { \
|
||||
return _g.UnsetAttribute(aNameSpaceID, aAttribute, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, \
|
||||
PRInt32& aNameSpaceID, \
|
||||
nsIAtom*& aName) const { \
|
||||
return _g.GetAttributeNameAt(aIndex, aNameSpaceID, aName); \
|
||||
} \
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { \
|
||||
return _g.GetAttributeCount(aResult); \
|
||||
} \
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { \
|
||||
return _g.List(out, aIndent); \
|
||||
} \
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.BeginConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.ConvertContentToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const { \
|
||||
return _g.FinishConvertToXIF(aConverter); \
|
||||
} \
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, \
|
||||
nsEvent* aEvent, \
|
||||
nsIDOMEvent** aDOMEvent, \
|
||||
PRUint32 aFlags, \
|
||||
nsEventStatus* aEventStatus); \
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) { \
|
||||
return _g.GetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) { \
|
||||
return _g.SetContentID(aID); \
|
||||
} \
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange) { \
|
||||
return _g.RangeAdd(aRange); \
|
||||
} \
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange) { \
|
||||
return _g.RangeRemove(aRange); \
|
||||
} \
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const { \
|
||||
return _g.GetRangeList(aResult); \
|
||||
} \
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
|
||||
/**
|
||||
* Implement the nsIScriptObjectOwner API by forwarding the methods to a
|
||||
* generic content object
|
||||
*/
|
||||
#define NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, \
|
||||
void** aScriptObject) { \
|
||||
return _g.GetScriptObject(aContext, aScriptObject); \
|
||||
} \
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject) { \
|
||||
return _g.SetScriptObject(aScriptObject); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_CONTENT_QUERY_INTERFACE(_id, _iptr, _this, _base) \
|
||||
if (_id.Equals(kISupportsIID)) { \
|
||||
_base* tmp = _this; \
|
||||
nsISupports* tmp2 = tmp; \
|
||||
*_iptr = (void*) tmp2; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMNodeIID)) { \
|
||||
nsIDOMNode* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMElementIID)) { \
|
||||
nsIDOMElement* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMEventReceiverIID)) { \
|
||||
nsIDOMEventReceiver* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIDOMEventTargetIID)) { \
|
||||
nsIDOMEventTarget* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIScriptObjectOwnerIID)) { \
|
||||
nsIScriptObjectOwner* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIContentIID)) { \
|
||||
_base* tmp = _this; \
|
||||
nsIContent* tmp2 = tmp; \
|
||||
*_iptr = (void*) tmp2; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIJSScriptObjectIID)) { \
|
||||
nsIJSScriptObject* tmp = (nsIJSScriptObject*)&mInner; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#endif /* nsGenericElement_h___ */
|
||||
478
mozilla/content/base/src/nsNameSpaceManager.cpp
Normal file
478
mozilla/content/base/src/nsNameSpaceManager.cpp
Normal file
@@ -0,0 +1,478 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
static NS_DEFINE_IID(kINameSpaceManagerIID, NS_INAMESPACEMANAGER_IID);
|
||||
static NS_DEFINE_IID(kINameSpaceIID, NS_INAMESPACE_IID);
|
||||
|
||||
|
||||
static const char kXMLNSNameSpaceURI[] = "<This isn't really a namespace>";
|
||||
static const char kXMLNameSpaceURI[] = "http://www.w3.org/XML/1998/namespace";
|
||||
static const char kHTMLNameSpaceURI[] = "http://www.w3.org/TR/REC-html40"; // XXX?? "urn:w3-org-ns:HTML"??
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Name Space ID table support
|
||||
|
||||
static PRInt32 gNameSpaceTableRefs;
|
||||
static nsHashtable* gURIToIDTable;
|
||||
static nsVoidArray* gURIArray;
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(NameSpaceURIKey);
|
||||
|
||||
class NameSpaceURIKey : public nsHashKey {
|
||||
public:
|
||||
NameSpaceURIKey(const nsString* aString)
|
||||
: mString(aString)
|
||||
{
|
||||
MOZ_COUNT_CTOR(NameSpaceURIKey);
|
||||
}
|
||||
|
||||
virtual ~NameSpaceURIKey(void)
|
||||
{
|
||||
MOZ_COUNT_DTOR(NameSpaceURIKey);
|
||||
}
|
||||
|
||||
virtual PRUint32 HashValue(void) const
|
||||
{
|
||||
#if 1 // case insensitive XXX should this be case sensitive???
|
||||
PRUint32 hash = 0;
|
||||
const PRUnichar* string = mString->GetUnicode();
|
||||
PRUnichar ch;
|
||||
while ((ch = *string++) != 0) {
|
||||
// FYI: hash = hash*37 + ch
|
||||
ch = nsCRT::ToLower(ch);
|
||||
hash = ((hash << 5) + (hash << 2) + hash) + ch;
|
||||
}
|
||||
return hash;
|
||||
#else
|
||||
if (nsnull != mString) {
|
||||
return nsCRT::HashValue(mString->GetUnicode());
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual PRBool Equals(const nsHashKey *aKey) const
|
||||
{
|
||||
const nsString* other = ((const NameSpaceURIKey*)aKey)->mString;
|
||||
if (nsnull != mString) {
|
||||
if (nsnull != other) {
|
||||
return mString->EqualsIgnoreCase(*other); // XXX case sensitive?
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PRBool(nsnull == other);
|
||||
}
|
||||
|
||||
virtual nsHashKey *Clone(void) const
|
||||
{
|
||||
return new NameSpaceURIKey(mString);
|
||||
}
|
||||
|
||||
const nsString* mString;
|
||||
};
|
||||
|
||||
static void AddRefTable()
|
||||
{
|
||||
if (0 == gNameSpaceTableRefs++) {
|
||||
NS_ASSERTION(nsnull == gURIToIDTable, "already have URI table");
|
||||
NS_ASSERTION(nsnull == gURIArray, "already have URI array");
|
||||
|
||||
gURIToIDTable = new nsHashtable();
|
||||
gURIArray = new nsVoidArray();
|
||||
|
||||
nsString* xmlns = new nsString(kXMLNSNameSpaceURI);
|
||||
nsString* xml = new nsString(kXMLNameSpaceURI);
|
||||
nsString* html = new nsString(kHTMLNameSpaceURI);
|
||||
gURIArray->AppendElement(xmlns); // ordering here needs to match IDs
|
||||
gURIArray->AppendElement(xml);
|
||||
gURIArray->AppendElement(html);
|
||||
NameSpaceURIKey xmlnsKey(xmlns);
|
||||
NameSpaceURIKey xmlKey(xml);
|
||||
NameSpaceURIKey htmlKey(html);
|
||||
gURIToIDTable->Put(&xmlnsKey, (void*)kNameSpaceID_XMLNS);
|
||||
gURIToIDTable->Put(&xmlKey, (void*)kNameSpaceID_XML);
|
||||
gURIToIDTable->Put(&htmlKey, (void*)kNameSpaceID_HTML);
|
||||
}
|
||||
NS_ASSERTION(nsnull != gURIToIDTable, "no URI table");
|
||||
NS_ASSERTION(nsnull != gURIArray, "no URI array");
|
||||
}
|
||||
|
||||
static void ReleaseTable()
|
||||
{
|
||||
if (0 == --gNameSpaceTableRefs) {
|
||||
delete gURIToIDTable;
|
||||
PRInt32 index = gURIArray->Count();
|
||||
while (0 < index--) {
|
||||
nsString* str = (nsString*)gURIArray->ElementAt(index);
|
||||
delete str;
|
||||
}
|
||||
delete gURIArray;
|
||||
gURIToIDTable = nsnull;
|
||||
gURIArray = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
static PRInt32 FindNameSpaceID(const nsString& aURI)
|
||||
{
|
||||
NS_ASSERTION(nsnull != gURIToIDTable, "no URI table");
|
||||
NameSpaceURIKey key(&aURI);
|
||||
void* value = gURIToIDTable->Get(&key);
|
||||
if (nsnull != value) {
|
||||
return PRInt32(value);
|
||||
}
|
||||
return kNameSpaceID_Unknown;
|
||||
}
|
||||
|
||||
static const nsString* FindNameSpaceURI(PRInt32 aID)
|
||||
{
|
||||
NS_ASSERTION(nsnull != gURIArray, "no URI array");
|
||||
return (const nsString*)gURIArray->ElementAt(aID - 1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Name Space
|
||||
|
||||
class NameSpaceImpl : public nsINameSpace {
|
||||
public:
|
||||
NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
const nsString& aURI);
|
||||
NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
PRInt32 aNameSpaceID);
|
||||
virtual ~NameSpaceImpl();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager) const;
|
||||
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const;
|
||||
NS_IMETHOD GetNameSpaceURI(nsString& aURI) const;
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aPrefix) const;
|
||||
|
||||
NS_IMETHOD GetParentNameSpace(nsINameSpace*& aParent) const;
|
||||
|
||||
NS_IMETHOD FindNameSpace(nsIAtom* aPrefix, nsINameSpace*& aNameSpace) const;
|
||||
NS_IMETHOD FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const;
|
||||
NS_IMETHOD FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const;
|
||||
|
||||
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI,
|
||||
nsINameSpace*& aChildNameSpace);
|
||||
NS_IMETHOD CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID,
|
||||
nsINameSpace*& aChildNameSpace);
|
||||
|
||||
private:
|
||||
// These are not supported and are not implemented!
|
||||
NameSpaceImpl(const NameSpaceImpl& aCopy);
|
||||
NameSpaceImpl& operator=(const NameSpaceImpl& aCopy);
|
||||
|
||||
public:
|
||||
nsINameSpaceManager* mManager;
|
||||
NameSpaceImpl* mParent;
|
||||
nsIAtom* mPrefix;
|
||||
PRInt32 mID;
|
||||
};
|
||||
|
||||
NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
const nsString& aURI)
|
||||
: mManager(aManager),
|
||||
mParent(aParent),
|
||||
mPrefix(aPrefix)
|
||||
{
|
||||
NS_ASSERTION(nsnull != aManager, "null namespace manager");
|
||||
NS_INIT_REFCNT();
|
||||
NS_ADDREF(mManager);
|
||||
NS_IF_ADDREF(mParent);
|
||||
NS_IF_ADDREF(mPrefix);
|
||||
mManager->RegisterNameSpace(aURI, mID);
|
||||
}
|
||||
|
||||
NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager,
|
||||
NameSpaceImpl* aParent,
|
||||
nsIAtom* aPrefix,
|
||||
PRInt32 aNameSpaceID)
|
||||
: mManager(aManager),
|
||||
mParent(aParent),
|
||||
mPrefix(aPrefix),
|
||||
mID(aNameSpaceID)
|
||||
{
|
||||
NS_ASSERTION(nsnull != aManager, "null namespace manager");
|
||||
NS_INIT_REFCNT();
|
||||
NS_ADDREF(mManager);
|
||||
NS_IF_ADDREF(mParent);
|
||||
NS_IF_ADDREF(mPrefix);
|
||||
}
|
||||
|
||||
NameSpaceImpl::~NameSpaceImpl()
|
||||
{
|
||||
NS_RELEASE(mManager);
|
||||
NS_IF_RELEASE(mParent);
|
||||
NS_IF_RELEASE(mPrefix);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(NameSpaceImpl, kINameSpaceIID)
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetNameSpaceManager(nsINameSpaceManager*& aManager) const
|
||||
{
|
||||
NS_ASSERTION(nsnull != aManager, "null namespace manager");
|
||||
aManager = mManager;
|
||||
NS_ADDREF(aManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetNameSpaceID(PRInt32& aID) const
|
||||
{
|
||||
aID = mID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetNameSpaceURI(nsString& aURI) const
|
||||
{
|
||||
NS_ASSERTION(nsnull != mManager, "null namespace manager");
|
||||
return mManager->GetNameSpaceURI(mID, aURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetNameSpacePrefix(nsIAtom*& aPrefix) const
|
||||
{
|
||||
aPrefix = mPrefix;
|
||||
NS_IF_ADDREF(aPrefix);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::GetParentNameSpace(nsINameSpace*& aParent) const
|
||||
{
|
||||
aParent = mParent;
|
||||
NS_IF_ADDREF(aParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::FindNameSpace(nsIAtom* aPrefix, nsINameSpace*& aNameSpace) const
|
||||
{
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
do {
|
||||
if (aPrefix == nameSpace->mPrefix) {
|
||||
aNameSpace = (nsINameSpace*)nameSpace;
|
||||
NS_ADDREF(aNameSpace);
|
||||
return NS_OK;
|
||||
}
|
||||
nameSpace = nameSpace->mParent;
|
||||
}
|
||||
while (nsnull != nameSpace);
|
||||
aNameSpace = nsnull;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::FindNameSpaceID(nsIAtom* aPrefix, PRInt32& aNameSpaceID) const
|
||||
{
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
do {
|
||||
if (aPrefix == nameSpace->mPrefix) {
|
||||
aNameSpaceID = nameSpace->mID;
|
||||
return NS_OK;
|
||||
}
|
||||
nameSpace = nameSpace->mParent;
|
||||
}
|
||||
while (nsnull != nameSpace);
|
||||
if (nsnull == aPrefix) {
|
||||
aNameSpaceID = kNameSpaceID_None;
|
||||
}
|
||||
else {
|
||||
aNameSpaceID = kNameSpaceID_Unknown;
|
||||
}
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::FindNameSpacePrefix(PRInt32 aNameSpaceID, nsIAtom*& aPrefix) const
|
||||
{
|
||||
const NameSpaceImpl* nameSpace = this;
|
||||
do {
|
||||
if (aNameSpaceID == nameSpace->mID) {
|
||||
aPrefix = nameSpace->mPrefix;
|
||||
NS_IF_ADDREF(aPrefix);
|
||||
return NS_OK;
|
||||
}
|
||||
nameSpace = nameSpace->mParent;
|
||||
}
|
||||
while (nsnull != nameSpace);
|
||||
aPrefix = nsnull;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, const nsString& aURI,
|
||||
nsINameSpace*& aChildNameSpace)
|
||||
{
|
||||
NameSpaceImpl* child = new NameSpaceImpl(mManager, this, aPrefix, aURI);
|
||||
|
||||
if (child) {
|
||||
return child->QueryInterface(kINameSpaceIID, (void**)&aChildNameSpace);
|
||||
}
|
||||
aChildNameSpace = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceImpl::CreateChildNameSpace(nsIAtom* aPrefix, PRInt32 aNameSpaceID,
|
||||
nsINameSpace*& aChildNameSpace)
|
||||
{
|
||||
if (FindNameSpaceURI(aNameSpaceID)) {
|
||||
NameSpaceImpl* child = new NameSpaceImpl(mManager, this, aPrefix, aNameSpaceID);
|
||||
|
||||
if (child) {
|
||||
return child->QueryInterface(kINameSpaceIID, (void**)&aChildNameSpace);
|
||||
}
|
||||
aChildNameSpace = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
aChildNameSpace = nsnull;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Name Space Manager
|
||||
|
||||
class NameSpaceManagerImpl : public nsINameSpaceManager {
|
||||
public:
|
||||
NameSpaceManagerImpl();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CreateRootNameSpace(nsINameSpace*& aRootNameSpace);
|
||||
|
||||
NS_IMETHOD RegisterNameSpace(const nsString& aURI,
|
||||
PRInt32& aNameSpaceID);
|
||||
|
||||
NS_IMETHOD GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI);
|
||||
NS_IMETHOD GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID);
|
||||
|
||||
private:
|
||||
// These are not supported and are not implemented!
|
||||
NameSpaceManagerImpl(const NameSpaceManagerImpl& aCopy);
|
||||
NameSpaceManagerImpl& operator=(const NameSpaceManagerImpl& aCopy);
|
||||
|
||||
protected:
|
||||
virtual ~NameSpaceManagerImpl();
|
||||
|
||||
};
|
||||
|
||||
NameSpaceManagerImpl::NameSpaceManagerImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
AddRefTable();
|
||||
}
|
||||
|
||||
NameSpaceManagerImpl::~NameSpaceManagerImpl()
|
||||
{
|
||||
ReleaseTable();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(NameSpaceManagerImpl, kINameSpaceManagerIID)
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::CreateRootNameSpace(nsINameSpace*& aRootNameSpace)
|
||||
{
|
||||
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
aRootNameSpace = nsnull;
|
||||
|
||||
NameSpaceImpl* xmlns = new NameSpaceImpl(this, nsnull, nsLayoutAtoms::xmlnsNameSpace, kNameSpaceID_XMLNS);
|
||||
if (nsnull != xmlns) {
|
||||
NameSpaceImpl* xml = new NameSpaceImpl(this, xmlns, nsLayoutAtoms::xmlNameSpace, kNameSpaceID_XML);
|
||||
if (nsnull != xml) {
|
||||
rv = xml->QueryInterface(kINameSpaceIID, (void**)&aRootNameSpace);
|
||||
}
|
||||
else {
|
||||
delete xmlns;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::RegisterNameSpace(const nsString& aURI,
|
||||
PRInt32& aNameSpaceID)
|
||||
{
|
||||
PRInt32 id = FindNameSpaceID(aURI);
|
||||
|
||||
if (kNameSpaceID_Unknown == id) {
|
||||
nsString* uri = new nsString(aURI);
|
||||
gURIArray->AppendElement(uri);
|
||||
id = gURIArray->Count(); // id is index + 1
|
||||
NameSpaceURIKey key(uri);
|
||||
gURIToIDTable->Put(&key, (void*)id);
|
||||
}
|
||||
aNameSpaceID = id;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::GetNameSpaceURI(PRInt32 aNameSpaceID, nsString& aURI)
|
||||
{
|
||||
const nsString* result = FindNameSpaceURI(aNameSpaceID);
|
||||
if (nsnull != result) {
|
||||
aURI = *result;
|
||||
return NS_OK;
|
||||
}
|
||||
aURI.Truncate();
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NameSpaceManagerImpl::GetNameSpaceID(const nsString& aURI, PRInt32& aNameSpaceID)
|
||||
{
|
||||
aNameSpaceID = FindNameSpaceID(aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_LAYOUT nsresult
|
||||
NS_NewNameSpaceManager(nsINameSpaceManager** aInstancePtrResult)
|
||||
{
|
||||
if (aInstancePtrResult == nsnull) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
NameSpaceManagerImpl *it = new NameSpaceManagerImpl();
|
||||
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(kINameSpaceManagerIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
2000
mozilla/content/base/src/nsRange.cpp
Normal file
2000
mozilla/content/base/src/nsRange.cpp
Normal file
File diff suppressed because it is too large
Load Diff
217
mozilla/content/base/src/nsRange.h
Normal file
217
mozilla/content/base/src/nsRange.h
Normal file
@@ -0,0 +1,217 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsRange_h___
|
||||
#define nsRange_h___
|
||||
|
||||
/*
|
||||
* nsRange.h: interface of the nsRange object.
|
||||
*/
|
||||
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMNSRange.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "prmon.h"
|
||||
|
||||
class nsVoidArray;
|
||||
|
||||
class nsRange : public nsIDOMRange,
|
||||
public nsIDOMNSRange,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsRange();
|
||||
virtual ~nsRange();
|
||||
|
||||
// nsIDOMRange interface
|
||||
|
||||
NS_IMETHOD GetIsPositioned(PRBool* aIsPositioned);
|
||||
|
||||
NS_IMETHOD GetStartParent(nsIDOMNode** aStartParent);
|
||||
NS_IMETHOD GetStartOffset(PRInt32* aStartOffset);
|
||||
|
||||
NS_IMETHOD GetEndParent(nsIDOMNode** aEndParent);
|
||||
NS_IMETHOD GetEndOffset(PRInt32* aEndOffset);
|
||||
|
||||
NS_IMETHOD GetIsCollapsed(PRBool* aIsCollapsed);
|
||||
|
||||
NS_IMETHOD GetCommonParent(nsIDOMNode** aCommonParent);
|
||||
|
||||
NS_IMETHOD SetStart(nsIDOMNode* aParent, PRInt32 aOffset);
|
||||
NS_IMETHOD SetStartBefore(nsIDOMNode* aSibling);
|
||||
NS_IMETHOD SetStartAfter(nsIDOMNode* aSibling);
|
||||
|
||||
NS_IMETHOD SetEnd(nsIDOMNode* aParent, PRInt32 aOffset);
|
||||
NS_IMETHOD SetEndBefore(nsIDOMNode* aSibling);
|
||||
NS_IMETHOD SetEndAfter(nsIDOMNode* aSibling);
|
||||
|
||||
NS_IMETHOD Collapse(PRBool aToStart);
|
||||
|
||||
NS_IMETHOD Unposition();
|
||||
|
||||
NS_IMETHOD SelectNode(nsIDOMNode* aN);
|
||||
NS_IMETHOD SelectNodeContents(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD CompareEndPoints(PRUint16 how, nsIDOMRange* srcRange, PRInt32* ret);
|
||||
|
||||
NS_IMETHOD DeleteContents();
|
||||
|
||||
NS_IMETHOD ExtractContents(nsIDOMDocumentFragment** aReturn);
|
||||
NS_IMETHOD CloneContents(nsIDOMDocumentFragment** aReturn);
|
||||
|
||||
NS_IMETHOD InsertNode(nsIDOMNode* aN);
|
||||
NS_IMETHOD SurroundContents(nsIDOMNode* aN);
|
||||
|
||||
NS_IMETHOD Clone(nsIDOMRange** aReturn);
|
||||
|
||||
NS_IMETHOD ToString(nsString& aReturn);
|
||||
|
||||
// nsIDOMNSRange interface
|
||||
NS_IMETHOD CreateContextualFragment(const nsString& aFragment,
|
||||
nsIDOMDocumentFragment** aReturn);
|
||||
NS_IMETHOD IsValidFragment(const nsString& aFragment, PRBool* aReturn);
|
||||
|
||||
/*BEGIN nsIScriptObjectOwner interface implementations*/
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
/*END nsIScriptObjectOwner interface implementations*/
|
||||
|
||||
// nsRange interface extensions
|
||||
|
||||
static NS_METHOD OwnerGone(nsIContent* aParentNode);
|
||||
|
||||
static NS_METHOD OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset);
|
||||
|
||||
static NS_METHOD OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, nsIContent* aRemovedNode);
|
||||
|
||||
static NS_METHOD OwnerChildReplaced(nsIContent* aParentNode, PRInt32 aOffset, nsIContent* aReplacedNode);
|
||||
|
||||
static NS_METHOD TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartOffset, PRInt32 aEndOffset, PRInt32 aReplaceLength);
|
||||
|
||||
//private: I wish VC++ would give me a &&*@!#$ break
|
||||
PRBool mIsPositioned;
|
||||
PRInt32 mStartOffset;
|
||||
PRInt32 mEndOffset;
|
||||
nsCOMPtr<nsIDOMNode> mStartParent;
|
||||
nsCOMPtr<nsIDOMNode> mEndParent;
|
||||
static PRMonitor *mMonitor; // monitor to protect the following statics
|
||||
static nsVoidArray *mStartAncestors; // just keeping these static to avoid reallocing the arrays.
|
||||
static nsVoidArray *mEndAncestors; // the contents of these arrays are discarded across calls.
|
||||
static nsVoidArray *mStartAncestorOffsets; // this also makes nsRange objects lighter weight.
|
||||
static nsVoidArray *mEndAncestorOffsets; //
|
||||
|
||||
// no copy's or assigns
|
||||
nsRange(const nsRange&);
|
||||
nsRange& operator=(const nsRange&);
|
||||
|
||||
// helper routines
|
||||
|
||||
static PRBool InSameDoc(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
|
||||
static PRInt32 IndexOf(nsIDOMNode* aNode);
|
||||
static PRInt32 FillArrayWithAncestors(nsVoidArray* aArray,nsIDOMNode* aNode);
|
||||
static nsCOMPtr<nsIDOMNode> CommonParent(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
|
||||
static nsresult GetDOMNodeFromContent(nsIContent* inContentNode, nsCOMPtr<nsIDOMNode>* outDomNode);
|
||||
static nsresult GetContentFromDOMNode(nsIDOMNode* inDomNode, nsCOMPtr<nsIContent>* outContentNode);
|
||||
static nsresult PopRanges(nsIDOMNode* aDestNode, PRInt32 aOffset, nsIContent* aSourceNode);
|
||||
static nsresult Lock();
|
||||
static nsresult Unlock();
|
||||
|
||||
static nsresult CloneSibsAndParents(nsIDOMNode* parentNode,
|
||||
PRInt32 nodeOffset,
|
||||
nsIDOMNode* clonedNode,
|
||||
nsIDOMNode* commonParent,
|
||||
nsIDOMDocumentFragment* docfrag,
|
||||
PRBool leftP);
|
||||
|
||||
nsresult DoSetRange(nsIDOMNode* aStartN, PRInt32 aStartOffset,
|
||||
nsIDOMNode* aEndN, PRInt32 aEndOffset);
|
||||
|
||||
PRBool IsIncreasing(nsIDOMNode* aStartN, PRInt32 aStartOff,
|
||||
nsIDOMNode* aEndN, PRInt32 aEndOff);
|
||||
|
||||
nsresult IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aResult);
|
||||
|
||||
nsresult ComparePointToRange(nsIDOMNode* aParent, PRInt32 aOffset, PRInt32* aResult);
|
||||
|
||||
|
||||
PRInt32 GetAncestorsAndOffsets(nsIDOMNode* aNode, PRInt32 aOffset,
|
||||
nsVoidArray* aAncestorNodes, nsVoidArray* aAncestorOffsets);
|
||||
|
||||
nsresult AddToListOf(nsIDOMNode* aNode);
|
||||
|
||||
nsresult RemoveFromListOf(nsIDOMNode* aNode);
|
||||
|
||||
nsresult ContentOwnsUs(nsIDOMNode* domNode);
|
||||
|
||||
protected:
|
||||
void* mScriptObject;
|
||||
|
||||
};
|
||||
|
||||
// Make a new nsIDOMRange object
|
||||
nsresult NS_NewRange(nsIDOMRange** aInstancePtrResult);
|
||||
|
||||
|
||||
/*************************************************************************************
|
||||
* Utility routine to compare two "points", were a point is a node/offset pair
|
||||
* Returns -1 if point1 < point2, 1, if point1 > point2,
|
||||
* 0 if error or if point1 == point2.
|
||||
************************************************************************************/
|
||||
PRInt32 ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
||||
nsIDOMNode* aParent2, PRInt32 aOffset2);
|
||||
|
||||
|
||||
/*************************************************************************************
|
||||
* Utility routine to detect if a content node intersects a range
|
||||
************************************************************************************/
|
||||
PRBool IsNodeIntersectsRange(nsIContent* aNode, nsIDOMRange* aRange);
|
||||
|
||||
|
||||
/*************************************************************************************
|
||||
* Utility routine to detect if a content node starts before a range and/or
|
||||
* ends after a range. If neither it is contained inside the range.
|
||||
*
|
||||
* XXX - callers responsibility to ensure node in same doc as range!
|
||||
*
|
||||
************************************************************************************/
|
||||
nsresult CompareNodeToRange(nsIContent* aNode,
|
||||
nsIDOMRange* aRange,
|
||||
PRBool *outNodeBefore,
|
||||
PRBool *outNodeAfter);
|
||||
|
||||
|
||||
/*************************************************************************************
|
||||
* Utility routine to create a pair of dom points to represent
|
||||
* the start and end locations of a single node. Return false
|
||||
* if we dont' succeed.
|
||||
************************************************************************************/
|
||||
PRBool GetNodeBracketPoints(nsIContent* aNode,
|
||||
nsCOMPtr<nsIDOMNode>* outParent,
|
||||
PRInt32* outStartOffset,
|
||||
PRInt32* outEndOffset);
|
||||
|
||||
#endif /* nsRange_h___ */
|
||||
2339
mozilla/content/base/src/nsStyleContext.cpp
Normal file
2339
mozilla/content/base/src/nsStyleContext.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1165
mozilla/content/base/src/nsStyleSet.cpp
Normal file
1165
mozilla/content/base/src/nsStyleSet.cpp
Normal file
File diff suppressed because it is too large
Load Diff
96
mozilla/content/base/src/nsTextContentChangeData.cpp
Normal file
96
mozilla/content/base/src/nsTextContentChangeData.cpp
Normal 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsTextContentChangeData.h"
|
||||
|
||||
// Create a new instance of nsTextContentChangeData with a refcnt of 1
|
||||
nsresult
|
||||
NS_NewTextContentChangeData(nsTextContentChangeData** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
nsTextContentChangeData* it = new nsTextContentChangeData();
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(it);
|
||||
*aResult = it;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTextContentChangeData::nsTextContentChangeData()
|
||||
: mType(Insert),
|
||||
mOffset(0),
|
||||
mLength(0),
|
||||
mReplaceLength(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsTextContentChangeData::~nsTextContentChangeData()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsTextContentChangeData, nsITextContentChangeData);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextContentChangeData::GetChangeType(ChangeType* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = mType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextContentChangeData::GetReplaceData(PRInt32* aOffset,
|
||||
PRInt32* aSourceLength,
|
||||
PRInt32* aReplaceLength)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOffset);
|
||||
NS_ENSURE_ARG_POINTER(aSourceLength);
|
||||
NS_ENSURE_ARG_POINTER(aReplaceLength);
|
||||
*aOffset = mOffset;
|
||||
*aSourceLength = mLength;
|
||||
*aReplaceLength = mReplaceLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextContentChangeData::GetInsertData(PRInt32* aOffset,
|
||||
PRInt32* aInsertLength)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOffset);
|
||||
NS_ENSURE_ARG_POINTER(aInsertLength);
|
||||
*aOffset = mOffset;
|
||||
*aInsertLength = mLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextContentChangeData::GetAppendData(PRInt32* aOffset,
|
||||
PRInt32* aAppendLength)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOffset);
|
||||
NS_ENSURE_ARG_POINTER(aAppendLength);
|
||||
*aOffset = mOffset;
|
||||
*aAppendLength = mLength;
|
||||
return NS_OK;
|
||||
}
|
||||
72
mozilla/content/base/src/nsTextContentChangeData.h
Normal file
72
mozilla/content/base/src/nsTextContentChangeData.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsTextContentChangeData_h___
|
||||
#define nsTextContentChangeData_h___
|
||||
|
||||
#include "nsITextContent.h"
|
||||
|
||||
class nsTextContentChangeData : public nsITextContentChangeData {
|
||||
public:
|
||||
friend nsresult
|
||||
NS_NewTextContentChangeData(nsTextContentChangeData** aResult);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsITextContentChangedData
|
||||
NS_IMETHOD GetChangeType(ChangeType* aResult);
|
||||
|
||||
NS_IMETHOD GetReplaceData(PRInt32* aOffset,
|
||||
PRInt32* aSourceLength,
|
||||
PRInt32* aReplaceLength);
|
||||
|
||||
NS_IMETHOD GetInsertData(PRInt32* aOffset,
|
||||
PRInt32* aInsertLength);
|
||||
|
||||
NS_IMETHOD GetAppendData(PRInt32* aOffset,
|
||||
PRInt32* aAppendLength);
|
||||
|
||||
void SetData(ChangeType aType, PRInt32 aOffset, PRInt32 aLength) {
|
||||
mType = aType;
|
||||
mOffset = aOffset;
|
||||
mLength = aLength;
|
||||
}
|
||||
|
||||
void SetReplaceLength(PRInt32 aReplaceLength) {
|
||||
mReplaceLength = aReplaceLength;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsTextContentChangeData();
|
||||
virtual ~nsTextContentChangeData();
|
||||
|
||||
ChangeType mType;
|
||||
PRInt32 mOffset;
|
||||
PRInt32 mLength;
|
||||
PRInt32 mReplaceLength; // only used for replace type
|
||||
};
|
||||
|
||||
// Create a new instance of nsTextContentChangeData with a refcnt of 1
|
||||
extern nsresult
|
||||
NS_NewTextContentChangeData(nsTextContentChangeData** aResult);
|
||||
|
||||
#endif /* nsTextContentChangeData_h___ */
|
||||
245
mozilla/content/base/src/nsTextFragment.cpp
Normal file
245
mozilla/content/base/src/nsTextFragment.cpp
Normal file
@@ -0,0 +1,245 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
nsTextFragment::~nsTextFragment()
|
||||
{
|
||||
ReleaseText();
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFragment::ReleaseText()
|
||||
{
|
||||
if (mState.mLength && m1b && mState.mInHeap) {
|
||||
if (mState.mIs2b) {
|
||||
delete [] m2b;
|
||||
}
|
||||
else {
|
||||
delete [] m1b;
|
||||
}
|
||||
}
|
||||
m1b = nsnull;
|
||||
mState.mIs2b = 0;
|
||||
mState.mInHeap = 0;
|
||||
mState.mLength = 0;
|
||||
}
|
||||
|
||||
nsTextFragment::nsTextFragment(const nsTextFragment& aOther)
|
||||
: m1b(nsnull),
|
||||
mAllBits(0)
|
||||
{
|
||||
if (aOther.Is2b()) {
|
||||
SetTo(aOther.Get2b(), aOther.GetLength());
|
||||
}
|
||||
else {
|
||||
SetTo(aOther.Get1b(), aOther.GetLength());
|
||||
}
|
||||
}
|
||||
|
||||
nsTextFragment::nsTextFragment(const char* aString)
|
||||
: m1b(nsnull),
|
||||
mAllBits(0)
|
||||
{
|
||||
SetTo(aString, strlen(aString));
|
||||
}
|
||||
|
||||
nsTextFragment::nsTextFragment(const PRUnichar* aString)
|
||||
: m1b(nsnull),
|
||||
mAllBits(0)
|
||||
{
|
||||
SetTo(aString, nsCRT::strlen(aString));
|
||||
}
|
||||
|
||||
nsTextFragment::nsTextFragment(const nsString& aString)
|
||||
: m1b(nsnull),
|
||||
mAllBits(0)
|
||||
{
|
||||
SetTo(aString.GetUnicode(), aString.Length());
|
||||
}
|
||||
|
||||
nsTextFragment&
|
||||
nsTextFragment::operator=(const nsTextFragment& aOther)
|
||||
{
|
||||
if (aOther.Is2b()) {
|
||||
SetTo(aOther.Get2b(), aOther.GetLength());
|
||||
}
|
||||
else {
|
||||
SetTo(aOther.Get1b(), aOther.GetLength());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsTextFragment&
|
||||
nsTextFragment::operator=(const char* aString)
|
||||
{
|
||||
SetTo(aString, nsCRT::strlen(aString));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsTextFragment&
|
||||
nsTextFragment::operator=(const PRUnichar* aString)
|
||||
{
|
||||
SetTo(aString, nsCRT::strlen(aString));
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsTextFragment&
|
||||
nsTextFragment::operator=(const nsString& aString)
|
||||
{
|
||||
SetTo(aString.GetUnicode(), aString.Length());
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFragment::SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease)
|
||||
{
|
||||
ReleaseText();
|
||||
|
||||
m2b = aBuffer;
|
||||
mState.mIs2b = 1;
|
||||
mState.mInHeap = aRelease ? 1 : 0;
|
||||
mState.mLength = aLength;
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength)
|
||||
{
|
||||
ReleaseText();
|
||||
if (0 != aLength) {
|
||||
// See if we need to store the data in ucs2 or not
|
||||
PRBool need2 = PR_FALSE;
|
||||
const PRUnichar* ucp = aBuffer;
|
||||
const PRUnichar* uend = aBuffer + aLength;
|
||||
while (ucp < uend) {
|
||||
PRUnichar ch = *ucp++;
|
||||
if (ch >> 8) {
|
||||
need2 = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (need2) {
|
||||
// Use ucs2 storage because we have to
|
||||
PRUnichar* nt = new PRUnichar[aLength];
|
||||
if (nsnull != nt) {
|
||||
// Copy data
|
||||
nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength);
|
||||
|
||||
// Setup our fields
|
||||
m2b = nt;
|
||||
mState.mIs2b = 1;
|
||||
mState.mInHeap = 1;
|
||||
mState.mLength = aLength;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Use 1 byte storage because we can
|
||||
unsigned char* nt = new unsigned char[aLength];
|
||||
if (nsnull != nt) {
|
||||
// Copy data
|
||||
unsigned char* cp = nt;
|
||||
unsigned char* end = nt + aLength;
|
||||
while (cp < end) {
|
||||
*cp++ = (unsigned char) *aBuffer++;
|
||||
}
|
||||
|
||||
// Setup our fields
|
||||
m1b = nt;
|
||||
mState.mIs2b = 0;
|
||||
mState.mInHeap = 1;
|
||||
mState.mLength = aLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength)
|
||||
{
|
||||
ReleaseText();
|
||||
if (0 != aLength) {
|
||||
unsigned char* nt = new unsigned char[aLength];
|
||||
if (nsnull != nt) {
|
||||
nsCRT::memcpy(nt, aBuffer, sizeof(unsigned char) * aLength);
|
||||
|
||||
m1b = nt;
|
||||
mState.mIs2b = 0;
|
||||
mState.mInHeap = 1;
|
||||
mState.mLength = aLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFragment::AppendTo(nsString& aString) const
|
||||
{
|
||||
if (mState.mIs2b) {
|
||||
aString.Append(m2b, mState.mLength);
|
||||
}
|
||||
else {
|
||||
aString.Append((char*)m1b, mState.mLength);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFragment::CopyTo(PRUnichar* aDest, PRInt32 aOffset, PRInt32 aCount)
|
||||
{
|
||||
if (aOffset < 0) aOffset = 0;
|
||||
if (aOffset + aCount > GetLength()) {
|
||||
aCount = mState.mLength - aOffset;
|
||||
}
|
||||
if (0 != aCount) {
|
||||
if (mState.mIs2b) {
|
||||
nsCRT::memcpy(aDest, m2b + aOffset, sizeof(PRUnichar) * aCount);
|
||||
}
|
||||
else {
|
||||
unsigned char* cp = m1b + aOffset;
|
||||
unsigned char* end = cp + aCount;
|
||||
while (cp < end) {
|
||||
*aDest++ = PRUnichar(*cp++);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFragment::CopyTo(char* aDest, PRInt32 aOffset, PRInt32 aCount)
|
||||
{
|
||||
if (aOffset < 0) aOffset = 0;
|
||||
if (aOffset + aCount > GetLength()) {
|
||||
aCount = mState.mLength - aOffset;
|
||||
}
|
||||
if (0 != aCount) {
|
||||
if (mState.mIs2b) {
|
||||
PRUnichar* cp = m2b + aOffset;
|
||||
PRUnichar* end = cp + aCount;
|
||||
while (cp < end) {
|
||||
*aDest++ = (unsigned char) (*cp++);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsCRT::memcpy(aDest, m1b + aOffset, sizeof(char) * aCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
221
mozilla/content/base/src/nsTextNode.cpp
Normal file
221
mozilla/content/base/src/nsTextNode.cpp
Normal file
@@ -0,0 +1,221 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsGenericDOMDataNode.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID);
|
||||
|
||||
class nsTextNode : public nsIDOMText,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIContent,
|
||||
public nsITextContent
|
||||
{
|
||||
public:
|
||||
nsTextNode();
|
||||
virtual ~nsTextNode();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIDOMCharacterData
|
||||
NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIDOMText
|
||||
NS_IMPL_IDOMTEXT_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const {
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
|
||||
// nsITextContent
|
||||
NS_IMPL_ITEXTCONTENT_USING_GENERIC_DOM_DATA(mInner)
|
||||
|
||||
protected:
|
||||
nsGenericDOMDataNode mInner;
|
||||
PRUint32 mContentID;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewTextNode(nsIContent** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsTextNode* it;
|
||||
NS_NEWXPCOM(it, nsTextNode);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsTextNode::nsTextNode()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this);
|
||||
mContentID = 0;
|
||||
}
|
||||
|
||||
nsTextNode::~nsTextNode()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsTextNode)
|
||||
NS_IMPL_RELEASE(nsTextNode)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_DOM_DATA_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMTextIID)) {
|
||||
nsIDOMText* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kITextContentIID)) {
|
||||
nsITextContent* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::GetTag(nsIAtom*& aResult) const
|
||||
{
|
||||
aResult = nsLayoutAtoms::textTagName;
|
||||
NS_ADDREF(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
aNodeName.SetString("#text");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::GetNodeType(PRUint16* aNodeType)
|
||||
{
|
||||
*aNodeType = (PRUint16)nsIDOMNode::TEXT_NODE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsTextNode* it;
|
||||
NS_NEWXPCOM(it, nsTextNode);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
// XXX Increment the ref count before calling any
|
||||
// methods. If they do a QI and then a Release()
|
||||
// the instance will be deleted.
|
||||
result = it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
nsAutoString data;
|
||||
result = GetData(data);
|
||||
if (NS_FAILED(result)) {
|
||||
NS_RELEASE(*aReturn);
|
||||
return result;
|
||||
}
|
||||
result = it->SetData(data);
|
||||
if (NS_FAILED(result)) {
|
||||
NS_RELEASE(*aReturn);
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
NS_PRECONDITION(nsnull != mInner.mDocument, "bad content");
|
||||
|
||||
PRInt32 index;
|
||||
for (index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
fprintf(out, "Text@%p refcount=%d<", this, mRefCnt);
|
||||
|
||||
nsAutoString tmp;
|
||||
mInner.ToCString(tmp, 0, mInner.mText.GetLength());
|
||||
fputs(tmp, out);
|
||||
|
||||
fputs(">\n", out);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::GetContentID(PRUint32* aID)
|
||||
{
|
||||
*aID = mContentID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextNode::SetContentID(PRUint32 aID)
|
||||
{
|
||||
mContentID = aID;
|
||||
return NS_OK;
|
||||
}
|
||||
32
mozilla/content/events/Makefile.in
Normal file
32
mozilla/content/events/Makefile.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# 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 = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
27
mozilla/content/events/makefile.win
Normal file
27
mozilla/content/events/makefile.win
Normal file
@@ -0,0 +1,27 @@
|
||||
#!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=public src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
9
mozilla/content/events/public/MANIFEST
Normal file
9
mozilla/content/events/public/MANIFEST
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:layout directory
|
||||
#
|
||||
nsIEventListenerManager.h
|
||||
nsIEventStateManager.h
|
||||
nsIPrivateDOMEvent.h
|
||||
nsIPrivateTextEvent.h
|
||||
nsIPrivateTextRange.h
|
||||
nsIPrivateCompositionEvent.h
|
||||
43
mozilla/content/events/public/Makefile.in
Normal file
43
mozilla/content/events/public/Makefile.in
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = layout
|
||||
|
||||
EXPORTS = \
|
||||
nsIEventListenerManager.h \
|
||||
nsIEventStateManager.h \
|
||||
nsIPrivateDOMEvent.h \
|
||||
nsIPrivateTextEvent.h \
|
||||
nsIPrivateTextRange.h \
|
||||
nsIPrivateCompositionEvent.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
37
mozilla/content/events/public/makefile.win
Normal file
37
mozilla/content/events/public/makefile.win
Normal file
@@ -0,0 +1,37 @@
|
||||
#!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=..\..\..
|
||||
|
||||
|
||||
EXPORTS = \
|
||||
nsIEventListenerManager.h \
|
||||
nsIEventStateManager.h \
|
||||
nsIPrivateDOMEvent.h \
|
||||
nsIPrivateTextEvent.h \
|
||||
nsIPrivateTextRange.h \
|
||||
nsIPrivateCompositionEvent.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
141
mozilla/content/events/public/nsIEventListenerManager.h
Normal file
141
mozilla/content/events/public/nsIEventListenerManager.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIEventListenerManager_h__
|
||||
#define nsIEventListenerManager_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsIPresContext;
|
||||
class nsIDOMEventListener;
|
||||
class nsIScriptObjectOwner;
|
||||
|
||||
/*
|
||||
* Event listener manager interface.
|
||||
*/
|
||||
#define NS_IEVENTLISTENERMANAGER_IID \
|
||||
{ /* cd91bcf0-ded9-11d1-bd85-00805f8ae3f4 */ \
|
||||
0xcd91bcf0, 0xded9, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIEventListenerManager : public nsISupports {
|
||||
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IEVENTLISTENERMANAGER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Retrieves events listeners of all types.
|
||||
* @param
|
||||
*/
|
||||
virtual nsresult GetEventListeners(nsVoidArray **aListeners, const nsIID& aIID) = 0;
|
||||
|
||||
/**
|
||||
* Sets events listeners of all types.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 flags) = 0;
|
||||
|
||||
/**
|
||||
* Removes events listeners of all types.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 flags) = 0;
|
||||
|
||||
/**
|
||||
* Sets events listeners of all types.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0;
|
||||
|
||||
/**
|
||||
* Removes events listeners of all types.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 flags) = 0;
|
||||
|
||||
/**
|
||||
* Creates a script event listener for the given script object with name mName and function
|
||||
* body mFunc.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult AddScriptEventListener(nsIScriptContext*aContext,
|
||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
||||
nsIAtom *aName,
|
||||
const nsString& aFunc,
|
||||
REFNSIID aIID,
|
||||
PRBool aDeferCompilation) = 0;
|
||||
|
||||
/**
|
||||
* Registers an event listener that already exists on the given script object with the event
|
||||
* listener manager.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult RegisterScriptEventListener(nsIScriptContext *aContext,
|
||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
||||
nsIAtom* aName,
|
||||
REFNSIID aIID) = 0;
|
||||
|
||||
/**
|
||||
* Causes a check for event listeners and processing by them if they exist.
|
||||
* Event flags live in nsGUIEvent.h
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult HandleEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
/**
|
||||
* Creates a DOM event that can subsequently be passed into HandleEvent.
|
||||
* (used rarely in the situation where methods on the event need to be
|
||||
* invoked prior to the processing of the event).
|
||||
*/
|
||||
virtual nsresult CreateEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent) = 0;
|
||||
|
||||
/**
|
||||
* Captures all events designated for descendant objects at the current level.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult CaptureEvent(nsIDOMEventListener *aListener) = 0;
|
||||
|
||||
/**
|
||||
* Releases all events designated for descendant objects at the current level.
|
||||
* @param an event listener
|
||||
*/
|
||||
virtual nsresult ReleaseEvent(nsIDOMEventListener *aListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes all event listeners registered by this instance of the listener
|
||||
* manager.
|
||||
*/
|
||||
virtual nsresult RemoveAllListeners(PRBool aScriptOnly) = 0;
|
||||
|
||||
};
|
||||
|
||||
extern NS_HTML nsresult NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
|
||||
#endif // nsIEventListenerManager_h__
|
||||
87
mozilla/content/events/public/nsIEventStateManager.h
Normal file
87
mozilla/content/events/public/nsIEventStateManager.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIEventStateManager_h__
|
||||
#define nsIEventStateManager_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIPresContext;
|
||||
class nsIDOMEvent;
|
||||
class nsIFrame;
|
||||
class nsIView;
|
||||
|
||||
/*
|
||||
* Event listener manager interface.
|
||||
*/
|
||||
#define NS_IEVENTSTATEMANAGER_IID \
|
||||
{ /* 80a98c80-2036-11d2-bd89-00805f8ae3f4 */ \
|
||||
0x80a98c80, 0x2036, 0x11d2, \
|
||||
{0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIEventStateManager : public nsISupports {
|
||||
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IEVENTSTATEMANAGER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD PreHandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent *aEvent,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsEventStatus* aStatus,
|
||||
nsIView* aView) = 0;
|
||||
|
||||
NS_IMETHOD PostHandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent *aEvent,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsEventStatus* aStatus,
|
||||
nsIView* aView) = 0;
|
||||
|
||||
NS_IMETHOD SetPresContext(nsIPresContext* aPresContext) = 0;
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
|
||||
|
||||
NS_IMETHOD GetEventTarget(nsIFrame **aFrame) = 0;
|
||||
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent) = 0;
|
||||
NS_IMETHOD GetEventRelatedContent(nsIContent** aContent) = 0;
|
||||
|
||||
NS_IMETHOD GetContentState(nsIContent *aContent, PRInt32& aState) = 0;
|
||||
NS_IMETHOD SetContentState(nsIContent *aContent, PRInt32 aState) = 0;
|
||||
|
||||
NS_IMETHOD GetFocusedContent(nsIContent **aContent) = 0;
|
||||
NS_IMETHOD SetFocusedContent(nsIContent* aContent) = 0;
|
||||
|
||||
// Cross ESM methods, doesn't matter what instance you call it from
|
||||
NS_IMETHOD GetFocusedEventTarget(nsIFrame **aFrame) = 0;
|
||||
|
||||
// This is an experiement and may be temporary
|
||||
NS_IMETHOD ConsumeFocusEvents(PRBool aDoConsume) = 0;
|
||||
};
|
||||
|
||||
#define NS_EVENT_STATE_UNSPECIFIED 0x0000
|
||||
#define NS_EVENT_STATE_ACTIVE 0x0001 // mouse is down on content
|
||||
#define NS_EVENT_STATE_FOCUS 0x0002 // content has focus
|
||||
#define NS_EVENT_STATE_HOVER 0x0004 // mouse is hovering over content
|
||||
#define NS_EVENT_STATE_DRAGOVER 0x0008 // drag is hovering over content
|
||||
|
||||
#endif // nsIEventStateManager_h__
|
||||
43
mozilla/content/events/public/nsIPrivateCompositionEvent.h
Normal file
43
mozilla/content/events/public/nsIPrivateCompositionEvent.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIPrivateCompositionEvent_h__
|
||||
#define nsIPrivateCompositionEvent_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {ECF6BEF1-5F0C-11d3-9EB3-0060089FE59B}
|
||||
#define NS_IPRIVATECOMPOSITIONEVENT_IID \
|
||||
{ 0xecf6bef1, 0x5f0c, 0x11d3, \
|
||||
{ 0x9e, 0xb3, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b }}
|
||||
|
||||
class nsIPrivateCompositionEvent : public nsISupports {
|
||||
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATECOMPOSITIONEVENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetCompositionReply(struct nsTextEventReply** aReply) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIPrivateCompositionEvent_h__
|
||||
|
||||
54
mozilla/content/events/public/nsIPrivateDOMEvent.h
Normal file
54
mozilla/content/events/public/nsIPrivateDOMEvent.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIPrivateDOMEvent_h__
|
||||
#define nsIPrivateDOMEvent_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIPresContext;
|
||||
|
||||
/*
|
||||
* Event listener manager interface.
|
||||
*/
|
||||
#define NS_IPRIVATEDOMEVENT_IID \
|
||||
{ /* 80a98c80-2036-11d2-bd89-00805f8ae3f4 */ \
|
||||
0x80a98c80, 0x2036, 0x11d2, \
|
||||
{0xbd, 0x89, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMNode;
|
||||
class nsIDOMEvent;
|
||||
|
||||
class nsIPrivateDOMEvent : public nsISupports {
|
||||
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATEDOMEVENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD DuplicatePrivateData() = 0;
|
||||
NS_IMETHOD SetTarget(nsIDOMNode* aNode) = 0;
|
||||
};
|
||||
|
||||
extern nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent);
|
||||
extern nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent);
|
||||
|
||||
#endif // nsIPrivateDOMEvent_h__
|
||||
46
mozilla/content/events/public/nsIPrivateTextEvent.h
Normal file
46
mozilla/content/events/public/nsIPrivateTextEvent.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIPrivateTextEvent_h__
|
||||
#define nsIPrivateTextEvent_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIPrivateTextRange.h"
|
||||
|
||||
#define NS_IPRIVATETEXTEVENT_IID \
|
||||
{ /* 37B69251-4ACE-11d3-9EA6-0060089FE59B */ \
|
||||
0x37b69251, 0x4ace, 0x11d3, \
|
||||
{0x9e, 0xa6, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b} }
|
||||
|
||||
class nsIPrivateTextEvent : public nsISupports {
|
||||
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATETEXTEVENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetText(nsString& aText) = 0;
|
||||
NS_IMETHOD GetInputRange(nsIPrivateTextRangeList** aInputRange) = 0;
|
||||
NS_IMETHOD GetEventReply(struct nsTextEventReply** aReply) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIPrivateTextEvent_h__
|
||||
|
||||
66
mozilla/content/events/public/nsIPrivateTextRange.h
Normal file
66
mozilla/content/events/public/nsIPrivateTextRange.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIPrivateTextRange_h__
|
||||
#define nsIPrivateTextRange_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define NS_IPRIVATETEXTRANGE_IID \
|
||||
{0xb471ab41, 0x2a79, 0x11d3, \
|
||||
{ 0x9e, 0xa4, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b } }
|
||||
|
||||
class nsIPrivateTextRange : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATETEXTRANGE_IID; return iid; }
|
||||
enum {
|
||||
TEXTRANGE_CARETPOSITION = 1,
|
||||
TEXTRANGE_RAWINPUT = 2,
|
||||
TEXTRANGE_SELECTEDRAWTEXT = 3,
|
||||
TEXTRANGE_CONVERTEDTEXT = 4,
|
||||
TEXTRANGE_SELECTEDCONVERTEDTEXT = 5
|
||||
};
|
||||
|
||||
NS_IMETHOD GetRangeStart(PRUint16* aRangeStart)=0;
|
||||
NS_IMETHOD SetRangeStart(PRUint16 aRangeStart)=0;
|
||||
|
||||
NS_IMETHOD GetRangeEnd(PRUint16* aRangeEnd)=0;
|
||||
NS_IMETHOD SetRangeEnd(PRUint16 aRangeEnd)=0;
|
||||
|
||||
NS_IMETHOD GetRangeType(PRUint16* aRangeType)=0;
|
||||
NS_IMETHOD SetRangeType(PRUint16 aRangeType)=0;
|
||||
};
|
||||
|
||||
#define NS_IPRIVATETEXTRANGELIST_IID \
|
||||
{ 0x1ee9d531, 0x2a79, 0x11d3, \
|
||||
{ 0x9e, 0xa4, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b} }
|
||||
|
||||
class nsIPrivateTextRangeList : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IPRIVATETEXTRANGELIST_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRUint16* aLength)=0;
|
||||
NS_IMETHOD Item(PRUint16 aIndex, nsIPrivateTextRange** aReturn)=0;
|
||||
};
|
||||
|
||||
#endif // nsIPrivateTextRange_h__
|
||||
7
mozilla/content/events/src/MANIFEST
Normal file
7
mozilla/content/events/src/MANIFEST
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:layout directory
|
||||
#
|
||||
nsEventListenerManager.h
|
||||
nsEventStateManager.h
|
||||
nsDOMEvent.h
|
||||
nsDOMEventsIIDs.h
|
||||
61
mozilla/content/events/src/Makefile.in
Normal file
61
mozilla/content/events/src/Makefile.in
Normal file
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = layout
|
||||
LIBRARY_NAME = raptorevents_s
|
||||
|
||||
REQUIRES = xpcom raptor dom js netlib
|
||||
|
||||
CPPSRCS = \
|
||||
nsEventListenerManager.cpp \
|
||||
nsEventStateManager.cpp \
|
||||
nsDOMEvent.cpp \
|
||||
nsDOMEventsIIDs.cpp \
|
||||
nsPrivateTextRange.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsEventListenerManager.h \
|
||||
nsEventStateManager.h \
|
||||
nsDOMEvent.h \
|
||||
nsDOMEventsIIDs.h \
|
||||
nsPrivateTextRange.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_HTML
|
||||
|
||||
INCLUDES += -I$(PUBLIC)/dom -I$(srcdir)/../../html/base/src
|
||||
|
||||
64
mozilla/content/events/src/makefile.win
Normal file
64
mozilla/content/events/src/makefile.win
Normal file
@@ -0,0 +1,64 @@
|
||||
#!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=..\..\..
|
||||
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
LIBRARY_NAME=raptorevents_s
|
||||
MODULE=raptor
|
||||
REQUIRES=xpcom raptor dom js
|
||||
|
||||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
CPPSRCS= nsEventListenerManager.cpp \
|
||||
nsEventStateManager.cpp \
|
||||
nsDOMEvent.cpp \
|
||||
nsDOMEventsIIDs.cpp \
|
||||
nsPrivateTextRange.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= .\$(OBJDIR)\nsEventListenerManager.obj \
|
||||
.\$(OBJDIR)\nsEventStateManager.obj \
|
||||
.\$(OBJDIR)\nsDOMEvent.obj \
|
||||
.\$(OBJDIR)\nsDOMEventsIIDs.obj \
|
||||
.\$(OBJDIR)\nsPrivateTextRange.obj \
|
||||
$(NULL)
|
||||
|
||||
|
||||
EXPORTS= nsEventListenerManager.h nsEventStateManager.h nsDOMEvent.h nsDOMEventsIIDs.h nsPrivateTextRange.h
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I..\..\html\base\src -I$(PUBLIC)\netlib
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
923
mozilla/content/events/src/nsDOMEvent.cpp
Normal file
923
mozilla/content/events/src/nsDOMEvent.cpp
Normal file
@@ -0,0 +1,923 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPrivateTextRange.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIPrivateCompositionEvent.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
||||
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMEventIID, NS_IDOMEVENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMUIEventIID, NS_IDOMUIEVENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMKeyEventIID, NS_IDOMKEYEVENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMMouseEventIID, NS_IDOMMOUSEEVENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMNSUIEventIID, NS_IDOMNSUIEVENT_IID);
|
||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
static NS_DEFINE_IID(kIPrivateTextEventIID, NS_IPRIVATETEXTEVENT_IID);
|
||||
static NS_DEFINE_IID(kIPrivateCompositionEventIID,NS_IPRIVATECOMPOSITIONEVENT_IID);
|
||||
|
||||
static char* mEventNames[] = {
|
||||
"mousedown", "mouseup", "click", "dblclick", "mouseover",
|
||||
"mouseout", "mousemove", "keydown", "keyup", "keypress",
|
||||
"focus", "blur", "load", "unload", "abort", "error",
|
||||
"submit", "reset", "change", "select", "input", "paint" ,"text",
|
||||
"create", "close", "destroy", "command", "broadcast", "commandupdate",
|
||||
"dragenter", "dragover", "dragexit", "dragdrop", "draggesture"
|
||||
};
|
||||
|
||||
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent) {
|
||||
mPresContext = aPresContext;
|
||||
NS_ADDREF(mPresContext);
|
||||
mEvent = aEvent;
|
||||
mTarget = nsnull;
|
||||
mText = nsnull;
|
||||
mTextRange = nsnull;
|
||||
|
||||
if (aEvent->eventStructType ==NS_TEXT_EVENT) {
|
||||
//
|
||||
// extract the IME composition string
|
||||
//
|
||||
mText = new nsString(((nsTextEvent*)aEvent)->theText);
|
||||
//
|
||||
// build the range list -- ranges need to be DOM-ified since the IME transaction
|
||||
// will hold a ref, the widget representation isn't persistent
|
||||
//
|
||||
nsIPrivateTextRange** tempTextRangeList = new nsIPrivateTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
||||
if (tempTextRangeList!=nsnull) {
|
||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
||||
nsPrivateTextRange* tempPrivateTextRange = new nsPrivateTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
||||
if (tempPrivateTextRange!=nsnull) {
|
||||
tempPrivateTextRange->AddRef();
|
||||
tempTextRangeList[i] = (nsIPrivateTextRange*)tempPrivateTextRange;
|
||||
}
|
||||
}
|
||||
|
||||
mTextRange = (nsIPrivateTextRangeList*) new nsPrivateTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
||||
if (mTextRange!=nsnull) mTextRange->AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsDOMEvent::~nsDOMEvent() {
|
||||
NS_RELEASE(mPresContext);
|
||||
NS_IF_RELEASE(mTarget);
|
||||
NS_IF_RELEASE(mTextRange);
|
||||
|
||||
if (mText!=nsnull)
|
||||
delete mText;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMEvent)
|
||||
NS_IMPL_RELEASE(nsDOMEvent)
|
||||
|
||||
nsresult nsDOMEvent::QueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIDOMEventIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIDOMEvent*)(nsIDOMUIEvent*)(nsIDOMMouseEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMUIEventIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIDOMUIEvent*)(nsIDOMMouseEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMMouseEventIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIDOMMouseEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMKeyEventIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIDOMKeyEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMNSUIEventIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIDOMNSUIEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIPrivateDOMEventIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIPrivateDOMEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIPrivateTextEventIID)) {
|
||||
*aInstancePtrResult=(void*)((nsIPrivateTextEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIPrivateCompositionEventIID)) {
|
||||
*aInstancePtrResult = (void*)((nsIPrivateCompositionEvent*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
// nsIDOMEventInterface
|
||||
NS_METHOD nsDOMEvent::GetType(nsString& aType)
|
||||
{
|
||||
const char* mName = GetEventName(mEvent->message);
|
||||
|
||||
if (nsnull != mName) {
|
||||
aType = mName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetTarget(nsIDOMNode** aTarget)
|
||||
{
|
||||
if (nsnull != mTarget) {
|
||||
*aTarget = mTarget;
|
||||
NS_ADDREF(mTarget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIEventStateManager *manager;
|
||||
nsIContent *targetContent;
|
||||
|
||||
if (NS_OK == mPresContext->GetEventStateManager(&manager)) {
|
||||
manager->GetEventTargetContent(mEvent, &targetContent);
|
||||
NS_RELEASE(manager);
|
||||
}
|
||||
|
||||
if (targetContent) {
|
||||
if (NS_OK == targetContent->QueryInterface(kIDOMNodeIID, (void**)&mTarget)) {
|
||||
*aTarget = mTarget;
|
||||
NS_ADDREF(mTarget);
|
||||
}
|
||||
NS_RELEASE(targetContent);
|
||||
}
|
||||
else {
|
||||
//Always want a target. Use document if nothing else.
|
||||
nsIPresShell* presShell;
|
||||
nsIDocument* doc;
|
||||
if (NS_SUCCEEDED(mPresContext->GetShell(&presShell))) {
|
||||
presShell->GetDocument(&doc);
|
||||
NS_RELEASE(presShell);
|
||||
}
|
||||
|
||||
if (doc) {
|
||||
if (NS_OK == doc->QueryInterface(kIDOMNodeIID, (void**)&mTarget)) {
|
||||
*aTarget = mTarget;
|
||||
NS_ADDREF(mTarget);
|
||||
}
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetCurrentNode(nsIDOMNode** aCurrentNode)
|
||||
{
|
||||
*aCurrentNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetEventPhase(PRUint16* aEventPhase)
|
||||
{
|
||||
if (mEvent->flags & NS_EVENT_FLAG_CAPTURE) {
|
||||
*aEventPhase = nsIDOMMouseEvent::CAPTURING_PHASE;
|
||||
}
|
||||
else if (mEvent->flags & NS_EVENT_FLAG_BUBBLE) {
|
||||
*aEventPhase = nsIDOMMouseEvent::BUBBLING_PHASE;
|
||||
}
|
||||
else if (mEvent->flags & NS_EVENT_FLAG_INIT) {
|
||||
*aEventPhase = nsIDOMMouseEvent::AT_TARGET;
|
||||
}
|
||||
else {
|
||||
*aEventPhase = 0;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetBubbles(PRBool* aBubbles)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetCancelable(PRBool* aCancelable)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::PreventBubble()
|
||||
{
|
||||
if (mEvent->flags & NS_EVENT_FLAG_BUBBLE || mEvent->flags & NS_EVENT_FLAG_INIT) {
|
||||
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::PreventCapture()
|
||||
{
|
||||
if (mEvent->flags & NS_EVENT_FLAG_CAPTURE) {
|
||||
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::PreventDefault()
|
||||
{
|
||||
mEvent->flags |= NS_EVENT_FLAG_NO_DEFAULT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetView(nsIDOMAbstractView** aView)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::GetDetail(PRInt32* aDetail)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetText(nsString& aText)
|
||||
{
|
||||
if (mEvent->message == NS_TEXT_EVENT) {
|
||||
aText = *mText;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetInputRange(nsIPrivateTextRangeList** aInputRange)
|
||||
{
|
||||
if (mEvent->message == NS_TEXT_EVENT) {
|
||||
*aInputRange = mTextRange;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetEventReply(nsTextEventReply** aReply)
|
||||
{
|
||||
if (mEvent->message==NS_TEXT_EVENT) {
|
||||
*aReply = &(((nsTextEvent*)mEvent)->theReply);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetCompositionReply(nsTextEventReply** aReply)
|
||||
{
|
||||
if((mEvent->message==NS_COMPOSITION_START) ||
|
||||
(mEvent->message==NS_COMPOSITION_QUERY)) {
|
||||
*aReply = &(((nsCompositionEvent*)mEvent)->theReply);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetScreenX(PRInt32* aScreenX)
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT && mEvent->eventStructType != NS_DRAGDROP_EVENT) ) {
|
||||
*aScreenX = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!((nsGUIEvent*)mEvent)->widget )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRect bounds, offset;
|
||||
bounds.x = mEvent->refPoint.x;
|
||||
|
||||
((nsGUIEvent*)mEvent)->widget->WidgetToScreen ( bounds, offset );
|
||||
*aScreenX = offset.x;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetScreenY(PRInt32* aScreenY)
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT && mEvent->eventStructType != NS_DRAGDROP_EVENT) ) {
|
||||
*aScreenY = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!((nsGUIEvent*)mEvent)->widget )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRect bounds, offset;
|
||||
bounds.y = mEvent->refPoint.y;
|
||||
|
||||
((nsGUIEvent*)mEvent)->widget->WidgetToScreen ( bounds, offset );
|
||||
*aScreenY = offset.y;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetClientX(PRInt32* aClientX)
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT && mEvent->eventStructType != NS_DRAGDROP_EVENT) ) {
|
||||
*aClientX = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//My god, man, there *must* be a better way to do this.
|
||||
nsIPresShell* shell;
|
||||
nsIWidget* rootWidget = nsnull;
|
||||
mPresContext->GetShell(&shell);
|
||||
|
||||
if (shell) {
|
||||
nsIViewManager* vm;
|
||||
shell->GetViewManager(&vm);
|
||||
if (vm) {
|
||||
nsIView* rootView = nsnull;
|
||||
vm->GetRootView(rootView);
|
||||
if (rootView) {
|
||||
rootView->GetWidget(rootWidget);
|
||||
}
|
||||
NS_RELEASE(vm);
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
|
||||
|
||||
nsRect bounds, offset;
|
||||
offset.x = 0;
|
||||
|
||||
nsIWidget* parent = ((nsGUIEvent*)mEvent)->widget;
|
||||
//Add extra ref since loop will free one.
|
||||
NS_ADDREF(parent);
|
||||
nsIWidget* tmp;
|
||||
while (rootWidget != parent && nsnull != parent) {
|
||||
parent->GetBounds(bounds);
|
||||
offset.x += bounds.x;
|
||||
tmp = parent;
|
||||
parent = tmp->GetParent();
|
||||
NS_RELEASE(tmp);
|
||||
}
|
||||
NS_IF_RELEASE(parent);
|
||||
NS_IF_RELEASE(rootWidget);
|
||||
|
||||
*aClientX = mEvent->refPoint.x + offset.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetClientY(PRInt32* aClientY)
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT && mEvent->eventStructType != NS_DRAGDROP_EVENT) ) {
|
||||
*aClientY = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//My god, man, there *must* be a better way to do this.
|
||||
nsIPresShell* shell;
|
||||
nsIWidget* rootWidget = nsnull;
|
||||
mPresContext->GetShell(&shell);
|
||||
|
||||
if (shell) {
|
||||
nsIViewManager* vm;
|
||||
shell->GetViewManager(&vm);
|
||||
if (vm) {
|
||||
nsIView* rootView = nsnull;
|
||||
vm->GetRootView(rootView);
|
||||
if (rootView) {
|
||||
rootView->GetWidget(rootWidget);
|
||||
}
|
||||
NS_RELEASE(vm);
|
||||
}
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
|
||||
|
||||
nsRect bounds, offset;
|
||||
offset.y = 0;
|
||||
|
||||
nsIWidget* parent = ((nsGUIEvent*)mEvent)->widget;
|
||||
//Add extra ref since loop will free one.
|
||||
NS_ADDREF(parent);
|
||||
nsIWidget* tmp;
|
||||
while (rootWidget != parent && nsnull != parent) {
|
||||
parent->GetBounds(bounds);
|
||||
offset.y += bounds.y;
|
||||
tmp = parent;
|
||||
parent = tmp->GetParent();
|
||||
NS_RELEASE(tmp);
|
||||
}
|
||||
NS_IF_RELEASE(parent);
|
||||
NS_IF_RELEASE(rootWidget);
|
||||
|
||||
*aClientY = mEvent->refPoint.y + offset.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetAltKey(PRBool* aIsDown)
|
||||
{
|
||||
*aIsDown = ((nsInputEvent*)mEvent)->isAlt;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetCtrlKey(PRBool* aIsDown)
|
||||
{
|
||||
*aIsDown = ((nsInputEvent*)mEvent)->isControl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetShiftKey(PRBool* aIsDown)
|
||||
{
|
||||
*aIsDown = ((nsInputEvent*)mEvent)->isShift;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetMetaKey(PRBool* aIsDown)
|
||||
{
|
||||
*aIsDown = ((nsInputEvent*)mEvent)->isMeta;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetCharCode(PRUint32* aCharCode)
|
||||
{
|
||||
if (!mEvent || mEvent->eventStructType != NS_KEY_EVENT) {
|
||||
*aCharCode = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
switch (mEvent->message) {
|
||||
case NS_KEY_UP:
|
||||
case NS_KEY_DOWN:
|
||||
#ifdef NS_DEBUG
|
||||
printf("GetCharCode used for wrong key event; should use onkeypress.\n");
|
||||
#endif
|
||||
*aCharCode = 0;
|
||||
break;
|
||||
case NS_KEY_PRESS:
|
||||
*aCharCode = ((nsKeyEvent*)mEvent)->charCode;
|
||||
#if defined(NS_DEBUG) && defined(DEBUG_buster)
|
||||
if (0==*aCharCode)
|
||||
printf("GetCharCode used correctly but no valid key!\n");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetKeyCode(PRUint32* aKeyCode)
|
||||
{
|
||||
if (!mEvent || mEvent->eventStructType != NS_KEY_EVENT) {
|
||||
*aKeyCode = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
switch (mEvent->message) {
|
||||
case NS_KEY_UP:
|
||||
case NS_KEY_PRESS:
|
||||
case NS_KEY_DOWN:
|
||||
*aKeyCode = ((nsKeyEvent*)mEvent)->keyCode;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetButton(PRUint16* aButton)
|
||||
{
|
||||
if (!mEvent || mEvent->eventStructType != NS_MOUSE_EVENT) {
|
||||
*aButton = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
switch (mEvent->message) {
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
case NS_MOUSE_LEFT_CLICK:
|
||||
case NS_MOUSE_LEFT_DOUBLECLICK:
|
||||
*aButton = 1;
|
||||
break;
|
||||
case NS_MOUSE_MIDDLE_BUTTON_UP:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
case NS_MOUSE_MIDDLE_CLICK:
|
||||
case NS_MOUSE_MIDDLE_DOUBLECLICK:
|
||||
*aButton = 2;
|
||||
break;
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_CLICK:
|
||||
case NS_MOUSE_RIGHT_DOUBLECLICK:
|
||||
*aButton = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetClickCount(PRUint16* aClickCount)
|
||||
{
|
||||
if (!mEvent || mEvent->eventStructType != NS_MOUSE_EVENT) {
|
||||
*aClickCount = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
switch (mEvent->message) {
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
case NS_MOUSE_LEFT_CLICK:
|
||||
case NS_MOUSE_LEFT_DOUBLECLICK:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_UP:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
case NS_MOUSE_MIDDLE_CLICK:
|
||||
case NS_MOUSE_MIDDLE_DOUBLECLICK:
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_CLICK:
|
||||
case NS_MOUSE_RIGHT_DOUBLECLICK:
|
||||
*aClickCount = ((nsMouseEvent*)mEvent)->clickCount;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
|
||||
{
|
||||
nsIEventStateManager *manager;
|
||||
nsIContent *relatedContent;
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
if (NS_OK == mPresContext->GetEventStateManager(&manager)) {
|
||||
manager->GetEventRelatedContent(&relatedContent);
|
||||
NS_RELEASE(manager);
|
||||
}
|
||||
|
||||
if (relatedContent) {
|
||||
ret = relatedContent->QueryInterface(kIDOMNodeIID, (void**)aRelatedNode);
|
||||
NS_RELEASE(relatedContent);
|
||||
}
|
||||
else {
|
||||
*aRelatedNode = nsnull;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// nsINSEventInterface
|
||||
NS_METHOD nsDOMEvent::GetLayerX(PRInt32* aLayerX)
|
||||
{
|
||||
if (!mEvent || mEvent->eventStructType != NS_MOUSE_EVENT) {
|
||||
*aLayerX = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float t2p;
|
||||
mPresContext->GetTwipsToPixels(&t2p);
|
||||
*aLayerX = NSTwipsToIntPixels(mEvent->point.x, t2p);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetLayerY(PRInt32* aLayerY)
|
||||
{
|
||||
if (!mEvent || mEvent->eventStructType != NS_MOUSE_EVENT) {
|
||||
*aLayerY = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float t2p;
|
||||
mPresContext->GetTwipsToPixels(&t2p);
|
||||
*aLayerY = NSTwipsToIntPixels(mEvent->point.y, t2p);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetPageX(PRInt32* aPageX)
|
||||
{
|
||||
return GetClientX(aPageX);
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetPageY(PRInt32* aPageY)
|
||||
{
|
||||
return GetClientY(aPageY);
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetWhich(PRUint32* aWhich)
|
||||
{
|
||||
switch (mEvent->eventStructType) {
|
||||
case NS_KEY_EVENT:
|
||||
return GetKeyCode(aWhich);
|
||||
case NS_MOUSE_EVENT:
|
||||
{
|
||||
PRUint16 button;
|
||||
(void) GetButton(&button);
|
||||
*aWhich = button;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
*aWhich = 0;
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
||||
{
|
||||
nsIFrame* targetFrame;
|
||||
nsIEventStateManager* manager;
|
||||
|
||||
if (NS_OK == mPresContext->GetEventStateManager(&manager)) {
|
||||
manager->GetEventTarget(&targetFrame);
|
||||
NS_RELEASE(manager);
|
||||
}
|
||||
|
||||
if (targetFrame) {
|
||||
nsIContent* parent = nsnull;
|
||||
PRInt32 offset, endOffset;
|
||||
PRBool beginOfContent;
|
||||
if (NS_SUCCEEDED(targetFrame->GetContentAndOffsetsFromPoint(mPresContext,
|
||||
mEvent->point,
|
||||
&parent,
|
||||
offset,
|
||||
endOffset,
|
||||
beginOfContent))) {
|
||||
if (parent && NS_SUCCEEDED(parent->QueryInterface(kIDOMNodeIID, (void**)aRangeParent))) {
|
||||
NS_RELEASE(parent);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IF_RELEASE(parent);
|
||||
}
|
||||
}
|
||||
*aRangeParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetRangeOffset(PRInt32* aRangeOffset)
|
||||
{
|
||||
nsIFrame* targetFrame;
|
||||
nsIEventStateManager* manager;
|
||||
|
||||
if (NS_OK == mPresContext->GetEventStateManager(&manager)) {
|
||||
manager->GetEventTarget(&targetFrame);
|
||||
NS_RELEASE(manager);
|
||||
}
|
||||
|
||||
if (targetFrame) {
|
||||
nsIContent* parent = nsnull;
|
||||
PRInt32 endOffset;
|
||||
PRBool beginOfContent;
|
||||
if (NS_SUCCEEDED(targetFrame->GetContentAndOffsetsFromPoint(mPresContext,
|
||||
mEvent->point,
|
||||
&parent,
|
||||
*aRangeOffset,
|
||||
endOffset,
|
||||
beginOfContent))) {
|
||||
NS_IF_RELEASE(parent);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
*aRangeOffset = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetCancelBubble(PRBool* aCancelBubble)
|
||||
{
|
||||
if (mEvent->flags & NS_EVENT_FLAG_BUBBLE || mEvent->flags & NS_EVENT_FLAG_INIT) {
|
||||
*aCancelBubble = (mEvent->flags &= NS_EVENT_FLAG_STOP_DISPATCH) ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
else {
|
||||
*aCancelBubble = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::SetCancelBubble(PRBool aCancelBubble)
|
||||
{
|
||||
if (mEvent->flags & NS_EVENT_FLAG_BUBBLE || mEvent->flags & NS_EVENT_FLAG_INIT) {
|
||||
if (aCancelBubble) {
|
||||
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
}
|
||||
else {
|
||||
mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::GetIsChar(PRBool* aIsChar)
|
||||
{
|
||||
if (!mEvent) {
|
||||
*aIsChar = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
if (mEvent->eventStructType == NS_KEY_EVENT) {
|
||||
*aIsChar = ((nsKeyEvent*)mEvent)->isChar;
|
||||
return NS_OK;
|
||||
}
|
||||
if (mEvent->eventStructType == NS_TEXT_EVENT) {
|
||||
*aIsChar = ((nsTextEvent*)mEvent)->isChar;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aIsChar = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//XXX The following four methods are for custom event dispatch inside the DOM.
|
||||
//They will be implemented post-beta
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMEvent::InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
||||
{
|
||||
//XXX Write me!
|
||||
|
||||
//XXX And when you do, make sure to copy over the event target here, too!
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::SetTarget(nsIDOMNode* aTarget)
|
||||
{
|
||||
if (mTarget != aTarget) {
|
||||
NS_IF_RELEASE(mTarget);
|
||||
NS_IF_ADDREF(aTarget);
|
||||
mTarget = aTarget;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
||||
{
|
||||
switch(aEventType) {
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
return mEventNames[eDOMEvents_mousedown];
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_UP:
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
return mEventNames[eDOMEvents_mouseup];
|
||||
case NS_MOUSE_LEFT_CLICK:
|
||||
case NS_MOUSE_MIDDLE_CLICK:
|
||||
case NS_MOUSE_RIGHT_CLICK:
|
||||
return mEventNames[eDOMEvents_click];
|
||||
case NS_MOUSE_LEFT_DOUBLECLICK:
|
||||
case NS_MOUSE_MIDDLE_DOUBLECLICK:
|
||||
case NS_MOUSE_RIGHT_DOUBLECLICK:
|
||||
return mEventNames[eDOMEvents_dblclick];
|
||||
case NS_MOUSE_ENTER:
|
||||
return mEventNames[eDOMEvents_mouseover];
|
||||
case NS_MOUSE_EXIT:
|
||||
return mEventNames[eDOMEvents_mouseout];
|
||||
case NS_MOUSE_MOVE:
|
||||
return mEventNames[eDOMEvents_mousemove];
|
||||
case NS_KEY_UP:
|
||||
return mEventNames[eDOMEvents_keyup];
|
||||
case NS_KEY_DOWN:
|
||||
return mEventNames[eDOMEvents_keydown];
|
||||
case NS_KEY_PRESS:
|
||||
return mEventNames[eDOMEvents_keypress];
|
||||
case NS_FOCUS_CONTENT:
|
||||
return mEventNames[eDOMEvents_focus];
|
||||
case NS_BLUR_CONTENT:
|
||||
return mEventNames[eDOMEvents_blur];
|
||||
case NS_XUL_CLOSE:
|
||||
return mEventNames[eDOMEvents_close];
|
||||
case NS_PAGE_LOAD:
|
||||
case NS_IMAGE_LOAD:
|
||||
return mEventNames[eDOMEvents_load];
|
||||
case NS_PAGE_UNLOAD:
|
||||
return mEventNames[eDOMEvents_unload];
|
||||
case NS_IMAGE_ABORT:
|
||||
return mEventNames[eDOMEvents_abort];
|
||||
case NS_IMAGE_ERROR:
|
||||
return mEventNames[eDOMEvents_error];
|
||||
case NS_FORM_SUBMIT:
|
||||
return mEventNames[eDOMEvents_submit];
|
||||
case NS_FORM_RESET:
|
||||
return mEventNames[eDOMEvents_reset];
|
||||
case NS_FORM_CHANGE:
|
||||
return mEventNames[eDOMEvents_change];
|
||||
case NS_FORM_SELECTED:
|
||||
return mEventNames[eDOMEvents_select];
|
||||
case NS_FORM_INPUT:
|
||||
return mEventNames[eDOMEvents_input];
|
||||
case NS_PAINT:
|
||||
return mEventNames[eDOMEvents_paint];
|
||||
case NS_TEXT_EVENT:
|
||||
return mEventNames[eDOMEvents_text];
|
||||
case NS_MENU_CREATE:
|
||||
return mEventNames[eDOMEvents_create];
|
||||
case NS_MENU_DESTROY:
|
||||
return mEventNames[eDOMEvents_destroy];
|
||||
case NS_MENU_ACTION:
|
||||
return mEventNames[eDOMEvents_command];
|
||||
case NS_XUL_BROADCAST:
|
||||
return mEventNames[eDOMEvents_broadcast];
|
||||
case NS_XUL_COMMAND_UPDATE:
|
||||
return mEventNames[eDOMEvents_commandupdate];
|
||||
case NS_DRAGDROP_ENTER:
|
||||
return mEventNames[eDOMEvents_dragenter];
|
||||
case NS_DRAGDROP_OVER:
|
||||
return mEventNames[eDOMEvents_dragover];
|
||||
case NS_DRAGDROP_EXIT:
|
||||
return mEventNames[eDOMEvents_dragexit];
|
||||
case NS_DRAGDROP_DROP:
|
||||
return mEventNames[eDOMEvents_dragdrop];
|
||||
case NS_DRAGDROP_GESTURE:
|
||||
return mEventNames[eDOMEvents_draggesture];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent)
|
||||
{
|
||||
nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return it->QueryInterface(kIDOMEventIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
160
mozilla/content/events/src/nsDOMEvent.h
Normal file
160
mozilla/content/events/src/nsDOMEvent.h
Normal file
@@ -0,0 +1,160 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsDOMEvent_h__
|
||||
#define nsDOMEvent_h__
|
||||
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIPrivateCompositionEvent.h"
|
||||
#include "nsIPrivateTextEvent.h"
|
||||
#include "nsIPrivateTextRange.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsGUIEvent.h"
|
||||
class nsIContent;
|
||||
|
||||
class nsDOMEvent : public nsIDOMKeyEvent,
|
||||
public nsIDOMMouseEvent,
|
||||
public nsIDOMNSUIEvent,
|
||||
public nsIPrivateDOMEvent,
|
||||
public nsIPrivateTextEvent,
|
||||
public nsIPrivateCompositionEvent {
|
||||
|
||||
public:
|
||||
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
||||
enum nsDOMEvents {
|
||||
eDOMEvents_mousedown=0,
|
||||
eDOMEvents_mouseup,
|
||||
eDOMEvents_click,
|
||||
eDOMEvents_dblclick,
|
||||
eDOMEvents_mouseover,
|
||||
eDOMEvents_mouseout,
|
||||
eDOMEvents_mousemove,
|
||||
eDOMEvents_keydown,
|
||||
eDOMEvents_keyup,
|
||||
eDOMEvents_keypress,
|
||||
eDOMEvents_focus,
|
||||
eDOMEvents_blur,
|
||||
eDOMEvents_load,
|
||||
eDOMEvents_unload,
|
||||
eDOMEvents_abort,
|
||||
eDOMEvents_error,
|
||||
eDOMEvents_submit,
|
||||
eDOMEvents_reset,
|
||||
eDOMEvents_change,
|
||||
eDOMEvents_select,
|
||||
eDOMEvents_input,
|
||||
eDOMEvents_paint,
|
||||
eDOMEvents_text,
|
||||
eDOMEvents_create,
|
||||
eDOMEvents_close,
|
||||
eDOMEvents_destroy,
|
||||
eDOMEvents_command,
|
||||
eDOMEvents_broadcast,
|
||||
eDOMEvents_commandupdate,
|
||||
eDOMEvents_dragenter,
|
||||
eDOMEvents_dragover,
|
||||
eDOMEvents_dragexit,
|
||||
eDOMEvents_dragdrop,
|
||||
eDOMEvents_draggesture
|
||||
};
|
||||
|
||||
nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent);
|
||||
virtual ~nsDOMEvent();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMEvent Interface
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD GetTarget(nsIDOMNode** aTarget);
|
||||
NS_IMETHOD GetCurrentNode(nsIDOMNode** aCurrentNode);
|
||||
NS_IMETHOD GetEventPhase(PRUint16* aEventPhase);
|
||||
NS_IMETHOD GetBubbles(PRBool* aBubbles);
|
||||
NS_IMETHOD GetCancelable(PRBool* aCancelable);
|
||||
NS_IMETHOD PreventBubble();
|
||||
NS_IMETHOD PreventCapture();
|
||||
NS_IMETHOD PreventDefault();
|
||||
NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg);
|
||||
|
||||
// nsIDOMUIEvent Interface
|
||||
NS_IMETHOD GetView(nsIDOMAbstractView** aView);
|
||||
NS_IMETHOD GetDetail(PRInt32* aDetail);
|
||||
NS_IMETHOD InitUIEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg);
|
||||
|
||||
// nsIDOMMouseEvent Interface and nsIDOMKeyEvent Interface
|
||||
NS_IMETHOD GetScreenX(PRInt32* aScreenX);
|
||||
NS_IMETHOD GetScreenY(PRInt32* aScreenY);
|
||||
NS_IMETHOD GetClientX(PRInt32* aClientX);
|
||||
NS_IMETHOD GetClientY(PRInt32* aClientY);
|
||||
NS_IMETHOD GetAltKey(PRBool* aAltKey);
|
||||
NS_IMETHOD GetCtrlKey(PRBool* aCtrlKey);
|
||||
NS_IMETHOD GetShiftKey(PRBool* aShiftKey);
|
||||
NS_IMETHOD GetMetaKey(PRBool* aMetaKey);
|
||||
NS_IMETHOD GetButton(PRUint16* aButton);
|
||||
NS_IMETHOD GetClickCount(PRUint16* aClickCount);
|
||||
NS_IMETHOD GetRelatedNode(nsIDOMNode** aRelatedNode);
|
||||
NS_IMETHOD GetCharCode(PRUint32* aCharCode);
|
||||
NS_IMETHOD GetKeyCode(PRUint32* aKeyCode);
|
||||
NS_IMETHOD InitMouseEvent(const nsString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg);
|
||||
NS_IMETHOD InitKeyEvent(const nsString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg);
|
||||
|
||||
// nsIDOMNSUIEvent interface
|
||||
NS_IMETHOD GetLayerX(PRInt32* aLayerX);
|
||||
NS_IMETHOD GetLayerY(PRInt32* aLayerY);
|
||||
NS_IMETHOD GetPageX(PRInt32* aClientX);
|
||||
NS_IMETHOD GetPageY(PRInt32* aClientY);
|
||||
NS_IMETHOD GetWhich(PRUint32* aKeyCode);
|
||||
NS_IMETHOD GetRangeParent(nsIDOMNode** aRangeParent);
|
||||
NS_IMETHOD GetRangeOffset(PRInt32* aRangeOffset);
|
||||
NS_IMETHOD GetCancelBubble(PRBool* aCancelBubble);
|
||||
NS_IMETHOD SetCancelBubble(PRBool aCancelBubble);
|
||||
NS_IMETHOD GetIsChar(PRBool* aIsChar);
|
||||
|
||||
// nsIPrivateDOMEvent interface
|
||||
NS_IMETHOD DuplicatePrivateData();
|
||||
NS_IMETHOD SetTarget(nsIDOMNode* aNode);
|
||||
|
||||
// nsIPrivateTextEvent interface
|
||||
NS_IMETHOD GetText(nsString& aText);
|
||||
NS_IMETHOD GetInputRange(nsIPrivateTextRangeList** aInputRange);
|
||||
NS_IMETHOD GetEventReply(nsTextEventReply** aReply);
|
||||
|
||||
// nsIPrivateCompositionEvent interface
|
||||
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
|
||||
|
||||
protected:
|
||||
|
||||
nsEvent* mEvent;
|
||||
nsIPresContext* mPresContext;
|
||||
nsIDOMNode* mTarget;
|
||||
nsString* mText;
|
||||
nsIPrivateTextRangeList* mTextRange;
|
||||
const char* GetEventName(PRUint32 aEventType);
|
||||
};
|
||||
|
||||
#endif // nsDOMEvent_h__
|
||||
45
mozilla/content/events/src/nsDOMEventsIIDs.cpp
Normal file
45
mozilla/content/events/src/nsDOMEventsIIDs.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nsDOMEventsIIDs.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMLoadListener.h"
|
||||
#include "nsIDOMDragListener.h"
|
||||
#include "nsIDOMPaintListener.h"
|
||||
#include "nsIDOMTextListener.h"
|
||||
#include "nsIDOMCompositionListener.h"
|
||||
#include "nsIDOMMenuListener.h"
|
||||
|
||||
NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMMouseMotionListenerIID, NS_IDOMMOUSEMOTIONLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMFocusListenerIID, NS_IDOMFOCUSLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMFormListenerIID, NS_IDOMFORMLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMLoadListenerIID, NS_IDOMLOADLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMDragListenerIID, NS_IDOMDRAGLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMPaintListenerIID, NS_IDOMPAINTLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMTextListenerIID,NS_IDOMTEXTLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMCompositionListenerIID,NS_IDOMCOMPOSITIONLISTENER_IID);
|
||||
NS_DEFINE_IID(kIDOMMenuListenerIID, NS_IDOMMENULISTENER_IID);
|
||||
39
mozilla/content/events/src/nsDOMEventsIIDs.h
Normal file
39
mozilla/content/events/src/nsDOMEventsIIDs.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsDOMEVENTSIIDs_h___
|
||||
#define nsDOMEVENTSIIDs_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
extern const nsIID kIDOMMouseListenerIID;
|
||||
extern const nsIID kIDOMKeyListenerIID;
|
||||
extern const nsIID kIDOMMouseMotionListenerIID;
|
||||
extern const nsIID kIDOMFocusListenerIID;
|
||||
extern const nsIID kIDOMFormListenerIID;
|
||||
extern const nsIID kIDOMLoadListenerIID;
|
||||
extern const nsIID kIDOMDragListenerIID;
|
||||
extern const nsIID kIDOMPaintListenerIID;
|
||||
extern const nsIID kIDOMTextListenerIID;
|
||||
extern const nsIID kIDOMCompositionListenerIID;
|
||||
extern const nsIID kIDOMMenuListenerIID;
|
||||
|
||||
#endif /* nsDOMEVENTSIIDs_h___ */
|
||||
1496
mozilla/content/events/src/nsEventListenerManager.cpp
Normal file
1496
mozilla/content/events/src/nsEventListenerManager.cpp
Normal file
File diff suppressed because it is too large
Load Diff
206
mozilla/content/events/src/nsEventListenerManager.h
Normal file
206
mozilla/content/events/src/nsEventListenerManager.h
Normal file
@@ -0,0 +1,206 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsEventListenerManager_h__
|
||||
#define nsEventListenerManager_h__
|
||||
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
class nsIDOMEvent;
|
||||
class nsIAtom;
|
||||
|
||||
typedef struct {
|
||||
nsIDOMEventListener* mListener;
|
||||
PRUint8 mFlags;
|
||||
PRUint8 mSubType;
|
||||
PRUint32 mHandlerIsString;
|
||||
} nsListenerStruct;
|
||||
|
||||
//Flag must live higher than all event flags in nsGUIEvent.h
|
||||
#define NS_PRIV_EVENT_FLAG_SCRIPT 0x10
|
||||
|
||||
/*
|
||||
* Event listener manager
|
||||
*/
|
||||
|
||||
class nsEventListenerManager : public nsIEventListenerManager {
|
||||
|
||||
public:
|
||||
nsEventListenerManager();
|
||||
virtual ~nsEventListenerManager();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsVoidArray** GetListenersByIID(const nsIID& aIID);
|
||||
|
||||
/**
|
||||
* Retrieves events listeners of all types.
|
||||
* @param
|
||||
*/
|
||||
|
||||
virtual nsresult GetEventListeners(nsVoidArray **aListeners, const nsIID& aIID);
|
||||
|
||||
/**
|
||||
* Sets events listeners of all types.
|
||||
* @param an event listener
|
||||
*/
|
||||
|
||||
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags);
|
||||
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags);
|
||||
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags);
|
||||
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsString& type, PRInt32 aFlags) ;
|
||||
|
||||
virtual nsresult AddScriptEventListener(nsIScriptContext*aContext,
|
||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
||||
nsIAtom *aName,
|
||||
const nsString& aFunc,
|
||||
REFNSIID aIID,
|
||||
PRBool aDeferCompilation);
|
||||
virtual nsresult RegisterScriptEventListener(nsIScriptContext *aContext,
|
||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
||||
nsIAtom* aName,
|
||||
const nsIID& aIID);
|
||||
|
||||
|
||||
virtual nsresult CaptureEvent(nsIDOMEventListener *aListener);
|
||||
virtual nsresult ReleaseEvent(nsIDOMEventListener *aListener);
|
||||
|
||||
virtual nsresult HandleEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
virtual nsresult CreateEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent);
|
||||
|
||||
virtual nsresult RemoveAllListeners(PRBool aScriptOnly);
|
||||
|
||||
static nsresult GetIdentifiersForType(nsIAtom* aType, nsIID& aIID, PRInt32* aSubType);
|
||||
|
||||
protected:
|
||||
nsresult HandleEventSubType(nsListenerStruct* aListenerStruct,
|
||||
nsIDOMEvent* aDOMEvent,
|
||||
PRUint32 aSubType);
|
||||
nsListenerStruct* FindJSEventListener(REFNSIID aIID);
|
||||
nsresult SetJSEventListener(nsIScriptContext *aContext, nsIScriptObjectOwner *aOwner, nsIAtom* aName, REFNSIID aIID, PRBool aIsString);
|
||||
nsresult AddEventListener(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags, PRInt32 aSubType);
|
||||
nsresult RemoveEventListener(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags, PRInt32 aSubType);
|
||||
void ReleaseListeners(nsVoidArray** aListeners, PRBool aScriptOnly);
|
||||
|
||||
nsVoidArray* mEventListeners;
|
||||
nsVoidArray* mMouseListeners;
|
||||
nsVoidArray* mMouseMotionListeners;
|
||||
nsVoidArray* mKeyListeners;
|
||||
nsVoidArray* mLoadListeners;
|
||||
nsVoidArray* mFocusListeners;
|
||||
nsVoidArray* mFormListeners;
|
||||
nsVoidArray* mDragListeners;
|
||||
nsVoidArray* mPaintListeners;
|
||||
nsVoidArray* mTextListeners;
|
||||
nsVoidArray* mCompositionListeners;
|
||||
nsVoidArray* mMenuListeners;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
};
|
||||
|
||||
|
||||
//Set of defines for distinguishing event handlers within listener groupings
|
||||
//XXX Current usage allows no more than 7 types per listener grouping
|
||||
|
||||
#define NS_EVENT_BITS_NONE 0x00
|
||||
|
||||
//nsIDOMMouseListener
|
||||
#define NS_EVENT_BITS_MOUSE_NONE 0x00
|
||||
#define NS_EVENT_BITS_MOUSE_MOUSEDOWN 0x01
|
||||
#define NS_EVENT_BITS_MOUSE_MOUSEUP 0x02
|
||||
#define NS_EVENT_BITS_MOUSE_CLICK 0x04
|
||||
#define NS_EVENT_BITS_MOUSE_DBLCLICK 0x08
|
||||
#define NS_EVENT_BITS_MOUSE_MOUSEOVER 0x10
|
||||
#define NS_EVENT_BITS_MOUSE_MOUSEOUT 0x20
|
||||
|
||||
//nsIDOMMouseMotionListener
|
||||
#define NS_EVENT_BITS_MOUSEMOTION_NONE 0x00
|
||||
#define NS_EVENT_BITS_MOUSEMOTION_MOUSEMOVE 0x01
|
||||
#define NS_EVENT_BITS_MOUSEMOTION_DRAGMOVE 0x02
|
||||
|
||||
//nsIDOMKeyListener
|
||||
#define NS_EVENT_BITS_KEY_NONE 0x00
|
||||
#define NS_EVENT_BITS_KEY_KEYDOWN 0x01
|
||||
#define NS_EVENT_BITS_KEY_KEYUP 0x02
|
||||
#define NS_EVENT_BITS_KEY_KEYPRESS 0x04
|
||||
|
||||
//nsIDOMTextListener
|
||||
#define NS_EVENT_BITS_TEXT_NONE 0x00
|
||||
#define NS_EVENT_BITS_TEXT_TEXT 0x01
|
||||
|
||||
//nsIDOMCompositionListener
|
||||
#define NS_EVENT_BITS_COMPOSITION_NONE 0x00
|
||||
#define NS_EVENT_BITS_COMPOSITION_START 0x01
|
||||
#define NS_EVENT_BITS_COMPOSITION_END 0x02
|
||||
#define NS_EVENT_BITS_COMPOSITION_QUERY 0x04
|
||||
|
||||
//nsIDOMFocusListener
|
||||
#define NS_EVENT_BITS_FOCUS_NONE 0x00
|
||||
#define NS_EVENT_BITS_FOCUS_FOCUS 0x01
|
||||
#define NS_EVENT_BITS_FOCUS_BLUR 0x02
|
||||
|
||||
//nsIDOMFormListener
|
||||
#define NS_EVENT_BITS_FORM_NONE 0x00
|
||||
#define NS_EVENT_BITS_FORM_SUBMIT 0x01
|
||||
#define NS_EVENT_BITS_FORM_RESET 0x02
|
||||
#define NS_EVENT_BITS_FORM_CHANGE 0x04
|
||||
#define NS_EVENT_BITS_FORM_SELECT 0x08
|
||||
#define NS_EVENT_BITS_FORM_INPUT 0x10
|
||||
|
||||
//nsIDOMLoadListener
|
||||
#define NS_EVENT_BITS_LOAD_NONE 0x00
|
||||
#define NS_EVENT_BITS_LOAD_LOAD 0x01
|
||||
#define NS_EVENT_BITS_LOAD_UNLOAD 0x02
|
||||
#define NS_EVENT_BITS_LOAD_ABORT 0x04
|
||||
#define NS_EVENT_BITS_LOAD_ERROR 0x08
|
||||
|
||||
//nsIDOMMenuListener
|
||||
#define NS_EVENT_BITS_MENU_NONE 0x00
|
||||
#define NS_EVENT_BITS_MENU_CREATE 0x01
|
||||
#define NS_EVENT_BITS_XUL_CLOSE 0x02
|
||||
#define NS_EVENT_BITS_MENU_DESTROY 0x04
|
||||
#define NS_EVENT_BITS_MENU_ACTION 0x08
|
||||
#define NS_EVENT_BITS_XUL_BROADCAST 0x10
|
||||
#define NS_EVENT_BITS_XUL_COMMAND_UPDATE 0x20
|
||||
|
||||
//nsIDOMDragListener
|
||||
#define NS_EVENT_BITS_DRAG_NONE 0x00
|
||||
#define NS_EVENT_BITS_DRAG_ENTER 0x01
|
||||
#define NS_EVENT_BITS_DRAG_OVER 0x02
|
||||
#define NS_EVENT_BITS_DRAG_EXIT 0x04
|
||||
#define NS_EVENT_BITS_DRAG_DROP 0x08
|
||||
#define NS_EVENT_BITS_DRAG_GESTURE 0x10
|
||||
|
||||
//nsIDOMPaintListener
|
||||
#define NS_EVENT_BITS_PAINT_NONE 0x00
|
||||
#define NS_EVENT_BITS_PAINT_PAINT 0x01
|
||||
|
||||
#endif // nsEventListenerManager_h__
|
||||
2079
mozilla/content/events/src/nsEventStateManager.cpp
Normal file
2079
mozilla/content/events/src/nsEventStateManager.cpp
Normal file
File diff suppressed because it is too large
Load Diff
147
mozilla/content/events/src/nsEventStateManager.h
Normal file
147
mozilla/content/events/src/nsEventStateManager.h
Normal file
@@ -0,0 +1,147 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsEventStateManager_h__
|
||||
#define nsEventStateManager_h__
|
||||
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
class nsIDocument;
|
||||
class nsIScrollableView;
|
||||
class nsISelfScrollingFrame;
|
||||
|
||||
/*
|
||||
* Event listener manager
|
||||
*/
|
||||
|
||||
class nsEventStateManager : public nsIEventStateManager {
|
||||
|
||||
public:
|
||||
nsEventStateManager();
|
||||
virtual ~nsEventStateManager();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/* The PreHandleEvent method is called before event dispatch to either
|
||||
* the DOM or frames. Any processing which must not be prevented or
|
||||
* cancelled should occur here. Any processing which is intended to
|
||||
* be conditional based on either DOM or frame processing should occur in
|
||||
* PostHandleEvent. Any centralized event processing which must occur before
|
||||
* DOM or frame event handling should occur here as well.
|
||||
*/
|
||||
NS_IMETHOD PreHandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent *aEvent,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsEventStatus* aStatus,
|
||||
nsIView* aView);
|
||||
|
||||
/* The PostHandleEvent method should contain all system processing which
|
||||
* should occur conditionally based on DOM or frame processing. It should
|
||||
* also contain any centralized event processing which must occur after
|
||||
* DOM and frame processing.
|
||||
*/
|
||||
NS_IMETHOD PostHandleEvent(nsIPresContext* aPresContext,
|
||||
nsGUIEvent *aEvent,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsEventStatus* aStatus,
|
||||
nsIView* aView);
|
||||
|
||||
NS_IMETHOD SetPresContext(nsIPresContext* aPresContext);
|
||||
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame);
|
||||
|
||||
NS_IMETHOD GetEventTarget(nsIFrame **aFrame);
|
||||
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
|
||||
NS_IMETHOD GetEventRelatedContent(nsIContent** aContent);
|
||||
|
||||
NS_IMETHOD GetContentState(nsIContent *aContent, PRInt32& aState);
|
||||
NS_IMETHOD SetContentState(nsIContent *aContent, PRInt32 aState);
|
||||
NS_IMETHOD GetFocusedContent(nsIContent **aContent);
|
||||
NS_IMETHOD SetFocusedContent(nsIContent* aContent);
|
||||
|
||||
// Cross ESM methods
|
||||
NS_IMETHOD GetFocusedEventTarget(nsIFrame **aFrame);
|
||||
|
||||
// This is an experiement and may be temporary
|
||||
NS_IMETHOD ConsumeFocusEvents(PRBool aDoConsume) { mConsumeFocusEvents = aDoConsume; return NS_OK; }
|
||||
|
||||
protected:
|
||||
void UpdateCursor(nsIPresContext* aPresContext, nsPoint& aPoint, nsIFrame* aTargetFrame, nsEventStatus* aStatus);
|
||||
void GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIEvent* aEvent);
|
||||
void GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsGUIEvent* aEvent);
|
||||
NS_IMETHOD DispatchKeyPressEvent(nsIPresContext* aPresContext, nsKeyEvent *aEvent, nsEventStatus* aStatus);
|
||||
NS_IMETHOD SetClickCount(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
|
||||
NS_IMETHOD CheckForAndDispatchClick(nsIPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
|
||||
PRBool ChangeFocus(nsIContent* aFocus, nsIFrame* aFocusFrame, PRBool aSetFocus);
|
||||
void ShiftFocus(PRBool foward);
|
||||
nsIContent* GetNextTabbableContent(nsIContent* aParent, nsIContent* aChild, nsIContent* aTop, PRBool foward);
|
||||
PRInt32 GetNextTabIndex(nsIContent* aParent, PRBool foward);
|
||||
NS_IMETHOD SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent);
|
||||
nsIScrollableView* GetNearestScrollingView(nsIView* aView);
|
||||
nsISelfScrollingFrame* GetNearestSelfScrollingFrame(nsIFrame* aFrame);
|
||||
PRBool CheckDisabled(nsIContent* aContent);
|
||||
|
||||
nsIFrame* GetDocumentFrame(nsIPresContext* aPresContext);
|
||||
|
||||
// routines for the d&d gesture tracking state machine
|
||||
void BeginTrackingDragGesture ( nsGUIEvent* inDownEvent, nsIFrame* inDownFrame ) ;
|
||||
void StopTrackingDragGesture ( ) ;
|
||||
void GenerateDragGesture ( nsIPresContext* aPresContext, nsGUIEvent *aEvent ) ;
|
||||
PRBool IsTrackingDragGesture ( ) const { return mIsTrackingDragGesture; }
|
||||
|
||||
//Any frames here must be checked for validity in ClearFrameRefs
|
||||
nsIFrame* mCurrentTarget;
|
||||
nsIContent* mCurrentTargetContent;
|
||||
nsIContent* mCurrentRelatedContent;
|
||||
nsIFrame* mLastMouseOverFrame;
|
||||
nsIFrame* mLastDragOverFrame;
|
||||
|
||||
// member variables for the d&d gesture state machine
|
||||
PRBool mIsTrackingDragGesture;
|
||||
nsPoint mGestureDownPoint;
|
||||
nsIFrame* mGestureDownFrame;
|
||||
|
||||
nsIContent* mLastLeftMouseDownContent;
|
||||
nsIContent* mLastMiddleMouseDownContent;
|
||||
nsIContent* mLastRightMouseDownContent;
|
||||
|
||||
nsIContent* mActiveContent;
|
||||
nsIContent* mHoverContent;
|
||||
nsIContent* mDragOverContent;
|
||||
nsIContent* mCurrentFocus;
|
||||
PRInt32 mCurrentTabIndex;
|
||||
nsIWidget * mLastWindowToHaveFocus; // last native window to get focus via the evs
|
||||
PRBool mConsumeFocusEvents;
|
||||
|
||||
nsIPresContext* mPresContext; // Not refcnted
|
||||
nsIDocument* mDocument; // [OWNER], but doesn't need to be.
|
||||
|
||||
PRUint32 mLClickCount;
|
||||
PRUint32 mMClickCount;
|
||||
PRUint32 mRClickCount;
|
||||
|
||||
static PRUint32 mInstanceCount;
|
||||
|
||||
};
|
||||
|
||||
extern nsresult NS_NewEventStateManager(nsIEventStateManager** aInstancePtrResult);
|
||||
|
||||
#endif // nsEventStateManager_h__
|
||||
153
mozilla/content/events/src/nsPrivateTextRange.cpp
Normal file
153
mozilla/content/events/src/nsPrivateTextRange.cpp
Normal file
@@ -0,0 +1,153 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsPrivateTextRange.h"
|
||||
|
||||
static NS_DEFINE_IID(kIPrivateTextRange, NS_IPRIVATETEXTRANGE_IID);
|
||||
static NS_DEFINE_IID(kIPrivateTextRangeList,NS_IPRIVATETEXTRANGELIST_IID);
|
||||
|
||||
nsPrivateTextRange::nsPrivateTextRange(PRUint16 aRangeStart, PRUint16 aRangeEnd, PRUint16 aRangeType)
|
||||
: mRangeStart(aRangeStart),
|
||||
mRangeEnd(aRangeEnd),
|
||||
mRangeType(aRangeType)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPrivateTextRange::~nsPrivateTextRange(void)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsPrivateTextRange)
|
||||
NS_IMPL_RELEASE(nsPrivateTextRange)
|
||||
|
||||
nsresult nsPrivateTextRange::QueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIPrivateTextRange)) {
|
||||
*aInstancePtrResult = (void*) ((nsIPrivateTextRange*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRange::GetRangeStart(PRUint16* aRangeStart)
|
||||
{
|
||||
*aRangeStart = mRangeStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRange::SetRangeStart(PRUint16 aRangeStart)
|
||||
{
|
||||
mRangeStart = aRangeStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRange::GetRangeEnd(PRUint16* aRangeEnd)
|
||||
{
|
||||
*aRangeEnd = mRangeEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRange::SetRangeEnd(PRUint16 aRangeEnd)
|
||||
{
|
||||
mRangeEnd = aRangeEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRange::GetRangeType(PRUint16* aRangeType)
|
||||
{
|
||||
*aRangeType = mRangeType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRange::SetRangeType(PRUint16 aRangeType)
|
||||
{
|
||||
mRangeType = aRangeType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsPrivateTextRangeList::nsPrivateTextRangeList(PRUint16 aLength,nsIPrivateTextRange** aList)
|
||||
: mLength(aLength),
|
||||
mList(aList)
|
||||
{
|
||||
if (aList==nsnull)
|
||||
aLength = 0;
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsPrivateTextRangeList::~nsPrivateTextRangeList(void)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<mLength;i++)
|
||||
mList[i]->Release();
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsPrivateTextRangeList)
|
||||
NS_IMPL_RELEASE(nsPrivateTextRangeList)
|
||||
|
||||
nsresult nsPrivateTextRangeList::QueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(kIPrivateTextRangeList)) {
|
||||
*aInstancePtrResult = (void*) ((nsIPrivateTextRangeList*)this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRangeList::GetLength(PRUint16* aLength)
|
||||
{
|
||||
*aLength = mLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsPrivateTextRangeList::Item(PRUint16 aIndex, nsIPrivateTextRange** aReturn)
|
||||
{
|
||||
if (aIndex>mLength) {
|
||||
*aReturn = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mList[aIndex]->AddRef();
|
||||
*aReturn = mList[aIndex];
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
71
mozilla/content/events/src/nsPrivateTextRange.h
Normal file
71
mozilla/content/events/src/nsPrivateTextRange.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsPrivateTextRange_h__
|
||||
#define nsPrivateTextRange_h__
|
||||
|
||||
#include "nsIPrivateTextRange.h"
|
||||
|
||||
class nsPrivateTextRange : public nsIPrivateTextRange
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
public:
|
||||
|
||||
nsPrivateTextRange(PRUint16 aRangeStart, PRUint16 aRangeEnd, PRUint16 aRangeType);
|
||||
virtual ~nsPrivateTextRange(void);
|
||||
|
||||
NS_IMETHOD GetRangeStart(PRUint16* aRangeStart);
|
||||
NS_IMETHOD SetRangeStart(PRUint16 aRangeStart);
|
||||
|
||||
NS_IMETHOD GetRangeEnd(PRUint16* aRangeEnd);
|
||||
NS_IMETHOD SetRangeEnd(PRUint16 aRangeEnd);
|
||||
|
||||
NS_IMETHOD GetRangeType(PRUint16* aRangeType);
|
||||
NS_IMETHOD SetRangeType(PRUint16 aRangeType);
|
||||
|
||||
protected:
|
||||
|
||||
PRUint16 mRangeStart;
|
||||
PRUint16 mRangeEnd;
|
||||
PRUint16 mRangeType;
|
||||
};
|
||||
|
||||
class nsPrivateTextRangeList: public nsIPrivateTextRangeList
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
public:
|
||||
|
||||
nsPrivateTextRangeList(PRUint16 aLength,nsIPrivateTextRange** aList);
|
||||
virtual ~nsPrivateTextRangeList(void);
|
||||
|
||||
NS_IMETHOD GetLength(PRUint16* aLength);
|
||||
|
||||
NS_IMETHOD Item(PRUint16 aIndex, nsIPrivateTextRange** aReturn);
|
||||
|
||||
protected:
|
||||
|
||||
PRUint16 mLength;
|
||||
nsIPrivateTextRange** mList;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
32
mozilla/content/html/content/Makefile.in
Normal file
32
mozilla/content/html/content/Makefile.in
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# 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 = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
26
mozilla/content/html/content/makefile.win
Normal file
26
mozilla/content/html/content/makefile.win
Normal file
@@ -0,0 +1,26 @@
|
||||
#!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=src public
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
5
mozilla/content/html/content/public/MANIFEST
Normal file
5
mozilla/content/html/content/public/MANIFEST
Normal file
@@ -0,0 +1,5 @@
|
||||
nsIFocusableContent.h
|
||||
nsIForm.h
|
||||
nsIFormControl.h
|
||||
nsISelectElement.h
|
||||
|
||||
41
mozilla/content/html/content/public/Makefile.in
Normal file
41
mozilla/content/html/content/public/Makefile.in
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = layout
|
||||
|
||||
EXPORTS = \
|
||||
nsIFormControl.h \
|
||||
nsIForm.h \
|
||||
nsIFocusableContent.h \
|
||||
nsISelectElement.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
29
mozilla/content/html/content/public/makefile.win
Normal file
29
mozilla/content/html/content/public/makefile.win
Normal file
@@ -0,0 +1,29 @@
|
||||
#!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=..\..\..\..
|
||||
|
||||
EXPORTS=nsIFormControl.h nsIForm.h nsIFocusableContent.h nsISelectElement.h
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
82
mozilla/content/html/content/public/nsIForm.h
Normal file
82
mozilla/content/html/content/public/nsIForm.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIForm_h___
|
||||
#define nsIForm_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsIFormControl;
|
||||
class nsISizeOfHandler;
|
||||
|
||||
#define NS_FORM_METHOD_GET 0
|
||||
#define NS_FORM_METHOD_POST 1
|
||||
#define NS_FORM_ENCTYPE_URLENCODED 0
|
||||
#define NS_FORM_ENCTYPE_MULTIPART 1
|
||||
|
||||
// IID for the nsIFormManager interface
|
||||
#define NS_IFORM_IID \
|
||||
{ 0xb7e94510, 0x4c19, 0x11d2, \
|
||||
{ 0x80, 0x3f, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
|
||||
|
||||
/**
|
||||
* This interface provides a complete set of methods dealing with
|
||||
* elements which belong to a form element. When nsIDOMHTMLCollection
|
||||
* allows write operations
|
||||
*/
|
||||
class nsIForm : public nsISupports {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Add an element to end of this form's list of elements
|
||||
* @param aElement the element to add
|
||||
* @return NS_OK if the element was successfully added
|
||||
*/
|
||||
NS_IMETHOD AddElement(nsIFormControl* aElement) = 0;
|
||||
|
||||
/**
|
||||
* Get the element at a specified index position
|
||||
* @param aIndex the index
|
||||
* @param aElement the element at that index
|
||||
* @return NS_OK if there was an element at that position, -1 otherwise
|
||||
*/
|
||||
NS_IMETHOD GetElementAt(PRInt32 aIndex, nsIFormControl** aElement) const = 0;
|
||||
|
||||
/**
|
||||
* Get the number of elements in this form
|
||||
* @param aCount the number of elements
|
||||
* @return NS_OK if there was an element at that position, -1 otherwise
|
||||
*/
|
||||
NS_IMETHOD GetElementCount(PRUint32* aCount) const = 0;
|
||||
|
||||
/**
|
||||
* Remove an element from this form's list of elements
|
||||
* @param aElement the element to remove
|
||||
* @param aChildIsRef if PR_TRUE, the elements ref count will be decremented
|
||||
* otherwise not. This is to facilitate circular references.
|
||||
* @return NS_OK if the element was successfully removed.
|
||||
*/
|
||||
NS_IMETHOD RemoveElement(nsIFormControl* aElement,
|
||||
PRBool aChildIsRef = PR_TRUE) = 0;
|
||||
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIForm_h___ */
|
||||
92
mozilla/content/html/content/public/nsIFormControl.h
Normal file
92
mozilla/content/html/content/public/nsIFormControl.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIFormControl_h___
|
||||
#define nsIFormControl_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsIDOMHTMLFormElement;
|
||||
|
||||
#define NS_FORM_BROWSE 0
|
||||
#define NS_FORM_BUTTON_BUTTON 1
|
||||
#define NS_FORM_BUTTON_RESET 2
|
||||
#define NS_FORM_BUTTON_SUBMIT 3
|
||||
#define NS_FORM_FIELDSET 4
|
||||
#define NS_FORM_INPUT_BUTTON 5
|
||||
#define NS_FORM_INPUT_CHECKBOX 6
|
||||
#define NS_FORM_INPUT_FILE 7
|
||||
#define NS_FORM_INPUT_HIDDEN 8
|
||||
#define NS_FORM_INPUT_RESET 9
|
||||
#define NS_FORM_INPUT_IMAGE 10
|
||||
#define NS_FORM_INPUT_PASSWORD 11
|
||||
#define NS_FORM_INPUT_RADIO 12
|
||||
#define NS_FORM_INPUT_SUBMIT 13
|
||||
#define NS_FORM_INPUT_TEXT 14
|
||||
#define NS_FORM_LABEL 15
|
||||
#define NS_FORM_OPTION 16
|
||||
#define NS_FORM_OPTGROUP 17
|
||||
#define NS_FORM_LEGEND 18
|
||||
#define NS_FORM_SELECT 19
|
||||
#define NS_FORM_TEXTAREA 20
|
||||
|
||||
#define NS_FORM_NOTOK 0xFFFFFFF7
|
||||
#define NS_FORM_NOTSET 0xFFFFFFF7
|
||||
|
||||
#define NS_IFORMCONTROL_IID \
|
||||
{ 0x282ff440, 0xcd7e, 0x11d1, \
|
||||
{0x89, 0xad, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
|
||||
/**
|
||||
* Interface which all form controls (e.g. buttons, checkboxes, text,
|
||||
* radio buttons, select, etc) implement in addition to their dom specific interface.
|
||||
**/
|
||||
class nsIFormControl : public nsISupports {
|
||||
public:
|
||||
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IFORMCONTROL_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Get the form for this form control.
|
||||
* @param aForm the form to get
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm) = 0;
|
||||
|
||||
/**
|
||||
* Set the form for this form control.
|
||||
* @param aForm the form
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm) = 0;
|
||||
|
||||
/**
|
||||
* Get the type of this control
|
||||
* @param aType the type to be returned
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD GetType(PRInt32* aType) = 0;
|
||||
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIFormControl_h___ */
|
||||
102
mozilla/content/html/content/public/nsIHTMLContent.h
Normal file
102
mozilla/content/html/content/public/nsIHTMLContent.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsIHTMLContent_h___
|
||||
#define nsIHTMLContent_h___
|
||||
|
||||
#include "nsIStyledContent.h"
|
||||
#include "nsHTMLValue.h"
|
||||
class nsString;
|
||||
class nsIFrame;
|
||||
class nsIStyleRule;
|
||||
class nsIMutableStyleContext;
|
||||
class nsIPresContext;
|
||||
class nsXIFConverter;
|
||||
class nsIHTMLMappedAttributes;
|
||||
class nsIURI;
|
||||
|
||||
// IID for the nsIHTMLContent class
|
||||
#define NS_IHTMLCONTENT_IID \
|
||||
{ 0xb9e110b0, 0x94d6, 0x11d1, \
|
||||
{0x89, 0x5c, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
|
||||
typedef void (*nsMapAttributesFunc)(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
// Abstract interface for all html content
|
||||
class nsIHTMLContent : public nsIStyledContent {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IHTMLCONTENT_IID; return iid; }
|
||||
|
||||
/**
|
||||
* If this html content is a container, then compact asks it to minimize
|
||||
* it's storage usage.
|
||||
*/
|
||||
NS_IMETHOD Compact() = 0;
|
||||
|
||||
NS_IMETHOD SetHTMLAttribute(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
PRBool aNotify) = 0;
|
||||
|
||||
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute,
|
||||
nsHTMLValue& aValue) const = 0;
|
||||
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const = 0;
|
||||
|
||||
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult) = 0;
|
||||
|
||||
/**
|
||||
* Get the base URL for any relative URLs within this piece
|
||||
* of content. Generally, this is the document's base URL,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const = 0;
|
||||
|
||||
/**
|
||||
* Get the base target for any links within this piece
|
||||
* of content. Generally, this is the document's base target,
|
||||
* but certain content carries a local base for backward
|
||||
* compatibility.
|
||||
*/
|
||||
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const = 0;
|
||||
|
||||
/**
|
||||
* Translate this piece of content to html. Note that this only
|
||||
* translates this content object, not any children it might
|
||||
* have. The caller is responsible for recursing down the
|
||||
* hierarchy.
|
||||
*/
|
||||
// XXX add in output character set information so that we know how
|
||||
// to encode non 7 bit characters
|
||||
NS_IMETHOD ToHTMLString(nsString& aResult) const = 0;
|
||||
|
||||
NS_IMETHOD ToHTML(FILE* out) const = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIHTMLContent_h___ */
|
||||
71
mozilla/content/html/content/public/nsISelectElement.h
Normal file
71
mozilla/content/html/content/public/nsISelectElement.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsISelectElement_h___
|
||||
#define nsISelectElement_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// IID for the nsISelect interface
|
||||
#define NS_ISELECTELEMENT_IID \
|
||||
{ 0xa6cf90f6, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
|
||||
/**
|
||||
* This interface is used to notify a SELECT when OPTION
|
||||
* elements are added and removed from its subtree.
|
||||
* Note that the nsIDOMHTMLSelectElement and nsIContent
|
||||
* interfaces are the ones to use to access and enumerate
|
||||
* OPTIONs within a SELECT element.
|
||||
*/
|
||||
class nsISelectElement : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISELECTELEMENT_IID)
|
||||
|
||||
/**
|
||||
* An OPTION element has been added to the SELECT's
|
||||
* subtree.
|
||||
*/
|
||||
NS_IMETHOD AddOption(nsIContent* aContent) = 0;
|
||||
|
||||
/**
|
||||
* An OPTION element has been deleted from the SELECT's
|
||||
* subtree.
|
||||
*/
|
||||
NS_IMETHOD RemoveOption(nsIContent* aContent) = 0;
|
||||
|
||||
/**
|
||||
* Indicates that we're done adding child content
|
||||
* to the select during document loading.
|
||||
*/
|
||||
NS_IMETHOD DoneAddingContent(PRBool aIsDone) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether we're done adding child content
|
||||
* to the select during document loading.
|
||||
*/
|
||||
NS_IMETHOD IsDoneAddingContent(PRBool * aIsDone) = 0;
|
||||
};
|
||||
|
||||
#endif // nsISelectElement_h___
|
||||
|
||||
141
mozilla/content/html/content/src/GenericElementCollection.cpp
Normal file
141
mozilla/content/html/content/src/GenericElementCollection.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
|
||||
#include "GenericElementCollection.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
||||
GenericElementCollection::GenericElementCollection(nsIContent *aParent,
|
||||
nsIAtom *aTag)
|
||||
: nsGenericDOMHTMLCollection()
|
||||
{
|
||||
mParent = aParent;
|
||||
mTag = aTag;
|
||||
NS_IF_ADDREF(aTag);
|
||||
}
|
||||
|
||||
GenericElementCollection::~GenericElementCollection()
|
||||
{
|
||||
// we do NOT have a ref-counted reference to mParent, so do NOT
|
||||
// release it! this is to avoid circular references. The
|
||||
// instantiator who provided mParent is responsible for managing our
|
||||
// reference for us.
|
||||
|
||||
// Release reference on the tag
|
||||
NS_IF_RELEASE(mTag);
|
||||
}
|
||||
|
||||
// we re-count every call. A better implementation would be to set ourselves up as
|
||||
// an observer of contentAppended, contentInserted, and contentDeleted
|
||||
NS_IMETHODIMP
|
||||
GenericElementCollection::GetLength(PRUint32* aLength)
|
||||
{
|
||||
if (nsnull==aLength)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aLength=0;
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull!=mParent)
|
||||
{
|
||||
nsIContent *child=nsnull;
|
||||
PRUint32 childIndex=0;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
while (nsnull!=child)
|
||||
{
|
||||
nsIAtom *childTag;
|
||||
child->GetTag(childTag);
|
||||
if (mTag==childTag)
|
||||
{
|
||||
(*aLength)++;
|
||||
}
|
||||
NS_RELEASE(childTag);
|
||||
NS_RELEASE(child);
|
||||
childIndex++;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GenericElementCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
*aReturn=nsnull;
|
||||
PRUint32 theIndex = 0;
|
||||
nsresult rv = NS_OK;
|
||||
if (nsnull!=mParent)
|
||||
{
|
||||
nsIContent *child=nsnull;
|
||||
PRUint32 childIndex=0;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
while (nsnull!=child)
|
||||
{
|
||||
nsIAtom *childTag;
|
||||
child->GetTag(childTag);
|
||||
if (mTag==childTag)
|
||||
{
|
||||
if (aIndex==theIndex)
|
||||
{
|
||||
child->QueryInterface(kIDOMNodeIID, (void**)aReturn); // out-param addref
|
||||
NS_ASSERTION(nsnull!=aReturn, "content element must be an nsIDOMNode");
|
||||
NS_RELEASE(childTag);
|
||||
NS_RELEASE(child);
|
||||
break;
|
||||
}
|
||||
theIndex++;
|
||||
}
|
||||
NS_RELEASE(childTag);
|
||||
NS_RELEASE(child);
|
||||
childIndex++;
|
||||
mParent->ChildAt(childIndex, child);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GenericElementCollection::NamedItem(const nsString& aName, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (nsnull!=mParent)
|
||||
{
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GenericElementCollection::ParentDestroyed()
|
||||
{
|
||||
// see comment in destructor, do NOT release mParent!
|
||||
mParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult
|
||||
GenericElementCollection::SizeOf(nsISizeOfHandler* aSizer,
|
||||
PRUint32* aResult) const
|
||||
{
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = sizeof(*this);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
58
mozilla/content/html/content/src/GenericElementCollection.h
Normal file
58
mozilla/content/html/content/src/GenericElementCollection.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef GenericElementCollection_h__
|
||||
#define GenericElementCollection_h__
|
||||
|
||||
#include "nsGenericDOMHTMLCollection.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIAtom;
|
||||
|
||||
/**
|
||||
* This class provides a late-bound collection of elements that are
|
||||
* direct decendents of an element.
|
||||
* mParent is NOT ref-counted to avoid circular references
|
||||
*/
|
||||
class GenericElementCollection : public nsGenericDOMHTMLCollection
|
||||
{
|
||||
public:
|
||||
GenericElementCollection(nsIContent *aParent,
|
||||
nsIAtom *aTag);
|
||||
virtual ~GenericElementCollection();
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn);
|
||||
|
||||
NS_IMETHOD ParentDestroyed();
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsIContent * mParent;
|
||||
nsIAtom * mTag;
|
||||
};
|
||||
|
||||
#endif
|
||||
115
mozilla/content/html/content/src/Makefile.in
Normal file
115
mozilla/content/html/content/src/Makefile.in
Normal file
@@ -0,0 +1,115 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = layout
|
||||
LIBRARY_NAME = nglhtmlcon_s
|
||||
|
||||
REQUIRES = xpcom raptor dom js netlib
|
||||
|
||||
CPPSRCS = \
|
||||
nsAttributeContent.cpp \
|
||||
nsGenericHTMLElement.cpp \
|
||||
nsGenericDOMHTMLCollection.cpp \
|
||||
GenericElementCollection.cpp \
|
||||
nsHTMLAnchorElement.cpp \
|
||||
nsHTMLAppletElement.cpp \
|
||||
nsHTMLAreaElement.cpp \
|
||||
nsHTMLBRElement.cpp \
|
||||
nsHTMLBaseElement.cpp \
|
||||
nsHTMLBaseFontElement.cpp \
|
||||
nsHTMLBodyElement.cpp \
|
||||
nsHTMLButtonElement.cpp \
|
||||
nsHTMLDListElement.cpp \
|
||||
nsHTMLDelElement.cpp \
|
||||
nsHTMLDirectoryElement.cpp \
|
||||
nsHTMLDivElement.cpp \
|
||||
nsHTMLEmbedElement.cpp \
|
||||
nsHTMLFieldSetElement.cpp \
|
||||
nsHTMLFontElement.cpp \
|
||||
nsHTMLFormElement.cpp \
|
||||
nsHTMLFrameElement.cpp \
|
||||
nsHTMLFrameSetElement.cpp \
|
||||
nsHTMLHRElement.cpp \
|
||||
nsHTMLHeadElement.cpp \
|
||||
nsHTMLHeadingElement.cpp \
|
||||
nsHTMLHtmlElement.cpp \
|
||||
nsHTMLIFrameElement.cpp \
|
||||
nsHTMLImageElement.cpp \
|
||||
nsHTMLInputElement.cpp \
|
||||
nsHTMLInsElement.cpp \
|
||||
nsHTMLIsIndexElement.cpp \
|
||||
nsHTMLLIElement.cpp \
|
||||
nsHTMLLabelElement.cpp \
|
||||
nsHTMLLayerElement.cpp \
|
||||
nsHTMLLegendElement.cpp \
|
||||
nsHTMLLinkElement.cpp \
|
||||
nsHTMLMapElement.cpp \
|
||||
nsHTMLMenuElement.cpp \
|
||||
nsHTMLMetaElement.cpp \
|
||||
nsHTMLModElement.cpp \
|
||||
nsHTMLOListElement.cpp \
|
||||
nsHTMLObjectElement.cpp \
|
||||
nsHTMLOptionElement.cpp \
|
||||
nsHTMLOptGroupElement.cpp \
|
||||
nsHTMLParagraphElement.cpp \
|
||||
nsHTMLParamElement.cpp \
|
||||
nsHTMLPreElement.cpp \
|
||||
nsHTMLQuoteElement.cpp \
|
||||
nsHTMLScriptElement.cpp \
|
||||
nsHTMLSelectElement.cpp \
|
||||
nsHTMLSpacerElement.cpp \
|
||||
nsHTMLSpanElement.cpp \
|
||||
nsHTMLStyleElement.cpp \
|
||||
nsHTMLTableElement.cpp \
|
||||
nsHTMLTableCaptionElement.cpp \
|
||||
nsHTMLTableCellElement.cpp \
|
||||
nsHTMLTableColElement.cpp \
|
||||
nsHTMLTableColGroupElement.cpp \
|
||||
nsHTMLTableRowElement.cpp \
|
||||
nsHTMLTableSectionElement.cpp \
|
||||
nsHTMLTextAreaElement.cpp \
|
||||
nsHTMLTitleElement.cpp \
|
||||
nsHTMLUListElement.cpp \
|
||||
nsHTMLWBRElement.cpp \
|
||||
nsEditorController.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_HTML
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir)/../../style/src \
|
||||
-I$(srcdir)/../../../base/src \
|
||||
-I$(srcdir)/../../base/src \
|
||||
$(NULL)
|
||||
|
||||
185
mozilla/content/html/content/src/makefile.win
Normal file
185
mozilla/content/html/content/src/makefile.win
Normal file
@@ -0,0 +1,185 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
LIBRARY_NAME = nglhtmlcon_s
|
||||
MODULE=raptor
|
||||
REQUIRES=xpcom raptor js
|
||||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
!if defined(XP_NEW_SELECTION)
|
||||
DEFINES = $(DEFINES) -DXP_NEW_SELECTION
|
||||
!endif
|
||||
|
||||
CPPSRCS= \
|
||||
nsAttributeContent.cpp \
|
||||
nsGenericHTMLElement.cpp \
|
||||
nsGenericDOMHTMLCollection.cpp \
|
||||
GenericElementCollection.cpp \
|
||||
nsHTMLAnchorElement.cpp \
|
||||
nsHTMLAppletElement.cpp \
|
||||
nsHTMLAreaElement.cpp \
|
||||
nsHTMLBRElement.cpp \
|
||||
nsHTMLBaseElement.cpp \
|
||||
nsHTMLBaseFontElement.cpp \
|
||||
nsHTMLBodyElement.cpp \
|
||||
nsHTMLButtonElement.cpp \
|
||||
nsHTMLDListElement.cpp \
|
||||
nsHTMLDelElement.cpp \
|
||||
nsHTMLDirectoryElement.cpp \
|
||||
nsHTMLDivElement.cpp \
|
||||
nsHTMLEmbedElement.cpp \
|
||||
nsHTMLFieldSetElement.cpp \
|
||||
nsHTMLFontElement.cpp \
|
||||
nsHTMLFormElement.cpp \
|
||||
nsHTMLFrameElement.cpp \
|
||||
nsHTMLFrameSetElement.cpp \
|
||||
nsHTMLHRElement.cpp \
|
||||
nsHTMLHeadElement.cpp \
|
||||
nsHTMLHeadingElement.cpp \
|
||||
nsHTMLHtmlElement.cpp \
|
||||
nsHTMLIFrameElement.cpp \
|
||||
nsHTMLImageElement.cpp \
|
||||
nsHTMLInputElement.cpp \
|
||||
nsHTMLInsElement.cpp \
|
||||
nsHTMLIsIndexElement.cpp \
|
||||
nsHTMLLIElement.cpp \
|
||||
nsHTMLLabelrElement.cpp \
|
||||
nsHTMLLayerElement.cpp \
|
||||
nsHTMLLegendElement.cpp \
|
||||
nsHTMLLinkElement.cpp \
|
||||
nsHTMLMapElement.cpp \
|
||||
nsHTMLMenuElement.cpp \
|
||||
nsHTMLMetaElement.cpp \
|
||||
nsHTMLModElement.cpp \
|
||||
nsHTMLOListElement.cpp \
|
||||
nsHTMLObjectElement.cpp \
|
||||
nsHTMLOptionElement.cpp \
|
||||
nsHTMLOptGroupElement.cpp \
|
||||
nsHTMLParagraphElement.cpp \
|
||||
nsHTMLParamElement.cpp \
|
||||
nsHTMLPreElement.cpp \
|
||||
nsHTMLQuoteElement.cpp \
|
||||
nsHTMLScriptElement.cpp \
|
||||
nsHTMLSelectElement.cpp \
|
||||
nsHTMLSpacerElement.cpp \
|
||||
nsHTMLSpanElement.cpp \
|
||||
nsHTMLStyleElement.cpp \
|
||||
nsHTMLTableElement.cpp \
|
||||
nsHTMLTableCaptionElement.cpp \
|
||||
nsHTMLTableCellElement.cpp \
|
||||
nsHTMLTableColElement.cpp \
|
||||
nsHTMLTableColGroupElement.cpp \
|
||||
nsHTMLTableRowElement.cpp \
|
||||
nsHTMLTableSectionElement.cpp \
|
||||
nsHTMLTextAreaElement.cpp \
|
||||
nsHTMLTitleElement.cpp \
|
||||
nsHTMLUListElement.cpp \
|
||||
nsHTMLWBRElement.cpp \
|
||||
nsEditorController.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsAttributeContent.obj \
|
||||
.\$(OBJDIR)\nsGenericHTMLElement.obj \
|
||||
.\$(OBJDIR)\nsGenericDOMHTMLCollection.obj \
|
||||
.\$(OBJDIR)\GenericElementCollection.obj \
|
||||
.\$(OBJDIR)\nsHTMLAnchorElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLAppletElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLAreaElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLBRElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLBaseElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLBaseFontElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLBodyElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLButtonElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLDListElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLDelElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLDirectoryElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLDivElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLEmbedElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLFieldSetElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLFontElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLFormElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLFrameElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLFrameSetElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLHRElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLHeadElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLHeadingElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLHtmlElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLIFrameElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLImageElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLInputElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLInsElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLIsIndexElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLLIElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLLabelElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLLayerElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLLegendElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLLinkElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLMapElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLMenuElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLMetaElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLModElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLOListElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLObjectElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLOptionElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLOptGroupElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLParagraphElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLParamElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLPreElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLQuoteElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLScriptElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLSelectElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLSpacerElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLSpanElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLStyleElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableCaptionElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableCellElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableColElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableColGroupElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableRowElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableSectionElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTextAreaElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLTitleElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLUListElement.obj \
|
||||
.\$(OBJDIR)\nsHTMLWBRElement.obj \
|
||||
.\$(OBJDIR)\nsEditorController.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\netlib \
|
||||
-I..\..\style\src \
|
||||
-I..\..\..\base\src -I..\..\base\src \
|
||||
-I$(PUBLIC)\plugin -I$(PUBLIC)\oji -I$(PUBLIC)\java
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
547
mozilla/content/html/content/src/nsAttributeContent.cpp
Normal file
547
mozilla/content/html/content/src/nsAttributeContent.cpp
Normal file
@@ -0,0 +1,547 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIAttributeContent.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsXIFConverter.h"
|
||||
#include "nsRange.h"
|
||||
|
||||
#include "nsIDOMSelection.h"
|
||||
#include "nsIEnumerator.h"
|
||||
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "prprf.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsITextContent.h"
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMEventListener;
|
||||
class nsIDOMNodeList;
|
||||
class nsIEventListenerManager;
|
||||
class nsIFrame;
|
||||
class nsIStyleContext;
|
||||
class nsIStyleRule;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMText;
|
||||
|
||||
|
||||
// XXX share all id's in this dir
|
||||
|
||||
NS_DEFINE_IID(kIDOMCharacterDataIID, NS_IDOMCHARACTERDATA_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIPrivateDOMEventIID, NS_IPRIVATEDOMEVENT_IID);
|
||||
static NS_DEFINE_IID(kIEnumeratorIID, NS_IENUMERATOR_IID);
|
||||
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID);
|
||||
static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID);
|
||||
|
||||
|
||||
class nsAttributeContent : public nsIContent, public nsITextContent, public nsIAttributeContent {
|
||||
public:
|
||||
friend nsresult NS_NewAttributeContent(nsAttributeContent** aNewFrame);
|
||||
|
||||
nsAttributeContent();
|
||||
virtual ~nsAttributeContent();
|
||||
|
||||
NS_IMETHOD Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttrName);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// Implementation for nsIContent
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const;
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep);
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const;
|
||||
NS_IMETHOD SetParent(nsIContent* aParent);
|
||||
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult) {
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aID) const {
|
||||
aID = kNameSpaceID_None;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const {
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr,
|
||||
nsIAtom*& aName,
|
||||
PRInt32& aNameSpaceID) {
|
||||
aName = nsnull;
|
||||
aNameSpaceID = kNameSpaceID_None;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
|
||||
nsIAtom*& aPrefix) {
|
||||
aPrefix = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsString& aValue,
|
||||
PRBool aNotify) { return NS_OK; }
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { return NS_OK; }
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsString &aResult) const {return NS_CONTENT_ATTR_NOT_THERE; }
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID, nsIAtom*& aName) const {
|
||||
aName = nsnull;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const { aResult = 0; return NS_OK; }
|
||||
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const { return NS_OK; }
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
NS_IMETHOD GetContentID(PRUint32* aID) {
|
||||
*aID = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetContentID(PRUint32 aID) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange);
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange);
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const;
|
||||
|
||||
// Implementation for nsIContent
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const;
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const { aResult = PR_FALSE; return NS_OK; }
|
||||
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const { aResult = 0; return NS_OK; }
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const { aResult = nsnull; return NS_OK; }
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const { aResult = -1; return NS_OK; }
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) { return NS_OK; }
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) { return NS_OK; }
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify) { return NS_OK; }
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify) { return NS_OK; }
|
||||
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn){ return NS_OK; }
|
||||
|
||||
///////////////////
|
||||
// Implementation for nsITextContent
|
||||
NS_IMETHOD GetText(const nsTextFragment** aFragmentsResult);
|
||||
NS_IMETHOD GetTextLength(PRInt32* aLengthResult);
|
||||
NS_IMETHOD CopyText(nsString& aResult);
|
||||
NS_IMETHOD SetText(const PRUnichar* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify);
|
||||
NS_IMETHOD SetText(const char* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify);
|
||||
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult);
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
void ValidateTextFragment();
|
||||
|
||||
void ToCString(nsString& aBuf, PRInt32 aOffset, PRInt32 aLen) const;
|
||||
|
||||
// Up pointer to the real content object that we are
|
||||
// supporting. Sometimes there is work that we just can't do
|
||||
// ourselves, so this is needed to ask the real object to do the
|
||||
// work.
|
||||
nsIContent* mContent;
|
||||
nsIDocument* mDocument;
|
||||
nsIContent* mParent;
|
||||
|
||||
nsTextFragment mText;
|
||||
PRInt32 mNameSpaceID;
|
||||
nsIAtom* mAttrName;
|
||||
|
||||
};
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsAttributeContent)
|
||||
|
||||
NS_IMPL_RELEASE(nsAttributeContent)
|
||||
|
||||
|
||||
nsresult
|
||||
NS_NewAttributeContent(nsIContent** aContent)
|
||||
{
|
||||
NS_PRECONDITION(aContent, "null OUT ptr");
|
||||
if (nsnull == aContent) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsAttributeContent* it = new nsAttributeContent;
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return NS_SUCCEEDED(it->QueryInterface(nsCOMTypeInfo<nsIContent>::GetIID(), (void **)aContent)) ?
|
||||
NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsAttributeContent::nsAttributeContent()
|
||||
: mText()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mDocument = nsnull;
|
||||
mParent = nsnull;
|
||||
mContent = nsnull;
|
||||
mAttrName = nsnull;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
nsAttributeContent::~nsAttributeContent()
|
||||
{
|
||||
NS_IF_RELEASE(mAttrName);
|
||||
//NS_IF_RELEASE(mDocument);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsAttributeContent::Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttrName)
|
||||
{
|
||||
NS_ASSERTION((nsnull == mContent) && (nsnull != aContent), "null ptr");
|
||||
mContent = aContent;
|
||||
|
||||
NS_IF_RELEASE(mAttrName);
|
||||
mNameSpaceID = aNameSpaceID;
|
||||
mAttrName = aAttrName;
|
||||
NS_ADDREF(mAttrName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param aIID The name of the class implementing the method
|
||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||
*
|
||||
*/
|
||||
nsresult nsAttributeContent::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIContent>::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIContent*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsITextContent>::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsITextContent*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIAttributeContent>::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIAttributeContent*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)(nsIContent*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Implementation of nsIContent
|
||||
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::BeginConvertToXIF(nsXIFConverter& aConverter) const
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::FinishConvertToXIF(nsXIFConverter& aConverter) const
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate the content object into the (XIF) XML Interchange Format
|
||||
* XIF is an intermediate form of the content model, the buffer
|
||||
* will then be parsed into any number of formats including HTML, TXT, etc.
|
||||
*/
|
||||
nsresult
|
||||
nsAttributeContent::ConvertContentToXIF(nsXIFConverter& aConverter) const
|
||||
{
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsAttributeContent::ToCString(nsString& aBuf, PRInt32 aOffset,
|
||||
PRInt32 aLen) const
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::GetDocument(nsIDocument*& aResult) const
|
||||
{
|
||||
aResult = mDocument;
|
||||
NS_IF_ADDREF(mDocument);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::SetDocument(nsIDocument* aDocument, PRBool aDeep)
|
||||
{
|
||||
mDocument = aDocument;
|
||||
//NS_IF_ADDREF(mDocument);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::GetParent(nsIContent*& aResult) const
|
||||
{
|
||||
NS_IF_ADDREF(mParent);
|
||||
aResult = mParent;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::SetParent(nsIContent* aParent)
|
||||
{
|
||||
mParent = aParent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::RangeAdd(nsIDOMRange& aRange)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::RangeRemove(nsIDOMRange& aRange)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::GetRangeList(nsVoidArray*& aResult) const
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Implementation of the nsITextContent interface
|
||||
|
||||
void
|
||||
nsAttributeContent::ValidateTextFragment()
|
||||
{
|
||||
if (nsnull != mContent) {
|
||||
nsAutoString result;
|
||||
mContent->GetAttribute(mNameSpaceID, mAttrName, result);
|
||||
|
||||
PRUnichar * text = result.ToNewUnicode();
|
||||
mText.SetTo(text, result.Length());
|
||||
nsCRT::free(text);
|
||||
}
|
||||
else {
|
||||
mText.SetTo("", 0);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::GetText(const nsTextFragment** aFragmentsResult)
|
||||
{
|
||||
ValidateTextFragment();
|
||||
if (nsnull != mContent) {
|
||||
*aFragmentsResult = &mText;
|
||||
return NS_OK;
|
||||
}
|
||||
// XXX is this a good idea, or should we just return an empty
|
||||
// fragment with no data in it?
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::GetTextLength(PRInt32* aLengthResult)
|
||||
{
|
||||
if (!aLengthResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
ValidateTextFragment();
|
||||
*aLengthResult = mText.GetLength();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::CopyText(nsString& aResult)
|
||||
{
|
||||
ValidateTextFragment();
|
||||
if (mText.Is2b()) {
|
||||
aResult.SetString(mText.Get2b(), mText.GetLength());
|
||||
}
|
||||
else {
|
||||
aResult.SetString(mText.Get1b(), mText.GetLength());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX shouldn't these update mContent's attribute?
|
||||
nsresult
|
||||
nsAttributeContent::SetText(const PRUnichar* aBuffer, PRInt32 aLength,
|
||||
PRBool aNotify)
|
||||
{
|
||||
NS_PRECONDITION((aLength >= 0) && (nsnull != aBuffer), "bad args");
|
||||
if (aLength < 0) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
if (nsnull == aBuffer) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
mText.SetTo(aBuffer, aLength);
|
||||
|
||||
// Trigger a reflow
|
||||
if (aNotify && (nsnull != mDocument)) {
|
||||
mDocument->ContentChanged(mContent, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX shouldn't these update mContent's attribute?
|
||||
nsresult
|
||||
nsAttributeContent::SetText(const char* aBuffer,
|
||||
PRInt32 aLength,
|
||||
PRBool aNotify)
|
||||
{
|
||||
NS_PRECONDITION((aLength >= 0) && (nsnull != aBuffer), "bad args");
|
||||
if (aLength < 0) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
if (nsnull == aBuffer) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
mText.SetTo(aBuffer, aLength);
|
||||
|
||||
// Trigger a reflow
|
||||
if (aNotify && (nsnull != mDocument)) {
|
||||
mDocument->ContentChanged(mContent, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsAttributeContent::IsOnlyWhitespace(PRBool* aResult)
|
||||
{
|
||||
ValidateTextFragment();
|
||||
|
||||
nsTextFragment& frag = mText;
|
||||
if (frag.Is2b()) {
|
||||
const PRUnichar* cp = frag.Get2b();
|
||||
const PRUnichar* end = cp + frag.GetLength();
|
||||
while (cp < end) {
|
||||
PRUnichar ch = *cp++;
|
||||
if (!XP_IS_SPACE(ch)) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const char* cp = frag.Get1b();
|
||||
const char* end = cp + frag.GetLength();
|
||||
while (cp < end) {
|
||||
PRUnichar ch = PRUnichar(*(unsigned char*)cp);
|
||||
cp++;
|
||||
if (!XP_IS_SPACE(ch)) {
|
||||
*aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAttributeContent::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
||||
*aResult = sizeof(*this);
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nslayout.h"
|
||||
#include "nsGenericDOMHTMLCollection.h"
|
||||
|
||||
|
||||
nsGenericDOMHTMLCollection::nsGenericDOMHTMLCollection()
|
||||
{
|
||||
mRefCnt = 0;
|
||||
mScriptObject = nsnull;
|
||||
}
|
||||
|
||||
nsGenericDOMHTMLCollection::~nsGenericDOMHTMLCollection()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericDOMHTMLCollection::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLCollectionIID, NS_IDOMHTMLCOLLECTION_IID);
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
if (aIID.Equals(kIDOMHTMLCollectionIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMHTMLCollection*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
*aInstancePtr = (void*)(nsIScriptObjectOwner*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)(nsIDOMHTMLCollection*)this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsGenericDOMHTMLCollection)
|
||||
NS_IMPL_RELEASE(nsGenericDOMHTMLCollection)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericDOMHTMLCollection::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if (nsnull == mScriptObject) {
|
||||
res = NS_NewScriptHTMLCollection(aContext, (nsISupports *)(nsIDOMHTMLCollection *)this, nsnull, (void**)&mScriptObject);
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericDOMHTMLCollection::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsGenericDOMHTMLCollection_h__
|
||||
#define nsGenericDOMHTMLCollection_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
/**
|
||||
* This is a base class for a generic HTML collection. The base class
|
||||
* provides implementations for nsISupports and nsIScriptObjectOwner,
|
||||
* but it is up to the subclass to implement the core HTML collection
|
||||
* methods:
|
||||
* GetLength
|
||||
* Item
|
||||
* NamedItem
|
||||
*
|
||||
*/
|
||||
class nsGenericDOMHTMLCollection : public nsIDOMHTMLCollection,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
nsGenericDOMHTMLCollection();
|
||||
virtual ~nsGenericDOMHTMLCollection();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// The following need to be defined in the subclass
|
||||
// nsIDOMHTMLCollection interface
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMNode** aReturn)=0;
|
||||
|
||||
protected:
|
||||
void* mScriptObject;
|
||||
};
|
||||
|
||||
#endif // nsGenericDOMHTMLCollection_h__
|
||||
2985
mozilla/content/html/content/src/nsGenericHTMLElement.cpp
Normal file
2985
mozilla/content/html/content/src/nsGenericHTMLElement.cpp
Normal file
File diff suppressed because it is too large
Load Diff
651
mozilla/content/html/content/src/nsGenericHTMLElement.h
Normal file
651
mozilla/content/html/content/src/nsGenericHTMLElement.h
Normal file
@@ -0,0 +1,651 @@
|
||||
/* -*- 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsGenericHTMLElement_h___
|
||||
#define nsGenericHTMLElement_h___
|
||||
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsHTMLValue.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsINameSpaceManager.h" // for kNameSpaceID_HTML
|
||||
|
||||
extern const nsIID kIDOMHTMLElementIID;
|
||||
extern const nsIID kIHTMLContentIID;
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMEventListener;
|
||||
class nsIDOMNodeList;
|
||||
class nsIEventListenerManager;
|
||||
class nsIFrame;
|
||||
class nsIHTMLAttributes;
|
||||
class nsIHTMLMappedAttributes;
|
||||
class nsIHTMLContent;
|
||||
class nsIMutableStyleContext;
|
||||
class nsIStyleRule;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMScriptObjectFactory;
|
||||
class nsChildContentList;
|
||||
class nsDOMCSSDeclaration;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
class nsIURI;
|
||||
class nsIFormControlFrame;
|
||||
class nsIFormControl;
|
||||
class nsIForm;
|
||||
|
||||
class nsGenericHTMLElement : public nsGenericElement {
|
||||
public:
|
||||
nsGenericHTMLElement();
|
||||
~nsGenericHTMLElement();
|
||||
|
||||
nsresult CopyInnerTo(nsIContent* aSrcContent,
|
||||
nsGenericHTMLElement* aDest,
|
||||
PRBool aDeep);
|
||||
|
||||
// Implementation for nsIDOMNode
|
||||
nsresult GetNodeName(nsString& aNodeName);
|
||||
|
||||
// Implementation for nsIDOMElement
|
||||
nsresult GetAttribute(const nsString& aName, nsString& aReturn)
|
||||
{
|
||||
return nsGenericElement::GetAttribute(aName, aReturn);
|
||||
}
|
||||
nsresult SetAttribute(const nsString& aName, const nsString& aValue)
|
||||
{
|
||||
return nsGenericElement::SetAttribute(aName, aValue);
|
||||
}
|
||||
nsresult GetTagName(nsString& aTagName);
|
||||
|
||||
// Implementation for nsIDOMHTMLElement
|
||||
nsresult GetId(nsString& aId);
|
||||
nsresult SetId(const nsString& aId);
|
||||
nsresult GetTitle(nsString& aTitle);
|
||||
nsresult SetTitle(const nsString& aTitle);
|
||||
nsresult GetLang(nsString& aLang);
|
||||
nsresult SetLang(const nsString& aLang);
|
||||
nsresult GetDir(nsString& aDir);
|
||||
nsresult SetDir(const nsString& aDir);
|
||||
nsresult GetClassName(nsString& aClassName);
|
||||
nsresult SetClassName(const nsString& aClassName);
|
||||
nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
|
||||
|
||||
// Implementation for nsIContent
|
||||
nsresult GetNameSpaceID(PRInt32& aNameSpaceID) const;
|
||||
nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep);
|
||||
nsresult ParseAttributeString(const nsString& aStr,
|
||||
nsIAtom*& aName,
|
||||
PRInt32& aNameSpaceID);
|
||||
nsresult GetNameSpacePrefixFromId(PRInt32 aNameSpaceID,
|
||||
nsIAtom*& aPrefix);
|
||||
nsresult SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue,
|
||||
PRBool aNotify);
|
||||
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const;
|
||||
nsresult UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify);
|
||||
nsresult GetAttributeNameAt(PRInt32 aIndex,
|
||||
PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName) const;
|
||||
nsresult GetAttributeCount(PRInt32& aResult) const;
|
||||
nsresult List(FILE* out, PRInt32 aIndent) const;
|
||||
nsresult SetParentForFormControls(nsIContent* aParent,
|
||||
nsIFormControl* aControl,
|
||||
nsIForm* aForm);
|
||||
nsresult SetDocumentForFormControls(nsIDocument* aDocument,
|
||||
PRBool aDeep,
|
||||
nsIFormControl* aControl,
|
||||
nsIForm* aForm);
|
||||
|
||||
// Implementation for nsIHTMLContent
|
||||
nsresult Compact();
|
||||
nsresult SetHTMLAttribute(nsIAtom* aAttribute, const nsHTMLValue& aValue,
|
||||
PRBool aNotify);
|
||||
nsresult GetHTMLAttribute(nsIAtom* aAttribute, nsHTMLValue& aValue) const;
|
||||
nsresult GetID(nsIAtom*& aResult) const;
|
||||
nsresult GetClasses(nsVoidArray& aArray) const;
|
||||
nsresult HasClass(nsIAtom* aClass) const;
|
||||
nsresult GetContentStyleRules(nsISupportsArray* aRules);
|
||||
nsresult GetInlineStyleRules(nsISupportsArray* aRules);
|
||||
nsresult GetBaseURL(nsIURI*& aBaseURL) const;
|
||||
nsresult GetBaseTarget(nsString& aBaseTarget) const;
|
||||
nsresult ToHTMLString(nsString& aResult) const;
|
||||
nsresult ToHTML(FILE* out) const;
|
||||
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult,
|
||||
size_t aInstanceSize) const;
|
||||
|
||||
//----------------------------------------
|
||||
nsresult AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const;
|
||||
|
||||
void ListAttributes(FILE* out) const;
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// Attribute parsing utilities
|
||||
|
||||
struct EnumTable {
|
||||
const char* tag;
|
||||
PRInt32 value;
|
||||
};
|
||||
|
||||
static PRBool ParseEnumValue(const nsString& aValue,
|
||||
EnumTable* aTable,
|
||||
nsHTMLValue& aResult);
|
||||
|
||||
static PRBool ParseCaseSensitiveEnumValue(const nsString& aValue,
|
||||
EnumTable* aTable,
|
||||
nsHTMLValue& aResult);
|
||||
|
||||
static PRBool EnumValueToString(const nsHTMLValue& aValue,
|
||||
EnumTable* aTable,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ParseValueOrPercent(const nsString& aString,
|
||||
nsHTMLValue& aResult,
|
||||
nsHTMLUnit aValueUnit);
|
||||
|
||||
static PRBool ParseValueOrPercentOrProportional(const nsString& aString,
|
||||
nsHTMLValue& aResult,
|
||||
nsHTMLUnit aValueUnit);
|
||||
|
||||
static PRBool ValueOrPercentToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ValueOrPercentOrProportionalToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ParseValue(const nsString& aString, PRInt32 aMin,
|
||||
nsHTMLValue& aResult, nsHTMLUnit aValueUnit);
|
||||
|
||||
static PRBool ParseValue(const nsString& aString, PRInt32 aMin, PRInt32 aMax,
|
||||
nsHTMLValue& aResult, nsHTMLUnit aValueUnit);
|
||||
|
||||
static PRBool ParseColor(const nsString& aString, nsIDocument* aDocument,
|
||||
nsHTMLValue& aResult);
|
||||
|
||||
static PRBool ColorToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ParseCommonAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult);
|
||||
static PRBool ParseAlignValue(const nsString& aString, nsHTMLValue& aResult);
|
||||
|
||||
PRBool ParseDivAlignValue(const nsString& aString,
|
||||
nsHTMLValue& aResult) const;
|
||||
PRBool DivAlignValueToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult) const;
|
||||
|
||||
PRBool ParseTableHAlignValue(const nsString& aString,
|
||||
nsHTMLValue& aResult) const;
|
||||
PRBool TableHAlignValueToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult) const;
|
||||
|
||||
PRBool ParseTableCellHAlignValue(const nsString& aString,
|
||||
nsHTMLValue& aResult) const;
|
||||
PRBool TableCellHAlignValueToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult) const;
|
||||
|
||||
static PRBool ParseTableVAlignValue(const nsString& aString,
|
||||
nsHTMLValue& aResult);
|
||||
|
||||
static PRBool TableVAlignValueToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool AlignValueToString(const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ParseImageAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aString,
|
||||
nsHTMLValue& aResult);
|
||||
|
||||
static PRBool ImageAttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ParseFrameborderValue(PRBool aStandardMode,
|
||||
const nsString& aString,
|
||||
nsHTMLValue& aResult);
|
||||
|
||||
static PRBool FrameborderValueToString(PRBool aStandardMode,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
static PRBool ParseScrollingValue(PRBool aStandardMode,
|
||||
const nsString& aString,
|
||||
nsHTMLValue& aResult);
|
||||
|
||||
static PRBool ScrollingValueToString(PRBool aStandardMode,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult);
|
||||
|
||||
nsresult ReparseStyleAttribute(void);
|
||||
nsresult ParseStyleAttribute(const nsString& aValue, nsHTMLValue& aResult);
|
||||
|
||||
/** Attribute Mapping Helpers
|
||||
*
|
||||
* All attributes that are mapped into style contexts must have a
|
||||
* matched set of mapping function and impact getter
|
||||
*/
|
||||
|
||||
static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aStyleContext,
|
||||
nsIPresContext* aPresContext);
|
||||
static PRBool GetCommonMappedAttributesImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint);
|
||||
|
||||
static void MapImageAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
static PRBool GetImageMappedAttributesImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint);
|
||||
|
||||
static void MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
static PRBool GetImageAlignAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint);
|
||||
|
||||
static void MapImageBorderAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext,
|
||||
nscolor aBorderColors[4]);
|
||||
static PRBool GetImageBorderAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint);
|
||||
|
||||
static void MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint);
|
||||
|
||||
//XXX These two creates a dependency between content and frames
|
||||
static nsresult GetPrimaryFrame(nsIHTMLContent* aContent,
|
||||
nsIFormControlFrame *&aFormControlFrame);
|
||||
static nsresult GetPresContext(nsIHTMLContent* aContent, nsIPresContext** aPresContext);
|
||||
|
||||
static nsresult GetBaseURL(const nsHTMLValue& aBaseHref,
|
||||
nsIDocument* aDocument,
|
||||
nsIURI** aResult);
|
||||
|
||||
// See if the content object is in a document that has nav-quirks
|
||||
// mode enabled.
|
||||
PRBool InNavQuirksMode() const;
|
||||
|
||||
nsIHTMLAttributes* mAttributes;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsGenericHTMLLeafElement : public nsGenericHTMLElement {
|
||||
public:
|
||||
nsGenericHTMLLeafElement();
|
||||
~nsGenericHTMLLeafElement();
|
||||
|
||||
nsresult CopyInnerTo(nsIContent* aSrcContent,
|
||||
nsGenericHTMLLeafElement* aDest,
|
||||
PRBool aDeep);
|
||||
|
||||
// Remainder of nsIDOMHTMLElement (and nsIDOMNode)
|
||||
nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
|
||||
nsresult HasChildNodes(PRBool* aHasChildNodes) {
|
||||
*aHasChildNodes = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetFirstChild(nsIDOMNode** aFirstChild) {
|
||||
*aFirstChild = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult GetLastChild(nsIDOMNode** aLastChild) {
|
||||
*aLastChild = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
|
||||
nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
|
||||
nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Remainder of nsIHTMLContent (and nsIContent)
|
||||
nsresult BeginConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult ConvertContentToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult FinishConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult Compact() {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult CanContainChildren(PRBool& aResult) const {
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult ChildCount(PRInt32& aResult) const {
|
||||
aResult = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult ChildAt(PRInt32 aIndex, nsIContent*& aResult) const {
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const {
|
||||
aResult = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult RemoveChildAt(PRInt32 aIndex, PRBool aNotify) {
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsGenericHTMLContainerElement : public nsGenericHTMLElement {
|
||||
public:
|
||||
nsGenericHTMLContainerElement();
|
||||
~nsGenericHTMLContainerElement();
|
||||
|
||||
nsresult CopyInnerTo(nsIContent* aSrcContent,
|
||||
nsGenericHTMLContainerElement* aDest,
|
||||
PRBool aDeep);
|
||||
|
||||
// Remainder of nsIDOMHTMLElement (and nsIDOMNode)
|
||||
nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
|
||||
nsresult HasChildNodes(PRBool* aHasChildNodes);
|
||||
nsresult GetFirstChild(nsIDOMNode** aFirstChild);
|
||||
nsresult GetLastChild(nsIDOMNode** aLastChild);
|
||||
|
||||
nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
|
||||
nsIDOMNode** aReturn);
|
||||
nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
|
||||
nsIDOMNode** aReturn);
|
||||
nsresult RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
|
||||
nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
|
||||
|
||||
// Remainder of nsIHTMLContent (and nsIContent)
|
||||
nsresult BeginConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult ConvertContentToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult FinishConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
nsresult Compact();
|
||||
nsresult CanContainChildren(PRBool& aResult) const;
|
||||
nsresult ChildCount(PRInt32& aResult) const;
|
||||
nsresult ChildAt(PRInt32 aIndex, nsIContent*& aResult) const;
|
||||
nsresult IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const;
|
||||
nsresult InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
|
||||
nsresult ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
|
||||
nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
|
||||
nsresult RemoveChildAt(PRInt32 aIndex, PRBool aNotify);
|
||||
|
||||
nsVoidArray mChildren;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Implement the nsIDOMHTMLElement API by forwarding the methods to a
|
||||
* generic content object (either nsGenericHTMLLeafElement or
|
||||
* nsGenericHTMLContainerContent)
|
||||
*/
|
||||
#define NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(_g) \
|
||||
NS_IMETHOD GetId(nsString& aId) { \
|
||||
return _g.GetId(aId); \
|
||||
} \
|
||||
NS_IMETHOD SetId(const nsString& aId) { \
|
||||
return _g.SetId(aId); \
|
||||
} \
|
||||
NS_IMETHOD GetTitle(nsString& aTitle) { \
|
||||
return _g.GetTitle(aTitle); \
|
||||
} \
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle) { \
|
||||
return _g.SetTitle(aTitle); \
|
||||
} \
|
||||
NS_IMETHOD GetLang(nsString& aLang) { \
|
||||
return _g.GetLang(aLang); \
|
||||
} \
|
||||
NS_IMETHOD SetLang(const nsString& aLang) { \
|
||||
return _g.SetLang(aLang); \
|
||||
} \
|
||||
NS_IMETHOD GetDir(nsString& aDir) { \
|
||||
return _g.GetDir(aDir); \
|
||||
} \
|
||||
NS_IMETHOD SetDir(const nsString& aDir) { \
|
||||
return _g.SetDir(aDir); \
|
||||
} \
|
||||
NS_IMETHOD GetClassName(nsString& aClassName) { \
|
||||
return _g.GetClassName(aClassName); \
|
||||
} \
|
||||
NS_IMETHOD SetClassName(const nsString& aClassName) { \
|
||||
return _g.SetClassName(aClassName); \
|
||||
} \
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { \
|
||||
return _g.GetStyle(aStyle); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_IHTMLCONTENT_USING_GENERIC(_g) \
|
||||
NS_IMETHOD Compact() { \
|
||||
return _g.Compact(); \
|
||||
} \
|
||||
NS_IMETHOD SetHTMLAttribute(nsIAtom* aAttribute, \
|
||||
const nsHTMLValue& aValue, PRBool aNotify) { \
|
||||
return _g.SetHTMLAttribute(aAttribute, aValue, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute, \
|
||||
nsHTMLValue& aValue) const { \
|
||||
return _g.GetHTMLAttribute(aAttribute, aValue); \
|
||||
} \
|
||||
NS_IMETHOD GetID(nsIAtom*& aResult) const { \
|
||||
return _g.GetID(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetClasses(nsVoidArray& aArray) const { \
|
||||
return _g.GetClasses(aArray); \
|
||||
} \
|
||||
NS_IMETHOD HasClass(nsIAtom* aClass) const { \
|
||||
return _g.HasClass(aClass); \
|
||||
} \
|
||||
NS_IMETHOD GetContentStyleRules(nsISupportsArray* aRules) { \
|
||||
return _g.GetContentStyleRules(aRules); \
|
||||
} \
|
||||
NS_IMETHOD GetInlineStyleRules(nsISupportsArray* aRules) { \
|
||||
return _g.GetInlineStyleRules(aRules); \
|
||||
} \
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \
|
||||
return _g.GetBaseURL(aBaseURL); \
|
||||
} \
|
||||
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \
|
||||
return _g.GetBaseTarget(aBaseTarget); \
|
||||
} \
|
||||
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
|
||||
return _g.ToHTMLString(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ToHTML(FILE* out) const { \
|
||||
return _g.ToHTML(out); \
|
||||
} \
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \
|
||||
const nsString& aValue, \
|
||||
nsHTMLValue& aResult); \
|
||||
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \
|
||||
const nsHTMLValue& aValue, \
|
||||
nsString& aResult) const; \
|
||||
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \
|
||||
nsMapAttributesFunc& aMapFunc) const; \
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \
|
||||
PRInt32& aHint) const;
|
||||
|
||||
#define NS_IMPL_IHTMLCONTENT_USING_GENERIC2(_g) \
|
||||
NS_IMETHOD Compact() { \
|
||||
return _g.Compact(); \
|
||||
} \
|
||||
NS_IMETHOD SetHTMLAttribute(nsIAtom* aAttribute, \
|
||||
const nsHTMLValue& aValue, PRBool aNotify) { \
|
||||
return _g.SetHTMLAttribute(aAttribute, aValue, aNotify); \
|
||||
} \
|
||||
NS_IMETHOD GetHTMLAttribute(nsIAtom* aAttribute, \
|
||||
nsHTMLValue& aValue) const { \
|
||||
return _g.GetHTMLAttribute(aAttribute, aValue); \
|
||||
} \
|
||||
NS_IMETHOD GetID(nsIAtom*& aResult) const { \
|
||||
return _g.GetID(aResult); \
|
||||
} \
|
||||
NS_IMETHOD GetClasses(nsVoidArray& aArray) const { \
|
||||
return _g.GetClasses(aArray); \
|
||||
} \
|
||||
NS_IMETHOD HasClass(nsIAtom* aClass) const { \
|
||||
return _g.HasClass(aClass); \
|
||||
} \
|
||||
NS_IMETHOD GetContentStyleRules(nsISupportsArray* aRules); \
|
||||
NS_IMETHOD GetInlineStyleRules(nsISupportsArray* aRules); \
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const { \
|
||||
return _g.GetBaseURL(aBaseURL); \
|
||||
} \
|
||||
NS_IMETHOD GetBaseTarget(nsString& aBaseTarget) const { \
|
||||
return _g.GetBaseTarget(aBaseTarget); \
|
||||
} \
|
||||
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
|
||||
return _g.ToHTMLString(aResult); \
|
||||
} \
|
||||
NS_IMETHOD ToHTML(FILE* out) const { \
|
||||
return _g.ToHTML(out); \
|
||||
} \
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, \
|
||||
const nsString& aValue, \
|
||||
nsHTMLValue& aResult); \
|
||||
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, \
|
||||
const nsHTMLValue& aValue, \
|
||||
nsString& aResult) const; \
|
||||
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \
|
||||
nsMapAttributesFunc& aMapFunc) const; \
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \
|
||||
PRInt32& aHint) const;
|
||||
|
||||
/**
|
||||
* This macro implements the portion of query interface that is
|
||||
* generic to all html content objects.
|
||||
*/
|
||||
#define NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(_id, _iptr, _this) \
|
||||
NS_IMPL_CONTENT_QUERY_INTERFACE(_id, _iptr, _this, nsIHTMLContent) \
|
||||
if (_id.Equals(kIDOMHTMLElementIID)) { \
|
||||
nsIDOMHTMLElement* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIHTMLContentIID)) { \
|
||||
nsIHTMLContent* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
if (_id.Equals(kIStyledContentIID)) { \
|
||||
nsIStyledContent* tmp = _this; \
|
||||
*_iptr = (void*) tmp; \
|
||||
NS_ADDREF_THIS(); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
/**
|
||||
* A macro to implement the getter and setter for a given string
|
||||
* valued content property. The method uses the generic SetAttr and
|
||||
* GetAttribute methods.
|
||||
*/
|
||||
#define NS_IMPL_STRING_ATTR(_class, _method, _atom) \
|
||||
NS_IMETHODIMP \
|
||||
_class::Get##_method(nsString& aValue) \
|
||||
{ \
|
||||
mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(const nsString& aValue) \
|
||||
{ \
|
||||
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, aValue, PR_TRUE); \
|
||||
}
|
||||
|
||||
/**
|
||||
* A macro to implement the getter and setter for a given boolean
|
||||
* valued content property. The method uses the generic SetAttr and
|
||||
* GetAttribute methods.
|
||||
*/
|
||||
#define NS_IMPL_BOOL_ATTR(_class, _method, _atom) \
|
||||
NS_IMETHODIMP \
|
||||
_class::Get##_method(PRBool* aValue) \
|
||||
{ \
|
||||
nsHTMLValue val; \
|
||||
nsresult rv = mInner.GetHTMLAttribute(nsHTMLAtoms::_atom, val); \
|
||||
*aValue = NS_CONTENT_ATTR_NOT_THERE != rv; \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(PRBool aValue) \
|
||||
{ \
|
||||
nsHTMLValue empty(eHTMLUnit_Empty); \
|
||||
if (aValue) { \
|
||||
return mInner.SetHTMLAttribute(nsHTMLAtoms::_atom, empty, PR_TRUE); \
|
||||
} \
|
||||
else { \
|
||||
mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::_atom, PR_TRUE); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* A macro to implement the getter and setter for a given integer
|
||||
* valued content property. The method uses the generic SetAttr and
|
||||
* GetAttribute methods.
|
||||
*/
|
||||
#define NS_IMPL_INT_ATTR(_class, _method, _atom) \
|
||||
NS_IMETHODIMP \
|
||||
_class::Get##_method(PRInt32* aValue) \
|
||||
{ \
|
||||
nsHTMLValue value; \
|
||||
*aValue = -1; \
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == \
|
||||
mInner.GetHTMLAttribute(nsHTMLAtoms::_atom, value)) { \
|
||||
if (value.GetUnit() == eHTMLUnit_Integer) { \
|
||||
*aValue = value.GetIntValue(); \
|
||||
} \
|
||||
} \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_method(PRInt32 aValue) \
|
||||
{ \
|
||||
nsHTMLValue value(aValue, eHTMLUnit_Integer); \
|
||||
return mInner.SetHTMLAttribute(nsHTMLAtoms::_atom, value, PR_TRUE); \
|
||||
}
|
||||
|
||||
#endif /* nsGenericHTMLElement_h___ */
|
||||
486
mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
Normal file
486
mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
Normal file
@@ -0,0 +1,486 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIFocusableContent.h"
|
||||
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFrameManager.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
// XXX suppress
|
||||
|
||||
// XXX either suppress is handled in the event code below OR we need a
|
||||
// custom frame
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLAnchorElementIID, NS_IDOMHTMLANCHORELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID);
|
||||
|
||||
class nsHTMLAnchorElement : public nsIDOMHTMLAnchorElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent,
|
||||
public nsIFocusableContent
|
||||
{
|
||||
public:
|
||||
nsHTMLAnchorElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLAnchorElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLAnchorElement
|
||||
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
|
||||
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
|
||||
NS_IMETHOD GetCharset(nsString& aCharset);
|
||||
NS_IMETHOD SetCharset(const nsString& aCharset);
|
||||
NS_IMETHOD GetCoords(nsString& aCoords);
|
||||
NS_IMETHOD SetCoords(const nsString& aCoords);
|
||||
NS_IMETHOD GetHref(nsString& aHref);
|
||||
NS_IMETHOD SetHref(const nsString& aHref);
|
||||
NS_IMETHOD GetHreflang(nsString& aHreflang);
|
||||
NS_IMETHOD SetHreflang(const nsString& aHreflang);
|
||||
NS_IMETHOD GetName(nsString& aName);
|
||||
NS_IMETHOD SetName(const nsString& aName);
|
||||
NS_IMETHOD GetRel(nsString& aRel);
|
||||
NS_IMETHOD SetRel(const nsString& aRel);
|
||||
NS_IMETHOD GetRev(nsString& aRev);
|
||||
NS_IMETHOD SetRev(const nsString& aRev);
|
||||
NS_IMETHOD GetShape(nsString& aShape);
|
||||
NS_IMETHOD SetShape(const nsString& aShape);
|
||||
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
|
||||
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
|
||||
NS_IMETHOD GetTarget(nsString& aTarget);
|
||||
NS_IMETHOD SetTarget(const nsString& aTarget);
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD SetType(const nsString& aType);
|
||||
NS_IMETHOD Blur();
|
||||
NS_IMETHOD Focus();
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIFocusableContent
|
||||
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
|
||||
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
|
||||
|
||||
protected:
|
||||
nsGenericHTMLContainerElement mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLAnchorElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLAnchorElement::nsHTMLAnchorElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLAnchorElement::~nsHTMLAnchorElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLAnchorElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLAnchorElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLAnchorElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLAnchorElementIID)) {
|
||||
nsIDOMHTMLAnchorElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kIFocusableContentIID)) {
|
||||
*aInstancePtr = (void*)(nsIFocusableContent*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLAnchorElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLAnchorElement* it = new nsHTMLAnchorElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, AccessKey, accesskey)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Charset, charset)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Coords, coords)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Hreflang, hreflang)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Name, name)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rel, rel)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape)
|
||||
NS_IMPL_INT_ATTR(nsHTMLAnchorElement, TabIndex, tabindex)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Target, target)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::Blur()
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::Focus()
|
||||
{
|
||||
nsIDocument* doc; // Strong
|
||||
nsresult rv = GetDocument(doc);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!doc) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
PRInt32 numShells = doc->GetNumberOfShells();
|
||||
nsIPresShell* shell = nsnull; // Strong
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
for (PRInt32 i=0; i<numShells; i++)
|
||||
{
|
||||
shell = doc->GetShellAt(i);
|
||||
if (!shell) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
rv = shell->GetPresContext(getter_AddRefs(context));
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!context) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
rv = SetFocus(context);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
|
||||
NS_RELEASE(shell);
|
||||
}
|
||||
NS_RELEASE(doc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext)
|
||||
{
|
||||
|
||||
// don't make the link grab the focus if there is no link handler
|
||||
nsILinkHandler* handler;
|
||||
nsresult rv = aPresContext->GetLinkHandler(&handler);
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != handler)) {
|
||||
nsIEventStateManager *stateManager;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
stateManager->SetContentState(this, NS_EVENT_STATE_FOCUS);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext->GetShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIFrameManager> frameManager;
|
||||
presShell->GetFrameManager(getter_AddRefs(frameManager));
|
||||
if (frameManager) {
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
frameManager->GetPrimaryFrameFor(this, &frame);
|
||||
if (frame) {
|
||||
presShell->ScrollFrameIntoView(frame,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE,NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
NS_RELEASE(handler);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::RemoveFocus(nsIPresContext* aPresContext)
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::tabindex) {
|
||||
if (nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
|
||||
eHTMLUnit_Integer)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::suppress) {
|
||||
if (aValue.EqualsIgnoreCase("true")) {
|
||||
aResult.SetEmptyValue(); // XXX? shouldn't just leave "true"
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX support suppress in here
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
NS_ENSURE_ARG(aPresContext);
|
||||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
// Try script event handlers first
|
||||
nsresult ret = mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
|
||||
if ((NS_OK == ret) && (nsEventStatus_eIgnore == *aEventStatus) &&
|
||||
!(aFlags & NS_EVENT_FLAG_CAPTURE)) {
|
||||
// If this anchor element has an HREF then it is sensitive to
|
||||
// mouse events (otherwise ignore them).
|
||||
nsAutoString href;
|
||||
nsresult result = GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::href, href);
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
||||
switch (aEvent->message) {
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
{
|
||||
// don't make the link grab the focus if there is no link handler
|
||||
nsILinkHandler* handler;
|
||||
nsresult rv = aPresContext->GetLinkHandler(&handler);
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != handler)) {
|
||||
nsIEventStateManager *stateManager;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
stateManager->SetContentState(this, NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS);
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
NS_RELEASE(handler);
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_CLICK:
|
||||
case NS_KEY_PRESS:
|
||||
{
|
||||
if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {
|
||||
|
||||
nsKeyEvent * keyEvent;
|
||||
if (aEvent->eventStructType == NS_KEY_EVENT) {
|
||||
//Handle key commands from keys with char representation here, not on KeyDown
|
||||
keyEvent = (nsKeyEvent *)aEvent;
|
||||
}
|
||||
|
||||
//Click or return key
|
||||
if (aEvent->message == NS_MOUSE_LEFT_CLICK || keyEvent->keyCode == NS_VK_RETURN) {
|
||||
nsAutoString target;
|
||||
nsIURI* baseURL = nsnull;
|
||||
GetBaseURL(baseURL);
|
||||
GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::target, target);
|
||||
if (target.Length() == 0) {
|
||||
GetBaseTarget(target);
|
||||
}
|
||||
mInner.TriggerLink(aPresContext, eLinkVerb_Replace,
|
||||
baseURL, href, target, PR_TRUE);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
*aEventStatus = nsEventStatus_eConsumeDoDefault;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
// XXX Bring up a contextual menu provided by the application
|
||||
break;
|
||||
|
||||
case NS_MOUSE_ENTER:
|
||||
{
|
||||
nsIEventStateManager *stateManager;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
stateManager->SetContentState(this, NS_EVENT_STATE_HOVER);
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
|
||||
nsAutoString target;
|
||||
nsIURI* baseURL = nsnull;
|
||||
GetBaseURL(baseURL);
|
||||
GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::target, target);
|
||||
if (target.Length() == 0) {
|
||||
GetBaseTarget(target);
|
||||
}
|
||||
mInner.TriggerLink(aPresContext, eLinkVerb_Replace,
|
||||
baseURL, href, target, PR_FALSE);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_EXIT:
|
||||
{
|
||||
nsIEventStateManager *stateManager;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
stateManager->SetContentState(nsnull, NS_EVENT_STATE_HOVER);
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
|
||||
nsAutoString empty;
|
||||
mInner.TriggerLink(aPresContext, eLinkVerb_Replace, nsnull, empty, empty, PR_FALSE);
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::GetHref(nsString& aValue)
|
||||
{
|
||||
// Resolve url to an absolute url
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString relURLSpec;
|
||||
nsIURI* baseURL = nsnull;
|
||||
|
||||
// Get base URL.
|
||||
mInner.GetBaseURL(baseURL);
|
||||
|
||||
// Get href= attribute (relative URL).
|
||||
mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::href, relURLSpec);
|
||||
|
||||
// If there is no href=, then use base target.
|
||||
if (relURLSpec.Length() == 0) {
|
||||
mInner.GetBaseTarget(relURLSpec);
|
||||
}
|
||||
|
||||
if (nsnull != baseURL) {
|
||||
// Get absolute URL.
|
||||
rv = NS_MakeAbsoluteURI(relURLSpec, baseURL, aValue);
|
||||
}
|
||||
else {
|
||||
// Absolute URL is same as relative URL.
|
||||
aValue = relURLSpec;
|
||||
}
|
||||
NS_IF_RELEASE(baseURL);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::SetHref(const nsString& aValue)
|
||||
{
|
||||
return mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::href, aValue, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAnchorElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
354
mozilla/content/html/content/src/nsHTMLAppletElement.cpp
Normal file
354
mozilla/content/html/content/src/nsHTMLAppletElement.cpp
Normal file
@@ -0,0 +1,354 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLAppletElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIJVMManager.h"
|
||||
#include "nsILiveConnectManager.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsIJVMPluginInstance.h"
|
||||
|
||||
// XXX this is to get around conflicts with windows.h defines
|
||||
// introduced through jni.h
|
||||
#ifdef XP_PC
|
||||
#undef GetClassName
|
||||
#undef GetObject
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLAppletElementIID, NS_IDOMHTMLAPPLETELEMENT_IID);
|
||||
|
||||
class nsHTMLAppletElement : public nsIDOMHTMLAppletElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLAppletElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLAppletElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLAppletElement
|
||||
NS_IMETHOD GetAlign(nsString& aAlign);
|
||||
NS_IMETHOD SetAlign(const nsString& aAlign);
|
||||
NS_IMETHOD GetAlt(nsString& aAlt);
|
||||
NS_IMETHOD SetAlt(const nsString& aAlt);
|
||||
NS_IMETHOD GetArchive(nsString& aArchive);
|
||||
NS_IMETHOD SetArchive(const nsString& aArchive);
|
||||
NS_IMETHOD GetCode(nsString& aCode);
|
||||
NS_IMETHOD SetCode(const nsString& aCode);
|
||||
NS_IMETHOD GetCodeBase(nsString& aCodeBase);
|
||||
NS_IMETHOD SetCodeBase(const nsString& aCodeBase);
|
||||
NS_IMETHOD GetHeight(nsString& aHeight);
|
||||
NS_IMETHOD SetHeight(const nsString& aHeight);
|
||||
NS_IMETHOD GetHspace(nsString& aHspace);
|
||||
NS_IMETHOD SetHspace(const nsString& aHspace);
|
||||
NS_IMETHOD GetName(nsString& aName);
|
||||
NS_IMETHOD SetName(const nsString& aName);
|
||||
NS_IMETHOD GetObject(nsString& aObject);
|
||||
NS_IMETHOD SetObject(const nsString& aObject);
|
||||
NS_IMETHOD GetVspace(nsString& aVspace);
|
||||
NS_IMETHOD SetVspace(const nsString& aVspace);
|
||||
NS_IMETHOD GetWidth(nsString& aWidth);
|
||||
NS_IMETHOD SetWidth(const nsString& aWidth);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext,
|
||||
void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsGenericHTMLContainerElement mInner;
|
||||
PRBool mReflectedApplet;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLAppletElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLAppletElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLAppletElement::nsHTMLAppletElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
mReflectedApplet = PR_FALSE;
|
||||
}
|
||||
|
||||
nsHTMLAppletElement::~nsHTMLAppletElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLAppletElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLAppletElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLAppletElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLAppletElementIID)) {
|
||||
nsIDOMHTMLAppletElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLAppletElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLAppletElement* it = new nsHTMLAppletElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Align, align)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Alt, alt)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Archive, archive)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Code, code)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, CodeBase, codebase)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Height, height)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Hspace, hspace)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Name, name)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Object, object)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Vspace, vspace)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Width, width)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
if (nsGenericHTMLElement::ParseAlignValue(aValue, aResult)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
else if (nsGenericHTMLElement::ParseImageAttribute(aAttribute,
|
||||
aValue, aResult)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
|
||||
nsGenericHTMLElement::AlignValueToString(aValue, aResult);
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
else if (nsGenericHTMLElement::ImageAttributeToString(aAttribute,
|
||||
aValue, aResult)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext);
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext);
|
||||
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) {
|
||||
if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
extern nsresult NS_GetObjectFramePluginInstance(nsIFrame* aFrame, nsIPluginInstance*& aPluginInstance);
|
||||
|
||||
/**
|
||||
* For backwards compatibility an applet element's JavaScript object should expose both the public
|
||||
* fields of the applet, and the attributes of the applet tag. The call to nsGenericElement::GetScriptObject
|
||||
* takes case of the tag attributes. Here we generate a JavaScript reference to the applet object itself,
|
||||
* and set its __proto__ property to the tag object. That way, if the Java applet has public fields that
|
||||
* shadow the tag attributes, the applet's fields take precedence.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::GetScriptObject(nsIScriptContext* aContext,
|
||||
void** aScriptObject)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
NS_WITH_SERVICE(nsIJVMManager, jvm, nsIJVMManager::GetCID(), &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// nsresult rv = NS_OK;
|
||||
if (!mReflectedApplet) {
|
||||
// 1. get the script object corresponding to the <APPLET> element itself.
|
||||
JSObject* elementObject = nsnull;
|
||||
rv = mInner.GetScriptObject(aContext, (void**)&elementObject);
|
||||
if (NS_OK != rv)
|
||||
return rv;
|
||||
|
||||
// 2. get the plugin instance corresponding to this element.
|
||||
nsIPresShell* shell = mInner.mDocument->GetShellAt(0);
|
||||
if (nsnull == shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mInner.mContent, &frame);
|
||||
NS_RELEASE(shell);
|
||||
|
||||
// 3. get the Java object corresponding to this applet, and reflect it into
|
||||
// JavaScript using the LiveConnect manager.
|
||||
JSContext* context = (JSContext*)aContext->GetNativeContext();
|
||||
JSObject* wrappedAppletObject = nsnull;
|
||||
nsIPluginInstance* pluginInstance = nsnull;
|
||||
rv = NS_GetObjectFramePluginInstance(frame, pluginInstance);
|
||||
if ((rv == NS_OK) && (nsnull != pluginInstance)) {
|
||||
nsIJVMPluginInstance* javaPluginInstance = nsnull;
|
||||
if (pluginInstance->QueryInterface(nsIJVMPluginInstance::GetIID(), (void**)&javaPluginInstance) == NS_OK) {
|
||||
jobject appletObject = nsnull;
|
||||
rv = javaPluginInstance->GetJavaObject(&appletObject);
|
||||
if (NS_OK == rv) {
|
||||
nsILiveConnectManager* manager = NULL;
|
||||
rv = nsServiceManager::GetService(nsIJVMManager::GetCID(),
|
||||
nsILiveConnectManager::GetIID(),
|
||||
(nsISupports **)&manager);
|
||||
if (rv == NS_OK) {
|
||||
rv = manager->WrapJavaObject(context, appletObject, &wrappedAppletObject);
|
||||
nsServiceManager::ReleaseService(nsIJVMManager::GetCID(), manager);
|
||||
}
|
||||
}
|
||||
NS_RELEASE(javaPluginInstance);
|
||||
}
|
||||
NS_RELEASE(pluginInstance);
|
||||
}
|
||||
|
||||
// 4. set the __proto__ field of the applet object to be the element script object.
|
||||
if (nsnull != wrappedAppletObject) {
|
||||
JS_SetPrototype(context, wrappedAppletObject, elementObject);
|
||||
mInner.SetScriptObject(wrappedAppletObject);
|
||||
mReflectedApplet = PR_TRUE;
|
||||
}
|
||||
*aScriptObject = wrappedAppletObject;
|
||||
} else {
|
||||
rv = mInner.GetScriptObject(aContext, aScriptObject);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
else
|
||||
return mInner.GetScriptObject(aContext, aScriptObject);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO: if this method ever gets called, it will destroy the prototype type chain.
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
return mInner.SetScriptObject(aScriptObject);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAppletElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
258
mozilla/content/html/content/src/nsHTMLAreaElement.cpp
Normal file
258
mozilla/content/html/content/src/nsHTMLAreaElement.cpp
Normal file
@@ -0,0 +1,258 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIFocusableContent.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLAreaElementIID, NS_IDOMHTMLAREAELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID);
|
||||
|
||||
class nsHTMLAreaElement : public nsIDOMHTMLAreaElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent,
|
||||
public nsIFocusableContent
|
||||
{
|
||||
public:
|
||||
nsHTMLAreaElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLAreaElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLAreaElement
|
||||
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
|
||||
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
|
||||
NS_IMETHOD GetAlt(nsString& aAlt);
|
||||
NS_IMETHOD SetAlt(const nsString& aAlt);
|
||||
NS_IMETHOD GetCoords(nsString& aCoords);
|
||||
NS_IMETHOD SetCoords(const nsString& aCoords);
|
||||
NS_IMETHOD GetHref(nsString& aHref);
|
||||
NS_IMETHOD SetHref(const nsString& aHref);
|
||||
NS_IMETHOD GetNoHref(PRBool* aNoHref);
|
||||
NS_IMETHOD SetNoHref(PRBool aNoHref);
|
||||
NS_IMETHOD GetShape(nsString& aShape);
|
||||
NS_IMETHOD SetShape(const nsString& aShape);
|
||||
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
|
||||
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
|
||||
NS_IMETHOD GetTarget(nsString& aTarget);
|
||||
NS_IMETHOD SetTarget(const nsString& aTarget);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIFocusableContent
|
||||
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
|
||||
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
|
||||
|
||||
protected:
|
||||
nsGenericHTMLLeafElement mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLAreaElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLAreaElement::nsHTMLAreaElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLAreaElement::~nsHTMLAreaElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLAreaElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLAreaElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLAreaElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLAreaElementIID)) {
|
||||
nsIDOMHTMLAreaElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kIFocusableContentIID)) {
|
||||
*aInstancePtr = (void*)(nsIFocusableContent*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLAreaElement* it = new nsHTMLAreaElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, AccessKey, accesskey)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Alt, alt)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Coords, coords)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Href, href)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLAreaElement, NoHref, nohref)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Shape, shape)
|
||||
NS_IMPL_INT_ATTR(nsHTMLAreaElement, TabIndex, tabindex)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLAreaElement, Target, target)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::nohref) {
|
||||
aResult.SetEmptyValue();
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::tabindex) {
|
||||
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Integer)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
|
||||
{
|
||||
if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::SetFocus(nsIPresContext* aPresContext)
|
||||
{
|
||||
nsIEventStateManager* esm;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&esm)) {
|
||||
esm->SetContentState(this, NS_EVENT_STATE_FOCUS);
|
||||
NS_RELEASE(esm);
|
||||
}
|
||||
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::RemoveFocus(nsIPresContext* aPresContext)
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLAreaElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
225
mozilla/content/html/content/src/nsHTMLBRElement.cpp
Normal file
225
mozilla/content/html/content/src/nsHTMLBRElement.cpp
Normal file
@@ -0,0 +1,225 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLBRElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIHTMLAttributes.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLBRElementIID, NS_IDOMHTMLBRELEMENT_IID);
|
||||
|
||||
class nsHTMLBRElement : public nsIDOMHTMLBRElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLBRElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLBRElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLBRElement
|
||||
NS_IMETHOD GetClear(nsString& aClear);
|
||||
NS_IMETHOD SetClear(const nsString& aClear);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsGenericHTMLLeafElement mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLBRElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLBRElement::nsHTMLBRElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLBRElement::~nsHTMLBRElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLBRElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLBRElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLBRElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLBRElementIID)) {
|
||||
nsIDOMHTMLBRElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLBRElement* it = new nsHTMLBRElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBRElement, Clear, clear)
|
||||
|
||||
static nsGenericHTMLElement::EnumTable kClearTable[] = {
|
||||
{ "left", NS_STYLE_CLEAR_LEFT },
|
||||
{ "right", NS_STYLE_CLEAR_RIGHT },
|
||||
{ "all", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
|
||||
{ "both", NS_STYLE_CLEAR_LEFT_AND_RIGHT },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBRElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::clear) {
|
||||
if (nsGenericHTMLElement::ParseEnumValue(aValue, kClearTable, aResult)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBRElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::clear) {
|
||||
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kClearTable, aResult);
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
nsStyleDisplay* display = (nsStyleDisplay*)
|
||||
aContext->GetMutableStyleData(eStyleStruct_Display);
|
||||
|
||||
nsHTMLValue value;
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::clear, value);
|
||||
if (value.GetUnit() == eHTMLUnit_Enumerated) {
|
||||
display->mBreakType = value.GetIntValue();
|
||||
}
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (nsHTMLAtoms::clear == aAttribute) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBRElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBRElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
195
mozilla/content/html/content/src/nsHTMLBaseElement.cpp
Normal file
195
mozilla/content/html/content/src/nsHTMLBaseElement.cpp
Normal file
@@ -0,0 +1,195 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLBaseElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLBaseElementIID, NS_IDOMHTMLBASEELEMENT_IID);
|
||||
|
||||
class nsHTMLBaseElement : public nsIDOMHTMLBaseElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLBaseElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLBaseElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLBaseElement
|
||||
NS_IMETHOD GetHref(nsString& aHref);
|
||||
NS_IMETHOD SetHref(const nsString& aHref);
|
||||
NS_IMETHOD GetTarget(nsString& aTarget);
|
||||
NS_IMETHOD SetTarget(const nsString& aTarget);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsGenericHTMLLeafElement mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBaseElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLBaseElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLBaseElement::nsHTMLBaseElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLBaseElement::~nsHTMLBaseElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLBaseElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLBaseElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLBaseElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLBaseElementIID)) {
|
||||
nsIDOMHTMLBaseElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLBaseElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLBaseElement* it = new nsHTMLBaseElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBaseElement, Href, href)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBaseElement, Target, target)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
215
mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp
Normal file
215
mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp
Normal file
@@ -0,0 +1,215 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLBaseFontElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLBaseFontElementIID, NS_IDOMHTMLBASEFONTELEMENT_IID);
|
||||
|
||||
class nsHTMLBaseFontElement : public nsIDOMHTMLBaseFontElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLBaseFontElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLBaseFontElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLBaseElement
|
||||
NS_IMETHOD GetColor(nsString& aColor);
|
||||
NS_IMETHOD SetColor(const nsString& aColor);
|
||||
NS_IMETHOD GetFace(nsString& aFace);
|
||||
NS_IMETHOD SetFace(const nsString& aFace);
|
||||
NS_IMETHOD GetSize(nsString& aSize);
|
||||
NS_IMETHOD SetSize(const nsString& aSize);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsGenericHTMLLeafElement mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLBaseFontElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLBaseFontElement::nsHTMLBaseFontElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLBaseFontElement::~nsHTMLBaseFontElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLBaseFontElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLBaseFontElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLBaseFontElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLBaseFontElementIID)) {
|
||||
nsIDOMHTMLBaseFontElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLBaseFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLBaseFontElement* it = new nsHTMLBaseFontElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Color, color)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Face, face)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Size, size)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFontElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
// XXX write me
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
// XXX write me
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
// XXX write me
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if ((nsHTMLAtoms::color == aAttribute) ||
|
||||
(nsHTMLAtoms::face == aAttribute) ||
|
||||
(nsHTMLAtoms::size == aAttribute)) {
|
||||
aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; // XXX this seems a bit harsh, perhaps we need a reflow_all?
|
||||
}
|
||||
else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = &MapFontAttributesInto;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFontElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBaseFontElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
827
mozilla/content/html/content/src/nsHTMLBodyElement.cpp
Normal file
827
mozilla/content/html/content/src/nsHTMLBodyElement.cpp
Normal file
@@ -0,0 +1,827 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIHTMLStyleSheet.h"
|
||||
#include "nsIHTMLCSSStyleSheet.h"
|
||||
#include "nsICSSStyleRule.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIMarkupDocumentViewer.h"
|
||||
#include "nsIHTMLAttributes.h"
|
||||
#include "nsIHTMLContentContainer.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID);
|
||||
static NS_DEFINE_IID(kIStyleRuleIID, NS_ISTYLE_RULE_IID);
|
||||
static NS_DEFINE_IID(kICSSStyleRuleIID, NS_ICSS_STYLE_RULE_IID);
|
||||
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLBodyElementIID, NS_IDOMHTMLBODYELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIHTMLContentContainerIID, NS_IHTMLCONTENTCONTAINER_IID);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsHTMLBodyElement;
|
||||
|
||||
class BodyRule: public nsIStyleRule {
|
||||
public:
|
||||
BodyRule(nsHTMLBodyElement* aPart, nsIHTMLStyleSheet* aSheet);
|
||||
virtual ~BodyRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aResult) const;
|
||||
NS_IMETHOD HashValue(PRUint32& aValue) const;
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
|
||||
// Strength is an out-of-band weighting, always 0 here
|
||||
NS_IMETHOD GetStrength(PRInt32& aStrength) const;
|
||||
|
||||
NS_IMETHOD MapFontStyleInto(nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
NS_IMETHOD MapStyleInto(nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsHTMLBodyElement* mPart; // not ref-counted, cleared by content
|
||||
nsIHTMLStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BodyFixupRule : public nsIStyleRule {
|
||||
public:
|
||||
BodyFixupRule(nsHTMLBodyElement* aPart, nsIHTMLCSSStyleSheet* aSheet);
|
||||
virtual ~BodyFixupRule();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Equals(const nsIStyleRule* aRule, PRBool& aValue) const;
|
||||
NS_IMETHOD HashValue(PRUint32& aValue) const;
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
// Strength is an out-of-band weighting, always maxint here
|
||||
NS_IMETHOD GetStrength(PRInt32& aStrength) const;
|
||||
|
||||
NS_IMETHOD MapFontStyleInto(nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
NS_IMETHOD MapStyleInto(nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext);
|
||||
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
||||
nsHTMLBodyElement* mPart; // not ref-counted, cleared by content
|
||||
nsIHTMLCSSStyleSheet* mSheet; // not ref-counted, cleared by content
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// special subclass of inner class to override set document
|
||||
class nsBodyInner: public nsGenericHTMLContainerElement
|
||||
{
|
||||
public:
|
||||
nsBodyInner();
|
||||
virtual ~nsBodyInner();
|
||||
|
||||
nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep);
|
||||
|
||||
BodyRule* mContentStyleRule;
|
||||
BodyFixupRule* mInlineStyleRule;
|
||||
};
|
||||
|
||||
|
||||
nsBodyInner::nsBodyInner()
|
||||
: nsGenericHTMLContainerElement(),
|
||||
mContentStyleRule(nsnull),
|
||||
mInlineStyleRule(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
nsBodyInner::~nsBodyInner()
|
||||
{
|
||||
if (nsnull != mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mContentStyleRule);
|
||||
}
|
||||
if (nsnull != mInlineStyleRule) {
|
||||
mInlineStyleRule->mPart = nsnull;
|
||||
mInlineStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mInlineStyleRule);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsBodyInner::SetDocument(nsIDocument* aDocument, PRBool aDeep)
|
||||
{
|
||||
if (nsnull != mContentStyleRule) {
|
||||
mContentStyleRule->mPart = nsnull;
|
||||
mContentStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mContentStyleRule); // destroy old style rule since the sheet will probably change
|
||||
}
|
||||
if (nsnull != mInlineStyleRule) {
|
||||
mInlineStyleRule->mPart = nsnull;
|
||||
mInlineStyleRule->mSheet = nsnull;
|
||||
NS_RELEASE(mInlineStyleRule); // destroy old style rule since the sheet will probably change
|
||||
}
|
||||
return nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsHTMLBodyElement : public nsIDOMHTMLBodyElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLBodyElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLBodyElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLBodyElement
|
||||
NS_IMETHOD GetALink(nsString& aALink);
|
||||
NS_IMETHOD SetALink(const nsString& aALink);
|
||||
NS_IMETHOD GetBackground(nsString& aBackground);
|
||||
NS_IMETHOD SetBackground(const nsString& aBackground);
|
||||
NS_IMETHOD GetBgColor(nsString& aBgColor);
|
||||
NS_IMETHOD SetBgColor(const nsString& aBgColor);
|
||||
NS_IMETHOD GetLink(nsString& aLink);
|
||||
NS_IMETHOD SetLink(const nsString& aLink);
|
||||
NS_IMETHOD GetText(nsString& aText);
|
||||
NS_IMETHOD SetText(const nsString& aText);
|
||||
NS_IMETHOD GetVLink(nsString& aVLink);
|
||||
NS_IMETHOD SetVLink(const nsString& aVLink);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC2(mInner)
|
||||
|
||||
protected:
|
||||
nsBodyInner mInner;
|
||||
|
||||
friend class BodyRule;
|
||||
friend class BodyFixupRule;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
BodyRule::BodyRule(nsHTMLBodyElement* aPart, nsIHTMLStyleSheet* aSheet)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mPart = aPart;
|
||||
mSheet = aSheet;
|
||||
}
|
||||
|
||||
BodyRule::~BodyRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(BodyRule, kIStyleRuleIID);
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::Equals(const nsIStyleRule* aRule, PRBool& aResult) const
|
||||
{
|
||||
aResult = PRBool(this == aRule);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::HashValue(PRUint32& aValue) const
|
||||
{
|
||||
aValue = (PRUint32)(mPart);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Strength is an out-of-band weighting, useful for mapping CSS ! important
|
||||
// always 0 here
|
||||
NS_IMETHODIMP
|
||||
BodyRule::GetStrength(PRInt32& aStrength) const
|
||||
{
|
||||
aStrength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::MapFontStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext)
|
||||
{
|
||||
// set up the basefont (defaults to 3)
|
||||
nsStyleFont* font = (nsStyleFont*)aContext->GetMutableStyleData(eStyleStruct_Font);
|
||||
PRInt32 scaler;
|
||||
aPresContext->GetFontScaler(&scaler);
|
||||
float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);
|
||||
// apply font scaling to the body
|
||||
font->mFont.size = NSToCoordFloor(float(font->mFont.size) * scaleFactor);
|
||||
if (font->mFont.size < 1) {
|
||||
font->mFont.size = 1;
|
||||
}
|
||||
font->mFixedFont.size = NSToCoordFloor(float(font->mFixedFont.size) * scaleFactor);
|
||||
if (font->mFixedFont.size < 1) {
|
||||
font->mFixedFont.size = 1;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::MapStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext)
|
||||
{
|
||||
if (nsnull != mPart) {
|
||||
|
||||
nsStyleSpacing* styleSpacing = (nsStyleSpacing*)(aContext->GetMutableStyleData(eStyleStruct_Spacing));
|
||||
|
||||
if (nsnull != styleSpacing) {
|
||||
nsHTMLValue value;
|
||||
PRInt32 attrCount;
|
||||
float p2t;
|
||||
mPart->GetAttributeCount(attrCount);
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
nscoord bodyMarginWidth = -1;
|
||||
nscoord bodyMarginHeight = -1;
|
||||
|
||||
if (0 < attrCount) {
|
||||
// if marginwidth/marginheigth is set reflect them as 'margin'
|
||||
mPart->GetHTMLAttribute(nsHTMLAtoms::marginwidth, value);
|
||||
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
||||
bodyMarginWidth = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||
if (bodyMarginWidth < 0) {
|
||||
bodyMarginWidth = 0;
|
||||
}
|
||||
nsStyleCoord widthCoord(bodyMarginWidth);
|
||||
styleSpacing->mMargin.SetLeft(widthCoord);
|
||||
styleSpacing->mMargin.SetRight(widthCoord);
|
||||
}
|
||||
|
||||
mPart->GetHTMLAttribute(nsHTMLAtoms::marginheight, value);
|
||||
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
||||
bodyMarginHeight = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||
if (bodyMarginHeight < 0) {
|
||||
bodyMarginHeight = 0;
|
||||
}
|
||||
|
||||
nsStyleCoord heightCoord(bodyMarginHeight);
|
||||
styleSpacing->mMargin.SetTop(heightCoord);
|
||||
styleSpacing->mMargin.SetBottom(heightCoord);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX This is all pretty hokey...
|
||||
|
||||
// if marginwidth or marginheight is set in the <frame> and not set in the <body>
|
||||
// reflect them as margin in the <body>
|
||||
if ((0 > bodyMarginWidth) || (0 > bodyMarginHeight)) {
|
||||
nsISupports* container;
|
||||
aPresContext->GetContainer(&container);
|
||||
if (nsnull != container) {
|
||||
nsCompatibility mode;
|
||||
aPresContext->GetCompatibilityMode(&mode);
|
||||
nsIWebShell* webShell = nsnull;
|
||||
container->QueryInterface(kIWebShellIID, (void**) &webShell);
|
||||
if (nsnull != webShell) {
|
||||
nscoord pixel = NSIntPixelsToTwips(1, p2t);
|
||||
nscoord frameMarginWidth=-1; // default value
|
||||
nscoord frameMarginHeight=-1; // default value
|
||||
webShell->GetMarginWidth(&frameMarginWidth); // -1 indicates not set
|
||||
webShell->GetMarginHeight(&frameMarginHeight);
|
||||
if ((frameMarginWidth >= 0) && (0 > bodyMarginWidth)) { // set in <frame> & not in <body>
|
||||
if (eCompatibility_NavQuirks == mode) { // allow 0 margins
|
||||
if ((0 > bodyMarginHeight) && (0 > frameMarginHeight)) { // another nav quirk
|
||||
frameMarginHeight = 0;
|
||||
}
|
||||
} else { // margins are at least 1 pixel
|
||||
if (0 == frameMarginWidth) {
|
||||
frameMarginWidth = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((frameMarginHeight >= 0) && (0 > bodyMarginHeight)) { // set in <frame> & not in <body>
|
||||
if (eCompatibility_NavQuirks == mode) { // allow 0 margins
|
||||
if ((0 > bodyMarginWidth) && (0 > frameMarginWidth)) { // another nav quirk
|
||||
frameMarginWidth = 0;
|
||||
}
|
||||
} else { // margins are at least 1 pixel
|
||||
if (0 == frameMarginHeight) {
|
||||
frameMarginHeight = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((0 > bodyMarginWidth) && (frameMarginWidth >= 0)) {
|
||||
nsStyleCoord widthCoord(frameMarginWidth);
|
||||
styleSpacing->mMargin.SetLeft(widthCoord);
|
||||
styleSpacing->mMargin.SetRight(widthCoord);
|
||||
}
|
||||
|
||||
if ((0 > bodyMarginHeight) && (frameMarginHeight >= 0)) {
|
||||
nsStyleCoord heightCoord(frameMarginHeight);
|
||||
styleSpacing->mMargin.SetTop(heightCoord);
|
||||
styleSpacing->mMargin.SetBottom(heightCoord);
|
||||
}
|
||||
NS_RELEASE(webShell);
|
||||
}
|
||||
NS_RELEASE(container);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyRule::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
BodyFixupRule::BodyFixupRule(nsHTMLBodyElement* aPart, nsIHTMLCSSStyleSheet* aSheet)
|
||||
: mPart(aPart),
|
||||
mSheet(aSheet)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
BodyFixupRule::~BodyFixupRule()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(BodyFixupRule);
|
||||
NS_IMPL_RELEASE(BodyFixupRule);
|
||||
|
||||
nsresult BodyFixupRule::QueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtrResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null pointer");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
// static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kIStyleRuleIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIStyleRule*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISupports*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::Equals(const nsIStyleRule* aRule, PRBool& aResult) const
|
||||
{
|
||||
aResult = PRBool(this == aRule);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::HashValue(PRUint32& aValue) const
|
||||
{
|
||||
aValue = (PRUint32)(mPart);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
|
||||
{
|
||||
NS_IF_ADDREF(mSheet);
|
||||
aSheet = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Strength is an out-of-band weighting, always MaxInt here
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::GetStrength(PRInt32& aStrength) const
|
||||
{
|
||||
aStrength = 2000000000;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::MapFontStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::MapStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext)
|
||||
{
|
||||
// XXX do any other body processing here
|
||||
|
||||
const nsStyleColor* styleColor;
|
||||
styleColor = (const nsStyleColor*)aContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// Use the CSS precedence rules for dealing with BODY background: if the value
|
||||
// of the 'background' property for the HTML element is different from
|
||||
// 'transparent' then use it, else use the value of the 'background' property
|
||||
// for the BODY element
|
||||
|
||||
// See if the BODY has a background specified
|
||||
if (!styleColor->BackgroundIsTransparent()) {
|
||||
// Get the parent style context
|
||||
nsIStyleContext* parentContext = aContext->GetParent();
|
||||
|
||||
// Look at its 'background' property
|
||||
const nsStyleColor* parentStyleColor;
|
||||
parentStyleColor = (const nsStyleColor*)parentContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
// See if it's 'transparent' or set by us
|
||||
if (parentStyleColor->BackgroundIsTransparent() ||
|
||||
(NS_STYLE_BG_PROPOGATED == (parentStyleColor->mBackgroundFlags & NS_STYLE_BG_PROPOGATED))) {
|
||||
// Have the parent (initial containing block) use the BODY's background
|
||||
nsStyleColor* mutableStyleColor;
|
||||
mutableStyleColor = (nsStyleColor*)parentContext->GetMutableStyleData(eStyleStruct_Color);
|
||||
|
||||
mutableStyleColor->mBackgroundAttachment = styleColor->mBackgroundAttachment;
|
||||
mutableStyleColor->mBackgroundFlags = styleColor->mBackgroundFlags | NS_STYLE_BG_PROPOGATED;
|
||||
mutableStyleColor->mBackgroundRepeat = styleColor->mBackgroundRepeat;
|
||||
mutableStyleColor->mBackgroundColor = styleColor->mBackgroundColor;
|
||||
mutableStyleColor->mBackgroundXPosition = styleColor->mBackgroundXPosition;
|
||||
mutableStyleColor->mBackgroundYPosition = styleColor->mBackgroundYPosition;
|
||||
mutableStyleColor->mBackgroundImage = styleColor->mBackgroundImage;
|
||||
|
||||
// Reset the BODY's background to transparent
|
||||
mutableStyleColor = (nsStyleColor*)aContext->GetMutableStyleData(eStyleStruct_Color);
|
||||
mutableStyleColor->mBackgroundFlags = NS_STYLE_BG_COLOR_TRANSPARENT |
|
||||
NS_STYLE_BG_IMAGE_NONE;
|
||||
mutableStyleColor->mBackgroundImage.SetLength(0);
|
||||
mutableStyleColor->mBackgroundAttachment = NS_STYLE_BG_ATTACHMENT_SCROLL;
|
||||
}
|
||||
NS_RELEASE(parentContext);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext->GetShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsIHTMLContentContainer* htmlContainer;
|
||||
if (NS_OK == doc->QueryInterface(kIHTMLContentContainerIID,
|
||||
(void**)&htmlContainer)) {
|
||||
nsIHTMLStyleSheet* styleSheet;
|
||||
if (NS_OK == htmlContainer->GetAttributeStyleSheet(&styleSheet)) {
|
||||
styleSheet->SetDocumentForegroundColor(styleColor->mColor);
|
||||
if (!(styleColor->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
||||
styleSheet->SetDocumentBackgroundColor(styleColor->mBackgroundColor);
|
||||
}
|
||||
NS_RELEASE(styleSheet);
|
||||
}
|
||||
NS_RELEASE(htmlContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BodyFixupRule::List(FILE* out, PRInt32 aIndent) const
|
||||
{
|
||||
// Indent
|
||||
for (PRInt32 index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
fputs("Special BODY tag fixup rule\n", out);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLBodyElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLBodyElement::nsHTMLBodyElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLBodyElement::~nsHTMLBodyElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLBodyElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLBodyElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLBodyElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLBodyElementIID)) {
|
||||
nsIDOMHTMLBodyElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLBodyElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLBodyElement* it = new nsHTMLBodyElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, ALink, alink)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Background, background)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, BgColor, bgcolor)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Link, link)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, Text, text)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLBodyElement, VLink, vlink)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::bgcolor) ||
|
||||
(aAttribute == nsHTMLAtoms::text) ||
|
||||
(aAttribute == nsHTMLAtoms::link) ||
|
||||
(aAttribute == nsHTMLAtoms::alink) ||
|
||||
(aAttribute == nsHTMLAtoms::vlink)) {
|
||||
if (nsGenericHTMLElement::ParseColor(aValue, mInner.mDocument, aResult)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
else if ((aAttribute == nsHTMLAtoms::marginwidth) ||
|
||||
(aAttribute == nsHTMLAtoms::marginheight)) {
|
||||
if (nsGenericHTMLElement::ParseValue(aValue, 0, aResult, eHTMLUnit_Pixel)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
if (nsnull != aAttributes) {
|
||||
nsHTMLValue value;
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext);
|
||||
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::text, value);
|
||||
if ((eHTMLUnit_Color == value.GetUnit()) ||
|
||||
(eHTMLUnit_ColorName == value.GetUnit())){
|
||||
nsStyleColor* color = (nsStyleColor*)
|
||||
aContext->GetMutableStyleData(eStyleStruct_Color);
|
||||
color->mColor = value.GetColorValue();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext->GetShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsIHTMLContentContainer* htmlContainer;
|
||||
if (NS_OK == doc->QueryInterface(kIHTMLContentContainerIID,
|
||||
(void**)&htmlContainer)) {
|
||||
nsIHTMLStyleSheet* styleSheet;
|
||||
if (NS_OK == htmlContainer->GetAttributeStyleSheet(&styleSheet)) {
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::link, value);
|
||||
if ((eHTMLUnit_Color == value.GetUnit()) ||
|
||||
(eHTMLUnit_ColorName == value.GetUnit())) {
|
||||
styleSheet->SetLinkColor(value.GetColorValue());
|
||||
}
|
||||
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::alink, value);
|
||||
if ((eHTMLUnit_Color == value.GetUnit()) ||
|
||||
(eHTMLUnit_ColorName == value.GetUnit())) {
|
||||
styleSheet->SetActiveLinkColor(value.GetColorValue());
|
||||
}
|
||||
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::vlink, value);
|
||||
if ((eHTMLUnit_Color == value.GetUnit()) ||
|
||||
(eHTMLUnit_ColorName == value.GetUnit())) {
|
||||
styleSheet->SetVisitedLinkColor(value.GetColorValue());
|
||||
}
|
||||
NS_RELEASE(styleSheet);
|
||||
}
|
||||
NS_RELEASE(htmlContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
|
||||
static nsIHTMLStyleSheet* GetAttrStyleSheet(nsIDocument* aDocument)
|
||||
{
|
||||
nsIHTMLStyleSheet* sheet = nsnull;
|
||||
nsIHTMLContentContainer* htmlContainer;
|
||||
|
||||
if (nsnull != aDocument) {
|
||||
if (NS_OK == aDocument->QueryInterface(kIHTMLContentContainerIID, (void**)&htmlContainer)) {
|
||||
htmlContainer->GetAttributeStyleSheet(&sheet);
|
||||
NS_RELEASE(htmlContainer);
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(nsnull != sheet, "can't get attribute style sheet");
|
||||
return sheet;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetContentStyleRules(nsISupportsArray* aRules)
|
||||
{
|
||||
mInner.GetContentStyleRules(aRules);
|
||||
|
||||
if (nsnull == mInner.mContentStyleRule) {
|
||||
nsIHTMLStyleSheet* sheet = nsnull;
|
||||
|
||||
if (nsnull != mInner.mDocument) { // find style sheet
|
||||
sheet = GetAttrStyleSheet(mInner.mDocument);
|
||||
}
|
||||
|
||||
mInner.mContentStyleRule = new BodyRule(this, sheet);
|
||||
NS_IF_RELEASE(sheet);
|
||||
NS_IF_ADDREF(mInner.mContentStyleRule);
|
||||
}
|
||||
if (aRules && mInner.mContentStyleRule) {
|
||||
aRules->AppendElement(mInner.mContentStyleRule);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsIHTMLCSSStyleSheet* GetInlineStyleSheet(nsIDocument* aDocument)
|
||||
{
|
||||
nsIHTMLCSSStyleSheet* sheet = nsnull;
|
||||
nsIHTMLContentContainer* htmlContainer;
|
||||
|
||||
if (nsnull != aDocument) {
|
||||
if (NS_OK == aDocument->QueryInterface(kIHTMLContentContainerIID, (void**)&htmlContainer)) {
|
||||
htmlContainer->GetInlineStyleSheet(&sheet);
|
||||
NS_RELEASE(htmlContainer);
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(nsnull != sheet, "can't get inline style sheet");
|
||||
return sheet;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetInlineStyleRules(nsISupportsArray* aRules)
|
||||
{
|
||||
mInner.GetInlineStyleRules(aRules);
|
||||
|
||||
if (nsnull == mInner.mInlineStyleRule) {
|
||||
nsIHTMLCSSStyleSheet* sheet = nsnull;
|
||||
|
||||
if (nsnull != mInner.mDocument) { // find style sheet
|
||||
sheet = GetInlineStyleSheet(mInner.mDocument);
|
||||
}
|
||||
|
||||
mInner.mInlineStyleRule = new BodyFixupRule(this, sheet);
|
||||
NS_IF_RELEASE(sheet);
|
||||
NS_IF_ADDREF(mInner.mInlineStyleRule);
|
||||
}
|
||||
if (aRules && mInner.mInlineStyleRule) {
|
||||
aRules->AppendElement(mInner.mInlineStyleRule);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::link) ||
|
||||
(aAttribute == nsHTMLAtoms::vlink) ||
|
||||
(aAttribute == nsHTMLAtoms::alink) ||
|
||||
(aAttribute == nsHTMLAtoms::text)) {
|
||||
aHint = NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
else if ((aAttribute == nsHTMLAtoms::marginwidth) ||
|
||||
(aAttribute == nsHTMLAtoms::marginheight)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLBodyElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
560
mozilla/content/html/content/src/nsHTMLButtonElement.cpp
Normal file
560
mozilla/content/html/content/src/nsHTMLButtonElement.cpp
Normal file
@@ -0,0 +1,560 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIDOMNSHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIFocusableContent.h"
|
||||
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLButtonElementIID, NS_IDOMHTMLBUTTONELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID);
|
||||
|
||||
class nsHTMLButtonElement : public nsIDOMHTMLButtonElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent,
|
||||
public nsIFormControl,
|
||||
public nsIFocusableContent
|
||||
{
|
||||
public:
|
||||
nsHTMLButtonElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLButtonElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLButtonElement
|
||||
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
||||
NS_IMETHOD GetAccessKey(nsString& aAccessKey);
|
||||
NS_IMETHOD SetAccessKey(const nsString& aAccessKey);
|
||||
NS_IMETHOD GetDisabled(PRBool* aDisabled);
|
||||
NS_IMETHOD SetDisabled(PRBool aDisabled);
|
||||
NS_IMETHOD GetName(nsString& aName);
|
||||
NS_IMETHOD SetName(const nsString& aName);
|
||||
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
|
||||
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
|
||||
NS_IMETHOD GetType(nsString& aType);
|
||||
NS_IMETHOD GetValue(nsString& aValue);
|
||||
NS_IMETHOD SetValue(const nsString& aValue);
|
||||
|
||||
// nsIDOMHTMLButtonElement
|
||||
NS_IMETHOD Blur();
|
||||
NS_IMETHOD Focus();
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIFormControl
|
||||
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm);
|
||||
NS_IMETHOD GetType(PRInt32* aType);
|
||||
NS_IMETHOD Init() { return NS_OK; }
|
||||
|
||||
// nsIFocusableContent
|
||||
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
|
||||
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
|
||||
|
||||
protected:
|
||||
nsGenericHTMLContainerElement mInner;
|
||||
nsIForm* mForm;
|
||||
PRInt32 mType;
|
||||
};
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID);
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
|
||||
// Construction, destruction
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLButtonElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLButtonElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLButtonElement::nsHTMLButtonElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
mForm = nsnull;
|
||||
mType = NS_FORM_BUTTON_BUTTON; // default
|
||||
}
|
||||
|
||||
nsHTMLButtonElement::~nsHTMLButtonElement()
|
||||
{
|
||||
if (nsnull != mForm) {
|
||||
// prevent mForm from decrementing its ref count on us
|
||||
mForm->RemoveElement(this, PR_FALSE);
|
||||
NS_RELEASE(mForm);
|
||||
}
|
||||
}
|
||||
|
||||
// nsISupports
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLButtonElement);
|
||||
|
||||
nsresult
|
||||
nsHTMLButtonElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLButtonElementIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMHTMLButtonElement*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kIFormControlIID)) {
|
||||
*aInstancePtr = (void*)(nsIFormControl*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(kIFocusableContentIID)) {
|
||||
*aInstancePtr = (void*)(nsIFocusableContent*) this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
nsHTMLButtonElement::Release()
|
||||
{
|
||||
--mRefCnt;
|
||||
NS_LOG_RELEASE(this, mRefCnt, "nsHTMLButtonElement");
|
||||
if (mRefCnt <= 0) {
|
||||
delete this;
|
||||
return 0;
|
||||
} else if ((1 == mRefCnt) && mForm) {
|
||||
mRefCnt = 0;
|
||||
delete this;
|
||||
return 0;
|
||||
} else {
|
||||
return mRefCnt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// nsIDOMHTMLButtonElement
|
||||
|
||||
nsresult
|
||||
nsHTMLButtonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLButtonElement* it = new nsHTMLButtonElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
// nsIContent
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::SetParent(nsIContent* aParent)
|
||||
{
|
||||
return mInner.SetParentForFormControls(aParent, this, mForm);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
|
||||
{
|
||||
return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
*aForm = nsnull;
|
||||
if (nsnull != mForm) {
|
||||
nsIDOMHTMLFormElement* formElem = nsnull;
|
||||
result = mForm->QueryInterface(kIDOMHTMLFormElementIID, (void**)&formElem);
|
||||
if (NS_OK == result) {
|
||||
*aForm = formElem;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::GetType(nsString& aType)
|
||||
{
|
||||
aType.SetString("button");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, AccessKey, accesskey)
|
||||
//NS_IMPL_BOOL_ATTR(nsHTMLButtonElement, Disabled, disabled)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::GetDisabled(PRBool* aValue)
|
||||
{
|
||||
nsHTMLValue val;
|
||||
nsresult rv = mInner.GetHTMLAttribute(nsHTMLAtoms::disabled, val);
|
||||
*aValue = NS_CONTENT_ATTR_NOT_THERE != rv;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::SetDisabled(PRBool aValue)
|
||||
{
|
||||
nsHTMLValue empty(eHTMLUnit_Empty);
|
||||
if (aValue) {
|
||||
nsresult status = mInner.SetHTMLAttribute(nsHTMLAtoms::disabled, empty, PR_TRUE);
|
||||
mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "DISABLED", PR_TRUE);
|
||||
return status;
|
||||
|
||||
}
|
||||
else {
|
||||
mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::disabled, PR_TRUE);
|
||||
mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "", PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, Name, name)
|
||||
NS_IMPL_INT_ATTR(nsHTMLButtonElement, TabIndex, tabindex)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLButtonElement, Value, value)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::Blur()
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = nsnull;
|
||||
nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Ask the frame to Deselect focus (i.e Blur).
|
||||
formControlFrame->SetFocus(PR_FALSE, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::Focus()
|
||||
{
|
||||
nsIFormControlFrame* formControlFrame = nsnull;
|
||||
nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
formControlFrame->SetFocus(PR_TRUE, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::SetFocus(nsIPresContext* aPresContext)
|
||||
{
|
||||
// first see if we are disabled or not. If disabled then do nothing.
|
||||
nsAutoString disabled;
|
||||
if (NS_CONTENT_ATTR_HAS_VALUE == mInner.GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::disabled, disabled))
|
||||
return NS_OK;
|
||||
|
||||
nsIEventStateManager* esm;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&esm)) {
|
||||
esm->SetContentState(this, NS_EVENT_STATE_FOCUS);
|
||||
NS_RELEASE(esm);
|
||||
}
|
||||
|
||||
Focus();
|
||||
nsIFormControlFrame* formControlFrame = nsnull;
|
||||
nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
formControlFrame->ScrollIntoView(aPresContext);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::RemoveFocus(nsIPresContext* aPresContext)
|
||||
{
|
||||
Blur();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsGenericHTMLElement::EnumTable kButtonTypeTable[] = {
|
||||
{ "button", NS_FORM_BUTTON_BUTTON },
|
||||
{ "reset", NS_FORM_BUTTON_RESET },
|
||||
{ "submit", NS_FORM_BUTTON_SUBMIT },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::tabindex) {
|
||||
if (nsGenericHTMLElement::ParseValue(aValue, 0, 32767, aResult,
|
||||
eHTMLUnit_Integer)) {
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::type) {
|
||||
nsGenericHTMLElement::EnumTable *table = kButtonTypeTable;
|
||||
while (nsnull != table->tag) {
|
||||
if (aValue.EqualsIgnoreCase(table->tag)) {
|
||||
aResult.SetIntValue(table->value, eHTMLUnit_Enumerated);
|
||||
mType = table->value;
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
table++;
|
||||
}
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::disabled) {
|
||||
aResult.SetEmptyValue();
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kButtonTypeTable, aResult);
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
NS_ENSURE_ARG(aPresContext);
|
||||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
|
||||
// Do not process any DOM events if the element is disabled
|
||||
PRBool disabled;
|
||||
nsresult rv = GetDisabled(&disabled);
|
||||
if (NS_FAILED(rv) || disabled) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Try script event handlers first
|
||||
nsresult ret = mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
|
||||
if ((NS_OK == ret) && (nsEventStatus_eIgnore == *aEventStatus) &&
|
||||
!(aFlags & NS_EVENT_FLAG_CAPTURE)) {
|
||||
switch (aEvent->message) {
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
{
|
||||
nsIEventStateManager *stateManager;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
stateManager->SetContentState(this, NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS);
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
{
|
||||
nsIEventStateManager *stateManager;
|
||||
nsIContent *activeLink = nsnull;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
//stateManager->GetActiveLink(&activeLink);
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
|
||||
if (activeLink == this) {
|
||||
if (nsEventStatus_eConsumeNoDefault != *aEventStatus) {
|
||||
nsAutoString href, target, disabled;
|
||||
nsIURI* baseURL = nsnull;
|
||||
GetBaseURL(baseURL);
|
||||
GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::href, href);
|
||||
GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::target, target);
|
||||
GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::disabled, disabled);
|
||||
|
||||
if (target.Length() == 0) {
|
||||
GetBaseTarget(target);
|
||||
}
|
||||
mInner.TriggerLink(aPresContext, eLinkVerb_Replace, baseURL, href, target, PR_TRUE);
|
||||
NS_IF_RELEASE(baseURL);
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
// XXX Bring up a contextual menu provided by the application
|
||||
break;
|
||||
|
||||
case NS_MOUSE_ENTER:
|
||||
{
|
||||
nsIEventStateManager *stateManager;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
stateManager->SetContentState(this, NS_EVENT_STATE_HOVER);
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
// XXX this doesn't seem to do anything yet
|
||||
case NS_MOUSE_EXIT:
|
||||
{
|
||||
nsIEventStateManager *stateManager;
|
||||
if (NS_OK == aPresContext->GetEventStateManager(&stateManager)) {
|
||||
stateManager->SetContentState(nsnull, NS_EVENT_STATE_HOVER);
|
||||
NS_RELEASE(stateManager);
|
||||
}
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::GetType(PRInt32* aType)
|
||||
{
|
||||
if (aType) {
|
||||
*aType = mType;
|
||||
return NS_OK;
|
||||
} else {
|
||||
return NS_FORM_NOTOK;
|
||||
}
|
||||
}
|
||||
|
||||
// An important assumption is that if aForm is null, the previous mForm will not be released
|
||||
// This allows nsHTMLFormElement to deal with circular references.
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::SetForm(nsIDOMHTMLFormElement* aForm)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (nsnull == aForm) {
|
||||
mForm = nsnull;
|
||||
return NS_OK;
|
||||
} else {
|
||||
NS_IF_RELEASE(mForm);
|
||||
nsIFormControl* formControl = nsnull;
|
||||
result = QueryInterface(kIFormControlIID, (void**)&formControl);
|
||||
if ((NS_OK == result) && formControl) {
|
||||
result = aForm->QueryInterface(kIFormIID, (void**)&mForm); // keep the ref
|
||||
if ((NS_OK == result) && mForm) {
|
||||
mForm->AddElement(formControl);
|
||||
}
|
||||
NS_RELEASE(formControl);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
if (!aResult) return NS_ERROR_NULL_POINTER;
|
||||
#ifdef DEBUG
|
||||
mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
if (mForm) {
|
||||
PRBool recorded;
|
||||
aSizer->RecordObject(mForm, &recorded);
|
||||
if (!recorded) {
|
||||
PRUint32 formSize;
|
||||
mForm->SizeOf(aSizer, &formSize);
|
||||
aSizer->AddSize(nsHTMLAtoms::iform, formSize);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
209
mozilla/content/html/content/src/nsHTMLDListElement.cpp
Normal file
209
mozilla/content/html/content/src/nsHTMLDListElement.cpp
Normal file
@@ -0,0 +1,209 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLDListElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIHTMLAttributes.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLDListElementIID, NS_IDOMHTMLDLISTELEMENT_IID);
|
||||
|
||||
class nsHTMLDListElement : public nsIDOMHTMLDListElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLDListElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLDListElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLDListElement
|
||||
NS_IMETHOD GetCompact(PRBool* aCompact);
|
||||
NS_IMETHOD SetCompact(PRBool aCompact);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsGenericHTMLContainerElement mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLDListElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLDListElement::nsHTMLDListElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLDListElement::~nsHTMLDListElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLDListElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLDListElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLDListElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLDListElementIID)) {
|
||||
nsIDOMHTMLDListElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLDListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLDListElement* it = new nsHTMLDListElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLDListElement, Compact, compact)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDListElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::compact) {
|
||||
aResult.SetEmptyValue();
|
||||
return NS_CONTENT_ATTR_NO_VALUE;
|
||||
}
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDListElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
if (nsnull != aAttributes) {
|
||||
nsHTMLValue value;
|
||||
// compact: empty
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::compact, value);
|
||||
if (value.GetUnit() == eHTMLUnit_Empty) {
|
||||
// XXX set
|
||||
}
|
||||
}
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::compact) {
|
||||
aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css?
|
||||
}
|
||||
else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDListElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDListElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
199
mozilla/content/html/content/src/nsHTMLDelElement.cpp
Normal file
199
mozilla/content/html/content/src/nsHTMLDelElement.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
/* -*- 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 Communicator client 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):
|
||||
*/
|
||||
#include "nsIDOMHTMLModElement.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLIIDs.h"
|
||||
#include "nsIStyleContext.h"
|
||||
#include "nsIMutableStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
||||
static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID);
|
||||
|
||||
class nsHTMLDelElement : public nsIDOMHTMLModElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent
|
||||
{
|
||||
public:
|
||||
nsHTMLDelElement(nsIAtom* aTag);
|
||||
virtual ~nsHTMLDelElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode
|
||||
NS_IMPL_IDOMNODE_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMElement
|
||||
NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMHTMLModElement
|
||||
NS_IMETHOD GetCite(nsString& aCite);
|
||||
NS_IMETHOD SetCite(const nsString& aCite);
|
||||
NS_IMETHOD GetDateTime(nsString& aDateTime);
|
||||
NS_IMETHOD SetDateTime(const nsString& aDateTime);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
|
||||
|
||||
// nsIContent
|
||||
NS_IMPL_ICONTENT_USING_GENERIC(mInner)
|
||||
|
||||
// nsIHTMLContent
|
||||
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
|
||||
|
||||
protected:
|
||||
nsGenericHTMLContainerElement mInner;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
|
||||
if (nsnull == aInstancePtrResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
nsIHTMLContent* it = new nsHTMLDelElement(aTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLDelElement::nsHTMLDelElement(nsIAtom* aTag)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInner.Init(this, aTag);
|
||||
}
|
||||
|
||||
nsHTMLDelElement::~nsHTMLDelElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsHTMLDelElement)
|
||||
|
||||
NS_IMPL_RELEASE(nsHTMLDelElement)
|
||||
|
||||
nsresult
|
||||
nsHTMLDelElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
||||
if (aIID.Equals(kIDOMHTMLModElementIID)) {
|
||||
nsIDOMHTMLModElement* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsHTMLDelElement* it = new nsHTMLDelElement(mInner.mTag);
|
||||
if (nsnull == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mInner.CopyInnerTo(this, &it->mInner, aDeep);
|
||||
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
|
||||
}
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLDelElement, Cite, cite)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLDelElement, DateTime, datetime)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDelElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsString& aValue,
|
||||
nsHTMLValue& aResult)
|
||||
{
|
||||
// XXX write me
|
||||
return NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDelElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsString& aResult) const
|
||||
{
|
||||
// XXX write me
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsIMutableStyleContext* aContext,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
// XXX write me
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDelElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||
nsMapAttributesFunc& aMapFunc) const
|
||||
{
|
||||
aFontMapFunc = nsnull;
|
||||
aMapFunc = &MapAttributesInto;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDelElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags, aEventStatus);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDelElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||
{
|
||||
return mInner.SizeOf(aSizer, aResult, sizeof(*this));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user