This commit was manufactured by cvs2svn to create tag 'nss377_20030613'.

git-svn-id: svn://10.0.0.236/tags/nss377_20030613@143874 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
(no author) 2003-06-18 17:50:11 +00:00
parent 01ef3a85f6
commit 29a27cc68d
21918 changed files with 0 additions and 5287696 deletions

View File

@ -1,43 +0,0 @@
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.

View File

@ -1,567 +0,0 @@
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."

View File

@ -1,380 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
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
#
default: $(SUBMAKEFILES)
$(MAKE) -C config export
$(MAKE) nspr
$(MAKE) ldap
$(MAKE) tier_0
$(MAKE) tier_1
$(MAKE) tier_2
$(MAKE) tier_9
ifdef MOZ_EXTENSIONS
$(MAKE) tier_94
endif
ifdef MOZ_PSM
$(MAKE) tier_95
endif
ifdef MOZ_MAIL_NEWS
$(MAKE) tier_97
endif
ifdef MOZ_CALENDAR
$(MAKE) tier_98
endif
$(MAKE) tier_99
# Make sure that the existing rulesets work
DIRS = \
$(tier_0_dirs) \
$(tier_1_dirs) \
$(tier_2_dirs) \
$(tier_9_dirs) \
$(NULL)
ifdef GC_LEAK_DETECTOR
DIRS += gc/boehm
endif
ifdef MOZ_EXTENSIONS
DIRS += $(tier_94_dirs)
endif
ifdef MOZ_PSM
DIRS += $(tier_95_dirs)
endif
ifdef MOZ_MAIL_NEWS
DIRS += $(tier_97_dirs)
endif
ifdef MOZ_CALENDAR
DIRS += $(tier_98_dirs)
endif
DIRS += $(tier_99_dirs)
#
# tier 0 - base build config dirs
#
tier_0_dirs = \
config \
build \
include \
$(NULL)
#
# tier 1 - 3rd party individual libraries
#
tier_1_dirs += dbm
ifndef MOZ_NATIVE_JPEG
tier_1_dirs += jpeg
endif
ifndef MOZ_NATIVE_ZLIB
tier_1_dirs += modules/zlib
endif
# Installer needs standalone libjar, hence standalone zlib
ifdef MOZ_INSTALLER
tier_1_dirs += modules/zlib/standalone
endif
ifdef MOZ_INTERNAL_LIBART_LGPL
tier_1_dirs += other-licenses/libart_lgpl
endif
#
# tier 2 - base libraries
#
tier_2_dirs = js
# MacOSX needs to build lib for MoreFiles before xpcom
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
tier_2_dirs += lib/mac/MoreFiles
endif
tier_2_dirs += \
modules/libreg \
string \
xpcom \
$(NULL)
#
# tier 9 - core components (necko,gecko)
#
tier_9_dirs += \
js/src/xpconnect \
intl \
modules/libjar \
$(NULL)
ifdef MOZ_OJI
tier_9_dirs += js/src/liveconnect
endif
ifdef MOZ_JSDEBUGGER
tier_9_dirs += js/jsd
endif
ifdef MOZ_ENABLE_XLIB
tier_9_dirs += gfx/src/xlibrgb widget/src/xlibxtbin
endif
ifdef MOZ_ENABLE_GTK
tier_9_dirs += widget/src/gtksuperwin widget/src/gtkxtbin
endif
ifdef MOZ_ENABLE_GTK2
tier_9_dirs += widget/src/gtkxtbin
endif
tier_9_dirs += \
modules/libutil \
netwerk \
modules/mpfilelocprovider \
uriloader \
modules/libpref \
modules/libimg \
modules/oji \
caps \
rdf \
expat \
htmlparser \
gfx \
modules/libpr0n \
modules/plugin \
dom \
view \
widget \
content \
layout \
db \
docshell \
webshell \
embedding \
editor \
sun-java \
profile \
themes \
$(NULL)
ifdef ACCESSIBILITY
tier_9_dirs += accessible
endif
ifdef MOZ_LDAP_XPCOM
tier_9_dirs += directory/xpcom
endif
# This must preceed xpfe
ifdef MOZ_JPROF
tier_9_dirs += tools/jprof
endif
tier_9_dirs += xpfe xpinstall
ifdef MOZ_LEAKY
tier_9_dirs += tools/leaky
endif
ifdef NS_TRACE_MALLOC
tier_9_dirs += tools/trace-malloc
endif
ifdef MOZ_MAPINFO
tier_9_dirs += tools/codesighs
endif
tier_9_dirs += l10n
ifdef MOZ_PHOENIX
tier_9_dirs += toolkit
endif
#
# tier 9x - application features
#
ifdef MOZ_EXTENSIONS
tier_94_dirs += extensions
endif
ifdef MOZ_PSM
tier_95_dirs += security/manager
endif
ifdef MOZ_MAIL_NEWS
tier_97_dirs += mailnews
endif
ifdef MOZ_CALENDAR
tier_98_dirs += calendar
endif
#
# tier 99 - application binaries
#
ifneq (,$(MOZ_STATIC_COMPONENTS)$(MOZ_META_COMPONENTS))
tier_99_dirs += modules/staticmod
endif
ifdef MOZ_PHOENIX
tier_99_dirs += browser
else
tier_99_dirs += xpfe/bootstrap
endif
ifdef MOZ_ENABLE_GTK
tier_99_dirs += embedding/browser/gtk/tests
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::
$(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 real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/nspr
$(RM) -f $(addprefix $(DESTDIR)$(mozappdir)/$(LIB_PREFIX), $(addsuffix .$(LIB_SUFFIX), nspr4 plds4 plc4))
$(RM) -f $(addprefix $(DESTDIR)$(bindir)/,nspr-config compile-et.pl prerr.properties)
endif
ifdef MOZ_LDAP_XPCOM
$(MAKE) -C directory/c-sdk real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/ldap
endif
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
tier_%:
@echo "$@: $($@_dirs)"
@$(EXIT_ON_ERROR) \
for d in $($@_dirs); do $(UPDATE_TITLE) \
$(MAKE) -C $$d export; \
done ; \
$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include ;\
for d in $($@_dirs); do $(UPDATE_TITLE) \
$(MAKE) -C $$d libs; \
done
#
# Individual modules
#
boehm:
ifdef GC_LEAK_DETECTOR
$(MAKE) -C gc/boehm
endif
nspr: boehm
ifndef MOZ_NATIVE_NSPR
$(MAKE) -C nsprpub
endif
ldap:
ifdef MOZ_LDAP_XPCOM
$(MAKE) -C directory/c-sdk
endif
export::
@$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include
distclean::
cat unallmakefiles | $(XARGS) rm -f
rm -f unallmakefiles $(DIST_GARBAGE)
ifeq ($(OS_ARCH),WINNT)
rebase:
ifdef MOZILLA_OFFICIAL
echo rebasing $(DIST)
/bin/find $(DIST) -name "*.dll" > rebase.lst
rebase -b 60000000 -R . -G rebase.lst
rm rebase.lst
endif
splitsymbols:
ifdef MOZILLA_OFFICIAL
echo splitting symbols out of binaries
/bin/find $(DIST) -name "*.dll" -exec splitsym {} \;
/bin/find $(DIST) -name "*.exe" -exec splitsym {} \;
/bin/find $(DIST) -name "*.EXE" -exec splitsym {} \;
endif # MOZILLA_OFFICIAL
deliver: splitsymbols rebase
endif # WINNT

View File

@ -1,325 +0,0 @@
==============================================================
= = = = = = = = = = Mozilla Read Me = = = = = = = = = = =
==============================================================
Mozilla is subject to the terms detailed in the license
agreement accompanying it.
This Read Me file contains information about system
requirements and installation instructions for the Windows,
Mac OS, and Linux builds of Mozilla.
For more info on Mozilla, see www.mozilla.org. To submit bugs
or other feedback, see the Navigator QA menu and check out
Bugzilla at http://bugzilla.mozilla.org for links to known
bugs, bug-writing guidelines, and more. You can also get help
with Bugzilla by pointing your IRC client to #mozillazine
at irc.mozilla.org.
==============================================================
Getting Mozilla
==============================================================
You can download nightly builds of Mozilla from the
Mozilla.org FTP site at
ftp://ftp.mozilla.org/pub/mozilla/nightly/
For the very latest builds, see
ftp://ftp.mozilla.org/pub/mozilla/nightly/latest
Keep in mind that nightly builds, which are used by
Mozilla.org developers for testing, may be buggy. If you are
looking for a more polished version of Mozilla, Mozilla.org
releases Milestone builds of Mozilla every six weeks or so
that you can download from
http://www.mozilla.org/releases
Be sure to read the Mozilla release notes for information
on known problems and installation issues with Mozilla.
The release notes can be found at the preceding URL along
with the milestone releases themselves.
Note: Please use Talkback builds whenever possible. These
builds allow transmission of crash data back to Mozilla
developers, improved crash analysis, and posting of crash
information to our crash-data newsgroup.
==============================================================
System Requirements
==============================================================
*All Platforms
To view and use the new streamlined "Modern" theme,
your display monitor should be set to display
thousands of colors. For users who cannot set their
displays to use more than 256 colors, Mozilla.org
recommends using the "Classic" theme for Mozilla.
To select the Modern theme after you have installed
Mozilla, from the Navigator browser, open the View
menu, and then open then open the Apply Theme submenu
and choose Modern.
*Mac OS
-Mac OS 8.6 or later
-PowerPC 604e 266 MHz or faster processor, or G3/G4
-64 MB RAM
-36 MB of free hard disk space
*Windows
-Windows 9x/Me or Windows NT 4/2000/XP
-Intel Pentium-class 233 MHz (or faster) processor
-64 MB RAM
-26 MB free hard disk space
*Linux
-Red Hat Linux 6.x or 7 with X11 R6
[Note: Mozilla is certified and fully supported on
Red Hat Linux, but will run on other Linux
distributions, such as Debian 2.1 (or later) or
SuSE 6.2 (or later). The libraries glibc 2.1 (or
higher) and libjpeg.so.62 (or higher) are required.]
-Intel Pentium-class 233 MHz (or faster) processor
-64MB RAM
-26MB free hard disk space
==============================================================
Installation Instructions
==============================================================
For Mac OS and Windows users, it is strongly recommended that
you exit all programs before running the setup program. Also,
you should temporarily disable virus-detection software.
For Linux users, note that the installation instructions use
the bash shell. If you're not using bash, adjust the commands
accordingly.
For all platforms, install into a clean (new) directory.
Installing on top of previously released builds may cause
problems.
Note: These instructions do not tell you how to build Mozilla.
For info on building the Mozilla source, see
http://www.mozilla.org/source.html
Windows Installation Instructions
---------------------------------
Note: For Windows NT/2000/XP systems, you need Administrator
privileges to install Mozilla. If you see an "Error 5" message
during installation, make sure you're running the installation
with Administrator privileges.
To install Mozilla by downloading the Mozilla installer,
follow these steps:
1. Click the the mozilla-win32-installer.exe link on
the site you're downloading Mozilla from to download
the installer file to your machine.
2. Navigate to where you downloaded the file and
double-click the Mozilla program icon on your machine
to begin the Setup program.
3. Follow the on-screen instructions in the setup
program. The program starts automatically the first
time.
To install Mozilla by downloading the .zip file and
installing manually, follow these steps:
1. Click the mozilla-win32-talkback.zip link or the
mozilla-win32.zip link on the site you're down-
loading Mozilla from to download the .zip file to
your machine.
2. Navigate to where you downloaded the file and
double-click the compressed file.
Note: This step assumes you already have a recent
version of WinZip installed, and that you know how to
use it. If not, you can get WinZip and information
about the program at www.winzip.com.
3. Extract the .zip file to a directory such as
C:\Program Files\mozilla.org\Mozilla.
4. To start Mozilla, navigate to the directory you
extracted Mozilla to and double-click the Mozilla.exe
icon.
Mac OS Installation Instructions
--------------------------------
Note: If the downloaded file does not expand automatically
you must expand the file using a program such as StuffIt
Expander. Expander ships with all new Macs and comes with the
default system install, so you may want to do a find in
Sherlock for "StuffIt" to make sure that you don't already
have it installed.
If you don't have Expander, you can get a copy at the
following Web site:
http://www.aladdinsys.com/expander/expander_mac_login.html
If you do already have Expander, you need to set it to start
by default. See the above URL for info on using Expander.
To install Mozilla by downloading the Mozilla installer,
(recommended) follow these steps:
1. Click the MacMozillaInstaller.sea.bin link on the
site you're downloading Mozilla from to download the
file to your Mac's desktop. A MozillaInstaller
folder is created.
2. Double-click the MozillaInstaller folder in the
Finder.
3. Double-click the Mozilla Installer icon.
4. Follow the on-screen instructions to complete the
installation process.
5. To start Mozilla, open the folder where you
installed Mozilla and double-click the Mozilla icon.
To install Mozilla by downloading the .bin file and
installing manually, follow these steps:
1. Click the mozilla-mac-*.sea.bin link on the site
you're downloading Mozilla from to download the
Mozilla binary to your Mac's desktop.
2. Double-click the mozilla-mac-*.sea.sit.bin icon
on your desktop.
3. Choose the directory where you want to install
Mozilla.
4. To start Mozilla, open the folder where you
installed Mozilla and double-click the Mozilla icon.
Linux Installation Instructions
-------------------------------
Note: If you install in the default directory (which is
usually /usr/local/mozilla), or any other directory where
only the root user normally has write-access, you must
start Mozilla first as root before other users can start
the program. Doing so generates a set of files required
for later use by other users.
To install Mozilla by downloading the Mozilla installer,
follow these steps:
1. Create a directory named mozilla (mkdir mozilla)
and change to that directory (cd mozilla).
2. Click the link on the site you're downloading
Mozilla from to download the installer file
(called mozilla-1686-pc-linux-gnu-installer.tar.gz)
to your machine.
3. Change to the mozilla directory (cd mozilla) and
decompress the archive with the following command:
tar zxvf moz*.tar.gz
The installer is now located in a subdirectory of
Mozilla named mozilla-installer.
4. Change to the mozilla-installer directory
(cd mozilla-installer) and run the installer with the
./mozilla-installer command.
5. Follow the instructions in the install wizard for
installing Mozilla.
Note: If you have a slower machine, be aware that the
installation may take some time. In this case, the
installation progress may appear to hang indefinitely,
even though the installation is still in process.
6. To start Mozilla, change to the directory where you
installed it and run the ./mozilla command.
To install Mozilla by downloading the tar.gz file:
1. Create a directory named "mozilla" (mkdir mozilla)
and change to that directory (cd mozilla).
2. Click the link on the site you're downloading
Mozilla from to download the non-installer
(mozilla*.tar.gz) file into the mozilla directory.
3. Change to the mozilla directory (cd mozilla) and
decompress the file with the following command:
tar zxvf moz*.tar.gz
This creates a "mozilla" directory under your mozilla
directory.
4. Change to the mozilla directory (cd mozilla).
5. Run Mozilla with the following run script:
./mozilla
To hook up Mozilla complete with icon to the GNOME Panel,
follow these steps:
1. Click the GNOME Main Menu button, open the Panel menu,
and then open the Add to Panel submenu and choose Launcher.
2. Right-click the icon for Mozilla on the Panel and
enter the following command:
directory_name./mozilla
where directory_name is the name of the directory
you downloaded mozilla to. For example, the default
directory that Mozilla suggests is /usr/local/mozilla.
3. Type in a name for the icon, and type in a comment
if you wish.
4. Click the icon button and type in the following as
the icon's location:
directory_name/icons/mozicon50.xpm
where directory name is the directory where you
installed Mozilla. For example, the default directory
is /usr/local/mozilla/icons/mozicon50.xpm.

View File

@ -1,2 +0,0 @@
Pursuant to section 3.3 of the MPL, this file will contain a list of the files
that have been modified by IBM Corporation.

View File

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

View File

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

View File

@ -1,190 +0,0 @@
<html>
<head>
<title>
How the Accessible Module works
</title>
</head>
<body>
<h1>How the Accessible module (accessibility.dll) works</h1>
<ul>
<p>
See also:
<a href="http://www.mozilla.org/projects/ui/accessibility/vendors-win.html">Gecko Info for Windows Accessibility Vendors</a>, a primer for vendors of 3rd party accessibility software, on how to use our MSAA and other relevant API's.
</p>
<p>
The <a href="http://lxr.mozilla.org/seamonkey/source/accessible/">Accessible module</a> is where we implement support for the <a href="http://www.microsoft.com/enable/msaa/">Microsoft Active Accessibility (MSAA) API</a>
(<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=12952">bug 12952</a>).
Support for Sun's <a href="http://www.sun.com/access/gnome/">Gnome Accessibility API</a> is part of our future plans as well.
</p>
</ul>
<h2>What is MSAA?</h2>
<ul>
<p>
A 3rd part accessibility aid, such as a screen reader, wants to track what's happening inside Mozilla. It needs to know about
focus changes and other events, and it needs to know whtat data nodes there are in the layout tree.
Using this information,
the screen reader will speak out loud important changes to the document or UI, and allow the user to track
where they navigate. Some screen readers also magnify text and images in the currently focused area, and others
show information on a <a href="http://www.audiodata.de/e/produkte/pc/lapbraille/">refreshable braille display</a>.
</p>
<p>
In Windows, accesibility aids acquires the necessary information to do this using hacks and MSAA. MSAA is supposed
to be the "right way" for accessibility aids to get information, but sometimes the hacks are more effective.
For example, screen readers look for screen draws of a vertical blinking line, to determine the location of the caret.
Without doing this, screen readers would not be able to let the user know where there caret has moved to in most programs,
because so many applications do not use the system caret (ours is an example). This is so commonly done, that
no one even bothers to support the MSAA caret, because the hack works.
</p>
<p>
MSAA provides information in two different ways:
<ol>
<li>a COM interface (IAccessible) that allows applications to expose the tree of data nodes that make up
each window in the user interface currently being interacted with and</li>
<li> a set of system messages
that confer accessibility-related events such as focus changes, changes to document content and alerts.</li>
</ol>
</p>
<p>
To really learn about MSAA, you need to download
the entire <a href="http://www.microsoft.com/enable/msaa/download.htm">MSAA SDK</a>.
Without downloading the SDK, you won't get the complete documentation.
The SDK also contains some very useful tools, such as the Accessible Event Watcher, which shows what accessible
events are being generated by a given piece of software. The Accessible Explorer and Inspect Object tools
show the tree of data nodes the Accessible object is exposing through COM.
</p>
</ul>
<h2>IAccessible Interface</h2>
<ul>
<p>
The IAccessible interface is used in a tree of IAccessible's, each one representing a data node, similar to a DOM.
</p>
<p>
Here are the methods supported in IAccessible:
<ul>
<li>get_accParent: Get the parent of an IAccessible.</li>
<li>get_accChildCount: Get the number of children of an IAccesible.</li>
<li>get_accChild: Get the child of an Iaccessible.</li>
<li>get_accName: Get the "name" of the IAccessible, for example the name of a button, checkbox or menuitem.</li>
<li>get_accValue: Get the "value" of the IAccessible, for example a number in a slider, a URL for a link, the text a user entered in a field.</li>
<li>get_accDescription: Get a long description of the current IAccessible. This is not really too useful.</li>
<li>get_accRole: Get an enumerated value representing what this IAccessible is used for, for example.</li>
is it a link, static text, editable text, a checkbox, or a table cell, etc.</li>
<li>get_accState: a 32 bit field representing possible on/off states, such as focused, fousable, selected, selectable, visible, protected (for passwords),
checked, etc. </li>
<li>get_accHelp: Get context sensitive help for the IAccessible.</li>
<li>get_accHelpTopic: We don't use this, it's only if the Windows help system is used.</li>
<li>get_accKeyboardShortcut: What is the keyboard shortcut for this IAccessible.</li>
<li>get_accFocus: Which child is focused?</li>
<li>get_accSelection: Which children of this item are selected?</li>
<li>get_accDefaultAction: Get a description or name of the default action for this component, such as "jump" for links.</li>
<li>accSelect: Select the item associated with this IAccessible.</li>
<li>accLocation: Get the x,y coordinates, and the height and width of this IAccessible node.</li>
<li>accNavigate: Navigate up, down, left or right from this IAccessible.</li>
<li>accHitTest: Find out what IAccessible exists and a specific coordinate.</li>
<li>accDoDefaultAction: Perform the action described by get_accDefaultAction.</li>
<li>put_accName: Change the name.</li>
<li>put_accValue: Change the value.</li>
</ul>
</p>
</ul>
<h2>The Basics</h2>
<ul>
<p>
Rather than directly implement IAccessible with an Accessible class, we have chosen to proxy to our own cross-platform interface,
called nsIAccessible, which is more robust. It has the capability of supporting other new accessibility API's such
as Sun's Gnome Accessiblity API. The nsIAccessible interface is implemented by a variety of classes for each of the
various objects in HTML. Each class is tailored to the specific abilities and properties of the HTML objects it applies to.
</p>
<p>
The first thing that happens when an accessibility aid wants to watch our application is calls the Windows API function
AccessibleObjectFromWindow(). This in turns sends the window in question
a <a href="http://lxr.mozilla.org/seamonkey/search?string=WM_GETOBJECT">WM_GETOBJECT</a> message requesting an IAccessible for the window.
In our case, this event is received in mozilla/widget/src/windows/nsWindow.cpp.
We send back an IAccessible interface that represents that root window. The accessibility aid will use
that first IAccessible to reach rest of the IAccessible hierarchy, by asking for it's children IAccessibles, asking the children for the
grandchildren IAccessibles, and so on. Until this WM_GETOBJECT message is processed, the accessibility.dll is not loaded,
so there is almost zero overhead for accessibility in Mozilla.
</p>
</ul>
<h2>How the IAccessible's are Created</h2>
<ul>
<p>
To create the root IAccessible for a window the first time it gets the <a href="http://lxr.mozilla.org/seamonkey/search?string=WM_GETOBJECT">WM_GETOBJECT</a> message in,
nsWindow.cpp first generates an internal event
called <a href="http://lxr.mozilla.org/seamonkey/search?string=NS_GETACCESSIBLE">NS_GETACCESSIBLE</a>,
which is handled in nsFrame.cpp via the creation of an nsRootAccessible implementation of the nsIAccessible interface.
The first IAccessible is then created by instantiating a RootAccessible class. This RootAccessible is also cached by
the nsWindow it's for, so that any additional WM_GETOBJECT messages use the same RootAccessible.
The RootAccessible class used to implement IAccessible here is slightly different from the normal Accessible class
that's used, in that it keeps track of event data.
RootAccessible and Accessible are both implemented
in <a href="http://lxr.mozilla.org/seamonkey/source/widget/source/windows/Accessible.cpp">
mozilla/widget/src/windows/Accessible.cpp</a>).
</P>
</ul>
<h2>The Real Power Behind IAccessible's</h2>
<ul>
<p>The implementations of IAccessible (Accessible and RootAccessible), don't know anything about Mozilla
objects. They merely proxy to our cross platform accessibility classes, which all have an nsIAccessible interface.
</h2>
<p>
The base implementation for nsIAccessible is called nsAccessible. It has default implementations for all the
nsIAccessible methods. It also knows how
to walk Mozilla's content DOM and frame tree, exposing only the objects that are needed for accessibility.
Essentially, nsAccessible knows what it needs to expose by asking each DOM node's primary frame for
an nsIAccessible, using the GetAccessible() method. If it gets one, it's considered an accessible object.
A frame that wishes to return
an nsIAccessible GetAccessible() is called, creates one of the correct type on the fly using
nsIAccessibilityService methods built for that purpose.
</p>
<p>
The specific implementations
of nsIAccessible for each widget or content type inherit from nsAccessible.
Each implementation then overrides those methods
it wishes to implement, and does nothing for those methods it wants the default behavior for.
For example, the default behavior for nsIAccessible::getAccFirstChild is to
instantial a nsDOMTreeWalker, and ask it for the first child. However, nsImageAccessible overrides getAccFirstChild,
returning the first area of an image map if there is one, otherwise nsnull.
</p>
</ul>
<h2>MSAA Events</h2>
<ul>
<p>
When an accessibility-related event occurs within an application such as Mozilla, it must use NotifyWinEvent from
the Win32 API. NotifyWinEvent is passed arguments for the window the event occured in, and the number of the child
within that window. Accessibility aids use the Win32 call SetWinEventHook() to register as a listener for these events.
</p>
<p>
The accessibility aid is choose which events it is interested in learning more about by using the Win32 API call
AccessibleObjectFromEvent, requesting the IAccessible to the node corresponding to the
child number that had been indicated from NotifyWinEvent(). This ends up asking our RootAccessible for the child
IAccessible that matches the window handle and child id we indicated through NotofyWinEvent().
</p>
<p>
In Mozilla, this creates a problem. We cannot
keep track of a child number for every important accessible node in a document. We deal with this by generating fake
child IDs for the most recent accessibile events that we have generated, in a circular array.
</p>
<p>
Since there is a RootAccessible for each top level window that might generate MSAA events, that's where we do the bookkeeping
for these events and their nsIAccessible's. Whenever NotifyWinEvent() is called, a new fake ID is generated (We use
negative numbers for the fake IDs). When the callback comes to request the IAccessible for that child number,
we check the circular array for that ID, and voila, we have the corresponding nsIAccessible to proxy.
</p>
<p>
Every RootAccessible has an nsRootAccessible which is an nsIAccessibleEventReceiver. The RootAccessible
uses this to register itself as an nsIAccessibleEventListener. In the end, nsRootAccessible registers itself as a listener
of Mozilla's internal and DOM events. It's HandleEvent routine translates these events into MSAA events, and passes them along to
with an nsIAccessible to the original RootAccessible::HandleEvent
which turns that nsIAccessible into a NotifyWinEvent call, complete with a fake child ID.
</p>
<p>
Most MSAA events aren't utilized by accessibility aids. Therefore we implement only the handful that matter.
The most important event is the focus event, followed by name, state and value change events.
</p>
</ul>
</body>
</html>

View File

@ -1,68 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): John Gaunt (jgaunt@netscape.com)
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
LIBRARY_NAME = accessibility
EXPORT_LIBRARY = 1
ifneq ($(OS_ARCH),WINNT)
SHORT_LIBNAME = access
endif
IS_COMPONENT = 1
MODULE_NAME = nsAccessibilityModule
REQUIRES = \
xpcom \
string \
dom \
$(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) \
$(NULL)
ifdef MOZ_XUL
SHARED_LIBRARY_LIBS += $(DIST)/lib/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
endif
EXTRA_DSO_LIBS = \
gkconshared_s \
gkgfx \
$(NULL)
EXTRA_DSO_LDOPTS = \
$(LIBS_DIR) \
$(EXTRA_DSO_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIAccessibilityService.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_NewAccessibilityService(&accessibility);
if (NS_FAILED(rv)) {
NS_ERROR("Unable to construct chrome registry");
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
},
};
NS_IMPL_NSGETMODULE(nsAccessibilityModule, components);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
nsIAccessibilityService.idl
nsIAccessible.idl

View File

@ -1,52 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
XPIDL_MODULE= accessibility
XPIDLSRCS = \
nsIAccessibilityService.idl \
nsIAccessible.idl \
nsIAccessibleAction.idl \
nsIAccessibleCaret.idl \
nsIAccessibleDocument.idl \
nsIAccessibleEditableText.idl \
nsIAccessibleEventReceiver.idl \
nsIAccessibleEventListener.idl \
nsIAccessibleHyperLink.idl \
nsIAccessibleHyperText.idl \
nsIAccessibleProvider.idl \
nsIAccessibleSelectable.idl \
nsIAccessibleTable.idl \
nsIAccessibleText.idl \
nsIAccessibleValue.idl \
nsIAccessibleWin32Object.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,109 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
*/
#include "nsISupports.idl"
#include "domstubs.idl"
#include "nsIAtom.idl"
#include "domstubs.idl"
#include "nsIAccessible.idl"
#include "nsIAccessibleCaret.idl"
interface nsIWeakReference;
interface nsIAccessibleEventListener;
[scriptable, uuid(68D9720A-0984-42b6-A3F5-8237ED925727)]
interface nsIAccessibilityService : nsISupports
{
nsIAccessible createAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
nsIAccessible createIFrameAccessible(in nsIDOMNode aNode);
nsIAccessible createRootAccessible(in nsISupports aPresContext, in nsISupports aFrame);
nsIAccessibleCaret createCaretAccessible(in nsIDOMNode aNode, in nsIAccessibleEventListener aListener);
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
nsIAccessible createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLButtonAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLCheckboxAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
nsIAccessible createHTMLNativeWindowAccessible(in nsIDOMNode aDOMNode, in nsIWeakReference aShell, in PRInt32 aHWnd);
nsIAccessible createHTMLPluginAccessible(in nsIDOMNode aDOMNode, in nsIWeakReference aShell);
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLRadioButtonAccessibleXBL(in nsIDOMNode aNode);
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsISupports aPresShell);
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableCaptionAccessible(in nsIDOMNode aDOMNode);
nsIAccessible createHTMLTableHeadAccessible(in nsIDOMNode aDOMNode);
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame);
nsIAccessible createXULButtonAccessible(in nsIDOMNode aNode);
nsIAccessible createXULCheckboxAccessible(in nsIDOMNode aNode);
nsIAccessible createXULColorPickerAccessible(in nsIDOMNode aNode);
nsIAccessible createXULColorPickerTileAccessible(in nsIDOMNode aNode);
nsIAccessible createXULComboboxAccessible(in nsIDOMNode aNode);
nsIAccessible createXULDropmarkerAccessible(in nsIDOMNode aNode);
nsIAccessible createXULGroupboxAccessible(in nsIDOMNode aNode);
nsIAccessible createXULImageAccessible(in nsIDOMNode aNode);
nsIAccessible createXULListboxAccessible(in nsIDOMNode aNode);
nsIAccessible createXULListitemAccessible(in nsIDOMNode aNode);
nsIAccessible createXULMenubarAccessible(in nsIDOMNode aNode);
nsIAccessible createXULMenuitemAccessible(in nsIDOMNode aNode);
nsIAccessible createXULMenupopupAccessible(in nsIDOMNode aNode);
nsIAccessible createXULMenuSeparatorAccessible(in nsIDOMNode aNode);
nsIAccessible createXULProgressMeterAccessible(in nsIDOMNode aNode);
nsIAccessible createXULStatusBarAccessible(in nsIDOMNode aNode);
nsIAccessible createXULRadioButtonAccessible(in nsIDOMNode aNode);
nsIAccessible createXULRadioGroupAccessible(in nsIDOMNode aNode);
nsIAccessible createXULSelectOptionAccessible(in nsIDOMNode aNode);
nsIAccessible createXULSelectListAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTabAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTabBoxAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTabPanelsAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTabsAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTextAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTreeAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTreeColumnsAccessible(in nsIDOMNode aNode);
nsIAccessible createXULTreeColumnitemAccessible(in nsIDOMNode aNode);
nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
};
%{ 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_NewAccessibilityService(nsIAccessibilityService** aResult);
%}

View File

@ -1,331 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric D Vaughan (evaughan@netscape.com)
*
* Contributor(s):
* Aaron Leventhal
* John Gaunt
*/
#include "nsISupports.idl"
#include "nsIDOMNode.idl"
#include "domstubs.idl"
[scriptable, uuid(B26FBE47-9A5F-42a1-822B-082461AE4D6D)]
interface nsIAccessible : nsISupports
{
readonly attribute nsIAccessible accParent;
readonly attribute nsIAccessible accNextSibling;
readonly attribute nsIAccessible accPreviousSibling;
readonly attribute nsIAccessible accFirstChild;
readonly attribute nsIAccessible accLastChild;
readonly attribute long accChildCount;
attribute AString accName;
readonly attribute AString accValue;
readonly attribute long accId;
readonly attribute AString accDescription;
readonly attribute AString accKeyboardShortcut;
readonly attribute unsigned long accRole;
readonly attribute unsigned long accState;
readonly attribute unsigned long accExtState;
readonly attribute AString accHelp;
readonly attribute nsIAccessible accFocused;
nsIAccessible accGetAt(in long x, in long y);
nsIAccessible accNavigateRight();
nsIAccessible accNavigateLeft();
nsIAccessible accNavigateUp();
nsIAccessible accNavigateDown();
void accGetBounds(out long x,
out long y,
out long width,
out long height);
void accAddSelection();
void accRemoveSelection();
void accExtendSelection();
void accTakeSelection();
void accTakeFocus();
readonly attribute PRUint8 accNumActions;
AString getAccActionName(in PRUint8 index);
void accDoAction(in PRUint8 index); // Action number 0 is the default action
nsIDOMNode accGetDOMNode();
// Used by Accessible implementation to save data and speed up accessibility tree walking
[noscript] void CacheOptimizations(in nsIAccessible aParent, in PRInt32 aSiblingIndex, in nsIDOMNodeList aSiblingList);
// MSAA State flags - used for bitfield. More than 1 allowed.
const unsigned long STATE_UNAVAILABLE = 0x00000001; // Disabled, maps to opposite of Java ENABLED, Gnome/ATK SENSITIVE?
const unsigned long STATE_SELECTED = 0x00000002;
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
// Extended state flags (for now non-MSAA, for Java and Gnome/ATK support)
// This is only the states that there isn't already a mapping for in MSAA
// See www.accessmozilla.org/article.php?sid=11 for information on the mappings between accessibility API states
const unsigned long STATE_INVALID = 0x00200000; // No explanation given
const unsigned long STATE_ACTIVE = 0x00400000; // This window is currently the active window
const unsigned long STATE_EXPANDABLE = 0x00800000; // An item that can be expanded, such as a tree item with children
const unsigned long STATE_MODAL = 0x01000000; // Must do something with control before leaving it
const unsigned long STATE_MULTI_LINE = 0x02000000; // Edit control that can take multiple lines
const unsigned long STATE_SENSITIVE = 0x04000000; // No explanation given
const unsigned long STATE_RESIZABLE = 0x08000000; // Object can be resized
const unsigned long STATE_SHOWING = 0x10000000; // This object and all of it's ancestors are visible
const unsigned long STATE_SINGLE_LINE = 0x20000000; // This text object can only contain 1 line of text
const unsigned long 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 STATE_VERTICAL = 0x80000000; // Especially used for sliders and scrollbars
%{C++
#ifdef MOZ_ACCESSIBILITY_ATK
/*******************************************************************************
The following nsIAccessible roles are traslated to ATK_ROLE_UNKNOWN
ROLE_TITLEBAR, ROLE_SOUND, ROLE_CURSOR, ROLE_CARET, ROLE_BORDER,
ROLE_GROUPING, ROLE_EQUATION, ROLE_COLUMN, ROLE_ROW, ROLE_LINK,
ROLE_WHITESPACE, ROLE_CLOCK,
ROLE_IPADDRESS
ROLE_GRIP
The object represents a special mouse pointer, which allows a user to
manipulate user interface elements such as windows.
ROLE_HELPBALLOON
The object displays a Help topic in the form of a ToolTip or Help balloon.
ROLE_PROPERTYPAGE
The object represents a property sheet.
ROLE_INDICATOR
The object represents an indicator, such as a pointer graphic pointing to
the currrent item.
ROLE_HOTKEYFIELD
The object represents a hot-key field that allow the user to enter a
sequence of keystroke.
The following ATK roles have no corresponding nsIAccessible roles. Perhaps
there are not these types of widget/control in Mozilla, so don't need these
ATK roles? Or need add some of them?
ATK_ROLE_ARROW
An arrow in one of the four cardinal directions.
ATK_ROLE_INTERNAL_FRAME
A frame-like object that is clipped by a desktop pane.
ATK_ROLE_ACCEL_LABEL, ATK_ROLE_CANVAS, ATK_ROLE_CHECK_MENU_ITEM,
ATK_ROLE_COLOR_CHOOSER, ATK_ROLE_DATE_EDITOR, ATK_ROLE_DESKTOP_ICON,
ATK_ROLE_DESKTOP_FRAME, ATK_ROLE_DIRECTORY_PANE, ATK_ROLE_FILE_CHOOSER,
ATK_ROLE_FILLER, ATK_ROLE_FONT_CHOOSER, ATK_ROLE_GLASS_PANE,
ATK_ROLE_HTML_CONTAINER, ATK_ROLE_ICON, ATK_ROLE_LAYERED_PANE,
ATK_ROLE_POPUP_MENU, ATK_ROLE_OPTION_PANE, ATK_ROLE_PASSWORD_TEXT,
ATK_ROLE_RADIO_MENU_ITEM, ATK_ROLE_ROOT_PANE, ATK_ROLE_SCROLL_PANE,
ATK_ROLE_SPLIT_PANE, ATK_ROLE_TEAR_OFF_MENU_ITEM, ATK_ROLE_TERMINAL,
ATK_ROLE_TOGGLE_BUTTON, ATK_ROLE_TREE_TABLE, ATK_ROLE_VIEWPORT, ATK_ROLE_LABEL
Important:
Following value should keep synchronization with the definitions in atk.h
*******************************************************************************/
enum { ROLE_TITLEBAR = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_MENUBAR = 33U }; // ATK_ROLE_MENU_BAR
enum { ROLE_SCROLLBAR = 47U }; // ATK_ROLE_SCROLL_BAR
enum { ROLE_GRIP = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_SOUND = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_CURSOR = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_CARET = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_ALERT = 2U }; // ATK_ROLE_ALERT
enum { ROLE_WINDOW = 68U }; // ATK_ROLE_WINDOW
// An object used for drawing custom user interface elements
enum { ROLE_CLIENT = 18U }; // ATK_ROLE_DRAWING_AREA
enum { ROLE_MENUPOPUP = 32U }; // ATK_ROLE_MENU
enum { ROLE_MENUITEM = 34U }; // ATK_ROLE_MENU_ITEM
enum { ROLE_TOOLTIP = 63U }; // ATK_ROLE_TOOL_TIP
// The object represents a main window for a application
enum { ROLE_APPLICATION = 22U }; // ATK_ROLE_FRAME
// The object represents a document window, only for MDI windows
enum { ROLE_DOCUMENT = 68U }; // ATK_ROLE_WINDOW
enum { ROLE_PANE = 38U }; // ATK_ROLE_PANEL
enum { ROLE_CHART = 26U }; // ATK_ROLE_IMAGE
enum { ROLE_DIALOG = 16U }; // ATK_ROLE_DIALOG
enum { ROLE_BORDER = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_GROUPING = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_SEPARATOR = 49U }; // ATK_ROLE_SEPARATOR
enum { ROLE_TOOLBAR = 62U }; // ATK_ROLE_TOOL_BAR
enum { ROLE_STATUSBAR = 53U }; // ATK_ROLE_STATUSBAR
enum { ROLE_TABLE = 54U }; // ATK_ROLE_TABLE
// Or ATK_ROLE_TABLE_COLUMN_HEADER?
enum { ROLE_COLUMNHEADER = 10U };// ATK_ROLE_COLUMN_HEADER
// Or ATK_ROLE_TABLE_ROW_HEADER ?
enum { ROLE_ROWHEADER = 46U }; // ATK_ROLE_ROW_HEADER
enum { ROLE_COLUMN = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_ROW = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_CELL = 55U }; // ATK_ROLE_TABLE_CELL
enum { ROLE_LINK = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_HELPBALLOON = 66U }; // ATK_ROLE_UNKNOWN
// The object represents a cartoon-like graphic object
enum { ROLE_CHARACTER = 26U }; // ATK_ROLE_IMAGE
enum { ROLE_LIST = 30U }; // ATK_ROLE_LIST
enum { ROLE_LISTITEM = 31U }; // ATK_ROLE_LIST_ITEM
// The object represents an outline or tree structure
enum { ROLE_OUTLINE = 64U }; // ATK_ROLE_TREE
// The object represents an item in an outline or tree structure
enum { ROLE_OUTLINEITEM = 31U }; // ATK_ROLE_LIST_ITEM
enum { ROLE_PAGETAB = 36U }; // ATK_ROLE_PAGE_TAB
enum { ROLE_PROPERTYPAGE = 66U };// ATK_ROLE_UNKNOWN
enum { ROLE_INDICATOR = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_GRAPHIC = 26U }; // ATK_ROLE_IMAGE
// Read-only text, can't be modified or selected
enum { ROLE_STATICTEXT = 60U }; // ATK_ROLE_TEXT
enum { ROLE_TEXT = 60U }; // ATK_ROLE_TEXT
enum { ROLE_PUSHBUTTON = 42U }; // ATK_ROLE_PUSH_BUTTON
enum { ROLE_CHECKBUTTON = 7U }; // ATK_ROLE_CHECK_BOX
enum { ROLE_RADIOBUTTON = 43U }; // ATK_ROLE_RADIO_BUTTON
enum { ROLE_COMBOBOX = 11U }; // ATK_ROLE_COMBO_BOX
// Just represents the calender control
enum { ROLE_DROPLIST = 5U }; // ATK_ROLE_CALENDAR
enum { ROLE_PROGRESSBAR = 41U }; // ATK_ROLE_PROGRESS_BAR
enum { ROLE_DIAL = 15U }; // ATK_ROLE_DIAL
enum { ROLE_HOTKEYFIELD = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_SLIDER = 50U }; // ATK_ROLE_SLIDER
enum { ROLE_SPINBUTTON = 52U }; // ATK_ROLE_SPIN_BUTTON
enum { ROLE_DIAGRAM = 26U }; // ATK_ROLE_IMAGE
enum { ROLE_ANIMATION = 3U }; // ATK_ROLE_ANIMATION
enum { ROLE_EQUATION = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_BUTTONDROPDOWN = 42U }; // ATK_ROLE_PUSH_BUTTON
enum { ROLE_BUTTONMENU = 42U }; // ATK_ROLE_PUSH_BUTTON
// Represents a button that drops down a grid
enum { ROLE_BUTTONDROPDOWNGRID = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_WHITESPACE = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_PAGETABLIST = 37U }; // ATK_ROLE_PAGE_TAB_LIST
enum { ROLE_CLOCK = 66U }; // ATK_ROLE_UNKNOWN
// Represents a button on the toolbar that has a drop-down list icon
// directly adjacent to the button
enum { ROLE_SPLITBUTTON = 42U }; // ATK_ROLE_PUSH_BUTTON
enum { ROLE_IPADDRESS = 66U }; // ATK_ROLE_UNKNOWN
enum { ROLE_NOTHING = 0U }; // ATK_ROLE_INVALID
#else
// MSAA Roles - only one per nsIAccessible or IAccessible
enum { ROLE_TITLEBAR = 1U };
enum { ROLE_MENUBAR = 2U };
enum { ROLE_SCROLLBAR = 3U };
enum { ROLE_GRIP = 4U };
enum { ROLE_SOUND = 5U };
enum { ROLE_CURSOR = 6U };
enum { ROLE_CARET = 7U };
enum { ROLE_ALERT = 8U };
enum { ROLE_WINDOW = 9U };
enum { ROLE_CLIENT = 10U };
enum { ROLE_MENUPOPUP = 11U };
enum { ROLE_MENUITEM = 12U };
enum { ROLE_TOOLTIP = 13U };
enum { ROLE_APPLICATION = 14U };
enum { ROLE_DOCUMENT = 15U };
enum { ROLE_PANE = 16U };
enum { ROLE_CHART = 17U };
enum { ROLE_DIALOG = 18U };
enum { ROLE_BORDER = 19U };
enum { ROLE_GROUPING = 20U };
enum { ROLE_SEPARATOR = 21U };
enum { ROLE_TOOLBAR = 22U };
enum { ROLE_STATUSBAR = 23U };
enum { ROLE_TABLE = 24U };
enum { ROLE_COLUMNHEADER = 25U };
enum { ROLE_ROWHEADER = 26U };
enum { ROLE_COLUMN = 27U };
enum { ROLE_ROW = 28U };
enum { ROLE_CELL = 29U };
enum { ROLE_LINK = 30U };
enum { ROLE_HELPBALLOON = 31U };
enum { ROLE_CHARACTER = 32U };
enum { ROLE_LIST = 33U };
enum { ROLE_LISTITEM = 34U };
enum { ROLE_OUTLINE = 35U };
enum { ROLE_OUTLINEITEM = 36U };
enum { ROLE_PAGETAB = 37U };
enum { ROLE_PROPERTYPAGE = 38U };
enum { ROLE_INDICATOR = 39U };
enum { ROLE_GRAPHIC = 40U };
enum { ROLE_STATICTEXT = 41U };
enum { ROLE_TEXT = 42U };
enum { ROLE_PUSHBUTTON = 43U };
enum { ROLE_CHECKBUTTON = 44U };
enum { ROLE_RADIOBUTTON = 45U };
enum { ROLE_COMBOBOX = 46U };
enum { ROLE_DROPLIST = 47U };
enum { ROLE_PROGRESSBAR = 48U };
enum { ROLE_DIAL = 49U };
enum { ROLE_HOTKEYFIELD = 50U };
enum { ROLE_SLIDER = 51U };
enum { ROLE_SPINBUTTON = 52U };
enum { ROLE_DIAGRAM = 53U };
enum { ROLE_ANIMATION = 54U };
enum { ROLE_EQUATION = 55U };
enum { ROLE_BUTTONDROPDOWN = 56U };
enum { ROLE_BUTTONMENU = 57U };
enum { ROLE_BUTTONDROPDOWNGRID = 58U };
enum { ROLE_WHITESPACE = 59U };
enum { ROLE_PAGETABLIST = 60U };
enum { ROLE_CLOCK = 61U };
enum { ROLE_SPLITBUTTON = 62U };
enum { ROLE_IPADDRESS = 63U };
enum { ROLE_NOTHING = 4294967295U };
#endif
%}
};

View File

@ -1,51 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
*
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*/
#include "nsISupports.idl"
[scriptable, uuid(829B36D4-125A-4279-ABC4-87D834664F82)]
interface nsIAccessibleAction : nsISupports
{
readonly attribute long actions;
boolean doAction (in long index);
AString getDescription (in long index);
void getDescriptionConst (in long index,
[shared, retval] out string description);
AString getKeyBinding (in long index);
void getKeyBindingConst (in long index,
[shared, retval] out string keyBinding);
};
/*
Assumptions:
string is a UTF-8 or most likely ASCII
encoding.
*/

View File

@ -1,32 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
*
*/
#include "nsISupports.idl"
#include "nsIAccessible.idl"
[scriptable, uuid(9124c666-6133-4be6-b3ed-dd0ec35f1e64)]
interface nsIAccessibleCaret : nsISupports
{
void attachNewSelectionListener(in nsIDOMNode aFocusedNode);
void removeSelectionListener();
};

View File

@ -1,42 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Aaron Leventhal
*
* Contributor(s):
* John Gaunt
*/
#include "nsISupports.idl"
#include "nsIAccessible.idl"
#include "domstubs.idl"
#include "nsIAccessibleCaret.idl"
interface nsIDocument;
[scriptable, uuid(8781FC88-355F-4439-881F-6504A0A1CEB6)]
interface nsIAccessibleDocument : nsISupports
{
readonly attribute AString URL;
readonly attribute AString title;
readonly attribute AString mimeType;
readonly attribute AString docType;
AString getNameSpaceURIForID(in short nameSpaceID);
[noscript] nsIDocument getDocument();
readonly attribute nsIAccessibleCaret caretAccessible;
};

View File

@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
*
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*/
#include "nsISupports.idl"
[scriptable, uuid(91F0A56C-11BE-47C7-8D02-7C15E00C05F5)]
interface nsIAccessibleEditableText : nsISupports
{
/**
* Set font styles, such as italic, bold...
*/
void setAttributes (in long startPos, in long endPos,
in nsISupports attributes);
void setTextContents (in AString text);
void insertText (in AString text, in long position);
void copyText (in long startPos, in long endPos);
void cutText (in long startPos, in long endPos);
void deleteText (in long startPos, in long endPos);
void pasteText (in long position);
};
/*
Assumptions:
selectAttributes method takes an nsISupports parameter.
'set' methods throw exception on failure.
'wstring' inputs are potentially multibyte (UTF-16 for
instance); 'string' and UTF-8 may be a better choice.
*/

View File

@ -1,99 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric D Vaughan (evaughan@netscape.com)
*
* Contributor(s):
*/
#include "nsISupports.idl"
#include "nsIAccessible.idl"
%{ C++
// extra event data (currently used by ATK)
struct AccessibleEventData {
PRUint32 aUnused;
};
%}
[ptr] native AccessibleEventData(AccessibleEventData);
[scriptable, uuid(BEE49E7D-9D06-49bf-8984-1694C697D74F)]
interface nsIAccessibleEventListener : nsISupports
{
// these are set to the values given by MSAA
const unsigned long EVENT_CREATE = 0x8000;
const unsigned long EVENT_DESTROY = 0x8001;
const unsigned long EVENT_SHOW = 0x8002;
const unsigned long EVENT_HIDE = 0x8003;
const unsigned long EVENT_REORDER = 0x8004;
const unsigned long EVENT_FOCUS = 0x8005;
const unsigned long EVENT_STATE_CHANGE = 0x800A;
const unsigned long EVENT_LOCATION_CHANGE = 0x800B;
const unsigned long EVENT_NAME_CHANGE = 0x800C;
const unsigned long EVENT_DESCRIPTIONCHANGE = 0x800D;
const unsigned long EVENT_VALUE_CHANGE = 0x800E;
const unsigned long EVENT_PARENTCHANGE = 0x800F;
const unsigned long EVENT_HELPCHANGE = 0x8010;
const unsigned long EVENT_DEFACTIONCHANGE = 0x8011;
const unsigned long EVENT_ACCELERATORCHANGE = 0x8012;
const unsigned long EVENT_SELECTION = 0x8006;
const unsigned long EVENT_SELECTION_ADD = 0x8007;
const unsigned long EVENT_SELECTION_REMOVE = 0x8008;
const unsigned long EVENT_SELECTION_WITHIN = 0x8009;
const unsigned long EVENT_ALERT = 0x0002;
const unsigned long EVENT_FOREGROUND = 0x0003;
const unsigned long EVENT_MENUSTART = 0x0004;
const unsigned long EVENT_MENUEND = 0x0005;
const unsigned long EVENT_MENUPOPUPSTART = 0x0006;
const unsigned long EVENT_MENUPOPUPEND = 0x0007;
const unsigned long EVENT_CAPTURESTART = 0x0008;
const unsigned long EVENT_CAPTUREEND = 0x0009;
const unsigned long EVENT_MOVESIZESTART = 0x000A;
const unsigned long EVENT_MOVESIZEEND = 0x000B;
const unsigned long EVENT_CONTEXTHELPSTART = 0x000C;
const unsigned long EVENT_CONTEXTHELPEND = 0x000D;
const unsigned long EVENT_DRAGDROPSTART = 0x000E;
const unsigned long EVENT_DRAGDROPEND = 0x000F;
const unsigned long EVENT_DIALOGSTART = 0x0010;
const unsigned long EVENT_DIALOGEND = 0x0011;
const unsigned long EVENT_SCROLLINGSTART = 0x0012;
const unsigned long EVENT_SCROLLINGEND = 0x0013;
const unsigned long EVENT_MINIMIZESTART = 0x0016;
const unsigned long EVENT_MINIMIZEEND = 0x0017;
// the additional events for ATK
const unsigned long EVENT_ATK_PROPERTY_CHANGE = 0x0100;
const unsigned long EVENT_ATK_SELECTION_CHANGE = 0x0101;
const unsigned long EVENT_ATK_TEXT_CHANGE = 0x0102;
const unsigned long EVENT_ATK_TEXT_SELECTION_CHANGE = 0x0103;
const unsigned long EVENT_ATK_TEXT_CARET_MOVE = 0x0104;
const unsigned long EVENT_ATK_VISIBLE_DATA_CHANGE = 0x0105;
const unsigned long EVENT_ATK_TABLE_MODEL_CHANGE = 0x0110;
const unsigned long EVENT_ATK_TABLE_ROW_INSERT = 0x0111;
const unsigned long EVENT_ATK_TABLE_ROW_DELETE = 0x0112;
const unsigned long EVENT_ATK_TABLE_ROW_REORDER = 0x0113;
const unsigned long EVENT_ATK_TABLE_COLUMN_INSERT = 0x0114;
const unsigned long EVENT_ATK_TABLE_COLUMN_DELETE = 0x0115;
const unsigned long EVENT_ATK_TABLE_COLUMN_REORDER = 0x0116;
[noscript]
void handleEvent(in unsigned long aEvent, in nsIAccessible aTarget, in AccessibleEventData aData);
};

View File

@ -1,32 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric D Vaughan (evaughan@netscape.com)
*
* Contributor(s):
*/
#include "nsIAccessibleEventListener.idl"
[scriptable, uuid(AB331E47-4FAA-4a12-9480-9B480DD78B39)]
interface nsIAccessibleEventReceiver : nsISupports
{
void addAccessibleEventListener(in nsIAccessibleEventListener aListener);
void removeAccessibleEventListener();
};

View File

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
*
* Contributor(s): Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*/
#include "nsISupports.idl"
#include "nsIAccessible.idl"
interface nsIURI;
[scriptable, uuid(a492c7d6-1dd1-11b2-9bc0-80614884799a)]
interface nsIAccessibleHyperLink : nsISupports
{
readonly attribute long anchors;
readonly attribute long startIndex;
readonly attribute long endIndex;
nsIURI getURI (in long i);
nsIAccessible getObject (in long i);
boolean isValid ();
};
/*
Assumptions:
The object associated with object or anchor index
is an nsIAccessible.
A URI can be represented by the nsIURI interface
(or nsIURL interface).
Note that an object which supports nsIAccessibleHyperlink
does *not* generally implement nsIAccessible, unlike the
case of the other nsiAccessible* interfaces in this directory.
Aaron: would the nsISupports return from
getObject be queryable for nsIURI and nsIURL directly?
*/

View File

@ -1,38 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
*
* Contributor(s): Bill Haneman (bill.haneman@sun.com)
* Paul Sandoz (paul.sandoz@sun.com)
* John Gaunt (jgaunt@netscape.com)
*/
#include "nsISupports.idl"
#include "nsIAccessibleHyperLink.idl"
[scriptable, uuid(8f18d922-1dd2-11b2-82ea-829b78a44413)]
interface nsIAccessibleHyperText : nsISupports
{
readonly attribute long links;
nsIAccessibleHyperLink getLink (in long index);
long getLinkIndex (in long charIndex);
};

View File

@ -1,33 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: John Gaunt (jgaunt@netscape.com)
*
* Contributor(s):
* John Gaunt
*/
#include "nsISupports.idl"
#include "nsIAccessible.idl"
[scriptable, uuid(3f0e3eb0-1dd2-11b2-9605-be5b8e76cf4b)]
interface nsIAccessibleProvider : nsISupports
{
readonly attribute nsIAccessible accessible;
};

View File

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: John Gaunt (jgaunt@netscape.com)
*
* Contributor(s):
* John Gaunt
* Marc Mulcahy (marc.mulcahy@sun.com)
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* Kyle Yuan (kyle.yuan@sun.com)
*/
#include "nsISupports.idl"
#include "nsIAccessible.idl"
#include "nsISupportsArray.idl"
[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
interface nsIAccessibleSelectable : nsISupports
{
nsISupportsArray GetSelectedChildren();
/**
* Returns the number of accessible children currently selected.
*/
readonly attribute long selectionCount;
/**
* Adds the specified accessible child of the object to the
* object's selection.
*/
void addSelection(in long index);
/**
* Removes the specified child of the object from the object's selection.
*/
void removeSelection(in long index);
/**
* Clears the selection in the object so that no children in the object
* are selected.
*/
void clearSelection();
/**
* Returns a reference to the accessible object representing the specified
* selected child of the object.
*/
nsIAccessible refSelection(in long index);
/**
* Determines if the current child of this object is selected
*/
boolean isChildSelected(in long index);
/**
* If the object does not accept multiple selection, return false.
*/
boolean selectAllSelection();
};

View File

@ -1,66 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
*
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*/
#include "nsISupports.idl"
#include "nsIAccessible.idl"
[scriptable, uuid(0A7E98A9-CA7D-42F0-BFE1-2CFC35256038)]
interface nsIAccessibleTable : nsISupports
{
attribute nsIAccessible caption;
attribute AString summary;
readonly attribute long columns;
readonly attribute nsIAccessibleTable columnHeader;
readonly attribute long rows;
readonly attribute nsIAccessibleTable rowHeader;
void getSelectedColumns (out unsigned long columnsSize,
[retval, array, size_is(columnsSize)] out long columns);
void getSelectedRows (out unsigned long rowsSize,
[retval, array, size_is(rowsSize)] out long rows);
/**
* gets a cell
*/
nsIAccessible cellRefAt (in long row, in long column);
/**
* get an index
*/
long getIndexAt (in long row, in long column);
long getColumnAtIndex (in long index);
long getRowAtIndex (in long index);
long getColumnExtentAt (in long row, in long column);
long getRowExtentAt (in long row, in long column);
AString getColumnDescription (in long column);
AString getRowDescription (in long row);
boolean isColumnSelected (in long column);
boolean isRowSelected (in long row);
boolean isCellSelected (in long row, in long column);
};

View File

@ -1,131 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
*
* Contributor(s): Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
*/
#include "nsISupports.idl"
typedef long nsAccessibleTextBoundary;
typedef long nsAccessibleCoordType;
[scriptable, uuid(E44D3FA6-9CB2-432A-8BDB-69D72B6ADA00)]
interface nsIAccessibleText : nsISupports
{
const nsAccessibleTextBoundary BOUNDARY_CHAR = 0;
const nsAccessibleTextBoundary BOUNDARY_WORD_START = 1;
const nsAccessibleTextBoundary BOUNDARY_WORD_END = 2;
const nsAccessibleTextBoundary BOUNDARY_SENTENCE_START = 3;
const nsAccessibleTextBoundary BOUNDARY_SENTENCE_END = 4;
const nsAccessibleTextBoundary BOUNDARY_LINE_START = 5;
const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
const nsAccessibleCoordType COORD_TYPE_SCREEN = 0;
const nsAccessibleCoordType COORD_TYPE_WINDOW = 1;
attribute long caretOffset;
readonly attribute long characterCount;
readonly attribute long selectionCount;
/**
* String methods may need to return multibyte-encoded strings,
* since some locales can't be encoded using 16-bit chars.
* So the methods below might return UTF-16 strings, or they could
* return "string" values which are UTF-8.
*/
AString getText (in long startOffset, in long endOffset);
AString getTextAfterOffset (in long offset,
in nsAccessibleTextBoundary boundaryType,
out long startOffset,
out long endOffset);
AString getTextAtOffset (in long offset,
in nsAccessibleTextBoundary boundaryType,
out long startOffset,
out long endOffset);
/**
* It would be better to return an unsigned long here,
* to allow unicode chars > 16 bits
*/
wchar getCharacterAtOffset (in long offset);
nsISupports getAttributeRange (in long offset,
out long rangeStartOffset,
out long rangeEndOffset);
AString getTextBeforeOffset (in long offset,
in nsAccessibleTextBoundary boundaryType,
out long startOffset,
out long endOffset);
void getCharacterExtents (in long offset,
out long x,
out long y,
out long length,
out long width,
in nsAccessibleCoordType coordType);
long getOffsetAtPoint (in long x, in long y,
in nsAccessibleCoordType coordType);
void getSelectionBounds (in long selectionNum,
out long startOffset,
out long endOffset);
void setSelectionBounds (in long selectionNum,
in long startOffset,
in long endOffset);
void addSelection (in long startOffset, in long endOffset);
void removeSelection (in long selectionNum);
};
/*
Assumptions:
Using wstring (UCS2) instead of string encoded in UTF-8.
Multibyte encodings (or at least potentially multi-byte
encodings) would be preferred for the reasons cited above.
The following methods will throw an exception
on failure (since not every text component will allow
every operation):
setSelectionBounds, addSelection, removeSelection,
setCaretOffset.
getRangeAttributes defined to return an nsISupports
interface instead of a pango specific data structure.
It may be that some other return type is more appropriate
for mozilla text attributes.
we assume that all text components support the idea of
a caret offset, whether visible or "virtual". If this
isn't the case, caretOffset can be made readonly and
a setCaretOffset method provided which throws an exception
on failure (as with *selection methods above).
*/

View File

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Marc Mulcahy (marc.mulcahy@sun.com)
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
*/
#include "nsISupports.idl"
[scriptable, uuid(F4ABBC2F-0F28-47DC-A9E9-F7A1719AB2BE)]
interface nsIAccessibleValue : nsISupports
{
readonly attribute double maximumValue;
readonly attribute double minimumValue;
readonly attribute double currentValue;
/**
* We want to be able to return a success condition of the value
* getting set. ie if the value is not within the interval of
* minimumValue-maximumValue
*/
boolean setCurrentValue (in double value);
};
/*
Assumptions:
The attribute currentValue will throw an exception
if it cannot be set i.e. if the value is not a
member of the interval.
This may not be the 'desired' behaviour given gObject
equivalent. Thus it could be changed to be:
readonly attribute double currentValue;
boolean setCurrentValue (double long value);
GValue can represent many basic types.
Since this interface is designed to represent
an interval and a member of double should
cover the cases of char int and float.
*/

View File

@ -1,34 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: John Gaunt (jgaunt@netscape.com)
*
* Contributor(s):
*
*/
#include "nsISupports.idl"
[scriptable, uuid(ca7a3a93-822f-4cdf-8cb4-c52d16b9afc7)]
interface nsIAccessibleWin32Object : nsISupports
{
/** handle to the external window implementing IAccessible */
readonly attribute long hwnd;
};

View File

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

View File

@ -1 +0,0 @@
accessible.properties

View File

@ -1,78 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): John Gaunt (jgaunt@netscape.com)
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
LIBRARY_NAME = accessibility_base_s
REQUIRES = content \
docshell \
dom \
gfx \
htmlparser \
intl \
layout \
locale \
necko \
plugin \
pref \
string \
uriloader \
view \
webshell \
widget \
xpcom \
xuldoc \
$(NULL)
CPPSRCS = \
nsAccessibilityService.cpp \
nsAccessible.cpp \
nsBaseWidgetAccessible.cpp \
nsFormControlAccessible.cpp \
nsGenericAccessible.cpp \
nsRootAccessible.cpp \
nsCaretAccessible.cpp \
nsSelectAccessible.cpp \
nsTextAccessible.cpp \
$(NULL)
EXPORTS = \
nsRootAccessible.h \
nsAccessibleEventData.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(srcdir) \
-I$(srcdir)/../html \
-I$(srcdir)/../xul \
-I$(srcdir)/../../../layout/html/base/src \
$(NULL)

View File

@ -1,11 +0,0 @@
jump = Jump
press = Press
check = Check
uncheck = Uncheck
select = Select
open = Open
close = Close
switch = Switch
click = Click
collapse= Collapse
expand = Expand

View File

@ -1,9 +0,0 @@
en-win.jar:
locale/en-US/global-platform/accessible.properties
en-unix.jar:
locale/en-US/global-platform/accessible.properties
en-mac.jar:
locale/en-US/global-platform/accessible.properties

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
* Contributor(s): John Gaunt (jgaunt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsAccessibilityService_h__
#define __nsAccessibilityService_h__
#include "nsIAccessibilityService.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsIDocShell.h"
#include "nsObjectFrame.h"
class nsIFrame;
class nsIWeakReference;
class nsIDOMNode;
class nsAccessibilityService : public nsIAccessibilityService
{
public:
nsAccessibilityService();
virtual ~nsAccessibilityService();
NS_DECL_ISUPPORTS
// nsIAccessibilityService methods:
NS_DECL_NSIACCESSIBILITYSERVICE
static nsresult GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **weakShell);
private:
nsresult GetHTMLObjectAccessibleFor(nsIDOMNode *aNode, nsIPresShell *aShell, nsObjectFrame *aFrame, nsIAccessible **_retval);
nsresult GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent);
void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent);
nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell);
};
#endif /* __nsIAccessibilityService_h__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,180 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
*
*
* 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 _nsAccessible_H_
#define _nsAccessible_H_
#include "nsCOMPtr.h"
#include "nsGenericAccessible.h"
#include "nsIAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIDOMNode.h"
#include "nsIFocusController.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsPoint.h"
#include "nsRect.h"
#include "nsWeakReference.h"
#include "nsIDOMNodeList.h"
#include "nsIBindingManager.h"
#include "nsIStringBundle.h"
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
class nsIContent;
class nsIDocShell;
class nsIFrame;
class nsIWebShell;
enum { eSiblingsUninitialized = -1, eSiblingsWalkNormalDOM = -2}; // Used in sibling index field as flags
class nsAccessible : public nsGenericAccessible
{
public:
// to eliminate the confusion of "magic numbers" -- if ( 0 ){ foo; }
enum { eAction_Switch=0, eAction_Jump=0, eAction_Click=0, eAction_Select=0 };
// how many actions
enum { eNo_Action=0, eSingle_Action=1 };
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
virtual ~nsAccessible();
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccId(PRInt32 *_retval);
NS_IMETHOD GetAccKeyboardShortcut(nsAString& _retval);
NS_IMETHOD GetAccDescription(nsAString& _retval);
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccFocused(nsIAccessible **_retval);
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD AccRemoveSelection(void);
NS_IMETHOD AccTakeSelection(void);
NS_IMETHOD AccTakeFocus(void);
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
protected:
virtual nsIFrame* GetFrame();
virtual nsIFrame* GetBoundsFrame();
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
PRBool IsPartiallyVisible(PRBool *aIsOffscreen);
NS_IMETHOD AppendLabelText(nsIDOMNode *aLabelNode, nsAString& _retval);
NS_IMETHOD AppendLabelFor(nsIContent *aLookNode, const nsAString *aId, nsAString *aLabel);
NS_IMETHOD GetHTMLAccName(nsAString& _retval);
NS_IMETHOD GetXULAccName(nsAString& _retval);
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString);
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString);
NS_IMETHOD AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent);
NS_IMETHOD GetFocusedNode(nsIDOMNode **aFocusedNode);
NS_IMETHOD CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList);
// helper method to verify frames
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
static nsresult GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut);
static nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
void GetScrollOffset(nsRect *aRect);
void GetScreenOrigin(nsIPresContext *aPresContext, nsIFrame *aFrame, nsRect *aRect);
nsresult AppendFlatStringFromSubtreeRecurse(nsIContent *aContent, nsAString *aFlatString);
// Data Members
nsCOMPtr<nsIDOMNode> mDOMNode;
nsCOMPtr<nsIWeakReference> mPresShell;
nsCOMPtr<nsIAccessible> mParent;
nsCOMPtr<nsIDOMNodeList> mSiblingList; // If some of our computed siblings are anonymous content nodes, cache node list
PRInt32 mSiblingIndex; // Cache where we are in list of kids that we got from nsIBindingManager::GetContentList(parentContent)
static PRUint32 gInstanceCount;
static nsIStringBundle *gStringBundle;
static nsIStringBundle *gKeyStringBundle;
};
/** This class is used to walk the DOM tree. It skips
* everything but nodes that either implement nsIAccessible
* or have primary frames that implement "GetAccessible"
*/
struct WalkState {
nsCOMPtr<nsIAccessible> accessible;
nsCOMPtr<nsIDOMNode> domNode;
nsCOMPtr<nsIDOMNodeList> siblingList;
PRInt32 siblingIndex; // Holds a state flag or an index into the siblingList
WalkState *prevState;
};
class nsAccessibleTreeWalker {
public:
nsAccessibleTreeWalker(nsIWeakReference* aShell, nsIDOMNode* aContent,
PRInt32 aCachedSiblingIndex, nsIDOMNodeList *aCachedSiblingList, PRBool mWalkAnonymousContent);
virtual ~nsAccessibleTreeWalker();
NS_IMETHOD GetNextSibling();
NS_IMETHOD GetPreviousSibling();
NS_IMETHOD GetParent();
NS_IMETHOD GetFirstChild();
NS_IMETHOD GetLastChild();
PRInt32 GetChildCount();
WalkState mState;
WalkState mInitialState;
protected:
NS_IMETHOD GetChildBefore(nsIDOMNode* aParent, nsIDOMNode* aChild);
PRBool IsHidden();
PRBool GetAccessible();
NS_IMETHOD GetFullTreeParentNode(nsIDOMNode *aChildNode, nsIDOMNode **aParentNodeOut);
void GetSiblings(nsIDOMNode *aOneOfTheSiblings);
void GetKids(nsIDOMNode *aParent);
void ClearState();
NS_IMETHOD PushState();
NS_IMETHOD PopState();
nsCOMPtr<nsIWeakReference> mPresShell;
nsCOMPtr<nsIAccessibilityService> mAccService;
nsCOMPtr<nsIBindingManager> mBindingManager;
};
#endif

View File

@ -1,93 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kyle Yuan (kyle.yuan@sun.com)
* John Sun (john.sun@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsAccessibleEventData_H_
#define _nsAccessibleEventData_H_
#ifdef MOZ_ACCESSIBILITY_ATK
struct AtkStateChange {
PRUint32 state;
PRBool enable;
};
enum AtkProperty {
PROP_0, // gobject convention
PROP_NAME,
PROP_DESCRIPTION,
PROP_PARENT, // ancestry has changed
PROP_VALUE,
PROP_ROLE,
PROP_LAYER,
PROP_MDI_ZORDER,
PROP_TABLE_CAPTION,
PROP_TABLE_COLUMN_DESCRIPTION,
PROP_TABLE_COLUMN_HEADER,
PROP_TABLE_ROW_DESCRIPTION,
PROP_TABLE_ROW_HEADER,
PROP_TABLE_SUMMARY,
PROP_LAST // gobject convention
};
struct AtkPropertyChange {
PRInt32 type; // property type as listed above
void *oldvalue;
void *newvalue;
};
struct AtkChildrenChange {
PRUint32 index; // index of child in parent
nsIAccessible *child;
PRBool add; // true for add, false for delete
};
struct AtkTextChange {
PRUint32 start;
PRUint32 length;
PRBool add; // true for add, false for delete
};
struct AtkTableChange {
PRUint32 index; // the start row/column after which the rows are inserted/deleted.
PRUint32 count; // the number of inserted/deleted rows/columns
};
#endif
#endif

View File

@ -1,455 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "nsCOMPtr.h"
#include "nsGUIEvent.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsIFrame.h"
#include "nsILink.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsISelection.h"
#include "nsISelectionController.h"
#include "nsIServiceManager.h"
#include "nsIAccessibilityService.h"
// ------------
// nsBlockAccessible
// ------------
nsBlockAccessible::nsBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):nsAccessible(aNode, aShell)
{
}
/* nsIAccessible accGetAt (in long x, in long y); */
NS_IMETHODIMP nsBlockAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
{
// We're going to find the child that contains coordinates (tx,ty)
PRInt32 x,y,w,h;
AccGetBounds(&x,&y,&w,&h); // Get bounds for this accessible
if (tx >= x && tx < x + w && ty >= y && ty < y + h)
{
// It's within this nsIAccessible, let's drill down
nsCOMPtr<nsIAccessible> child;
nsCOMPtr<nsIAccessible> smallestChild;
PRInt32 smallestArea = -1;
nsCOMPtr<nsIAccessible> next;
GetAccFirstChild(getter_AddRefs(child));
PRInt32 cx,cy,cw,ch; // Child bounds
while(child) {
child->AccGetBounds(&cx,&cy,&cw,&ch);
// ok if there are multiple frames the contain the point
// and they overlap then pick the smallest. We need to do this
// for text frames.
// For example, A point that's in block #2 is also in block #1, but we want to return #2:
//
// [[block #1 is long wrapped text that continues to
// another line]] [[here is a shorter block #2]]
if (tx >= cx && tx < cx + cw && ty >= cy && ty < cy + ch)
{
if (smallestArea == -1 || cw*ch < smallestArea) {
smallestArea = cw*ch;
smallestChild = child;
}
}
child->GetAccNextSibling(getter_AddRefs(next));
child = next;
}
if (smallestChild != nsnull)
{
*_retval = smallestChild;
NS_ADDREF(*_retval);
return NS_OK;
}
*_retval = this;
NS_ADDREF(this);
return NS_OK;
}
*_retval = nsnull;
return NS_OK;
}
/**
* nsContainerAccessible
*/
nsContainerAccessible::nsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
/** no actions */
NS_IMETHODIMP nsContainerAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eNo_Action;
return NS_OK;
}
/** no actions */
NS_IMETHODIMP nsContainerAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
return NS_OK;
}
/** no actions */
NS_IMETHODIMP nsContainerAccessible::AccDoAction(PRUint8 index)
{
return NS_OK;
}
/** no state -- normal */
NS_IMETHODIMP nsContainerAccessible::GetAccState(PRUint32 *_retval)
{
*_retval = 0;
return NS_OK;
}
/** no value */
NS_IMETHODIMP nsContainerAccessible::GetAccValue(nsAString& _retval)
{
return NS_OK;
}
/** no name*/
NS_IMETHODIMP nsContainerAccessible::GetAccName(nsAString& _retval)
{
return NS_OK;
}
//-------------
// nsLeafFrameAccessible
//-------------
nsLeafAccessible::nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
/* nsIAccessible getAccFirstChild (); */
NS_IMETHODIMP nsLeafAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/* nsIAccessible getAccLastChild (); */
NS_IMETHODIMP nsLeafAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/* long getAccChildCount (); */
NS_IMETHODIMP nsLeafAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 0;
return NS_OK;
}
//----------------
// nsLinkableAccessible
//----------------
nsLinkableAccessible::nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell), mIsALinkCached(PR_FALSE), mLinkContent(nsnull), mIsLinkVisited(PR_FALSE)
{
}
NS_IMETHODIMP nsLinkableAccessible::AccTakeFocus()
{
if (IsALink()) {
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
mLinkContent->SetFocus(context);
}
return NS_OK;
}
/* long GetAccState (); */
NS_IMETHODIMP nsLinkableAccessible::GetAccState(PRUint32 *_retval)
{
nsAccessible::GetAccState(_retval);
*_retval |= STATE_READONLY | STATE_SELECTABLE;
if (IsALink()) {
*_retval |= STATE_LINKED;
if (mIsLinkVisited)
*_retval |= STATE_TRAVERSED;
}
// Get current selection and find out if current node is in it
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsIFrame *frame = nsnull;
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
nsCOMPtr<nsISelectionController> selCon;
frame->GetSelectionController(context,getter_AddRefs(selCon));
if (selCon) {
nsCOMPtr<nsISelection> domSel;
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
if (domSel) {
PRBool isSelected = PR_FALSE, isCollapsed = PR_TRUE;
domSel->ContainsNode(mDOMNode, PR_TRUE, &isSelected);
domSel->GetIsCollapsed(&isCollapsed);
if (isSelected && !isCollapsed)
*_retval |=STATE_SELECTED;
}
}
}
if (IsALink()) {
// Make sure we also include all the states of the parent link, such as focusable, focused, etc.
PRUint32 role;
GetAccRole(&role);
if (role != ROLE_LINK) {
nsCOMPtr<nsIAccessible> parentAccessible;
GetAccParent(getter_AddRefs(parentAccessible));
if (parentAccessible) {
PRUint32 orState = 0;
parentAccessible->GetAccState(&orState);
*_retval |= orState;
}
}
}
return NS_OK;
}
NS_IMETHODIMP nsLinkableAccessible::GetAccValue(nsAString& _retval)
{
if (IsALink()) {
nsCOMPtr<nsIDOMNode> linkNode(do_QueryInterface(mLinkContent));
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
if (linkNode && presShell)
return presShell->GetLinkLocation(linkNode, _retval);
}
return NS_ERROR_NOT_IMPLEMENTED;
}
/* PRUint8 getAccNumActions (); */
NS_IMETHODIMP nsLinkableAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
/* wstring getAccActionName (in PRUint8 index); */
NS_IMETHODIMP nsLinkableAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
// Action 0 (default action): Jump to link
if (index == eAction_Jump) {
if (IsALink()) {
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("jump"), _retval);
return NS_OK;
}
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_ERROR_INVALID_ARG;
}
/* void accDoAction (in PRUint8 index); */
NS_IMETHODIMP nsLinkableAccessible::AccDoAction(PRUint8 index)
{
// Action 0 (default action): Jump to link
if (index == eAction_Jump) {
if (IsALink()) {
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresContext> presContext;
shell->GetPresContext(getter_AddRefs(presContext));
if (presContext) {
nsMouseEvent linkClickEvent;
linkClickEvent.eventStructType = NS_EVENT;
linkClickEvent.message = NS_MOUSE_LEFT_CLICK;
linkClickEvent.isShift = PR_FALSE;
linkClickEvent.isControl = PR_FALSE;
linkClickEvent.isAlt = PR_FALSE;
linkClickEvent.isMeta = PR_FALSE;
linkClickEvent.clickCount = 0;
linkClickEvent.widget = nsnull;
nsEventStatus eventStatus = nsEventStatus_eIgnore;
mLinkContent->HandleDOMEvent(presContext,
&linkClickEvent,
nsnull,
NS_EVENT_FLAG_INIT,
&eventStatus);
return NS_OK;
}
}
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsLinkableAccessible::GetAccKeyboardShortcut(nsAString& _retval)
{
if (IsALink()) {
nsCOMPtr<nsIDOMNode> linkNode(do_QueryInterface(mLinkContent));
if (linkNode && mDOMNode != linkNode) {
nsCOMPtr<nsIAccessible> linkAccessible;
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
accService->GetAccessibleFor(linkNode, getter_AddRefs(linkAccessible));
return linkAccessible->GetAccKeyboardShortcut(_retval);
}
}
return nsAccessible::GetAccKeyboardShortcut(_retval);;
}
PRBool nsLinkableAccessible::IsALink()
{
if (mIsALinkCached) // Cached answer?
return mLinkContent? PR_TRUE: PR_FALSE;
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
if (walkUpContent) {
nsCOMPtr<nsIContent> tempContent = walkUpContent;
while (walkUpContent) {
nsCOMPtr<nsILink> link(do_QueryInterface(walkUpContent));
if (link) {
mLinkContent = tempContent;
mIsALinkCached = PR_TRUE;
nsLinkState linkState;
link->GetLinkState(linkState);
if (linkState == eLinkState_Visited)
mIsLinkVisited = PR_TRUE;
return PR_TRUE;
}
walkUpContent->GetParent(*getter_AddRefs(tempContent));
walkUpContent = tempContent;
}
}
mIsALinkCached = PR_TRUE; // Cached that there is no link
return PR_FALSE;
}
// ------------
// nsMenuListenerAccessible
// ------------
NS_IMPL_ISUPPORTS_INHERITED1(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
nsMenuListenerAccessible::nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsAccessible(aDOMNode, aShell)
{
mRegistered = PR_FALSE;
mOpen = PR_FALSE;
}
nsMenuListenerAccessible::~nsMenuListenerAccessible()
{
if (mRegistered) {
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
if (eventReceiver)
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
}
}
NS_IMETHODIMP nsMenuListenerAccessible::PopupShowing(nsIDOMEvent* aEvent)
{
mOpen = PR_TRUE;
/* TBD send state change event */
return NS_OK;
}
NS_IMETHODIMP nsMenuListenerAccessible::PopupHiding(nsIDOMEvent* aEvent)
{
mOpen = PR_FALSE;
/* TBD send state change event */
return NS_OK;
}
NS_IMETHODIMP nsMenuListenerAccessible::Close(nsIDOMEvent* aEvent)
{
mOpen = PR_FALSE;
/* TBD send state change event */
return NS_OK;
}
void
nsMenuListenerAccessible::SetupMenuListener()
{
// if not already one, register ourselves as a popup listener
if (!mRegistered) {
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
if (!eventReceiver) {
return;
}
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
if (NS_FAILED(rv)) {
return;
}
mRegistered = PR_TRUE;
}
}

View File

@ -1,150 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsBaseWidgetAccessible_H_
#define _nsBaseWidgetAccessible_H_
#include "nsAccessible.h"
#include "nsCOMPtr.h"
#include "nsIContent.h"
#include "nsIDOMNode.h"
#include "nsIDOMXULListener.h"
/**
* This file contains a number of classes that are used as base
* classes for the different accessibility implementations of
* the HTML and XUL widget sets. --jgaunt
*/
/**
* Special Accessible that knows how to handle hit detection for flowing text
*/
class nsBlockAccessible : public nsAccessible
{
public:
nsBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
};
/**
* Special Accessible that just contains other accessible objects
* no actions, no name, no state, no value
*/
class nsContainerAccessible : public nsAccessible
{
public:
nsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
NS_IMETHOD GetAccName(nsAString& _retval);
};
/**
* Leaf version of DOM Accessible -- has no children
*/
class nsLeafAccessible : public nsAccessible
{
public:
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
};
/**
* A type of accessible for DOM nodes containing an href="" attribute.
* It knows how to report the state of the link ( traveled or not )
* and can activate ( click ) the link programmatically.
*/
class nsLinkableAccessible : public nsAccessible
{
public:
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
NS_IMETHOD AccTakeFocus();
NS_IMETHOD GetAccKeyboardShortcut(nsAString& _retval);
protected:
PRBool IsALink();
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
nsCOMPtr<nsIContent> mLinkContent;
PRBool mIsLinkVisited;
};
/*
* A base class that can listen to menu events. Its used by selects so the
* button and the window accessibles can change their name and role
* depending on whether the drop down list is dropped down on not
*/
class nsMenuListenerAccessible : public nsAccessible, public nsIDOMXULListener
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsMenuListenerAccessible();
// popup listener
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD Close(nsIDOMEvent* aEvent);
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
virtual void SetupMenuListener();
PRBool mRegistered;
PRBool mOpen;
};
#endif

View File

@ -1,247 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibilityService.h"
#include "nsCaretAccessible.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsICaret.h"
#include "nsISelectionController.h"
#include "nsIFrame.h"
#include "nsISelectionPrivate.h"
#include "nsIAccessibleEventListener.h"
#include "nsIViewManager.h"
#include "nsIWidget.h"
#include "nsIPresShell.h"
#include "nsTextAccessible.h"
NS_IMPL_ISUPPORTS_INHERITED2(nsCaretAccessible, nsLeafAccessible, nsIAccessibleCaret, nsISelectionListener)
nsCaretAccessible::nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsIAccessibleEventListener *aListener):
nsLeafAccessible(aDocumentNode, aShell), mVisible(PR_TRUE), mCurrentDOMNode(nsnull), mListener(aListener)
{
}
NS_IMETHODIMP nsCaretAccessible::RemoveSelectionListener()
{
nsCOMPtr<nsISelection> prevDomSel(do_QueryReferent(mDomSelectionWeak));
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(prevDomSel));
if (selPrivate) {
mDomSelectionWeak = nsnull;
return selPrivate->RemoveSelectionListener(this);
}
return NS_OK;
}
NS_IMETHODIMP nsCaretAccessible::AttachNewSelectionListener(nsIDOMNode *aCurrentNode)
{
mCurrentDOMNode = aCurrentNode;
// When focus moves such that the caret is part of a new frame selection
// this removes the old selection listener and attaches a new one for the current focus
nsCOMPtr<nsIDOMDocument> domDoc;
aCurrentNode->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
if (!doc) // we also should try to QI to document instead (necessary to do when node is a document)
doc = do_QueryInterface(aCurrentNode);
if (!doc)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresShell> presShell;
doc->GetShellAt(0, getter_AddRefs(presShell));
nsCOMPtr<nsIContent> content(do_QueryInterface(aCurrentNode));
if (!content)
doc->GetRootContent(getter_AddRefs(content)); // If node is not content, use root content
if (!presShell || !content)
return NS_ERROR_FAILURE;
nsIFrame *frame = nsnull;
presShell->GetPrimaryFrameFor(content, &frame);
nsCOMPtr<nsIPresContext> presContext;
presShell->GetPresContext(getter_AddRefs(presContext));
if (!frame || !presContext)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISelectionController> selCon;
frame->GetSelectionController(presContext, getter_AddRefs(selCon));
if (!selCon)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISelection> domSel, prevDomSel(do_QueryReferent(mDomSelectionWeak));
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
if (domSel == prevDomSel)
return NS_OK; // This is already the selection we're listening to
RemoveSelectionListener();
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(domSel));
if (!selPrivate)
return NS_ERROR_FAILURE;
mDomSelectionWeak = do_GetWeakReference(domSel);
return selPrivate->AddSelectionListener(this);
}
NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel, short aReason)
{
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDoc));
if (!doc)
return NS_OK;
nsCOMPtr<nsIPresShell> presShell;
doc->GetShellAt(0, getter_AddRefs(presShell));
nsCOMPtr<nsISelection> domSel(do_QueryReferent(mDomSelectionWeak));
if (!presShell || domSel != aSel)
return NS_OK; // Only listening to selection changes in currently focused frame
nsCOMPtr<nsICaret> caret;
presShell->GetCaret(getter_AddRefs(caret));
if (!caret)
return NS_OK;
nsRect caretRect;
PRBool isCollapsed;
caret->GetCaretCoordinates(nsICaret::eTopLevelWindowCoordinates, domSel, &caretRect, &isCollapsed, nsnull);
PRBool visible = (caretRect.x >= 0 && caretRect.y >= 0 && caretRect.width >= 0 && caretRect.height >= 0);
if (visible) // Make sure it's visible both by looking at coordinates and visible flag
caret->GetCaretVisible(&visible);
if (visible != mVisible) {
mVisible = visible;
mListener->HandleEvent(mVisible? nsIAccessibleEventListener::EVENT_SHOW: nsIAccessibleEventListener::EVENT_HIDE, this, nsnull);
}
nsCOMPtr<nsIPresContext> presContext;
presShell->GetPresContext(getter_AddRefs(presContext));
nsCOMPtr<nsIViewManager> viewManager;
presShell->GetViewManager(getter_AddRefs(viewManager));
if (!presContext || !viewManager)
return NS_OK;
nsIView *view = nsnull;
viewManager->GetRootView(view);
if (!view)
return NS_OK;
nsCOMPtr<nsIWidget> widget;
view->GetWidget(*getter_AddRefs(widget));
if (!widget)
return NS_OK;
float t2p;
presContext->GetTwipsToPixels(&t2p);
// Convert to pixels using that scale
caretRect.x = NSTwipsToIntPixels(caretRect.x, t2p);
caretRect.y = NSTwipsToIntPixels(caretRect.y, t2p);
caretRect.width = NSTwipsToIntPixels(caretRect.width, t2p);
caretRect.height = NSTwipsToIntPixels(caretRect.height, t2p);
nsRect caretScreenRect;
widget->WidgetToScreen(caretRect, mCaretRect);
#ifndef MOZ_ACCESSIBILITY_ATK
if (visible)
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_LOCATION_CHANGE, this, nsnull);
#else
nsCOMPtr<nsIDOMNode> focusNode;
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mCurrentDOMNode));
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mCurrentDOMNode));
if (inputElement || textArea)
focusNode = mCurrentDOMNode;
else
domSel->GetFocusNode(getter_AddRefs(focusNode));
if (!focusNode)
return NS_OK;
nsCOMPtr<nsIAccessible> accessible;
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
accService->GetAccessibleFor(focusNode, getter_AddRefs(accessible));
if (accessible) {
if (isCollapsed) {
PRInt32 caretOffset;
domSel->GetFocusOffset(&caretOffset);
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_ATK_TEXT_CARET_MOVE, accessible, (AccessibleEventData*)&caretOffset);
}
else
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_ATK_TEXT_SELECTION_CHANGE, accessible, nsnull);
}
#endif
return NS_OK;
}
/** Return the caret's bounds */
NS_IMETHODIMP nsCaretAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
if (!mVisible)
return NS_ERROR_FAILURE; // When root accessible hasn't yet called SetCaretBounds()
*x = mCaretRect.x;
*y = mCaretRect.y;
*width = mCaretRect.width;
*height = mCaretRect.height;
return NS_OK;
}
NS_IMETHODIMP nsCaretAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_CARET;
return NS_OK;
}
NS_IMETHODIMP nsCaretAccessible::GetAccState(PRUint32 *_retval)
{
*_retval = mVisible? 0: STATE_INVISIBLE;
return NS_OK;
}
NS_IMETHODIMP nsCaretAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsCaretAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsCaretAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}

View File

@ -1,88 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsCaretAccessible_h__
#define __nsCaretAccessible_h__
#include "nsAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "nsIWeakReference.h"
#include "nsIDOMNode.h"
#include "nsIAccessibleCaret.h"
#include "nsISelectionListener.h"
/*
* This special accessibility class is for the caret, which is really the currently focused selection.
* There is only 1 visible caret per top level window (nsRootAccessible)
* The caret accesible does not exist within the normal accessible tree; it lives in a different world.
* In MSAA, it is retrieved with via the WM_GETOBJECT message with lParam = OBJID_CARET,
* (as opposed to the root accessible tree for a window which is retrieved with OBJID_CLIENT)
* The caret accessible is owned by the nsRootAccessible for the top level window that it's in.
*/
class nsCaretAccessible : public nsLeafAccessible, public nsIAccessibleCaret, public nsISelectionListener
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsIAccessibleEventListener *aListener);
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
/* ----- nsIAccessibleCaret ------ */
NS_IMETHOD AttachNewSelectionListener(nsIDOMNode *aFocusedNode);
NS_IMETHOD RemoveSelectionListener();
/* ----- nsISelectionListener ---- */
NS_IMETHOD NotifySelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel, short aReason);
private:
nsRect mCaretRect;
PRBool mVisible;
nsCOMPtr<nsIDOMNode> mCurrentDOMNode;
// mListener is not a com pointer. It's a copy of the listener in the nsRootAccessible owner.
//See nsRootAccessible.h for details of the lifetime if this listener
nsIAccessibleEventListener *mListener;
nsCOMPtr<nsIWeakReference> mDomSelectionWeak;
};
#endif

View File

@ -1,180 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
* Aaron Leventhal (aaronl@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsFormControlAccessible.h"
#include "nsIDocument.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLLabelElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMXULButtonElement.h"
#include "nsIDOMXULCheckboxElement.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULLabelElement.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsReadableUtils.h"
#include "nsString.h"
/**
* nsFormControlAccessible
*/
nsFormControlAccessible::nsFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
/**
* XUL states: focused, unavailable(disabled), focusable, ?protected?
* HTML states: focused, unabailable(disabled), focusable, protected
*/
NS_IMETHODIMP nsFormControlAccessible::GetAccState(PRUint32 *_retval)
{
// Get the focused state from the nsAccessible
nsAccessible::GetAccState(_retval);
PRBool disabled = PR_FALSE;
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMHTMLInputElement> htmlFormElement(do_QueryInterface(mDOMNode, &rv));
if (NS_SUCCEEDED(rv) && htmlFormElement) {
htmlFormElement->GetDisabled(&disabled);
nsAutoString typeString;
htmlFormElement->GetType(typeString);
if (typeString.EqualsIgnoreCase("password"))
*_retval |= STATE_PROTECTED;
}
else {
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode, &rv));
if (NS_SUCCEEDED(rv) && xulFormElement) {
xulFormElement->GetDisabled(&disabled);
/* XXX jgaunt do XUL elements support password fields? */
}
}
if (disabled)
*_retval |= STATE_UNAVAILABLE;
else
*_retval |= STATE_FOCUSABLE;
return NS_OK;
}
/**
* Will be called by both HTML and XUL elements, this method
* merely checks who is calling and then calls the appropriate
* protected method for the XUL or HTML element.
*/
NS_IMETHODIMP nsFormControlAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMXULElement> xulFormElement(do_QueryInterface(mDOMNode));
if (xulFormElement)
return GetXULAccName(_retval);
else
return GetHTMLAccName(_retval);
}
/**
* No Children
*/
NS_IMETHODIMP nsFormControlAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsFormControlAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsFormControlAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 0;
return NS_OK;
}
// ------------
// Radio button
// ------------
nsRadioButtonAccessible::nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
}
/**
*
*/
NS_IMETHODIMP nsRadioButtonAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsRadioButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Click) {
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("select"), _retval);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/**
*
*/
NS_IMETHODIMP nsRadioButtonAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_RADIOBUTTON;
return NS_OK;
}

View File

@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Eric D Vaughan (evaughan@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsFormControlAccessible_H_
#define _nsFormControlAccessible_H_
#include "nsBaseWidgetAccessible.h"
/**
* This supports name and state information for both XUL and HTML
* widgets. Designed to be a base class for the impls of XUL
* and HTML form widget Accessibles
*/
class nsFormControlAccessible : public nsAccessible
{
public:
nsFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
};
/**
*
*/
class nsRadioButtonAccessible : public nsFormControlAccessible
{
public:
nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
};
#endif

View File

@ -1,254 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Eric Vaughan (evaughan@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGenericAccessible.h"
#include "nsCOMPtr.h"
#include "nsIWeakReference.h"
#include "nsReadableUtils.h"
#include "nsIContent.h"
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsGenericAccessible, nsIAccessible)
nsGenericAccessible::nsGenericAccessible()
{
NS_INIT_ISUPPORTS();
/* member initializers and constructor code */
}
nsGenericAccessible::~nsGenericAccessible()
{
/* destructor code */
}
/* nsIAccessible getAccParent (); */
NS_IMETHODIMP nsGenericAccessible::GetAccParent(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible getAccNextSibling (); */
NS_IMETHODIMP nsGenericAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible getAccPreviousSibling (); */
NS_IMETHODIMP nsGenericAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible getAccFirstChild (); */
NS_IMETHODIMP nsGenericAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible getAccLastChild (); */
NS_IMETHODIMP nsGenericAccessible::GetAccLastChild(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* long getAccChildCount (); */
NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getAccName (); */
NS_IMETHODIMP nsGenericAccessible::GetAccName(nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getAccValue (); */
NS_IMETHODIMP nsGenericAccessible::GetAccValue(nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute long accId; */
NS_IMETHODIMP nsGenericAccessible::GetAccId(PRInt32 *aAccId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setAccName (in DOMString name); */
NS_IMETHODIMP nsGenericAccessible::SetAccName(const nsAString& name)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getAccDescription (); */
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getAccKeyboardShortcut (); */
NS_IMETHODIMP nsGenericAccessible::GetAccKeyboardShortcut(nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long getAccRole (); */
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getAccState (); */
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* PRUint8 getAccNumActions (); */
NS_IMETHODIMP nsGenericAccessible::GetAccNumActions(PRUint8 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getAccActionName (in PRUint8 index); */
NS_IMETHODIMP nsGenericAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void accDoAction (in PRUint8 index); */
NS_IMETHODIMP nsGenericAccessible::AccDoAction(PRUint8 index)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible getAccFocused(); */
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getAccHelp (); */
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accGetAt (in long x, in long y); */
NS_IMETHODIMP nsGenericAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateRight (); */
NS_IMETHODIMP nsGenericAccessible::AccNavigateRight(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateLeft (); */
NS_IMETHODIMP nsGenericAccessible::AccNavigateLeft(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateUp (); */
NS_IMETHODIMP nsGenericAccessible::AccNavigateUp(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIAccessible accNavigateDown (); */
NS_IMETHODIMP nsGenericAccessible::AccNavigateDown(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void accGetBounds (out long x, out long y, out long width, out long height); */
NS_IMETHODIMP nsGenericAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void accAddSelection (); */
NS_IMETHODIMP nsGenericAccessible::AccAddSelection()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void accRemoveSelection (); */
NS_IMETHODIMP nsGenericAccessible::AccRemoveSelection()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void accExtendSelection (); */
NS_IMETHODIMP nsGenericAccessible::AccExtendSelection()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void accTakeSelection (); */
NS_IMETHODIMP nsGenericAccessible::AccTakeSelection()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void accTakeFocus (); */
NS_IMETHODIMP nsGenericAccessible::AccTakeFocus()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long getAccExtState (); */
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsGenericAccessible::AccGetDOMNode(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsGenericAccessible::CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -1,67 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Eric D Vaughan (evaughan@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsGenericAccessible_H_
#define _nsGenericAccessible_H_
#include "nsISupports.h"
#include "nsIAccessible.h"
#include "nsIContent.h"
#include "nsIDOMNode.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsCOMPtr.h"
#include "nsIWeakReference.h"
/**
* Basic implementation
* supports nothing
*/
class nsGenericAccessible : public nsIAccessible
{
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLE
public:
nsGenericAccessible();
virtual ~nsGenericAccessible();
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,173 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* 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 _nsRootAccessible_H_
#define _nsRootAccessible_H_
#include "nsAccessible.h"
#include "nsIAccessibleEventReceiver.h"
#include "nsIAccessibleEventListener.h"
#include "nsIAccessibleDocument.h"
#include "nsIDOMFormListener.h"
#include "nsIDOMXULListener.h"
#include "nsIDOMFocusListener.h"
#include "nsIDocument.h"
#include "nsIAccessibilityService.h"
#include "nsIWebProgressListener.h"
#include "nsIWeakReference.h"
#include "nsITimer.h"
#include "nsIWebProgress.h"
#include "nsIScrollPositionListener.h"
#include "nsIScrollableView.h"
#include "nsHashtable.h"
const PRInt32 SCROLL_HASH_START_SIZE = 6;
class nsDocAccessibleMixin
{
public:
nsDocAccessibleMixin(nsIDocument *doc);
nsDocAccessibleMixin(nsIWeakReference *aShell);
virtual ~nsDocAccessibleMixin();
NS_DECL_NSIACCESSIBLEDOCUMENT
protected:
NS_IMETHOD GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
nsCOMPtr<nsIDocument> mDocument;
};
class nsRootAccessible : public nsAccessible,
public nsDocAccessibleMixin,
public nsIAccessibleDocument,
public nsIAccessibleEventReceiver,
public nsIDOMFocusListener,
public nsIDOMFormListener,
public nsIDOMXULListener,
public nsIWebProgressListener,
public nsIScrollPositionListener,
public nsSupportsWeakReference
{
NS_DECL_ISUPPORTS_INHERITED
public:
enum EBusyState {eBusyStateUninitialized, eBusyStateLoading, eBusyStateDone};
nsRootAccessible(nsIWeakReference* aShell);
virtual ~nsRootAccessible();
/* attribute wstring accName; */
NS_IMETHOD GetAccName(nsAString& aAccName);
NS_IMETHOD GetAccValue(nsAString& aAccValue);
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
NS_IMETHOD GetAccState(PRUint32 *aAccState);
// ----- nsIAccessibleEventReceiver -------------------
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
NS_IMETHOD RemoveAccessibleEventListener();
// ----- nsIDOMEventListener --------------------------
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
// ----- nsIDOMFocusListener --------------------------
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
// ----- nsIDOMFormListener ---------------------------
NS_IMETHOD Submit(nsIDOMEvent* aEvent);
NS_IMETHOD Reset(nsIDOMEvent* aEvent);
NS_IMETHOD Change(nsIDOMEvent* aEvent);
NS_IMETHOD Select(nsIDOMEvent* aEvent);
NS_IMETHOD Input(nsIDOMEvent* aEvent);
// ----- nsIDOMXULListener ---------------------------
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent);
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent);
NS_IMETHOD Close(nsIDOMEvent* aEvent);
NS_IMETHOD Command(nsIDOMEvent* aEvent);
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent);
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent);
// ----- nsIScrollPositionListener ---------------------------
NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
NS_IMETHOD ScrollPositionDidChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
NS_DECL_NSIACCESSIBLEDOCUMENT
NS_DECL_NSIWEBPROGRESSLISTENER
protected:
NS_IMETHOD GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode);
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
virtual nsIFrame* GetFrame();
void FireAccessibleFocusEvent(nsIAccessible *focusAccessible, nsIDOMNode *focusNode);
void AddScrollListener(nsIPresShell *aPresShell);
void RemoveScrollListener(nsIPresShell *aPresShell);
void AddContentDocListeners();
void RemoveContentDocListeners();
void FireDocLoadFinished();
static void DocLoadCallback(nsITimer *aTimer, void *aClosure);
static void ScrollTimerCallback(nsITimer *aTimer, void *aClosure);
static PRUint32 gInstanceCount;
// mListener is not a com pointer. We don't own the listener
// it is the callers responsibility to remove the listener
// otherwise we will get into circular referencing problems
// We don't need a weak reference, because we're owned by this listener
nsIAccessibleEventListener *mListener;
static nsIDOMNode * gLastFocusedNode; // we do our own refcounting for this
nsCOMPtr<nsITimer> mScrollWatchTimer;
nsCOMPtr<nsITimer> mDocLoadTimer;
nsCOMPtr<nsIWebProgress> mWebProgress;
nsCOMPtr<nsIAccessibilityService> mAccService;
EBusyState mBusy;
PRPackedBool mIsNewDocument;
// Used for tracking scroll events
PRUint32 mScrollPositionChangedTicks;
nsCOMPtr<nsIAccessibleCaret> mCaretAccessible;
};
#endif

View File

@ -1,546 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
* Kyle Yuan (kyle.yuan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsFormControlAccessible.h"
#include "nsIAtom.h"
#include "nsIComboboxControlFrame.h"
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMText.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIFrame.h"
#include "nsIListControlFrame.h"
#include "nsISelectControlFrame.h"
#include "nsIServiceManager.h"
#include "nsLayoutAtoms.h"
#include "nsRootAccessible.h"
#include "nsSelectAccessible.h"
/** ------------------------------------------------------ */
/** First, the common widgets */
/** ------------------------------------------------------ */
/** Constructor -- cache our parent */
nsSelectListAccessible::nsSelectListAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/** Return our parents bounds */
NS_IMETHODIMP nsSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
return mParent->AccGetBounds(x,y,width,height);
}
/** Return our cached parent */
NS_IMETHODIMP nsSelectListAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_ADDREF(*_retval);
return NS_OK;
}
/** We are a list */
NS_IMETHODIMP nsSelectListAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LIST;
return NS_OK;
}
/** We are an only child */
NS_IMETHODIMP nsSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/** We are an only child */
NS_IMETHODIMP nsSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* nsSelectOptionAccessible
*/
/** Constructor -- cache our parent */
nsSelectOptionAccessible::nsSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsLeafAccessible(aDOMNode, aShell)
{
if (aParent)
mParent = aParent;
else {
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
nsCOMPtr<nsIDOMNode> parentNode, parentNode1;
nsCOMPtr<nsIAccessible> parentAccessible, lastChildAcc;
aDOMNode->GetParentNode(getter_AddRefs(parentNode));
if (parentNode) {
// this parent could be a Combobox or a ListBox. Each has a different
// was to get to the ListElement.
nsCOMPtr<nsIDOMHTMLOptGroupElement> optGroupElement(do_QueryInterface(parentNode));
if (optGroupElement) {
parentNode->GetParentNode(getter_AddRefs(parentNode1));
parentNode = parentNode1;
}
accService->GetAccessibleFor(parentNode, getter_AddRefs(parentAccessible));
PRUint32 role;
do {
parentAccessible->GetAccLastChild(getter_AddRefs(lastChildAcc));
if (lastChildAcc)
lastChildAcc->GetAccRole(&role);
parentAccessible = lastChildAcc;
} while (role != nsIAccessible::ROLE_LIST && lastChildAcc);
}
mParent = parentAccessible;
}
}
/** We are a ListItem */
NS_IMETHODIMP nsSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LISTITEM;
return NS_OK;
}
/** Return our cached parent */
NS_IMETHODIMP nsSelectOptionAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
* Get our Name from our Content's subtree
*/
NS_IMETHODIMP nsSelectOptionAccessible::GetAccName(nsAString& _retval)
{
// CASE #1 -- great majority of the cases
// find the label attribute - this is what the W3C says we should use
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
NS_ASSERTION(domElement, "No domElement for accessible DOM node!");
nsresult rv = domElement->GetAttribute(NS_LITERAL_STRING("label"), _retval) ;
if (NS_SUCCEEDED(rv) && !_retval.IsEmpty() ) {
return NS_OK;
}
// CASE #2 -- no label parameter, get the first child,
// use it if it is a text node
nsCOMPtr<nsIDOMNode> child;
mDOMNode->GetFirstChild(getter_AddRefs(child));
if (child) {
nsCOMPtr<nsIDOMText> text (do_QueryInterface(child));
if (text) {
nsCOMPtr<nsIContent> content (do_QueryInterface(child));
if (!content) {
return NS_ERROR_FAILURE;
}
nsAutoString txtValue;
rv = AppendFlatStringFromContentNode(content, &txtValue);
if (NS_SUCCEEDED(rv)) {
// Temp var (txtValue) needed until CompressWhitespace built for nsAString
txtValue.CompressWhitespace();
_retval.Assign(txtValue);
return NS_OK;
}
}
}
return NS_ERROR_FAILURE;
}
/** ----- nsComboboxTextFieldAccessible ----- */
/** Constructor */
nsComboboxTextFieldAccessible::nsComboboxTextFieldAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell):
nsLeafAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/**
* Currently gets the text from the first option, needs to check for selection
* and then return that text.
* Walks the Frame tree and checks for proper frames.
*/
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccValue(nsAString& _retval)
{
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsCOMPtr<nsIPresContext> context;
GetPresContext(context);
if (!frame || !context)
return NS_ERROR_FAILURE;
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return NS_ERROR_FAILURE;
#endif
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::textFrame))
return NS_ERROR_FAILURE;
#endif
nsCOMPtr<nsIContent> content;
frame->GetContent(getter_AddRefs(content));
if (!content)
return NS_ERROR_FAILURE;
AppendFlatStringFromSubtree(content, &_retval);
return NS_OK;
}
/**
* Gets the bounds for the BlockFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
{
// get our first child's frame
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsCOMPtr<nsIPresContext> context;
GetPresContext(context);
if (!frame || !context)
return;
frame->FirstChild(context, nsnull, aBoundingFrame);
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return;
#endif
frame->GetRect(aBounds);
}
/** Return our cached parent */
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
* We are the first child of our parent, no previous sibling
*/
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* Our role is currently only static text, but we should be able to have
* editable text here and we need to check that case.
*/
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_STATICTEXT;
return NS_OK;
}
/**
* As a nsComboboxTextFieldAccessible we can have the following states:
* STATE_READONLY
* STATE_FOCUSED
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsComboboxTextFieldAccessible::GetAccState(PRUint32 *_retval)
{
// Get focus status from base class
nsAccessible::GetAccState(_retval);
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
return NS_OK;
}
/** -----ComboboxButtonAccessible ----- */
/** Constructor -- cache our parent */
nsComboboxButtonAccessible::nsComboboxButtonAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell):
nsLeafAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/** Just one action ( click ). */
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
/**
* Gets the bounds for the gfxButtonControlFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
{
// get our second child's frame
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsCOMPtr<nsIPresContext> context;
GetPresContext(context);
if (!context)
return;
*aBoundingFrame = frame; // bounding frame is the ComboboxControlFrame
frame->FirstChild(context, nsnull, &frame); // first frame is for the textfield
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return;
#endif
frame->GetNextSibling(&frame); // sibling frame is for the button
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
return;
#endif
frame->GetRect(aBounds);
}
/** We are a button. */
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PUSHBUTTON;
return NS_OK;
}
/** Return our cached parent */
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
* Gets the name from GetAccActionName()
*/
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccName(nsAString& _retval)
{
return GetAccActionName(eAction_Click, _retval);
}
/**
* Our action name is the reverse of our state:
* if we are closed -> open is our name.
* if we are open -> closed is our name.
* Uses the frame to get the state, updated on every click
*/
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
PRBool isOpen = PR_FALSE;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame;
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame)
return NS_ERROR_FAILURE;
comboFrame->IsDroppedDown(&isOpen);
if (isOpen)
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("close"), _retval);
else
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("open"), _retval);
return NS_OK;
}
/**
* As a nsComboboxButtonAccessible we can have the following states:
* STATE_PRESSED
* STATE_FOCUSED
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsComboboxButtonAccessible::GetAccState(PRUint32 *_retval)
{
// Get focus status from base class
nsAccessible::GetAccState(_retval);
// we are open or closed --> pressed or not
PRBool isOpen = PR_FALSE;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame;
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame)
return NS_ERROR_FAILURE;
comboFrame->IsDroppedDown(&isOpen);
if (isOpen)
*_retval |= STATE_PRESSED;
*_retval |= STATE_FOCUSABLE;
return NS_OK;
}
/** ----- nsComboboxWindowAccessible ----- */
/**
* Constructor -- cache our parent
*/
nsComboboxWindowAccessible::nsComboboxWindowAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell):
nsAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/**
* As a nsComboboxWindowAccessible we can have the following states:
* STATE_FOCUSED
* STATE_FOCUSABLE
* STATE_INVISIBLE
* STATE_FLOATING
*/
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccState(PRUint32 *_retval)
{
// Get focus status from base class
nsAccessible::GetAccState(_retval);
// we are open or closed
PRBool isOpen = PR_FALSE;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame = nsnull;
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame)
return NS_ERROR_FAILURE;
comboFrame->IsDroppedDown(&isOpen);
if (! isOpen)
*_retval |= STATE_INVISIBLE;
*_retval |= STATE_FOCUSABLE | STATE_FLOATING;
return NS_OK;
}
/** We are a window */
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_WINDOW;
return NS_OK;
}
/** Return our cached parent */
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
* We are the last sibling of our parent.
*/
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* We only have one child, a list
*/
NS_IMETHODIMP nsComboboxWindowAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 1;
return NS_OK;
}
/**
* Gets the bounds for the areaFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
{
// get our first option
nsCOMPtr<nsIDOMNode> child;
mDOMNode->GetFirstChild(getter_AddRefs(child));
// now get its frame
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell) {
*aBoundingFrame = nsnull;
return;
}
nsIFrame* frame = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
shell->GetPrimaryFrameFor(content, &frame);
if (!frame) {
*aBoundingFrame = nsnull;
return;
}
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return;
#endif
frame->GetParent(aBoundingFrame);
frame->GetParent(&frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::areaFrame))
return;
#endif
frame->GetRect(aBounds);
}

View File

@ -1,175 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
* Kyle Yuan (kyle.yuan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsSelectAccessible_h__
#define __nsSelectAccessible_h__
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleSelectable.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMXULListener.h"
/** ------------------------------------------------------ */
/** First, the common widgets */
/** ------------------------------------------------------ */
enum { eSelection_Add=0, eSelection_Remove=1, eSelection_GetState=2 };
/**
* The list that contains all the options in the select.
*/
class nsSelectListAccessible : public nsAccessible
{
public:
nsSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsSelectListAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
/**
* Options inside the select, contained within the list
*/
class nsSelectOptionAccessible : public nsLeafAccessible
{
public:
nsSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsSelectOptionAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
/**
* A class the represents the text field in the Combobox to the left
* of the drop down button
*/
class nsComboboxTextFieldAccessible : public nsLeafAccessible
{
public:
nsComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsComboboxTextFieldAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
/**
* A class that represents the button inside the Select to the
* right of the text field
*/
class nsComboboxButtonAccessible : public nsLeafAccessible
{
public:
nsComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsComboboxButtonAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
/**
* A class that represents the window that lives to the right
* of the drop down button inside the Select. This is the window
* that is made visible when the button is pressed.
*/
class nsComboboxWindowAccessible : public nsAccessible
{
public:
nsComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsComboboxWindowAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
#endif

View File

@ -1,488 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
* Aaron Leventhal (aaronl@netscape.com)
* Kyle Yuan (kyle.yuan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsContentCID.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMRange.h"
#include "nsIFrame.h"
#include "nsITextContent.h"
#include "nsTextAccessible.h"
#include "nsTextFragment.h"
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
NS_IMPL_ISUPPORTS1(nsAccessibleText, nsIAccessibleText)
nsAccessibleText::nsAccessibleText()
{
NS_INIT_ISUPPORTS();
}
nsAccessibleText::~nsAccessibleText()
{
}
void nsAccessibleText::SetTextNode(nsIDOMNode *aNode)
{
mTextNode = aNode;
}
/**
* nsIAccessibleText impl.
*/
nsresult nsAccessibleText::GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel)
{
nsCOMPtr<nsIDOMDocument> domDoc;
mTextNode->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
if (!doc)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresShell> shell;
doc->GetShellAt(0, getter_AddRefs(shell));
if (!shell)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
nsCOMPtr<nsIContent> content(do_QueryInterface(mTextNode));
nsIFrame *frame = nsnull;
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
frame->GetSelectionController(context, aSelCon);
if (*aSelCon)
(*aSelCon)->GetSelection(nsISelectionController::SELECTION_NORMAL, aDomSel);
}
if (*aSelCon && *aDomSel)
return NS_OK;
return NS_ERROR_FAILURE;
}
/*
Gets the specified text.
aBoundaryType means:
ATK_TEXT_BOUNDARY_CHAR
The character before/at/after the offset is returned.
ATK_TEXT_BOUNDARY_WORD_START
The returned string is from the word start before/at/after the offset to the next word start.
ATK_TEXT_BOUNDARY_WORD_END
The returned string is from the word end before/at/after the offset to the next work end.
ATK_TEXT_BOUNDARY_SENTENCE_START
The returned string is from the sentence start before/at/after the offset to the next sentence start.
ATK_TEXT_BOUNDARY_SENTENCE_END
The returned string is from the sentence end before/at/after the offset to the next sentence end.
ATK_TEXT_BOUNDARY_LINE_START
The returned string is from the line start before/at/after the offset to the next line start.
ATK_TEXT_BOUNDARY_LINE_END
The returned string is from the line end before/at/after the offset to the next line start.
*/
nsresult nsAccessibleText::GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
if (!range)
return NS_ERROR_OUT_OF_MEMORY;
*aStartOffset = *aEndOffset = aOffset;
// Move caret position to offset
range->SetStart(mTextNode, aOffset);
range->SetEnd(mTextNode, aOffset);
domSel->RemoveAllRanges();
domSel->AddRange(range);
// Step1: move caret to an appropriate start position
// Step2: move caret to end postion and select the text
PRBool isStep1Forward, isStep2Forward; // Moving directions for two steps
switch (aType)
{
case eGetBefore:
isStep1Forward = PR_FALSE;
isStep2Forward = PR_FALSE;
break;
case eGetAt:
isStep1Forward = PR_FALSE;
isStep2Forward = PR_TRUE;
break;
case eGetAfter:
isStep1Forward = PR_TRUE;
isStep2Forward = PR_TRUE;
break;
default:
return NS_ERROR_INVALID_ARG;
}
switch (aBoundaryType)
{
case BOUNDARY_CHAR:
if (aType == eGetAfter) { // We need the character next to current position
selCon->CharacterMove(isStep1Forward, PR_FALSE);
domSel->GetFocusOffset(aStartOffset);
}
selCon->CharacterMove(isStep2Forward, PR_TRUE);
domSel->GetFocusOffset(aEndOffset);
break;
case BOUNDARY_WORD_START:
selCon->WordMove(isStep1Forward, PR_FALSE); // Move caret to previous/next word start boundary
domSel->GetFocusOffset(aStartOffset);
selCon->WordMove(isStep2Forward, PR_TRUE); // Select previous/next word
domSel->GetFocusOffset(aEndOffset);
break;
case BOUNDARY_LINE_START:
if (aType != eGetAt) { // We need adjust the caret position to previous/next line
selCon->LineMove(isStep1Forward, PR_TRUE);
domSel->GetFocusOffset(aEndOffset);
}
selCon->IntraLineMove(PR_FALSE, PR_FALSE); // Move caret to the line start
domSel->GetFocusOffset(aStartOffset);
selCon->IntraLineMove(PR_TRUE, PR_TRUE); // Move caret to the line end and select the whole line
domSel->GetFocusOffset(aEndOffset);
break;
case BOUNDARY_WORD_END:
case BOUNDARY_LINE_END:
case BOUNDARY_SENTENCE_START:
case BOUNDARY_SENTENCE_END:
case BOUNDARY_ATTRIBUTE_RANGE:
return NS_ERROR_NOT_IMPLEMENTED;
default:
return NS_ERROR_INVALID_ARG;
}
nsXPIDLString text;
// Get text from selection
domSel->ToString(getter_Copies(text));
domSel->RemoveAllRanges();
_retval = text;
// Ensure aStartOffset <= aEndOffset
if (*aStartOffset > *aEndOffset) {
PRInt32 tmp = *aStartOffset;
*aStartOffset = *aEndOffset;
*aEndOffset = tmp;
}
return NS_OK;
}
/*
* Gets the offset position of the caret (cursor).
*/
NS_IMETHODIMP nsAccessibleText::GetCaretOffset(PRInt32 *aCaretOffset)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
return domSel->GetFocusOffset(aCaretOffset);
}
/*
* Sets the caret (cursor) position to the specified offset.
*/
NS_IMETHODIMP nsAccessibleText::SetCaretOffset(PRInt32 aCaretOffset)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
if (! range)
return NS_ERROR_OUT_OF_MEMORY;
range->SetStart(mTextNode, aCaretOffset);
range->SetEnd(mTextNode, aCaretOffset);
return domSel->AddRange(range);
}
/*
* Gets the character count.
*/
NS_IMETHODIMP nsAccessibleText::GetCharacterCount(PRInt32 *aCharacterCount)
{
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mTextNode));
if (!textContent)
return NS_ERROR_FAILURE;
return textContent->GetTextLength(aCharacterCount);
}
/*
* Gets the number of selected regions.
*/
NS_IMETHODIMP nsAccessibleText::GetSelectionCount(PRInt32 *aSelectionCount)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
return domSel->GetRangeCount(aSelectionCount);
}
/*
* Gets the specified text.
*/
NS_IMETHODIMP nsAccessibleText::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset, nsAString & _retval)
{
nsAutoString text;
mTextNode->GetNodeValue(text);
_retval = Substring(text, aStartOffset, aEndOffset - aStartOffset);
return NS_OK;
}
NS_IMETHODIMP nsAccessibleText::GetTextBeforeOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
{
return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, _retval);
}
NS_IMETHODIMP nsAccessibleText::GetTextAtOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
{
return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, _retval);
}
NS_IMETHODIMP nsAccessibleText::GetTextAfterOffset(PRInt32 aOffset, nsAccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval)
{
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, _retval);
}
/*
* Gets the specified text.
*/
NS_IMETHODIMP nsAccessibleText::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *_retval)
{
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(mTextNode));
if (!textContent)
return NS_ERROR_FAILURE;
const nsTextFragment *textFrag;
textContent->GetText(&textFrag);
*_retval = textFrag->CharAt(aOffset);
return NS_OK;
}
NS_IMETHODIMP nsAccessibleText::GetAttributeRange(PRInt32 aOffset, PRInt32 *aRangeStartOffset, PRInt32 *aRangeEndOffset, nsISupports **_retval)
{
// will do better job later
return NS_ERROR_NOT_IMPLEMENTED;
}
/*
* Given an offset, the x, y, width, and height values are filled appropriately.
*/
NS_IMETHODIMP nsAccessibleText::GetCharacterExtents(PRInt32 aOffset, PRInt32 *aX, PRInt32 *aY, PRInt32 *aLength, PRInt32 *aWidth, nsAccessibleCoordType aCoordType)
{
// will do better job later
return NS_ERROR_NOT_IMPLEMENTED;
}
/*
* Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to
* the screen or this widget's window depending on coords.
*/
NS_IMETHODIMP nsAccessibleText::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, nsAccessibleCoordType aCoordType, PRInt32 *_retval)
{
// will do better job later
return NS_ERROR_NOT_IMPLEMENTED;
}
/*
* Gets the start and end offset of the specified selection.
*/
NS_IMETHODIMP nsAccessibleText::GetSelectionBounds(PRInt32 aSelectionNum, PRInt32 *aStartOffset, PRInt32 *aEndOffset)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
PRInt32 rangeCount;
domSel->GetRangeCount(&rangeCount);
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIDOMRange> range;
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
range->GetStartOffset(aStartOffset);
range->GetEndOffset(aEndOffset);
return NS_OK;
}
/*
* Changes the start and end offset of the specified selection.
*/
NS_IMETHODIMP nsAccessibleText::SetSelectionBounds(PRInt32 aSelectionNum, PRInt32 aStartOffset, PRInt32 aEndOffset)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
PRInt32 rangeCount;
domSel->GetRangeCount(&rangeCount);
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIDOMRange> range;
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
nsCOMPtr<nsIDOMNode> startParent;
nsCOMPtr<nsIDOMNode> endParent;
range->GetStartContainer(getter_AddRefs(startParent));
range->GetEndContainer(getter_AddRefs(endParent));
range->SetStart(startParent, aStartOffset);
range->SetEnd(endParent, aEndOffset);
return NS_OK;
}
/*
* Adds a selection bounded by the specified offsets.
*/
NS_IMETHODIMP nsAccessibleText::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
if (! range)
return NS_ERROR_OUT_OF_MEMORY;
range->SetStart(mTextNode, aStartOffset);
range->SetEnd(mTextNode, aEndOffset);
return domSel->AddRange(range);
}
/*
* Removes the specified selection.
*/
NS_IMETHODIMP nsAccessibleText::RemoveSelection(PRInt32 aSelectionNum)
{
nsCOMPtr<nsISelectionController> selCon;
nsCOMPtr<nsISelection> domSel;
if (NS_FAILED(GetSelections(getter_AddRefs(selCon), getter_AddRefs(domSel))))
return NS_ERROR_FAILURE;
PRInt32 rangeCount;
domSel->GetRangeCount(&rangeCount);
if (aSelectionNum < 0 || aSelectionNum >= rangeCount)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsIDOMRange> range;
domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
return domSel->RemoveRange(range);
}
// ------------
// Text Accessibles
// ------------
nsTextAccessible::nsTextAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsLinkableAccessible(aDOMNode, aShell)
{
SetTextNode(aDOMNode);
}
NS_IMPL_ISUPPORTS_INHERITED1(nsTextAccessible, nsLinkableAccessible, nsAccessibleText)
/**
* We are text
*/
NS_IMETHODIMP nsTextAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_TEXT;
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsTextAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsTextAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children
*/
NS_IMETHODIMP nsTextAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 0;
return NS_OK;
}

View File

@ -1,88 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Eric D Vaughan (evaughan@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsTextAccessible_H_
#define _nsTextAccessible_H_
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleText.h"
#include "nsISelectionController.h"
class nsAccessibleText : public nsIAccessibleText
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLETEXT
nsAccessibleText();
virtual ~nsAccessibleText();
void SetTextNode(nsIDOMNode *aNode);
private:
nsCOMPtr<nsIDOMNode> mTextNode;
enum EGetTextType { eGetBefore=-1, eGetAt=0, eGetAfter=1 };
nsresult GetSelections(nsISelectionController **aSelCon, nsISelection **aDomSel);
nsresult GetTextHelper(EGetTextType aType, nsAccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & _retval);
};
/**
* Text nodes have no children, but since double inheritance
* no-worky we have to re-impl the LeafAccessiblity blocks
* this way.
*/
class nsTextAccessible : public nsLinkableAccessible,
public nsAccessibleText
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
};
#endif

View File

@ -1,74 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): John Gaunt (jgaunt@netscape.com)
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
LIBRARY_NAME = accessibility_html_s
REQUIRES = \
appshell \
content \
docshell \
dom \
editor \
gfx \
htmlparser \
imglib2 \
intl \
layout \
locale \
necko \
plugin \
string \
uriloader \
view \
webshell \
widget \
xpcom \
$(NULL)
CPPSRCS = \
nsHTMLAreaAccessible.cpp \
nsHTMLFormControlAccessible.cpp \
nsHTMLIFrameRootAccessible.cpp \
nsHTMLImageAccessible.cpp \
nsHTMLLinkAccessible.cpp \
nsHTMLPluginAccessible.cpp \
nsHTMLSelectAccessible.cpp \
nsHTMLTableAccessible.cpp \
nsHTMLTextAccessible.cpp \
nsHTMLWin32ObjectAccessible.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \
-I$(srcdir)/../base \
-I$(srcdir)/../../../layout/html/base/src \
$(NULL)

View File

@ -1,205 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGenericAccessible.h"
#include "nsHTMLAreaAccessible.h"
#include "nsReadableUtils.h"
#include "nsString.h"
#include "nsAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIFrame.h"
#include "nsIImageFrame.h"
#include "nsIImageMap.h"
// --- area -----
nsHTMLAreaAccessible::nsHTMLAreaAccessible(nsIDOMNode *aDomNode, nsIAccessible *aAccParent, nsIWeakReference* aShell):
nsLinkableAccessible(aDomNode, aShell), mAccParent(aAccParent)
{
}
/* wstring getAccName (); */
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccName(nsAString & _retval)
{
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
if (elt) {
nsAutoString hrefString;
elt->GetAttribute(NS_LITERAL_STRING("title"), _retval);
if (_retval.IsEmpty())
GetAccValue(_retval);
}
return NS_OK;
}
/* unsigned long getAccRole (); */
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LINK;
return NS_OK;
}
/* wstring getAccDescription (); */
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccDescription(nsAString& _retval)
{
// Still to do - follow IE's standard here
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mDOMNode));
if (area)
area->GetShape(_retval);
return NS_OK;
}
/* nsIAccessible getAccFirstChild (); */
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/* nsIAccessible getAccLastChild (); */
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/* long getAccChildCount (); */
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 0;
return NS_OK;
}
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccParent(nsIAccessible * *aAccParent)
{
*aAccParent = mAccParent;
NS_IF_ADDREF(*aAccParent);
return NS_OK;
}
nsIAccessible *nsHTMLAreaAccessible::CreateAreaAccessible(nsIDOMNode *aDOMNode)
{
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
if (accService) {
nsIAccessible* acc = nsnull;
accService->CreateHTMLAreaAccessible(mPresShell, aDOMNode, mAccParent, &acc);
return acc;
}
return nsnull;
}
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
{
*aAccNextSibling = nsnull;
nsCOMPtr<nsIDOMNode> nextNode;
mDOMNode->GetNextSibling(getter_AddRefs(nextNode));
if (nextNode)
*aAccNextSibling = CreateAreaAccessible(nextNode);
return NS_OK;
}
/* readonly attribute nsIAccessible accPreviousSibling; */
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPrevSibling)
{
*aAccPrevSibling = nsnull;
nsCOMPtr<nsIDOMNode> prevNode;
mDOMNode->GetPreviousSibling(getter_AddRefs(prevNode));
if (prevNode)
*aAccPrevSibling = CreateAreaAccessible(prevNode);
return NS_OK;
}
/* void accGetBounds (out long x, out long y, out long width, out long height); */
NS_IMETHODIMP nsHTMLAreaAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
// Essentially this uses GetRect on mAreas of nsImageMap from nsImageFrame
*x = *y = *width = *height = 0;
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresContext> presContext;
presShell->GetPresContext(getter_AddRefs(presContext));
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
nsCOMPtr<nsIContent> ourContent(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(ourContent, NS_ERROR_FAILURE);
nsIFrame *frame = nsnull;
presShell->GetPrimaryFrameFor(ourContent, &frame);
nsIImageFrame *imageFrame;
nsresult rv = frame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIImageMap> map;
imageFrame->GetImageMap(presContext, getter_AddRefs(map));
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
nsRect rect, orgRectPixels, pageRectPixels;
rv = map->GetBoundsForAreaContent(ourContent, presContext, rect);
NS_ENSURE_SUCCESS(rv, rv);
// Convert from twips to pixels
float t2p;
presContext->GetTwipsToPixels(&t2p); // Get pixels conversion factor
*x = NSTwipsToIntPixels(rect.x, t2p);
*y = NSTwipsToIntPixels(rect.y, t2p);
// XXX aaronl not sure why we have to subtract the x,y from the width, height
// -- but it works perfectly!
*width = NSTwipsToIntPixels(rect.width, t2p) - *x;
*height = NSTwipsToIntPixels(rect.height, t2p) - *y;
// Put coords in absolute screen coords
GetScreenOrigin(presContext, frame, &orgRectPixels);
GetScrollOffset(&pageRectPixels);
*x += orgRectPixels.x - pageRectPixels.x;
*y += orgRectPixels.y - pageRectPixels.y;
return NS_OK;
}

View File

@ -1,70 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLAreaAccessible_H_
#define _nsHTMLAreaAccessible_H_
#include "nsBaseWidgetAccessible.h"
#include "nsAccessible.h"
/* Accessible for image map areas - must be child of image
*/
class nsHTMLAreaAccessible : public nsLinkableAccessible
{
public:
nsHTMLAreaAccessible(nsIDOMNode *domNode, nsIAccessible *accParent, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString & _retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
NS_IMETHOD GetAccNextSibling(nsIAccessible * *aAccNextSibling);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling);
NS_IMETHOD GetAccDescription(nsAString& _retval);
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
protected:
nsIAccessible *CreateAreaAccessible(nsIDOMNode *aDOMNode);
nsCOMPtr<nsIAccessible> mAccParent;
};
#endif

View File

@ -1,587 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Eric Vaughan (evaughan@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsAccessible.h"
#include "nsFormControlAccessible.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLFormControlAccessible.h"
#include "nsIClipboard.h"
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNSHTMLButtonElement.h"
#include "nsIDOMHTMLLabelElement.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMXULCheckboxElement.h"
#include "nsIDOMXULButtonElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIEditor.h"
#include "nsIEventStateManager.h"
#include "nsIFrame.h"
#include "nsITextControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPlaintextEditor.h"
#include "nsISelectionController.h"
#include "nsReadableUtils.h"
#include "nsWeakReference.h"
// --- checkbox -----
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_CHECKBUTTON;
return NS_OK;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Click) { // 0 is the magic value for default action
// check or uncheck
PRUint32 state;
GetAccState(&state);
if (state & STATE_CHECKED)
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("uncheck"), _retval);
else
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("check"), _retval);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index)
{
if (index == 0) { // 0 is the magic value for default action
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement(do_QueryInterface(mDOMNode));
if (htmlCheckboxElement) {
htmlCheckboxElement->Click();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccState(PRUint32 *_retval)
{
nsFormControlAccessible::GetAccState(_retval);
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement(do_QueryInterface(mDOMNode));
if (htmlCheckboxElement)
htmlCheckboxElement->GetChecked(&checked);
if (checked)
*_retval |= STATE_CHECKED;
return NS_OK;
}
//------ Radio button -------
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsRadioButtonAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoAction(PRUint8 index)
{
if (index == eAction_Click) {
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
if (element) {
element->Click();
return NS_OK;
}
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccState(PRUint32 *_retval)
{
nsFormControlAccessible::GetAccState(_retval);
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
nsCOMPtr<nsIDOMHTMLInputElement> htmlRadioElement(do_QueryInterface(mDOMNode));
if (htmlRadioElement)
htmlRadioElement->GetChecked(&checked);
if (checked)
*_retval |= STATE_CHECKED;
return NS_OK;
}
// ----- Button -----
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Click) {
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoAction(PRUint8 index)
{
if (index == eAction_Click) {
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
if (element) {
element->Click();
return NS_OK;
}
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccState(PRUint32 *_retval)
{
nsFormControlAccessible::GetAccState(_retval);
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No nsIDOMElement for button node!");
nsAutoString buttonType;
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
if (buttonType.EqualsIgnoreCase("submit"))
*_retval |= STATE_DEFAULT;
return NS_OK;
}
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PUSHBUTTON;
return NS_OK;
}
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMHTMLInputElement> button(do_QueryInterface(mDOMNode));
if (!button)
return NS_ERROR_FAILURE;
nsAutoString name;
button->GetValue(name);
name.CompressWhitespace();
if (name.IsEmpty()) {
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
elt->GetAttribute(NS_LITERAL_STRING("title"), name);
}
_retval.Assign(name);
return NS_OK;
}
// ----- HTML 4 Button: can contain arbitrary HTML content -----
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsLeafAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;;
}
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Click) {
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTML4ButtonAccessible::AccDoAction(PRUint8 index)
{
if (index == 0) {
nsCOMPtr<nsIDOMNSHTMLButtonElement> buttonElement(do_QueryInterface(mDOMNode));
if ( buttonElement )
{
buttonElement->Click();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PUSHBUTTON;
return NS_OK;
}
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccState(PRUint32 *_retval)
{
nsAccessible::GetAccState(_retval);
*_retval |= STATE_FOCUSABLE;
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No nsIDOMElement for button node!");
nsAutoString buttonType;
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
if (buttonType.EqualsIgnoreCase("submit"))
*_retval |= STATE_DEFAULT;
return NS_OK;
}
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAString& _retval)
{
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsAutoString name;
if (content)
rv = AppendFlatStringFromSubtree(content, &name);
if (NS_SUCCEEDED(rv)) {
// Temp var needed until CompressWhitespace built for nsAString
name.CompressWhitespace();
_retval.Assign(name);
}
return rv;
}
// --- textfield -----
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
// In nsHTMLTextFieldAccessible, mDOMNode is a nsHTMLInputElement. But we need
// a *true* text node(nsTextNode) for the text operation. It's the first child
// of our editor's root element
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell)
return;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsIFrame *frame = nsnull;
shell->GetPrimaryFrameFor(content, &frame);
nsITextControlFrame *tframe = nsnull;
frame->QueryInterface(NS_GET_IID(nsITextControlFrame), (void**)&tframe);
if (!tframe)
return;
nsCOMPtr<nsIEditor> editor;
tframe->GetEditor(getter_AddRefs(editor));
if (!editor)
return;
nsCOMPtr<nsIDOMElement> rootElement;
editor->GetRootElement(getter_AddRefs(rootElement));
nsCOMPtr<nsIDOMNode> rootNode(do_QueryInterface(rootElement));
if (rootNode) {
nsCOMPtr<nsIDOMNode> domNode;
rootNode->GetFirstChild(getter_AddRefs(domNode));
SetTextNode(domNode);
}
}
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessible, nsFormControlAccessible, nsIAccessibleEditableText, nsAccessibleText)
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_TEXT;
return NS_OK;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAString& _retval)
{
PRUint32 state;
GetAccState(&state);
if (state & STATE_PROTECTED) // Don't return password text!
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
if (textArea) {
textArea->GetValue(_retval);
return NS_OK;
}
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
if (inputElement) {
inputElement->GetValue(_retval);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
{
// can be
// focusable, focused, protected. readonly, unavailable, selected
nsAccessible::GetAccState(_retval);
*_retval |= STATE_FOCUSABLE;
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
PRBool isReadOnly = PR_FALSE;
elt->HasAttribute(NS_LITERAL_STRING("readonly"), &isReadOnly);
if (isReadOnly)
*_retval |= STATE_READONLY;
// Get current selection and find out if current node is in it
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsIFrame *frame = nsnull;
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
nsCOMPtr<nsISelectionController> selCon;
frame->GetSelectionController(context,getter_AddRefs(selCon));
if (selCon) {
nsCOMPtr<nsISelection> domSel;
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
if (domSel) {
PRBool isCollapsed = PR_TRUE;
domSel->GetIsCollapsed(&isCollapsed);
if (!isCollapsed)
*_retval |=STATE_SELECTED;
}
}
}
if (!textArea) {
if (inputElement) {
/////// ====== Must be a password field, so it uses nsIDOMHTMLFormControl ==== ///////
PRUint32 moreStates = 0;
nsresult rv = nsFormControlAccessible::GetAccState(&moreStates);
*_retval |= moreStates;
return rv;
}
return NS_ERROR_FAILURE;
}
PRBool disabled = PR_FALSE;
textArea->GetDisabled(&disabled);
if (disabled)
*_retval |= STATE_UNAVAILABLE;
return NS_OK;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos, nsISupports *aAttributes)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::SetTextContents(const nsAString &aText)
{
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
if (textArea)
return textArea->SetValue(aText);
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
if (inputElement)
return inputElement->SetValue(aText);
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::MakeSelection(PRInt32 aStartPos, PRInt32 aEndPos, nsIEditor **aEditor)
{
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell)
return NS_ERROR_FAILURE;
AccTakeFocus();
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsIFrame *frame = nsnull;
shell->GetPrimaryFrameFor(content, &frame);
nsITextControlFrame *tframe = nsnull;
frame->QueryInterface(NS_GET_IID(nsITextControlFrame), (void**)&tframe);
if (!tframe)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIEditor> editor;
tframe->SetSelectionRange(aStartPos, aEndPos);
tframe->GetEditor(getter_AddRefs(editor));
if (!editor)
return NS_ERROR_FAILURE;
*aEditor = editor;
NS_ADDREF(*aEditor);
return NS_OK;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::InsertText(const nsAString &aText, PRInt32 aPosition)
{
nsCOMPtr<nsIEditor> editor;
if (NS_SUCCEEDED(MakeSelection(aPosition, aPosition, getter_AddRefs(editor)))) {
nsCOMPtr<nsIPlaintextEditor> peditor(do_QueryInterface(editor));
peditor->InsertText(aText);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
{
nsCOMPtr<nsIEditor> editor;
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
editor->Copy();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
{
nsCOMPtr<nsIEditor> editor;
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
editor->Cut();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
{
nsCOMPtr<nsIEditor> editor;
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
editor->DeleteSelection(nsIEditor::eNone);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::PasteText(PRInt32 aPosition)
{
nsCOMPtr<nsIEditor> editor;
if (NS_SUCCEEDED(MakeSelection(aPosition, aPosition, getter_AddRefs(editor)))) {
editor->Paste(nsIClipboard::kGlobalClipboard);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
// --- groupbox -----
/*
* The HTML for this is <fieldset> <legend>box-title</legend> form elements </fieldset>
*/
nsHTMLGroupboxAccessible::nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_GROUPING;
return NS_OK;
}
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccState(PRUint32 *_retval)
{
// Groupbox doesn't support any states!
*_retval = 0;
return NS_OK;
}
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
if (element) {
nsCOMPtr<nsIDOMNodeList> legends;
element->GetElementsByTagName(NS_LITERAL_STRING("legend"), getter_AddRefs(legends));
if (legends) {
nsCOMPtr<nsIDOMNode> legendNode;
legends->Item(0, getter_AddRefs(legendNode));
nsCOMPtr<nsIContent> legendContent(do_QueryInterface(legendNode));
if (legendContent) {
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
return AppendFlatStringFromSubtree(legendContent, &_retval);
}
}
}
return NS_OK;
}

View File

@ -1,125 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Eric D Vaughan (evaughan@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLFormControlAccessible_H_
#define _nsHTMLFormControlAccessible_H_
#include "nsBaseWidgetAccessible.h"
#include "nsFormControlAccessible.h"
#include "nsIAccessibleEditableText.h"
#include "nsTextAccessible.h"
class nsICheckboxControlFrame;
class nsHTMLCheckboxAccessible : public nsFormControlAccessible
{
public:
nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
{
public:
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
class nsHTMLButtonAccessible : public nsFormControlAccessible
{
public:
nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
};
class nsHTML4ButtonAccessible : public nsLeafAccessible
{
public:
nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
};
class nsIEditor;
class nsHTMLTextFieldAccessible : public nsFormControlAccessible,
public nsIAccessibleEditableText,
public nsAccessibleText
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEEDITABLETEXT
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
protected:
NS_IMETHOD MakeSelection(PRInt32 aStartPos, PRInt32 aEndPos, nsIEditor **aEditor);
};
class nsHTMLGroupboxAccessible : public nsAccessible
{
public:
nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
};
#endif

View File

@ -1,431 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* 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 "nsHTMLIFrameRootAccessible.h"
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIDOMDocument.h"
#include "nsReadableUtils.h"
NS_INTERFACE_MAP_BEGIN(nsHTMLIFrameRootAccessible)
NS_INTERFACE_MAP_END_INHERITING(nsRootAccessible)
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLIFrameAccessible, nsBlockAccessible, nsIAccessibleDocument, nsIAccessibleHyperText, nsIAccessibleEventReceiver)
nsHTMLIFrameAccessible::nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *aDoc):
nsBlockAccessible(aNode, aShell), nsDocAccessibleMixin(aDoc), mRootAccessible(aRoot)
{
}
/* attribute wstring accName; */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAString& aAccName)
{
return GetTitle(aAccName);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAString& aAccValue)
{
return GetURL(aAccValue);
}
/* nsIAccessible getAccFirstChild (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
return mRootAccessible->GetAccFirstChild(_retval);
}
/* nsIAccessible getAccLastChild (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccLastChild(nsIAccessible **_retval)
{
return mRootAccessible->GetAccLastChild(_retval);
}
/* long getAccChildCount (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccChildCount(PRInt32 *_retval)
{
return mRootAccessible->GetAccChildCount(_retval);
}
/* unsigned long getAccRole (); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PANE;
return NS_OK;
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccState(PRUint32 *aAccState)
{
return nsAccessible::GetAccState(aAccState);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetURL(nsAString& aURL)
{
return nsDocAccessibleMixin::GetURL(aURL);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetTitle(nsAString& aTitle)
{
return nsDocAccessibleMixin::GetTitle(aTitle);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetMimeType(nsAString& aMimeType)
{
return nsDocAccessibleMixin::GetMimeType(aMimeType);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocType(nsAString& aDocType)
{
return nsDocAccessibleMixin::GetDocType(aDocType);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAString& aNameSpaceURI)
{
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocument(nsIDocument **doc)
{
return nsDocAccessibleMixin::GetDocument(doc);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::GetCaretAccessible(nsIAccessibleCaret **aCaretAccessible)
{
// Caret only owned by top level window's document
*aCaretAccessible = nsnull;
return NS_OK;
}
// ------- nsIAccessibleHyperText ---------------
/* readonly attribute long links; */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetLinks(PRInt32 *aLinks)
{
*aLinks = GetLinksFromAccNode(this);
return NS_OK;
}
/* nsIAccessibleHyperLink getLink (in long index); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetLink(PRInt32 aIndex,
nsIAccessibleHyperLink **_retval)
{
return GetLinkFromAccNode(aIndex, this, _retval);
}
/* long getLinkIndex (in long charIndex); */
NS_IMETHODIMP nsHTMLIFrameAccessible::GetLinkIndex(PRInt32 aCharIndex,
PRInt32 *_retval)
{
return GetLinkIndexFromAccNode(this, aCharIndex, _retval);
}
//helper function for nsIAccessibleHyperText
PRBool nsHTMLIFrameAccessible::IsHyperLink(nsIAccessible *aAccNode)
{
nsCOMPtr<nsIAccessibleHyperLink> hyperlink(do_QueryInterface(aAccNode));
return hyperlink? PR_TRUE: PR_FALSE;
}
PRInt32 nsHTMLIFrameAccessible::GetLinksFromAccNode(nsIAccessible *aAccNode)
{
PRInt32 rv = IsHyperLink(aAccNode) ? 1 : 0;
// Here, all the links of accChild should be summed up
nsCOMPtr<nsIAccessible> childa;
nsCOMPtr<nsIAccessible> child;
aAccNode->GetAccFirstChild(getter_AddRefs(child));
while (child) {
rv += GetLinksFromAccNode(child);
child->GetAccNextSibling(getter_AddRefs(childa));
child = childa;
}
//end for summing up accChildren's links
return rv;
}
nsresult nsHTMLIFrameAccessible::GetLinkFromAccNode(PRInt32 aIndex,
nsIAccessible *aAccNode,
nsIAccessibleHyperLink **_retval)
{
PRInt32 links;
//firstly, to see whether beginning node is a hyperlink
links = 0;
if (aIndex < 0) {
//of course, the aIndex is not right.
*_retval = nsnull;
return NS_ERROR_INVALID_ARG;
}
if (IsHyperLink(aAccNode)) {
links = 1;
if (0 == aIndex) {
return CallQueryInterface(aAccNode, _retval);
}
}
//navigate all accChildren to getLink for the aIndex
nsCOMPtr<nsIAccessible> child;
nsCOMPtr<nsIAccessible> childa;
aIndex = aIndex - links;
aAccNode->GetAccFirstChild(getter_AddRefs(child));
while (child) {
links = GetLinksFromAccNode(child);
if (aIndex < links) {
return GetLinkFromAccNode(aIndex, child, _retval);
}
aIndex -= links;
child->GetAccNextSibling(getter_AddRefs(childa));
child = childa;
}
//end of navigate accChild
*_retval = nsnull;
return NS_ERROR_INVALID_ARG;
}
PRInt32 nsHTMLIFrameAccessible::GetAccNodeCharLength(nsIAccessible *aAccNode)
{
PRUint32 role;
PRInt32 childCharLength;
nsAutoString tempAccName;
PRInt32 rv = 0;
role = ROLE_NOTHING;
aAccNode->GetAccRole(&role);
//ROLE_TEXT
if (ROLE_TEXT == role) {
aAccNode->GetAccName(tempAccName);
rv = tempAccName.Length();
}
//sum up the number all accChildren's characters
nsCOMPtr<nsIAccessible> childa;
nsCOMPtr<nsIAccessible> child;
aAccNode->GetAccFirstChild(getter_AddRefs(child));
while (child) {
childCharLength = GetAccNodeCharLength(child);
rv += childCharLength;
child->GetAccNextSibling(getter_AddRefs(childa));
child = childa;
}
return rv;
}
// *_retval is zero-based index, so -1 for no index.
// be careful, charIndex is zero-index, but length is not.
nsresult nsHTMLIFrameAccessible::GetLinkIndexFromAccNode(nsIAccessible *aAccNode,
PRInt32 aCharIndex,
PRInt32 *_retval)
{
nsresult rv;
PRUint32 role;
nsAutoString tempAccName;
PRInt32 charLength;
PRInt32 links;
*_retval = -1;
links = 0;
charLength = 0;
role = ROLE_NOTHING;
aAccNode->GetAccRole(&role);
// if the beginning node is hyperlink
if (IsHyperLink(aAccNode)) {
charLength = GetAccNodeCharLength(aAccNode);
if (aCharIndex < charLength) {
*_retval = 0;
return NS_OK;
}
*_retval = -1;
return NS_OK;
}
//begin to count char length
if (ROLE_TEXT == role) {
aAccNode->GetAccName(tempAccName);
charLength = tempAccName.Length();
if (aCharIndex < charLength) {
*_retval = -1;
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
if (IsHyperLink(aAccNode)) {
links = 1;
}
//exam the beginning node end
//getLinkIndex from accChildren
nsCOMPtr<nsIAccessible> childa;
nsCOMPtr<nsIAccessible> child;
PRInt32 childCharLength;
PRInt32 childLinks;
aAccNode->GetAccFirstChild(getter_AddRefs(child));
while (child) {
childCharLength = GetAccNodeCharLength(child);
if (aCharIndex < charLength + childCharLength) {
rv = GetLinkIndexFromAccNode(child, aCharIndex - charLength, _retval);
*_retval += links;
return rv;
}
charLength += childCharLength;
childLinks = GetLinksFromAccNode(child);
links += childLinks;
child->GetAccNextSibling(getter_AddRefs(childa));
child = childa;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsHTMLIFrameAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
{
nsCOMPtr<nsIAccessibleEventReceiver> rootReceiver(do_QueryInterface(mRootAccessible));
NS_ENSURE_TRUE(rootReceiver, NS_OK);
return rootReceiver->AddAccessibleEventListener(aListener);
}
NS_IMETHODIMP nsHTMLIFrameAccessible::RemoveAccessibleEventListener()
{
nsCOMPtr<nsIAccessibleEventReceiver> rootReceiver(do_QueryInterface(mRootAccessible));
NS_ENSURE_TRUE(rootReceiver, NS_OK);
return rootReceiver->RemoveAccessibleEventListener();
}
//=============================//
// nsHTMLIFrameRootAccessible //
//=============================//
//-----------------------------------------------------
// construction
//-----------------------------------------------------
nsHTMLIFrameRootAccessible::nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsRootAccessible(aShell), mOuterNode(aNode)
{
}
//-----------------------------------------------------
// destruction
//-----------------------------------------------------
nsHTMLIFrameRootAccessible::~nsHTMLIFrameRootAccessible()
{
}
void nsHTMLIFrameRootAccessible::Init()
{
nsCOMPtr<nsIDOMDocument> domDoc;
mOuterNode->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
if (doc) {
nsCOMPtr<nsIPresShell> parentShell;
doc->GetShellAt(0, getter_AddRefs(parentShell));
if (parentShell) {
nsCOMPtr<nsIContent> content(do_QueryInterface(mOuterNode));
nsIFrame* frame = nsnull;
parentShell->GetPrimaryFrameFor(content, &frame);
NS_ASSERTION(frame, "No outer frame.");
if (!frame)
return;
frame->GetAccessible(getter_AddRefs(mOuterAccessible));
NS_ASSERTION(mOuterAccessible, "Something's wrong - there's no accessible for the outer parent of this frame.");
}
}
}
void nsHTMLIFrameRootAccessible::Init(nsIAccessible *aOuterAccessible)
{
if (aOuterAccessible) {
mOuterAccessible = aOuterAccessible;
}
}
/* readonly attribute nsIAccessible accParent; */
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccParent(nsIAccessible **_retval)
{
if (!mOuterAccessible)
Init();
return mOuterAccessible->GetAccParent(_retval);
}
/* nsIAccessible getAccNextSibling (); */
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
if (!mOuterAccessible)
Init();
return mOuterAccessible->GetAccNextSibling(_retval);
}
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
if (!mOuterAccessible)
Init();
return mOuterAccessible->GetAccPreviousSibling(_retval);
}
/* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */
NS_IMETHODIMP nsHTMLIFrameRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
{
NS_ASSERTION(aListener, "Trying to add a null listener!");
if (!mListener) {
mListener = aListener;
AddContentDocListeners();
}
return NS_OK;
}
/* void removeAccessibleEventListener (); */
NS_IMETHODIMP nsHTMLIFrameRootAccessible::RemoveAccessibleEventListener()
{
if (mListener) {
RemoveContentDocListeners();
mListener = nsnull;
}
return NS_OK;
}

View File

@ -1,127 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* 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 _nsIFrameRootAccessible_H_
#define _nsIFrameRootAccessible_H_
#include "nsBaseWidgetAccessible.h"
#include "nsRootAccessible.h"
#include "nsAccessible.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleHyperText.h"
#include "nsIAccessibleEventReceiver.h"
class nsIWebShell;
class nsIWeakReference;
class nsHTMLIFrameAccessible : public nsBlockAccessible,
public nsIAccessibleDocument,
public nsIAccessibleHyperText,
public nsIAccessibleEventReceiver,
public nsDocAccessibleMixin
{
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEDOCUMENT
NS_DECL_NSIACCESSIBLEHYPERTEXT
public:
nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *doc);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccName(nsAString& aAccName);
NS_IMETHOD GetAccValue(nsAString& AccValue);
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
NS_IMETHOD GetAccState(PRUint32 *aAccState);
// ----- nsIAccessibleEventReceiver -------------------
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
NS_IMETHOD RemoveAccessibleEventListener();
protected:
nsCOMPtr<nsIAccessible> mRootAccessible;
//helper function for nsIAccessibleHyperText
PRBool IsHyperLink(nsIAccessible *aAccNode);
PRInt32 GetLinksFromAccNode(nsIAccessible *aAccNode);
nsresult GetLinkFromAccNode(PRInt32 aIndex, nsIAccessible *aAccNode,
nsIAccessibleHyperLink **_retval);
PRInt32 GetAccNodeCharLength(nsIAccessible *aAccNode);
nsresult GetLinkIndexFromAccNode(nsIAccessible *aAccNode,
PRInt32 aCharIndex, PRInt32 *_retval);
};
class nsHTMLIFrameRootAccessible : public nsRootAccessible
{
NS_DECL_ISUPPORTS_INHERITED
public:
nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
virtual ~nsHTMLIFrameRootAccessible();
/* attribute wstring accName; */
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
/* nsIAccessible getAccNextSibling (); */
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
/* nsIAccessible getAccPreviousSibling (); */
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
// ----- nsIAccessibleEventReceiver -------------------
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
NS_IMETHOD RemoveAccessibleEventListener();
protected:
void Init();
public:
void Init(nsIAccessible *aOuterAccessible);
// In these variable names, "outer" relates to the nsHTMLIFrameAccessible, as opposed to the
// nsHTMLIFrameRootAccessible which is "inner".
// The outer node is a <browser> or <iframe> tag, whereas the inner node corresponds to the inner document root.
nsCOMPtr<nsIDOMNode> mOuterNode;
nsCOMPtr<nsIAccessible> mOuterAccessible;
};
#endif

View File

@ -1,277 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGenericAccessible.h"
#include "nsHTMLImageAccessible.h"
#include "nsReadableUtils.h"
#include "nsAccessible.h"
#include "nsIHTMLDocument.h"
#include "nsIDocument.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "nsIImageFrame.h"
#include "nsNetUtil.h"
// --- image -----
nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsLinkableAccessible(aDOMNode, aShell)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode));
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell)
return;
shell->GetDocument(getter_AddRefs(doc));
nsAutoString mapElementName;
if (doc && element) {
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
element->GetAttribute(NS_LITERAL_STRING("usemap"),mapElementName);
if (htmlDoc && !mapElementName.IsEmpty()) {
if (mapElementName.CharAt(0) == '#')
mapElementName.Cut(0,1);
htmlDoc->GetImageMap(mapElementName, getter_AddRefs(mMapElement));
}
}
}
NS_IMETHODIMP nsHTMLImageAccessible::GetAccState(PRUint32 *_retval)
{
// The state is a bitfield, get our inherited state, then logically OR it with STATE_ANIMATED if this
// is an animated image.
nsLinkableAccessible::GetAccState(_retval);
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
nsIFrame *frame = nsnull;
if (content && shell)
shell->GetPrimaryFrameFor(content, &frame);
nsIImageFrame *imageFrame = nsnull;
frame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
nsCOMPtr<imgIRequest> imageRequest;
if (imageFrame)
imageFrame->GetImageRequest(getter_AddRefs(imageRequest));
nsCOMPtr<imgIContainer> imgContainer;
if (imageRequest)
imageRequest->GetImage(getter_AddRefs(imgContainer));
if (imgContainer) {
PRUint32 numFrames;
imgContainer->GetNumFrames(&numFrames);
if (numFrames > 1)
*_retval |= STATE_ANIMATED;
}
return NS_OK;
}
/* wstring getAccName (); */
NS_IMETHODIMP nsHTMLImageAccessible::GetAccName(nsAString& _retval)
{
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> imageContent(do_QueryInterface(mDOMNode));
if (imageContent) {
nsAutoString name;
rv = AppendFlatStringFromContentNode(imageContent, &name);
if (NS_SUCCEEDED(rv)) {
// Temp var needed until CompressWhitespace built for nsAString
name.CompressWhitespace();
_retval.Assign(name);
}
}
return rv;
}
/* wstring getAccRole (); */
NS_IMETHODIMP nsHTMLImageAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_GRAPHIC;
return NS_OK;
}
nsIAccessible *nsHTMLImageAccessible::CreateAreaAccessible(PRUint32 areaNum)
{
if (!mMapElement)
return nsnull;
if (areaNum == -1) {
PRInt32 numAreaMaps;
GetAccChildCount(&numAreaMaps);
if (numAreaMaps<=0)
return nsnull;
areaNum = NS_STATIC_CAST(PRUint32,numAreaMaps-1);
}
nsCOMPtr<nsIDOMHTMLCollection> mapAreas;
mMapElement->GetAreas(getter_AddRefs(mapAreas));
if (!mapAreas)
return nsnull;
nsCOMPtr<nsIDOMNode> domNode;
mapAreas->Item(areaNum,getter_AddRefs(domNode));
if (!domNode)
return nsnull;
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
if (!accService)
return nsnull;
if (accService) {
nsIAccessible* acc = nsnull;
accService->CreateHTMLAreaAccessible(mPresShell, domNode, this, &acc);
return acc;
}
return nsnull;
}
/* nsIAccessible getAccFirstChild (); */
NS_IMETHODIMP nsHTMLImageAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = CreateAreaAccessible(0);
return NS_OK;
}
/* nsIAccessible getAccLastChild (); */
NS_IMETHODIMP nsHTMLImageAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = CreateAreaAccessible(-1);
return NS_OK;
}
/* long getAccChildCount (); */
NS_IMETHODIMP nsHTMLImageAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 0;
if (mMapElement) {
nsIDOMHTMLCollection *mapAreas;
mMapElement->GetAreas(&mapAreas);
if (mapAreas) {
PRUint32 length;
mapAreas->GetLength(&length);
*_retval = NS_STATIC_CAST(PRInt32, length);
}
}
return NS_OK;
}
// Image map hyperlink
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageMapAccessible, nsHTMLImageAccessible, nsIAccessibleHyperLink)
/* readonly attribute long anchors; */
NS_IMETHODIMP nsHTMLImageMapAccessible::GetAnchors(PRInt32 *aAnchors)
{
return GetAccChildCount(aAnchors);
}
/* readonly attribute long startIndex; */
NS_IMETHODIMP nsHTMLImageMapAccessible::GetStartIndex(PRInt32 *aStartIndex)
{
//should not be supported in image map hyperlink
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute long endIndex; */
NS_IMETHODIMP nsHTMLImageMapAccessible::GetEndIndex(PRInt32 *aEndIndex)
{
//should not be supported in image map hyperlink
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIURI getURI (in long i); */
NS_IMETHODIMP nsHTMLImageMapAccessible::GetURI(PRInt32 aIndex, nsIURI **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsIDOMHTMLCollection> mapAreas;
mMapElement->GetAreas(getter_AddRefs(mapAreas));
if (!mapAreas)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> domNode;
mapAreas->Item(aIndex,getter_AddRefs(domNode));
if (!domNode)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (content) {
nsCOMPtr<nsIDocument> doc;
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc)))) {
nsCOMPtr<nsIURI> baseURI;
if (NS_SUCCEEDED(doc->GetBaseURL(*getter_AddRefs(baseURI)))) {
nsCOMPtr<nsIDOMElement> area(do_QueryInterface(domNode));
nsAutoString hrefValue;
if (NS_SUCCEEDED(area->GetAttribute(NS_LITERAL_STRING("href"), hrefValue))) {
return NS_NewURI(_retval, hrefValue, nsnull, baseURI);
}
}
}
}
return NS_ERROR_FAILURE;
}
/* nsIAccessible getObject (in long i); */
NS_IMETHODIMP nsHTMLImageMapAccessible::GetObject(PRInt32 aIndex,
nsIAccessible **_retval)
{
*_retval = CreateAreaAccessible(aIndex);
return NS_OK;
}
/* boolean isValid (); */
NS_IMETHODIMP nsHTMLImageMapAccessible::IsValid(PRBool *_retval)
{
*_retval = PR_TRUE;
return NS_OK;
}

View File

@ -1,87 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLImageAccessible_H_
#define _nsHTMLImageAccessible_H_
#include "nsAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleHyperLink.h"
#include "nsIFrame.h"
#include "nsIImageFrame.h"
#include "nsIDOMHTMLMapElement.h"
/* Accessible for supporting images
* supports:
* - gets name, role
* - support basic state
*/
class nsHTMLImageAccessible : public nsLinkableAccessible
{
public:
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
protected:
nsIAccessible *CreateAreaAccessible(PRUint32 areaNum);
nsCOMPtr<nsIDOMHTMLMapElement> mMapElement;
};
/* Accessible for support images with "use=#map".
* only this kind of images will support nsIAccessibleHyperLink
*/
class nsHTMLImageMapAccessible : public nsHTMLImageAccessible,
public nsIAccessibleHyperLink
{
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEHYPERLINK
public:
nsHTMLImageMapAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell)
: nsHTMLImageAccessible(aDomNode, aShell)
{
}//constructor end
};
#endif

View File

@ -1,144 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLLinkAccessible.h"
#include "nsWeakReference.h"
#include "nsIFrame.h"
#include "nsILink.h"
#include "nsILinkHandler.h"
#include "nsISelection.h"
#include "nsISelectionController.h"
#include "nsIPresContext.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsReadableUtils.h"
#include "nsIDOMElement.h"
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsLinkableAccessible, nsIAccessibleHyperLink)
nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsLinkableAccessible(aDomNode, aShell)
{
}
/* wstring getAccName (); */
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAString& _retval)
{
if (!IsALink()) // Also initializes private data members
return NS_ERROR_FAILURE;
return AppendFlatStringFromSubtree(mLinkContent,&_retval);
}
/* unsigned long getAccRole (); */
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LINK;
return NS_OK;
}
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccState(PRUint32 *_retval)
{
nsLinkableAccessible::GetAccState(_retval);
*_retval &= ~(STATE_READONLY|STATE_SELECTABLE);
return NS_OK;
}
/* readonly attribute long anchors; */
NS_IMETHODIMP nsHTMLLinkAccessible::GetAnchors(PRInt32 *aAnchors)
{
if (!IsALink())
return NS_ERROR_FAILURE;
*aAnchors = 1;
return NS_OK;
}
/* readonly attribute long startIndex; */
NS_IMETHODIMP nsHTMLLinkAccessible::GetStartIndex(PRInt32 *aStartIndex)
{
//not see the value to implement this attributes
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute long endIndex; */
NS_IMETHODIMP nsHTMLLinkAccessible::GetEndIndex(PRInt32 *aEndIndex)
{
//not see the value to implement this attributes
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIURI getURI (in long i); */
NS_IMETHODIMP nsHTMLLinkAccessible::GetURI(PRInt32 i, nsIURI **_retval)
{
//I do not know why we have to retrun a nsIURI instead of
//nsILink or just a string of url. Anyway, maybe nsIURI is
//more powerful for the future.
*_retval = nsnull;
nsCOMPtr<nsILink> link(do_QueryInterface(mLinkContent));
if (link) {
nsXPIDLCString hrefValue;
if (NS_SUCCEEDED(link->GetHrefCString(*getter_Copies(hrefValue)))) {
return NS_NewURI(_retval, hrefValue, nsnull, nsnull);
}
}
return NS_ERROR_FAILURE;
}
/* nsIAccessible getObject (in long i); */
NS_IMETHODIMP nsHTMLLinkAccessible::GetObject(PRInt32 aIndex,
nsIAccessible **_retval)
{
if (0 != aIndex)
return NS_ERROR_FAILURE;
return QueryInterface(NS_GET_IID(nsIAccessible), (void **)_retval);
}
/* boolean isValid (); */
NS_IMETHODIMP nsHTMLLinkAccessible::IsValid(PRBool *_retval)
{
// I have not found the cause which makes this attribute false.
*_retval = PR_TRUE;
return NS_OK;
}

View File

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLLinkAccessible_H_
#define _nsHTMLLinkAccessible_H_
#include "nsAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleHyperLink.h"
class nsHTMLLinkAccessible : public nsLinkableAccessible,
public nsIAccessibleHyperLink
{
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEHYPERLINK
public:
nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
#endif

View File

@ -1,96 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLPluginAccessible.h"
#include "nsIContent.h"
#include "nsObjectFrame.h"
#include "nsplugindefs.h"
#include "nsAccessibilityService.h"
nsHTMLPluginAccessible::nsHTMLPluginAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
{
}
NS_IMETHODIMP
nsHTMLPluginAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
nsIFrame* frame = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
shell->GetPrimaryFrameFor(content, &frame);
if (!frame)
return NS_ERROR_FAILURE;
nsObjectFrame* objectFrame = NS_STATIC_CAST(nsObjectFrame*, frame);
#ifdef XP_WIN
HWND pluginPort = nsnull;
objectFrame->GetPluginPort(&pluginPort);
if (pluginPort) {
if (mAccService)
mAccService->CreateHTMLNativeWindowAccessible(mDOMNode, mPresShell, (PRInt32)pluginPort, _retval);
}
#else
*_retval = nsnull;
#endif
NS_IF_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLPluginAccessible::GetAccLastChild(nsIAccessible **_retval)
{
return GetAccFirstChild(_retval);
}
NS_IMETHODIMP
nsHTMLPluginAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLPluginAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_WINDOW;
return NS_OK;
}

View File

@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessible.h"
/**
* This class is used to wrap the window for the plugin. It's only child
* is a shim class that will allow the platform specific layer of our
* accessibility support to get the IAccessible from the plugin itself
* (via the windows call to get he accessible by window).
*/
class nsHTMLPluginAccessible : public nsAccessible
{
public:
nsHTMLPluginAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
protected:
nsCOMPtr<nsIAccessibilityService> mAccService;
};

File diff suppressed because it is too large Load Diff

View File

@ -1,276 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
* Kyle Yuan (kyle.yuan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsHTMLSelectAccessible_h__
#define __nsHTMLSelectAccessible_h__
#include "nsCOMPtr.h"
#include "nsIAccessibleSelectable.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMNode.h"
#include "nsIWeakReference.h"
#include "nsSelectAccessible.h"
/**
* Selects, Listboxes and Comboboxes, are made up of a number of different
* widgets, some of which are shared between the two. This file contains * all of the widgets for both of the Selects, for HTML only. Some of them
* extend classes from nsSelectAccessible.cpp, which contains base classes
* that are also extended by the XUL Select Accessibility support.
*
* Listbox:
* - nsHTMLListboxAccessible
* - nsHTMLSelectListAccessible
* - nsHTMLSelectOptionAccessible
*
* Comboboxes:
* - nsHTMLComboboxAccessible
* - nsHTMLComboboxTextFieldAccessible
* - nsHTMLComboboxButtonAccessible
* - nsHTMLComboboxWindowAccessible
* - nsHTMLSelectListAccessible
* - nsHTMLSelectOptionAccessible(s)
*/
/** ------------------------------------------------------ */
/** First, the common widgets */
/** ------------------------------------------------------ */
/*
* The basic implemetation of nsIAccessibleSelectable.
*/
class nsHTMLSelectableAccessible : public nsAccessible,
public nsIAccessibleSelectable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESELECTABLE
nsHTMLSelectableAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLSelectableAccessible() {}
protected:
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
class iterator
{
protected:
PRUint32 mLength;
PRUint32 mIndex;
PRInt32 mSelCount;
nsHTMLSelectableAccessible *mParent;
nsCOMPtr<nsIDOMHTMLCollection> mOptions;
nsCOMPtr<nsIDOMHTMLOptionElement> mOption;
public:
iterator(nsHTMLSelectableAccessible *aParent);
void CalcSelectionCount(PRInt32 *aSelectionCount);
void Select(PRBool aSelect);
void AddAccessibleIfSelected(nsIAccessibilityService *aAccService, nsISupportsArray *aSelectedAccessibles, nsIPresContext *aContext);
PRBool GetAccessibleIfSelected(PRInt32 aIndex, nsIAccessibilityService *aAccService, nsIPresContext *aContext, nsIAccessible **_retval);
PRBool Advance();
};
friend class iterator;
};
/*
* The list that contains all the options in the select.
*/
class nsHTMLSelectListAccessible : public nsSelectListAccessible
{
public:
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLSelectListAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *aAccChildCount) ;
};
/*
* Options inside the select, contained within the list
*/
class nsHTMLSelectOptionAccessible : public nsSelectOptionAccessible
{
public:
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLSelectOptionAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsCOMPtr<nsIDOMNode>& aFocusedOptionNode);
};
/*
* Opt Groups inside the select, contained within the list
*/
class nsHTMLSelectOptGroupAccessible : public nsHTMLSelectOptionAccessible
{
public:
nsHTMLSelectOptGroupAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLSelectOptGroupAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
};
/** ------------------------------------------------------ */
/** Secondly, the Listbox widget */
/** ------------------------------------------------------ */
/*
* A class the represents the HTML Listbox widget.
*/
class nsHTMLListboxAccessible : public nsHTMLSelectableAccessible
{
public:
nsHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLListboxAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
};
/** ------------------------------------------------------ */
/** Finally, the Combobox widgets */
/** ------------------------------------------------------ */
/*
* A class the represents the HTML Combobox widget.
*/
class nsHTMLComboboxAccessible : public nsHTMLSelectableAccessible
{
public:
nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLComboboxAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
};
/*
* A class the represents the text field in the Select to the left
* of the drop down button
*/
class nsHTMLComboboxTextFieldAccessible : public nsComboboxTextFieldAccessible
{
public:
nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLComboboxTextFieldAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
};
/**
* A class that represents the button inside the Select to the
* right of the text field
*/
class nsHTMLComboboxButtonAccessible : public nsComboboxButtonAccessible
{
public:
nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLComboboxButtonAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD AccDoAction(PRUint8 index);
};
/*
* A class that represents the window that lives to the right
* of the drop down button inside the Select. This is the window
* that is made visible when the button is pressed.
*/
class nsHTMLComboboxWindowAccessible : public nsComboboxWindowAccessible
{
public:
nsHTMLComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLComboboxWindowAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
};
#endif

View File

@ -1,646 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLTableAccessible.h"
#include "nsWeakReference.h"
#include "nsReadableUtils.h"
nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsBlockAccessible(aDomNode, aShell)
{
}
/* unsigned long getAccRole (); */
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccRole(PRUint32 *aResult)
{
*aResult = ROLE_CELL;
return NS_OK;
}
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccState(PRUint32 *aResult)
{
nsAccessible::GetAccState(aResult);
*aResult &= ~STATE_FOCUSABLE; // Inherit all states except focusable state since table cells cannot be focused
return NS_OK;
}
nsHTMLTableCaptionAccessible::nsHTMLTableCaptionAccessible
(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsAccessible(aDomNode, aShell)
{
}
NS_IMETHODIMP
nsHTMLTableCaptionAccessible::GetAccState(PRUint32 *aResult)
{
nsAccessible::GetAccState(aResult);
*aResult &= ~STATE_FOCUSABLE;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableCaptionAccessible::GetAccValue(nsAString& aResult)
{
aResult.Assign(NS_LITERAL_STRING("")); // Default name is blank
nsCOMPtr<nsIContent> captionContent(do_QueryInterface(mDOMNode));
AppendFlatStringFromSubtree(captionContent, &aResult);
return NS_OK;
}
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableAccessible,
nsBlockAccessible,
nsIAccessible,
nsIAccessibleTable)
nsHTMLTableAccessible::nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsBlockAccessible(aDomNode, aShell)
{
}
/* unsigned long getAccRole (); */
NS_IMETHODIMP nsHTMLTableAccessible::GetAccRole(PRUint32 *aResult)
{
*aResult = ROLE_TABLE;
return NS_OK;
}
NS_IMETHODIMP nsHTMLTableAccessible::GetAccState(PRUint32 *aResult)
{
nsAccessible::GetAccState(aResult);
*aResult &= ~STATE_FOCUSABLE; // Inherit all states except focusable state since tables cannot be focused
return NS_OK;
}
NS_IMETHODIMP nsHTMLTableAccessible::GetAccName(nsAString& aResult)
{
aResult.Assign(NS_LITERAL_STRING("")); // Default name is blank
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
if (element) {
nsCOMPtr<nsIDOMNodeList> captions;
element->GetElementsByTagName(NS_LITERAL_STRING("caption"), getter_AddRefs(captions));
if (captions) {
nsCOMPtr<nsIDOMNode> captionNode;
captions->Item(0, getter_AddRefs(captionNode));
if (captionNode) {
nsCOMPtr<nsIContent> captionContent(do_QueryInterface(captionNode));
AppendFlatStringFromSubtree(captionContent, &aResult);
}
}
}
return NS_OK;
}
/* Implementation of nsIAccessibleTable */
NS_IMETHODIMP
nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMHTMLTableCaptionElement> caption;
rv = table->GetCaption(getter_AddRefs(caption));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> captionNode(do_QueryInterface(caption));
NS_ENSURE_TRUE(captionNode, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessibilityService>
accService(do_GetService("@mozilla.org/accessibilityService;1"));
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
return accService->CreateHTMLTableCaptionAccessible(captionNode, aCaption);
}
NS_IMETHODIMP
nsHTMLTableAccessible::SetCaption(nsIAccessible *aCaption)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> domNode;
rv = aCaption->AccGetDOMNode(getter_AddRefs(domNode));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> newDOMNode;
rv = domNode->CloneNode(PR_TRUE, getter_AddRefs(newDOMNode));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMHTMLTableCaptionElement>
captionElement(do_QueryInterface(newDOMNode));
NS_ENSURE_TRUE(captionElement, NS_ERROR_FAILURE);
return table->SetCaption(captionElement);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetSummary(nsAString &aSummary)
{
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
return table->GetSummary(aSummary);
}
NS_IMETHODIMP
nsHTMLTableAccessible::SetSummary(const nsAString &aSummary)
{
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
return table->SetSummary(aSummary);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetColumns(PRInt32 *aColumns)
{
nsITableLayout *tableLayout = nsnull;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rows;
return tableLayout->GetTableSize(rows, *aColumns);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMHTMLTableSectionElement> section;
rv = table->GetTHead(getter_AddRefs(section));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessibilityService>
accService(do_GetService("@mozilla.org/accessibilityService;1"));
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessible> accHead;
rv = accService->CreateHTMLTableHeadAccessible(section,
getter_AddRefs(accHead));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessibleTable> accTableHead(do_QueryInterface(accHead));
NS_ENSURE_TRUE(accTableHead, NS_ERROR_FAILURE);
*aColumnHeader = accTableHead;
NS_IF_ADDREF(*aColumnHeader);
return rv;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetRows(PRInt32 *aRows)
{
nsITableLayout *tableLayout = nsnull;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columns;
return tableLayout->GetTableSize(*aRows, columns);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
// Can not implement because there is no row header in html table
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetSelectedColumns(PRUint32 *aNumColumns,
PRInt32 **aColumns)
{
nsresult rv = NS_OK;
PRInt32 columnCount;
rv = GetColumns(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
PRBool *states = new PRBool[columnCount];
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
*aNumColumns = 0;
PRInt32 index;
for (index = 0; index < columnCount; index++) {
rv = IsColumnSelected(index, &states[index]);
NS_ENSURE_SUCCESS(rv, rv);
if (states[index]) {
(*aNumColumns)++;
}
}
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
if (!outArray) {
delete []states;
return NS_ERROR_OUT_OF_MEMORY;
}
PRInt32 curr = 0;
for (index = 0; index < columnCount; index++) {
if (states[index]) {
outArray[curr++] = index;
}
}
delete []states;
*aColumns = outArray;
return rv;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetSelectedRows(PRUint32 *aNumRows, PRInt32 **aRows)
{
nsresult rv = NS_OK;
PRInt32 rowCount;
rv = GetRows(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRBool *states = new PRBool[rowCount];
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
*aNumRows = 0;
PRInt32 index;
for (index = 0; index < rowCount; index++) {
rv = IsRowSelected(index, &states[index]);
NS_ENSURE_SUCCESS(rv, rv);
if (states[index]) {
(*aNumRows)++;
}
}
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
if (!outArray) {
delete []states;
return NS_ERROR_OUT_OF_MEMORY;
}
PRInt32 curr = 0;
for (index = 0; index < rowCount; index++) {
if (states[index]) {
outArray[curr++] = index;
}
}
delete []states;
*aRows = outArray;
return rv;
}
NS_IMETHODIMP
nsHTMLTableAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
nsIAccessible **_retval)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMElement> cellElement;
rv = GetCellAt(aRow, aColumn, *getter_AddRefs(cellElement));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessibilityService>
accService(do_GetService("@mozilla.org/accessibilityService;1"));
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
return accService->GetAccessibleFor(cellElement, _retval);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetIndexAt(PRInt32 aRow, PRInt32 aColumn,
PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
*_retval = aRow * columns + aColumn;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
*_retval = aIndex % columns;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
*_retval = aIndex / columns;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn,
PRInt32 *_retval)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMElement> domElement;
rv = GetCellAt(aRow, aColumn, *getter_AddRefs(domElement));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMHTMLTableCellElement> cell(do_QueryInterface(domElement));
NS_ENSURE_TRUE(cell, NS_ERROR_FAILURE);
return cell->GetColSpan(_retval);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn,
PRInt32 *_retval)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMElement> domElement;
rv = GetCellAt(aRow, aColumn, *getter_AddRefs(domElement));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMHTMLTableCellElement> cell(do_QueryInterface(domElement));
NS_ENSURE_TRUE(cell, NS_ERROR_FAILURE);
return cell->GetRowSpan(_retval);
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetColumnDescription(PRInt32 aColumn, nsAString &_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetRowDescription(PRInt32 aRow, nsAString &_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 rows;
rv = GetRows(&rows);
NS_ENSURE_SUCCESS(rv, rv);
for (PRInt32 index = 0; index < rows; index++) {
rv = IsCellSelected(index, aColumn, _retval);
NS_ENSURE_SUCCESS(rv, rv);
if (!*_retval) {
break;
}
}
return rv;
}
NS_IMETHODIMP
nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, PRBool *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
for (PRInt32 index = 0; index < columns; index++) {
rv = IsCellSelected(aRow, index, _retval);
NS_ENSURE_SUCCESS(rv, rv);
if (!*_retval) {
break;
}
}
return rv;
}
NS_IMETHODIMP
nsHTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
PRBool *_retval)
{
nsITableLayout *tableLayout = nsnull;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMElement> domElement;
PRInt32 startRowIndex = 0, startColIndex = 0,
rowSpan, colSpan, actualRowSpan, actualColSpan;
return tableLayout->GetCellDataAt(aRow, aColumn,
*getter_AddRefs(domElement),
startRowIndex, startColIndex, rowSpan,
colSpan, actualRowSpan, actualColSpan,
*_retval);
}
nsresult
nsHTMLTableAccessible::GetTableNode(nsIDOMNode **_retval)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
if (table) {
*_retval = table;
NS_IF_ADDREF(*_retval);
return rv;
}
nsCOMPtr<nsIDOMHTMLTableSectionElement> section(do_QueryInterface(mDOMNode));
if (section) {
nsCOMPtr<nsIDOMNode> parent;
rv = section->GetParentNode(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(rv, rv);
*_retval = parent;
NS_IF_ADDREF(*_retval);
return rv;
}
return NS_ERROR_FAILURE;
}
nsresult
nsHTMLTableAccessible::GetTableLayout(nsITableLayout **aLayoutObject)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMNode> tableNode;
rv = GetTableNode(getter_AddRefs(tableNode));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content(do_QueryInterface(tableNode));
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> document;
rv = content->GetDocument(*getter_AddRefs(document));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPresShell> presShell;
rv = document->GetShellAt(0, getter_AddRefs(presShell));
NS_ENSURE_SUCCESS(rv, rv);
nsISupports *layoutObject = nsnull;
rv = presShell->GetLayoutObjectFor(content, &layoutObject);
NS_ENSURE_SUCCESS(rv, rv);
*aLayoutObject = nsnull;
return layoutObject->QueryInterface(NS_GET_IID(nsITableLayout),
(void **)aLayoutObject);
}
nsresult
nsHTMLTableAccessible::GetCellAt(PRInt32 aRowIndex,
PRInt32 aColIndex,
nsIDOMElement* &aCell)
{
PRInt32 startRowIndex = 0, startColIndex = 0,
rowSpan, colSpan, actualRowSpan, actualColSpan;
PRBool isSelected;
nsITableLayout *tableLayout = nsnull;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
return tableLayout->GetCellDataAt(aRowIndex, aColIndex, aCell,
startRowIndex, startColIndex,
rowSpan, colSpan,
actualRowSpan, actualColSpan,
isSelected);
}
//Class nsHTMLTableHeadAccessible
nsHTMLTableHeadAccessible::nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode,
nsIWeakReference *aShell):
nsHTMLTableAccessible(aDomNode, aShell)
{
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetAccRole(PRUint32 *aResult)
{
*aResult = ROLE_COLUMNHEADER;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetCaption(nsIAccessible **aCaption)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::SetCaption(nsIAccessible *aCaption)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetSummary(nsAString &aSummary)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::SetSummary(const nsAString &aSummary)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetRows(PRInt32 *aRows)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIDOMHTMLTableSectionElement> head(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(head, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMHTMLCollection> rows;
rv = head->GetRows(getter_AddRefs(rows));
NS_ENSURE_SUCCESS(rv, rv);
return rows->GetLength((PRUint32 *)aRows);
}
/* End of Implementation of nsIAccessibleTable */

View File

@ -1,114 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLTableAccessible_H_
#define _nsHTMLTableAccessible_H_
#include "nsAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleTable.h"
#include "nsIServiceManager.h"
#include "nsIDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLTableElement.h"
#include "nsIDOMHTMLTableCaptionElem.h"
#include "nsIDOMHTMLTableRowElement.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDOMHTMLCollection.h"
#include "nsITableLayout.h"
class nsHTMLTableCellAccessible : public nsBlockAccessible
{
public:
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *aResult);
NS_IMETHOD GetAccState(PRUint32 *aResult);
};
class nsHTMLTableCaptionAccessible : public nsAccessible
{
public:
nsHTMLTableCaptionAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccState(PRUint32 *aResult);
NS_IMETHOD GetAccValue(nsAString& aResult);
};
class nsHTMLTableAccessible : public nsBlockAccessible,
public nsIAccessibleTable
{
public:
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
/* nsIAccessible */
NS_IMETHOD GetAccRole(PRUint32 *aResult);
NS_IMETHOD GetAccState(PRUint32 *aResult);
NS_IMETHOD GetAccName(nsAString& aResult);
/* nsIAccessibleTable */
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLETABLE
protected:
nsresult GetTableNode(nsIDOMNode **_retval);
nsresult GetTableLayout(nsITableLayout **aLayoutObject);
nsresult GetCellAt(PRInt32 aRowIndex,
PRInt32 aColIndex,
nsIDOMElement* &aCell);
};
class nsHTMLTableHeadAccessible : public nsHTMLTableAccessible
{
public:
nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell);
/* nsIAccessible */
NS_IMETHOD GetAccRole(PRUint32 *aResult);
/* nsIAccessibleTable */
NS_IMETHOD GetCaption(nsIAccessible **aCaption);
NS_IMETHOD SetCaption(nsIAccessible *aCaption);
NS_IMETHOD GetSummary(nsAString &aSummary);
NS_IMETHOD SetSummary(const nsAString &aSummary);
NS_IMETHOD GetColumnHeader(nsIAccessibleTable **aColumnHeader);
NS_IMETHOD GetRows(PRInt32 *aRows);
};
#endif

View File

@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Eric Vaughan (evaughan@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLTextAccessible.h"
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessible(aDomNode, aShell)
{
}
/* wstring getAccName (); */
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(nsAString& _retval)
{
nsAutoString accName;
if (NS_FAILED(mDOMNode->GetNodeValue(accName)))
return NS_ERROR_FAILURE;
accName.CompressWhitespace();
_retval = accName;
return NS_OK;
}

View File

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* 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 _nsHTMLTextAccessible_H_
#define _nsHTMLTextAccessible_H_
#include "nsTextAccessible.h"
class nsIWeakReference;
class nsHTMLTextAccessible : public nsTextAccessible
{
public:
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
};
#endif

View File

@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com) (original author)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLWin32ObjectAccessible.h"
#include "nsAccessible.h"
nsHTMLWin32ObjectAccessible::nsHTMLWin32ObjectAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRInt32 aHwnd):
nsAccessible(aNode, aShell)
{
if (aHwnd) {
// XXX - when we get accessible plugins we may have to check here
// for the proper window handle using Win32 APIs so we check
// the proper IAccessible for the information we need.
mHwnd = aHwnd;
}
}
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLWin32ObjectAccessible, nsAccessible, nsIAccessibleWin32Object)
NS_IMETHODIMP
nsHTMLWin32ObjectAccessible::GetHwnd(PRInt32 *aHwnd) {
*aHwnd = mHwnd;
return NS_OK;
}

View File

@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* John Gaunt (jgaunt@netscape.com) (original author)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsHTMLWin32ObjectAccessible_H_
#define _nsHTMLWin32ObjectAccessible_H_
#include "nsIAccessibleWin32Object.h"
#include "nsAccessible.h"
struct IAccessible;
/**
* This class is used only internally, we never! send out an IAccessible linked
* back to this object. This class is used to represent a plugin object when
* referenced as a child or sibling of another nsAccessible node. We need only
* a limited portion of the nsIAccessible interface implemented here. The
* in depth accessible information will be returned by the actual IAccessible
* object returned by us in Accessible::NewAccessible() that gets the IAccessible
* from the windows system from the window handle.
*/
class nsHTMLWin32ObjectAccessible : public nsAccessible,
public nsIAccessibleWin32Object
{
public:
nsHTMLWin32ObjectAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRInt32 aHwnd);
virtual ~nsHTMLWin32ObjectAccessible() {}
NS_DECL_ISUPPORTS_INHERITED
// ---- nsIAccessibleWin32Object ----
NS_IMETHOD GetHwnd(PRInt32 *aHwnd);
protected:
// ---- Data Members ----
/**
* A handle to the native plugin window (hopefully), given to
* Accessible::NewAccessible() so the actual IAccessible can be retrieved.
*/
PRInt32 mHwnd;
};
#endif

View File

@ -1,73 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): John Gaunt (jgaunt@netscape.com)
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = accessibility
LIBRARY_NAME = accessibility_xul_s
REQUIRES = \
appshell \
content \
docshell \
dom \
gfx \
htmlparser \
intl \
layout \
locale \
necko \
plugin \
pref \
string \
view \
webbrwsr \
webshell \
widget \
xpcom \
$(NULL)
CPPSRCS = \
nsXULColorPickerAccessible.cpp \
nsXULFormControlAccessible.cpp \
nsXULMenuAccessible.cpp \
nsXULSelectAccessible.cpp \
nsXULTabAccessible.cpp \
nsXULTextAccessible.cpp \
nsXULTreeAccessible.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \
-I$(srcdir)/../base \
-I$(srcdir)/../html \
-I$(srcdir)/../../../layout/html/base/src \
-I$(srcdir)/../../../layout/html/forms/src \
-I$(srcdir)/../../../layout/html/forms/public \
$(NULL)

View File

@ -1,136 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsXULColorPickerAccessible.h"
#include "nsReadableUtils.h"
#include "nsString.h"
#include "nsXULFormControlAccessible.h"
#include "nsIDOMElement.h"
/**
* XUL Color Picker Tile
*/
/**
* Default Constructor
*/
nsXULColorPickerTileAccessible::nsXULColorPickerTileAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
}
/**
* We are a pushbutton
*/
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PUSHBUTTON;
return NS_OK;
}
/**
* Possible states: focused, focusable, selected
*/
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccState(PRUint32 *_retval)
{
// get focus and disable status from base class
nsFormControlAccessible::GetAccState(_retval);
*_retval |= STATE_FOCUSABLE;
// Focused?
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No XUL Element for colorpicker");
PRBool isFocused = PR_FALSE;
element->HasAttribute(NS_LITERAL_STRING("hover"), &isFocused);
if (isFocused)
*_retval |= STATE_FOCUSED;
PRBool isSelected = PR_FALSE;
element->HasAttribute(NS_LITERAL_STRING("selected"), &isSelected);
if (isFocused)
*_retval |= STATE_SELECTED;
return NS_OK;
}
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccName(nsAString& _retval)
{
_retval.Assign(NS_LITERAL_STRING(""));
return NS_OK;
}
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccValue(nsAString& _retval)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No XUL Element for colorpicker");
return element->GetAttribute(NS_LITERAL_STRING("color"), _retval);
}
/**
* XUL Color Picker
*/
/**
* Default Constructor
*/
nsXULColorPickerAccessible::nsXULColorPickerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsXULColorPickerTileAccessible(aNode, aShell)
{
}
/**
* Possible states: focused, focusable, unavailable(disabled)
*/
NS_IMETHODIMP nsXULColorPickerAccessible::GetAccState(PRUint32 *_retval)
{
// get focus and disable status from base class
nsFormControlAccessible::GetAccState(_retval);
*_retval |= STATE_FOCUSABLE | STATE_HASPOPUP;
return NS_OK;
}
NS_IMETHODIMP nsXULColorPickerAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_BUTTONDROPDOWNGRID;
return NS_OK;
}

View File

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsXULColorPickerAccessible_H_
#define _nsXULColorPickerAccessible_H_
// NOTE: alphabetically ordered
#include "nsFormControlAccessible.h"
class nsXULColorPickerTileAccessible : public nsFormControlAccessible
{
public:
nsXULColorPickerTileAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
};
class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible
{
public:
nsXULColorPickerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
};
#endif

View File

@ -1,640 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsIDocument.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMXULButtonElement.h"
#include "nsIDOMXULCheckboxElement.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULLabelElement.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsReadableUtils.h"
#include "nsString.h"
#include "nsXULFormControlAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
/**
* XUL Button: can contain arbitrary HTML content
*/
/**
* Default Constructor
*/
// Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
nsXULButtonAccessible::nsXULButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsXULButtonAccessible::GetAccName(nsAString& aResult)
{
return GetXULAccName(aResult);
}
/**
* Only one actions available
*/
NS_IMETHODIMP nsXULButtonAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;;
}
/**
* Return the name of our only action
*/
NS_IMETHODIMP nsXULButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Click) {
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/**
* Tell the button to do it's action
*/
NS_IMETHODIMP nsXULButtonAccessible::AccDoAction(PRUint8 index)
{
if (index == 0) {
nsCOMPtr<nsIDOMXULButtonElement> buttonElement(do_QueryInterface(mDOMNode));
if ( buttonElement )
{
buttonElement->Click();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_INVALID_ARG;
}
/**
* We are a pushbutton
*/
NS_IMETHODIMP nsXULButtonAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PUSHBUTTON;
return NS_OK;
}
/**
* Possible states: focused, focusable, unavailable(disabled)
*/
NS_IMETHODIMP nsXULButtonAccessible::GetAccState(PRUint32 *_retval)
{
// get focus and disable status from base class
nsAccessible::GetAccState(_retval);
PRBool disabled = PR_FALSE;
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode));
if (xulFormElement) {
xulFormElement->GetDisabled(&disabled);
if (disabled)
*_retval |= STATE_UNAVAILABLE;
else
*_retval |= STATE_FOCUSABLE;
}
// Buttons can be checked -- they simply appear pressed in rather than checked
nsCOMPtr<nsIDOMXULButtonElement> xulButtonElement(do_QueryInterface(mDOMNode));
if (xulButtonElement) {
PRBool checked = PR_FALSE;
PRInt32 checkState = 0;
xulButtonElement->GetChecked(&checked);
if (checked) {
*_retval |= STATE_PRESSED;
xulButtonElement->GetCheckState(&checkState);
if (checkState == nsIDOMXULButtonElement::CHECKSTATE_MIXED)
*_retval |= STATE_MIXED;
}
}
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No nsIDOMElement for button node!");
PRBool isDefault = PR_FALSE;
element->HasAttribute(NS_LITERAL_STRING("default"), &isDefault) ;
if (isDefault)
*_retval |= STATE_DEFAULT;
return NS_OK;
}
/**
* Perhaps 1 child - if there's a <dropmarker>
*/
NS_IMETHODIMP nsXULButtonAccessible::GetAccFirstChild(nsIAccessible **aResult)
{
*aResult = nsnull;
nsCOMPtr<nsIAccessible> testAccessible;
nsAccessible::GetAccLastChild(getter_AddRefs(testAccessible));
// If the anonymous tree walker can find accessible children, and the last one is a push button,
// then use it as the only accessible child -- because this is the scenario where we have a dropmarker child
if (testAccessible) {
PRUint32 role;
if (NS_SUCCEEDED(testAccessible->GetAccRole(&role)) && role == ROLE_PUSHBUTTON) {
*aResult = testAccessible;
NS_ADDREF(*aResult);
}
}
return NS_OK;
}
NS_IMETHODIMP nsXULButtonAccessible::GetAccLastChild(nsIAccessible **aResult)
{
return GetAccFirstChild(aResult);
}
NS_IMETHODIMP nsXULButtonAccessible::GetAccChildCount(PRInt32 *aResult)
{
*aResult = 0;
nsCOMPtr<nsIAccessible> accessible;
GetAccFirstChild(getter_AddRefs(accessible));
if (accessible)
*aResult = 1;
return NS_OK;
}
/**
* XUL Dropmarker: can contain arbitrary HTML content
*/
/**
* Default Constructor
*/
nsXULDropmarkerAccessible::nsXULDropmarkerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
}
/**
* Only one actions available
*/
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccNumActions(PRUint8 *aResult)
{
*aResult = eSingle_Action;
return NS_OK;;
}
PRBool nsXULDropmarkerAccessible::DropmarkerOpen(PRBool aToggleOpen)
{
PRBool isOpen = PR_FALSE;
nsCOMPtr<nsIDOMNode> parentButtonNode;
mDOMNode->GetParentNode(getter_AddRefs(parentButtonNode));
nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement(do_QueryInterface(parentButtonNode));
if (parentButtonElement) {
parentButtonElement->GetOpen(&isOpen);
if (aToggleOpen)
parentButtonElement->SetOpen(!isOpen);
}
else {
nsCOMPtr<nsIDOMXULMenuListElement> parentMenuListElement(do_QueryInterface(parentButtonNode));
if (parentMenuListElement) {
parentMenuListElement->GetOpen(&isOpen);
if (aToggleOpen)
parentMenuListElement->SetOpen(!isOpen);
}
}
return isOpen;
}
/**
* Return the name of our only action
*/
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccActionName(PRUint8 index, nsAString& aResult)
{
if (index == eAction_Click) {
if (DropmarkerOpen(PR_FALSE))
aResult = NS_LITERAL_STRING("close");
else
aResult = NS_LITERAL_STRING("open");
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/**
* Tell the Dropmarker to do it's action
*/
NS_IMETHODIMP nsXULDropmarkerAccessible::AccDoAction(PRUint8 index)
{
if (index == eAction_Click) {
DropmarkerOpen(PR_TRUE); // Reverse the open attribute
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/**
* We are a pushbutton
*/
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccRole(PRUint32 *aResult)
{
*aResult = ROLE_PUSHBUTTON;
return NS_OK;
}
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccState(PRUint32 *aResult)
{
*aResult = 0;
if (DropmarkerOpen(PR_FALSE))
*aResult = STATE_PRESSED;
return NS_OK;
}
/**
* XUL checkbox
*/
/**
* Default Constructor
*/
nsXULCheckboxAccessible::nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
}
/**
* We are a CheckButton
*/
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_CHECKBUTTON;
return NS_OK;
}
/**
* Only one action available
*/
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
/**
* Return the name of our only action
*/
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Click) {
// check or uncheck
PRUint32 state;
GetAccState(&state);
if (state & STATE_CHECKED)
_retval = NS_LITERAL_STRING("uncheck");
else
_retval = NS_LITERAL_STRING("check");
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/**
* Tell the checkbox to do its only action -- check( or uncheck) itself
*/
NS_IMETHODIMP nsXULCheckboxAccessible::AccDoAction(PRUint8 index)
{
if (index == eAction_Click) {
PRBool checked = PR_FALSE;
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
if (xulCheckboxElement) {
xulCheckboxElement->Click();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_INVALID_ARG;
}
/**
* Possible states: focused, focusable, unavailable(disabled), checked
*/
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccState(PRUint32 *_retval)
{
// Get focus and disable status from base class
nsFormControlAccessible::GetAccState(_retval);
// Determine Checked state
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
if (xulCheckboxElement) {
PRBool checked = PR_FALSE;
xulCheckboxElement->GetChecked(&checked);
if (checked) {
*_retval |= STATE_CHECKED;
PRInt32 checkState = 0;
xulCheckboxElement->GetCheckState(&checkState);
if (checkState == nsIDOMXULCheckboxElement::CHECKSTATE_MIXED)
*_retval |= STATE_MIXED;
}
}
return NS_OK;
}
/**
* XUL groupbox
*/
nsXULGroupboxAccessible::nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_GROUPING;
return NS_OK;
}
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccState(PRUint32 *_retval)
{
// Groupbox doesn't support any states!
*_retval = 0;
return NS_OK;
}
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccName(nsAString& _retval)
{
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
if (element) {
nsCOMPtr<nsIDOMNodeList> captions;
element->GetElementsByTagName(NS_LITERAL_STRING("caption"), getter_AddRefs(captions));
if (captions) {
nsCOMPtr<nsIDOMNode> captionNode;
captions->Item(0, getter_AddRefs(captionNode));
if (captionNode) {
element = do_QueryInterface(captionNode);
NS_ASSERTION(element, "No nsIDOMElement for caption node!");
element->GetAttribute(NS_LITERAL_STRING("label"), _retval) ;
}
}
}
return NS_OK;
}
/**
* progressmeter
*/
NS_IMPL_ISUPPORTS_INHERITED1(nsXULProgressMeterAccessible, nsFormControlAccessible, nsIAccessibleValue)
nsXULProgressMeterAccessible::nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsFormControlAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PROGRESSBAR;
return NS_OK;
}
/**
* No states supported for progressmeter
*/
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccState(PRUint32 *_retval)
{
*_retval =0;
return NS_OK;
}
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccValue(nsAString& _retval)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No element for DOM node!");
element->GetAttribute(NS_LITERAL_STRING("value"), _retval);
if (!_retval.IsEmpty() && _retval.Last() != '%')
_retval.Append(NS_LITERAL_STRING("%"));
return NS_OK;
}
/* readonly attribute double maximumValue; */
NS_IMETHODIMP nsXULProgressMeterAccessible::GetMaximumValue(double *aMaximumValue)
{
*aMaximumValue = 1; // 100% = 1;
return NS_OK;
}
/* readonly attribute double minimumValue; */
NS_IMETHODIMP nsXULProgressMeterAccessible::GetMinimumValue(double *aMinimumValue)
{
*aMinimumValue = 0;
return NS_OK;
}
/* readonly attribute double currentValue; */
NS_IMETHODIMP nsXULProgressMeterAccessible::GetCurrentValue(double *aCurrentValue)
{
nsAutoString currentValue;
GetAccValue(currentValue);
PRInt32 error;
*aCurrentValue = currentValue.ToFloat(&error) / 100;
return NS_OK;
}
/* boolean setCurrentValue (in double value); */
NS_IMETHODIMP nsXULProgressMeterAccessible::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.Append(NS_LITERAL_STRING("%"));
if (NS_SUCCEEDED(element->SetAttribute(NS_LITERAL_STRING("value"), valueString))) {
*_retval = PR_TRUE;
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/**
* XUL Radio Button
*/
/** Constructor */
nsXULRadioButtonAccessible::nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsRadioButtonAccessible(aNode, aShell)
{
}
/** Our only action is to click */
NS_IMETHODIMP nsXULRadioButtonAccessible::AccDoAction(PRUint8 index)
{
if (index == eAction_Click) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
if (radioButton) {
radioButton->Click();
return NS_OK;
}
}
return NS_ERROR_INVALID_ARG;
}
/** We are Focusable and can be Checked and focused */
NS_IMETHODIMP nsXULRadioButtonAccessible::GetAccState(PRUint32 *_retval)
{
nsFormControlAccessible::GetAccState(_retval);
PRBool selected = PR_FALSE; // Radio buttons can be selected
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
if (radioButton)
radioButton->GetSelected(&selected);
if (selected) {
*_retval |= STATE_CHECKED;
// If our parent radio group is focused, then consider this radio button focused
nsCOMPtr<nsIDOMNode> parentNode;
mDOMNode->GetParentNode(getter_AddRefs(parentNode));
if (parentNode) {
nsCOMPtr<nsIDOMNode> focusedNode;
GetFocusedNode(getter_AddRefs(focusedNode));
if (focusedNode == parentNode)
*_retval |= STATE_FOCUSED;
}
}
return NS_OK;
}
/**
* This gets the parent of the RadioGroup (our grandparent) and sets it
* as our parent, for future calls.
*/
NS_IMETHODIMP nsXULRadioButtonAccessible::GetAccParent(nsIAccessible ** aAccParent)
{
if (! mParent) {
nsCOMPtr<nsIAccessible> tempParent;
nsAccessible::GetAccParent(getter_AddRefs(tempParent));
if (tempParent)
tempParent->GetAccParent(getter_AddRefs(mParent));
}
NS_ASSERTION(mParent,"Whoa! This RadioButtonAcc doesn't have a parent! Better find out why.");
*aAccParent = mParent;
NS_ADDREF(*aAccParent);
return NS_OK;
}
/**
* XUL Radio Group
* The Radio Group proxies for the Radio Buttons themselves. The Group gets
* focus whereas the Buttons do not. So we only have an accessible object for
* this for the purpose of getting the proper RadioButton. Need this here to
* avoid circular reference problems when navigating the accessible tree and
* for getting to the radiobuttons.
*/
/** Constructor */
nsXULRadioGroupAccessible::nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
NS_IMETHODIMP nsXULRadioGroupAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_GROUPING;
return NS_OK;
}
NS_IMETHODIMP nsXULRadioGroupAccessible::GetAccState(PRUint32 *_retval)
{
// The radio group is not focusable.
// Sometimes the focus controller will report that it is focused.
// That means that the actual selected radio button should be considered focused
nsAccessible::GetAccState(_retval);
*_retval &= ~(STATE_FOCUSABLE | STATE_FOCUSED);
return NS_OK;
}
/**
* XUL StatusBar: can contain arbitrary HTML content
*/
/**
* Default Constructor
*/
nsXULStatusBarAccessible::nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
/**
* We are a statusbar
*/
NS_IMETHODIMP nsXULStatusBarAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_STATUSBAR;
return NS_OK;
}
NS_IMETHODIMP nsXULStatusBarAccessible::GetAccState(PRUint32 *_retval)
{
*_retval = 0; // no special state flags for status bar
return NS_OK;
}

View File

@ -1,139 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsXULFormControlAccessible_H_
#define _nsXULFormControlAccessible_H_
// NOTE: alphabetically ordered
#include "nsBaseWidgetAccessible.h"
#include "nsFormControlAccessible.h"
#include "nsHTMLFormControlAccessible.h"
#include "nsIAccessibleValue.h"
class nsXULButtonAccessible : public nsAccessible
// Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
{
public:
nsXULButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& aResult);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
};
class nsXULCheckboxAccessible : public nsFormControlAccessible
{
public:
nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
class nsXULDropmarkerAccessible : public nsFormControlAccessible
{
public:
nsXULDropmarkerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
private:
PRBool DropmarkerOpen(PRBool aToggleOpen);
};
class nsXULGroupboxAccessible : public nsAccessible
{
public:
nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
};
class nsXULProgressMeterAccessible : public nsFormControlAccessible,
public nsIAccessibleValue
{
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEVALUE
public:
nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString &_retval);
};
class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
{
public:
nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
class nsXULRadioGroupAccessible : public nsAccessible
{
public:
nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
class nsXULStatusBarAccessible : public nsAccessible
{
public:
nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
#endif

View File

@ -1,378 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsXULMenuAccessible.h"
#include "nsAccessible.h"
#include "nsIAccessible.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMKeyEvent.h"
#include "nsIPref.h"
#include "nsIServiceManager.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
// ------------------------ Menu Item -----------------------------
nsXULMenuitemAccessible::nsXULMenuitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccState(PRUint32 *_retval)
{
nsAccessible::GetAccState(_retval);
// Focused?
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No DOM element for menu node!");
PRBool isFocused = PR_FALSE;
element->HasAttribute(NS_LITERAL_STRING("_moz-menuactive"), &isFocused);
if (isFocused)
*_retval |= STATE_FOCUSED;
// Has Popup?
nsAutoString tagName;
element->GetLocalName(tagName);
if (tagName.Equals(NS_LITERAL_STRING("menu")))
*_retval |= STATE_HASPOPUP;
nsAutoString menuItemType;
element->GetAttribute(NS_LITERAL_STRING("type"), menuItemType);
if (!menuItemType.IsEmpty()) {
// Selectable?
if (menuItemType.Equals(NS_LITERAL_STRING("radio")))
*_retval |= STATE_SELECTABLE;
// Checked?
PRBool isChecked = PR_FALSE;
element->HasAttribute(NS_LITERAL_STRING("checked"), &isChecked);
if (isChecked) {
if (*_retval & STATE_SELECTABLE)
*_retval |= STATE_SELECTED; // Use STATE_SELECTED for radio buttons
else *_retval |= STATE_CHECKED;
}
}
// Offscreen?
// If parent or grandparent menuitem is offscreen, then we're offscreen too
// We get it by replacing the current offscreen bit with the parent's
PRUint32 parentState = 0;
nsCOMPtr<nsIAccessible> parentAccessible;
GetAccParent(getter_AddRefs(parentAccessible));
parentAccessible->GetAccState(&parentState);
*_retval &= ~STATE_OFFSCREEN; // clear the old OFFSCREEN bit
*_retval |= (parentState & STATE_OFFSCREEN); // or it with the parent's offscreen bit
return NS_OK;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No DOM element for menu node!");
element->GetAttribute(NS_LITERAL_STRING("label"), _retval);
return NS_OK;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccKeyboardShortcut(nsAString& _retval)
{
static PRInt32 gMenuAccesskeyModifier = -1; // magic value of -1 indicates unitialized state
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
if (elt) {
nsAutoString accesskey;
elt->GetAttribute(NS_LITERAL_STRING("accesskey"), accesskey);
if (accesskey.IsEmpty())
return NS_OK;
nsCOMPtr<nsIAccessible> parentAccessible;
GetAccParent(getter_AddRefs(parentAccessible));
if (parentAccessible) {
PRUint32 role;
parentAccessible->GetAccRole(&role);
if (role == ROLE_MENUBAR) {
// If top level menu item, add Alt+ or whatever modifier text to string
// No need to cache pref service, this happens rarely
if (gMenuAccesskeyModifier == -1) { // Need to initialize cached global accesskey pref
gMenuAccesskeyModifier = 0;
nsresult result;
nsCOMPtr<nsIPref> prefService(do_GetService(kPrefCID, &result));
if (NS_SUCCEEDED(result) && prefService)
prefService->GetIntPref("ui.key.menuAccessKey", &gMenuAccesskeyModifier);
}
nsAutoString propertyKey;
switch (gMenuAccesskeyModifier) {
case nsIDOMKeyEvent::DOM_VK_CONTROL: propertyKey = NS_LITERAL_STRING("VK_CONTROL"); break;
case nsIDOMKeyEvent::DOM_VK_ALT: propertyKey = NS_LITERAL_STRING("VK_ALT"); break;
case nsIDOMKeyEvent::DOM_VK_META: propertyKey = NS_LITERAL_STRING("VK_META"); break;
}
if (!propertyKey.IsEmpty())
nsAccessible::GetFullKeyName(propertyKey, accesskey, _retval);
}
}
if (_retval.IsEmpty())
_retval = accesskey;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_MENUITEM;
return NS_OK;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccFirstChild(nsIAccessible **aAccFirstChild)
{
*aAccFirstChild = nsnull;
// Last argument of PR_FALSE indicates we don't walk anonymous children for menuitems
nsAccessibleTreeWalker walker(mPresShell, mDOMNode, mSiblingIndex, mSiblingList, PR_FALSE);
if (NS_SUCCEEDED(walker.GetFirstChild())) {
*aAccFirstChild = walker.mState.accessible;
NS_ADDREF(*aAccFirstChild);
}
return NS_OK;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccLastChild(nsIAccessible **aAccLastChild)
{
*aAccLastChild = nsnull;
// Last argument of PR_FALSE indicates we don't walk anonymous children for menuitems
nsAccessibleTreeWalker walker(mPresShell, mDOMNode, mSiblingIndex, mSiblingList, PR_FALSE);
if (NS_SUCCEEDED(walker.GetLastChild())) {
*aAccLastChild = walker.mState.accessible;
NS_ADDREF(*aAccLastChild);
}
return NS_OK;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccChildCount(PRInt32 *aAccChildCount)
{
// Last argument of PR_FALSE indicates we don't walk anonymous children for menuitems
nsAccessibleTreeWalker walker(mPresShell, mDOMNode, mSiblingIndex, mSiblingList, PR_FALSE);
*aAccChildCount = walker.GetChildCount();
return NS_OK;
}
NS_IMETHODIMP nsXULMenuitemAccessible::AccDoAction(PRUint8 index)
{
if (index == eAction_Select) { // default action
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectItem(do_QueryInterface(mDOMNode));
if (selectItem)
selectItem->DoCommand();
else {
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(mDOMNode));
if (xulElement) {
xulElement->Click();
}
}
nsCOMPtr<nsIAccessible> parentAccessible;
GetAccParent(getter_AddRefs(parentAccessible));
if (parentAccessible) {
PRUint32 role;
parentAccessible->GetAccRole(&role);
if (role == ROLE_LIST) {
nsCOMPtr<nsIAccessible> buttonAccessible;
parentAccessible->GetAccPreviousSibling(getter_AddRefs(buttonAccessible));
PRUint32 state;
buttonAccessible->GetAccState(&state);
if (state & STATE_PRESSED)
buttonAccessible->AccDoAction(eAction_Click);
}
}
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/** select us! close combo box if necessary*/
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Select) {
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("select"), _retval);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
// ------------------------ Menu Separator ----------------------------
nsXULMenuSeparatorAccessible::nsXULMenuSeparatorAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsXULMenuitemAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccState(PRUint32 *_retval)
{
// Isn't focusable, but can be offscreen
nsXULMenuitemAccessible::GetAccState(_retval);
*_retval &= STATE_OFFSCREEN;
return NS_OK;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccName(nsAString& _retval)
{
_retval.Assign(NS_LITERAL_STRING(""));
return NS_OK;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_SEPARATOR;
return NS_OK;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::AccDoAction(PRUint8 index)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccNumActions(PRUint8 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// ------------------------ Menu Popup -----------------------------
nsXULMenupopupAccessible::nsXULMenupopupAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): nsAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsXULMenupopupAccessible::GetAccState(PRUint32 *_retval)
{
// We are onscreen if our parent is active
*_retval = 0;
PRBool isActive = PR_FALSE;
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
element->HasAttribute(NS_LITERAL_STRING("menuactive"), &isActive);
if (!isActive) {
nsCOMPtr<nsIAccessible> parentAccessible;
nsCOMPtr<nsIDOMNode> parentNode;
GetAccParent(getter_AddRefs(parentAccessible));
if (parentAccessible)
parentAccessible->AccGetDOMNode(getter_AddRefs(parentNode));
element = do_QueryInterface(parentNode);
if (element)
element->HasAttribute(NS_LITERAL_STRING("open"), &isActive);
}
if (!isActive)
*_retval |= STATE_OFFSCREEN;
return NS_OK;
}
NS_IMETHODIMP nsXULMenupopupAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No element for popup node!");
while (element) {
element->GetAttribute(NS_LITERAL_STRING("label"), _retval);
if (!_retval.IsEmpty())
return NS_OK;
nsCOMPtr<nsIDOMNode> parentNode, node(do_QueryInterface(element));
if (!node)
return NS_ERROR_FAILURE;
node->GetParentNode(getter_AddRefs(parentNode));
element = do_QueryInterface(parentNode);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULMenupopupAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_MENUPOPUP;
return NS_OK;
}
// ------------------------ Menu Bar -----------------------------
nsXULMenubarAccessible::nsXULMenubarAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): nsAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsXULMenubarAccessible::GetAccState(PRUint32 *_retval)
{
nsresult rv = nsAccessible::GetAccState(_retval);
*_retval &= ~STATE_FOCUSABLE; // Menu bar iteself is not actually focusable
return rv;
}
NS_IMETHODIMP nsXULMenubarAccessible::GetAccName(nsAString& _retval)
{
_retval = NS_LITERAL_STRING("Application");
return NS_OK;
}
NS_IMETHODIMP nsXULMenubarAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_MENUBAR;
return NS_OK;
}

View File

@ -1,94 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: Aaron Leventhal (aaronl@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsXULMenuAccessible_H_
#define _nsXULMenuAccessible_H_
#include "nsAccessible.h"
/* Accessible for supporting XUL menus
*/
class nsXULMenuitemAccessible : public nsAccessible
{
public:
nsXULMenuitemAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccKeyboardShortcut(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **aAccFirstChild);
NS_IMETHOD GetAccLastChild(nsIAccessible **aAccLastChild);
NS_IMETHOD GetAccChildCount(PRInt32 *aAccChildCount);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
};
class nsXULMenuSeparatorAccessible : public nsXULMenuitemAccessible
{
public:
nsXULMenuSeparatorAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
};
class nsXULMenupopupAccessible : public nsAccessible
{
public:
nsXULMenupopupAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
};
class nsXULMenubarAccessible : public nsAccessible
{
public:
nsXULMenubarAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
};
#endif

View File

@ -1,540 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Eric Vaughan (evaughan@netscape.com)
* Kyle Yuan (kyle.yuan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsXULSelectAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIServiceManager.h"
#include "nsLayoutAtoms.h"
/**
* Selects, Listboxes and Comboboxes, are made up of a number of different
* widgets, some of which are shared between the two. This file contains
* all of the widgets for both of the Selects, for XUL only. Some of them
* extend classes from nsSelectAccessible.cpp, which contains base classes
* that are also extended by the XUL Select Accessibility support.
*
* Listbox:
* - nsXULListboxAccessible
* - nsXULSelectListAccessible
* - nsXULSelectOptionAccessible
*
* Comboboxes:
* - nsXULComboboxAccessible
* - nsHTMLTextFieldAccessible (editable) or nsTextAccessible (readonly)
* - nsXULComboboxButtonAccessible
* - nsXULSelectListAccessible
* - nsXULSelectOptionAccessible
*/
/** ------------------------------------------------------ */
/** Impl. of nsXULSelectableAccessible */
/** ------------------------------------------------------ */
// Helper methos
nsXULSelectableAccessible::nsXULSelectableAccessible(nsIDOMNode* aDOMNode,
nsIWeakReference* aShell):
nsAccessible(aDOMNode, aShell)
{
}
NS_IMPL_ISUPPORTS_INHERITED1(nsXULSelectableAccessible, nsAccessible, nsIAccessibleSelectable)
NS_IMETHODIMP nsXULSelectableAccessible::ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState)
{
*aSelState = PR_FALSE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
if (xulMultiSelect) {
nsCOMPtr<nsIDOMNodeList> nodeList;
xulMultiSelect->GetChildNodes(getter_AddRefs(nodeList));
if (nodeList) {
nsCOMPtr<nsIDOMNode> node;
nodeList->Item(aIndex, getter_AddRefs(node));
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(node));
item->GetSelected(aSelState);
if (eSelection_Add == aMethod && !(*aSelState))
xulMultiSelect->AddItemToSelection(item);
else if (eSelection_Remove == aMethod && (*aSelState))
xulMultiSelect->RemoveItemFromSelection(item);
}
return NS_OK;
}
nsCOMPtr<nsIDOMXULSelectControlElement> xulSelect(do_QueryInterface(mDOMNode));
if (xulSelect) {
PRInt32 selIndex;
xulSelect->GetSelectedIndex(&selIndex);
if (selIndex == aIndex)
*aSelState = PR_TRUE;
if (eSelection_Add == aMethod && !(*aSelState))
xulSelect->SetSelectedIndex(aIndex);
else if (eSelection_Remove == aMethod && (*aSelState)) {
xulSelect->SetSelectedIndex(-1);
}
return NS_OK;
}
return NS_ERROR_FAILURE;
}
// Interface methods
NS_IMETHODIMP nsXULSelectableAccessible::GetSelectedChildren(nsISupportsArray **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
if (!accService)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISupportsArray> selectedAccessibles;
NS_NewISupportsArray(getter_AddRefs(selectedAccessibles));
if (!selectedAccessibles)
return NS_ERROR_OUT_OF_MEMORY;
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
if (xulMultiSelect) {
PRInt32 length = 0;
xulMultiSelect->GetSelectedCount(&length);
for (PRInt32 index = 0; index < length; index++) {
nsCOMPtr<nsIAccessible> tempAccessible;
nsCOMPtr<nsIDOMXULSelectControlItemElement> tempNode;
xulMultiSelect->GetSelectedItem(index, getter_AddRefs(tempNode));
nsCOMPtr<nsIDOMNode> tempDOMNode (do_QueryInterface(tempNode));
accService->CreateXULListitemAccessible(tempDOMNode, getter_AddRefs(tempAccessible));
if (tempAccessible)
selectedAccessibles->AppendElement(tempAccessible);
}
}
PRUint32 uLength = 0;
selectedAccessibles->Count(&uLength);
if (uLength != 0) { // length of nsISupportsArray containing selected options
*_retval = selectedAccessibles;
NS_ADDREF(*_retval);
}
return NS_OK;
}
// return the nth selected child's nsIAccessible object
NS_IMETHODIMP nsXULSelectableAccessible::RefSelection(PRInt32 aIndex, nsIAccessible **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
if (!accService)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULSelectControlItemElement> tempDOMNode;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
if (xulMultiSelect)
xulMultiSelect->GetSelectedItem(aIndex, getter_AddRefs(tempDOMNode));
nsCOMPtr<nsIDOMXULSelectControlElement> xulSelect(do_QueryInterface(mDOMNode));
if (xulSelect && aIndex == 0)
xulSelect->GetSelectedItem(getter_AddRefs(tempDOMNode));
if (tempDOMNode) {
nsCOMPtr<nsIAccessible> tempAccess;
accService->CreateXULListitemAccessible(tempDOMNode, getter_AddRefs(tempAccess));
*_retval = tempAccess;
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULSelectableAccessible::GetSelectionCount(PRInt32 *aSelectionCount)
{
*aSelectionCount = 0;
// For XUL multi-select control
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
if (xulMultiSelect)
return xulMultiSelect->GetSelectedCount(aSelectionCount);
// For XUL single-select control/menulist
nsCOMPtr<nsIDOMXULSelectControlElement> xulSelect(do_QueryInterface(mDOMNode));
if (xulSelect) {
PRInt32 index;
xulSelect->GetSelectedIndex(&index);
if (index >= 0)
*aSelectionCount = 1;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULSelectableAccessible::AddSelection(PRInt32 aIndex)
{
PRBool isSelected;
return ChangeSelection(aIndex, eSelection_Add, &isSelected);
}
NS_IMETHODIMP nsXULSelectableAccessible::RemoveSelection(PRInt32 aIndex)
{
PRBool isSelected;
return ChangeSelection(aIndex, eSelection_Remove, &isSelected);
}
NS_IMETHODIMP nsXULSelectableAccessible::IsChildSelected(PRInt32 aIndex, PRBool *_retval)
{
*_retval = PR_FALSE;
return ChangeSelection(aIndex, eSelection_GetState, _retval);
}
NS_IMETHODIMP nsXULSelectableAccessible::ClearSelection()
{
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
if (xulMultiSelect)
return xulMultiSelect->ClearSelection();
nsCOMPtr<nsIDOMXULSelectControlElement> xulSelect(do_QueryInterface(mDOMNode));
if (xulSelect)
return xulSelect->SetSelectedIndex(-1);
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULSelectableAccessible::SelectAllSelection(PRBool *_retval)
{
*_retval = PR_TRUE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect(do_QueryInterface(mDOMNode));
if (xulMultiSelect)
return xulMultiSelect->SelectAll();
// otherwise, don't support this method
*_retval = PR_FALSE;
return NS_OK;
}
/** ------------------------------------------------------ */
/** First, the common widgets */
/** ------------------------------------------------------ */
/** ----- nsXULSelectListAccessible ----- */
/** Default Constructor */
nsXULSelectListAccessible::nsXULSelectListAccessible(nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsXULSelectListAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LIST;
return NS_OK;
}
/**
* As a nsXULSelectListAccessible we can have the following states:
* STATE_MULTISELECTABLE
* STATE_EXTSELECTABLE
*/
NS_IMETHODIMP nsXULSelectListAccessible::GetAccState(PRUint32 *_retval)
{
*_retval = 0;
nsAutoString selectionTypeString;
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
NS_ASSERTION(element, "No nsIDOMElement for caption node!");
element->GetAttribute(NS_LITERAL_STRING("seltype"), selectionTypeString) ;
if (selectionTypeString.EqualsIgnoreCase("multiple"))
*_retval |= STATE_MULTISELECTABLE | STATE_EXTSELECTABLE;
return NS_OK;
}
/** ----- nsXULSelectOptionAccessible ----- */
/** Default Constructor */
nsXULSelectOptionAccessible::nsXULSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsXULMenuitemAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsXULSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LISTITEM;
return NS_OK;
}
/**
* As a nsXULSelectOptionAccessible we can have the following states:
* STATE_SELECTABLE
* STATE_SELECTED
* STATE_FOCUSED
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsXULSelectOptionAccessible::GetAccState(PRUint32 *_retval)
{
nsXULMenuitemAccessible::GetAccState(_retval);
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(mDOMNode));
PRBool isSelected = PR_FALSE;
item->GetSelected(&isSelected);
if (isSelected)
*_retval |= STATE_SELECTED;
return NS_OK;
}
/** ------------------------------------------------------ */
/** Secondly, the Listbox widget */
/** ------------------------------------------------------ */
/** ----- nsXULListboxAccessible ----- */
/** Constructor */
nsXULListboxAccessible::nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsXULSelectableAccessible(aDOMNode, aShell)
{
}
/**
* Let Accessible count them up
*/
NS_IMETHODIMP nsXULListboxAccessible::GetAccChildCount(PRInt32 *_retval)
{
return nsAccessible::GetAccChildCount(_retval);
}
/**
* As a nsXULListboxAccessible we can have the following states:
* STATE_FOCUSED
* STATE_READONLY
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsXULListboxAccessible::GetAccState(PRUint32 *_retval)
{
// Get focus status from base class
nsAccessible::GetAccState(_retval);
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
// see if we are multiple select if so set ourselves as such
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
if (element) {
nsAutoString selType;
element->GetAttribute(NS_LITERAL_STRING("seltype"), selType);
if (!selType.IsEmpty() && selType.Equals(NS_LITERAL_STRING("multiple")))
*_retval |= STATE_MULTISELECTABLE;
}
*_retval |= STATE_FOCUSABLE ;
return NS_OK;
}
/**
* Our value is the value of our ( first ) selected child. nsIDOMXULSelectElement
* returns this by default with GetValue().
*/
NS_IMETHODIMP nsXULListboxAccessible::GetAccValue(nsAString& _retval)
{
_retval.Truncate();
nsCOMPtr<nsIDOMXULSelectControlElement> select(do_QueryInterface(mDOMNode));
if (select) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
select->GetSelectedItem(getter_AddRefs(selectedItem));
if (selectedItem)
return selectedItem->GetLabel(_retval);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULListboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LIST;
return NS_OK;
}
/** ----- nsXULListitemAccessible ----- */
/** Constructor */
nsXULListitemAccessible::nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsXULMenuitemAccessible(aDOMNode, aShell)
{
}
/** Inherit the ISupports impl from nsAccessible, we handle nsIAccessibleSelectable */
NS_IMPL_ISUPPORTS_INHERITED0(nsXULListitemAccessible, nsXULMenuitemAccessible)
/**
* If there is a Listcell as a child ( not anonymous ) use it, otherwise
* default to getting the name from GetXULAccName
*/
NS_IMETHODIMP nsXULListitemAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMNode> child;
if (NS_SUCCEEDED(mDOMNode->GetFirstChild(getter_AddRefs(child)))) {
nsCOMPtr<nsIDOMElement> childElement (do_QueryInterface(child));
if (childElement) {
nsAutoString tagName;
childElement->GetLocalName(tagName);
if (tagName.Equals(NS_LITERAL_STRING("listcell"))) {
childElement->GetAttribute(NS_LITERAL_STRING("label"), _retval);
return NS_OK;
}
}
}
return GetXULAccName(_retval);
}
/**
*
*/
NS_IMETHODIMP nsXULListitemAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LISTITEM;
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsXULListitemAccessible::GetAccState(PRUint32 *_retval)
{
// nsAccessible::GetAccState(_retval); // get focused state
nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem (do_QueryInterface(mDOMNode));
if (listItem) {
PRBool isSelected;
listItem->GetSelected(&isSelected);
if (isSelected)
*_retval |= STATE_SELECTED;
nsCOMPtr<nsIDOMNode> domParent;
mDOMNode->GetParentNode(getter_AddRefs(domParent));
nsCOMPtr<nsIDOMXULMultiSelectControlElement> parent(do_QueryInterface(domParent));
if (parent) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> current;
parent->GetCurrentItem(getter_AddRefs(current));
if (listItem == current)
*_retval |= STATE_FOCUSED;
}
*_retval |= STATE_FOCUSABLE | STATE_SELECTABLE;
}
return NS_OK;
}
/** ------------------------------------------------------ */
/** Finally, the Combobox widgets */
/** ------------------------------------------------------ */
/** ----- nsXULComboboxAccessible ----- */
/** Constructor */
nsXULComboboxAccessible::nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsXULSelectableAccessible(aDOMNode, aShell)
{
}
/** We are a combobox */
NS_IMETHODIMP nsXULComboboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_COMBOBOX;
return NS_OK;
}
/**
* We always have 3 children: TextField, Button, Window. In that order
*/
NS_IMETHODIMP nsXULComboboxAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 3;
return NS_OK;
}
/**
* As a nsComboboxAccessible we can have the following states:
* STATE_FOCUSED
* STATE_READONLY
* STATE_FOCUSABLE
* STATE_HASPOPUP
* STATE_EXPANDED
* STATE_COLLAPSED
*/
NS_IMETHODIMP nsXULComboboxAccessible::GetAccState(PRUint32 *_retval)
{
// Get focus status from base class
nsAccessible::GetAccState(_retval);
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (menuList) {
PRBool isOpen;
menuList->GetOpen(&isOpen);
if (isOpen)
*_retval |= STATE_EXPANDED;
else
*_retval |= STATE_COLLAPSED;
}
*_retval |= STATE_HASPOPUP | STATE_READONLY | STATE_FOCUSABLE;
return NS_OK;
}
/**
* Our value is the name of our ( first ) selected child. nsIDOMXULSelectElement
* returns this by default with GetValue().
*/
NS_IMETHODIMP nsXULComboboxAccessible::GetAccValue(nsAString& _retval)
{
// The first accessible child is the text accessible that contains the name of the selected element.
// This is our value
nsCOMPtr<nsIAccessible> firstChild;
GetAccFirstChild(getter_AddRefs(firstChild));
return firstChild->GetAccName(_retval);
}

View File

@ -1,185 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
* Kyle Yuan (kyle.yuan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULSelectAccessible_h__
#define __nsXULSelectAccessible_h__
#include "nsCOMPtr.h"
#include "nsIAccessibleSelectable.h"
#include "nsIDOMNode.h"
#include "nsIWeakReference.h"
#include "nsSelectAccessible.h"
#include "nsXULMenuAccessible.h"
/**
* Selects, Listboxes and Comboboxes, are made up of a number of different
* widgets, some of which are shared between the two. This file contains
* all of the widgets for both of the Selects, for XUL only. Some of them
* extend classes from nsSelectAccessible.cpp, which contains base classes
* that are also extended by the XUL Select Accessibility support.
*
* Listbox:
* - nsXULListboxAccessible
* - nsXULSelectListAccessible
* - nsXULSelectOptionAccessible
*
* Comboboxes:
* - nsXULComboboxAccessible <menulist />
* - nsHTMLTextFieldAccessible
* - nsXULComboboxButtonAccessible
* - nsXULSelectListAccessible <menupopup />
* - nsXULSelectOptionAccessible(s) <menuitem />
*/
/** ------------------------------------------------------ */
/** First, the common widgets */
/** ------------------------------------------------------ */
/*
* The basic implemetation of nsIAccessibleSelectable.
*/
class nsXULSelectableAccessible : public nsAccessible,
public nsIAccessibleSelectable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESELECTABLE
nsXULSelectableAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULSelectableAccessible() {}
protected:
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
};
/*
* The list that contains all the options in the select.
*/
class nsXULSelectListAccessible : public nsAccessible
{
public:
nsXULSelectListAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULSelectListAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
/*
* Options inside the select, contained within the list
*/
class nsXULSelectOptionAccessible : public nsXULMenuitemAccessible
{
public:
nsXULSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULSelectOptionAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
static nsresult GetFocusedOptionNode(nsIWeakReference *aPresShell, nsIDOMNode *aListNode, nsCOMPtr<nsIDOMNode>& aFocusedOptionNode);
};
/** ------------------------------------------------------ */
/** Secondly, the Listbox widget */
/** ------------------------------------------------------ */
/*
* A class the represents the XUL Listbox widget.
*/
class nsXULListboxAccessible : public nsXULSelectableAccessible
{
public:
nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULListboxAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
};
/**
* Listitems -- used in listboxes
*/
class nsXULListitemAccessible : public nsXULMenuitemAccessible
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULListitemAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
/** ------------------------------------------------------ */
/** Finally, the Combobox widgets */
/** ------------------------------------------------------ */
/*
* A class the represents the XUL Combobox widget.
*/
class nsXULComboboxAccessible : public nsXULSelectableAccessible
{
public:
nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULComboboxAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
};
#endif

View File

@ -1,321 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsAccessibilityService.h"
#include "nsXULTabAccessible.h"
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIFrame.h"
#include "nsIPluginViewer.h"
#include "nsIScriptGlobalObject.h"
#include "nsIStyleContext.h"
#include "nsIWebShell.h"
#include "nsIWebShellWindow.h"
#include "nsplugindefs.h"
#include "nsPluginViewer.h"
/**
* XUL Tab
*/
/** Constructor */
nsXULTabAccessible::nsXULTabAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsLeafAccessible(aNode, aShell)
{
}
/**
* Might need to use the GetXULAccName method from nsFormControlAcc.cpp
*/
NS_IMETHODIMP nsXULTabAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMXULSelectControlItemElement> tab(do_QueryInterface(mDOMNode));
if (tab)
return GetXULAccName(_retval);
return NS_ERROR_FAILURE;
}
/** Only one action available */
NS_IMETHODIMP nsXULTabAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = eSingle_Action;
return NS_OK;
}
/** Return the name of our only action */
NS_IMETHODIMP nsXULTabAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
{
if (index == eAction_Click) {
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("switch"), _retval);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
/** Tell the tab to do it's action */
NS_IMETHODIMP nsXULTabAccessible::AccDoAction(PRUint8 index)
{
if (index == eAction_Switch) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> tab(do_QueryInterface(mDOMNode));
if ( tab )
{
tab->Click();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_INVALID_ARG;
}
/** We are a tab */
NS_IMETHODIMP nsXULTabAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PAGETAB;
return NS_OK;
}
/**
* Possible states: focused, focusable, unavailable(disabled), offscreen
*/
NS_IMETHODIMP nsXULTabAccessible::GetAccState(PRUint32 *_retval)
{
// get focus and disable status from base class
nsLeafAccessible::GetAccState(_retval);
// In the past, tabs have been focusable in classic theme
// They may be again in the future
// Check style for -moz-user-focus: normal to see if it's focusable
*_retval &= ~STATE_FOCUSABLE;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
if (presShell && content) {
nsIFrame *frame = nsnull;
const nsStyleUserInterface* ui;
presShell->GetPrimaryFrameFor(content, &frame);
if (frame) {
frame->GetStyleData(eStyleStruct_UserInterface, ((const nsStyleStruct*&)ui));
if (ui->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL)
*_retval |= STATE_FOCUSABLE;
}
}
return NS_OK;
}
/**
* XUL TabBox
* to facilitate naming of the tabPanels object we will give this the name
* of the selected tab in the tabs object.
*/
/** Constructor */
nsXULTabBoxAccessible::nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell)
{
}
/** We are a window*/
NS_IMETHODIMP nsXULTabBoxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_WINDOW;
return NS_OK;
}
/** Possible states: normal */
NS_IMETHODIMP nsXULTabBoxAccessible::GetAccState(PRUint32 *_retval)
{
*_retval = 0;
return NS_OK;
}
/** 2 children, tabs, tabpanels */
NS_IMETHODIMP nsXULTabBoxAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 2;
return NS_OK;
}
/**
* XUL TabPanels
* XXX jgaunt -- this has to report the info for the selected child, reachable through
* the DOMNode. The TabPanels object has as its children the different
* vbox/hbox/whatevers that provide what you look at when you click on
* a tab.
* Here is how this will work: when asked about an object the tabPanels object will find
* out the selected child and create the tabPanel object using the child. That should wrap
* any XUL/HTML content in the child, since it is a simple nsAccessible basically.
* or maybe we just do that on creation. Not use the DOMnode we are given, but cache the selected
* DOMnode and then run from there.
*/
/** Constructor */
nsXULTabPanelsAccessible::nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsAccessible(aNode, aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
{
}
/** We are a Property Page */
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PROPERTYPAGE;
return NS_OK;
}
/**
* Possible values: unavailable
*/
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccState(PRUint32 *_retval)
{
// get focus and disable status from base class -- skip container because we have state
nsAccessible::GetAccState(_retval);
*_retval &= ~STATE_FOCUSABLE;
return NS_OK;
}
/**
* The name for the panel is the name from the tab associated with
* the panel. XXX not sure if the "panels" object should have the
* same name.
*/
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccName(nsAString& _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
nsAccessible::GetAccFirstChild(_retval);
if (*_retval == nsnull)
GetAccPluginChild(_retval);
return NS_OK;
}
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccLastChild(nsIAccessible **_retval)
{
nsAccessible::GetAccLastChild(_retval);
if (*_retval == nsnull)
GetAccPluginChild(_retval);
return NS_OK;
}
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccChildCount(PRInt32 *_retval)
{
nsAccessible::GetAccChildCount(_retval);
if (*_retval == 0) {
*_retval = 1;
}
return NS_OK;
}
nsresult nsXULTabPanelsAccessible::GetAccPluginChild(nsIAccessible **_retval)
{
// this big mess eventually gets the HWND for the full
// page plugin, and creates the shim class so we can
// get the IAccessible from the system in the widget/src code
nsCOMPtr<nsIDOMDocument> domDoc;
mDOMNode->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
if (doc) {
nsCOMPtr<nsIScriptGlobalObject> globalObj;
doc->GetScriptGlobalObject(getter_AddRefs(globalObj));
if (globalObj) {
nsCOMPtr<nsIDocShell> docShell;
globalObj->GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
if (webShell) {
nsCOMPtr<nsIWebShellContainer> container;
webShell->GetContainer(*getter_AddRefs(container));
nsCOMPtr<nsIWebShellWindow> wsWin(do_QueryInterface(container));
if (wsWin) {
nsCOMPtr<nsIWebShell> contentShell;
wsWin->GetContentWebShell(getter_AddRefs(contentShell));
nsCOMPtr<nsIDocShell> contentDocShell(do_QueryInterface(contentShell));
if (contentDocShell) {
nsCOMPtr<nsIContentViewer> contentViewer;
contentDocShell->GetContentViewer(getter_AddRefs(contentViewer));
nsCOMPtr<nsIPluginViewer> pluginViewer (do_QueryInterface(contentViewer));
if (pluginViewer) {
nsIPluginViewer *pViewer = pluginViewer.get();
PluginViewerImpl *viewer = (PluginViewerImpl*)pViewer;
#ifdef XP_WIN
// Plugin code tends to be very platform specific, need to rev this
// when linux/mac plugins come into the picture HWND == windows
HWND pluginPort = nsnull;
viewer->GetPluginPort(&pluginPort);
if (pluginPort != 0) {
if (mAccService) {
mAccService->CreateHTMLNativeWindowAccessible(mDOMNode, mPresShell, (PRInt32)pluginPort, _retval);
return NS_OK;
}
}
#else
*_retval = nsnull;
#endif
}
}
}
}
}
}
return NS_ERROR_FAILURE;
}
/**
* XUL Tabs - the s really stands for strip. this is a collection of tab objects
*/
/** Constructor */
nsXULTabsAccessible::nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsContainerAccessible(aNode, aShell)
{
}
/** We are a Page Tab List */
NS_IMETHODIMP nsXULTabsAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PAGETABLIST;
return NS_OK;
}

View File

@ -1,107 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsXULTabAccessible_H_
#define _nsXULTabAccessible_H_
// NOTE: alphabetically ordered
#include "nsBaseWidgetAccessible.h"
#include "nsFormControlAccessible.h"
#include "nsHTMLFormControlAccessible.h"
/** An individual tab */
class nsXULTabAccessible : public nsLeafAccessible
{
public:
nsXULTabAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
};
/**
* Contains a tabs object and a tabPanels object. A complete
* entity with relationships between tabs and content to
* be displayed in the tabpanels object
*/
class nsXULTabBoxAccessible : public nsAccessible
{
public:
nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
};
/**
* Represents the content area associated with the tabs object (when
* used together)
*/
class nsXULTabPanelsAccessible : public nsAccessible
{
public:
nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
protected:
nsresult GetAccPluginChild(nsIAccessible **_retval);
// data members
nsCOMPtr<nsIDOMNode> mGParentDOMNode;
nsCOMPtr<nsIDOMNode> mParentDOMNode;
nsCOMPtr<nsIAccessibilityService> mAccService;
};
/** merely a container of tab obejcts */
class nsXULTabsAccessible : public nsContainerAccessible
{
public:
nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
};
#endif

View File

@ -1,70 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsIDOMXULDescriptionElement.h"
#include "nsWeakReference.h"
#include "nsXULTextAccessible.h"
/**
* For XUL descriptions and labels
*/
nsXULTextAccessible::nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessible(aDomNode, aShell)
{
}
/* wstring getAccName (); */
NS_IMETHODIMP nsXULTextAccessible::GetAccName(nsAString& _retval)
{
nsCOMPtr<nsIDOMXULDescriptionElement> descriptionElement(do_QueryInterface(mDOMNode));
if (descriptionElement) {
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
return AppendFlatStringFromSubtree(content, &_retval);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULTextAccessible::GetAccState(PRUint32 *_retval)
{
// Labels and description can only have read only state
// They are not focusable or selectable
*_retval = STATE_READONLY;
return NS_OK;
}

View File

@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: John Gaunt (jgaunt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsXULTextAccessible_H_
#define _nsXULTextAccessible_H_
#include "nsTextAccessible.h"
class nsIWeakReference;
class nsXULTextAccessible : public nsTextAccessible
{
public:
nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,167 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Author: 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 __nsXULTreeAccessible_h__
#define __nsXULTreeAccessible_h__
#include "nsAccessible.h"
#include "nsBaseWidgetAccessible.h"
#include "nsCOMPtr.h"
#include "nsIDOMNode.h"
#include "nsIWeakReference.h"
#include "nsITreeBoxObject.h"
#include "nsITreeView.h"
#include "nsXULSelectAccessible.h"
#include "nsIAccessibleTable.h"
/*
* A class the represents the XUL Tree widget.
*/
class nsXULTreeAccessible : public nsXULSelectableAccessible,
public nsIAccessibleTable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESELECTABLE
NS_DECL_NSIACCESSIBLETABLE
nsXULTreeAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
static void GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
private:
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
nsCOMPtr<nsIAccessible> mCaption;
nsString mSummary;
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
};
/**
* Treeitems -- used in Trees
*/
class nsXULTreeitemAccessible : public nsLeafAccessible
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsXULTreeitemAccessible(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell, PRInt32 aRow, PRInt32 aColumn = -1);
virtual ~nsXULTreeitemAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccValue(nsAString& _retval);
NS_IMETHOD GetAccId(PRInt32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD AccRemoveSelection(void);
NS_IMETHOD AccTakeSelection(void);
NS_IMETHOD AccTakeFocus(void);
private:
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
PRInt32 mRow, mColumnIndex;
nsString mColumn;
};
class nsXULTreeColumnsAccessible : public nsAccessible,
public nsIAccessibleTable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
nsXULTreeColumnsAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeColumnsAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD AccDoAction(PRUint8 index);
private:
nsCOMPtr<nsIAccessible> mCaption;
nsString mSummary;
};
class nsXULTreeColumnitemAccessible : public nsLeafAccessible
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsXULTreeColumnitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeColumnitemAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccName(nsAString& _retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
};
#endif

17
mozilla/aclocal.m4 vendored
View File

@ -1,17 +0,0 @@
dnl
dnl Local autoconf macros used with mozilla
dnl The contents of this file are under the Public Domain.
dnl
builtin(include, build/autoconf/glib.m4)dnl
builtin(include, build/autoconf/gtk.m4)dnl
builtin(include, build/autoconf/libIDL.m4)dnl
builtin(include, build/autoconf/libIDL-2.m4)dnl
builtin(include, build/autoconf/nspr.m4)dnl
builtin(include, build/autoconf/libart.m4)dnl
builtin(include, build/autoconf/pkg.m4)dnl
builtin(include, build/autoconf/freetype2.m4)dnl
dnl
define(MOZ_TOPSRCDIR,.)dnl MOZ_TOPSRCDIR is used in altoptions.m4
builtin(include, build/autoconf/altoptions.m4)dnl

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla 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 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifeq (,$(filter WINNT OS2,$(OS_ARCH)))
DIRS = unix
endif
include $(topsrcdir)/config/rules.mk
# Install bloaturls.txt file for tinderbox Bloaty test.
libs:: bloaturls.txt
$(INSTALL) $< $(DIST)/bin

View File

@ -1,179 +0,0 @@
#! /usr/bin/env perl
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# acoutput-fast.pl - Quickly create makefiles that are in a common format.
#
# Most of the makefiles in mozilla only refer to two configure variables:
# @srcdir@
# @top_srcdir@
# However, configure does not know any better and it runs sed on each file
# with over 150 replacement rules (slow as molasses).
#
# This script takes a list of makefiles as input. For example,
#
# echo $MAKEFILES | acoutput-fast.pl
#
# The script creates each Makefile that only references @srcdir@ and
# @top_srcdir@. For other files, it lists them in a shell command that is
# printed to stdout:
#
# CONFIG_FILES="unhandled_files..."; export CONFIG_FILES
#
# This command can be used to have config.status create the unhandled
# files. For example,
#
# eval "echo $MAKEFILES | acoutput-fast.pl"
# AC_OUTPUT($MAKEFILES)
#
# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
#use File::Basename;
sub dirname {
my $dir = $_[0];
return '.' if not $dir =~ m%/%;
$dir =~ s%/[^/][^/]*$%%;
return $dir;
}
# Create one directory. Assumes it doesn't already exist.
# Will create parent(s) if needed.
sub create_directory {
my $dir = $_[0];
my $parent = dirname($dir);
create_directory($parent) if not -d $parent;
mkdir "$dir",0777;
}
# Create all the directories at once.
# This can be much faster than calling mkdir() for each one.
sub create_directories {
my @makefiles = @_;
my @dirs = ();
my $ac_file;
foreach $ac_file (@makefiles) {
push @dirs, dirname($ac_file);
}
# Call mkdir with the directories sorted by subdir count (how many /'s)
if (@dirs) {
my $mkdir_command = "mkdir -p ". join(' ', @dirs);
if (system($mkdir_command) != 0) {
print STDERR "Creating dirs all at once failed; trying one at atime\n";
foreach $dir (@dirs) {
if (not -d $dir) {
print STDERR "Creating directory $dir\n";
create_directory($dir);
}
}
}
}
}
if ($ARGV[0] =~ /^--srcdir=/) {
$ac_given_srcdir = (split /=/, shift @ARGV)[1];
} else {
$ac_given_srcdir = $0;
$ac_given_srcdir =~ s|/?build/autoconf/.*$||;
$ac_given_srcdir = '.' if $ac_given_srcdir eq '';
}
# Read list of makefiles from the stdin or,
# from files listed on the command-line.
#
@makefiles=();
push @makefiles, split while (<STDIN>);
# Create all the directories at once.
# This can be much faster than calling mkdir() for each one.
create_directories(@makefiles);
# Output the makefiles.
#
@unhandled=();
foreach $ac_file (@makefiles) {
if (not $ac_file =~ /Makefile$/ or $ac_file =~ /:/) {
push @unhandled, $ac_file;
next;
}
$ac_file_in = "$ac_given_srcdir/$ac_file.in";
$ac_dir = dirname($ac_file);
if ($ac_dir eq '.') {
$ac_dir_suffix = '';
$ac_dots = '';
} else {
$ac_dir_suffix = "/$ac_dir";
$ac_dir_suffix =~ s%^/\./%/%;
$ac_dots = $ac_dir_suffix;
$ac_dots =~ s%/[^/]*%../%g;
}
if ($ac_given_srcdir eq '.') {
$srcdir = '.';
if ($ac_dots eq '') {
$top_srcdir = '.'
} else {
$top_srcdir = $ac_dots;
$top_srcdir =~ s%/$%%;
}
} elsif ($ac_given_srcdir =~ m%^/% or $ac_given_srcdir =~ m%^.:/%) {
$srcdir = "$ac_given_srcdir$ac_dir_suffix";
$top_srcdir = "$ac_given_srcdir";
} else {
$srcdir = "$ac_dots$ac_given_srcdir$ac_dir_suffix";
$top_srcdir = "$ac_dots$ac_given_srcdir";
}
if (-e $ac_file) {
next if -M _ < -M $ac_file_in;
print STDERR "updating $ac_file\n";
} else {
print STDERR "creating $ac_file\n";
}
open (INFILE, "<$ac_file_in")
or ( warn "can't read $ac_file_in: No such file or directory\n" and next);
open (OUTFILE, ">$ac_file")
or ( warn "Unable to create $ac_file\n" and next);
while (<INFILE>) {
#if (/\@[_a-zA-Z]*\@.*\@[_a-zA-Z]*\@/) {
# warn "Two defines on a line:$ac_file:$.:$_";
# push @unhandled, $ac_file;
# last;
#}
s/\@srcdir\@/$srcdir/g;
s/\@top_srcdir\@/$top_srcdir/g;
if (/\@[_a-zA-Z]*\@/) {
warn "Unknown variable:$ac_file:$.:$_";
push @unhandled, $ac_file;
last;
}
print OUTFILE;
}
close INFILE;
close OUTFILE;
}
# Print the shell command to be evaluated by configure.
#
print "CONFIG_FILES=\"".join(' ', @unhandled)."\"; export CONFIG_FILES\n";

View File

@ -1,140 +0,0 @@
dnl The contents of this file are subject to the Netscape Public
dnl License Version 1.1 (the "License"); you may not use this file
dnl except in compliance with the License. You may obtain a copy of
dnl the License at http://www.mozilla.org/NPL/
dnl
dnl Software distributed under the License is distributed on an "AS
dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
dnl implied. See the License for the specific language governing
dnl rights and limitations under the License.
dnl
dnl The Original Code is mozilla.org code.
dnl
dnl The Initial Developer of the Original Code is Netscape
dnl Communications Corporation. Portions created by Netscape are
dnl Copyright (C) 1999 Netscape Communications Corporation. All
dnl Rights Reserved.
dnl
dnl Contributor(s):
dnl
dnl altoptions.m4 - An alternative way of specifying command-line options.
dnl These macros are needed to support a menu-based configurator.
dnl This file also includes the macro, AM_READ_MYCONFIG, for reading
dnl the 'myconfig.m4' file.
dnl Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
dnl MOZ_ARG_ENABLE_BOOL( NAME, HELP, IF-YES [, IF-NO [, ELSE]])
dnl MOZ_ARG_DISABLE_BOOL( NAME, HELP, IF-NO [, IF-YES [, ELSE]])
dnl MOZ_ARG_ENABLE_STRING( NAME, HELP, IF-SET [, ELSE])
dnl MOZ_ARG_ENABLE_BOOL_OR_STRING( NAME, HELP, IF-YES, IF-NO, IF-SET[, ELSE]]])
dnl MOZ_ARG_WITH_BOOL( NAME, HELP, IF-YES [, IF-NO [, ELSE])
dnl MOZ_ARG_WITHOUT_BOOL( NAME, HELP, IF-NO [, IF-YES [, ELSE])
dnl MOZ_ARG_WITH_STRING( NAME, HELP, IF-SET [, ELSE])
dnl MOZ_ARG_HEADER(Comment)
dnl MOZ_CHECK_PTHREADS( NAME, IF-YES [, ELSE ])
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
dnl MOZ_TWO_STRING_TEST(NAME, VAL, STR1, IF-STR1, STR2, IF-STR2 [, ELSE])
AC_DEFUN(MOZ_TWO_STRING_TEST,
[if test "[$2]" = "[$3]"; then
ifelse([$4], , :, [$4])
elif test "[$2]" = "[$5]"; then
ifelse([$6], , :, [$6])
else
ifelse([$7], ,
[AC_MSG_ERROR([Option, [$1], does not take an argument ([$2]).])],
[$7])
fi])
dnl MOZ_ARG_ENABLE_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE]])
AC_DEFUN(MOZ_ARG_ENABLE_BOOL,
[AC_ARG_ENABLE([$1], [$2],
[MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4])],
[$5])])
dnl MOZ_ARG_DISABLE_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE]])
AC_DEFUN(MOZ_ARG_DISABLE_BOOL,
[AC_ARG_ENABLE([$1], [$2],
[MOZ_TWO_STRING_TEST([$1], [$enableval], no, [$3], yes, [$4])],
[$5])])
dnl MOZ_ARG_ENABLE_STRING(NAME, HELP, IF-SET [, ELSE])
AC_DEFUN(MOZ_ARG_ENABLE_STRING,
[AC_ARG_ENABLE([$1], [$2], [$3], [$4])])
dnl MOZ_ARG_ENABLE_BOOL_OR_STRING(NAME, HELP, IF-YES, IF-NO, IF-SET[, ELSE]]])
AC_DEFUN(MOZ_ARG_ENABLE_BOOL_OR_STRING,
[ifelse([$5], ,
[errprint([Option, $1, needs an "IF-SET" argument.
])
m4exit(1)],
[AC_ARG_ENABLE([$1], [$2],
[MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4], [$5])],
[$6])])])
dnl MOZ_ARG_WITH_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE])
AC_DEFUN(MOZ_ARG_WITH_BOOL,
[AC_ARG_WITH([$1], [$2],
[MOZ_TWO_STRING_TEST([$1], [$withval], yes, [$3], no, [$4])],
[$5])])
dnl MOZ_ARG_WITHOUT_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE])
AC_DEFUN(MOZ_ARG_WITHOUT_BOOL,
[AC_ARG_WITH([$1], [$2],
[MOZ_TWO_STRING_TEST([$1], [$withval], no, [$3], yes, [$4])],
[$5])])
dnl MOZ_ARG_WITH_STRING(NAME, HELP, IF-SET [, ELSE])
AC_DEFUN(MOZ_ARG_WITH_STRING,
[AC_ARG_WITH([$1], [$2], [$3], [$4])])
dnl MOZ_ARG_HEADER(Comment)
dnl This is used by webconfig to group options
define(MOZ_ARG_HEADER, [# $1])
dnl
dnl Apparently, some systems cannot properly check for the pthread
dnl library unless <pthread.h> is included so we need to test
dnl using it
dnl
dnl MOZ_CHECK_PTHREADS(lib, success, failure)
AC_DEFUN(MOZ_CHECK_PTHREADS,
[
AC_MSG_CHECKING([for pthread_create in -l$1])
echo "
#include <pthread.h>
void *foo(void *v) { int a = 1; }
int main() {
pthread_t t;
if (!pthread_create(&t, 0, &foo, 0)) {
pthread_join(t, 0);
}
exit(0);
}" > dummy.c ;
echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5;
${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5;
_res=$? ;
rm -f dummy.c dummy${ac_exeext} ;
if test "$_res" = "0"; then
AC_MSG_RESULT([yes])
[$2]
else
AC_MSG_RESULT([no])
[$3]
fi
])
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
AC_DEFUN(MOZ_READ_MOZCONFIG,
[AC_REQUIRE([AC_INIT_BINSH])dnl
# Read in '.mozconfig' script to set the initial options.
# See the mozconfig2configure script for more details.
_AUTOCONF_TOOLS_DIR=`dirname [$]0`/[$1]/build/autoconf
. $_AUTOCONF_TOOLS_DIR/mozconfig2configure])
dnl This gets inserted at the top of the configure script
MOZ_READ_MOZCONFIG(MOZ_TOPSRCDIR)

View File

@ -1,54 +0,0 @@
#!/bin/sh
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
# clean-config.sh - Removes all files generated by mozilla configure.
# Only removes files from the topsrcdir. To clean up an objdir,
# simply remove the directory and start over.
#
# Usage:
# 1. cd <topsrcdir>
# 2. build/autoconf/clean-config.sh
#
# Send comments, improvements, bugs to slamm@netscape.com
topsrcdir=`cd \`dirname $0\`/../..; pwd`
if [ ! -f configure.in ]; then
echo "clean-config.sh only cleans the source tree. To run," 2>&1
echo " cd $topsrcdir; build/autoconf/clean-config.sh" 2>&1
echo " (To clean a separate objdir, simple remove the directory.)" 2>&1
exit 1
fi
if [ -f mailnews/makefiles ]; then
MOZ_MAIL_NEWS=1
export MOZ_MAIL_NEWS
fi
. allmakefiles.sh
rm -fr $MAKEFILES \
config-defs.h \
config.cache \
config.log \
config.status \
$NULL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,137 +0,0 @@
# Configure paths for FreeType2
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
dnl AM_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
dnl
AC_DEFUN(AC_CHECK_FT2,
[dnl
dnl Get the cflags and libraries from the freetype-config script
dnl
AC_ARG_WITH(freetype-prefix,
[ --with-ft-prefix=PFX Prefix where FreeType is installed (optional)],
ft_config_prefix="$withval", ft_config_prefix="")
AC_ARG_WITH(freetype-exec-prefix,
[ --with-ft-exec-prefix=PFX
Exec prefix where FreeType is installed (optional)],
ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
AC_ARG_ENABLE(freetypetest,
[ --disable-freetypetest
Do not try to compile and run a test FreeType program],
[], enable_fttest=yes)
if test x$ft_config_exec_prefix != x ; then
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
fi
fi
if test x$ft_config_prefix != x ; then
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
fi
fi
AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
min_ft_version=ifelse([$1], ,6.1.0,$1)
AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
no_ft=""
if test "$FT2_CONFIG" = "no" ; then
no_ft=yes
else
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ft_min_major_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_min_minor_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_min_micro_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_fttest" = "xyes" ; then
ft_config_is_lt=no
if test $ft_config_major_version -lt $ft_min_major_version ; then
ft_config_is_lt=yes
else
if test $ft_config_major_version -eq $ft_min_major_version ; then
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
ft_config_is_lt=yes
else
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
ft_config_is_lt=yes
fi
fi
fi
fi
fi
if test "x$ft_config_is_lt" = "xyes" ; then
ifelse([$3], , :, [$3])
AC_MSG_RESULT(no)
else
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $FT2_CFLAGS"
LIBS="$FT2_LIBS $LIBS"
dnl
dnl Sanity checks for the results of freetype-config to some extent
dnl
AC_TRY_RUN([
#include <ft2build.h>
#include FT_FREETYPE_H
#include <stdio.h>
#include <stdlib.h>
int
main()
{
FT_Library library;
FT_Error error;
error = FT_Init_FreeType(&library);
if (error)
return 1;
else
{
FT_Done_FreeType(library);
return 0;
}
}
],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi # test $ft_config_version -lt $ft_min_version
fi # test "x$enable_fttest" = "xyes"
fi # test "$FT2_CONFIG" = "no"
if test "x$ft_config_is_lt" != "xyes" ; then
if test "x$no_ft" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$FT2_CONFIG" = "no" ; then
echo "*** The freetype-config script installed by FreeType 2 could not be found."
echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the FT2_CONFIG environment variable to the"
echo "*** full path to freetype-config."
else
echo "*** The FreeType test program failed to run. If your system uses"
echo "*** shared libraries and they are installed outside the normal"
echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
echo "*** (or whatever is appropiate for your system) is correctly set."
fi
FT2_CFLAGS=""
FT2_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(FT2_CFLAGS)
AC_SUBST(FT2_LIBS)
fi
])

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