first commit
This commit is contained in:
commit
2f2ae146c0
|
@ -0,0 +1,24 @@
|
|||
#RetroZilla Git Ignore
|
||||
|
||||
mozconfig
|
||||
.mozconfig
|
||||
|
||||
### Windows ###
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
|
@ -0,0 +1,20 @@
|
|||
# gmake
|
||||
# This file is automatically generated for client.mk.
|
||||
# Do not edit. Edit /c/projects/moz95/mozilla/mozconfig instead.
|
||||
# To create a new .mozconfig file, you can visit,
|
||||
# http://webtools.mozilla.org/build/config.cgi
|
||||
|
||||
# PATH=/local/bin:/c/mozilla-build//wget:/c/mozilla-build//7zip:/c/mozilla-build//blat261/full:/c/mozilla-build//python25:/c/mozilla-build//svn-win32-1.4.2/bin:/c/mozilla-build//upx203w:/c/mozilla-build//xemacs/XEmacs-21.4.19/i586-pc-win32:/c/mozilla-build//info-zip:/c/mozilla-build//nsis-2.22:/c/mozilla-build//nsis-2.33u:.:/usr/local/bin:/mingw/bin:/bin:/c/PROGRA~1/MICROS~3/Common/msdev98/BIN:/c/PROGRA~1/MICROS~3/VC98/BIN:/c/PROGRA~1/MICROS~3/Common/TOOLS/WINNT:/c/PROGRA~1/MICROS~3/Common/TOOLS:/c/WINNT/System32:/c/WINNT:/c/WINNT/System32/Wbem:/c/mozilla-build/moztools-180compat/bin
|
||||
MOZ_MAKE_FLAGS=-j4
|
||||
MOZ_OBJDIR=/c/projects/moz95/obj-sm95-release
|
||||
# --target=i586-pc-msvc is used by configure (not client.mk)
|
||||
# --enable-application=suite is used by configure (not client.mk)
|
||||
# --enable-optimize is used by configure (not client.mk)
|
||||
# --disable-debug is used by configure (not client.mk)
|
||||
# --disable-tests is used by configure (not client.mk)
|
||||
# --without-system-jpg is used by configure (not client.mk)
|
||||
# --without-system-zlib is used by configure (not client.mk)
|
||||
# --enable-extensions=default,tasks is used by configure (not client.mk)
|
||||
# --enable-crypto is used by configure (not client.mk)
|
||||
# --enable-svg is used by configure (not client.mk)
|
||||
# --enable-canvas is used by configure (not client.mk)
|
|
@ -0,0 +1,14 @@
|
|||
# gmake
|
||||
# This file is automatically generated for client.mk.
|
||||
# Do not edit. Edit /c/projects/moz95/mozilla/mozconfig instead.
|
||||
# To create a new .mozconfig file, you can visit,
|
||||
# http://webtools.mozilla.org/build/config.cgi
|
||||
|
||||
# PATH=/local/bin:/c/mozilla-build//wget:/c/mozilla-build//7zip:/c/mozilla-build//blat261/full:/c/mozilla-build//python25:/c/mozilla-build//svn-win32-1.4.2/bin:/c/mozilla-build//upx203w:/c/mozilla-build//xemacs/XEmacs-21.4.19/i586-pc-win32:/c/mozilla-build//info-zip:/c/mozilla-build//nsis-2.22:/c/mozilla-build//nsis-2.33u:.:/usr/local/bin:/mingw/bin:/bin:/c/PROGRA~1/MICROS~3/Common/msdev98/BIN:/c/PROGRA~1/MICROS~3/VC98/BIN:/c/PROGRA~1/MICROS~3/Common/TOOLS/WINNT:/c/PROGRA~1/MICROS~3/Common/TOOLS:/c/WINNT/System32:/c/WINNT:/c/WINNT/System32/Wbem:/c/mozilla-build/moztools-180compat/bin
|
||||
MOZ_MAKE_FLAGS=-j4
|
||||
MOZ_OBJDIR=/c/projects/moz95/obj-sm95-release
|
||||
# --target=i586-pc-msvc is used by configure (not client.mk)
|
||||
# --enable-application=suite is used by configure (not client.mk)
|
||||
# --enable-optimize is used by configure (not client.mk)
|
||||
# --disable-debug is used by configure (not client.mk)
|
||||
# --disable-tests is used by configure (not client.mk)
|
|
@ -0,0 +1,14 @@
|
|||
RetroZilla Credits
|
||||
==================
|
||||
For now, I'm just listing the contributors to the RetroZilla
|
||||
project in this file, but I plan to create a replacement for
|
||||
about:credits in the future. If you've contributed to RetroZilla
|
||||
and your name isn't already in this list, send an email to
|
||||
rn10950+retrozilla@gmail.com, and I will verify your contributions
|
||||
and add your name to the list.
|
||||
|
||||
SPECIAL THANKS TO:
|
||||
==================
|
||||
Ryan Nematz
|
||||
Nathan Lineback
|
||||
Mozilla.org Developers
|
|
@ -0,0 +1,43 @@
|
|||
Please be apprised of the following Legal Notices:
|
||||
|
||||
A) The U.S. District Court for the Eastern District of Virginia has
|
||||
ruled that the Netscape Navigator code does not infringe Wang's U.S.
|
||||
Patent No. 4,751,669 ("the '669 Patent") because: 1) HTML is not
|
||||
Videotex as defined by the '669 patent; 2) web servers are not central
|
||||
suppliers; and 3) Navigator does not "connect," as defined by the '669
|
||||
Patent, to web servers on the Internet. Wang may appeal this decision to
|
||||
the Federal Circuit. Wang contended that its Patent disclosing a
|
||||
"Videotext" system, is infringed by the following functionality in the
|
||||
Netscape Navigator code: 1) the animated logo and status line indicators
|
||||
--See Claims 1,8 and 9; 2) the "File Save As" function --See Claims
|
||||
23-27; 3) Bookmarks and Rename Bookmarks in the Properties window --See
|
||||
Claims 20-22; 4) storing HTML, GIF, and JPEG files and adding filename
|
||||
extensions --See Claim 38
|
||||
|
||||
B) Intermind owns pending U.S. patent applications on communications
|
||||
systems which employ metadata ("channel objects") to define a control
|
||||
structure for information transfer. The Netscape code does not infringe
|
||||
as released; however, modifications which utilize channel objects as
|
||||
described by Intermind should be considered carefully. The following is
|
||||
a statement from Intermind: "Intermind's claims fundamentally involve
|
||||
the use of a control structure to automate communications. ...The
|
||||
essence of Intermind's top claim is that two devices sender and
|
||||
receiver have persistent storage, communicate over a network,
|
||||
and exchange a control structure including metadata which describes: 1)
|
||||
what information is to be updated, 2) when to update this information,
|
||||
and 3) how to transfer the updated information. In addition, at least
|
||||
the receiving device must be able to process the metadata in order to
|
||||
perform the update determination and transfer. Any digital
|
||||
communications system which incorporates all of these elements will be
|
||||
covered by Intermind's patents." See Intermind.com.
|
||||
|
||||
C) Stac, Inc., and its licensing agent Hi/fn, own several patents which
|
||||
disclose data compression methods implementing an LZS compression
|
||||
algorithm, including U.S. Patent Nos. 4,701,745 and 5,016, 009 ("the
|
||||
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.
|
|
@ -0,0 +1,567 @@
|
|||
MOZILLA PUBLIC LICENSE
|
||||
Version 1.1
|
||||
|
||||
---------------
|
||||
|
||||
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
|
||||
the creation of Modifications.
|
||||
|
||||
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
|
||||
combination of the Original Code and Modifications, in each case
|
||||
including portions thereof.
|
||||
|
||||
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
|
||||
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.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.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
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
2. Source Code License.
|
||||
|
||||
2.1. The Initial Developer Grant.
|
||||
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).
|
||||
|
||||
(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.
|
||||
|
||||
2.2. Contributor Grant.
|
||||
Subject to third party intellectual property claims, each Contributor
|
||||
hereby grants You a world-wide, royalty-free, non-exclusive license
|
||||
|
||||
(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
|
||||
|
||||
(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.
|
||||
|
||||
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.
|
||||
|
||||
3.2. Availability of Source Code.
|
||||
Any Modification which You create or to which You contribute must be
|
||||
made available in Source Code form under the terms of this License
|
||||
either on the same media as an Executable version or via an accepted
|
||||
Electronic Distribution Mechanism to anyone to whom you made an
|
||||
Executable version available; and if made available via Electronic
|
||||
Distribution Mechanism, must remain available for at least twelve (12)
|
||||
months after the date it initially became available, or at least six
|
||||
(6) months after a subsequent version of that particular Modification
|
||||
has been made available to such recipients. You are responsible for
|
||||
ensuring that the Source Code version remains available even if the
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
(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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
3.7. Larger Works.
|
||||
You may create a Larger Work by combining Covered Code with other code
|
||||
not governed by the terms of this License and distribute the Larger
|
||||
Work as a single product. In such a case, You must make sure the
|
||||
requirements of this License are fulfilled for the Covered Code.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
6.2. Effect of New Versions.
|
||||
Once Covered Code has been published under a particular version of the
|
||||
License, You may always continue to use it under the terms of that
|
||||
version. You may also choose to use such Covered Code under the terms
|
||||
of any subsequent version of the License published by Netscape. No one
|
||||
other than Netscape has the right to modify the terms applicable to
|
||||
Covered Code created under this License.
|
||||
|
||||
6.3. Derivative Works.
|
||||
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
|
||||
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.)
|
||||
|
||||
7. DISCLAIMER OF WARRANTY.
|
||||
|
||||
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.
|
||||
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
||||
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
||||
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
||||
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
||||
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
8. TERMINATION.
|
||||
|
||||
8.1. 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
|
||||
survive any termination of this License. Provisions which, by their
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
rights set forth herein.
|
||||
|
||||
11. MISCELLANEOUS.
|
||||
|
||||
This License represents the complete agreement concerning subject
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
13. MULTIPLE-LICENSED CODE.
|
||||
|
||||
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.
|
||||
|
||||
EXHIBIT A -Mozilla Public License.
|
||||
|
||||
``The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.1 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF 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 Initial Developer of the Original Code is ________________________.
|
||||
Portions created by ______________________ are Copyright (C) ______
|
||||
_______________________. 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."
|
||||
|
||||
[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."
|
|
@ -0,0 +1,586 @@
|
|||
#
|
||||
# ***** 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 the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms 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
|
||||
|
||||
include $(topsrcdir)/build/unix/modules.mk
|
||||
|
||||
ifeq ($(BUILD_MODULES),all)
|
||||
#
|
||||
# And now for something completely different...
|
||||
# Divide the default build into tiers.
|
||||
# Tiers must be defined on module boundaries
|
||||
#
|
||||
SUPPRESS_DEFAULT_RULES = 1
|
||||
|
||||
default alldep all:: $(SUBMAKEFILES)
|
||||
$(RM) -rf $(DIST)/sdk
|
||||
$(RM) -rf $(DIST)/include
|
||||
$(MAKE) -C config export
|
||||
$(MAKE) nspr
|
||||
$(MAKE) ldap
|
||||
$(MAKE) tier_0
|
||||
$(MAKE) tier_1
|
||||
$(MAKE) tier_2
|
||||
$(MAKE) tier_9
|
||||
$(MAKE) tier_50
|
||||
$(MAKE) tier_99
|
||||
|
||||
# Make sure that the existing rulesets work
|
||||
DIRS = \
|
||||
$(tier_0_dirs) \
|
||||
$(tier_1_dirs) \
|
||||
$(tier_2_dirs) \
|
||||
$(tier_9_dirs) \
|
||||
$(tier_50_dirs) \
|
||||
$(NULL)
|
||||
|
||||
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
|
||||
|
||||
ifndef MOZ_NATIVE_JPEG
|
||||
tier_1_dirs += jpeg
|
||||
endif
|
||||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
tier_1_dirs += modules/zlib
|
||||
endif
|
||||
|
||||
# Installer needs standalone libjar, hence standalone zlib
|
||||
ifdef MOZ_INSTALLER
|
||||
tier_1_dirs += modules/zlib/standalone
|
||||
endif
|
||||
|
||||
ifdef MOZ_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 \
|
||||
db \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_STORAGE
|
||||
tier_9_dirs += storage
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XLIB
|
||||
tier_9_dirs += gfx/src/xlibrgb widget/src/xlibxtbin
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
tier_9_dirs += widget/src/gtksuperwin widget/src/gtkxtbin
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK2
|
||||
tier_9_dirs += widget/src/gtkxtbin
|
||||
endif
|
||||
|
||||
ifdef MOZ_IPCD
|
||||
tier_9_dirs += ipc/ipcd
|
||||
endif
|
||||
|
||||
ifdef MOZ_JSDEBUGGER
|
||||
tier_9_dirs += js/jsd
|
||||
endif
|
||||
|
||||
tier_9_dirs += \
|
||||
modules/libutil \
|
||||
netwerk \
|
||||
modules/libjar \
|
||||
uriloader \
|
||||
modules/libpref \
|
||||
modules/libimg \
|
||||
caps \
|
||||
rdf \
|
||||
parser/expat \
|
||||
parser/xml \
|
||||
parser/htmlparser \
|
||||
gfx \
|
||||
modules/libpr0n \
|
||||
sun-java \
|
||||
modules/plugin \
|
||||
dom \
|
||||
view \
|
||||
widget \
|
||||
content \
|
||||
layout \
|
||||
xpfe/components/shistory \
|
||||
docshell \
|
||||
webshell \
|
||||
embedding \
|
||||
editor \
|
||||
xpfe/appshell \
|
||||
$(NULL)
|
||||
|
||||
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
|
||||
ifdef MOZ_XUL_APP
|
||||
tier_50_dirs += chrome
|
||||
else
|
||||
tier_50_dirs += rdf/chrome
|
||||
endif
|
||||
else
|
||||
tier_50_dirs += embedding/minimo/chromelite
|
||||
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 += \
|
||||
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_PHOENIX
|
||||
#XXXBlake this shell path is a temp hack; toolkit shouldn't depend on browser
|
||||
tier_50_dirs += browser/components/shell/public
|
||||
endif
|
||||
|
||||
ifdef MOZ_XPINSTALL
|
||||
tier_50_dirs += xpinstall
|
||||
endif
|
||||
|
||||
# JavaXPCOM JNI code is compiled into libXUL
|
||||
ifdef MOZ_JAVAXPCOM
|
||||
tier_50_dirs += extensions/java/xpcom/src
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_LIBXUL
|
||||
tier_50_dirs += \
|
||||
toolkit/library \
|
||||
xpcom/stub \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
tier_50_dirs += tools/trace-malloc
|
||||
endif
|
||||
|
||||
ifdef MOZ_PSM
|
||||
tier_50_dirs += security/manager
|
||||
else
|
||||
tier_50_dirs += security/manager/boot/public security/manager/ssl/public
|
||||
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 features
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
ifdef MOZ_JAVAXPCOM
|
||||
tier_99_dirs += extensions/java
|
||||
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
|
||||
|
||||
ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2))
|
||||
tier_99_dirs += embedding/browser/gtk
|
||||
endif
|
||||
|
||||
# viewer
|
||||
ifneq (,$(ENABLE_TESTS))
|
||||
ifndef MOZ_ENABLE_LIBXUL
|
||||
tier_99_dirs += webshell/tests
|
||||
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
|
||||
|
||||
else
|
||||
|
||||
# Standalone build
|
||||
|
||||
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
|
||||
|
||||
default:: $(SUBMAKEFILES)
|
||||
$(MAKE) export
|
||||
$(MAKE) libs
|
||||
|
||||
endif # BUILD_MODULES == all
|
||||
|
||||
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
|
||||
|
||||
# Map mozilla targets to standard automake target
|
||||
ifdef MOZ_ENABLE_LIBXUL
|
||||
tier_50: $(addsuffix /Makefile, $(filter-out $(STATIC_MAKEFILES), $($@_dirs)))
|
||||
@echo "tier_50: $(tier_50_dirs)"
|
||||
@$(EXIT_ON_ERROR) \
|
||||
for d in $(tier_50_dirs); do \
|
||||
$(UPDATE_TITLE) \
|
||||
if test ! -f $$d/Makefile; then \
|
||||
$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $$d/Makefile; \
|
||||
fi; \
|
||||
$(MAKE) -C $$d export; \
|
||||
done ; \
|
||||
for d in $(tier_50_dirs); do \
|
||||
$(UPDATE_TITLE) \
|
||||
$(MAKE) -C $$d libs; \
|
||||
done
|
||||
@echo "Building tools from tier 2/9/50"
|
||||
@$(EXIT_ON_ERROR) \
|
||||
for d in $(tier_2_dirs) $(tier_9_dirs) $(tier_50_dirs); do \
|
||||
$(UPDATE_TITLE) \
|
||||
$(MAKE) -C $$d tools; \
|
||||
done;
|
||||
endif
|
||||
|
||||
tier_%:
|
||||
@echo "$@: $($@_dirs)"
|
||||
@$(EXIT_ON_ERROR) \
|
||||
for d in $($@_dirs); do \
|
||||
$(UPDATE_TITLE) \
|
||||
if test ! -f $$d/Makefile; then \
|
||||
$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $$d/Makefile; \
|
||||
fi; \
|
||||
$(MAKE) -C $$d export; \
|
||||
done ; \
|
||||
for d in $($@_dirs); do $(UPDATE_TITLE) \
|
||||
$(MAKE) -C $$d libs; \
|
||||
done
|
||||
|
||||
#
|
||||
# Individual modules
|
||||
#
|
||||
boehm:
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
$(MAKE) -C gc/boehm
|
||||
endif
|
||||
|
||||
nspr: boehm
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
$(MAKE) -C nsprpub
|
||||
endif
|
||||
|
||||
ldap:
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
$(MAKE) -C directory/c-sdk
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
signnss:
|
||||
ifdef MOZILLA_OFFICIAL
|
||||
echo signing NSS libs
|
||||
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
|
||||
|
|
@ -0,0 +1,306 @@
|
|||
==============================================================
|
||||
|
||||
= = = = = = = = = = 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.
|
|
@ -0,0 +1,3 @@
|
|||
For mozilla-the-client build instructions, please read:
|
||||
http://www.mozilla.org/build/
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
================================================================================
|
||||
|
||||
= = = = = = = = = = = = = = 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 mozilla.dev.ports.os2
|
||||
on news.mozilla.org.
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
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/>.
|
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
# ***** 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
|
@ -0,0 +1,92 @@
|
|||
#
|
||||
# ***** 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
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
[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
|
|
@ -0,0 +1,82 @@
|
|||
/* -*- 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)
|
||||
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
#
|
||||
# ***** 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
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# ***** 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
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
/* -*- 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.
|
||||
|
||||
*/
|
|
@ -0,0 +1,68 @@
|
|||
/* -*- 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.
|
||||
|
||||
*/
|
|
@ -0,0 +1,76 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla 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?
|
||||
|
||||
*/
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- 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 ();
|
||||
};
|
|
@ -0,0 +1,82 @@
|
|||
/* -*- 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);
|
||||
};
|
|
@ -0,0 +1,144 @@
|
|||
/* -*- 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).
|
||||
*/
|
|
@ -0,0 +1,74 @@
|
|||
/* -*- 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.
|
||||
|
||||
*/
|
|
@ -0,0 +1,25 @@
|
|||
#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
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
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
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
/* -*- 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
|
||||
);
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
/* -*- 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);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla 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);
|
||||
};
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
# ***** 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
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/* -*- 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;
|
||||
};
|
|
@ -0,0 +1,141 @@
|
|||
/* -*- 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);
|
||||
};
|
|
@ -0,0 +1,150 @@
|
|||
/* -*- 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(0e80f152-d676-4fba-8862-9dc4eb761442)]
|
||||
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 nsISupports 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 nsISupports 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 nsISupports 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);
|
||||
|
||||
%}
|
|
@ -0,0 +1,642 @@
|
|||
/* -*- 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 a role attribute 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 role attribute 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 role attribute 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.
|
||||
* Many states are only valid given a certain role attribute that supports them
|
||||
*/
|
||||
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
|
||||
%}
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla 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();
|
||||
};
|
|
@ -0,0 +1,135 @@
|
|||
/* -*- 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);
|
||||
};
|
|
@ -0,0 +1,154 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is 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;
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla 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;
|
||||
};
|
|
@ -0,0 +1,128 @@
|
|||
/* -*- 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 } }
|
||||
|
||||
%}
|
|
@ -0,0 +1,110 @@
|
|||
/* -*- 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();
|
||||
};
|
|
@ -0,0 +1,53 @@
|
|||
/* -*- 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);
|
||||
};
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is 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();
|
||||
};
|
|
@ -0,0 +1,55 @@
|
|||
/* -*- 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);
|
||||
};
|
|
@ -0,0 +1,67 @@
|
|||
/* -*- 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();
|
||||
};
|
|
@ -0,0 +1,70 @@
|
|||
#
|
||||
# ***** 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
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
# ***** 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)
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- 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"
|
||||
#include "nsAppRootAccessible.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();
|
||||
|
||||
// Shutdown accessibility for ATK
|
||||
nsAppRootAccessible::Unload();
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is 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
|
|
@ -0,0 +1,568 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 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 "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) {
|
||||
nsIFrame *frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDomNode));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, PR_FALSE);
|
||||
|
||||
while (aCurFrame) {
|
||||
|
||||
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) {
|
||||
#ifdef DEBUG
|
||||
nsAutoString text;
|
||||
node->GetNodeValue(text);
|
||||
char buf[1024];
|
||||
text.ToCString(buf, sizeof(buf));
|
||||
#endif
|
||||
// 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();
|
||||
aCurFrame = siblingFrame;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, nsnull);
|
||||
|
||||
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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
*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;
|
||||
} else if (GetLinkNode(domNode) == nsAccessNode::gLastFocusedNode) {
|
||||
//Focus is here
|
||||
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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
*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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
*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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
*aLinks = 0;
|
||||
|
||||
PRUint32 index, count;
|
||||
mTextChildren->GetLength(&count);
|
||||
for (index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
|
||||
if (GetLinkNode(domNode)) {
|
||||
(*aLinks)++;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessibleHyperLink getLink (in long index); */
|
||||
NS_IMETHODIMP nsAccessibleHyperText::GetLink(PRInt32 aIndex, nsIAccessibleHyperLink **aLink)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 index, count, linkCount = 0;
|
||||
mTextChildren->GetLength(&count);
|
||||
for (index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryElementAt(mTextChildren, index));
|
||||
nsIDOMNode* parentNode = GetLinkNode(domNode);
|
||||
if (parentNode) {
|
||||
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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
*aLinkIndex = -1;
|
||||
PRInt32 beforeLength_unused;
|
||||
PRUint32 nodeIndex;
|
||||
nsIDOMNode* domNode = FindTextNodeByOffset(aCharIndex, beforeLength_unused);
|
||||
if (GetLinkNode(domNode)
|
||||
&& NS_SUCCEEDED(mTextChildren->IndexOf(0, domNode, &nodeIndex))) {
|
||||
(*aLinkIndex)++;
|
||||
for (PRUint32 index = 0; index < nodeIndex; index++) {
|
||||
nsCOMPtr<nsIDOMNode> childNode(do_QueryElementAt(mTextChildren, index));
|
||||
if (GetLinkNode(childNode)) {
|
||||
(*aLinkIndex)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getSelectedLinkIndex (); */
|
||||
NS_IMETHODIMP nsAccessibleHyperText::GetSelectedLinkIndex(PRInt32 *aSelectedLinkIndex)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
*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));
|
||||
nsIDOMNode* linkNode = GetLinkNode(domNode);
|
||||
if (linkNode) {
|
||||
if (linkNode == 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)
|
||||
{
|
||||
NS_ENSURE_TRUE(mTextChildren, NS_ERROR_FAILURE);
|
||||
|
||||
*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;
|
||||
}
|
||||
|
||||
nsIDOMNode* nsAccessibleHyperText::GetLinkNode(nsIDOMNode* aNode)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
nsCOMPtr<nsILink> link;
|
||||
while (aNode && link == nsnull) {
|
||||
// text node maybe a child (or grandchild, ...) of a link node
|
||||
aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
aNode = parentNode;
|
||||
link = do_QueryInterface(parentNode);
|
||||
}
|
||||
|
||||
return parentNode;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _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);
|
||||
nsIDOMNode* GetLinkNode(nsIDOMNode* aNode);
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,137 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _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 GetCurrentOffset(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
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,100 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.com)
|
||||
*
|
||||
* Contributor(s): John Sun (john.sun@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,845 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMai.h"
|
||||
#include "nsAppRootAccessible.h"
|
||||
#include "prlink.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <atk/atk.h>
|
||||
|
||||
/* app root accessible */
|
||||
static nsAppRootAccessible *sAppRoot = nsnull;
|
||||
|
||||
/* 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 MOZILLA_VERSION
|
||||
#define MAI_NAME "Gecko"
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* static */ void nsAppRootAccessible::Unload()
|
||||
{
|
||||
NS_IF_RELEASE(sAppRoot);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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) || count == 0)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (aChildNum < 0)
|
||||
aChildNum = count - 1;
|
||||
|
||||
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()
|
||||
{
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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();
|
||||
static void Unload();
|
||||
|
||||
public:
|
||||
nsAppRootAccessible();
|
||||
|
||||
/* virtual function from nsAccessNode */
|
||||
NS_IMETHOD Init();
|
||||
|
||||
/* 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__ */
|
|
@ -0,0 +1,557 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.com)
|
||||
*
|
||||
* Contributor(s): John Sun (john.sun@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#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"));
|
||||
atk_focus_tracker_notify(accWrap->GetAtkObject());
|
||||
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"));
|
||||
AtkObject *accessible = accWrap->GetAtkObject();
|
||||
guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
|
||||
g_signal_emit(accessible, id, 0);
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_ATK_WINDOW_DEACTIVATE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_WINDOW_DEACTIVATED\n"));
|
||||
AtkObject *accessible = accWrap->GetAtkObject();
|
||||
guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
|
||||
g_signal_emit(accessible, id, 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);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.com)
|
||||
*
|
||||
* Contributor(s): John Sun (john.sun@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* 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
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 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 "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();
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _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
|
|
@ -0,0 +1,101 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 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 "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;
|
||||
nsAccessibleWrap::GetExtState(aState);
|
||||
|
||||
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();
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _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
|
|
@ -0,0 +1,253 @@
|
|||
/* -*- 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: Gilbert Fang (gilbert.fang@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 "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;
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/* -*- 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: Kyle Yuan (kyle.yuan@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _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
|
|
@ -0,0 +1,604 @@
|
|||
/* -*- 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);
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/* -*- 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 ***** */
|
||||
|
||||
#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
|
|
@ -0,0 +1,87 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.com)
|
||||
*
|
||||
* Contributor(s): John Sun (john.sun@sun.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,325 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 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 "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();
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,91 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 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 <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;
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,262 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 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 "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;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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_ConvertUCS2toUTF8(aString); }
|
||||
|
||||
const char *GetKeyBinding() {
|
||||
return mKeyBinding.get();
|
||||
}
|
||||
void SetKeyBinding(nsAString &aString) { mKeyBinding = NS_ConvertUCS2toUTF8(aString); }
|
||||
private:
|
||||
nsCString mName;
|
||||
nsCString mKeyBinding;
|
||||
};
|
||||
|
||||
#endif /* __MAI_INTERFACE_ACTION_H__ */
|
|
@ -0,0 +1,183 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 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 "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;
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,259 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "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_ConvertUTF8toUCS2 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_ConvertUTF8toUCS2 strContent(aString);
|
||||
|
||||
// interface changed in nsIAccessibleEditabelText.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");
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,204 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 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 "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;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,221 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Silvia Zhao (silvia.zhao@sun.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 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 "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;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Silvia Zhao (silvia.zhao@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,585 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 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 "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);
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,512 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 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 "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;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,179 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Silvia Zhao (silvia.zhao@sun.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 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 "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;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Silvia Zhao (silvia.zhao@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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__ */
|
|
@ -0,0 +1,115 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: 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 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 "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));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessibleWrap::Init()
|
||||
{
|
||||
nsresult rv = nsRootAccessible::Init();
|
||||
nsAppRootAccessible *root = nsAppRootAccessible::Create();
|
||||
if (root) {
|
||||
root->AddRootAccessible(this);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsRootAccessibleWrap::~nsRootAccessibleWrap()
|
||||
{
|
||||
MAI_LOG_DEBUG(("Delete Root Acc=%p\n", (void*)this));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessibleWrap::Shutdown()
|
||||
{
|
||||
nsAppRootAccessible *root = nsAppRootAccessible::Create();
|
||||
if (root) {
|
||||
root->RemoveRootAccessible(this);
|
||||
}
|
||||
return nsRootAccessible::Shutdown();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/
|
||||
/* ***** 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: Bolian Yin (bolian.yin@sun.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 NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __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 Init();
|
||||
NS_IMETHOD Shutdown();
|
||||
NS_IMETHOD GetParent(nsIAccessible ** aParent);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetExtState(PRUint32 *aState);
|
||||
};
|
||||
|
||||
#endif /* __NS_ROOT_ACCESSIBLE_WRAP_H__ */
|
|
@ -0,0 +1,46 @@
|
|||
/* -*- 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 Netscape Corp.
|
||||
* Portions created by Netscape Corp.are Copyright (C) 2003 Netscape
|
||||
* Corp. All Rights Reserved.
|
||||
*
|
||||
* Original Author: Aaron Leventhal
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsTextAccessibleWrap_H_
|
||||
#define _nsTextAccessibleWrap_H_
|
||||
|
||||
#include "nsTextAccessible.h"
|
||||
#include "nsAccessibleText.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,165 @@
|
|||
/* -*- 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: Gilbert Fang (gilbert.fang@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 "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;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
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::GetExtState(PRUint32 *aExtState)
|
||||
{
|
||||
nsAccessibleWrap::GetExtState(aExtState);
|
||||
|
||||
PRUint32 state;
|
||||
nsXULTextFieldAccessible::GetState(&state);
|
||||
if (!(state & STATE_READONLY))
|
||||
*aExtState |= EXT_STATE_EDITABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULTextFieldAccessibleWrap::Shutdown()
|
||||
{
|
||||
nsAccessibleEditableText::ShutdownEditor();
|
||||
return nsXULTextFieldAccessible::Shutdown();
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/* -*- 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: Gilbert Fang (gilbert.fang@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 ***** */
|
||||
|
||||
#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 GetExtState(PRUint32 *aExtState);
|
||||
NS_IMETHOD Shutdown();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
/* -*- 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
|
|
@ -0,0 +1,552 @@
|
|||
/* -*- 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 "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 **aAccessibleCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDOMNode && mTree, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 index;
|
||||
rv = GetIndexAt(aRow, aColumn, &index);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return GetChildAt(index, aAccessibleCell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *aIndex)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_ARG_POINTER(aIndex);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
PRInt32 columns;
|
||||
rv = GetColumns(&columns);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt32 treeCols;
|
||||
nsAccessible::GetChildCount(&treeCols);
|
||||
*aIndex = aRow * columns + aColumn + treeCols;
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/* -*- 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 ***** */
|
||||
|
||||
#ifndef __nsXULTreeAccessibleWrap_h__
|
||||
#define __nsXULTreeAccessibleWrap_h__
|
||||
|
||||
#include "nsIAccessibleTable.h"
|
||||
#include "nsXULTreeAccessible.h"
|
||||
|
||||
typedef class nsXULTreeitemAccessible nsXULTreeitemAccessibleWrap;
|
||||
|
||||
class nsXULTreeAccessibleWrap : public nsXULTreeAccessible,
|
||||
public nsIAccessibleTable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETABLE
|
||||
|
||||
nsXULTreeAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULTreeAccessibleWrap() {}
|
||||
|
||||
NS_IMETHOD GetChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAccessible> mCaption;
|
||||
nsString mSummary;
|
||||
};
|
||||
|
||||
class nsXULTreeColumnsAccessibleWrap : public nsXULTreeColumnsAccessible,
|
||||
public nsIAccessibleTable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETABLE
|
||||
|
||||
nsXULTreeColumnsAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULTreeColumnsAccessibleWrap() {}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAccessible> mCaption;
|
||||
nsString mSummary;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,112 @@
|
|||
# ***** 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_base_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
REQUIRES = commandhandler \
|
||||
composer \
|
||||
content \
|
||||
docshell \
|
||||
dom \
|
||||
editor \
|
||||
gfx \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
plugin \
|
||||
pref \
|
||||
string \
|
||||
unicharutil \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
xuldoc \
|
||||
imglib2 \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsAccessNode.cpp \
|
||||
nsAccessibleEventData.cpp \
|
||||
nsDocAccessible.cpp \
|
||||
nsOuterDocAccessible.cpp \
|
||||
nsAccessibilityAtoms.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsAccessible.cpp \
|
||||
nsAccessibleTreeWalker.cpp \
|
||||
nsBaseWidgetAccessible.cpp \
|
||||
nsFormControlAccessible.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsCaretAccessible.cpp \
|
||||
nsTextAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsRootAccessible.h \
|
||||
nsAccessibleEventData.h \
|
||||
nsAccessNode.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../html \
|
||||
-I$(srcdir)/../xul \
|
||||
-I$(srcdir)/../../../layout/generic \
|
||||
-I$(srcdir)/../../../layout/xul/base/src \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../atk \
|
||||
$(NULL)
|
||||
endif
|
|
@ -0,0 +1,538 @@
|
|||
/* -*- 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 "nsAccessNode.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsPIAccessibleDocument.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNSHTMLElement.h"
|
||||
#include "nsIDOMViewCSS.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
/* For documentation of the accessibility architecture,
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/
|
||||
|
||||
nsIStringBundle *nsAccessNode::gStringBundle = 0;
|
||||
nsIStringBundle *nsAccessNode::gKeyStringBundle = 0;
|
||||
nsITimer *nsAccessNode::gDoCommandTimer = 0;
|
||||
nsIDOMNode *nsAccessNode::gLastFocusedNode = 0;
|
||||
PRBool nsAccessNode::gIsAccessibilityActive = PR_FALSE;
|
||||
PRBool nsAccessNode::gIsCacheDisabled = PR_FALSE;
|
||||
nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> nsAccessNode::gGlobalDocAccessibleCache;
|
||||
|
||||
/*
|
||||
* Class nsAccessNode
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
NS_IMPL_ISUPPORTS2(nsAccessNode, nsIAccessNode, nsPIAccessNode)
|
||||
|
||||
nsAccessNode::nsAccessNode(nsIDOMNode *aNode, nsIWeakReference* aShell):
|
||||
mDOMNode(aNode), mWeakShell(aShell), mRefCnt(0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
mIsInitialized = PR_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsAccessNode::~nsAccessNode()
|
||||
{
|
||||
if (mWeakShell) {
|
||||
Shutdown(); // Otherwise virtual Shutdown() methods could get fired twice
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessNode::Init()
|
||||
{
|
||||
// We have to put this here, instead of constructor, otherwise
|
||||
// we don't have the virtual GetUniqueID() method for the hash key.
|
||||
// We need that for accessibles that don't have DOM nodes
|
||||
|
||||
NS_ASSERTION(!mIsInitialized, "Initialized twice!");
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
if (!docAccessible) {
|
||||
// No doc accessible yet for this node's document.
|
||||
// There was probably an accessible event fired before the
|
||||
// current document was ever asked for by the assistive technology.
|
||||
// Create a doc accessible so we can cache this node
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIDOMNode> docNode(do_QueryInterface(presShell->GetDocument()));
|
||||
if (docNode) {
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
NS_ASSERTION(accService, "No accessibility service");
|
||||
if (accService) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleInShell(docNode, presShell,
|
||||
getter_AddRefs(accessible));
|
||||
docAccessible = do_QueryInterface(accessible);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(docAccessible, "Cannot cache new nsAccessNode");
|
||||
if (!docAccessible) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
void* uniqueID;
|
||||
GetUniqueID(&uniqueID);
|
||||
nsCOMPtr<nsPIAccessibleDocument> privateDocAccessible =
|
||||
do_QueryInterface(docAccessible);
|
||||
NS_ASSERTION(privateDocAccessible, "No private docaccessible for docaccessible");
|
||||
privateDocAccessible->CacheAccessNode(uniqueID, this);
|
||||
#ifdef DEBUG
|
||||
mIsInitialized = PR_TRUE;
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsAccessNode::Shutdown()
|
||||
{
|
||||
mDOMNode = nsnull;
|
||||
mWeakShell = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessNode::GetUniqueID(void **aUniqueID)
|
||||
{
|
||||
*aUniqueID = NS_STATIC_CAST(void*, mDOMNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessNode::GetOwnerWindow(void **aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
NS_ASSERTION(docAccessible, "No root accessible pointer back, Init() not called.");
|
||||
return docAccessible->GetWindowHandle(aWindow);
|
||||
}
|
||||
|
||||
void nsAccessNode::InitXPAccessibility()
|
||||
{
|
||||
if (gIsAccessibilityActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> stringBundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
if (stringBundleService) {
|
||||
// Static variables are released in ShutdownAllXPAccessibility();
|
||||
stringBundleService->CreateBundle(ACCESSIBLE_BUNDLE_URL,
|
||||
&gStringBundle);
|
||||
stringBundleService->CreateBundle(PLATFORM_KEYS_BUNDLE_URL,
|
||||
&gKeyStringBundle);
|
||||
}
|
||||
|
||||
nsAccessibilityAtoms::AddRefAtoms();
|
||||
|
||||
gGlobalDocAccessibleCache.Init(4);
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefBranch) {
|
||||
prefBranch->GetBoolPref("accessibility.disablecache", &gIsCacheDisabled);
|
||||
}
|
||||
|
||||
gIsAccessibilityActive = PR_TRUE;
|
||||
}
|
||||
|
||||
void nsAccessNode::ShutdownXPAccessibility()
|
||||
{
|
||||
// Called by nsAccessibilityService::Shutdown()
|
||||
// which happens when xpcom is shutting down
|
||||
// at exit of program
|
||||
|
||||
if (!gIsAccessibilityActive) {
|
||||
return;
|
||||
}
|
||||
NS_IF_RELEASE(gStringBundle);
|
||||
NS_IF_RELEASE(gKeyStringBundle);
|
||||
NS_IF_RELEASE(gDoCommandTimer);
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
|
||||
ClearCache(gGlobalDocAccessibleCache);
|
||||
|
||||
gIsAccessibilityActive = PR_FALSE;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPresShell> nsAccessNode::GetPresShell()
|
||||
{
|
||||
nsIPresShell *presShell = nsnull;
|
||||
if (mWeakShell)
|
||||
CallQueryReferent(mWeakShell.get(), &presShell);
|
||||
if (!presShell) {
|
||||
if (mWeakShell) {
|
||||
// If our pres shell has died, but we're still holding onto
|
||||
// a weak reference, our accessibles are no longer relevant
|
||||
// and should be shut down
|
||||
Shutdown();
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
return presShell;
|
||||
}
|
||||
|
||||
nsPresContext* nsAccessNode::GetPresContext()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell(GetPresShell());
|
||||
if (!presShell) {
|
||||
return nsnull;
|
||||
}
|
||||
return presShell->GetPresContext();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument> nsAccessNode::GetDocAccessible()
|
||||
{
|
||||
return GetDocAccessibleFor(mWeakShell); // Addref'd
|
||||
}
|
||||
|
||||
nsIFrame* nsAccessNode::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
while (content) {
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (frame) {
|
||||
return frame;
|
||||
}
|
||||
nsCOMPtr<nsIContent> tempContent = content->GetParent();
|
||||
content = tempContent;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetDOMNode(nsIDOMNode **aNode)
|
||||
{
|
||||
NS_IF_ADDREF(*aNode = mDOMNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetNumChildren(PRInt32 *aNumChildren)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (!content) {
|
||||
*aNumChildren = 0;
|
||||
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aNumChildren = content->GetChildCount();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetAccessibleDocument(nsIAccessibleDocument **aDocAccessible)
|
||||
{
|
||||
*aDocAccessible = GetDocAccessibleFor(mWeakShell).get();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetInnerHTML(nsAString& aInnerHTML)
|
||||
{
|
||||
aInnerHTML.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> domNSElement(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(domNSElement, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return domNSElement->GetInnerHTML(aInnerHTML);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessNode::MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIAccessNode> accessNode;
|
||||
accService->GetCachedAccessNode(aNode, mWeakShell, getter_AddRefs(accessNode));
|
||||
|
||||
if (!accessNode) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accService->GetAccessibleInWeakShell(aNode, mWeakShell,
|
||||
getter_AddRefs(accessible));
|
||||
|
||||
accessNode = do_QueryInterface(accessible);
|
||||
}
|
||||
|
||||
if (accessNode) {
|
||||
NS_ADDREF(*aAccessNode = accessNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAccessNode *newAccessNode = new nsAccessNode(aNode, mWeakShell);
|
||||
if (!newAccessNode) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aAccessNode = newAccessNode);
|
||||
newAccessNode->Init();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetFirstChildNode(nsIAccessNode **aAccessNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(domNode));
|
||||
NS_ENSURE_TRUE(domNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return MakeAccessNode(domNode, aAccessNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetLastChildNode(nsIAccessNode **aAccessNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetLastChild(getter_AddRefs(domNode));
|
||||
NS_ENSURE_TRUE(domNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return MakeAccessNode(domNode, aAccessNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetParentNode(nsIAccessNode **aAccessNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(domNode));
|
||||
NS_ENSURE_TRUE(domNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return MakeAccessNode(domNode, aAccessNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetPreviousSiblingNode(nsIAccessNode **aAccessNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(domNode));
|
||||
NS_ENSURE_TRUE(domNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return MakeAccessNode(domNode, aAccessNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetNextSiblingNode(nsIAccessNode **aAccessNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(domNode));
|
||||
NS_ENSURE_TRUE(domNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return MakeAccessNode(domNode, aAccessNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetChildNodeAt(PRInt32 aChildNum, nsIAccessNode **aAccessNode)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domNode =
|
||||
do_QueryInterface(content->GetChildAt(aChildNum));
|
||||
NS_ENSURE_TRUE(domNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
return MakeAccessNode(domNode, aAccessNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetComputedStyleValue(const nsAString& aPseudoElt, const nsAString& aPropertyName, nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
|
||||
nsPresContext *presContext = GetPresContext();
|
||||
NS_ENSURE_TRUE(domElement && presContext, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsISupports> container = presContext->GetContainer();
|
||||
nsCOMPtr<nsIDOMWindow> domWin(do_GetInterface(container));
|
||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(domWin));
|
||||
NS_ENSURE_TRUE(viewCSS, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl;
|
||||
viewCSS->GetComputedStyle(domElement, aPseudoElt, getter_AddRefs(styleDecl));
|
||||
NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE);
|
||||
|
||||
return styleDecl->GetPropertyValue(aPropertyName, aValue);
|
||||
}
|
||||
|
||||
/***************** Hashtable of nsIAccessNode's *****************/
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument>
|
||||
nsAccessNode::GetDocAccessibleFor(nsIWeakReference *aPresShell)
|
||||
{
|
||||
nsIAccessibleDocument *docAccessible = nsnull;
|
||||
nsCOMPtr<nsIAccessNode> accessNode;
|
||||
gGlobalDocAccessibleCache.Get(NS_STATIC_CAST(void*, aPresShell), getter_AddRefs(accessNode));
|
||||
if (accessNode) {
|
||||
CallQueryInterface(accessNode, &docAccessible);
|
||||
}
|
||||
return docAccessible;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument>
|
||||
nsAccessNode::GetDocAccessibleFor(nsISupports *aContainer)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aContainer));
|
||||
NS_ASSERTION(docShell, "This method currently only supports docshells");
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
|
||||
return weakShell ? GetDocAccessibleFor(weakShell) : nsnull;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessibleDocument>
|
||||
nsAccessNode::GetDocAccessibleFor(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> eventShell = GetPresShellFor(aNode);
|
||||
nsCOMPtr<nsIWeakReference> weakEventShell(do_GetWeakReference(eventShell));
|
||||
return weakEventShell? GetDocAccessibleFor(weakEventShell) : nsnull;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPresShell>
|
||||
nsAccessNode::GetPresShellFor(nsIDOMNode *aNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDocument));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDocument));
|
||||
if (!doc) { // This is necessary when the node is the document node
|
||||
doc = do_QueryInterface(aNode);
|
||||
}
|
||||
nsIPresShell *presShell = nsnull;
|
||||
if (doc) {
|
||||
presShell = doc->GetShellAt(0);
|
||||
NS_IF_ADDREF(presShell);
|
||||
}
|
||||
return presShell;
|
||||
}
|
||||
|
||||
|
||||
already_AddRefed<nsIDocShellTreeItem>
|
||||
nsAccessNode::GetDocShellTreeItemFor(nsIDOMNode *aStartNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aStartNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (!doc) {
|
||||
doc = do_QueryInterface(aStartNode);
|
||||
}
|
||||
NS_ASSERTION(doc, "No document for node passed in");
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsIDocShellTreeItem *docShellTreeItem = nsnull;
|
||||
if (container) {
|
||||
CallQueryInterface(container, &docShellTreeItem);
|
||||
}
|
||||
|
||||
return docShellTreeItem;
|
||||
}
|
||||
|
||||
void nsAccessNode::PutCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> &aCache,
|
||||
void* aUniqueID,
|
||||
nsIAccessNode *aAccessNode)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIAccessNode> oldAccessNode;
|
||||
GetCacheEntry(aCache, aUniqueID, getter_AddRefs(oldAccessNode));
|
||||
NS_ASSERTION(!oldAccessNode, "This cache entry shouldn't exist already");
|
||||
#endif
|
||||
aCache.Put(aUniqueID, aAccessNode);
|
||||
}
|
||||
|
||||
void nsAccessNode::GetCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> &aCache,
|
||||
void* aUniqueID,
|
||||
nsIAccessNode **aAccessNode)
|
||||
{
|
||||
aCache.Get(aUniqueID, aAccessNode); // AddRefs for us
|
||||
}
|
||||
|
||||
PLDHashOperator nsAccessNode::ClearCacheEntry(const void* aKey, nsCOMPtr<nsIAccessNode>& aAccessNode, void* aUserArg)
|
||||
{
|
||||
nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(aAccessNode));
|
||||
privateAccessNode->Shutdown();
|
||||
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
void nsAccessNode::ClearCache(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> &aCache)
|
||||
{
|
||||
aCache.Enumerate(ClearCacheEntry, nsnull);
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is 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 _nsAccessNode_H_
|
||||
#define _nsAccessNode_H_
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAccessibilityAtoms.h"
|
||||
#include "nsIAccessNode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsPIAccessNode.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
|
||||
class nsIPresShell;
|
||||
class nsPresContext;
|
||||
class nsIAccessibleDocument;
|
||||
class nsIFrame;
|
||||
class nsIDOMNodeList;
|
||||
class nsITimer;
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
|
||||
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
|
||||
|
||||
/* hashkey wrapper using void* KeyType
|
||||
*
|
||||
* @see nsTHashtable::EntryType for specification
|
||||
*/
|
||||
class nsVoidHashKey : public PLDHashEntryHdr
|
||||
{
|
||||
public:
|
||||
typedef const void* KeyType;
|
||||
typedef const void* KeyTypePointer;
|
||||
|
||||
nsVoidHashKey(KeyTypePointer aKey) : mValue(aKey) { }
|
||||
nsVoidHashKey(const nsVoidHashKey& toCopy) : mValue(toCopy.mValue) { }
|
||||
~nsVoidHashKey() { }
|
||||
|
||||
KeyType GetKey() const { return mValue; }
|
||||
KeyTypePointer GetKeyPointer() const { return mValue; }
|
||||
PRBool KeyEquals(KeyTypePointer aKey) const { return aKey == mValue; }
|
||||
|
||||
static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; }
|
||||
static PLDHashNumber HashKey(KeyTypePointer aKey) { return NS_PTR_TO_INT32(aKey) >> 2; }
|
||||
enum { ALLOW_MEMMOVE = PR_TRUE };
|
||||
|
||||
private:
|
||||
const void* mValue;
|
||||
};
|
||||
|
||||
class nsAccessNode: public nsIAccessNode, public nsPIAccessNode
|
||||
{
|
||||
public: // construction, destruction
|
||||
nsAccessNode(nsIDOMNode *, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessNode();
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
NS_DECL_NSIACCESSNODE
|
||||
NS_DECL_NSPIACCESSNODE
|
||||
|
||||
static void InitXPAccessibility();
|
||||
static void ShutdownXPAccessibility();
|
||||
|
||||
// Static methods for handling per-document cache
|
||||
static void PutCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode>& aCache,
|
||||
void* aUniqueID, nsIAccessNode *aAccessNode);
|
||||
static void GetCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode>& aCache, void* aUniqueID,
|
||||
nsIAccessNode **aAccessNode);
|
||||
static void ClearCache(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode>& aCache);
|
||||
|
||||
static PLDHashOperator PR_CALLBACK ClearCacheEntry(const void* aKey, nsCOMPtr<nsIAccessNode>& aAccessNode, void* aUserArg);
|
||||
|
||||
// Static cache methods for global document cache
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIWeakReference *aPresShell);
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsISupports *aContainer);
|
||||
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIDOMNode *aNode);
|
||||
|
||||
static already_AddRefed<nsIDocShellTreeItem> GetDocShellTreeItemFor(nsIDOMNode *aStartNode);
|
||||
static already_AddRefed<nsIPresShell> GetPresShellFor(nsIDOMNode *aStartNode);
|
||||
|
||||
// Return PR_TRUE if there is a role attribute
|
||||
static PRBool HasRoleAttribute(nsIContent *aContent)
|
||||
{
|
||||
return (aContent->IsContentOfType(nsIContent::eHTML) && aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::role)) ||
|
||||
aContent->HasAttr(kNameSpaceID_XHTML, nsAccessibilityAtoms::role) ||
|
||||
aContent->HasAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role);
|
||||
}
|
||||
|
||||
// Return PR_TRUE if there is a role attribute, and fill it into aRole
|
||||
static PRBool GetRoleAttribute(nsIContent *aContent, nsAString& aRole)
|
||||
{
|
||||
aRole.Truncate();
|
||||
return (aContent->IsContentOfType(nsIContent::eHTML) && aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::role, aRole) != NS_CONTENT_ATTR_NOT_THERE) ||
|
||||
aContent->GetAttr(kNameSpaceID_XHTML, nsAccessibilityAtoms::role, aRole) != NS_CONTENT_ATTR_NOT_THERE ||
|
||||
aContent->GetAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role, aRole) != NS_CONTENT_ATTR_NOT_THERE;
|
||||
}
|
||||
|
||||
static nsIDOMNode *gLastFocusedNode;
|
||||
|
||||
protected:
|
||||
nsresult MakeAccessNode(nsIDOMNode *aNode, nsIAccessNode **aAccessNode);
|
||||
already_AddRefed<nsIPresShell> GetPresShell();
|
||||
nsPresContext* GetPresContext();
|
||||
already_AddRefed<nsIAccessibleDocument> GetDocAccessible();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
nsCOMPtr<nsIWeakReference> mWeakShell;
|
||||
|
||||
PRInt32 mRefCnt;
|
||||
NS_DECL_OWNINGTHREAD
|
||||
|
||||
#ifdef DEBUG
|
||||
PRBool mIsInitialized;
|
||||
#endif
|
||||
|
||||
// Static data, we do our own refcounting for our static data
|
||||
static nsIStringBundle *gStringBundle;
|
||||
static nsIStringBundle *gKeyStringBundle;
|
||||
static nsITimer *gDoCommandTimer;
|
||||
static PRBool gIsAccessibilityActive;
|
||||
static PRBool gIsCacheDisabled;
|
||||
|
||||
static nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> gGlobalDocAccessibleCache;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
/* -*- 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 ***** */
|
||||
|
||||
/******
|
||||
|
||||
This file contains the list of all accessibility nsIAtoms and their values
|
||||
|
||||
It is designed to be used as inline input to nsAccessibilityAtoms.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
All entires must be enclosed in the macro ACCESSIBILITY_ATOM which will have cruel
|
||||
and unusual things done to it
|
||||
|
||||
It is recommended (but not strictly necessary) to keep all entries
|
||||
in alphabetical order
|
||||
|
||||
The first argument to ACCESSIBILITY_ATOM is the C++ identifier of the atom
|
||||
The second argument is the string value of the atom
|
||||
|
||||
******/
|
||||
|
||||
|
||||
// Header info
|
||||
ACCESSIBILITY_ATOM(headerContentLanguage, "content-language")
|
||||
|
||||
// Alphabetical list of frame types
|
||||
ACCESSIBILITY_ATOM(blockFrame, "BlockFrame")
|
||||
ACCESSIBILITY_ATOM(inlineFrame, "InlineFrame")
|
||||
ACCESSIBILITY_ATOM(objectFrame, "ObjectFrame")
|
||||
ACCESSIBILITY_ATOM(textFrame, "TextFrame")
|
||||
|
||||
// Alphabetical list of tag names
|
||||
ACCESSIBILITY_ATOM(a, "a")
|
||||
ACCESSIBILITY_ATOM(abbr, "abbr")
|
||||
ACCESSIBILITY_ATOM(acronym, "acronym")
|
||||
ACCESSIBILITY_ATOM(area, "area")
|
||||
ACCESSIBILITY_ATOM(blockquote, "blockquote")
|
||||
ACCESSIBILITY_ATOM(br, "br")
|
||||
ACCESSIBILITY_ATOM(body, "body")
|
||||
ACCESSIBILITY_ATOM(caption, "caption")
|
||||
ACCESSIBILITY_ATOM(description, "description") // XUL
|
||||
ACCESSIBILITY_ATOM(dd, "dd")
|
||||
ACCESSIBILITY_ATOM(dl, "dl")
|
||||
ACCESSIBILITY_ATOM(dt, "dt")
|
||||
ACCESSIBILITY_ATOM(form, "form")
|
||||
ACCESSIBILITY_ATOM(h1, "h1")
|
||||
ACCESSIBILITY_ATOM(h2, "h2")
|
||||
ACCESSIBILITY_ATOM(h3, "h3")
|
||||
ACCESSIBILITY_ATOM(h4, "h4")
|
||||
ACCESSIBILITY_ATOM(h5, "h5")
|
||||
ACCESSIBILITY_ATOM(h6, "h6")
|
||||
ACCESSIBILITY_ATOM(img, "img")
|
||||
ACCESSIBILITY_ATOM(input, "input")
|
||||
ACCESSIBILITY_ATOM(label, "label")
|
||||
ACCESSIBILITY_ATOM(li, "li")
|
||||
ACCESSIBILITY_ATOM(link, "link")
|
||||
ACCESSIBILITY_ATOM(map, "map")
|
||||
ACCESSIBILITY_ATOM(math, "math")
|
||||
ACCESSIBILITY_ATOM(menu, "menu") // XUL
|
||||
ACCESSIBILITY_ATOM(object, "object")
|
||||
ACCESSIBILITY_ATOM(ol, "ol")
|
||||
ACCESSIBILITY_ATOM(optgroup, "optgroup")
|
||||
ACCESSIBILITY_ATOM(option, "option")
|
||||
ACCESSIBILITY_ATOM(q, "q")
|
||||
ACCESSIBILITY_ATOM(select, "select")
|
||||
ACCESSIBILITY_ATOM(svg, "svg")
|
||||
ACCESSIBILITY_ATOM(table, "table")
|
||||
ACCESSIBILITY_ATOM(tbody, "tbody")
|
||||
ACCESSIBILITY_ATOM(td, "td")
|
||||
ACCESSIBILITY_ATOM(th, "th")
|
||||
ACCESSIBILITY_ATOM(tfoot, "tfoot")
|
||||
ACCESSIBILITY_ATOM(thead, "thead")
|
||||
ACCESSIBILITY_ATOM(toolbaritem, "toolbaritem") // XUL
|
||||
ACCESSIBILITY_ATOM(tr, "tr")
|
||||
ACCESSIBILITY_ATOM(ul, "ul")
|
||||
|
||||
// DHTML accessibility relationship attributes
|
||||
ACCESSIBILITY_ATOM(controls, "controls")
|
||||
ACCESSIBILITY_ATOM(describedby, "describedby")
|
||||
ACCESSIBILITY_ATOM(flowto, "flowto")
|
||||
ACCESSIBILITY_ATOM(labelledby, "labelledby")
|
||||
|
||||
// Alphabetical list of attributes
|
||||
ACCESSIBILITY_ATOM(acceltext, "acceltext")
|
||||
ACCESSIBILITY_ATOM(accesskey, "accesskey")
|
||||
ACCESSIBILITY_ATOM(alt, "alt")
|
||||
ACCESSIBILITY_ATOM(control, "control")
|
||||
ACCESSIBILITY_ATOM(data, "data")
|
||||
ACCESSIBILITY_ATOM(disabled, "disabled")
|
||||
ACCESSIBILITY_ATOM(_for, "for")
|
||||
ACCESSIBILITY_ATOM(href, "href")
|
||||
ACCESSIBILITY_ATOM(id, "id")
|
||||
ACCESSIBILITY_ATOM(lang, "lang")
|
||||
ACCESSIBILITY_ATOM(multiline, "multiline")
|
||||
ACCESSIBILITY_ATOM(name, "name")
|
||||
ACCESSIBILITY_ATOM(onclick, "onclick")
|
||||
ACCESSIBILITY_ATOM(readonly, "readonly")
|
||||
ACCESSIBILITY_ATOM(src, "src")
|
||||
ACCESSIBILITY_ATOM(summary, "summary")
|
||||
ACCESSIBILITY_ATOM(tabindex, "tabindex")
|
||||
ACCESSIBILITY_ATOM(title, "title")
|
||||
ACCESSIBILITY_ATOM(tooltiptext, "tooltiptext")
|
||||
ACCESSIBILITY_ATOM(type, "type")
|
||||
ACCESSIBILITY_ATOM(value, "value")
|
||||
|
||||
// DHTML accessibility attributes
|
||||
ACCESSIBILITY_ATOM(checked, "checked")
|
||||
ACCESSIBILITY_ATOM(expanded, "expanded")
|
||||
ACCESSIBILITY_ATOM(invalid, "invalid")
|
||||
ACCESSIBILITY_ATOM(multiselect, "multiselect")
|
||||
ACCESSIBILITY_ATOM(required, "required")
|
||||
ACCESSIBILITY_ATOM(role, "role")
|
||||
ACCESSIBILITY_ATOM(selected, "selected")
|
||||
ACCESSIBILITY_ATOM(valuenow, "valuenow") // For DHTML widget values
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue