Compare commits
19 Commits
NETSCAPE_6
...
ANDREAS_UR
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c86870f5e | ||
|
|
84c217287c | ||
|
|
40ec36a902 | ||
|
|
fd74881a7b | ||
|
|
bee1aca88c | ||
|
|
dc8e2d7f7e | ||
|
|
b24787e0e6 | ||
|
|
b1b3984f3e | ||
|
|
af0cb392de | ||
|
|
81d5e263bd | ||
|
|
021efc0b2e | ||
|
|
e1a20fe5a9 | ||
|
|
5079c60d4a | ||
|
|
2872c03bbf | ||
|
|
f62f30f03f | ||
|
|
9cab54d2a7 | ||
|
|
8c34037440 | ||
|
|
b50eb4f01e | ||
|
|
540b6c9118 |
@@ -26,22 +26,22 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/build/unix/modules.mk
|
||||
|
||||
ifneq ($(BUILD_MODULES),all)
|
||||
|
||||
DIRS = $(BUILD_MODULE_DIRS)
|
||||
EXPORT_DIRS = $(BUILD_MODULE_DEP_DIRS)
|
||||
|
||||
else
|
||||
|
||||
DIRS = config build
|
||||
|
||||
ifdef MOZ_JAVA_SUPPLEMENT
|
||||
DIRS += \
|
||||
java/util \
|
||||
java/webclient \
|
||||
$(NULL)
|
||||
#
|
||||
ifdef MOZ_L10N
|
||||
DIRS += l10n
|
||||
endif
|
||||
|
||||
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
ifdef USE_NSPR_AUTOCONF
|
||||
DIRS += nsprpub
|
||||
else
|
||||
DIRS += $(topsrcdir)/nsprpub
|
||||
# NSPR does not use Makefile.in
|
||||
STATIC_MAKEFILES := $(topsrcdir)/nsprpub
|
||||
endif
|
||||
endif
|
||||
|
||||
# boehm needs to be built before XPCOM
|
||||
@@ -49,17 +49,7 @@ ifdef GC_LEAK_DETECTOR
|
||||
DIRS += gc/boehm
|
||||
endif
|
||||
|
||||
DIRS += $(NSPRPUB_DIR)
|
||||
|
||||
DIRS += dbm modules/libreg js string xpcom js/src/xpconnect
|
||||
|
||||
ifdef MOZ_OJI
|
||||
DIRS += js/src/liveconnect
|
||||
endif
|
||||
|
||||
ifdef MOZ_JSDEBUGGER
|
||||
DIRS += js/jsd
|
||||
endif
|
||||
DIRS += dbm modules/libreg xpcom
|
||||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
DIRS += modules/zlib
|
||||
@@ -69,75 +59,42 @@ ifndef MOZ_NATIVE_JPEG
|
||||
DIRS += jpeg
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XLIB
|
||||
DIRS += gfx/src/xlibrgb widget/src/xlibxtbin
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
DIRS += widget/src/gtksuperwin widget/src/gtkxtbin
|
||||
endif
|
||||
|
||||
# Linux and Solaris installer needs standalone libjar, hence standalone zlib
|
||||
ifneq (,$(filter Linux SunOS,$(OS_ARCH)))
|
||||
DIRS += modules/zlib/standalone
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
widget/timer \
|
||||
include \
|
||||
modules/libutil \
|
||||
netwerk \
|
||||
modules/mpfilelocprovider \
|
||||
uriloader \
|
||||
intl \
|
||||
js \
|
||||
modules/libpref \
|
||||
modules/libimg \
|
||||
modules/oji \
|
||||
modules/plugin \
|
||||
modules/libjar \
|
||||
caps \
|
||||
rdf \
|
||||
expat \
|
||||
htmlparser \
|
||||
widget/timer \
|
||||
gfx \
|
||||
gfx2 \
|
||||
modules/libpr0n \
|
||||
modules/plugin \
|
||||
dom \
|
||||
view \
|
||||
widget \
|
||||
content \
|
||||
layout \
|
||||
db \
|
||||
rdf \
|
||||
docshell \
|
||||
webshell \
|
||||
embedding \
|
||||
editor \
|
||||
sun-java \
|
||||
profile \
|
||||
themes \
|
||||
$(NULL)
|
||||
|
||||
ifdef ACCESSIBILITY
|
||||
DIRS += accessible
|
||||
endif
|
||||
|
||||
# This must preceed xpfe
|
||||
ifdef MOZ_JPROF
|
||||
DIRS += tools/jprof
|
||||
endif
|
||||
|
||||
ifdef MOZ_BUILD_XPFE
|
||||
DIRS += xpfe
|
||||
endif
|
||||
|
||||
DIRS += xpinstall
|
||||
|
||||
ifdef MOZ_PSM
|
||||
DIRS += security/manager
|
||||
endif
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
DIRS += directory/c-sdk/ldap directory/xpcom
|
||||
endif
|
||||
|
||||
ifdef MOZ_EXTENSIONS
|
||||
DIRS += extensions
|
||||
endif
|
||||
@@ -150,38 +107,20 @@ ifdef MOZ_LEAKY
|
||||
DIRS += tools/leaky
|
||||
endif
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += xpcom/tests
|
||||
ifdef MOZ_JPROF
|
||||
DIRS += tools/jprof
|
||||
endif
|
||||
|
||||
DIRS += l10n
|
||||
|
||||
ifneq (,$(MOZ_STATIC_COMPONENTS)$(MOZ_META_COMPONENTS))
|
||||
DIRS += modules/staticmod
|
||||
endif
|
||||
|
||||
DIRS += xpfe/bootstrap
|
||||
|
||||
endif # BUILD_MODULES == all
|
||||
|
||||
STATIC_MAKEFILES := $(NSPRPUB_DIR) directory/c-sdk/ldap
|
||||
|
||||
ifdef MOZ_PSM
|
||||
STATIC_MAKEFILES += security/nss
|
||||
endif
|
||||
|
||||
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 \
|
||||
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
export::
|
||||
+$(LOOP_OVER_EXPORT_DIRS)
|
||||
real_all: all
|
||||
|
||||
distclean::
|
||||
cat unallmakefiles | $(XARGS) rm -f
|
||||
rm -f unallmakefiles $(DIST_GARBAGE)
|
||||
real_export: export
|
||||
|
||||
real_libs: libs
|
||||
|
||||
real_install: install
|
||||
|
||||
real_clobber: clobber
|
||||
|
||||
real_depend: depend
|
||||
|
||||
@@ -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.
|
||||
@@ -1,3 +0,0 @@
|
||||
For mozilla-the-client build instructions, please read:
|
||||
http://www.mozilla.org/build/
|
||||
|
||||
BIN
mozilla/README/mozilla/ide-menubar.gif
Normal file
BIN
mozilla/README/mozilla/ide-menubar.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
mozilla/README/mozilla/ide-prefs.gif
Normal file
BIN
mozilla/README/mozilla/ide-prefs.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
400
mozilla/README/mozilla/mac-build.html
Normal file
400
mozilla/README/mozilla/mac-build.html
Normal file
@@ -0,0 +1,400 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Building Mozilla on the Macintosh PPC platform</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
<HR>
|
||||
<H1>
|
||||
Building Mozilla on the Macintosh PPC platform</H1>
|
||||
|
||||
<H2>
|
||||
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
|
||||
</H2>
|
||||
v 1.0, June 1998
|
||||
|
||||
<P>
|
||||
<HR><I>How to build Mozilla on a Macintosh PPC System.</I>
|
||||
<HR>
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<H2>4. <A HREF="#s4"> Credits </A></H2>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
What this document is: A guide to building the Mozilla application.
|
||||
This includes:
|
||||
<OL>
|
||||
<LI> A listing of the development tools you will need to build Mozilla. </LI>
|
||||
<LI> A list of environment variables you will need to set before building. </LI>
|
||||
</OL>
|
||||
<P>
|
||||
If you're looking for documentation on developing features or fixing bugs,
|
||||
the Mozilla
|
||||
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
|
||||
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
|
||||
are probably what you're looking for.
|
||||
<P>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Building Mozilla </A></H2>
|
||||
<P>
|
||||
<UL>Each of the following subsections describes, or gives references to
|
||||
descriptions of, the steps necessary to build Mozilla.
|
||||
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
There are two principal ways of getting the code,
|
||||
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
|
||||
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
|
||||
CVS will provide the most current code for building, but is
|
||||
slower than ftp (takes longer to download).
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
|
||||
The following need to be installed:
|
||||
<UL>
|
||||
<LI>CodeWarrior (CW) 2 - obtainable from
|
||||
<A HREF="http://www.metrowerks.com">Metrowerks</A>.
|
||||
See <A HREF="#s3">Common Sticking Points</A> if you have a different
|
||||
version.
|
||||
</LI>
|
||||
|
||||
<LI>PowerPlant 1.8 - obtainable from the CodeWarrior CD.</LI>
|
||||
|
||||
<LI>MSL - the Metrowerks Standard Library, obtainable from the
|
||||
CodeWarrior CD</LI>
|
||||
|
||||
<LI><A HREF="ftp://ftp.boingo.com//dan/WASTE/waste-13.hqx">WASTE
|
||||
1.3</A></LI>
|
||||
|
||||
<LI><A HREF="http://www.bact.wisc.edu/CWASTEEdit/CWASTEEdit.sit.hqx">CWASTE
|
||||
1.6.2</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://ftp.scripting.com/userland/menuSharingToolkit4.1.sit.hqx">
|
||||
Menu Sharing Toolkit</A> (from UserLand)</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://ftp.digitalalchemy.com/pub/digitalalchemy/mercutio-SDK.sit.bin">
|
||||
Mercutio 1.5 SDK</A> (only download the SDK, not the entire package, else
|
||||
the access paths will be wrong)</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://ftp.share.com/pub/internet-configuration/ICProgKit1.4.sit">
|
||||
Internet Config 1.4 SDK</A></LI>
|
||||
|
||||
<LI><A HREF="http://www.mooseyard.com/Jens/Software/">AEGizmos
|
||||
1.4.2</A></LI>
|
||||
|
||||
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_tool.bin">
|
||||
MacPerl 5 MPW Tool</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_appl.bin">MacPerl 5 Application</A></LI>
|
||||
|
||||
<LI>MakeStub - MPW (installed with CodeWarrior Heaven option). If
|
||||
you choose not to install MPW, it is located on the MacOS Tools CD
|
||||
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
|
||||
|
||||
<LI>RunTSScript - in Mozilla source distribution
|
||||
(mozilla:build:mac:RunTSScript), needs to be installed by hand</LI>
|
||||
|
||||
<LI><A HREF="ftp://dev.apple.com/devworld/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/ToolServer.sit.hqx">ToolServer</A>
|
||||
- or in the CW distribution (CW Pro 2 Tools:Apple Development
|
||||
Tools:ToolServer 3.4.1.sit). <B>We recommend pulling it off the
|
||||
CD</B> because it comes with configuration files for CodeWarrior
|
||||
which you would have to create manually were you to pull it off
|
||||
the net.</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://people.netscape.com/sfraser/software/NewAlias_tool.sit.hqx">
|
||||
New Alias MPW Tool</A> An MPW tool that creates Finder aliases for files.
|
||||
</LI>
|
||||
|
||||
<LI>StreamEdit MPW Tool - MPW (installed with CodeWarrior Heaven option). If
|
||||
you choose not to install MPW, it is located on the MacOS Tools CD
|
||||
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
|
||||
</LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="ftp://dev.apple.com/devworld/Periodicals/develop/develop25/develop_Issue_25_code/ToolFrontEnd.sit.hqx">ToolFrontEnd</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="http://sunsite.cnlab-switch.ch/ftp/software/platform/macos/src/HTML/MPW_C.html">
|
||||
patch 2.1</A></LI>
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
Hardware/OS
|
||||
<UL>
|
||||
<LI>To build Navigator, you need a fast PPC Mac. The faster the
|
||||
better. You can't build with a 68K machine because we have too many
|
||||
resources, and the build process will crash when trying to generate
|
||||
resources out of our cross-platform strings. See the discussion below
|
||||
for a way around this.
|
||||
</LI>
|
||||
<LI>You will need about 96 MB of physical RAM to "fast link" the app.
|
||||
You can still fast link if you give your machine 96 MB of virtual
|
||||
memory, but then the VM hit is large enough to counteract any
|
||||
improvement. One of our beta testers had a machine with only 64MB of
|
||||
physical RAM (VM was off) and it ran out of memory trying to link.
|
||||
Turning VM on got it to link, but build time increased greatly.
|
||||
</LI>
|
||||
<LI>Reports from the net indicate that the optimized version
|
||||
(MozillaPPC) take much less RAM to build than the 96MB we suggest. If
|
||||
you are running out of memory, try building that instead of the debug
|
||||
version (the debug symbols require a lot of RAM come link time).
|
||||
</LI>
|
||||
<LI>You should be ok with a 400MB disk partition, even when fully
|
||||
built. This does not include tools like the IDE, just source.
|
||||
</LI>
|
||||
<LI>On an HFS+ volume, a full build takes about 110MB. HFS+ is good,
|
||||
but utilities are sparse.
|
||||
</LI>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>Install CodeWarrior from the CD. While it is large, installing
|
||||
the "CodeWarrior Heaven" option will guarantee that you have
|
||||
everything you need. This will give you PowerPlant, MSL, and MPW.
|
||||
If you choose to install less, proceed at your own risk.</LI>
|
||||
|
||||
<LI>In the Finder, increase the memory partition of the IDE to
|
||||
15MB (you can get by with 12, if need be).</LI>
|
||||
|
||||
<LI>Download ToolFrontEnd. After expanding it, in "ToolFrontEnd
|
||||
Folder:Drop-Ins" there are three items:
|
||||
|
||||
<UL>
|
||||
<LI><I>#include</I></LI>
|
||||
|
||||
<LI><I>ToolFrontEnd</I></LI>
|
||||
|
||||
<LI><I>ToolFrontEnd Panel</I></LI>
|
||||
</UL>
|
||||
|
||||
<P>Create a folder named "Include Scanners". Place the file
|
||||
"#include" into the Include Scanners folder. Move the Include
|
||||
Scanners folder to the CodeWarrior Plugins folder. Create a folder
|
||||
named "ToolFrontEnd". Place the files "ToolFrontEnd" and
|
||||
"ToolFrontEnd Panel" into the ToolFrontEnd folder. Place this
|
||||
folder in the CodeWarrior Plugins folder.</P></LI>
|
||||
|
||||
<LI>Open "ToolFrontEnd Panel" with ResEdit. Change the file type
|
||||
from <B>'Panl'</B> to <B>'PanL'</B>. Save.</LI>
|
||||
|
||||
<LI>Uncompress the StuffIt Archive for ToolServer. The goal is to
|
||||
let ToolServer and MPW share the same Tools directory so you don't
|
||||
need to have multiple versions of tools. Do the following:
|
||||
|
||||
<OL>
|
||||
<LI>Open ToolServer's Tools folder. There is one file called
|
||||
"RMetrowerks". </LI>
|
||||
|
||||
<LI>Move RMetrowerks to Tools folder of MPW. MPW folder must be
|
||||
at "Metrowerks:Codewarrior MPW:MPW" if you installed
|
||||
Codewarrior Heaven. </LI>
|
||||
|
||||
<LI>Remove ToolServer's Tools folder.</LI>
|
||||
|
||||
<LI>Now create an alias of Tools folder in "CodeWarrior MPW"
|
||||
and move it to your ToolServer folder. Rename the alias
|
||||
(probably called "Tools alias") to "Tools"</LI>
|
||||
|
||||
|
||||
<LI><FONT COLOR="#FF0000"><B>IMPORTANT</B></FONT>: Make sure
|
||||
you only have one instance of ToolServer on your machine. If
|
||||
the build script finds the wrong one, the correct tools will
|
||||
not be found and strange things will happen.</LI>
|
||||
</OL>
|
||||
</LI>
|
||||
|
||||
<LI>After installing the MacPerl MPW Tool distribution (run the
|
||||
InstallerVISE application), in the "MacPerl ƒ" folder, there
|
||||
will be an MPW tool named "perl". Install this in MPW's tools
|
||||
folder.</LI>
|
||||
|
||||
<LI>Install the MacPerl Application (run the
|
||||
InstallerVISE application). You can install this anywhere, but it is
|
||||
recommended that you install it inside of your CodeWarrior folder for
|
||||
easy reference. After installation, you will need to set a preference
|
||||
to enable double-click launch of the perl scripts. This preference is set
|
||||
by going under the Edit Menu to Preferences. Click on the "Script" button
|
||||
and hit the radio button "Run Scripts opened from Finder"</LI>
|
||||
|
||||
<LI>Install the "patch", "MakeStub", "NewAlias" and "StreamEdit" Tools in the
|
||||
tools
|
||||
folder. Note that "MakeStub" and "StreamEdit" are automatically installed by the
|
||||
"CodeWarrior Heaven" install option.</LI>
|
||||
|
||||
<LI>Install RunTSScript (found in the Mozilla source distribution)
|
||||
in the compilers folder in your build environment
|
||||
("Metrowerks:Metrowerks Codewarrior:Codewarrior
|
||||
Plugins:Compilers")</LI>
|
||||
|
||||
<LI>Next, after downloading all the 3rd party software components,
|
||||
drag WASTE, CWASTE, Menu Sharing, Mercutio, Internet Config, and
|
||||
the AEGizmo folders (just as they are) into the "MacOS Support"
|
||||
folder in your build environment.</LI>
|
||||
|
||||
<LI>Start ToolServer from within CodeWarrior (or use MPW if you
|
||||
are brave enough). We're about to patch some files. Make sure the
|
||||
ToolServer menu is in the CodeWarrior menu bar by turning on the
|
||||
<A HREF="IDEPrefs.gif">preference</A> under the "Extras" panel in
|
||||
the IDE Preferences (not the project preferences!). The menu bar
|
||||
should look like this:
|
||||
|
||||
|
||||
<P><IMG SRC="IDEMenuBar.gif" WIDTH=359 HEIGHT=20 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
|
||||
|
||||
<P>Choose "Start ToolServer" from the ToolServer menu (this is the
|
||||
icon menu between "Window" and "Help" in the menubar above). You
|
||||
will now see a window with no close box. This is your ToolServer
|
||||
Worksheet where you will type (or cut & paste) the commands
|
||||
for the following steps.</P>
|
||||
|
||||
<P>In case you have never used MPW/ToolServer before, the
|
||||
following is <B>very important</B>. Pressing "return" does not
|
||||
execute commands like you might think. It just inserts a newline
|
||||
into the worksheet like a normal text editor. <B>To actually get
|
||||
ToolServer to execute the command, you must press "Enter" (lower
|
||||
right of numeric keypad).</B> This executes the line that the
|
||||
cursor is on, and only that line. If you want to execute multiple
|
||||
lines at once, select them all and hit Enter.</P></LI>
|
||||
|
||||
<LI>Set the shell variables {IDE} and {Source} to the correct
|
||||
paths for your build environment. {IDE} is where your CodeWarrior
|
||||
IDE is located. {Source} is the folder containing the toplevel
|
||||
"ns" folder of the Mozilla source. Mine look like this (don't
|
||||
forget to keep the quotes if your path includes spaces), yours
|
||||
will almost certainly be different (<FONT COLOR="#FF0000">to
|
||||
punctuate this, the things you need to change are in red</FONT>).
|
||||
|
||||
<PRE>Set IDE "<FONT COLOR="#FF0000">Develop:Source331 Build Environment:CW Pro 2:Metrowerks CodeWarrior:</FONT>"
|
||||
Set Source "<FONT COLOR="#FF0000">Source:FreeSource:</FONT>"</PRE>
|
||||
</LI>
|
||||
|
||||
<LI>If you are using CWPro2, execute the following lines to patch
|
||||
LDropFlag to draw correcly over non-white backgrounds.
|
||||
|
||||
<PRE>directory "{IDE}MacOS Support:PowerPlant:_In Progress:_Table Classes:"
|
||||
patch LDropFlag.cp "{Source}mozilla:lib:mac:patches:LDropFlag.patch"
|
||||
duplicate -y "{Source}mozilla:lib:mac:patches:DropFlag Icons.rsrc" "{IDE}MacOS Support:PowerPlant:PowerPlant Resources:"</PRE></LI>
|
||||
|
||||
<LI>Execute the following lines to patch menusharing.c to allow it
|
||||
to compile with the new Universal Headers. It references an
|
||||
obsolete header file (GestaltEqu.h).
|
||||
|
||||
<PRE>directory "{IDE}MacOS Support:Menu Sharing Toolkit 4.1:"
|
||||
patch menusharing.c "{Source}mozilla:lib:mac:patches:menusharing.patch"</PRE></LI>
|
||||
|
||||
|
||||
<LI>If you are using CWPro2 straight off the CD, you need to patch
|
||||
AppleEvents.r to fix a problem with the Universal Headers (the
|
||||
definition of the 'aedt' resource was omitted). <B>You do not have
|
||||
to do this if you have applied the netborne patch to Pro2e
|
||||
</B> because it has been fixed.
|
||||
|
||||
<PRE>directory "{IDE}MacOS Support:Headers:Rez Headers:"
|
||||
patch AppleEvents.r "{Source}mozilla:lib:mac:patches:AppleEvents.r.patch"</PRE></LI>
|
||||
|
||||
<LI>You need to patch stat.mac.h to fix a problem in MSL where
|
||||
lines were omitted.
|
||||
|
||||
<PRE>directory "{IDE}Metrowerks Standard Library:MSL C:MSL Mac:Public Includes"
|
||||
patch stat.mac.h "{Source}mozilla:lib:mac:patches:stat.mac.h.patch"</PRE></LI>
|
||||
|
||||
<LI>Congratulations! Now you are ready to build. Once these steps
|
||||
are done, you don't have to repeat these setups the next
|
||||
time!</LI>
|
||||
</OL>
|
||||
|
||||
|
||||
<P>
|
||||
|
||||
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
|
||||
<UL>
|
||||
<P>In the folder mozilla:build:mac:, there are several Perl scripts with
|
||||
names of the form BuildMozillaXXX.pl, where XXX is "Optimized",
|
||||
"Debug", "Tinderbox", et al. Each script builds the corresponding
|
||||
version of Mozilla. If you configured the MacPerl application to
|
||||
execute scripts that are opened from the finder, all you have to do is
|
||||
double click on the appropriate one; otherwise, launch MacPerl, and
|
||||
run the appropriate script from the "Run Script..." menu item.</P>
|
||||
|
||||
<P>These `configured build' scripts are simple, and you might want to
|
||||
make your own to force your build to StopForErrors(), or alternatively
|
||||
DontStopForErrors(), et al. You can set up certain build-script
|
||||
variables and (soon) compile-time flags. Compare the supplied scripts
|
||||
to figure out what you might want. Note that CodeWarriorLib, Moz.pm,
|
||||
and BuildList.pm, are AppleScript libraries and Perl modules meant to
|
||||
be used by a `configured build'. Use your favorite POD viewer (Shuck
|
||||
comes with MacPerl) to view the documentation in the Perl scripts.</P>
|
||||
|
||||
<P>If there were any errors in any of the projects along the way, the
|
||||
script will stop at that point and the IDE will tell you the errors.
|
||||
You can fix them and make sure they current project builds, but to
|
||||
continue the automation, you have to start from the beginning by
|
||||
double-clicking the script again. This isn't quite as bad as it
|
||||
sounds because the previous projects are already built (unless you
|
||||
changed some major header file). Please note that stopping the script
|
||||
once it has started is difficult. We are working to address
|
||||
this issue.</P>
|
||||
|
||||
<P>After the build is complete, you can find aliases to the built libraries
|
||||
and the final Mozilla application. Debug builds are built to
|
||||
Mozilla:dist:client_debug, while optimized builds are built to Mozilla:dist:client.
|
||||
</P>
|
||||
|
||||
<P>Don't worry too much about the numerous warnings generated during
|
||||
the build. We try our best to get the XP teams to use real compilers,
|
||||
but alas, they continue to write warning-laden code. There is also
|
||||
some generated code (Java is one example) that has a lot of warnings
|
||||
that we can't help either. If you write any new code, please help us
|
||||
in our quest to get zero warnings.</P>
|
||||
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
|
||||
<UL>
|
||||
<LI><B>I have CodeWarrior3, how do i build with it?</B>
|
||||
<UL> Currently, the answer is, "You don't." Eventually, the distribution
|
||||
will be modified to allow building using CodeWarrior3, but for now
|
||||
CodeWarrior2 is the only IDE that is supported.
|
||||
</UL>
|
||||
</LI>
|
||||
</UL>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4. Credits</A></H2>
|
||||
<UL>
|
||||
The majority of this document is taken from the build document included
|
||||
in the Mozilla source distribution at README:mozilla:macbuild.htm written
|
||||
by Mike Pinkerton, <A HREF="mailto:pinkerton@netscape.com">
|
||||
pinkerton@netscape.com</A>.
|
||||
</BODY>
|
||||
</HTML>
|
||||
71
mozilla/README/mozilla/unix-build.html
Normal file
71
mozilla/README/mozilla/unix-build.html
Normal file
@@ -0,0 +1,71 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Mozilla Unix Build Instructions</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
|
||||
<H1>Unix Build Instructions</H1>
|
||||
|
||||
See <a href="http://www.mozilla.org/build/unix.html">http://www.mozilla.org/build/unix.html</a> for the lastest version of these instructions.</a><p>
|
||||
|
||||
<b>Daniel Nunes,</b>
|
||||
<TT><A HREF="mailto:leaf@mozilla.org">leaf@mozilla.org</A></TT>
|
||||
<br>
|
||||
<!-- hhmts start -->
|
||||
Last modified: Fri Sep 3 17:00:32 PDT 1999
|
||||
<!-- hhmts end -->
|
||||
<p>
|
||||
For documentation on developing features or
|
||||
fixing bugs, look at the
|
||||
<A HREF="http://www.mozilla.org/hacking/">Mozilla Hacking Guidelines</A>.
|
||||
For general Unix issues,
|
||||
look at the <A HREF="../unix/">Mozilla Unix</a>.
|
||||
<P>
|
||||
|
||||
<H2>Other Unix Build pages</H2>
|
||||
<UL>
|
||||
<li><a href="unix-details.html">Detailed Unix Build
|
||||
Instructions</a></li>
|
||||
<LI><A HREF="http://www.mozilla.org/unix/irix.html">Irix build status</A>.
|
||||
The Irix build is working now!</li>
|
||||
</ul>
|
||||
|
||||
<H2>Requirements</H2>
|
||||
<ul>
|
||||
|
||||
<li>Requirements for building on unix can be found on the
|
||||
<a href="unix-details.html#s3"> Detailed Unix Build
|
||||
Instructions</a>.</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<H2>Build the Lizard</H2>
|
||||
<ol>
|
||||
<li><code>cvs co -f mozilla/client.mk</code>
|
||||
<li><code>cd mozilla</code>
|
||||
<li><code>gmake -f client.mk</code>
|
||||
</ol>
|
||||
To rebuild without pulling the tree,
|
||||
<ul><code>
|
||||
gmake -f client.mk build
|
||||
</code></ul>
|
||||
To pull the tree,
|
||||
<ul><code>
|
||||
gmake -f client.mk checkout
|
||||
</code></ul>
|
||||
To change build options, use the
|
||||
<a href="http://cvs-mirror.mozilla.org/webtools/build/config.cgi">
|
||||
Unix Build Configurator</a>
|
||||
|
||||
<H2>After the build </H2>
|
||||
<UL>
|
||||
<LI><CODE>cd dist/bin</CODE></LI>
|
||||
<LI><CODE>./mozilla-apprunner.sh</CODE></LI>
|
||||
<LI><CODE>./mozilla-viewer.sh</CODE></LI>
|
||||
</UL>
|
||||
|
||||
</UL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
216
mozilla/README/mozilla/unix-details.html
Normal file
216
mozilla/README/mozilla/unix-details.html
Normal file
@@ -0,0 +1,216 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Mozilla Detailed Unix Build Instructions</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
|
||||
<H1>Unix Detailed Build Instructions</H1>
|
||||
|
||||
See <a href="http://www.mozilla.org/build/unix-details.html">http://www.mozilla.org/build/unix-details.html</a> for the lastest version of these instructions.</a><p>
|
||||
|
||||
<b>Daniel Nunes,</b>
|
||||
<TT><A HREF="mailto:leaf@mozilla.org">leaf@mozilla.org</A></TT>
|
||||
<br>
|
||||
<!-- hhmts start -->
|
||||
Last modified: Fri Sep 3 16:59:34 PDT 1999
|
||||
<!-- hhmts end -->
|
||||
|
||||
<P>
|
||||
This is a guide to building Mozilla on Unix including,
|
||||
<uL>
|
||||
<LI> A list of the required development tools.</LI>
|
||||
<LI> Commands to build Mozilla using the Autoconf build system. </LI>
|
||||
</uL>
|
||||
<P>
|
||||
For documentation on developing features or fixing bugs,
|
||||
look at the
|
||||
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Mozilla Technical Documents</A> or
|
||||
<A HREF="http://www.mozilla.org/library.html">Mozilla Library</A>.
|
||||
For general Unix issues, look at the
|
||||
<A HREF="http://www.mozilla.org/unix/">Mozilla Unix</a>.
|
||||
<P>
|
||||
|
||||
<H2><A NAME="s2">Other Unix Build pages</A></H2>
|
||||
<UL>
|
||||
<LI><A HREF="http://www.mozilla.org/unix.html">Simple Unix Build Instructions</a></li>
|
||||
<LI><A HREF="http://www.mozilla.org/making-additions.html">How to add files and not break the
|
||||
build</a>.</li>
|
||||
<LI><A HREF="http://www.mozilla.org/configurator-faq.html">Build Configuator FAQ</A>:
|
||||
FAQ for the
|
||||
<a href="http://cvs-mirror.mozilla.org/webtools/build/config.cgi">
|
||||
Unix Build Configurator</a>.</LI>
|
||||
<LI><A HREF="http://www.mozilla.org/unix/irix.html">Irix build status</A>:
|
||||
The Irix build is working now!</li>
|
||||
<li><a href="http://www.mozilla.org/redhat-on-intel.html">Redhat on Intel build instructions (out of date)</a>:
|
||||
Makes life easy through RPMs.</li>
|
||||
</ul>
|
||||
|
||||
<H2><A NAME="s3">Requirements</A></H2>
|
||||
Your hardware should be equal to, or better than:
|
||||
<UL>
|
||||
32 MB RAM, 128 MB swap (64 MB RAM recommended)
|
||||
</UL>
|
||||
<P>
|
||||
|
||||
The following software should be installed.
|
||||
(You can download gcc, gmake and autoconf from
|
||||
<A HREF="ftp://prep.ai.mit.edu/pub/gnu/">prep.ai.mit.edu</A>.)
|
||||
<UL>
|
||||
<LI>If you're using a glibc 2.07 system, you need this
|
||||
<A HREF=ftp://ftp.mozilla.org/pub/mozilla/libraries/source/glibc-2.0.7-dlopen.patch>patch</A></LI>
|
||||
|
||||
<LI><A HREF="http://egcs.cygnus.com"><B>egcs 1.0.3</b></a> (or higher),
|
||||
or <A HREF="http://www.gnu.org/software/gcc/gcc.html">
|
||||
<B>gcc 2.7.2.x</B></A> <b>(2.8.x still has some bugs)</b>,<br>
|
||||
or your platform's native C/C++ compiler.<br>
|
||||
<b>egcs</b> is recommended, this is the compiler that the Linux tinderboxes and many developers are using.
|
||||
|
||||
<LI><b><a href="http://language.perl.com/info/software.html">Perl 5</a></b>
|
||||
|
||||
<LI><b><A HREF="ftp://prep.ai.mit.edu/pub/gnu/">GNU make 3.74</a></b>
|
||||
(or higher except 3.77).<br>
|
||||
GNU make 3.77 shipped with bug a that breaks the NSPR build.
|
||||
Revert to 3.76.1 until this is fixed.
|
||||
|
||||
<LI><B><A HREF="http://www.mozilla.org/cvs.html">CVS 1.9</a></b> (or higher).
|
||||
To get started:<BR>
|
||||
<ol>
|
||||
<li><CODE>
|
||||
setenv CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot</CODE>
|
||||
<li><CODE><b>cvs login</b></CODE>
|
||||
<font color="green">
|
||||
(password: <code><b>anonymous</b></code>)
|
||||
</font>
|
||||
(You only need to do the login once.)
|
||||
</ol>
|
||||
|
||||
<LI><B><A HREF="http://www.gtk.org/">GTK+ / GLib 1.2.0</a></b> (or higher).
|
||||
<ul>
|
||||
<li><b>Debian:</b>
|
||||
<A HREF="ftp://ftp.gtk.org/pub/gtk/binary/DEBIAN/">ftp://ftp.gtk.org/pub/gtk/binary/DEBIAN/</a>
|
||||
<li><b>Red Hat:</b> <a href="ftp://ftp.gtk.org/pub/gtk/binary/RPMS/">ftp://ftp.gtk.org/pub/gtk/binary/RPMS/</a><br>
|
||||
Remove any old glib-devel and gtk+-devel packages already
|
||||
installed on your machine.
|
||||
There is no need to remove the gtk+/glib RPMs that came with Redhat.
|
||||
<UL>
|
||||
<CODE>rpm -e glib-devel</code><BR>
|
||||
<code>rpm -e gtk+-devel</CODE>
|
||||
</UL>
|
||||
Download new glib, glib-devel, gtk+, and gtk+-devel packages into
|
||||
the same directory and install them with one commmand.
|
||||
<UL>
|
||||
<CODE>rpm -i *.rpm</CODE>
|
||||
</UL></li>
|
||||
<LI><A HREF="http://www.gtk.org/download.html">Source tar
|
||||
balls or CVS</a>
|
||||
</ul>
|
||||
|
||||
<LI><B><A HREF="http://www.rpi.edu/~veliaa/libIDL/">libIDL 6.3</A></B> (or higher).<br>
|
||||
Source snapshots are available from Mozilla via
|
||||
<a href="ftp://ftp.mozilla.org/pub/mozilla/libraries">ftp</a>.
|
||||
If you're running <b>Red Hat</b>, download the libIDL and libIDL-devel RPMs
|
||||
and install them as above.
|
||||
|
||||
<H3>OPTIONAL</H3>
|
||||
<ul>
|
||||
<LI><b><A HREF="http://www.mozilla.org/projects/autoconf/">Autoconf 2.12</A></b> (which
|
||||
requires <A HREF="http://www.seindal.dk/rene/gnu/">GNU m4</A>),
|
||||
is necessary if you want to hack on configure.in. If you have
|
||||
no idea what this means, then don't worry about it. It's optional.
|
||||
</LI>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<H2><A NAME="s4">Get the Code</A></H2>
|
||||
<P>
|
||||
There are two ways to get the code:
|
||||
<ul>
|
||||
<li><A HREF="http://www.mozilla.org/download.html"> ftp</A>: Drops are generally produced
|
||||
at least once per month, and are known to compile and even run on a
|
||||
few platforms.
|
||||
<li><A HREF="http://www.mozilla.org/cvs.html"> CVS</A>: Provides the most current code,
|
||||
but is slower than ftp.
|
||||
<ul>
|
||||
<code>setenv CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
||||
</code><br>
|
||||
<code>cvs co SeaMonkeyAll</code>
|
||||
</ul>
|
||||
The <code>SeaMonkeyAll</code> module pulls the right source
|
||||
for building the viewer and apprunner.
|
||||
</ul>
|
||||
<P>
|
||||
|
||||
<H2><A NAME="s5">Build the Lizard</A></H2>
|
||||
<h3>Manually drive the build</h3>
|
||||
<CODE>
|
||||
<ol>
|
||||
<li><code>cd mozilla</code>
|
||||
<li><code>./configure
|
||||
<ul>
|
||||
<font color=green>
|
||||
Your options may vary.
|
||||
</font></br>
|
||||
For configure options, run "<b>./configure --help</b>",<br> or
|
||||
use the
|
||||
<a href="http://cvs-mirror.mozilla.org/webtools/build/config.cgi">
|
||||
Unix Build Configurator</a>.<br>
|
||||
</ul>
|
||||
<li><code>gmake</code>
|
||||
</ol>
|
||||
<P>
|
||||
Once you have configured, you only have to run
|
||||
<b><code>configure</code></b> if you add
|
||||
or remove Makefile.in files (cvs update can do this. Beware!). The list
|
||||
of makefiles is in <b><code>mozilla/allmakefiles.sh</code></b>
|
||||
<P>
|
||||
For build system hackers: If you change configure.in, cd to mozilla, and
|
||||
run <b><code>autoconf</code></b>. This generates a new configure
|
||||
script. (When you checkin configure.in, cvs will run autoconf and check
|
||||
in a new configure script for you).
|
||||
|
||||
<h3>Automated build (client.mk)</h3>
|
||||
<ol>
|
||||
<li> Save the script from
|
||||
<a href="http://cvs-mirror.mozilla.org/webtools/build/config.cgi">
|
||||
Unix Build Configurator</a> as <code><b>~/.mozconfig</b></code>.
|
||||
<li><code>cvs co -f mozilla/client.mk</code>
|
||||
<li><code>cd mozilla</code>
|
||||
<li><code>gmake -f client.mk</code>
|
||||
</ol>
|
||||
<dl>If you want to build without pulling the tree (as in, you already have the
|
||||
source lying around),
|
||||
<ul><code>
|
||||
gmake -f client.mk build
|
||||
</code></ul>
|
||||
If you just want to pull the tree,
|
||||
<ul><code>
|
||||
gmake -f client.mk checkout
|
||||
</code></ul>
|
||||
</dl>
|
||||
<H2><A NAME="s6">After the build </A></H2>
|
||||
<UL>
|
||||
<LI><b><CODE>cd dist/bin</CODE></b> and you should see links to the
|
||||
scripts to run the executables:
|
||||
<CODE>mozilla-viewer.sh</CODE> and <CODE>mozilla-apprunner.sh</CODE>.
|
||||
<LI>If the scripts do not work, set <CODE><b>LD_LIBRARY_PATH</b></CODE>
|
||||
and run <CODE>viewer</CODE> and <CODE>apprunner</CODE> directly.
|
||||
Set <CODE><b>LD_LIBRARY_PATH</b></CODE> to include dist/bin, and
|
||||
the NSPR and GTK libraries. (For example, you might set it to
|
||||
<CODE>.:../../nspr/lib</CODE>).
|
||||
<UL>
|
||||
<LI>On HP-UX, the equivalent environment variable is
|
||||
<CODE>SHLIB_PATH</CODE>.
|
||||
<LI>On AIX, the equivalent environment variable is <CODE>LIBPATH</CODE>.
|
||||
</UL>
|
||||
|
||||
<LI>If you run the executables from anywhere other than dist/bin, you
|
||||
must set the environment variable <CODE><B>MOZILLA_FIVE_HOME</B></CODE> to
|
||||
point to the <I>absolute path</I> of the dist/bin directory.
|
||||
|
||||
<LI>Update your tree by re-checking out the source, e.g. repeating the
|
||||
initial checkout process.
|
||||
</UL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
209
mozilla/README/mozilla/win-build.html
Normal file
209
mozilla/README/mozilla/win-build.html
Normal file
@@ -0,0 +1,209 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Building Mozilla on Microsoft Windows 32-bit platforms</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
|
||||
ALINK="#FF0000">
|
||||
<HR>
|
||||
<H1>
|
||||
Building Mozilla on Microsoft Windows 32-bit platforms</H1>
|
||||
|
||||
<H2>
|
||||
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
|
||||
</H2>
|
||||
v 1.0, June 1998
|
||||
|
||||
<P>
|
||||
<HR><I>How to build Mozilla on a Microsoft Windows 32-bit System.</I>
|
||||
<HR>
|
||||
<H2>1. <A HREF="#s1">Introduction</A></H2>
|
||||
|
||||
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.2">2.2 Requirements</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
|
||||
|
||||
<LI>
|
||||
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
|
||||
</UL>
|
||||
|
||||
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s1">1. Introduction</A></H2>
|
||||
|
||||
<P>
|
||||
What this document is: A guide to building the Mozilla application.
|
||||
<BR>
|
||||
This includes:
|
||||
<OL>
|
||||
<LI> A listing of the development tools you will need to build Mozilla. </LI>
|
||||
<LI> A list of environment variables you will need to set before building. </LI>
|
||||
</OL>
|
||||
<P>
|
||||
If you're looking for documentation on developing features or fixing bugs,
|
||||
the Mozilla
|
||||
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
|
||||
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
|
||||
are probably what you're looking for.
|
||||
<P>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2. Building Mozilla </A></H2>
|
||||
<P>
|
||||
<UL>Each of the following subsections describes, or gives references to
|
||||
descriptions of, the steps necessary to build Mozilla.
|
||||
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
There are two principal ways of getting the code,
|
||||
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
|
||||
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
|
||||
CVS will provide the least outdated code for building, but is
|
||||
slower than ftp.
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
|
||||
<UL>
|
||||
The following need to be installed:
|
||||
<UL>
|
||||
<LI>Microsoft Visual C++ version 4.2 or later
|
||||
<LI>GNU Tools for Microsoft Windows, located:
|
||||
<UL>
|
||||
<LI><A HREF="http://www.cygnus.com/misc/gnu-win32">Cygnus</A></LI>
|
||||
<LI><A HREF="http://www.gnu.org/order/ftp.html">GNU home page</A></LI>
|
||||
<LI><A HREF="ftp://prep.ai.mit.edu/pub/gnu">MIT</A></LI>
|
||||
</UL>
|
||||
Specifically, you'll need:
|
||||
<UL><CODE>
|
||||
cp.exe<BR>
|
||||
rm.exe<BR>
|
||||
uname.exe<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
Netscape has internally modified version of gmake, shmsdos and win32gnu
|
||||
that we use to get around some problems we were having keeping in sync
|
||||
with the Unix version of gmake. This version of gmake can be found in the
|
||||
Windows Build Tools package, which can be ftp'd from
|
||||
<A HREF="http://www.mozilla.org/download-mozilla.html"> the Mozilla
|
||||
Download page</A>.
|
||||
The three files you will need are:
|
||||
<UL><CODE>
|
||||
gmake.exe<BR>
|
||||
shmsdos.exe<BR>
|
||||
uname.exe<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
|
||||
</UL>
|
||||
<P>
|
||||
Hardware/OS
|
||||
<UL>
|
||||
<LI>Pentium 133 MHz or better</LI>
|
||||
<LI>64 MB RAM, 128 MB recommended</LI>
|
||||
<LI>250 MB NTFS or 500 MB FAT disk space</LI>
|
||||
<LI>NT 4.0 is preferred; NT 3.51 will also work.
|
||||
</LI>
|
||||
</UL>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
|
||||
<P>
|
||||
<UL>
|
||||
The following environment variables need to be set:
|
||||
<UL>
|
||||
<CODE>
|
||||
set MOZ_BITS=32
|
||||
<BR>
|
||||
set MOZ_DEBUG=1 (set this only if you want to build a debug build)
|
||||
<BR>
|
||||
set MOZ_GOLD=1
|
||||
<BR>
|
||||
set MOZ_MEDIUM=1
|
||||
<BR>
|
||||
set MOZ_NT=351 (if running NT3.51)
|
||||
<BR>
|
||||
set MOZ_OUT=(optional: specifies location of resultant executable)
|
||||
<BR>
|
||||
set MOZ_SRC=(top of your tree, for example: set MOZ_SRC=d:\mozilla_source
|
||||
if this is the directory where you checked or unzipped the source into)
|
||||
<BR>
|
||||
set MOZ_TOOLS=(location of the bin directory of your GNU tools. The build
|
||||
looks for MOZ_TOOLS\bin\gmake.exe, so make sure that the gmake.exe from
|
||||
the Windows Build Tools package resides there.)
|
||||
<BR>
|
||||
set NO_SECURITY=1
|
||||
<BR>
|
||||
set NSPR20=1
|
||||
<BR>
|
||||
set _MSC_VER=1100 (if you are running VC++ 5.0 or higher)
|
||||
<BR>
|
||||
</CODE>
|
||||
</UL>
|
||||
<BR>
|
||||
<P>
|
||||
</UL>
|
||||
|
||||
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
|
||||
<UL>
|
||||
Change to the directory you copied the source into (for example,
|
||||
<CODE>cd d:\mozilla_source</CODE>). If this directory was empty before you
|
||||
installed the source, there should be two directories here:
|
||||
<CODE>README</CODE> and <CODE>mozilla</CODE>.
|
||||
<CODE>
|
||||
<PRE>
|
||||
cd mozilla\config
|
||||
nmake /f makefile.win
|
||||
cd ..
|
||||
nmake /f client.mak
|
||||
</PRE>
|
||||
</CODE>
|
||||
</UL>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
|
||||
<UL>
|
||||
<LI><B>nmake has a 'fatal error', listing one of the GNU commands and a
|
||||
hexadecimal return code.</B>
|
||||
<UL>
|
||||
This will happen as a result of not having the GNU tools and Windows Build
|
||||
tools in your path. Add the directories with the appropriate binaries to your
|
||||
path.
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>It fails with the message "'.\WIN32' unexpected": </B>
|
||||
<UL>
|
||||
You didn't properly
|
||||
set the environment variables -- you must not include a space at the end
|
||||
of the set statements (be careful if you are cut'n'pasting).
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>It fails to build, with directory-related errors: </B>
|
||||
<UL>
|
||||
The full path
|
||||
to the source must not include any spaces. Additionally, the source must
|
||||
be extracted with an intact directory structure by a utility that understands
|
||||
long filenames. If in doubt, grab Info-Zip at
|
||||
<A HREF="ftp://ftp.cdrom.com/pub/infozip">ftp://ftp.cdrom.com/pub/infozip</A>
|
||||
</UL>
|
||||
</LI>
|
||||
<LI>
|
||||
<B>I'm not running a 32-bit windows system, how do i build?</B>
|
||||
<UL>
|
||||
Currently, the build process depends on a 32-bit operating system.
|
||||
Windows NT 4.0 is the recommended windows operating system.
|
||||
</UL>
|
||||
</UL>
|
||||
<HR>
|
||||
</BODY>
|
||||
</HTML>
|
||||
53
mozilla/README/mozilla/wininstall.htm
Normal file
53
mozilla/README/mozilla/wininstall.htm
Normal file
@@ -0,0 +1,53 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="Author" CONTENT="Chris Yeh">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en]C-NSCP (WinNT; U) [Netscape]">
|
||||
<TITLE>Running Mozilla...</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H2>
|
||||
<FONT FACE="Arial,Helvetica">Running Mozilla Without Trashing Netscape
|
||||
Installation</FONT></H2>
|
||||
This document explains how to run <TT>mozilla.exe</TT> separately from
|
||||
<TT>netscape.exe</TT> without trashing your regular installation of Netscape
|
||||
Communicator. This is necessary if, for example, you want to use Communicator's
|
||||
mail client while you work on Mozilla development.
|
||||
<BR>
|
||||
<HR WIDTH="100%">
|
||||
<OL>
|
||||
<LI>
|
||||
Before running <TT>mozilla.exe</TT>, create a new user profile either from
|
||||
a Netscape 4.0x installation using the "User Profile Manager" shortcut
|
||||
in the Utilities folder (on Windows) or by using the <TT>-new_account</TT>
|
||||
option on the command line of either <TT>netscape.exe</TT> or <TT>mozilla.exe</TT>.
|
||||
We suggest calling the profile "<TT>mozilla</TT>."</LI>
|
||||
|
||||
<LI>
|
||||
Always use that new account when running <TT>mozilla.exe</TT>, and never
|
||||
run <TT>netscape.exe</TT> using that same account profile.</LI>
|
||||
</OL>
|
||||
To make things easier, you can start the application with the user account
|
||||
on the command line, for example:
|
||||
<UL><TT>mozilla.exe -P"mozilla"</TT></UL>
|
||||
This assures that prefs and the cache will not interfere between the two
|
||||
versions. This will be especially
|
||||
<BR>important as new prefs are added to the Mozilla product. Note that
|
||||
you must use quotes around the name and there can be no space between the
|
||||
"P" and the profile name. Otherwise, the application won't catch the profile
|
||||
switch, and it will try to load the profile name as the initial URL.
|
||||
|
||||
<P>
|
||||
<HR WIDTH="100%">
|
||||
<BR>You can copy your <TT>bookmark.htm</TT> file from an existing profile
|
||||
to your new profile directory if you want to share bookmarks.
|
||||
|
||||
<P>After the initial 3/31 release, we will add some code to Mozilla to
|
||||
prevent running with a profile that is already being used by <TT>netscape.exe</TT>.
|
||||
<BR>
|
||||
<HR WIDTH="100%">
|
||||
<BR><FONT SIZE=-1>Copyright © 1998 <A HREF="http://home.netscape.com/misc/contact_info.html">Netscape
|
||||
Communications Corporation</A></FONT>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
@@ -1,57 +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
|
||||
LIBRARY_NAME = accessibility
|
||||
EXPORT_LIBRARY = 1
|
||||
SHORT_LIBNAME = access
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsAccessibilityModule
|
||||
REQUIRES = xpcom string dom
|
||||
|
||||
CPPSRCS = nsAccessibilityFactory.cpp
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../src
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/libaccessibility_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LIBS = \
|
||||
gkconshared_s \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
-L$(DIST)/lib \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
-lgkgfx \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
LIBRARY_NAME=accessibility
|
||||
MODULE_NAME=nsAccessibilityModule
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessibilityFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = $(LINCS) -I..\src # for implementation headers
|
||||
|
||||
SUB_LIBRARIES=\
|
||||
$(DIST)\lib\accessibility_s.lib \
|
||||
$(NULL)
|
||||
|
||||
LLIBS=\
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\timer_s.lib \
|
||||
$(DIST)\lib\gkgfx.lib \
|
||||
$(DIST)\lib\contentshared_s.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#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 nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "AccessibilityService",
|
||||
NS_ACCESSIBILITY_SERVICE_CID,
|
||||
"@mozilla.org/accessibilityService;1",
|
||||
NS_ConstructAccessibilityService
|
||||
},
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(nsAccessibilityModule, components);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,26 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..
|
||||
|
||||
DIRS= public src build
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,2 +0,0 @@
|
||||
nsIAccessibilityService.idl
|
||||
nsIAccessible.idl
|
||||
@@ -1,45 +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 \
|
||||
nsIAccessibleDocument.idl \
|
||||
nsIAccessibleEventReceiver.idl \
|
||||
nsIAccessibleEventListener.idl \
|
||||
nsIAccessibleSelectable.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
XPIDL_MODULE=accessibility
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIAccessibilityService.idl \
|
||||
.\nsIAccessible.idl \
|
||||
.\nsIAccessibleDocument.idl \
|
||||
.\nsIAccessibleEventReceiver.idl \
|
||||
.\nsIAccessibleEventListener.idl \
|
||||
.\nsIAccessibleSelectable.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
@@ -1,67 +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"
|
||||
|
||||
interface nsIWeakReference;
|
||||
|
||||
[scriptable, uuid(68D9720A-0984-42b6-A3F5-8237ED925727)]
|
||||
interface nsIAccessibilityService : nsISupports
|
||||
{
|
||||
nsIAccessible createRootAccessible(in nsISupports aPresContext, in nsISupports aFrame);
|
||||
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
|
||||
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLIFrameAccessible(in nsIDOMNode aNode, in nsISupports aPresContext);
|
||||
nsIAccessible createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible createAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
|
||||
};
|
||||
|
||||
|
||||
%{ 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);
|
||||
|
||||
%}
|
||||
@@ -1,189 +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 DOMString accName;
|
||||
readonly attribute DOMString accValue;
|
||||
|
||||
readonly attribute DOMString accDescription;
|
||||
readonly attribute unsigned long accRole;
|
||||
readonly attribute unsigned long accState;
|
||||
readonly attribute unsigned long accExtState;
|
||||
|
||||
readonly attribute DOMString 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;
|
||||
DOMString getAccActionName(in PRUint8 index);
|
||||
void accDoAction(in PRUint8 index); // Action number 0 is the default action
|
||||
|
||||
nsIDOMNode accGetDOMNode();
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
// MSAA Roles - only one per nsIAccessible or IAccessible
|
||||
const unsigned long ROLE_TITLEBAR = 0x00000001;
|
||||
const unsigned long ROLE_MENUBAR = 0x00000002;
|
||||
const unsigned long ROLE_SCROLLBAR = 0x00000003;
|
||||
const unsigned long ROLE_GRIP = 0x00000004;
|
||||
const unsigned long ROLE_SOUND = 0x00000005;
|
||||
const unsigned long ROLE_CURSOR = 0x00000006;
|
||||
const unsigned long ROLE_CARET = 0x00000007;
|
||||
const unsigned long ROLE_ALERT = 0x00000008;
|
||||
const unsigned long ROLE_WINDOW = 0x00000009;
|
||||
const unsigned long ROLE_CLIENT = 0x0000000A;
|
||||
const unsigned long ROLE_MENUPOPUP = 0x0000000B;
|
||||
const unsigned long ROLE_MENUITEM = 0x0000000C;
|
||||
const unsigned long ROLE_TOOLTIP = 0x0000000D;
|
||||
const unsigned long ROLE_APPLICATION = 0x0000000E;
|
||||
const unsigned long ROLE_DOCUMENT = 0x0000000F;
|
||||
const unsigned long ROLE_PANE = 0x00000010;
|
||||
const unsigned long ROLE_CHART = 0x00000011;
|
||||
const unsigned long ROLE_DIALOG = 0x00000012;
|
||||
const unsigned long ROLE_BORDER = 0x00000013;
|
||||
const unsigned long ROLE_GROUPING = 0x00000014;
|
||||
const unsigned long ROLE_SEPARATOR = 0x00000015;
|
||||
const unsigned long ROLE_TOOLBAR = 0x00000016;
|
||||
const unsigned long ROLE_STATUSBAR = 0x00000017;
|
||||
const unsigned long ROLE_TABLE = 0x00000018;
|
||||
const unsigned long ROLE_COLUMNHEADER = 0x00000019;
|
||||
const unsigned long ROLE_ROWHEADER = 0x0000001A;
|
||||
const unsigned long ROLE_COLUMN = 0x0000001B;
|
||||
const unsigned long ROLE_ROW = 0x0000001C;
|
||||
const unsigned long ROLE_CELL = 0x0000001D;
|
||||
const unsigned long ROLE_LINK = 0x0000001E;
|
||||
const unsigned long ROLE_HELPBALLOON = 0x0000001F;
|
||||
const unsigned long ROLE_CHARACTER = 0x00000020;
|
||||
const unsigned long ROLE_LIST = 0x00000021;
|
||||
const unsigned long ROLE_LISTITEM = 0x00000022;
|
||||
const unsigned long ROLE_OUTLINE = 0x00000023;
|
||||
const unsigned long ROLE_OUTLINEITEM = 0x00000024;
|
||||
const unsigned long ROLE_PAGETAB = 0x00000025;
|
||||
const unsigned long ROLE_PROPERTYPAGE = 0x00000026;
|
||||
const unsigned long ROLE_INDICATOR = 0x00000027;
|
||||
const unsigned long ROLE_GRAPHIC = 0x00000028;
|
||||
const unsigned long ROLE_STATICTEXT = 0x00000029;
|
||||
const unsigned long ROLE_TEXT = 0x0000002A; // Editable, selectable, etc.
|
||||
const unsigned long ROLE_PUSHBUTTON = 0x0000002B;
|
||||
const unsigned long ROLE_CHECKBUTTON = 0x0000002C;
|
||||
const unsigned long ROLE_RADIOBUTTON = 0x0000002D;
|
||||
const unsigned long ROLE_COMBOBOX = 0x0000002E;
|
||||
const unsigned long ROLE_DROPLIST = 0x0000002F;
|
||||
const unsigned long ROLE_PROGRESSBAR = 0x00000030;
|
||||
const unsigned long ROLE_DIAL = 0x00000031;
|
||||
const unsigned long ROLE_HOTKEYFIELD = 0x00000032;
|
||||
const unsigned long ROLE_SLIDER = 0x00000033;
|
||||
const unsigned long ROLE_SPINBUTTON = 0x00000034;
|
||||
const unsigned long ROLE_DIAGRAM = 0x00000035;
|
||||
const unsigned long ROLE_ANIMATION = 0x00000036;
|
||||
const unsigned long ROLE_EQUATION = 0x00000037;
|
||||
const unsigned long ROLE_BUTTONDROPDOWN = 0x00000038;
|
||||
const unsigned long ROLE_BUTTONMENU = 0x00000039;
|
||||
const unsigned long ROLE_BUTTONDROPDOWNGRID = 0x0000003A;
|
||||
const unsigned long ROLE_WHITESPACE = 0x0000003B;
|
||||
const unsigned long ROLE_PAGETABLIST = 0x0000003C;
|
||||
const unsigned long ROLE_CLOCK = 0x0000003D;
|
||||
const unsigned long ROLE_SPLITBUTTON = 0x0000003E; // New in MSAA 2.0
|
||||
const unsigned long ROLE_IPADDRESS = 0x0000003F; // New in MSAA 2.0
|
||||
};
|
||||
@@ -1,41 +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"
|
||||
interface nsIDocument;
|
||||
|
||||
[scriptable, uuid(8781FC88-355F-4439-881F-6504A0A1CEB6)]
|
||||
interface nsIAccessibleDocument : nsISupports
|
||||
{
|
||||
readonly attribute DOMString URL;
|
||||
readonly attribute DOMString title;
|
||||
readonly attribute DOMString mimeType;
|
||||
readonly attribute DOMString docType;
|
||||
DOMString getNameSpaceURIForID(in short nameSpaceID);
|
||||
[noscript] nsIDocument getDocument();
|
||||
|
||||
};
|
||||
@@ -1,41 +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"
|
||||
|
||||
[scriptable, uuid(BEE49E7D-9D06-49bf-8984-1694C697D74F)]
|
||||
interface nsIAccessibleEventListener : nsISupports
|
||||
{
|
||||
// these are set to the values given by MSAA
|
||||
const unsigned long EVENT_FOCUS = 0x8005;
|
||||
const unsigned long EVENT_STATE_CHANGE = 0x800A;
|
||||
const unsigned long EVENT_NAME_CHANGE = 0x800C;
|
||||
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;
|
||||
|
||||
void handleEvent(in unsigned long aEvent, in nsIAccessible aTarget);
|
||||
};
|
||||
@@ -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(in nsIAccessibleEventListener aListener);
|
||||
};
|
||||
@@ -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):
|
||||
* John Gaunt
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
|
||||
interface nsIAccessibleSelectable : nsISupports
|
||||
{
|
||||
nsISupportsArray GetSelectedChildren();
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
accessible.properties
|
||||
@@ -1,58 +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
|
||||
LIBRARY_NAME = accessibility_s
|
||||
REQUIRES = xpcom string layout widget dom view locale intl docshell webshell necko htmlparser xuldoc imglib2 gfx2
|
||||
|
||||
CPPSRCS = \
|
||||
nsAccessible.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsHTMLIFrameRootAccessible.cpp \
|
||||
nsHTMLFormControlAccessible.cpp \
|
||||
nsHTMLTextAccessible.cpp \
|
||||
nsHTMLTableAccessible.cpp \
|
||||
nsHTMLImageAccessible.cpp \
|
||||
nsHTMLAreaAccessible.cpp \
|
||||
nsHTMLLinkAccessible.cpp \
|
||||
nsHTMLSelectListAccessible.cpp \
|
||||
nsHTMLComboboxAccessible.cpp \
|
||||
nsHTMLListboxAccessible.cpp \
|
||||
nsGenericAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsRootAccessible.h \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
jump = Jump
|
||||
press = Press
|
||||
check = Check
|
||||
uncheck = Uncheck
|
||||
select = Select
|
||||
@@ -1 +0,0 @@
|
||||
accessible.properties
|
||||
@@ -1,5 +0,0 @@
|
||||
jump = Jump
|
||||
press = Press
|
||||
check = Check
|
||||
uncheck = Uncheck
|
||||
select = Select
|
||||
@@ -1,3 +0,0 @@
|
||||
en-US.jar:
|
||||
locale/en-US/global/accessible.properties
|
||||
|
||||
@@ -1,685 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsHTMLComboboxAccessible.h"
|
||||
#include "nsHTMLListboxAccessible.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
// IFrame
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsHTMLIFrameRootAccessible.h"
|
||||
|
||||
//--------------------
|
||||
|
||||
|
||||
nsAccessibilityService::nsAccessibilityService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsAccessibilityService::~nsAccessibilityService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAccessibilityService, nsIAccessibilityService);
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibilityService methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISupports* aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
// XXX - jgaunt - looks like we aren't using this
|
||||
//nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
NS_ASSERTION(presShell,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
|
||||
|
||||
*_retval = new nsRootAccessible(weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLComboboxAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLListboxAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(aAccParent, aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLCheckboxAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLRadioButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTML4ButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTML4ButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible createHTMLTableAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTableAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTableCellAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTableCellAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLImageAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsIImageFrame* imageFrame = nsnull;
|
||||
|
||||
// not using a nsCOMPtr frames don't support them.
|
||||
aFrame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
|
||||
|
||||
if (!imageFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = new nsHTMLImageAccessible(node, imageFrame, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLAreaAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLAreaAccessible(nsIWeakReference *aShell, nsIDOMNode *aDOMNode, nsIAccessible *aAccParent,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLAreaAccessible(aDOMNode, aAccParent, aShell);
|
||||
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextFieldAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextFieldAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
|
||||
{
|
||||
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
|
||||
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
(*aRealFrame)->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
*aNode = node;
|
||||
NS_IF_ADDREF(*aNode);
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
// do_GetWR only works into a |nsCOMPtr| :-(
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
weakShell = do_GetWeakReference(tempShell);
|
||||
NS_IF_ADDREF(*aShell = weakShell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
|
||||
|
||||
*_retval = new nsAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
|
||||
|
||||
*_retval = new nsAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
|
||||
NS_ASSERTION(content,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
NS_ASSERTION(presShell,"Error non PresShell passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(presShell);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
doc->GetShellAt(0, getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsISupports> supps;
|
||||
presShell->GetSubShellFor(content, getter_AddRefs(supps));
|
||||
if (supps) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
docShell->GetPresShell(getter_AddRefs(ps));
|
||||
if (ps) {
|
||||
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(ps);
|
||||
nsCOMPtr<nsIDocument> innerDoc;
|
||||
ps->GetDocument(getter_AddRefs(innerDoc));
|
||||
if (innerDoc) {
|
||||
nsCOMPtr<nsIAccessible> root = new nsHTMLIFrameRootAccessible(aDOMNode, wr);
|
||||
if ( root ) {
|
||||
nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(aDOMNode, root, weakRef, innerDoc);
|
||||
if ( frameAcc != nsnull ) {
|
||||
*_retval = NS_STATIC_CAST(nsIAccessible*, frameAcc);
|
||||
if ( *_retval ) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// This method finds the content node in the parent document
|
||||
// corresponds to the docshell
|
||||
// This code is copied and pasted from nsEventStateManager.cpp
|
||||
// Is also inefficient - better solution should come along as part of
|
||||
// Bug 85602: "FindContentForDocShell walks entire content tree"
|
||||
// Hopefully there will be a better method soon, with a public interface
|
||||
|
||||
nsIContent*
|
||||
nsAccessibilityService::FindContentForDocShell(nsIPresShell* aPresShell,
|
||||
nsIContent* aContent,
|
||||
nsIDocShell* aDocShell)
|
||||
{
|
||||
NS_ASSERTION(aPresShell, "Pointer is null!");
|
||||
NS_ASSERTION(aDocShell, "Pointer is null!");
|
||||
NS_ASSERTION(aContent, "Pointer is null!");
|
||||
|
||||
nsCOMPtr<nsISupports> supps;
|
||||
aPresShell->GetSubShellFor(aContent, getter_AddRefs(supps));
|
||||
if (supps) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
|
||||
if (docShell.get() == aDocShell)
|
||||
return aContent;
|
||||
}
|
||||
|
||||
// walk children content
|
||||
PRInt32 count;
|
||||
aContent->ChildCount(count);
|
||||
for (PRInt32 i=0;i<count;i++) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
aContent->ChildAt(i, *getter_AddRefs(child));
|
||||
nsIContent* foundContent = FindContentForDocShell(aPresShell, child, aDocShell);
|
||||
if (foundContent != nsnull) {
|
||||
return foundContent;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!presContext)
|
||||
return;
|
||||
nsCOMPtr<nsISupports> pcContainer;
|
||||
presContext->GetContainer(getter_AddRefs(pcContainer));
|
||||
if (!pcContainer)
|
||||
return;
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(pcContainer));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(docShell));
|
||||
if (!treeItem)
|
||||
return;
|
||||
|
||||
// Get Parent Doc
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItemParent;
|
||||
treeItem->GetParent(getter_AddRefs(treeItemParent));
|
||||
if (!treeItemParent)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(treeItemParent));
|
||||
if (!parentDS)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
parentDS->GetPresShell(getter_AddRefs(parentPresShell));
|
||||
if (!parentPresShell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> parentDoc;
|
||||
parentPresShell->GetDocument(getter_AddRefs(parentDoc));
|
||||
if (!parentDoc)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
parentDoc->GetRootContent(getter_AddRefs(rootContent));
|
||||
|
||||
nsIContent *tempContent;
|
||||
tempContent = FindContentForDocShell(parentPresShell, rootContent, docShell);
|
||||
if (tempContent) {
|
||||
*aOwnerContent = tempContent;
|
||||
*aOwnerShell = parentPresShell;
|
||||
NS_ADDREF(*aOwnerShell);
|
||||
NS_ADDREF(*aOwnerContent);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------
|
||||
* GetAccessibleFor - get an nsIAccessible from a DOM node
|
||||
* ------------------------------------------------------- */
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
if (!aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// ---- Get the document for this node ----
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIDocument> nodeIsDoc(do_QueryInterface(aNode));
|
||||
if (nodeIsDoc)
|
||||
doc = nodeIsDoc;
|
||||
else {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
doc = do_QueryInterface(domDoc);
|
||||
}
|
||||
if (!doc)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// ---- Get the pres shell ----
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// ---- Check if area node ----
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> areaContent(do_QueryInterface(aNode));
|
||||
if (areaContent) // Area elements are implemented in nsHTMLImageAccessible as children of the image
|
||||
return PR_FALSE; // Return, otherwise the image frame looks like an accessible object in the wrong place
|
||||
|
||||
// ---- Check if we need outer owning doc ----
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content && nodeIsDoc) {
|
||||
// This happens when we're on the document node, which will not QI to an nsIContent,
|
||||
// When that happens, we try to get the outer, parent document node that contains the document
|
||||
// For example, a <browser> or <iframe> element
|
||||
nsCOMPtr<nsIPresShell> ownerShell;
|
||||
nsCOMPtr<nsIContent> ownerContent;
|
||||
GetOwnerFor(shell, getter_AddRefs(ownerShell), getter_AddRefs(ownerContent));
|
||||
shell = ownerShell;
|
||||
content = ownerContent;
|
||||
}
|
||||
|
||||
// ---- If still no nsIContent, return ----
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
// ---- Try using frame to get IAccessible ----
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessible> newAcc;
|
||||
frame->GetAccessible(getter_AddRefs(newAcc));
|
||||
|
||||
// ---- Try QI'ing node to get nsIAccessible ----
|
||||
if (!newAcc)
|
||||
newAcc = do_QueryInterface(aNode);
|
||||
|
||||
// ---- If link, create link accessible ----
|
||||
if (!newAcc) {
|
||||
// is it a link?
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(aNode));
|
||||
if (link) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLLinkAccessible(aNode, weakShell);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- If <select> option, create select option accessible
|
||||
if (!newAcc) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(aNode));
|
||||
if (optionElement) {
|
||||
// nsHTMLSelectionOptionAccessible's must be created via the parent
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccessibleFor(parentNode, getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLSelectOptionAccessible(parentAccessible, aNode, weakShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!newAcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = newAcc;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAccessibilityService* accService = new nsAccessibilityService();
|
||||
if (!accService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(accService);
|
||||
*aResult = accService;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsAccessibilityService_h__
|
||||
#define __nsAccessibilityService_h__
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIWeakReference;
|
||||
class nsIDOMNode;
|
||||
|
||||
class nsAccessibilityService : public nsIAccessibilityService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBILITYSERVICE
|
||||
|
||||
// nsAccessibilityService methods:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent);
|
||||
void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent);
|
||||
nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsAccessible_H_
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsPoint.h"
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global/locale/accessible.properties"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIDocShell;
|
||||
class nsIWebShell;
|
||||
class nsIContent;
|
||||
|
||||
class nsAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFocused(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
// Helper Routines for Sub-Docs
|
||||
static nsresult GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
|
||||
static nsresult GetDocShellObjects(nsIDocShell* aDocShell,
|
||||
nsIPresShell** aPresShell,
|
||||
nsIPresContext** aPresContext,
|
||||
nsIContent** aContent);
|
||||
static nsresult GetDocShells(nsIPresShell* aPresShell,
|
||||
nsIDocShell** aDocShell,
|
||||
nsIDocShell** aParentDocShell);
|
||||
static nsresult GetParentPresShellAndContent(nsIPresShell* aPresShell,
|
||||
nsIPresShell** aParentPresShell,
|
||||
nsIContent** aSubShellContent);
|
||||
|
||||
static PRBool FindContentForWebShell(nsIPresShell* aParentPresShell,
|
||||
nsIContent* aParentContent,
|
||||
nsIWebShell* aWebShell,
|
||||
nsIContent** aFoundContent);
|
||||
nsresult CalcOffset(nsIFrame* aFrame,
|
||||
nsIPresContext * aPresContext,
|
||||
nsRect& aRect);
|
||||
nsresult GetAbsPosition(nsIPresShell* aPresShell, nsPoint& aPoint);
|
||||
nsresult GetAbsoluteFramePosition(nsIPresContext* aPresContext,
|
||||
nsIFrame *aFrame,
|
||||
nsRect& aAbsoluteTwipsRect,
|
||||
nsRect& aAbsolutePixelRect);
|
||||
static nsresult GetTranslatedString(PRUnichar *aKey, nsAWritableString *aStringOut);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIFocusController> mFocusController;
|
||||
|
||||
};
|
||||
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
class nsLinkableAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
|
||||
protected:
|
||||
PRBool IsALink();
|
||||
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
|
||||
nsCOMPtr<nsIContent> mLinkContent;
|
||||
PRBool mIsLinkVisited;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,225 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsGenericAccessible, nsIAccessible)
|
||||
|
||||
nsGenericAccessible::nsGenericAccessible()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsGenericAccessible::~nsGenericAccessible()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccParent (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const nsAReadableString& name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFocused(); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateRight (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateLeft (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateUp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateDown (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accAddSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accExtendSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccExtState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetDOMNode(nsIDOMNode **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsGenericAccessible_H_
|
||||
#define _nsGenericAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
/**
|
||||
* Basic implementation
|
||||
* supports nothing
|
||||
*/
|
||||
class nsGenericAccessible : public nsIAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
public:
|
||||
nsGenericAccessible();
|
||||
virtual ~nsGenericAccessible();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,478 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMNSHTMLSelectElement.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull,aShell),
|
||||
nsDocAccessibleMixin(aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
|
||||
{
|
||||
mListener = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
|
||||
shell->GetDocument(getter_AddRefs(mDocument));
|
||||
mDOMNode = do_QueryInterface(mDocument);
|
||||
|
||||
nsLayoutAtoms::AddRefAtoms();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::~nsRootAccessible()
|
||||
{
|
||||
nsLayoutAtoms::ReleaseAtoms();
|
||||
RemoveAccessibleEventListener(mListener);
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccName(nsAWritableString& aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
}
|
||||
|
||||
// helpers
|
||||
nsIFrame* nsRootAccessible::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* root = nsnull;
|
||||
if (shell)
|
||||
shell->GetRootFrame(&root);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
void nsRootAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
*aRelativeFrame = GetFrame();
|
||||
(*aRelativeFrame)->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long accRole; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUint32 *aAccRole)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aAccRole = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
// Commenting this out for now.
|
||||
// It was requested that we always use pane objects instead of client objects.
|
||||
// However, it might be asked that we put client objects back.
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsISupports> container;
|
||||
context->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem, docTreeItem(do_QueryInterface(container));
|
||||
if (docTreeItem) {
|
||||
docTreeItem->GetSameTypeParent(getter_AddRefs(parentTreeItem));
|
||||
// Basically, if this docshell has a parent of the same type, it's a frame
|
||||
if (parentTreeItem) {
|
||||
*aAccRole = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aAccRole = ROLE_CLIENT;
|
||||
*/
|
||||
|
||||
*aAccRole = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetAccState(aAccState);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccValue(nsAWritableString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
|
||||
/* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (!mListener)
|
||||
{
|
||||
// add an event listener to the document
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
// use AddEventListener from the nsIDOMEventTarget interface
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventTarget), getter_AddRefs(target))) && target)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
// we're a DOMEventListener now!!
|
||||
nsCOMPtr<nsIDOMEventListener> listener;
|
||||
rv = this->QueryInterface( NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener) );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to QI");
|
||||
// capture DOM focus events
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("focus") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
// capture Form change events
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("change") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
// add ourself as a CheckboxStateChange listener ( custom event fired in nsHTMLInputElement.cpp )
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("CheckboxStateChange") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
// add ourself as a RadiobuttonStateChange listener ( custom event fired in nsHTMLInputElement.cpp )
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("RadiobuttonStateChange") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
// create a weak reference to the listener
|
||||
mListener = aListener;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void removeAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (mListener)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP))) && erP)
|
||||
{
|
||||
nsresult rv = erP->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
mListener = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --------------- nsIDOMEventListener Methods (3) ------------------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mListener) {
|
||||
// optionTargetNode is set to current option for HTML selects
|
||||
nsCOMPtr<nsIDOMNode> targetNode, optionTargetNode;
|
||||
nsresult rv = GetTargetNode(aEvent, targetNode);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// Check to see if it's a select element. If so, need the currently focused option
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(targetNode));
|
||||
if (selectElement) // ----- Target Node is an HTML <select> element ------
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOptionNode(mPresShell, targetNode, optionTargetNode);
|
||||
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(mAccService->GetAccessibleFor(targetNode, getter_AddRefs(accessible)))) {
|
||||
if ( eventType.EqualsIgnoreCase("focus") ) {
|
||||
if (mCurrentFocus != targetNode) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = targetNode;
|
||||
}
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("change") ) {
|
||||
if (optionTargetNode) { // Set to current option only for HTML selects
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_SELECTION, accessible);
|
||||
if (mCurrentFocus != optionTargetNode &&
|
||||
NS_SUCCEEDED(mAccService->GetAccessibleFor(optionTargetNode, getter_AddRefs(accessible)))) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = optionTargetNode;
|
||||
}
|
||||
}
|
||||
else
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("CheckboxStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("RadiobuttonStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
|
||||
nsresult rv;
|
||||
aTargetNode = do_QueryInterface(domEventTarget, &rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// ------- nsIDOMFocusListener Methods (1) -------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return HandleEvent(aEvent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Blur(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// ------- nsIDOMFormListener Methods (5) -------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Submit(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Reset(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Change(nsIDOMEvent* aEvent)
|
||||
{
|
||||
// get change events when the form elements changes its state, checked->not,
|
||||
// deleted text, new text, change in selection for list/combo boxes
|
||||
// this may be the event that we have the individual Accessible objects
|
||||
// handle themselves -- have list/combos figure out the change in selection
|
||||
// have textareas and inputs fire a change of state etc...
|
||||
return HandleEvent(aEvent);
|
||||
}
|
||||
|
||||
// gets Select events when text is selected in a textarea or input
|
||||
NS_IMETHODIMP nsRootAccessible::Select(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// gets Input events when text is entered or deleted in a textarea or input
|
||||
NS_IMETHODIMP nsRootAccessible::Input(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// ------- nsIAccessibleDocument Methods (5) ---------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
|
||||
nsDocAccessibleMixin::nsDocAccessibleMixin(nsIDocument *aDoc):mDocument(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
nsDocAccessibleMixin::nsDocAccessibleMixin(nsIWeakReference *aPresShell)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aPresShell));
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
shell->GetDocument(getter_AddRefs(mDocument));
|
||||
}
|
||||
|
||||
nsDocAccessibleMixin::~nsDocAccessibleMixin()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
nsCOMPtr<nsIURI> pURI;
|
||||
mDocument->GetDocumentURL(getter_AddRefs(pURI));
|
||||
nsXPIDLCString path;
|
||||
pURI->GetSpec(getter_Copies(path));
|
||||
aURL.Assign(NS_ConvertUTF8toUCS2(path).get());
|
||||
//XXXaaronl Need to use CopyUTF8toUCS2(nsDependentCString(path), aURL); when it's written
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
// This doesn't leak - we don't own the const pointer that's returned
|
||||
aTitle = *(mDocument->GetDocumentTitle());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
if (mDocument)
|
||||
return mDocument->GetContentType(aMimeType);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMDocumentType> docType;
|
||||
|
||||
if (xulDoc) {
|
||||
aDocType = NS_LITERAL_STRING("window"); // doctype not implemented for XUL at time of writing - causes assertion
|
||||
return NS_OK;
|
||||
}
|
||||
else if (domDoc && NS_SUCCEEDED(domDoc->GetDoctype(getter_AddRefs(docType))) && docType) {
|
||||
return docType->GetName(aDocType);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceManager;
|
||||
if (NS_SUCCEEDED(mDocument->GetNameSpaceManager(*getter_AddRefs(nameSpaceManager))))
|
||||
return nameSpaceManager->GetNameSpaceURI(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
*doc = mDocument;
|
||||
if (mDocument) {
|
||||
NS_IF_ADDREF(*doc);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
// Screen readers need to know when the document is finished loading (STATE_BUSY flag)
|
||||
// We do it this way, rather than via nsIWebProgressListener, because
|
||||
// if accessibility was turned on after a document already finished loading,
|
||||
// we would get no state changes from nsIWebProgressListener.
|
||||
// The GetBusyFlags method, however, always has the current busy state information for us.
|
||||
|
||||
*aAccState = 0;
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
if (context) {
|
||||
nsCOMPtr<nsISupports> container;
|
||||
context->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
||||
if (docShell) {
|
||||
PRUint32 busyFlags;
|
||||
docShell->GetBusyFlags(&busyFlags);
|
||||
if (busyFlags != nsIDocShell::BUSY_FLAGS_NONE)
|
||||
*aAccState = nsIAccessible::STATE_BUSY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsRootAccessible_H_
|
||||
#define _nsRootAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleEventReceiver.h"
|
||||
#include "nsIAccessibleEventListener.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
class nsDocAccessibleMixin
|
||||
{
|
||||
public:
|
||||
nsDocAccessibleMixin(nsIDocument *doc);
|
||||
nsDocAccessibleMixin(nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleMixin();
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
||||
class nsRootAccessible : public nsAccessible,
|
||||
public nsDocAccessibleMixin,
|
||||
public nsIAccessibleDocument,
|
||||
public nsIAccessibleEventReceiver,
|
||||
public nsIDOMFocusListener,
|
||||
public nsIDOMFormListener
|
||||
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsRootAccessible(nsIWeakReference* aShell);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccName(nsAWritableString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& aAccValue);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
// ----- nsIAccessibleEventReceiver -------------------
|
||||
|
||||
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
|
||||
// ----- nsIDOMEventListener --------------------------
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent);
|
||||
|
||||
// ----- 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);
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode);
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual nsIFrame* GetFrame();
|
||||
|
||||
// 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
|
||||
nsIAccessibleEventListener* mListener;
|
||||
nsCOMPtr<nsIDOMNode> mCurrentFocus;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,154 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
|
||||
// --- area -----
|
||||
|
||||
nsHTMLAreaAccessible::nsHTMLAreaAccessible(nsIDOMNode *aDomNode, nsIAccessible *aAccParent, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell), mAccParent(aAccParent)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccName(nsAWritableString & _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt) {
|
||||
nsAutoString hrefString;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("title"), _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt)
|
||||
elt->GetAttribute(NS_LITERAL_STRING("href"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
// Still to do - follow IE's standard here
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mDOMNode));
|
||||
if (area)
|
||||
area->GetShape(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = mAccParent;
|
||||
NS_IF_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible *nsHTMLAreaAccessible::CreateAreaAccessible(nsIDOMNode *aDOMNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (accService) {
|
||||
nsIAccessible* acc = nsnull;
|
||||
accService->CreateHTMLAreaAccessible(mPresShell, aDOMNode, mAccParent, &acc);
|
||||
return acc;
|
||||
}
|
||||
return nsnull;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
|
||||
{
|
||||
*aAccNextSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(nextNode));
|
||||
if (nextNode)
|
||||
*aAccNextSibling = CreateAreaAccessible(nextNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accPreviousSibling; */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPrevSibling)
|
||||
{
|
||||
*aAccPrevSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> prevNode;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prevNode));
|
||||
if (prevNode)
|
||||
*aAccPrevSibling = CreateAreaAccessible(prevNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
//nsIFrame *frame;
|
||||
// Do a better job on this later - need to use GetRect on mAreas of nsImageMap from nsImageFrame
|
||||
//return mAccParent->nsAccessible::AccGetBounds(x,y,width,height);
|
||||
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLAreaAccessible_H_
|
||||
#define _nsHTMLAreaAccessible_H_
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
/* Accessible for image map areas - must be child of image
|
||||
*/
|
||||
|
||||
class nsHTMLAreaAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLAreaAccessible(nsIDOMNode *domNode, nsIAccessible *accParent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString & _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible * *aAccNextSibling);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling);
|
||||
NS_IMETHOD GetAccDescription(nsAWritableString& _retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(nsIDOMNode *aDOMNode);
|
||||
nsCOMPtr<nsIAccessible> mAccParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,467 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel)
|
||||
{
|
||||
PRInt32 numChildren = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement(do_QueryInterface(aLookNode));
|
||||
if (labelElement) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aLookNode));
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (elt) {
|
||||
nsAutoString labelIsFor;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("for"),labelIsFor);
|
||||
if (labelIsFor.Equals(*aId))
|
||||
rv = AppendFlatStringFromSubtree(aLookNode, aLabel);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
aLookNode->ChildCount(numChildren);
|
||||
nsIContent *contentWalker;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < numChildren; index++) {
|
||||
aLookNode->ChildAt(index, contentWalker);
|
||||
if (contentWalker)
|
||||
AppendLabelFor(contentWalker, aId, aLabel);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement;
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElement;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoString label;
|
||||
// go up tree get name of ancestor label if there is one. Don't go up farther than form element
|
||||
while (walkUpContent && label.IsEmpty() && !formElement) {
|
||||
labelElement = do_QueryInterface(walkUpContent);
|
||||
if (labelElement)
|
||||
rv = AppendFlatStringFromSubtree(walkUpContent, &label);
|
||||
formElement = do_QueryInterface(walkUpContent); // reached top ancestor in form
|
||||
nsCOMPtr<nsIContent> nextParent;
|
||||
walkUpContent->GetParent(*getter_AddRefs(nextParent));
|
||||
walkUpContent = nextParent;
|
||||
}
|
||||
|
||||
|
||||
// There can be a label targeted at this control using the for="control_id" attribute
|
||||
// To save computing time, only look for those inside of a form element
|
||||
walkUpContent = do_QueryInterface(formElement);
|
||||
|
||||
if (walkUpContent) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
nsAutoString forId;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("id"), forId);
|
||||
// Actually we'll be walking down the content this time, with a depth first search
|
||||
if (!forId.IsEmpty())
|
||||
AppendLabelFor(walkUpContent,&forId,&label);
|
||||
}
|
||||
|
||||
label.CompressWhitespace();
|
||||
if (label.IsEmpty())
|
||||
return nsAccessible::GetAccName(_retval);
|
||||
|
||||
_retval.Assign(label);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked, protected, unavailable
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked) *_retval |= STATE_CHECKED;
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
element->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
|
||||
nsAutoString typeString;
|
||||
element->GetType(typeString);
|
||||
if (typeString.EqualsIgnoreCase("password"))
|
||||
*_retval |= STATE_PROTECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CHECKBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
// check or uncheck
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
if (element)
|
||||
element->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
_retval = NS_LITERAL_STRING("uncheck");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("check");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) { // 0 is the magic value for default action
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("select");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_RADIOBUTTON;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// ----- HTML 4 Button: can contain arbitrary HTML content -----
|
||||
|
||||
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLBlockAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAutoString name;
|
||||
if (content)
|
||||
rv = AppendFlatStringFromSubtree(content, &name);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// --- textfield -----
|
||||
|
||||
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
if (textArea) {
|
||||
textArea->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
if (inputElement) {
|
||||
inputElement->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, protected. readonly, unavailable, selected
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
PRBool isReadOnly = PR_FALSE;
|
||||
elt->HasAttribute(NS_LITERAL_STRING("readonly"), &isReadOnly);
|
||||
if (isReadOnly)
|
||||
*_retval |= STATE_READONLY;
|
||||
|
||||
// Get current selection and find out if current node is in it
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame))) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
if (domSel) {
|
||||
PRBool isCollapsed = PR_TRUE;
|
||||
domSel->GetIsCollapsed(&isCollapsed);
|
||||
if (!isCollapsed)
|
||||
*_retval |=STATE_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!textArea) {
|
||||
if (inputElement) {
|
||||
/////// ====== Must be a password field, so it uses nsIDOMHTMLFormControl ==== ///////
|
||||
PRUint32 moreStates = 0;
|
||||
nsresult rv = nsHTMLFormControlAccessible::GetAccState(&moreStates);
|
||||
*_retval |= moreStates;
|
||||
return rv;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
textArea->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLFormControlAccessible_H_
|
||||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHODIMP AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel);
|
||||
};
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTML4ButtonAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
|
||||
class nsHTMLTextFieldAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,274 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLIFrameRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHTMLIFrameRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsRootAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameAccessible::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!");
|
||||
if ( !aInstancePtr )
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleDocument))) {
|
||||
*aInstancePtr = (void*)(nsIAccessibleDocument*) this;
|
||||
NS_IF_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsHTMLBlockAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLIFrameAccessible::nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *aDoc):
|
||||
nsHTMLBlockAccessible(aNode, aShell), mRootAccessible(aRoot), nsDocAccessibleMixin(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAWritableString& aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAWritableString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccFirstChild(_retval);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccLastChild(_retval);
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccChildCount(_retval);
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetAccState(aAccState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
//=============================//
|
||||
// nsHTMLIFrameRootAccessible //
|
||||
//=============================//
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRootAccessible(aShell)
|
||||
{
|
||||
mRealDOMNode = aNode;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::~nsHTMLIFrameRootAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccParent(nsIAccessible * *_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccParent(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccNextSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccPreviousSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetHTMLIFrameAccessible(nsIAccessible** aAcc)
|
||||
{
|
||||
// Start by finding our PresShell and from that
|
||||
// we get our nsIDocShell in order to walk the DocShell tree
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
|
||||
if (!presShell) {
|
||||
*aAcc = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
if (NS_SUCCEEDED(GetDocShellFromPS(presShell, getter_AddRefs(docShell)))) {
|
||||
// Now that we have the DocShell QI
|
||||
// it to a tree item to find it's parent
|
||||
nsCOMPtr<nsIDocShellTreeItem> item(do_QueryInterface(docShell));
|
||||
if (item) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> itemParent;
|
||||
item->GetParent(getter_AddRefs(itemParent));
|
||||
// QI to get the WebShell for the parent document
|
||||
nsCOMPtr<nsIDocShell> parentDocShell(do_QueryInterface(itemParent));
|
||||
if (parentDocShell) {
|
||||
// Get the PresShell/Content and
|
||||
// Root Content Node of the parent document
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
nsCOMPtr<nsIPresContext> parentPresContext;
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
if (NS_SUCCEEDED(GetDocShellObjects(parentDocShell,
|
||||
getter_AddRefs(parentPresShell),
|
||||
getter_AddRefs(parentPresContext),
|
||||
getter_AddRefs(rootContent)))) {
|
||||
// QI the DocShell (of this sub-doc) to a webshell
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
|
||||
if (webShell && parentPresShell && parentPresContext && rootContent) {
|
||||
// Now, find the Content in the parent document
|
||||
// that represents this sub-doc,
|
||||
// we do that matching webshells
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (FindContentForWebShell(parentPresShell,
|
||||
rootContent,
|
||||
webShell,
|
||||
getter_AddRefs(content))) {
|
||||
// OK, we found the content node in the parent doc
|
||||
// that corresponds to this sub-doc
|
||||
// Get the frame for that content
|
||||
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(parentPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
parentPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
#ifdef NS_DEBUG_X
|
||||
printf("** Found: Con:%p Fr:%p", content, frame);
|
||||
char * name;
|
||||
if (GetNameForFrame(frame, &name)) {
|
||||
printf(" Name:[%s]", name);
|
||||
nsMemory::Free(name);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(frame));
|
||||
|
||||
*aAcc = acc;
|
||||
NS_IF_ADDREF(*aAcc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsIFrameRootAccessible_H_
|
||||
#define _nsIFrameRootAccessible_H_
|
||||
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
|
||||
class nsIWebShell;
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsHTMLIFrameAccessible : public nsHTMLBlockAccessible,
|
||||
public nsIAccessibleDocument,
|
||||
public nsDocAccessibleMixin
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
public:
|
||||
nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *doc);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& AccValue);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIAccessible> mRootAccessible;
|
||||
};
|
||||
|
||||
class nsHTMLIFrameRootAccessible : public nsRootAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLIFrameRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetHTMLIFrameAccessible(nsIAccessible** aAcc);
|
||||
nsCOMPtr<nsIDOMNode> mRealDOMNode;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,188 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIImageFrame.h"
|
||||
|
||||
// --- image -----
|
||||
|
||||
nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIImageFrame *aImageFrame, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
nsAutoString mapElementName;
|
||||
|
||||
if (doc && element) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
|
||||
element->GetAttribute(NS_LITERAL_STRING("usemap"),mapElementName);
|
||||
if (htmlDoc && !mapElementName.IsEmpty()) {
|
||||
if (mapElementName.CharAt(0) == '#')
|
||||
mapElementName.Cut(0,1);
|
||||
htmlDoc->GetImageMap(mapElementName, getter_AddRefs(mMapElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// The state is a bitfield, get our inherited state, then logically OR it with STATE_ANIMATED if this
|
||||
// is an animated image.
|
||||
|
||||
nsLinkableAccessible::GetAccState(_retval);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && shell)
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
nsCOMPtr<nsIImageFrame> imageFrame(do_QueryInterface(frame));
|
||||
|
||||
nsCOMPtr<imgIRequest> imageRequest;
|
||||
if (imageFrame)
|
||||
imageFrame->GetImageRequest(getter_AddRefs(imageRequest));
|
||||
|
||||
nsCOMPtr<imgIContainer> imgContainer;
|
||||
if (imageRequest)
|
||||
imageRequest->GetImage(getter_AddRefs(imgContainer));
|
||||
|
||||
if (imgContainer) {
|
||||
PRUint32 numFrames;
|
||||
imgContainer->GetNumFrames(&numFrames);
|
||||
if (numFrames > 1)
|
||||
*_retval |= STATE_ANIMATED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> imageContent(do_QueryInterface(mDOMNode));
|
||||
if (imageContent) {
|
||||
nsAutoString name;
|
||||
rv = AppendFlatStringFromContentNode(imageContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_GRAPHIC;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsIAccessible *nsHTMLImageAccessible::CreateAreaAccessible(PRUint32 areaNum)
|
||||
{
|
||||
if (!mMapElement)
|
||||
return nsnull;
|
||||
|
||||
if (areaNum == -1) {
|
||||
PRInt32 numAreaMaps;
|
||||
GetAccChildCount(&numAreaMaps);
|
||||
if (numAreaMaps<=0)
|
||||
return nsnull;
|
||||
areaNum = NS_STATIC_CAST(PRUint32,numAreaMaps-1);
|
||||
}
|
||||
|
||||
nsIDOMHTMLCollection *mapAreas;
|
||||
mMapElement->GetAreas(&mapAreas);
|
||||
if (!mapAreas)
|
||||
return nsnull;
|
||||
|
||||
nsIDOMNode *domNode = nsnull;
|
||||
mapAreas->Item(areaNum,&domNode);
|
||||
if (!domNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (!accService)
|
||||
return nsnull;
|
||||
if (accService) {
|
||||
nsIAccessible* acc = nsnull;
|
||||
accService->CreateHTMLAreaAccessible(mPresShell, domNode, this, &acc);
|
||||
return acc;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = CreateAreaAccessible(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = CreateAreaAccessible(-1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
if (mMapElement) {
|
||||
nsIDOMHTMLCollection *mapAreas;
|
||||
mMapElement->GetAreas(&mapAreas);
|
||||
if (mapAreas) {
|
||||
PRUint32 length;
|
||||
mapAreas->GetLength(&length);
|
||||
*_retval = NS_STATIC_CAST(PRInt32, length);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLImageAccessible_H_
|
||||
#define _nsHTMLImageAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
|
||||
/* Accessible for supporting images
|
||||
* supports:
|
||||
* - gets name, role
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLImageAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIImageFrame *imageFrame, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(PRUint32 areaNum);
|
||||
nsCOMPtr<nsIDOMHTMLMapElement> mMapElement;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
if (!IsALink()) // Also initializes private data members
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = AppendFlatStringFromSubtree(mLinkContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -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 Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLLinkAccessible_H_
|
||||
#define _nsHTMLLinkAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsHTMLLinkAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,794 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsISelectElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
/*
|
||||
* A class the represents the text field in the Select to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsHTMLSelectTextFieldAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A base class that can listen to menu events. Its used so the
|
||||
* button and the window accessibles can change there name and role
|
||||
* depending on whether the drop down list is dropped down on not
|
||||
*/
|
||||
class nsMenuListenerAccessible : public nsAccessible, public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsMenuListenerAccessible();
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
virtual void SetupMenuListener();
|
||||
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the right of the text field
|
||||
*/
|
||||
class nsHTMLSelectButtonAccessible : public nsMenuListenerAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsHTMLSelectWindowAccessible : public nsMenuListenerAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* The list that contains all the options in the select. It is inside the window.
|
||||
*/
|
||||
class nsHTMLSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectListAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
//--------- nsHTMLSelectAccessible -----
|
||||
|
||||
nsHTMLSelectAccessible::nsHTMLSelectAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLSelectAccessible, nsAccessible, nsIAccessibleSelectable)
|
||||
|
||||
// ------------- Helper method for determination of proper Frame ------
|
||||
//static
|
||||
PRBool nsHTMLSelectAccessible::IsCorrectFrame( nsIFrame* aFrame, nsIAtom* aAtom ) {
|
||||
if (!aFrame || !aAtom)
|
||||
return PR_FALSE;
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType.get() != aAtom)
|
||||
return PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> text;
|
||||
GetAccFirstChild(getter_AddRefs(text));
|
||||
if (text)
|
||||
return text->GetAccValue(_retval);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_COMBOBOX;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
// create a window accessible
|
||||
*_retval = new nsHTMLSelectWindowAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
// create a text field
|
||||
|
||||
*_retval = new nsHTMLSelectTextFieldAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
// always have 3 children
|
||||
*_retval = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------- SelectTextFieldAccessible ------
|
||||
|
||||
nsHTMLSelectTextFieldAccessible::nsHTMLSelectTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if ( !frame )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::textFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AppendFlatStringFromSubtree(content, &_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our first child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if ( !frame )
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_STATICTEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --------- nsMenuListenerAccessible -----------
|
||||
|
||||
nsMenuListenerAccessible::nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMenuListenerAccessible::~nsMenuListenerAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupShowing(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupHiding(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuListenerAccessible::SetupMenuListener()
|
||||
{
|
||||
// not not already one register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (!eventReceiver) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------- SelectButtonAccessible ------
|
||||
|
||||
nsHTMLSelectButtonAccessible::nsHTMLSelectButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsMenuListenerAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::gfxButtonControlFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(content));
|
||||
if (element)
|
||||
{
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our second child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::gfxButtonControlFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return GetAccActionName(0, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
SetupMenuListener();
|
||||
|
||||
// get the current state open or closed
|
||||
// set _retval to it.
|
||||
// notice its supposed to be reversed. Close if opened
|
||||
// and Open if closed.
|
||||
|
||||
if (mOpen)
|
||||
_retval = NS_LITERAL_STRING("Close");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("Open");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectWindowAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectTextFieldAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//---------------------
|
||||
|
||||
|
||||
nsHTMLSelectWindowAccessible::nsHTMLSelectWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell)
|
||||
:nsMenuListenerAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
SetupMenuListener();
|
||||
|
||||
// if open we are visible if closed we are invisible
|
||||
// set _retval to it.
|
||||
if (mOpen)
|
||||
*_retval |= STATE_DEFAULT;
|
||||
else
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our first option
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aRelativeFrame = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::listControlFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
|
||||
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> last;
|
||||
mDOMNode->GetLastChild(getter_AddRefs(last));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, last, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> first;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(first));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, first, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------
|
||||
|
||||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LISTITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(next));
|
||||
|
||||
if (next) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, next, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> prev;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prev));
|
||||
|
||||
if (prev) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, prev, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content (do_QueryInterface(mDOMNode));
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoString option;
|
||||
nsresult rv = AppendFlatStringFromSubtree(content, &option);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
option.CompressWhitespace();
|
||||
_retval.Assign(option);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLSelectAccessible_h__
|
||||
#define __nsHTMLSelectAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
class nsHTMLSelectAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLSelectAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrame( nsIFrame* aFrame, nsIAtom* aAtom );
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Each option in the Select. These are in the nsListAccessible
|
||||
*/
|
||||
class nsHTMLSelectOptionAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsHTMLBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CELL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLTableAccessible::nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsHTMLBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTableAccessible_H_
|
||||
#define _nsHTMLTableAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsHTMLTableCellAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
class nsHTMLTableAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsString.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
|
||||
return mDOMNode->GetNodeValue(_retval);
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTextAccessible_H_
|
||||
#define _nsHTMLTextAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
class nsITextControlFrame;
|
||||
|
||||
class nsHTMLTextAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,3 +0,0 @@
|
||||
en-US.jar:
|
||||
locale/en-US/global/accessible.properties
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
LIBRARY_NAME=accessibility_s
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessible.obj \
|
||||
.\$(OBJDIR)\nsRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLIFrameRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsAccessibilityService.obj \
|
||||
.\$(OBJDIR)\nsHTMLSelectListAccessible.obj \
|
||||
.\$(OBJDIR)\nsGenericAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTextAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLImageAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLAreaAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLLinkAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLComboboxAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLListboxAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
.\nsRootAccessible.h \
|
||||
$(NULL)
|
||||
|
||||
LINCS= \
|
||||
-I..\..\layout\html\forms\public \
|
||||
-I..\..\layout\html\forms\src \
|
||||
-I..\..\layout\html\base\src \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,685 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsHTMLComboboxAccessible.h"
|
||||
#include "nsHTMLListboxAccessible.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
// IFrame
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsHTMLIFrameRootAccessible.h"
|
||||
|
||||
//--------------------
|
||||
|
||||
|
||||
nsAccessibilityService::nsAccessibilityService()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsAccessibilityService::~nsAccessibilityService()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAccessibilityService, nsIAccessibilityService);
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibilityService methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISupports* aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
// XXX - jgaunt - looks like we aren't using this
|
||||
//nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
NS_ASSERTION(presShell,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
|
||||
|
||||
*_retval = new nsRootAccessible(weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLComboboxAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLListboxAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(aAccParent, aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLCheckboxAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLRadioButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTML4ButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTML4ButtonAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible createHTMLTableAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTableAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTableCellAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTableCellAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLImageAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsIImageFrame* imageFrame = nsnull;
|
||||
|
||||
// not using a nsCOMPtr frames don't support them.
|
||||
aFrame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
|
||||
|
||||
if (!imageFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = new nsHTMLImageAccessible(node, imageFrame, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLAreaAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLAreaAccessible(nsIWeakReference *aShell, nsIDOMNode *aDOMNode, nsIAccessible *aAccParent,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLAreaAccessible(aDOMNode, aAccParent, aShell);
|
||||
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextFieldAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextFieldAccessible(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
|
||||
{
|
||||
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
|
||||
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
(*aRealFrame)->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
*aNode = node;
|
||||
NS_IF_ADDREF(*aNode);
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
// do_GetWR only works into a |nsCOMPtr| :-(
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
weakShell = do_GetWeakReference(tempShell);
|
||||
NS_IF_ADDREF(*aShell = weakShell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
|
||||
|
||||
*_retval = new nsAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
|
||||
if (!document)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIPresShell> tempShell;
|
||||
document->GetShellAt(0, getter_AddRefs(tempShell));
|
||||
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
|
||||
|
||||
*_retval = new nsAccessible(aDOMNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
|
||||
NS_ASSERTION(content,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
|
||||
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
presContext->GetShell(getter_AddRefs(presShell));
|
||||
NS_ASSERTION(presShell,"Error non PresShell passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(presShell);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
doc->GetShellAt(0, getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsISupports> supps;
|
||||
presShell->GetSubShellFor(content, getter_AddRefs(supps));
|
||||
if (supps) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIPresShell> ps;
|
||||
docShell->GetPresShell(getter_AddRefs(ps));
|
||||
if (ps) {
|
||||
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(ps);
|
||||
nsCOMPtr<nsIDocument> innerDoc;
|
||||
ps->GetDocument(getter_AddRefs(innerDoc));
|
||||
if (innerDoc) {
|
||||
nsCOMPtr<nsIAccessible> root = new nsHTMLIFrameRootAccessible(aDOMNode, wr);
|
||||
if ( root ) {
|
||||
nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(aDOMNode, root, weakRef, innerDoc);
|
||||
if ( frameAcc != nsnull ) {
|
||||
*_retval = NS_STATIC_CAST(nsIAccessible*, frameAcc);
|
||||
if ( *_retval ) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// This method finds the content node in the parent document
|
||||
// corresponds to the docshell
|
||||
// This code is copied and pasted from nsEventStateManager.cpp
|
||||
// Is also inefficient - better solution should come along as part of
|
||||
// Bug 85602: "FindContentForDocShell walks entire content tree"
|
||||
// Hopefully there will be a better method soon, with a public interface
|
||||
|
||||
nsIContent*
|
||||
nsAccessibilityService::FindContentForDocShell(nsIPresShell* aPresShell,
|
||||
nsIContent* aContent,
|
||||
nsIDocShell* aDocShell)
|
||||
{
|
||||
NS_ASSERTION(aPresShell, "Pointer is null!");
|
||||
NS_ASSERTION(aDocShell, "Pointer is null!");
|
||||
NS_ASSERTION(aContent, "Pointer is null!");
|
||||
|
||||
nsCOMPtr<nsISupports> supps;
|
||||
aPresShell->GetSubShellFor(aContent, getter_AddRefs(supps));
|
||||
if (supps) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
|
||||
if (docShell.get() == aDocShell)
|
||||
return aContent;
|
||||
}
|
||||
|
||||
// walk children content
|
||||
PRInt32 count;
|
||||
aContent->ChildCount(count);
|
||||
for (PRInt32 i=0;i<count;i++) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
aContent->ChildAt(i, *getter_AddRefs(child));
|
||||
nsIContent* foundContent = FindContentForDocShell(aPresShell, child, aDocShell);
|
||||
if (foundContent != nsnull) {
|
||||
return foundContent;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!presContext)
|
||||
return;
|
||||
nsCOMPtr<nsISupports> pcContainer;
|
||||
presContext->GetContainer(getter_AddRefs(pcContainer));
|
||||
if (!pcContainer)
|
||||
return;
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(pcContainer));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(docShell));
|
||||
if (!treeItem)
|
||||
return;
|
||||
|
||||
// Get Parent Doc
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItemParent;
|
||||
treeItem->GetParent(getter_AddRefs(treeItemParent));
|
||||
if (!treeItemParent)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(treeItemParent));
|
||||
if (!parentDS)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
parentDS->GetPresShell(getter_AddRefs(parentPresShell));
|
||||
if (!parentPresShell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> parentDoc;
|
||||
parentPresShell->GetDocument(getter_AddRefs(parentDoc));
|
||||
if (!parentDoc)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
parentDoc->GetRootContent(getter_AddRefs(rootContent));
|
||||
|
||||
nsIContent *tempContent;
|
||||
tempContent = FindContentForDocShell(parentPresShell, rootContent, docShell);
|
||||
if (tempContent) {
|
||||
*aOwnerContent = tempContent;
|
||||
*aOwnerShell = parentPresShell;
|
||||
NS_ADDREF(*aOwnerShell);
|
||||
NS_ADDREF(*aOwnerContent);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------
|
||||
* GetAccessibleFor - get an nsIAccessible from a DOM node
|
||||
* ------------------------------------------------------- */
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
if (!aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// ---- Get the document for this node ----
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIDocument> nodeIsDoc(do_QueryInterface(aNode));
|
||||
if (nodeIsDoc)
|
||||
doc = nodeIsDoc;
|
||||
else {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
doc = do_QueryInterface(domDoc);
|
||||
}
|
||||
if (!doc)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// ---- Get the pres shell ----
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// ---- Check if area node ----
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> areaContent(do_QueryInterface(aNode));
|
||||
if (areaContent) // Area elements are implemented in nsHTMLImageAccessible as children of the image
|
||||
return PR_FALSE; // Return, otherwise the image frame looks like an accessible object in the wrong place
|
||||
|
||||
// ---- Check if we need outer owning doc ----
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (!content && nodeIsDoc) {
|
||||
// This happens when we're on the document node, which will not QI to an nsIContent,
|
||||
// When that happens, we try to get the outer, parent document node that contains the document
|
||||
// For example, a <browser> or <iframe> element
|
||||
nsCOMPtr<nsIPresShell> ownerShell;
|
||||
nsCOMPtr<nsIContent> ownerContent;
|
||||
GetOwnerFor(shell, getter_AddRefs(ownerShell), getter_AddRefs(ownerContent));
|
||||
shell = ownerShell;
|
||||
content = ownerContent;
|
||||
}
|
||||
|
||||
// ---- If still no nsIContent, return ----
|
||||
if (!content)
|
||||
return PR_FALSE;
|
||||
|
||||
// ---- Try using frame to get IAccessible ----
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessible> newAcc;
|
||||
frame->GetAccessible(getter_AddRefs(newAcc));
|
||||
|
||||
// ---- Try QI'ing node to get nsIAccessible ----
|
||||
if (!newAcc)
|
||||
newAcc = do_QueryInterface(aNode);
|
||||
|
||||
// ---- If link, create link accessible ----
|
||||
if (!newAcc) {
|
||||
// is it a link?
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(aNode));
|
||||
if (link) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLLinkAccessible(aNode, weakShell);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- If <select> option, create select option accessible
|
||||
if (!newAcc) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(aNode));
|
||||
if (optionElement) {
|
||||
// nsHTMLSelectionOptionAccessible's must be created via the parent
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccessibleFor(parentNode, getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLSelectOptionAccessible(parentAccessible, aNode, weakShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!newAcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*_retval = newAcc;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAccessibilityService* accService = new nsAccessibilityService();
|
||||
if (!accService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(accService);
|
||||
*aResult = accService;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsAccessibilityService_h__
|
||||
#define __nsAccessibilityService_h__
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIWeakReference;
|
||||
class nsIDOMNode;
|
||||
|
||||
class nsAccessibilityService : public nsIAccessibilityService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBILITYSERVICE
|
||||
|
||||
// nsAccessibilityService methods:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent);
|
||||
void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent);
|
||||
nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsAccessible_H_
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsPoint.h"
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global/locale/accessible.properties"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIDocShell;
|
||||
class nsIWebShell;
|
||||
class nsIContent;
|
||||
|
||||
class nsAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFocused(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
// Helper Routines for Sub-Docs
|
||||
static nsresult GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
|
||||
static nsresult GetDocShellObjects(nsIDocShell* aDocShell,
|
||||
nsIPresShell** aPresShell,
|
||||
nsIPresContext** aPresContext,
|
||||
nsIContent** aContent);
|
||||
static nsresult GetDocShells(nsIPresShell* aPresShell,
|
||||
nsIDocShell** aDocShell,
|
||||
nsIDocShell** aParentDocShell);
|
||||
static nsresult GetParentPresShellAndContent(nsIPresShell* aPresShell,
|
||||
nsIPresShell** aParentPresShell,
|
||||
nsIContent** aSubShellContent);
|
||||
|
||||
static PRBool FindContentForWebShell(nsIPresShell* aParentPresShell,
|
||||
nsIContent* aParentContent,
|
||||
nsIWebShell* aWebShell,
|
||||
nsIContent** aFoundContent);
|
||||
nsresult CalcOffset(nsIFrame* aFrame,
|
||||
nsIPresContext * aPresContext,
|
||||
nsRect& aRect);
|
||||
nsresult GetAbsPosition(nsIPresShell* aPresShell, nsPoint& aPoint);
|
||||
nsresult GetAbsoluteFramePosition(nsIPresContext* aPresContext,
|
||||
nsIFrame *aFrame,
|
||||
nsRect& aAbsoluteTwipsRect,
|
||||
nsRect& aAbsolutePixelRect);
|
||||
static nsresult GetTranslatedString(PRUnichar *aKey, nsAWritableString *aStringOut);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAWritableString *aFlatString);
|
||||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIFocusController> mFocusController;
|
||||
|
||||
};
|
||||
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
class nsLinkableAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
|
||||
protected:
|
||||
PRBool IsALink();
|
||||
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
|
||||
nsCOMPtr<nsIContent> mLinkContent;
|
||||
PRBool mIsLinkVisited;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,225 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsGenericAccessible, nsIAccessible)
|
||||
|
||||
nsGenericAccessible::nsGenericAccessible()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsGenericAccessible::~nsGenericAccessible()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccParent (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const nsAReadableString& name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFocused(); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(nsAWritableString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateRight (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateLeft (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateUp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateDown (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accAddSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accExtendSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccExtState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetDOMNode(nsIDOMNode **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsGenericAccessible_H_
|
||||
#define _nsGenericAccessible_H_
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
/**
|
||||
* Basic implementation
|
||||
* supports nothing
|
||||
*/
|
||||
class nsGenericAccessible : public nsIAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
public:
|
||||
nsGenericAccessible();
|
||||
virtual ~nsGenericAccessible();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,154 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
|
||||
// --- area -----
|
||||
|
||||
nsHTMLAreaAccessible::nsHTMLAreaAccessible(nsIDOMNode *aDomNode, nsIAccessible *aAccParent, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell), mAccParent(aAccParent)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccName(nsAWritableString & _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt) {
|
||||
nsAutoString hrefString;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("title"), _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt)
|
||||
elt->GetAttribute(NS_LITERAL_STRING("href"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccDescription(nsAWritableString& _retval)
|
||||
{
|
||||
// Still to do - follow IE's standard here
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mDOMNode));
|
||||
if (area)
|
||||
area->GetShape(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = mAccParent;
|
||||
NS_IF_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible *nsHTMLAreaAccessible::CreateAreaAccessible(nsIDOMNode *aDOMNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (accService) {
|
||||
nsIAccessible* acc = nsnull;
|
||||
accService->CreateHTMLAreaAccessible(mPresShell, aDOMNode, mAccParent, &acc);
|
||||
return acc;
|
||||
}
|
||||
return nsnull;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
|
||||
{
|
||||
*aAccNextSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(nextNode));
|
||||
if (nextNode)
|
||||
*aAccNextSibling = CreateAreaAccessible(nextNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accPreviousSibling; */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPrevSibling)
|
||||
{
|
||||
*aAccPrevSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> prevNode;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prevNode));
|
||||
if (prevNode)
|
||||
*aAccPrevSibling = CreateAreaAccessible(prevNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
//nsIFrame *frame;
|
||||
// Do a better job on this later - need to use GetRect on mAreas of nsImageMap from nsImageFrame
|
||||
//return mAccParent->nsAccessible::AccGetBounds(x,y,width,height);
|
||||
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLAreaAccessible_H_
|
||||
#define _nsHTMLAreaAccessible_H_
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
/* Accessible for image map areas - must be child of image
|
||||
*/
|
||||
|
||||
class nsHTMLAreaAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLAreaAccessible(nsIDOMNode *domNode, nsIAccessible *accParent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString & _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible * *aAccNextSibling);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling);
|
||||
NS_IMETHOD GetAccDescription(nsAWritableString& _retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(nsIDOMNode *aDOMNode);
|
||||
nsCOMPtr<nsIAccessible> mAccParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,728 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsHTMLComboboxAccessible.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
/** ----- nsHTMLComboboxAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsHTMLAccessible and set initial state
|
||||
* closed and not registered
|
||||
*/
|
||||
nsHTMLComboboxAccessible::nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
SetupMenuListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor -- If we are registered, remove ourselves as a listener.
|
||||
*/
|
||||
nsHTMLComboboxAccessible::~nsHTMLComboboxAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/** Inherit the ISupports impl from nsAccessible -- handle nsIDOMXULListener ourself */
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsHTMLComboboxAccessible, nsAccessible, nsIDOMXULListener)
|
||||
|
||||
/**
|
||||
* Tell our caller we are a combobox
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_COMBOBOX;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our last child, a nsHTMLComboboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLComboboxWindowAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our first child, a nsHTMLComboboxTextFieldAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLComboboxTextFieldAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We always have 3 children: TextField, Button, Window. In that order
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleSelectable method. No-op because our selection is returned through
|
||||
* GetValue(). This _may_ change just to provide additional info for the vendors
|
||||
* and another option for them to get at stuff.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. SelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if (select) {
|
||||
select->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_HASPOPUP
|
||||
* STATE_EXPANDED
|
||||
* STATE_COLLAPSED
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
if (mOpen)
|
||||
*_retval |= STATE_EXPANDED;
|
||||
else
|
||||
*_retval |= STATE_COLLAPSED;
|
||||
|
||||
*_retval |= STATE_HASPOPUP | STATE_READONLY | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set our state to open and (TBD) fire an event to MSAA saying our state
|
||||
* has changed.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::PopupShowing(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set our state to not open and (TDB) fire an event to MSAA saying
|
||||
* our state has changed.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::PopupHiding(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set our state to not open and (TDB) fire an event to MSAA saying
|
||||
* our state has changed.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we aren't already registered, register ourselves as a
|
||||
* listener to "popupshowing" events on our DOM node. Set our
|
||||
* state to registered, but don't notify MSAA as they
|
||||
* don't need to know about this state.
|
||||
*/
|
||||
void
|
||||
nsHTMLComboboxAccessible::SetupMenuListener()
|
||||
{
|
||||
// if not already registered as a popup listener, register ourself
|
||||
if (!mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver && NS_SUCCEEDED(eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE)))
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** ----- nsHTMLComboboxTextFieldAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsLeafAccessible and set our parent
|
||||
*/
|
||||
nsHTMLComboboxTextFieldAccessible::nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently gets the text from the first option, needs to check for selection
|
||||
* and then return that text.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!frame || !context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::textFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AppendFlatStringFromSubtree(content, &_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the BlockFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsHTMLComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our first child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!frame || !context)
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, aBoundingFrame);
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for our parent
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our next sibling, a
|
||||
* nsHTMLComboboxButtonAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are the first child of our parent, no previous sibling
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our role is currently only static text, but we should be able to have
|
||||
* editable text here and we need to check that case.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_STATICTEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxTextFieldAccessible we can have the following states:
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/** -----SelectButtonAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsMenuListenerAccessible and set our parent
|
||||
*/
|
||||
nsHTMLComboboxButtonAccessible::nsHTMLComboboxButtonAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmaticaly click on the button, causing either the display or
|
||||
* the hiding of the drop down box ( window ).
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!context)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
// We only have one action, click. Any other index is meaningless(wrong)
|
||||
if (index == eAction_Click) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(content));
|
||||
if (element)
|
||||
{
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Just one action ( click ).
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the gfxButtonControlFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsHTMLComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our second child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetNextSibling(aBoundingFrame);
|
||||
frame->GetNextSibling(&frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell our caller we are a button.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for our parent
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name from GetAccActionName()
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return GetAccActionName(eAction_Click, _retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Our action name is the reverse of our state:
|
||||
* if we are closed -> open is our name.
|
||||
* if we are open -> closed is our name.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
// we are open or closed
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (isOpen)
|
||||
_retval = NS_LITERAL_STRING("Close");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("Open");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our next sibling, a
|
||||
* nsHTMLComboboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxWindowAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our previous sibling, a
|
||||
* nsHTMLComboboxTextFieldAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxTextFieldAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children. Just a button ( over-riding nsAccessible )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children. Just a button ( over-riding nsAccessible )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children. Just a button ( over-riding nsAccessible )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxButtonAccessible we can have the following states:
|
||||
* STATE_PRESSED
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
// we are open or closed
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (isOpen)
|
||||
*_retval |= STATE_PRESSED;
|
||||
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/** ----- nsHTMLComboboxWindowAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsMenuListener and set our parent
|
||||
*/
|
||||
nsHTMLComboboxWindowAccessible::nsHTMLComboboxWindowAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLComboboxWindowAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_INVISIBLE
|
||||
* STATE_FLOATING
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
// we are open or closed
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsIFrame *boundsFrame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame* comboFrame = nsnull;
|
||||
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
|
||||
if (!comboFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
comboFrame->IsDroppedDown(&isOpen);
|
||||
if (! isOpen)
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
*_retval |= STATE_FOCUSABLE | STATE_FLOATING;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell our caller we are a window
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for our parent
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our previous sibling, a
|
||||
* nsHTMLComboboxButtonAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLComboboxButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are the last sibling of our parent.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only have one child, a list
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only have one child, a list
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We only have one child, a list
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bounds for the areaFrame.
|
||||
* Walks the Frame tree and checks for proper frames.
|
||||
*/
|
||||
void nsHTMLComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame)
|
||||
{
|
||||
// get our first option
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aBoundingFrame = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetParent(aBoundingFrame);
|
||||
frame->GetParent(&frame);
|
||||
#ifdef DEBUG
|
||||
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::areaFrame))
|
||||
return;
|
||||
#endif
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLComboboxAccessible_h__
|
||||
#define __nsHTMLComboboxAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Combobox widget.
|
||||
*/
|
||||
class nsHTMLComboboxAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable,
|
||||
public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxAccessible();
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
virtual void SetupMenuListener();
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* A class the represents the text field in the Select to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsHTMLComboboxTextFieldAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the
|
||||
* right of the text field
|
||||
*/
|
||||
class nsHTMLComboboxButtonAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
enum { eAction_Click=0 };
|
||||
|
||||
nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsHTMLComboboxWindowAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,467 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel)
|
||||
{
|
||||
PRInt32 numChildren = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement(do_QueryInterface(aLookNode));
|
||||
if (labelElement) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aLookNode));
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (elt) {
|
||||
nsAutoString labelIsFor;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("for"),labelIsFor);
|
||||
if (labelIsFor.Equals(*aId))
|
||||
rv = AppendFlatStringFromSubtree(aLookNode, aLabel);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
aLookNode->ChildCount(numChildren);
|
||||
nsIContent *contentWalker;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < numChildren; index++) {
|
||||
aLookNode->ChildAt(index, contentWalker);
|
||||
if (contentWalker)
|
||||
AppendLabelFor(contentWalker, aId, aLabel);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLLabelElement> labelElement;
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElement;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoString label;
|
||||
// go up tree get name of ancestor label if there is one. Don't go up farther than form element
|
||||
while (walkUpContent && label.IsEmpty() && !formElement) {
|
||||
labelElement = do_QueryInterface(walkUpContent);
|
||||
if (labelElement)
|
||||
rv = AppendFlatStringFromSubtree(walkUpContent, &label);
|
||||
formElement = do_QueryInterface(walkUpContent); // reached top ancestor in form
|
||||
nsCOMPtr<nsIContent> nextParent;
|
||||
walkUpContent->GetParent(*getter_AddRefs(nextParent));
|
||||
walkUpContent = nextParent;
|
||||
}
|
||||
|
||||
|
||||
// There can be a label targeted at this control using the for="control_id" attribute
|
||||
// To save computing time, only look for those inside of a form element
|
||||
walkUpContent = do_QueryInterface(formElement);
|
||||
|
||||
if (walkUpContent) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
nsAutoString forId;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("id"), forId);
|
||||
// Actually we'll be walking down the content this time, with a depth first search
|
||||
if (!forId.IsEmpty())
|
||||
AppendLabelFor(walkUpContent,&forId,&label);
|
||||
}
|
||||
|
||||
label.CompressWhitespace();
|
||||
if (label.IsEmpty())
|
||||
return nsAccessible::GetAccName(_retval);
|
||||
|
||||
_retval.Assign(label);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked, protected, unavailable
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked) *_retval |= STATE_CHECKED;
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
element->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
|
||||
nsAutoString typeString;
|
||||
element->GetType(typeString);
|
||||
if (typeString.EqualsIgnoreCase("password"))
|
||||
*_retval |= STATE_PROTECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CHECKBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
// check or uncheck
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
if (element)
|
||||
element->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
_retval = NS_LITERAL_STRING("uncheck");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("check");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) { // 0 is the magic value for default action
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("select");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_RADIOBUTTON;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// ----- HTML 4 Button: can contain arbitrary HTML content -----
|
||||
|
||||
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLBlockAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
_retval = NS_LITERAL_STRING("press");
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAutoString name;
|
||||
if (content)
|
||||
rv = AppendFlatStringFromSubtree(content, &name);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// --- textfield -----
|
||||
|
||||
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHTMLFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
if (textArea) {
|
||||
textArea->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
if (inputElement) {
|
||||
inputElement->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* long getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, protected. readonly, unavailable, selected
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
PRBool isReadOnly = PR_FALSE;
|
||||
elt->HasAttribute(NS_LITERAL_STRING("readonly"), &isReadOnly);
|
||||
if (isReadOnly)
|
||||
*_retval |= STATE_READONLY;
|
||||
|
||||
// Get current selection and find out if current node is in it
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame))) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
if (domSel) {
|
||||
PRBool isCollapsed = PR_TRUE;
|
||||
domSel->GetIsCollapsed(&isCollapsed);
|
||||
if (!isCollapsed)
|
||||
*_retval |=STATE_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!textArea) {
|
||||
if (inputElement) {
|
||||
/////// ====== Must be a password field, so it uses nsIDOMHTMLFormControl ==== ///////
|
||||
PRUint32 moreStates = 0;
|
||||
nsresult rv = nsHTMLFormControlAccessible::GetAccState(&moreStates);
|
||||
*_retval |= moreStates;
|
||||
return rv;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
textArea->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLFormControlAccessible_H_
|
||||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHODIMP AppendLabelFor(nsIContent *aLookNode, nsAReadableString *aId, nsAWritableString *aLabel);
|
||||
};
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsHTML4ButtonAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
|
||||
class nsHTMLTextFieldAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,274 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLIFrameRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHTMLIFrameRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsRootAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameAccessible, nsHTMLBlockAccessible);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameAccessible::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!");
|
||||
if ( !aInstancePtr )
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleDocument))) {
|
||||
*aInstancePtr = (void*)(nsIAccessibleDocument*) this;
|
||||
NS_IF_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
return nsHTMLBlockAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLIFrameAccessible::nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *aDoc):
|
||||
nsHTMLBlockAccessible(aNode, aShell), mRootAccessible(aRoot), nsDocAccessibleMixin(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAWritableString& aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAWritableString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccFirstChild(_retval);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccLastChild(_retval);
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccChildCount(_retval);
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetAccState(aAccState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
//=============================//
|
||||
// nsHTMLIFrameRootAccessible //
|
||||
//=============================//
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRootAccessible(aShell)
|
||||
{
|
||||
mRealDOMNode = aNode;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::~nsHTMLIFrameRootAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccParent(nsIAccessible * *_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccParent(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccNextSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(GetHTMLIFrameAccessible(getter_AddRefs(accessible))))
|
||||
return accessible->GetAccPreviousSibling(_retval);
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetHTMLIFrameAccessible(nsIAccessible** aAcc)
|
||||
{
|
||||
// Start by finding our PresShell and from that
|
||||
// we get our nsIDocShell in order to walk the DocShell tree
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
|
||||
if (!presShell) {
|
||||
*aAcc = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
if (NS_SUCCEEDED(GetDocShellFromPS(presShell, getter_AddRefs(docShell)))) {
|
||||
// Now that we have the DocShell QI
|
||||
// it to a tree item to find it's parent
|
||||
nsCOMPtr<nsIDocShellTreeItem> item(do_QueryInterface(docShell));
|
||||
if (item) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> itemParent;
|
||||
item->GetParent(getter_AddRefs(itemParent));
|
||||
// QI to get the WebShell for the parent document
|
||||
nsCOMPtr<nsIDocShell> parentDocShell(do_QueryInterface(itemParent));
|
||||
if (parentDocShell) {
|
||||
// Get the PresShell/Content and
|
||||
// Root Content Node of the parent document
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
nsCOMPtr<nsIPresContext> parentPresContext;
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
if (NS_SUCCEEDED(GetDocShellObjects(parentDocShell,
|
||||
getter_AddRefs(parentPresShell),
|
||||
getter_AddRefs(parentPresContext),
|
||||
getter_AddRefs(rootContent)))) {
|
||||
// QI the DocShell (of this sub-doc) to a webshell
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(docShell));
|
||||
if (webShell && parentPresShell && parentPresContext && rootContent) {
|
||||
// Now, find the Content in the parent document
|
||||
// that represents this sub-doc,
|
||||
// we do that matching webshells
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (FindContentForWebShell(parentPresShell,
|
||||
rootContent,
|
||||
webShell,
|
||||
getter_AddRefs(content))) {
|
||||
// OK, we found the content node in the parent doc
|
||||
// that corresponds to this sub-doc
|
||||
// Get the frame for that content
|
||||
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(parentPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
parentPresShell->GetPrimaryFrameFor(content, &frame);
|
||||
#ifdef NS_DEBUG_X
|
||||
printf("** Found: Con:%p Fr:%p", content, frame);
|
||||
char * name;
|
||||
if (GetNameForFrame(frame, &name)) {
|
||||
printf(" Name:[%s]", name);
|
||||
nsMemory::Free(name);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(frame));
|
||||
|
||||
*aAcc = acc;
|
||||
NS_IF_ADDREF(*aAcc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsIFrameRootAccessible_H_
|
||||
#define _nsIFrameRootAccessible_H_
|
||||
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
|
||||
class nsIWebShell;
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsHTMLIFrameAccessible : public nsHTMLBlockAccessible,
|
||||
public nsIAccessibleDocument,
|
||||
public nsDocAccessibleMixin
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
public:
|
||||
nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *doc);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& AccValue);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIAccessible> mRootAccessible;
|
||||
};
|
||||
|
||||
class nsHTMLIFrameRootAccessible : public nsRootAccessible
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLIFrameRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetHTMLIFrameAccessible(nsIAccessible** aAcc);
|
||||
nsCOMPtr<nsIDOMNode> mRealDOMNode;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,188 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLImageAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIImageFrame.h"
|
||||
|
||||
// --- image -----
|
||||
|
||||
nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIImageFrame *aImageFrame, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
nsAutoString mapElementName;
|
||||
|
||||
if (doc && element) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
|
||||
element->GetAttribute(NS_LITERAL_STRING("usemap"),mapElementName);
|
||||
if (htmlDoc && !mapElementName.IsEmpty()) {
|
||||
if (mapElementName.CharAt(0) == '#')
|
||||
mapElementName.Cut(0,1);
|
||||
htmlDoc->GetImageMap(mapElementName, getter_AddRefs(mMapElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// The state is a bitfield, get our inherited state, then logically OR it with STATE_ANIMATED if this
|
||||
// is an animated image.
|
||||
|
||||
nsLinkableAccessible::GetAccState(_retval);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && shell)
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
nsCOMPtr<nsIImageFrame> imageFrame(do_QueryInterface(frame));
|
||||
|
||||
nsCOMPtr<imgIRequest> imageRequest;
|
||||
if (imageFrame)
|
||||
imageFrame->GetImageRequest(getter_AddRefs(imageRequest));
|
||||
|
||||
nsCOMPtr<imgIContainer> imgContainer;
|
||||
if (imageRequest)
|
||||
imageRequest->GetImage(getter_AddRefs(imgContainer));
|
||||
|
||||
if (imgContainer) {
|
||||
PRUint32 numFrames;
|
||||
imgContainer->GetNumFrames(&numFrames);
|
||||
if (numFrames > 1)
|
||||
*_retval |= STATE_ANIMATED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> imageContent(do_QueryInterface(mDOMNode));
|
||||
if (imageContent) {
|
||||
nsAutoString name;
|
||||
rv = AppendFlatStringFromContentNode(imageContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_GRAPHIC;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsIAccessible *nsHTMLImageAccessible::CreateAreaAccessible(PRUint32 areaNum)
|
||||
{
|
||||
if (!mMapElement)
|
||||
return nsnull;
|
||||
|
||||
if (areaNum == -1) {
|
||||
PRInt32 numAreaMaps;
|
||||
GetAccChildCount(&numAreaMaps);
|
||||
if (numAreaMaps<=0)
|
||||
return nsnull;
|
||||
areaNum = NS_STATIC_CAST(PRUint32,numAreaMaps-1);
|
||||
}
|
||||
|
||||
nsIDOMHTMLCollection *mapAreas;
|
||||
mMapElement->GetAreas(&mapAreas);
|
||||
if (!mapAreas)
|
||||
return nsnull;
|
||||
|
||||
nsIDOMNode *domNode = nsnull;
|
||||
mapAreas->Item(areaNum,&domNode);
|
||||
if (!domNode)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (!accService)
|
||||
return nsnull;
|
||||
if (accService) {
|
||||
nsIAccessible* acc = nsnull;
|
||||
accService->CreateHTMLAreaAccessible(mPresShell, domNode, this, &acc);
|
||||
return acc;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = CreateAreaAccessible(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = CreateAreaAccessible(-1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
if (mMapElement) {
|
||||
nsIDOMHTMLCollection *mapAreas;
|
||||
mMapElement->GetAreas(&mapAreas);
|
||||
if (mapAreas) {
|
||||
PRUint32 length;
|
||||
mapAreas->GetLength(&length);
|
||||
*_retval = NS_STATIC_CAST(PRInt32, length);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLImageAccessible_H_
|
||||
#define _nsHTMLImageAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
|
||||
/* Accessible for supporting images
|
||||
* supports:
|
||||
* - gets name, role
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLImageAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIImageFrame *imageFrame, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(PRUint32 areaNum);
|
||||
nsCOMPtr<nsIDOMHTMLMapElement> mMapElement;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
if (!IsALink()) // Also initializes private data members
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = AppendFlatStringFromSubtree(mLinkContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -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 Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLLinkAccessible_H_
|
||||
#define _nsHTMLLinkAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsHTMLLinkAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,183 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLListboxAccessible.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
/** ----- nsHTMLListboxAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- create the nsHTMLAccessible
|
||||
*/
|
||||
nsHTMLListboxAccessible::nsHTMLListboxAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** Inherit the ISupports impl from nsAccessible */
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLListboxAccessible, nsAccessible, nsIAccessibleSelectable)
|
||||
|
||||
/**
|
||||
* Tell our caller we are a list ( there isn't a listbox value )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our last child, a nsHTMLListboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Through the arg, pass back our first child, a nsHTMLListboxWindowAccessible object
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* We always have 1 child: SelectList.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleSelectable method. This needs to get from the select the list
|
||||
* of select options and then iterate through that pulling out the selected
|
||||
* items and creating IAccessible objects for them. Put the IAccessibles in
|
||||
* the nsISupportsArray and return them.
|
||||
* retval will be nsnull if:
|
||||
* - there are no options in the select
|
||||
* - there are options but none are selected
|
||||
* - the DOMNode is not a nsIDOMHTMLSelectElement ( shouldn't happen )
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select(do_QueryInterface(mDOMNode));
|
||||
if(select) {
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options;
|
||||
// get all the options in the select
|
||||
select->GetOptions(getter_AddRefs(options));
|
||||
if (options) {
|
||||
// set up variables we need to get the selected options and to get their nsIAccessile objects
|
||||
PRUint32 length;
|
||||
options->GetLength(&length);
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsISupportsArray> selectedAccessibles;
|
||||
NS_NewISupportsArray(getter_AddRefs(selectedAccessibles));
|
||||
if (!selectedAccessibles || !accService)
|
||||
return NS_ERROR_FAILURE;
|
||||
// find the selected options and get the accessible objects;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
for (PRUint32 i = 0 ; i < length ; i++) {
|
||||
nsCOMPtr<nsIDOMNode> tempNode;
|
||||
options->Item(i,getter_AddRefs(tempNode));
|
||||
if (tempNode) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> tempOption(do_QueryInterface(tempNode));
|
||||
if (tempOption)
|
||||
tempOption->GetSelected(&isSelected);
|
||||
if (isSelected) {
|
||||
nsCOMPtr<nsIAccessible> tempAccess;
|
||||
accService->CreateHTMLSelectOptionAccessible(tempOption, this, context, getter_AddRefs(tempAccess));
|
||||
if ( tempAccess )
|
||||
selectedAccessibles->AppendElement(tempAccess);
|
||||
isSelected = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedAccessibles->Count(&length); // reusing length
|
||||
if ( length != 0 ) { // length of nsISupportsArray containing selected options
|
||||
*_retval = selectedAccessibles;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
// no options, not a select or none of the options are selected
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. SelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if ( select ) {
|
||||
select->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLListboxAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLListboxAccessible_h__
|
||||
#define __nsHTMLListboxAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Combobox widget.
|
||||
*/
|
||||
class nsHTMLListboxAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLListboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,794 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsISelectElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
/*
|
||||
* A class the represents the text field in the Select to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsHTMLSelectTextFieldAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A base class that can listen to menu events. Its used so the
|
||||
* button and the window accessibles can change there name and role
|
||||
* depending on whether the drop down list is dropped down on not
|
||||
*/
|
||||
class nsMenuListenerAccessible : public nsAccessible, public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsMenuListenerAccessible();
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
virtual void SetupMenuListener();
|
||||
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the right of the text field
|
||||
*/
|
||||
class nsHTMLSelectButtonAccessible : public nsMenuListenerAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsHTMLSelectWindowAccessible : public nsMenuListenerAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* The list that contains all the options in the select. It is inside the window.
|
||||
*/
|
||||
class nsHTMLSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectListAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
//--------- nsHTMLSelectAccessible -----
|
||||
|
||||
nsHTMLSelectAccessible::nsHTMLSelectAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLSelectAccessible, nsAccessible, nsIAccessibleSelectable)
|
||||
|
||||
// ------------- Helper method for determination of proper Frame ------
|
||||
//static
|
||||
PRBool nsHTMLSelectAccessible::IsCorrectFrame( nsIFrame* aFrame, nsIAtom* aAtom ) {
|
||||
if (!aFrame || !aAtom)
|
||||
return PR_FALSE;
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (frameType.get() != aAtom)
|
||||
return PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> text;
|
||||
GetAccFirstChild(getter_AddRefs(text));
|
||||
if (text)
|
||||
return text->GetAccValue(_retval);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_COMBOBOX;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
// create a window accessible
|
||||
*_retval = new nsHTMLSelectWindowAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
// create a text field
|
||||
|
||||
*_retval = new nsHTMLSelectTextFieldAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
// always have 3 children
|
||||
*_retval = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------- SelectTextFieldAccessible ------
|
||||
|
||||
nsHTMLSelectTextFieldAccessible::nsHTMLSelectTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if ( !frame )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::textFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (!content)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AppendFlatStringFromSubtree(content, &_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our first child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
if ( !frame )
|
||||
return;
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_STATICTEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --------- nsMenuListenerAccessible -----------
|
||||
|
||||
nsMenuListenerAccessible::nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMenuListenerAccessible::~nsMenuListenerAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupShowing(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupHiding(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuListenerAccessible::SetupMenuListener()
|
||||
{
|
||||
// not not already one register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (!eventReceiver) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------- SelectButtonAccessible ------
|
||||
|
||||
nsHTMLSelectButtonAccessible::nsHTMLSelectButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsMenuListenerAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::gfxButtonControlFrame) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
frame->GetContent(getter_AddRefs(content));
|
||||
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(content));
|
||||
if (element)
|
||||
{
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our second child's frame
|
||||
nsIFrame* frame = nsAccessible::GetBoundsFrame();
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
frame->FirstChild(context, nsnull, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetNextSibling(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::gfxButtonControlFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
return GetAccActionName(0, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
|
||||
{
|
||||
SetupMenuListener();
|
||||
|
||||
// get the current state open or closed
|
||||
// set _retval to it.
|
||||
// notice its supposed to be reversed. Close if opened
|
||||
// and Open if closed.
|
||||
|
||||
if (mOpen)
|
||||
_retval = NS_LITERAL_STRING("Close");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("Open");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectWindowAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectTextFieldAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectButtonAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//---------------------
|
||||
|
||||
|
||||
nsHTMLSelectWindowAccessible::nsHTMLSelectWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell)
|
||||
:nsMenuListenerAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
SetupMenuListener();
|
||||
|
||||
// if open we are visible if closed we are invisible
|
||||
// set _retval to it.
|
||||
if (mOpen)
|
||||
*_retval |= STATE_DEFAULT;
|
||||
else
|
||||
*_retval |= STATE_INVISIBLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsHTMLSelectButtonAccessible(parent, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLSelectWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
// get our first option
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
// now get its frame
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aRelativeFrame = nsnull;
|
||||
return;
|
||||
}
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::blockFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(&frame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( frame, nsLayoutAtoms::areaFrame) )
|
||||
return;
|
||||
|
||||
frame->GetParent(aRelativeFrame);
|
||||
if ( ! nsHTMLSelectAccessible::IsCorrectFrame( *aRelativeFrame, nsLayoutAtoms::listControlFrame) )
|
||||
return;
|
||||
|
||||
frame->GetRect(aBounds);
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
|
||||
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> last;
|
||||
mDOMNode->GetLastChild(getter_AddRefs(last));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, last, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> first;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(first));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, first, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------
|
||||
|
||||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LISTITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(next));
|
||||
|
||||
if (next) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, next, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> prev;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prev));
|
||||
|
||||
if (prev) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, prev, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content (do_QueryInterface(mDOMNode));
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoString option;
|
||||
nsresult rv = AppendFlatStringFromSubtree(content, &option);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
option.CompressWhitespace();
|
||||
_retval.Assign(option);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLSelectAccessible_h__
|
||||
#define __nsHTMLSelectAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
|
||||
class nsHTMLSelectAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsHTMLSelectAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrame( nsIFrame* aFrame, nsIAtom* aAtom );
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Each option in the Select. These are in the nsListAccessible
|
||||
*/
|
||||
class nsHTMLSelectOptionAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,312 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
*/
|
||||
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISelectControlFrame.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIListControlFrame.h"
|
||||
|
||||
/** ----- nsHTMLSelectListAccessible ----- */
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> last;
|
||||
mDOMNode->GetLastChild(getter_AddRefs(last));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, last, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> first;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(first));
|
||||
|
||||
*_retval = new nsHTMLSelectOptionAccessible(this, first, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLSelectListAccessible we can have the following states:
|
||||
* STATE_MULTISELECTABLE
|
||||
* STATE_EXTSELECTABLE
|
||||
* no STATE_FOCUSED! -- can't be focused, options are focused instead
|
||||
* no STATE_FOCUSABLE! -- can't be focused, options are focused instead
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if ( select ) {
|
||||
PRBool multiple;
|
||||
select->GetMultiple(&multiple);
|
||||
if ( multiple )
|
||||
*_retval |= STATE_MULTISELECTABLE | STATE_EXTSELECTABLE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/** ----- nsHTMLSelectOptionAccessible ----- */
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LISTITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(next));
|
||||
|
||||
if (next) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, next, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> prev;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prev));
|
||||
|
||||
if (prev) {
|
||||
*_retval = new nsHTMLSelectOptionAccessible(mParent, prev, mPresShell);
|
||||
if ( ! *_retval )
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content (do_QueryInterface(mDOMNode));
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoString option;
|
||||
nsresult rv = AppendFlatStringFromSubtree(content, &option);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAWritableString
|
||||
option.CompressWhitespace();
|
||||
_retval.Assign(option);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLSelectOptionAccessible we can have the following states:
|
||||
* STATE_SELECTABLE
|
||||
* STATE_SELECTED
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* STATE_INVISIBLE // not implemented yet
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0 (nsAccessible::GetAccState() doesn't know about list options)
|
||||
*_retval = 0;
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode, parentNode;
|
||||
mParent->AccGetDOMNode(getter_AddRefs(parentNode));
|
||||
GetFocusedOptionNode(mPresShell, parentNode, focusedOptionNode);
|
||||
if (focusedOptionNode == mDOMNode)
|
||||
*_retval |= STATE_FOCUSED;
|
||||
|
||||
// Are we selected?
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option (do_QueryInterface(mDOMNode));
|
||||
if ( option ) {
|
||||
PRBool isSelected = PR_FALSE;
|
||||
option->GetSelected(&isSelected);
|
||||
if ( isSelected )
|
||||
*_retval |= STATE_SELECTED;
|
||||
}
|
||||
|
||||
*_retval |= STATE_SELECTABLE | STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIWeakReference *aPresShell,
|
||||
nsIDOMNode *aListNode,
|
||||
nsCOMPtr<nsIDOMNode>& aFocusedOptionNode)
|
||||
{
|
||||
NS_ASSERTION(aListNode, "Called GetFocusedOptionNode without a valid list node");
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aListNode));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIListControlFrame> listFrame(do_QueryInterface(frame, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv; // How can list content not have a list frame?
|
||||
NS_ASSERTION(listFrame, "We don't have a list frame, but rv returned a success code.");
|
||||
|
||||
// Get what's focused by asking frame for "selected item".
|
||||
// Don't use DOM method of getting selected item, which instead gives *first* selected option
|
||||
PRInt32 focusedOptionIndex = 0;
|
||||
rv = listFrame->GetSelectedIndex(&focusedOptionIndex);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options;
|
||||
|
||||
// Get options
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(aListNode));
|
||||
NS_ASSERTION(selectElement, "No select element where it should be");
|
||||
rv = selectElement->GetOptions(getter_AddRefs(options));
|
||||
}
|
||||
|
||||
// Either use options and focused index, or default to list node itself
|
||||
if (NS_SUCCEEDED(rv) && options && focusedOptionIndex >= 0) // Something is focused
|
||||
rv = options->Item(focusedOptionIndex, getter_AddRefs(aFocusedOptionNode));
|
||||
else { // If no options in list or focusedOptionIndex <0, then we are not focused on an item
|
||||
aFocusedOptionNode = aListNode; // return normal target content
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsHTMLSelectListAccessible_h__
|
||||
#define __nsHTMLSelectListAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
/*
|
||||
* The list that contains all the options in the select.
|
||||
*/
|
||||
class nsHTMLSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectListAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/*
|
||||
* Options inside the select, contained within the list
|
||||
*/
|
||||
class nsHTMLSelectOptionAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
static nsresult GetFocusedOptionNode(nsIWeakReference *aPresShell, nsIDOMNode *aListNode, nsCOMPtr<nsIDOMNode>& aFocusedOptionNode);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -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 Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsHTMLBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CELL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLTableAccessible::nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsHTMLBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTableAccessible_H_
|
||||
#define _nsHTMLTableAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsHTMLTableCellAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
class nsHTMLTableAccessible : public nsHTMLBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsString.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(nsAWritableString& _retval)
|
||||
{
|
||||
|
||||
return mDOMNode->GetNodeValue(_retval);
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTextAccessible_H_
|
||||
#define _nsHTMLTextAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
class nsITextControlFrame;
|
||||
|
||||
class nsHTMLTextAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,478 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMNSHTMLSelectElement.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull,aShell),
|
||||
nsDocAccessibleMixin(aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
|
||||
{
|
||||
mListener = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
|
||||
shell->GetDocument(getter_AddRefs(mDocument));
|
||||
mDOMNode = do_QueryInterface(mDocument);
|
||||
|
||||
nsLayoutAtoms::AddRefAtoms();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::~nsRootAccessible()
|
||||
{
|
||||
nsLayoutAtoms::ReleaseAtoms();
|
||||
RemoveAccessibleEventListener(mListener);
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccName(nsAWritableString& aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
}
|
||||
|
||||
// helpers
|
||||
nsIFrame* nsRootAccessible::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return nsnull;
|
||||
|
||||
nsIFrame* root = nsnull;
|
||||
if (shell)
|
||||
shell->GetRootFrame(&root);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
void nsRootAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
{
|
||||
*aRelativeFrame = GetFrame();
|
||||
(*aRelativeFrame)->GetRect(aBounds);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long accRole; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUint32 *aAccRole)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
*aAccRole = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
// Commenting this out for now.
|
||||
// It was requested that we always use pane objects instead of client objects.
|
||||
// However, it might be asked that we put client objects back.
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsISupports> container;
|
||||
context->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem, docTreeItem(do_QueryInterface(container));
|
||||
if (docTreeItem) {
|
||||
docTreeItem->GetSameTypeParent(getter_AddRefs(parentTreeItem));
|
||||
// Basically, if this docshell has a parent of the same type, it's a frame
|
||||
if (parentTreeItem) {
|
||||
*aAccRole = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*aAccRole = ROLE_CLIENT;
|
||||
*/
|
||||
|
||||
*aAccRole = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetAccState(aAccState);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccValue(nsAWritableString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
|
||||
/* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (!mListener)
|
||||
{
|
||||
// add an event listener to the document
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
// use AddEventListener from the nsIDOMEventTarget interface
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventTarget), getter_AddRefs(target))) && target)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
// we're a DOMEventListener now!!
|
||||
nsCOMPtr<nsIDOMEventListener> listener;
|
||||
rv = this->QueryInterface( NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener) );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to QI");
|
||||
// capture DOM focus events
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("focus") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
// capture Form change events
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("change") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
// add ourself as a CheckboxStateChange listener ( custom event fired in nsHTMLInputElement.cpp )
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("CheckboxStateChange") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
// add ourself as a RadiobuttonStateChange listener ( custom event fired in nsHTMLInputElement.cpp )
|
||||
rv = target->AddEventListener( NS_LITERAL_STRING("RadiobuttonStateChange") , listener, PR_TRUE );
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
// create a weak reference to the listener
|
||||
mListener = aListener;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void removeAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
if (mListener)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
if (!shell)
|
||||
return NS_OK;
|
||||
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> erP;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP))) && erP)
|
||||
{
|
||||
nsresult rv = erP->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
mListener = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --------------- nsIDOMEventListener Methods (3) ------------------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mListener) {
|
||||
// optionTargetNode is set to current option for HTML selects
|
||||
nsCOMPtr<nsIDOMNode> targetNode, optionTargetNode;
|
||||
nsresult rv = GetTargetNode(aEvent, targetNode);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// Check to see if it's a select element. If so, need the currently focused option
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(targetNode));
|
||||
if (selectElement) // ----- Target Node is an HTML <select> element ------
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOptionNode(mPresShell, targetNode, optionTargetNode);
|
||||
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
if (NS_SUCCEEDED(mAccService->GetAccessibleFor(targetNode, getter_AddRefs(accessible)))) {
|
||||
if ( eventType.EqualsIgnoreCase("focus") ) {
|
||||
if (mCurrentFocus != targetNode) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = targetNode;
|
||||
}
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("change") ) {
|
||||
if (optionTargetNode) { // Set to current option only for HTML selects
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_SELECTION, accessible);
|
||||
if (mCurrentFocus != optionTargetNode &&
|
||||
NS_SUCCEEDED(mAccService->GetAccessibleFor(optionTargetNode, getter_AddRefs(accessible)))) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = optionTargetNode;
|
||||
}
|
||||
}
|
||||
else
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("CheckboxStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("RadiobuttonStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
|
||||
nsresult rv;
|
||||
aTargetNode = do_QueryInterface(domEventTarget, &rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// ------- nsIDOMFocusListener Methods (1) -------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return HandleEvent(aEvent);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Blur(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// ------- nsIDOMFormListener Methods (5) -------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Submit(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Reset(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Change(nsIDOMEvent* aEvent)
|
||||
{
|
||||
// get change events when the form elements changes its state, checked->not,
|
||||
// deleted text, new text, change in selection for list/combo boxes
|
||||
// this may be the event that we have the individual Accessible objects
|
||||
// handle themselves -- have list/combos figure out the change in selection
|
||||
// have textareas and inputs fire a change of state etc...
|
||||
return HandleEvent(aEvent);
|
||||
}
|
||||
|
||||
// gets Select events when text is selected in a textarea or input
|
||||
NS_IMETHODIMP nsRootAccessible::Select(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// gets Input events when text is entered or deleted in a textarea or input
|
||||
NS_IMETHODIMP nsRootAccessible::Input(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// ------- nsIAccessibleDocument Methods (5) ---------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
|
||||
nsDocAccessibleMixin::nsDocAccessibleMixin(nsIDocument *aDoc):mDocument(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
nsDocAccessibleMixin::nsDocAccessibleMixin(nsIWeakReference *aPresShell)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aPresShell));
|
||||
NS_ASSERTION(shell,"Shell is gone!!! What are we doing here?");
|
||||
shell->GetDocument(getter_AddRefs(mDocument));
|
||||
}
|
||||
|
||||
nsDocAccessibleMixin::~nsDocAccessibleMixin()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetURL(nsAWritableString& aURL)
|
||||
{
|
||||
nsCOMPtr<nsIURI> pURI;
|
||||
mDocument->GetDocumentURL(getter_AddRefs(pURI));
|
||||
nsXPIDLCString path;
|
||||
pURI->GetSpec(getter_Copies(path));
|
||||
aURL.Assign(NS_ConvertUTF8toUCS2(path).get());
|
||||
//XXXaaronl Need to use CopyUTF8toUCS2(nsDependentCString(path), aURL); when it's written
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
// This doesn't leak - we don't own the const pointer that's returned
|
||||
aTitle = *(mDocument->GetDocumentTitle());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetMimeType(nsAWritableString& aMimeType)
|
||||
{
|
||||
if (mDocument)
|
||||
return mDocument->GetContentType(aMimeType);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetDocType(nsAWritableString& aDocType)
|
||||
{
|
||||
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMDocumentType> docType;
|
||||
|
||||
if (xulDoc) {
|
||||
aDocType = NS_LITERAL_STRING("window"); // doctype not implemented for XUL at time of writing - causes assertion
|
||||
return NS_OK;
|
||||
}
|
||||
else if (domDoc && NS_SUCCEEDED(domDoc->GetDoctype(getter_AddRefs(docType))) && docType) {
|
||||
return docType->GetName(aDocType);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAWritableString& aNameSpaceURI)
|
||||
{
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsINameSpaceManager> nameSpaceManager;
|
||||
if (NS_SUCCEEDED(mDocument->GetNameSpaceManager(*getter_AddRefs(nameSpaceManager))))
|
||||
return nameSpaceManager->GetNameSpaceURI(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
*doc = mDocument;
|
||||
if (mDocument) {
|
||||
NS_IF_ADDREF(*doc);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
// Screen readers need to know when the document is finished loading (STATE_BUSY flag)
|
||||
// We do it this way, rather than via nsIWebProgressListener, because
|
||||
// if accessibility was turned on after a document already finished loading,
|
||||
// we would get no state changes from nsIWebProgressListener.
|
||||
// The GetBusyFlags method, however, always has the current busy state information for us.
|
||||
|
||||
*aAccState = 0;
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
if (context) {
|
||||
nsCOMPtr<nsISupports> container;
|
||||
context->GetContainer(getter_AddRefs(container));
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
||||
if (docShell) {
|
||||
PRUint32 busyFlags;
|
||||
docShell->GetBusyFlags(&busyFlags);
|
||||
if (busyFlags != nsIDocShell::BUSY_FLAGS_NONE)
|
||||
*aAccState = nsIAccessible::STATE_BUSY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsRootAccessible_H_
|
||||
#define _nsRootAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleEventReceiver.h"
|
||||
#include "nsIAccessibleEventListener.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
class nsDocAccessibleMixin
|
||||
{
|
||||
public:
|
||||
nsDocAccessibleMixin(nsIDocument *doc);
|
||||
nsDocAccessibleMixin(nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleMixin();
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
||||
class nsRootAccessible : public nsAccessible,
|
||||
public nsDocAccessibleMixin,
|
||||
public nsIAccessibleDocument,
|
||||
public nsIAccessibleEventReceiver,
|
||||
public nsIDOMFocusListener,
|
||||
public nsIDOMFormListener
|
||||
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsRootAccessible(nsIWeakReference* aShell);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccName(nsAWritableString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAWritableString& aAccValue);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
|
||||
// ----- nsIAccessibleEventReceiver -------------------
|
||||
|
||||
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
|
||||
// ----- nsIDOMEventListener --------------------------
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent);
|
||||
|
||||
// ----- 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);
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode);
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual nsIFrame* GetFrame();
|
||||
|
||||
// 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
|
||||
nsIAccessibleEventListener* mListener;
|
||||
nsCOMPtr<nsIDOMNode> mCurrentFocus;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
4
mozilla/aclocal.m4
vendored
4
mozilla/aclocal.m4
vendored
@@ -6,9 +6,5 @@ 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/nspr.m4)dnl
|
||||
builtin(include, build/autoconf/pkg.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
@@ -27,16 +27,10 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifneq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
DIRS = unix
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Install bloaturls.txt file for tinderbox Bloaty test.
|
||||
install:: $(srcdir)/bloaturls.txt
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
# Install startup.html, startup test page.
|
||||
install:: $(srcdir)/startup-test.html
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
@@ -132,7 +132,7 @@ foreach $ac_file (@makefiles) {
|
||||
$top_srcdir = $ac_dots;
|
||||
$top_srcdir =~ s%/$%%;
|
||||
}
|
||||
} elsif ($ac_given_srcdir =~ m%^/% or $ac_given_srcdir =~ m%^.:/%) {
|
||||
} elsif ($ac_given_srcdir =~ m%^/%) {
|
||||
$srcdir = "$ac_given_srcdir$ac_dir_suffix";
|
||||
$top_srcdir = "$ac_given_srcdir";
|
||||
} else {
|
||||
@@ -153,17 +153,17 @@ foreach $ac_file (@makefiles) {
|
||||
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;
|
||||
#}
|
||||
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;
|
||||
s/\@srcdir\@/$srcdir/;
|
||||
s/\@top_srcdir\@/$top_srcdir/;
|
||||
|
||||
if (/\@[_a-zA-Z]*\@/) {
|
||||
warn "Unknown variable:$ac_file:$.:$_";
|
||||
#warn "Unknown variable:$ac_file:$.:$_";
|
||||
push @unhandled, $ac_file;
|
||||
last;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ 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
|
||||
|
||||
|
||||
@@ -96,45 +95,13 @@ 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])
|
||||
# See the load-mozconfig.sh script for more details.
|
||||
_topsrcdir=`dirname [$]0`
|
||||
. $_topsrcdir/build/autoconf/load-mozconfig.sh])
|
||||
|
||||
dnl This gets inserted at the top of the configure script
|
||||
MOZ_READ_MOZCONFIG(MOZ_TOPSRCDIR)
|
||||
MOZ_READ_MOZCONFIG
|
||||
|
||||
952
mozilla/build/autoconf/config.guess
vendored
952
mozilla/build/autoconf/config.guess
vendored
File diff suppressed because it is too large
Load Diff
562
mozilla/build/autoconf/config.sub
vendored
562
mozilla/build/autoconf/config.sub
vendored
@@ -1,10 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-03-30'
|
||||
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
@@ -29,8 +25,6 @@ timestamp='2001-03-30'
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
@@ -51,73 +45,30 @@ timestamp='2001-03-30'
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
Operation modes:
|
||||
-h, --help print this help, then exit
|
||||
-t, --time-stamp print date of last modification, then exit
|
||||
-v, --version print version number, then exit
|
||||
|
||||
Report bugs and patches to <config-patches@gnu.org>."
|
||||
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
# Parse command line
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
--time-stamp | --time* | -t )
|
||||
echo "$timestamp" ; exit 0 ;;
|
||||
--version | -v )
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | --h* | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
break ;;
|
||||
-* )
|
||||
echo "$me: invalid option $1$help"
|
||||
exit 1 ;;
|
||||
|
||||
*local*)
|
||||
# First pass through any local machine types.
|
||||
echo $1
|
||||
exit 0;;
|
||||
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) echo "$me: missing argument$help" >&2
|
||||
exit 1;;
|
||||
1) ;;
|
||||
*) echo "$me: too many arguments$help" >&2
|
||||
exit 1;;
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@@ -143,25 +94,15 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis)
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-scout)
|
||||
;;
|
||||
-wrs)
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=-sco3.2v5
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
@@ -180,9 +121,6 @@ case $os in
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-udk*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@@ -205,9 +143,17 @@ case $os in
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
-mint | -mint[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
-qnx*)
|
||||
basic_machine=i386-pc
|
||||
os=-qnx`uname -v | cut -c1-1`
|
||||
;;
|
||||
-nto*)
|
||||
basic_machine=i386-pc
|
||||
os=-nto
|
||||
;;
|
||||
-rhapsody*)
|
||||
basic_machine=ppc-apple
|
||||
os=-rhapsody`uname -r`
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -215,39 +161,20 @@ esac
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
|
||||
| arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
|
||||
| pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 \
|
||||
| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
|
||||
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||
| hppa64 \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
|
||||
| alphaev6[78] \
|
||||
| we32k | ns16k | clipper | i370 | sh | sh[34] \
|
||||
| powerpc | powerpcle \
|
||||
| 1750a | dsp16xx | pdp10 | pdp11 \
|
||||
| mips16 | mips64 | mipsel | mips64el \
|
||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
|
||||
| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
|
||||
| pj | pjl | h8500)
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | alphaev5 | alphaev56 | alphaev6 | alphapca56 | we32k | ns16k | clipper \
|
||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[234567]86 | x86_64)
|
||||
i[34567]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
@@ -256,51 +183,27 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
# FIXME: clean up the formatting here.
|
||||
vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||
| xmp-* | ymp-* \
|
||||
| x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
|
||||
| hppa2.0n-* | hppa64-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
|
||||
| alphaev6[78]-* \
|
||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
||||
| clipper-* | orion-* \
|
||||
| sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
||||
| f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
|
||||
| [cjt]90-* \
|
||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
|
||||
| bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
|
||||
| alpha-* | alphaev5-* | alphaev56-* | alphaev6-* | alphapca56-* | we32k-* | cydra-* \
|
||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
386bsd)
|
||||
basic_machine=i386-unknown
|
||||
os=-bsd
|
||||
;;
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
a29khif)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
@@ -316,24 +219,20 @@ case $basic_machine in
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-unknown
|
||||
basic_machine=m68k-cbm
|
||||
;;
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-unknown
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-unknown
|
||||
basic_machine=m68k-cbm
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
apollo68bsd)
|
||||
basic_machine=m68k-apollo
|
||||
os=-bsd
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
@@ -370,16 +269,13 @@ case $basic_machine in
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[cjt]90)
|
||||
basic_machine=${basic_machine}-cray
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
@@ -413,10 +309,6 @@ case $basic_machine in
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
es1800 | OSE68k | ose68k | ose | OSE)
|
||||
basic_machine=m68k-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
@@ -427,10 +319,6 @@ case $basic_machine in
|
||||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
go32)
|
||||
basic_machine=i386-pc
|
||||
os=-go32
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
@@ -439,14 +327,6 @@ case $basic_machine in
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
h8300xray)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-xray
|
||||
;;
|
||||
h8500hms)
|
||||
basic_machine=h8500-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
@@ -462,30 +342,13 @@ case $basic_machine in
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp3k9[0-9][0-9] | hp9[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k6[0-9][0-9] | hp6[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k7[0-79][0-9] | hp7[0-79][0-9])
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k78[0-9] | hp78[0-9])
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][13679] | hp8[0-9][13679])
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
@@ -494,16 +357,9 @@ case $basic_machine in
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
hppaosf)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-osf
|
||||
;;
|
||||
hppro)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-proelf
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[34567]86v32)
|
||||
@@ -522,14 +378,6 @@ case $basic_machine in
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
i386mach)
|
||||
basic_machine=i386-mach
|
||||
os=-mach
|
||||
;;
|
||||
i386-vsta | vsta)
|
||||
basic_machine=i386-unknown
|
||||
os=-vsta
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
@@ -555,23 +403,9 @@ case $basic_machine in
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
#### MozillaHack
|
||||
i386-msvc | msvc)
|
||||
basic_machine=i386-pc
|
||||
os=-msvc
|
||||
;;
|
||||
#### End MozillaHack
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
@@ -586,34 +420,10 @@ case $basic_machine in
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
netbsd386)
|
||||
basic_machine=i386-unknown
|
||||
os=-netbsd
|
||||
;;
|
||||
netwinder)
|
||||
basic_machine=armv4l-rebel
|
||||
os=-linux
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
@@ -626,10 +436,6 @@ case $basic_machine in
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
necv70)
|
||||
basic_machine=v70-nec
|
||||
os=-sysv
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
@@ -655,32 +461,9 @@ case $basic_machine in
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
mon960)
|
||||
basic_machine=i960-intel
|
||||
os=-mon960
|
||||
;;
|
||||
nonstopux)
|
||||
basic_machine=mips-compaq
|
||||
os=-nonstopux
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
op50n-* | op60c-*)
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
os68k)
|
||||
basic_machine=m68k-none
|
||||
os=-os68k
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
@@ -698,28 +481,28 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen)
|
||||
pentium | p5 | k5 | nexen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
pentiumpro | p6 | k6 | 6x86)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i686-pc
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
|
||||
pentium-* | p5-* | k5-* | nexen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
pentiumpro-* | p6-* | k6-* | 6x86-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=power-ibm
|
||||
power) basic_machine=rs6000-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
@@ -734,13 +517,13 @@ case $basic_machine in
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
pw32)
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
*qnx*)
|
||||
basic_machine=i386-pc
|
||||
os=-qnx`uname -v | cut -c1-1`
|
||||
;;
|
||||
rom68k)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
*nto*)
|
||||
basic_machine=i386-pc
|
||||
os=-nto
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
@@ -748,10 +531,6 @@ case $basic_machine in
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sa29200)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@@ -759,10 +538,6 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sparclite-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
@@ -770,13 +545,6 @@ case $basic_machine in
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
st2000)
|
||||
basic_machine=m68k-tandem
|
||||
;;
|
||||
stratus)
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@@ -817,22 +585,10 @@ case $basic_machine in
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
sv1)
|
||||
basic_machine=sv1-cray
|
||||
os=-unicos
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=t3e-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
@@ -850,10 +606,6 @@ case $basic_machine in
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
v810 | necv810)
|
||||
basic_machine=v810-nec
|
||||
os=-none
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
@@ -877,14 +629,6 @@ case $basic_machine in
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
w65*)
|
||||
basic_machine=w65-wdc
|
||||
os=-none
|
||||
;;
|
||||
w89k-*)
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
@@ -892,10 +636,6 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
z8k-*-coff)
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
@@ -903,15 +643,6 @@ case $basic_machine in
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
w89k)
|
||||
basic_machine=hppa1.1-winbond
|
||||
;;
|
||||
op50n)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
op60c)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
@@ -928,20 +659,13 @@ case $basic_machine in
|
||||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp10)
|
||||
# there are many clones, so DEC is not a safe bet
|
||||
basic_machine=pdp10-unknown
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh3 | sh4)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv9)
|
||||
sparc)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@@ -953,19 +677,6 @@ case $basic_machine in
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
mac | mpw | mac-mpw)
|
||||
basic_machine=m68k-apple
|
||||
;;
|
||||
pmac | pmac-mpw)
|
||||
basic_machine=powerpc-apple
|
||||
;;
|
||||
c4x*)
|
||||
basic_machine=c4x-none
|
||||
os=-coff
|
||||
;;
|
||||
*-unknown)
|
||||
# Make sure to match an already-canonicalized machine name.
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
@@ -1007,12 +718,6 @@ case $os in
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
#### MozillaHack
|
||||
-os2_emx)
|
||||
;;
|
||||
-os2_vacpp)
|
||||
;;
|
||||
#### End MozillaHack
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
@@ -1025,35 +730,15 @@ case $os in
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -msvc* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
case $basic_machine in
|
||||
x86-* | i[34567]86-*)
|
||||
;;
|
||||
*)
|
||||
os=-nto$os
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-nto*)
|
||||
os=-nto-qnx
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
-beos*)
|
||||
os=-beos
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
@@ -1064,12 +749,6 @@ case $os in
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
@@ -1085,18 +764,12 @@ case $os in
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
os=-nsk
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
@@ -1122,17 +795,14 @@ case $os in
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-ose*)
|
||||
os=-ose
|
||||
;;
|
||||
-es1800*)
|
||||
os=-ose
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
-rhapsody*)
|
||||
;;
|
||||
-qnx*)
|
||||
;;
|
||||
-nto*)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
@@ -1159,15 +829,9 @@ case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-rebel)
|
||||
os=-linux
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
@@ -1186,36 +850,15 @@ case $basic_machine in
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
*-winbond)
|
||||
os=-proelf
|
||||
;;
|
||||
*-oki)
|
||||
os=-proelf
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
@@ -1276,21 +919,9 @@ case $basic_machine in
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f30[01]-fujitsu | f700-fujitsu)
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*-rom68k)
|
||||
os=-coff
|
||||
;;
|
||||
*-*bug)
|
||||
os=-coff
|
||||
;;
|
||||
*-apple)
|
||||
os=-macos
|
||||
;;
|
||||
*-atari*)
|
||||
os=-mint
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
@@ -1312,15 +943,9 @@ case $basic_machine in
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
vendor=be
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-mpeix*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
@@ -1336,7 +961,7 @@ case $basic_machine in
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs* | -opened*)
|
||||
-mvs*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
@@ -1348,26 +973,9 @@ case $basic_machine in
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
-hms*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-mpw* | -macos*)
|
||||
vendor=apple
|
||||
;;
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
vendor=atari
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "timestamp='"
|
||||
# time-stamp-format: "%:y-%02m-%02d"
|
||||
# time-stamp-end: "'"
|
||||
# End:
|
||||
|
||||
46
mozilla/build/autoconf/find-mozconfig.sh
Executable file
46
mozilla/build/autoconf/find-mozconfig.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#! /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) 1999 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
# find-mozconfig.sh - Loads options from .mozconfig onto configure's
|
||||
# command-line. The .mozconfig file is searched for in the
|
||||
# order:
|
||||
# if $MOZCONFIG is set, use that.
|
||||
# Otherwise, use $TOPSRCDIR/.mozconfig
|
||||
# Otherwise, use $HOME/.mozconfig
|
||||
#
|
||||
topsrcdir=`cd \`dirname $0\`/../..; pwd`
|
||||
|
||||
for _config in $MOZCONFIG \
|
||||
$MOZ_MYCONFIG \
|
||||
$topsrcdir/.mozconfig \
|
||||
$topsrcdir/mozconfig \
|
||||
$topsrcdir/mozconfig.sh \
|
||||
$topsrcdir/myconfig.sh \
|
||||
$HOME/.mozconfig \
|
||||
$HOME/.mozconfig.sh \
|
||||
$HOME/.mozmyconfig.sh
|
||||
do
|
||||
if test -f $_config; then
|
||||
echo $_config;
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
102
mozilla/build/autoconf/load-mozconfig.sh
Normal file
102
mozilla/build/autoconf/load-mozconfig.sh
Normal file
@@ -0,0 +1,102 @@
|
||||
# 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) 1999 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
# load-mozconfig.sh - Loads options from .mozconfig onto configure's
|
||||
# command-line. See find-mozconfig.sh for how the config file is
|
||||
# found
|
||||
#
|
||||
# The options from .mozconfig are inserted into the command-line
|
||||
# before the real command-line options. This way the real options
|
||||
# will override any .mozconfig options.
|
||||
#
|
||||
# .mozconfig is a shell script. To add an option to configure's
|
||||
# command-line use the pre-defined function, ac_add_options,
|
||||
#
|
||||
# ac_add_options <configure-option> [<configure-option> ... ]
|
||||
#
|
||||
# For example,
|
||||
#
|
||||
# ac_add_options --with-pthreads --enable-debug
|
||||
#
|
||||
# ac_add_options can be called multiple times in .mozconfig.
|
||||
# Each call adds more options to configure's command-line.
|
||||
#
|
||||
# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
|
||||
|
||||
|
||||
ac_add_options() {
|
||||
for _opt
|
||||
do
|
||||
# Escape shell characters, space, tab, dollar, quote, backslash.
|
||||
_opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'`
|
||||
_opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'`
|
||||
|
||||
# Avoid adding duplicates
|
||||
case "$ac_options" in
|
||||
*"$_opt"* ) ;;
|
||||
* ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
mk_add_options() {
|
||||
# These options are for client.mk
|
||||
# configure can safely ignore them.
|
||||
:
|
||||
}
|
||||
|
||||
ac_echo_options() {
|
||||
echo "Adding options from $MOZCONFIG:"
|
||||
eval "set -- $mozconfig_ac_options"
|
||||
for _opt
|
||||
do
|
||||
echo " $_opt"
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Define load the options
|
||||
#
|
||||
ac_options=
|
||||
mozconfig_ac_options=
|
||||
|
||||
# Save the real command-line options
|
||||
for _opt
|
||||
do
|
||||
# Escape shell characters, space, tab, dollar, quote, backslash.
|
||||
_opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'`
|
||||
|
||||
ac_options="$ac_options \"$_opt\""
|
||||
done
|
||||
|
||||
# Call find-mozconfig.sh
|
||||
# In params: $MOZCONFIG $HOME (old:$MOZ_MYCONFIG)
|
||||
_topsrcdir=`dirname $0`
|
||||
MOZCONFIG=`$_topsrcdir/build/autoconf/find-mozconfig.sh`
|
||||
|
||||
if [ "$MOZCONFIG" ]; then
|
||||
. $MOZCONFIG
|
||||
ac_echo_options 1>&2
|
||||
fi
|
||||
|
||||
eval "set -- $mozconfig_ac_options $ac_options"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
# make-makefiles - Quickly create Makefiles for subdirectories.
|
||||
# Also, creates any needed subdirectories.
|
||||
#
|
||||
# usage: make-makefiles [ -t <topsrcdir> -d <depth> ] [ <subdir> | <subdir>/Makefile ] ...
|
||||
# usage: make-makefiles [ -d <depth> ] [ <subdir> | <subdir>/Makefile ] ...
|
||||
|
||||
# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
# Determine various tree path variables
|
||||
#
|
||||
($topsrcdir, $depth, @makefiles) = parse_arguments(@ARGV);
|
||||
($depth, @makefiles) = parse_arguments(@ARGV);
|
||||
|
||||
$object_fullpath = `pwd`;
|
||||
chdir $depth;
|
||||
@@ -43,8 +43,7 @@ chomp $object_root;
|
||||
# called from "mozilla/gfx/src", then $source_subdir would be
|
||||
# "gfx/src/".
|
||||
$source_subdir = "$object_fullpath/";
|
||||
my $quoted_object_root = quotemeta($object_root);
|
||||
$source_subdir =~ s|^$quoted_object_root/||;
|
||||
$source_subdir =~ s|^$object_root/||;
|
||||
|
||||
# Prefix makefiles with $source_subdir so that paths
|
||||
# will be relative to the top of the object tree.
|
||||
@@ -58,7 +57,7 @@ create_directories(@makefiles);
|
||||
# Find the path to the source directory based on how 'make-makefile'
|
||||
# was invoked. The path is either relative to the object directory
|
||||
# or an absolute path.
|
||||
$given_srcdir = find_srcdir($topsrcdir, $depth);
|
||||
$given_srcdir = find_srcdir($0, $depth);
|
||||
|
||||
if ($debug) {
|
||||
warn "object_fullpath = $object_fullpath\n";
|
||||
@@ -95,28 +94,13 @@ sub find_depth {
|
||||
sub parse_arguments {
|
||||
my @args = @_;
|
||||
my $depth = '';
|
||||
my $topsrcdir = '';
|
||||
my @makefiles = ();
|
||||
|
||||
while (1) {
|
||||
if ($args[0] eq '-d') {
|
||||
$depth = $args[1];
|
||||
shift @args;
|
||||
shift @args;
|
||||
} elsif ($args[0] eq '-t') {
|
||||
$topsrcdir = $args[1];
|
||||
shift @args;
|
||||
shift @args;
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($topsrcdir eq '') {
|
||||
$topsrcdir = $0; # Figure out topsrcdir based on program name.
|
||||
$topsrcdir =~ s|/?build/autoconf/.*$||;
|
||||
}
|
||||
if ($depth eq '') {
|
||||
if ($args[0] eq '-d') {
|
||||
$depth = $args[1];
|
||||
shift @args;
|
||||
shift @args;
|
||||
} else {
|
||||
# Use $(DEPTH) in the Makefile or Makefile.in to determine the depth
|
||||
if (-e "Makefile.in") {
|
||||
$depth = find_depth("Makefile.in");
|
||||
@@ -143,7 +127,7 @@ sub parse_arguments {
|
||||
}
|
||||
@makefiles = "Makefile" unless @args;
|
||||
|
||||
return ($topsrcdir, $depth, @makefiles);
|
||||
return ($depth, @makefiles);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +147,10 @@ sub create_directories {
|
||||
# Find the top of the source directory
|
||||
# (Assuming that the executable is in $top_srcdir/build/autoconf)
|
||||
sub find_srcdir {
|
||||
my ($ac_given_srcdir, $depth) = @_;
|
||||
my ($program_name, $depth) = @_;
|
||||
|
||||
my $ac_given_srcdir = $program_name;
|
||||
$ac_given_srcdir =~ s|/?build/autoconf/.*$||;
|
||||
|
||||
if ($debug) {
|
||||
print "ac_given_srcdir = $ac_given_srcdir\n";
|
||||
@@ -208,7 +195,7 @@ sub update_makefiles {
|
||||
$top_srcdir = $ac_dots;
|
||||
$top_srcdir =~ s%/$%%;
|
||||
}
|
||||
} elsif ($ac_given_srcdir =~ m%^/% or $ac_given_srcdir =~ m%^.:/%) {
|
||||
} elsif ($ac_given_srcdir =~ m%^/%) {
|
||||
$srcdir = "$ac_given_srcdir$ac_dir_suffix";
|
||||
$top_srcdir = "$ac_given_srcdir";
|
||||
} else {
|
||||
@@ -246,14 +233,14 @@ sub update_makefiles {
|
||||
};
|
||||
|
||||
while (<INFILE>) {
|
||||
#if (/\@[_a-zA-Z]*\@.*\@[_a-zA-Z]*\@/) {
|
||||
# #warn "Two defines on a line:$ac_file:$.:$_";
|
||||
# push @unhandled, $ac_file;
|
||||
# last;
|
||||
#}
|
||||
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;
|
||||
s/\@srcdir\@/$srcdir/;
|
||||
s/\@top_srcdir\@/$top_srcdir/;
|
||||
|
||||
if (/\@[_a-zA-Z]*\@/) {
|
||||
#warn "Unknown variable:$ac_file:$.:$_";
|
||||
|
||||
@@ -1,46 +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) 1999 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Stephen Lamm <slamm@netscape.com>
|
||||
#
|
||||
|
||||
# mozconfigfind - Loads options from .mozconfig onto configure's
|
||||
# command-line. The .mozconfig file is searched for in the
|
||||
# order:
|
||||
# if $MOZCONFIG is set, use that.
|
||||
# Otherwise, use $TOPSRCDIR/.mozconfig
|
||||
# Otherwise, use $HOME/.mozconfig
|
||||
#
|
||||
topsrcdir=$1
|
||||
|
||||
for _config in $MOZCONFIG \
|
||||
$MOZ_MYCONFIG \
|
||||
$topsrcdir/.mozconfig \
|
||||
$topsrcdir/mozconfig \
|
||||
$topsrcdir/mozconfig.sh \
|
||||
$topsrcdir/myconfig.sh \
|
||||
$HOME/.mozconfig \
|
||||
$HOME/.mozconfig.sh \
|
||||
$HOME/.mozmyconfig.sh
|
||||
do
|
||||
if test -f $_config; then
|
||||
echo $_config;
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user