Compare commits

..

47 Commits

Author SHA1 Message Date
spence%netscape.com
233427693e unix build fix
git-svn-id: svn://10.0.0.236/branches/N2@24851 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-23 17:37:01 +00:00
spence%netscape.com
8a5d6cea8a unix parity
git-svn-id: svn://10.0.0.236/branches/N2@24825 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-23 08:41:00 +00:00
spence%netscape.com
060c6b2ea2 unix cleanup
git-svn-id: svn://10.0.0.236/branches/N2@24822 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-23 08:23:21 +00:00
spence%netscape.com
09b0cb9dac still bringing unix up-to-date
git-svn-id: svn://10.0.0.236/branches/N2@24646 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-22 02:41:00 +00:00
spence%netscape.com
edba634cae unix parity
git-svn-id: svn://10.0.0.236/branches/N2@24644 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-22 02:30:33 +00:00
spence%netscape.com
a7365899d1 unix parity
git-svn-id: svn://10.0.0.236/branches/N2@24639 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-22 01:14:23 +00:00
spence%netscape.com
c3389b3323 bring up-to-date on unix
git-svn-id: svn://10.0.0.236/branches/N2@24637 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-22 01:10:00 +00:00
gagan%netscape.com
718ec18100 Updates, just moving between machines...
git-svn-id: svn://10.0.0.236/branches/N2@24279 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-17 22:53:00 +00:00
gagan%netscape.com
7d190a8dd4 Removed pluggable for now...
git-svn-id: svn://10.0.0.236/branches/N2@23299 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-09 08:26:52 +00:00
gagan%netscape.com
e1ebb3e092 Changes... updates. Added nsIHeader.h
git-svn-id: svn://10.0.0.236/branches/N2@23287 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-09 05:27:33 +00:00
gagan%netscape.com
59705f110a Updates.
git-svn-id: svn://10.0.0.236/branches/N2@23286 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-09 05:27:07 +00:00
gagan%netscape.com
10d067c837 Added HTTP specific files for the pluggable protocols architecture. Made changes from IID() to GetIID() function. Other misc. errors etc.
git-svn-id: svn://10.0.0.236/branches/N2@23223 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-08 23:52:00 +00:00
gagan%netscape.com
0995f00878 The new files for pluggable HTTP. These would eventually go under mozilla/network/pluggable/http but are here till DP's autoregistration code
gets in for HTTP.


git-svn-id: svn://10.0.0.236/branches/N2@23222 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-08 23:49:55 +00:00
spence%netscape.com
44c6ee7bd0 make unix build with new netlib changes
git-svn-id: svn://10.0.0.236/branches/N2@22550 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-02 08:52:18 +00:00
gagan%netscape.com
6b475c2062 Makefiles for about:protocol.
git-svn-id: svn://10.0.0.236/branches/N2@22044 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-26 03:38:56 +00:00
gagan%netscape.com
6445d6fc19 Some diff...
git-svn-id: svn://10.0.0.236/branches/N2@22032 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-26 02:34:56 +00:00
gagan%netscape.com
504987c7f8 Added pluggable protocols directory. Eventually the protocols directory will go away.
git-svn-id: svn://10.0.0.236/branches/N2@22031 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-26 02:32:22 +00:00
gagan%netscape.com
3c3c9de879 Added pluggable dir structure. Eventually this will replace the protocol
tree. First checkin.


git-svn-id: svn://10.0.0.236/branches/N2@22030 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-26 02:31:09 +00:00
gagan%netscape.com
4fb4cdbaf9 Changes related to calling nsIProtocolInstance, and added error handling codes.
git-svn-id: svn://10.0.0.236/branches/N2@22015 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-26 01:51:02 +00:00
gagan%netscape.com
6c56d63c2b First checkin of nsIProtocolInstance.
git-svn-id: svn://10.0.0.236/branches/N2@21819 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-25 01:35:28 +00:00
gagan%netscape.com
6360bf628f Changes...
git-svn-id: svn://10.0.0.236/branches/N2@21818 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-25 01:34:58 +00:00
gagan%netscape.com
17afc12ff5 More changes...
git-svn-id: svn://10.0.0.236/branches/N2@21817 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-25 01:34:32 +00:00
gagan%netscape.com
d2c8923434 Debug method...
git-svn-id: svn://10.0.0.236/branches/N2@21707 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-24 05:44:01 +00:00
gagan%netscape.com
d962f6c931 Some fixes and changed the parsing routine to use PL_strpbrk.
git-svn-id: svn://10.0.0.236/branches/N2@21703 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-24 04:57:40 +00:00
gagan%netscape.com
c467d95fcc URL parsing related work.
git-svn-id: svn://10.0.0.236/branches/N2@20920 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 08:35:12 +00:00
gagan%netscape.com
7d6ab18c04 Removed local nsFileStream.cpp.
git-svn-id: svn://10.0.0.236/branches/N2@20882 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 04:23:49 +00:00
gagan%netscape.com
2267821c34 Removed local nsFileStream.h we are now using mozilla/base/public/nsFileStream.h
git-svn-id: svn://10.0.0.236/branches/N2@20881 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 04:18:56 +00:00
spence%netscape.com
f652521f1f replacement of nsFileStream
git-svn-id: svn://10.0.0.236/branches/N2@20880 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 04:12:27 +00:00
gagan%netscape.com
4df60ddcca Minor tweaks to build on windows.
git-svn-id: svn://10.0.0.236/branches/N2@20864 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 03:15:35 +00:00
gagan%netscape.com
2a952c444d Ah... more of TheManager changes.
git-svn-id: svn://10.0.0.236/branches/N2@20861 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 02:58:48 +00:00
gagan%netscape.com
b1d8f9e682 Modified the global manager to be initialized only when somebody makes the first request for it. Possible fix for the static initialization problem. Should work.
git-svn-id: svn://10.0.0.236/branches/N2@20859 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 02:46:17 +00:00
spence%netscape.com
d2229d1d13 cleanup of old FileStream class
git-svn-id: svn://10.0.0.236/branches/N2@20835 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-17 00:16:19 +00:00
gagan%netscape.com
1165868b3c Updates. transfering to my desktop...
git-svn-id: svn://10.0.0.236/branches/N2@20827 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-16 22:42:10 +00:00
gagan%netscape.com
f74ec1b6ec Makefile changes for the new files.
git-svn-id: svn://10.0.0.236/branches/N2@20746 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-16 00:05:43 +00:00
gagan%netscape.com
2946bb22b6 Updates. Should compile now.
git-svn-id: svn://10.0.0.236/branches/N2@20745 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-16 00:04:30 +00:00
gagan%netscape.com
071e3adc48 First checkin of URL interfaces. Not in the build yet.
git-svn-id: svn://10.0.0.236/branches/N2@20536 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-12 05:54:58 +00:00
gagan%netscape.com
46e56a76cd New URL implementation files. Not in the build as yet. (Even for N2)
git-svn-id: svn://10.0.0.236/branches/N2@20535 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-12 05:51:23 +00:00
spence%netscape.com
7a5a6134fc resurrected
git-svn-id: svn://10.0.0.236/branches/N2@20350 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-11 03:31:54 +00:00
spence%netscape.com
57dafff70d cleanup
git-svn-id: svn://10.0.0.236/branches/N2@20344 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-11 03:00:37 +00:00
(no author)
34420a2e9d This commit was manufactured by cvs2svn to create branch 'N2'.
git-svn-id: svn://10.0.0.236/branches/N2@20337 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-11 02:25:26 +00:00
spence%netscape.com
81aeb86448 updated to use mozilla/base nsFileStream
git-svn-id: svn://10.0.0.236/branches/N2@20336 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-11 02:25:25 +00:00
spence%netscape.com
5586abebc4 updated NU_CACHE to use mozilla/base nsFileStream class
git-svn-id: svn://10.0.0.236/branches/N2@20333 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-11 01:58:11 +00:00
spence%netscape.com
76c32f445f updated to use mozilla/base nsFileStream; changed name to avoid confusion
git-svn-id: svn://10.0.0.236/branches/N2@20309 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-11 00:25:41 +00:00
spence%netscape.com
ca07152e56 removed bogosity that broke NU_CACHE on unix
git-svn-id: svn://10.0.0.236/branches/N2@20287 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-10 20:51:08 +00:00
spence%netscape.com
aa16a83c74 NU_CACHE build changes for Linux
git-svn-id: svn://10.0.0.236/branches/N2@19429 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-03 13:54:52 +00:00
spence%netscape.com
df7795dbf4 NU_CACHE build changes for Linux
git-svn-id: svn://10.0.0.236/branches/N2@19428 18797224-902f-48f8-a5cc-f745e15eee43
1999-02-03 13:45:53 +00:00
(no author)
74ce2dfd5d This commit was manufactured by cvs2svn to create branch 'N2'.
git-svn-id: svn://10.0.0.236/branches/N2@18827 18797224-902f-48f8-a5cc-f745e15eee43
1999-01-27 23:06:34 +00:00
32140 changed files with 1324093 additions and 5990667 deletions

View File

@@ -38,6 +38,3 @@ Stac Patents"). The Netscape Communicator code does not perform
compression. If you modify the Netscape source code to perform
compression, please take notice of the Stac Patents.
D) Netscape Communications Corporation ("Netscape") does not guarantee
that any source code or executable code available from the mozilla.org
domain is Year 2000 compliant.

View File

@@ -1,83 +1,71 @@
MOZILLA PUBLIC LICENSE
Version 1.1
NETSCAPE PUBLIC LICENSE
Version 1.0
---------------
----------------
1. Definitions.
1.0.1. "Commercial Use" means distribution or otherwise making the
Covered Code available to a third party.
1.1. "Contributor" means each entity that creates or contributes to
1.1. ``Contributor'' means each entity that creates or contributes to
the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original
1.2. ``Contributor Version'' means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. "Covered Code" means the Original Code or Modifications or the
1.3. ``Covered Code'' means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. "Electronic Distribution Mechanism" means a mechanism generally
1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. "Executable" means Covered Code in any form other than Source
1.5. ``Executable'' means Covered Code in any form other than Source
Code.
1.6. "Initial Developer" means the individual or entity identified
as the Initial Developer in the Source Code notice required by Exhibit
A.
1.6. ``Initial Developer'' means the individual or entity identified as
the Initial Developer in the Source Code notice required by Exhibit A.
1.7. "Larger Work" means a work which combines Covered Code or
1.7. ``Larger Work'' means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. "License" means this document.
1.8. ``License'' means this document.
1.8.1. "Licensable" means having the right to grant, to the maximum
extent possible, whether at the time of the initial grant or
subsequently acquired, any and all of the rights conveyed herein.
1.9. "Modifications" means any addition to or deletion from the
1.9. ``Modifications'' means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. "Original Code" means Source Code of computer software code
1.10. ``Original Code'' means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this
License is not already Covered Code governed by this License.
Original Code, and which, at the time of its release under this License
is not already Covered Code governed by this License.
1.10.1. "Patent Claims" means any patent claim(s), now owned or
hereafter acquired, including without limitation, method, process,
and apparatus claims, in any patent Licensable by grantor.
1.11. "Source Code" means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus
any associated interface definition files, scripts used to control
compilation and installation of an Executable, or source code
1.11. ``Source Code'' means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus any
associated interface definition files, scripts used to control
compilation and installation of an Executable, or a list of source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. "You" (or "Your") means an individual or a legal entity
exercising rights under, and complying with all of the terms of, this
License or a future version of this License issued under Section 6.1.
For legal entities, "You" includes any entity which controls, is
controlled by, or is under common control with You. For purposes of
this definition, "control" means (a) the power, direct or indirect,
to cause the direction or management of such entity, whether by
contract or otherwise, or (b) ownership of more than fifty percent
(50%) of the outstanding shares or beneficial ownership of such
entity.
1.12. ``You'' means an individual or a legal entity exercising rights
under, and complying with all of the terms of, this License or a future
version of this License issued under Section 6.1. For legal entities,
``You'' includes any entity which controls, is controlled by, or is
under common control with You. For purposes of this definition,
``control'' means (a) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (b) ownership of fifty percent (50%) or more of the
outstanding shares or beneficial ownership of such entity.
2. Source Code License.
@@ -85,75 +73,49 @@
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce,
modify, display, perform, sublicense and distribute the Original
Code (or portions thereof) with or without Modifications, and/or
as part of a Larger Work; and
(b) under Patents Claims infringed by the making, using or
selling of Original Code, to make, have made, use, practice,
sell, and offer for sale, and/or otherwise dispose of the
Original Code (or portions thereof).
(a) to use, reproduce, modify, display, perform, sublicense and
distribute the Original Code (or portions thereof) with or without
Modifications, or as part of a Larger Work; and
(c) the licenses granted in this Section 2.1(a) and (b) are
effective on the date Initial Developer first distributes
Original Code under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is
granted: 1) for code that You delete from the Original Code; 2)
separate from the Original Code; or 3) for infringements caused
by: i) the modification of the Original Code or ii) the
combination of the Original Code with other software or devices.
(b) under patents now or hereafter owned or controlled by Initial
Developer, to make, have made, use and sell (``Utilize'') the
Original Code (or portions thereof), but solely to the extent that
any such patent is reasonably necessary to enable You to Utilize
the Original Code (or portions thereof) and not to any greater
extent that may be necessary to Utilize further Modifications or
combinations.
2.2. Contributor Grant.
Subject to third party intellectual property claims, each Contributor
hereby grants You a world-wide, royalty-free, non-exclusive license
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) under intellectual property rights (other than patent or
trademark) Licensable by Contributor, to use, reproduce, modify,
display, perform, sublicense and distribute the Modifications
created by such Contributor (or portions thereof) either on an
unmodified basis, with other Modifications, as Covered Code
and/or as part of a Larger Work; and
(a) to use, reproduce, modify, display, perform, sublicense and
distribute the Modifications created by such Contributor (or
portions thereof) either on an unmodified basis, with other
Modifications, as Covered Code or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or
selling of Modifications made by that Contributor either alone
and/or in combination with its Contributor Version (or portions
of such combination), to make, use, sell, offer for sale, have
made, and/or otherwise dispose of: 1) Modifications made by that
Contributor (or portions thereof); and 2) the combination of
Modifications made by that Contributor with its Contributor
Version (or portions of such combination).
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
effective on the date Contributor first makes Commercial Use of
the Covered Code.
(d) Notwithstanding Section 2.2(b) above, no patent license is
granted: 1) for any code that Contributor has deleted from the
Contributor Version; 2) separate from the Contributor Version;
3) for infringements caused by: i) third party modifications of
Contributor Version or ii) the combination of Modifications made
by that Contributor with other software (except as part of the
Contributor Version) or other devices; or 4) under Patent Claims
infringed by Covered Code in the absence of Modifications made by
that Contributor.
(b) under patents now or hereafter owned or controlled by
Contributor, to Utilize the Contributor Version (or portions
thereof), but solely to the extent that any such patent is
reasonably necessary to enable You to Utilize the Contributor
Version (or portions thereof), and not to any greater extent that
may be necessary to Utilize further Modifications or combinations.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be
distributed only under the terms of this License or a future version
of this License released under Section 6.1, and You must include a
copy of this License with every copy of the Source Code You
distribute. You may not offer or impose any terms on any Source Code
version that alters or restricts the applicable version of this
License or the recipients' rights hereunder. However, You may include
an additional document offering the additional rights described in
Section 3.5.
Section 2.2. The Source Code version of Covered Code may be distributed
only under the terms of this License or a future version of this
License released under Section 6.1, and You must include a copy of this
License with every copy of the Source Code You distribute. You may not
offer or impose any terms on any Source Code version that alters or
restricts the applicable version of this License or the recipients'
rights hereunder. However, You may include an additional document
offering the additional rights described in Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
@@ -169,86 +131,77 @@
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which You contribute to contain a
You must cause all Covered Code to which you contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that
the Modification is derived, directly or indirectly, from Original
Code provided by the Initial Developer and including the name of the
Initial Developer in (a) the Source Code, and (b) in any notice in an
the date of any change. You must include a prominent statement that the
Modification is derived, directly or indirectly, from Original Code
provided by the Initial Developer and including the name of the Initial
Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If Contributor has knowledge that a license under a third party's
intellectual property rights is required to exercise the rights
granted by such Contributor under Sections 2.1 or 2.2,
Contributor must include a text file with the Source Code
distribution titled "LEGAL" which describes the claim and the
party making the claim in sufficient detail that a recipient will
know whom to contact. If Contributor obtains such knowledge after
the Modification is made available as described in Section 3.2,
Contributor shall promptly modify the LEGAL file in all copies
Contributor makes available thereafter and shall take other steps
(such as notifying appropriate mailing lists or newsgroups)
reasonably calculated to inform those who received the Covered
Code that new knowledge has been obtained.
If You have knowledge that a party claims an intellectual property
right in particular functionality or code (or its utilization
under this License), you must include a text file with the source
code distribution titled ``LEGAL'' which describes the claim and
the party making the claim in sufficient detail that a recipient
will know whom to contact. If you obtain such knowledge after You
make Your Modification available as described in Section 3.2, You
shall promptly modify the LEGAL file in all copies You make
available thereafter and shall take other steps (such as notifying
appropriate mailing lists or newsgroups) reasonably calculated to
inform those who received the Covered Code that new knowledge has
been obtained.
(b) Contributor APIs.
If Contributor's Modifications include an application programming
interface and Contributor has knowledge of patent licenses which
are reasonably necessary to implement that API, Contributor must
also include this information in the LEGAL file.
(c) Representations.
Contributor represents that, except as disclosed pursuant to
Section 3.4(a) above, Contributor believes that Contributor's
Modifications are Contributor's original creation(s) and/or
Contributor has sufficient rights to grant the rights conveyed by
this License.
If Your Modification is an application programming interface and
You own or control patents which are reasonably necessary to
implement that API, you must also include this information in the
LEGAL file.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code. If it is not possible to put such notice in a particular Source
Code file due to its structure, then You must include such notice in a
location (such as a relevant directory) where a user would be likely
to look for such a notice. If You created one or more Modification(s)
You may add your name as a Contributor to the notice described in
Exhibit A. You must also duplicate this License in any documentation
for the Source Code where You describe recipients' rights or ownership
rights relating to Covered Code. You may choose to offer, and to
charge a fee for, warranty, support, indemnity or liability
obligations to one or more recipients of Covered Code. However, You
may do so only on Your own behalf, and not on behalf of the Initial
Developer or any Contributor. You must make it absolutely clear than
any such warranty, support, indemnity or liability obligation is
offered by You alone, and You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty,
support, indemnity or liability terms You offer.
Code, and this License in any documentation for the Source Code, where
You describe recipients' rights relating to Covered Code. If You
created one or more Modification(s), You may add your name as a
Contributor to the notice described in Exhibit A. If it is not possible
to put such notice in a particular Source Code file due to its
structure, then you must include such notice in a location (such as a
relevant directory file) where a user would be likely to look for such
a notice. You may choose to offer, and to charge a fee for, warranty,
support, indemnity or liability obligations to one or more recipients
of Covered Code. However, You may do so only on Your own behalf, and
not on behalf of the Initial Developer or any Contributor. You must
make it absolutely clear than any such warranty, support, indemnity or
liability obligation is offered by You alone, and You hereby agree to
indemnify the Initial Developer and every Contributor for any liability
incurred by the Initial Developer or such Contributor as a result of
warranty, support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of
the Covered Code is available under the terms of this License,
including a description of how and where You have fulfilled the
obligations of Section 3.2. The notice must be conspicuously included
in any notice in an Executable version, related documentation or
collateral in which You describe recipients' rights relating to the
Covered Code. You may distribute the Executable version of Covered
Code or ownership rights under a license of Your choice, which may
contain terms different from this License, provided that You are in
compliance with the terms of this License and that the license for the
Executable version does not attempt to limit or alter the recipient's
rights in the Source Code version from the rights set forth in this
License. If You distribute the Executable version under a different
license You must make it absolutely clear that any terms which differ
from this License are offered by You alone, not by the Initial
Developer or any Contributor. You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by
the Initial Developer or such Contributor as a result of any such
terms You offer.
and if You include a notice stating that the Source Code version of the
Covered Code is available under the terms of this License, including a
description of how and where You have fulfilled the obligations of
Section 3.2. The notice must be conspicuously included in any notice in
an Executable version, related documentation or collateral in which You
describe recipients' rights relating to the Covered Code. You may
distribute the Executable version of Covered Code under a license of
Your choice, which may contain terms different from this License,
provided that You are in compliance with the terms of this License and
that the license for the Executable version does not attempt to limit
or alter the recipient's rights in the Source Code version from the
rights set forth in this License. If You distribute the Executable
version under a different license You must make it absolutely clear
that any terms which differ from this License are offered by You alone,
not by the Initial Developer or any Contributor. You hereby agree to
indemnify the Initial Developer and every Contributor for any liability
incurred by the Initial Developer or such Contributor as a result of
any such terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
@@ -259,27 +212,26 @@
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description
must be included in the LEGAL file described in Section 3.4 and must
be included with all distributions of the Source Code. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
License with respect to some or all of the Covered Code due to statute
or regulation then You must: (a) comply with the terms of this License
to the maximum extent possible; and (b) describe the limitations and
the code they affect. Such description must be included in the LEGAL
file described in Section 3.4 and must be included with all
distributions of the Source Code. Except to the extent prohibited by
statute or regulation, such description must be sufficiently detailed
for a recipient of ordinary skill to be able to understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A and to related Covered Code.
attached the notice in Exhibit A, and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation ("Netscape") may publish revised
and/or new versions of the License from time to time. Each version
will be given a distinguishing version number.
Netscape Communications Corporation (``Netscape'') may publish revised
and/or new versions of the License from time to time. Each version will
be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
@@ -290,22 +242,20 @@
Covered Code created under this License.
6.3. Derivative Works.
If You create or use a modified version of this License (which you may
If you create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), You must (a) rename Your license so that
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
"MPL", "NPL" or any confusingly similar phrase do not appear in your
license (except to note that your license differs from this License)
and (b) otherwise make it clear that Your version of the license
governed by this License), you must (a) rename Your license so that the
phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or
any confusingly similar phrase do not appear anywhere in your license
and (b) otherwise make it clear that your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial
Developer, Original Code or Contributor in the notice described in
Exhibit A shall not of themselves be deemed to be modifications of
this License.)
Netscape Public License. (Filling in the name of the Initial Developer,
Original Code or Contributor in the notice described in Exhibit A shall
not of themselves be deemed to be modifications of this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
@@ -318,7 +268,7 @@
8. TERMINATION.
8.1. This License and the rights granted hereunder will terminate
This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
@@ -326,69 +276,28 @@
nature, must remain in effect beyond the termination of this License
shall survive.
8.2. If You initiate litigation by asserting a patent infringement
claim (excluding declatory judgment actions) against Initial Developer
or a Contributor (the Initial Developer or Contributor against whom
You file such action is referred to as "Participant") alleging that:
(a) such Participant's Contributor Version directly or indirectly
infringes any patent, then any and all rights granted by such
Participant to You under Sections 2.1 and/or 2.2 of this License
shall, upon 60 days notice from Participant terminate prospectively,
unless if within 60 days after receipt of notice You either: (i)
agree in writing to pay Participant a mutually agreeable reasonable
royalty for Your past and future use of Modifications made by such
Participant, or (ii) withdraw Your litigation claim with respect to
the Contributor Version against such Participant. If within 60 days
of notice, a reasonable royalty and payment arrangement are not
mutually agreed upon in writing by the parties or the litigation claim
is not withdrawn, the rights granted by Participant to You under
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
the 60 day notice period specified above.
(b) any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then
any rights granted to You by such Participant under Sections 2.1(b)
and 2.2(b) are revoked effective as of the date You first made, used,
sold, distributed, or had made, Modifications made by that
Participant.
8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or
indirectly infringes any patent where such claim is resolved (such as
by license or settlement) prior to the initiation of patent
infringement litigation, then the reasonable value of the licenses
granted by such Participant under Sections 2.1 or 2.2 shall be taken
into account in determining the amount or value of any payment or
license.
8.4. In the event of termination under Sections 8.1 or 8.2 above,
all end user license agreements (excluding distributors and resellers)
which have been validly granted by You or any distributor hereunder
prior to termination shall survive termination.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER
PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND
ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE
BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a "commercial item," as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
software" and "commercial computer software documentation," as such
The Covered Code is a ``commercial item,'' as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer
software'' and ``commercial computer software documentation,'' as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
@@ -400,168 +309,113 @@
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if
any, provides otherwise), excluding its conflict-of-law provisions.
With respect to disputes in which at least one party is a citizen of,
or an entity chartered or registered to do business in the United
States of America, any litigation relating to this License shall be
subject to the jurisdiction of the Federal Courts of the Northern
District of California, with venue lying in Santa Clara County,
California, with the losing party responsible for costs, including
without limitation, court costs and reasonable attorneys' fees and
expenses. The application of the United Nations Convention on
Contracts for the International Sale of Goods is expressly excluded.
Any law or regulation which provides that the language of a contract
shall be construed against the drafter shall not apply to this
License.
California law provisions (except to the extent applicable law, if any,
provides otherwise), excluding its conflict-of-law provisions. With
respect to disputes in which at least one party is a citizen of, or an
entity chartered or registered to do business in, the United States of
America: (a) unless otherwise agreed in writing, all disputes relating
to this License (excepting any dispute relating to intellectual
property rights) shall be subject to final and binding arbitration,
with the losing party paying all costs of arbitration; (b) any
arbitration relating to this Agreement shall be held in Santa Clara
County, California, under the auspices of JAMS/EndDispute; and (c) any
litigation relating to this Agreement shall be subject to the
jurisdiction of the Federal Courts of the Northern District of
California, with venue lying in Santa Clara County, California, with
the losing party responsible for costs, including without limitation,
court costs and reasonable attorneys fees and expenses. The application
of the United Nations Convention on Contracts for the International
Sale of Goods is expressly excluded. Any law or regulation which
provides that the language of a contract shall be construed against the
drafter shall not apply to this License.
12. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or indirectly,
out of its utilization of rights under this License and You agree to
work with Initial Developer and Contributors to distribute such
responsibility on an equitable basis. Nothing herein is intended or
shall be deemed to constitute any admission of liability.
Except in cases where another Contributor has failed to comply with
Section 3.4, You are responsible for damages arising, directly or
indirectly, out of Your utilization of rights under this License, based
on the number of copies of Covered Code you made available, the
revenues you received from utilizing such rights, and other relevant
factors. You agree to work with affected parties to distribute
responsibility on an equitable basis.
13. MULTIPLE-LICENSED CODE.
AMENDMENTS
Additional Terms applicable to the Netscape Public License.
Initial Developer may designate portions of the Covered Code as
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
Developer permits you to utilize portions of the Covered Code under
Your choice of the NPL or the alternative licenses, if any, specified
by the Initial Developer in the file described in Exhibit A.
I. Effect.
These additional terms described in this Netscape Public License --
Amendments shall apply to the Mozilla Communicator client code and to
all Covered Code under this License.
EXHIBIT A -Mozilla Public License.
II. ``Netscape's Branded Code'' means Covered Code that Netscape
distributes and/or permits others to distribute under one or more
trademark(s) which are controlled by Netscape but which are not
licensed for use under this License.
``The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
III. Netscape and logo.
This License does not grant any rights to use the trademark
``Netscape'', the ``Netscape N and horizon'' logo or the Netscape
lighthouse logo, even if such marks are included in the Original Code.
IV. Inability to Comply Due to Contractual Obligation.
Prior to licensing the Original Code under this License, Netscape has
licensed third party code for use in Netscape's Branded Code. To the
extent that Netscape is limited contractually from making such third
party code available under this License, Netscape may choose to
reintegrate such code into Covered Code without being required to
distribute such code in Source Code form, even if such code would
otherwise be considered ``Modifications'' under this License.
V. Use of Modifications and Covered Code by Initial Developer.
V.1. In General.
The obligations of Section 3 apply to Netscape, except to the
extent specified in this Amendment, Section V.2 and V.3.
V.2. Other Products.
Netscape may include Covered Code in products other than the
Netscape's Branded Code which are released by Netscape during the
two (2) years following the release date of the Original Code,
without such additional products becoming subject to the terms of
this License, and may license such additional products on
different terms from those contained in this License.
V.3. Alternative Licensing.
Netscape may license the Source Code of Netscape's Branded Code,
including Modifications incorporated therein, without such
additional products becoming subject to the terms of this License,
and may license such additional products on different terms from
those contained in this License.
VI. Arbitration and Litigation.
Notwithstanding the limitations of Section 11 above, the provisions
regarding arbitration and litigation in Section 11(a), (b) and (c) of
the License shall apply to all disputes relating to this License.
EXHIBIT A.
``The contents of this file are subject to the Netscape Public License
Version 1.0 (the "License"); you 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/
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 ______________________________________.
The Original Code is Mozilla Communicator client code, released March
31, 1998.
The Initial Developer of the Original Code is ________________________.
Portions created by ______________________ are Copyright (C) ______
_______________________. 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 the _____ license (the "[___] License"), in which case the
provisions of [______] License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the [____] License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the [___] License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the [___] License."
Contributor(s): ______________________________________.''
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]
----------------------------------------------------------------------
AMENDMENTS
The Netscape Public License Version 1.1 ("NPL") consists of the
Mozilla Public License Version 1.1 with the following Amendments,
including Exhibit A-Netscape Public License. Files identified with
"Exhibit A-Netscape Public License" are governed by the Netscape
Public License Version 1.1.
Additional Terms applicable to the Netscape Public License.
I. Effect.
These additional terms described in this Netscape Public
License -- Amendments shall apply to the Mozilla Communicator
client code and to all Covered Code under this License.
II. "Netscape's Branded Code" means Covered Code that Netscape
distributes and/or permits others to distribute under one or more
trademark(s) which are controlled by Netscape but which are not
licensed for use under this License.
III. Netscape and logo.
This License does not grant any rights to use the trademarks
"Netscape", the "Netscape N and horizon" logo or the "Netscape
lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript",
"Smart Browsing" even if such marks are included in the Original
Code or Modifications.
IV. Inability to Comply Due to Contractual Obligation.
Prior to licensing the Original Code under this License, Netscape
has licensed third party code for use in Netscape's Branded Code.
To the extent that Netscape is limited contractually from making
such third party code available under this License, Netscape may
choose to reintegrate such code into Covered Code without being
required to distribute such code in Source Code form, even if
such code would otherwise be considered "Modifications" under
this License.
V. Use of Modifications and Covered Code by Initial Developer.
V.1. In General.
The obligations of Section 3 apply to Netscape, except to
the extent specified in this Amendment, Section V.2 and V.3.
V.2. Other Products.
Netscape may include Covered Code in products other than the
Netscape's Branded Code which are released by Netscape
during the two (2) years following the release date of the
Original Code, without such additional products becoming
subject to the terms of this License, and may license such
additional products on different terms from those contained
in this License.
V.3. Alternative Licensing.
Netscape may license the Source Code of Netscape's Branded
Code, including Modifications incorporated therein, without
such Netscape Branded Code becoming subject to the terms of
this License, and may license such Netscape Branded Code on
different terms from those contained in this License.
VI. Litigation.
Notwithstanding the limitations of Section 11 above, the
provisions regarding litigation in Section 11(a), (b) and (c) of
the License shall apply to all disputes relating to this License.
EXHIBIT A-Netscape Public License.
"The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s): ______________________________________.
Alternatively, the contents of this file may be used under the
terms of the _____ license (the "[___] License"), in which case
the provisions of [______] License are applicable instead of
those above. If you wish to allow use of your version of this
file only under the terms of the [____] License and not to allow
others to use your version of this file under the NPL, indicate
your decision by deleting the provisions above and replace them
with the notice and other provisions required by the [___]
License. If you do not delete the provisions above, a recipient
may use your version of this file under either the NPL or the
[___] License."
the notices in the Source Code files of the Original Code. This is due
to time constraints encountered in simultaneously finalizing the
License and in preparing the Original Code for release. You should use
the text of this Exhibit A rather than the text found in the Original
Code Source Code for Your Modifications.]

View File

@@ -1,39 +1,19 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# 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
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# License.
# NPL.
#
# The Original Code is mozilla.org code.
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = .
topsrcdir = @top_srcdir@
@@ -42,589 +22,75 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/build/unix/modules.mk
ifeq (,$(filter-out all,$(BUILD_MODULES))$(MOZ_XSLT_STANDALONE))
#
# And now for something completely different...
# Divide the default build into tiers.
# Tiers must be defined on module boundaries
#
SUPPRESS_DEFAULT_RULES = 1
# Make sure that the existing rulesets work
DIRS += $(tier_0_dirs)
ifndef LIBXUL_SDK
# only build gecko if --with-libxul-sdk isn't passed
DIRS += \
$(tier_1_dirs) \
$(tier_2_dirs) \
$(tier_9_dirs) \
$(tier_50_dirs) \
$(NULL)
endif # LIBXUL_SDK
ifdef GC_LEAK_DETECTOR
DIRS += gc/boehm
endif
DIRS += $(tier_99_dirs)
#
# tier 0 - base build config dirs
#
tier_0_dirs = \
config \
build \
$(NULL)
#
# tier 1 - 3rd party individual libraries
#
tier_1_dirs += dbm
# The list of directories that need to be built to build the standalone
# nglayout test program. The order is important.
DIRS = \
config \
dbm \
nsprpub \
$(NULL)
ifndef MOZ_NATIVE_JPEG
tier_1_dirs += jpeg
DIRS += \
jpeg \
$(NULL)
endif
DIRS += \
modules/libreg \
xpcom \
$(NULL)
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_UPDATER
tier_1_dirs += modules/libbz2
tier_1_dirs += modules/libmar
endif
ifdef MOZ_SVG_RENDERER_LIBART
tier_1_dirs += other-licenses/libart_lgpl
endif
#
# tier 2 - base libraries
#
tier_2_dirs = \
js \
xpcom \
$(NULL)
ifndef MOZ_NO_XPCOM_OBSOLETE
tier_2_dirs += modules/libreg xpcom/obsolete
endif
ifdef NS_TRACE_MALLOC
tier_2_dirs += tools/trace-malloc/lib
endif
#
# tier 9 - core components (necko,gecko)
#
tier_9_dirs += \
js/src/xpconnect \
intl \
$(NULL)
ifdef MOZ_ENABLE_XLIB
tier_9_dirs += gfx/src/xlibrgb widget/src/xlibxtbin
endif
ifdef MOZ_ENABLE_GTK
tier_9_dirs += widget/src/gtksuperwin widget/src/gtkxtbin
endif
ifdef MOZ_ENABLE_GTK2
tier_9_dirs += widget/src/gtkxtbin
endif
ifdef MOZ_IPCD
tier_9_dirs += ipc/ipcd
endif
tier_9_dirs += \
modules/libutil \
netwerk \
modules/libjar \
$(NULL)
ifdef MOZ_XUL
tier_9_dirs += rdf
endif
tier_9_dirs += \
uriloader \
modules/libpref \
modules/libimg \
caps \
parser/expat \
parser/htmlparser \
gfx \
modules/libpr0n \
sun-java \
modules/plugin \
dom \
view \
widget \
content \
layout \
docshell \
webshell \
embedding \
editor \
xpfe/appshell \
$(NULL)
ifdef MOZ_AUTH_EXTENSION
tier_9_dirs += extensions/auth
endif
ifdef MOZ_XMLEXTRAS
tier_9_dirs += extensions/xmlextras
endif
ifdef MOZ_WEBSERVICES
tier_9_dirs += extensions/webservices
endif
ifdef MOZ_UNIVERSALCHARDET
tier_9_dirs += extensions/universalchardet
endif
ifdef MOZ_OJI
tier_9_dirs += \
js/src/liveconnect \
modules/oji \
$(NULL)
endif
ifdef ACCESSIBILITY
tier_9_dirs += accessible
endif
#
# tier 50 - xpfe & toolkit
#
ifdef MOZ_XUL_APP
tier_50_dirs += chrome
else
ifdef MOZ_XUL
tier_50_dirs += rdf/chrome
else
tier_50_dirs += embedding/minimo/chromelite
endif
endif
tier_50_dirs += profile
# This must preceed xpfe
ifdef MOZ_JPROF
tier_50_dirs += tools/jprof
endif
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
tier_50_dirs += xpfe/bootstrap/appleevents
endif
tier_50_dirs += \
db \
xpfe \
toolkit/components \
$(NULL)
ifndef MOZ_XUL_APP
tier_50_dirs += themes
endif
ifdef MOZ_ENABLE_XREMOTE
tier_50_dirs += widget/src/xremoteclient
endif
ifdef MOZ_XUL_APP
tier_50_dirs += toolkit
endif
ifdef MOZ_XPINSTALL
tier_50_dirs += xpinstall
endif
ifdef MOZ_JSDEBUGGER
tier_50_dirs += js/jsd
endif
ifdef MOZ_PSM
tier_50_dirs += security/manager
else
tier_50_dirs += security/manager/boot/public security/manager/ssl/public
endif
ifdef MOZ_PREF_EXTENSIONS
tier_50_dirs += extensions/pref
endif
ifdef MOZ_JAVAXPCOM
tier_50_dirs += extensions/java
endif
ifndef BUILD_STATIC_LIBS
ifdef MOZ_XUL_APP
ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2))
tier_50_dirs += embedding/browser/gtk
endif
endif
endif
ifdef MOZ_XUL_APP
ifndef BUILD_STATIC_LIBS
tier_50_dirs += toolkit/library
endif
endif
ifdef MOZ_ENABLE_LIBXUL
tier_50_dirs += xpcom/stub
endif
ifdef NS_TRACE_MALLOC
tier_50_dirs += tools/trace-malloc
endif
ifdef MOZ_STORAGE
tier_50_dirs += storage
endif
ifdef MOZ_LDAP_XPCOM
tier_50_dirs += directory/xpcom
endif
ifndef MINIMO
ifdef MOZ_XUL_APP
ifdef MOZ_ENABLE_GTK2
tier_50_dirs += toolkit/components/gnome
endif
endif
endif
ifdef MOZ_LEAKY
tier_50_dirs += tools/leaky
endif
ifdef MOZ_MAPINFO
tier_50_dirs += tools/codesighs
endif
#
# tier 99 - application binaries
#
ifdef MOZ_MAIL_NEWS
tier_99_dirs += mailnews
endif
ifdef MOZ_CALENDAR
tier_99_dirs += calendar
endif
ifdef MOZ_EXTENSIONS
tier_99_dirs += extensions
endif
# axcontrol
ifeq ($(OS_ARCH),WINNT)
ifndef MOZ_NO_ACTIVEX_SUPPORT
tier_99_dirs += \
embedding/browser/activex/src/control \
embedding/browser/activex/src/control_kicker \
$(NULL)
endif
endif
# Java Embedding Plugin
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
tier_99_dirs += plugin/oji/JEP
endif
ifneq (,$(filter browser suite,$(MOZ_BUILD_APP)))
tier_99_dirs += xpfe/components/search
endif
ifdef MOZ_BRANDING_DIRECTORY
tier_99_dirs += $(MOZ_BRANDING_DIRECTORY)
endif
ifdef MOZ_PHOENIX
tier_99_dirs += browser xpfe/bootstrap/init.d
endif
ifdef MOZ_XULRUNNER
tier_99_dirs += xulrunner
endif
ifdef MOZ_COMPOSER
tier_99_dirs += editor/ui
endif
ifdef MOZ_THUNDERBIRD
tier_99_dirs += mail xpfe/bootstrap/init.d
endif
ifdef MOZ_STANDALONE_COMPOSER
tier_99_dirs += composer
endif
ifdef MOZ_SUNBIRD
tier_99_dirs += calendar/sunbird
endif
ifdef MOZ_SUITE
tier_99_dirs += suite
endif
ifdef MINIMO
tier_99_dirs += minimo
endif
ifdef MOZ_XUL_APP
ifdef MOZ_INSTALLER
tier_99_dirs += toolkit/mozapps/installer
endif
else
ifneq (,$(MOZ_XPFE_COMPONENTS)$(MOZ_XUL))
ifndef MINIMO
tier_99_dirs += xpfe/bootstrap
endif
endif
endif
# winembed, mfcembed
ifeq ($(OS_ARCH),WINNT)
ifneq (,$(ENABLE_TESTS)$(MOZILLA_OFFICIAL))
tier_99_dirs += embedding/tests
endif
endif
# os2embed
ifeq ($(OS_ARCH),OS2)
ifneq (,$(ENABLE_TESTS)$(MOZILLA_OFFICIAL))
tier_99_dirs += embedding/tests
endif
endif
ifeq ($(MOZ_BUILD_APP),macbrowser)
tier_99_dirs += \
embedding/config \
camino \
$(NULL)
endif
# test harnesses
ifdef ENABLE_TESTS
tier_99_dirs += tools/test-harness
endif
default alldep all:: $(SUBMAKEFILES)
$(RM) -rf $(DIST)/sdk
$(RM) -rf $(DIST)/include
$(MAKE) -C config export
ifndef LIBXUL_SDK
$(MAKE) nspr
endif
$(MAKE) ldap
$(MAKE) tier_0
ifndef LIBXUL_SDK
$(MAKE) tier_1
$(MAKE) tier_2
$(MAKE) tier_9
$(MAKE) tier_50
endif
$(MAKE) tier_99
DIRS += \
modules/zlib \
$(NULL)
endif
DIRS += \
modules/libutil \
intl \
sun-java \
nav-java \
js \
modules/security/freenav \
modules/libpref \
modules/libimg \
modules/oji \
modules/plugin \
base \
caps \
lib/xp \
lib/libpwcac \
network \
lib/liblayer/include \
htmlparser \
gfx \
dom \
view \
widget \
layout \
rdf \
webshell \
editor \
silentdl
DIRS += xpfe
include $(topsrcdir)/config/config.mk
else # BUILD_MODULES
# Standalone build
ifdef MOZ_XSLT_STANDALONE
DIRS = \
xpcom/typelib \
xpcom \
parser/expat \
content/xslt/src \
$(NULL)
SUBMAKEFILES = xpcom/typelib/Makefile
else
DIRS = $(BUILD_MODULE_DIRS)
# Hack to generate xpidl Makefile
ifneq ($(BUILD_MODULES),all)
ifneq (,$(findstring xpcom, $(BUILD_MODULE_DIRS)))
DIRS := xpcom/typelib $(DIRS)
SUBMAKEFILES := xpcom/typelib/Makefile
endif
endif
endif
default:: $(SUBMAKEFILES)
$(MAKE) export
$(MAKE) libs
endif # BUILD_MODULES == all or MOZ_XSLT_STANDALONE
STATIC_MAKEFILES := nsprpub directory/c-sdk security/nss
GARBAGE_DIRS += dist
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
dependencies.beos config/autoconf.mk config/myrules.mk config/myconfig.mk \
unallmakefiles mozilla-config.h \
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
# Build pseudo-external modules first when export is explicitly called
export::
$(RM) -rf $(DIST)/sdk
$(MAKE) -C config export
$(MAKE) nspr
$(MAKE) ldap
ifneq ($(BUILD_MODULES),all)
ifneq (,$(findstring xpcom, $(BUILD_MODULE_DIRS)))
$(MAKE) -C xpcom/typelib
$(MAKE) export-idl
endif
endif
install::
ifndef MOZ_NATIVE_NSPR
$(MAKE) -C nsprpub 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
include $(topsrcdir)/config/rules.mk
# Clean up after pseudo-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
real_all: all
# Map mozilla targets to standard automake target
real_export: export
export_tier_%:
@echo "$@" $(if $(tier_$*_dirs),,$(error Tier $* not present))
@$(MAKE) $(addsuffix /Makefile,$(filter-out $(STATIC_MAKEFILES),$(tier_$*_dirs)))
@$(EXIT_ON_ERROR) \
for d in $(tier_$*_dirs); do \
$(UPDATE_TITLE) \
$(MAKE) -C $$d export; \
done
real_libs: libs
libs_tier_%:
@echo "$@" $(if $(tier_$*_dirs),,$(error Tier $* not present))
@$(MAKE) $(addsuffix /Makefile,$(filter-out $(STATIC_MAKEFILES),$(tier_$*_dirs)))
@$(EXIT_ON_ERROR) \
for d in $(tier_$*_dirs); do \
$(UPDATE_TITLE) \
$(MAKE) -C $$d libs; \
done
real_install: install
tools_tier_%:
@echo "$@" $(if $(tier_$*_dirs),,$(error Tier $* not present))
@$(MAKE) $(addsuffix /Makefile,$(filter-out $(STATIC_MAKEFILES),$(tier_$*_dirs)))
@$(EXIT_ON_ERROR) \
for d in $(tier_$*_dirs); do \
$(UPDATE_TITLE) \
$(MAKE) -C $$d tools; \
done
real_clobber: clobber
tier_50:
@echo "$@: $($@_dirs)"
$(MAKE) export_tier_50
$(MAKE) libs_tier_50
$(MAKE) tools_tier_2
$(MAKE) tools_tier_9
$(MAKE) tools_tier_50
tier_%:
@echo "$@: $(if $($@_dirs),$($@_dirs),$(error Tier $* not present.))"
$(MAKE) export_$@
$(MAKE) libs_$@
#
# 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
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
ifdef MOZ_DEBUG_SYMBOLS
echo finding pdb files
mkdir -p $(DIST)/$(BUILDID)
-cp `/bin/find . -path "./dist" -prune -o -name "*.dll" | sed "s/\.dll$$/\.pdb/" | xargs` $(DIST)/$(BUILDID)
-cp `/bin/find . -path "./dist" -prune -o -name "*.exe" | sed "s/\.exe$$/\.pdb/" | xargs` $(DIST)/$(BUILDID)
-cp `/bin/find . -path "./dist" -prune -o -name "*.EXE" | sed "s/\.EXE$$/\.pdb/" | xargs` $(DIST)/$(BUILDID)
endif # MOZ_DEBUG_SYMBOLS
ifdef MOZ_PROFILE
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 {} \;
mkdir -p $(DIST)/$(BUILDID)
/bin/find $(DIST) -name "*.dbg" -exec mv {} $(DIST)/$(BUILDID) \;
endif # MOZ_PROFILE
endif # MOZILLA_OFFICIAL
## XXXvlad -- the test and cp should be removed once bug 249782 is
## completely fixed
signnss:
ifdef MOZILLA_OFFICIAL
echo signing NSS libs
test -f $(DEPTH)/nss/shlibsign.exe.manifest && cp $(DEPTH)/nss/shlibsign.exe.manifest $(DIST)/bin
cd $(DIST)/bin; ./shlibsign.exe -v -i softokn3.dll
cd $(DIST)/bin; ./shlibsign.exe -v -i freebl3.dll
endif # MOZILLA_OFFICIAL
BUILDID = $(shell cat $(DEPTH)/config/build_number)
deliver: splitsymbols rebase signnss
endif # WINNT
real_depend: depend

View File

@@ -1,306 +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.org/mozilla/nightly/
For the very latest builds, see
ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest-trunk
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 X or later
-PowerPC processor (266 MHz or faster recommended)
-64 MB RAM
-36 MB of free hard disk space
*Windows
-Windows 95, 98, Me, NT4, 2000 or XP
-Intel Pentium class processor (233 MHz or faster
recommended)
-64 MB RAM
-26 MB free hard disk space
*Linux
-The following library versions (or compatible) are
required: glibc 2.1, XFree86 3.3.x, GTK 1.2.x, Glib
1.2.x, Libstdc++ 2.9.0. Red Hat Linux 6.0,
Debian 2.1, and SuSE 6.2 (or later) installations
should work.
-Red Hat 6.x users who want to install the Mozilla
RPM must have at least version 4.0.2 of rpm
installed.
-Intel Pentium class processor (233 MHz or faster
recommended)
-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 X Installation Instructions
----------------------------------
To install Mozilla by downloading the Mozilla disk image,
follow these steps:
1. Click the mozilla-mac-MachO.dmg.gz link to download
it to your machine. By default, the download file is
downloaded to your desktop.
2. Once you have downloaded the .dmg.gz file, drag it
onto Stuffit Expander to decompress it. If the disk
image doesn't mount automatically, double-click on the
.dmg file to mount it. If that fails, and the file
does not look like a disk image file, do a "Show Info"
on the file, and, in the "Open with application"
category, choose Disk Copy. In Mac OS 10.2, you can
use "Open with" from the context menu.
3. Once the disk image mounts, open it, and drag the
Mozilla icon onto your hard disk.
4. We recommend that you copy it to the Applications
folder.
5. Now Eject the disk image.
6. If you like, you can drag Mozilla to your dock to
have it easily accessible at all times. You might also
wish to select Mozilla as your default browser in the
Internet system preferences pane (under the Web tab).
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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,3 +0,0 @@
For mozilla-the-client build instructions, please read:
http://www.mozilla.org/build/

View File

@@ -1,239 +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 OS/2 build of Mozilla.
For more info on Mozilla, see http://www.mozilla.org. For more info on the OS/2
port see http://www.mozilla.org/ports/os2. To submit bugs or other feedback
check out Bugzilla at https://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, OS/2 specific
problems are discussed in #warpzilla and in the newsgroup
netscape.public.mozilla.os2 on news.mozilla.org and other newsservers.
================================================================================
Getting Mozilla
================================================================================
Official Milestone builds of Mozilla are published on the release page at
http://www.mozilla.org/releases
OS/2 releases are not created by Mozilla.org staff and may appear on the page
http://www.mozilla.org/ports/os2 before the releases page. Be sure to read the
Mozilla release notes linked on the releases page for information on known
problems and installation issues with Mozilla.
================================================================================
System Requirements
================================================================================
*All Platforms
To view and use the "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.
*OS/2
- This release requires updated C runtime DLLs (libc-0.5.1) from
http://www.innotek.de/products/gccos2/download/gccos2download_e.html
in order to run. By default the installation routine places them in
\OS2\DLL on your bootdrive, but you can put them in the same directory as
Mozilla's executable, or somewhere else in your LIBPATH. The Mozilla
installer will not install the C runtime DLLs for you but requires them to
run.
- Minimum hardware requirements
+ Pentium class processor
+ 64 MiB RAM plus 64 MiB free swap space
+ 35 MiB free harddisk space for installation
plus storage space for disk cache and mail
- Recommended hardware for acceptable performance
+ 500 MHz processor
+ 256 MiB RAM plus 64 MiB free swap space
NOTE: Mozilla's performance and stability increases the more physical RAM
is available. Especially for long browsing and IRC sessions 512 MiB of
memory is recommended.
- Software requirements
+ Installation on a file system supporting long file names
(i.e. HPFS or JFS but not FAT)
+ OS/2 Warp 4 with Fixpack 15 or later
+ MPTS version 5.3
+ TCP/IP version 4.1
+ INETVER: SOCKETS.SYS=5.3007, AFOS2.SYS=5.3001, AFINET.SYS=5.3006
NOTE: Do not attempt to use MPTS & TCP/IP versions below these INETVER
levels. Although Mozilla may seem to start and run normally with older
stacks, some features Mozilla needs are not implemented correctly in
older MPTS versions, which may result in crashes and data loss.
+ Convenience Pack 2 or eComStation 1.0 or later meet these requirements
out of the box.
================================================================================
Installation Instructions
================================================================================
For all platforms, install into a clean (new) directory. Installing on top of
previously released builds may cause problems if a ZIP package is used instead
of an installer EXE.
Note: These instructions do not tell you how to build Mozilla.
For info on building the Mozilla source, see
http://www.mozilla.org/build/
OS/2 Installation Instructions
------------------------------
To install Mozilla by downloading the Mozilla installer, follow these steps:
1. Click the "Installer" link on the site you're downloading Mozilla
from to download the installer file to your machine. This file is typically
called mozilla-os2-*-installer.exe where the "*" is replaced by the Mozilla
version.
2. Navigate to where you downloaded the file, make sure that the C library
DLLs are copied to the same directory or installed in the LIBPATH, and
double-click on the the Mozilla installer object to start the Setup
program.
3. Follow the on-screen instructions in the setup program. The program
automatically ends any running Mozilla sessions and creates a Mozilla
folder on the Desktop. To start Mozilla the first time, again make sure
that the C library DLLs are copied to the installation directory or
installed in the LIBPATH and then double-click the Mozilla program object
inside this folder.
To install Mozilla by downloading the .zip file and installing manually,
follow these steps:
1. Click the "Zip" link on the site you're downloading Mozilla from to
download the ZIP package to your machine. This file is typically called
mozilla-os2-*.zip where the "*" is replaced by the Mozilla version.
2. Navigate to where you downloaded the file and unpack it using your
favorite unzip tool.
3. Keep in mind that the unzip process creates a directory "mozilla" below
the location you point it to, i.e.
unzip mozilla-os2-1.7.5.zip -d c:\mozilla-1.7.5
will unpack Mozilla into c:\mozilla-1.7.5\mozilla.
4. Make sure that you are _not_ unpacking over an old installation. This is
known to cause problems.
5. To start Mozilla, navigate to the directory you extracted Mozilla to,
make sure that the C library DLLs are copied to the installation directory
or installed in the LIBPATH, and then double-click the Mozilla.exe object.
Running multiple versions of Mozilla concurrently
-------------------------------------------------
Because various members of the Mozilla family (i.e. Mozilla, Firefox,
Thunderbird, IBM Web Browser) may use different, incompatible versions of the
same DLL, some extra steps may be required to run them concurrently.
One workaround is the LIBPATHSTRICT variable. To run Mozilla based applications
one can create a CMD script like the following example (where an installation of
Mozilla exists in the directory d:\internet\mozilla is assumed):
set LIBPATHSTRICT=T
rem The next line may be needed when a different Mozilla program is listed in LIBPATH
rem set BEGINLIBPATH=d:\internet\mozilla
rem The next line is only needed to run two versions of the same program
rem set MOZ_NO_REMOTE=1
d:
cd d:\internet\mozilla
mozilla.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
Similarly, one can create a program object to start Mozilla using the following
settings:
Path and file name: *
Parameters: /c set LIBPATHSTRICT=T & .\mozilla.exe "%*"
Working directory: d:\internet\mozilla
(One might need to add MOZ_NO_REMOTE and/or BEGINLIBPATH as in the CMD script
above depending on the system configuration.)
Finally, the simplest method is to use the Run! utility by Rich Walsh that can
be found in the Hobbes Software Archive:
http://hobbes.nmsu.edu/cgi-bin/h-search?key=Run!
Read its documentation for more information.
Separating profiles from installation directory
-----------------------------------------------
To separate the locations of the user profile(s) (containing the bookmarks and
all customizations) from the installation directory to keep your preferences in
the case of an update even when using ZIP packages, set the variable
MOZILLA_HOME to a directory of your choice. You can do this either in
Config.sys or in a script or using a program object as listed above. If you add
set MOZILLA_HOME=f:\Data
the user profile(s) will be created in "f:\Data\Mozilla\Profiles".
Other important environment variables
-------------------------------------
There are a few enviroment variables that can be used to control special
behavior of Mozilla on OS/2:
- set NSPR_OS2_NO_HIRES_TIMER=1
This causes Mozilla not to use OS/2's high resolution timer. Set this if other
applications using the high resolution timer (multimedia apps) act strangely.
- set MOZILLA_USE_EXTENDED_FT2LIB=T
If you have the Innotek Font Engine installed this variable enables special
functions in Mozilla to handle unicode characters.
- set MOZ_NO_REMOTE=1
Use this to run two instances of Mozilla simultaneously (e.g. debug and
optimized version).
Find more information on this topic and other tips on
http://www.os2bbs.com/os2news/Warpzilla.html
Known Problems of the OS/2 version
----------------------------------
Cross-platform problems are usually listed in the release notes of each
milestone release.
- Bug 167884, "100% CPU load when viewing site [tiling transparent PNG]":
https://bugzilla.mozilla.org/show_bug.cgi?id=167884
On OS/2, Mozilla is known to have very slow performance on websites that use
small, repeated images with transparency for their layout.
Other known problems can be found by following the link "Current Open Warpzilla
Bugs" on the OS/2 Mozilla page <http://www.mozilla.org/ports/os2/>.

View File

@@ -0,0 +1,443 @@
<HEAD>
<TITLE>Building Mozilla on the Macintosh PPC platform</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B">
<P>
<HR>
</P>
<H1>Building Mozilla on the Macintosh PPC platform</H1>
<H2>Daniel Nunes, <A HREF="mailto:leaf@netscape.com"><TT>leaf@netscape.com</TT></A></H2>
<P>v 1.1, 1998-9-29<BR>
updated for the Pro4 IDE</P>
<P>
<HR>
<I>How to build Mozilla on a Macintosh PPC System.</I>
<HR>
</P>
<H2>1. <A HREF="#s1">Introduction</A></H2>
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
<UL>
<LI><A HREF="#ss2.1">2.1 Get the Code </A></LI>
<LI><A HREF="#ss2.2">2.2 Requirements</A></LI>
<LI><A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
<LI><A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
</UL>
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
<H2>4. <A HREF="#s4"> Credits </A></H2>
<P>
<HR>
</P>
<H2><A NAME=s1></A>1. Introduction</H2>
<P>What this document is: A guide to building the Mozilla
application. This includes:</P>
<OL>
<LI>A listing of the development tools you will need to build
Mozilla.</LI>
<LI>A list of environment variables you will need to set before
building.</LI>
</OL>
<P>If you're looking for documentation on developing features or
fixing bugs, the Mozilla <A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical
Documents </A> or <A HREF="http://www.mozilla.org/library.html">
Library </A> are probably what you're looking for.</P>
<P>
<HR>
</P>
<H2><A NAME=s2></A>2. Building Mozilla</H2>
<P>&nbsp;</P>
<UL>
<LI>Each of the following subsections describes, or gives
references to descriptions of, the steps necessary to build
Mozilla.
<H2><A NAME="ss2.1"></A>2.1 Get the Code</H2>
<P>&nbsp;</P>
<UL>
<LI>There are two principal ways of getting the code, <A HREF="http://www.mozilla.org/download.html">
ftp</A> and <A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
CVS will provide the most current code for building, but is
slower than ftp. Ftp drops are generally produced once per
month, and are known to compile.</LI>
</UL>
<P>&nbsp;</P>
<H2><A NAME="ss2.2"></A>2.2 Requirements</H2>
<P>The following need to be installed:</P>
<UL>
<LI>CodeWarrior (CW) Pro4 - obtainable from <A HREF="http://www.metrowerks.com">Metrowerks</A>.
See <A HREF="#s3">Common Sticking Points</A> if you have a
different version. Mozilla will no longer build with anything
earlier.</LI>
<LI>PowerPlant - obtainable from the CodeWarrior CD.</LI>
<LI>MSL - the Metrowerks Standard Library, obtainable from the
CodeWarrior CD</LI>
<LI><A HREF="ftp://ftp.boingo.com//dan/WASTE/waste-13.hqx">WASTE
1.3</A></LI>
<LI><A HREF="http://www.bact.wisc.edu/CWASTEEdit/CWASTEEdit.sit.hqx">CWASTE
1.6.2</A></LI>
<LI><A HREF="ftp://ftp.scripting.com/userland/menuSharingToolkit4.1.sit.hqx">Menu
Sharing Toolkit</A> (from UserLand)</LI>
<LI><A HREF="ftp://ftp.share.com/pub/internet-configuration/ICProgKit1.4.sit">Internet
Config 1.4 SDK</A></LI>
<LI><A HREF="http://www.mooseyard.com/Jens/Software/">AEGizmos
1.4.2</A></LI>
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_tool.bin">MacPerl
5 MPW Tool</A></LI>
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_appl.bin">MacPerl
5 Application</A></LI>
<LI>The module Mac:AppleEvents:Simple, which should be stored
in your Perl library folder under :Mac:AppleEvents:Simple.pm,
may be downloaded <A HREF="http://www.perl.com/CPAN-local/modules/by-module/Mac/Mac-AppleEvents-Simple-0.10.tgz">here</A>.</LI>
<LI>The module Mac:Apps:Launch, which should be stored in your
Perl library folder under :Mac:Apps:Launch.pm, may be
downloaded <A HREF="http://www.perl.com/CPAN-local/modules/by-module/Mac/Mac-Apps-Launch-1.30.tar.gz">here</A>.</LI>
<LI>MakeStub - MPW (installed with CodeWarrior Heaven option).
If you choose not to install MPW, it is located on the MacOS
Tools CD in "CW Pro 4 Tools:CodeWarrior MPW:MPW:Tools"</LI>
<LI>RunTSScript - in Mozilla source distribution
(mozilla:build:mac:RunTSScript), needs to be installed by
hand</LI>
<LI><A HREF="ftp://dev.apple.com/devworld/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/ToolServer.sit.hqx">ToolServer</A>
- or in the CW distribution (CW Pro 4 Tools:Apple Development
Tools:ToolServer 3.4.1.sit). <B>We recommend pulling it off the
CD</B> because it comes with configuration files for
CodeWarrior which you would have to create manually were you to
pull it off the net.</LI>
<LI><A HREF="http://sunsite.cnlab-switch.ch/ftp/software/platform/macos/src/HTML/MPW_C.html">patch
2.1</A></LI>
</UL>
<P>Hardware/OS</P>
<UL>
<LI>To build Navigator, you need a fast PPC Mac. The faster the
better.</LI>
<LI>You will need about 96 MB of physical RAM to "fast link"
the app. You can still fast link if you give your machine 96 MB
of virtual memory, but then the VM hit is large enough to
counteract any improvement. One of our beta testers had a
machine with only 64MB of physical RAM (VM was off) and it ran
out of memory trying to link. Turning VM on got it to link, but
build time increased greatly.</LI>
<LI>Reports from the net indicate that the optimized version
(MozillaPPC) take much less RAM to build than the 96MB we
suggest. If you are running out of memory, try building that
instead of the debug version (the debug symbols require a lot
of RAM come link time).</LI>
<LI>You should be ok with a 400MB disk partition, even when
fully built. This does not include tools like the IDE, just
source.</LI>
<LI>On an HFS+ volume, a full build takes about 110MB. HFS+ is
good, but utilities are sparse.</LI>
</UL>
<P>&nbsp;</P>
<H2><A NAME="ss2.3"></A>2.3 Setup the Build Environment</H2>
<P>&nbsp;</P>
<OL>
<LI>Install CodeWarrior from the CD. While it is large,
installing the "CodeWarrior Heaven" option will guarantee that
you have everything you need. This will give you PowerPlant,
MSL, and MPW. If you choose to install less, proceed at your
own risk.</LI>
<LI>In the Finder, increase the memory partition of the IDE to
15MB (you can get by with 12, if need be).</LI>
<LI>Uncompress the StuffIt Archive for ToolServer. The goal is
to let ToolServer and MPW share the same Tools directory so you
don't need to have multiple versions of tools. Do the
following:
<OL>
<LI>Open ToolServer's Tools folder. There is one file called
"RMetrowerks".</LI>
<LI>Move RMetrowerks to Tools folder of MPW. MPW folder must
be at "Metrowerks:Codewarrior MPW:MPW" if you installed
Codewarrior Heaven.</LI>
<LI>Remove ToolServer's Tools folder.</LI>
<LI>Now create an alias of Tools folder in "CodeWarrior MPW"
and move it to your ToolServer folder. Rename the alias
(probably called "Tools alias") to "Tools"</LI>
<LI><FONT COLOR="#FF0000"><B>IMPORTANT</B></FONT>: Make sure
you only have one instance of ToolServer on your machine. If
the build script finds the wrong one, the correct tools will
not be found and strange things will happen.</LI>
</OL>
</LI>
<LI>After installing the MacPerl MPW Tool distribution (run the
InstallerVISE application), in the "MacPerl &#131;" folder,
there will be an MPW tool named "perl". Install this in MPW's
tools folder.</LI>
<LI>Install the MacPerl Application (run the InstallerVISE
application). You can install this anywhere, but it is
recommended that you install it inside of your CodeWarrior
folder for easy reference. After installation, you will need to
set a preference to enable double-click launch of the perl
scripts. This preference is set by going under the Edit Menu to
Preferences. Click on the "Script" button and hit the radio
button "Run Scripts opened from Finder"</LI>
<LI>Install the "patch" and "MakeStub" Tools in the tools
folder. Note that "MakeStub" is automatically installed by the
"CodeWarrior Heaven" install option.</LI>
<LI>Install RunTSScript (found in the Mozilla source
distribution) in the compilers folder in your build environment
("Metrowerks:Metrowerks Codewarrior:Codewarrior
Plugins:Compilers")</LI>
<LI>Next, after downloading all the 3rd party software
components, drag WASTE, CWASTE, Menu Sharing, Internet Config,
and the AEGizmo folders (just as they are) into the "MacOS
Support" folder in your build environment.</LI>
<LI>Create a folder inside the PowerPlant folder
(Metrowerks:Metrowerks CodeWarrior:MacOS Support:PowerPlant)
called "_Will Be Obsolete" Make sure you include the leading
underscore.</LI>
<LI>Unstuff the obsolete LGA classes (located on the Reference
CD in "CodeWarrior Examples:MacOS Examples:PowerPlant
Examples:Obsolete PP Items:Old GA Classes.sit) and place the
resulting folder into the "_Will Be Obsolete" folder you
created in the previous step.</LI>
<LI>Start ToolServer from within CodeWarrior (or use MPW if you
are brave enough). We're about to patch some files. Make sure
the ToolServer menu is in the CodeWarrior menu bar by turning
on the <A HREF="IDEPrefs.gif">preference</A> under the "Extras"
panel in the IDE Preferences (not the project preferences!).
The menu bar should look like this:
<P><IMG SRC="IDEMenuBar.gif" WIDTH=359 HEIGHT=20 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
<P>Choose "Start ToolServer" from the ToolServer menu (this is
the icon menu between "Window" and "Help" in the menubar
above). You will now see a window with no close box. This is
your ToolServer Worksheet where you will type (or cut &amp;
paste) the commands for the following steps.</P>
<P>In case you have never used MPW/ToolServer before, the
following is <B>very important</B>. Pressing "return" does not
execute commands like you might think. It just inserts a
newline into the worksheet like a normal text editor. <B>To
actually get ToolServer to execute the command, you must press
"Enter" (lower right of numeric keypad).</B> This executes the
line that the cursor is on, and only that line. If you want to
execute multiple lines at once, select them all and hit
Enter.</P></LI>
<LI>Set the shell variables {IDE} and {Source} to the correct
paths for your build environment. {IDE} is where your
CodeWarrior IDE is located. {Source} is the folder containing
the toplevel "ns" folder of the Mozilla source. Mine look like
this (don't forget to keep the quotes if your path includes
spaces), yours will almost certainly be different
(<FONT COLOR="#FF0000">to punctuate this, the things you need
to change are in red</FONT>).
<PRE>Set IDE "<FONT COLOR="#FF0000">Develop:CW Pro 4:Metrowerks CodeWarrior:</FONT>"
Set Source "<FONT COLOR="#FF0000">Source:FreeSource:</FONT>"</PRE></LI>
<LI>Execute the following lines to patch menusharing.c to allow
it to compile with the new Universal Headers. It references an
obsolete header file (GestaltEqu.h).
<PRE>directory "{IDE}MacOS Support:Menu Sharing Toolkit 4.1:"
patch menusharing.c "{Source}mozilla:lib:mac:patches:menusharing.patch"</PRE></LI>
<LI>You need to patch stat.mac.h to fix a problem in MSL where
lines were omitted.
<PRE>directory "{IDE}Metrowerks Standard Library:MSL C:MSL Mac:Public Includes"
patch stat.mac.h "{Source}mozilla:lib:mac:patches:stat.mac.h.patch"</PRE></LI>
<LI>Congratulations! Now you are ready to build. Once these
steps are done, you don't have to repeat these setups the next
time!</LI>
</OL>
<P>&nbsp;</P>
<H2><A NAME="ss2.4"></A>2.4 Run the build</H2>
<UL>
<LI>In the folder mozilla:build:mac:, there are several Perl
scripts with names of the form BuildMozillaXXX.pl, where XXX is
"Optimized", "Debug", "Tinderbox", et al. Each script builds
the corresponding version of Mozilla. If you configured the
MacPerl application to execute scripts that are opened from the
finder, all you have to do is double click on the appropriate
one; otherwise, launch MacPerl, and run the appropriate script
from the "Run Script..." menu item.
<P>These `configured build' scripts are simple, and you might
want to make your own to force your build to StopForErrors(),
or alternatively DontStopForErrors(), et al. You can set up
certain build-script variables and (soon) compile-time flags.
Compare the supplied scripts to figure out what you might want.
Note that CodeWarriorLib, Moz.pm, and BuildList.pm, are
AppleScript libraries and Perl modules meant to be used by a
`configured build'. Use your favorite POD viewer (Shuck comes
with MacPerl) to view the documentation in the Perl
scripts.</P>
<P>If there were any errors in any of the projects along the
way, the script will stop at that point and the IDE will tell
you the errors. You can fix them and make sure they current
project builds, but to continue the automation, you have to
start from the beginning by double-clicking the script again.
This isn't quite as bad as it sounds because the previous
projects are already built (unless you changed some major
header file). Please note that stopping the script once it has
started is difficult. We are working to address this issue.</P>
<P>After the build is complete, you can find aliases to the
built libraries and the final Mozilla application. Debug builds
are built to Mozilla:dist:client_debug, while optimized builds
are built to Mozilla:dist:client.</P>
<P>Don't worry too much about the numerous warnings generated
during the build. We try our best to get the XP teams to use
real compilers, but alas, they continue to write warning-laden
code. There is also some generated code (Java is one example)
that has a lot of warnings that we can't help either. If you
write any new code, please help us in our quest to get zero
warnings.</P></LI>
</UL>
</LI>
</UL>
<P>
<HR>
</P>
<H2><A NAME=s3></A>3. Common Sticking Points</H2>
<UL>
<LI><B>I only have CodeWarrior Pro3 or Pro2. How do i build with
it?</B>
<UL>
<LI>Currently, the answer is, "You don't." We make use of
several classes in PowerPlant which recently appeared in Pro4.
Time to upgrade, I'm afraid. Don't even try opening the
projects with Pro2 because you will get data loss and have to
throw the project away (it won't even prompt you!)</LI>
</UL>
</LI>
<LI><B>I'm having problems building. MacPerl tells me it can't
fine MemAllocatorStubs</B>
<UL>
<LI>It sounds like your ToolServer environment is not setup
correctly. Make sure you follow the directions to the letter.
You could also be seeing this if you have multiple versions of
ToolServer on your computer and the Finder lauches the wrong
one. This is very common, as the <I>Carbon Dater</I> app from
Apple DTS contains a copy of ToolServer. Either remove all the
other versions of ToolServer or make sure you launch the
appropriate version before you start building.</LI>
</UL>
</LI>
<LI><B>The IDE runs out of memory building jsinterp.c. What do I
do?</B>
<UL>
<LI>We have seen this every now and then, and it only appears
to show up when building optimized (non-debug) builds. You can
normally get around this by building that file by itself
(select it and choose "Compile") and then continuing the make.
We're not sure why this is happening, so if you have any
answers or solutions, please let us know!</LI>
</UL>
</LI>
</UL>
<P>
<HR>
</P>
<H2><A NAME=s4></A>4. Credits</H2>
<UL>
<LI>The majority of this document is taken from the build document
included in the Mozilla source distribution at
README:mozilla:macbuild.htm written by Mike Pinkerton, <A HREF="mailto:pinkerton@netscape.com">
pinkerton@netscape.com</A>.</LI>
</UL>
</BODY>
</HTML>

View File

@@ -0,0 +1,158 @@
<HTML>
<HEAD>
<TITLE>Building Mozilla on unix platforms</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">
<HR>
<H1>
Building Mozilla on Unix platforms</H1>
<H2>
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT></H2>
v 1.1, June 1998
<P>
<HR><I>How to build Mozilla on a Unix System.</I>
<HR>
<H2>1. <A HREF="#s1">Introduction</A></H2>
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
<UL>
<LI>
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
<LI>
<A HREF="#ss2.2">2.2 Requirements</A></LI>
<LI>
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
<LI>
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
<LI>
<A HREF="#ss2.5">2.5 Run the Lizard </A></LI>
</UL>
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
<HR>
<H2><A NAME="s1">1. Introduction</A></H2>
<P>
What this document is: A guide to building the Mozilla application.
<BR>
This includes:
<OL>
<LI> A listing of the development tools you will need to build Mozilla. </LI>
<LI> A list of environment variables you will need to set before building. </LI>
</OL>
<P>
If you're looking for documentation on developing features or fixing bugs,
the Mozilla
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
are probably what you're looking for.
<P>
<HR>
<H2><A NAME="s2">2. Building Mozilla </A></H2>
<P>
<UL>Each of the following subsections describes, or gives references to
descriptions of, the steps necessary to build Mozilla.
</UL>
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
<P>
<UL>
There are two principal ways of getting the code,
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
CVS will provide the most current code for building, but is
slower than ftp. Ftp drops are generally produced once per month,
and are known to compile.
</UL>
<P>
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
<UL>
The following should be installed:
<UL>
<LI>Motif 1.2
<LI>The native C/C++ compiler (or GNU C/C++ compiler 2.7.2 in lieu of the
native compiler)
<LI>GNU make 3.74 or better
<LI>Perl (or, if you have no Perl, then set <CODE>PERL=/bin/echo</CODE>)
</UL>
<P>
Your hardware should be equal to, or better than:
<UL>
32 MB RAM, 128 MB swap (64 MB RAM recommended)
</UL>
</UL>
<P>
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
<P>
<UL>
The following environment variables need to be set:
<CODE>
<PRE>
MOZILLA_CLIENT=1
MOZ_MEDIUM=1
NO_MDUPDATE=1
</PRE>
</CODE>
Optionally, you can set <CODE>BUILD_OPT=1</CODE> if you don't want a debug
build.
<P>
If your Motif libraries are installed in a non-standard place, you can tell
the Mozilla makefiles where to look by setting
<CODE>MOZILLA_MOTIF_SEARCH_PATH</CODE> to point to the directory in which
your Motif installation resides.
<P>
Environment variables are set by the shell, and there are two common ways
of setting them. <BR>
Type <CODE>setenv VARIABLE value</CODE> or <CODE>export VARIABLE=value</CODE>.
<P>
</UL>
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
<UL>
Change to the directory you copied the source into (for example,
<CODE>cd /builds</CODE>). If this directory was empty before you
installed the source, there should be two directories here:
<CODE>README</CODE> and <CODE>mozilla</CODE>.
<CODE>
<PRE>
cd mozilla
gmake
</PRE>
</CODE>
</UL>
<H2><A NAME="ss2.5">2.5 After the build </A></H2>
<UL>
You may notice that if you try running mozilla-export right after the build,
you'll run into a problem. You need to set <CODE>LD_LIBRARY_PATH</CODE> to
<CODE>
${LD_LIBRARY_PATH}:/PATH_TO_SOURCE/mozilla/dist/Linux2.0.32_x86_OPT.OBJ/bin
</CODE> (where <CODE>PATH_TO_SOURCE</CODE> is the full path to your source
tree) before the dynamically linked binary will run. <BR><BR>
This varies by platform:<br>
<UL>
<LI>On HP-UX, the equivalent environment variable is <CODE>SHLIB_PATH</CODE>.
<LI>On AIX, the equivalent environment variable is <CODE>LIBPATH</CODE>.
</UL>
</UL>
<HR>
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
<LI>My linker dies with this error: undefined reference to `_Xsetlocale'
<UL>If this error occurs, you might have to recompile libX11.so
with the -DX_LOCALE flag (thanks to Scott Lampert,
<A HREF="mailto:fortunato@heavymetal.org">fortunato@heavymetal.org</A>).
</UL>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,217 @@
<HTML>
<HEAD>
<TITLE>Building Mozilla on Microsoft Windows 32-bit platforms</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">
<HR>
<H1>
Building Mozilla on Microsoft Windows 32-bit platforms</H1>
<H2>
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
</H2>
v 1.0, June 1998
<P>
<HR><I>How to build Mozilla on a Microsoft Windows 32-bit System.</I>
<HR>
<H2>1. <A HREF="#s1">Introduction</A></H2>
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
<UL>
<LI>
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
<LI>
<A HREF="#ss2.2">2.2 Requirements</A></LI>
<LI>
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
<LI>
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
</UL>
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
<HR>
<H2><A NAME="s1">1. Introduction</A></H2>
<P>
What this document is: A guide to building the Mozilla application.
<BR>
This includes:
<OL>
<LI> A listing of the development tools you will need to build Mozilla. </LI>
<LI> A list of environment variables you will need to set before building. </LI>
</OL>
<P>
If you're looking for documentation on developing features or fixing bugs,
the Mozilla
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
are probably what you're looking for.
<P>
<HR>
<H2><A NAME="s2">2. Building Mozilla </A></H2>
<P>
<UL>Each of the following subsections describes, or gives references to
descriptions of, the steps necessary to build Mozilla.
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
<P>
<UL>
There are two principal ways of getting the code,
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
CVS will provide the most current code for building, but is
slower than ftp. Ftp drops are generally produced once per month,
and are known to compile.
</UL>
<P>
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
<UL>
The following need to be installed:
<UL>
<LI>Microsoft Visual C++ version 4.2 or later
<LI>GNU Tools for Microsoft Windows, located:
<UL>
<LI><A HREF="http://www.cygnus.com/misc/gnu-win32">Cygnus</A></LI>
<LI><A HREF="http://www.gnu.org/order/ftp.html">GNU home page</A></LI>
<LI><A HREF="ftp://prep.ai.mit.edu/pub/gnu">MIT</A></LI>
</UL>
Specifically, you'll need:
<UL><CODE>
cp.exe<BR>
rm.exe<BR>
uname.exe<BR>
</CODE>
</UL>
Netscape has internally modified version of gmake, shmsdos and win32gnu
that we use to get around some problems we were having keeping in sync
with the Unix version of gmake. This version of gmake can be found in the
Windows Build Tools package, which can be ftp'd from
<A HREF="http://www.mozilla.org/download-mozilla.html"> the Mozilla
Download page</A>.
The three files you will need are:
<UL><CODE>
gmake.exe<BR>
shmsdos.exe<BR>
uname.exe<BR>
</CODE>
</UL>
</UL>
<P>
Hardware/OS
<UL>
<LI>Pentium 133 MHz or better</LI>
<LI>64 MB RAM, 128 MB recommended</LI>
<LI>250 MB NTFS or 500 MB FAT disk space</LI>
<LI>NT 4.0 is preferred; NT 3.51 will also work.
</LI>
</UL>
</UL>
<P>
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
<P>
<UL>
The following environment variables need to be set:
<UL>
<CODE>
set MOZ_BITS=32
<BR>
set MOZ_DEBUG=1 (set this only if you want to build a debug build)
<BR>
set MOZ_MEDIUM=1
<BR>
set MOZ_NT=351 (if running NT3.51)
<BR>
set MOZ_OUT=(optional: specifies location of resultant executable)
<BR>
set MOZ_SRC=(top of your tree, for example: set MOZ_SRC=d:\mozilla_source
if this is the directory where you checked or unzipped the source into)
<BR>
set MOZ_TOOLS=(the parent directory of the GNU tools 'bin' directory. The build
looks for MOZ_TOOLS\bin\gmake.exe, so make sure that the gmake.exe from
the Windows Build Tools package resides there.)
<BR>
set NSPR20=1
<BR>
set _MSC_VER=1100 (if you are running VC++ 5.0) or 1200
(if you are running VC++ 6.0)
<BR>
</CODE>
</UL>
<BR>
<P>
</UL>
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
<UL>
Change to the directory you copied the source into (for example,
<CODE>cd d:\mozilla_source</CODE>). If this directory was empty before you
installed the source, there should be two directories here:
<CODE>README</CODE> and <CODE>mozilla</CODE>.
<CODE>
<PRE>
cd mozilla\config
nmake /f makefile.win
cd ..
nmake /f client.mak
</PRE>
</CODE>
</UL>
</UL>
<HR>
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
<UL>
<LI><B>nmake has a 'fatal error', listing one of the GNU commands and a
hexadecimal return code.</B>
<UL>
This will happen as a result of not having the GNU tools and Windows Build
tools in your path. Add the directories with the appropriate binaries to your
path.
</UL>
</LI>
<LI>
<B>It fails with the message "'.\WIN32' unexpected": </B>
<UL>
You didn't properly
set the environment variables -- you must not include a space at the end
of the set statements (be careful if you are cut'n'pasting).
</UL>
</LI>
<LI>
<B>It fails to build, with directory-related errors: </B>
<UL>
The full path
to the source must not include any spaces. Additionally, the source must
be extracted with an intact directory structure by a utility that understands
long filenames. If in doubt, grab Info-Zip at
<A HREF="ftp://ftp.cdrom.com/pub/infozip">ftp://ftp.cdrom.com/pub/infozip</A>
</UL>
</LI>
<LI>
<B>It fails immediately with the message "Cannot find specified directory":
</B>
<UL>
You didn't properly set the environment variable MOZ_TOOLS;
this needs to be set to the path up to, but not including, the final \bin
directory in the path to the gnu tools. So, the path to the tool executables
is '%MOZ_TOOLS%\bin\<executable>'.
</UL>
</LI>
<LI>
<B>I'm not running a 32-bit windows system, how do i build?</B>
<UL>
Currently, the build process depends on a 32-bit operating system.
Windows NT 4.0 is the recommended windows operating system.
</UL>
</UL>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,400 @@
<HTML>
<HEAD>
<TITLE>Building Mozilla on the Macintosh PPC platform</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">
<HR>
<H1>
Building Mozilla on the Macintosh PPC platform</H1>
<H2>
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
</H2>
v 1.0, June 1998
<P>
<HR><I>How to build Mozilla on a Macintosh PPC System.</I>
<HR>
<H2>1. <A HREF="#s1">Introduction</A></H2>
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
<UL>
<LI>
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
<LI>
<A HREF="#ss2.2">2.2 Requirements</A></LI>
<LI>
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
<LI>
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
</UL>
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
<H2>4. <A HREF="#s4"> Credits </A></H2>
<HR>
<H2><A NAME="s1">1. Introduction</A></H2>
<P>
What this document is: A guide to building the Mozilla application.
This includes:
<OL>
<LI> A listing of the development tools you will need to build Mozilla. </LI>
<LI> A list of environment variables you will need to set before building. </LI>
</OL>
<P>
If you're looking for documentation on developing features or fixing bugs,
the Mozilla
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
are probably what you're looking for.
<P>
<HR>
<H2><A NAME="s2">2. Building Mozilla </A></H2>
<P>
<UL>Each of the following subsections describes, or gives references to
descriptions of, the steps necessary to build Mozilla.
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
<P>
<UL>
There are two principal ways of getting the code,
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
CVS will provide the most current code for building, but is
slower than ftp (takes longer to download).
</UL>
<P>
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
The following need to be installed:
<UL>
<LI>CodeWarrior (CW) 2 - obtainable from
<A HREF="http://www.metrowerks.com">Metrowerks</A>.
See <A HREF="#s3">Common Sticking Points</A> if you have a different
version.
</LI>
<LI>PowerPlant 1.8 - obtainable from the CodeWarrior CD.</LI>
<LI>MSL - the Metrowerks Standard Library, obtainable from the
CodeWarrior CD</LI>
<LI><A HREF="ftp://ftp.boingo.com//dan/WASTE/waste-13.hqx">WASTE
1.3</A></LI>
<LI><A HREF="http://www.bact.wisc.edu/CWASTEEdit/CWASTEEdit.sit.hqx">CWASTE
1.6.2</A></LI>
<LI>
<A HREF="ftp://ftp.scripting.com/userland/menuSharingToolkit4.1.sit.hqx">
Menu Sharing Toolkit</A> (from UserLand)</LI>
<LI>
<A HREF="ftp://ftp.digitalalchemy.com/pub/digitalalchemy/mercutio-SDK.sit.bin">
Mercutio 1.5 SDK</A> (only download the SDK, not the entire package, else
the access paths will be wrong)</LI>
<LI>
<A HREF="ftp://ftp.share.com/pub/internet-configuration/ICProgKit1.4.sit">
Internet Config 1.4 SDK</A></LI>
<LI><A HREF="http://www.mooseyard.com/Jens/Software/">AEGizmos
1.4.2</A></LI>
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_tool.bin">
MacPerl 5 MPW Tool</A></LI>
<LI>
<A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_appl.bin">MacPerl 5 Application</A></LI>
<LI>MakeStub - MPW (installed with CodeWarrior Heaven option). If
you choose not to install MPW, it is located on the MacOS Tools CD
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
<LI>RunTSScript - in Mozilla source distribution
(mozilla:build:mac:RunTSScript), needs to be installed by hand</LI>
<LI><A HREF="ftp://dev.apple.com/devworld/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/ToolServer.sit.hqx">ToolServer</A>
- or in the CW distribution (CW Pro 2 Tools:Apple Development
Tools:ToolServer 3.4.1.sit). <B>We recommend pulling it off the
CD</B> because it comes with configuration files for CodeWarrior
which you would have to create manually were you to pull it off
the net.</LI>
<LI>
<A HREF="http://people.netscape.com/sfraser/software/NewAlias_tool.sit.hqx">
New Alias MPW Tool</A> An MPW tool that creates Finder aliases for files.
</LI>
<LI>StreamEdit MPW Tool - MPW (installed with CodeWarrior Heaven option). If
you choose not to install MPW, it is located on the MacOS Tools CD
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
</LI>
<LI>
<A HREF="ftp://dev.apple.com/devworld/Periodicals/develop/develop25/develop_Issue_25_code/ToolFrontEnd.sit.hqx">ToolFrontEnd</A></LI>
<LI>
<A HREF="http://sunsite.cnlab-switch.ch/ftp/software/platform/macos/src/HTML/MPW_C.html">
patch 2.1</A></LI>
</UL>
<P>
Hardware/OS
<UL>
<LI>To build Navigator, you need a fast PPC Mac. The faster the
better. You can't build with a 68K machine because we have too many
resources, and the build process will crash when trying to generate
resources out of our cross-platform strings. See the discussion below
for a way around this.
</LI>
<LI>You will need about 96 MB of physical RAM to "fast link" the app.
You can still fast link if you give your machine 96 MB of virtual
memory, but then the VM hit is large enough to counteract any
improvement. One of our beta testers had a machine with only 64MB of
physical RAM (VM was off) and it ran out of memory trying to link.
Turning VM on got it to link, but build time increased greatly.
</LI>
<LI>Reports from the net indicate that the optimized version
(MozillaPPC) take much less RAM to build than the 96MB we suggest. If
you are running out of memory, try building that instead of the debug
version (the debug symbols require a lot of RAM come link time).
</LI>
<LI>You should be ok with a 400MB disk partition, even when fully
built. This does not include tools like the IDE, just source.
</LI>
<LI>On an HFS+ volume, a full build takes about 110MB. HFS+ is good,
but utilities are sparse.
</LI>
</UL>
<P>
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
<P>
<OL>
<LI>Install CodeWarrior from the CD. While it is large, installing
the "CodeWarrior Heaven" option will guarantee that you have
everything you need. This will give you PowerPlant, MSL, and MPW.
If you choose to install less, proceed at your own risk.</LI>
<LI>In the Finder, increase the memory partition of the IDE to
15MB (you can get by with 12, if need be).</LI>
<LI>Download ToolFrontEnd. After expanding it, in "ToolFrontEnd
Folder:Drop-Ins" there are three items:
<UL>
<LI><I>#include</I></LI>
<LI><I>ToolFrontEnd</I></LI>
<LI><I>ToolFrontEnd Panel</I></LI>
</UL>
<P>Create a folder named "Include Scanners". Place the file
"#include" into the Include Scanners folder. Move the Include
Scanners folder to the CodeWarrior Plugins folder. Create a folder
named "ToolFrontEnd". Place the files "ToolFrontEnd" and
"ToolFrontEnd Panel" into the ToolFrontEnd folder. Place this
folder in the CodeWarrior Plugins folder.</P></LI>
<LI>Open "ToolFrontEnd Panel" with ResEdit. Change the file type
from <B>'Panl'</B> to <B>'PanL'</B>. Save.</LI>
<LI>Uncompress the StuffIt Archive for ToolServer. The goal is to
let ToolServer and MPW share the same Tools directory so you don't
need to have multiple versions of tools. Do the following:
<OL>
<LI>Open ToolServer's Tools folder. There is one file called
"RMetrowerks". </LI>
<LI>Move RMetrowerks to Tools folder of MPW. MPW folder must be
at "Metrowerks:Codewarrior MPW:MPW" if you installed
Codewarrior Heaven. </LI>
<LI>Remove ToolServer's Tools folder.</LI>
<LI>Now create an alias of Tools folder in "CodeWarrior MPW"
and move it to your ToolServer folder. Rename the alias
(probably called "Tools alias") to "Tools"</LI>
<LI><FONT COLOR="#FF0000"><B>IMPORTANT</B></FONT>: Make sure
you only have one instance of ToolServer on your machine. If
the build script finds the wrong one, the correct tools will
not be found and strange things will happen.</LI>
</OL>
</LI>
<LI>After installing the MacPerl MPW Tool distribution (run the
InstallerVISE application), in the "MacPerl &#131;" folder, there
will be an MPW tool named "perl". Install this in MPW's tools
folder.</LI>
<LI>Install the MacPerl Application (run the
InstallerVISE application). You can install this anywhere, but it is
recommended that you install it inside of your CodeWarrior folder for
easy reference. After installation, you will need to set a preference
to enable double-click launch of the perl scripts. This preference is set
by going under the Edit Menu to Preferences. Click on the "Script" button
and hit the radio button "Run Scripts opened from Finder"</LI>
<LI>Install the "patch", "MakeStub", "NewAlias" and "StreamEdit" Tools in the
tools
folder. Note that "MakeStub" and "StreamEdit" are automatically installed by the
"CodeWarrior Heaven" install option.</LI>
<LI>Install RunTSScript (found in the Mozilla source distribution)
in the compilers folder in your build environment
("Metrowerks:Metrowerks Codewarrior:Codewarrior
Plugins:Compilers")</LI>
<LI>Next, after downloading all the 3rd party software components,
drag WASTE, CWASTE, Menu Sharing, Mercutio, Internet Config, and
the AEGizmo folders (just as they are) into the "MacOS Support"
folder in your build environment.</LI>
<LI>Start ToolServer from within CodeWarrior (or use MPW if you
are brave enough). We're about to patch some files. Make sure the
ToolServer menu is in the CodeWarrior menu bar by turning on the
<A HREF="IDEPrefs.gif">preference</A> under the "Extras" panel in
the IDE Preferences (not the project preferences!). The menu bar
should look like this:
<P><IMG SRC="IDEMenuBar.gif" WIDTH=359 HEIGHT=20 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
<P>Choose "Start ToolServer" from the ToolServer menu (this is the
icon menu between "Window" and "Help" in the menubar above). You
will now see a window with no close box. This is your ToolServer
Worksheet where you will type (or cut &amp; paste) the commands
for the following steps.</P>
<P>In case you have never used MPW/ToolServer before, the
following is <B>very important</B>. Pressing "return" does not
execute commands like you might think. It just inserts a newline
into the worksheet like a normal text editor. <B>To actually get
ToolServer to execute the command, you must press "Enter" (lower
right of numeric keypad).</B> This executes the line that the
cursor is on, and only that line. If you want to execute multiple
lines at once, select them all and hit Enter.</P></LI>
<LI>Set the shell variables {IDE} and {Source} to the correct
paths for your build environment. {IDE} is where your CodeWarrior
IDE is located. {Source} is the folder containing the toplevel
"ns" folder of the Mozilla source. Mine look like this (don't
forget to keep the quotes if your path includes spaces), yours
will almost certainly be different (<FONT COLOR="#FF0000">to
punctuate this, the things you need to change are in red</FONT>).
<PRE>Set IDE "<FONT COLOR="#FF0000">Develop:Source331 Build Environment:CW Pro 2:Metrowerks CodeWarrior:</FONT>"
Set Source "<FONT COLOR="#FF0000">Source:FreeSource:</FONT>"</PRE>
</LI>
<LI>If you are using CWPro2, execute the following lines to patch
LDropFlag to draw correcly over non-white backgrounds.
<PRE>directory "{IDE}MacOS Support:PowerPlant:_In Progress:_Table Classes:"
patch LDropFlag.cp "{Source}mozilla:lib:mac:patches:LDropFlag.patch"
duplicate -y "{Source}mozilla:lib:mac:patches:DropFlag Icons.rsrc" "{IDE}MacOS Support:PowerPlant:PowerPlant Resources:"</PRE></LI>
<LI>Execute the following lines to patch menusharing.c to allow it
to compile with the new Universal Headers. It references an
obsolete header file (GestaltEqu.h).
<PRE>directory "{IDE}MacOS Support:Menu Sharing Toolkit 4.1:"
patch menusharing.c "{Source}mozilla:lib:mac:patches:menusharing.patch"</PRE></LI>
<LI>If you are using CWPro2 straight off the CD, you need to patch
AppleEvents.r to fix a problem with the Universal Headers (the
definition of the 'aedt' resource was omitted). <B>You do not have
to do this if you have applied the netborne patch to Pro2e
</B> because it has been fixed.
<PRE>directory "{IDE}MacOS Support:Headers:Rez Headers:"
patch AppleEvents.r "{Source}mozilla:lib:mac:patches:AppleEvents.r.patch"</PRE></LI>
<LI>You need to patch stat.mac.h to fix a problem in MSL where
lines were omitted.
<PRE>directory "{IDE}Metrowerks Standard Library:MSL C:MSL Mac:Public Includes"
patch stat.mac.h "{Source}mozilla:lib:mac:patches:stat.mac.h.patch"</PRE></LI>
<LI>Congratulations! Now you are ready to build. Once these steps
are done, you don't have to repeat these setups the next
time!</LI>
</OL>
<P>
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
<UL>
<P>In the folder mozilla:build:mac:, there are several Perl scripts with
names of the form BuildMozillaXXX.pl, where XXX is "Optimized",
"Debug", "Tinderbox", et al. Each script builds the corresponding
version of Mozilla. If you configured the MacPerl application to
execute scripts that are opened from the finder, all you have to do is
double click on the appropriate one; otherwise, launch MacPerl, and
run the appropriate script from the "Run Script..." menu item.</P>
<P>These `configured build' scripts are simple, and you might want to
make your own to force your build to StopForErrors(), or alternatively
DontStopForErrors(), et al. You can set up certain build-script
variables and (soon) compile-time flags. Compare the supplied scripts
to figure out what you might want. Note that CodeWarriorLib, Moz.pm,
and BuildList.pm, are AppleScript libraries and Perl modules meant to
be used by a `configured build'. Use your favorite POD viewer (Shuck
comes with MacPerl) to view the documentation in the Perl scripts.</P>
<P>If there were any errors in any of the projects along the way, the
script will stop at that point and the IDE will tell you the errors.
You can fix them and make sure they current project builds, but to
continue the automation, you have to start from the beginning by
double-clicking the script again. This isn't quite as bad as it
sounds because the previous projects are already built (unless you
changed some major header file). Please note that stopping the script
once it has started is difficult. We are working to address
this issue.</P>
<P>After the build is complete, you can find aliases to the built libraries
and the final Mozilla application. Debug builds are built to
Mozilla:dist:client_debug, while optimized builds are built to Mozilla:dist:client.
</P>
<P>Don't worry too much about the numerous warnings generated during
the build. We try our best to get the XP teams to use real compilers,
but alas, they continue to write warning-laden code. There is also
some generated code (Java is one example) that has a lot of warnings
that we can't help either. If you write any new code, please help us
in our quest to get zero warnings.</P>
</UL>
</UL>
<HR>
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
<UL>
<LI><B>I have CodeWarrior3, how do i build with it?</B>
<UL> Currently, the answer is, "You don't." Eventually, the distribution
will be modified to allow building using CodeWarrior3, but for now
CodeWarrior2 is the only IDE that is supported.
</UL>
</LI>
</UL>
<HR>
<H2><A NAME="s4">4. Credits</A></H2>
<UL>
The majority of this document is taken from the build document included
in the Mozilla source distribution at README:mozilla:macbuild.htm written
by Mike Pinkerton, <A HREF="mailto:pinkerton@netscape.com">
pinkerton@netscape.com</A>.
</BODY>
</HTML>

View File

@@ -0,0 +1,163 @@
<HTML>
<HEAD>
<TITLE>Building the Mozilla client on unix platforms</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">
<HR>
<H1>Building the Mozilla client on Unix platforms</H1>
<H2>
Daniel Nunes, <TT><A HREF="mailto:leaf@mozilla.org">leaf@mozilla.org</A></TT></H2>
v 1.2, 1998-11-02
<P>
<HR><I>How to build Mozilla on a Unix System.</I>
<HR>
<H2>1. <A HREF="#s1">Introduction</A></H2>
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
<UL>
<LI>
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
<LI>
<A HREF="#ss2.2">2.2 Requirements</A></LI>
<LI>
<A HREF="#ss2.3">2.3 Build the Lizard</A></LI>
<LI>
<A HREF="#ss2.4">2.4 After the Build</A></LI>
</UL>
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
<HR>
<H2><A NAME="s1">1. Introduction</A></H2>
<P>
Perhaps you are interested in building classic Mozilla, before the
fall of the old layout engine, and the rise of the new. If so, the
<B><A HREF="classic-unix.html">Classic Mozilla Build document</A></B>
is what you're looking for.
<P>
<P>
What this document is: A guide to building the Mozilla application.
<BR>
This includes:
<OL>
<LI> A listing of the development tools you will need to build Mozilla. </LI>
<LI> A sample set of commands to build Mozilla using the Autoconf
build system. </LI>
</OL>
<P>
If you're looking for documentation on developing features or fixing bugs,
the Mozilla
<A HREF="../tplist.html">Technical Documents</A> or
<A HREF="../../../library.html"> Library </A>
are probably what you're looking for.
<P>
<HR>
<H2><A NAME="s2">2. Building Mozilla </A></H2>
<P>
<UL>Each of the following subsections describes, or gives references to
descriptions of, the steps necessary to build Mozilla.
</UL>
<UL>
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
<P>
<UL>
Eventually, there will be two principal ways of getting the code,
<A HREF="../../../download.html"> ftp</A> and
<A HREF="../../../cvs.html"> CVS</A>.
CVS will provide the most current code for building, but is
slower than ftp. Ftp drops are generally produced once per month,
and are known to compile on some machine, somewhere.
<B>For now</B>, however, you must do the following to obtain the newest
browser source:
<BR>
<CODE>
cvs co mozilla/nglayout.mk<BR>
cd mozilla<BR>
gmake -f nglayout.mk pull_all<BR>
</CODE>
<BR>
This should pull all the right source.
</UL>
<P>
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
<UL>
The following should be installed:
<UL>
<LI>Motif 1.2
<LI>The native C/C++ compiler (or GNU C/C++ compiler 2.7.2 in lieu of the
native compiler)
<LI>GNU make 3.74 or better
<LI>Perl5
<LI><A HREF="../../../projects/autoconf/">Autconf</A> requirements,
including NSPR.
<LI><CODE>LD_LIBRARY_PATH</CODE> must include the path to the NSPR
shared objects.<BR>
For most people, this means adding <CODE>/usr/local/nspr/lib</CODE>
to <CODE>LD_LIBRARY_PATH</CODE>
(either:
<BR>
<CODE>setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/usr/local/nspr/lib</CODE>
<BR>
or
<BR>
<CODE>export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/nspr/lib</CODE>
.<BR>
If you get an error like "No such variable" then omit the
<CODE>${LD_LIBRARY_PATH}:</CODE> part
)
</UL>
<P>
Your hardware should be equal to, or better than:
<UL>
32 MB RAM, 128 MB swap (64 MB RAM recommended)
</UL>
</UL>
<P>
<H2><A NAME="ss2.3">2.3 Build the Lizard</A></H2>
<P>
<UL>
<CODE>
autoconf<BR>
mkdir obj-`./build/autoconf/config.guess`<BR>
cd obj-`./build/autoconf/config.guess`<BR>
../configure --with-nspr=/usr/local/nspr --enable-toolkit=motif<BR>
gmake depend<BR>
gmake<BR>
</CODE>
</UL>
<H2><A NAME="ss2.4">2.4 After the build </A></H2>
<UL>
<LI> <CODE>cd dist/bin</CODE> and you should see links to the objects you
need to run <CODE>main</CODE>.
<LI>On most unixen LD_LIBRARY_PATH must be set to wherever the necessary
libraries are.
<UL>
<LI>On HP-UX, the equivalent environment variable is <CODE>SHLIB_PATH</CODE>.
<LI>On AIX, the equivalent environment variable is <CODE>LIBPATH</CODE>.
</UL>
</UL>
</UL>
<HR>
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
<LI>I'm sure there are bound to be some. Send
<A HREF="mailto:leaf@mozilla.org"> me</A> mail.
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,209 @@
<HTML>
<HEAD>
<TITLE>Building Mozilla on Microsoft Windows 32-bit platforms</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">
<HR>
<H1>
Building Mozilla on Microsoft Windows 32-bit platforms</H1>
<H2>
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
</H2>
v 1.0, June 1998
<P>
<HR><I>How to build Mozilla on a Microsoft Windows 32-bit System.</I>
<HR>
<H2>1. <A HREF="#s1">Introduction</A></H2>
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
<UL>
<LI>
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
<LI>
<A HREF="#ss2.2">2.2 Requirements</A></LI>
<LI>
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
<LI>
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
</UL>
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
<HR>
<H2><A NAME="s1">1. Introduction</A></H2>
<P>
What this document is: A guide to building the Mozilla application.
<BR>
This includes:
<OL>
<LI> A listing of the development tools you will need to build Mozilla. </LI>
<LI> A list of environment variables you will need to set before building. </LI>
</OL>
<P>
If you're looking for documentation on developing features or fixing bugs,
the Mozilla
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
are probably what you're looking for.
<P>
<HR>
<H2><A NAME="s2">2. Building Mozilla </A></H2>
<P>
<UL>Each of the following subsections describes, or gives references to
descriptions of, the steps necessary to build Mozilla.
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
<P>
<UL>
There are two principal ways of getting the code,
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
CVS will provide the least outdated code for building, but is
slower than ftp.
</UL>
<P>
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
<UL>
The following need to be installed:
<UL>
<LI>Microsoft Visual C++ version 4.2 or later
<LI>GNU Tools for Microsoft Windows, located:
<UL>
<LI><A HREF="http://www.cygnus.com/misc/gnu-win32">Cygnus</A></LI>
<LI><A HREF="http://www.gnu.org/order/ftp.html">GNU home page</A></LI>
<LI><A HREF="ftp://prep.ai.mit.edu/pub/gnu">MIT</A></LI>
</UL>
Specifically, you'll need:
<UL><CODE>
cp.exe<BR>
rm.exe<BR>
uname.exe<BR>
</CODE>
</UL>
Netscape has internally modified version of gmake, shmsdos and win32gnu
that we use to get around some problems we were having keeping in sync
with the Unix version of gmake. This version of gmake can be found in the
Windows Build Tools package, which can be ftp'd from
<A HREF="http://www.mozilla.org/download-mozilla.html"> the Mozilla
Download page</A>.
The three files you will need are:
<UL><CODE>
gmake.exe<BR>
shmsdos.exe<BR>
uname.exe<BR>
</CODE>
</UL>
</UL>
<P>
Hardware/OS
<UL>
<LI>Pentium 133 MHz or better</LI>
<LI>64 MB RAM, 128 MB recommended</LI>
<LI>250 MB NTFS or 500 MB FAT disk space</LI>
<LI>NT 4.0 is preferred; NT 3.51 will also work.
</LI>
</UL>
</UL>
<P>
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
<P>
<UL>
The following environment variables need to be set:
<UL>
<CODE>
set MOZ_BITS=32
<BR>
set MOZ_DEBUG=1 (set this only if you want to build a debug build)
<BR>
set MOZ_GOLD=1
<BR>
set MOZ_MEDIUM=1
<BR>
set MOZ_NT=351 (if running NT3.51)
<BR>
set MOZ_OUT=(optional: specifies location of resultant executable)
<BR>
set MOZ_SRC=(top of your tree, for example: set MOZ_SRC=d:\mozilla_source
if this is the directory where you checked or unzipped the source into)
<BR>
set MOZ_TOOLS=(location of the bin directory of your GNU tools. The build
looks for MOZ_TOOLS\bin\gmake.exe, so make sure that the gmake.exe from
the Windows Build Tools package resides there.)
<BR>
set NO_SECURITY=1
<BR>
set NSPR20=1
<BR>
set _MSC_VER=1100 (if you are running VC++ 5.0 or higher)
<BR>
</CODE>
</UL>
<BR>
<P>
</UL>
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
<UL>
Change to the directory you copied the source into (for example,
<CODE>cd d:\mozilla_source</CODE>). If this directory was empty before you
installed the source, there should be two directories here:
<CODE>README</CODE> and <CODE>mozilla</CODE>.
<CODE>
<PRE>
cd mozilla\config
nmake /f makefile.win
cd ..
nmake /f client.mak
</PRE>
</CODE>
</UL>
</UL>
<HR>
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
<UL>
<LI><B>nmake has a 'fatal error', listing one of the GNU commands and a
hexadecimal return code.</B>
<UL>
This will happen as a result of not having the GNU tools and Windows Build
tools in your path. Add the directories with the appropriate binaries to your
path.
</UL>
</LI>
<LI>
<B>It fails with the message "'.\WIN32' unexpected": </B>
<UL>
You didn't properly
set the environment variables -- you must not include a space at the end
of the set statements (be careful if you are cut'n'pasting).
</UL>
</LI>
<LI>
<B>It fails to build, with directory-related errors: </B>
<UL>
The full path
to the source must not include any spaces. Additionally, the source must
be extracted with an intact directory structure by a utility that understands
long filenames. If in doubt, grab Info-Zip at
<A HREF="ftp://ftp.cdrom.com/pub/infozip">ftp://ftp.cdrom.com/pub/infozip</A>
</UL>
</LI>
<LI>
<B>I'm not running a 32-bit windows system, how do i build?</B>
<UL>
Currently, the build process depends on a 32-bit operating system.
Windows NT 4.0 is the recommended windows operating system.
</UL>
</UL>
<HR>
</BODY>
</HTML>

View File

@@ -0,0 +1,53 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Chris Yeh">
<META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en]C-NSCP (WinNT; U) [Netscape]">
<TITLE>Running Mozilla...</TITLE>
</HEAD>
<BODY>
<H2>
<FONT FACE="Arial,Helvetica">Running Mozilla Without Trashing Netscape
Installation</FONT></H2>
This document explains how to run <TT>mozilla.exe</TT> separately from
<TT>netscape.exe</TT> without trashing your regular installation of Netscape
Communicator. This is necessary if, for example, you want to use Communicator's
mail client while you work on Mozilla development.
<BR>
<HR WIDTH="100%">
<OL>
<LI>
Before running <TT>mozilla.exe</TT>, create a new user profile either from
a Netscape 4.0x installation using the "User Profile Manager" shortcut
in the Utilities folder (on Windows) or by using&nbsp; the <TT>-new_account</TT>
option on the command line of either <TT>netscape.exe</TT> or <TT>mozilla.exe</TT>.&nbsp;
We suggest calling the profile "<TT>mozilla</TT>."</LI>
<LI>
Always use that new account when running <TT>mozilla.exe</TT>, and never
run <TT>netscape.exe</TT> using that same account profile.</LI>
</OL>
To make things easier, you can start the application with the user account
on the command line, for example:
<UL><TT>mozilla.exe -P"mozilla"</TT></UL>
This assures that prefs and the cache will not interfere between the two
versions. This will be especially
<BR>important as new prefs are added to the Mozilla product. Note that
you must use quotes around the name and there can be no space between the
"P" and the profile name. Otherwise, the application won't catch the profile
switch, and it will try to load the profile name as the initial URL.
<P>
<HR WIDTH="100%">
<BR>You can copy your <TT>bookmark.htm</TT> file from an existing profile
to your new profile directory if you want to share bookmarks.
<P>After the initial 3/31 release, we will add some code to Mozilla to
prevent running with a profile that is already being used by <TT>netscape.exe</TT>.
<BR>&nbsp;
<HR WIDTH="100%">
<BR><FONT SIZE=-1>Copyright &copy; 1998 <A HREF="http://home.netscape.com/misc/contact_info.html">Netscape
Communications Corporation</A></FONT>
</BODY>
</HTML>

View File

@@ -0,0 +1,184 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=x-mac-roman">
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (WinNT; I) [Netscape]">
<META NAME="KeyWords" CONTENT="client, source, documentation">
<META NAME="Author" CONTENT="Kipp E.B. Hickman">
<TITLE>NGLayout Windows Build Instructions</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H2>
<FONT FACE="Arial,Helvetica">NGLayout Windows Build Instructions</FONT></H2>
This document explains how to build NGLayout for the Windows platform.&nbsp;
<HR><B><FONT SIZE=+1>Required Tools:</FONT></B>
<UL>
<LI>
<B>Microsoft Visual C++ version 4.2 or later</B></LI>
<LI>
<B>The same set of tools for building <A HREF="http://www.mozilla.org/docs/tplist/catBuild/winbuild.htm">Mozilla</A></B></LI>
</UL>
<B><FONT SIZE=+1>Setting up:</FONT></B>
<UL>
<LI>
You need a Pentium with at least a 133 MHz processor and at least 250 megs
(NTFS partition) or 500 megs (FAT partition) of hard drive space. You need
to have a minimum of 64 megs of memory in order to build this tree. These
numbers are approximations.</LI>
<LI>
The preferred platform is NT 4.0. NT 3.51 will also work, and Win95 might
work if you're lucky. Maybe.</LI>
<LI>
Install MSVC. If you don't choose to have the MSVC install modify your
environment variables for PATH, INCLUDE, and LIB information, be sure to
run VCVARS32.BAT out of the MSVC bin directory prior to attempting to build.</LI>
<LI>
Download and install GNU tools. Put them in your path.</LI>
<LI>
Install NGLayout source.</LI>
<UL>
<LI>
cd &lt;your-source-area></LI>
<LI>
unzip -o -q win-19980415.zip</LI>
</UL>
<LI>
There are several environment variables you will need to set, either manually
or via a script within a command session, or by setting them in your system
environment located through the Control Panel | System icon.</LI>
<P>&nbsp;<B>Note: There is an additional variable for building NGLayout!
Use this list carefully!</B>
<P>&nbsp;The variables are:
<UL>
<LI>
set MOZ_BITS=32</LI>
<LI>
set MOZ_DEBUG=1 (don't set this if you want to build an optimized release
build)</LI>
<LI>
set MOZ_GOLD=1</LI>
<LI>
set MOZ_MEDIUM=1</LI>
<LI>
set MOZ_NT=351 (if running NT 3.51, don't set otherwise)</LI>
<LI>
set MOZ_OUT=(location of resulting executable and totally optional, see
Notes for more details)</LI>
<LI>
set MOZ_SRC=(top of your tree, drive letter and path, i.e. set MOZ_SRC=d:\mozilla_src.
The topmost directory under this should be mozilla)</LI>
<LI>
set MOZ_TOOLS=(location of the bin directory containing your GNU tools.
The build looks for MOZ_TOOLS\bin\gmake.exe, so make sure your MOZ_TOOLS
is figured appropriately)</LI>
<LI>
set NO_SECURITY=1</LI>
<LI>
set NSPR20=1</LI>
<LI>
if you are running VC++ 5.0 or higher: set _MSC_VER=1100; if you are running
VC++ 4.2 then set MOZ_VCVER=42</LI>
<LI>
<B>set STANDALONE_IMAGE_LIB=1</B></LI>
<LI>
<B>set MODULAR_NETLIB=1</B></LI>
</UL>
</UL>
<B><FONT SIZE=+1>Building:</FONT></B>
<UL>
<LI>
You need to be running a vanilla command prompt. Other shells may work,
but you might have to tweak makefiles.</LI>
<LI>
<B>Build the tools:</B> This generates several tools that handle things
like dependency generation</LI>
<UL>
<LI>
cd mozilla\config</LI>
<LI>
nmake /f makefile.win</LI>
</UL>
<LI>
<B>Build the NGLayout:</B> This will do a complete build of the source
tree. You will end up with a viewer.exe at the end. The viewer.exe will
be in your dist\win32_[OD].obj\bin directory (O will be used when you don't
set MOZ_DEBUG; D will be used when you set MOZ_DEBUG).</LI>
<UL>
<LI>
cd mozilla</LI>
<LI>
nmake /f nglayout.mak</LI>
</UL>
</UL>
<B><FONT SIZE=+1>Running:</FONT></B>
<UL>
<LI>
Once you have built the system, do this to run the viewer program (the
viewer program is a simple test program that uses the nsIWebWidget API
to embed a web widget object). The viewer program has a few basic menu
items, include "Samples" which load sample tests.</LI>
<UL>
<LI>
cd mozilla\dist\win32_[OD].obj\bin</LI>
<LI>
.\viewer.exe</LI>
</UL>
</UL>
<B><FONT SIZE=+1>Notes:</FONT></B>
<UL>
<LI>
This build process does not use Visual C++ generated project files for
several reasons having to do with (among other things) size, maintainability,
and the long term desire to start using more of tools like gmake, or plug
and play developer tools. This does not preclude you from using the Visual
C++ IDE, or it's debugger. Once you have built a viewer.exe do this to
run it under the debugger:</LI>
</UL>
<UL>
<UL>
<LI>
cd mozilla\dist\win32_[OD].obj\bin</LI>
<LI>
msdev viewer.exe</LI>
</UL>
</UL>
<HR WIDTH="100%">
<CENTER><FONT SIZE=-1>Copyright &copy; 1998 <A HREF="http://home.netscape.com/misc/contact_info.html">Netscape
Communications Corporation</A></FONT></CENTER>
&nbsp;
</BODY>
</HTML>

View File

@@ -1,49 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
DIRS = public src build
include $(topsrcdir)/config/rules.mk

File diff suppressed because it is too large Load Diff

View File

@@ -1,92 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 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 of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
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
GRE_MODULE = 1
LIBXUL_LIBRARY = 1
PACKAGE_FILE = accessibility.pkg
REQUIRES = xpcom \
$(NULL)
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/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \
$(NULL)
ifdef MOZ_XUL
SHARED_LIBRARY_LIBS += $(DIST)/lib/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
endif
EXTRA_DSO_LIBS = \
gkgfx \
$(NULL)
EXTRA_DSO_LDOPTS = \
$(LIBS_DIR) \
$(EXTRA_DSO_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
endif
include $(topsrcdir)/config/rules.mk

View File

@@ -1,18 +0,0 @@
[gecko]
#if SHARED_LIBRARY
dist/bin/components/@SHARED_LIBRARY@
#else
!staticcomp @LIBRARY@ @MODULE_NAME@
#endif
!xpt dist/bin/components/accessibility.xpt
#if MOZ_WIDGET_TOOLKIT==windows
!xpt dist/bin/components/accessibility-msaa.xpt
#elif MOZ_WIDGET_TOOLKIT==gtk2
!xpt dist/bin/components/accessibility-atk.xpt
#endif
# xxxbsmedberg why is this in the browser, but the other stuff in gecko?
[xpfe-browser browser]
#if MOZ_WIDGET_TOOLKIT==windows
dist/bin/AccessibleMarshal.dll
#endif

View File

@@ -1,82 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessibleRetrieval.h"
#include "nscore.h"
static NS_IMETHODIMP
NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
NS_ASSERTION(aOuter == nsnull, "no aggregation");
nsIAccessibilityService* accessibility;
rv = NS_GetAccessibilityService(&accessibility);
if (NS_FAILED(rv)) {
NS_ERROR("Unable to construct accessibility service");
return rv;
}
rv = accessibility->QueryInterface(aIID, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
NS_RELEASE(accessibility);
return rv;
}
// The list of components we register
static const nsModuleComponentInfo components[] =
{
{ "AccessibilityService",
NS_ACCESSIBILITY_SERVICE_CID,
"@mozilla.org/accessibilityService;1",
NS_ConstructAccessibilityService
},
{ "AccessibleRetrieval",
NS_ACCESSIBLE_RETRIEVAL_CID,
"@mozilla.org/accessibleRetrieval;1",
NS_ConstructAccessibilityService
},
};
NS_IMPL_NSGETMODULE(nsAccessibilityModule, components)

View File

@@ -1,74 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
DIRS = atk
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
DIRS = msaa
endif
endif
MODULE = accessibility
XPIDL_MODULE= accessibility
GRE_MODULE = 1
XPIDLSRCS = \
nsIAccessibilityService.idl \
nsIAccessibleRetrieval.idl \
nsIAccessible.idl \
nsPIAccessible.idl \
nsIAccessibleCaret.idl \
nsIAccessibleDocument.idl \
nsPIAccessibleDocument.idl \
nsIAccessibleProvider.idl \
nsIAccessibleSelectable.idl \
nsIAccessibleTreeCache.idl \
nsIAccessNode.idl \
nsPIAccessNode.idl \
nsIAccessibleEvent.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,60 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Sun Microsystems, Inc.
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
XPIDL_MODULE = accessibility-atk
GRE_MODULE = 1
XPIDLSRCS = \
nsIAccessibleAction.idl \
nsIAccessibleEditableText.idl \
nsIAccessibleHyperLink.idl \
nsIAccessibleHyperText.idl \
nsIAccessibleTable.idl \
nsIAccessibleText.idl \
nsIAccessibleValue.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,66 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
[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.
*/

View File

@@ -1,68 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
[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.
*/

View File

@@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIURI;
interface nsIAccessible;
[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 ();
boolean isSelected ();
};
/*
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?
*/

View File

@@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bill Haneman (bill.haneman@sun.com)
* Paul Sandoz (paul.sandoz@sun.com)
* John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#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);
long getSelectedLinkIndex ();
};

View File

@@ -1,82 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessible;
[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);
};

View File

@@ -1,144 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
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);
AString getTextBeforeOffset (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);
void getCharacterExtents (in long offset,
out long x,
out long y,
out long width,
out long height,
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).
*/

View File

@@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
[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.
*/

View File

@@ -1,25 +0,0 @@
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( ISimpleDOMDocument )
EXTERN_PROXY_FILE( ISimpleDOMNode )
EXTERN_PROXY_FILE( ISimpleDOMText )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( ISimpleDOMDocument ),
REFERENCE_PROXY_FILE( ISimpleDOMNode ),
REFERENCE_PROXY_FILE( ISimpleDOMText ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif

View File

@@ -1,7 +0,0 @@
LIBRARY AccessibleMarshal.dll
DESCRIPTION 'ISimpleDOM* proxy/stub DLLs - allows cross-process communication'
EXPORTS DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE

View File

@@ -1,126 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.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: Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("//")
cpp_quote("// ISimpleDOMDocument")
cpp_quote("//")
cpp_quote("// @STATUS UNDER_REVIEW")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("//")
cpp_quote("// get_URL(out] BSTR *url)")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Get the internet URL associated with this document.")
cpp_quote("//")
cpp_quote("// get_title([out BSTR *title")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Get the document's title from the <TITLE> element")
cpp_quote("//")
cpp_quote("// get_mimeType([out BSTR *mimeType")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Get the registered mime type, such as text/html")
cpp_quote("//")
cpp_quote("// get_docType([out] BSTR *docType")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Get doctype associated with the <!DOCTYPE ..> element")
cpp_quote("//")
cpp_quote("// get_nameSpaceURIForID([in] short nameSpaceID, [out] BSTR *nameSpaceURI)")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Some of the methods for ISimpleDOMNode return a nameSpaceID (-1,0,1,2,3,....)")
cpp_quote("// This method returns the associated namespace URI for each ID.")
cpp_quote("//")
cpp_quote("// set_alternateViewMediaTypes([in] BSTR *commaSeparatedMediaType)")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// For style property retrieval on nsISimpleDOMNode elements, ")
cpp_quote("// set the additional alternate media types that properties are available for.")
cpp_quote("// [in] BSTR *commaSeparatedMediaTypes is a comma separate list, for example \"aural, braille\".")
cpp_quote("// The alternate media properties are requested with nsISimpleDOMNode::get_computedStyle.")
cpp_quote("// Note: setting this value on a document will increase memory overhead, and may create a small delay.")
cpp_quote("//")
cpp_quote("// W3C media Types:")
cpp_quote("// * all: Suitable for all devices. ")
cpp_quote("// * aural: Intended for speech synthesizers. See the section on aural style sheets for details. ")
cpp_quote("// * braille: Intended for braille tactile feedback devices. ")
cpp_quote("// * embossed: Intended for paged braille printers. ")
cpp_quote("// * handheld: Intended for handheld devices - typically small screen, monochrome, limited bandwidth. ")
cpp_quote("// * print: Intended for paged, opaque material and for documents viewed on screen in print preview mode. Please consult the section on paged media for information about formatting issues that are specific to paged media. ")
cpp_quote("// * projection: Intended for projected presentations, for example projectors or print to transparencies. Please consult the section on paged media for information about formatting issues that are specific to paged media. ")
cpp_quote("// * screen: Intended primarily for color computer screens. ")
cpp_quote("// * tty: intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. Authors should not use pixel units with the tty media type. ")
cpp_quote("// * tv: Intended for television-type devices - low resolution, color, limited-scrollability screens, sound")
cpp_quote("// * See latest W3C CSS specs for complete list of media types")
cpp_quote("//")
cpp_quote("//")
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("")
cpp_quote("")
import "objidl.idl";
import "oaidl.idl";
const long DISPID_DOC_URL = -5904;
const long DISPID_DOC_TITLE = -5905;
const long DISPID_DOC_MIMETYPE = -5906;
const long DISPID_DOC_DOCTYPE = -5907;
const long DISPID_DOC_NAMESPACE = -5908;
const long DISPID_DOC_MEDIATYPES = -5909;
[object, uuid(0D68D6D0-D93D-4d08-A30D-F00DD1F45B24)]
interface ISimpleDOMDocument : IUnknown
{
[propget, id(DISPID_DOC_URL)] HRESULT URL(
[out, retval] BSTR * url
);
[propget, id(DISPID_DOC_TITLE)] HRESULT title(
[out, retval] BSTR * title
);
[propget, id(DISPID_DOC_MIMETYPE)] HRESULT mimeType(
[out, retval] BSTR * mimeType
);
[propget, id(DISPID_DOC_DOCTYPE)] HRESULT docType(
[out, retval] BSTR * docType
);
[propget, id(DISPID_DOC_NAMESPACE)] HRESULT nameSpaceURIForID(
[in] short nameSpaceID,
[out, retval] BSTR * nameSpaceURI
);
[propput, id(DISPID_DOC_MEDIATYPES)] HRESULT alternateViewMediaTypes(
[in] BSTR * commaSeparatedMediaTypes
);
}

View File

@@ -1,216 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.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: Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("//")
cpp_quote("// ISimpleDOMNode")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// An interface that extends MSAA's IAccessible to provide readonly DOM node information via cross-process COM.")
cpp_quote("//")
cpp_quote("// @STATUS UNDER_REVIEW")
cpp_quote("//")
cpp_quote("// get_nodeInfo(")
cpp_quote("// /* [out] */ BSTR *nodeName, // For elements, this is the tag name")
cpp_quote("// /* [out] */ short *nameSpaceID,")
cpp_quote("// /* [out] */ BSTR *nodeValue, ")
cpp_quote("// /* [out] */ unsigned int *numChildren); ")
cpp_quote("// /* [out] */ unsigned int *uniqueID; // In Win32 accessible events we generate, the target's childID matches to this")
cpp_quote("// /* [out] */ unsigned short *nodeType,")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Get the basic information about a node.")
cpp_quote("// The namespace ID can be mapped to an URI using nsISimpleDOMDocument::get_nameSpaceURIForID()")
cpp_quote("//")
cpp_quote("// get_attributes(")
cpp_quote("// /* [in] */ unsigned short maxAttribs,")
cpp_quote("// /* [out] */ unsigned short *numAttribs,")
cpp_quote("// /* [out] */ BSTR *attribNames,")
cpp_quote("// /* [out] */ short *nameSpaceID,")
cpp_quote("// /* [out] */ BSTR *attribValues);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Returns 3 arrays - the attribute names and values, and a namespace ID for each")
cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
cpp_quote("//")
cpp_quote("// get_attributesForNames(")
cpp_quote("// /* [in] */ unsigned short numAttribs,")
cpp_quote("// /* [in] */ BSTR *attribNames,")
cpp_quote("// /* [in] */ short *nameSpaceID,")
cpp_quote("// /* [out] */ BSTR *attribValues);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Takes 2 arrays - the attribute names and namespace IDs, and returns an array of corresponding values")
cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
cpp_quote("//")
cpp_quote("// computedStyle( ")
cpp_quote("// /* [in] */ unsigned short maxStyleProperties,")
cpp_quote("// /* [out] */ unsigned short *numStyleProperties, ")
cpp_quote("// /* [in] */ boolean useAlternateView, // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
cpp_quote("// /* [out] */ BSTR *styleProperties, ")
cpp_quote("// /* [out] */ BSTR *styleValues);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Returns 2 arrays -- the style properties and their values")
cpp_quote("// useAlternateView=FALSE: gets properties for the default media type (usually screen)")
cpp_quote("// useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
cpp_quote("//")
cpp_quote("// computedStyleForProperties( ")
cpp_quote("// /* [in] */ unsigned short numStyleProperties, ")
cpp_quote("// /* [in] */ boolean useAlternateView, // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
cpp_quote("// /* [in] */ BSTR *styleProperties, ")
cpp_quote("// /* [out] */ BSTR *styleValues);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Scroll the current view so that this dom node is visible.")
cpp_quote("// placeTopLeft=TRUE: scroll until the top left corner of the dom node is at the top left corner of the view.")
cpp_quote("// placeTopLeft=FALSE: scroll minimally to make the dom node visible. Don't scroll at all if already visible.")
cpp_quote("//")
cpp_quote("// scrollTo( ")
cpp_quote("// /* [in] */ boolean placeTopLeft); ")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Returns style property values for those properties in the styleProperties [in] array")
cpp_quote("// Returns 2 arrays -- the style properties and their values")
cpp_quote("// useAlternateView=FALSE: gets properties for the default media type (usually screen)")
cpp_quote("// useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
cpp_quote("//")
cpp_quote("// get_parentNode (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_firstChild (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_lastChild (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_previousSibling(/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_nextSibling (/* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// get_childAt (/* [in] */ unsigned childIndex, /* [out] */ ISimpleDOMNode **newNodePtr);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// DOM navigation - get a different node.")
cpp_quote("//")
cpp_quote("// get_innerHTML(/* [out] */ BSTR *htmlText);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Returns HTML of this DOM node's subtree. Does not include the start and end tag for this node/element.")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// get_language(/* [out] */ BSTR *htmlText);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Returns the computed language for this node, or empty string if unknown.")
cpp_quote("//")
cpp_quote("//")
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("")
cpp_quote("")
import "objidl.idl";
import "oaidl.idl";
const long DISPID_NODE_NODEINFO = -5900;
const long DISPID_NODE_ATTRIBUTES = -5901;
const long DISPID_NODE_ATTRIBUTESFORNAMES = -5902;
const long DISPID_NODE_COMPSTYLE = -5903;
const long DISPID_NODE_COMPSTYLEFORPROPS = -5904;
const long DISPID_NODE_LANGUAGE = -5905;
[object, uuid(1814ceeb-49e2-407f-af99-fa755a7d2607)]
interface ISimpleDOMNode : IUnknown
{
const unsigned short NODETYPE_ELEMENT = 1;
const unsigned short NODETYPE_ATTRIBUTE = 2;
const unsigned short NODETYPE_TEXT = 3;
const unsigned short NODETYPE_CDATA_SECTION = 4;
const unsigned short NODETYPE_ENTITY_REFERENCE = 5;
const unsigned short NODETYPE_ENTITY = 6;
const unsigned short NODETYPE_PROCESSING_INSTRUCTION = 7;
const unsigned short NODETYPE_COMMENT = 8;
const unsigned short NODETYPE_DOCUMENT = 9;
const unsigned short NODETYPE_DOCUMENT_TYPE = 10;
const unsigned short NODETYPE_DOCUMENT_FRAGMENT = 11;
const unsigned short NODETYPE_NOTATION = 12;
[propget, id(DISPID_NODE_NODEINFO)] HRESULT nodeInfo(
[out] BSTR *nodeName, // for performance returns NULL for text nodes (true nodeName would be "#text")
[out] short *nameSpaceID,
[out] BSTR *nodeValue,
[out] unsigned int *numChildren,
[out] unsigned int *uniqueID, // In Win32 accessible events we generate, the target's childID matches to this
[out, retval] unsigned short *nodeType
);
[propget, id(DISPID_NODE_ATTRIBUTES)] HRESULT attributes(
[in] unsigned short maxAttribs,
[out, size_is(maxAttribs), length_is(*numAttribs)] BSTR *attribNames,
[out, size_is(maxAttribs), length_is(*numAttribs)] short *nameSpaceID,
[out, size_is(maxAttribs), length_is(*numAttribs)] BSTR *attribValues,
[out, retval] unsigned short *numAttribs
);
[propget, id(DISPID_NODE_ATTRIBUTESFORNAMES)] HRESULT attributesForNames(
[in] unsigned short numAttribs,
[in, size_is(numAttribs), length_is(numAttribs)] BSTR *attribNames,
[in, size_is(numAttribs), length_is(numAttribs)] short *nameSpaceID,
[out, retval, size_is(numAttribs), length_is(numAttribs)] BSTR *attribValues
);
[propget, id(DISPID_NODE_COMPSTYLE)] HRESULT computedStyle(
[in] unsigned short maxStyleProperties,
[in] boolean useAlternateView, // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes
[out, size_is(maxStyleProperties), length_is(*numStyleProperties)] BSTR *styleProperties,
[out, size_is(maxStyleProperties), length_is(*numStyleProperties)] BSTR *styleValues,
[out, retval] unsigned short *numStyleProperties
);
[propget, id(DISPID_NODE_COMPSTYLEFORPROPS)] HRESULT computedStyleForProperties(
[in] unsigned short numStyleProperties,
[in] boolean useAlternateView, // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes
[in, size_is(numStyleProperties), length_is(numStyleProperties)] BSTR *styleProperties,
[out, retval, size_is(numStyleProperties), length_is(numStyleProperties)] BSTR *styleValues
);
HRESULT scrollTo([in] boolean placeTopLeft);
[propget] HRESULT parentNode([out, retval] ISimpleDOMNode **node);
[propget] HRESULT firstChild([out, retval] ISimpleDOMNode **node);
[propget] HRESULT lastChild([out, retval] ISimpleDOMNode **node);
[propget] HRESULT previousSibling([out, retval] ISimpleDOMNode **node);
[propget] HRESULT nextSibling([out, retval] ISimpleDOMNode **node);
[propget] HRESULT childAt([in] unsigned childIndex,
[out, retval] ISimpleDOMNode **node);
[propget] HRESULT innerHTML([out, retval] BSTR *innerHTML);
[propget, local] HRESULT localInterface([out][retval] void **localInterface);
[propget, id(DISPID_NODE_LANGUAGE)] HRESULT language([out, retval] BSTR *language);
}

View File

@@ -1,113 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
import "objidl.idl";
import "oaidl.idl";
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("//")
cpp_quote("// ISimpleDOMText")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// An interface that extends MSAA's IAccessible to provide important additional capabilities on text nodes")
cpp_quote("//")
cpp_quote("// @STATUS UNDER_REVIEW")
cpp_quote("//")
cpp_quote("// [propget] domText(/* out,retval */ BSTR *domText")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Similar to IAccessible::get_accName, but does not strip out whitespace characters.")
cpp_quote("// Important for retrieving the correct start/end substring indices to use with other")
cpp_quote("// methods in ISimpleDOMText.")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// get_[un]clippedSubstringBounds(")
cpp_quote("// /* [in] */ unsigned int startIndex,")
cpp_quote("// /* [in] */ unsigned int endIndex,")
cpp_quote("// /* [out] */ int *x,")
cpp_quote("// /* [out] */ int *y,")
cpp_quote("// /* [out] */ int *width,")
cpp_quote("// /* [out] */ int *height);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Both methods get_clippedSubstringBounds and get_unclippedSubstringBounds return the screen pixel")
cpp_quote("// coordinates of the given text substring. The in parameters for start and end indices refer")
cpp_quote("// to the string returned by ISimpleDOMText::get_domText().")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// scrollToSubstring(")
cpp_quote("// /* [in] */ unsigned int startIndex,")
cpp_quote("// /* [in] */ unsigned int endIndex);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// In scrollable views, scrolls to ensure that the specified substring is visible onscreen.")
cpp_quote("// The in parameters for start and end indices refer to the string returned")
cpp_quote("// by ISimpleDOMText::get_domText().")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// [propget] fontFamily(/* out,retval */ BSTR *fontFamily);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Return a single computed font family name, which is better than the comma delineated list")
cpp_quote("// that is returned by the ISimpleDOMNode computed style methods for font-family.")
cpp_quote("// In other words, return something like 'Arial' instead of 'Arial, Helvetica, Sans-serif'.")
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("")
cpp_quote("")
[object, uuid(4e747be5-2052-4265-8af0-8ecad7aad1c0)]
interface ISimpleDOMText: IUnknown
{
// Includes whitespace in DOM
[propget] HRESULT domText([out, retval] BSTR *domText);
HRESULT get_clippedSubstringBounds([in] unsigned int startIndex,
[in] unsigned int endIndex,
[out] int *x,
[out] int *y,
[out] int *width,
[out] int *height);
HRESULT get_unclippedSubstringBounds([in] unsigned int startIndex,
[in] unsigned int endIndex,
[out] int *x,
[out] int *y,
[out] int *width,
[out] int *height);
HRESULT scrollToSubstring([in] unsigned int startIndex,
[in] unsigned int endIndex);
[propget] HRESULT fontFamily([out, retval] BSTR *fontFamily);
};

View File

@@ -1,119 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is
# Aaron Leventhal
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Chase Phillips <cmp@mozilla.org>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
LIBRARY_NAME = AccessibleMarshal
MODULE = accessibility
XPIDL_MODULE = accessibility-msaa
GRE_MODULE = 1
DEFFILE = $(win_srcdir)/AccessibleMarshal.def
include $(DEPTH)/config/autoconf.mk
XPIDLSRCS = \
nsIAccessibleWin32Object.idl \
$(NULL)
DEFINES += -DREGISTER_PROXY_DLL -D_WIN32_WINNT=0x400
GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
FORCE_SHARED_LIB = 1
SRCS_IN_OBJDIR = 1
CSRCS = \
AccessibleMarshal.c \
ISimpleDOMNode_p.c \
ISimpleDOMNode_i.c \
ISimpleDOMDocument_p.c \
ISimpleDOMDocument_i.c \
ISimpleDOMText_p.c \
ISimpleDOMText_i.c \
$(NULL)
MIDL_GENERATED_FILES = \
ISimpleDOMNode.h \
ISimpleDOMNode_p.c \
ISimpleDOMNode_i.c \
ISimpleDOMDocument.h \
ISimpleDOMDocument_p.c \
ISimpleDOMDocument_i.c \
ISimpleDOMText.h \
ISimpleDOMText_p.c \
ISimpleDOMText_i.c \
$(NULL)
SRCDIR_CSRCS = $(addprefix $(srcdir)/,$(CSRCS))
OS_LIBS = \
kernel32.lib \
rpcndr.lib \
rpcns4.lib \
rpcrt4.lib \
oleaut32.lib \
$(NULL)
$(MIDL_GENERATED_FILES): done_gen
done_gen: ISimpleDOMNode.idl ISimpleDOMDocument.idl ISimpleDOMText.idl
$(MIDL) $(MIDL_FLAGS) -Oicf $(srcdir)/ISimpleDOMNode.idl
$(MIDL) $(MIDL_FLAGS) -Oicf $(srcdir)/ISimpleDOMDocument.idl
$(MIDL) $(MIDL_FLAGS) -Oicf $(srcdir)/ISimpleDOMText.idl
touch $@
EXPORTS = \
ISimpleDOMNode.h \
ISimpleDOMNode_i.c \
ISimpleDOMDocument.h \
ISimpleDOMDocument_i.c \
ISimpleDOMText.h \
ISimpleDOMText_i.c \
$(NULL)
export:: done_gen
# This marshall dll is also registered in the installer
register::
regsvr32 -s $(DIST)/bin/$(SHARED_LIBRARY)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,46 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
[scriptable, uuid(ca7a3a93-822f-4cdf-8cb4-c52d16b9afc7)]
interface nsIAccessibleWin32Object : nsISupports
{
/** handle to the external window implementing IAccessible */
[noscript] readonly attribute voidPtr hwnd;
};

View File

@@ -1,141 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMNode;
interface nsIAccessibleDocument;
/**
* An interface used by in-process accessibility clients
* to get style, window, markup and other information about
* a DOM node. When accessibility is active in Gecko,
* every DOM node can have one nsIAccessNode for each
* pres shell the DOM node is rendered in.
* The nsIAccessNode implementations are instantiated lazily.
* The nsIAccessNode tree for a given dom window
* has a one to one relationship to the DOM tree.
* If the DOM node for this access node is "accessible",
* then a QueryInterface to nsIAccessible will succeed.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(46820F9B-3088-4046-AB0F-56FDACDC7A82)]
interface nsIAccessNode : nsISupports
{
/**
* The DOM node this nsIAccessNode is associated with.
*/
readonly attribute nsIDOMNode DOMNode;
/**
* The number of DOM children for the DOM node, which
* matches the number of nsIAccessNode children for this
* nsIAccessNode.
*/
readonly attribute long numChildren;
/**
* Get the nth child of this node
* @param childNum Zero-based child index
* @return The nth nsIAccessNode child
*/
nsIAccessNode getChildNodeAt(in long childNum);
/**
* The parent nsIAccessNode
*/
readonly attribute nsIAccessNode parentNode;
/**
* The first nsIAccessNode child
*/
readonly attribute nsIAccessNode firstChildNode;
/**
* The last nsIAccessNode child
*/
readonly attribute nsIAccessNode lastChildNode;
/**
* The previous nsIAccessNode sibling
*/
readonly attribute nsIAccessNode previousSiblingNode;
/**
* The next nsIAccessNode sibling
*/
readonly attribute nsIAccessNode nextSiblingNode;
/**
* The nsIAccessibleDocument that this nsIAccessNode
* resides in.
*/
readonly attribute nsIAccessibleDocument accessibleDocument;
/**
* The innerHTML for the DOM node
* This is a text string of all the markup inside the DOM
* node, not including the start and end tag for the node.
*/
readonly attribute DOMString innerHTML;
/**
* The OS window handle for the window this node
* is being displayed in.
*/
[noscript] readonly attribute voidPtr ownerWindow;
/**
* A unique ID calculated for this DOM node, for the
* purposes of caching and referencing this object.
*/
[noscript] readonly attribute voidPtr uniqueID;
/**
* Retrieve the computed style value for this DOM node, if it is a DOM element.
* Note: the meanings of width, height and other size measurements depend
* on the version of CSS being used. Therefore, for bounds information,
* it is better to use nsIAccessible::accGetBounds.
* @param pseudoElt The pseudo element to retrieve style for, or NULL
* for general computed style information for this node.
* @param propertyName Retrieve the computed style value for this property name,
* for example "border-bottom".
*/
DOMString getComputedStyleValue(in DOMString pseudoElt, in DOMString propertyName);
};

View File

@@ -1,150 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIAccessibleRetrieval.idl"
interface nsIAccessibleEventListener;
interface nsIDocument;
interface nsIFrame;
interface nsObjectFrame;
interface nsIContent;
[scriptable, uuid(09a39069-a138-40dd-91dd-79ce45742b52)]
interface nsIAccessibilityService : nsIAccessibleRetrieval
{
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
nsIAccessible createRootAccessible(in nsIPresShell aShell, in nsIDocument aDocument);
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
nsIAccessible createXULAlertAccessible(in nsIDOMNode aNode);
nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
nsIAccessible createHTMLBlockAccessible(in nsISupports aFrame);
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLButtonAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLAccessibleByMarkup(in nsISupports aFrame, in nsIWeakReference aWeakShell, in nsIDOMNode aDOMNode, in AString aRole);
nsIAccessible createHTMLLIAccessible(in nsISupports aFrame, in nsISupports aBulletFrame, in AString aBulletText);
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLCheckboxAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLGenericAccessible(in nsISupports aFrame);
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLHRAccessible(in nsISupports aFrame);
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
nsIAccessible createHTMLLabelAccessible(in nsISupports aFrame);
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLObjectFrameAccessible(in nsObjectFrame aFrame);
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLRadioButtonAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsIWeakReference aPresShell);
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 createXULLinkAccessible(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 createXULTextBoxAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTreeAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTreeColumnsAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTreeColumnitemAccessible(in nsIDOMNode aNode);
nsIAccessible createXULToolbarAccessible(in nsIDOMNode aNode);
nsIAccessible createXULToolbarSeparatorAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTooltipAccessible(in nsIDOMNode aNode);
[noscript] nsIAccessible getAccessible(in nsIDOMNode aNode, in nsIPresShell aPresShell,
in nsIWeakReference aWeakShell,
inout nsIFrame frameHint, out boolean aIsHidden);
/**
* Invalidate the accessibility cache associated with aPresShell, for accessibles
* that were generated for aContainerContent and it's subtree.
* The container content node for the change is passed in, rather than the
* changed presentation for the content node itself.
* @param aPresShell The presShell where changes occured
* @param aChangeContent The affected DOM content
* @param aEvent The event from nsIAccessibleEvent that
* caused the change:
* Must be one of:
* EVENT_REORDER (change),
* EVENT_SHOW (make visible or create) or
* EVENT_HIDE (destroy or hide)
*/
[noscript] void invalidateSubtreeFor(in nsIPresShell aPresShell,
in nsIContent aChangedContent,
in PRUint32 aEvent);
};
%{ C++
// for component registration
// {DE401C37-9A7F-4278-A6F8-3DE2833989EF}
#define NS_ACCESSIBILITY_SERVICE_CID \
{ 0xde401c37, 0x9a7f, 0x4278, { 0xa6, 0xf8, 0x3d, 0xe2, 0x83, 0x39, 0x89, 0xef } }
extern nsresult
NS_GetAccessibilityService(nsIAccessibilityService** aResult);
%}

View File

@@ -1,643 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Original Author: Eric D Vaughan (evaughan@netscape.com)
* Contributor(s): Aaron Leventhal (aaronl@netscape.com)
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
/**
* A cross-platform interface that supports platform-specific
* accessibility APIs like MSAA and ATK. Contains the sum of what's needed
* to support IAccessible as well as ATK's generic accessibility objects.
* Can also be used by in-process accessibility clients to get information
* about objects in the accessible tree. The accessible tree is a subset of
* nodes in the DOM tree -- such as documents, focusable elements and text.
* Mozilla creates the implementations of nsIAccessible on demand.
* See http://www.mozilla.org/projects/ui/accessibility for more information.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(DB717DB4-37E9-42F1-A3B0-2579DD7C3814)]
interface nsIAccessible : nsISupports
{
/**
* Parent node in accessible tree.
*/
readonly attribute nsIAccessible parent;
/**
* Next sibling in accessible tree
*/
readonly attribute nsIAccessible nextSibling;
/**
* Previous sibling in accessible tree
*/
readonly attribute nsIAccessible previousSibling;
/**
* First child in accessible tree
*/
readonly attribute nsIAccessible firstChild;
/**
* Last child in accessible tree
*/
readonly attribute nsIAccessible lastChild;
/**
* Number of accessible children
*/
readonly attribute long childCount;
/**
* The 0-based index of this accessible in its parent's list of children,
* or -1 if this accessible does not have a parent.
*/
readonly attribute long indexInParent;
/**
* Accessible name -- the main text equivalent for this node
*/
attribute AString name;
/**
* Accessible value -- a number or a secondary text equivalent for this node
* Widgets that use xhtml2:role can force a value using the valuenow attribute
*/
readonly attribute AString finalValue;
/**
* Accessible description -- long text associated with this node
*/
readonly attribute AString description;
/**
* Provides localized string of accesskey name, such as Alt+D.
* The modifier may be affected by user and platform preferences.
* Usually alt+letter, or just the letter alone for menu items.
*/
readonly attribute AString keyboardShortcut;
/**
* Provides localized string of global keyboard accelerator, such
* as Ctrl+O for Open file
*/
readonly attribute AString keyBinding;
/**
* Natural enumerated accessible role for the associated element.
* The values depend on platform because of variations.
* See the ROLE_* constants defined later in this file.
* This does not take into account xhtml2:role as the finalRole does.
*/
readonly attribute unsigned long role;
/**
* Enumerated accessible role. The values depend on platform because of variations.
* See the ROLE_* constants defined later in this file.
* Widgets can use xhtml2:role to force the final role
*/
readonly attribute unsigned long finalRole;
/**
* Accessible states -- bit field which describes boolean properties of node.
* See the STATE_* constants defined later in this file.
* Widgets that use xhtml2:role can force the state using the attributes
* disabled, etc.
*/
readonly attribute unsigned long finalState;
/**
* Extended accessible states -- second bit field describing node
*/
readonly attribute unsigned long extState;
/**
* Help text associated with node
*/
readonly attribute AString help;
/**
* Focused accessible child of node
*/
readonly attribute nsIAccessible focusedChild;
/**
* Accessible child which contains the coordinate at x,y
*/
nsIAccessible getChildAtPoint(in long x, in long y);
/**
* Nth accessible child using zero-based index or last child if index less than zero
*/
nsIAccessible getChildAt(in long aChildIndex);
/**
* Accessible node geometrically to the right of this one
*/
nsIAccessible getAccessibleToRight();
/**
* Accessible node geometrically to the left of this one
*/
nsIAccessible getAccessibleToLeft();
/**
* Accessible node geometrically above this one
*/
nsIAccessible getAccessibleAbove();
/**
* Accessible node geometrically below this one
*/
nsIAccessible getAccessibleBelow();
/**
* Accessible node related to this one
*/
nsIAccessible getAccessibleRelated(in unsigned long aRelationType);
void getBounds(out long x,
out long y,
out long width,
out long height);
/**
* Add this accessible to the current selection
*/
void addSelection();
/**
* Remove this accessible from the current selection
*/
void removeSelection();
/**
* Extend the current selection from its current accessible anchor node
* to this accessible
*/
void extendSelection();
/**
* Select this accessible node only
*/
void takeSelection();
/**
* Focus this accessible node,
* The state STATE_FOCUSABLE indicates whether this node is normally focusable.
* It is the callers responsibility to determine whether this node is focusable.
* accTakeFocus on a node that is not normally focusable (such as a table),
* will still set focus on that node, although normally that will not be visually
* indicated in most style sheets.
*/
void takeFocus();
/**
* The number of accessible actions associated with this accessible
*/
readonly attribute PRUint8 numActions;
/**
* The name of the accessible action at the given zero-based index
*/
AString getActionName(in PRUint8 index);
/**
* Perform the accessible action at the given zero-based index
* Action number 0 is the default action
*/
void doAction(in PRUint8 index);
/**
* Get a pointer to accessibility interface for this node, which is specific
* to the OS/accessibility toolkit we're running on.
*/
[noscript] void getNativeInterface(out voidPtr aOutAccessible);
/**
* 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;
const unsigned long STATE_FOCUSED = 0x00000004;
const unsigned long STATE_PRESSED = 0x00000008;
const unsigned long STATE_CHECKED = 0x00000010;
const unsigned long STATE_MIXED = 0x00000020; // 3-state checkbox or toolbar button
const unsigned long STATE_READONLY = 0x00000040; // Maps to opposite of Java/Gnome/ATK EDITABLE state
const unsigned long STATE_HOTTRACKED = 0x00000080;
const unsigned long STATE_DEFAULT = 0x00000100;
const unsigned long STATE_EXPANDED = 0x00000200;
const unsigned long STATE_COLLAPSED = 0x00000400;
const unsigned long STATE_BUSY = 0x00000800;
const unsigned long STATE_FLOATING = 0x00001000; // Children "owned" not "contained" by parent
const unsigned long STATE_MARQUEED = 0x00002000;
const unsigned long STATE_ANIMATED = 0x00004000;
const unsigned long STATE_INVISIBLE = 0x00008000;
const unsigned long STATE_OFFSCREEN = 0x00010000;
const unsigned long STATE_SIZEABLE = 0x00020000;
const unsigned long STATE_MOVEABLE = 0x00040000;
const unsigned long STATE_SELFVOICING = 0x00080000;
const unsigned long STATE_FOCUSABLE = 0x00100000;
const unsigned long STATE_SELECTABLE = 0x00200000;
const unsigned long STATE_LINKED = 0x00400000;
const unsigned long STATE_TRAVERSED = 0x00800000;
const unsigned long STATE_MULTISELECTABLE = 0x01000000; // Supports multiple selection
const unsigned long STATE_EXTSELECTABLE = 0x02000000; // Supports extended selection
const unsigned long STATE_ALERT_LOW = 0x04000000; // This information is of low priority
const unsigned long STATE_ALERT_MEDIUM = 0x08000000; // This information is of medium priority
const unsigned long STATE_ALERT_HIGH = 0x10000000; // This information is of high priority
const unsigned long STATE_PROTECTED = 0x20000000; // Maps to Gnome's *Role* ATK_ROLE_PASSWD_TEXT, nothing for Java?
const unsigned long STATE_HASPOPUP = 0x40000000; // New in MSAA 2.0
// Mapping important states that we don't have to unused alert states on MSAA
// as per discussions with AT vendors. On ATK there will be legitimate states for
// STATE_REQUIRED AND STATE_INVALID
const unsigned long STATE_REQUIRED = STATE_ALERT_LOW;
const unsigned long STATE_IMPORTANT = STATE_ALERT_MEDIUM;
const unsigned long STATE_INVALID = STATE_ALERT_HIGH;
const unsigned long STATE_CHECKABLE = STATE_MARQUEED;
/**
* Extended state flags (for now non-MSAA, for Java and Gnome/ATK support)
* "Extended state flags" has seperate value space from "MSAA State flags".
*/
const unsigned long EXT_STATE_EDITABLE = 0x00200000; // Used for XUL/HTML input (type = text,password) element
const unsigned long EXT_STATE_ACTIVE = 0x00400000; // This window is currently the active window
const unsigned long EXT_STATE_EXPANDABLE = 0x00800000; // An item that can be expanded, such as a tree item with children
const unsigned long EXT_STATE_MODAL = 0x01000000; // Must do something with control before leaving it
const unsigned long EXT_STATE_MULTI_LINE = 0x02000000; // Edit control that can take multiple lines
const unsigned long EXT_STATE_SENSITIVE = 0x04000000; // No explanation given
const unsigned long EXT_STATE_SHOWING = 0x10000000; // This object and all of it's ancestors are visible
const unsigned long EXT_STATE_SINGLE_LINE = 0x20000000; // This text object can only contain 1 line of text
const unsigned long EXT_STATE_TRANSIENT = 0x40000000; // Tells accessibility aid "Don't add event listener - this object doesn't generate any". For example, could be used with higher level containers.
const unsigned long EXT_STATE_VERTICAL = 0x80000000; // Especially used for sliders and scrollbars
/**
* Relation Types -- most of these come from ATK's atkrelationtype.h
* RELATION_NULL:
* RELATION_CONTROLLED_BY: Controlled by one or more target objects.
* RELATION_CONTROLLER_FOR: Controller for one or more target objects.
* RELATION_LABEL_FOR: Label for one or more target objects.
* RELATION_LABELLED_BY: Labelled by one or more target objects.
* RELATION_MEMBER_OF: Member of a group of one or more target objects.
* RELATION_NODE_CHILD_OF: Cell in a treetable which is displayed because a
* cell in the same col is expanded & identifies it.
* RELATION_FLOWS_TO: Has content that flows logically to another
* object in a sequential way, e.g. text flow.
* RELATION_FLOWS_FROM: Has content that flows logically from another
* object in a sequential way, e.g. text flow.
* RELATION_SUBWINDOW_OF: Subwindow attached to a component but otherwise
* not connected in the UI hierarchy to that component.
* RELATION_EMBEDS: Visually embeds another object's content, i.e.
* this object's content flows around another's content.
* RELATION_EMBEDDED_BY: Inverse of RELATION_EMBEDS; this object's content
* is visually embedded in another object.
* RELATION_POPUP_FOR: Popup for another object.
* RELATION_PARENT_WINDOW_OF: Parent window of another object.
* RELATION_DEFAULT_BUTTON: Part of a form/dialog with a related default button.
* RELATION_DESCRIBED_BY: Described by one or more target objects.
* RELATION_DESCRIPTION_FOR: Description for one or more target objects.
* RELATION_LAST_DEFINED:
*/
const unsigned long RELATION_NUL = 0x00; // ATK_RELATION_NUL
const unsigned long RELATION_CONTROLLED_BY = 0x01; // ATK_RELATION_CONTROLLED_BY
const unsigned long RELATION_CONTROLLER_FOR = 0x02; // ATK_RELATION_CONTROLLER_FOR
const unsigned long RELATION_LABEL_FOR = 0x03; // ATK_RELATION_LABEL_FOR
const unsigned long RELATION_LABELLED_BY = 0x04; // ATK_RELATION_LABELLED_BY
const unsigned long RELATION_MEMBER_OF = 0x05; // ATK_RELATION_MEMBER_OF
const unsigned long RELATION_NODE_CHILD_OF = 0x06; // ATK_RELATION_NODE_CHILD_OF
const unsigned long RELATION_FLOWS_TO = 0x07; // ATK_RELATION_FLOWS_TO
const unsigned long RELATION_FLOWS_FROM = 0x08; // ATK_RELATION_FLOWS_FROM
const unsigned long RELATION_SUBWINDOW_OF = 0x09; // ATK_RELATION_SUBWINDOW_OF
const unsigned long RELATION_EMBEDS = 0x0a; // ATK_RELATION_EMBEDS
const unsigned long RELATION_EMBEDDED_BY = 0x0b; // ATK_RELATION_EMBEDDED_BY
const unsigned long RELATION_POPUP_FOR = 0x0c; // ATK_RELATION_POPUP_FOR
const unsigned long RELATION_PARENT_WINDOW_OF = 0x0d; // ATK_RELATION_PARENT_WINDOW_OF
const unsigned long RELATION_DEFAULT_BUTTON = 0x4000; // MSAA only, no ATK relation
const unsigned long RELATION_DESCRIBED_BY = 0x4001; // MSAA only, no ATK relation
const unsigned long RELATION_DESCRIPTION_FOR = 0x4002; // MSAA only, no ATK relation
%{C++
#ifdef MOZ_ACCESSIBILITY_ATK
enum { RELATION_LAST_DEFINED = 14U };
/**
* The following nsIAccessible roles are translated 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_NOTHING
*
* 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 current 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 = 73U }; // ATK_ROLE_APPLICATION
// The object represents a document window, only for MDI windows
enum { ROLE_DOCUMENT = 80U }; // ATK_ROLE_DOCUMENT_FRAME
enum { ROLE_PANE = 38U }; // ATK_ROLE_PANEL
enum { ROLE_CHART = 78U }; // ATK_ROLE_CHART
enum { ROLE_DIALOG = 16U }; // ATK_ROLE_DIALOG
enum { ROLE_BORDER = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_GROUPING = 38U }; // ATK_ROLE_PANEL
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 = 101U }; // ATK doesn't have such role now
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 = 66U }; // ATK_ROLE_UNKNOWN
// Represent top level window
enum { ROLE_FRAME = 22U }; // ATK_ROLE_FRAME
// Other roles from atk.h
enum { ROLE_ACCEL_LABEL = 1U }; // ATK_ROLE_ACCEL_LABEL
enum { ROLE_ARROW = 4U }; // ATK_ROLE_ARROW
enum { ROLE_CANVAS = 6U }; // ATK_ROLE_CANVAS
enum { ROLE_CHECK_MENU_ITEM = 8U }; // ATK_ROLE_CHECK_MENU_ITEM
enum { ROLE_COLOR_CHOOSER = 9U }; // ATK_ROLE_COLOR_CHOOSER
enum { ROLE_DATE_EDITOR = 12U }; // ATK_ROLE_DATE_EDITOR
enum { ROLE_DESKTOP_ICON = 13U }; // ATK_ROLE_DESKTOP_ICON
enum { ROLE_DESKTOP_FRAME = 14U }; // ATK_ROLE_DESKTOP_FRAME
enum { ROLE_DIRECTORY_PANE = 17U }; // ATK_ROLE_DIRECTORY_PANE
enum { ROLE_FILE_CHOOSER = 19U}; // ATK_ROLE_FILE_CHOOSER
enum { ROLE_FILLER = 20U }; // ATK_ROLE_FILLER
enum { ROLE_FONT_CHOOSER = 21U }; // ATK_ROLE_FONT_CHOOSER
enum { ROLE_GLASS_PANE = 23U }; // ATK_ROLE_GLASS_PANE
enum { ROLE_HTML_CONTAINER = 24U }; // ATK_ROLE_HTML_CONTAINER
enum { ROLE_ICON = 25U }; // ATK_ROLE_ICON
enum { ROLE_INTERNAL_FRAME = 27U }; // ATK_ROLE_INTERNAL_FRAME
enum { ROLE_LABEL = 28U }; // ATK_ROLE_LABEL
enum { ROLE_LAYERED_PANE = 29U }; // ATK_ROLE_LAYERED_PANE
enum { ROLE_OPTION_PANE = 35U }; // ATK_ROLE_OPTION_PANE
enum { ROLE_PASSWORD_TEXT = 39U }; // ATK_ROLE_PASSWORD_TEXT
enum { ROLE_POPUP_MENU = 40U }; // ATK_ROLE_POPUP_MENU
enum { ROLE_RADIO_MENU_ITEM = 44U }; // ATK_ROLE_RADIO_MENU_ITEM
enum { ROLE_ROOT_PANE = 45U }; // ATK_ROLE_ROOT_PANE
enum { ROLE_SCROLL_PANE = 48U }; // ATK_ROLE_SCROLL_PANE
enum { ROLE_SPLIT_PANE = 51U }; // ATK_ROLE_SPLIT_PANE
enum { ROLE_TABLE_COLUMN_HEADER = 56U }; // ATK_ROLE_TABLE_COLUMN_HEADER
enum { ROLE_TABLE_ROW_HEADER = 57U }; // ATK_ROLE_TABLE_ROW_HEADER
enum { ROLE_TEAR_OFF_MENU_ITEM = 58U }; // ATK_ROLE_TEAR_OFF_MENU_ITEM
enum { ROLE_TERMINAL = 59U }; // ATK_ROLE_TERMINAL
enum { ROLE_TOGGLE_BUTTON = 61U }; // ATK_ROLE_TOGGLE_BUTTON
enum { ROLE_TREE_TABLE = 65U }; // ATK_ROLE_TREE_TABLE
enum { ROLE_VIEWPORT = 67U }; // ATK_ROLE_VIEWPORT
enum { ROLE_HEADER = 69U }; // ATK_ROLE_HEADER
enum { ROLE_FOOTER = 70U }; // ATK_ROLE_FOOTER
enum { ROLE_PARAGRAPH = 71U }; // ATK_ROLE_PARAGRAPH
enum { ROLE_RULER = 72U }; // ATK_ROLE_RULER
enum { ROLE_AUTOCOMPLETE = 74U }; // ATK_ROLE_AUTOCOMPLETE
enum { ROLE_EDITBAR = 75U }; // ATK_ROLE_EDITBAR
enum { ROLE_EMBEDDED = 76U }; // ATK_ROLE_EMBEDDED
enum { ROLE_ENTRY = 77U }; // ATK_ROLE_ENTRY
enum { ROLE_CAPTION = 79U }; // ATK_ROLE_CAPTION
enum { ROLE_DOCUMENT_FRAME = 80U }; // ATK_ROLE_DOCUMENT_FRAME
enum { ROLE_HEADING = 81U }; // ATK_ROLE_HEADING
enum { ROLE_PAGE = 82U }; // ATK_ROLE_PAGE
enum { ROLE_SECTION = 83U }; // ATK_ROLE_SECTION
enum { ROLE_REDUNDANT_OBJECT = 84U }; // ATK_ROLE_REDUNDANT_OBJECT
#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_RADIO_MENU_ITEM = 12U }; // Same as ROLE_MENUITEM
enum { ROLE_CHECK_MENU_ITEM = 12U }; // Same as ROLE_MENUITEM
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_TREE_TABLE = 35U }; // Same as ROLE_OUTLINE
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 };
// Make up for ATK roles that we don't have in MSAA
// When in doubt map them to ROLE_NOTHING so that the role string is exposed
enum { ROLE_ICON = ROLE_NOTHING };
enum { ROLE_PASSWORD_TEXT = ROLE_TEXT };
enum { ROLE_AUTOCOMPLETE = ROLE_COMBOBOX };
enum { ROLE_EDITBAR = ROLE_NOTHING };
enum { ROLE_EMBEDDED = ROLE_NOTHING };
enum { ROLE_ENTRY = ROLE_NOTHING };
enum { ROLE_CAPTION = ROLE_NOTHING };
enum { ROLE_DOCUMENT_FRAME = ROLE_NOTHING };
enum { ROLE_HEADING = ROLE_NOTHING };
enum { ROLE_PAGE = ROLE_NOTHING };
enum { ROLE_SECTION = ROLE_NOTHING };
enum { ROLE_REDUNDANT_OBJECT = ROLE_NOTHING };
// MSAA relationship extensions to accNavigate
enum { NAVRELATION_CONTROLLED_BY = 0x1000 };
enum { NAVRELATION_CONTROLLER_FOR = 0x1001 };
enum { NAVRELATION_LABEL_FOR = 0x1002 };
enum { NAVRELATION_LABELLED_BY = 0x1003 };
enum { NAVRELATION_MEMBER_OF = 0x1004 };
enum { NAVRELATION_NODE_CHILD_OF = 0x1005 };
enum { NAVRELATION_FLOWS_TO = 0x1006 };
enum { NAVRELATION_FLOWS_FROM = 0x1007 };
enum { NAVRELATION_SUBWINDOW_OF = 0x1008 };
enum { NAVRELATION_EMBEDS = 0x1009 };
enum { NAVRELATION_EMBEDDED_BY = 0x100a };
enum { NAVRELATION_POPUP_FOR = 0x100b };
enum { NAVRELATION_PARENT_WINDOW_OF = 0x100c };
enum { NAVRELATION_DEFAULT_BUTTON = 0x100d };
enum { NAVRELATION_DESCRIBED_BY = 0x100e };
enum { NAVRELATION_DESCRIPTION_FOR = 0x100f };
#endif
%}
};

View File

@@ -1,47 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIDOMNode.idl"
[scriptable, uuid(9124c666-6133-4be6-b3ed-dd0ec35f1e64)]
interface nsIAccessibleCaret : nsISupports
{
void attachNewSelectionListener(in nsIDOMNode aFocusedNode);
void removeSelectionListener();
};

View File

@@ -1,135 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessible;
interface nsIAccessNode;
interface nsIDOMDocument;
interface nsIDOMNode;
interface nsIDOMWindow;
/**
* An interface for in-process accessibility clients
* that wish to retrieve information about a document.
* When accessibility is turned on in Gecko,
* there is an nsIAccessibleDocument for each document
* whether it is XUL, HTML or whatever.
* You can QueryInterface to nsIAccessibleDocument from
* the nsIAccessible or nsIAccessNode for the root node
* of a document. You can also get one from
* nsIAccessNode::GetAccessibleDocument() or
* nsIAccessibleEvent::GetAccessibleDocument()
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(8781FC88-355F-4439-881F-6504A0A1CEB6)]
interface nsIAccessibleDocument : nsISupports
{
/**
* The URL of the document
*/
readonly attribute AString URL;
/**
* The title of the document, as specified in the document.
*/
readonly attribute AString title;
/**
* The mime type of the document
*/
readonly attribute AString mimeType;
/**
* The doc type of the document, as specified in the document.
*/
readonly attribute AString docType;
/**
* True if the document is live in an editor.
* False if the document is being displayed but not edited.
* If a <div> is contentEditable, then it has its own document,
* with isEditable == true.
*/
readonly attribute boolean isEditable;
/**
* The nsIDOMDocument interface associated with this document.
*/
readonly attribute nsIDOMDocument document;
/**
* The nsIDOMWindow that the document resides in.
*/
readonly attribute nsIDOMWindow window;
/*
* The accessible for the caret belonging to this window.
*/
readonly attribute nsIAccessible caretAccessible;
/**
* The namespace for each ID that is handed back.
*/
AString getNameSpaceURIForID(in short nameSpaceID);
/**
* The window handle for the OS window the document is being displayed in.
* For example, in Windows you can static cast it to an HWND.
*/
[noscript] readonly attribute voidPtr windowHandle;
/**
* Returns the access node cached by this document
* @param aUniqueID The unique ID used to cache the node.
* This matches up with the uniqueID attribute on
* nsIAccessNode.
* @return The nsIAccessNode cached for this particular unique ID.
*/
[noscript] nsIAccessNode getCachedAccessNode(in voidPtr aUniqueID);
/**
* Returns the first accessible parent of a DOM node.
* Guaranteed not to return nsnull if the DOM node is in a document.
* @param aDOMNode The DOM node we need an accessible for.
* @return An first nsIAccessible found by crawling up the DOM node
* to the document root.
*/
nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode);
};

View File

@@ -1,154 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessible;
interface nsIAccessibleDocument;
interface nsIDOMNode;
%{C++
#define NS_ACCESSIBLE_EVENT_TOPIC "accessible-event"
%}
/**
* An interface for accessibility events listened to
* by in-process accessibility clients, which can be used
* to find out how to get accessibility and DOM interfaces for
* the event and its target. To listen to in-process accessibility invents,
* make your object an nsIObserver, and listen for accessible-event by
* using code something like this:
* nsCOMPtr<nsIObserverService> observerService =
* do_GetService("@mozilla.org/observer-service;1", &rv);
* if (NS_SUCCEEDED(rv))
* rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(87F29033-C4A6-40a3-AC7A-3BA391F9992D)]
interface nsIAccessibleEvent : nsISupports
{
/**
* The type of event, based on the enumerated event values
* defined in this interface.
*/
readonly attribute unsigned long eventType;
/**
* The nsIAccessible associated with the event.
* May return null if no accessible is available
*/
readonly attribute nsIAccessible accessible;
/**
* The nsIAccessibleDocument that the event target nsIAccessible
* resides in. This can be used to get the DOM window,
* the DOM document and the window handler, among other things.
*/
readonly attribute nsIAccessibleDocument accessibleDocument;
/**
* The nsIDOMNode associated with the event
* May return null if accessible for event has been shut down
*/
readonly attribute nsIDOMNode DOMNode;
// 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;
const unsigned long EVENT_ATK_LINK_SELECTED = 0x0117;
const unsigned long EVENT_ATK_WINDOW_ACTIVATE = 0x0118;
const unsigned long EVENT_ATK_WINDOW_CREATE = 0x0119;
const unsigned long EVENT_ATK_WINDOW_DEACTIVATE = 0x0120;
const unsigned long EVENT_ATK_WINDOW_DESTROY = 0x0121;
const unsigned long EVENT_ATK_WINDOW_MAXIMIZE = 0x0122;
const unsigned long EVENT_ATK_WINDOW_MINIMIZE = 0x0123;
const unsigned long EVENT_ATK_WINDOW_RESIZE = 0x0124;
const unsigned long EVENT_ATK_WINDOW_RESTORE = 0x0125;
};

View File

@@ -1,47 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIAccessible.idl"
[scriptable, uuid(3f0e3eb0-1dd2-11b2-9605-be5b8e76cf4b)]
interface nsIAccessibleProvider : nsISupports
{
readonly attribute nsIAccessible accessible;
};

View File

@@ -1,128 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMNode;
interface nsIAccessible;
interface nsIWeakReference;
interface nsIPresShell;
interface nsIDOMWindow;
interface nsIAccessNode;
/**
* An interface for in-process accessibility clients
* wishing to get an nsIAccessible or nsIAccessNode for
* a given DOM node.
* More documentation at:
* http://www.mozilla.org/projects/ui/accessibility
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(663CA4A8-D219-4000-925D-D8F66406B626)]
interface nsIAccessibleRetrieval : nsISupports
{
/**
* Return an nsIAccessible for a DOM node in pres shell 0.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
/**
* Return an nsIAccessible for a DOM node in pres shell for this DOM window.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @param aDOMWin The DOM window containing the node.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleInWindow(in nsIDOMNode aNode, in nsIDOMWindow aDOMWin);
/**
* Return an nsIAccessible for a DOM node in the given weak shell.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleInWeakShell(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
/**
* Return an nsIAccessible for a DOM node in the given pres shell.
* Create a new accessible of the appropriate type if necessary,
* or use one from the accessibility cache if it already exists.
* @param aNode The DOM node to get an accessible for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessible for the given DOM node.
*/
nsIAccessible getAccessibleInShell(in nsIDOMNode aNode, in nsIPresShell aPresShell);
/**
* Return an nsIAccessNode for an already created DOM node in the given weak shell.
* Does not create a new one -- only returns cached access nodes.
* @param aNode The DOM node to get an access node for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessNode for the given DOM node or null if
* an access node does not already exist for this DOM node.
*/
nsIAccessNode getCachedAccessNode(in nsIDOMNode aNode, in nsIWeakReference aShell);
/**
* Return an nsIAccessible for an already created DOM node in the given weak shell.
* Does not create a new one -- only returns cached accessibles.
* @param aNode The DOM node to get an accessible for.
* @param aPresShell The presentation shell which contains layout info for the DOM node.
* @return The nsIAccessible for the given DOM node or null if
* an accessible does not already exist for this DOM node.
*/
nsIAccessible getCachedAccessible(in nsIDOMNode aNode, in nsIWeakReference aShell);
};
%{ C++
// for component registration
// {663CA4A8-D219-4000-925D-D8F66406B626}
#define NS_ACCESSIBLE_RETRIEVAL_CID \
{ 0x663ca4a8, 0xd219, 0x4000, { 0x92, 0x5d, 0xd8, 0xf6, 0x64, 0x6, 0xb6, 0x26 } }
%}

View File

@@ -1,110 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Marc Mulcahy (marc.mulcahy@sun.com)
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* Kyle Yuan (kyle.yuan@sun.com)
* Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIAccessible.idl"
#include "nsIArray.idl"
/**
* An interface for the accessibility module and in-process accessibility clients
* for dealing with getting and changing the selection of accessible nodes.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
interface nsIAccessibleSelectable : nsISupports
{
%{C++
enum { eSelection_Add = 0U, eSelection_Remove = 1U, eSelection_GetState = 2U };
%}
/**
* Return an nsIArray of selected nsIAccessible children
*/
nsIArray 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.
* If the specified object is already selected, then it does nothing.
* @throws NS_ERROR_FAILURE if the specified object is not selectable.
*/
void addChildToSelection(in long index);
/**
* Removes the specified child of the object from the object's selection.
* If the specified object was not selected, then it does nothing.
* @throws NS_ERROR_FAILURE if the specified object is not selectable.
*/
void removeChildFromSelection(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.
* @param index Zero-based selected accessible child index
* @return The nth selected accessible child
*/
nsIAccessible refSelection(in long index);
/**
* Determines if the current child of this object is selected
* @param The zero-based accessible child index
* @return Returns true if the child is selected, false if not.
*/
boolean isChildSelected(in long index);
/**
* Select all children
* @return If the object does not accept multiple selection, return false.
* Otherwise, returns true.
*/
boolean selectAllSelection();
};

View File

@@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsITreeColumns.idl"
interface nsIAccessible;
/**
* A cross-platform interface that supports cache for tree item
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(CC742DA2-9C25-4D04-96CD-DA407D676C6D)]
interface nsIAccessibleTreeCache : nsISupports
{
/**
* Get tree item from cache according to row and column, create if doesn't exist in cache
* "aColumn" can be nsnull
*/
[noscript] nsIAccessible getCachedTreeitemAccessible(in PRInt32 aRow, in nsITreeColumn aColumn);
};

View File

@@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIFrame;
[scriptable, uuid(b3507946-4a44-4e40-b66c-f23e320997c5)]
interface nsPIAccessNode : nsISupports
{
[noscript] void init();
[noscript] void shutdown();
[notxpcom] nsIFrame GetFrame();
};

View File

@@ -1,55 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessible;
[scriptable, uuid(52F1BE88-84F7-4f7f-B31C-062AFE7DF15D)]
interface nsPIAccessible : nsISupports
{
[noscript] void setParent(in nsIAccessible aAccParent);
[noscript] void setFirstChild(in nsIAccessible aAccFirstChild);
[noscript] void setNextSibling(in nsIAccessible aAccNextSibling);
/**
* Set the child count to -1 (unknown) and null out cached child pointers
*/
[noscript] void invalidateChildren();
[noscript] void fireToolkitEvent(in unsigned long aEvent, in nsIAccessible aTarget, in voidPtr aData);
};

View File

@@ -1,67 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessNode;
interface nsIContent;
[uuid(eae56f75-ee68-4120-b113-10f21b75509e)]
interface nsPIAccessibleDocument : nsISupports
{
/**
* Find the accessible object in the accessibility cache that
* corresponds to aStartNode or the first ancestor of aStartNode
* that has an accessible object associated with it.
* Clear that accessible object's parent's cache of accessible children and
* and remove the accessible object and any decendents from the accessible cache.
* New accessible objects will be created and cached again on demand.
* @param aChangeContent The child that is changing
* @param aEvent The event from nsIAccessibleEvent that caused the change:
* Must be one of: EVENT_REORDER (change),
* EVENT_SHOW (make visible or create) or
* EVENT_HIDE (destroy or hide)
*/
void invalidateCacheSubtree(in nsIContent aChangeContent,
in PRUint32 aChangeEvent);
void cacheAccessNode(in voidPtr aUniqueID, in nsIAccessNode aAccessNode);
void destroy();
void flushPendingEvents();
void fireDocLoadingEvent(in boolean isFinished);
void fireAnchorJumpEvent();
};

View File

@@ -1,70 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 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 of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
DIRS += atk
else
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
DIRS += msaa
else
ifeq ($(MOZ_WIDGET_TOOLKIT),mac)
DIRS += mac
else
DIRS += other
endif
endif
endif
DIRS += \
base \
html \
$(null)
ifdef MOZ_XUL
DIRS += xul
endif
include $(topsrcdir)/config/rules.mk

View File

@@ -1,122 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code
#
# The Initial Developer of the Original Code is
# Aaron Leventhal
# Portions created by the Initial Developer are Copyright (C) 2003
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
LIBRARY_NAME = accessibility_toolkit_s
LIBXUL_LIBRARY = 1
REQUIRES = content \
docshell \
dom \
editor \
gfx \
intl \
layout \
locale \
necko \
string \
uriloader \
view \
webshell \
widget \
xpcom \
$(NULL)
CPPSRCS = \
nsAccessNodeWrap.cpp \
nsAccessibleWrap.cpp \
nsDocAccessibleWrap.cpp \
nsRootAccessibleWrap.cpp \
nsAppRootAccessible.cpp \
nsAccessibleText.cpp \
nsAccessibleHyperText.cpp \
nsHTMLFormControlAccessibleWrap.cpp \
nsHTMLLinkAccessibleWrap.cpp \
nsHTMLTableAccessibleWrap.cpp \
nsHTMLBlockAccessible.cpp \
nsMaiInterface.cpp \
nsMaiInterfaceComponent.cpp \
nsMaiInterfaceAction.cpp \
nsMaiInterfaceText.cpp \
nsMaiInterfaceEditableText.cpp \
nsMaiInterfaceSelection.cpp \
nsMaiInterfaceValue.cpp \
nsMaiHyperlink.cpp \
nsMaiInterfaceHypertext.cpp \
nsMaiInterfaceTable.cpp \
$(NULL)
#ifdef MOZ_XUL
CPPSRCS += \
nsXULFormControlAccessibleWrap.cpp \
nsXULTreeAccessibleWrap.cpp \
$(NULL)
#endif
EXPORTS = \
nsAccessNodeWrap.h \
nsAccessibleWrap.h \
nsDocAccessibleWrap.h \
nsRootAccessibleWrap.h \
nsTextAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULTreeAccessibleWrap.h \
nsAccessibleText.h \
$(NULL)
# we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
include $(topsrcdir)/config/rules.mk
CFLAGS += $(MOZ_GTK2_CFLAGS)
CXXFLAGS += $(MOZ_GTK2_CFLAGS)
LOCAL_INCLUDES += \
-I$(srcdir) \
-I$(srcdir)/../base \
-I$(srcdir)/../html \
-I$(srcdir)/../xul \
$(NULL)

View File

@@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessNodeWrap.h"
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
/*
* Class nsAccessNodeWrap
*/
//-----------------------------------------------------
// construction
//-----------------------------------------------------
nsAccessNodeWrap::nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell):
nsAccessNode(aNode, aShell)
{
}
//-----------------------------------------------------
// destruction
//-----------------------------------------------------
nsAccessNodeWrap::~nsAccessNodeWrap()
{
}
void nsAccessNodeWrap::InitAccessibility()
{
nsAccessNode::InitXPAccessibility();
}
void nsAccessNodeWrap::ShutdownAccessibility()
{
nsAccessNode::ShutdownXPAccessibility();
}

View File

@@ -1,58 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
#ifndef _nsAccessNodeWrap_H_
#define _nsAccessNodeWrap_H_
#include "nsAccessNode.h"
class nsAccessNodeWrap : public nsAccessNode
{
public: // construction, destruction
nsAccessNodeWrap(nsIDOMNode *aNode, nsIWeakReference* aShell);
virtual ~nsAccessNodeWrap();
static void InitAccessibility();
static void ShutdownAccessibility();
};
#endif

View File

@@ -1,541 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kyle Yuan (kyle.yuan@sun.com)
* Ginn Chen (ginn.chen@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityService.h"
#include "nsAccessibleHyperText.h"
#include "nsHTMLLinkAccessibleWrap.h"
#include "nsHTMLTextAccessible.h"
#include "nsPIAccessNode.h"
#include "nsIFrame.h"
#include "nsILink.h"
#include "nsIServiceManager.h"
/*
* nsAccessibleHyperText supports both nsIAccessibleHyperText and nsIAccessibleText.
* It's mainly aimed at the compound content that consists of many text nodes and links.
* Typically, it's a paragraph of text, a cell of table, etc.
*/
NS_IMPL_ISUPPORTS2(nsAccessibleHyperText, nsIAccessibleHyperText, nsIAccessibleText)
nsAccessibleHyperText::nsAccessibleHyperText(nsIDOMNode* aDomNode, nsIWeakReference* aShell)
{
mIndex = -1;
nsCOMPtr<nsIContent> content(do_QueryInterface(aDomNode));
if (content) {
nsCOMPtr<nsIContent> parentContent = content->GetParent();
if (parentContent)
mIndex = parentContent->IndexOf(content);
}
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aShell));
if (shell) {
NS_NewArray(getter_AddRefs(mTextChildren));
if (mTextChildren) {
nsCOMPtr<nsIContent> content(do_QueryInterface(aDomNode));
nsIFrame *frame = shell->GetPrimaryFrameFor(content);
nsIFrame *parentFrame = nsAccessible::GetParentBlockFrame(frame);
NS_ASSERTION(parentFrame, "Error: HyperText can't get parent block frame");
if (parentFrame) {
nsIFrame* childFrame = parentFrame->GetFirstChild(nsnull);
PRBool bSave = PR_FALSE;
GetAllTextChildren(shell->GetPresContext(), childFrame,
aDomNode, bSave);
}
}
}
}
void nsAccessibleHyperText::Shutdown()
{
mTextChildren = nsnull;
}
PRBool nsAccessibleHyperText::GetAllTextChildren(nsPresContext *aPresContext, nsIFrame *aCurFrame, nsIDOMNode* aNode, PRBool &bSave)
{
if (! aCurFrame)
return PR_FALSE;
nsIAtom* frameType = aCurFrame->GetType();
if (frameType == nsAccessibilityAtoms::blockFrame) {
if (bSave)
return PR_TRUE;
}
else {
if (frameType == nsAccessibilityAtoms::textFrame) {
// Skip the empty text frames that usually only consist of "\n"
if (! aCurFrame->GetRect().IsEmpty()) {
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aCurFrame->GetContent()));
if (bSave || node == aNode) {
// some long text node may be divided into several frames,
// so we must check whether this node is already in the array
PRUint32 index;
nsresult rv = mTextChildren->IndexOf(0, node, &index);
if (NS_FAILED(rv)) {
mTextChildren->AppendElement(node, PR_FALSE);
}
bSave = PR_TRUE;
}
}
}
nsIFrame* childFrame = aCurFrame->GetFirstChild(nsnull);
if (GetAllTextChildren(aPresContext, childFrame, aNode, bSave))
return PR_TRUE;
}
nsIFrame* siblingFrame = aCurFrame->GetNextSibling();
return GetAllTextChildren(aPresContext, siblingFrame, aNode, bSave);
}
PRInt32 nsAccessibleHyperText::GetIndex()
// XXX, this index is used for giving a hypertext a meaningful name, such as "Paragraph n",
// but by now, we haven't found a better way to do that, just use the index of our parent's
// children list as the number.
{
return mIndex;
}
nsIDOMNode* nsAccessibleHyperText::FindTextNodeByOffset(PRInt32 aOffset, PRInt32& aBeforeLength)
{
aBeforeLength = 0;
PRUint32 index, count;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsAccessibleText accText(domNode);
PRInt32 charCount;
if (NS_SUCCEEDED(accText.GetCharacterCount(&charCount))) {
if (aOffset >= 0 && aOffset <= charCount) {
return domNode;
}
aOffset -= charCount;
aBeforeLength += charCount;
}
}
return nsnull;
}
nsresult nsAccessibleHyperText::GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
{
PRInt32 beforeLength;
nsIDOMNode* domNode = FindTextNodeByOffset(aOffset, beforeLength);
if (domNode) {
nsAccessibleText accText(domNode);
// call nsAccessibleText::GetTextHelper directly so that it can adjust the aStartOffset/aEndOffset
// according to the mTextChildren
nsresult rv = accText.GetTextHelper(aType, aBoundaryType, aOffset - beforeLength, aStartOffset, aEndOffset, mTextChildren, aText);
return rv;
}
return NS_ERROR_INVALID_ARG;
}
// ------- nsIAccessibleText ---------------
/* attribute long caretOffset; */
NS_IMETHODIMP nsAccessibleHyperText::GetCaretOffset(PRInt32 *aCaretOffset)
{
*aCaretOffset = 0;
PRInt32 charCount, caretOffset;
PRUint32 index, count;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsAccessibleText accText(domNode);
if (NS_SUCCEEDED(accText.GetCaretOffset(&caretOffset))) {
*aCaretOffset += caretOffset;
return NS_OK;
}
if (NS_SUCCEEDED(accText.GetCharacterCount(&charCount))) {
*aCaretOffset += charCount;
}
}
// The current focus node is not inside us
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsAccessibleHyperText::SetCaretOffset(PRInt32 aCaretOffset)
{
PRInt32 beforeLength;
nsIDOMNode* domNode = FindTextNodeByOffset(aCaretOffset, beforeLength);
if (domNode) {
nsAccessibleText accText(domNode);
return accText.SetCaretOffset(aCaretOffset - beforeLength);
}
return NS_ERROR_INVALID_ARG;
}
/* readonly attribute long characterCount; */
NS_IMETHODIMP nsAccessibleHyperText::GetCharacterCount(PRInt32 *aCharacterCount)
{
*aCharacterCount = 0;
PRInt32 charCount;
PRUint32 index, count;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsAccessibleText accText(domNode);
if (NS_SUCCEEDED(accText.GetCharacterCount(&charCount)))
*aCharacterCount += charCount;
}
return NS_OK;
}
/* readonly attribute long selectionCount; */
NS_IMETHODIMP nsAccessibleHyperText::GetSelectionCount(PRInt32 *aSelectionCount)
{
*aSelectionCount = 0;
PRInt32 selCount;
PRUint32 index, count;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsAccessibleText accText(domNode);
if (NS_SUCCEEDED(accText.GetSelectionCount(&selCount)))
*aSelectionCount += selCount;
}
return NS_OK;
}
/* AString getText (in long startOffset, in long endOffset); */
NS_IMETHODIMP nsAccessibleHyperText::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset, nsAString & aText)
{
if (aEndOffset == -1)
GetCharacterCount(&aEndOffset);
PRInt32 charCount, totalCount = 0, currentStart, currentEnd;
PRUint32 index, count;
nsAutoString text, nodeText;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsAccessibleText accText(domNode);
if (NS_SUCCEEDED(accText.GetCharacterCount(&charCount))) {
currentStart = aStartOffset - totalCount;
currentEnd = aEndOffset - totalCount;
if (currentStart >= 0 && currentStart < charCount) {
accText.GetText(currentStart, NS_MIN(charCount, currentEnd), nodeText);
text += nodeText;
aStartOffset += charCount - currentStart;
if (aStartOffset >= aEndOffset)
break;
}
totalCount += charCount;
}
}
// Eliminate the new line character
PRInt32 start = 0, length = text.Length();
PRInt32 offset = text.FindCharInSet("\n\r");
while (offset != kNotFound) {
if (offset > start)
aText += Substring(text, start, offset - start);
start = offset + 1;
offset = text.FindCharInSet("\n\r", start);
}
// Consume the last bit of the string if there's any left
if (start < length) {
if (start)
aText += Substring(text, start, length - start);
else
aText = text;
}
return NS_OK;
}
/* AString getTextBeforeOffset (in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset); */
NS_IMETHODIMP nsAccessibleHyperText::GetTextBeforeOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
{
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
}
/* AString getTextAfterOffset (in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset); */
NS_IMETHODIMP nsAccessibleHyperText::GetTextAfterOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
{
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
}
/* AString getTextAtOffset (in long offset, in nsAccessibleTextBoundary boundaryType, out long startOffset, out long endOffset); */
NS_IMETHODIMP nsAccessibleHyperText::GetTextAtOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
{
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
}
/* wchar getCharacterAtOffset (in long offset); */
NS_IMETHODIMP nsAccessibleHyperText::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter)
{
PRInt32 beforeLength;
nsIDOMNode* domNode = FindTextNodeByOffset(aOffset, beforeLength);
if (domNode) {
nsAccessibleText accText(domNode);
return accText.GetCharacterAtOffset(aOffset - beforeLength, aCharacter);
}
return NS_ERROR_INVALID_ARG;
}
/* nsISupports getAttributeRange (in long offset, out long rangeStartOffset, out long rangeEndOffset); */
NS_IMETHODIMP nsAccessibleHyperText::GetAttributeRange(PRInt32 aOffset, PRInt32 *aRangeStartOffset, PRInt32 *aRangeEndOffset, nsISupports **aAttributes)
{
*aRangeStartOffset = aOffset;
GetCharacterCount(aRangeEndOffset);
*aAttributes = 0;
return NS_OK;
}
/* void getCharacterExtents (in long offset, out long x, out long y, out long width, out long height, in nsAccessibleCoordType coordType); */
NS_IMETHODIMP nsAccessibleHyperText::GetCharacterExtents(PRInt32 aOffset, PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight, nsAccessibleCoordType aCoordType)
{
PRInt32 beforeLength;
nsIDOMNode* domNode = FindTextNodeByOffset(aOffset, beforeLength);
if (domNode) {
nsAccessibleText accText(domNode);
return accText.GetCharacterExtents(aOffset - beforeLength, aX, aY, aWidth, aHeight, aCoordType);
}
return NS_ERROR_INVALID_ARG;
}
/* long getOffsetAtPoint (in long x, in long y, in nsAccessibleCoordType coordType); */
NS_IMETHODIMP nsAccessibleHyperText::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, nsAccessibleCoordType aCoordType, PRInt32 *aOffset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void getSelectionBounds (in long selectionNum, out long startOffset, out long endOffset); */
NS_IMETHODIMP nsAccessibleHyperText::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setSelectionBounds (in long selectionNum, in long startOffset, in long endOffset); */
NS_IMETHODIMP nsAccessibleHyperText::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void addSelection (in long startOffset, in long endOffset); */
NS_IMETHODIMP nsAccessibleHyperText::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void removeSelection (in long selectionNum); */
NS_IMETHODIMP nsAccessibleHyperText::RemoveSelection(PRInt32 aSelectionNum)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// ------- nsIAccessibleHyperText ---------------
/* readonly attribute long links; */NS_IMETHODIMP nsAccessibleHyperText::GetLinks(PRInt32 *aLinks)
{
*aLinks = 0;
PRUint32 index, count;
PRInt32 caretOffset;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsCOMPtr<nsIDOMNode> parentNode;
nsCOMPtr<nsILink> link = nsnull;
domNode->GetParentNode(getter_AddRefs(parentNode));
while (parentNode) {
link = do_QueryInterface(parentNode);
if (link)
break;
nsCOMPtr<nsIDOMNode> temp = parentNode;
temp->GetParentNode(getter_AddRefs(parentNode));
}
if (link)
(*aLinks)++;
else {
nsAccessibleText accText(domNode);
if (NS_SUCCEEDED(accText.GetCaretOffset(&caretOffset))) {
*aLinks = 0;
return NS_OK;
}
}
}
return NS_OK;
}
/* nsIAccessibleHyperLink getLink (in long index); */
NS_IMETHODIMP nsAccessibleHyperText::GetLink(PRInt32 aIndex, nsIAccessibleHyperLink **aLink)
{
PRUint32 index, count, linkCount = 0;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsCOMPtr<nsIDOMNode> parentNode;
// text node maybe a child (or grandchild, ...) of a link node
nsCOMPtr<nsILink> link;
domNode->GetParentNode(getter_AddRefs(parentNode));
while (parentNode) {
link = do_QueryInterface(parentNode);
if (link)
break;
nsCOMPtr<nsIDOMNode> temp = parentNode;
temp->GetParentNode(getter_AddRefs(parentNode));
}
if (link) {
if (linkCount++ == NS_STATIC_CAST(PRUint32, aIndex)) {
nsCOMPtr<nsIWeakReference> weakShell;
nsAccessibilityService::GetShellFromNode(parentNode, getter_AddRefs(weakShell));
NS_ENSURE_TRUE(weakShell, NS_ERROR_FAILURE);
// Check to see if we already have it in the cache.
nsCOMPtr<nsIAccessibilityService>
accService(do_GetService("@mozilla.org/accessibilityService;1"));
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessible> cachedAcc;
nsresult rv = accService->GetCachedAccessible(parentNode, weakShell,
getter_AddRefs(cachedAcc));
NS_ENSURE_SUCCESS(rv, rv);
*aLink = nsnull;
if (cachedAcc) {
// Retrieved from cache
nsCOMPtr<nsIAccessibleHyperLink> cachedLink(do_QueryInterface(cachedAcc));
if (cachedLink) {
*aLink = cachedLink;
NS_IF_ADDREF(*aLink);
}
}
if (!(*aLink)) {
*aLink = new nsHTMLLinkAccessibleWrap(parentNode, mTextChildren, weakShell, nsnull);
NS_ENSURE_TRUE(*aLink, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aLink);
nsCOMPtr<nsPIAccessNode> accessNode(do_QueryInterface(*aLink));
accessNode->Init();
}
break;
}
}
}
return NS_OK;
}
/* long getLinkIndex (in long charIndex); */
NS_IMETHODIMP nsAccessibleHyperText::GetLinkIndex(PRInt32 aCharIndex, PRInt32 *aLinkIndex)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* long getSelectedLinkIndex (); */
NS_IMETHODIMP nsAccessibleHyperText::GetSelectedLinkIndex(PRInt32 *aSelectedLinkIndex)
{
*aSelectedLinkIndex = -1;
PRUint32 count;
mTextChildren->GetLength(&count);
if (count <= 0)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> curNode(do_QueryElementAt(mTextChildren, 0));
PRUint32 index, linkCount = 0;
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsCOMPtr<nsIDOMNode> parentNode;
nsCOMPtr<nsILink> link;
do {
// text node maybe a child of a link node
domNode->GetParentNode(getter_AddRefs(parentNode));
domNode = parentNode;
link = do_QueryInterface(parentNode);
} while (domNode && link == nsnull);
if (link) {
if (parentNode == nsAccessNode::gLastFocusedNode) {
*aSelectedLinkIndex = linkCount;
return NS_OK;
}
linkCount++;
}
}
return NS_ERROR_FAILURE;
}
nsresult nsAccessibleHyperText::GetBounds(nsIWeakReference *aWeakShell, PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
*x = *y = *width = *height = 0;
nsRect unionRectTwips;
PRUint32 index, count;
mTextChildren->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
nsHTMLTextAccessible *accText = new nsHTMLTextAccessible(domNode, aWeakShell, nsnull);
if (!accText)
return NS_ERROR_OUT_OF_MEMORY;
nsRect frameRect;
accText->GetBounds(&frameRect.x, &frameRect.y, &frameRect.width, &frameRect.height);
unionRectTwips.UnionRect(unionRectTwips, frameRect);
delete accText;
}
*x = unionRectTwips.x;
*y = unionRectTwips.y;
*width = unionRectTwips.width;
*height = unionRectTwips.height;
return NS_OK;
}

View File

@@ -1,73 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsAccessibleHyperText_H_
#define _nsAccessibleHyperText_H_
#include "nsAccessibleText.h"
#include "nsIAccessibleHyperText.h"
#include "nsIAccessibleText.h"
#include "nsArray.h"
#include "nsTextAccessible.h"
class nsAccessibleHyperText : public nsIAccessibleHyperText,
public nsIAccessibleText
{
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLEHYPERTEXT
NS_DECL_NSIACCESSIBLETEXT
public:
nsAccessibleHyperText(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
virtual ~nsAccessibleHyperText() {};
nsresult GetBounds(nsIWeakReference *aShell, PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
void Shutdown();
PRInt32 GetIndex();
protected:
nsCOMPtr<nsIMutableArray> mTextChildren;
PRInt32 mIndex;
PRBool GetAllTextChildren(nsPresContext *aPresContext, nsIFrame *aCurFrame, nsIDOMNode* aNode, PRBool &bSave);
nsIDOMNode* FindTextNodeByOffset(PRInt32 aOffset, PRInt32& aBeforeLength);
nsresult GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,136 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsAccessibleText_H_
#define _nsAccessibleText_H_
#include "nsAccessibleEventData.h"
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleEditableText.h"
#include "nsIAccessibleText.h"
#include "nsIEditActionListener.h"
#include "nsIEditor.h"
#include "nsISelectionController.h"
#include "nsITextControlFrame.h"
#include "nsTextAccessibleWrap.h"
#include "nsTextAccessible.h"
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
class nsAccessibleText : public nsIAccessibleText
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLETEXT
nsAccessibleText(nsIDOMNode *aNode);
virtual ~nsAccessibleText() {};
static PRBool gSuppressedNotifySelectionChanged;
protected:
nsCOMPtr<nsIDOMNode> mTextNode;
virtual nsresult GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel);
nsresult GetTextHelperCore(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
nsISelectionController *aSelCon, nsISelection *aDomSel,
nsISupports *aClosure, nsAString & aText);
nsresult GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
nsISupports *aClosure, nsAString & aText);
static nsresult DOMPointToOffset(nsISupports *aClosure, nsIDOMNode* aNode, PRInt32 aNodeOffset, PRInt32 *aResult);
static nsresult OffsetToDOMPoint(nsISupports *aClosure, PRInt32 aOffset, nsIDOMNode** aResult, PRInt32* aPosition);
static nsresult GetCurrectOffset(nsISupports *aClosure, nsISelection *aDomSel, PRInt32 *aOffset);
friend class nsAccessibleHyperText;
};
class nsAccessibleEditableText : public nsAccessibleText,
public nsIAccessibleEditableText,
public nsIEditActionListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLEEDITABLETEXT
NS_DECL_NSIEDITACTIONLISTENER
nsAccessibleEditableText(nsIDOMNode *aNode);
virtual ~nsAccessibleEditableText() {};
NS_IMETHOD GetCaretOffset(PRInt32 *aCaretOffset);
NS_IMETHOD SetCaretOffset(PRInt32 aCaretOffset);
NS_IMETHOD GetCharacterCount(PRInt32 *aCharacterCount);
NS_IMETHOD GetText(PRInt32 startOffset, PRInt32 endOffset, nsAString & aText);
NS_IMETHOD GetTextBeforeOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText);
NS_IMETHOD GetTextAtOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText);
NS_IMETHOD GetTextAfterOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText);
void ShutdownEditor();
static PRBool IsSingleLineTextControl(nsIDOMNode *aDomNode);
protected:
virtual nsresult GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel);
void SetEditor(nsIEditor *aEditor);
nsITextControlFrame* GetTextFrame();
nsresult GetSelectionRange(PRInt32 *aStartPos, PRInt32 *aEndPos);
nsresult SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos);
nsresult FireTextChangeEvent(AtkTextChange *aTextData);
// To solve the naming conflict with nsDocAccessible::mEditor, we have to name it
// "mPlainEditor", though it's not necessary to be a "plaintext" editor.
nsCOMPtr<nsIEditor> mPlainEditor;
};
class nsTextAccessibleWrap : public nsTextAccessible,
public nsAccessibleText
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsTextAccessibleWrap(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
};
#endif

View File

@@ -1,972 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMai.h"
#include "nsAccessibleWrap.h"
#include "nsAppRootAccessible.h"
#include "nsString.h"
#include "nsMaiInterfaceComponent.h"
#include "nsMaiInterfaceAction.h"
#include "nsMaiInterfaceText.h"
#include "nsMaiInterfaceEditableText.h"
#include "nsMaiInterfaceSelection.h"
#include "nsMaiInterfaceValue.h"
#include "nsMaiInterfaceHypertext.h"
#include "nsMaiInterfaceTable.h"
/* MaiAtkObject */
enum {
ACTIVATE,
CREATE,
DEACTIVATE,
DESTROY,
MAXIMIZE,
MINIMIZE,
RESIZE,
RESTORE,
LAST_SIGNAL
};
/**
* This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
*/
struct MaiAtkObject
{
AtkObject parent;
/*
* The nsAccessibleWrap whose properties and features are exported
* via this object instance.
*/
nsAccessibleWrap *accWrap;
};
struct MaiAtkObjectClass
{
AtkObjectClass parent_class;
};
static guint mai_atk_object_signals [LAST_SIGNAL] = { 0, };
#ifdef MAI_LOGGING
PRInt32 sMaiAtkObjCreated = 0;
PRInt32 sMaiAtkObjDeleted = 0;
#endif
G_BEGIN_DECLS
/* callbacks for MaiAtkObject */
static void classInitCB(AtkObjectClass *aClass);
static void initializeCB(AtkObject *aAtkObj, gpointer aData);
static void finalizeCB(GObject *aObj);
/* callbacks for AtkObject virtual functions */
static const gchar* getNameCB (AtkObject *aAtkObj);
static const gchar* getDescriptionCB (AtkObject *aAtkObj);
static AtkRole getRoleCB(AtkObject *aAtkObj);
static AtkObject* getParentCB(AtkObject *aAtkObj);
static gint getChildCountCB(AtkObject *aAtkObj);
static AtkObject* refChildCB(AtkObject *aAtkObj, gint aChildIndex);
static gint getIndexInParentCB(AtkObject *aAtkObj);
static AtkStateSet* refStateSetCB(AtkObject *aAtkObj);
static AtkRelationSet* refRelationSetCB(AtkObject *aAtkObj);
/* the missing atkobject virtual functions */
/*
static AtkLayer getLayerCB(AtkObject *aAtkObj);
static gint getMdiZorderCB(AtkObject *aAtkObj);
static void SetNameCB(AtkObject *aAtkObj,
const gchar *name);
static void SetDescriptionCB(AtkObject *aAtkObj,
const gchar *description);
static void SetParentCB(AtkObject *aAtkObj,
AtkObject *parent);
static void SetRoleCB(AtkObject *aAtkObj,
AtkRole role);
static guint ConnectPropertyChangeHandlerCB(
AtkObject *aObj,
AtkPropertyChangeHandler *handler);
static void RemovePropertyChangeHandlerCB(
AtkObject *aAtkObj,
guint handler_id);
static void InitializeCB(AtkObject *aAtkObj,
gpointer data);
static void ChildrenChangedCB(AtkObject *aAtkObj,
guint change_index,
gpointer changed_child);
static void FocusEventCB(AtkObject *aAtkObj,
gboolean focus_in);
static void PropertyChangeCB(AtkObject *aAtkObj,
AtkPropertyValues *values);
static void StateChangeCB(AtkObject *aAtkObj,
const gchar *name,
gboolean state_set);
static void VisibleDataChangedCB(AtkObject *aAtkObj);
*/
G_END_DECLS
static GType GetMaiAtkType(const PRUint32 & interfaceCount,
MaiInterface **interfaces);
static const char * GetUniqueMaiAtkTypeName(void);
static gpointer parent_class = NULL;
GType
mai_atk_object_get_type(void)
{
static GType type = 0;
if (!type) {
static const GTypeInfo tinfo = {
sizeof(MaiAtkObjectClass),
(GBaseInitFunc)NULL,
(GBaseFinalizeFunc)NULL,
(GClassInitFunc)classInitCB,
(GClassFinalizeFunc)NULL,
NULL, /* class data */
sizeof(MaiAtkObject), /* instance size */
0, /* nb preallocs */
(GInstanceInitFunc)NULL,
NULL /* value table */
};
type = g_type_register_static(ATK_TYPE_OBJECT,
"MaiAtkObject", &tinfo, GTypeFlags(0));
}
return type;
}
#ifdef MAI_LOGGING
PRInt32 nsAccessibleWrap::mAccWrapCreated = 0;
PRInt32 nsAccessibleWrap::mAccWrapDeleted = 0;
#endif
nsAccessibleWrap::nsAccessibleWrap(nsIDOMNode* aNode,
nsIWeakReference *aShell)
: nsAccessible(aNode, aShell),
mMaiAtkObject(nsnull),
mInterfaces(nsnull),
mInterfaceCount(0)
{
#ifdef MAI_LOGGING
++mAccWrapCreated;
#endif
MAI_LOG_DEBUG(("==nsAccessibleWrap creating: this=%p,total=%d left=%d\n",
(void*)this, mAccWrapCreated,
(mAccWrapCreated-mAccWrapDeleted)));
}
nsAccessibleWrap::~nsAccessibleWrap()
{
#ifdef MAI_LOGGING
++mAccWrapDeleted;
#endif
MAI_LOG_DEBUG(("==nsAccessibleWrap deleting: this=%p,total=%d left=%d\n",
(void*)this, mAccWrapDeleted,
(mAccWrapCreated-mAccWrapDeleted)));
if (mMaiAtkObject) {
MAI_ATK_OBJECT(mMaiAtkObject)->accWrap = nsnull;
g_object_unref(mMaiAtkObject);
}
if (mInterfaces) {
for (int index = 0; index < MAI_INTERFACE_NUM; ++index)
delete mInterfaces[index];
delete [] mInterfaces;
}
}
NS_IMETHODIMP nsAccessibleWrap::GetExtState(PRUint32 *aState)
{
PRUint32 state;
nsAccessible::GetState(&state);
if (!(state & STATE_INVISIBLE))
*aState |= EXT_STATE_SHOWING;
return NS_OK;
}
NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
{
*aOutAccessible = nsnull;
if (!mMaiAtkObject) {
CreateMaiInterfaces();
mMaiAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(GetMaiAtkType(mInterfaceCount, mInterfaces), NULL));
NS_ENSURE_TRUE(mMaiAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mMaiAtkObject, this);
mMaiAtkObject->role = ATK_ROLE_INVALID;
mMaiAtkObject->layer = ATK_LAYER_INVALID;
}
*aOutAccessible = mMaiAtkObject;
return NS_OK;
}
AtkObject *
nsAccessibleWrap::GetAtkObject(void)
{
void *atkObj = nsnull;
GetNativeInterface(&atkObj);
return NS_STATIC_CAST(AtkObject *, atkObj);
}
/* private */
nsresult
nsAccessibleWrap::CreateMaiInterfaces(void)
{
typedef MaiInterface * MaiInterfacePointer;
if (!mInterfaces) {
mInterfaces = new MaiInterfacePointer[MAI_INTERFACE_NUM];
for (PRUint16 index = 0; index < MAI_INTERFACE_NUM; ++index) {
mInterfaces[index] = nsnull;
}
NS_ENSURE_TRUE(mInterfaces, NS_ERROR_OUT_OF_MEMORY);
}
// Add Interfaces for each nsIAccessible.ext interfaces
nsresult rv;
// the Component interface are supported by all nsIAccessible
MaiInterfaceComponent *maiInterfaceComponent =
new MaiInterfaceComponent(this);
NS_ENSURE_TRUE(maiInterfaceComponent, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceComponent);
NS_ENSURE_SUCCESS(rv, rv);
// Add Action interface if the action count is more than zero.
PRUint8 actionCount = 0;
rv = GetNumActions(&actionCount);
if (NS_SUCCEEDED(rv) && actionCount > 0) {
MaiInterfaceAction *maiInterfaceAction = new MaiInterfaceAction(this);
NS_ENSURE_TRUE(maiInterfaceAction, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceAction);
NS_ENSURE_SUCCESS(rv, rv);
}
PRUint32 accRole;
rv = GetRole(&accRole);
if (accRole != nsIAccessible::ROLE_HTML_CONTAINER) {
//nsIAccessibleText
nsCOMPtr<nsIAccessibleText> accessInterfaceText;
QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accessInterfaceText));
if (accessInterfaceText) {
MaiInterfaceText *maiInterfaceText = new MaiInterfaceText(this);
NS_ENSURE_TRUE(maiInterfaceText, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceText);
NS_ENSURE_SUCCESS(rv, rv);
}
//nsIAccessibleEditableText
nsCOMPtr<nsIAccessibleEditableText> accessInterfaceEditableText;
QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accessInterfaceEditableText));
if (accessInterfaceEditableText) {
MaiInterfaceEditableText *maiInterfaceEditableText =
new MaiInterfaceEditableText(this);
NS_ENSURE_TRUE(maiInterfaceEditableText, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceEditableText);
NS_ENSURE_SUCCESS(rv, rv);
}
}
//nsIAccessibleSelection
nsCOMPtr<nsIAccessibleSelectable> accessInterfaceSelection;
QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accessInterfaceSelection));
if (accessInterfaceSelection) {
MaiInterfaceSelection *maiInterfaceSelection =
new MaiInterfaceSelection(this);
NS_ENSURE_TRUE(maiInterfaceSelection, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceSelection);
NS_ENSURE_SUCCESS(rv, rv);
}
//nsIAccessibleValue
nsCOMPtr<nsIAccessibleValue> accessInterfaceValue;
QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accessInterfaceValue));
if (accessInterfaceValue) {
MaiInterfaceValue *maiInterfaceValue = new MaiInterfaceValue(this);
NS_ENSURE_TRUE(maiInterfaceValue, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceValue);
NS_ENSURE_SUCCESS(rv, rv);
}
//nsIAccessibleHypertext
PRInt32 linkCount = 0;
nsCOMPtr<nsIAccessibleHyperText> accessInterfaceHypertext;
QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
getter_AddRefs(accessInterfaceHypertext));
if (accessInterfaceHypertext) {
rv = accessInterfaceHypertext->GetLinks(&linkCount);
if (NS_SUCCEEDED(rv) && (linkCount > 0)) {
MaiInterfaceHypertext *maiInterfaceHypertext =
new MaiInterfaceHypertext(this, mWeakShell);
NS_ENSURE_TRUE(maiInterfaceHypertext, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceHypertext);
NS_ENSURE_SUCCESS(rv, rv);
}
}
//nsIAccessibleTable
if (accRole == nsIAccessible::ROLE_TREE_TABLE) {
// In most cases, html table is used as container to arrange the webpage,
// not to represent a "real" table with practical colum, colum heaer, row.
// So, only add maiInterfaceTable for XUL table.
nsCOMPtr<nsIAccessibleTable> accessInterfaceTable;
QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accessInterfaceTable));
if (accessInterfaceTable) {
MaiInterfaceTable *maiInterfaceTable = new MaiInterfaceTable(this);
NS_ENSURE_TRUE(maiInterfaceTable, NS_ERROR_OUT_OF_MEMORY);
rv = AddMaiInterface(maiInterfaceTable);
NS_ENSURE_SUCCESS(rv, rv);
}
}
return rv;
}
nsresult
nsAccessibleWrap::AddMaiInterface(MaiInterface *aMaiIface)
{
NS_ENSURE_ARG_POINTER(aMaiIface);
MaiInterfaceType aMaiIfaceType = aMaiIface->GetType();
if ((aMaiIfaceType <= MAI_INTERFACE_INVALID) ||
(aMaiIfaceType >= MAI_INTERFACE_NUM))
return NS_ERROR_FAILURE;
// if same type of If has been added, release previous one
if (mInterfaces[aMaiIfaceType]) {
delete mInterfaces[aMaiIfaceType];
}
mInterfaces[aMaiIfaceType] = aMaiIface;
mInterfaceCount++;
return NS_OK;
}
MaiInterface *
nsAccessibleWrap::GetMaiInterface(PRInt16 aIfaceType)
{
NS_ENSURE_TRUE(aIfaceType > MAI_INTERFACE_INVALID, nsnull);
NS_ENSURE_TRUE(aIfaceType < MAI_INTERFACE_NUM, nsnull);
return mInterfaces[aIfaceType];
}
static GType
GetMaiAtkType(const PRUint32 & interfaceCount, MaiInterface **interfaces)
{
GType type;
static const GTypeInfo tinfo = {
sizeof(MaiAtkObjectClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) NULL,
(GClassFinalizeFunc) NULL,
NULL, /* class data */
sizeof(MaiAtkObject), /* instance size */
0, /* nb preallocs */
(GInstanceInitFunc) NULL,
NULL /* value table */
};
if (interfaceCount == 0)
return MAI_TYPE_ATK_OBJECT;
type = g_type_register_static(MAI_TYPE_ATK_OBJECT,
GetUniqueMaiAtkTypeName(),
&tinfo, GTypeFlags(0));
for (int index = 0; index < MAI_INTERFACE_NUM; index++) {
if (!interfaces[index])
continue;
g_type_add_interface_static(type,
interfaces[index]->GetAtkType(),
interfaces[index]->GetInterfaceInfo());
}
return type;
}
static const char *
GetUniqueMaiAtkTypeName(void)
{
#define MAI_ATK_TYPE_NAME_LEN (30) /* 10+sizeof(gulong)*8/4+1 < 30 */
static PRUint32 atkTypeNameIndex = 0;
static gchar namePrefix[] = "MaiAtkType"; /* size = 10 */
static gchar name[MAI_ATK_TYPE_NAME_LEN + 1];
sprintf(name, "%s%x", namePrefix, atkTypeNameIndex++);
name[MAI_ATK_TYPE_NAME_LEN] = '\0';
MAI_LOG_DEBUG(("MaiWidget::LastedTypeName=%s\n", name));
return name;
}
/******************************************************************************
The following nsIAccessible states aren't translated, just ignored.
STATE_MIXED: For a three-state check box.
STATE_READONLY: The object is designated read-only.
STATE_HOTTRACKED: Means its appearance has changed to indicate mouse
over it.
STATE_FLOATING: Not supported yet.
STATE_MARQUEED: Indicate scrolling or moving text or graphics.
STATE_ANIMATED:
STATE_OFFSCREEN: Has no on-screen representation.
STATE_MOVEABLE:
STATE_SELFVOICING: The object has self-TTS.
STATE_LINKED: The object is formatted as a hyperlink.
STATE_TRAVERSE: The object is a hyperlink that has been visited.
STATE_EXTSELECTABLE: Indicates that an object extends its selectioin.
STATE_ALERT_LOW: Not supported yet.
STATE_ALERT_MEDIUM: Not supported yet.
STATE_ALERT_HIGH: Not supported yet.
STATE_PROTECTED: The object is a password-protected edit control.
STATE_HASPOPUP: Object displays a pop-up menu or window when invoked.
Returned AtkStatusSet never contain the following AtkStates.
ATK_STATE_ARMED: Indicates that the object is armed.
ATK_STATE_DEFUNCT: Indicates the user interface object corresponding to
thus object no longer exists.
ATK_STATE_HORIZONTAL:Indicates the orientation of this object is horizontal.
ATK_STATE_ICONIFIED:
ATK_STATE_OPAQUE: Indicates the object paints every pixel within its
rectangular region
ATK_STATE_STALE: The index associated with this object has changed since
the user accessed the object
******************************************************************************/
void
nsAccessibleWrap::TranslateStates(PRUint32 aState, PRUint32 aExtState, void *aAtkStateSet)
{
if (!aAtkStateSet)
return;
AtkStateSet *state_set = NS_STATIC_CAST(AtkStateSet *, aAtkStateSet);
if (aState & nsIAccessible::STATE_SELECTED)
atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
if (aState & nsIAccessible::STATE_FOCUSED)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
if (aState & nsIAccessible::STATE_PRESSED)
atk_state_set_add_state (state_set, ATK_STATE_PRESSED);
if (aState & nsIAccessible::STATE_CHECKED)
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
if (aState & nsIAccessible::STATE_EXPANDED)
atk_state_set_add_state (state_set, ATK_STATE_EXPANDED);
if (aState & nsIAccessible::STATE_COLLAPSED)
atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE);
// The control can't accept input at this time
if (aState & nsIAccessible::STATE_BUSY)
atk_state_set_add_state (state_set, ATK_STATE_BUSY);
if (aState & nsIAccessible::STATE_FOCUSABLE)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
if (!(aState & nsIAccessible::STATE_INVISIBLE))
atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
if (aState & nsIAccessible::STATE_SELECTABLE)
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
if (aState & nsIAccessible::STATE_SIZEABLE)
atk_state_set_add_state (state_set, ATK_STATE_RESIZABLE);
if (aState & nsIAccessible::STATE_MULTISELECTABLE)
atk_state_set_add_state (state_set, ATK_STATE_MULTISELECTABLE);
if (!(aState & nsIAccessible::STATE_UNAVAILABLE)) {
atk_state_set_add_state (state_set, ATK_STATE_ENABLED);
atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
}
if (aState & nsIAccessible::STATE_INVALID)
atk_state_set_add_state (state_set, ATK_STATE_INVALID);
#ifdef ATK_STATE_DEFAULT
if (aState & nsIAccessible::STATE_DEFAULT)
atk_state_set_add_state (state_set, ATK_STATE_DEFAULT);
#endif
#ifdef ATK_STATE_REQUIRED
if (aState & nsIAccessible::STATE_REQUIRED)
atk_state_set_add_state (state_set, ATK_STATE_REQUIRED);
#endif
// The following state is
// Extended state flags (for now non-MSAA, for Java and Gnome/ATK support)
if (aExtState & nsIAccessible::EXT_STATE_ACTIVE)
atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
if (aExtState & nsIAccessible::EXT_STATE_EXPANDABLE)
atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE);
if (aExtState & nsIAccessible::EXT_STATE_MODAL)
atk_state_set_add_state (state_set, ATK_STATE_MODAL);
if (aExtState & nsIAccessible::EXT_STATE_MULTI_LINE)
atk_state_set_add_state (state_set, ATK_STATE_MULTI_LINE);
if (aExtState & nsIAccessible::EXT_STATE_SENSITIVE)
atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
if (aExtState & nsIAccessible::EXT_STATE_SHOWING)
atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
if (aExtState & nsIAccessible::EXT_STATE_SINGLE_LINE)
atk_state_set_add_state (state_set, ATK_STATE_SINGLE_LINE);
if (aExtState & nsIAccessible::EXT_STATE_TRANSIENT)
atk_state_set_add_state (state_set, ATK_STATE_TRANSIENT);
if (aExtState & nsIAccessible::EXT_STATE_VERTICAL)
atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
if (aState & nsIAccessible::EXT_STATE_EDITABLE)
atk_state_set_add_state (state_set, ATK_STATE_EDITABLE);
}
PRBool nsAccessibleWrap::IsValidObject()
{
// to ensure we are not shut down
return (mDOMNode != nsnull);
}
/* static functions for ATK callbacks */
void
classInitCB(AtkObjectClass *aClass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(aClass);
parent_class = g_type_class_peek_parent(aClass);
aClass->get_name = getNameCB;
aClass->get_description = getDescriptionCB;
aClass->get_parent = getParentCB;
aClass->get_n_children = getChildCountCB;
aClass->ref_child = refChildCB;
aClass->get_index_in_parent = getIndexInParentCB;
aClass->get_role = getRoleCB;
aClass->ref_state_set = refStateSetCB;
aClass->ref_relation_set = refRelationSetCB;
aClass->initialize = initializeCB;
gobject_class->finalize = finalizeCB;
mai_atk_object_signals [ACTIVATE] =
g_signal_new ("activate",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [CREATE] =
g_signal_new ("create",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [DEACTIVATE] =
g_signal_new ("deactivate",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [DESTROY] =
g_signal_new ("destroy",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [MAXIMIZE] =
g_signal_new ("maximize",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [MINIMIZE] =
g_signal_new ("minimize",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [RESIZE] =
g_signal_new ("resize",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mai_atk_object_signals [RESTORE] =
g_signal_new ("restore",
MAI_TYPE_ATK_OBJECT,
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
void
initializeCB(AtkObject *aAtkObj, gpointer aData)
{
NS_ASSERTION((MAI_IS_ATK_OBJECT(aAtkObj)), "Invalid AtkObject");
NS_ASSERTION(aData, "Invalid Data to init AtkObject");
if (!aAtkObj || !aData)
return;
/* call parent init function */
/* AtkObjectClass has not a "initialize" function now,
* maybe it has later
*/
if (ATK_OBJECT_CLASS(parent_class)->initialize)
ATK_OBJECT_CLASS(parent_class)->initialize(aAtkObj, aData);
/* initialize object */
MAI_ATK_OBJECT(aAtkObj)->accWrap =
NS_STATIC_CAST(nsAccessibleWrap*, aData);
#ifdef MAI_LOGGING
++sMaiAtkObjCreated;
#endif
MAI_LOG_DEBUG(("MaiAtkObj Create obj=%p for AccWrap=%p, all=%d, left=%d\n",
(void*)aAtkObj, (void*)aData, sMaiAtkObjCreated,
(sMaiAtkObjCreated-sMaiAtkObjDeleted)));
}
void
finalizeCB(GObject *aObj)
{
if (!MAI_IS_ATK_OBJECT(aObj))
return;
NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == nsnull, "AccWrap NOT null");
#ifdef MAI_LOGGING
++sMaiAtkObjDeleted;
#endif
MAI_LOG_DEBUG(("MaiAtkObj Delete obj=%p, all=%d, left=%d\n",
(void*)aObj, sMaiAtkObjCreated,
(sMaiAtkObjCreated-sMaiAtkObjDeleted)));
// call parent finalize function
// finalize of GObjectClass will unref the accessible parent if has
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize(aObj);
}
const gchar *
getNameCB(AtkObject *aAtkObj)
{
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), nsnull);
nsAutoString uniName;
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
/* nsIAccessible is responsible for the non-NULL name */
nsresult rv = accWrap->GetName(uniName);
NS_ENSURE_SUCCESS(rv, nsnull);
if (uniName.Length() > 0) {
NS_ConvertUTF8toUTF16 objName(aAtkObj->name);
if (!uniName.Equals(objName)) {
atk_object_set_name(aAtkObj,
NS_ConvertUTF16toUTF8(uniName).get());
}
}
return aAtkObj->name;
}
const gchar *
getDescriptionCB(AtkObject *aAtkObj)
{
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), nsnull);
if (!aAtkObj->description) {
gint len;
nsAutoString uniDesc;
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
/* nsIAccessible is responsible for the non-NULL description */
nsresult rv = accWrap->GetDescription(uniDesc);
NS_ENSURE_SUCCESS(rv, nsnull);
len = uniDesc.Length();
if (len > 0) {
atk_object_set_description(aAtkObj,
NS_ConvertUTF16toUTF8(uniDesc).get());
}
}
return aAtkObj->description;
}
AtkRole
getRoleCB(AtkObject *aAtkObj)
{
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), ATK_ROLE_INVALID);
if (aAtkObj->role == ATK_ROLE_INVALID) {
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
PRUint32 accRole;
nsresult rv = accWrap->GetFinalRole(&accRole);
NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);
//the cross-platform Accessible object returns the same value for
//both "ROLE_MENUITEM" and "ROLE_MENUPOPUP"
if (accRole == nsIAccessible::ROLE_MENUITEM) {
PRInt32 childCount = 0;
accWrap->GetChildCount(&childCount);
if (childCount > 0)
accRole = nsIAccessible::ROLE_MENUPOPUP;
}
else if (accRole == nsIAccessible::ROLE_LINK) {
//ATK doesn't have role-link now
//register it on runtime
static AtkRole linkRole = (AtkRole)0;
if (linkRole == 0) {
linkRole = atk_role_register("hyper link");
}
accRole = linkRole;
}
#ifndef ATK_ROLE_AUTOCOMPLETE
else if (accRole == nsIAccessible::ROLE_AUTOCOMPLETE) {
accRole == ATK_ROLE_COMBO_BOX;
}
#endif
#ifndef ATK_ROLE_CAPTION
else if (accRole == nsIAccessible::ROLE_CAPTION) {
accRole == ATK_ROLE_LABEL;
}
#endif
aAtkObj->role = NS_STATIC_CAST(AtkRole, accRole);
}
return aAtkObj->role;
}
AtkObject *
getParentCB(AtkObject *aAtkObj)
{
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), nsnull);
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
nsCOMPtr<nsIAccessible> accParent;
nsresult rv = accWrap->GetParent(getter_AddRefs(accParent));
if (NS_FAILED(rv) || !accParent)
return nsnull;
nsIAccessible *tmpParent = accParent;
nsAccessibleWrap *accWrapParent = NS_STATIC_CAST(nsAccessibleWrap *,
tmpParent);
AtkObject *parentAtkObj = accWrapParent->GetAtkObject();
if (parentAtkObj && !aAtkObj->accessible_parent) {
atk_object_set_parent(aAtkObj, parentAtkObj);
}
return parentAtkObj;
}
gint
getChildCountCB(AtkObject *aAtkObj)
{
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), 0);
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
PRInt32 count = 0;
accWrap->GetChildCount(&count);
return count;
}
AtkObject *
refChildCB(AtkObject *aAtkObj, gint aChildIndex)
{
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), nsnull);
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
nsresult rv;
nsCOMPtr<nsIAccessible> accChild;
rv = accWrap->GetChildAt(aChildIndex, getter_AddRefs(accChild));
if (NS_FAILED(rv) || !accChild)
return nsnull;
nsIAccessible *tmpAccChild = accChild;
nsAccessibleWrap *accWrapChild =
NS_STATIC_CAST(nsAccessibleWrap*, tmpAccChild);
//this will addref parent
AtkObject *childAtkObj = accWrapChild->GetAtkObject();
NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
if (!childAtkObj)
return nsnull;
atk_object_set_parent(childAtkObj,
accWrap->GetAtkObject());
g_object_ref(childAtkObj);
return childAtkObj;
}
gint
getIndexInParentCB(AtkObject *aAtkObj)
{
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), -1);
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
PRInt32 currentIndex = -1;
accWrap->GetIndexInParent(&currentIndex);
return currentIndex;
}
AtkStateSet *
refStateSetCB(AtkObject *aAtkObj)
{
AtkStateSet *state_set = nsnull;
state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), state_set);
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
PRUint32 accState = 0;
nsresult rv = accWrap->GetFinalState(&accState);
NS_ENSURE_SUCCESS(rv, state_set);
PRUint32 accExtState = 0;
rv = accWrap->GetExtState(&accExtState);
NS_ENSURE_SUCCESS(rv, state_set);
if ((accState == 0) && (accExtState == 0))
return state_set;
nsAccessibleWrap::TranslateStates(accState, accExtState, state_set);
return state_set;
}
AtkRelationSet *
refRelationSetCB(AtkObject *aAtkObj)
{
AtkRelationSet *relation_set = nsnull;
relation_set = ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj);
NS_ENSURE_SUCCESS(CheckMaiAtkObject(aAtkObj), relation_set);
nsAccessibleWrap *accWrap =
NS_REINTERPRET_CAST(MaiAtkObject*, aAtkObj)->accWrap;
AtkObject *accessible_array[1];
AtkRelation* relation;
PRUint32 relationType[2] = {nsIAccessible::RELATION_LABELLED_BY,
nsIAccessible::RELATION_LABEL_FOR};
for (PRUint32 i = 0; i <= 1; i++) {
if (!atk_relation_set_contains(relation_set, NS_STATIC_CAST(AtkRelationType, relationType[i]))) {
nsIAccessible* accRelated;
nsresult rv = accWrap->GetAccessibleRelated(relationType[i], &accRelated);
if (NS_SUCCEEDED(rv) && accRelated) {
accessible_array[0] = NS_STATIC_CAST(nsAccessibleWrap*, accRelated)->GetAtkObject();
relation = atk_relation_new(accessible_array, 1,
NS_STATIC_CAST(AtkRelationType, relationType[i]));
atk_relation_set_add(relation_set, relation);
}
}
}
return relation_set;
}
// Check if aAtkObj is a valid MaiAtkObject
nsresult
CheckMaiAtkObject(AtkObject *aAtkObj)
{
NS_ENSURE_ARG(MAI_IS_ATK_OBJECT(aAtkObj));
nsAccessibleWrap * tmpAccWrap = MAI_ATK_OBJECT(aAtkObj)->accWrap;
if (tmpAccWrap == nsnull)
return NS_ERROR_INVALID_POINTER;
if (tmpAccWrap != nsAppRootAccessible::Create() && !tmpAccWrap->IsValidObject())
return NS_ERROR_INVALID_POINTER;
if (tmpAccWrap->GetAtkObject() != aAtkObj)
return NS_ERROR_FAILURE;
return NS_OK;
}
// Check if aAtkObj is a valid MaiAtkObject, and return the nsAccessibleWrap
// for it.
nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
{
NS_ENSURE_TRUE(MAI_IS_ATK_OBJECT(aAtkObj), nsnull);
nsAccessibleWrap * tmpAccWrap = MAI_ATK_OBJECT(aAtkObj)->accWrap;
NS_ENSURE_TRUE(tmpAccWrap != nsnull, nsnull);
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
return tmpAccWrap;
}

View File

@@ -1,100 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __NS_ACCESSIBLE_WRAP_H__
#define __NS_ACCESSIBLE_WRAP_H__
#include "nsCOMPtr.h"
#include "nsAccessible.h"
#include "prlog.h"
#ifdef PR_LOGGING
#define MAI_LOGGING
#endif /* #ifdef PR_LOGGING */
class nsAccessibleWrap;
class MaiInterface;
struct _AtkObject;
typedef struct _AtkObject AtkObject;
/**
* nsAccessibleWrap, and its descendents in atk directory provide the
* implementation of AtkObject.
*/
class nsAccessibleWrap: public nsAccessible
{
public:
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
virtual ~nsAccessibleWrap();
#ifdef MAI_LOGGING
virtual void DumpnsAccessibleWrapInfo(int aDepth) {}
static PRInt32 mAccWrapCreated;
static PRInt32 mAccWrapDeleted;
#endif
public:
// return the atk object for this nsAccessibleWrap
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
NS_IMETHOD GetExtState(PRUint32 *aState);
AtkObject * GetAtkObject(void);
MaiInterface *GetMaiInterface(PRInt16 aIfaceType);
PRBool IsValidObject();
static void TranslateStates(PRUint32 aState,
PRUint32 aExtState,
void *aAtkStateSet);
protected:
AtkObject *mMaiAtkObject;
private:
nsresult CreateMaiInterfaces(void);
nsresult AddMaiInterface(MaiInterface *aMaiIface);
MaiInterface **mInterfaces;
PRUint32 mInterfaceCount;
};
#endif /* __NS_ACCESSIBLE_WRAP_H__ */

View File

@@ -1,842 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
* Ginn Chen (ginn.chen@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsMai.h"
#include "nsAppRootAccessible.h"
#include "prlink.h"
#include "nsIServiceManager.h"
#include <gtk/gtk.h>
#include <atk/atk.h>
/* maiutil */
static guint mai_util_add_global_event_listener(GSignalEmissionHook listener,
const gchar *event_type);
static void mai_util_remove_global_event_listener(guint remove_listener);
static guint mai_util_add_key_event_listener(AtkKeySnoopFunc listener,
gpointer data);
static void mai_util_remove_key_event_listener(guint remove_listener);
static AtkObject *mai_util_get_root(void);
static G_CONST_RETURN gchar *mai_util_get_toolkit_name(void);
static G_CONST_RETURN gchar *mai_util_get_toolkit_version(void);
/* Misc */
static void _listener_info_destroy(gpointer data);
static guint add_listener (GSignalEmissionHook listener,
const gchar *object_type,
const gchar *signal,
const gchar *hook_data);
static AtkKeyEventStruct *atk_key_event_from_gdk_event_key(GdkEventKey *key);
static gboolean notify_hf(gpointer key, gpointer value, gpointer data);
static void insert_hf(gpointer key, gpointer value, gpointer data);
static gboolean remove_hf(gpointer key, gpointer value, gpointer data);
static gint mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event,
gpointer func_data);
static void value_destroy_func(gpointer data);
static GHashTable *listener_list = NULL;
static gint listener_idx = 1;
typedef struct _MaiUtilListenerInfo MaiUtilListenerInfo;
#define MAI_TYPE_UTIL (mai_util_get_type ())
#define MAI_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
MAI_TYPE_UTIL, MaiUtil))
#define MAI_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
MAI_TYPE_UTIL, MaiUtilClass))
#define MAI_IS_UTIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
MAI_TYPE_UTIL))
#define MAI_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
MAI_TYPE_UTIL))
#define MAI_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
MAI_TYPE_UTIL, MaiUtilClass))
typedef struct _MaiUtil MaiUtil;
typedef struct _MaiUtilClass MaiUtilClass;
static GHashTable *key_listener_list = NULL;
static guint key_snooper_id = 0;
G_BEGIN_DECLS
typedef void (*GnomeAccessibilityInit) (void);
typedef void (*GnomeAccessibilityShutdown) (void);
G_END_DECLS
struct _MaiUtil
{
AtkUtil parent;
GList *listener_list;
};
struct MaiKeyListenerInfo
{
AtkKeySnoopFunc listener;
gpointer data;
};
struct GnomeAccessibilityModule
{
const char *libName;
PRLibrary *lib;
const char *initName;
GnomeAccessibilityInit init;
const char *shutdownName;
GnomeAccessibilityShutdown shutdown;
};
GType mai_util_get_type (void);
static void mai_util_class_init(MaiUtilClass *klass);
struct _MaiUtilClass
{
AtkUtilClass parent_class;
};
/* supporting */
PRLogModuleInfo *gMaiLog = NULL;
#define MAI_VERSION "0.0.6"
#define MAI_NAME "mozilla"
struct _MaiUtilListenerInfo
{
gint key;
guint signal_id;
gulong hook_id;
};
static GnomeAccessibilityModule sAtkBridge = {
#ifdef AIX
"libatk-bridge.a(libatk-bridge.so.0)", NULL,
#else
"libatk-bridge.so", NULL,
#endif
"gnome_accessibility_module_init", NULL,
"gnome_accessibility_module_shutdown", NULL,
};
GType
mai_util_get_type(void)
{
static GType type = 0;
if (!type) {
static const GTypeInfo tinfo = {
sizeof(MaiUtilClass),
(GBaseInitFunc) NULL, /* base init */
(GBaseFinalizeFunc) NULL, /* base finalize */
(GClassInitFunc) mai_util_class_init, /* class init */
(GClassFinalizeFunc) NULL, /* class finalize */
NULL, /* class data */
sizeof(MaiUtil), /* instance size */
0, /* nb preallocs */
(GInstanceInitFunc) NULL, /* instance init */
NULL /* value table */
};
type = g_type_register_static(ATK_TYPE_UTIL,
"MaiUtil", &tinfo, GTypeFlags(0));
}
return type;
}
/* intialize the the atk interface (function pointers) with MAI implementation.
* When atk bridge get loaded, these interface can be used.
*/
static void
mai_util_class_init(MaiUtilClass *klass)
{
AtkUtilClass *atk_class;
gpointer data;
data = g_type_class_peek(ATK_TYPE_UTIL);
atk_class = ATK_UTIL_CLASS(data);
atk_class->add_global_event_listener =
mai_util_add_global_event_listener;
atk_class->remove_global_event_listener =
mai_util_remove_global_event_listener;
atk_class->add_key_event_listener = mai_util_add_key_event_listener;
atk_class->remove_key_event_listener = mai_util_remove_key_event_listener;
atk_class->get_root = mai_util_get_root;
atk_class->get_toolkit_name = mai_util_get_toolkit_name;
atk_class->get_toolkit_version = mai_util_get_toolkit_version;
listener_list = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
_listener_info_destroy);
}
static guint
mai_util_add_global_event_listener(GSignalEmissionHook listener,
const gchar *event_type)
{
guint rc = 0;
gchar **split_string;
split_string = g_strsplit (event_type, ":", 3);
if (split_string) {
if (!strcmp ("window", split_string[0])) {
/* ???
static gboolean initialized = FALSE;
if (!initialized) {
do_window_event_initialization ();
initialized = TRUE;
}
rc = add_listener (listener, "MaiWindow",
split_string[1], event_type);
*/
rc = add_listener (listener, "MaiAtkObject", split_string[1], event_type);
}
else {
rc = add_listener (listener, split_string[1], split_string[2],
event_type);
}
}
return rc;
}
static void
mai_util_remove_global_event_listener(guint remove_listener)
{
if (remove_listener > 0) {
MaiUtilListenerInfo *listener_info;
gint tmp_idx = remove_listener;
listener_info = (MaiUtilListenerInfo *)
g_hash_table_lookup(listener_list, &tmp_idx);
if (listener_info != NULL) {
/* Hook id of 0 and signal id of 0 are invalid */
if (listener_info->hook_id != 0 && listener_info->signal_id != 0) {
/* Remove the emission hook */
g_signal_remove_emission_hook(listener_info->signal_id,
listener_info->hook_id);
/* Remove the element from the hash */
g_hash_table_remove(listener_list, &tmp_idx);
}
else {
/* do not use g_warning with such complex format args, */
/* Forte CC can not preprocess it correctly */
g_log((gchar *)0, G_LOG_LEVEL_WARNING,
"Invalid listener hook_id %ld or signal_id %d\n",
listener_info->hook_id, listener_info->signal_id);
}
}
else {
/* do not use g_warning with such complex format args, */
/* Forte CC can not preprocess it correctly */
g_log((gchar *)0, G_LOG_LEVEL_WARNING,
"No listener with the specified listener id %d",
remove_listener);
}
}
else {
g_warning("Invalid listener_id %d", remove_listener);
}
}
static AtkKeyEventStruct *
atk_key_event_from_gdk_event_key (GdkEventKey *key)
{
AtkKeyEventStruct *event = g_new0(AtkKeyEventStruct, 1);
switch (key->type) {
case GDK_KEY_PRESS:
event->type = ATK_KEY_EVENT_PRESS;
break;
case GDK_KEY_RELEASE:
event->type = ATK_KEY_EVENT_RELEASE;
break;
default:
g_assert_not_reached ();
return NULL;
}
event->state = key->state;
event->keyval = key->keyval;
event->length = key->length;
if (key->string && key->string [0] &&
(key->state & GDK_CONTROL_MASK ||
g_unichar_isgraph (g_utf8_get_char (key->string)))) {
event->string = key->string;
}
else if (key->type == GDK_KEY_PRESS ||
key->type == GDK_KEY_RELEASE) {
event->string = gdk_keyval_name (key->keyval);
}
event->keycode = key->hardware_keycode;
event->timestamp = key->time;
MAI_LOG_DEBUG(("MaiKey:\tsym %u\n\tmods %x\n\tcode %u\n\ttime %lx\n",
(unsigned int) event->keyval,
(unsigned int) event->state,
(unsigned int) event->keycode,
(unsigned long int) event->timestamp));
return event;
}
static gboolean
notify_hf(gpointer key, gpointer value, gpointer data)
{
AtkKeyEventStruct *event = (AtkKeyEventStruct *) data;
MaiKeyListenerInfo *info = (MaiKeyListenerInfo *)value;
return (*(info->listener))(event, info->data) ? TRUE : FALSE;
}
static void
value_destroy_func(gpointer data)
{
g_free(data);
}
static void
insert_hf(gpointer key, gpointer value, gpointer data)
{
GHashTable *new_table = (GHashTable *) data;
g_hash_table_insert (new_table, key, value);
}
static gboolean
remove_hf(gpointer key, gpointer value, gpointer data)
{
AtkKeySnoopFunc listener = (AtkKeySnoopFunc)data;
MaiKeyListenerInfo *info = (MaiKeyListenerInfo *)value;
if (info->listener == listener)
return TRUE;
return FALSE;
}
static gint
mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event, gpointer func_data)
{
/* notify each AtkKeySnoopFunc in turn... */
gint consumed = 0;
if (key_listener_list) {
AtkKeyEventStruct *keyEvent = atk_key_event_from_gdk_event_key(event);
GHashTable *new_hash = g_hash_table_new(NULL, NULL);
g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
consumed = g_hash_table_foreach_steal (new_hash, notify_hf, keyEvent);
g_hash_table_destroy (new_hash);
g_free (keyEvent);
}
return (consumed ? 1 : 0);
}
static guint
mai_util_add_key_event_listener (AtkKeySnoopFunc listener,
gpointer data)
{
NS_ENSURE_TRUE(listener, 0);
static guint key=0;
MaiKeyListenerInfo *info = g_new0(MaiKeyListenerInfo, 1);
NS_ENSURE_TRUE(info, 0);
info->listener = listener;
info->data = data;
if (!key_listener_list) {
key_listener_list = g_hash_table_new_full(NULL, NULL, NULL,
value_destroy_func);
key_snooper_id = gtk_key_snooper_install(mai_key_snooper, NULL);
}
g_hash_table_insert(key_listener_list, GUINT_TO_POINTER (key++),
(gpointer)info);
return key;
}
static void
mai_util_remove_key_event_listener (guint remove_listener)
{
g_hash_table_foreach_remove(key_listener_list, remove_hf,
(gpointer)remove_listener);
if (g_hash_table_size(key_listener_list) == 0) {
gtk_key_snooper_remove(key_snooper_id);
}
}
AtkObject *
mai_util_get_root(void)
{
nsAppRootAccessible *root = nsAppRootAccessible::Create();
if (!root)
return nsnull;
return root->GetAtkObject();
}
G_CONST_RETURN gchar *
mai_util_get_toolkit_name(void)
{
return MAI_NAME;
}
G_CONST_RETURN gchar *
mai_util_get_toolkit_version(void)
{
return MAI_VERSION;
}
void
_listener_info_destroy(gpointer data)
{
g_free(data);
}
guint
add_listener (GSignalEmissionHook listener,
const gchar *object_type,
const gchar *signal,
const gchar *hook_data)
{
GType type;
guint signal_id;
gint rc = 0;
type = g_type_from_name(object_type);
if (type) {
signal_id = g_signal_lookup(signal, type);
if (signal_id > 0) {
MaiUtilListenerInfo *listener_info;
rc = listener_idx;
listener_info = (MaiUtilListenerInfo *)
g_malloc(sizeof(MaiUtilListenerInfo));
listener_info->key = listener_idx;
listener_info->hook_id =
g_signal_add_emission_hook(signal_id, 0, listener,
g_strdup(hook_data),
(GDestroyNotify)g_free);
listener_info->signal_id = signal_id;
g_hash_table_insert(listener_list, &(listener_info->key),
listener_info);
listener_idx++;
}
else {
g_warning("Invalid signal type %s\n", signal);
}
}
else {
g_warning("Invalid object type %s\n", object_type);
}
return rc;
}
// currently support one child
nsRootAccessibleWrap *sOnlyChild = nsnull;
static nsresult LoadGtkModule(GnomeAccessibilityModule& aModule);
nsAppRootAccessible::nsAppRootAccessible():
nsAccessibleWrap(nsnull, nsnull),
mChildren(nsnull),
mInitialized(PR_FALSE)
{
MAI_LOG_DEBUG(("======Create AppRootAcc=%p\n", (void*)this));
}
nsAppRootAccessible::~nsAppRootAccessible()
{
MAI_LOG_DEBUG(("======Destory AppRootAcc=%p\n", (void*)this));
}
/* virtual functions */
#if 0
#ifdef MAI_LOGGING
void
nsAppRootAccessible::DumpMaiObjectInfo(int aDepth)
{
--aDepth;
if (aDepth < 0)
return;
g_print("nsAppRootAccessible: this=0x%x, aDepth=%d, type=%s\n",
(unsigned int)this, aDepth, "nsAppRootAccessible");
gint nChild = GetChildCount();
g_print("#child=%d<br>\n", nChild);
g_print("Iface num: 1=component, 2=action, 3=value, 4=editabletext,"
"5=hyperlink, 6=hypertext, 7=selection, 8=table, 9=text\n");
g_print("<ul>\n");
MaiObject *maiChild;
for (int childIndex = 0; childIndex < nChild; childIndex++) {
maiChild = RefChild(childIndex);
if (maiChild) {
g_print(" <li>");
maiChild->DumpMaiObjectInfo(aDepth);
}
}
g_print("</ul>\n");
g_print("End of nsAppRootAccessible: this=0x%x, type=%s\n<br>",
(unsigned int)this, "nsAppRootAccessible");
}
#endif
#endif
NS_IMETHODIMP nsAppRootAccessible::Init()
{
NS_ASSERTION((mInitialized == FALSE), "Init AppRoot Again!!");
if (mInitialized == PR_TRUE)
return NS_OK;
MAI_LOG_DEBUG(("Mozilla Atk Implementation initializing\n"));
g_type_init();
// Initialize the MAI Utility class
g_type_class_unref(g_type_class_ref(MAI_TYPE_UTIL));
// load and initialize atk-bridge library
nsresult rv = LoadGtkModule(sAtkBridge);
if (NS_SUCCEEDED(rv)) {
// init atk-bridge
(*sAtkBridge.init)();
}
else
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
rv = NS_NewArray(getter_AddRefs(mChildren));
return rv;
}
NS_IMETHODIMP nsAppRootAccessible::Shutdown()
{
nsAppRootAccessible *root = nsAppRootAccessible::Create();
if (root)
NS_IF_RELEASE(root);
if (sAtkBridge.lib) {
if (sAtkBridge.shutdown)
(*sAtkBridge.shutdown)();
//Not unload atk-bridge library
//an exit function registered will take care of it
sAtkBridge.lib = NULL;
sAtkBridge.init = NULL;
sAtkBridge.shutdown = NULL;
}
return NS_OK;
}
NS_IMETHODIMP nsAppRootAccessible::GetName(nsAString& _retval)
{
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
NS_ASSERTION(bundleService, "String bundle service must be present!");
nsCOMPtr<nsIStringBundle> bundle;
bundleService->CreateBundle("chrome://branding/locale/brand.properties",
getter_AddRefs(bundle));
nsXPIDLString appName;
if (bundle) {
bundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
getter_Copies(appName));
} else {
NS_WARNING("brand.properties not present, using default app name");
appName.AssignLiteral("Mozilla");
}
_retval.Assign(appName);
return NS_OK;
}
NS_IMETHODIMP nsAppRootAccessible::GetDescription(nsAString& aDescription)
{
GetName(aDescription);
aDescription.AppendLiteral(" Root Accessible");
return NS_OK;
}
NS_IMETHODIMP nsAppRootAccessible::GetRole(PRUint32 *aRole)
{
*aRole = ROLE_APPLICATION;
return NS_OK;
}
NS_IMETHODIMP nsAppRootAccessible::GetFinalRole(PRUint32 *aFinalRole)
{
return GetRole(aFinalRole);
}
NS_IMETHODIMP nsAppRootAccessible::GetParent(nsIAccessible ** aParent)
{
*aParent = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsAppRootAccessible::GetChildAt(PRInt32 aChildNum,
nsIAccessible **aChild)
{
PRUint32 count = 0;
nsresult rv = NS_OK;
*aChild = nsnull;
if (mChildren)
rv = mChildren->GetLength(&count);
NS_ENSURE_SUCCESS(rv, rv);
if (aChildNum >= NS_STATIC_CAST(PRInt32, count))
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIWeakReference> childWeakRef;
rv = mChildren->QueryElementAt(aChildNum, NS_GET_IID(nsIWeakReference),
getter_AddRefs(childWeakRef));
if (childWeakRef) {
MAI_LOG_DEBUG(("GetChildAt(%d), has weak ref\n", aChildNum));
nsCOMPtr<nsIAccessible> childAcc = do_QueryReferent(childWeakRef);
if (childAcc) {
MAI_LOG_DEBUG(("GetChildAt(%d), has Acc Child ref\n", aChildNum));
NS_IF_ADDREF(*aChild = childAcc);
}
else
MAI_LOG_DEBUG(("GetChildAt(%d), NOT has Acc Child ref\n",
aChildNum));
}
else
MAI_LOG_DEBUG(("GetChildAt(%d), NOT has weak ref\n", aChildNum));
return rv;
}
NS_IMETHODIMP nsAppRootAccessible::GetChildCount(PRInt32 *aAccChildCount)
{
PRUint32 count = 0;
nsresult rv = NS_OK;
if (mChildren)
rv = mChildren->GetLength(&count);
if (NS_SUCCEEDED(rv)) {
MAI_LOG_DEBUG(("\nGet Acc Child OK, count=%d\n", count));
}
else
MAI_LOG_DEBUG(("\nGet Acc Child Failed, count=%d\n", count));
*aAccChildCount = NS_STATIC_CAST(PRInt32, count);
return rv;
}
NS_IMETHODIMP nsAppRootAccessible::GetFirstChild(nsIAccessible * *aFirstChild)
{
nsCOMPtr<nsIAccessible> firstChild;
*aFirstChild = nsnull;
nsresult rv = NS_OK;
rv = mChildren->QueryElementAt(0, NS_GET_IID(nsIAccessible),
getter_AddRefs(firstChild));
if (firstChild)
NS_IF_ADDREF(*aFirstChild = firstChild);
return rv;
}
NS_IMETHODIMP nsAppRootAccessible::GetNextSibling(nsIAccessible * *aNextSibling)
{
*aNextSibling = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsAppRootAccessible::GetPreviousSibling(nsIAccessible * *aPreviousSibling)
{
*aPreviousSibling = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsAppRootAccessible::GetNativeInterface(void **aOutAccessible)
{
*aOutAccessible = nsnull;
if (!mMaiAtkObject) {
mMaiAtkObject =
NS_REINTERPRET_CAST(AtkObject *,
g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
NS_ENSURE_TRUE(mMaiAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mMaiAtkObject, this);
mMaiAtkObject->role = ATK_ROLE_INVALID;
mMaiAtkObject->layer = ATK_LAYER_INVALID;
}
*aOutAccessible = mMaiAtkObject;
return NS_OK;
}
nsresult
nsAppRootAccessible::AddRootAccessible(nsRootAccessibleWrap *aRootAccWrap)
{
NS_ENSURE_ARG_POINTER(aRootAccWrap);
nsresult rv = NS_ERROR_FAILURE;
// add by weak reference
rv = mChildren->AppendElement(NS_STATIC_CAST(nsIAccessibleDocument*, aRootAccWrap),
PR_TRUE);
#ifdef MAI_LOGGING
PRUint32 count = 0;
mChildren->GetLength(&count);
if (NS_SUCCEEDED(rv)) {
MAI_LOG_DEBUG(("\nAdd RootAcc=%p OK, count=%d\n",
(void*)aRootAccWrap, count));
}
else
MAI_LOG_DEBUG(("\nAdd RootAcc=%p Failed, count=%d\n",
(void*)aRootAccWrap, count));
#endif
return rv;
}
nsresult
nsAppRootAccessible::RemoveRootAccessible(nsRootAccessibleWrap *aRootAccWrap)
{
NS_ENSURE_ARG_POINTER(aRootAccWrap);
PRUint32 index = 0;
nsresult rv = NS_ERROR_FAILURE;
// we must use weak ref to get the index
nsCOMPtr<nsIWeakReference> weakPtr =
do_GetWeakReference(NS_STATIC_CAST(nsIAccessibleDocument*, aRootAccWrap));
rv = mChildren->IndexOf(0, weakPtr, &index);
#ifdef MAI_LOGGING
PRUint32 count = 0;
mChildren->GetLength(&count);
if (NS_SUCCEEDED(rv)) {
rv = mChildren->RemoveElementAt(index);
MAI_LOG_DEBUG(("\nRemove RootAcc=%p, count=%d\n",
(void*)aRootAccWrap, (count-1)));
}
else
MAI_LOG_DEBUG(("\nFail to Remove RootAcc=%p, count=%d\n",
(void*)aRootAccWrap, count));
#else
NS_ENSURE_SUCCESS(rv, rv);
rv = mChildren->RemoveElementAt(index);
#endif
return rv;
}
nsAppRootAccessible *
nsAppRootAccessible::Create()
{
static nsAppRootAccessible *sAppRoot = nsnull;
if (!sAppRoot) {
sAppRoot = new nsAppRootAccessible();
NS_ASSERTION(sAppRoot, "OUT OF MEMORY");
if (sAppRoot) {
if (NS_FAILED(sAppRoot->Init())) {
delete sAppRoot;
sAppRoot = nsnull;
}
else
NS_IF_ADDREF(sAppRoot);
}
}
return sAppRoot;
}
static nsresult
LoadGtkModule(GnomeAccessibilityModule& aModule)
{
NS_ENSURE_ARG(aModule.libName);
if (!(aModule.lib = PR_LoadLibrary(aModule.libName))) {
MAI_LOG_DEBUG(("Fail to load lib: %s in default path\n", aModule.libName));
//try to load the module with "gtk-2.0/modules" appended
char *curLibPath = PR_GetLibraryPath();
nsCAutoString libPath(curLibPath);
libPath.Append(":/usr/lib");
MAI_LOG_DEBUG(("Current Lib path=%s\n", libPath.get()));
PR_FreeLibraryName(curLibPath);
PRInt16 loc1 = 0, loc2 = 0;
PRInt16 subLen = 0;
while (loc2 >= 0) {
loc2 = libPath.FindChar(':', loc1);
if (loc2 < 0)
subLen = libPath.Length() - loc1;
else
subLen = loc2 - loc1;
nsCAutoString sub(Substring(libPath, loc1, subLen));
sub.Append("/gtk-2.0/modules/");
sub.Append(aModule.libName);
aModule.lib = PR_LoadLibrary(sub.get());
if (aModule.lib) {
MAI_LOG_DEBUG(("Ok, load %s from %s\n", aModule.libName, sub.get()));
break;
}
loc1 = loc2+1;
}
if (!aModule.lib) {
MAI_LOG_DEBUG(("Fail to load %s\n", aModule.libName));
return NS_ERROR_FAILURE;
}
}
//we have loaded the library, try to get the function ptrs
if (!(aModule.init = PR_FindFunctionSymbol(aModule.lib,
aModule.initName)) ||
!(aModule.shutdown = PR_FindFunctionSymbol(aModule.lib,
aModule.shutdownName))) {
//fail, :(
MAI_LOG_DEBUG(("Fail to find symbol %s in %s",
aModule.init ? aModule.shutdownName : aModule.initName,
aModule.libName));
PR_UnloadLibrary(aModule.lib);
aModule.lib = NULL;
return NS_ERROR_FAILURE;
}
return NS_OK;
}

View File

@@ -1,102 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
* Ginn Chen (ginn.chen@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __NS_APP_ROOT_ACCESSIBLE_H__
#define __NS_APP_ROOT_ACCESSIBLE_H__
#include "nsArray.h"
#include "nsIAccessibleDocument.h"
#include "nsAccessibilityService.h"
#include "nsAccessibleWrap.h"
#include "nsRootAccessibleWrap.h"
#define MAI_TYPE_APP_ROOT (MAI_TYPE_ATK_OBJECT)
/* nsAppRootAccessible is for the whole application of Mozilla.
* Only one instance of nsAppRootAccessible exists for one Mozilla instance.
* And this one should be created when Mozilla Startup (if accessibility
* feature has been enabled) and destroyed when Mozilla Shutdown.
*
* All the accessibility objects for toplevel windows are direct children of
* the nsAppRootAccessible instance.
*/
class nsAppRootAccessible;
class nsAppRootAccessible: public nsAccessibleWrap
{
public:
virtual ~nsAppRootAccessible();
#ifdef MAI_LOGGING
// virtual void DumpMaiObjectInfo(int aDepth);
#endif
static nsAppRootAccessible *Create();
public:
nsAppRootAccessible();
/* virtual functions from nsAccessibleNode */
NS_IMETHOD Init();
NS_IMETHOD Shutdown();
/* virtual functions from nsAccessible */
NS_IMETHOD GetName(nsAString & aName);
NS_IMETHOD GetDescription(nsAString & aDescription);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetFinalRole(PRUint32 *aFinalRole);
NS_IMETHOD GetParent(nsIAccessible * *aParent);
NS_IMETHOD GetNextSibling(nsIAccessible * *aNextSibling);
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
NS_IMETHOD GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild);
NS_IMETHOD GetFirstChild(nsIAccessible * *aFirstChild);
NS_IMETHOD GetChildCount(PRInt32 *aAccChildCount);
// return the atk object for app root accessible
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
nsresult AddRootAccessible(nsRootAccessibleWrap *aRootAccWrap);
nsresult RemoveRootAccessible(nsRootAccessibleWrap *aRootAccWrap);
private:
nsCOMPtr<nsIMutableArray> mChildren;
PRBool mInitialized;
};
#endif /* __NS_APP_ROOT_ACCESSIBLE_H__ */

View File

@@ -1,552 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMai.h"
#include "nsDocAccessibleWrap.h"
#include "nsAccessibleEventData.h"
#include <atk/atk.h>
#include <glib.h>
#include <glib-object.h>
//----- nsDocAccessibleWrap -----
/*
* Must keep sychronization with enumerate AtkProperty in
* accessible/src/base/nsAccessibleEventData.h
*/
static char * sAtkPropertyNameArray[PROP_LAST] = {
0,
"accessible_name",
"accessible_description",
"accessible_parent",
"accessible_value",
"accessible_role",
"accessible_layer",
"accessible_mdi_zorder",
"accessible_table_caption",
"accessible_table_column_description",
"accessible_table_column_header",
"accessible_table_row_description",
"accessible_table_row_header",
"accessible_table_summary"
};
static AtkStateType TranslateAState(PRUint32 aState, PRUint32 aExtState);
NS_IMPL_ISUPPORTS_INHERITED2(nsDocAccessibleWrap, nsDocAccessible, nsIAccessibleText, nsIAccessibleEditableText)
nsDocAccessibleWrap::nsDocAccessibleWrap(nsIDOMNode *aDOMNode,
nsIWeakReference *aShell):
nsDocAccessible(aDOMNode, aShell), nsAccessibleEditableText(aDOMNode)
{
}
nsDocAccessibleWrap::~nsDocAccessibleWrap()
{
}
NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
nsIAccessible* aAccessible,
void* aEventData)
{
NS_ENSURE_ARG_POINTER(aAccessible);
// First fire nsIObserver event for internal xpcom accessibility clients
nsDocAccessible::FireToolkitEvent(aEvent, aAccessible, aEventData);
nsresult rv = NS_ERROR_FAILURE;
nsAccessibleWrap *accWrap =
NS_STATIC_CAST(nsAccessibleWrap *, aAccessible);
MAI_LOG_DEBUG(("\n\nReceived event: aEvent=%u, obj=0x%x, data=0x%x \n",
aEvent, aAccessible, aEventData));
nsAccessibleWrap *oldAccWrap = nsnull, *newAccWrap = nsnull;
AtkTableChange * pAtkTableChange = nsnull;
switch (aEvent) {
case nsIAccessibleEvent::EVENT_FOCUS:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
atk_focus_tracker_notify(accWrap->GetAtkObject());
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
AtkStateChange *pAtkStateChange;
AtkStateType atkState;
MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
if (!aEventData)
break;
pAtkStateChange = NS_REINTERPRET_CAST(AtkStateChange *, aEventData);
switch (pAtkStateChange->state) {
case nsIAccessible::STATE_INVISIBLE:
atkState = ATK_STATE_VISIBLE;
pAtkStateChange->enable = !pAtkStateChange->enable;
break;
case nsIAccessible::STATE_UNAVAILABLE:
atkState = ATK_STATE_ENABLED;
pAtkStateChange->enable = !pAtkStateChange->enable;
break;
case nsIAccessible::STATE_READONLY:
atkState = ATK_STATE_EDITABLE;
pAtkStateChange->enable = !pAtkStateChange->enable;
break;
default:
atkState = TranslateAState(pAtkStateChange->state, pAtkStateChange->extState);
}
atk_object_notify_state_change(accWrap->GetAtkObject(),
atkState, pAtkStateChange->enable);
rv = NS_OK;
break;
/*
* More complex than I ever thought.
* Need handle them separately.
*/
case nsIAccessibleEvent::EVENT_ATK_PROPERTY_CHANGE :
AtkPropertyChange *pAtkPropChange;
AtkPropertyValues values;
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_PROPERTY_CHANGE\n"));
if (!aEventData)
break;
pAtkPropChange = NS_REINTERPRET_CAST(AtkPropertyChange *, aEventData);
values.property_name = sAtkPropertyNameArray[pAtkPropChange->type];
MAI_LOG_DEBUG(("\n\nthe type of EVENT_ATK_PROPERTY_CHANGE: %d\n\n",
pAtkPropChange->type));
switch (pAtkPropChange->type) {
case PROP_TABLE_CAPTION:
case PROP_TABLE_SUMMARY:
if (pAtkPropChange->oldvalue)
oldAccWrap = NS_REINTERPRET_CAST(nsAccessibleWrap *,
pAtkPropChange->oldvalue);
if (pAtkPropChange->newvalue)
newAccWrap = NS_REINTERPRET_CAST(nsAccessibleWrap *,
pAtkPropChange->newvalue);
if (oldAccWrap && newAccWrap) {
g_value_init(&values.old_value, G_TYPE_POINTER);
g_value_set_pointer(&values.old_value,
oldAccWrap->GetAtkObject());
g_value_init(&values.new_value, G_TYPE_POINTER);
g_value_set_pointer(&values.new_value,
newAccWrap->GetAtkObject());
rv = NS_OK;
}
break;
case PROP_TABLE_COLUMN_DESCRIPTION:
case PROP_TABLE_COLUMN_HEADER:
case PROP_TABLE_ROW_HEADER:
case PROP_TABLE_ROW_DESCRIPTION:
g_value_init(&values.new_value, G_TYPE_INT);
g_value_set_int(&values.new_value,
*NS_REINTERPRET_CAST(gint *,
pAtkPropChange->newvalue));
rv = NS_OK;
break;
//Perhaps need more cases in the future
default:
g_value_init (&values.old_value, G_TYPE_POINTER);
g_value_set_pointer (&values.old_value, pAtkPropChange->oldvalue);
g_value_init (&values.new_value, G_TYPE_POINTER);
g_value_set_pointer (&values.new_value, pAtkPropChange->newvalue);
rv = NS_OK;
}
if (NS_SUCCEEDED(rv)) {
char *signal_name = g_strconcat("property_change::",
values.property_name, NULL);
g_signal_emit_by_name(accWrap->GetAtkObject(), signal_name,
&values, NULL);
g_free (signal_name);
}
break;
case nsIAccessibleEvent::EVENT_ATK_SELECTION_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_SELECTION_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"selection_changed");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TEXT_CHANGE:
AtkTextChange *pAtkTextChange;
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TEXT_CHANGE\n"));
if (!aEventData)
break;
pAtkTextChange = NS_REINTERPRET_CAST(AtkTextChange *, aEventData);
g_signal_emit_by_name (accWrap->GetAtkObject(),
pAtkTextChange->add ? \
"text_changed::insert":"text_changed::delete",
pAtkTextChange->start,
pAtkTextChange->length);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TEXT_SELECTION_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TEXT_SELECTION_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"text_selection_changed");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TEXT_CARET_MOVE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TEXT_CARET_MOVE\n"));
if (!aEventData)
break;
MAI_LOG_DEBUG(("\n\nCaret postion: %d", *(gint *)aEventData ));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"text_caret_moved",
// Curent caret position
*(gint *)aEventData);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TABLE_MODEL_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_MODEL_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"model_changed");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TABLE_ROW_INSERT:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_ROW_INSERT\n"));
if (!aEventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
g_signal_emit_by_name(accWrap->GetAtkObject(),
"row_inserted",
// After which the rows are inserted
pAtkTableChange->index,
// The number of the inserted
pAtkTableChange->count);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TABLE_ROW_DELETE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_ROW_DELETE\n"));
if (!aEventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
g_signal_emit_by_name(accWrap->GetAtkObject(),
"row_deleted",
// After which the rows are deleted
pAtkTableChange->index,
// The number of the deleted
pAtkTableChange->count);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TABLE_ROW_REORDER:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_ROW_REORDER\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"row_reordered");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TABLE_COLUMN_INSERT:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_COLUMN_INSERT\n"));
if (!aEventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
g_signal_emit_by_name(accWrap->GetAtkObject(),
"column_inserted",
// After which the columns are inserted
pAtkTableChange->index,
// The number of the inserted
pAtkTableChange->count);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TABLE_COLUMN_DELETE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_COLUMN_DELETE\n"));
if (!aEventData)
break;
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
g_signal_emit_by_name(accWrap->GetAtkObject(),
"column_deleted",
// After which the columns are deleted
pAtkTableChange->index,
// The number of the deleted
pAtkTableChange->count);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_TABLE_COLUMN_REORDER:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_TABLE_COLUMN_REORDER\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"column_reordered");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_VISIBLE_DATA_CHANGE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_VISIBLE_DATA_CHANGE\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"visible_data_changed");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_LINK_SELECTED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_LINK_SELECTED\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"link_selected",
// Selected link index
*(gint *)aEventData);
rv = NS_OK;
break;
// Is a superclass of ATK event children_changed
case nsIAccessibleEvent::EVENT_REORDER:
AtkChildrenChange *pAtkChildrenChange;
MAI_LOG_DEBUG(("\n\nReceived: EVENT_REORDER(children_change)\n"));
pAtkChildrenChange = NS_REINTERPRET_CAST(AtkChildrenChange *,
aEventData);
nsAccessibleWrap *childAccWrap;
if (pAtkChildrenChange && pAtkChildrenChange->child) {
childAccWrap = NS_STATIC_CAST(nsAccessibleWrap *,
pAtkChildrenChange->child);
g_signal_emit_by_name (accWrap->GetAtkObject(),
pAtkChildrenChange->add ? \
"children_changed::add" : \
"children_changed::remove",
pAtkChildrenChange->index,
childAccWrap->GetAtkObject(),
NULL);
}
else {
//
// EVENT_REORDER is normally fired by "HTML Document".
//
// In GOK, [only] "children_changed::add" can cause foreground
// window accessible to update it children, which will
// refresh "UI-Grab" window.
//
g_signal_emit_by_name (accWrap->GetAtkObject(),
"children_changed::add",
-1, NULL, NULL);
}
rv = NS_OK;
break;
/*
* Because dealing with menu is very different between nsIAccessible
* and ATK, and the menu activity is important, specially transfer the
* following two event.
* Need more verification by AT test.
*/
case nsIAccessibleEvent::EVENT_MENUSTART:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUSTART\n"));
atk_focus_tracker_notify(accWrap->GetAtkObject());
g_signal_emit_by_name(accWrap->GetAtkObject(),
"selection_changed");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_MENUEND:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUEND\n"));
g_signal_emit_by_name(accWrap->GetAtkObject(),
"selection_changed");
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_WINDOW_ACTIVATE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_WINDOW_ACTIVATED\n"));
g_signal_emit(accWrap->GetAtkObject(),
g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT), 0);
rv = NS_OK;
break;
case nsIAccessibleEvent::EVENT_ATK_WINDOW_DEACTIVATE:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_WINDOW_DEACTIVATED\n"));
g_signal_emit(accWrap->GetAtkObject(),
g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT), 0);
rv = NS_OK;
break;
default:
// Don't transfer others
MAI_LOG_DEBUG(("\n\nReceived an unknown event=0x%u\n", aEvent));
break;
}
return rv;
}
/* static */
AtkStateType
TranslateAState(PRUint32 aState, PRUint32 aExtState)
{
switch (aState) {
case nsIAccessible::STATE_SELECTED:
return ATK_STATE_SELECTED;
case nsIAccessible::STATE_FOCUSED:
return ATK_STATE_FOCUSED;
case nsIAccessible::STATE_PRESSED:
return ATK_STATE_PRESSED;
case nsIAccessible::STATE_CHECKED:
return ATK_STATE_CHECKED;
case nsIAccessible::STATE_EXPANDED:
return ATK_STATE_EXPANDED;
case nsIAccessible::STATE_COLLAPSED:
return ATK_STATE_EXPANDABLE;
// The control can't accept input at this time
case nsIAccessible::STATE_BUSY:
return ATK_STATE_BUSY;
case nsIAccessible::STATE_FOCUSABLE:
return ATK_STATE_FOCUSABLE;
case nsIAccessible::STATE_SELECTABLE:
return ATK_STATE_SELECTABLE;
case nsIAccessible::STATE_SIZEABLE:
return ATK_STATE_RESIZABLE;
case nsIAccessible::STATE_MULTISELECTABLE:
return ATK_STATE_MULTISELECTABLE;
#if 0
// The following states are opposite the MSAA states.
// We need to deal with them specially
case nsIAccessible::STATE_INVISIBLE:
return !ATK_STATE_VISIBLE;
case nsIAccessible::STATE_UNAVAILABLE:
return !ATK_STATE_ENABLED;
case nsIAccessible::STATE_READONLY:
return !ATK_STATE_EDITABLE;
#endif
}
// The following state is
// Extended state flags (for non-MSAA, for Java and Gnome/ATK support)
switch (aExtState) {
case nsIAccessible::EXT_STATE_ACTIVE:
return ATK_STATE_ACTIVE;
case nsIAccessible::EXT_STATE_EXPANDABLE:
return ATK_STATE_EXPANDABLE;
#if 0
// Need change definitions in nsIAccessible.idl to avoid
// duplicate value
case nsIAccessible::EXT_STATE_MODAL:
return ATK_STATE_MODAL;
#endif
case nsIAccessible::EXT_STATE_MULTI_LINE:
return ATK_STATE_MULTI_LINE;
case nsIAccessible::EXT_STATE_SENSITIVE:
return ATK_STATE_SENSITIVE;
case nsIAccessible::EXT_STATE_SHOWING:
return ATK_STATE_SHOWING;
case nsIAccessible::EXT_STATE_SINGLE_LINE:
return ATK_STATE_SINGLE_LINE;
case nsIAccessible::EXT_STATE_TRANSIENT:
return ATK_STATE_TRANSIENT;
case nsIAccessible::EXT_STATE_VERTICAL:
return ATK_STATE_VERTICAL;
}
return ATK_STATE_INVALID;
}
NS_IMETHODIMP nsDocAccessibleWrap::Shutdown()
{
nsAccessibleEditableText::ShutdownEditor();
return nsDocAccessible::Shutdown();
}
NS_IMETHODIMP nsDocAccessibleWrap::GetRole(PRUint32 *_retval)
{
PRBool isEditable;
GetIsEditable(&isEditable);
if (isEditable)
*_retval = ROLE_TEXT;
else
*_retval = ROLE_HTML_CONTAINER;
return NS_OK;
}
void nsDocAccessibleWrap::CheckForEditor()
{
nsDocAccessible::CheckForEditor();
if (mEditor)
SetEditor(mEditor); // set editor for nsAccessibleEditableText
}
NS_IMETHODIMP nsDocAccessibleWrap::FireDocLoadingEvent(PRBool aIsFinished)
{
if (!mDocument || !mWeakShell)
return NS_OK; // Document has been shut down
if (!aIsFinished) {
// Load has been verified, it will occur, about to commence
AtkChildrenChange childrenData;
childrenData.index = -1;
childrenData.child = 0;
childrenData.add = PR_FALSE;
FireToolkitEvent(nsIAccessibleEvent::EVENT_REORDER, this, &childrenData);
}
return nsDocAccessible::FireDocLoadingEvent(aIsFinished);
}

View File

@@ -1,70 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
#ifndef _nsDocAccessibleWrap_H_
#define _nsDocAccessibleWrap_H_
#include "nsDocAccessible.h"
#include "nsAccessibleText.h"
class nsDocAccessibleWrap: public nsDocAccessible,
public nsAccessibleEditableText
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
virtual ~nsDocAccessibleWrap();
NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible,
void* aData);
NS_IMETHOD FireDocLoadingEvent(PRBool isFinished);
NS_IMETHOD Shutdown();
NS_IMETHOD GetRole(PRUint32 *aAccRole);
protected:
void CheckForEditor();
};
#endif

View File

@@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLBlockAccessible.h"
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLBlockAccessible, nsBlockAccessible, nsIAccessibleText, nsIAccessibleHyperText)
nsHTMLBlockAccessible::nsHTMLBlockAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsBlockAccessible(aDomNode, aShell), nsAccessibleHyperText(aDomNode, aShell)
{
}
NS_IMETHODIMP nsHTMLBlockAccessible::GetName(nsAString& aName)
{
return nsBlockAccessible::GetName(aName);
}
NS_IMETHODIMP nsHTMLBlockAccessible::GetRole(PRUint32 *aRole)
{
*aRole = ROLE_TEXT;
return NS_OK;
}
NS_IMETHODIMP nsHTMLBlockAccessible::GetState(PRUint32 *aState)
{
nsAccessible::GetState(aState);
*aState &= ~STATE_FOCUSABLE;
*aState |= STATE_UNAVAILABLE;
return NS_OK;
}
NS_IMETHODIMP nsHTMLBlockAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
return nsAccessibleHyperText::GetBounds(mWeakShell, x, y, width, height);
}
NS_IMETHODIMP nsHTMLBlockAccessible::Shutdown()
{
nsAccessibleHyperText::Shutdown();
return nsBlockAccessible::Shutdown();
}

View File

@@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLBlockAccessible_H_
#define _nsHTMLBlockAccessible_H_
#include "nsAccessibleHyperText.h"
class nsHTMLBlockAccessible : public nsBlockAccessible,
public nsAccessibleHyperText
{
NS_DECL_ISUPPORTS_INHERITED
public:
nsHTMLBlockAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState);
NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD Shutdown();
};
#endif

View File

@@ -1,98 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLFormControlAccessibleWrap.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIFrame.h"
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessibleWrap, nsHTMLTextFieldAccessible, nsIAccessibleText, nsIAccessibleEditableText)
nsHTMLTextFieldAccessibleWrap::nsHTMLTextFieldAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsHTMLTextFieldAccessible(aNode, aShell), nsAccessibleEditableText(aNode)
{
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
if (shell) {
nsIFrame *frame = GetFrame();
if (frame) {
nsITextControlFrame *textFrame;
frame->QueryInterface(NS_GET_IID(nsITextControlFrame), (void**)&textFrame);
if (textFrame) {
nsCOMPtr<nsIEditor> editor;
textFrame->GetEditor(getter_AddRefs(editor));
SetEditor(editor);
}
}
}
}
NS_IMETHODIMP nsHTMLTextFieldAccessibleWrap::GetRole(PRUint32 *_retval)
{
PRUint32 state = 0;
nsresult rv = GetState(&state);
if (NS_SUCCEEDED(rv) && (state & STATE_PROTECTED))
*_retval = ROLE_PASSWORD_TEXT;
else
*_retval = ROLE_TEXT;
return NS_OK;
}
NS_IMETHODIMP nsHTMLTextFieldAccessibleWrap::GetExtState(PRUint32 *aState)
{
nsresult rv;
nsCOMPtr<nsIDOMHTMLInputElement> htmlFormElement(do_QueryInterface(mDOMNode, &rv));
if (NS_SUCCEEDED(rv) && htmlFormElement) {
nsAutoString typeString;
htmlFormElement->GetType(typeString);
if (typeString.LowerCaseEqualsLiteral("text"))
*aState |= EXT_STATE_SINGLE_LINE;
}
PRUint32 state;
nsHTMLTextFieldAccessible::GetState(&state);
if (!(state & STATE_READONLY))
*aState |= EXT_STATE_EDITABLE;
return NS_OK;
}
NS_IMETHODIMP nsHTMLTextFieldAccessibleWrap::Shutdown()
{
nsAccessibleEditableText::ShutdownEditor();
return nsHTMLTextFieldAccessible::Shutdown();
}

View File

@@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* 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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLFormControlAccessibleWrap_H_
#define _nsHTMLFormControlAccessibleWrap_H_
#include "nsHTMLFormControlAccessible.h"
#include "nsAccessibleText.h"
typedef class nsHTMLRadioButtonAccessible nsHTMLRadioButtonAccessibleWrap;
class nsHTMLTextFieldAccessibleWrap : public nsHTMLTextFieldAccessible,
public nsAccessibleEditableText
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsHTMLTextFieldAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32* aRole);
NS_IMETHOD GetExtState(PRUint32 *aState);
NS_IMETHOD Shutdown();
};
#endif

View File

@@ -1,253 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gilbert Fang (gilbert.fang@sun.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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLLinkAccessibleWrap.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDocument.h"
#include "nsILink.h"
#include "nsIDOMText.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
// --------------------------------------------------------
// nsHTMLLinkAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessibleWrap, nsHTMLLinkAccessible, nsIAccessibleHyperLink)
nsHTMLLinkAccessibleWrap::nsHTMLLinkAccessibleWrap(nsIDOMNode* aDomNode, nsIArray* aTextNodes, nsIWeakReference* aShell, nsIFrame *aFrame):
nsHTMLLinkAccessible(aDomNode, aShell, aFrame)
{
mTextNodes = aTextNodes;
}
//-------------------------- nsIAccessibleHyperLink -------------------------
/* readonly attribute long anchors; */
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::GetAnchors(PRInt32 *aAnchors)
{
if (!mIsLink)
return NS_ERROR_FAILURE;
*aAnchors = 1;
return NS_OK;
}
/* readonly attribute long startIndex; */
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::GetStartIndex(PRInt32 *aStartIndex)
{
PRInt32 endIndex;
return GetLinkOffset(aStartIndex, &endIndex);
}
/* readonly attribute long endIndex; */
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::GetEndIndex(PRInt32 *aEndIndex)
{
PRInt32 startIndex;
return GetLinkOffset(&startIndex, aEndIndex);
}
/* nsIURI getURI (in long i); */
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::GetURI(PRInt32 i, nsIURI **aURI)
{
//I do not know why we have to return a nsIURI instead of
//nsILink or just a string of url. Anyway, maybe nsIURI is
//more powerful for the future.
*aURI = nsnull;
if (!mIsLink)
return NS_ERROR_FAILURE;
nsCOMPtr<nsILink> link(do_QueryInterface(mActionContent));
if (link) {
return link->GetHrefURI(aURI);
}
return NS_ERROR_FAILURE;
}
/* nsIAccessible getObject (in long i); */
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::GetObject(PRInt32 aIndex,
nsIAccessible **aAccessible)
{
if (0 != aIndex)
return NS_ERROR_FAILURE;
return QueryInterface(NS_GET_IID(nsIAccessible), (void **)aAccessible);
}
/* boolean isValid (); */
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::IsValid(PRBool *aIsValid)
{
// I have not found the cause which makes this attribute false.
*aIsValid = PR_TRUE;
return NS_OK;
}
/* boolean isSelected (); */
NS_IMETHODIMP nsHTMLLinkAccessibleWrap::IsSelected(PRBool *aIsSelected)
{
*aIsSelected = (gLastFocusedNode == mDOMNode);
return NS_OK;
}
nsresult nsHTMLLinkAccessibleWrap::GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset)
{
NS_ENSURE_TRUE(mTextNodes, NS_ERROR_FAILURE);
if (!mIsLink)
return NS_ERROR_FAILURE;
nsCOMPtr<nsILink> currentLink(do_QueryInterface(mActionContent));
NS_ENSURE_TRUE(currentLink, NS_ERROR_FAILURE);
PRUint32 index, count = 0;
PRUint32 totalLength = 0, textLength = 0;
mTextNodes->GetLength(&count);
for (index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextNodes, index));
nsCOMPtr<nsIDOMText> domText(do_QueryInterface(domNode));
if (domText) {
domText->GetLength(&textLength);
totalLength += textLength;
}
// text node maybe a child (or grandchild, ...) of a link node
nsCOMPtr<nsIDOMNode> parentNode;
nsCOMPtr<nsILink> link = nsnull;
domNode->GetParentNode(getter_AddRefs(parentNode));
while (parentNode) {
link = do_QueryInterface(parentNode);
if (link)
break;
nsCOMPtr<nsIDOMNode> temp = parentNode;
temp->GetParentNode(getter_AddRefs(parentNode));
}
if (link == currentLink) {
*aEndOffset = totalLength;
*aStartOffset = totalLength - textLength;
return NS_OK;
}
}
return NS_ERROR_FAILURE;
}
// --------------------------------------------------------
// nsHTMLImageMapAccessible Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageMapAccessible, nsHTMLImageAccessible, nsIAccessibleHyperLink)
nsHTMLImageMapAccessible::nsHTMLImageMapAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsHTMLImageAccessible(aDomNode, aShell)
{
}
/* readonly attribute long anchors; */
NS_IMETHODIMP nsHTMLImageMapAccessible::GetAnchors(PRInt32 *aAnchors)
{
return GetChildCount(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 **aURI)
{
*aURI = 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<nsIURI> baseURI = content->GetBaseURI();
nsCOMPtr<nsIDOMElement> area(do_QueryInterface(domNode));
nsAutoString hrefValue;
if (NS_SUCCEEDED(area->GetAttribute(NS_LITERAL_STRING("href"), hrefValue))) {
return NS_NewURI(aURI, hrefValue, nsnull, baseURI);
}
}
return NS_ERROR_FAILURE;
}
/* nsIAccessible getObject (in long i); */
NS_IMETHODIMP nsHTMLImageMapAccessible::GetObject(PRInt32 aIndex,
nsIAccessible **aAccessible)
{
*aAccessible = nsnull;
nsCOMPtr<nsIAccessible> areaAccessible;
nsresult rv = GetChildAt(aIndex, getter_AddRefs(areaAccessible));
areaAccessible.swap(*aAccessible);
return rv;
}
/* boolean isValid (); */
NS_IMETHODIMP nsHTMLImageMapAccessible::IsValid(PRBool *aIsValid)
{
*aIsValid = PR_TRUE;
return NS_OK;
}
/* boolean isSelected (); */
NS_IMETHODIMP nsHTMLImageMapAccessible::IsSelected(PRBool *aIsSelected)
{
*aIsSelected = PR_FALSE;
return NS_OK;
}

View File

@@ -1,71 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gilbert Fang (gilbert.fang@sun.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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLLinkAccessibleWrap_H_
#define _nsHTMLLinkAccessibleWrap_H_
#include "nsHTMLImageAccessible.h"
#include "nsHTMLLinkAccessible.h"
#include "nsIAccessibleHyperLink.h"
#include "nsArray.h"
class nsHTMLLinkAccessibleWrap : public nsHTMLLinkAccessible,
public nsIAccessibleHyperLink
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEHYPERLINK
nsHTMLLinkAccessibleWrap(nsIDOMNode* aDomNode, nsIArray* aTextNodes, nsIWeakReference* aShell, nsIFrame *aFrame);
private:
nsresult GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset);
nsCOMPtr<nsIArray> mTextNodes;
};
class nsHTMLImageMapAccessible : public nsHTMLImageAccessible,
public nsIAccessibleHyperLink
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEHYPERLINK
nsHTMLImageMapAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
};
#endif

View File

@@ -1,604 +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 Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems, Inc.
* Portions created by Sun Microsystems are Copyright (C) 2002 Sun
* Microsystems, Inc. All Rights Reserved.
*
* Original Author: Pete Zha (pete.zha@sun.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 ***** */
#include "nsHTMLTableAccessibleWrap.h"
#include "nsIAccessibilityService.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLTableCaptionElem.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMHTMLTableElement.h"
#include "nsIDOMHTMLTableRowElement.h"
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsITableLayout.h"
// --------------------------------------------------------
// nsHTMLTableCellAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableCellAccessibleWrap, nsHTMLTableCellAccessible, nsIAccessibleText, nsIAccessibleHyperText)
nsHTMLTableCellAccessibleWrap::nsHTMLTableCellAccessibleWrap(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsHTMLTableCellAccessible(aDomNode, aShell), nsAccessibleHyperText(aDomNode, aShell)
{
}
NS_IMETHODIMP nsHTMLTableCellAccessibleWrap::Shutdown()
{
nsAccessibleHyperText::Shutdown();
return nsHTMLTableCellAccessible::Shutdown();
}
// --------------------------------------------------------
// nsHTMLTableAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableAccessibleWrap, nsHTMLTableAccessible, nsIAccessibleTable)
nsHTMLTableAccessibleWrap::nsHTMLTableAccessibleWrap(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsHTMLTableAccessible(aDomNode, aShell)
{
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::GetCaption(nsIAccessible **aCaption)
{
*aCaption = nsnull;
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);
accService->GetCachedAccessible(captionNode, mWeakShell, aCaption);
if (*aCaption)
return NS_OK;
return accService->CreateHTMLTableCaptionAccessible(captionNode, aCaption);
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::SetCaption(nsIAccessible *aCaption)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aCaption));
NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode");
nsCOMPtr<nsIDOMNode> domNode;
rv = accessNode->GetDOMNode(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
nsHTMLTableAccessibleWrap::GetSummary(nsAString &aSummary)
{
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
return table->GetSummary(aSummary);
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::SetSummary(const nsAString &aSummary)
{
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
return table->SetSummary(aSummary);
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::GetColumns(PRInt32 *aColumns)
{
nsITableLayout *tableLayout;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rows;
return tableLayout->GetTableSize(rows, *aColumns);
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::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;
nsCOMPtr<nsIDOMNode> sectionNode(do_QueryInterface(section));
if (sectionNode) {
rv = accService->GetCachedAccessible(sectionNode, mWeakShell,
getter_AddRefs(accHead));
}
if (!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
nsHTMLTableAccessibleWrap::GetRows(PRInt32 *aRows)
{
nsITableLayout *tableLayout;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columns;
return tableLayout->GetTableSize(*aRows, columns);
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
// Can not implement because there is no row header in html table
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
nsIAccessible **aTableCellAccessible)
{
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->GetAccessibleInWeakShell(cellElement, mWeakShell,
aTableCellAccessible);
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString &_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::GetRowDescription(PRInt32 aRow, nsAString &_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
PRBool *_retval)
{
nsITableLayout *tableLayout;
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
nsHTMLTableAccessibleWrap::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
nsHTMLTableAccessibleWrap::GetTableLayout(nsITableLayout **aLayoutObject)
{
*aLayoutObject = nsnull;
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);
nsIPresShell *presShell = content->GetDocument()->GetShellAt(0);
nsCOMPtr<nsISupports> layoutObject;
rv = presShell->GetLayoutObjectFor(content, getter_AddRefs(layoutObject));
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(layoutObject, aLayoutObject);
}
nsresult
nsHTMLTableAccessibleWrap::GetCellAt(PRInt32 aRowIndex,
PRInt32 aColIndex,
nsIDOMElement* &aCell)
{
PRInt32 startRowIndex = 0, startColIndex = 0,
rowSpan, colSpan, actualRowSpan, actualColSpan;
PRBool isSelected;
nsITableLayout *tableLayout;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
return tableLayout->GetCellDataAt(aRowIndex, aColIndex, aCell,
startRowIndex, startColIndex,
rowSpan, colSpan,
actualRowSpan, actualColSpan,
isSelected);
}
// --------------------------------------------------------
// nsHTMLTableHeadAccessible Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeadAccessible, nsHTMLTableAccessibleWrap)
nsHTMLTableHeadAccessible::nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell):
nsHTMLTableAccessibleWrap(aDomNode, aShell)
{
Init(); // Make sure this generated accessible of the table is cached
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetRole(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);
}

View File

@@ -1,96 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pete Zha (pete.zha@sun.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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLTableAccessibleWrap_H_
#define _nsHTMLTableAccessibleWrap_H_
#include "nsAccessibleHyperText.h"
#include "nsHTMLTableAccessible.h"
#include "nsIAccessibleTable.h"
class nsITableLayout;
class nsHTMLTableCellAccessibleWrap : public nsHTMLTableCellAccessible,
public nsAccessibleHyperText
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsHTMLTableCellAccessibleWrap(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD Shutdown();
};
class nsHTMLTableAccessibleWrap : public nsHTMLTableAccessible,
public nsIAccessibleTable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
nsHTMLTableAccessibleWrap(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
protected:
nsresult GetTableNode(nsIDOMNode **_retval);
nsresult GetTableLayout(nsITableLayout **aLayoutObject);
nsresult GetCellAt(PRInt32 aRowIndex,
PRInt32 aColIndex,
nsIDOMElement* &aCell);
};
class nsHTMLTableHeadAccessible : public nsHTMLTableAccessibleWrap
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell);
/* nsIAccessible */
NS_IMETHOD GetRole(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);
};
#endif

View File

@@ -1,87 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __NS_MAI_H__
#define __NS_MAI_H__
#include <atk/atk.h>
#include <glib.h>
#include <glib-object.h>
#include "nsAccessibleWrap.h"
extern PRLogModuleInfo *gMaiLog;
#ifdef MAI_LOGGING
#define MAI_LOG(level, args) \
PR_BEGIN_MACRO \
if (!gMaiLog) { \
gMaiLog = PR_NewLogModule("Mai"); \
PR_ASSERT(gMaiLog); \
} \
PR_LOG(gMaiLog, (level), args); \
PR_END_MACRO
#else
#define MAI_LOG(level, args)
#endif
#define MAI_LOG_DEBUG(args) MAI_LOG(PR_LOG_DEBUG, args)
#define MAI_LOG_WARNING(args) MAI_LOG(PR_LOG_WARNING, args)
#define MAI_LOG_ERROR(args) MAI_LOG(PR_LOG_ERROR, args)
#define MAI_TYPE_ATK_OBJECT (mai_atk_object_get_type ())
#define MAI_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
MAI_TYPE_ATK_OBJECT, MaiAtkObject))
#define MAI_ATK_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
MAI_TYPE_ATK_OBJECT, \
MaiAtkObjectClass))
#define MAI_IS_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
MAI_TYPE_ATK_OBJECT))
#define MAI_IS_ATK_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
MAI_TYPE_ATK_OBJECT))
#define MAI_ATK_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
MAI_TYPE_ATK_OBJECT, \
MaiAtkObjectClass))
GType mai_atk_object_get_type(void);
nsresult CheckMaiAtkObject(AtkObject *aAtkObj);
nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj);
#endif /* __NS_MAI_H__ */

View File

@@ -1,324 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIURI.h"
#include "nsMaiHyperlink.h"
/* MaiAtkHyperlink */
#define MAI_TYPE_ATK_HYPERLINK (mai_atk_hyperlink_get_type ())
#define MAI_ATK_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlink))
#define MAI_ATK_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlinkClass))
#define MAI_IS_ATK_HYPERLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
MAI_TYPE_ATK_HYPERLINK))
#define MAI_IS_ATK_HYPERLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
MAI_TYPE_ATK_HYPERLINK))
#define MAI_ATK_HYPERLINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlinkClass))
/**
* This MaiAtkHyperlink is a thin wrapper, in the MAI namespace,
* for AtkHyperlink
*/
struct MaiAtkHyperlink
{
AtkHyperlink parent;
/*
* The MaiHyperlink whose properties and features are exported via this
* hyperlink instance.
*/
MaiHyperlink *maiHyperlink;
gchar *uri;
};
struct MaiAtkHyperlinkClass
{
AtkHyperlinkClass parent_class;
};
GType mai_atk_hyperlink_get_type(void);
G_BEGIN_DECLS
/* callbacks for AtkHyperlink */
static void classInitCB(AtkHyperlinkClass *aClass);
static void finalizeCB(GObject *aObj);
/* callbacks for AtkHyperlink virtual functions */
static gchar *getUriCB(AtkHyperlink *aLink, gint aLinkIndex);
static AtkObject *getObjectCB(AtkHyperlink *aLink, gint aLinkIndex);
static gint getEndIndexCB(AtkHyperlink *aLink);
static gint getStartIndexCB(AtkHyperlink *aLink);
static gboolean isValidCB(AtkHyperlink *aLink);
static gint getAnchorCountCB(AtkHyperlink *aLink);
G_END_DECLS
static gpointer parent_class = NULL;
static nsIAccessibleHyperLink *
get_accessible_hyperlink(AtkHyperlink *aHyperlink);
GType
mai_atk_hyperlink_get_type(void)
{
static GType type = 0;
if (!type) {
static const GTypeInfo tinfo = {
sizeof(MaiAtkHyperlinkClass),
(GBaseInitFunc)NULL,
(GBaseFinalizeFunc)NULL,
(GClassInitFunc)classInitCB,
(GClassFinalizeFunc)NULL,
NULL, /* class data */
sizeof(MaiAtkHyperlink), /* instance size */
0, /* nb preallocs */
(GInstanceInitFunc)NULL,
NULL /* value table */
};
type = g_type_register_static(ATK_TYPE_HYPERLINK,
"MaiAtkHyperlink",
&tinfo, GTypeFlags(0));
}
return type;
}
MaiHyperlink::MaiHyperlink(nsIAccessibleHyperLink *aAcc,
nsIDOMNode *aNode, nsIWeakReference* aShell):
nsAccessNodeWrap(aNode, aShell),
mHyperlink(aAcc),
mMaiAtkHyperlink(nsnull)
{
}
MaiHyperlink::~MaiHyperlink()
{
if (mMaiAtkHyperlink)
g_object_unref(mMaiAtkHyperlink);
}
// MaiHyperlink use its nsIAccessibleHyperlink raw pointer as ID
NS_IMETHODIMP MaiHyperlink::GetUniqueID(void **aUniqueID)
{
if (!mHyperlink)
return NS_ERROR_FAILURE;
*aUniqueID = NS_STATIC_CAST(void*, mHyperlink.get());
return NS_OK;
}
AtkHyperlink *
MaiHyperlink::GetAtkHyperlink(void)
{
NS_ENSURE_TRUE(mHyperlink, nsnull);
if (mMaiAtkHyperlink)
return mMaiAtkHyperlink;
nsCOMPtr<nsIAccessibleHyperLink> accessIf(do_QueryInterface(mHyperlink));
if (!accessIf)
return nsnull;
mMaiAtkHyperlink =
NS_REINTERPRET_CAST(AtkHyperlink *,
g_object_new(mai_atk_hyperlink_get_type(), NULL));
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
NS_ENSURE_TRUE(mMaiAtkHyperlink, nsnull);
/* be sure to initialize it with "this" */
MaiHyperlink::Initialize(mMaiAtkHyperlink, this);
return mMaiAtkHyperlink;
}
/* static */
/* remember to call this static function when a MaiAtkHyperlink
* is created
*/
nsresult
MaiHyperlink::Initialize(AtkHyperlink *aObj, MaiHyperlink *aHyperlink)
{
NS_ENSURE_ARG(MAI_IS_ATK_HYPERLINK(aObj));
NS_ENSURE_ARG(aHyperlink);
/* initialize hyperlink */
MAI_ATK_HYPERLINK(aObj)->maiHyperlink = aHyperlink;
MAI_ATK_HYPERLINK(aObj)->uri = nsnull;
return NS_OK;
}
/* static functions for ATK callbacks */
void
classInitCB(AtkHyperlinkClass *aClass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(aClass);
parent_class = g_type_class_peek_parent(aClass);
aClass->get_uri = getUriCB;
aClass->get_object = getObjectCB;
aClass->get_end_index = getEndIndexCB;
aClass->get_start_index = getStartIndexCB;
aClass->is_valid = isValidCB;
aClass->get_n_anchors = getAnchorCountCB;
gobject_class->finalize = finalizeCB;
}
void
finalizeCB(GObject *aObj)
{
NS_ASSERTION(MAI_IS_ATK_HYPERLINK(aObj), "Invalid MaiAtkHyperlink");
if (!MAI_IS_ATK_HYPERLINK(aObj))
return;
MaiAtkHyperlink *maiHyperlink = MAI_ATK_HYPERLINK(aObj);
if (maiHyperlink->uri)
g_free(maiHyperlink->uri);
maiHyperlink->maiHyperlink = nsnull;
/* call parent finalize function */
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize(aObj);
}
gchar *
getUriCB(AtkHyperlink *aLink, gint aLinkIndex)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, nsnull);
MaiAtkHyperlink *maiHyperlink = MAI_ATK_HYPERLINK(accHyperlink);
if (maiHyperlink->uri)
return maiHyperlink->uri;
nsCOMPtr<nsIURI> uri;
nsresult rv = accHyperlink->GetURI(aLinkIndex,getter_AddRefs(uri));
if (NS_FAILED(rv) || !uri)
return nsnull;
nsCAutoString cautoStr;
rv = uri->GetSpec(cautoStr);
maiHyperlink->uri = g_strdup(cautoStr.get());
return maiHyperlink->uri;
}
AtkObject *
getObjectCB(AtkHyperlink *aLink, gint aLinkIndex)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, nsnull);
nsCOMPtr<nsIAccessible> accObj;
nsresult rv = accHyperlink->GetObject(aLinkIndex, getter_AddRefs(accObj));
NS_ENSURE_SUCCESS(rv, nsnull);
AtkObject *atkObj = nsnull;
if (accObj) {
nsIAccessible *tmpObj = accObj;
nsAccessibleWrap *accWrap = NS_STATIC_CAST(nsAccessibleWrap *, tmpObj);
atkObj = accWrap->GetAtkObject();
}
//no need to add ref it, because it is "get" not "ref" ???
return atkObj;
}
gint
getEndIndexCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 endIndex = -1;
nsresult rv = accHyperlink->GetEndIndex(&endIndex);
return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, endIndex);
}
gint
getStartIndexCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 startIndex = -1;
nsresult rv = accHyperlink->GetStartIndex(&startIndex);
return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, startIndex);
}
gboolean
isValidCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, FALSE);
PRBool isValid = PR_FALSE;
nsresult rv = accHyperlink->IsValid(&isValid);
return (NS_FAILED(rv)) ? FALSE : NS_STATIC_CAST(gboolean, isValid);
}
gint
getAnchorCountCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 count = -1;
nsresult rv = accHyperlink->GetAnchors(&count);
return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, count);
}
// Check if aHyperlink is a valid MaiHyperlink, and return the
// nsIAccessibleHyperLink related.
nsIAccessibleHyperLink *
get_accessible_hyperlink(AtkHyperlink *aHyperlink)
{
NS_ENSURE_TRUE(MAI_IS_ATK_HYPERLINK(aHyperlink), nsnull);
MaiHyperlink * maiHyperlink =
MAI_ATK_HYPERLINK(aHyperlink)->maiHyperlink;
NS_ENSURE_TRUE(maiHyperlink != nsnull, nsnull);
NS_ENSURE_TRUE(maiHyperlink->GetAtkHyperlink() == aHyperlink, nsnull);
return maiHyperlink->GetAccHyperlink();
}

View File

@@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_HYPERLINK_H__
#define __MAI_HYPERLINK_H__
#include "nsString.h"
#include "nsMai.h"
#include "nsIAccessibleHyperLink.h"
struct _AtkHyperlink;
typedef struct _AtkHyperlink AtkHyperlink;
/*
* MaiHyperlink is a auxiliary class for MaiInterfaceHyperText.
*/
class MaiHyperlink : public nsAccessNodeWrap
{
public:
MaiHyperlink(nsIAccessibleHyperLink *aAcc,
nsIDOMNode *aNode, nsIWeakReference* aShell);
~MaiHyperlink();
NS_IMETHOD GetUniqueID(void **aUniqueID);
public:
AtkHyperlink *GetAtkHyperlink(void);
nsIAccessibleHyperLink *GetAccHyperlink(void) {
return mHyperlink;
}
protected:
nsCOMPtr<nsIAccessibleHyperLink> mHyperlink;
AtkHyperlink *mMaiAtkHyperlink;
public:
static nsresult Initialize(AtkHyperlink *aObj, MaiHyperlink *aClass);
};
#endif /* __MAI_HYPERLINK_H__ */

View File

@@ -1,90 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <atk/atk.h>
#include "nsMaiInterface.h"
#include "nsAccessibleWrap.h"
MaiInterface::MaiInterface(nsAccessibleWrap *aAccWrap)
{
}
MaiInterface::~MaiInterface()
{
}
GType
MaiInterface::GetAtkType()
{
MaiInterfaceType type = GetType();
GType atkType;
switch (type) {
case MAI_INTERFACE_COMPONENT:
atkType = ATK_TYPE_COMPONENT;
break;
case MAI_INTERFACE_ACTION:
atkType = ATK_TYPE_ACTION;
break;
case MAI_INTERFACE_VALUE:
atkType = ATK_TYPE_VALUE;
break;
case MAI_INTERFACE_EDITABLE_TEXT:
atkType = ATK_TYPE_EDITABLE_TEXT;
break;
case MAI_INTERFACE_HYPERLINK:
atkType = ATK_TYPE_HYPERLINK;
break;
case MAI_INTERFACE_HYPERTEXT:
atkType = ATK_TYPE_HYPERTEXT;
break;
case MAI_INTERFACE_SELECTION:
atkType = ATK_TYPE_SELECTION;
break;
case MAI_INTERFACE_TABLE:
atkType = ATK_TYPE_TABLE;
break;
case MAI_INTERFACE_TEXT:
atkType = ATK_TYPE_TEXT;
break;
default:
atkType = G_TYPE_INVALID;
}
return atkType;
}

View File

@@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_H__
#define __MAI_INTERFACE_H__
#include "nsMai.h"
enum MaiInterfaceType {
MAI_INTERFACE_INVALID, /* 0 */
MAI_INTERFACE_COMPONENT,
MAI_INTERFACE_ACTION,
MAI_INTERFACE_VALUE,
MAI_INTERFACE_EDITABLE_TEXT,
MAI_INTERFACE_HYPERLINK,
MAI_INTERFACE_HYPERTEXT,
MAI_INTERFACE_SELECTION,
MAI_INTERFACE_TABLE,
MAI_INTERFACE_TEXT,
MAI_INTERFACE_NUM /* 10 */
};
class nsAccessibleWrap;
/* MaiInterface is the base class for all the MAI interface class (e.g.
* MaiInterfaceAction, MaiInterfaceComponent, etc).
*
* Descendents of MaiInterface provide all the implementation for corresponding
* interfaces in ATK, and map them onto nsIAccessible interfaces.
*/
class MaiInterface
{
public:
MaiInterface(nsAccessibleWrap *aAccWrap);
virtual ~MaiInterface();
GType GetAtkType();
virtual MaiInterfaceType GetType() = 0;
virtual const GInterfaceInfo *GetInterfaceInfo() = 0;
};
#endif /* __MAI_INTERFACE_H__ */

View File

@@ -1,261 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceAction.h"
#include "nsAccessibleWrap.h"
#include "nsString.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkActionIface *aIface);
/* action interface callbacks */
static gboolean doActionCB(AtkAction *aAction, gint aActionIndex);
static gint getActionCountCB(AtkAction *aAction);
static const gchar *getDescriptionCB(AtkAction *aAction, gint aActionIndex);
static const gchar *getNameCB(AtkAction *aAction, gint aActionIndex);
static const gchar *getKeyBindingCB(AtkAction *aAction, gint aActionIndex);
static gboolean setDescriptionCB(AtkAction *aAction, gint aActionIndex,
const gchar *aDesc);
G_END_DECLS
MaiInterfaceAction::MaiInterfaceAction(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceAction::~MaiInterfaceAction()
{
}
MaiInterfaceType
MaiInterfaceAction::GetType()
{
return MAI_INTERFACE_ACTION;
}
const GInterfaceInfo *
MaiInterfaceAction::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_action_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_action_info;
}
/* static functions */
void
interfaceInitCB(AtkActionIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
aIface->do_action = doActionCB;
aIface->get_n_actions = getActionCountCB;
aIface->get_description = getDescriptionCB;
aIface->get_keybinding = getKeyBindingCB;
aIface->get_name = getNameCB;
aIface->set_description = setDescriptionCB;
}
gboolean
doActionCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, FALSE);
nsresult rv = accWrap->DoAction(aActionIndex);
return (NS_FAILED(rv)) ? FALSE : TRUE;
}
gint
getActionCountCB(AtkAction *aAction)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, 0);
PRUint8 num = 0;
nsresult rv = accWrap->GetNumActions(&num);
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, num);
}
const gchar *
getDescriptionCB(AtkAction *aAction, gint aActionIndex)
{
// the interface in nsIAccessibleAction is empty
// use getName as default description
return getNameCB(aAction, aActionIndex);
}
const gchar *
getNameCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull);
MaiInterfaceAction *action =
NS_STATIC_CAST(MaiInterfaceAction *,
accWrap->GetMaiInterface(MAI_INTERFACE_ACTION));
NS_ENSURE_TRUE(action, nsnull);
nsAutoString autoStr;
nsresult rv = accWrap->GetActionName(aActionIndex, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
action->SetName(autoStr);
return action->GetName();
}
const gchar *
getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull);
MaiInterfaceAction *action =
NS_STATIC_CAST(MaiInterfaceAction *,
accWrap->GetMaiInterface(MAI_INTERFACE_ACTION));
NS_ENSURE_TRUE(action, nsnull);
if (*action->GetKeyBinding())
return action->GetKeyBinding();
//return all KeyBindings including accesskey and shortcut
nsAutoString allKeyBinding;
//get accesskey
nsAutoString accessKey;
nsresult rv = accWrap->GetKeyboardShortcut(accessKey);
if (NS_SUCCEEDED(rv) && !accessKey.IsEmpty()) {
nsCOMPtr<nsIAccessible> parentAccessible;
accWrap->GetParent(getter_AddRefs(parentAccessible));
if (parentAccessible) {
PRUint32 role;
parentAccessible->GetRole(&role);
if (role == ATK_ROLE_MENU_BAR) {
//it is topmenu, change from "Alt+f" to "f;<Alt>f"
nsAutoString rightChar;
accessKey.Right(rightChar, 1);
allKeyBinding = rightChar + NS_LITERAL_STRING(";<Alt>") +
rightChar;
}
else if ((role == ATK_ROLE_MENU) || (role == ATK_ROLE_MENU_ITEM)) {
//it is submenu, change from "s" to "s;<Alt>f:s"
nsAutoString allKey = accessKey;
nsCOMPtr<nsIAccessible> grandParentAcc = parentAccessible;
while ((grandParentAcc) && (role != ATK_ROLE_MENU_BAR)) {
nsAutoString grandParentKey;
grandParentAcc->GetKeyboardShortcut(grandParentKey);
if (!grandParentKey.IsEmpty()) {
nsAutoString rightChar;
grandParentKey.Right(rightChar, 1);
allKey = rightChar + NS_LITERAL_STRING(":") + allKey;
}
nsCOMPtr<nsIAccessible> tempAcc = grandParentAcc;
tempAcc->GetParent(getter_AddRefs(grandParentAcc));
if (grandParentAcc)
grandParentAcc->GetRole(&role);
}
allKeyBinding = accessKey + NS_LITERAL_STRING(";<Alt>") +
allKey;
}
}
else {
//default process, rarely happens.
nsAutoString rightChar;
accessKey.Right(rightChar, 1);
allKeyBinding = rightChar + NS_LITERAL_STRING(";<Alt>") + rightChar;
}
}
else //don't have accesskey
allKeyBinding.AssignLiteral(";");
//get shortcut
nsAutoString keyBinding, subShortcut;
rv = accWrap->GetKeyBinding(keyBinding);
if (NS_SUCCEEDED(rv) && !keyBinding.IsEmpty()) {
//change the shortcut from "Ctrl+Shift+L" to "<Control><Shift>L"
PRInt32 oldPos, curPos=0;
while ((curPos != -1) && (curPos < (PRInt32)keyBinding.Length())) {
oldPos = curPos;
nsAutoString subString;
curPos = keyBinding.FindChar('+', oldPos);
if (curPos == -1) {
keyBinding.Mid(subString, oldPos, keyBinding.Length() - oldPos);
subShortcut += subString;
}
else {
keyBinding.Mid(subString, oldPos, curPos - oldPos);
//change "Ctrl" to "Control"
if (subString.LowerCaseEqualsLiteral("ctrl"))
subString.AssignLiteral("Control");
subShortcut += NS_LITERAL_STRING("<") + subString +
NS_LITERAL_STRING(">");
curPos++;
}
}
}
allKeyBinding += NS_LITERAL_STRING(";") + subShortcut;
action->SetKeyBinding(allKeyBinding);
return action->GetKeyBinding();
}
gboolean
setDescriptionCB(AtkAction *aAction, gint aActionIndex,
const gchar *aDesc)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
NS_ENSURE_TRUE(accWrap, nsnull);
/* this is not supported in nsIAccessible yet */
return FALSE;
}

View File

@@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_ACTION_H__
#define __MAI_INTERFACE_ACTION_H__
#include "nsMaiInterface.h"
class MaiInterfaceAction: public MaiInterface
{
public:
MaiInterfaceAction(nsAccessibleWrap*);
virtual ~MaiInterfaceAction();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
const char *GetName() {
return mName.get();
}
void SetName(nsAString &aString) { mName = NS_ConvertUTF16toUTF8(aString); }
const char *GetKeyBinding() {
return mKeyBinding.get();
}
void SetKeyBinding(nsAString &aString) { mKeyBinding = NS_ConvertUTF16toUTF8(aString); }
private:
nsCString mName;
nsCString mKeyBinding;
};
#endif /* __MAI_INTERFACE_ACTION_H__ */

View File

@@ -1,182 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceComponent.h"
#include "nsAccessibleWrap.h"
G_BEGIN_DECLS
/* component interface callbacks */
static void interfaceInitCB(AtkComponentIface *aIface);
static AtkObject *refAccessibleAtPointCB(AtkComponent *aComponent,
gint aAccX, gint aAccY,
AtkCoordType aCoordType);
static void getExtentsCB(AtkComponent *aComponent,
gint *aAccX, gint *aAccY,
gint *aAccWidth, gint *aAccHeight,
AtkCoordType aCoordType);
/* the "contains", "get_position", "get_size" can take advantage of
* "get_extents", there is no need to implement them now.
*/
static gboolean grabFocusCB(AtkComponent *aComponent);
/* what are missing now for atk component */
/* ==================================================
* add_focus_handler
* remove_focus_handler
* set_extents
* set_position
* set_size
* get_layer
* get_mdi_zorder
* ==================================================
*/
G_END_DECLS
MaiInterfaceComponent::MaiInterfaceComponent(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceComponent::~MaiInterfaceComponent()
{
}
MaiInterfaceType
MaiInterfaceComponent::GetType()
{
return MAI_INTERFACE_COMPONENT;
}
const GInterfaceInfo *
MaiInterfaceComponent::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_component_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_component_info;
}
/* static functions */
void
interfaceInitCB(AtkComponentIface *aIface)
{
NS_ASSERTION(aIface, "Invalid Interface");
if(!aIface)
return;
/*
* Use default implementation in atk for contains, get_position,
* and get_size
*/
aIface->ref_accessible_at_point = refAccessibleAtPointCB;
aIface->get_extents = getExtentsCB;
aIface->grab_focus = grabFocusCB;
}
AtkObject *
refAccessibleAtPointCB(AtkComponent *aComponent,
gint aAccX, gint aAccY,
AtkCoordType aCoordType)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
NS_ENSURE_TRUE(accWrap, nsnull);
// or ATK_XY_SCREEN what is definition this in nsIAccessible ???
if (aCoordType == ATK_XY_WINDOW) {
/* deal with the coord type */
}
nsCOMPtr<nsIAccessible> pointAcc;
nsresult rv = accWrap->GetChildAtPoint(aAccX, aAccY, getter_AddRefs(pointAcc));
if (NS_FAILED(rv))
return nsnull;
nsIAccessible *tmpAcc = pointAcc;
nsAccessibleWrap *tmpAccWrap =
NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
AtkObject *atkObj = tmpAccWrap->GetAtkObject();
if (!atkObj)
return nsnull;
g_object_ref(atkObj);
return atkObj;
}
void
getExtentsCB(AtkComponent *aComponent,
gint *aAccX,
gint *aAccY,
gint *aAccWidth,
gint *aAccHeight,
AtkCoordType aCoordType)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
if (!accWrap)
return;
PRInt32 nsAccX, nsAccY, nsAccWidth, nsAccHeight;
nsresult rv = accWrap->GetBounds(&nsAccX, &nsAccY,
&nsAccWidth, &nsAccHeight);
if (NS_FAILED(rv))
return;
// or ATK_XY_SCREEN what is definition this in nsIAccessible?
if (aCoordType == ATK_XY_WINDOW) {
/* deal with the coord type */
}
*aAccX = nsAccX;
*aAccY = nsAccY;
*aAccWidth = nsAccWidth;
*aAccHeight = nsAccHeight;
}
gboolean
grabFocusCB(AtkComponent *aComponent)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aComponent));
NS_ENSURE_TRUE(accWrap, FALSE);
nsresult rv = accWrap->TakeFocus();
return (NS_FAILED(rv)) ? FALSE : TRUE;
}

View File

@@ -1,55 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_COMPONENT_H__
#define __MAI_INTERFACE_COMPONENT_H__
#include "nsMaiInterface.h"
class MaiInterfaceComponent: public MaiInterface
{
public:
MaiInterfaceComponent(nsAccessibleWrap* aAccWrap);
virtual ~MaiInterfaceComponent();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
#endif /* __MAI_INTERFACE_COMPONENT_H__ */

View File

@@ -1,258 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsString.h"
#include "nsMaiInterfaceEditableText.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkEditableTextIface *aIface);
/* editabletext interface callbacks */
static gboolean setRunAttributesCB(AtkEditableText *aText,
AtkAttributeSet *aAttribSet,
gint aStartOffset,
gint aEndOffset);
static void setTextContentsCB(AtkEditableText *aText, const gchar *aString);
static void insertTextCB(AtkEditableText *aText,
const gchar *aString, gint aLength, gint *aPosition);
static void copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
static void cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
static void deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos);
static void pasteTextCB(AtkEditableText *aText, gint aPosition);
G_END_DECLS
MaiInterfaceEditableText::MaiInterfaceEditableText(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceEditableText::~MaiInterfaceEditableText()
{
}
MaiInterfaceType
MaiInterfaceEditableText::GetType()
{
return MAI_INTERFACE_EDITABLE_TEXT;
}
const GInterfaceInfo *
MaiInterfaceEditableText::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_editabletext_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_editabletext_info;
}
/* statics */
void
interfaceInitCB(AtkEditableTextIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
aIface->set_run_attributes = setRunAttributesCB;
aIface->set_text_contents = setTextContentsCB;
aIface->insert_text = insertTextCB;
aIface->copy_text = copyTextCB;
aIface->cut_text = cutTextCB;
aIface->delete_text = deleteTextCB;
aIface->paste_text = pasteTextCB;
}
/* static, callbacks for atkeditabletext virutal functions */
gboolean
setRunAttributesCB(AtkEditableText *aText, AtkAttributeSet *aAttribSet,
gint aStartOffset, gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, FALSE);
nsCOMPtr<nsISupports> attrSet;
/* how to insert attributes into nsISupports ??? */
nsresult rv = accText->SetAttributes(aStartOffset, aEndOffset,
attrSet);
return NS_FAILED(rv) ? FALSE : TRUE;
}
void
setTextContentsCB(AtkEditableText *aText, const gchar *aString)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accText));
if (!accText)
return;
MAI_LOG_DEBUG(("EditableText: setTextContentsCB, aString=%s", aString));
NS_ConvertUTF8toUTF16 strContent(aString);
nsresult rv = accText->SetTextContents(strContent);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::SetTextContents, failed\n");
}
void
insertTextCB(AtkEditableText *aText,
const gchar *aString, gint aLength, gint *aPosition)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accText));
if (!accText)
return;
NS_ConvertUTF8toUTF16 strContent(aString);
// interface changed in nsIAccessibleEditableText.idl ???
//
// PRInt32 pos = *aPosition;
// nsresult rv = accText->InsertText(strContent, aLength, &pos);
// *aPosition = pos;
nsresult rv = accText->InsertText(strContent, *aPosition);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::InsertText, failed\n");
MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d",
aString, aLength, *aPosition));
}
void
copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accText));
if (!accText)
return;
MAI_LOG_DEBUG(("EditableText: copyTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
nsresult rv = accText->CopyText(aStartPos, aEndPos);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::CopyText, failed\n");
}
void
cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accText));
if (!accText)
return;
MAI_LOG_DEBUG(("EditableText: cutTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
nsresult rv = accText->CutText(aStartPos, aEndPos);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::CutText, failed\n");
}
void
deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accText));
if (!accText)
return;
MAI_LOG_DEBUG(("EditableText: deleteTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
nsresult rv = accText->DeleteText(aStartPos, aEndPos);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::DeleteText, failed\n");
}
void
pasteTextCB(AtkEditableText *aText, gint aPosition)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleEditableText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
getter_AddRefs(accText));
if (!accText)
return;
MAI_LOG_DEBUG(("EditableText: pasteTextCB, aPosition=%d", aPosition));
nsresult rv = accText->PasteText(aPosition);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceEditableText::PasteText, failed\n");
}

View File

@@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_EDITABLETEXT_H__
#define __MAI_INTERFACE_EDITABLETEXT_H__
#include "nsMaiInterface.h"
#include "nsIAccessibleEditableText.h"
class MaiInterfaceEditableText: public MaiInterface
{
public:
MaiInterfaceEditableText(nsAccessibleWrap*);
virtual ~MaiInterfaceEditableText();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
#endif /* __MAI_INTERFACE_EDITABLETEXT_H__ */

View File

@@ -1,203 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceHypertext.h"
#include "nsIAccessibleDocument.h"
#include "nsPIAccessNode.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkHypertextIface *aIface);
/* hypertext interface callbacks */
static AtkHyperlink *getLinkCB(AtkHypertext *aText, gint aLinkIndex);
static gint getLinkCountCB(AtkHypertext *aText);
static gint getLinkIndexCB(AtkHypertext *aText, gint aCharIndex);
G_END_DECLS
MaiInterfaceHypertext::MaiInterfaceHypertext(nsAccessibleWrap *aAccWrap,
nsIWeakReference* aShell):
MaiInterface(aAccWrap),
mWeakShell(aShell)
{
}
MaiInterfaceHypertext::~MaiInterfaceHypertext()
{
mWeakShell = nsnull;
}
MaiInterfaceType
MaiInterfaceHypertext::GetType()
{
return MAI_INTERFACE_HYPERTEXT;
}
nsresult
MaiInterfaceHypertext::GetWeakShell(nsIWeakReference **aWeakShell)
{
nsresult rv = NS_ERROR_FAILURE;
if (mWeakShell) {
*aWeakShell = mWeakShell;
NS_IF_ADDREF(*aWeakShell);
rv = NS_OK;
}
else
*aWeakShell = nsnull;
return rv;
}
const GInterfaceInfo *
MaiInterfaceHypertext::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_hypertext_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_hypertext_info;
}
/* statics */
void
interfaceInitCB(AtkHypertextIface *aIface)
{
g_return_if_fail(aIface != NULL);
aIface->get_link = getLinkCB;
aIface->get_n_links = getLinkCountCB;
aIface->get_link_index = getLinkIndexCB;
}
AtkHyperlink *
getLinkCB(AtkHypertext *aText, gint aLinkIndex)
{
nsresult rv;
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
MaiInterfaceHypertext *maiHypertext =
NS_STATIC_CAST(MaiInterfaceHypertext *,
accWrap->GetMaiInterface(MAI_INTERFACE_HYPERTEXT));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIWeakReference> weakShell;
rv = maiHypertext->GetWeakShell(getter_AddRefs(weakShell));
NS_ENSURE_SUCCESS(rv, nsnull);
nsCOMPtr<nsIAccessibleHyperText> accHyperlink;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
getter_AddRefs(accHyperlink));
NS_ENSURE_TRUE(accHyperlink, nsnull);
nsCOMPtr<nsIAccessibleHyperLink> hyperLink;
rv = accHyperlink->GetLink(aLinkIndex, getter_AddRefs(hyperLink));
if (NS_FAILED(rv) || !hyperLink)
return nsnull;
// The MaiHyperlink and its nsIAccessibleHyperlink are in the same cache.
// we take hyperlink->get() as Id for the MaiHyperlink.
// release our ref to the previous one
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(weakShell);
if (!accessibleDoc) {
NS_WARNING("No accessible document for this presshell");
return nsnull;
}
nsCOMPtr<nsIAccessNode> maiNode;
accessibleDoc->GetCachedAccessNode(NS_STATIC_CAST(void*, hyperLink.get()),
getter_AddRefs(maiNode));
// if the maiHyperlink is not in cache, create it.
if (!maiNode) {
maiNode = new MaiHyperlink(hyperLink, nsnull, weakShell);
if (!maiNode) {
NS_WARNING("OUT OF MEMORY");
return nsnull;
}
nsCOMPtr<nsPIAccessNode> pMaiNode = do_QueryInterface(maiNode);
pMaiNode->Init(); // add to cache.
}
// we can get AtkHyperlink from the MaiHyperlink
nsIAccessNode *tmpNode = maiNode;
MaiHyperlink *maiHyperlink = NS_STATIC_CAST(MaiHyperlink *, tmpNode);
/* we should not addref the atkhyperlink because we are "get" not "ref" */
return maiHyperlink->GetAtkHyperlink();
}
gint
getLinkCountCB(AtkHypertext *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleHyperText> accHyperlink;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
getter_AddRefs(accHyperlink));
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 count = -1;
nsresult rv = accHyperlink->GetLinks(&count);
NS_ENSURE_SUCCESS(rv, -1);
return count;
}
gint
getLinkIndexCB(AtkHypertext *aText, gint aCharIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleHyperText> accHyperlink;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
getter_AddRefs(accHyperlink));
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 index = -1;
nsresult rv = accHyperlink->GetLinkIndex(aCharIndex, &index);
NS_ENSURE_SUCCESS(rv, -1);
return index;
}

View File

@@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_HYPERTEXT_H__
#define __MAI_INTERFACE_HYPERTEXT_H__
#include "nsMaiInterface.h"
#include "nsMaiHyperlink.h"
#include "nsIAccessibleHyperText.h"
class MaiInterfaceHypertext: public MaiInterface
{
public:
MaiInterfaceHypertext(nsAccessibleWrap *aAccWrap,
nsIWeakReference* aShell);
virtual ~MaiInterfaceHypertext();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
nsresult GetWeakShell(nsIWeakReference **aWeakShell);
private:
nsCOMPtr<nsIWeakReference> mWeakShell;
};
#endif /* __MAI_INTERFACE_HYPERTEXT_H__ */

View File

@@ -1,220 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Silvia Zhao (silvia.zhao@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceSelection.h"
G_BEGIN_DECLS
/* selection interface callbacks */
static void interfaceInitCB(AtkSelectionIface *aIface);
static gboolean addSelectionCB(AtkSelection *aSelection,
gint i);
static gboolean clearSelectionCB(AtkSelection *aSelection);
static AtkObject *refSelectionCB(AtkSelection *aSelection,
gint i);
static gint getSelectionCountCB(AtkSelection *aSelection);
static gboolean isChildSelectedCB(AtkSelection *aSelection,
gint i);
static gboolean removeSelectionCB(AtkSelection *aSelection,
gint i);
static gboolean selectAllSelectionCB(AtkSelection *aSelection);
G_END_DECLS
MaiInterfaceSelection::MaiInterfaceSelection(nsAccessibleWrap* aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceSelection::~MaiInterfaceSelection()
{
}
MaiInterfaceType
MaiInterfaceSelection::GetType()
{
return MAI_INTERFACE_SELECTION;
}
const GInterfaceInfo *
MaiInterfaceSelection::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_selection_info = {
(GInterfaceInitFunc) interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_selection_info;
}
/* static functions */
void
interfaceInitCB(AtkSelectionIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
aIface->add_selection = addSelectionCB;
aIface->clear_selection = clearSelectionCB;
aIface->ref_selection = refSelectionCB;
aIface->get_selection_count = getSelectionCountCB;
aIface->is_child_selected = isChildSelectedCB;
aIface->remove_selection = removeSelectionCB;
aIface->select_all_selection = selectAllSelectionCB;
}
gboolean
addSelectionCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accSelection));
NS_ENSURE_TRUE(accSelection, FALSE);
return NS_SUCCEEDED(accSelection->AddChildToSelection(i));
}
gboolean
clearSelectionCB(AtkSelection *aSelection)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accSelection));
NS_ENSURE_TRUE(accSelection, FALSE);
return NS_SUCCEEDED(accSelection->ClearSelection());
}
AtkObject *
refSelectionCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accSelection));
NS_ENSURE_TRUE(accSelection, nsnull);
AtkObject *atkObj = nsnull;
nsCOMPtr<nsIAccessible> accSelect;
nsresult rv = accSelection->RefSelection(i, getter_AddRefs(accSelect));
if (NS_SUCCEEDED(rv) && accSelect) {
nsIAccessible *tmpAcc = accSelect;
nsAccessibleWrap *refAccWrap =
NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
atkObj = refAccWrap->GetAtkObject();
if (atkObj)
g_object_ref(atkObj);
}
return atkObj;
}
gint
getSelectionCountCB(AtkSelection *aSelection)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accSelection));
NS_ENSURE_TRUE(accSelection, -1);
PRInt32 num = 0;
nsresult rv = accSelection->GetSelectionCount(&num);
return (NS_FAILED(rv)) ? -1 : num;
}
gboolean
isChildSelectedCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accSelection));
NS_ENSURE_TRUE(accSelection, FALSE);
PRBool result = FALSE;
nsresult rv = accSelection->IsChildSelected(i, &result);
return (NS_FAILED(rv)) ? FALSE : result;
}
gboolean
removeSelectionCB(AtkSelection *aSelection, gint i)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accSelection));
NS_ENSURE_TRUE(accSelection, FALSE);
nsresult rv = accSelection->RemoveChildFromSelection(i);
return (NS_FAILED(rv)) ? FALSE : TRUE;
}
gboolean
selectAllSelectionCB(AtkSelection *aSelection)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleSelectable> accSelection;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleSelectable),
getter_AddRefs(accSelection));
NS_ENSURE_TRUE(accSelection, FALSE);
PRBool result = FALSE;
nsresult rv = accSelection->SelectAllSelection(&result);
return (NS_FAILED(rv)) ? FALSE : result;
}

View File

@@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Silvia Zhao (silvia.zhao@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_SELECTION_H__
#define __MAI_INTERFACE_SELECTION_H__
#include "nsMaiInterface.h"
#include "nsIAccessibleSelectable.h"
class MaiInterfaceSelection: public MaiInterface
{
public:
MaiInterfaceSelection(nsAccessibleWrap*);
~MaiInterfaceSelection();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
#endif /* __MAI_INTERFACE_SELECTION_H__ */

View File

@@ -1,584 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceTable.h"
G_BEGIN_DECLS
/* table interface callbacks */
static void interfaceInitCB(AtkTableIface *aIface);
static AtkObject* refAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static gint getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static gint getColumnAtIndexCB(AtkTable *aTable, gint aIndex);
static gint getRowAtIndexCB(AtkTable *aTable, gint aIndex);
static gint getColumnCountCB(AtkTable *aTable);
static gint getRowCountCB(AtkTable *aTable);
static gint getColumnExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static gint getRowExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
static AtkObject* getCaptionCB(AtkTable *aTable);
static const gchar* getColumnDescriptionCB(AtkTable *aTable, gint aColumn);
static AtkObject* getColumnHeaderCB(AtkTable *aTable, gint aColumn);
static const gchar* getRowDescriptionCB(AtkTable *aTable, gint aRow);
static AtkObject* getRowHeaderCB(AtkTable *aTable, gint aRow);
static AtkObject* getSummaryCB(AtkTable *aTable);
static gint getSelectedColumnsCB(AtkTable *aTable, gint **aSelected);
static gint getSelectedRowsCB(AtkTable *aTable, gint **aSelected);
static gboolean isColumnSelectedCB(AtkTable *aTable, gint aColumn);
static gboolean isRowSelectedCB(AtkTable *aTable, gint aRow);
static gboolean isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn);
/* what are missing now for atk table */
/* ==================================================
void (* set_caption) (AtkTable *aTable,
AtkObject *caption);
void (* set_column_description) (AtkTable *aTable,
gint aColumn,
const gchar *description);
void (* set_column_header) (AtkTable *aTable,
gint aColumn,
AtkObject *header);
void (* set_row_description) (AtkTable *aTable,
gint aRow,
const gchar *description);
void (* set_row_header) (AtkTable *aTable,
gint aRow,
AtkObject *header);
void (* set_summary) (AtkTable *aTable,
AtkObject *accessible);
gboolean (* add_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* remove_row_selection) (AtkTable *aTable,
gint aRow);
gboolean (* add_column_selection) (AtkTable *aTable,
gint aColumn);
gboolean (* remove_column_selection) (AtkTable *aTable,
gint aColumn);
////////////////////////////////////////
// signal handlers
//
void (* row_inserted) (AtkTable *aTable,
gint aRow,
gint num_inserted);
void (* column_inserted) (AtkTable *aTable,
gint aColumn,
gint num_inserted);
void (* row_deleted) (AtkTable *aTable,
gint aRow,
gint num_deleted);
void (* column_deleted) (AtkTable *aTable,
gint aColumn,
gint num_deleted);
void (* row_reordered) (AtkTable *aTable);
void (* column_reordered) (AtkTable *aTable);
void (* model_changed) (AtkTable *aTable);
* ==================================================
*/
G_END_DECLS
MaiInterfaceTable::MaiInterfaceTable(nsAccessibleWrap* aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceTable::~MaiInterfaceTable()
{
}
MaiInterfaceType
MaiInterfaceTable::GetType()
{
return MAI_INTERFACE_TABLE;
}
const GInterfaceInfo *
MaiInterfaceTable::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_table_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_table_info;
}
/* static functions */
void
interfaceInitCB(AtkTableIface *aIface)
{
g_return_if_fail(aIface != NULL);
aIface->ref_at = refAtCB;
aIface->get_index_at = getIndexAtCB;
aIface->get_column_at_index = getColumnAtIndexCB;
aIface->get_row_at_index = getRowAtIndexCB;
aIface->get_n_columns = getColumnCountCB;
aIface->get_n_rows = getRowCountCB;
aIface->get_column_extent_at = getColumnExtentAtCB;
aIface->get_row_extent_at = getRowExtentAtCB;
aIface->get_caption = getCaptionCB;
aIface->get_column_description = getColumnDescriptionCB;
aIface->get_column_header = getColumnHeaderCB;
aIface->get_row_description = getRowDescriptionCB;
aIface->get_row_header = getRowHeaderCB;
aIface->get_summary = getSummaryCB;
aIface->get_selected_columns = getSelectedColumnsCB;
aIface->get_selected_rows = getSelectedRowsCB;
aIface->is_column_selected = isColumnSelectedCB;
aIface->is_row_selected = isRowSelectedCB;
aIface->is_selected = isCellSelectedCB;
}
/* static */
AtkObject*
refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessible> cell;
nsresult rv = accTable->CellRefAt(aRow, aColumn,getter_AddRefs(cell));
if (NS_FAILED(rv) || !cell)
return nsnull;
nsIAccessible *tmpAcc = cell;
nsAccessibleWrap *cellAccWrap = NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
AtkObject *atkObj = cellAccWrap->GetAtkObject();
if (atkObj)
g_object_ref(atkObj);
return atkObj;
}
gint
getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 index;
nsresult rv = accTable->GetIndexAt(aRow, aColumn, &index);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, index);
}
gint
getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 col;
nsresult rv = accTable->GetColumnAtIndex(aIndex, &col);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, col);
}
gint
getRowAtIndexCB(AtkTable *aTable, gint aIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 row;
nsresult rv = accTable->GetRowAtIndex(aIndex, &row);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, row);
}
gint
getColumnCountCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 count;
nsresult rv = accTable->GetColumns(&count);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, count);
}
gint
getRowCountCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 count;
nsresult rv = accTable->GetRows(&count);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, count);
}
gint
getColumnExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 extent;
nsresult rv = accTable->GetColumnExtentAt(aRow, aColumn, &extent);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, extent);
}
gint
getRowExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, -1);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 extent;
nsresult rv = accTable->GetRowExtentAt(aRow, aColumn, &extent);
NS_ENSURE_SUCCESS(rv, -1);
return NS_STATIC_CAST(gint, extent);
}
AtkObject*
getCaptionCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessible> caption;
nsresult rv = accTable->GetCaption(getter_AddRefs(caption));
if (NS_FAILED(rv) || !caption)
return nsnull;
nsIAccessible *tmpAcc = caption;
nsAccessibleWrap *captionAccWrap =
NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
return captionAccWrap->GetAtkObject();
}
const gchar*
getColumnDescriptionCB(AtkTable *aTable, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
MaiInterfaceTable *maiTable =
NS_STATIC_CAST(MaiInterfaceTable *,
accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
NS_ENSURE_TRUE(maiTable, nsnull);
const char *description = maiTable->GetColumnDescription();
if (!description) {
nsAutoString autoStr;
nsresult rv = accTable->GetColumnDescription(aColumn, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
maiTable->SetColumnDescription(autoStr);
description = maiTable->GetColumnDescription();
}
return description;
}
AtkObject*
getColumnHeaderCB(AtkTable *aTable, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessibleTable> header;
nsresult rv = accTable->GetColumnHeader(getter_AddRefs(header));
NS_ENSURE_SUCCESS(rv, nsnull);
NS_ENSURE_TRUE(header, nsnull);
// Note: "table column header" has different definition between atk and mai
//
// 1. "getColumnHeaderCB" defined in AtkTableIface should return object
// whose role is "ATK_ROLE_TABLE_COLUMN_HEADER", which is implemented
// by nsXULTreeColumnitemAccessible.
//
// 2. "GetColumnHeader" defined in nsIAccessibleTable returns
// nsXULTreeColumnsAccessibleWrap, which exports nsIAccessibleTable and is
// "ROLE_LIST".
nsCOMPtr<nsIAccessible> accHeader;
header->CellRefAt(0, aColumn, getter_AddRefs(accHeader));
NS_ENSURE_TRUE(accHeader, nsnull);
nsIAccessible *tmpAcc = accHeader;
nsAccessibleWrap *headerAccWrap =
NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
return headerAccWrap->GetAtkObject();
}
const gchar*
getRowDescriptionCB(AtkTable *aTable, gint aRow)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
MaiInterfaceTable *maiTable =
NS_STATIC_CAST(MaiInterfaceTable *,
accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
NS_ENSURE_TRUE(maiTable, nsnull);
nsAutoString autoStr;
nsresult rv = accTable->GetRowDescription(aRow, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
maiTable->SetRowDescription(autoStr);
return maiTable->GetRowDescription();
}
AtkObject*
getRowHeaderCB(AtkTable *aTable, gint aRow)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessibleTable> header;
nsresult rv = accTable->GetRowHeader(getter_AddRefs(header));
NS_ENSURE_SUCCESS(rv, nsnull);
nsCOMPtr<nsIAccessible> accHeader(do_QueryInterface(header));
NS_ENSURE_TRUE(accTable, nsnull);
nsIAccessible *tmpAcc = accHeader;
nsAccessibleWrap *headerAccWrap =
NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
return headerAccWrap->GetAtkObject();
}
AtkObject*
getSummaryCB(AtkTable *aTable)
{
/* ??? in nsIAccessibleTable, it returns a nsAString */
return nsnull;
}
gint
getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, 0);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, 0);
PRUint32 size = 0;
PRInt32 *columns = NULL;
nsresult rv = accTable->GetSelectedColumns(&size, &columns);
if (NS_FAILED(rv) || (size == 0) || !columns) {
*aSelected = nsnull;
return 0;
}
gint *atkColumns = g_new(gint, size);
if (!atkColumns) {
NS_WARNING("OUT OF MEMORY");
return nsnull;
}
//copy
for (PRUint32 index = 0; index < size; ++index)
atkColumns[index] = NS_STATIC_CAST(gint, columns[index]);
nsMemory::Free(columns);
*aSelected = atkColumns;
return size;
}
gint
getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, 0);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, 0);
PRUint32 size = 0;
PRInt32 *rows = NULL;
nsresult rv = accTable->GetSelectedRows(&size, &rows);
if (NS_FAILED(rv) || (size == 0) || !rows) {
*aSelected = nsnull;
return 0;
}
gint *atkRows = g_new(gint, size);
if (!atkRows) {
NS_WARNING("OUT OF MEMORY");
return nsnull;
}
//copy
for (PRUint32 index = 0; index < size; ++index)
atkRows[index] = NS_STATIC_CAST(gint, rows[index]);
nsMemory::Free(rows);
*aSelected = atkRows;
return size;
}
gboolean
isColumnSelectedCB(AtkTable *aTable, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, FALSE);
PRBool outValue;
nsresult rv = accTable->IsColumnSelected(aColumn, &outValue);
return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
}
gboolean
isRowSelectedCB(AtkTable *aTable, gint aRow)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, FALSE);
PRBool outValue;
nsresult rv = accTable->IsRowSelected(aRow, &outValue);
return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
}
gboolean
isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, FALSE);
PRBool outValue;
nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
}

View File

@@ -1,75 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_TABLE_H__
#define __MAI_INTERFACE_TABLE_H__
#include "nsMaiInterface.h"
#include "nsIAccessibleTable.h"
class MaiInterfaceTable: public MaiInterface
{
public:
MaiInterfaceTable(nsAccessibleWrap*);
virtual ~MaiInterfaceTable();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
const char *GetColumnDescription() {
return mColumnDescription.get();
}
void SetColumnDescription(nsAString &aString) {
CopyUTF16toUTF8(aString, mColumnDescription);
}
const char *GetRowDescription() {
return mRowDescription.get();
}
void SetRowDescription(nsAString &aString) {
CopyUTF16toUTF8(aString, mRowDescription);
}
private:
nsCString mColumnDescription;
nsCString mRowDescription;
};
#endif /* __MAI_INTERFACE_TABLE_H__ */

View File

@@ -1,512 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
* Ginn Chen (ginn.chen@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceText.h"
#include "nsString.h"
G_BEGIN_DECLS
static void interfaceInitCB(AtkTextIface *aIface);
/* text interface callbacks */
static gchar *getTextCB(AtkText *aText,
gint aStartOffset, gint aEndOffset);
static gchar *getTextAfterOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
static gchar *getTextAtOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
static gunichar getCharacterAtOffsetCB(AtkText *aText, gint aOffset);
static gchar *getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset);
static gint getCaretOffsetCB(AtkText *aText);
static AtkAttributeSet *getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aStartOffset,
gint *aEndOffset);
static AtkAttributeSet* getDefaultAttributesCB(AtkText *aText);
static void getCharacterExtentsCB(AtkText *aText, gint aOffset,
gint *aX, gint *aY,
gint *aWidth, gint *aHeight,
AtkCoordType aCoords);
static gint getCharacterCountCB(AtkText *aText);
static gint getOffsetAtPointCB(AtkText *aText,
gint aX, gint aY,
AtkCoordType aCoords);
static gint getSelectionCountCB(AtkText *aText);
static gchar *getSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset);
// set methods
static gboolean addSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset);
static gboolean removeSelectionCB(AtkText *aText,
gint aSelectionNum);
static gboolean setSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset);
static gboolean setCaretOffsetCB(AtkText *aText, gint aOffset);
/*************************************************
// signal handlers
//
static void TextChangedCB(AtkText *aText, gint aPosition, gint aLength);
static void TextCaretMovedCB(AtkText *aText, gint aLocation);
static void TextSelectionChangedCB(AtkText *aText);
*/
G_END_DECLS
MaiInterfaceText::MaiInterfaceText(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceText::~MaiInterfaceText()
{
}
MaiInterfaceType
MaiInterfaceText::GetType()
{
return MAI_INTERFACE_TEXT;
}
const GInterfaceInfo *
MaiInterfaceText::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_text_info = {
(GInterfaceInitFunc)interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_text_info;
}
/* statics */
void
interfaceInitCB(AtkTextIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
aIface->get_text = getTextCB;
aIface->get_text_after_offset = getTextAfterOffsetCB;
aIface->get_text_at_offset = getTextAtOffsetCB;
aIface->get_character_at_offset = getCharacterAtOffsetCB;
aIface->get_text_before_offset = getTextBeforeOffsetCB;
aIface->get_caret_offset = getCaretOffsetCB;
aIface->get_run_attributes = getRunAttributesCB;
aIface->get_default_attributes = getDefaultAttributesCB;
aIface->get_character_extents = getCharacterExtentsCB;
aIface->get_character_count = getCharacterCountCB;
aIface->get_offset_at_point = getOffsetAtPointCB;
aIface->get_n_selections = getSelectionCountCB;
aIface->get_selection = getSelectionCB;
// set methods
aIface->add_selection = addSelectionCB;
aIface->remove_selection = removeSelectionCB;
aIface->set_selection = setSelectionCB;
aIface->set_caret_offset = setCaretOffsetCB;
}
void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
{
// convert each char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRole(&accRole);
if (NS_STATIC_CAST(AtkRole, accRole) == ATK_ROLE_PASSWORD_TEXT) {
for (PRUint32 i = 0; i < aString.Length(); i++)
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
}
}
gchar *
getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, nsnull);
nsAutoString autoStr;
nsresult rv = accText->GetText(aStartOffset, aEndOffset, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
ConvertTexttoAsterisks(accWrap, autoStr);
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
//copy and return, libspi will free it.
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gchar *
getTextAfterOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, nsnull);
nsAutoString autoStr;
PRInt32 startOffset = 0, endOffset = 0;
nsresult rv =
accText->GetTextAfterOffset(aOffset, aBoundaryType,
&startOffset, &endOffset, autoStr);
*aStartOffset = startOffset;
*aEndOffset = endOffset;
NS_ENSURE_SUCCESS(rv, nsnull);
ConvertTexttoAsterisks(accWrap, autoStr);
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gchar *
getTextAtOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, nsnull);
nsAutoString autoStr;
PRInt32 startOffset = 0, endOffset = 0;
nsresult rv =
accText->GetTextAtOffset(aOffset, aBoundaryType,
&startOffset, &endOffset, autoStr);
*aStartOffset = startOffset;
*aEndOffset = endOffset;
NS_ENSURE_SUCCESS(rv, nsnull);
ConvertTexttoAsterisks(accWrap, autoStr);
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gunichar
getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, 0);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, 0);
/* PRUnichar is unsigned short in Mozilla */
/* gnuichar is guint32 in glib */
PRUnichar uniChar;
nsresult rv =
accText->GetCharacterAtOffset(aOffset, &uniChar);
// convert char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRole(&accRole);
if (NS_STATIC_CAST(AtkRole, accRole) == ATK_ROLE_PASSWORD_TEXT) {
uniChar = '*';
}
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gunichar, uniChar);
}
gchar *
getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, nsnull);
nsAutoString autoStr;
PRInt32 startOffset = 0, endOffset = 0;
nsresult rv =
accText->GetTextBeforeOffset(aOffset, aBoundaryType,
&startOffset, &endOffset, autoStr);
*aStartOffset = startOffset;
*aEndOffset = endOffset;
NS_ENSURE_SUCCESS(rv, nsnull);
ConvertTexttoAsterisks(accWrap, autoStr);
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
gint
getCaretOffsetCB(AtkText *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, 0);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, 0);
PRInt32 offset;
nsresult rv = accText->GetCaretOffset(&offset);
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, offset);
}
AtkAttributeSet *
getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aStartOffset,
gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, nsnull);
nsCOMPtr<nsISupports> attrSet;
PRInt32 startOffset = 0, endOffset = 0;
nsresult rv = accText->GetAttributeRange(aOffset,
&startOffset, &endOffset,
getter_AddRefs(attrSet));
*aStartOffset = startOffset;
*aEndOffset = endOffset;
NS_ENSURE_SUCCESS(rv, nsnull);
/* what to do with the nsISupports ? ??? */
return nsnull;
}
AtkAttributeSet *
getDefaultAttributesCB(AtkText *aText)
{
/* not supported ??? */
return nsnull;
}
void
getCharacterExtentsCB(AtkText *aText, gint aOffset,
gint *aX, gint *aY,
gint *aWidth, gint *aHeight,
AtkCoordType aCoords)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if(!accWrap)
return;
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
if (!accText)
return;
PRInt32 extY = 0, extX = 0;
PRInt32 extWidth = 0, extHeight = 0;
nsresult rv = accText->GetCharacterExtents(aOffset, &extX, &extY,
&extWidth, &extHeight,
aCoords);
*aX = extX;
*aY = extY;
*aWidth = extWidth;
*aHeight = extHeight;
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"MaiInterfaceText::GetCharacterExtents, failed\n");
}
gint
getCharacterCountCB(AtkText *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, 0);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, 0);
PRInt32 count = 0;
nsresult rv = accText->GetCharacterCount(&count);
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, count);
}
gint
getOffsetAtPointCB(AtkText *aText,
gint aX, gint aY,
AtkCoordType aCoords)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, 0);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, 0);
PRInt32 offset = 0;
nsresult rv = accText->GetOffsetAtPoint(aX, aY, aCoords, &offset);
return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, offset);
}
gint
getSelectionCountCB(AtkText *aText)
{
/* no implemetation in nsIAccessibleText??? */
//new attribuate will be added in nsIAccessibleText.idl
//readonly attribute long selectionCount;
return 0;
}
gchar *
getSelectionCB(AtkText *aText, gint aSelectionNum,
gint *aStartOffset, gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, nsnull);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, nsnull);
PRInt32 startOffset = 0, endOffset = 0;
nsresult rv = accText->GetSelectionBounds(aSelectionNum,
&startOffset, &endOffset);
*aStartOffset = startOffset;
*aEndOffset = endOffset;
NS_ENSURE_SUCCESS(rv, nsnull);
return getTextCB(aText, *aStartOffset, *aEndOffset);
}
// set methods
gboolean
addSelectionCB(AtkText *aText,
gint aStartOffset,
gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, FALSE);
nsresult rv = accText->AddSelection(aStartOffset, aEndOffset);
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}
gboolean
removeSelectionCB(AtkText *aText,
gint aSelectionNum)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, FALSE);
nsresult rv = accText->RemoveSelection(aSelectionNum);
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}
gboolean
setSelectionCB(AtkText *aText, gint aSelectionNum,
gint aStartOffset, gint aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, FALSE);
nsresult rv = accText->SetSelectionBounds(aSelectionNum,
aStartOffset, aEndOffset);
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}
gboolean
setCaretOffsetCB(AtkText *aText, gint aOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, FALSE);
nsresult rv = accText->SetCaretOffset(aOffset);
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
}

View File

@@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_TEXT_H__
#define __MAI_INTERFACE_TEXT_H__
#include "nsMaiInterface.h"
#include "nsIAccessibleText.h"
class MaiInterfaceText: public MaiInterface
{
public:
MaiInterfaceText(nsAccessibleWrap*);
virtual ~MaiInterfaceText();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
#endif /* __MAI_INTERFACE_TEXT_H__ */

View File

@@ -1,178 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Silvia Zhao (silvia.zhao@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMaiInterfaceValue.h"
G_BEGIN_DECLS
/*value interface callbacks*/
static void interfaceInitCB(AtkValueIface *aIface);
static void getCurrentValueCB(AtkValue *obj,
GValue *value);
static void getMaximumValueCB(AtkValue *obj,
GValue *value);
static void getMinimumValueCB(AtkValue *obj,
GValue *value);
static gboolean setCurrentValueCB(AtkValue *obj,
const GValue *value);
G_END_DECLS
MaiInterfaceValue::MaiInterfaceValue(nsAccessibleWrap *aAccWrap):
MaiInterface(aAccWrap)
{
}
MaiInterfaceValue::~MaiInterfaceValue()
{
}
MaiInterfaceType
MaiInterfaceValue::GetType()
{
return MAI_INTERFACE_VALUE;
}
const GInterfaceInfo *
MaiInterfaceValue::GetInterfaceInfo()
{
static const GInterfaceInfo atk_if_value_info = {
(GInterfaceInitFunc) interfaceInitCB,
(GInterfaceFinalizeFunc) NULL,
NULL
};
return &atk_if_value_info;
}
/* static functions */
void
interfaceInitCB(AtkValueIface *aIface)
{
NS_ASSERTION(aIface, "Invalid aIface");
if (!aIface)
return;
aIface->get_current_value = getCurrentValueCB;
aIface->get_maximum_value = getMaximumValueCB;
aIface->get_minimum_value = getMinimumValueCB;
aIface->set_current_value = setCurrentValueCB;
}
void
getCurrentValueCB(AtkValue *obj, GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
if (!accValue)
return;
memset (value, 0, sizeof (GValue));
double accDouble;
if (NS_FAILED(accValue->GetCurrentValue(&accDouble)))
return;
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, accDouble);
}
void
getMaximumValueCB(AtkValue *obj, GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
if (!accValue)
return;
memset (value, 0, sizeof (GValue));
double accDouble;
if (NS_FAILED(accValue->GetMaximumValue(&accDouble)))
return;
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, accDouble);
}
void
getMinimumValueCB(AtkValue *obj, GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
if (!accValue)
return;
memset (value, 0, sizeof (GValue));
double accDouble;
if (NS_FAILED(accValue->GetMinimumValue(&accDouble)))
return;
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, accDouble);
}
gboolean
setCurrentValueCB(AtkValue *obj, const GValue *value)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
NS_ENSURE_TRUE(accWrap, FALSE);
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
NS_ENSURE_TRUE(accValue, FALSE);
PRBool aBool;
double accDouble;
accDouble = g_value_get_double (value);
accValue->SetCurrentValue(accDouble, &aBool);
return aBool;
}

View File

@@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Silvia Zhao (silvia.zhao@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __MAI_INTERFACE_VALUE_H__
#define __MAI_INTERFACE_VALUE_H__
#include "nsMaiInterface.h"
#include "nsIAccessibleValue.h"
class MaiInterfaceValue: public MaiInterface
{
public:
MaiInterfaceValue(nsAccessibleWrap*);
~MaiInterfaceValue();
virtual MaiInterfaceType GetType();
virtual const GInterfaceInfo *GetInterfaceInfo();
};
#endif /* __MAI_INTERFACE_VALUE_H__ */

View File

@@ -1,104 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
* Ginn Chen (ginn.chen@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMai.h"
#include "nsRootAccessibleWrap.h"
#include "nsAppRootAccessible.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIFocusController.h"
nsRootAccessibleWrap::nsRootAccessibleWrap(nsIDOMNode *aDOMNode,
nsIWeakReference* aShell):
nsRootAccessible(aDOMNode, aShell)
{
MAI_LOG_DEBUG(("New Root Acc=%p\n", (void*)this));
nsAppRootAccessible *root = nsAppRootAccessible::Create();
if (root)
root->AddRootAccessible(this);
}
nsRootAccessibleWrap::~nsRootAccessibleWrap()
{
MAI_LOG_DEBUG(("Delete Root Acc=%p\n", (void*)this));
nsAppRootAccessible *root = nsAppRootAccessible::Create();
if (root)
root->RemoveRootAccessible(this);
}
NS_IMETHODIMP nsRootAccessibleWrap::GetParent(nsIAccessible ** aParent)
{
nsAppRootAccessible *root = nsAppRootAccessible::Create();
nsresult rv = NS_OK;
if (root) {
NS_IF_ADDREF(*aParent = root);
}
else {
*aParent = nsnull;
rv = NS_ERROR_FAILURE;
}
return rv;
}
NS_IMETHODIMP nsRootAccessibleWrap::GetRole(PRUint32 *_retval)
{
*_retval = ROLE_FRAME;
return NS_OK;
}
NS_IMETHODIMP nsRootAccessibleWrap::GetExtState(PRUint32 *aState)
{
nsAccessibleWrap::GetExtState(aState);
nsCOMPtr<nsIDOMWindow> domWin;
GetWindow(getter_AddRefs(domWin));
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(domWin));
if (privateDOMWindow) {
nsIFocusController *focusController =
privateDOMWindow->GetRootFocusController();
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (isActive) {
*aState |= EXT_STATE_ACTIVE;
}
}
return NS_OK;
}

View File

@@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Bolian Yin (bolian.yin@sun.com)
* Ginn Chen (ginn.chen@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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __NS_ROOT_ACCESSIBLE_WRAP_H__
#define __NS_ROOT_ACCESSIBLE_WRAP_H__
#include "nsRootAccessible.h"
/* nsRootAccessibleWrap is the accessible class for toplevel Window.
* The instance of nsRootAccessibleWrap will be child of MaiAppRoot instance.
* It is added into root when the toplevel window is created, and removed
* from root when the toplevel window is destroyed.
*/
class nsRootAccessibleWrap: public nsRootAccessible
{
public:
nsRootAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
virtual ~nsRootAccessibleWrap();
NS_IMETHOD GetParent(nsIAccessible ** aParent);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetExtState(PRUint32 *aState);
};
#endif /* __NS_ROOT_ACCESSIBLE_WRAP_H__ */

View File

@@ -1,45 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Corp.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aaron Leventhal
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsTextAccessibleWrap_H_
#define _nsTextAccessibleWrap_H_
#include "nsTextAccessible.h"
#include "nsAccessibleText.h"
#endif

View File

@@ -1,153 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gilbert Fang (gilbert.fang@sun.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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMElement.h"
#include "nsXULFormControlAccessibleWrap.h"
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMXULTextboxElement.h"
NS_IMPL_ISUPPORTS_INHERITED1(nsXULProgressMeterAccessibleWrap, nsXULProgressMeterAccessible, nsIAccessibleValue)
nsXULProgressMeterAccessibleWrap::nsXULProgressMeterAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsXULProgressMeterAccessible(aNode, aShell)
{
}
/* readonly attribute double maximumValue; */
NS_IMETHODIMP nsXULProgressMeterAccessibleWrap::GetMaximumValue(double *aMaximumValue)
{
*aMaximumValue = 1; // 100% = 1;
return NS_OK;
}
/* readonly attribute double minimumValue; */
NS_IMETHODIMP nsXULProgressMeterAccessibleWrap::GetMinimumValue(double *aMinimumValue)
{
*aMinimumValue = 0;
return NS_OK;
}
/* readonly attribute double currentValue; */
NS_IMETHODIMP nsXULProgressMeterAccessibleWrap::GetCurrentValue(double *aCurrentValue)
{
nsAutoString currentValue;
GetValue(currentValue);
PRInt32 error;
*aCurrentValue = currentValue.ToFloat(&error) / 100;
return NS_OK;
}
/* boolean setCurrentValue (in double value); */
NS_IMETHODIMP nsXULProgressMeterAccessibleWrap::SetCurrentValue(double aValue, PRBool *_retval)
{
//Here I do not suppose the min/max are 0/1.00 because I want
// these part of code to be more extensible.
*_retval = PR_FALSE;
double min, max;
GetMinimumValue(&min);
GetMaximumValue(&max);
if (aValue > max || aValue < min)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No element for DOM node!");
PRUint32 value = PRUint32(aValue * 100.0 + 0.5);
nsAutoString valueString;
valueString.AppendInt(value);
valueString.AppendLiteral("%");
if (NS_SUCCEEDED(element->SetAttribute(NS_LITERAL_STRING("value"), valueString))) {
*_retval = PR_TRUE;
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMPL_ISUPPORTS_INHERITED2(nsXULTextFieldAccessibleWrap, nsXULTextFieldAccessible, nsIAccessibleText, nsIAccessibleEditableText)
nsXULTextFieldAccessibleWrap::nsXULTextFieldAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsXULTextFieldAccessible(aNode, aShell), nsAccessibleEditableText(aNode)
{
nsCOMPtr<nsIDOMXULTextBoxElement> textBox(do_QueryInterface(aNode));
NS_ASSERTION(textBox, "Not a XUL textbox!");
if (!textBox)
return;
textBox->GetInputField(getter_AddRefs(mTextNode));
if (!mTextNode)
return;
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
if (!shell)
return;
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
nsIFrame* frame = shell->GetPrimaryFrameFor(content);
if (!frame)
return;
nsITextControlFrame *textFrame;
frame->QueryInterface(NS_GET_IID(nsITextControlFrame), (void**)&textFrame);
if (textFrame) {
nsCOMPtr<nsIEditor> editor;
textFrame->GetEditor(getter_AddRefs(editor));
SetEditor(editor);
}
}
NS_IMETHODIMP nsXULTextFieldAccessibleWrap::GetRole(PRUint32 *aRole)
{
PRUint32 state = 0;
nsresult rv = GetState(&state);
if (NS_SUCCEEDED(rv) && (state & STATE_PROTECTED))
*aRole = ROLE_PASSWORD_TEXT;
else
*aRole = ROLE_TEXT;
return NS_OK;
}
NS_IMETHODIMP nsXULTextFieldAccessibleWrap::Shutdown()
{
nsAccessibleEditableText::ShutdownEditor();
return nsXULTextFieldAccessible::Shutdown();
}

View File

@@ -1,70 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gilbert Fang (gilbert.fang@sun.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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULFormControlAccessibleWrap_h__
#define __nsXULFormControlAccessibleWrap_h__
#include "nsIAccessibleValue.h"
#include "nsXULFormControlAccessible.h"
#include "nsAccessibleText.h"
class nsXULProgressMeterAccessibleWrap : public nsXULProgressMeterAccessible,
public nsIAccessibleValue
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEVALUE
nsXULProgressMeterAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell);
};
class nsXULTextFieldAccessibleWrap : public nsXULTextFieldAccessible,
public nsAccessibleEditableText
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsXULTextFieldAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32* aRole);
NS_IMETHOD Shutdown();
};
#endif

View File

@@ -1,45 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is IBM Corporation
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aleventh@us.ibm.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULMenuAccessibleWrap_h__
#define __nsXULMenuAccessibleWrap_h__
#include "nsXULMenuAccessible.h"
typedef class nsXULMenuitemAccessible nsXULMenuitemAccessibleWrap;
#endif

View File

@@ -1,570 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pete Zha (pete.zha@sun.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 MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMElement.h"
#include "nsITreeSelection.h"
#include "nsITreeColumns.h"
#include "nsXULTreeAccessibleWrap.h"
// --------------------------------------------------------
// nsXULTreeAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeAccessibleWrap, nsXULTreeAccessible, nsIAccessibleTable)
nsXULTreeAccessibleWrap::nsXULTreeAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeAccessible(aDOMNode, aShell)
{
mCaption = nsnull;
}
// tree's children count is row count * col count + treecols count
// override "children count = row count + treecols count" defined in
// nsXULTreeAccessible
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetChildCount(PRInt32 *aAccChildCount)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
// get treecols count, which is cached by nsAccessibleTreeWalker
// by going through DOM structure of XUL tree
nsAccessible::GetChildCount(aAccChildCount);
// add the count of table cell (or tree item) accessibles, which are
// created and appended by XUL tree accessible implementation
PRInt32 rowCount, colCount = 1;
mTreeView->GetRowCount(&rowCount);
GetColumnCount(mTree, &colCount);
*aAccChildCount += rowCount * colCount;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetCaption(nsIAccessible **aCaption)
{
*aCaption = mCaption;
NS_IF_ADDREF(*aCaption);
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::SetCaption(nsIAccessible *aCaption)
{
mCaption = aCaption;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSummary(nsAString &aSummary)
{
aSummary = mSummary;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::SetSummary(const nsAString &aSummary)
{
mSummary = aSummary;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumns(PRInt32 *aColumns)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIAccessible> acc;
rv = nsAccessible::GetFirstChild(getter_AddRefs(acc));
NS_ENSURE_TRUE(acc, NS_ERROR_FAILURE);
return acc->GetChildCount(aColumns);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIAccessible> acc;
nsAccessible::GetFirstChild(getter_AddRefs(acc));
NS_ENSURE_TRUE(acc, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessibleTable> accTable(do_QueryInterface(acc, &rv));
NS_ENSURE_SUCCESS(rv, rv);
*aColumnHeader = accTable;
NS_IF_ADDREF(*aColumnHeader);
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRows(PRInt32 *aRows)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
return mTreeView->GetRowCount(aRows);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
// Row header not supported
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSelectedColumns(PRUint32 *aNumColumns, PRInt32 **aColumns)
{
// If all the row has been selected, then all the columns are selected.
// Because we can't select a column alone.
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
NS_ENSURE_ARG_POINTER(aNumColumns);
nsresult rv = NS_OK;
PRInt32 rows;
rv = GetRows(&rows);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedRows;
rv = GetSelectionCount(&selectedRows);
NS_ENSURE_SUCCESS(rv, rv);
if (rows == selectedRows) {
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
*aNumColumns = columns;
} else {
*aNumColumns = 0;
return rv;
}
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 index = 0; index < *aNumColumns; index++) {
outArray[index] = index;
}
*aColumns = outArray;
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSelectedRows(PRUint32 *aNumRows, PRInt32 **aRows)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
NS_ENSURE_ARG_POINTER(aNumRows);
nsresult rv = NS_OK;
rv = GetSelectionCount((PRInt32 *)aNumRows);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsITreeView> view;
rv = mTree->GetView(getter_AddRefs(view));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITreeSelection> selection;
rv = view->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowCount;
rv = GetRows(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRBool isSelected;
PRInt32 index, curr = 0;
for (index = 0; index < rowCount; index++) {
selection->IsSelected(index, &isSelected);
if (isSelected) {
outArray[curr++] = index;
}
}
*aRows = outArray;
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **_retval)
{
NS_ENSURE_TRUE(mDOMNode && mTree, NS_ERROR_FAILURE);
nsresult rv = NS_OK;
nsCOMPtr<nsIAccessibleTable> header;
rv = GetColumnHeader(getter_AddRefs(header));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessible> column;
rv = header->CellRefAt(0, aColumn, getter_AddRefs(column));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(column));
NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode");
nsCOMPtr<nsIDOMNode> columnNode;
rv = accessNode->GetDOMNode(getter_AddRefs(columnNode));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMElement> columnElement(do_QueryInterface(columnNode, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITreeColumns> treeColumns;
rv = mTree->GetColumns(getter_AddRefs(treeColumns));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITreeColumn> treeColumn;
rv = treeColumns->GetColumnFor(columnElement, getter_AddRefs(treeColumn));
NS_ENSURE_SUCCESS(rv, rv);
return GetCachedTreeitemAccessible(aRow, treeColumn, _retval);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::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 nsXULTreeAccessibleWrap::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 treeCols;
nsAccessible::GetChildCount(&treeCols);
*_retval = (aIndex - treeCols) % columns;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 treeCols;
nsAccessible::GetChildCount(&treeCols);
*_retval = (aIndex - treeCols) / columns;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
{
nsCOMPtr<nsIAccessibleTable> columnHeader;
nsresult rv = GetColumnHeader(getter_AddRefs(columnHeader));
if (NS_SUCCEEDED(rv) && columnHeader) {
return columnHeader->GetColumnDescription(aColumn, _retval);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowDescription(PRInt32 aRow, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
{
// If all the row has been selected, then all the columns are selected.
// Because we can't select a column alone.
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 rows;
rv = GetRows(&rows);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedRows;
rv = GetSelectionCount(&selectedRows);
NS_ENSURE_SUCCESS(rv, rv);
*_retval = rows == selectedRows;
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::IsRowSelected(PRInt32 aRow, PRBool *_retval)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
nsresult rv = NS_OK;
nsCOMPtr<nsITreeView> view;
rv = mTree->GetView(getter_AddRefs(view));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITreeSelection> selection;
rv = view->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
return selection->IsSelected(aRow, _retval);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, PRBool *_retval)
{
return IsRowSelected(aRow, _retval);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
PRInt32 rowIndex;
nsresult rv = GetRowAtIndex(aIndex, &rowIndex);
nsCOMPtr<nsITreeSelection> selection;
rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ASSERTION(selection, "Can't get selection from mTreeView");
if (selection) {
selection->IsSelected(rowIndex, aSelState);
// XXX: Can move to nsXULTreeAccessible if this can be applied to cross-platform
if ((!(*aSelState) && eSelection_Add == aMethod)) {
nsresult rv = selection->Select(rowIndex);
mTree->EnsureRowIsVisible(aIndex);
return rv;
}
// XXX: Will eSelection_Remove happen for XULTree? Leave the original implementation here
if ((*aSelState) && eSelection_Remove == aMethod) {
return selection->ToggleSelect(rowIndex);
}
}
return NS_OK;
}
// --------------------------------------------------------
// nsXULTreeAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeColumnsAccessibleWrap, nsXULTreeColumnsAccessible, nsIAccessibleTable)
nsXULTreeColumnsAccessibleWrap::nsXULTreeColumnsAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeColumnsAccessible(aDOMNode, aShell)
{
mCaption = nsnull;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetCaption(nsIAccessible **aCaption)
{
*aCaption = mCaption;
NS_IF_ADDREF(*aCaption);
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::SetCaption(nsIAccessible *aCaption)
{
mCaption = aCaption;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSummary(nsAString &aSummary)
{
aSummary = mSummary;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::SetSummary(const nsAString &aSummary)
{
mSummary = aSummary;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumns(PRInt32 *aColumns)
{
return GetChildCount(aColumns);
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnHeader(nsIAccessibleTable * *aColumnHeader)
{
// Column header not supported.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRows(PRInt32 *aRows)
{
NS_ENSURE_ARG_POINTER(aRows);
*aRows = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowHeader(nsIAccessibleTable * *aRowHeader)
{
// Row header not supported.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSelectedColumns(PRUint32 *columnsSize, PRInt32 **columns)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSelectedRows(PRUint32 *rowsSize, PRInt32 **rows)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **_retval)
{
nsCOMPtr<nsIAccessible> next, temp;
GetFirstChild(getter_AddRefs(next));
NS_ENSURE_TRUE(next, NS_ERROR_FAILURE);
for (PRInt32 col = 0; col < aColumn; col++) {
next->GetNextSibling(getter_AddRefs(temp));
NS_ENSURE_TRUE(temp, NS_ERROR_FAILURE);
next = temp;
}
*_retval = next;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = aColumn;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = aIndex;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 0;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
{
nsCOMPtr<nsIAccessible> column;
nsresult rv = CellRefAt(0, aColumn, getter_AddRefs(column));
if (NS_SUCCEEDED(rv) && column) {
return column->GetName(_retval);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowDescription(PRInt32 aRow, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::IsRowSelected(PRInt32 aRow, PRBool *_retval)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, PRBool *_retval)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}

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