Compare commits
485 Commits
MAILIM_BRA
...
NETSCAPE_6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
075d0ab2f2 | ||
|
|
5b44c9999f | ||
|
|
d8fe11b5a4 | ||
|
|
c013520119 | ||
|
|
2bcc79014c | ||
|
|
d2fecb7ea9 | ||
|
|
08b9ea85cf | ||
|
|
e1d2c460d6 | ||
|
|
0475a79ff6 | ||
|
|
d6242bd141 | ||
|
|
56fd366948 | ||
|
|
bfe0b8dfe1 | ||
|
|
d942a5fca1 | ||
|
|
3b2582feb8 | ||
|
|
e756b83c4d | ||
|
|
c636a1d999 | ||
|
|
15f05a9fbf | ||
|
|
3723b1d616 | ||
|
|
b9e630cd09 | ||
|
|
069c34903e | ||
|
|
a2bdcdd2c7 | ||
|
|
f8954afd62 | ||
|
|
415e4b72d3 | ||
|
|
1a52900772 | ||
|
|
5b52392817 | ||
|
|
0581a1f59d | ||
|
|
fefa0b8482 | ||
|
|
d865783e96 | ||
|
|
5a8e870248 | ||
|
|
0dd07fcb44 | ||
|
|
a5d0cd6701 | ||
|
|
16aed83af0 | ||
|
|
1299c286cc | ||
|
|
a7ffb58fe2 | ||
|
|
d8f4c33192 | ||
|
|
7ead48dbe8 | ||
|
|
f1860fbadc | ||
|
|
818270ff9e | ||
|
|
ee71b5ceac | ||
|
|
4ba6ac6172 | ||
|
|
de8322aab8 | ||
|
|
43b4280a30 | ||
|
|
785f70d84d | ||
|
|
220bdb30be | ||
|
|
4bf6af20b9 | ||
|
|
632cfc715e | ||
|
|
ddc6be30ee | ||
|
|
d0b0caddc4 | ||
|
|
e6ca9fead3 | ||
|
|
0760514fb0 | ||
|
|
2b0f8da028 | ||
|
|
5d2c1e284e | ||
|
|
ef568e7a83 | ||
|
|
ef74dae0e8 | ||
|
|
b81b213d04 | ||
|
|
1ccf8da466 | ||
|
|
2bb5dd3a5d | ||
|
|
eef1953101 | ||
|
|
ba2c55238e | ||
|
|
1d1da6ebd3 | ||
|
|
994df90bb5 | ||
|
|
f6942a3d2a | ||
|
|
5425558f28 | ||
|
|
7002800e9b | ||
|
|
30e74cffda | ||
|
|
6a51761487 | ||
|
|
1c761ae69d | ||
|
|
612ff0c74e | ||
|
|
13cf71081e | ||
|
|
d12292d5ea | ||
|
|
f01eff3605 | ||
|
|
2293f7a84d | ||
|
|
42bd8c4dd3 | ||
|
|
c2a53f73fa | ||
|
|
806a8b39c2 | ||
|
|
f6fd3e8875 | ||
|
|
d875eec3a4 | ||
|
|
3e416c0513 | ||
|
|
12e9b7a298 | ||
|
|
005aa45847 | ||
|
|
4eb1dbd5a7 | ||
|
|
3cf0e74740 | ||
|
|
4c3f215e2b | ||
|
|
e9ef0ffacc | ||
|
|
beed77f1c0 | ||
|
|
174c0b1558 | ||
|
|
a071e8dc70 | ||
|
|
4882e081f0 | ||
|
|
81e2538482 | ||
|
|
efe018a9e6 | ||
|
|
34083e6795 | ||
|
|
a031df1fb7 | ||
|
|
3b6c8aa9e5 | ||
|
|
f1bf83ec8f | ||
|
|
57de60b35e | ||
|
|
bc1f68f1e9 | ||
|
|
99194edfe0 | ||
|
|
efa8d7d7c8 | ||
|
|
2a4287eccf | ||
|
|
467a13f630 | ||
|
|
2c2aa68e1d | ||
|
|
f43cb3161d | ||
|
|
d1c54329ca | ||
|
|
9693956170 | ||
|
|
2bc62b1415 | ||
|
|
317249c56a | ||
|
|
4326de52b8 | ||
|
|
4910524cab | ||
|
|
f5420bca31 | ||
|
|
b69cd49c6b | ||
|
|
40ae15b240 | ||
|
|
d1a33f3259 | ||
|
|
b8b04b2777 | ||
|
|
ac03659bd8 | ||
|
|
a0cc6531cb | ||
|
|
60e2321259 | ||
|
|
0b83c005e9 | ||
|
|
34349da08b | ||
|
|
598eacc4f9 | ||
|
|
0128156574 | ||
|
|
a713920b70 | ||
|
|
0cdc966245 | ||
|
|
d326bffa32 | ||
|
|
b6ed21bc4a | ||
|
|
19039d5a68 | ||
|
|
d0901fa2c8 | ||
|
|
4e07680f92 | ||
|
|
bca8035316 | ||
|
|
89847524eb | ||
|
|
ff21072f1f | ||
|
|
6057fc9598 | ||
|
|
0b0cebe215 | ||
|
|
b6658b6338 | ||
|
|
2dbe8975f0 | ||
|
|
293f9035f1 | ||
|
|
910ceb167b | ||
|
|
1df70339e2 | ||
|
|
c625f052ea | ||
|
|
eef63da323 | ||
|
|
3dfa1a19b0 | ||
|
|
ff9b7031d6 | ||
|
|
1c612c7742 | ||
|
|
2d7c433ea6 | ||
|
|
48a0d56aa9 | ||
|
|
91f350925b | ||
|
|
ac703f65e5 | ||
|
|
eee6d39a84 | ||
|
|
b4a101d672 | ||
|
|
7e84c99e83 | ||
|
|
97be76f8b4 | ||
|
|
1776a171d4 | ||
|
|
81093cb228 | ||
|
|
6e19a74a09 | ||
|
|
a60d8b4824 | ||
|
|
4ed58c0051 | ||
|
|
ab5c9047fc | ||
|
|
f52bdbc3be | ||
|
|
23d14cad16 | ||
|
|
37c190c22e | ||
|
|
55f314e175 | ||
|
|
77e79f5968 | ||
|
|
1b7215b193 | ||
|
|
6db623ad82 | ||
|
|
745e0f8a58 | ||
|
|
310f048191 | ||
|
|
61fcda7fc3 | ||
|
|
7aa36a6aca | ||
|
|
712dd7ecfc | ||
|
|
aaedc05e69 | ||
|
|
0cbafcd8b0 | ||
|
|
d221f9042c | ||
|
|
d3f2cfed94 | ||
|
|
a4edbcb828 | ||
|
|
faee19ca68 | ||
|
|
2964c08516 | ||
|
|
0088fee340 | ||
|
|
b76d92a07f | ||
|
|
1e590dafd5 | ||
|
|
73005c9879 | ||
|
|
edcfb9968f | ||
|
|
348410001b | ||
|
|
16245543f1 | ||
|
|
8fd5d9b8d9 | ||
|
|
d07cea90df | ||
|
|
f2d19fd047 | ||
|
|
05c0c931e3 | ||
|
|
60177508d7 | ||
|
|
8f05990056 | ||
|
|
7106093ea1 | ||
|
|
673ac81689 | ||
|
|
fb04fb600a | ||
|
|
dddc8c8df5 | ||
|
|
071dcfab31 | ||
|
|
fd55366c47 | ||
|
|
c23f0ea75f | ||
|
|
291eda8da0 | ||
|
|
f60a4a1891 | ||
|
|
222ef59af5 | ||
|
|
3793dbba82 | ||
|
|
8d3f011b8d | ||
|
|
945d2797fa | ||
|
|
4122965e21 | ||
|
|
7ddce62bb2 | ||
|
|
5b8e1decdd | ||
|
|
398e15602b | ||
|
|
5a7f9ef37a | ||
|
|
48c8e05cbb | ||
|
|
83bb6eb88a | ||
|
|
84017680e7 | ||
|
|
307d8d5398 | ||
|
|
f654b64e8f | ||
|
|
1db35f9de8 | ||
|
|
a2e139c514 | ||
|
|
02b9280cdc | ||
|
|
66a8942ed5 | ||
|
|
785351ad99 | ||
|
|
ada1e758a7 | ||
|
|
0bb1da4514 | ||
|
|
746c14890a | ||
|
|
5f0044d4b4 | ||
|
|
87d1ee2413 | ||
|
|
eff3b014c2 | ||
|
|
0ea88c1ad9 | ||
|
|
e2f208e326 | ||
|
|
dd1aa5f0ea | ||
|
|
13636923cd | ||
|
|
b92cb4590b | ||
|
|
2695b5b3be | ||
|
|
ef87a82842 | ||
|
|
821cd9a7fc | ||
|
|
53b8205819 | ||
|
|
04445057b5 | ||
|
|
debd6bd65f | ||
|
|
eb1bfcfde3 | ||
|
|
ff11e9c7ae | ||
|
|
452517be8d | ||
|
|
3a37dfe39b | ||
|
|
ce68108260 | ||
|
|
403167314c | ||
|
|
e7269ea088 | ||
|
|
a7ca00446a | ||
|
|
31572ca31b | ||
|
|
6984a86ab3 | ||
|
|
4b017c8f51 | ||
|
|
10f2a7b17a | ||
|
|
f1e8d63d77 | ||
|
|
c1de59c520 | ||
|
|
e8915585fc | ||
|
|
3cffe12af9 | ||
|
|
d863f44f5c | ||
|
|
086c238bc1 | ||
|
|
d909c4e60d | ||
|
|
01e55af3d4 | ||
|
|
cfd9316e7c | ||
|
|
f54c131e6d | ||
|
|
9d18923188 | ||
|
|
0b5a1e5389 | ||
|
|
570251f1ed | ||
|
|
3caf2a49a4 | ||
|
|
d5a6b35429 | ||
|
|
ad97f177b4 | ||
|
|
e6cdf92b6d | ||
|
|
5433034371 | ||
|
|
5aca2825f0 | ||
|
|
2ed16b645e | ||
|
|
08b216d231 | ||
|
|
62d970524d | ||
|
|
586535752b | ||
|
|
1d3f10ba78 | ||
|
|
336d211083 | ||
|
|
6a8fcb18e0 | ||
|
|
e796f4ea2b | ||
|
|
9aaf9609bb | ||
|
|
7d4e7bc7d8 | ||
|
|
11dda9e7e2 | ||
|
|
e4cc0bbde5 | ||
|
|
f73176d18d | ||
|
|
e9b07bdb22 | ||
|
|
4c4fc299f7 | ||
|
|
2b8c082913 | ||
|
|
1018334fd6 | ||
|
|
2e6f663a94 | ||
|
|
9813c2d012 | ||
|
|
afbaedd313 | ||
|
|
852e7f39be | ||
|
|
8e503e987b | ||
|
|
60055373bc | ||
|
|
de2bdaeb68 | ||
|
|
b4c3ba3158 | ||
|
|
afe70cb20e | ||
|
|
0130c09fdb | ||
|
|
236c9c1438 | ||
|
|
5b724bb62c | ||
|
|
b963f74ca9 | ||
|
|
b2e55c3c08 | ||
|
|
81e4a81df8 | ||
|
|
7c3a29ea6a | ||
|
|
e2e79f0a98 | ||
|
|
2447f93166 | ||
|
|
5e0bcc50ce | ||
|
|
03517e0557 | ||
|
|
e016528374 | ||
|
|
1ccc21361c | ||
|
|
60315dab09 | ||
|
|
d4ed5de1d5 | ||
|
|
d81ee0e696 | ||
|
|
0d53807e8c | ||
|
|
7efa0103e2 | ||
|
|
7f7ef61de5 | ||
|
|
abeddd00b4 | ||
|
|
c8d8f9fc24 | ||
|
|
4fb3a770bf | ||
|
|
fa4e9d0dd8 | ||
|
|
343edffb97 | ||
|
|
394693b9b6 | ||
|
|
e0419770f6 | ||
|
|
2e35258022 | ||
|
|
9cde6c816e | ||
|
|
d647581a41 | ||
|
|
b2d293d7c0 | ||
|
|
2c917ae462 | ||
|
|
5a9683a4ab | ||
|
|
7b58da0cad | ||
|
|
ce6add0fed | ||
|
|
b7a27c33db | ||
|
|
078783926a | ||
|
|
dcc28801e7 | ||
|
|
3f5a2e8a5c | ||
|
|
0c3eee476f | ||
|
|
858763d06d | ||
|
|
ede0c5ab73 | ||
|
|
9c28bc6229 | ||
|
|
f6eb933aec | ||
|
|
0a6a9fd629 | ||
|
|
627a2fa5d3 | ||
|
|
8bad31c580 | ||
|
|
973a138490 | ||
|
|
766d65fa78 | ||
|
|
2bed6f7a2b | ||
|
|
1db6f7b7c8 | ||
|
|
3ee4597b02 | ||
|
|
a4a473d518 | ||
|
|
6a6ab4e28f | ||
|
|
a3e9b17f10 | ||
|
|
253a49cd77 | ||
|
|
cd21c03664 | ||
|
|
cf126e08a2 | ||
|
|
d5205a0cbe | ||
|
|
44f8952c2b | ||
|
|
b4356e037d | ||
|
|
dc98e60ad1 | ||
|
|
12b282edd2 | ||
|
|
9dc2508915 | ||
|
|
913974ff70 | ||
|
|
a611c3fa27 | ||
|
|
e2f91e0eef | ||
|
|
e9812af9dd | ||
|
|
9391a7135e | ||
|
|
ed6ff1f297 | ||
|
|
c8b90827ed | ||
|
|
32e5e46df0 | ||
|
|
8f3d1f533b | ||
|
|
68683e8186 | ||
|
|
5226e443c4 | ||
|
|
1ffe13a4bb | ||
|
|
3aa4e8ee82 | ||
|
|
95fdb80ac3 | ||
|
|
592d631348 | ||
|
|
5ad63473b5 | ||
|
|
ca2930fef6 | ||
|
|
e042778097 | ||
|
|
48e8dc3afe | ||
|
|
ee5b88f504 | ||
|
|
da4c1220ad | ||
|
|
5d20e95a61 | ||
|
|
1518265a7a | ||
|
|
8c85e4fcf1 | ||
|
|
e53aec46d1 | ||
|
|
6887bc1966 | ||
|
|
9b5877a83a | ||
|
|
ba09c542b2 | ||
|
|
a66b153c53 | ||
|
|
e65919336e | ||
|
|
e2f1a9bc9b | ||
|
|
c9465eb348 | ||
|
|
e45ffff2a7 | ||
|
|
c9bf14bd6f | ||
|
|
2c7c8fa4ac | ||
|
|
7910b2e903 | ||
|
|
bda5786937 | ||
|
|
bd8d4b80bc | ||
|
|
a9f8eb5255 | ||
|
|
a19dc671ba | ||
|
|
214d0bb707 | ||
|
|
da71dddcd1 | ||
|
|
c01dd3e2f6 | ||
|
|
a1945a4b37 | ||
|
|
d6c7837d7e | ||
|
|
7ab11a2910 | ||
|
|
918aedd742 | ||
|
|
3a6dcacb77 | ||
|
|
5d4c9c03c9 | ||
|
|
1665532f16 | ||
|
|
11f1c99c39 | ||
|
|
afd88479d3 | ||
|
|
7168d1a8c3 | ||
|
|
964dde1cad | ||
|
|
90e92c729e | ||
|
|
9c8e527cba | ||
|
|
ccb1e2fd37 | ||
|
|
d326ebbdba | ||
|
|
5662ee8b97 | ||
|
|
34fd65e72e | ||
|
|
1619de5a13 | ||
|
|
cef8df4890 | ||
|
|
c5d40fbb22 | ||
|
|
c6e4cd4a0c | ||
|
|
a0da673610 | ||
|
|
6915c9b64f | ||
|
|
d4ddf5b901 | ||
|
|
bec02d74b7 | ||
|
|
fbf8f97a35 | ||
|
|
9f0ad3c850 | ||
|
|
7cb1660860 | ||
|
|
cb6a00d0dd | ||
|
|
19a5fead7d | ||
|
|
62f334a0a2 | ||
|
|
102a2724fa | ||
|
|
a5cae88f2e | ||
|
|
e327210730 | ||
|
|
80626e227e | ||
|
|
adf70abbbb | ||
|
|
498ce0aaf9 | ||
|
|
5e0af0ccdd | ||
|
|
de0910f6ee | ||
|
|
b61fa5b60e | ||
|
|
8efa6975cc | ||
|
|
9695eac077 | ||
|
|
fbb7e7472a | ||
|
|
32f3806bf0 | ||
|
|
3fbb2b5028 | ||
|
|
373281325e | ||
|
|
07d3891457 | ||
|
|
ce34146fa4 | ||
|
|
2e1a9bce6d | ||
|
|
e68b30e16e | ||
|
|
f75f2c964a | ||
|
|
3cc3b02e9f | ||
|
|
43082cc7d3 | ||
|
|
84ca3e46fc | ||
|
|
b71a0d4153 | ||
|
|
88232d9b3d | ||
|
|
8532c1fd58 | ||
|
|
18603b97ef | ||
|
|
137b5e30b9 | ||
|
|
574b31e2c7 | ||
|
|
e127df6817 | ||
|
|
1b9e0a9dbb | ||
|
|
4c002b41db | ||
|
|
1b7655115b | ||
|
|
3b9e749579 | ||
|
|
9ede8deaa5 | ||
|
|
c926a9ad82 | ||
|
|
d63d20c4e9 | ||
|
|
87a35d18c4 | ||
|
|
58bb911f81 | ||
|
|
1fc4f6cf6d | ||
|
|
1322ba0abd | ||
|
|
276b070725 | ||
|
|
d1ebb0777f | ||
|
|
c5fed3e06b | ||
|
|
19d0f57a0f | ||
|
|
93c47a625f | ||
|
|
4892be5264 | ||
|
|
703d584111 | ||
|
|
65b6908093 | ||
|
|
9e99e7738f | ||
|
|
055359c675 | ||
|
|
7301a8096a | ||
|
|
4c2fcd5edd | ||
|
|
16f4fe9967 | ||
|
|
fda7a2186a | ||
|
|
90bc0fe117 | ||
|
|
3f49f9c396 | ||
|
|
ab3d5d6cb7 |
@@ -35,155 +35,65 @@ EXPORT_DIRS = $(BUILD_MODULE_DEP_DIRS)
|
||||
|
||||
else
|
||||
|
||||
#
|
||||
# And now for something completely different...
|
||||
# Divide the default build into tiers.
|
||||
# Tiers must be defined on module boundaries
|
||||
#
|
||||
default: $(SUBMAKEFILES)
|
||||
$(MAKE) tier_0
|
||||
$(MAKE) nspr
|
||||
$(MAKE) ldap
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
$(MAKE) freetype
|
||||
$(MAKE) expat
|
||||
endif
|
||||
$(MAKE) tier_1
|
||||
$(MAKE) tier_2
|
||||
$(MAKE) tier_9
|
||||
ifdef MOZ_EXTENSIONS
|
||||
$(MAKE) tier_94
|
||||
endif
|
||||
ifdef MOZ_PSM
|
||||
$(MAKE) tier_95
|
||||
endif
|
||||
ifdef MOZ_MAIL_NEWS
|
||||
$(MAKE) tier_97
|
||||
endif
|
||||
ifdef MOZ_CALENDAR
|
||||
$(MAKE) tier_98
|
||||
endif
|
||||
$(MAKE) tier_99
|
||||
|
||||
# Make sure that the existing rulesets work
|
||||
DIRS = \
|
||||
$(tier_0_dirs) \
|
||||
$(tier_1_dirs) \
|
||||
$(tier_2_dirs) \
|
||||
$(tier_9_dirs) \
|
||||
$(NULL)
|
||||
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
DIRS += gc/boehm
|
||||
endif
|
||||
|
||||
ifdef MOZ_EXTENSIONS
|
||||
DIRS += $(tier_94_dirs)
|
||||
endif
|
||||
ifdef MOZ_PSM
|
||||
DIRS += $(tier_95_dirs)
|
||||
endif
|
||||
ifdef MOZ_MAIL_NEWS
|
||||
DIRS += $(tier_97_dirs)
|
||||
endif
|
||||
ifdef MOZ_CALENDAR
|
||||
DIRS += $(tier_98_dirs)
|
||||
endif
|
||||
|
||||
DIRS += $(tier_99_dirs)
|
||||
|
||||
#
|
||||
# tier 0 - base build config dirs
|
||||
#
|
||||
tier_0_dirs = \
|
||||
config \
|
||||
build \
|
||||
include \
|
||||
$(NULL)
|
||||
|
||||
#
|
||||
# tier 1 - 3rd party individual libraries
|
||||
#
|
||||
tier_1_dirs += dbm
|
||||
|
||||
ifndef MOZ_NATIVE_JPEG
|
||||
tier_1_dirs += jpeg
|
||||
endif
|
||||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
tier_1_dirs += modules/zlib
|
||||
endif
|
||||
|
||||
# Installer needs standalone libjar, hence standalone zlib
|
||||
ifdef MOZ_INSTALLER
|
||||
tier_1_dirs += modules/zlib/standalone
|
||||
endif
|
||||
|
||||
ifdef MOZ_INTERNAL_LIBART_LGPL
|
||||
tier_1_dirs += other-licenses/libart_lgpl
|
||||
endif
|
||||
|
||||
#
|
||||
# tier 2 - base libraries
|
||||
#
|
||||
tier_2_dirs = js
|
||||
|
||||
# MacOSX needs to build lib for MoreFiles before xpcom
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
tier_2_dirs += lib/mac/MoreFiles
|
||||
endif
|
||||
|
||||
tier_2_dirs += \
|
||||
modules/libreg \
|
||||
string \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
#
|
||||
# tier 9 - core components (necko,gecko)
|
||||
#
|
||||
|
||||
tier_9_dirs += \
|
||||
js/src/xpconnect \
|
||||
intl \
|
||||
modules/libjar \
|
||||
$(NULL)
|
||||
DIRS = config build
|
||||
|
||||
ifdef MOZ_JAVA_SUPPLEMENT
|
||||
tier_9_dirs += \
|
||||
DIRS += \
|
||||
java/util \
|
||||
java/webclient \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# boehm needs to be built before XPCOM
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
DIRS += gc/boehm
|
||||
endif
|
||||
|
||||
DIRS += $(NSPRPUB_DIR)
|
||||
|
||||
DIRS += dbm modules/libreg js string xpcom js/src/xpconnect
|
||||
|
||||
ifdef MOZ_OJI
|
||||
tier_9_dirs += js/src/liveconnect
|
||||
DIRS += js/src/liveconnect
|
||||
endif
|
||||
|
||||
ifdef MOZ_JSDEBUGGER
|
||||
tier_9_dirs += js/jsd
|
||||
DIRS += js/jsd
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
tier_9_dirs += other-licenses/Xft
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
DIRS += modules/zlib
|
||||
endif
|
||||
|
||||
ifndef MOZ_NATIVE_JPEG
|
||||
DIRS += jpeg
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XLIB
|
||||
tier_9_dirs += gfx/src/xlibrgb widget/src/xlibxtbin
|
||||
DIRS += gfx/src/xlibrgb widget/src/xlibxtbin
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
tier_9_dirs += widget/src/gtksuperwin widget/src/gtkxtbin
|
||||
DIRS += widget/src/gtksuperwin widget/src/gtkxtbin
|
||||
endif
|
||||
|
||||
tier_9_dirs += \
|
||||
# Linux and Solaris installer needs standalone libjar, hence standalone zlib
|
||||
ifneq (,$(filter Linux SunOS,$(OS_ARCH)))
|
||||
DIRS += modules/zlib/standalone
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
widget/timer \
|
||||
include \
|
||||
modules/libutil \
|
||||
netwerk \
|
||||
modules/mpfilelocprovider \
|
||||
uriloader \
|
||||
intl \
|
||||
modules/libpref \
|
||||
modules/libimg \
|
||||
modules/oji \
|
||||
modules/libjar \
|
||||
caps \
|
||||
rdf \
|
||||
expat \
|
||||
@@ -208,67 +118,53 @@ tier_9_dirs += \
|
||||
$(NULL)
|
||||
|
||||
ifdef ACCESSIBILITY
|
||||
tier_9_dirs += accessible
|
||||
endif
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
tier_9_dirs += directory/xpcom
|
||||
DIRS += accessible
|
||||
endif
|
||||
|
||||
# This must preceed xpfe
|
||||
ifdef MOZ_JPROF
|
||||
tier_9_dirs += tools/jprof
|
||||
DIRS += tools/jprof
|
||||
endif
|
||||
|
||||
tier_9_dirs += xpfe xpinstall
|
||||
DIRS += xpfe
|
||||
|
||||
ifdef MOZ_LEAKY
|
||||
tier_9_dirs += tools/leaky
|
||||
endif
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
tier_9_dirs += tools/trace-malloc
|
||||
endif
|
||||
|
||||
tier_9_dirs += l10n
|
||||
|
||||
#
|
||||
# tier 9x - application features
|
||||
#
|
||||
|
||||
ifdef MOZ_EXTENSIONS
|
||||
tier_94_dirs += extensions
|
||||
endif
|
||||
DIRS += xpinstall
|
||||
|
||||
ifdef MOZ_PSM
|
||||
tier_95_dirs += security/manager
|
||||
DIRS += security/manager
|
||||
endif
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
DIRS += directory/c-sdk/ldap directory/xpcom
|
||||
endif
|
||||
|
||||
ifdef MOZ_EXTENSIONS
|
||||
DIRS += extensions
|
||||
endif
|
||||
|
||||
ifdef MOZ_MAIL_NEWS
|
||||
tier_97_dirs += mailnews
|
||||
DIRS += mailnews
|
||||
endif
|
||||
|
||||
ifdef MOZ_CALENDAR
|
||||
tier_98_dirs += calendar
|
||||
ifdef MOZ_LEAKY
|
||||
DIRS += tools/leaky
|
||||
endif
|
||||
|
||||
#
|
||||
# tier 99 - application binaries
|
||||
#
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += xpcom/tests
|
||||
endif
|
||||
|
||||
DIRS += l10n
|
||||
|
||||
ifneq (,$(MOZ_STATIC_COMPONENTS)$(MOZ_META_COMPONENTS))
|
||||
tier_99_dirs += modules/staticmod
|
||||
DIRS += modules/staticmod
|
||||
endif
|
||||
|
||||
tier_99_dirs += xpfe/bootstrap
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
tier_99_dirs += embedding/browser/gtk/tests
|
||||
endif
|
||||
DIRS += xpfe/bootstrap
|
||||
|
||||
endif # BUILD_MODULES == all
|
||||
|
||||
STATIC_MAKEFILES := nsprpub directory/c-sdk
|
||||
STATIC_MAKEFILES := $(NSPRPUB_DIR) directory/c-sdk/ldap
|
||||
|
||||
ifdef MOZ_PSM
|
||||
STATIC_MAKEFILES += security/nss
|
||||
@@ -280,120 +176,12 @@ DIST_GARBAGE = config.cache config.log config.status config-defs.h \
|
||||
unallmakefiles \
|
||||
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
|
||||
|
||||
ifeq ($(BUILD_MODULES),all)
|
||||
# Build psuedo-external modules first when export is explicitly called
|
||||
export::
|
||||
$(MAKE) -C config export
|
||||
$(MAKE) nspr
|
||||
$(MAKE) ldap
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
$(MAKE) freetype
|
||||
$(MAKE) expat
|
||||
endif
|
||||
|
||||
install::
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
$(MAKE) -C nsprpub real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/nspr
|
||||
$(RM) -f $(addprefix $(DESTDIR)$(mozappdir)/$(LIB_PREFIX), $(addsuffix .$(LIB_SUFFIX), nspr4 plds4 plc4))
|
||||
$(RM) -f $(addprefix $(DESTDIR)$(bindir)/,nspr-config compile-et.pl prerr.properties)
|
||||
endif
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
$(MAKE) -C directory/c-sdk real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/ldap
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq ($(BUILD_MODULES),all)
|
||||
# Clean up after psuedo-external modules
|
||||
clean clobber realclean clobber_all distclean::
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
$(MAKE) -C nsprpub $@
|
||||
endif
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
$(MAKE) -C directory/c-sdk $@
|
||||
endif
|
||||
endif
|
||||
|
||||
tier_%:
|
||||
@echo "$@: $($@_dirs)"
|
||||
@$(EXIT_ON_ERROR) \
|
||||
for d in $($@_dirs); do $(UPDATE_TITLE) \
|
||||
$(MAKE) -C $$d export; \
|
||||
done ; \
|
||||
$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include ;\
|
||||
for d in $($@_dirs); do $(UPDATE_TITLE) \
|
||||
$(MAKE) -C $$d libs; \
|
||||
done
|
||||
#
|
||||
# Individual modules
|
||||
#
|
||||
boehm:
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
$(MAKE) -C gc/boehm
|
||||
endif
|
||||
|
||||
nspr: boehm
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
$(MAKE) -C nsprpub
|
||||
endif
|
||||
|
||||
ldap:
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
$(MAKE) -C directory/c-sdk
|
||||
endif
|
||||
|
||||
freetype:
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
ifndef MOZ_XFT_SYSTEM_FREETYPE2
|
||||
$(MAKE) -C other-licenses/freetype
|
||||
$(MAKE) -C other-licenses/freetype install
|
||||
endif
|
||||
endif
|
||||
|
||||
expat:
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
$(MAKE) -C other-licenses/expat
|
||||
$(MAKE) -C other-licenses/expat install
|
||||
endif
|
||||
|
||||
# For modules.mk standalone build
|
||||
export::
|
||||
+$(LOOP_OVER_EXPORT_DIRS)
|
||||
|
||||
export::
|
||||
@$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include
|
||||
|
||||
distclean::
|
||||
cat unallmakefiles | $(XARGS) rm -f
|
||||
rm -f unallmakefiles $(DIST_GARBAGE)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
rebase:
|
||||
ifdef MOZILLA_OFFICIAL
|
||||
echo rebasing $(DIST)
|
||||
/bin/find $(DIST) -name "*.dll" > rebase.lst
|
||||
rebase -b 60000000 -R . -G rebase.lst
|
||||
rm rebase.lst
|
||||
endif
|
||||
|
||||
splitsymbols:
|
||||
ifdef MOZILLA_OFFICIAL
|
||||
echo splitting symbols out of binaries
|
||||
/bin/find $(DIST) -name "*.dll" -exec splitsym {} \;
|
||||
/bin/find $(DIST) -name "*.exe" -exec splitsym {} \;
|
||||
/bin/find $(DIST) -name "*.EXE" -exec splitsym {} \;
|
||||
endif # MOZILLA_OFFICIAL
|
||||
|
||||
deliver: splitsymbols rebase
|
||||
|
||||
endif # WINNT
|
||||
|
||||
# Temporary hack for NSS 3.4 landing (bug 116334, wtc@netscape.com)
|
||||
ifdef MOZ_PSM
|
||||
ifdef COMPILER_DEPEND
|
||||
depend::
|
||||
$(MAKE) -C security/manager depend
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -1,325 +0,0 @@
|
||||
==============================================================
|
||||
|
||||
= = = = = = = = = = Mozilla Read Me = = = = = = = = = = =
|
||||
|
||||
==============================================================
|
||||
|
||||
Mozilla is subject to the terms detailed in the license
|
||||
agreement accompanying it.
|
||||
|
||||
This Read Me file contains information about system
|
||||
requirements and installation instructions for the Windows,
|
||||
Mac OS, and Linux builds of Mozilla.
|
||||
|
||||
For more info on Mozilla, see www.mozilla.org. To submit bugs
|
||||
or other feedback, see the Navigator QA menu and check out
|
||||
Bugzilla at http://bugzilla.mozilla.org for links to known
|
||||
bugs, bug-writing guidelines, and more. You can also get help
|
||||
with Bugzilla by pointing your IRC client to #mozillazine
|
||||
at irc.mozilla.org.
|
||||
|
||||
|
||||
==============================================================
|
||||
|
||||
Getting Mozilla
|
||||
|
||||
==============================================================
|
||||
|
||||
You can download nightly builds of Mozilla from the
|
||||
Mozilla.org FTP site at
|
||||
|
||||
ftp://ftp.mozilla.org/pub/mozilla/nightly/
|
||||
|
||||
For the very latest builds, see
|
||||
|
||||
ftp://ftp.mozilla.org/pub/mozilla/nightly/latest
|
||||
|
||||
Keep in mind that nightly builds, which are used by
|
||||
Mozilla.org developers for testing, may be buggy. If you are
|
||||
looking for a more polished version of Mozilla, Mozilla.org
|
||||
releases Milestone builds of Mozilla every six weeks or so
|
||||
that you can download from
|
||||
|
||||
http://www.mozilla.org/releases
|
||||
|
||||
Be sure to read the Mozilla release notes for information
|
||||
on known problems and installation issues with Mozilla.
|
||||
The release notes can be found at the preceding URL along
|
||||
with the milestone releases themselves.
|
||||
|
||||
Note: Please use Talkback builds whenever possible. These
|
||||
builds allow transmission of crash data back to Mozilla
|
||||
developers, improved crash analysis, and posting of crash
|
||||
information to our crash-data newsgroup.
|
||||
|
||||
|
||||
==============================================================
|
||||
|
||||
System Requirements
|
||||
|
||||
==============================================================
|
||||
|
||||
*All Platforms
|
||||
|
||||
To view and use the new streamlined "Modern" theme,
|
||||
your display monitor should be set to display
|
||||
thousands of colors. For users who cannot set their
|
||||
displays to use more than 256 colors, Mozilla.org
|
||||
recommends using the "Classic" theme for Mozilla.
|
||||
|
||||
To select the Modern theme after you have installed
|
||||
Mozilla, from the Navigator browser, open the View
|
||||
menu, and then open then open the Apply Theme submenu
|
||||
and choose Modern.
|
||||
|
||||
*Mac OS
|
||||
|
||||
-Mac OS 8.6 or later
|
||||
-PowerPC 604e 266 MHz or faster processor, or G3/G4
|
||||
-64 MB RAM
|
||||
-36 MB of free hard disk space
|
||||
|
||||
*Windows
|
||||
|
||||
-Windows 9x/Me or Windows NT 4/2000/XP
|
||||
-Intel Pentium-class 233 MHz (or faster) processor
|
||||
-64 MB RAM
|
||||
-26 MB free hard disk space
|
||||
|
||||
*Linux
|
||||
|
||||
-Red Hat Linux 6.x or 7 with X11 R6
|
||||
[Note: Mozilla is certified and fully supported on
|
||||
Red Hat Linux, but will run on other Linux
|
||||
distributions, such as Debian 2.1 (or later) or
|
||||
SuSE 6.2 (or later). The libraries glibc 2.1 (or
|
||||
higher) and libjpeg.so.62 (or higher) are required.]
|
||||
-Intel Pentium-class 233 MHz (or faster) processor
|
||||
-64MB RAM
|
||||
-26MB free hard disk space
|
||||
|
||||
|
||||
==============================================================
|
||||
|
||||
Installation Instructions
|
||||
|
||||
==============================================================
|
||||
|
||||
For Mac OS and Windows users, it is strongly recommended that
|
||||
you exit all programs before running the setup program. Also,
|
||||
you should temporarily disable virus-detection software.
|
||||
|
||||
For Linux users, note that the installation instructions use
|
||||
the bash shell. If you're not using bash, adjust the commands
|
||||
accordingly.
|
||||
|
||||
For all platforms, install into a clean (new) directory.
|
||||
Installing on top of previously released builds may cause
|
||||
problems.
|
||||
|
||||
Note: These instructions do not tell you how to build Mozilla.
|
||||
For info on building the Mozilla source, see
|
||||
|
||||
http://www.mozilla.org/source.html
|
||||
|
||||
|
||||
Windows Installation Instructions
|
||||
---------------------------------
|
||||
|
||||
Note: For Windows NT/2000/XP systems, you need Administrator
|
||||
privileges to install Mozilla. If you see an "Error 5" message
|
||||
during installation, make sure you're running the installation
|
||||
with Administrator privileges.
|
||||
|
||||
|
||||
To install Mozilla by downloading the Mozilla installer,
|
||||
follow these steps:
|
||||
|
||||
1. Click the the mozilla-win32-installer.exe link on
|
||||
the site you're downloading Mozilla from to download
|
||||
the installer file to your machine.
|
||||
|
||||
2. Navigate to where you downloaded the file and
|
||||
double-click the Mozilla program icon on your machine
|
||||
to begin the Setup program.
|
||||
|
||||
3. Follow the on-screen instructions in the setup
|
||||
program. The program starts automatically the first
|
||||
time.
|
||||
|
||||
|
||||
To install Mozilla by downloading the .zip file and
|
||||
installing manually, follow these steps:
|
||||
|
||||
1. Click the mozilla-win32-talkback.zip link or the
|
||||
mozilla-win32.zip link on the site you're down-
|
||||
loading Mozilla from to download the .zip file to
|
||||
your machine.
|
||||
|
||||
2. Navigate to where you downloaded the file and
|
||||
double-click the compressed file.
|
||||
|
||||
Note: This step assumes you already have a recent
|
||||
version of WinZip installed, and that you know how to
|
||||
use it. If not, you can get WinZip and information
|
||||
about the program at www.winzip.com.
|
||||
|
||||
3. Extract the .zip file to a directory such as
|
||||
C:\Program Files\mozilla.org\Mozilla.
|
||||
|
||||
4. To start Mozilla, navigate to the directory you
|
||||
extracted Mozilla to and double-click the Mozilla.exe
|
||||
icon.
|
||||
|
||||
|
||||
Mac OS Installation Instructions
|
||||
--------------------------------
|
||||
|
||||
Note: If the downloaded file does not expand automatically
|
||||
you must expand the file using a program such as StuffIt
|
||||
Expander. Expander ships with all new Macs and comes with the
|
||||
default system install, so you may want to do a find in
|
||||
Sherlock for "StuffIt" to make sure that you don't already
|
||||
have it installed.
|
||||
|
||||
If you don't have Expander, you can get a copy at the
|
||||
following Web site:
|
||||
|
||||
http://www.aladdinsys.com/expander/expander_mac_login.html
|
||||
|
||||
If you do already have Expander, you need to set it to start
|
||||
by default. See the above URL for info on using Expander.
|
||||
|
||||
|
||||
To install Mozilla by downloading the Mozilla installer,
|
||||
(recommended) follow these steps:
|
||||
|
||||
1. Click the MacMozillaInstaller.sea.bin link on the
|
||||
site you're downloading Mozilla from to download the
|
||||
file to your Mac's desktop. A MozillaInstaller
|
||||
folder is created.
|
||||
|
||||
2. Double-click the MozillaInstaller folder in the
|
||||
Finder.
|
||||
|
||||
3. Double-click the Mozilla Installer icon.
|
||||
|
||||
4. Follow the on-screen instructions to complete the
|
||||
installation process.
|
||||
|
||||
5. To start Mozilla, open the folder where you
|
||||
installed Mozilla and double-click the Mozilla icon.
|
||||
|
||||
|
||||
To install Mozilla by downloading the .bin file and
|
||||
installing manually, follow these steps:
|
||||
|
||||
1. Click the mozilla-mac-*.sea.bin link on the site
|
||||
you're downloading Mozilla from to download the
|
||||
Mozilla binary to your Mac's desktop.
|
||||
|
||||
2. Double-click the mozilla-mac-*.sea.sit.bin icon
|
||||
on your desktop.
|
||||
|
||||
3. Choose the directory where you want to install
|
||||
Mozilla.
|
||||
|
||||
4. To start Mozilla, open the folder where you
|
||||
installed Mozilla and double-click the Mozilla icon.
|
||||
|
||||
|
||||
Linux Installation Instructions
|
||||
-------------------------------
|
||||
|
||||
Note: If you install in the default directory (which is
|
||||
usually /usr/local/mozilla), or any other directory where
|
||||
only the root user normally has write-access, you must
|
||||
start Mozilla first as root before other users can start
|
||||
the program. Doing so generates a set of files required
|
||||
for later use by other users.
|
||||
|
||||
|
||||
To install Mozilla by downloading the Mozilla installer,
|
||||
follow these steps:
|
||||
|
||||
1. Create a directory named mozilla (mkdir mozilla)
|
||||
and change to that directory (cd mozilla).
|
||||
|
||||
2. Click the link on the site you're downloading
|
||||
Mozilla from to download the installer file
|
||||
(called mozilla-1686-pc-linux-gnu-installer.tar.gz)
|
||||
to your machine.
|
||||
|
||||
3. Change to the mozilla directory (cd mozilla) and
|
||||
decompress the archive with the following command:
|
||||
|
||||
tar zxvf moz*.tar.gz
|
||||
|
||||
The installer is now located in a subdirectory of
|
||||
Mozilla named mozilla-installer.
|
||||
|
||||
4. Change to the mozilla-installer directory
|
||||
(cd mozilla-installer) and run the installer with the
|
||||
./mozilla-installer command.
|
||||
|
||||
5. Follow the instructions in the install wizard for
|
||||
installing Mozilla.
|
||||
|
||||
Note: If you have a slower machine, be aware that the
|
||||
installation may take some time. In this case, the
|
||||
installation progress may appear to hang indefinitely,
|
||||
even though the installation is still in process.
|
||||
|
||||
6. To start Mozilla, change to the directory where you
|
||||
installed it and run the ./mozilla command.
|
||||
|
||||
|
||||
To install Mozilla by downloading the tar.gz file:
|
||||
|
||||
1. Create a directory named "mozilla" (mkdir mozilla)
|
||||
and change to that directory (cd mozilla).
|
||||
|
||||
2. Click the link on the site you're downloading
|
||||
Mozilla from to download the non-installer
|
||||
(mozilla*.tar.gz) file into the mozilla directory.
|
||||
|
||||
3. Change to the mozilla directory (cd mozilla) and
|
||||
decompress the file with the following command:
|
||||
|
||||
tar zxvf moz*.tar.gz
|
||||
|
||||
This creates a "mozilla" directory under your mozilla
|
||||
directory.
|
||||
|
||||
4. Change to the mozilla directory (cd mozilla).
|
||||
|
||||
5. Run Mozilla with the following run script:
|
||||
|
||||
./mozilla
|
||||
|
||||
|
||||
To hook up Mozilla complete with icon to the GNOME Panel,
|
||||
follow these steps:
|
||||
|
||||
1. Click the GNOME Main Menu button, open the Panel menu,
|
||||
and then open the Add to Panel submenu and choose Launcher.
|
||||
|
||||
2. Right-click the icon for Mozilla on the Panel and
|
||||
enter the following command:
|
||||
directory_name./mozilla
|
||||
|
||||
where directory_name is the name of the directory
|
||||
you downloaded mozilla to. For example, the default
|
||||
directory that Mozilla suggests is /usr/local/mozilla.
|
||||
|
||||
3. Type in a name for the icon, and type in a comment
|
||||
if you wish.
|
||||
|
||||
4. Click the icon button and type in the following as
|
||||
the icon's location:
|
||||
|
||||
directory_name/icons/mozicon50.xpm
|
||||
|
||||
where directory name is the directory where you
|
||||
installed Mozilla. For example, the default directory
|
||||
is /usr/local/mozilla/icons/mozicon50.xpm.
|
||||
@@ -16,7 +16,7 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
@@ -29,39 +29,28 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility
|
||||
EXPORT_LIBRARY = 1
|
||||
ifneq ($(OS_ARCH),WINNT)
|
||||
SHORT_LIBNAME = access
|
||||
endif
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsAccessibilityModule
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
dom \
|
||||
$(NULL)
|
||||
REQUIRES = xpcom string dom
|
||||
|
||||
CPPSRCS = nsAccessibilityFactory.cpp
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../src
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libaccessibility_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_XUL
|
||||
SHARED_LIBRARY_LIBS += $(DIST)/lib/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LIBS = \
|
||||
gkconshared_s \
|
||||
gkgfx \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(LIBS_DIR) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
-L$(DIST)/lib \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
-lgkgfx \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -17,40 +17,30 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
dom \
|
||||
$(NULL)
|
||||
LIBRARY_NAME=accessibility
|
||||
MODULE_NAME=nsAccessibilityModule
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessibilityFactory.obj \
|
||||
.\$(OBJDIR)\nsAccessibilityFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = $(LINCS) -I..\src # for implementation headers
|
||||
|
||||
SUB_LIBRARIES=\
|
||||
$(DIST)\lib\accessibility_base_s.lib \
|
||||
$(DIST)\lib\accessibility_html_s.lib \
|
||||
!ifdef MOZ_XUL
|
||||
$(DIST)\lib\accessibility_xul_s.lib \
|
||||
!endif
|
||||
$(DIST)\lib\accessibility_s.lib \
|
||||
$(NULL)
|
||||
|
||||
LLIBS=\
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\gkgfx.lib \
|
||||
$(DIST)\lib\contentshared_s.lib \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\timer_s.lib \
|
||||
$(DIST)\lib\gkgfx.lib \
|
||||
$(DIST)\lib\contentshared_s.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
|
||||
@@ -1,40 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
@@ -63,7 +47,7 @@ NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aRes
|
||||
}
|
||||
|
||||
// The list of components we register
|
||||
static const nsModuleComponentInfo components[] =
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "AccessibilityService",
|
||||
NS_ACCESSIBILITY_SERVICE_CID,
|
||||
|
||||
BIN
mozilla/accessible/macbuild/accessible.mcp
Normal file
BIN
mozilla/accessible/macbuild/accessible.mcp
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
mozilla/accessible/macbuild/accessibleIDL.mcp
Normal file
BIN
mozilla/accessible/macbuild/accessibleIDL.mcp
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -32,21 +32,14 @@ XPIDL_MODULE= accessibility
|
||||
XPIDLSRCS = \
|
||||
nsIAccessibilityService.idl \
|
||||
nsIAccessible.idl \
|
||||
nsIAccessibleAction.idl \
|
||||
nsIAccessibleCaret.idl \
|
||||
nsIAccessibleDocument.idl \
|
||||
nsIAccessibleEditableText.idl \
|
||||
nsIAccessibleEventReceiver.idl \
|
||||
nsIAccessibleEventListener.idl \
|
||||
nsIAccessibleHyperLink.idl \
|
||||
nsIAccessibleHyperText.idl \
|
||||
nsIAccessibleProvider.idl \
|
||||
nsIAccessibleSelectable.idl \
|
||||
nsIAccessibleTable.idl \
|
||||
nsIAccessibleText.idl \
|
||||
nsIAccessibleValue.idl \
|
||||
nsIAccessibleWin32Object.idl \
|
||||
nsIAccessibleSelectable.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -26,20 +26,10 @@ XPIDL_MODULE=accessibility
|
||||
XPIDLSRCS = \
|
||||
.\nsIAccessibilityService.idl \
|
||||
.\nsIAccessible.idl \
|
||||
.\nsIAccessibleAction.idl \
|
||||
.\nsIAccessibleCaret.idl \
|
||||
.\nsIAccessibleDocument.idl \
|
||||
.\nsIAccessibleEditableText.idl \
|
||||
.\nsIAccessibleEventReceiver.idl \
|
||||
.\nsIAccessibleEventListener.idl \
|
||||
.\nsIAccessibleHyperLink.idl \
|
||||
.\nsIAccessibleHyperText.idl \
|
||||
.\nsIAccessibleProvider.idl \
|
||||
.\nsIAccessibleSelectable.idl \
|
||||
.\nsIAccessibleTable.idl \
|
||||
.\nsIAccessibleText.idl \
|
||||
.\nsIAccessibleValue.idl \
|
||||
.\nsIAccessibleWin32Object.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
||||
@@ -27,71 +27,29 @@
|
||||
#include "nsIAtom.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
#include "nsIAccessibleCaret.idl"
|
||||
|
||||
interface nsIWeakReference;
|
||||
interface nsIAccessibleEventListener;
|
||||
|
||||
[scriptable, uuid(68D9720A-0984-42b6-A3F5-8237ED925727)]
|
||||
interface nsIAccessibilityService : nsISupports
|
||||
{
|
||||
nsIAccessible createAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible createIFrameAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createRootAccessible(in nsISupports aPresContext, in nsISupports aFrame);
|
||||
nsIAccessibleCaret createCaretAccessible(in nsIDOMNode aNode, in nsIAccessibleEventListener aListener);
|
||||
|
||||
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
|
||||
nsIAccessible createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLButtonAccessibleXBL(in nsIDOMNode aNode);
|
||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLCheckboxAccessibleXBL(in nsIDOMNode aNode);
|
||||
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLNativeWindowAccessible(in nsIDOMNode aDOMNode, in nsIWeakReference aShell, in PRInt32 aHWnd);
|
||||
nsIAccessible createHTMLPluginAccessible(in nsIDOMNode aDOMNode, in nsIWeakReference aShell);
|
||||
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLRadioButtonAccessibleXBL(in nsIDOMNode aNode);
|
||||
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
|
||||
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTableCaptionAccessible(in nsIDOMNode aDOMNode);
|
||||
nsIAccessible createHTMLTableHeadAccessible(in nsIDOMNode aDOMNode);
|
||||
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame);
|
||||
|
||||
nsIAccessible createXULButtonAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULCheckboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULColorPickerAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULColorPickerTileAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULComboboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULDropmarkerAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULGroupboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULImageAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULListboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULListitemAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenubarAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenuitemAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenupopupAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenuSeparatorAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULProgressMeterAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULStatusBarAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULRadioButtonAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULRadioGroupAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULSelectOptionAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULSelectListAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabBoxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabPanelsAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabsAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTextAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTreeAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTreeColumnsAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTreeColumnitemAccessible(in nsIDOMNode aNode);
|
||||
|
||||
nsIAccessible createHTMLIFrameAccessible(in nsIDOMNode aNode, in nsISupports aPresContext);
|
||||
nsIAccessible createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible createAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
|
||||
};
|
||||
|
||||
|
||||
@@ -38,18 +38,15 @@ interface nsIAccessible : nsISupports
|
||||
readonly attribute nsIAccessible accLastChild;
|
||||
|
||||
readonly attribute long accChildCount;
|
||||
attribute AString accName;
|
||||
readonly attribute AString accValue;
|
||||
readonly attribute long accId;
|
||||
|
||||
readonly attribute AString accDescription;
|
||||
readonly attribute AString accKeyboardShortcut;
|
||||
attribute DOMString accName;
|
||||
readonly attribute DOMString accValue;
|
||||
|
||||
readonly attribute DOMString accDescription;
|
||||
readonly attribute unsigned long accRole;
|
||||
readonly attribute unsigned long accState;
|
||||
readonly attribute unsigned long accExtState;
|
||||
|
||||
readonly attribute AString accHelp;
|
||||
readonly attribute DOMString accHelp;
|
||||
readonly attribute nsIAccessible accFocused;
|
||||
|
||||
nsIAccessible accGetAt(in long x, in long y);
|
||||
@@ -71,14 +68,11 @@ interface nsIAccessible : nsISupports
|
||||
void accTakeFocus();
|
||||
|
||||
readonly attribute PRUint8 accNumActions;
|
||||
AString getAccActionName(in PRUint8 index);
|
||||
DOMString getAccActionName(in PRUint8 index);
|
||||
void accDoAction(in PRUint8 index); // Action number 0 is the default action
|
||||
|
||||
nsIDOMNode accGetDOMNode();
|
||||
|
||||
// Used by Accessible implementation to save data and speed up accessibility tree walking
|
||||
[noscript] void CacheOptimizations(in nsIAccessible aParent, in PRInt32 aSiblingIndex, in nsIDOMNodeList aSiblingList);
|
||||
|
||||
// MSAA State flags - used for bitfield. More than 1 allowed.
|
||||
const unsigned long STATE_UNAVAILABLE = 0x00000001; // Disabled, maps to opposite of Java ENABLED, Gnome/ATK SENSITIVE?
|
||||
const unsigned long STATE_SELECTED = 0x00000002;
|
||||
@@ -128,204 +122,68 @@ interface nsIAccessible : nsISupports
|
||||
const unsigned long STATE_VERTICAL = 0x80000000; // Especially used for sliders and scrollbars
|
||||
|
||||
|
||||
%{C++
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
/*******************************************************************************
|
||||
The following nsIAccessible roles are traslated to ATK_ROLE_UNKNOWN
|
||||
|
||||
ROLE_TITLEBAR, ROLE_SOUND, ROLE_CURSOR, ROLE_CARET, ROLE_BORDER,
|
||||
ROLE_GROUPING, ROLE_EQUATION, ROLE_COLUMN, ROLE_ROW, ROLE_LINK,
|
||||
ROLE_WHITESPACE, ROLE_CLOCK,
|
||||
ROLE_IPADDRESS
|
||||
|
||||
ROLE_GRIP
|
||||
The object represents a special mouse pointer, which allows a user to
|
||||
manipulate user interface elements such as windows.
|
||||
|
||||
ROLE_HELPBALLOON
|
||||
The object displays a Help topic in the form of a ToolTip or Help balloon.
|
||||
|
||||
ROLE_PROPERTYPAGE
|
||||
The object represents a property sheet.
|
||||
|
||||
ROLE_INDICATOR
|
||||
The object represents an indicator, such as a pointer graphic pointing to
|
||||
the currrent item.
|
||||
|
||||
ROLE_HOTKEYFIELD
|
||||
The object represents a hot-key field that allow the user to enter a
|
||||
sequence of keystroke.
|
||||
|
||||
|
||||
The following ATK roles have no corresponding nsIAccessible roles. Perhaps
|
||||
there are not these types of widget/control in Mozilla, so don't need these
|
||||
ATK roles? Or need add some of them?
|
||||
|
||||
ATK_ROLE_ARROW
|
||||
An arrow in one of the four cardinal directions.
|
||||
|
||||
ATK_ROLE_INTERNAL_FRAME
|
||||
A frame-like object that is clipped by a desktop pane.
|
||||
|
||||
ATK_ROLE_ACCEL_LABEL, ATK_ROLE_CANVAS, ATK_ROLE_CHECK_MENU_ITEM,
|
||||
ATK_ROLE_COLOR_CHOOSER, ATK_ROLE_DATE_EDITOR, ATK_ROLE_DESKTOP_ICON,
|
||||
ATK_ROLE_DESKTOP_FRAME, ATK_ROLE_DIRECTORY_PANE, ATK_ROLE_FILE_CHOOSER,
|
||||
ATK_ROLE_FILLER, ATK_ROLE_FONT_CHOOSER, ATK_ROLE_GLASS_PANE,
|
||||
ATK_ROLE_HTML_CONTAINER, ATK_ROLE_ICON, ATK_ROLE_LAYERED_PANE,
|
||||
ATK_ROLE_POPUP_MENU, ATK_ROLE_OPTION_PANE, ATK_ROLE_PASSWORD_TEXT,
|
||||
ATK_ROLE_RADIO_MENU_ITEM, ATK_ROLE_ROOT_PANE, ATK_ROLE_SCROLL_PANE,
|
||||
ATK_ROLE_SPLIT_PANE, ATK_ROLE_TEAR_OFF_MENU_ITEM, ATK_ROLE_TERMINAL,
|
||||
ATK_ROLE_TOGGLE_BUTTON, ATK_ROLE_TREE_TABLE, ATK_ROLE_VIEWPORT, ATK_ROLE_LABEL
|
||||
|
||||
Important:
|
||||
Following value should keep synchronization with the definitions in atk.h
|
||||
*******************************************************************************/
|
||||
enum { ROLE_TITLEBAR = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_MENUBAR = 33U }; // ATK_ROLE_MENU_BAR
|
||||
enum { ROLE_SCROLLBAR = 47U }; // ATK_ROLE_SCROLL_BAR
|
||||
enum { ROLE_GRIP = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_SOUND = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_CURSOR = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_CARET = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_ALERT = 2U }; // ATK_ROLE_ALERT
|
||||
enum { ROLE_WINDOW = 68U }; // ATK_ROLE_WINDOW
|
||||
// An object used for drawing custom user interface elements
|
||||
enum { ROLE_CLIENT = 18U }; // ATK_ROLE_DRAWING_AREA
|
||||
enum { ROLE_MENUPOPUP = 32U }; // ATK_ROLE_MENU
|
||||
enum { ROLE_MENUITEM = 34U }; // ATK_ROLE_MENU_ITEM
|
||||
enum { ROLE_TOOLTIP = 63U }; // ATK_ROLE_TOOL_TIP
|
||||
// The object represents a main window for a application
|
||||
enum { ROLE_APPLICATION = 22U }; // ATK_ROLE_FRAME
|
||||
// The object represents a document window, only for MDI windows
|
||||
enum { ROLE_DOCUMENT = 68U }; // ATK_ROLE_WINDOW
|
||||
enum { ROLE_PANE = 38U }; // ATK_ROLE_PANEL
|
||||
enum { ROLE_CHART = 26U }; // ATK_ROLE_IMAGE
|
||||
enum { ROLE_DIALOG = 16U }; // ATK_ROLE_DIALOG
|
||||
enum { ROLE_BORDER = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_GROUPING = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_SEPARATOR = 49U }; // ATK_ROLE_SEPARATOR
|
||||
enum { ROLE_TOOLBAR = 62U }; // ATK_ROLE_TOOL_BAR
|
||||
enum { ROLE_STATUSBAR = 53U }; // ATK_ROLE_STATUSBAR
|
||||
enum { ROLE_TABLE = 54U }; // ATK_ROLE_TABLE
|
||||
// Or ATK_ROLE_TABLE_COLUMN_HEADER?
|
||||
enum { ROLE_COLUMNHEADER = 10U };// ATK_ROLE_COLUMN_HEADER
|
||||
// Or ATK_ROLE_TABLE_ROW_HEADER ?
|
||||
enum { ROLE_ROWHEADER = 46U }; // ATK_ROLE_ROW_HEADER
|
||||
enum { ROLE_COLUMN = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_ROW = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_CELL = 55U }; // ATK_ROLE_TABLE_CELL
|
||||
enum { ROLE_LINK = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_HELPBALLOON = 66U }; // ATK_ROLE_UNKNOWN
|
||||
// The object represents a cartoon-like graphic object
|
||||
enum { ROLE_CHARACTER = 26U }; // ATK_ROLE_IMAGE
|
||||
enum { ROLE_LIST = 30U }; // ATK_ROLE_LIST
|
||||
enum { ROLE_LISTITEM = 31U }; // ATK_ROLE_LIST_ITEM
|
||||
// The object represents an outline or tree structure
|
||||
enum { ROLE_OUTLINE = 64U }; // ATK_ROLE_TREE
|
||||
// The object represents an item in an outline or tree structure
|
||||
enum { ROLE_OUTLINEITEM = 31U }; // ATK_ROLE_LIST_ITEM
|
||||
enum { ROLE_PAGETAB = 36U }; // ATK_ROLE_PAGE_TAB
|
||||
enum { ROLE_PROPERTYPAGE = 66U };// ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_INDICATOR = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_GRAPHIC = 26U }; // ATK_ROLE_IMAGE
|
||||
// Read-only text, can't be modified or selected
|
||||
enum { ROLE_STATICTEXT = 60U }; // ATK_ROLE_TEXT
|
||||
enum { ROLE_TEXT = 60U }; // ATK_ROLE_TEXT
|
||||
enum { ROLE_PUSHBUTTON = 42U }; // ATK_ROLE_PUSH_BUTTON
|
||||
enum { ROLE_CHECKBUTTON = 7U }; // ATK_ROLE_CHECK_BOX
|
||||
enum { ROLE_RADIOBUTTON = 43U }; // ATK_ROLE_RADIO_BUTTON
|
||||
enum { ROLE_COMBOBOX = 11U }; // ATK_ROLE_COMBO_BOX
|
||||
// Just represents the calender control
|
||||
enum { ROLE_DROPLIST = 5U }; // ATK_ROLE_CALENDAR
|
||||
enum { ROLE_PROGRESSBAR = 41U }; // ATK_ROLE_PROGRESS_BAR
|
||||
enum { ROLE_DIAL = 15U }; // ATK_ROLE_DIAL
|
||||
enum { ROLE_HOTKEYFIELD = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_SLIDER = 50U }; // ATK_ROLE_SLIDER
|
||||
enum { ROLE_SPINBUTTON = 52U }; // ATK_ROLE_SPIN_BUTTON
|
||||
enum { ROLE_DIAGRAM = 26U }; // ATK_ROLE_IMAGE
|
||||
enum { ROLE_ANIMATION = 3U }; // ATK_ROLE_ANIMATION
|
||||
enum { ROLE_EQUATION = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_BUTTONDROPDOWN = 42U }; // ATK_ROLE_PUSH_BUTTON
|
||||
enum { ROLE_BUTTONMENU = 42U }; // ATK_ROLE_PUSH_BUTTON
|
||||
// Represents a button that drops down a grid
|
||||
enum { ROLE_BUTTONDROPDOWNGRID = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_WHITESPACE = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_PAGETABLIST = 37U }; // ATK_ROLE_PAGE_TAB_LIST
|
||||
enum { ROLE_CLOCK = 66U }; // ATK_ROLE_UNKNOWN
|
||||
// Represents a button on the toolbar that has a drop-down list icon
|
||||
// directly adjacent to the button
|
||||
enum { ROLE_SPLITBUTTON = 42U }; // ATK_ROLE_PUSH_BUTTON
|
||||
enum { ROLE_IPADDRESS = 66U }; // ATK_ROLE_UNKNOWN
|
||||
enum { ROLE_NOTHING = 0U }; // ATK_ROLE_INVALID
|
||||
|
||||
#else
|
||||
// MSAA Roles - only one per nsIAccessible or IAccessible
|
||||
enum { ROLE_TITLEBAR = 1U };
|
||||
enum { ROLE_MENUBAR = 2U };
|
||||
enum { ROLE_SCROLLBAR = 3U };
|
||||
enum { ROLE_GRIP = 4U };
|
||||
enum { ROLE_SOUND = 5U };
|
||||
enum { ROLE_CURSOR = 6U };
|
||||
enum { ROLE_CARET = 7U };
|
||||
enum { ROLE_ALERT = 8U };
|
||||
enum { ROLE_WINDOW = 9U };
|
||||
enum { ROLE_CLIENT = 10U };
|
||||
enum { ROLE_MENUPOPUP = 11U };
|
||||
enum { ROLE_MENUITEM = 12U };
|
||||
enum { ROLE_TOOLTIP = 13U };
|
||||
enum { ROLE_APPLICATION = 14U };
|
||||
enum { ROLE_DOCUMENT = 15U };
|
||||
enum { ROLE_PANE = 16U };
|
||||
enum { ROLE_CHART = 17U };
|
||||
enum { ROLE_DIALOG = 18U };
|
||||
enum { ROLE_BORDER = 19U };
|
||||
enum { ROLE_GROUPING = 20U };
|
||||
enum { ROLE_SEPARATOR = 21U };
|
||||
enum { ROLE_TOOLBAR = 22U };
|
||||
enum { ROLE_STATUSBAR = 23U };
|
||||
enum { ROLE_TABLE = 24U };
|
||||
enum { ROLE_COLUMNHEADER = 25U };
|
||||
enum { ROLE_ROWHEADER = 26U };
|
||||
enum { ROLE_COLUMN = 27U };
|
||||
enum { ROLE_ROW = 28U };
|
||||
enum { ROLE_CELL = 29U };
|
||||
enum { ROLE_LINK = 30U };
|
||||
enum { ROLE_HELPBALLOON = 31U };
|
||||
enum { ROLE_CHARACTER = 32U };
|
||||
enum { ROLE_LIST = 33U };
|
||||
enum { ROLE_LISTITEM = 34U };
|
||||
enum { ROLE_OUTLINE = 35U };
|
||||
enum { ROLE_OUTLINEITEM = 36U };
|
||||
enum { ROLE_PAGETAB = 37U };
|
||||
enum { ROLE_PROPERTYPAGE = 38U };
|
||||
enum { ROLE_INDICATOR = 39U };
|
||||
enum { ROLE_GRAPHIC = 40U };
|
||||
enum { ROLE_STATICTEXT = 41U };
|
||||
enum { ROLE_TEXT = 42U };
|
||||
enum { ROLE_PUSHBUTTON = 43U };
|
||||
enum { ROLE_CHECKBUTTON = 44U };
|
||||
enum { ROLE_RADIOBUTTON = 45U };
|
||||
enum { ROLE_COMBOBOX = 46U };
|
||||
enum { ROLE_DROPLIST = 47U };
|
||||
enum { ROLE_PROGRESSBAR = 48U };
|
||||
enum { ROLE_DIAL = 49U };
|
||||
enum { ROLE_HOTKEYFIELD = 50U };
|
||||
enum { ROLE_SLIDER = 51U };
|
||||
enum { ROLE_SPINBUTTON = 52U };
|
||||
enum { ROLE_DIAGRAM = 53U };
|
||||
enum { ROLE_ANIMATION = 54U };
|
||||
enum { ROLE_EQUATION = 55U };
|
||||
enum { ROLE_BUTTONDROPDOWN = 56U };
|
||||
enum { ROLE_BUTTONMENU = 57U };
|
||||
enum { ROLE_BUTTONDROPDOWNGRID = 58U };
|
||||
enum { ROLE_WHITESPACE = 59U };
|
||||
enum { ROLE_PAGETABLIST = 60U };
|
||||
enum { ROLE_CLOCK = 61U };
|
||||
enum { ROLE_SPLITBUTTON = 62U };
|
||||
enum { ROLE_IPADDRESS = 63U };
|
||||
enum { ROLE_NOTHING = 4294967295U };
|
||||
|
||||
#endif
|
||||
%}
|
||||
const unsigned long ROLE_TITLEBAR = 0x00000001;
|
||||
const unsigned long ROLE_MENUBAR = 0x00000002;
|
||||
const unsigned long ROLE_SCROLLBAR = 0x00000003;
|
||||
const unsigned long ROLE_GRIP = 0x00000004;
|
||||
const unsigned long ROLE_SOUND = 0x00000005;
|
||||
const unsigned long ROLE_CURSOR = 0x00000006;
|
||||
const unsigned long ROLE_CARET = 0x00000007;
|
||||
const unsigned long ROLE_ALERT = 0x00000008;
|
||||
const unsigned long ROLE_WINDOW = 0x00000009;
|
||||
const unsigned long ROLE_CLIENT = 0x0000000A;
|
||||
const unsigned long ROLE_MENUPOPUP = 0x0000000B;
|
||||
const unsigned long ROLE_MENUITEM = 0x0000000C;
|
||||
const unsigned long ROLE_TOOLTIP = 0x0000000D;
|
||||
const unsigned long ROLE_APPLICATION = 0x0000000E;
|
||||
const unsigned long ROLE_DOCUMENT = 0x0000000F;
|
||||
const unsigned long ROLE_PANE = 0x00000010;
|
||||
const unsigned long ROLE_CHART = 0x00000011;
|
||||
const unsigned long ROLE_DIALOG = 0x00000012;
|
||||
const unsigned long ROLE_BORDER = 0x00000013;
|
||||
const unsigned long ROLE_GROUPING = 0x00000014;
|
||||
const unsigned long ROLE_SEPARATOR = 0x00000015;
|
||||
const unsigned long ROLE_TOOLBAR = 0x00000016;
|
||||
const unsigned long ROLE_STATUSBAR = 0x00000017;
|
||||
const unsigned long ROLE_TABLE = 0x00000018;
|
||||
const unsigned long ROLE_COLUMNHEADER = 0x00000019;
|
||||
const unsigned long ROLE_ROWHEADER = 0x0000001A;
|
||||
const unsigned long ROLE_COLUMN = 0x0000001B;
|
||||
const unsigned long ROLE_ROW = 0x0000001C;
|
||||
const unsigned long ROLE_CELL = 0x0000001D;
|
||||
const unsigned long ROLE_LINK = 0x0000001E;
|
||||
const unsigned long ROLE_HELPBALLOON = 0x0000001F;
|
||||
const unsigned long ROLE_CHARACTER = 0x00000020;
|
||||
const unsigned long ROLE_LIST = 0x00000021;
|
||||
const unsigned long ROLE_LISTITEM = 0x00000022;
|
||||
const unsigned long ROLE_OUTLINE = 0x00000023;
|
||||
const unsigned long ROLE_OUTLINEITEM = 0x00000024;
|
||||
const unsigned long ROLE_PAGETAB = 0x00000025;
|
||||
const unsigned long ROLE_PROPERTYPAGE = 0x00000026;
|
||||
const unsigned long ROLE_INDICATOR = 0x00000027;
|
||||
const unsigned long ROLE_GRAPHIC = 0x00000028;
|
||||
const unsigned long ROLE_STATICTEXT = 0x00000029;
|
||||
const unsigned long ROLE_TEXT = 0x0000002A; // Editable, selectable, etc.
|
||||
const unsigned long ROLE_PUSHBUTTON = 0x0000002B;
|
||||
const unsigned long ROLE_CHECKBUTTON = 0x0000002C;
|
||||
const unsigned long ROLE_RADIOBUTTON = 0x0000002D;
|
||||
const unsigned long ROLE_COMBOBOX = 0x0000002E;
|
||||
const unsigned long ROLE_DROPLIST = 0x0000002F;
|
||||
const unsigned long ROLE_PROGRESSBAR = 0x00000030;
|
||||
const unsigned long ROLE_DIAL = 0x00000031;
|
||||
const unsigned long ROLE_HOTKEYFIELD = 0x00000032;
|
||||
const unsigned long ROLE_SLIDER = 0x00000033;
|
||||
const unsigned long ROLE_SPINBUTTON = 0x00000034;
|
||||
const unsigned long ROLE_DIAGRAM = 0x00000035;
|
||||
const unsigned long ROLE_ANIMATION = 0x00000036;
|
||||
const unsigned long ROLE_EQUATION = 0x00000037;
|
||||
const unsigned long ROLE_BUTTONDROPDOWN = 0x00000038;
|
||||
const unsigned long ROLE_BUTTONMENU = 0x00000039;
|
||||
const unsigned long ROLE_BUTTONDROPDOWNGRID = 0x0000003A;
|
||||
const unsigned long ROLE_WHITESPACE = 0x0000003B;
|
||||
const unsigned long ROLE_PAGETABLIST = 0x0000003C;
|
||||
const unsigned long ROLE_CLOCK = 0x0000003D;
|
||||
const unsigned long ROLE_SPLITBUTTON = 0x0000003E; // New in MSAA 2.0
|
||||
const unsigned long ROLE_IPADDRESS = 0x0000003F; // New in MSAA 2.0
|
||||
};
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
*
|
||||
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
|
||||
* Bill Haneman (bill.haneman@sun.com)
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(829B36D4-125A-4279-ABC4-87D834664F82)]
|
||||
interface nsIAccessibleAction : nsISupports
|
||||
{
|
||||
readonly attribute long actions;
|
||||
|
||||
boolean doAction (in long index);
|
||||
|
||||
AString getDescription (in long index);
|
||||
void getDescriptionConst (in long index,
|
||||
[shared, retval] out string description);
|
||||
|
||||
AString getKeyBinding (in long index);
|
||||
void getKeyBindingConst (in long index,
|
||||
[shared, retval] out string keyBinding);
|
||||
};
|
||||
|
||||
/*
|
||||
Assumptions:
|
||||
|
||||
string is a UTF-8 or most likely ASCII
|
||||
encoding.
|
||||
|
||||
*/
|
||||
@@ -1,32 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
[scriptable, uuid(9124c666-6133-4be6-b3ed-dd0ec35f1e64)]
|
||||
interface nsIAccessibleCaret : nsISupports
|
||||
{
|
||||
void attachNewSelectionListener(in nsIDOMNode aFocusedNode);
|
||||
void removeSelectionListener();
|
||||
};
|
||||
@@ -26,17 +26,16 @@
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIAccessibleCaret.idl"
|
||||
interface nsIDocument;
|
||||
|
||||
[scriptable, uuid(8781FC88-355F-4439-881F-6504A0A1CEB6)]
|
||||
interface nsIAccessibleDocument : nsISupports
|
||||
{
|
||||
readonly attribute AString URL;
|
||||
readonly attribute AString title;
|
||||
readonly attribute AString mimeType;
|
||||
readonly attribute AString docType;
|
||||
AString getNameSpaceURIForID(in short nameSpaceID);
|
||||
readonly attribute DOMString URL;
|
||||
readonly attribute DOMString title;
|
||||
readonly attribute DOMString mimeType;
|
||||
readonly attribute DOMString docType;
|
||||
DOMString getNameSpaceURIForID(in short nameSpaceID);
|
||||
[noscript] nsIDocument getDocument();
|
||||
readonly attribute nsIAccessibleCaret caretAccessible;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
*
|
||||
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
|
||||
* Bill Haneman (bill.haneman@sun.com)
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(91F0A56C-11BE-47C7-8D02-7C15E00C05F5)]
|
||||
interface nsIAccessibleEditableText : nsISupports
|
||||
{
|
||||
/**
|
||||
* Set font styles, such as italic, bold...
|
||||
*/
|
||||
void setAttributes (in long startPos, in long endPos,
|
||||
in nsISupports attributes);
|
||||
void setTextContents (in AString text);
|
||||
void insertText (in AString text, in long position);
|
||||
void copyText (in long startPos, in long endPos);
|
||||
void cutText (in long startPos, in long endPos);
|
||||
void deleteText (in long startPos, in long endPos);
|
||||
void pasteText (in long position);
|
||||
};
|
||||
|
||||
/*
|
||||
Assumptions:
|
||||
|
||||
selectAttributes method takes an nsISupports parameter.
|
||||
'set' methods throw exception on failure.
|
||||
'wstring' inputs are potentially multibyte (UTF-16 for
|
||||
instance); 'string' and UTF-8 may be a better choice.
|
||||
|
||||
*/
|
||||
@@ -25,75 +25,17 @@
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
%{ C++
|
||||
// extra event data (currently used by ATK)
|
||||
struct AccessibleEventData {
|
||||
PRUint32 aUnused;
|
||||
};
|
||||
%}
|
||||
|
||||
[ptr] native AccessibleEventData(AccessibleEventData);
|
||||
|
||||
[scriptable, uuid(BEE49E7D-9D06-49bf-8984-1694C697D74F)]
|
||||
interface nsIAccessibleEventListener : nsISupports
|
||||
{
|
||||
// these are set to the values given by MSAA
|
||||
const unsigned long EVENT_CREATE = 0x8000;
|
||||
const unsigned long EVENT_DESTROY = 0x8001;
|
||||
const unsigned long EVENT_SHOW = 0x8002;
|
||||
const unsigned long EVENT_HIDE = 0x8003;
|
||||
const unsigned long EVENT_REORDER = 0x8004;
|
||||
const unsigned long EVENT_FOCUS = 0x8005;
|
||||
const unsigned long EVENT_STATE_CHANGE = 0x800A;
|
||||
const unsigned long EVENT_LOCATION_CHANGE = 0x800B;
|
||||
const unsigned long EVENT_NAME_CHANGE = 0x800C;
|
||||
const unsigned long EVENT_DESCRIPTIONCHANGE = 0x800D;
|
||||
const unsigned long EVENT_VALUE_CHANGE = 0x800E;
|
||||
const unsigned long EVENT_PARENTCHANGE = 0x800F;
|
||||
const unsigned long EVENT_HELPCHANGE = 0x8010;
|
||||
const unsigned long EVENT_DEFACTIONCHANGE = 0x8011;
|
||||
const unsigned long EVENT_ACCELERATORCHANGE = 0x8012;
|
||||
const unsigned long EVENT_SELECTION = 0x8006;
|
||||
const unsigned long EVENT_SELECTION_ADD = 0x8007;
|
||||
const unsigned long EVENT_SELECTION_REMOVE = 0x8008;
|
||||
const unsigned long EVENT_SELECTION_WITHIN = 0x8009;
|
||||
const unsigned long EVENT_ALERT = 0x0002;
|
||||
const unsigned long EVENT_FOREGROUND = 0x0003;
|
||||
const unsigned long EVENT_MENUSTART = 0x0004;
|
||||
const unsigned long EVENT_MENUEND = 0x0005;
|
||||
const unsigned long EVENT_MENUPOPUPSTART = 0x0006;
|
||||
const unsigned long EVENT_MENUPOPUPEND = 0x0007;
|
||||
const unsigned long EVENT_CAPTURESTART = 0x0008;
|
||||
const unsigned long EVENT_CAPTUREEND = 0x0009;
|
||||
const unsigned long EVENT_MOVESIZESTART = 0x000A;
|
||||
const unsigned long EVENT_MOVESIZEEND = 0x000B;
|
||||
const unsigned long EVENT_CONTEXTHELPSTART = 0x000C;
|
||||
const unsigned long EVENT_CONTEXTHELPEND = 0x000D;
|
||||
const unsigned long EVENT_DRAGDROPSTART = 0x000E;
|
||||
const unsigned long EVENT_DRAGDROPEND = 0x000F;
|
||||
const unsigned long EVENT_DIALOGSTART = 0x0010;
|
||||
const unsigned long EVENT_DIALOGEND = 0x0011;
|
||||
const unsigned long EVENT_SCROLLINGSTART = 0x0012;
|
||||
const unsigned long EVENT_SCROLLINGEND = 0x0013;
|
||||
const unsigned long EVENT_MINIMIZESTART = 0x0016;
|
||||
const unsigned long EVENT_MINIMIZEEND = 0x0017;
|
||||
|
||||
// the additional events for ATK
|
||||
const unsigned long EVENT_ATK_PROPERTY_CHANGE = 0x0100;
|
||||
const unsigned long EVENT_ATK_SELECTION_CHANGE = 0x0101;
|
||||
const unsigned long EVENT_ATK_TEXT_CHANGE = 0x0102;
|
||||
const unsigned long EVENT_ATK_TEXT_SELECTION_CHANGE = 0x0103;
|
||||
const unsigned long EVENT_ATK_TEXT_CARET_MOVE = 0x0104;
|
||||
const unsigned long EVENT_ATK_VISIBLE_DATA_CHANGE = 0x0105;
|
||||
const unsigned long EVENT_ATK_TABLE_MODEL_CHANGE = 0x0110;
|
||||
const unsigned long EVENT_ATK_TABLE_ROW_INSERT = 0x0111;
|
||||
const unsigned long EVENT_ATK_TABLE_ROW_DELETE = 0x0112;
|
||||
const unsigned long EVENT_ATK_TABLE_ROW_REORDER = 0x0113;
|
||||
const unsigned long EVENT_ATK_TABLE_COLUMN_INSERT = 0x0114;
|
||||
const unsigned long EVENT_ATK_TABLE_COLUMN_DELETE = 0x0115;
|
||||
const unsigned long EVENT_ATK_TABLE_COLUMN_REORDER = 0x0116;
|
||||
|
||||
[noscript]
|
||||
void handleEvent(in unsigned long aEvent, in nsIAccessible aTarget, in AccessibleEventData aData);
|
||||
void handleEvent(in unsigned long aEvent, in nsIAccessible aTarget);
|
||||
};
|
||||
|
||||
|
||||
@@ -28,5 +28,5 @@
|
||||
interface nsIAccessibleEventReceiver : nsISupports
|
||||
{
|
||||
void addAccessibleEventListener(in nsIAccessibleEventListener aListener);
|
||||
void removeAccessibleEventListener();
|
||||
void removeAccessibleEventListener(in nsIAccessibleEventListener aListener);
|
||||
};
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
*
|
||||
* Contributor(s): Bill Haneman (bill.haneman@sun.com)
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
interface nsIURI;
|
||||
|
||||
[scriptable, uuid(a492c7d6-1dd1-11b2-9bc0-80614884799a)]
|
||||
interface nsIAccessibleHyperLink : nsISupports
|
||||
{
|
||||
readonly attribute long anchors;
|
||||
readonly attribute long startIndex;
|
||||
readonly attribute long endIndex;
|
||||
|
||||
nsIURI getURI (in long i);
|
||||
|
||||
nsIAccessible getObject (in long i);
|
||||
|
||||
boolean isValid ();
|
||||
};
|
||||
|
||||
/*
|
||||
Assumptions:
|
||||
|
||||
The object associated with object or anchor index
|
||||
is an nsIAccessible.
|
||||
A URI can be represented by the nsIURI interface
|
||||
(or nsIURL interface).
|
||||
|
||||
Note that an object which supports nsIAccessibleHyperlink
|
||||
does *not* generally implement nsIAccessible, unlike the
|
||||
case of the other nsiAccessible* interfaces in this directory.
|
||||
|
||||
Aaron: would the nsISupports return from
|
||||
getObject be queryable for nsIURI and nsIURL directly?
|
||||
|
||||
*/
|
||||
@@ -1,38 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
*
|
||||
* Contributor(s): Bill Haneman (bill.haneman@sun.com)
|
||||
* Paul Sandoz (paul.sandoz@sun.com)
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessibleHyperLink.idl"
|
||||
|
||||
[scriptable, uuid(8f18d922-1dd2-11b2-82ea-829b78a44413)]
|
||||
interface nsIAccessibleHyperText : nsISupports
|
||||
{
|
||||
readonly attribute long links;
|
||||
|
||||
nsIAccessibleHyperLink getLink (in long index);
|
||||
|
||||
long getLinkIndex (in long charIndex);
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
[scriptable, uuid(3f0e3eb0-1dd2-11b2-9605-be5b8e76cf4b)]
|
||||
interface nsIAccessibleProvider : nsISupports
|
||||
{
|
||||
readonly attribute nsIAccessible accessible;
|
||||
};
|
||||
@@ -21,11 +21,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt
|
||||
* Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
* Paul Sandoz (paul.sandoz@sun.com)
|
||||
* Bill Haneman (bill.haneman@sun.com)
|
||||
* Kyle Yuan (kyle.yuan@sun.com)
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
@@ -34,43 +30,5 @@
|
||||
[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
|
||||
interface nsIAccessibleSelectable : nsISupports
|
||||
{
|
||||
nsISupportsArray GetSelectedChildren();
|
||||
|
||||
/**
|
||||
* Returns the number of accessible children currently selected.
|
||||
*/
|
||||
readonly attribute long selectionCount;
|
||||
|
||||
/**
|
||||
* Adds the specified accessible child of the object to the
|
||||
* object's selection.
|
||||
*/
|
||||
void addSelection(in long index);
|
||||
|
||||
/**
|
||||
* Removes the specified child of the object from the object's selection.
|
||||
*/
|
||||
void removeSelection(in long index);
|
||||
|
||||
/**
|
||||
* Clears the selection in the object so that no children in the object
|
||||
* are selected.
|
||||
*/
|
||||
void clearSelection();
|
||||
|
||||
/**
|
||||
* Returns a reference to the accessible object representing the specified
|
||||
* selected child of the object.
|
||||
*/
|
||||
nsIAccessible refSelection(in long index);
|
||||
|
||||
/**
|
||||
* Determines if the current child of this object is selected
|
||||
*/
|
||||
boolean isChildSelected(in long index);
|
||||
|
||||
/**
|
||||
* If the object does not accept multiple selection, return false.
|
||||
*/
|
||||
boolean selectAllSelection();
|
||||
nsISupportsArray GetSelectedChildren();
|
||||
};
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
*
|
||||
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
|
||||
* Bill Haneman (bill.haneman@sun.com)
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
[scriptable, uuid(0A7E98A9-CA7D-42F0-BFE1-2CFC35256038)]
|
||||
interface nsIAccessibleTable : nsISupports
|
||||
{
|
||||
attribute nsIAccessible caption;
|
||||
attribute AString summary;
|
||||
readonly attribute long columns;
|
||||
readonly attribute nsIAccessibleTable columnHeader;
|
||||
readonly attribute long rows;
|
||||
readonly attribute nsIAccessibleTable rowHeader;
|
||||
|
||||
void getSelectedColumns (out unsigned long columnsSize,
|
||||
[retval, array, size_is(columnsSize)] out long columns);
|
||||
|
||||
void getSelectedRows (out unsigned long rowsSize,
|
||||
[retval, array, size_is(rowsSize)] out long rows);
|
||||
|
||||
/**
|
||||
* gets a cell
|
||||
*/
|
||||
nsIAccessible cellRefAt (in long row, in long column);
|
||||
|
||||
/**
|
||||
* get an index
|
||||
*/
|
||||
long getIndexAt (in long row, in long column);
|
||||
long getColumnAtIndex (in long index);
|
||||
long getRowAtIndex (in long index);
|
||||
long getColumnExtentAt (in long row, in long column);
|
||||
long getRowExtentAt (in long row, in long column);
|
||||
|
||||
AString getColumnDescription (in long column);
|
||||
AString getRowDescription (in long row);
|
||||
|
||||
boolean isColumnSelected (in long column);
|
||||
boolean isRowSelected (in long row);
|
||||
boolean isCellSelected (in long row, in long column);
|
||||
};
|
||||
@@ -1,131 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
*
|
||||
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
|
||||
* Bill Haneman (bill.haneman@sun.com)
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
typedef long nsAccessibleTextBoundary;
|
||||
typedef long nsAccessibleCoordType;
|
||||
|
||||
[scriptable, uuid(E44D3FA6-9CB2-432A-8BDB-69D72B6ADA00)]
|
||||
interface nsIAccessibleText : nsISupports
|
||||
{
|
||||
const nsAccessibleTextBoundary BOUNDARY_CHAR = 0;
|
||||
const nsAccessibleTextBoundary BOUNDARY_WORD_START = 1;
|
||||
const nsAccessibleTextBoundary BOUNDARY_WORD_END = 2;
|
||||
const nsAccessibleTextBoundary BOUNDARY_SENTENCE_START = 3;
|
||||
const nsAccessibleTextBoundary BOUNDARY_SENTENCE_END = 4;
|
||||
const nsAccessibleTextBoundary BOUNDARY_LINE_START = 5;
|
||||
const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
|
||||
const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
|
||||
|
||||
const nsAccessibleCoordType COORD_TYPE_SCREEN = 0;
|
||||
const nsAccessibleCoordType COORD_TYPE_WINDOW = 1;
|
||||
|
||||
attribute long caretOffset;
|
||||
|
||||
readonly attribute long characterCount;
|
||||
readonly attribute long selectionCount;
|
||||
|
||||
/**
|
||||
* String methods may need to return multibyte-encoded strings,
|
||||
* since some locales can't be encoded using 16-bit chars.
|
||||
* So the methods below might return UTF-16 strings, or they could
|
||||
* return "string" values which are UTF-8.
|
||||
*/
|
||||
AString getText (in long startOffset, in long endOffset);
|
||||
|
||||
AString getTextAfterOffset (in long offset,
|
||||
in nsAccessibleTextBoundary boundaryType,
|
||||
out long startOffset,
|
||||
out long endOffset);
|
||||
|
||||
AString getTextAtOffset (in long offset,
|
||||
in nsAccessibleTextBoundary boundaryType,
|
||||
out long startOffset,
|
||||
out long endOffset);
|
||||
|
||||
/**
|
||||
* It would be better to return an unsigned long here,
|
||||
* to allow unicode chars > 16 bits
|
||||
*/
|
||||
wchar getCharacterAtOffset (in long offset);
|
||||
|
||||
nsISupports getAttributeRange (in long offset,
|
||||
out long rangeStartOffset,
|
||||
out long rangeEndOffset);
|
||||
|
||||
AString getTextBeforeOffset (in long offset,
|
||||
in nsAccessibleTextBoundary boundaryType,
|
||||
out long startOffset,
|
||||
out long endOffset);
|
||||
|
||||
void getCharacterExtents (in long offset,
|
||||
out long x,
|
||||
out long y,
|
||||
out long length,
|
||||
out long width,
|
||||
in nsAccessibleCoordType coordType);
|
||||
|
||||
long getOffsetAtPoint (in long x, in long y,
|
||||
in nsAccessibleCoordType coordType);
|
||||
|
||||
void getSelectionBounds (in long selectionNum,
|
||||
out long startOffset,
|
||||
out long endOffset);
|
||||
|
||||
void setSelectionBounds (in long selectionNum,
|
||||
in long startOffset,
|
||||
in long endOffset);
|
||||
|
||||
void addSelection (in long startOffset, in long endOffset);
|
||||
|
||||
void removeSelection (in long selectionNum);
|
||||
};
|
||||
|
||||
/*
|
||||
Assumptions:
|
||||
|
||||
Using wstring (UCS2) instead of string encoded in UTF-8.
|
||||
Multibyte encodings (or at least potentially multi-byte
|
||||
encodings) would be preferred for the reasons cited above.
|
||||
|
||||
The following methods will throw an exception
|
||||
on failure (since not every text component will allow
|
||||
every operation):
|
||||
setSelectionBounds, addSelection, removeSelection,
|
||||
setCaretOffset.
|
||||
|
||||
getRangeAttributes defined to return an nsISupports
|
||||
interface instead of a pango specific data structure.
|
||||
It may be that some other return type is more appropriate
|
||||
for mozilla text attributes.
|
||||
|
||||
we assume that all text components support the idea of
|
||||
a caret offset, whether visible or "virtual". If this
|
||||
isn't the case, caretOffset can be made readonly and
|
||||
a setCaretOffset method provided which throws an exception
|
||||
on failure (as with *selection methods above).
|
||||
*/
|
||||
@@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(F4ABBC2F-0F28-47DC-A9E9-F7A1719AB2BE)]
|
||||
interface nsIAccessibleValue : nsISupports
|
||||
{
|
||||
readonly attribute double maximumValue;
|
||||
readonly attribute double minimumValue;
|
||||
readonly attribute double currentValue;
|
||||
|
||||
/**
|
||||
* We want to be able to return a success condition of the value
|
||||
* getting set. ie if the value is not within the interval of
|
||||
* minimumValue-maximumValue
|
||||
*/
|
||||
boolean setCurrentValue (in double value);
|
||||
};
|
||||
|
||||
/*
|
||||
Assumptions:
|
||||
|
||||
The attribute currentValue will throw an exception
|
||||
if it cannot be set i.e. if the value is not a
|
||||
member of the interval.
|
||||
This may not be the 'desired' behaviour given gObject
|
||||
equivalent. Thus it could be changed to be:
|
||||
|
||||
readonly attribute double currentValue;
|
||||
boolean setCurrentValue (double long value);
|
||||
|
||||
GValue can represent many basic types.
|
||||
Since this interface is designed to represent
|
||||
an interval and a member of double should
|
||||
cover the cases of char int and float.
|
||||
|
||||
*/
|
||||
@@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(ca7a3a93-822f-4cdf-8cb4-c52d16b9afc7)]
|
||||
interface nsIAccessibleWin32Object : nsISupports
|
||||
{
|
||||
/** handle to the external window implementing IAccessible */
|
||||
readonly attribute long hwnd;
|
||||
};
|
||||
1
mozilla/accessible/src/MANIFEST
Normal file
1
mozilla/accessible/src/MANIFEST
Normal file
@@ -0,0 +1 @@
|
||||
accessible.properties
|
||||
@@ -16,24 +16,43 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = \
|
||||
base \
|
||||
html \
|
||||
$(null)
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_s
|
||||
REQUIRES = xpcom string layout widget dom view locale intl docshell webshell necko htmlparser xuldoc imglib2 gfx2
|
||||
|
||||
ifdef MOZ_XUL
|
||||
DIRS += xul
|
||||
endif
|
||||
CPPSRCS = \
|
||||
nsAccessible.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsHTMLIFrameRootAccessible.cpp \
|
||||
nsHTMLFormControlAccessible.cpp \
|
||||
nsHTMLTextAccessible.cpp \
|
||||
nsHTMLTableAccessible.cpp \
|
||||
nsHTMLImageAccessible.cpp \
|
||||
nsHTMLAreaAccessible.cpp \
|
||||
nsHTMLLinkAccessible.cpp \
|
||||
nsHTMLSelectListAccessible.cpp \
|
||||
nsHTMLComboboxAccessible.cpp \
|
||||
nsHTMLListboxAccessible.cpp \
|
||||
nsGenericAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsRootAccessible.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
5
mozilla/accessible/src/accessible.properties
Normal file
5
mozilla/accessible/src/accessible.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
jump = Jump
|
||||
press = Press
|
||||
check = Check
|
||||
uncheck = Uncheck
|
||||
select = Select
|
||||
@@ -1,78 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_base_s
|
||||
REQUIRES = content \
|
||||
docshell \
|
||||
dom \
|
||||
gfx \
|
||||
htmlparser \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
plugin \
|
||||
pref \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
xuldoc \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsAccessibilityService.cpp \
|
||||
nsAccessible.cpp \
|
||||
nsBaseWidgetAccessible.cpp \
|
||||
nsFormControlAccessible.cpp \
|
||||
nsGenericAccessible.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsCaretAccessible.cpp \
|
||||
nsSelectAccessible.cpp \
|
||||
nsTextAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsRootAccessible.h \
|
||||
nsAccessibleEventData.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../html \
|
||||
-I$(srcdir)/../xul \
|
||||
-I$(srcdir)/../../../layout/html/base/src \
|
||||
$(NULL)
|
||||
@@ -3,9 +3,3 @@ press = Press
|
||||
check = Check
|
||||
uncheck = Uncheck
|
||||
select = Select
|
||||
open = Open
|
||||
close = Close
|
||||
switch = Switch
|
||||
click = Click
|
||||
collapse= Collapse
|
||||
expand = Expand
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
en-win.jar:
|
||||
locale/en-US/global-platform/accessible.properties
|
||||
|
||||
en-unix.jar:
|
||||
locale/en-US/global-platform/accessible.properties
|
||||
|
||||
en-mac.jar:
|
||||
locale/en-US/global-platform/accessible.properties
|
||||
en-US.jar:
|
||||
locale/en-US/global/accessible.properties
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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): John Gaunt (jgaunt@netscape.com)
|
||||
|
||||
DEPTH = ..\..\..
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_base_s
|
||||
REQUIRES = \
|
||||
content \
|
||||
content_xul \
|
||||
docshell \
|
||||
dom \
|
||||
gfx \
|
||||
intl \
|
||||
layout \
|
||||
layout_xul \
|
||||
locale \
|
||||
necko \
|
||||
plugin \
|
||||
pref \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsAccessibilityService.obj \
|
||||
.\$(OBJDIR)\nsAccessible.obj \
|
||||
.\$(OBJDIR)\nsBaseWidgetAccessible.obj \
|
||||
.\$(OBJDIR)\nsFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsGenericAccessible.obj \
|
||||
.\$(OBJDIR)\nsRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsCaretAccessible.obj \
|
||||
.\$(OBJDIR)\nsSelectAccessible.obj \
|
||||
.\$(OBJDIR)\nsTextAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
.\nsRootAccessible.h \
|
||||
.\nsAccessibleEventData.h \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I..\html \
|
||||
-I..\xul \
|
||||
-I..\..\..\layout\html\forms\public \
|
||||
-I..\..\..\layout\html\forms\src \
|
||||
-I..\..\..\layout\html\base\src \
|
||||
-I..\..\..\widget\src\windows \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +1,27 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsAccessibilityService_h__
|
||||
#define __nsAccessibilityService_h__
|
||||
@@ -43,7 +30,6 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsObjectFrame.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIWeakReference;
|
||||
@@ -52,21 +38,22 @@ class nsIDOMNode;
|
||||
class nsAccessibilityService : public nsIAccessibilityService
|
||||
{
|
||||
public:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBILITYSERVICE
|
||||
|
||||
static nsresult GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **weakShell);
|
||||
// nsAccessibilityService methods:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
nsresult GetHTMLObjectAccessibleFor(nsIDOMNode *aNode, nsIPresShell *aShell, nsObjectFrame *aFrame, nsIAccessible **_retval);
|
||||
nsresult GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent);
|
||||
NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent);
|
||||
void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent);
|
||||
nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIAccessibilityService_h__ */
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,84 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsAccessible_H_
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIBindingManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsPoint.h"
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
|
||||
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global/locale/accessible.properties"
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocShell;
|
||||
class nsIFrame;
|
||||
class nsIDocShell;
|
||||
class nsIWebShell;
|
||||
|
||||
enum { eSiblingsUninitialized = -1, eSiblingsWalkNormalDOM = -2}; // Used in sibling index field as flags
|
||||
class nsIContent;
|
||||
|
||||
class nsAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
// to eliminate the confusion of "magic numbers" -- if ( 0 ){ foo; }
|
||||
enum { eAction_Switch=0, eAction_Jump=0, eAction_Click=0, eAction_Select=0 };
|
||||
// how many actions
|
||||
enum { eNo_Action=0, eSingle_Action=1 };
|
||||
|
||||
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccId(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccKeyboardShortcut(nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
@@ -94,85 +61,95 @@ public:
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
// Helper Routines for Sub-Docs
|
||||
static nsresult GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
|
||||
static nsresult GetDocShellObjects(nsIDocShell* aDocShell,
|
||||
nsIPresShell** aPresShell,
|
||||
nsIPresContext** aPresContext,
|
||||
nsIContent** aContent);
|
||||
static nsresult GetDocShells(nsIPresShell* aPresShell,
|
||||
nsIDocShell** aDocShell,
|
||||
nsIDocShell** aParentDocShell);
|
||||
static nsresult GetParentPresShellAndContent(nsIPresShell* aPresShell,
|
||||
nsIPresShell** aParentPresShell,
|
||||
nsIContent** aSubShellContent);
|
||||
|
||||
static PRBool FindContentForWebShell(nsIPresShell* aParentPresShell,
|
||||
nsIContent* aParentContent,
|
||||
nsIWebShell* aWebShell,
|
||||
nsIContent** aFoundContent);
|
||||
nsresult CalcOffset(nsIFrame* aFrame,
|
||||
nsIPresContext * aPresContext,
|
||||
nsRect& aRect);
|
||||
nsresult GetAbsPosition(nsIPresShell* aPresShell, nsPoint& aPoint);
|
||||
nsresult GetAbsoluteFramePosition(nsIPresContext* aPresContext,
|
||||
nsIFrame *aFrame,
|
||||
nsRect& aAbsoluteTwipsRect,
|
||||
nsRect& aAbsolutePixelRect);
|
||||
static nsresult GetTranslatedString(PRUnichar *aKey, nsAWritableString *aStringOut);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
PRBool IsPartiallyVisible();
|
||||
NS_IMETHOD AppendLabelText(nsIDOMNode *aLabelNode, nsAString& _retval);
|
||||
NS_IMETHOD AppendLabelFor(nsIContent *aLookNode, const nsAString *aId, nsAString *aLabel);
|
||||
NS_IMETHOD GetHTMLAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetXULAccName(nsAString& _retval);
|
||||
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString);
|
||||
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString);
|
||||
NS_IMETHOD AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent);
|
||||
NS_IMETHOD GetFocusedNode(nsIDOMNode **aFocusedNode);
|
||||
NS_IMETHOD CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList);
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
static nsresult InitStringBundleService();
|
||||
static nsresult GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut);
|
||||
static nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
|
||||
void GetScrollOffset(nsRect *aRect);
|
||||
void GetScreenOrigin(nsIPresContext *aPresContext, nsIFrame *aFrame, nsRect *aRect);
|
||||
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIDOMNodeList> mSiblingList; // If some of our computed siblings are anonymous content nodes, cache node list
|
||||
PRInt32 mSiblingIndex; // Cache where we are in list of kids that we got from nsIBindingManager::GetContentList(parentContent)
|
||||
nsCOMPtr<nsIFocusController> mFocusController;
|
||||
|
||||
static PRUint32 gInstanceCount;
|
||||
static nsIStringBundle *gStringBundle;
|
||||
static nsIStringBundle *gKeyStringBundle;
|
||||
};
|
||||
|
||||
|
||||
/** This class is used to walk the DOM tree. It skips
|
||||
* everything but nodes that either implement nsIAccessible
|
||||
* or have primary frames that implement "GetAccessible"
|
||||
*/
|
||||
|
||||
struct WalkState {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
nsCOMPtr<nsIDOMNodeList> siblingList;
|
||||
PRInt32 siblingIndex; // Holds a state flag or an index into the siblingList
|
||||
WalkState *prevState;
|
||||
};
|
||||
|
||||
|
||||
class nsAccessibleTreeWalker {
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsAccessibleTreeWalker(nsIWeakReference* aShell, nsIDOMNode* aContent,
|
||||
PRInt32 aCachedSiblingIndex, nsIDOMNodeList *aCachedSiblingList, PRBool mWalkAnonymousContent);
|
||||
~nsAccessibleTreeWalker();
|
||||
|
||||
NS_IMETHOD GetNextSibling();
|
||||
NS_IMETHOD GetPreviousSibling();
|
||||
NS_IMETHOD GetParent();
|
||||
NS_IMETHOD GetFirstChild();
|
||||
NS_IMETHOD GetLastChild();
|
||||
PRInt32 GetChildCount();
|
||||
WalkState mState;
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetChildBefore(nsIDOMNode* aParent, nsIDOMNode* aChild);
|
||||
PRBool IsHidden();
|
||||
PRBool GetAccessible();
|
||||
NS_IMETHOD GetFullTreeParentNode(nsIDOMNode *aChildNode, nsIDOMNode **aParentNodeOut);
|
||||
void GetSiblings(nsIDOMNode *aOneOfTheSiblings);
|
||||
void GetKids(nsIDOMNode *aParent);
|
||||
|
||||
void ClearState();
|
||||
NS_IMETHOD PushState();
|
||||
NS_IMETHOD PopState();
|
||||
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
nsCOMPtr<nsIBindingManager> mBindingManager;
|
||||
nsHTMLBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
class nsLinkableAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
|
||||
protected:
|
||||
PRBool IsALink();
|
||||
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
|
||||
nsCOMPtr<nsIContent> mLinkContent;
|
||||
PRBool mIsLinkVisited;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kyle Yuan (kyle.yuan@sun.com)
|
||||
* John Sun (john.sun@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsAccessibleEventData_H_
|
||||
#define _nsAccessibleEventData_H_
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
struct AtkStateChange {
|
||||
PRUint32 state;
|
||||
PRBool enable;
|
||||
};
|
||||
|
||||
enum AtkProperty {
|
||||
PROP_0, // gobject convention
|
||||
PROP_NAME,
|
||||
PROP_DESCRIPTION,
|
||||
PROP_PARENT, // ancestry has changed
|
||||
PROP_VALUE,
|
||||
PROP_ROLE,
|
||||
PROP_LAYER,
|
||||
PROP_MDI_ZORDER,
|
||||
PROP_TABLE_CAPTION,
|
||||
PROP_TABLE_COLUMN_DESCRIPTION,
|
||||
PROP_TABLE_COLUMN_HEADER,
|
||||
PROP_TABLE_ROW_DESCRIPTION,
|
||||
PROP_TABLE_ROW_HEADER,
|
||||
PROP_TABLE_SUMMARY,
|
||||
PROP_LAST // gobject convention
|
||||
};
|
||||
|
||||
struct AtkPropertyChange {
|
||||
PRInt32 type; // property type as listed above
|
||||
void *oldvalue;
|
||||
void *newvalue;
|
||||
};
|
||||
|
||||
struct AtkChildrenChange {
|
||||
PRUint32 index; // index of child in parent
|
||||
nsIAccessible *child;
|
||||
PRBool add; // true for add, false for delete
|
||||
};
|
||||
|
||||
struct AtkTextChange {
|
||||
PRUint32 start;
|
||||
PRUint32 length;
|
||||
PRBool add; // true for add, false for delete
|
||||
};
|
||||
|
||||
struct AtkTableChange {
|
||||
PRUint32 index; // the start row/column after which the rows are inserted/deleted.
|
||||
PRUint32 count; // the number of inserted/deleted rows/columns
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,438 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
// ------------
|
||||
// nsBlockAccessible
|
||||
// ------------
|
||||
|
||||
nsBlockAccessible::nsBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsBlockAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
// We're going to find the child that contains coordinates (tx,ty)
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h); // Get bounds for this accessible
|
||||
if (tx >= x && tx < x + w && ty >= y && ty < y + h)
|
||||
{
|
||||
// It's within this nsIAccessible, let's drill down
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> smallestChild;
|
||||
PRInt32 smallestArea = -1;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch; // Child bounds
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
// ok if there are multiple frames the contain the point
|
||||
// and they overlap then pick the smallest. We need to do this
|
||||
// for text frames.
|
||||
|
||||
// For example, A point that's in block #2 is also in block #1, but we want to return #2:
|
||||
//
|
||||
// [[block #1 is long wrapped text that continues to
|
||||
// another line]] [[here is a shorter block #2]]
|
||||
|
||||
if (tx >= cx && tx < cx + cw && ty >= cy && ty < cy + ch)
|
||||
{
|
||||
if (smallestArea == -1 || cw*ch < smallestArea) {
|
||||
smallestArea = cw*ch;
|
||||
smallestChild = child;
|
||||
}
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
if (smallestChild != nsnull)
|
||||
{
|
||||
*_retval = smallestChild;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsContainerAccessible
|
||||
*/
|
||||
nsContainerAccessible::nsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** no actions */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eNo_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no actions */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no actions */
|
||||
NS_IMETHODIMP nsContainerAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no state -- normal */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no value */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no name*/
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------
|
||||
// nsLeafFrameAccessible
|
||||
//-------------
|
||||
|
||||
nsLeafAccessible::nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsLeafAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsLeafAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsLeafAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------
|
||||
// nsLinkableAccessible
|
||||
//----------------
|
||||
|
||||
nsLinkableAccessible::nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell), mIsALinkCached(PR_FALSE), mLinkContent(nsnull), mIsLinkVisited(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsLinkableAccessible::AccTakeFocus()
|
||||
{
|
||||
if (IsALink()) {
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
mLinkContent->SetFocus(context);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long GetAccState (); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_READONLY | STATE_SELECTABLE;
|
||||
if (IsALink()) {
|
||||
*_retval |= STATE_LINKED;
|
||||
if (mIsLinkVisited)
|
||||
*_retval |= STATE_TRAVERSED;
|
||||
}
|
||||
|
||||
// Get current selection and find out if current node is in it
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
if (domSel) {
|
||||
PRBool isSelected = PR_FALSE, isCollapsed = PR_TRUE;
|
||||
domSel->ContainsNode(mDOMNode, PR_TRUE, &isSelected);
|
||||
domSel->GetIsCollapsed(&isCollapsed);
|
||||
if (isSelected && !isCollapsed)
|
||||
*_retval |=STATE_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsALink()) {
|
||||
// Make sure we also include all the states of the parent link, such as focusable, focused, etc.
|
||||
PRUint32 role;
|
||||
GetAccRole(&role);
|
||||
if (role != ROLE_LINK) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccParent(getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
PRUint32 orState = 0;
|
||||
parentAccessible->GetAccState(&orState);
|
||||
*_retval |= orState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
if (IsALink()) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mLinkContent));
|
||||
if (elt)
|
||||
return elt->GetAttribute(NS_LITERAL_STRING("href"), _retval);
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
// Action 0 (default action): Jump to link
|
||||
if (index == eAction_Jump) {
|
||||
if (IsALink()) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("jump"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
// Action 0 (default action): Jump to link
|
||||
if (index == eAction_Jump) {
|
||||
if (IsALink()) {
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (presContext) {
|
||||
nsMouseEvent linkClickEvent;
|
||||
linkClickEvent.eventStructType = NS_EVENT;
|
||||
linkClickEvent.message = NS_MOUSE_LEFT_CLICK;
|
||||
linkClickEvent.isShift = PR_FALSE;
|
||||
linkClickEvent.isControl = PR_FALSE;
|
||||
linkClickEvent.isAlt = PR_FALSE;
|
||||
linkClickEvent.isMeta = PR_FALSE;
|
||||
linkClickEvent.clickCount = 0;
|
||||
linkClickEvent.widget = nsnull;
|
||||
|
||||
nsEventStatus eventStatus = nsEventStatus_eIgnore;
|
||||
mLinkContent->HandleDOMEvent(presContext,
|
||||
&linkClickEvent,
|
||||
nsnull,
|
||||
NS_EVENT_FLAG_INIT,
|
||||
&eventStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsLinkableAccessible::IsALink()
|
||||
{
|
||||
if (mIsALinkCached) // Cached answer?
|
||||
return mLinkContent? PR_TRUE: PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
|
||||
if (walkUpContent) {
|
||||
nsCOMPtr<nsIContent> tempContent = walkUpContent;
|
||||
while (walkUpContent) {
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(walkUpContent));
|
||||
if (link) {
|
||||
mLinkContent = tempContent;
|
||||
mIsALinkCached = PR_TRUE;
|
||||
nsLinkState linkState;
|
||||
link->GetLinkState(linkState);
|
||||
if (linkState == eLinkState_Visited)
|
||||
mIsLinkVisited = PR_TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
walkUpContent->GetParent(*getter_AddRefs(tempContent));
|
||||
walkUpContent = tempContent;
|
||||
}
|
||||
}
|
||||
mIsALinkCached = PR_TRUE; // Cached that there is no link
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// ------------
|
||||
// nsMenuListenerAccessible
|
||||
// ------------
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
|
||||
|
||||
nsMenuListenerAccessible::nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMenuListenerAccessible::~nsMenuListenerAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupShowing(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupHiding(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuListenerAccessible::SetupMenuListener()
|
||||
{
|
||||
// if not already one, register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (!eventReceiver) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsBaseWidgetAccessible_H_
|
||||
#define _nsBaseWidgetAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
|
||||
/**
|
||||
* This file contains a number of classes that are used as base
|
||||
* classes for the different accessibility implementations of
|
||||
* the HTML and XUL widget sets. --jgaunt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Special Accessible that knows how to handle hit detection for flowing text
|
||||
*/
|
||||
class nsBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Special Accessible that just contains other accessible objects
|
||||
* no actions, no name, no state, no value
|
||||
*/
|
||||
class nsContainerAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Leaf version of DOM Accessible -- has no children
|
||||
*/
|
||||
class nsLeafAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* A type of accessible for DOM nodes containing an href="" attribute.
|
||||
* It knows how to report the state of the link ( traveled or not )
|
||||
* and can activate ( click ) the link programmatically.
|
||||
*/
|
||||
class nsLinkableAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD AccTakeFocus();
|
||||
|
||||
protected:
|
||||
PRBool IsALink();
|
||||
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
|
||||
nsCOMPtr<nsIContent> mLinkContent;
|
||||
PRBool mIsLinkVisited;
|
||||
};
|
||||
|
||||
/*
|
||||
* A base class that can listen to menu events. Its used by selects so the
|
||||
* button and the window accessibles can change their name and role
|
||||
* depending on whether the drop down list is dropped down on not
|
||||
*/
|
||||
class nsMenuListenerAccessible : public nsAccessible, public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsMenuListenerAccessible();
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
virtual void SetupMenuListener();
|
||||
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Original Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCaretAccessible.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsICaret.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsIAccessibleEventListener.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsCaretAccessible, nsLeafAccessible, nsIAccessibleCaret, nsISelectionListener)
|
||||
|
||||
nsCaretAccessible::nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsIAccessibleEventListener *aListener):
|
||||
nsLeafAccessible(aDocumentNode, aShell), mVisible(PR_TRUE), mListener(aListener)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::RemoveSelectionListener()
|
||||
{
|
||||
nsCOMPtr<nsISelection> prevDomSel(do_QueryReferent(mDomSelectionWeak));
|
||||
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(prevDomSel));
|
||||
if (selPrivate) {
|
||||
mDomSelectionWeak = nsnull;
|
||||
return selPrivate->RemoveSelectionListener(this);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::AttachNewSelectionListener(nsIDOMNode *aCurrentNode)
|
||||
{
|
||||
// When focus moves such that the caret is part of a new frame selection
|
||||
// this removes the old selection listener and attaches a new one for the current focus
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aCurrentNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (!doc) // we also should try to QI to document instead (necessary to do when node is a document)
|
||||
doc = do_QueryInterface(aCurrentNode);
|
||||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
doc->GetShellAt(0, getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aCurrentNode));
|
||||
if (!content)
|
||||
doc->GetRootContent(getter_AddRefs(content)); // If node is not content, use root content
|
||||
if (!presShell || !content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(content, &frame);
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!frame || !presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(presContext, getter_AddRefs(selCon));
|
||||
if (!selCon)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISelection> domSel, prevDomSel(do_QueryReferent(mDomSelectionWeak));
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
if (domSel == prevDomSel)
|
||||
return NS_OK; // This is already the selection we're listening to
|
||||
RemoveSelectionListener();
|
||||
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(domSel));
|
||||
|
||||
if (!selPrivate)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mDomSelectionWeak = do_GetWeakReference(domSel);
|
||||
return selPrivate->AddSelectionListener(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel, short aReason)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDoc));
|
||||
if (!doc)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
doc->GetShellAt(0, getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsISelection> domSel(do_QueryReferent(mDomSelectionWeak));
|
||||
if (!presShell || domSel != aSel)
|
||||
return NS_OK; // Only listening to selection changes in currently focused frame
|
||||
|
||||
nsCOMPtr<nsICaret> caret;
|
||||
presShell->GetCaret(getter_AddRefs(caret));
|
||||
if (!caret)
|
||||
return NS_OK;
|
||||
|
||||
nsRect caretRect;
|
||||
PRBool isCollapsed;
|
||||
caret->GetCaretCoordinates(nsICaret::eTopLevelWindowCoordinates, domSel, &caretRect, &isCollapsed);
|
||||
PRBool visible = (caretRect.x >= 0 && caretRect.y >= 0 && caretRect.width >= 0 && caretRect.height >= 0);
|
||||
if (visible) // Make sure it's visible both by looking at coordinates and visible flag
|
||||
caret->GetCaretVisible(&visible);
|
||||
if (visible != mVisible) {
|
||||
mVisible = visible;
|
||||
mListener->HandleEvent(mVisible? nsIAccessibleEventListener::EVENT_SHOW: nsIAccessibleEventListener::EVENT_HIDE, this, nsnull);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsCOMPtr<nsIViewManager> viewManager;
|
||||
presShell->GetViewManager(getter_AddRefs(viewManager));
|
||||
if (!presContext || !viewManager)
|
||||
return NS_OK;
|
||||
nsIView *view = nsnull;
|
||||
viewManager->GetRootView(view);
|
||||
if (!view)
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetWidget(*getter_AddRefs(widget));
|
||||
if (!widget)
|
||||
return NS_OK;
|
||||
|
||||
float t2p;
|
||||
presContext->GetTwipsToPixels(&t2p);
|
||||
// Convert to pixels using that scale
|
||||
caretRect.x = NSTwipsToIntPixels(caretRect.x, t2p);
|
||||
caretRect.y = NSTwipsToIntPixels(caretRect.y, t2p);
|
||||
|
||||
caretRect.width = NSTwipsToIntPixels(caretRect.width, t2p);
|
||||
caretRect.height = NSTwipsToIntPixels(caretRect.height, t2p);
|
||||
|
||||
nsRect caretScreenRect;
|
||||
widget->WidgetToScreen(caretRect, mCaretRect);
|
||||
|
||||
#ifndef MOZ_ACCESSIBILITY_ATK
|
||||
if (visible)
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_LOCATION_CHANGE, this, nsnull);
|
||||
#else
|
||||
if (isCollapsed) {
|
||||
PRInt32 caretOffset;
|
||||
domSel->GetFocusOffset(&caretOffset);
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_ATK_TEXT_CARET_MOVE, this, (AccessibleEventData*)&caretOffset);
|
||||
}
|
||||
else
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_ATK_TEXT_SELECTION_CHANGE, this, nsnull);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Return the caret's bounds */
|
||||
NS_IMETHODIMP nsCaretAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
if (!mVisible)
|
||||
return NS_ERROR_FAILURE; // When root accessible hasn't yet called SetCaretBounds()
|
||||
*x = mCaretRect.x;
|
||||
*y = mCaretRect.y;
|
||||
*width = mCaretRect.width;
|
||||
*height = mCaretRect.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CARET;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = mVisible? 0: STATE_INVISIBLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCaretAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Original Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __nsCaretAccessible_h__
|
||||
#define __nsCaretAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIAccessibleCaret.h"
|
||||
#include "nsISelectionListener.h"
|
||||
/*
|
||||
* This special accessibility class is for the caret, which is really the currently focused selection.
|
||||
* There is only 1 visible caret per top level window (nsRootAccessible)
|
||||
* The caret accesible does not exist within the normal accessible tree; it lives in a different world.
|
||||
* In MSAA, it is retrieved with via the WM_GETOBJECT message with lParam = OBJID_CARET,
|
||||
* (as opposed to the root accessible tree for a window which is retrieved with OBJID_CLIENT)
|
||||
* The caret accessible is owned by the nsRootAccessible for the top level window that it's in.
|
||||
*/
|
||||
|
||||
class nsCaretAccessible : public nsLeafAccessible, public nsIAccessibleCaret, public nsISelectionListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsIAccessibleEventListener *aListener);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
/* ----- nsIAccessibleCaret ------ */
|
||||
NS_IMETHOD AttachNewSelectionListener(nsIDOMNode *aFocusedNode);
|
||||
NS_IMETHOD RemoveSelectionListener();
|
||||
|
||||
/* ----- nsISelectionListener ---- */
|
||||
NS_IMETHOD NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel, short aReason);
|
||||
|
||||
private:
|
||||
nsRect mCaretRect;
|
||||
PRBool mVisible;
|
||||
// mListener is not a com pointer. It's a copy of the listener in the nsRootAccessible owner.
|
||||
//See nsRootAccessible.h for details of the lifetime if this listener
|
||||
nsIAccessibleEventListener *mListener;
|
||||
nsCOMPtr<nsIWeakReference> mDomSelectionWeak;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,180 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
* Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULLabelElement.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/**
|
||||
* nsFormControlAccessible
|
||||
*/
|
||||
|
||||
nsFormControlAccessible::nsFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL states: focused, unavailable(disabled), focusable, ?protected?
|
||||
* HTML states: focused, unabailable(disabled), focusable, protected
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Get the focused state from the nsAccessible
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlFormElement(do_QueryInterface(mDOMNode, &rv));
|
||||
if (NS_SUCCEEDED(rv) && htmlFormElement) {
|
||||
htmlFormElement->GetDisabled(&disabled);
|
||||
nsAutoString typeString;
|
||||
htmlFormElement->GetType(typeString);
|
||||
if (typeString.EqualsIgnoreCase("password"))
|
||||
*_retval |= STATE_PROTECTED;
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode, &rv));
|
||||
if (NS_SUCCEEDED(rv) && xulFormElement) {
|
||||
xulFormElement->GetDisabled(&disabled);
|
||||
/* XXX jgaunt do XUL elements support password fields? */
|
||||
}
|
||||
}
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
else
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called by both HTML and XUL elements, this method
|
||||
* merely checks who is calling and then calls the appropriate
|
||||
* protected method for the XUL or HTML element.
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULElement> xulFormElement(do_QueryInterface(mDOMNode));
|
||||
if (xulFormElement)
|
||||
return GetXULAccName(_retval);
|
||||
else
|
||||
return GetHTMLAccName(_retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ------------
|
||||
// Radio button
|
||||
// ------------
|
||||
|
||||
nsRadioButtonAccessible::nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("select"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_RADIOBUTTON;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsFormControlAccessible_H_
|
||||
#define _nsFormControlAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
|
||||
/**
|
||||
* This supports name and state information for both XUL and HTML
|
||||
* widgets. Designed to be a base class for the impls of XUL
|
||||
* and HTML form widget Accessibles
|
||||
*/
|
||||
class nsFormControlAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class nsRadioButtonAccessible : public nsFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,45 +1,31 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
@@ -93,38 +79,26 @@ NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* DOMString getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(nsAString& _retval)
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* DOMString getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(nsAString& _retval)
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute long accId; */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccId(PRInt32 *aAccId)
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const nsAReadableString& name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in DOMString name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const nsAString& name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* DOMString getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(nsAString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* DOMString getAccKeyboardShortcut (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccKeyboardShortcut(nsAString& _retval)
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@@ -135,7 +109,7 @@ NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUint32 *_retval)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* DOMString getAccState (); */
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
@@ -147,8 +121,8 @@ NS_IMETHODIMP nsGenericAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* DOMString getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@@ -165,8 +139,8 @@ NS_IMETHODIMP nsGenericAccessible::GetAccFocused(nsIAccessible **_retval)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* DOMString getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(nsAString& _retval)
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@@ -248,7 +222,4 @@ NS_IMETHODIMP nsGenericAccessible::AccGetDOMNode(nsIDOMNode **_retval)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,25 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsGenericAccessible_H_
|
||||
#define _nsGenericAccessible_H_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,40 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsRootAccessible_H_
|
||||
#define _nsRootAccessible_H_
|
||||
@@ -44,20 +28,9 @@
|
||||
#include "nsIAccessibleEventListener.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIScrollPositionListener.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
const PRInt32 SCROLL_HASH_START_SIZE = 6;
|
||||
|
||||
class nsDocAccessibleMixin
|
||||
{
|
||||
@@ -65,11 +38,12 @@ class nsDocAccessibleMixin
|
||||
nsDocAccessibleMixin(nsIDocument *doc);
|
||||
nsDocAccessibleMixin(nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleMixin();
|
||||
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
||||
@@ -78,35 +52,29 @@ class nsRootAccessible : public nsAccessible,
|
||||
public nsIAccessibleDocument,
|
||||
public nsIAccessibleEventReceiver,
|
||||
public nsIDOMFocusListener,
|
||||
public nsIDOMFormListener,
|
||||
public nsIDOMXULListener,
|
||||
public nsIWebProgressListener,
|
||||
public nsITimerCallback,
|
||||
public nsIScrollPositionListener,
|
||||
public nsSupportsWeakReference
|
||||
public nsIDOMFormListener
|
||||
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
enum EBusyState {eBusyStateUninitialized, eBusyStateLoading, eBusyStateDone};
|
||||
|
||||
nsRootAccessible(nsIWeakReference* aShell);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccName(nsAString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAString& aAccValue);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& aAccValue);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
// ----- nsIAccessibleEventReceiver -------------------
|
||||
|
||||
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
NS_IMETHOD RemoveAccessibleEventListener();
|
||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
|
||||
// ----- nsIDOMEventListener --------------------------
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent);
|
||||
|
||||
// ----- nsIDOMFocusListener --------------------------
|
||||
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
||||
@@ -119,55 +87,20 @@ class nsRootAccessible : public nsAccessible,
|
||||
NS_IMETHOD Select(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Input(nsIDOMEvent* aEvent);
|
||||
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent);
|
||||
|
||||
// ----- nsIScrollPositionListener ---------------------------
|
||||
NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
|
||||
NS_IMETHOD ScrollPositionDidChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
|
||||
|
||||
// ----- nsITimerCallback ------------------------------------
|
||||
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode);
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual nsIFrame* GetFrame();
|
||||
void FireAccessibleFocusEvent(nsIAccessible *focusAccessible, nsIDOMNode *focusNode);
|
||||
void StartDocReadyTimer();
|
||||
void AddScrollListener(nsIPresShell *aPresShell);
|
||||
void RemoveScrollListener(nsIPresShell *aPresShell);
|
||||
friend PRBool PR_CALLBACK RemoveScrollListenerEnum(nsHashKey *aKey, void *aData, void* aClosure);
|
||||
|
||||
static PRUint32 gInstanceCount;
|
||||
|
||||
// mListener is not a com pointer. We don't own the listener
|
||||
// not a com pointer. We don't own the listener
|
||||
// it is the callers responsibility to remove the listener
|
||||
// otherwise we will get into circular referencing problems
|
||||
// We don't need a weak reference, because we're owned by this listener
|
||||
nsIAccessibleEventListener *mListener;
|
||||
|
||||
static nsIDOMNode * gLastFocusedNode; // we do our own refcounting for this
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsIWebProgress> mWebProgress;
|
||||
nsIAccessibleEventListener* mListener;
|
||||
nsCOMPtr<nsIDOMNode> mCurrentFocus;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
EBusyState mBusy;
|
||||
|
||||
// Used for tracking scroll events
|
||||
PRUint32 mScrollPositionChangedTicks;
|
||||
nsSupportsHashtable *mScrollablePresShells;
|
||||
nsCOMPtr<nsIWeakReference> mLastScrolledPresShell;
|
||||
nsCOMPtr<nsIAccessibleCaret> mCaretAccessible;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,545 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
* Kyle Yuan (kyle.yuan@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "nsIDOMHTMLOptGroupElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIListControlFrame.h"
|
||||
#include "nsISelectControlFrame.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsSelectAccessible.h"
|
||||
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/** Constructor -- cache our parent */
|
||||
nsSelectListAccessible::nsSelectListAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/** Return our parents bounds */
|
||||
NS_IMETHODIMP nsSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
/** Return our cached parent */
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** We are a list */
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** We are an only child */
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** We are an only child */
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsSelectOptionAccessible
|
||||
*/
|
||||
|
||||
/** Constructor -- cache our parent */
|
||||
nsSelectOptionAccessible::nsSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
if (aParent)
|
||||
mParent = aParent;
|
||||
else {
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsIDOMNode> parentNode, parentNode1;
|
||||
nsCOMPtr<nsIAccessible> parentAccessible, lastChildAcc;
|
||||
aDOMNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
// this parent could be a Combobox or a ListBox. Each has a different
|
||||
// was to get to the ListElement.
|
||||
nsCOMPtr<nsIDOMHTMLOptGroupElement> optGroupElement(do_QueryInterface(parentNode));
|
||||
if (optGroupElement) {
|
||||
parentNode->GetParentNode(getter_AddRefs(parentNode1));
|
||||
parentNode = parentNode1;
|
||||
}
|
||||
accService->GetAccessibleFor(parentNode, getter_AddRefs(parentAccessible));
|
||||
PRUint32 role;
|
||||
do {
|
||||
parentAccessible->GetAccLastChild(getter_AddRefs(lastChildAcc));
|
||||
if (lastChildAcc)
|
||||
lastChildAcc->GetAccRole(&role);
|
||||
parentAccessible = lastChildAcc;
|
||||
} while (role != nsIAccessible::ROLE_LIST && lastChildAcc);
|
||||
}
|
||||
mParent = parentAccessible;
|
||||
}
|
||||
}
|
||||
|
||||
/** We are a ListItem */
|
||||
NS_IMETHODIMP nsSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LISTITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Return our cached parent */
|
||||
NS_IMETHODIMP nsSelectOptionAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get our Name from our Content's subtree
|
||||
*/
|
||||
NS_IMETHODIMP nsSelectOptionAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
// CASE #1 -- great majority of the cases
|
||||
// find the label attribute - this is what the W3C says we should use
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(domElement, "No domElement for accessible DOM node!");
|
||||
nsresult rv = domElement->GetAttribute(NS_LITERAL_STRING("label"), _retval) ;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !_retval.IsEmpty() ) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// CASE #2 -- no label parameter, get the first child,
|
||||
// use it if it is a text node
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
if (child) {
|
||||
nsCOMPtr<nsIDOMText> text (do_QueryInterface(child));
|
||||
if (text) {
|
||||
nsCOMPtr<nsIContent> content (do_QueryInterface(child));
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsAutoString txtValue;
|
||||
rv = AppendFlatStringFromContentNode(content, &txtValue);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var (txtValue) needed until CompressWhitespace built for nsAString
|
||||
txtValue.CompressWhitespace();
|
||||
_retval.Assign(txtValue);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/** ----- nsComboboxTextFieldAccessible ----- */
|
||||
|
||||
/** Constructor */
|
||||
nsComboboxTextFieldAccessible::nsComboboxTextFieldAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently gets the text from the first option, needs to check for selection
|
||||
* and then return that text.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!frame || !context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::textFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AppendFlatStringFromSubtree(content, &_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the BlockFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our first child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!frame || !context)
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, aBoundingFrame);
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/** Return our cached parent */
|
||||
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are the first child of our parent, no previous sibling
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our role is currently only static text, but we should be able to have
|
||||
* editable text here and we need to check that case.
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_STATICTEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsComboboxTextFieldAccessible we can have the following states:
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Get focus status from base class
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** -----ComboboxButtonAccessible ----- */
|
||||
|
||||
/** Constructor -- cache our parent */
|
||||
nsComboboxButtonAccessible::nsComboboxButtonAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/** Just one action ( click ). */
|
||||
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the gfxButtonControlFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our second child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
*aBoundingFrame = frame; // bounding frame is the ComboboxControlFrame
|
||||
frame->FirstChild(context, nsnull, &frame); // first frame is for the textfield
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetNextSibling(&frame); // sibling frame is for the button
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/** We are a button. */
|
||||
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Return our cached parent */
|
||||
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name from GetAccActionName()
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
return GetAccActionName(eAction_Click, _retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Our action name is the reverse of our state:
|
||||
* if we are closed -> open is our name.
|
||||
* if we are open -> closed is our name.
|
||||
* Uses the frame to get the state, updated on every click
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (isOpen)
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("close"), _retval);
|
||||
else
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("open"), _retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsComboboxButtonAccessible we can have the following states:
|
||||
* STATE_PRESSED
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Get focus status from base class
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
// we are open or closed --> pressed or not
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (isOpen)
|
||||
*_retval |= STATE_PRESSED;
|
||||
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ----- nsComboboxWindowAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- cache our parent
|
||||
*/
|
||||
nsComboboxWindowAccessible::nsComboboxWindowAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsComboboxWindowAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_INVISIBLE
|
||||
* STATE_FLOATING
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Get focus status from base class
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
// we are open or closed
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame = nsnull;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (! isOpen)
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
*_retval |= STATE_FOCUSABLE | STATE_FLOATING;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** We are a window */
|
||||
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Return our cached parent */
|
||||
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are the last sibling of our parent.
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only have one child, a list
|
||||
*/
|
||||
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the areaFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our first option
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aBoundingFrame = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame) {
|
||||
*aBoundingFrame = nsnull;
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetParent(aBoundingFrame);
|
||||
frame->GetParent(&frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::areaFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
* Kyle Yuan (kyle.yuan@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __nsSelectAccessible_h__
|
||||
#define __nsSelectAccessible_h__
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
enum { eSelection_Add=0, eSelection_Remove=1, eSelection_GetState=2 };
|
||||
|
||||
/**
|
||||
* The list that contains all the options in the select.
|
||||
*/
|
||||
class nsSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectListAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options inside the select, contained within the list
|
||||
*/
|
||||
class nsSelectOptionAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectOptionAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class the represents the text field in the Combobox to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsComboboxTextFieldAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsComboboxTextFieldAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the
|
||||
* right of the text field
|
||||
*/
|
||||
class nsComboboxButtonAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsComboboxButtonAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsComboboxWindowAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsComboboxWindowAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,488 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
* Aaron Leventhal (aaronl@netscape.com)
|
||||
* Kyle Yuan (kyle.yuan@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsContentCID.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsTextAccessible.h"
|
||||
#include "nsTextFragment.h"
|
||||
|
||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAccessibleText, nsIAccessibleText)
|
||||
|
||||
nsAccessibleText::nsAccessibleText()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsAccessibleText::~nsAccessibleText()
|
||||
{
|
||||
}
|
||||
|
||||
void nsAccessibleText::SetTextNode(nsIDOMNode *aNode)
|
||||
{
|
||||
mTextNode = aNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleText impl.
|
||||
*/
|
||||
nsresult nsAccessibleText::GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mTextNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
|
||||
frame->GetSelectionController(context, aSelCon);
|
||||
if (*aSelCon)
|
||||
(*aSelCon)->GetSelection(nsISelectionController::SELECTION_NORMAL, aDomSel);
|
||||
}
|
||||
|
||||
if (*aSelCon && *aDomSel)
|
||||
return NS_OK;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
Gets the specified text.
|
||||
|
||||
aBoundaryType means:
|
||||
|
||||
ATK_TEXT_BOUNDARY_CHAR
|
||||
The character before/at/after the offset is returned.
|
||||
|
||||
ATK_TEXT_BOUNDARY_WORD_START
|
||||
The returned string is from the word start before/at/after the offset to the next word start.
|
||||
|
||||
ATK_TEXT_BOUNDARY_WORD_END
|
||||
The returned string is from the word end before/at/after the offset to the next work end.
|
||||
|
||||
ATK_TEXT_BOUNDARY_SENTENCE_START
|
||||
The returned string is from the sentence start before/at/after the offset to the next sentence start.
|
||||
|
||||
ATK_TEXT_BOUNDARY_SENTENCE_END
|
||||
The returned string is from the sentence end before/at/after the offset to the next sentence end.
|
||||
|
||||
ATK_TEXT_BOUNDARY_LINE_START
|
||||
The returned string is from the line start before/at/after the offset to the next line start.
|
||||
|
||||
ATK_TEXT_BOUNDARY_LINE_END
|
||||
The returned string is from the line end before/at/after the offset to the next line start.
|
||||
*/
|
||||
nsresult nsAccessibleText::GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
|
||||
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
|
||||
if (!range)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aStartOffset = *aEndOffset = aOffset;
|
||||
|
||||
// Move caret position to offset
|
||||
range->SetStart(mTextNode, aOffset);
|
||||
range->SetEnd(mTextNode, aOffset);
|
||||
domSel->RemoveAllRanges();
|
||||
domSel->AddRange(range);
|
||||
|
||||
// Step1: move caret to an appropriate start position
|
||||
// Step2: move caret to end postion and select the text
|
||||
PRBool isStep1Forward, isStep2Forward; // Moving directions for two steps
|
||||
switch (aType)
|
||||
{
|
||||
case eGetBefore:
|
||||
isStep1Forward = PR_FALSE;
|
||||
isStep2Forward = PR_FALSE;
|
||||
break;
|
||||
case eGetAt:
|
||||
isStep1Forward = PR_FALSE;
|
||||
isStep2Forward = PR_TRUE;
|
||||
break;
|
||||
case eGetAfter:
|
||||
isStep1Forward = PR_TRUE;
|
||||
isStep2Forward = PR_TRUE;
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
switch (aBoundaryType)
|
||||
{
|
||||
case BOUNDARY_CHAR:
|
||||
if (aType == eGetAfter) { // We need the character next to current position
|
||||
selCon->CharacterMove(isStep1Forward, PR_FALSE);
|
||||
domSel->GetFocusOffset(aStartOffset);
|
||||
}
|
||||
selCon->CharacterMove(isStep2Forward, PR_TRUE);
|
||||
domSel->GetFocusOffset(aEndOffset);
|
||||
break;
|
||||
case BOUNDARY_WORD_START:
|
||||
selCon->WordMove(isStep1Forward, PR_FALSE); // Move caret to previous/next word start boundary
|
||||
domSel->GetFocusOffset(aStartOffset);
|
||||
selCon->WordMove(isStep2Forward, PR_TRUE); // Select previous/next word
|
||||
domSel->GetFocusOffset(aEndOffset);
|
||||
break;
|
||||
case BOUNDARY_LINE_START:
|
||||
if (aType != eGetAt) { // We need adjust the caret position to previous/next line
|
||||
selCon->LineMove(isStep1Forward, PR_TRUE);
|
||||
domSel->GetFocusOffset(aEndOffset);
|
||||
}
|
||||
selCon->IntraLineMove(PR_FALSE, PR_FALSE); // Move caret to the line start
|
||||
domSel->GetFocusOffset(aStartOffset);
|
||||
selCon->IntraLineMove(PR_TRUE, PR_TRUE); // Move caret to the line end and select the whole line
|
||||
domSel->GetFocusOffset(aEndOffset);
|
||||
break;
|
||||
case BOUNDARY_WORD_END:
|
||||
case BOUNDARY_LINE_END:
|
||||
case BOUNDARY_SENTENCE_START:
|
||||
case BOUNDARY_SENTENCE_END:
|
||||
case BOUNDARY_ATTRIBUTE_RANGE:
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsXPIDLString text;
|
||||
// Get text from selection
|
||||
domSel->ToString(getter_Copies(text));
|
||||
domSel->RemoveAllRanges();
|
||||
_retval = text;
|
||||
|
||||
// Ensure aStartOffset <= aEndOffset
|
||||
if (*aStartOffset > *aEndOffset) {
|
||||
PRInt32 tmp = *aStartOffset;
|
||||
*aStartOffset = *aEndOffset;
|
||||
*aEndOffset = tmp;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the offset position of the caret (cursor).
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetCaretOffset(PRInt32 *aCaretOffset)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return domSel->GetFocusOffset(aCaretOffset);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the caret (cursor) position to the specified offset.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::SetCaretOffset(PRInt32 aCaretOffset)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
|
||||
if (! range)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
range->SetStart(mTextNode, aCaretOffset);
|
||||
range->SetEnd(mTextNode, aCaretOffset);
|
||||
return domSel->AddRange(range);
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the character count.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetCharacterCount(PRInt32 *aCharacterCount)
|
||||
{
|
||||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mTextNode));
|
||||
if (!textContent)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return textContent->GetTextLength(aCharacterCount);
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the number of selected regions.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetSelectionCount(PRInt32 *aSelectionCount)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return domSel->GetRangeCount(aSelectionCount);
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the specified text.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset, nsAString & _retval)
|
||||
{
|
||||
nsAutoString text;
|
||||
mTextNode->GetNodeValue(text);
|
||||
_retval = Substring(text, aStartOffset, aEndOffset - aStartOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleText::GetTextBeforeOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
|
||||
{
|
||||
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleText::GetTextAtOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
|
||||
{
|
||||
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleText::GetTextAfterOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
|
||||
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
|
||||
{
|
||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, _retval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the specified text.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *_retval)
|
||||
{
|
||||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mTextNode));
|
||||
if (!textContent)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
const nsTextFragment *textFrag;
|
||||
textContent->GetText(&textFrag);
|
||||
*_retval = textFrag->CharAt(aOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleText::GetAttributeRange(PRInt32 aOffset, PRInt32 *aRangeStartOffset, PRInt32 *aRangeEndOffset, nsISupports **_retval)
|
||||
{
|
||||
// will do better job later
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given an offset, the x, y, width, and height values are filled appropriately.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset, PRInt32 *aX, PRInt32 *aY, PRInt32 *aLength, PRInt32 *aWidth, nsAccessibleCoordType aCoordType)
|
||||
{
|
||||
// will do better job later
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to
|
||||
* the screen or this widget's window depending on coords.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, nsAccessibleCoordType aCoordType, PRInt32 *_retval)
|
||||
{
|
||||
// will do better job later
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the start and end offset of the specified selection.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rangeCount;
|
||||
domSel->GetRangeCount(&rangeCount);
|
||||
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
|
||||
range->GetStartOffset(aStartOffset);
|
||||
range->GetEndOffset(aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Changes the start and end offset of the specified selection.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rangeCount;
|
||||
domSel->GetRangeCount(&rangeCount);
|
||||
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> startParent;
|
||||
nsCOMPtr<nsIDOMNode> endParent;
|
||||
range->GetStartContainer(getter_AddRefs(startParent));
|
||||
range->GetEndContainer(getter_AddRefs(endParent));
|
||||
range->SetStart(startParent, aStartOffset);
|
||||
range->SetEnd(endParent, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a selection bounded by the specified offsets.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
|
||||
if (! range)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
range->SetStart(mTextNode, aStartOffset);
|
||||
range->SetEnd(mTextNode, aEndOffset);
|
||||
return domSel->AddRange(range);
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes the specified selection.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleText::RemoveSelection(PRInt32 aSelectionNum)
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
|
||||
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rangeCount;
|
||||
domSel->GetRangeCount(&rangeCount);
|
||||
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
|
||||
return domSel->RemoveRange(range);
|
||||
}
|
||||
|
||||
// ------------
|
||||
// Text Accessibles
|
||||
// ------------
|
||||
|
||||
nsTextAccessible::nsTextAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
{
|
||||
SetTextNode(aDOMNode);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsTextAccessible, nsLinkableAccessible, nsAccessibleText)
|
||||
|
||||
/**
|
||||
* We are text
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsTextAccessible_H_
|
||||
#define _nsTextAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
class nsAccessibleText : public nsIAccessibleText
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLETEXT
|
||||
|
||||
nsAccessibleText();
|
||||
virtual ~nsAccessibleText();
|
||||
|
||||
void SetTextNode(nsIDOMNode *aNode);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDOMNode> mTextNode;
|
||||
|
||||
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
|
||||
|
||||
nsresult GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel);
|
||||
nsresult GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
|
||||
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Text nodes have no children, but since double inheritance
|
||||
* no-worky we have to re-impl the LeafAccessiblity blocks
|
||||
* this way.
|
||||
*/
|
||||
class nsTextAccessible : public nsLinkableAccessible,
|
||||
public nsAccessibleText
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_html_s
|
||||
REQUIRES = \
|
||||
appshell \
|
||||
content \
|
||||
docshell \
|
||||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
gfx2 \
|
||||
htmlparser \
|
||||
imglib2 \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
plugin \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsHTMLAreaAccessible.cpp \
|
||||
nsHTMLFormControlAccessible.cpp \
|
||||
nsHTMLIFrameRootAccessible.cpp \
|
||||
nsHTMLImageAccessible.cpp \
|
||||
nsHTMLLinkAccessible.cpp \
|
||||
nsHTMLPluginAccessible.cpp \
|
||||
nsHTMLSelectAccessible.cpp \
|
||||
nsHTMLTableAccessible.cpp \
|
||||
nsHTMLTextAccessible.cpp \
|
||||
nsHTMLWin32ObjectAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../base \
|
||||
-I$(srcdir)/../../../layout/html/base/src \
|
||||
$(NULL)
|
||||
@@ -1,84 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# 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): John Gaunt (jgaunt@netscape.com)
|
||||
|
||||
DEPTH = ..\..\..
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_html_s
|
||||
REQUIRES = \
|
||||
appshell \
|
||||
content \
|
||||
docshell \
|
||||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
gfx2 \
|
||||
htmlparser \
|
||||
imglib2 \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
plugin \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webBrowser_core \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsHTMLAreaAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLIFrameRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLImageAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLLinkAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLPluginAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLSelectAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTextAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLWin32ObjectAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
.\nsHTMLWin32ObjectAccessible.h \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I..\base \
|
||||
-I..\..\..\layout\html\forms\public \
|
||||
-I..\..\..\layout\html\forms\src \
|
||||
-I..\..\..\layout\html\base\src \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +1,25 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
@@ -46,6 +30,7 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
|
||||
// --- area -----
|
||||
@@ -56,7 +41,7 @@ nsLinkableAccessible(aDomNode, aShell), mAccParent(aAccParent)
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccName(nsAString & _retval)
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccName(nsAWritableString & _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt) {
|
||||
@@ -74,7 +59,7 @@ NS_IMETHODIMP nsHTMLAreaAccessible::GetAccRole(PRUint32 *_retval)
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccValue(nsAString& _retval)
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt)
|
||||
@@ -83,7 +68,7 @@ NS_IMETHODIMP nsHTMLAreaAccessible::GetAccValue(nsAString& _retval)
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccDescription(nsAString& _retval)
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
// Still to do - follow IE's standard here
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mDOMNode));
|
||||
|
||||
@@ -1,46 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLAreaAccessible_H_
|
||||
#define _nsHTMLAreaAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
/* Accessible for image map areas - must be child of image
|
||||
@@ -51,16 +35,16 @@ class nsHTMLAreaAccessible : public nsLinkableAccessible
|
||||
|
||||
public:
|
||||
nsHTMLAreaAccessible(nsIDOMNode *domNode, nsIAccessible *accParent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString & _retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString & _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible * *aAccNextSibling);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling);
|
||||
NS_IMETHOD GetAccDescription(nsAString& _retval);
|
||||
NS_IMETHOD GetAccDescription(nsAWritableString& _retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -1,162 +1,241 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMNSHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel)
|
||||
{
|
||||
PRInt32 numChildren = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement(do_QueryInterface(aLookNode));
|
||||
if (labelElement) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aLookNode));
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (elt) {
|
||||
nsAutoString labelIsFor;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("for"),labelIsFor);
|
||||
if (labelIsFor.Equals(*aId))
|
||||
rv = AppendFlatStringFromSubtree(aLookNode, aLabel);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
aLookNode->ChildCount(numChildren);
|
||||
nsIContent *contentWalker;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < numChildren; index++) {
|
||||
aLookNode->ChildAt(index, contentWalker);
|
||||
if (contentWalker)
|
||||
AppendLabelFor(contentWalker, aId, aLabel);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement;
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElement;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoString label;
|
||||
// go up tree get name of ancestor label if there is one. Don't go up farther than form element
|
||||
while (walkUpContent && label.IsEmpty() && !formElement) {
|
||||
labelElement = do_QueryInterface(walkUpContent);
|
||||
if (labelElement)
|
||||
rv = AppendFlatStringFromSubtree(walkUpContent, &label);
|
||||
formElement = do_QueryInterface(walkUpContent); // reached top ancestor in form
|
||||
nsCOMPtr<nsIContent> nextParent;
|
||||
walkUpContent->GetParent(*getter_AddRefs(nextParent));
|
||||
walkUpContent = nextParent;
|
||||
}
|
||||
|
||||
|
||||
// There can be a label targeted at this control using the for="control_id" attribute
|
||||
// To save computing time, only look for those inside of a form element
|
||||
walkUpContent = do_QueryInterface(formElement);
|
||||
|
||||
if (walkUpContent) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
nsAutoString forId;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("id"), forId);
|
||||
// Actually we'll be walking down the content this time, with a depth first search
|
||||
if (!forId.IsEmpty())
|
||||
AppendLabelFor(walkUpContent,&forId,&label);
|
||||
}
|
||||
|
||||
label.CompressWhitespace();
|
||||
if (label.IsEmpty())
|
||||
return nsAccessible::GetAccName(_retval);
|
||||
|
||||
_retval.Assign(label);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked, protected, unavailable
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked) *_retval |= STATE_CHECKED;
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
element->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
|
||||
nsAutoString typeString;
|
||||
element->GetType(typeString);
|
||||
if (typeString.EqualsIgnoreCase("password"))
|
||||
*_retval |= STATE_PROTECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CHECKBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) { // 0 is the magic value for default action
|
||||
if (index == 0) {
|
||||
// check or uncheck
|
||||
PRUint32 state;
|
||||
GetAccState(&state);
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (state & STATE_CHECKED)
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("uncheck"), _retval);
|
||||
PRBool checked = PR_FALSE;
|
||||
if (element)
|
||||
element->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
_retval = NS_LITERAL_STRING("uncheck");
|
||||
else
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("check"), _retval);
|
||||
_retval = NS_LITERAL_STRING("check");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) { // 0 is the magic value for default action
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement(do_QueryInterface(mDOMNode));
|
||||
if (htmlCheckboxElement) {
|
||||
htmlCheckboxElement->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement(do_QueryInterface(mDOMNode));
|
||||
if (htmlCheckboxElement)
|
||||
htmlCheckboxElement->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
*_retval |= STATE_CHECKED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRadioButtonAccessible(aNode, aShell)
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoAction(PRUint8 index)
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("select");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlRadioElement(do_QueryInterface(mDOMNode));
|
||||
if (htmlRadioElement)
|
||||
htmlRadioElement->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
*_retval |= STATE_CHECKED;
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_RADIOBUTTON;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -164,58 +243,47 @@ NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
||||
|
||||
nsAutoString buttonType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||
if (buttonType.EqualsIgnoreCase("submit"))
|
||||
*_retval |= STATE_DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAString& _retval)
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button(do_QueryInterface(mDOMNode));
|
||||
|
||||
@@ -234,62 +302,56 @@ NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAString& _retval)
|
||||
// ----- HTML 4 Button: can contain arbitrary HTML content -----
|
||||
|
||||
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
nsHTMLBlockAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMNSHTMLButtonElement> buttonElement(do_QueryInterface(mDOMNode));
|
||||
if ( buttonElement )
|
||||
{
|
||||
buttonElement->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
||||
|
||||
nsAutoString buttonType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||
if (buttonType.EqualsIgnoreCase("submit"))
|
||||
*_retval |= STATE_DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAString& _retval)
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
@@ -299,7 +361,7 @@ NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAString& _retval)
|
||||
rv = AppendFlatStringFromSubtree(content, &name);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAString
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
@@ -311,52 +373,20 @@ NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAString& _retval)
|
||||
// --- textfield -----
|
||||
|
||||
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
// In nsHTMLTextFieldAccessible, mDOMNode is a nsHTMLInputElement. But we need
|
||||
// a *true* text node(nsTextNode) for the text operation. It's the first child
|
||||
// of our editor's root element
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsCOMPtr<nsITextControlFrame> tframe(do_QueryInterface(frame));
|
||||
if (!tframe)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
tframe->GetEditor(getter_AddRefs(editor));
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
editor->GetRootElement(getter_AddRefs(rootElement));
|
||||
nsCOMPtr<nsIDOMNode> rootNode(do_QueryInterface(rootElement));
|
||||
if (rootNode) {
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
rootNode->GetFirstChild(getter_AddRefs(domNode));
|
||||
SetTextNode(domNode);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessible, nsFormControlAccessible, nsIAccessibleEditableText, nsAccessibleText)
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAString& _retval)
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
PRUint32 state;
|
||||
GetAccState(&state);
|
||||
if (state & STATE_PROTECTED) // Don't return password text!
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
if (textArea) {
|
||||
textArea->GetValue(_retval);
|
||||
@@ -372,6 +402,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAString& _retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
@@ -398,8 +429,8 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
|
||||
nsIFrame *frame;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame))) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
@@ -419,7 +450,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
if (inputElement) {
|
||||
/////// ====== Must be a password field, so it uses nsIDOMHTMLFormControl ==== ///////
|
||||
PRUint32 moreStates = 0;
|
||||
nsresult rv = nsFormControlAccessible::GetAccState(&moreStates);
|
||||
nsresult rv = nsHTMLFormControlAccessible::GetAccState(&moreStates);
|
||||
*_retval |= moreStates;
|
||||
return rv;
|
||||
}
|
||||
@@ -434,147 +465,3 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos, nsISupports *aAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::SetTextContents(const nsAString &aText)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
if (textArea)
|
||||
return textArea->SetValue(aText);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
if (inputElement)
|
||||
return inputElement->SetValue(aText);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::MakeSelection(PRInt32 aStartPos, PRInt32 aEndPos, nsIEditor **aEditor)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AccTakeFocus();
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsCOMPtr<nsITextControlFrame> tframe(do_QueryInterface(frame));
|
||||
if (!tframe)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
tframe->SetSelectionRange(aStartPos, aEndPos);
|
||||
tframe->GetEditor(getter_AddRefs(editor));
|
||||
if (!editor)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aEditor = editor;
|
||||
NS_ADDREF(*aEditor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::InsertText(const nsAString &aText, PRInt32 aPosition)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aPosition, aPosition, getter_AddRefs(editor)))) {
|
||||
nsCOMPtr<nsIPlaintextEditor> peditor(do_QueryInterface(editor));
|
||||
peditor->InsertText(aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
|
||||
editor->Copy();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
|
||||
editor->Cut();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
|
||||
editor->DeleteSelection(nsIEditor::eNone);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::PasteText(PRInt32 aPosition)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aPosition, aPosition, getter_AddRefs(editor)))) {
|
||||
editor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// --- groupbox -----
|
||||
|
||||
/*
|
||||
* The HTML for this is <fieldset> <legend>box-title</legend> form elements </fieldset>
|
||||
*/
|
||||
|
||||
nsHTMLGroupboxAccessible::nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_GROUPING;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Groupbox doesn't support any states!
|
||||
*_retval = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNodeList> legends;
|
||||
element->GetElementsByTagName(NS_LITERAL_STRING("legend"), getter_AddRefs(legends));
|
||||
if (legends) {
|
||||
nsCOMPtr<nsIDOMNode> legendNode;
|
||||
legends->Item(0, getter_AddRefs(legendNode));
|
||||
nsCOMPtr<nsIContent> legendContent(do_QueryInterface(legendNode));
|
||||
if (legendContent) {
|
||||
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
return AppendFlatStringFromSubtree(legendContent, &_retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,125 +1,105 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLFormControlAccessible_H_
|
||||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
#include "nsTextAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsFormControlAccessible
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHODIMP AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel);
|
||||
};
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsFormControlAccessible
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTML4ButtonAccessible : public nsLeafAccessible
|
||||
class nsHTML4ButtonAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsIEditor;
|
||||
|
||||
class nsHTMLTextFieldAccessible : public nsFormControlAccessible,
|
||||
public nsIAccessibleEditableText,
|
||||
public nsAccessibleText
|
||||
class nsHTMLTextFieldAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD MakeSelection(PRInt32 aStartPos, PRInt32 aEndPos, nsIEditor **aEditor);
|
||||
};
|
||||
|
||||
class nsHTMLGroupboxAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,70 +1,82 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLIFrameRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHTMLIFrameRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsRootAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLIFrameAccessible, nsBlockAccessible, nsIAccessibleDocument, nsIAccessibleHyperText)
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameAccessible::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!");
|
||||
if ( !aInstancePtr )
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleDocument))) {
|
||||
*aInstancePtr = (void*)(nsIAccessibleDocument*) this;
|
||||
NS_IF_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsHTMLBlockAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLIFrameAccessible::nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *aDoc):
|
||||
nsBlockAccessible(aNode, aShell), nsDocAccessibleMixin(aDoc), mRootAccessible(aRoot)
|
||||
nsHTMLBlockAccessible(aNode, aShell), mRootAccessible(aRoot), nsDocAccessibleMixin(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAString& aAccName)
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAWritableString& aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAString& aAccValue)
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAWritableString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
@@ -96,30 +108,30 @@ NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval)
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
return nsAccessible::GetAccState(aAccState);
|
||||
return nsDocAccessibleMixin::GetAccState(aAccState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetURL(nsAString& aURL)
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetTitle(nsAString& aTitle)
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetMimeType(nsAString& aMimeType)
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocType(nsAString& aDocType)
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAString& aNameSpaceURI)
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
@@ -129,200 +141,6 @@ NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocument(nsIDocument **doc)
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetCaretAccessible(nsIAccessibleCaret **aCaretAccessible)
|
||||
{
|
||||
// Caret only owned by top level window's document
|
||||
*aCaretAccessible = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ------- nsIAccessibleHyperText ---------------
|
||||
/* readonly attribute long links; */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetLinks(PRInt32 *aLinks)
|
||||
{
|
||||
*aLinks = GetLinksFromAccNode(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessibleHyperLink getLink (in long index); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetLink(PRInt32 aIndex,
|
||||
nsIAccessibleHyperLink **_retval)
|
||||
{
|
||||
return GetLinkFromAccNode(aIndex, this, _retval);
|
||||
}
|
||||
|
||||
/* long getLinkIndex (in long charIndex); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetLinkIndex(PRInt32 aCharIndex,
|
||||
PRInt32 *_retval)
|
||||
{
|
||||
return GetLinkIndexFromAccNode(this, aCharIndex, _retval);
|
||||
}
|
||||
|
||||
//helper function for nsIAccessibleHyperText
|
||||
PRBool nsHTMLIFrameAccessible::IsHyperLink(nsIAccessible *aAccNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibleHyperLink> hyperlink(do_QueryInterface(aAccNode));
|
||||
return hyperlink? PR_TRUE: PR_FALSE;
|
||||
}
|
||||
|
||||
PRInt32 nsHTMLIFrameAccessible::GetLinksFromAccNode(nsIAccessible *aAccNode)
|
||||
{
|
||||
PRInt32 rv = IsHyperLink(aAccNode) ? 1 : 0;
|
||||
|
||||
// Here, all the links of accChild should be summed up
|
||||
nsCOMPtr<nsIAccessible> childa;
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
|
||||
aAccNode->GetAccFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
rv += GetLinksFromAccNode(child);
|
||||
child->GetAccNextSibling(getter_AddRefs(childa));
|
||||
child = childa;
|
||||
}
|
||||
//end for summing up accChildren's links
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsHTMLIFrameAccessible::GetLinkFromAccNode(PRInt32 aIndex,
|
||||
nsIAccessible *aAccNode,
|
||||
nsIAccessibleHyperLink **_retval)
|
||||
{
|
||||
PRInt32 links;
|
||||
|
||||
//firstly, to see whether beginning node is a hyperlink
|
||||
links = 0;
|
||||
if (aIndex < 0) {
|
||||
//of course, the aIndex is not right.
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
if (IsHyperLink(aAccNode)) {
|
||||
links = 1;
|
||||
if (0 == aIndex) {
|
||||
return CallQueryInterface(aAccNode, _retval);
|
||||
}
|
||||
}
|
||||
|
||||
//navigate all accChildren to getLink for the aIndex
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> childa;
|
||||
|
||||
aIndex = aIndex - links;
|
||||
aAccNode->GetAccFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
links = GetLinksFromAccNode(child);
|
||||
if (aIndex < links) {
|
||||
return GetLinkFromAccNode(aIndex, child, _retval);
|
||||
}
|
||||
aIndex -= links;
|
||||
child->GetAccNextSibling(getter_AddRefs(childa));
|
||||
child = childa;
|
||||
}
|
||||
//end of navigate accChild
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
PRInt32 nsHTMLIFrameAccessible::GetAccNodeCharLength(nsIAccessible *aAccNode)
|
||||
{
|
||||
PRUint32 role;
|
||||
PRInt32 childCharLength;
|
||||
nsAutoString tempAccName;
|
||||
|
||||
PRInt32 rv = 0;
|
||||
role = ROLE_NOTHING;
|
||||
aAccNode->GetAccRole(&role);
|
||||
|
||||
//ROLE_TEXT
|
||||
if (ROLE_TEXT == role) {
|
||||
aAccNode->GetAccName(tempAccName);
|
||||
rv = tempAccName.Length();
|
||||
}
|
||||
|
||||
//sum up the number all accChildren's characters
|
||||
nsCOMPtr<nsIAccessible> childa;
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
|
||||
aAccNode->GetAccFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
childCharLength = GetAccNodeCharLength(child);
|
||||
rv += childCharLength;
|
||||
child->GetAccNextSibling(getter_AddRefs(childa));
|
||||
child = childa;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// *_retval is zero-based index, so -1 for no index.
|
||||
// be careful, charIndex is zero-index, but length is not.
|
||||
nsresult nsHTMLIFrameAccessible::GetLinkIndexFromAccNode(nsIAccessible *aAccNode,
|
||||
PRInt32 aCharIndex,
|
||||
PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 role;
|
||||
nsAutoString tempAccName;
|
||||
PRInt32 charLength;
|
||||
PRInt32 links;
|
||||
|
||||
*_retval = -1;
|
||||
links = 0;
|
||||
charLength = 0;
|
||||
role = ROLE_NOTHING;
|
||||
aAccNode->GetAccRole(&role);
|
||||
|
||||
// if the beginning node is hyperlink
|
||||
if (IsHyperLink(aAccNode)) {
|
||||
charLength = GetAccNodeCharLength(aAccNode);
|
||||
if (aCharIndex < charLength) {
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
*_retval = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//begin to count char length
|
||||
if (ROLE_TEXT == role) {
|
||||
aAccNode->GetAccName(tempAccName);
|
||||
charLength = tempAccName.Length();
|
||||
if (aCharIndex < charLength) {
|
||||
*_retval = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
if (IsHyperLink(aAccNode)) {
|
||||
links = 1;
|
||||
}
|
||||
//exam the beginning node end
|
||||
|
||||
//getLinkIndex from accChildren
|
||||
nsCOMPtr<nsIAccessible> childa;
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
PRInt32 childCharLength;
|
||||
PRInt32 childLinks;
|
||||
|
||||
aAccNode->GetAccFirstChild(getter_AddRefs(child));
|
||||
while (child) {
|
||||
childCharLength = GetAccNodeCharLength(child);
|
||||
if (aCharIndex < charLength + childCharLength) {
|
||||
rv = GetLinkIndexFromAccNode(child, aCharIndex - charLength, _retval);
|
||||
*_retval += links;
|
||||
return rv;
|
||||
}
|
||||
charLength += childCharLength;
|
||||
childLinks = GetLinksFromAccNode(child);
|
||||
links += childLinks;
|
||||
child->GetAccNextSibling(getter_AddRefs(childa));
|
||||
child = childa;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
//=============================//
|
||||
// nsHTMLIFrameRootAccessible //
|
||||
//=============================//
|
||||
@@ -332,8 +150,9 @@ nsresult nsHTMLIFrameAccessible::GetLinkIndexFromAccNode(nsIAccessible *aAccNode
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRootAccessible(aShell), mOuterNode(aNode)
|
||||
nsRootAccessible(aShell)
|
||||
{
|
||||
mRealDOMNode = aNode;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
@@ -343,53 +162,113 @@ nsHTMLIFrameRootAccessible::~nsHTMLIFrameRootAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
void nsHTMLIFrameRootAccessible::Init()
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mOuterNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> parentShell;
|
||||
doc->GetShellAt(0, getter_AddRefs(parentShell));
|
||||
if (parentShell) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mOuterNode));
|
||||
nsIFrame* frame = nsnull;
|
||||
parentShell->GetPrimaryFrameFor(content, &frame);
|
||||
NS_ASSERTION(frame, "No outer frame.");
|
||||
if (!frame)
|
||||
return;
|
||||
frame->GetAccessible(getter_AddRefs(mOuterAccessible));
|
||||
NS_ASSERTION(mOuterAccessible, "Something's wrong - there's no accessible for the outer parent of this frame.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsHTMLIFrameRootAccessible::Init(nsIAccessible *aOuterAccessible)
|
||||
{
|
||||
if (aOuterAccessible) {
|
||||
mOuterAccessible = aOuterAccessible;
|
||||
}
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccParent(nsIAccessible * *_retval)
|
||||
{
|
||||
if (!mOuterAccessible)
|
||||
Init();
|
||||
return mOuterAccessible->GetAccParent(_retval);
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccParent(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
if (!mOuterAccessible)
|
||||
Init();
|
||||
return mOuterAccessible->GetAccNextSibling(_retval);
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccNextSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
if (!mOuterAccessible)
|
||||
Init();
|
||||
return mOuterAccessible->GetAccPreviousSibling(_retval);
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccPreviousSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetHTMLIFrameAccessible(nsIAccessible** aAcc)
|
||||
{
|
||||
// Start by finding our PresShell and from that
|
||||
// we get our nsIDocShell in order to walk the DocShell tree
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
|
||||
if (!presShell) {
|
||||
*aAcc = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
if (NS_SUCCEEDED(GetDocShellFromPS(presShell, getter_AddRefs(docShell)))) {
|
||||
// Now that we have the DocShell QI
|
||||
// it to a tree item to find it's parent
|
||||
nsCOMPtr<nsIDocShellTreeItem> item(do_QueryInterface(docShell));
|
||||
if (item) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> itemParent;
|
||||
item->GetParent(getter_AddRefs(itemParent));
|
||||
// QI to get the WebShell for the parent document
|
||||
nsCOMPtr<nsIDocShell> parentDocShell(do_QueryInterface(itemParent));
|
||||
if (parentDocShell) {
|
||||
// Get the PresShell/Content and
|
||||
// Root Content Node of the parent document
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
nsCOMPtr<nsIPresContext> parentPresContext;
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
if (NS_SUCCEEDED(GetDocShellObjects(parentDocShell,
|
||||
getter_AddRefs(parentPresShell),
|
||||
getter_AddRefs(parentPresContext),
|
||||
getter_AddRefs(rootContent)))) {
|
||||
// QI the DocShell (of this sub-doc) to a webshell
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
|
||||
if (webShell && parentPresShell && parentPresContext && rootContent) {
|
||||
// Now, find the Content in the parent document
|
||||
// that represents this sub-doc,
|
||||
// we do that matching webshells
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (FindContentForWebShell(parentPresShell,
|
||||
rootContent,
|
||||
webShell,
|
||||
getter_AddRefs(content))) {
|
||||
// OK, we found the content node in the parent doc
|
||||
// that corresponds to this sub-doc
|
||||
// Get the frame for that content
|
||||
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(parentPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
parentPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
#ifdef NS_DEBUG_X
|
||||
printf("** Found: Con:%p Fr:%p", content, frame);
|
||||
char * name;
|
||||
if (GetNameForFrame(frame, &name)) {
|
||||
printf(" Name:[%s]", name);
|
||||
nsMemory::Free(name);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(frame));
|
||||
|
||||
*aAcc = acc;
|
||||
NS_IF_ADDREF(*aAcc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,61 +1,41 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsIFrameRootAccessible_H_
|
||||
#define _nsIFrameRootAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessibleHyperText.h"
|
||||
|
||||
class nsIWebShell;
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsHTMLIFrameAccessible : public nsBlockAccessible,
|
||||
class nsHTMLIFrameAccessible : public nsHTMLBlockAccessible,
|
||||
public nsIAccessibleDocument,
|
||||
public nsIAccessibleHyperText,
|
||||
public nsDocAccessibleMixin
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
NS_DECL_NSIACCESSIBLEHYPERTEXT
|
||||
|
||||
public:
|
||||
nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *doc);
|
||||
@@ -63,23 +43,13 @@ class nsHTMLIFrameAccessible : public nsBlockAccessible,
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAString& AccValue);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& AccValue);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIAccessible> mRootAccessible;
|
||||
|
||||
//helper function for nsIAccessibleHyperText
|
||||
PRBool IsHyperLink(nsIAccessible *aAccNode);
|
||||
PRInt32 GetLinksFromAccNode(nsIAccessible *aAccNode);
|
||||
nsresult GetLinkFromAccNode(PRInt32 aIndex, nsIAccessible *aAccNode,
|
||||
nsIAccessibleHyperLink **_retval);
|
||||
PRInt32 GetAccNodeCharLength(nsIAccessible *aAccNode);
|
||||
nsresult GetLinkIndexFromAccNode(nsIAccessible *aAccNode,
|
||||
PRInt32 aCharIndex, PRInt32 *_retval);
|
||||
|
||||
};
|
||||
|
||||
class nsHTMLIFrameRootAccessible : public nsRootAccessible
|
||||
@@ -100,17 +70,8 @@ class nsHTMLIFrameRootAccessible : public nsRootAccessible
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
public:
|
||||
void Init(nsIAccessible *aOuterAccessible);
|
||||
|
||||
// In these variable names, "outer" relates to the nsHTMLIFrameAccessible, as opposed to the
|
||||
// nsHTMLIFrameRootAccessible which is "inner".
|
||||
// The outer node is a <browser> or <iframe> tag, whereas the inner node corresponds to the inner document root.
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mOuterNode;
|
||||
nsCOMPtr<nsIAccessible> mOuterAccessible;
|
||||
NS_IMETHOD GetHTMLIFrameAccessible(nsIAccessible** aAcc);
|
||||
nsCOMPtr<nsIDOMNode> mRealDOMNode;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +1,25 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
@@ -49,18 +33,16 @@
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
// --- image -----
|
||||
|
||||
nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIImageFrame *aImageFrame, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return;
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
nsAutoString mapElementName;
|
||||
@@ -111,7 +93,7 @@ NS_IMETHODIMP nsHTMLImageAccessible::GetAccState(PRUint32 *_retval)
|
||||
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccName(nsAString& _retval)
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
@@ -120,7 +102,7 @@ NS_IMETHODIMP nsHTMLImageAccessible::GetAccName(nsAString& _retval)
|
||||
nsAutoString name;
|
||||
rv = AppendFlatStringFromContentNode(imageContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAString
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
@@ -149,13 +131,13 @@ nsIAccessible *nsHTMLImageAccessible::CreateAreaAccessible(PRUint32 areaNum)
|
||||
areaNum = NS_STATIC_CAST(PRUint32,numAreaMaps-1);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> mapAreas;
|
||||
mMapElement->GetAreas(getter_AddRefs(mapAreas));
|
||||
nsIDOMHTMLCollection *mapAreas;
|
||||
mMapElement->GetAreas(&mapAreas);
|
||||
if (!mapAreas)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mapAreas->Item(areaNum,getter_AddRefs(domNode));
|
||||
nsIDOMNode *domNode = nsnull;
|
||||
mapAreas->Item(areaNum,&domNode);
|
||||
if (!domNode)
|
||||
return nsnull;
|
||||
|
||||
@@ -204,73 +186,3 @@ NS_IMETHODIMP nsHTMLImageAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Image map hyperlink
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageMapAccessible, nsHTMLImageAccessible, nsIAccessibleHyperLink)
|
||||
|
||||
/* readonly attribute long anchors; */
|
||||
NS_IMETHODIMP nsHTMLImageMapAccessible::GetAnchors(PRInt32 *aAnchors)
|
||||
{
|
||||
return GetAccChildCount(aAnchors);
|
||||
}
|
||||
|
||||
/* readonly attribute long startIndex; */
|
||||
NS_IMETHODIMP nsHTMLImageMapAccessible::GetStartIndex(PRInt32 *aStartIndex)
|
||||
{
|
||||
//should not be supported in image map hyperlink
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute long endIndex; */
|
||||
NS_IMETHODIMP nsHTMLImageMapAccessible::GetEndIndex(PRInt32 *aEndIndex)
|
||||
{
|
||||
//should not be supported in image map hyperlink
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIURI getURI (in long i); */
|
||||
NS_IMETHODIMP nsHTMLImageMapAccessible::GetURI(PRInt32 aIndex, nsIURI **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> mapAreas;
|
||||
mMapElement->GetAreas(getter_AddRefs(mapAreas));
|
||||
if (!mapAreas)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mapAreas->Item(aIndex,getter_AddRefs(domNode));
|
||||
if (!domNode)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc)))) {
|
||||
nsCOMPtr<nsIURI> baseURI;
|
||||
if (NS_SUCCEEDED(doc->GetBaseURL(*getter_AddRefs(baseURI)))) {
|
||||
nsCOMPtr<nsIDOMElement> area(do_QueryInterface(domNode));
|
||||
nsAutoString hrefValue;
|
||||
if (NS_SUCCEEDED(area->GetAttribute(NS_LITERAL_STRING("href"), hrefValue))) {
|
||||
return NS_NewURI(_retval, hrefValue, nsnull, baseURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* nsIAccessible getObject (in long i); */
|
||||
NS_IMETHODIMP nsHTMLImageMapAccessible::GetObject(PRInt32 aIndex,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = CreateAreaAccessible(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* boolean isValid (); */
|
||||
NS_IMETHODIMP nsHTMLImageMapAccessible::IsValid(PRBool *_retval)
|
||||
{
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,48 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLImageAccessible_H_
|
||||
#define _nsHTMLImageAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIAccessibleHyperLink.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
@@ -56,8 +38,8 @@ class nsHTMLImageAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIImageFrame *imageFrame, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
@@ -69,19 +51,4 @@ protected:
|
||||
nsCOMPtr<nsIDOMHTMLMapElement> mMapElement;
|
||||
};
|
||||
|
||||
/* Accessible for support images with "use=#map".
|
||||
* only this kind of images will support nsIAccessibleHyperLink
|
||||
*/
|
||||
class nsHTMLImageMapAccessible : public nsHTMLImageAccessible,
|
||||
public nsIAccessibleHyperLink
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEHYPERLINK
|
||||
|
||||
public:
|
||||
nsHTMLImageMapAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell)
|
||||
: nsHTMLImageAccessible(aDomNode, aShell)
|
||||
{
|
||||
}//constructor end
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,41 +1,25 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
@@ -45,20 +29,16 @@
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsLinkableAccessible, nsIAccessibleHyperLink)
|
||||
|
||||
nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAString& _retval)
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
if (!IsALink()) // Also initializes private data members
|
||||
return NS_ERROR_FAILURE;
|
||||
@@ -66,7 +46,7 @@ NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAString& _retval)
|
||||
nsAutoString name;
|
||||
nsresult rv = AppendFlatStringFromSubtree(mLinkContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAString
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
@@ -81,63 +61,3 @@ NS_IMETHODIMP nsHTMLLinkAccessible::GetAccRole(PRUint32 *_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute long anchors; */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAnchors(PRInt32 *aAnchors)
|
||||
{
|
||||
if (!IsALink())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aAnchors = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute long startIndex; */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetStartIndex(PRInt32 *aStartIndex)
|
||||
{
|
||||
//not see the value to implement this attributes
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute long endIndex; */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetEndIndex(PRInt32 *aEndIndex)
|
||||
{
|
||||
//not see the value to implement this attributes
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIURI getURI (in long i); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetURI(PRInt32 i, nsIURI **_retval)
|
||||
{
|
||||
//I do not know why we have to retrun a nsIURI instead of
|
||||
//nsILink or just a string of url. Anyway, maybe nsIURI is
|
||||
//more powerful for the future.
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(mLinkContent));
|
||||
if (link) {
|
||||
nsXPIDLCString hrefValue;
|
||||
if (NS_SUCCEEDED(link->GetHrefCString(*getter_Copies(hrefValue)))) {
|
||||
return NS_NewURI(_retval, hrefValue, nsnull, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* nsIAccessible getObject (in long i); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetObject(PRInt32 aIndex,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
if (0 != aIndex)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return QueryInterface(NS_GET_IID(nsIAccessible), (void **)_retval);
|
||||
}
|
||||
|
||||
/* boolean isValid (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::IsValid(PRBool *_retval)
|
||||
{
|
||||
// I have not found the cause which makes this attribute false.
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,37 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLLinkAccessible_H_
|
||||
#define _nsHTMLLinkAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIAccessibleHyperLink.h"
|
||||
|
||||
class nsHTMLLinkAccessible : public nsLinkableAccessible,
|
||||
public nsIAccessibleHyperLink
|
||||
class nsHTMLLinkAccessible : public nsLinkableAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEHYPERLINK
|
||||
|
||||
public:
|
||||
nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLPluginAccessible.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
|
||||
nsHTMLPluginAccessible::nsHTMLPluginAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLPluginAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsObjectFrame* objectFrame = NS_STATIC_CAST(nsObjectFrame*, frame);
|
||||
#ifdef XP_WIN
|
||||
HWND pluginPort = nsnull;
|
||||
objectFrame->GetPluginPort(&pluginPort);
|
||||
if (pluginPort) {
|
||||
if (mAccService)
|
||||
mAccService->CreateHTMLNativeWindowAccessible(mDOMNode, mPresShell, (PRInt32)pluginPort, _retval);
|
||||
}
|
||||
#else
|
||||
*_retval = nsnull;
|
||||
#endif
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLPluginAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return GetAccFirstChild(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLPluginAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLPluginAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
/**
|
||||
* This class is used to wrap the window for the plugin. It's only child
|
||||
* is a shim class that will allow the platform specific layer of our
|
||||
* accessibility support to get the IAccessible from the plugin itself
|
||||
* (via the windows call to get he accessible by window).
|
||||
*/
|
||||
class nsHTMLPluginAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLPluginAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,275 +1,72 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s): Kyle Yuan (kyle.yuan@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLSelectAccessible_h__
|
||||
#define __nsHTMLSelectAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsSelectAccessible.h"
|
||||
|
||||
/**
|
||||
* Selects, Listboxes and Comboboxes, are made up of a number of different
|
||||
* widgets, some of which are shared between the two. This file contains * all of the widgets for both of the Selects, for HTML only. Some of them
|
||||
* extend classes from nsSelectAccessible.cpp, which contains base classes
|
||||
* that are also extended by the XUL Select Accessibility support.
|
||||
*
|
||||
* Listbox:
|
||||
* - nsHTMLListboxAccessible
|
||||
* - nsHTMLSelectListAccessible
|
||||
* - nsHTMLSelectOptionAccessible
|
||||
*
|
||||
* Comboboxes:
|
||||
* - nsHTMLComboboxAccessible
|
||||
* - nsHTMLComboboxTextFieldAccessible
|
||||
* - nsHTMLComboboxButtonAccessible
|
||||
* - nsHTMLComboboxWindowAccessible
|
||||
* - nsHTMLSelectListAccessible
|
||||
* - nsHTMLSelectOptionAccessible(s)
|
||||
*/
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* The basic implemetation of nsIAccessibleSelectable.
|
||||
*/
|
||||
class nsHTMLSelectableAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
class nsHTMLSelectAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLSelectableAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectableAccessible() {}
|
||||
|
||||
protected:
|
||||
|
||||
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
|
||||
|
||||
class iterator
|
||||
{
|
||||
protected:
|
||||
PRUint32 mLength;
|
||||
PRUint32 mIndex;
|
||||
PRInt32 mSelCount;
|
||||
nsHTMLSelectableAccessible *mParent;
|
||||
nsCOMPtr<nsIDOMHTMLCollection> mOptions;
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> mOption;
|
||||
|
||||
public:
|
||||
iterator(nsHTMLSelectableAccessible *aParent);
|
||||
|
||||
void CalcSelectionCount(PRInt32 *aSelectionCount);
|
||||
void Select(PRBool aSelect);
|
||||
void AddAccessibleIfSelected(nsIAccessibilityService *aAccService, nsISupportsArray *aSelectedAccessibles, nsIPresContext *aContext);
|
||||
PRBool GetAccessibleIfSelected(PRInt32 aIndex, nsIAccessibilityService *aAccService, nsIPresContext *aContext, nsIAccessible **_retval);
|
||||
|
||||
PRBool Advance();
|
||||
};
|
||||
|
||||
friend class iterator;
|
||||
};
|
||||
|
||||
/*
|
||||
* The list that contains all the options in the select.
|
||||
*/
|
||||
class nsHTMLSelectListAccessible : public nsSelectListAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectListAccessible() {}
|
||||
nsHTMLSelectAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *aAccChildCount) ;
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrame( nsIFrame* aFrame, nsIAtom* aAtom );
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Options inside the select, contained within the list
|
||||
* Each option in the Select. These are in the nsListAccessible
|
||||
*/
|
||||
class nsHTMLSelectOptionAccessible : public nsSelectOptionAccessible
|
||||
class nsHTMLSelectOptionAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectOptionAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsCOMPtr<nsIDOMNode>& aFocusedOptionNode);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Opt Groups inside the select, contained within the list
|
||||
*/
|
||||
class nsHTMLSelectOptGroupAccessible : public nsHTMLSelectOptionAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptGroupAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectOptGroupAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Secondly, the Listbox widget */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Listbox widget.
|
||||
*/
|
||||
class nsHTMLListboxAccessible : public nsHTMLSelectableAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLListboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Combobox widget.
|
||||
*/
|
||||
class nsHTMLComboboxAccessible : public nsHTMLSelectableAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* A class the represents the text field in the Select to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsHTMLComboboxTextFieldAccessible : public nsComboboxTextFieldAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxTextFieldAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the
|
||||
* right of the text field
|
||||
*/
|
||||
class nsHTMLComboboxButtonAccessible : public nsComboboxButtonAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxButtonAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsHTMLComboboxWindowAccessible : public nsComboboxWindowAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxWindowAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,646 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsBlockAccessible(aDomNode, aShell)
|
||||
nsHTMLBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccRole(PRUint32 *aResult)
|
||||
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*aResult = ROLE_CELL;
|
||||
*_retval = ROLE_CELL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccState(PRUint32 *aResult)
|
||||
{
|
||||
nsAccessible::GetAccState(aResult);
|
||||
*aResult &= ~STATE_FOCUSABLE; // Inherit all states except focusable state since table cells cannot be focused
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLTableCaptionAccessible::nsHTMLTableCaptionAccessible
|
||||
(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableCaptionAccessible::GetAccState(PRUint32 *aResult)
|
||||
{
|
||||
nsAccessible::GetAccState(aResult);
|
||||
*aResult &= ~STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableCaptionAccessible::GetAccValue(nsAString& aResult)
|
||||
{
|
||||
aResult.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
|
||||
nsCOMPtr<nsIContent> captionContent(do_QueryInterface(mDOMNode));
|
||||
AppendFlatStringFromSubtree(captionContent, &aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableAccessible,
|
||||
nsBlockAccessible,
|
||||
nsIAccessible,
|
||||
nsIAccessibleTable)
|
||||
|
||||
nsHTMLTableAccessible::nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsBlockAccessible(aDomNode, aShell)
|
||||
nsHTMLBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccRole(PRUint32 *aResult)
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*aResult = ROLE_TABLE;
|
||||
*_retval = ROLE_TABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccState(PRUint32 *aResult)
|
||||
{
|
||||
nsAccessible::GetAccState(aResult);
|
||||
*aResult &= ~STATE_FOCUSABLE; // Inherit all states except focusable state since tables cannot be focused
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccName(nsAString& aResult)
|
||||
{
|
||||
aResult.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNodeList> captions;
|
||||
element->GetElementsByTagName(NS_LITERAL_STRING("caption"), getter_AddRefs(captions));
|
||||
if (captions) {
|
||||
nsCOMPtr<nsIDOMNode> captionNode;
|
||||
captions->Item(0, getter_AddRefs(captionNode));
|
||||
if (captionNode) {
|
||||
nsCOMPtr<nsIContent> captionContent(do_QueryInterface(captionNode));
|
||||
AppendFlatStringFromSubtree(captionContent, &aResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* Implementation of nsIAccessibleTable */
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableCaptionElement> caption;
|
||||
rv = table->GetCaption(getter_AddRefs(caption));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> captionNode(do_QueryInterface(caption));
|
||||
NS_ENSURE_TRUE(captionNode, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService>
|
||||
accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
return accService->CreateHTMLTableCaptionAccessible(captionNode, aCaption);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::SetCaption(nsIAccessible *aCaption)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
rv = aCaption->AccGetDOMNode(getter_AddRefs(domNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> newDOMNode;
|
||||
rv = domNode->CloneNode(PR_TRUE, getter_AddRefs(newDOMNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableCaptionElement>
|
||||
captionElement(do_QueryInterface(newDOMNode));
|
||||
NS_ENSURE_TRUE(captionElement, NS_ERROR_FAILURE);
|
||||
|
||||
return table->SetCaption(captionElement);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetSummary(nsAString &aSummary)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
|
||||
|
||||
return table->GetSummary(aSummary);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::SetSummary(const nsAString &aSummary)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
|
||||
|
||||
return table->SetSummary(aSummary);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetColumns(PRInt32 *aColumns)
|
||||
{
|
||||
nsITableLayout *tableLayout = nsnull;
|
||||
nsresult rv = GetTableLayout(&tableLayout);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 rows;
|
||||
return tableLayout->GetTableSize(rows, *aColumns);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableSectionElement> section;
|
||||
rv = table->GetTHead(getter_AddRefs(section));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService>
|
||||
accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accHead;
|
||||
rv = accService->CreateHTMLTableHeadAccessible(section,
|
||||
getter_AddRefs(accHead));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessibleTable> accTableHead(do_QueryInterface(accHead));
|
||||
NS_ENSURE_TRUE(accTableHead, NS_ERROR_FAILURE);
|
||||
|
||||
*aColumnHeader = accTableHead;
|
||||
NS_IF_ADDREF(*aColumnHeader);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetRows(PRInt32 *aRows)
|
||||
{
|
||||
nsITableLayout *tableLayout = nsnull;
|
||||
nsresult rv = GetTableLayout(&tableLayout);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 columns;
|
||||
return tableLayout->GetTableSize(*aRows, columns);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetRowHeader(nsIAccessibleTable **aRowHeader)
|
||||
{
|
||||
// Can not implement because there is no row header in html table
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetSelectedColumns(PRUint32 *aNumColumns,
|
||||
PRInt32 **aColumns)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 columnCount;
|
||||
rv = GetColumns(&columnCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool *states = new PRBool[columnCount];
|
||||
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*aNumColumns = 0;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < columnCount; index++) {
|
||||
rv = IsColumnSelected(index, &states[index]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (states[index]) {
|
||||
(*aNumColumns)++;
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
|
||||
if (!outArray) {
|
||||
delete []states;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
PRInt32 curr = 0;
|
||||
for (index = 0; index < columnCount; index++) {
|
||||
if (states[index]) {
|
||||
outArray[curr++] = index;
|
||||
}
|
||||
}
|
||||
|
||||
delete []states;
|
||||
*aColumns = outArray;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetSelectedRows(PRUint32 *aNumRows, PRInt32 **aRows)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 rowCount;
|
||||
rv = GetRows(&rowCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool *states = new PRBool[rowCount];
|
||||
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*aNumRows = 0;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < rowCount; index++) {
|
||||
rv = IsRowSelected(index, &states[index]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (states[index]) {
|
||||
(*aNumRows)++;
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
|
||||
if (!outArray) {
|
||||
delete []states;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
PRInt32 curr = 0;
|
||||
for (index = 0; index < rowCount; index++) {
|
||||
if (states[index]) {
|
||||
outArray[curr++] = index;
|
||||
}
|
||||
}
|
||||
|
||||
delete []states;
|
||||
*aRows = outArray;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
rv = GetCellAt(aRow, aColumn, *getter_AddRefs(cellElement));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService>
|
||||
accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
return accService->GetAccessibleFor(cellElement, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetIndexAt(PRInt32 aRow, PRInt32 aColumn,
|
||||
PRInt32 *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 columns;
|
||||
rv = GetColumns(&columns);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*_retval = aRow * columns + aColumn;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 columns;
|
||||
rv = GetColumns(&columns);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*_retval = aIndex % columns;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 columns;
|
||||
rv = GetColumns(&columns);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*_retval = aIndex / columns;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn,
|
||||
PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
rv = GetCellAt(aRow, aColumn, *getter_AddRefs(domElement));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableCellElement> cell(do_QueryInterface(domElement));
|
||||
NS_ENSURE_TRUE(cell, NS_ERROR_FAILURE);
|
||||
|
||||
return cell->GetColSpan(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn,
|
||||
PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
rv = GetCellAt(aRow, aColumn, *getter_AddRefs(domElement));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableCellElement> cell(do_QueryInterface(domElement));
|
||||
NS_ENSURE_TRUE(cell, NS_ERROR_FAILURE);
|
||||
|
||||
return cell->GetRowSpan(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetColumnDescription(PRInt32 aColumn, nsAString &_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::GetRowDescription(PRInt32 aRow, nsAString &_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 rows;
|
||||
rv = GetRows(&rows);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRInt32 index = 0; index < rows; index++) {
|
||||
rv = IsCellSelected(index, aColumn, _retval);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!*_retval) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, PRBool *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 columns;
|
||||
rv = GetColumns(&columns);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRInt32 index = 0; index < columns; index++) {
|
||||
rv = IsCellSelected(aRow, index, _retval);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!*_retval) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
|
||||
PRBool *_retval)
|
||||
{
|
||||
nsITableLayout *tableLayout = nsnull;
|
||||
nsresult rv = GetTableLayout(&tableLayout);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
|
||||
return tableLayout->GetCellDataAt(aRow, aColumn,
|
||||
*getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan,
|
||||
colSpan, actualRowSpan, actualColSpan,
|
||||
*_retval);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLTableAccessible::GetTableNode(nsIDOMNode **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
|
||||
if (table) {
|
||||
*_retval = table;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableSectionElement> section(do_QueryInterface(mDOMNode));
|
||||
if (section) {
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = section->GetParentNode(getter_AddRefs(parent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*_retval = parent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLTableAccessible::GetTableLayout(nsITableLayout **aLayoutObject)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> tableNode;
|
||||
rv = GetTableNode(getter_AddRefs(tableNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(tableNode));
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
rv = content->GetDocument(*getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
rv = document->GetShellAt(0, getter_AddRefs(presShell));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsISupports *layoutObject = nsnull;
|
||||
rv = presShell->GetLayoutObjectFor(content, &layoutObject);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aLayoutObject = nsnull;
|
||||
return layoutObject->QueryInterface(NS_GET_IID(nsITableLayout),
|
||||
(void **)aLayoutObject);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLTableAccessible::GetCellAt(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
nsIDOMElement* &aCell)
|
||||
{
|
||||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
|
||||
nsITableLayout *tableLayout = nsnull;
|
||||
nsresult rv = GetTableLayout(&tableLayout);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return tableLayout->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
startRowIndex, startColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan,
|
||||
isSelected);
|
||||
}
|
||||
|
||||
//Class nsHTMLTableHeadAccessible
|
||||
nsHTMLTableHeadAccessible::nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode,
|
||||
nsIWeakReference *aShell):
|
||||
nsHTMLTableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableHeadAccessible::GetAccRole(PRUint32 *aResult)
|
||||
{
|
||||
*aResult = ROLE_COLUMNHEADER;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableHeadAccessible::GetCaption(nsIAccessible **aCaption)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableHeadAccessible::SetCaption(nsIAccessible *aCaption)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableHeadAccessible::GetSummary(nsAString &aSummary)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableHeadAccessible::SetSummary(const nsAString &aSummary)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableHeadAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableHeadAccessible::GetRows(PRInt32 *aRows)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTableSectionElement> head(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(head, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> rows;
|
||||
rv = head->GetRows(getter_AddRefs(rows));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return rows->GetLength((PRUint32 *)aRows);
|
||||
}
|
||||
|
||||
/* End of Implementation of nsIAccessibleTable */
|
||||
|
||||
@@ -1,114 +1,44 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTableAccessible_H_
|
||||
#define _nsHTMLTableAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIAccessibleTable.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLTableElement.h"
|
||||
#include "nsIDOMHTMLTableCaptionElem.h"
|
||||
#include "nsIDOMHTMLTableRowElement.h"
|
||||
#include "nsIDOMHTMLTableCellElement.h"
|
||||
#include "nsIDOMHTMLTableSectionElem.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsITableLayout.h"
|
||||
|
||||
class nsHTMLTableCellAccessible : public nsBlockAccessible
|
||||
class nsHTMLTableCellAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLTableCaptionAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableCaptionAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccValue(nsAString& aResult);
|
||||
};
|
||||
|
||||
class nsHTMLTableAccessible : public nsBlockAccessible,
|
||||
public nsIAccessibleTable
|
||||
class nsHTMLTableAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
|
||||
/* nsIAccessible */
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccName(nsAString& aResult);
|
||||
|
||||
/* nsIAccessibleTable */
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLETABLE
|
||||
|
||||
protected:
|
||||
|
||||
nsresult GetTableNode(nsIDOMNode **_retval);
|
||||
nsresult GetTableLayout(nsITableLayout **aLayoutObject);
|
||||
nsresult GetCellAt(PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex,
|
||||
nsIDOMElement* &aCell);
|
||||
};
|
||||
|
||||
class nsHTMLTableHeadAccessible : public nsHTMLTableAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell);
|
||||
|
||||
/* nsIAccessible */
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aResult);
|
||||
|
||||
/* nsIAccessibleTable */
|
||||
NS_IMETHOD GetCaption(nsIAccessible **aCaption);
|
||||
NS_IMETHOD SetCaption(nsIAccessible *aCaption);
|
||||
NS_IMETHOD GetSummary(nsAString &aSummary);
|
||||
NS_IMETHOD SetSummary(const nsAString &aSummary);
|
||||
NS_IMETHOD GetColumnHeader(nsIAccessibleTable **aColumnHeader);
|
||||
NS_IMETHOD GetRows(PRInt32 *aRows);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,51 +1,74 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsString.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsTextAccessible(aDomNode, aShell)
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(nsAString& _retval)
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
|
||||
return mDOMNode->GetNodeValue(_retval);
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,54 +1,43 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- 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/
|
||||
* 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.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* 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):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTextAccessible_H_
|
||||
#define _nsHTMLTextAccessible_H_
|
||||
|
||||
#include "nsTextAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
class nsITextControlFrame;
|
||||
|
||||
class nsHTMLTextAccessible : public nsTextAccessible
|
||||
class nsHTMLTextAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com) (original author)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLWin32ObjectAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
nsHTMLWin32ObjectAccessible::nsHTMLWin32ObjectAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRInt32 aHwnd):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
if (aHwnd) {
|
||||
// XXX - when we get accessible plugins we may have to check here
|
||||
// for the proper window handle using Win32 APIs so we check
|
||||
// the proper IAccessible for the information we need.
|
||||
mHwnd = aHwnd;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLWin32ObjectAccessible, nsAccessible, nsIAccessibleWin32Object)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLWin32ObjectAccessible::GetHwnd(PRInt32 *aHwnd) {
|
||||
*aHwnd = mHwnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com) (original author)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsHTMLWin32ObjectAccessible_H_
|
||||
#define _nsHTMLWin32ObjectAccessible_H_
|
||||
|
||||
#include "nsIAccessibleWin32Object.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
struct IAccessible;
|
||||
|
||||
/**
|
||||
* This class is used only internally, we never! send out an IAccessible linked
|
||||
* back to this object. This class is used to represent a plugin object when
|
||||
* referenced as a child or sibling of another nsAccessible node. We need only
|
||||
* a limited portion of the nsIAccessible interface implemented here. The
|
||||
* in depth accessible information will be returned by the actual IAccessible
|
||||
* object returned by us in Accessible::NewAccessible() that gets the IAccessible
|
||||
* from the windows system from the window handle.
|
||||
*/
|
||||
class nsHTMLWin32ObjectAccessible : public nsAccessible,
|
||||
public nsIAccessibleWin32Object
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLWin32ObjectAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRInt32 aHwnd);
|
||||
virtual ~nsHTMLWin32ObjectAccessible() {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// ---- nsIAccessibleWin32Object ----
|
||||
NS_IMETHOD GetHwnd(PRInt32 *aHwnd);
|
||||
|
||||
protected:
|
||||
// ---- Data Members ----
|
||||
/**
|
||||
* A handle to the native plugin window (hopefully), given to
|
||||
* Accessible::NewAccessible() so the actual IAccessible can be retrieved.
|
||||
*/
|
||||
PRInt32 mHwnd;
|
||||
};
|
||||
|
||||
#endif
|
||||
3
mozilla/accessible/src/jar.mn
Normal file
3
mozilla/accessible/src/jar.mn
Normal file
@@ -0,0 +1,3 @@
|
||||
en-US.jar:
|
||||
locale/en-US/global/accessible.properties
|
||||
|
||||
@@ -17,18 +17,48 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ..\..
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
LIBRARY_NAME=accessibility_s
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
|
||||
DIRS = \
|
||||
base \
|
||||
html \
|
||||
!ifdef MOZ_XUL
|
||||
xul \
|
||||
!endif
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessible.obj \
|
||||
.\$(OBJDIR)\nsRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLIFrameRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsAccessibilityService.obj \
|
||||
.\$(OBJDIR)\nsHTMLSelectListAccessible.obj \
|
||||
.\$(OBJDIR)\nsGenericAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTextAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLImageAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLAreaAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLLinkAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLComboboxAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLListboxAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
.\nsRootAccessible.h \
|
||||
$(NULL)
|
||||
|
||||
LINCS= \
|
||||
-I..\..\layout\html\forms\public \
|
||||
-I..\..\layout\html\forms\src \
|
||||
-I..\..\layout\html\base\src \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
685
mozilla/accessible/src/nsAccessibilityService.cpp
Normal file
685
mozilla/accessible/src/nsAccessibilityService.cpp
Normal file
@@ -0,0 +1,685 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsHTMLComboboxAccessible.h"
|
||||
#include "nsHTMLListboxAccessible.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
// IFrame
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsHTMLIFrameRootAccessible.h"
|
||||
|
||||
//--------------------
|
||||
|
||||
|
||||
nsAccessibilityService::nsAccessibilityService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsAccessibilityService::~nsAccessibilityService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAccessibilityService, nsIAccessibilityService);
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibilityService methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISupports* aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
// XXX - jgaunt - looks like we aren't using this
|
||||
//nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
NS_ASSERTION(presShell,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
|
||||
|
||||
*_retval = new nsRootAccessible(weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLComboboxAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLListboxAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(aAccParent, aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLCheckboxAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLRadioButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTML4ButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTML4ButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible createHTMLTableAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTableAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTableCellAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTableCellAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLImageAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsIImageFrame* imageFrame = nsnull;
|
||||
|
||||
// not using a nsCOMPtr frames don't support them.
|
||||
aFrame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
|
||||
|
||||
if (!imageFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = new nsHTMLImageAccessible(node, imageFrame, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLAreaAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLAreaAccessible(nsIWeakReference *aShell, nsIDOMNode *aDOMNode, nsIAccessible *aAccParent,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLAreaAccessible(aDOMNode, aAccParent, aShell);
|
||||
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextFieldAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextFieldAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
|
||||
{
|
||||
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
|
||||
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
(*aRealFrame)->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
*aNode = node;
|
||||
NS_IF_ADDREF(*aNode);
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
// do_GetWR only works into a |nsCOMPtr| :-(
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
weakShell = do_GetWeakReference(tempShell);
|
||||
NS_IF_ADDREF(*aShell = weakShell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
|
||||
|
||||
*_retval = new nsAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
|
||||
|
||||
*_retval = new nsAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
|
||||
NS_ASSERTION(content,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
NS_ASSERTION(presShell,"Error non PresShell passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(presShell);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
doc->GetShellAt(0, getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsISupports> supps;
|
||||
presShell->GetSubShellFor(content, getter_AddRefs(supps));
|
||||
if (supps) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
docShell->GetPresShell(getter_AddRefs(ps));
|
||||
if (ps) {
|
||||
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(ps);
|
||||
nsCOMPtr<nsIDocument> innerDoc;
|
||||
ps->GetDocument(getter_AddRefs(innerDoc));
|
||||
if (innerDoc) {
|
||||
nsCOMPtr<nsIAccessible> root = new nsHTMLIFrameRootAccessible(aDOMNode, wr);
|
||||
if ( root ) {
|
||||
nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(aDOMNode, root, weakRef, innerDoc);
|
||||
if ( frameAcc != nsnull ) {
|
||||
*_retval = NS_STATIC_CAST(nsIAccessible*, frameAcc);
|
||||
if ( *_retval ) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// This method finds the content node in the parent document
|
||||
// corresponds to the docshell
|
||||
// This code is copied and pasted from nsEventStateManager.cpp
|
||||
// Is also inefficient - better solution should come along as part of
|
||||
// Bug 85602: "FindContentForDocShell walks entire content tree"
|
||||
// Hopefully there will be a better method soon, with a public interface
|
||||
|
||||
nsIContent*
|
||||
nsAccessibilityService::FindContentForDocShell(nsIPresShell* aPresShell,
|
||||
nsIContent* aContent,
|
||||
nsIDocShell* aDocShell)
|
||||
{
|
||||
NS_ASSERTION(aPresShell, "Pointer is null!");
|
||||
NS_ASSERTION(aDocShell, "Pointer is null!");
|
||||
NS_ASSERTION(aContent, "Pointer is null!");
|
||||
|
||||
nsCOMPtr<nsISupports> supps;
|
||||
aPresShell->GetSubShellFor(aContent, getter_AddRefs(supps));
|
||||
if (supps) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
|
||||
if (docShell.get() == aDocShell)
|
||||
return aContent;
|
||||
}
|
||||
|
||||
// walk children content
|
||||
PRInt32 count;
|
||||
aContent->ChildCount(count);
|
||||
for (PRInt32 i=0;i<count;i++) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
aContent->ChildAt(i, *getter_AddRefs(child));
|
||||
nsIContent* foundContent = FindContentForDocShell(aPresShell, child, aDocShell);
|
||||
if (foundContent != nsnull) {
|
||||
return foundContent;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!presContext)
|
||||
return;
|
||||
nsCOMPtr<nsISupports> pcContainer;
|
||||
presContext->GetContainer(getter_AddRefs(pcContainer));
|
||||
if (!pcContainer)
|
||||
return;
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(pcContainer));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(docShell));
|
||||
if (!treeItem)
|
||||
return;
|
||||
|
||||
// Get Parent Doc
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItemParent;
|
||||
treeItem->GetParent(getter_AddRefs(treeItemParent));
|
||||
if (!treeItemParent)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(treeItemParent));
|
||||
if (!parentDS)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
parentDS->GetPresShell(getter_AddRefs(parentPresShell));
|
||||
if (!parentPresShell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> parentDoc;
|
||||
parentPresShell->GetDocument(getter_AddRefs(parentDoc));
|
||||
if (!parentDoc)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
parentDoc->GetRootContent(getter_AddRefs(rootContent));
|
||||
|
||||
nsIContent *tempContent;
|
||||
tempContent = FindContentForDocShell(parentPresShell, rootContent, docShell);
|
||||
if (tempContent) {
|
||||
*aOwnerContent = tempContent;
|
||||
*aOwnerShell = parentPresShell;
|
||||
NS_ADDREF(*aOwnerShell);
|
||||
NS_ADDREF(*aOwnerContent);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------
|
||||
* GetAccessibleFor - get an nsIAccessible from a DOM node
|
||||
* ------------------------------------------------------- */
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
if (!aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// ---- Get the document for this node ----
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIDocument> nodeIsDoc(do_QueryInterface(aNode));
|
||||
if (nodeIsDoc)
|
||||
doc = nodeIsDoc;
|
||||
else {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
doc = do_QueryInterface(domDoc);
|
||||
}
|
||||
if (!doc)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// ---- Get the pres shell ----
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// ---- Check if area node ----
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> areaContent(do_QueryInterface(aNode));
|
||||
if (areaContent) // Area elements are implemented in nsHTMLImageAccessible as children of the image
|
||||
return PR_FALSE; // Return, otherwise the image frame looks like an accessible object in the wrong place
|
||||
|
||||
// ---- Check if we need outer owning doc ----
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content && nodeIsDoc) {
|
||||
// This happens when we're on the document node, which will not QI to an nsIContent,
|
||||
// When that happens, we try to get the outer, parent document node that contains the document
|
||||
// For example, a <browser> or <iframe> element
|
||||
nsCOMPtr<nsIPresShell> ownerShell;
|
||||
nsCOMPtr<nsIContent> ownerContent;
|
||||
GetOwnerFor(shell, getter_AddRefs(ownerShell), getter_AddRefs(ownerContent));
|
||||
shell = ownerShell;
|
||||
content = ownerContent;
|
||||
}
|
||||
|
||||
// ---- If still no nsIContent, return ----
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
// ---- Try using frame to get IAccessible ----
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessible> newAcc;
|
||||
frame->GetAccessible(getter_AddRefs(newAcc));
|
||||
|
||||
// ---- Try QI'ing node to get nsIAccessible ----
|
||||
if (!newAcc)
|
||||
newAcc = do_QueryInterface(aNode);
|
||||
|
||||
// ---- If link, create link accessible ----
|
||||
if (!newAcc) {
|
||||
// is it a link?
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(aNode));
|
||||
if (link) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLLinkAccessible(aNode, weakShell);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- If <select> option, create select option accessible
|
||||
if (!newAcc) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(aNode));
|
||||
if (optionElement) {
|
||||
// nsHTMLSelectionOptionAccessible's must be created via the parent
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccessibleFor(parentNode, getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLSelectOptionAccessible(parentAccessible, aNode, weakShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!newAcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = newAcc;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAccessibilityService* accService = new nsAccessibilityService();
|
||||
if (!accService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(accService);
|
||||
*aResult = accService;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
59
mozilla/accessible/src/nsAccessibilityService.h
Normal file
59
mozilla/accessible/src/nsAccessibilityService.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsAccessibilityService_h__
|
||||
#define __nsAccessibilityService_h__
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIWeakReference;
|
||||
class nsIDOMNode;
|
||||
|
||||
class nsAccessibilityService : public nsIAccessibilityService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBILITYSERVICE
|
||||
|
||||
// nsAccessibilityService methods:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent);
|
||||
void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent);
|
||||
nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
1607
mozilla/accessible/src/nsAccessible.cpp
Normal file
1607
mozilla/accessible/src/nsAccessible.cpp
Normal file
File diff suppressed because it is too large
Load Diff
155
mozilla/accessible/src/nsAccessible.h
Normal file
155
mozilla/accessible/src/nsAccessible.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 _nsAccessible_H_
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsPoint.h"
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global/locale/accessible.properties"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIDocShell;
|
||||
class nsIWebShell;
|
||||
class nsIContent;
|
||||
|
||||
class nsAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFocused(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
// Helper Routines for Sub-Docs
|
||||
static nsresult GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
|
||||
static nsresult GetDocShellObjects(nsIDocShell* aDocShell,
|
||||
nsIPresShell** aPresShell,
|
||||
nsIPresContext** aPresContext,
|
||||
nsIContent** aContent);
|
||||
static nsresult GetDocShells(nsIPresShell* aPresShell,
|
||||
nsIDocShell** aDocShell,
|
||||
nsIDocShell** aParentDocShell);
|
||||
static nsresult GetParentPresShellAndContent(nsIPresShell* aPresShell,
|
||||
nsIPresShell** aParentPresShell,
|
||||
nsIContent** aSubShellContent);
|
||||
|
||||
static PRBool FindContentForWebShell(nsIPresShell* aParentPresShell,
|
||||
nsIContent* aParentContent,
|
||||
nsIWebShell* aWebShell,
|
||||
nsIContent** aFoundContent);
|
||||
nsresult CalcOffset(nsIFrame* aFrame,
|
||||
nsIPresContext * aPresContext,
|
||||
nsRect& aRect);
|
||||
nsresult GetAbsPosition(nsIPresShell* aPresShell, nsPoint& aPoint);
|
||||
nsresult GetAbsoluteFramePosition(nsIPresContext* aPresContext,
|
||||
nsIFrame *aFrame,
|
||||
nsRect& aAbsoluteTwipsRect,
|
||||
nsRect& aAbsolutePixelRect);
|
||||
static nsresult GetTranslatedString(PRUnichar *aKey, nsAWritableString *aStringOut);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIFocusController> mFocusController;
|
||||
|
||||
};
|
||||
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
class nsLinkableAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
|
||||
protected:
|
||||
PRBool IsALink();
|
||||
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
|
||||
nsCOMPtr<nsIContent> mLinkContent;
|
||||
PRBool mIsLinkVisited;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
225
mozilla/accessible/src/nsGenericAccessible.cpp
Normal file
225
mozilla/accessible/src/nsGenericAccessible.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.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.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsGenericAccessible, nsIAccessible)
|
||||
|
||||
nsGenericAccessible::nsGenericAccessible()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsGenericAccessible::~nsGenericAccessible()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccParent (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const nsAReadableString& name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFocused(); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateRight (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateLeft (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateUp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateDown (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accAddSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accExtendSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccExtState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetDOMNode(nsIDOMNode **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
51
mozilla/accessible/src/nsGenericAccessible.h
Normal file
51
mozilla/accessible/src/nsGenericAccessible.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsGenericAccessible_H_
|
||||
#define _nsGenericAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
/**
|
||||
* Basic implementation
|
||||
* supports nothing
|
||||
*/
|
||||
class nsGenericAccessible : public nsIAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
public:
|
||||
nsGenericAccessible();
|
||||
virtual ~nsGenericAccessible();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
154
mozilla/accessible/src/nsHTMLAreaAccessible.cpp
Normal file
154
mozilla/accessible/src/nsHTMLAreaAccessible.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
|
||||
// --- area -----
|
||||
|
||||
nsHTMLAreaAccessible::nsHTMLAreaAccessible(nsIDOMNode *aDomNode, nsIAccessible *aAccParent, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell), mAccParent(aAccParent)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccName(nsAWritableString & _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt) {
|
||||
nsAutoString hrefString;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("title"), _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt)
|
||||
elt->GetAttribute(NS_LITERAL_STRING("href"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
// Still to do - follow IE's standard here
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mDOMNode));
|
||||
if (area)
|
||||
area->GetShape(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = mAccParent;
|
||||
NS_IF_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible *nsHTMLAreaAccessible::CreateAreaAccessible(nsIDOMNode *aDOMNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (accService) {
|
||||
nsIAccessible* acc = nsnull;
|
||||
accService->CreateHTMLAreaAccessible(mPresShell, aDOMNode, mAccParent, &acc);
|
||||
return acc;
|
||||
}
|
||||
return nsnull;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
|
||||
{
|
||||
*aAccNextSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(nextNode));
|
||||
if (nextNode)
|
||||
*aAccNextSibling = CreateAreaAccessible(nextNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accPreviousSibling; */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPrevSibling)
|
||||
{
|
||||
*aAccPrevSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> prevNode;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prevNode));
|
||||
if (prevNode)
|
||||
*aAccPrevSibling = CreateAreaAccessible(prevNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
//nsIFrame *frame;
|
||||
// Do a better job on this later - need to use GetRect on mAreas of nsImageMap from nsImageFrame
|
||||
//return mAccParent->nsAccessible::AccGetBounds(x,y,width,height);
|
||||
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
55
mozilla/accessible/src/nsHTMLAreaAccessible.h
Normal file
55
mozilla/accessible/src/nsHTMLAreaAccessible.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLAreaAccessible_H_
|
||||
#define _nsHTMLAreaAccessible_H_
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
/* Accessible for image map areas - must be child of image
|
||||
*/
|
||||
|
||||
class nsHTMLAreaAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLAreaAccessible(nsIDOMNode *domNode, nsIAccessible *accParent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString & _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible * *aAccNextSibling);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling);
|
||||
NS_IMETHOD GetAccDescription(nsAWritableString& _retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(nsIDOMNode *aDOMNode);
|
||||
nsCOMPtr<nsIAccessible> mAccParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
728
mozilla/accessible/src/nsHTMLComboboxAccessible.cpp
Normal file
728
mozilla/accessible/src/nsHTMLComboboxAccessible.cpp
Normal file
@@ -0,0 +1,728 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsHTMLComboboxAccessible.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
/** ----- nsHTMLComboboxAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsHTMLAccessible and set initial state
|
||||
* closed and not registered
|
||||
*/
|
||||
nsHTMLComboboxAccessible::nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
SetupMenuListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor -- If we are registered, remove ourselves as a listener.
|
||||
*/
|
||||
nsHTMLComboboxAccessible::~nsHTMLComboboxAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/** Inherit the ISupports impl from nsAccessible -- handle nsIDOMXULListener ourself */
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsHTMLComboboxAccessible, nsAccessible, nsIDOMXULListener)
|
||||
|
||||
/**
|
||||
* Tell our caller we are a combobox
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_COMBOBOX;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our last child, a nsHTMLComboboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLComboboxWindowAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our first child, a nsHTMLComboboxTextFieldAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLComboboxTextFieldAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We always have 3 children: TextField, Button, Window. In that order
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleSelectable method. No-op because our selection is returned through
|
||||
* GetValue(). This _may_ change just to provide additional info for the vendors
|
||||
* and another option for them to get at stuff.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. SelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if (select) {
|
||||
select->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_HASPOPUP
|
||||
* STATE_EXPANDED
|
||||
* STATE_COLLAPSED
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
if (mOpen)
|
||||
*_retval |= STATE_EXPANDED;
|
||||
else
|
||||
*_retval |= STATE_COLLAPSED;
|
||||
|
||||
*_retval |= STATE_HASPOPUP | STATE_READONLY | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set our state to open and (TBD) fire an event to MSAA saying our state
|
||||
* has changed.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::PopupShowing(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set our state to not open and (TDB) fire an event to MSAA saying
|
||||
* our state has changed.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::PopupHiding(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set our state to not open and (TDB) fire an event to MSAA saying
|
||||
* our state has changed.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we aren't already registered, register ourselves as a
|
||||
* listener to "popupshowing" events on our DOM node. Set our
|
||||
* state to registered, but don't notify MSAA as they
|
||||
* don't need to know about this state.
|
||||
*/
|
||||
void
|
||||
nsHTMLComboboxAccessible::SetupMenuListener()
|
||||
{
|
||||
// if not already registered as a popup listener, register ourself
|
||||
if (!mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver && NS_SUCCEEDED(eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE)))
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ----- nsHTMLComboboxTextFieldAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsLeafAccessible and set our parent
|
||||
*/
|
||||
nsHTMLComboboxTextFieldAccessible::nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently gets the text from the first option, needs to check for selection
|
||||
* and then return that text.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!frame || !context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::textFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AppendFlatStringFromSubtree(content, &_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the BlockFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsHTMLComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our first child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!frame || !context)
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, aBoundingFrame);
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for our parent
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our next sibling, a
|
||||
* nsHTMLComboboxButtonAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are the first child of our parent, no previous sibling
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our role is currently only static text, but we should be able to have
|
||||
* editable text here and we need to check that case.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_STATICTEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxTextFieldAccessible we can have the following states:
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/** -----SelectButtonAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsMenuListenerAccessible and set our parent
|
||||
*/
|
||||
nsHTMLComboboxButtonAccessible::nsHTMLComboboxButtonAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmaticaly click on the button, causing either the display or
|
||||
* the hiding of the drop down box ( window ).
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
// We only have one action, click. Any other index is meaningless(wrong)
|
||||
if (index == eAction_Click) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(content));
|
||||
if (element)
|
||||
{
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Just one action ( click ).
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the gfxButtonControlFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsHTMLComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our second child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetNextSibling(aBoundingFrame);
|
||||
frame->GetNextSibling(&frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell our caller we are a button.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for our parent
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name from GetAccActionName()
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return GetAccActionName(eAction_Click, _retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Our action name is the reverse of our state:
|
||||
* if we are closed -> open is our name.
|
||||
* if we are open -> closed is our name.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
// we are open or closed
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (isOpen)
|
||||
_retval = NS_LITERAL_STRING("Close");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("Open");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our next sibling, a
|
||||
* nsHTMLComboboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxWindowAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our previous sibling, a
|
||||
* nsHTMLComboboxTextFieldAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxTextFieldAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children. Just a button ( over-riding nsAccessible )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children. Just a button ( over-riding nsAccessible )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children. Just a button ( over-riding nsAccessible )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxButtonAccessible we can have the following states:
|
||||
* STATE_PRESSED
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
// we are open or closed
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (isOpen)
|
||||
*_retval |= STATE_PRESSED;
|
||||
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/** ----- nsHTMLComboboxWindowAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsMenuListener and set our parent
|
||||
*/
|
||||
nsHTMLComboboxWindowAccessible::nsHTMLComboboxWindowAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxWindowAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_INVISIBLE
|
||||
* STATE_FLOATING
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
// we are open or closed
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame = nsnull;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (! isOpen)
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
*_retval |= STATE_FOCUSABLE | STATE_FLOATING;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell our caller we are a window
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for our parent
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our previous sibling, a
|
||||
* nsHTMLComboboxButtonAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are the last sibling of our parent.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only have one child, a list
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only have one child, a list
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only have one child, a list
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the areaFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsHTMLComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our first option
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aBoundingFrame = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetParent(aBoundingFrame);
|
||||
frame->GetParent(&frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::areaFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
164
mozilla/accessible/src/nsHTMLComboboxAccessible.h
Normal file
164
mozilla/accessible/src/nsHTMLComboboxAccessible.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLComboboxAccessible_h__
|
||||
#define __nsHTMLComboboxAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Combobox widget.
|
||||
*/
|
||||
class nsHTMLComboboxAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable,
|
||||
public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxAccessible();
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
virtual void SetupMenuListener();
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* A class the represents the text field in the Select to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsHTMLComboboxTextFieldAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the
|
||||
* right of the text field
|
||||
*/
|
||||
class nsHTMLComboboxButtonAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
enum { eAction_Click=0 };
|
||||
|
||||
nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsHTMLComboboxWindowAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
467
mozilla/accessible/src/nsHTMLFormControlAccessible.cpp
Normal file
467
mozilla/accessible/src/nsHTMLFormControlAccessible.cpp
Normal file
@@ -0,0 +1,467 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel)
|
||||
{
|
||||
PRInt32 numChildren = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement(do_QueryInterface(aLookNode));
|
||||
if (labelElement) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aLookNode));
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (elt) {
|
||||
nsAutoString labelIsFor;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("for"),labelIsFor);
|
||||
if (labelIsFor.Equals(*aId))
|
||||
rv = AppendFlatStringFromSubtree(aLookNode, aLabel);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
aLookNode->ChildCount(numChildren);
|
||||
nsIContent *contentWalker;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < numChildren; index++) {
|
||||
aLookNode->ChildAt(index, contentWalker);
|
||||
if (contentWalker)
|
||||
AppendLabelFor(contentWalker, aId, aLabel);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement;
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElement;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoString label;
|
||||
// go up tree get name of ancestor label if there is one. Don't go up farther than form element
|
||||
while (walkUpContent && label.IsEmpty() && !formElement) {
|
||||
labelElement = do_QueryInterface(walkUpContent);
|
||||
if (labelElement)
|
||||
rv = AppendFlatStringFromSubtree(walkUpContent, &label);
|
||||
formElement = do_QueryInterface(walkUpContent); // reached top ancestor in form
|
||||
nsCOMPtr<nsIContent> nextParent;
|
||||
walkUpContent->GetParent(*getter_AddRefs(nextParent));
|
||||
walkUpContent = nextParent;
|
||||
}
|
||||
|
||||
|
||||
// There can be a label targeted at this control using the for="control_id" attribute
|
||||
// To save computing time, only look for those inside of a form element
|
||||
walkUpContent = do_QueryInterface(formElement);
|
||||
|
||||
if (walkUpContent) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
nsAutoString forId;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("id"), forId);
|
||||
// Actually we'll be walking down the content this time, with a depth first search
|
||||
if (!forId.IsEmpty())
|
||||
AppendLabelFor(walkUpContent,&forId,&label);
|
||||
}
|
||||
|
||||
label.CompressWhitespace();
|
||||
if (label.IsEmpty())
|
||||
return nsAccessible::GetAccName(_retval);
|
||||
|
||||
_retval.Assign(label);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked, protected, unavailable
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked) *_retval |= STATE_CHECKED;
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
element->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
|
||||
nsAutoString typeString;
|
||||
element->GetType(typeString);
|
||||
if (typeString.EqualsIgnoreCase("password"))
|
||||
*_retval |= STATE_PROTECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CHECKBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
// check or uncheck
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
if (element)
|
||||
element->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
_retval = NS_LITERAL_STRING("uncheck");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("check");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) { // 0 is the magic value for default action
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("select");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_RADIOBUTTON;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// ----- HTML 4 Button: can contain arbitrary HTML content -----
|
||||
|
||||
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLBlockAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAutoString name;
|
||||
if (content)
|
||||
rv = AppendFlatStringFromSubtree(content, &name);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// --- textfield -----
|
||||
|
||||
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
if (textArea) {
|
||||
textArea->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
if (inputElement) {
|
||||
inputElement->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, protected. readonly, unavailable, selected
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
PRBool isReadOnly = PR_FALSE;
|
||||
elt->HasAttribute(NS_LITERAL_STRING("readonly"), &isReadOnly);
|
||||
if (isReadOnly)
|
||||
*_retval |= STATE_READONLY;
|
||||
|
||||
// Get current selection and find out if current node is in it
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame))) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
if (domSel) {
|
||||
PRBool isCollapsed = PR_TRUE;
|
||||
domSel->GetIsCollapsed(&isCollapsed);
|
||||
if (!isCollapsed)
|
||||
*_retval |=STATE_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!textArea) {
|
||||
if (inputElement) {
|
||||
/////// ====== Must be a password field, so it uses nsIDOMHTMLFormControl ==== ///////
|
||||
PRUint32 moreStates = 0;
|
||||
nsresult rv = nsHTMLFormControlAccessible::GetAccState(&moreStates);
|
||||
*_retval |= moreStates;
|
||||
return rv;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
textArea->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
105
mozilla/accessible/src/nsHTMLFormControlAccessible.h
Normal file
105
mozilla/accessible/src/nsHTMLFormControlAccessible.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLFormControlAccessible_H_
|
||||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHODIMP AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel);
|
||||
};
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTML4ButtonAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
|
||||
class nsHTMLTextFieldAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
274
mozilla/accessible/src/nsHTMLIFrameRootAccessible.cpp
Normal file
274
mozilla/accessible/src/nsHTMLIFrameRootAccessible.cpp
Normal file
@@ -0,0 +1,274 @@
|
||||
/* -*- 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 "nsHTMLIFrameRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHTMLIFrameRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsRootAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameAccessible::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!");
|
||||
if ( !aInstancePtr )
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleDocument))) {
|
||||
*aInstancePtr = (void*)(nsIAccessibleDocument*) this;
|
||||
NS_IF_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsHTMLBlockAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLIFrameAccessible::nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *aDoc):
|
||||
nsHTMLBlockAccessible(aNode, aShell), mRootAccessible(aRoot), nsDocAccessibleMixin(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAWritableString& aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAWritableString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccFirstChild(_retval);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccLastChild(_retval);
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccChildCount(_retval);
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetAccState(aAccState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
//=============================//
|
||||
// nsHTMLIFrameRootAccessible //
|
||||
//=============================//
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRootAccessible(aShell)
|
||||
{
|
||||
mRealDOMNode = aNode;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::~nsHTMLIFrameRootAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccParent(nsIAccessible * *_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccParent(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccNextSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccPreviousSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetHTMLIFrameAccessible(nsIAccessible** aAcc)
|
||||
{
|
||||
// Start by finding our PresShell and from that
|
||||
// we get our nsIDocShell in order to walk the DocShell tree
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
|
||||
if (!presShell) {
|
||||
*aAcc = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
if (NS_SUCCEEDED(GetDocShellFromPS(presShell, getter_AddRefs(docShell)))) {
|
||||
// Now that we have the DocShell QI
|
||||
// it to a tree item to find it's parent
|
||||
nsCOMPtr<nsIDocShellTreeItem> item(do_QueryInterface(docShell));
|
||||
if (item) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> itemParent;
|
||||
item->GetParent(getter_AddRefs(itemParent));
|
||||
// QI to get the WebShell for the parent document
|
||||
nsCOMPtr<nsIDocShell> parentDocShell(do_QueryInterface(itemParent));
|
||||
if (parentDocShell) {
|
||||
// Get the PresShell/Content and
|
||||
// Root Content Node of the parent document
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
nsCOMPtr<nsIPresContext> parentPresContext;
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
if (NS_SUCCEEDED(GetDocShellObjects(parentDocShell,
|
||||
getter_AddRefs(parentPresShell),
|
||||
getter_AddRefs(parentPresContext),
|
||||
getter_AddRefs(rootContent)))) {
|
||||
// QI the DocShell (of this sub-doc) to a webshell
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
|
||||
if (webShell && parentPresShell && parentPresContext && rootContent) {
|
||||
// Now, find the Content in the parent document
|
||||
// that represents this sub-doc,
|
||||
// we do that matching webshells
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (FindContentForWebShell(parentPresShell,
|
||||
rootContent,
|
||||
webShell,
|
||||
getter_AddRefs(content))) {
|
||||
// OK, we found the content node in the parent doc
|
||||
// that corresponds to this sub-doc
|
||||
// Get the frame for that content
|
||||
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(parentPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
parentPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
#ifdef NS_DEBUG_X
|
||||
printf("** Found: Con:%p Fr:%p", content, frame);
|
||||
char * name;
|
||||
if (GetNameForFrame(frame, &name)) {
|
||||
printf(" Name:[%s]", name);
|
||||
nsMemory::Free(name);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(frame));
|
||||
|
||||
*aAcc = acc;
|
||||
NS_IF_ADDREF(*aAcc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
78
mozilla/accessible/src/nsHTMLIFrameRootAccessible.h
Normal file
78
mozilla/accessible/src/nsHTMLIFrameRootAccessible.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* -*- 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 _nsIFrameRootAccessible_H_
|
||||
#define _nsIFrameRootAccessible_H_
|
||||
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
|
||||
class nsIWebShell;
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsHTMLIFrameAccessible : public nsHTMLBlockAccessible,
|
||||
public nsIAccessibleDocument,
|
||||
public nsDocAccessibleMixin
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
public:
|
||||
nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *doc);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& AccValue);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIAccessible> mRootAccessible;
|
||||
};
|
||||
|
||||
class nsHTMLIFrameRootAccessible : public nsRootAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLIFrameRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetHTMLIFrameAccessible(nsIAccessible** aAcc);
|
||||
nsCOMPtr<nsIDOMNode> mRealDOMNode;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
188
mozilla/accessible/src/nsHTMLImageAccessible.cpp
Normal file
188
mozilla/accessible/src/nsHTMLImageAccessible.cpp
Normal file
@@ -0,0 +1,188 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIImageFrame.h"
|
||||
|
||||
// --- image -----
|
||||
|
||||
nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIImageFrame *aImageFrame, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
nsAutoString mapElementName;
|
||||
|
||||
if (doc && element) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
|
||||
element->GetAttribute(NS_LITERAL_STRING("usemap"),mapElementName);
|
||||
if (htmlDoc && !mapElementName.IsEmpty()) {
|
||||
if (mapElementName.CharAt(0) == '#')
|
||||
mapElementName.Cut(0,1);
|
||||
htmlDoc->GetImageMap(mapElementName, getter_AddRefs(mMapElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// The state is a bitfield, get our inherited state, then logically OR it with STATE_ANIMATED if this
|
||||
// is an animated image.
|
||||
|
||||
nsLinkableAccessible::GetAccState(_retval);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && shell)
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
nsCOMPtr<nsIImageFrame> imageFrame(do_QueryInterface(frame));
|
||||
|
||||
nsCOMPtr<imgIRequest> imageRequest;
|
||||
if (imageFrame)
|
||||
imageFrame->GetImageRequest(getter_AddRefs(imageRequest));
|
||||
|
||||
nsCOMPtr<imgIContainer> imgContainer;
|
||||
if (imageRequest)
|
||||
imageRequest->GetImage(getter_AddRefs(imgContainer));
|
||||
|
||||
if (imgContainer) {
|
||||
PRUint32 numFrames;
|
||||
imgContainer->GetNumFrames(&numFrames);
|
||||
if (numFrames > 1)
|
||||
*_retval |= STATE_ANIMATED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> imageContent(do_QueryInterface(mDOMNode));
|
||||
if (imageContent) {
|
||||
nsAutoString name;
|
||||
rv = AppendFlatStringFromContentNode(imageContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_GRAPHIC;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsIAccessible *nsHTMLImageAccessible::CreateAreaAccessible(PRUint32 areaNum)
|
||||
{
|
||||
if (!mMapElement)
|
||||
return nsnull;
|
||||
|
||||
if (areaNum == -1) {
|
||||
PRInt32 numAreaMaps;
|
||||
GetAccChildCount(&numAreaMaps);
|
||||
if (numAreaMaps<=0)
|
||||
return nsnull;
|
||||
areaNum = NS_STATIC_CAST(PRUint32,numAreaMaps-1);
|
||||
}
|
||||
|
||||
nsIDOMHTMLCollection *mapAreas;
|
||||
mMapElement->GetAreas(&mapAreas);
|
||||
if (!mapAreas)
|
||||
return nsnull;
|
||||
|
||||
nsIDOMNode *domNode = nsnull;
|
||||
mapAreas->Item(areaNum,&domNode);
|
||||
if (!domNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (!accService)
|
||||
return nsnull;
|
||||
if (accService) {
|
||||
nsIAccessible* acc = nsnull;
|
||||
accService->CreateHTMLAreaAccessible(mPresShell, domNode, this, &acc);
|
||||
return acc;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = CreateAreaAccessible(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = CreateAreaAccessible(-1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
if (mMapElement) {
|
||||
nsIDOMHTMLCollection *mapAreas;
|
||||
mMapElement->GetAreas(&mapAreas);
|
||||
if (mapAreas) {
|
||||
PRUint32 length;
|
||||
mapAreas->GetLength(&length);
|
||||
*_retval = NS_STATIC_CAST(PRInt32, length);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
54
mozilla/accessible/src/nsHTMLImageAccessible.h
Normal file
54
mozilla/accessible/src/nsHTMLImageAccessible.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.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLImageAccessible_H_
|
||||
#define _nsHTMLImageAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
|
||||
/* Accessible for supporting images
|
||||
* supports:
|
||||
* - gets name, role
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLImageAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIImageFrame *imageFrame, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(PRUint32 areaNum);
|
||||
nsCOMPtr<nsIDOMHTMLMapElement> mMapElement;
|
||||
};
|
||||
|
||||
#endif
|
||||
63
mozilla/accessible/src/nsHTMLLinkAccessible.cpp
Normal file
63
mozilla/accessible/src/nsHTMLLinkAccessible.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
if (!IsALink()) // Also initializes private data members
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = AppendFlatStringFromSubtree(mLinkContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
38
mozilla/accessible/src/nsHTMLLinkAccessible.h
Normal file
38
mozilla/accessible/src/nsHTMLLinkAccessible.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*- 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):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLLinkAccessible_H_
|
||||
#define _nsHTMLLinkAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsHTMLLinkAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
183
mozilla/accessible/src/nsHTMLListboxAccessible.cpp
Normal file
183
mozilla/accessible/src/nsHTMLListboxAccessible.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLListboxAccessible.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
/** ----- nsHTMLListboxAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsHTMLAccessible
|
||||
*/
|
||||
nsHTMLListboxAccessible::nsHTMLListboxAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** Inherit the ISupports impl from nsAccessible */
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLListboxAccessible, nsAccessible, nsIAccessibleSelectable)
|
||||
|
||||
/**
|
||||
* Tell our caller we are a list ( there isn't a listbox value )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our last child, a nsHTMLListboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our first child, a nsHTMLListboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We always have 1 child: SelectList.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleSelectable method. This needs to get from the select the list
|
||||
* of select options and then iterate through that pulling out the selected
|
||||
* items and creating IAccessible objects for them. Put the IAccessibles in
|
||||
* the nsISupportsArray and return them.
|
||||
* retval will be nsnull if:
|
||||
* - there are no options in the select
|
||||
* - there are options but none are selected
|
||||
* - the DOMNode is not a nsIDOMHTMLSelectElement ( shouldn't happen )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select(do_QueryInterface(mDOMNode));
|
||||
if(select) {
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options;
|
||||
// get all the options in the select
|
||||
select->GetOptions(getter_AddRefs(options));
|
||||
if (options) {
|
||||
// set up variables we need to get the selected options and to get their nsIAccessile objects
|
||||
PRUint32 length;
|
||||
options->GetLength(&length);
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsISupportsArray> selectedAccessibles;
|
||||
NS_NewISupportsArray(getter_AddRefs(selectedAccessibles));
|
||||
if (!selectedAccessibles || !accService)
|
||||
return NS_ERROR_FAILURE;
|
||||
// find the selected options and get the accessible objects;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
for (PRUint32 i = 0 ; i < length ; i++) {
|
||||
nsCOMPtr<nsIDOMNode> tempNode;
|
||||
options->Item(i,getter_AddRefs(tempNode));
|
||||
if (tempNode) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> tempOption(do_QueryInterface(tempNode));
|
||||
if (tempOption)
|
||||
tempOption->GetSelected(&isSelected);
|
||||
if (isSelected) {
|
||||
nsCOMPtr<nsIAccessible> tempAccess;
|
||||
accService->CreateHTMLSelectOptionAccessible(tempOption, this, context, getter_AddRefs(tempAccess));
|
||||
if ( tempAccess )
|
||||
selectedAccessibles->AppendElement(tempAccess);
|
||||
isSelected = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedAccessibles->Count(&length); // reusing length
|
||||
if ( length != 0 ) { // length of nsISupportsArray containing selected options
|
||||
*_retval = selectedAccessibles;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
// no options, not a select or none of the options are selected
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. SelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if ( select ) {
|
||||
select->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLListboxAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
57
mozilla/accessible/src/nsHTMLListboxAccessible.h
Normal file
57
mozilla/accessible/src/nsHTMLListboxAccessible.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLListboxAccessible_h__
|
||||
#define __nsHTMLListboxAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Combobox widget.
|
||||
*/
|
||||
class nsHTMLListboxAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLListboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
794
mozilla/accessible/src/nsHTMLSelectAccessible.cpp
Normal file
794
mozilla/accessible/src/nsHTMLSelectAccessible.cpp
Normal file
@@ -0,0 +1,794 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsISelectElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
/*
|
||||
* A class the represents the text field in the Select to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsHTMLSelectTextFieldAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A base class that can listen to menu events. Its used so the
|
||||
* button and the window accessibles can change there name and role
|
||||
* depending on whether the drop down list is dropped down on not
|
||||
*/
|
||||
class nsMenuListenerAccessible : public nsAccessible, public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsMenuListenerAccessible();
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
virtual void SetupMenuListener();
|
||||
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the right of the text field
|
||||
*/
|
||||
class nsHTMLSelectButtonAccessible : public nsMenuListenerAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsHTMLSelectWindowAccessible : public nsMenuListenerAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* The list that contains all the options in the select. It is inside the window.
|
||||
*/
|
||||
class nsHTMLSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectListAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
//--------- nsHTMLSelectAccessible -----
|
||||
|
||||
nsHTMLSelectAccessible::nsHTMLSelectAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLSelectAccessible, nsAccessible, nsIAccessibleSelectable)
|
||||
|
||||
// ------------- Helper method for determination of proper Frame ------
|
||||
//static
|
||||
PRBool nsHTMLSelectAccessible::IsCorrectFrame( nsIFrame* aFrame, nsIAtom* aAtom ) {
|
||||
if (!aFrame || !aAtom)
|
||||
return PR_FALSE;
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType.get() != aAtom)
|
||||
return PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> text;
|
||||
GetAccFirstChild(getter_AddRefs(text));
|
||||
if (text)
|
||||
return text->GetAccValue(_retval);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_COMBOBOX;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
// create a window accessible
|
||||
*_retval = new nsHTMLSelectWindowAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
// create a text field
|
||||
|
||||
*_retval = new nsHTMLSelectTextFieldAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
// always have 3 children
|
||||
*_retval = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------- SelectTextFieldAccessible ------
|
||||
|
||||
nsHTMLSelectTextFieldAccessible::nsHTMLSelectTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if ( !frame )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::textFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AppendFlatStringFromSubtree(content, &_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our first child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if ( !frame )
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_STATICTEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --------- nsMenuListenerAccessible -----------
|
||||
|
||||
nsMenuListenerAccessible::nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMenuListenerAccessible::~nsMenuListenerAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupShowing(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupHiding(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuListenerAccessible::SetupMenuListener()
|
||||
{
|
||||
// not not already one register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (!eventReceiver) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------- SelectButtonAccessible ------
|
||||
|
||||
nsHTMLSelectButtonAccessible::nsHTMLSelectButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsMenuListenerAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::gfxButtonControlFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(content));
|
||||
if (element)
|
||||
{
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our second child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::gfxButtonControlFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return GetAccActionName(0, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
SetupMenuListener();
|
||||
|
||||
// get the current state open or closed
|
||||
// set _retval to it.
|
||||
// notice its supposed to be reversed. Close if opened
|
||||
// and Open if closed.
|
||||
|
||||
if (mOpen)
|
||||
_retval = NS_LITERAL_STRING("Close");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("Open");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectWindowAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectTextFieldAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//---------------------
|
||||
|
||||
|
||||
nsHTMLSelectWindowAccessible::nsHTMLSelectWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell)
|
||||
:nsMenuListenerAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
SetupMenuListener();
|
||||
|
||||
// if open we are visible if closed we are invisible
|
||||
// set _retval to it.
|
||||
if (mOpen)
|
||||
*_retval |= STATE_DEFAULT;
|
||||
else
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our first option
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aRelativeFrame = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::listControlFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
|
||||
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> last;
|
||||
mDOMNode->GetLastChild(getter_AddRefs(last));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, last, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> first;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(first));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, first, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------
|
||||
|
||||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LISTITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(next));
|
||||
|
||||
if (next) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, next, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> prev;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prev));
|
||||
|
||||
if (prev) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, prev, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content (do_QueryInterface(mDOMNode));
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoString option;
|
||||
nsresult rv = AppendFlatStringFromSubtree(content, &option);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
option.CompressWhitespace();
|
||||
_retval.Assign(option);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
72
mozilla/accessible/src/nsHTMLSelectAccessible.h
Normal file
72
mozilla/accessible/src/nsHTMLSelectAccessible.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLSelectAccessible_h__
|
||||
#define __nsHTMLSelectAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
class nsHTMLSelectAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLSelectAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrame( nsIFrame* aFrame, nsIAtom* aAtom );
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Each option in the Select. These are in the nsListAccessible
|
||||
*/
|
||||
class nsHTMLSelectOptionAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user