Compare commits
48 Commits
NETSCAPE_7
...
Style_2001
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36c6508ca5 | ||
|
|
6b86f4ab09 | ||
|
|
0104de5f17 | ||
|
|
832523229e | ||
|
|
4ab78ac028 | ||
|
|
e13ea686b0 | ||
|
|
0ade9ed1a4 | ||
|
|
6ddb5c4e35 | ||
|
|
9a249d1ce7 | ||
|
|
ec026887bd | ||
|
|
5a7f4b953a | ||
|
|
4cbf367e97 | ||
|
|
2978c8f90e | ||
|
|
d7cb494447 | ||
|
|
054f9e0d73 | ||
|
|
d402ba02eb | ||
|
|
771d7cf99d | ||
|
|
48c6ea3e4a | ||
|
|
59114e02c7 | ||
|
|
d9c60cfada | ||
|
|
b5dcf846a3 | ||
|
|
523ae86155 | ||
|
|
c7d094e5d9 | ||
|
|
0d50b654f8 | ||
|
|
7521de201d | ||
|
|
00b7422ed7 | ||
|
|
da6bdccb88 | ||
|
|
87b494d864 | ||
|
|
460ef6f92e | ||
|
|
7d318db199 | ||
|
|
83947b1129 | ||
|
|
f3d727c5e1 | ||
|
|
cda70b20d1 | ||
|
|
c54da4c1f8 | ||
|
|
fd03c1ed56 | ||
|
|
b434461ec9 | ||
|
|
24bed8fd67 | ||
|
|
b9142ffb62 | ||
|
|
fafe707d88 | ||
|
|
c77e78c4c5 | ||
|
|
667fdbf733 | ||
|
|
32a91a8a42 | ||
|
|
3771e0d7d0 | ||
|
|
b288431bbe | ||
|
|
6d8ca72ace | ||
|
|
7b3da9f3ab | ||
|
|
69fb89d831 | ||
|
|
636e660e15 |
@@ -35,158 +35,73 @@ EXPORT_DIRS = $(BUILD_MODULE_DEP_DIRS)
|
||||
|
||||
else
|
||||
|
||||
#
|
||||
# And now for something completely different...
|
||||
# Divide the default build into tiers.
|
||||
# Tiers must be defined on module boundaries
|
||||
#
|
||||
default: $(SUBMAKEFILES)
|
||||
$(MAKE) tier_0
|
||||
$(MAKE) nspr
|
||||
$(MAKE) ldap
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
$(MAKE) freetype
|
||||
$(MAKE) expat
|
||||
endif
|
||||
$(MAKE) tier_1
|
||||
$(MAKE) tier_9
|
||||
ifdef MOZ_EXTENSIONS
|
||||
$(MAKE) tier_94
|
||||
endif
|
||||
ifdef MOZ_PSM
|
||||
$(MAKE) tier_95
|
||||
endif
|
||||
ifdef MOZ_MAIL_NEWS
|
||||
$(MAKE) tier_97
|
||||
endif
|
||||
ifdef MOZ_CALENDAR
|
||||
$(MAKE) tier_98
|
||||
endif
|
||||
$(MAKE) tier_99
|
||||
|
||||
# Make sure that the existing rulesets work
|
||||
DIRS = \
|
||||
$(tier_0_dirs) \
|
||||
$(tier_1_dirs) \
|
||||
$(tier_9_dirs) \
|
||||
$(NULL)
|
||||
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
DIRS += gc/boehm
|
||||
endif
|
||||
|
||||
ifdef MOZ_EXTENSIONS
|
||||
DIRS += $(tier_94_dirs)
|
||||
endif
|
||||
ifdef MOZ_PSM
|
||||
DIRS += $(tier_95_dirs)
|
||||
endif
|
||||
ifdef MOZ_MAIL_NEWS
|
||||
DIRS += $(tier_97_dirs)
|
||||
endif
|
||||
ifdef MOZ_CALENDAR
|
||||
DIRS += $(tier_98_dirs)
|
||||
endif
|
||||
|
||||
DIRS += $(tier_99_dirs)
|
||||
|
||||
#
|
||||
# tier 0 - base build config dirs
|
||||
#
|
||||
tier_0_dirs = \
|
||||
config \
|
||||
build \
|
||||
include \
|
||||
$(NULL)
|
||||
|
||||
#
|
||||
# tier 1 - base libraries
|
||||
#
|
||||
tier_1_dirs = js
|
||||
|
||||
# MacOSX needs to build lib for MoreFiles before xpcom
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
tier_1_dirs += lib/mac/MoreFiles
|
||||
endif
|
||||
|
||||
#
|
||||
# tier 9 - core components (xpcom,necko,gecko)
|
||||
#
|
||||
|
||||
# intl should not be in here - it's just temporary until
|
||||
# xpconnect's dependency on intl is repaired - see bug 106130
|
||||
tier_9_dirs += \
|
||||
modules/libreg \
|
||||
string \
|
||||
xpcom \
|
||||
intl \
|
||||
$(NULL)
|
||||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
tier_9_dirs += modules/zlib
|
||||
endif
|
||||
|
||||
# Installer needs standalone libjar, hence standalone zlib
|
||||
ifneq (,$(filter Linux SunOS WINNT,$(OS_ARCH)))
|
||||
tier_9_dirs += modules/zlib/standalone
|
||||
endif
|
||||
|
||||
tier_9_dirs += \
|
||||
modules/libjar \
|
||||
$(NULL)
|
||||
DIRS = config build
|
||||
|
||||
ifdef MOZ_JAVA_SUPPLEMENT
|
||||
tier_9_dirs += \
|
||||
DIRS += \
|
||||
java/util \
|
||||
java/webclient \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifndef MOZ_NATIVE_JPEG
|
||||
tier_9_dirs += jpeg
|
||||
# boehm needs to be built before XPCOM
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
DIRS += gc/boehm
|
||||
endif
|
||||
|
||||
tier_9_dirs += dbm js/src/xpconnect
|
||||
DIRS += $(NSPRPUB_DIR)
|
||||
|
||||
DIRS += dbm modules/libreg js string xpcom js/src/xpconnect
|
||||
|
||||
ifdef MOZ_OJI
|
||||
tier_9_dirs += js/src/liveconnect
|
||||
DIRS += js/src/liveconnect
|
||||
endif
|
||||
|
||||
ifdef MOZ_JSDEBUGGER
|
||||
tier_9_dirs += js/jsd
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
DIRS += modules/zlib
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
tier_9_dirs += other-licenses/Xft
|
||||
ifndef MOZ_NATIVE_JPEG
|
||||
DIRS += jpeg
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_XLIB
|
||||
tier_9_dirs += gfx/src/xlibrgb widget/src/xlibxtbin
|
||||
DIRS += gfx/src/xlibrgb widget/src/xlibxtbin
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
tier_9_dirs += widget/src/gtksuperwin widget/src/gtkxtbin
|
||||
DIRS += widget/src/gtksuperwin widget/src/gtkxtbin
|
||||
endif
|
||||
|
||||
ifdef MOZ_INTERNAL_LIBART_LGPL
|
||||
tier_9_dirs += other-licenses/libart_lgpl
|
||||
# Linux and Solaris installer needs standalone libjar, hence standalone zlib
|
||||
ifneq (,$(filter Linux SunOS,$(OS_ARCH)))
|
||||
DIRS += modules/zlib/standalone
|
||||
endif
|
||||
|
||||
tier_9_dirs += \
|
||||
DIRS += \
|
||||
widget/timer \
|
||||
include \
|
||||
modules/libutil \
|
||||
netwerk \
|
||||
modules/mpfilelocprovider \
|
||||
uriloader \
|
||||
intl \
|
||||
modules/libpref \
|
||||
modules/libimg \
|
||||
modules/oji \
|
||||
modules/libjar \
|
||||
caps \
|
||||
rdf \
|
||||
expat \
|
||||
htmlparser \
|
||||
gfx \
|
||||
gfx2 \
|
||||
modules/libpr0n \
|
||||
$(NULL)
|
||||
|
||||
ifdef USE_IMG2
|
||||
DIRS += gfx2 modules/libpr0n
|
||||
endif
|
||||
|
||||
DIRS += \
|
||||
modules/plugin \
|
||||
dom \
|
||||
view \
|
||||
@@ -201,74 +116,55 @@ tier_9_dirs += \
|
||||
sun-java \
|
||||
profile \
|
||||
themes \
|
||||
accessible \
|
||||
$(NULL)
|
||||
|
||||
ifdef ACCESSIBILITY
|
||||
tier_9_dirs += accessible
|
||||
endif
|
||||
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
tier_9_dirs += directory/xpcom
|
||||
endif
|
||||
|
||||
# This must preceed xpfe
|
||||
ifdef MOZ_JPROF
|
||||
tier_9_dirs += tools/jprof
|
||||
DIRS += tools/jprof
|
||||
endif
|
||||
|
||||
tier_9_dirs += xpfe xpinstall
|
||||
|
||||
ifdef MOZ_LEAKY
|
||||
tier_9_dirs += tools/leaky
|
||||
ifdef MOZ_BUILD_XPFE
|
||||
DIRS += xpfe
|
||||
endif
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
tier_9_dirs += xpcom/tests
|
||||
endif
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
tier_9_dirs += tools/trace-malloc
|
||||
endif
|
||||
|
||||
tier_9_dirs += l10n
|
||||
|
||||
#
|
||||
# tier 9x - application features
|
||||
#
|
||||
|
||||
ifdef MOZ_EXTENSIONS
|
||||
tier_94_dirs += extensions
|
||||
endif
|
||||
DIRS += xpinstall
|
||||
|
||||
ifdef MOZ_PSM
|
||||
tier_95_dirs += security/manager
|
||||
DIRS += security/nss security/manager
|
||||
endif
|
||||
|
||||
ifdef MOZ_EXTENSIONS
|
||||
DIRS += extensions
|
||||
endif
|
||||
|
||||
ifdef MOZ_MAIL_NEWS
|
||||
tier_97_dirs += mailnews
|
||||
DIRS += mailnews
|
||||
endif
|
||||
|
||||
ifdef MOZ_CALENDAR
|
||||
tier_98_dirs += calendar
|
||||
ifdef MOZ_LEAKY
|
||||
DIRS += tools/leaky
|
||||
endif
|
||||
|
||||
#
|
||||
# tier 99 - application binaries
|
||||
#
|
||||
|
||||
ifneq (,$(MOZ_STATIC_COMPONENTS)$(MOZ_META_COMPONENTS))
|
||||
tier_99_dirs += modules/staticmod
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += xpcom/tests
|
||||
endif
|
||||
|
||||
tier_99_dirs += xpfe/bootstrap
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
tier_99_dirs += embedding/browser/gtk/tests
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
DIRS += directory/c-sdk/ldap directory/xpcom
|
||||
endif
|
||||
|
||||
DIRS += l10n
|
||||
|
||||
ifdef MOZ_STATIC_COMPONENTS
|
||||
DIRS += modules/staticmod
|
||||
endif
|
||||
|
||||
DIRS += xpfe/bootstrap
|
||||
|
||||
endif # BUILD_MODULES == all
|
||||
|
||||
STATIC_MAKEFILES := nsprpub directory/c-sdk
|
||||
STATIC_MAKEFILES := $(NSPRPUB_DIR) directory/c-sdk/ldap
|
||||
|
||||
ifdef MOZ_PSM
|
||||
STATIC_MAKEFILES += security/nss
|
||||
@@ -280,120 +176,12 @@ DIST_GARBAGE = config.cache config.log config.status config-defs.h \
|
||||
unallmakefiles \
|
||||
$(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
|
||||
|
||||
ifeq ($(BUILD_MODULES),all)
|
||||
# Build psuedo-external modules first when export is explicitly called
|
||||
export::
|
||||
$(MAKE) -C config export
|
||||
$(MAKE) nspr
|
||||
$(MAKE) ldap
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
$(MAKE) freetype
|
||||
$(MAKE) expat
|
||||
endif
|
||||
|
||||
install::
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
$(MAKE) -C nsprpub real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/nspr
|
||||
$(RM) -f $(addprefix $(DESTDIR)$(mozappdir)/$(LIB_PREFIX), $(addsuffix .$(LIB_SUFFIX), nspr4 plds4 plc4))
|
||||
$(RM) -f $(addprefix $(DESTDIR)$(bindir)/,nspr-config compile-et.pl prerr.properties)
|
||||
endif
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
$(MAKE) -C directory/c-sdk real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/ldap
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq ($(BUILD_MODULES),all)
|
||||
# Clean up after psuedo-external modules
|
||||
clean clobber realclean clobber_all distclean::
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
$(MAKE) -C nsprpub $@
|
||||
endif
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
$(MAKE) -C directory/c-sdk $@
|
||||
endif
|
||||
endif
|
||||
|
||||
tier_%:
|
||||
@echo "$@: $($@_dirs)"
|
||||
@$(EXIT_ON_ERROR) \
|
||||
for d in $($@_dirs); do $(UPDATE_TITLE) \
|
||||
$(MAKE) -C $$d export; \
|
||||
done ; \
|
||||
$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include ;\
|
||||
for d in $($@_dirs); do $(UPDATE_TITLE) \
|
||||
$(MAKE) -C $$d libs; \
|
||||
done
|
||||
#
|
||||
# Individual modules
|
||||
#
|
||||
boehm:
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
$(MAKE) -C gc/boehm
|
||||
endif
|
||||
|
||||
nspr: boehm
|
||||
ifndef MOZ_NATIVE_NSPR
|
||||
$(MAKE) -C nsprpub
|
||||
endif
|
||||
|
||||
ldap:
|
||||
ifdef MOZ_LDAP_XPCOM
|
||||
$(MAKE) -C directory/c-sdk
|
||||
endif
|
||||
|
||||
freetype:
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
ifndef MOZ_XFT_SYSTEM_FREETYPE2
|
||||
$(MAKE) -C other-licenses/freetype
|
||||
$(MAKE) -C other-licenses/freetype install
|
||||
endif
|
||||
endif
|
||||
|
||||
expat:
|
||||
ifdef MOZ_ENABLE_XFT
|
||||
$(MAKE) -C other-licenses/expat
|
||||
$(MAKE) -C other-licenses/expat install
|
||||
endif
|
||||
|
||||
# For modules.mk standalone build
|
||||
export::
|
||||
+$(LOOP_OVER_EXPORT_DIRS)
|
||||
|
||||
export::
|
||||
@$(PERL) $(MOZILLA_DIR)/config/purge-old-headers.pl $(DIST)/include
|
||||
|
||||
distclean::
|
||||
cat unallmakefiles | $(XARGS) rm -f
|
||||
rm -f unallmakefiles $(DIST_GARBAGE)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
rebase:
|
||||
ifdef MOZILLA_OFFICIAL
|
||||
echo rebasing $(DIST)
|
||||
/bin/find $(DIST) -name "*.dll" > rebase.lst
|
||||
rebase -b 60000000 -R . -G rebase.lst
|
||||
rm rebase.lst
|
||||
endif
|
||||
|
||||
splitsymbols:
|
||||
ifdef MOZILLA_OFFICIAL
|
||||
echo splitting symbols out of binaries
|
||||
/bin/find $(DIST) -name "*.dll" -exec splitsym {} \;
|
||||
/bin/find $(DIST) -name "*.exe" -exec splitsym {} \;
|
||||
/bin/find $(DIST) -name "*.EXE" -exec splitsym {} \;
|
||||
endif # MOZILLA_OFFICIAL
|
||||
|
||||
deliver: splitsymbols rebase
|
||||
|
||||
endif # WINNT
|
||||
|
||||
# Temporary hack for NSS 3.4 landing (bug 116334, wtc@netscape.com)
|
||||
ifdef MOZ_PSM
|
||||
ifdef COMPILER_DEPEND
|
||||
depend::
|
||||
$(MAKE) -C security/manager depend
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -1,325 +0,0 @@
|
||||
==============================================================
|
||||
|
||||
= = = = = = = = = = Mozilla Read Me = = = = = = = = = = =
|
||||
|
||||
==============================================================
|
||||
|
||||
Mozilla is subject to the terms detailed in the license
|
||||
agreement accompanying it.
|
||||
|
||||
This Read Me file contains information about system
|
||||
requirements and installation instructions for the Windows,
|
||||
Mac OS, and Linux builds of Mozilla.
|
||||
|
||||
For more info on Mozilla, see www.mozilla.org. To submit bugs
|
||||
or other feedback, see the Navigator QA menu and check out
|
||||
Bugzilla at http://bugzilla.mozilla.org for links to known
|
||||
bugs, bug-writing guidelines, and more. You can also get help
|
||||
with Bugzilla by pointing your IRC client to #mozillazine
|
||||
at irc.mozilla.org.
|
||||
|
||||
|
||||
==============================================================
|
||||
|
||||
Getting Mozilla
|
||||
|
||||
==============================================================
|
||||
|
||||
You can download nightly builds of Mozilla from the
|
||||
Mozilla.org FTP site at
|
||||
|
||||
ftp://ftp.mozilla.org/pub/mozilla/nightly/
|
||||
|
||||
For the very latest builds, see
|
||||
|
||||
ftp://ftp.mozilla.org/pub/mozilla/nightly/latest
|
||||
|
||||
Keep in mind that nightly builds, which are used by
|
||||
Mozilla.org developers for testing, may be buggy. If you are
|
||||
looking for a more polished version of Mozilla, Mozilla.org
|
||||
releases Milestone builds of Mozilla every six weeks or so
|
||||
that you can download from
|
||||
|
||||
http://www.mozilla.org/releases
|
||||
|
||||
Be sure to read the Mozilla release notes for information
|
||||
on known problems and installation issues with Mozilla.
|
||||
The release notes can be found at the preceding URL along
|
||||
with the milestone releases themselves.
|
||||
|
||||
Note: Please use Talkback builds whenever possible. These
|
||||
builds allow transmission of crash data back to Mozilla
|
||||
developers, improved crash analysis, and posting of crash
|
||||
information to our crash-data newsgroup.
|
||||
|
||||
|
||||
==============================================================
|
||||
|
||||
System Requirements
|
||||
|
||||
==============================================================
|
||||
|
||||
*All Platforms
|
||||
|
||||
To view and use the new streamlined "Modern" theme,
|
||||
your display monitor should be set to display
|
||||
thousands of colors. For users who cannot set their
|
||||
displays to use more than 256 colors, Mozilla.org
|
||||
recommends using the "Classic" theme for Mozilla.
|
||||
|
||||
To select the Modern theme after you have installed
|
||||
Mozilla, from the Navigator browser, open the View
|
||||
menu, and then open then open the Apply Theme submenu
|
||||
and choose Modern.
|
||||
|
||||
*Mac OS
|
||||
|
||||
-Mac OS 8.6 or later
|
||||
-PowerPC 604e 266 MHz or faster processor, or G3/G4
|
||||
-64 MB RAM
|
||||
-36 MB of free hard disk space
|
||||
|
||||
*Windows
|
||||
|
||||
-Windows 9x/Me or Windows NT 4/2000/XP
|
||||
-Intel Pentium-class 233 MHz (or faster) processor
|
||||
-64 MB RAM
|
||||
-26 MB free hard disk space
|
||||
|
||||
*Linux
|
||||
|
||||
-Red Hat Linux 6.x or 7 with X11 R6
|
||||
[Note: Mozilla is certified and fully supported on
|
||||
Red Hat Linux, but will run on other Linux
|
||||
distributions, such as Debian 2.1 (or later) or
|
||||
SuSE 6.2 (or later). The libraries glibc 2.1 (or
|
||||
higher) and libjpeg.so.62 (or higher) are required.]
|
||||
-Intel Pentium-class 233 MHz (or faster) processor
|
||||
-64MB RAM
|
||||
-26MB free hard disk space
|
||||
|
||||
|
||||
==============================================================
|
||||
|
||||
Installation Instructions
|
||||
|
||||
==============================================================
|
||||
|
||||
For Mac OS and Windows users, it is strongly recommended that
|
||||
you exit all programs before running the setup program. Also,
|
||||
you should temporarily disable virus-detection software.
|
||||
|
||||
For Linux users, note that the installation instructions use
|
||||
the bash shell. If you're not using bash, adjust the commands
|
||||
accordingly.
|
||||
|
||||
For all platforms, install into a clean (new) directory.
|
||||
Installing on top of previously released builds may cause
|
||||
problems.
|
||||
|
||||
Note: These instructions do not tell you how to build Mozilla.
|
||||
For info on building the Mozilla source, see
|
||||
|
||||
http://www.mozilla.org/source.html
|
||||
|
||||
|
||||
Windows Installation Instructions
|
||||
---------------------------------
|
||||
|
||||
Note: For Windows NT/2000/XP systems, you need Administrator
|
||||
privileges to install Mozilla. If you see an "Error 5" message
|
||||
during installation, make sure you're running the installation
|
||||
with Administrator privileges.
|
||||
|
||||
|
||||
To install Mozilla by downloading the Mozilla installer,
|
||||
follow these steps:
|
||||
|
||||
1. Click the the mozilla-win32-installer.exe link on
|
||||
the site you're downloading Mozilla from to download
|
||||
the installer file to your machine.
|
||||
|
||||
2. Navigate to where you downloaded the file and
|
||||
double-click the Mozilla program icon on your machine
|
||||
to begin the Setup program.
|
||||
|
||||
3. Follow the on-screen instructions in the setup
|
||||
program. The program starts automatically the first
|
||||
time.
|
||||
|
||||
|
||||
To install Mozilla by downloading the .zip file and
|
||||
installing manually, follow these steps:
|
||||
|
||||
1. Click the mozilla-win32-talkback.zip link or the
|
||||
mozilla-win32.zip link on the site you're down-
|
||||
loading Mozilla from to download the .zip file to
|
||||
your machine.
|
||||
|
||||
2. Navigate to where you downloaded the file and
|
||||
double-click the compressed file.
|
||||
|
||||
Note: This step assumes you already have a recent
|
||||
version of WinZip installed, and that you know how to
|
||||
use it. If not, you can get WinZip and information
|
||||
about the program at www.winzip.com.
|
||||
|
||||
3. Extract the .zip file to a directory such as
|
||||
C:\Program Files\mozilla.org\Mozilla.
|
||||
|
||||
4. To start Mozilla, navigate to the directory you
|
||||
extracted Mozilla to and double-click the Mozilla.exe
|
||||
icon.
|
||||
|
||||
|
||||
Mac OS Installation Instructions
|
||||
--------------------------------
|
||||
|
||||
Note: If the downloaded file does not expand automatically
|
||||
you must expand the file using a program such as StuffIt
|
||||
Expander. Expander ships with all new Macs and comes with the
|
||||
default system install, so you may want to do a find in
|
||||
Sherlock for "StuffIt" to make sure that you don't already
|
||||
have it installed.
|
||||
|
||||
If you don't have Expander, you can get a copy at the
|
||||
following Web site:
|
||||
|
||||
http://www.aladdinsys.com/expander/expander_mac_login.html
|
||||
|
||||
If you do already have Expander, you need to set it to start
|
||||
by default. See the above URL for info on using Expander.
|
||||
|
||||
|
||||
To install Mozilla by downloading the Mozilla installer,
|
||||
(recommended) follow these steps:
|
||||
|
||||
1. Click the MacMozillaInstaller.sea.bin link on the
|
||||
site you're downloading Mozilla from to download the
|
||||
file to your Mac's desktop. A MozillaInstaller
|
||||
folder is created.
|
||||
|
||||
2. Double-click the MozillaInstaller folder in the
|
||||
Finder.
|
||||
|
||||
3. Double-click the Mozilla Installer icon.
|
||||
|
||||
4. Follow the on-screen instructions to complete the
|
||||
installation process.
|
||||
|
||||
5. To start Mozilla, open the folder where you
|
||||
installed Mozilla and double-click the Mozilla icon.
|
||||
|
||||
|
||||
To install Mozilla by downloading the .bin file and
|
||||
installing manually, follow these steps:
|
||||
|
||||
1. Click the mozilla-mac-*.sea.bin link on the site
|
||||
you're downloading Mozilla from to download the
|
||||
Mozilla binary to your Mac's desktop.
|
||||
|
||||
2. Double-click the mozilla-mac-*.sea.sit.bin icon
|
||||
on your desktop.
|
||||
|
||||
3. Choose the directory where you want to install
|
||||
Mozilla.
|
||||
|
||||
4. To start Mozilla, open the folder where you
|
||||
installed Mozilla and double-click the Mozilla icon.
|
||||
|
||||
|
||||
Linux Installation Instructions
|
||||
-------------------------------
|
||||
|
||||
Note: If you install in the default directory (which is
|
||||
usually /usr/local/mozilla), or any other directory where
|
||||
only the root user normally has write-access, you must
|
||||
start Mozilla first as root before other users can start
|
||||
the program. Doing so generates a set of files required
|
||||
for later use by other users.
|
||||
|
||||
|
||||
To install Mozilla by downloading the Mozilla installer,
|
||||
follow these steps:
|
||||
|
||||
1. Create a directory named mozilla (mkdir mozilla)
|
||||
and change to that directory (cd mozilla).
|
||||
|
||||
2. Click the link on the site you're downloading
|
||||
Mozilla from to download the installer file
|
||||
(called mozilla-1686-pc-linux-gnu-installer.tar.gz)
|
||||
to your machine.
|
||||
|
||||
3. Change to the mozilla directory (cd mozilla) and
|
||||
decompress the archive with the following command:
|
||||
|
||||
tar zxvf moz*.tar.gz
|
||||
|
||||
The installer is now located in a subdirectory of
|
||||
Mozilla named mozilla-installer.
|
||||
|
||||
4. Change to the mozilla-installer directory
|
||||
(cd mozilla-installer) and run the installer with the
|
||||
./mozilla-installer command.
|
||||
|
||||
5. Follow the instructions in the install wizard for
|
||||
installing Mozilla.
|
||||
|
||||
Note: If you have a slower machine, be aware that the
|
||||
installation may take some time. In this case, the
|
||||
installation progress may appear to hang indefinitely,
|
||||
even though the installation is still in process.
|
||||
|
||||
6. To start Mozilla, change to the directory where you
|
||||
installed it and run the ./mozilla command.
|
||||
|
||||
|
||||
To install Mozilla by downloading the tar.gz file:
|
||||
|
||||
1. Create a directory named "mozilla" (mkdir mozilla)
|
||||
and change to that directory (cd mozilla).
|
||||
|
||||
2. Click the link on the site you're downloading
|
||||
Mozilla from to download the non-installer
|
||||
(mozilla*.tar.gz) file into the mozilla directory.
|
||||
|
||||
3. Change to the mozilla directory (cd mozilla) and
|
||||
decompress the file with the following command:
|
||||
|
||||
tar zxvf moz*.tar.gz
|
||||
|
||||
This creates a "mozilla" directory under your mozilla
|
||||
directory.
|
||||
|
||||
4. Change to the mozilla directory (cd mozilla).
|
||||
|
||||
5. Run Mozilla with the following run script:
|
||||
|
||||
./mozilla
|
||||
|
||||
|
||||
To hook up Mozilla complete with icon to the GNOME Panel,
|
||||
follow these steps:
|
||||
|
||||
1. Click the GNOME Main Menu button, open the Panel menu,
|
||||
and then open the Add to Panel submenu and choose Launcher.
|
||||
|
||||
2. Right-click the icon for Mozilla on the Panel and
|
||||
enter the following command:
|
||||
directory_name./mozilla
|
||||
|
||||
where directory_name is the name of the directory
|
||||
you downloaded mozilla to. For example, the default
|
||||
directory that Mozilla suggests is /usr/local/mozilla.
|
||||
|
||||
3. Type in a name for the icon, and type in a comment
|
||||
if you wish.
|
||||
|
||||
4. Click the icon button and type in the following as
|
||||
the icon's location:
|
||||
|
||||
directory_name/icons/mozicon50.xpm
|
||||
|
||||
where directory name is the directory where you
|
||||
installed Mozilla. For example, the default directory
|
||||
is /usr/local/mozilla/icons/mozicon50.xpm.
|
||||
@@ -19,14 +19,14 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src build
|
||||
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>
|
||||
@@ -16,7 +16,7 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
@@ -29,40 +29,23 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility
|
||||
EXPORT_LIBRARY = 1
|
||||
ifneq ($(OS_ARCH),WINNT)
|
||||
SHORT_LIBNAME = access
|
||||
endif
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsAccessibilityModule
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
dom \
|
||||
$(NULL)
|
||||
REQUIRES = xpcom string dom
|
||||
|
||||
CPPSRCS = nsAccessibilityFactory.cpp
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../src
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
$(DIST)/lib/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
$(DIST)/lib/libaccessibility_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/libchrome_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_XUL
|
||||
SHARED_LIBRARY_LIBS += $(DIST)/lib/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LIBS = \
|
||||
gkconshared_s \
|
||||
gkgfx \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(LIBS_DIR) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
-lgkgfx \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -17,39 +17,31 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
dom \
|
||||
$(NULL)
|
||||
LIBRARY_NAME=accessibility
|
||||
MODULE_NAME=nsAccessibilityModule
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
MAKE_OBJ_TYPE=DLL
|
||||
DLLNAME=accessibility
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessibilityFactory.obj \
|
||||
$(NULL)
|
||||
.\$(OBJDIR)\nsAccessibilityFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = $(LINCS) -I..\src # for implementation headers
|
||||
|
||||
SUB_LIBRARIES=\
|
||||
$(DIST)\lib\accessibility_base_s.lib \
|
||||
$(DIST)\lib\accessibility_html_s.lib \
|
||||
!ifdef MOZ_XUL
|
||||
$(DIST)\lib\accessibility_xul_s.lib \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
LLIBS=\
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\gkgfx.lib \
|
||||
$(DIST)\lib\contentshared_s.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\accessibility_s.lib \
|
||||
$(DIST)\lib\timer_s.lib \
|
||||
$(DIST)\lib\gkgfxwin.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
|
||||
@@ -1,40 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
@@ -63,7 +47,7 @@ NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aRes
|
||||
}
|
||||
|
||||
// The list of components we register
|
||||
static const nsModuleComponentInfo components[] =
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "AccessibilityService",
|
||||
NS_ACCESSIBILITY_SERVICE_CID,
|
||||
|
||||
BIN
mozilla/accessible/macbuild/accessible.mcp
Normal file
BIN
mozilla/accessible/macbuild/accessible.mcp
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
mozilla/accessible/macbuild/accessibleIDL.mcp
Normal file
BIN
mozilla/accessible/macbuild/accessibleIDL.mcp
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,3 @@
|
||||
nsIAccessibilityService.idl
|
||||
nsIAccessible.idl
|
||||
nsIMutableAccessible.idl
|
||||
@@ -19,25 +19,23 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
MODULE = accessibility
|
||||
XPIDL_MODULE= accessibility
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAccessibilityService.idl \
|
||||
nsIAccessible.idl \
|
||||
nsIAccessibleDocument.idl \
|
||||
nsIAccessibleEventReceiver.idl \
|
||||
nsIAccessibleEventListener.idl \
|
||||
nsIAccessibleSelectable.idl \
|
||||
nsIAccessibleProvider.idl \
|
||||
$(NULL)
|
||||
XPIDLSRCS = \
|
||||
nsIAccessibilityService.idl \
|
||||
nsIAccessible.idl \
|
||||
nsIMutableAccessible.idl \
|
||||
nsIAccessibleEventReceiver.idl \
|
||||
nsIAccessibleEventListener.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -26,14 +26,9 @@ XPIDL_MODULE=accessibility
|
||||
XPIDLSRCS = \
|
||||
.\nsIAccessibilityService.idl \
|
||||
.\nsIAccessible.idl \
|
||||
.\nsIAccessibleDocument.idl \
|
||||
.\nsIMutableAccessible.idl \
|
||||
.\nsIAccessibleEventReceiver.idl \
|
||||
.\nsIAccessibleEventListener.idl \
|
||||
.\nsIAccessibleSelectable.idl \
|
||||
.\nsIAccessibleProvider.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
@@ -24,65 +24,20 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIMutableAccessible.idl"
|
||||
#include "nsIAtom.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
interface nsIWeakReference;
|
||||
|
||||
[scriptable, uuid(68D9720A-0984-42b6-A3F5-8237ED925727)]
|
||||
interface nsIAccessibilityService : nsISupports
|
||||
{
|
||||
nsIAccessible createAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible createIFrameAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createRootAccessible(in nsISupports aPresContext, in nsISupports aFrame);
|
||||
|
||||
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
|
||||
nsIAccessible createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createRootAccessible(in nsISupports aPresShell, in nsISupports aFrame);
|
||||
nsIMutableAccessible createMutableAccessible(in nsISupports aNode);
|
||||
nsIAccessible createHTMLBlockAccessible(in nsIAccessible aAccessible, in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLSelectAccessible(in nsIAtom aAccessible, in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
// new
|
||||
// nsIAccessible CreateHTMLObjectAccessible(in nsISupports aFrame);
|
||||
// end new
|
||||
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame);
|
||||
|
||||
nsIAccessible createXULButtonAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULCheckboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULColorPickerAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULColorPickerTileAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULComboboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULDropmarkerAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULGroupboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULImageAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULListboxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULListitemAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenubarAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenuitemAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenupopupAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULMenuSeparatorAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULProgressMeterAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULStatusBarAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULRadioButtonAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULRadioGroupAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULSelectOptionAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULSelectListAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabBoxAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabPanelsAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTabsAccessible(in nsIDOMNode aNode);
|
||||
nsIAccessible createXULTextAccessible(in nsIDOMNode aNode);
|
||||
|
||||
nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
|
||||
};
|
||||
|
||||
|
||||
@@ -95,5 +50,4 @@ interface nsIAccessibilityService : nsISupports
|
||||
|
||||
extern nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult);
|
||||
|
||||
%}
|
||||
|
||||
@@ -20,34 +20,51 @@
|
||||
* 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
|
||||
{
|
||||
/* Can't use these javascript can't tell us if properties are undefined
|
||||
|
||||
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;
|
||||
attribute wstring accName;
|
||||
attribute wstring accValue;
|
||||
readonly attribute wstring accDescription;
|
||||
readonly attribute wstring accRole;
|
||||
readonly attribute unsigned long accState;
|
||||
readonly attribute unsigned long accExtState;
|
||||
readonly attribute wstring accHelp;
|
||||
readonly attribute wstring accDefaultAction;
|
||||
readonly attribute boolean accFocused;
|
||||
*/
|
||||
|
||||
readonly attribute DOMString accHelp;
|
||||
readonly attribute nsIAccessible accFocused;
|
||||
nsIAccessible getAccParent();
|
||||
nsIAccessible getAccNextSibling();
|
||||
nsIAccessible getAccPreviousSibling();
|
||||
nsIAccessible getAccFirstChild();
|
||||
nsIAccessible getAccLastChild();
|
||||
|
||||
long getAccChildCount();
|
||||
wstring getAccName();
|
||||
wstring getAccValue();
|
||||
void setAccName(in wstring name);
|
||||
void setAccValue(in wstring value);
|
||||
|
||||
wstring getAccDescription();
|
||||
wstring getAccRole();
|
||||
unsigned long getAccState();
|
||||
unsigned long getAccExtState();
|
||||
wstring getAccDefaultAction();
|
||||
wstring getAccHelp();
|
||||
boolean getAccFocused();
|
||||
|
||||
nsIAccessible accGetAt(in long x, in long y);
|
||||
|
||||
@@ -58,23 +75,15 @@ interface nsIAccessible : nsISupports
|
||||
|
||||
void accGetBounds(out long x,
|
||||
out long y,
|
||||
out long width,
|
||||
out long height);
|
||||
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();
|
||||
|
||||
// Used by Accessible implementation to save data and speed up accessibility tree walking
|
||||
[noscript] void CacheOptimizations(in nsIAccessible aParent, in PRInt32 aSiblingIndex, in nsIDOMNodeList aSiblingList);
|
||||
void accDoDefaultAction();
|
||||
|
||||
// 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?
|
||||
@@ -125,6 +134,7 @@ interface nsIAccessible : nsISupports
|
||||
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;
|
||||
@@ -189,5 +199,7 @@ interface nsIAccessible : nsISupports
|
||||
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
|
||||
const unsigned long ROLE_NOTHING = 0xffffffff;
|
||||
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
};
|
||||
@@ -28,18 +28,7 @@
|
||||
[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;
|
||||
const unsigned long EVENT_MENUSTART = 0x0004;
|
||||
const unsigned long EVENT_MENUEND = 0x0005;
|
||||
const unsigned long EVENT_MENUPOPUPSTART = 0x0006;
|
||||
const unsigned long EVENT_MENUPOPUPEND = 0x0007;
|
||||
const unsigned long EVENT_FOCUS = 0x8005;
|
||||
|
||||
void handleEvent(in unsigned long aEvent, in nsIAccessible aTarget);
|
||||
};
|
||||
|
||||
@@ -28,5 +28,5 @@
|
||||
interface nsIAccessibleEventReceiver : nsISupports
|
||||
{
|
||||
void addAccessibleEventListener(in nsIAccessibleEventListener aListener);
|
||||
void removeAccessibleEventListener();
|
||||
void removeAccessibleEventListener(in nsIAccessibleEventListener aListener);
|
||||
};
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAccessible.idl"
|
||||
|
||||
[scriptable, uuid(3f0e3eb0-1dd2-11b2-9605-be5b8e76cf4b)]
|
||||
interface nsIAccessibleProvider : nsISupports
|
||||
{
|
||||
readonly attribute nsIAccessible accessible;
|
||||
};
|
||||
@@ -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();
|
||||
};
|
||||
36
mozilla/accessible/public/nsIMutableAccessible.idl
Normal file
36
mozilla/accessible/public/nsIMutableAccessible.idl
Normal file
@@ -0,0 +1,36 @@
|
||||
/* -*- 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: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s): pav
|
||||
*/
|
||||
|
||||
#include "nsIAccessible.idl"
|
||||
#include "nsIAtom.idl"
|
||||
|
||||
[scriptable, uuid(AD3274E5-9DD1-4614-81C8-BFF992869CBE)]
|
||||
interface nsIMutableAccessible : nsIAccessible
|
||||
{
|
||||
void SetNameAsNodeValue();
|
||||
void SetName(in wstring aName);
|
||||
void SetNameAsAttribute(in nsIAtom aAtom);
|
||||
void SetRole(in wstring aRole);
|
||||
void SetIsLeaf(in boolean aLeaf);
|
||||
};
|
||||
@@ -16,24 +16,34 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = \
|
||||
base \
|
||||
html \
|
||||
$(null)
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_s
|
||||
REQUIRES = xpcom string layout widget dom view locale gfx2
|
||||
|
||||
ifdef MOZ_XUL
|
||||
DIRS += xul
|
||||
endif
|
||||
CPPSRCS = \
|
||||
nsAccessible.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsMutableAccessible.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsHTMLFormControlAccessible.cpp \
|
||||
nsHTMLTextAccessible.cpp \
|
||||
nsSelectAccessible.cpp \
|
||||
nsGenericAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
override NO_SHARED_LIB=1
|
||||
override NO_STATIC_LIB=
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
accessible.properties
|
||||
@@ -1,77 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_base_s
|
||||
REQUIRES = \
|
||||
content \
|
||||
content_xul \
|
||||
docshell \
|
||||
dom \
|
||||
gfx \
|
||||
gfx2 \
|
||||
htmlparser \
|
||||
imglib2 \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
xuldoc \
|
||||
webbrwsr \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsAccessibilityService.cpp \
|
||||
nsAccessible.cpp \
|
||||
nsBaseWidgetAccessible.cpp \
|
||||
nsFormControlAccessible.cpp \
|
||||
nsGenericAccessible.cpp \
|
||||
nsRootAccessible.cpp \
|
||||
nsSelectAccessible.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
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../html \
|
||||
-I$(srcdir)/../xul \
|
||||
$(NULL)
|
||||
@@ -1,8 +0,0 @@
|
||||
jump = Jump
|
||||
press = Press
|
||||
check = Check
|
||||
uncheck = Uncheck
|
||||
select = Select
|
||||
open = Open
|
||||
close = Close
|
||||
switch = Switch
|
||||
@@ -1,3 +0,0 @@
|
||||
en-win.jar:
|
||||
locale/en-US/global-platform/accessible.properties
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
|
||||
DEPTH = ..\..\..
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_base_s
|
||||
REQUIRES = \
|
||||
content \
|
||||
content_xul \
|
||||
docshell \
|
||||
dom \
|
||||
gfx \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsAccessibilityService.obj \
|
||||
.\$(OBJDIR)\nsAccessible.obj \
|
||||
.\$(OBJDIR)\nsBaseWidgetAccessible.obj \
|
||||
.\$(OBJDIR)\nsFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsGenericAccessible.obj \
|
||||
.\$(OBJDIR)\nsRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsSelectAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
.\nsRootAccessible.h \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I..\html \
|
||||
-I..\xul \
|
||||
-I..\..\..\layout\html\forms\public \
|
||||
-I..\..\..\layout\html\forms\src \
|
||||
-I..\..\..\layout\html\base\src \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,69 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsAccessibilityService_h__
|
||||
#define __nsAccessibilityService_h__
|
||||
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsIWeakReference;
|
||||
class nsIPresShell;
|
||||
class nsIDOMNode;
|
||||
|
||||
class nsAccessibilityService : public nsIAccessibilityService
|
||||
{
|
||||
public:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBILITYSERVICE
|
||||
|
||||
// nsAccessibilityService methods:
|
||||
nsAccessibilityService();
|
||||
virtual ~nsAccessibilityService();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
nsresult GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent);
|
||||
nsresult GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **weakShell);
|
||||
void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent);
|
||||
nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell);
|
||||
NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIPresShell** aShell, nsIDOMNode** aContent);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIAccessibilityService_h__ */
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,168 +1,79 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsAccessible_H_
|
||||
#define _nsAccessible_H_
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIBindingManager.h"
|
||||
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocShell;
|
||||
class nsIFrame;
|
||||
class nsIWebShell;
|
||||
|
||||
enum { eSiblingsUninitialized = -1, eSiblingsWalkNormalDOM = -2}; // Used in sibling index field as flags
|
||||
|
||||
class nsAccessible : public nsGenericAccessible
|
||||
class nsAccessible : public nsIAccessible
|
||||
// public nsIAccessibleWidgetAccess
|
||||
{
|
||||
public:
|
||||
// to eliminate the confusion of "magic numbers" -- if ( 0 ){ foo; }
|
||||
enum { eAction_Switch=0, eAction_Jump=0, eAction_Click=0 };
|
||||
// how many actions
|
||||
enum { eNo_Action=0, eSingle_Action=1 };
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFocused(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccGetDOMNode(nsIDOMNode **_retval);
|
||||
//NS_IMETHOD AccGetWidget(nsIWidget**);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
PRBool IsPartiallyVisible();
|
||||
NS_IMETHOD AppendLabelText(nsIDOMNode *aLabelNode, nsAString& _retval);
|
||||
NS_IMETHOD AppendLabelFor(nsIContent *aLookNode, const nsAString *aId, nsAString *aLabel);
|
||||
NS_IMETHOD GetHTMLAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetXULAccName(nsAString& _retval);
|
||||
NS_IMETHOD AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString);
|
||||
NS_IMETHOD AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString);
|
||||
NS_IMETHOD AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent);
|
||||
NS_IMETHOD GetFocusedElement(nsIDOMElement **aFocusedElement);
|
||||
NS_IMETHOD CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList);
|
||||
// helper method to verify frames
|
||||
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
static nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
|
||||
void GetScrollOffset(nsRect *aRect);
|
||||
void GetScreenOrigin(nsIPresContext *aPresContext, nsIFrame *aFrame, nsRect *aRect);
|
||||
virtual nsIAccessible* CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewParentAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIDOMNode> mDOMNode;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIDOMNodeList> mSiblingList; // If some of our computed siblings are anonymous content nodes, cache node list
|
||||
PRInt32 mSiblingIndex; // Cache where we are in list of kids that we got from nsIBindingManager::GetContentList(parentContent)
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
};
|
||||
|
||||
|
||||
/** This class is used to walk the DOM tree. It skips
|
||||
* everything but nodes that either implement nsIAccessible
|
||||
* or have primary frames that implement "GetAccessible"
|
||||
*/
|
||||
|
||||
struct WalkState {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
nsCOMPtr<nsIDOMNodeList> siblingList;
|
||||
PRInt32 siblingIndex; // Holds a state flag or an index into the siblingList
|
||||
WalkState *prevState;
|
||||
};
|
||||
|
||||
|
||||
class nsAccessibleTreeWalker {
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsAccessibleTreeWalker(nsIWeakReference* aShell, nsIDOMNode* aContent,
|
||||
PRInt32 aCachedSiblingIndex, nsIDOMNodeList *aCachedSiblingList, PRBool mWalkAnonymousContent);
|
||||
~nsAccessibleTreeWalker();
|
||||
|
||||
NS_IMETHOD GetNextSibling();
|
||||
NS_IMETHOD GetPreviousSibling();
|
||||
NS_IMETHOD GetParent();
|
||||
NS_IMETHOD GetFirstChild();
|
||||
NS_IMETHOD GetLastChild();
|
||||
PRInt32 GetChildCount();
|
||||
WalkState mState;
|
||||
|
||||
nsHTMLBlockAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
protected:
|
||||
NS_IMETHOD GetChildBefore(nsIDOMNode* aParent, nsIDOMNode* aChild);
|
||||
PRBool IsHidden();
|
||||
PRBool GetAccessible();
|
||||
NS_IMETHOD GetFullTreeParentNode(nsIDOMNode *aChildNode, nsIDOMNode **aParentNodeOut);
|
||||
void GetSiblings(nsIDOMNode *aOneOfTheSiblings);
|
||||
void GetKids(nsIDOMNode *aParent);
|
||||
|
||||
void ClearState();
|
||||
NS_IMETHOD PushState();
|
||||
NS_IMETHOD PopState();
|
||||
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
nsCOMPtr<nsIBindingManager> mBindingManager;
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aFrame, nsIWeakReference* aShell);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,425 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
||||
// ------------
|
||||
// nsBlockAccessible
|
||||
// ------------
|
||||
|
||||
nsBlockAccessible::nsBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsBlockAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
// We're going to find the child that contains coordinates (tx,ty)
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h); // Get bounds for this accessible
|
||||
if (tx >= x && tx < x + w && ty >= y && ty < y + h)
|
||||
{
|
||||
// It's within this nsIAccessible, let's drill down
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> smallestChild;
|
||||
PRInt32 smallestArea = -1;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch; // Child bounds
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
// ok if there are multiple frames the contain the point
|
||||
// and they overlap then pick the smallest. We need to do this
|
||||
// for text frames.
|
||||
|
||||
// For example, A point that's in block #2 is also in block #1, but we want to return #2:
|
||||
//
|
||||
// [[block #1 is long wrapped text that continues to
|
||||
// another line]] [[here is a shorter block #2]]
|
||||
|
||||
if (tx >= cx && tx < cx + cw && ty >= cy && ty < cy + ch)
|
||||
{
|
||||
if (smallestArea == -1 || cw*ch < smallestArea) {
|
||||
smallestArea = cw*ch;
|
||||
smallestChild = child;
|
||||
}
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
if (smallestChild != nsnull)
|
||||
{
|
||||
*_retval = smallestChild;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsContainerAccessible
|
||||
*/
|
||||
nsContainerAccessible::nsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** no actions */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eNo_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no actions */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no actions */
|
||||
NS_IMETHODIMP nsContainerAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no state -- normal */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no value */
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** no name*/
|
||||
NS_IMETHODIMP nsContainerAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-------------
|
||||
// nsLeafFrameAccessible
|
||||
//-------------
|
||||
|
||||
nsLeafAccessible::nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsLeafAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsLeafAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsLeafAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------
|
||||
// nsLinkableAccessible
|
||||
//----------------
|
||||
|
||||
nsLinkableAccessible::nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell), mIsALinkCached(PR_FALSE), mLinkContent(nsnull), mIsLinkVisited(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
/* long GetAccState (); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_READONLY | STATE_SELECTABLE;
|
||||
if (IsALink()) {
|
||||
*_retval |= STATE_LINKED;
|
||||
if (mIsLinkVisited)
|
||||
*_retval |= STATE_TRAVERSED;
|
||||
}
|
||||
|
||||
// Get current selection and find out if current node is in it
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
if (domSel) {
|
||||
PRBool isSelected = PR_FALSE, isCollapsed = PR_TRUE;
|
||||
domSel->ContainsNode(mDOMNode, PR_TRUE, &isSelected);
|
||||
domSel->GetIsCollapsed(&isCollapsed);
|
||||
if (isSelected && !isCollapsed)
|
||||
*_retval |=STATE_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsALink()) {
|
||||
// Make sure we also include all the states of the parent link, such as focusable, focused, etc.
|
||||
PRUint32 role;
|
||||
GetAccRole(&role);
|
||||
if (role != ROLE_LINK) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccParent(getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
PRUint32 orState = 0;
|
||||
parentAccessible->GetAccState(&orState);
|
||||
*_retval |= orState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
if (IsALink()) {
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mLinkContent));
|
||||
if (elt)
|
||||
return elt->GetAttribute(NS_LITERAL_STRING("href"), _retval);
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
// Action 0 (default action): Jump to link
|
||||
if (index == eAction_Jump) {
|
||||
if (IsALink()) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("jump"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsLinkableAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
// Action 0 (default action): Jump to link
|
||||
if (index == 0) {
|
||||
if (IsALink()) {
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
shell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (presContext) {
|
||||
nsMouseEvent linkClickEvent;
|
||||
linkClickEvent.eventStructType = NS_EVENT;
|
||||
linkClickEvent.message = NS_MOUSE_LEFT_CLICK;
|
||||
linkClickEvent.isShift = PR_FALSE;
|
||||
linkClickEvent.isControl = PR_FALSE;
|
||||
linkClickEvent.isAlt = PR_FALSE;
|
||||
linkClickEvent.isMeta = PR_FALSE;
|
||||
linkClickEvent.clickCount = 0;
|
||||
linkClickEvent.widget = nsnull;
|
||||
|
||||
nsEventStatus eventStatus = nsEventStatus_eIgnore;
|
||||
mLinkContent->HandleDOMEvent(presContext,
|
||||
&linkClickEvent,
|
||||
nsnull,
|
||||
NS_EVENT_FLAG_INIT,
|
||||
&eventStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
PRBool nsLinkableAccessible::IsALink()
|
||||
{
|
||||
if (mIsALinkCached) // Cached answer?
|
||||
return mLinkContent? PR_TRUE: PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
|
||||
if (walkUpContent) {
|
||||
nsCOMPtr<nsIContent> tempContent = walkUpContent;
|
||||
while (walkUpContent) {
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(walkUpContent));
|
||||
if (link) {
|
||||
mLinkContent = tempContent;
|
||||
mIsALinkCached = PR_TRUE;
|
||||
nsLinkState linkState;
|
||||
link->GetLinkState(linkState);
|
||||
if (linkState == eLinkState_Visited)
|
||||
mIsLinkVisited = PR_TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
walkUpContent->GetParent(*getter_AddRefs(tempContent));
|
||||
walkUpContent = tempContent;
|
||||
}
|
||||
}
|
||||
mIsALinkCached = PR_TRUE; // Cached that there is no link
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// ------------
|
||||
// nsMenuListenerAccessible
|
||||
// ------------
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsMenuListenerAccessible, nsAccessible, nsIDOMXULListener)
|
||||
|
||||
nsMenuListenerAccessible::nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMenuListenerAccessible::~nsMenuListenerAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupShowing(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::PopupHiding(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuListenerAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuListenerAccessible::SetupMenuListener()
|
||||
{
|
||||
// if not already one, register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
|
||||
if (!eventReceiver) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("popupshowing"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsBaseWidgetAccessible_H_
|
||||
#define _nsBaseWidgetAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
|
||||
/**
|
||||
* This file contains a number of classes that are used as base
|
||||
* classes for the different accessibility implementations of
|
||||
* the HTML and XUL widget sets. --jgaunt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Special Accessible that knows how to handle hit detection for flowing text
|
||||
*/
|
||||
class nsBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsBlockAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Special Accessible that just contains other accessible objects
|
||||
* no actions, no name, no state, no value
|
||||
*/
|
||||
class nsContainerAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Leaf version of DOM Accessible -- has no children
|
||||
*/
|
||||
class nsLeafAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* A type of accessible for DOM nodes containing an href="" attribute.
|
||||
* It knows how to report the state of the link ( traveled or not )
|
||||
* and can activate ( click ) the link programmatically.
|
||||
*/
|
||||
class nsLinkableAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
|
||||
protected:
|
||||
PRBool IsALink();
|
||||
PRBool mIsALinkCached; // -1 = unknown, 0 = not a link, 1 = is a link
|
||||
nsCOMPtr<nsIContent> mLinkContent;
|
||||
PRBool mIsLinkVisited;
|
||||
};
|
||||
|
||||
/*
|
||||
* A base class that can listen to menu events. Its used by selects so the
|
||||
* button and the window accessibles can change their name and role
|
||||
* depending on whether the drop down list is dropped down on not
|
||||
*/
|
||||
class nsMenuListenerAccessible : public nsAccessible, public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsMenuListenerAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsMenuListenerAccessible();
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
virtual void SetupMenuListener();
|
||||
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* John Gaunt (jgaunt@netscape.com)
|
||||
* Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULLabelElement.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/**
|
||||
* nsFormControlAccessible
|
||||
*/
|
||||
|
||||
nsFormControlAccessible::nsFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL states: focused, unavailable(disabled), focusable, ?protected?
|
||||
* HTML states: focused, unabailable(disabled), focusable, protected
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Get the focused state from the nsAccessible
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlFormElement(do_QueryInterface(mDOMNode, &rv));
|
||||
if (NS_SUCCEEDED(rv) && htmlFormElement) {
|
||||
htmlFormElement->GetDisabled(&disabled);
|
||||
nsAutoString typeString;
|
||||
htmlFormElement->GetType(typeString);
|
||||
if (typeString.EqualsIgnoreCase("password"))
|
||||
*_retval |= STATE_PROTECTED;
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode, &rv));
|
||||
if (NS_SUCCEEDED(rv) && xulFormElement) {
|
||||
xulFormElement->GetDisabled(&disabled);
|
||||
/* XXX jgaunt do XUL elements support password fields? */
|
||||
}
|
||||
}
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
else
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called by both HTML and XUL elements, this method
|
||||
* merely checks who is calling and then calls the appropriate
|
||||
* protected method for the XUL or HTML element.
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULElement> xulFormElement(do_QueryInterface(mDOMNode));
|
||||
if (xulFormElement)
|
||||
return GetXULAccName(_retval);
|
||||
else
|
||||
return GetHTMLAccName(_retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsFormControlAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ------------
|
||||
// Radio button
|
||||
// ------------
|
||||
|
||||
nsRadioButtonAccessible::nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("select"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsRadioButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_RADIOBUTTON;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ------------
|
||||
// Text Accessibles
|
||||
// ------------
|
||||
|
||||
nsTextAccessible::nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* We are text
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No Children
|
||||
*/
|
||||
NS_IMETHODIMP nsTextAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsFormControlAccessible_H_
|
||||
#define _nsFormControlAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
|
||||
/**
|
||||
* This supports name and state information for both XUL and HTML
|
||||
* widgets. Designed to be a base class for the impls of XUL
|
||||
* and HTML form widget Accessibles
|
||||
*/
|
||||
class nsFormControlAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class nsRadioButtonAccessible : public nsFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Text nodes have no children, but since double inheritance
|
||||
* no-worky we have to re-impl the LeafAccessiblity blocks
|
||||
* this way.
|
||||
*/
|
||||
class nsTextAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,47 +1,31 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsGenericAccessible, nsIAccessible)
|
||||
@@ -60,183 +44,292 @@ nsGenericAccessible::~nsGenericAccessible()
|
||||
/* nsIAccessible getAccParent (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccPreviousSibling (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(nsAString& _retval)
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(nsAString& _retval)
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const nsAString& name)
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const PRUnichar *name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccValue (in wstring value); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccValue(const PRUnichar *value)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(nsAString& _retval)
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUint32 *_retval)
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFocused(); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(nsAString& _retval)
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* boolean getAccFocused (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(PRBool *_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;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateRight (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateLeft (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateUp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIAccessible accNavigateDown (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
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;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accAddSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accExtendSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoDefaultAction()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccExtState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::AccGetDOMNode(nsIDOMNode **_retval)
|
||||
//-------------
|
||||
// nsDOMAccessible
|
||||
//-------------
|
||||
|
||||
nsDOMAccessible::nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
mPresShell = do_GetWeakReference(aShell);
|
||||
mNode = aNode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::CacheOptimizations(nsIAccessible *aParent, PRInt32 aSiblingIndex, nsIDOMNodeList *aSiblingList)
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = selection->Collapse(parent, 0);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRInt32 offsetInParent = 0;
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
rv = parent->GetFirstChild(getter_AddRefs(child));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
|
||||
while(child)
|
||||
{
|
||||
if (child == mNode) {
|
||||
// Collapse selection to just before desired element,
|
||||
rv = selection->Collapse(parent, offsetInParent);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// then extend it to just after
|
||||
rv = selection->Extend(parent, offsetInParent+1);
|
||||
return rv;
|
||||
}
|
||||
|
||||
child->GetNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
offsetInParent++;
|
||||
}
|
||||
|
||||
// didn't find a child
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeFocus()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mNode);
|
||||
content->SetFocus(context);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------
|
||||
// nsLeafFrameAccessible
|
||||
//-------------
|
||||
|
||||
nsLeafDOMAccessible::nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,25 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsGenericAccessible_H_
|
||||
#define _nsGenericAccessible_H_
|
||||
@@ -58,10 +42,42 @@ class nsGenericAccessible : public nsIAccessible
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
public:
|
||||
public:
|
||||
nsGenericAccessible();
|
||||
virtual ~nsGenericAccessible();
|
||||
};
|
||||
|
||||
/**
|
||||
* And accessible that observes a dom node
|
||||
* supports:
|
||||
* - selection
|
||||
* - focus
|
||||
*/
|
||||
class nsDOMAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIDOMNode> mNode;
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafDOMAccessible : public nsDOMAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,123 +1,52 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIWebNavigation.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 "nsHTMLSelectAccessible.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.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(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFormListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
|
||||
nsIDOMNode * nsRootAccessible::gLastFocusedNode = 0; // Strong reference
|
||||
|
||||
PRUint32 nsRootAccessible::gInstanceCount = 0;
|
||||
|
||||
//#define DEBUG_LEAKS 1 // aaronl debug
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull,aShell),
|
||||
nsDocAccessibleMixin(aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1")),
|
||||
mBusy(eBusyStateUninitialized)
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame):nsAccessible(nsnull,nsnull,aShell)
|
||||
{
|
||||
mListener = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (shell) {
|
||||
shell->GetDocument(getter_AddRefs(mDocument));
|
||||
mDOMNode = do_QueryInterface(mDocument);
|
||||
}
|
||||
nsLayoutAtoms::AddRefAtoms();
|
||||
++gInstanceCount;
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("=====> %d nsRootAccessible's %x\n", gInstanceCount, (PRUint32)this);
|
||||
#endif
|
||||
// mFrame = aFrame;
|
||||
mListener = nsnull;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
@@ -125,560 +54,146 @@ nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::~nsRootAccessible()
|
||||
{
|
||||
if (--gInstanceCount == 0)
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("======> %d nsRootAccessible's %x\n", gInstanceCount, (PRUint32)this);
|
||||
#endif
|
||||
|
||||
nsLayoutAtoms::ReleaseAtoms();
|
||||
RemoveAccessibleEventListener();
|
||||
RemoveAccessibleEventListener(mListener);
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccName(nsAString& aAccName)
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccName(PRUnichar * *aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
*aAccName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helpers
|
||||
nsIFrame* nsRootAccessible::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
|
||||
nsIFrame* root = nsnull;
|
||||
if (shell)
|
||||
shell->GetRootFrame(&root);
|
||||
|
||||
return root;
|
||||
//if (!mFrame) {
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* root = nsnull;
|
||||
if (shell)
|
||||
shell->GetRootFrame(&root);
|
||||
|
||||
return root;
|
||||
//}
|
||||
|
||||
// return mFrame;
|
||||
}
|
||||
|
||||
void nsRootAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
||||
nsIAccessible* nsRootAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
*aRelativeFrame = GetFrame();
|
||||
if (*aRelativeFrame)
|
||||
(*aRelativeFrame)->GetRect(aBounds);
|
||||
return new nsHTMLBlockAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
/* 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)
|
||||
/* readonly attribute wstring accRole; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUnichar * *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 MSAA ROLE_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;
|
||||
|
||||
// If it's a <dialog>, use ROLE_DIALOG instead
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
mDocument->GetRootContent(getter_AddRefs(rootContent));
|
||||
if (rootContent) {
|
||||
nsCOMPtr<nsIDOMElement> rootElement(do_QueryInterface(rootContent));
|
||||
if (rootElement) {
|
||||
nsAutoString name;
|
||||
rootElement->GetLocalName(name);
|
||||
if (name.Equals(NS_LITERAL_STRING("dialog")))
|
||||
*aAccRole = ROLE_DIALOG;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
*aAccState = STATE_FOCUSABLE;
|
||||
if (mBusy == eBusyStateLoading)
|
||||
*aAccState |= STATE_BUSY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccValue(nsAString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
|
||||
void nsRootAccessible::Notify(nsITimer *timer)
|
||||
{
|
||||
// Short timer is finished
|
||||
if (mBusy != eBusyStateDone) {
|
||||
mBusy = eBusyStateDone;
|
||||
if (mListener)
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, this);
|
||||
}
|
||||
}
|
||||
|
||||
void nsRootAccessible::StartDocReadyTimer()
|
||||
{
|
||||
if (!mTimer) {
|
||||
nsresult rv;
|
||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
const PRUint32 kUpdateTimerDelay = 1;
|
||||
mTimer->Init(NS_STATIC_CAST(nsITimerCallback*, this), kUpdateTimerDelay);
|
||||
}
|
||||
}
|
||||
*aAccRole = ToNewUnicode(NS_LITERAL_STRING("client"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void addAccessibleEventListener (in nsIAccessibleEventListener aListener); */
|
||||
NS_IMETHODIMP nsRootAccessible::AddAccessibleEventListener(nsIAccessibleEventListener *aListener)
|
||||
{
|
||||
NS_ASSERTION(aListener, "Trying to add a null listener!");
|
||||
if (mListener)
|
||||
return NS_OK;
|
||||
if (!mListener)
|
||||
{
|
||||
// add an event listener to the document
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(receiver))) && receiver)
|
||||
{
|
||||
nsresult rv = receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
}
|
||||
}
|
||||
|
||||
// create a weak reference to the listener
|
||||
mListener = aListener;
|
||||
|
||||
// use AddEventListener from the nsIDOMEventTarget interface
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
|
||||
if (target) {
|
||||
// capture DOM focus events
|
||||
nsresult rv = target->AddEventListener(NS_LITERAL_STRING("focus"), NS_STATIC_CAST(nsIDOMFocusListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// capture Form change events
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("change"), NS_STATIC_CAST(nsIDOMFormListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
/* 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;
|
||||
|
||||
// add ourself as a CheckboxStateChange listener (custom event fired in nsHTMLInputElement.cpp)
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("CheckboxStateChange"), NS_STATIC_CAST(nsIDOMFormListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
// add ourself as a RadioStateChange Listener ( custom event fired in in nsHTMLInputElement.cpp & radio.xml)
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("RadioStateChange"), NS_STATIC_CAST(nsIDOMFormListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("ListitemStateChange"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("popupshowing"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("popuphiding"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
|
||||
rv = target->AddEventListener(NS_LITERAL_STRING("DOMMenuItemActive"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register listener");
|
||||
|
||||
// Extremely short timer, after which we announce that page is finished loading
|
||||
// By waiting until after this short time, we know that the 3rd party accessibility software
|
||||
// has received it's accessible, and can handle events on it.
|
||||
StartDocReadyTimer();
|
||||
|
||||
// Set up web progress listener - we need to know when page loading is finished
|
||||
// That way we can send the STATE_CHANGE events for the MSAA root "pane" object (ROLE_PANE),
|
||||
// and change the STATE_BUSY bit flag
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mPresShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
presShell->GetPresContext(getter_AddRefs(context));
|
||||
if (context) {
|
||||
nsCOMPtr<nsISupports> container; context->GetContainer(getter_AddRefs(container));
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
||||
if (docShell) {
|
||||
mWebProgress = do_GetInterface(docShell);
|
||||
mWebProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_LOCATION |
|
||||
nsIWebProgress::NOTIFY_STATE_DOCUMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(mWebProgress, "Could not get nsIWebProgress for nsRootAccessible");
|
||||
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;
|
||||
}
|
||||
|
||||
/* void removeAccessibleEventListener (); */
|
||||
NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener()
|
||||
{
|
||||
if (mListener) {
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mDocument));
|
||||
if (target) {
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("focus"), NS_STATIC_CAST(nsIDOMFocusListener*, this), PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("change"), NS_STATIC_CAST(nsIDOMFormListener*, this), PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("CheckboxStateChange"), NS_STATIC_CAST(nsIDOMFormListener*, this), PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("popupshowing"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("popuphiding"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("DOMMenuItemActive"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("RadioStateChange"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("ListitemStateChange"), NS_STATIC_CAST(nsIDOMXULListener*, this), PR_TRUE);
|
||||
}
|
||||
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
mTimer = nsnull;
|
||||
}
|
||||
|
||||
if (mWebProgress) {
|
||||
mWebProgress->RemoveProgressListener(this);
|
||||
mWebProgress = nsnull;
|
||||
}
|
||||
mListener = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *focusAccessible, nsIDOMNode *focusNode)
|
||||
{
|
||||
if (focusNode && gLastFocusedNode != focusNode) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, focusAccessible);
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
gLastFocusedNode = focusNode;
|
||||
NS_ADDREF(gLastFocusedNode);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------- 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;
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
// create and accessible for the target
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(t);
|
||||
|
||||
// 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(targetNode, optionTargetNode);
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
|
||||
// for focus events on Radio Groups we give the focus to the selected button
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> selectControl(do_QueryInterface(targetNode));
|
||||
if (selectControl) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectItem;
|
||||
selectControl->GetSelectedItem(getter_AddRefs(selectItem));
|
||||
optionTargetNode = do_QueryInterface(selectItem);
|
||||
}
|
||||
if (mCurrentFocus == content)
|
||||
return NS_OK;
|
||||
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
mCurrentFocus = content;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
if (NS_SUCCEEDED(mAccService->GetAccessibleFor(targetNode, getter_AddRefs(accessible)))) {
|
||||
if (eventType.EqualsIgnoreCase("focus") || eventType.EqualsIgnoreCase("DOMMenuItemActive")) {
|
||||
if (optionTargetNode &&
|
||||
NS_SUCCEEDED(mAccService->GetAccessibleFor(optionTargetNode, getter_AddRefs(accessible)))) {
|
||||
FireAccessibleFocusEvent(accessible, optionTargetNode);
|
||||
}
|
||||
else
|
||||
FireAccessibleFocusEvent(accessible, targetNode);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("change")) {
|
||||
if (!selectControl) // Don't use onchange to fire EVENT_STATE_CHANGE events for selects
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("ListitemStateChange")) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("CheckboxStateChange")) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("RadioStateChange") ) {
|
||||
// first the XUL radio buttons
|
||||
if (targetNode &&
|
||||
NS_SUCCEEDED(mAccService->GetAccessibleFor(targetNode, getter_AddRefs(accessible)))) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
}
|
||||
else { // for the html radio buttons -- apparently the focus code just works. :-)
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("popupshowing"))
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_MENUPOPUPSTART, accessible);
|
||||
else if (eventType.EqualsIgnoreCase("popuphiding"))
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_MENUPOPUPEND, accessible);
|
||||
}
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> a = do_QueryInterface(frame);
|
||||
|
||||
if (!a)
|
||||
a = do_QueryInterface(content);
|
||||
|
||||
nsCOMPtr<nsIAccessible> na = CreateNewAccessible(a, content, mPresShell);
|
||||
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, na);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->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);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
// ------- nsIDOMXULListener Methods (8) ---------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::PopupShowing(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::PopupShown(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::PopupHiding(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::PopupHidden(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Close(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Command(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||
|
||||
// ------- nsIAccessibleDocument Methods (5) ---------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetURL(nsAString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTitle(nsAString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetMimeType(nsAString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetDocType(nsAString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
|
||||
NS_IMETHODIMP nsRootAccessible::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
|
||||
NS_IMETHODIMP nsRootAccessible::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsIURI *location)
|
||||
{
|
||||
// Load has been verified, it will occur, about to commence
|
||||
if (mListener && mBusy != eBusyStateLoading) {
|
||||
mBusy = eBusyStateLoading;
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, this);
|
||||
StartDocReadyTimer();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
|
||||
NS_IMETHODIMP nsRootAccessible::OnStatusChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
|
||||
NS_IMETHODIMP nsRootAccessible::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRUint32 state)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDocAccessibleMixin::nsDocAccessibleMixin(nsIDocument *aDoc):mDocument(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
nsDocAccessibleMixin::nsDocAccessibleMixin(nsIWeakReference *aPresShell)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aPresShell));
|
||||
if (shell)
|
||||
shell->GetDocument(getter_AddRefs(mDocument));
|
||||
}
|
||||
|
||||
nsDocAccessibleMixin::~nsDocAccessibleMixin()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetURL(nsAString& aURL)
|
||||
NS_IMETHODIMP nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
if (!presShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
GetDocShellFromPS(presShell, getter_AddRefs(docShell));
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(docShell));
|
||||
nsCAutoString theURL;
|
||||
if (webNav) {
|
||||
nsCOMPtr<nsIURI> pURI;
|
||||
webNav->GetCurrentURI(getter_AddRefs(pURI));
|
||||
if (pURI)
|
||||
pURI->GetSpec(theURL);
|
||||
}
|
||||
//XXXaaronl Need to use CopyUTF8toUCS2(nsDependentCString(theURL), aURL); when it's written
|
||||
aURL.Assign(NS_ConvertUTF8toUCS2(theURL));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetTitle(nsAString& 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(nsAString& aMimeType)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSDocument> domnsDocument(do_QueryInterface(mDocument));
|
||||
if (domnsDocument) {
|
||||
return domnsDocument->GetContentType(aMimeType);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetDocType(nsAString& 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, nsAString& 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::GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell)
|
||||
{
|
||||
*aDocShell = nsnull;
|
||||
if (aPresShell) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aPresShell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptObj;
|
||||
doc->GetScriptGlobalObject(getter_AddRefs(scriptObj));
|
||||
if (scriptObj) {
|
||||
scriptObj->GetDocShell(aDocShell);
|
||||
if (*aDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1,40 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsRootAccessible_H_
|
||||
#define _nsRootAccessible_H_
|
||||
@@ -42,114 +26,44 @@
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleEventReceiver.h"
|
||||
#include "nsIAccessibleEventListener.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsITimerCallback.h"
|
||||
#include "nsIWebProgress.h"
|
||||
|
||||
|
||||
class nsDocAccessibleMixin
|
||||
{
|
||||
public:
|
||||
nsDocAccessibleMixin(nsIDocument *doc);
|
||||
nsDocAccessibleMixin(nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleMixin();
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetDocShellFromPS(nsIPresShell* aPresShell, nsIDocShell** aDocShell);
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
||||
class nsRootAccessible : public nsAccessible,
|
||||
public nsDocAccessibleMixin,
|
||||
public nsIAccessibleDocument,
|
||||
public nsIAccessibleEventReceiver,
|
||||
public nsIDOMFocusListener,
|
||||
public nsIDOMFormListener,
|
||||
public nsIDOMXULListener,
|
||||
public nsIWebProgressListener,
|
||||
public nsITimerCallback,
|
||||
public nsSupportsWeakReference
|
||||
|
||||
public nsIDOMFocusListener
|
||||
|
||||
{
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
enum EBusyState {eBusyStateUninitialized, eBusyStateLoading, eBusyStateDone};
|
||||
|
||||
nsRootAccessible(nsIWeakReference* aShell);
|
||||
nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame = nsnull);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccName(nsAString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAString& aAccValue);
|
||||
NS_IMETHOD GetAccName(PRUnichar * *aAccName);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aAccRole);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aAccState);
|
||||
NS_IMETHOD GetAccRole(PRUnichar * *aAccRole);
|
||||
|
||||
// ----- nsIAccessibleEventReceiver ------
|
||||
|
||||
// ----- nsIAccessibleEventReceiver -------------------
|
||||
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
NS_IMETHOD RemoveAccessibleEventListener();
|
||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
|
||||
// ----- nsIDOMEventListener --------------------------
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
// ----- nsIDOMFocusListener --------------------------
|
||||
// ----- nsIDOMEventListener --------
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent);
|
||||
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);
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupShown(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHiding(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD PopupHidden(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Command(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent);
|
||||
|
||||
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
||||
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode);
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual nsIFrame* GetFrame();
|
||||
void FireAccessibleFocusEvent(nsIAccessible *focusAccessible, nsIDOMNode *focusNode);
|
||||
void StartDocReadyTimer();
|
||||
|
||||
static PRUint32 gInstanceCount;
|
||||
|
||||
// mListener is not a com pointer. We don't own the listener
|
||||
// it is the callers responsibility to remove the listener
|
||||
// otherwise we will get into circular referencing problems
|
||||
// We don't need a weak reference, because we're owned by this listener
|
||||
nsIAccessibleEventListener *mListener;
|
||||
|
||||
static nsIDOMNode * gLastFocusedNode; // we do our own refcounting for this
|
||||
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsIWebProgress> mWebProgress;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
EBusyState mBusy;
|
||||
// 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<nsIContent> mCurrentFocus;
|
||||
};
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,238 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef __nsSelectAccessible_h__
|
||||
#define __nsSelectAccessible_h__
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIDOMXULListener.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* The list that contains all the options in the select.
|
||||
*/
|
||||
class nsSelectListAccessible : public nsAccessible
|
||||
class nsSelectAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectListAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options inside the select, contained within the list
|
||||
*/
|
||||
class nsSelectOptionAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectOptionAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Secondly, the Listbox widget */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* A class that represents the Listbox widget.
|
||||
*/
|
||||
class nsListboxAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsListboxAccessible (nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsListboxAccessible () {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
nsSelectAccessible(nsIAtom* aPopupAtom, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccValue(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual ~nsSelectAccessible() {}
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* A class the represents the HTML Combobox widget.
|
||||
*/
|
||||
class nsComboboxAccessible : public nsAccessible,
|
||||
public nsIAccessibleSelectable,
|
||||
public nsIDOMXULListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsComboboxAccessible();
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
/* ----- nsIDOMXULListener ----- */
|
||||
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 Combobox to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsComboboxTextFieldAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsComboboxTextFieldAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the
|
||||
* right of the text field
|
||||
*/
|
||||
class nsComboboxButtonAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsComboboxButtonAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsComboboxWindowAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsComboboxWindowAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame);
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_html_s
|
||||
REQUIRES = \
|
||||
content \
|
||||
content_xul \
|
||||
docshell \
|
||||
dom \
|
||||
gfx \
|
||||
gfx2 \
|
||||
htmlparser \
|
||||
imglib2 \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
webbrwsr \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsHTMLAreaAccessible.cpp \
|
||||
nsHTMLFormControlAccessible.cpp \
|
||||
nsHTMLIFrameRootAccessible.cpp \
|
||||
nsHTMLImageAccessible.cpp \
|
||||
nsHTMLLinkAccessible.cpp \
|
||||
nsHTMLSelectAccessible.cpp \
|
||||
nsHTMLTableAccessible.cpp \
|
||||
nsHTMLTextAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../base \
|
||||
$(NULL)
|
||||
@@ -1,74 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
|
||||
DEPTH = ..\..\..
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_html_s
|
||||
REQUIRES = \
|
||||
content \
|
||||
dom \
|
||||
gfx \
|
||||
gfx2 \
|
||||
htmlparser \
|
||||
imglib2 \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
string \
|
||||
uriloader \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsHTMLAreaAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLIFrameRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLImageAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLLinkAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLSelectAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTableAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTextAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I..\base \
|
||||
-I..\..\..\layout\html\forms\public \
|
||||
-I..\..\..\layout\html\forms\src \
|
||||
-I..\..\..\layout\html\base\src \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "nsHTMLAreaAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
|
||||
|
||||
// --- area -----
|
||||
|
||||
nsHTMLAreaAccessible::nsHTMLAreaAccessible(nsIDOMNode *aDomNode, nsIAccessible *aAccParent, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell), mAccParent(aAccParent)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccName(nsAString & _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
if (elt) {
|
||||
nsAutoString hrefString;
|
||||
elt->GetAttribute(NS_LITERAL_STRING("title"), _retval);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccValue(nsAString& _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(nsAString& _retval)
|
||||
{
|
||||
// Still to do - follow IE's standard here
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mDOMNode));
|
||||
if (area)
|
||||
area->GetShape(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = mAccParent;
|
||||
NS_IF_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible *nsHTMLAreaAccessible::CreateAreaAccessible(nsIDOMNode *aDOMNode)
|
||||
{
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
if (accService) {
|
||||
nsIAccessible* acc = nsnull;
|
||||
accService->CreateHTMLAreaAccessible(mPresShell, aDOMNode, mAccParent, &acc);
|
||||
return acc;
|
||||
}
|
||||
return nsnull;
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
|
||||
{
|
||||
*aAccNextSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> nextNode;
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(nextNode));
|
||||
if (nextNode)
|
||||
*aAccNextSibling = CreateAreaAccessible(nextNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accPreviousSibling; */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPrevSibling)
|
||||
{
|
||||
*aAccPrevSibling = nsnull;
|
||||
nsCOMPtr<nsIDOMNode> prevNode;
|
||||
mDOMNode->GetPreviousSibling(getter_AddRefs(prevNode));
|
||||
if (prevNode)
|
||||
*aAccPrevSibling = CreateAreaAccessible(prevNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsHTMLAreaAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
//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,71 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsHTMLAreaAccessible_H_
|
||||
#define _nsHTMLAreaAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
|
||||
/* Accessible for image map areas - must be child of image
|
||||
*/
|
||||
|
||||
class nsHTMLAreaAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLAreaAccessible(nsIDOMNode *domNode, nsIAccessible *accParent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString & _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible * *aAccNextSibling);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling);
|
||||
NS_IMETHOD GetAccDescription(nsAString& _retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(nsIDOMNode *aDOMNode);
|
||||
nsCOMPtr<nsIAccessible> mAccParent;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,446 +1,175 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMNSHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLLabelElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsLeafDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
// go up tree get name of label if there is one.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
*_retval = (checked ? STATE_CHECKED : 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ROLE_CHECKBUTTON;
|
||||
return NS_OK;
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("check box"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) { // 0 is the magic value for default action
|
||||
// check or uncheck
|
||||
PRUint32 state;
|
||||
GetAccState(&state);
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
if (state & STATE_CHECKED)
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("uncheck"), _retval);
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked)
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Check"));
|
||||
else
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("check"), _retval);
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("UnCheck"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index)
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoDefaultAction()
|
||||
{
|
||||
if (index == 0) { // 0 is the magic value for default action
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement(do_QueryInterface(mDOMNode));
|
||||
if (htmlCheckboxElement) {
|
||||
htmlCheckboxElement->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement(do_QueryInterface(mDOMNode));
|
||||
if (htmlCheckboxElement)
|
||||
htmlCheckboxElement->GetChecked(&checked);
|
||||
|
||||
if (checked)
|
||||
*_retval |= STATE_CHECKED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRadioButtonAccessible(aNode, aShell)
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoAction(PRUint8 index)
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Select"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("radio button"));
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlRadioElement(do_QueryInterface(mDOMNode));
|
||||
if (htmlRadioElement)
|
||||
htmlRadioElement->GetChecked(&checked);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (checked)
|
||||
*_retval |= STATE_CHECKED;
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Press"));
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoAction(PRUint8 index)
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
element->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
||||
|
||||
nsAutoString buttonType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||
if (buttonType.EqualsIgnoreCase("submit"))
|
||||
*_retval |= STATE_DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// ----- HTML 4 Button: can contain arbitrary HTML content -----
|
||||
|
||||
nsHTML4ButtonAccessible::nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("push button"));
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::AccDoAction(PRUint8 index)
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMNSHTMLButtonElement> buttonElement(do_QueryInterface(mDOMNode));
|
||||
if ( buttonElement )
|
||||
{
|
||||
buttonElement->Click();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
*_retval = nsnull;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button = do_QueryInterface(mNode);
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
||||
|
||||
nsAutoString buttonType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
|
||||
if (buttonType.EqualsIgnoreCase("submit"))
|
||||
*_retval |= STATE_DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTML4ButtonAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsAutoString name;
|
||||
if (content)
|
||||
rv = AppendFlatStringFromSubtree(content, &name);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAString
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
*_retval = name.ToNewUnicode();
|
||||
|
||||
|
||||
// --- textfield -----
|
||||
|
||||
nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_TEXT;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
PRUint32 state;
|
||||
GetAccState(&state);
|
||||
if (state & STATE_PROTECTED) // Don't return password text!
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
if (textArea) {
|
||||
textArea->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
if (inputElement) {
|
||||
inputElement->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, protected. readonly, unavailable, selected
|
||||
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
|
||||
PRBool isReadOnly = PR_FALSE;
|
||||
elt->HasAttribute(NS_LITERAL_STRING("readonly"), &isReadOnly);
|
||||
if (isReadOnly)
|
||||
*_retval |= STATE_READONLY;
|
||||
|
||||
// Get current selection and find out if current node is in it
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && NS_SUCCEEDED(shell->GetPrimaryFrameFor(content, &frame)) && frame) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
frame->GetSelectionController(context,getter_AddRefs(selCon));
|
||||
if (selCon) {
|
||||
nsCOMPtr<nsISelection> domSel;
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel));
|
||||
if (domSel) {
|
||||
PRBool isCollapsed = PR_TRUE;
|
||||
domSel->GetIsCollapsed(&isCollapsed);
|
||||
if (!isCollapsed)
|
||||
*_retval |=STATE_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!textArea) {
|
||||
if (inputElement) {
|
||||
/////// ====== Must be a password field, so it uses nsIDOMHTMLFormControl ==== ///////
|
||||
PRUint32 moreStates = 0;
|
||||
nsresult rv = nsFormControlAccessible::GetAccState(&moreStates);
|
||||
*_retval |= moreStates;
|
||||
return rv;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
textArea->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// --- groupbox -----
|
||||
|
||||
/*
|
||||
* The HTML for this is <fieldset> <legend>box-title</legend> form elements </fieldset>
|
||||
*/
|
||||
|
||||
nsHTMLGroupboxAccessible::nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_GROUPING;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Groupbox doesn't support any states!
|
||||
*_retval = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNodeList> legends;
|
||||
element->GetElementsByTagName(NS_LITERAL_STRING("legend"), getter_AddRefs(legends));
|
||||
if (legends) {
|
||||
nsCOMPtr<nsIDOMNode> legendNode;
|
||||
legends->Item(0, getter_AddRefs(legendNode));
|
||||
nsCOMPtr<nsIContent> legendContent(do_QueryInterface(legendNode));
|
||||
if (legendContent) {
|
||||
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
return AppendFlatStringFromSubtree(legendContent, &_retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,113 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric D Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLFormControlAccessible_H_
|
||||
#define _nsHTMLFormControlAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsFormControlAccessible
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsFormControlAccessible
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTML4ButtonAccessible : public nsLeafAccessible
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
|
||||
class nsHTMLTextFieldAccessible : public nsFormControlAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLGroupboxAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLIFrameRootAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHTMLIFrameRootAccessible)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsRootAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameRootAccessible, nsRootAccessible);
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIFrameAccessible, nsBlockAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIFrameAccessible, nsBlockAccessible);
|
||||
|
||||
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 nsBlockAccessible::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
nsHTMLIFrameAccessible::nsHTMLIFrameAccessible(nsIDOMNode* aNode, nsIAccessible* aRoot, nsIWeakReference* aShell, nsIDocument *aDoc):
|
||||
nsBlockAccessible(aNode, aShell), mRootAccessible(aRoot), nsDocAccessibleMixin(aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccName(nsAString& aAccName)
|
||||
{
|
||||
return GetTitle(aAccName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccValue(nsAString& aAccValue)
|
||||
{
|
||||
return GetURL(aAccValue);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccFirstChild(_retval);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccLastChild(_retval);
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return mRootAccessible->GetAccChildCount(_retval);
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PANE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
return nsAccessible::GetAccState(aAccState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetURL(nsAString& aURL)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetURL(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetTitle(nsAString& aTitle)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetMimeType(nsAString& aMimeType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetMimeType(aMimeType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocType(nsAString& aDocType)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocType(aDocType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetNameSpaceURIForID(PRInt16 aNameSpaceID, nsAString& aNameSpaceURI)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetNameSpaceURIForID(aNameSpaceID, aNameSpaceURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameAccessible::GetDocument(nsIDocument **doc)
|
||||
{
|
||||
return nsDocAccessibleMixin::GetDocument(doc);
|
||||
}
|
||||
|
||||
//=============================//
|
||||
// nsHTMLIFrameRootAccessible //
|
||||
//=============================//
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::nsHTMLIFrameRootAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
mOuterNode(aNode), nsRootAccessible(aShell)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsHTMLIFrameRootAccessible::~nsHTMLIFrameRootAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
void nsHTMLIFrameRootAccessible::Init()
|
||||
{
|
||||
if (!mOuterAccessible) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mOuterNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> parentShell;
|
||||
doc->GetShellAt(0, getter_AddRefs(parentShell));
|
||||
if (parentShell) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mOuterNode));
|
||||
nsIFrame* frame = nsnull;
|
||||
parentShell->GetPrimaryFrameFor(content, &frame);
|
||||
NS_ASSERTION(frame, "No outer frame.");
|
||||
frame->GetAccessible(getter_AddRefs(mOuterAccessible));
|
||||
NS_ASSERTION(mOuterAccessible, "Something's wrong - there's no accessible for the outer parent of this frame.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccParent(nsIAccessible * *_retval)
|
||||
{
|
||||
Init();
|
||||
return mOuterAccessible->GetAccParent(_retval);
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccNextSibling (); */
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
Init();
|
||||
return mOuterAccessible->GetAccNextSibling(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLIFrameRootAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
Init();
|
||||
return mOuterAccessible->GetAccPreviousSibling(_retval);
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsIFrameRootAccessible_H_
|
||||
#define _nsIFrameRootAccessible_H_
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
|
||||
class nsIWebShell;
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsHTMLIFrameAccessible : public nsBlockAccessible,
|
||||
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(nsAString& aAccName);
|
||||
NS_IMETHOD GetAccValue(nsAString& 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:
|
||||
void Init();
|
||||
|
||||
// In these variable names, "outer" relates to the nsHTMLIFrameAccessible, as opposed to the
|
||||
// nsHTMLIFrameRootAccessible which is "inner".
|
||||
// The outer node is a <browser> or <iframe> tag, whereas the inner node corresponds to the inner document root.
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mOuterNode;
|
||||
nsCOMPtr<nsIAccessible> mOuterAccessible;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,205 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsGenericAccessible.h"
|
||||
#include "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, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDOMNode, aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode));
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
nsAutoString mapElementName;
|
||||
|
||||
if (doc && element) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
|
||||
element->GetAttribute(NS_LITERAL_STRING("usemap"),mapElementName);
|
||||
if (htmlDoc && !mapElementName.IsEmpty()) {
|
||||
if (mapElementName.CharAt(0) == '#')
|
||||
mapElementName.Cut(0,1);
|
||||
htmlDoc->GetImageMap(mapElementName, getter_AddRefs(mMapElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// The state is a bitfield, get our inherited state, then logically OR it with STATE_ANIMATED if this
|
||||
// is an animated image.
|
||||
|
||||
nsLinkableAccessible::GetAccState(_retval);
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
nsIFrame *frame = nsnull;
|
||||
if (content && shell)
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
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(nsAString& _retval)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> imageContent(do_QueryInterface(mDOMNode));
|
||||
if (imageContent) {
|
||||
nsAutoString name;
|
||||
rv = AppendFlatStringFromContentNode(imageContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_GRAPHIC;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsIAccessible *nsHTMLImageAccessible::CreateAreaAccessible(PRUint32 areaNum)
|
||||
{
|
||||
if (!mMapElement)
|
||||
return nsnull;
|
||||
|
||||
if (areaNum == -1) {
|
||||
PRInt32 numAreaMaps;
|
||||
GetAccChildCount(&numAreaMaps);
|
||||
if (numAreaMaps<=0)
|
||||
return nsnull;
|
||||
areaNum = NS_STATIC_CAST(PRUint32,numAreaMaps-1);
|
||||
}
|
||||
|
||||
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,71 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsHTMLImageAccessible_H_
|
||||
#define _nsHTMLImageAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIImageFrame.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
|
||||
/* Accessible for supporting images
|
||||
* supports:
|
||||
* - gets name, role
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLImageAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
protected:
|
||||
nsIAccessible *CreateAreaAccessible(PRUint32 areaNum);
|
||||
nsCOMPtr<nsIDOMHTMLMapElement> mMapElement;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsILink.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsLinkableAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
if (!IsALink()) // Also initializes private data members
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = AppendFlatStringFromSubtree(mLinkContent, &name);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Temp var needed until CompressWhitespace built for nsAString
|
||||
name.CompressWhitespace();
|
||||
_retval.Assign(name);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLLinkAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LINK;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsHTMLLinkAccessible_H_
|
||||
#define _nsHTMLLinkAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
|
||||
class nsHTMLLinkAccessible : public nsLinkableAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,706 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsHTMLSelectAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIComboboxControlFrame.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLOptGroupElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOListElement.h"
|
||||
#include "nsIListControlFrame.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
/**
|
||||
* Selects, Listboxes and Comboboxes, are made up of a number of different
|
||||
* widgets, some of which are shared between the two. This file contains
|
||||
* all of the widgets for both of the Selects, for HTML only. Some of them
|
||||
* extend classes from nsSelectAccessible.cpp, which contains base classes
|
||||
* that are also extended by the XUL Select Accessibility support.
|
||||
*
|
||||
* Listbox:
|
||||
* - nsHTMLListboxAccessible
|
||||
* - nsHTMLSelectListAccessible
|
||||
* - nsHTMLSelectOptionAccessible
|
||||
*
|
||||
* Comboboxes:
|
||||
* - nsHTMLComboboxAccessilbe
|
||||
* - nsHTMLComboboxTextFieldAccessible
|
||||
* - nsHTMLComboboxButtonAccessible
|
||||
* - nsHTMLComboboxWindowAccessilbe
|
||||
* - nsHTMLSelectListAccessible
|
||||
* - nsHTMLSelectOptionAccessible
|
||||
*/
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/** ----- nsHTMLSelectListAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsSelectListAccessible(aParent, aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsHTMLSelectListAccessible we can have the following states:
|
||||
* STATE_MULTISELECTABLE
|
||||
* STATE_EXTSELECTABLE
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last child of the DOM node and creates and returns
|
||||
* a nsHTMLSelectOptionAccessible.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the child count of a Select List Accessible. We want to count
|
||||
* all the <optgroup>s and <option>s as children because we want a
|
||||
* flat tree under the Select List.
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccChildCount(PRInt32 *aAccChildCount)
|
||||
{
|
||||
// Count the number of <Option Group> and <option> elements and return
|
||||
// this number. This is so the tree can be flattened
|
||||
nsCOMPtr<nsIDOMNode> next, nextInner, nextChild;
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(mDOMNode));
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
PRInt32 countChild;
|
||||
|
||||
countChild = 0;
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(next));
|
||||
|
||||
while (next) {
|
||||
nsCOMPtr<nsIDOMHTMLOptGroupElement> optGroupElement(do_QueryInterface(next));
|
||||
countChild++;
|
||||
if (optGroupElement) {
|
||||
next->GetFirstChild(getter_AddRefs(nextInner));
|
||||
while (nextInner ) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(nextInner));
|
||||
if (optionElement) {
|
||||
countChild++;
|
||||
}
|
||||
nextInner->GetNextSibling(getter_AddRefs(nextChild));
|
||||
nextInner = nextChild;
|
||||
} // endWhile nextInner
|
||||
} // endif optGroupElement
|
||||
next->GetNextSibling(getter_AddRefs(nextInner));
|
||||
next = nextInner;
|
||||
} // endWhile next
|
||||
*aAccChildCount = countChild;
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
/** ----- nsHTMLSelectOptionAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsSelectOptionAccessible(aParent, aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next accessible sibling of the mDOMNode and creates and returns
|
||||
* a nsHTMLSelectOptionAccessible or nsHTMLSelectOptGroupAccessible.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
// Get next sibling and if found create and return an accessible for it
|
||||
// When getting the next sibling of an SelectOption we could be working with
|
||||
// either an optgroup or an option. We process this tree as flat.
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLOptGroupElement> currOptGroupElement(do_QueryInterface(mDOMNode));
|
||||
|
||||
if (currOptGroupElement) {
|
||||
mDOMNode->GetFirstChild(getter_AddRefs(next));
|
||||
}
|
||||
if (!next) // no child under a <optgroup> or we started with a <option>
|
||||
mDOMNode->GetNextSibling(getter_AddRefs(next)); // See if there is another <optgroup>
|
||||
|
||||
if (next) {
|
||||
accService->GetAccessibleFor(next, _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
// else No child then or child is not a <option> nor an <optgroup>
|
||||
// go back up to the parent and get next sibling from there,
|
||||
nsCOMPtr<nsIDOMNode> parent, parentNextSib;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(parent));
|
||||
|
||||
if (!parent) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMHTMLOListElement> listElement(do_QueryInterface(parent));
|
||||
if (listElement) // we are done!
|
||||
return NS_OK;
|
||||
}
|
||||
parent->GetNextSibling(getter_AddRefs(parentNextSib));
|
||||
if (!parentNextSib)
|
||||
return NS_OK; // done
|
||||
|
||||
// We have a parent that is an option or option group
|
||||
// get accessible for either one and return it
|
||||
accService->GetAccessibleFor(parentNextSib, _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the previous accessible sibling of the mDOMNode and creates and returns
|
||||
* a nsHTMLSelectOptionAccessible or nsHTMLSelectOptGroupAccessible.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsIAccessible> thisAcc, selectListAcc, nextSiblingAcc;
|
||||
|
||||
accService->GetAccessibleFor(mDOMNode, getter_AddRefs(thisAcc));
|
||||
|
||||
// The accessible parent of an <option> or <optgroup> is always the SelectListAcc - see GetAccessibleFor()
|
||||
thisAcc->GetAccParent(getter_AddRefs(selectListAcc));
|
||||
|
||||
if (!selectListAcc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> siblingDOMNode;
|
||||
selectListAcc->GetAccFirstChild(_retval);
|
||||
|
||||
// Go thru all the siblings until we find ourselves(mDOMNode) then use the
|
||||
// sibling right before us.
|
||||
do {
|
||||
(*_retval)->GetAccNextSibling(getter_AddRefs(nextSiblingAcc));
|
||||
if (!nextSiblingAcc) {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nextSiblingAcc->AccGetDOMNode(getter_AddRefs(siblingDOMNode));
|
||||
if (siblingDOMNode == mDOMNode) {
|
||||
break; // we found ourselves!
|
||||
}
|
||||
NS_RELEASE(*_retval);
|
||||
*_retval = nextSiblingAcc;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
} while (nextSiblingAcc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
*_retval = 0;
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode, parentNode;
|
||||
// Go up to parent <select> element
|
||||
nsCOMPtr<nsIDOMNode> thisNode(do_QueryInterface(mDOMNode));
|
||||
do {
|
||||
thisNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectControl(do_QueryInterface(parentNode));
|
||||
if (selectControl) {
|
||||
break;
|
||||
}
|
||||
thisNode = parentNode;
|
||||
} while (parentNode);
|
||||
if (!parentNode) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// find out if we are the focused node
|
||||
GetFocusedOptionNode(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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for getting the focused DOM Node from our parent(list) node. We
|
||||
* need to use the frame to get the focused option because for some reason we
|
||||
* weren't getting the proper notification when the focus changed using the DOM
|
||||
*/
|
||||
nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNode,
|
||||
nsCOMPtr<nsIDOMNode>& aFocusedOptionNode)
|
||||
{
|
||||
NS_ASSERTION(aListNode, "Called GetFocusedOptionNode without a valid list node");
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aListNode));
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
if (document)
|
||||
document->GetShellAt(0,getter_AddRefs(shell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
PRInt32 focusedOptionIndex = 0;
|
||||
|
||||
// Get options
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(aListNode));
|
||||
NS_ASSERTION(selectElement, "No select element where it should be");
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options;
|
||||
nsresult rv = selectElement->GetOptions(getter_AddRefs(options));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIListControlFrame> listFrame(do_QueryInterface(frame));
|
||||
if (listFrame) {
|
||||
// Get what's focused in listbox by asking frame for "selected item".
|
||||
// Can't use dom interface for this, because it will always return the first selected item
|
||||
// when there is more than 1 item selected. We need the focused item, not
|
||||
// the first selected item.
|
||||
rv = listFrame->GetSelectedIndex(&focusedOptionIndex);
|
||||
}
|
||||
else // Combo boxes can only have 1 selected option, so they can use the dom interface for this
|
||||
rv = selectElement->GetSelectedIndex(&focusedOptionIndex);
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
/** ----- nsHTMLSelectOptGroupAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsHTMLSelectOptGroupAccessible::nsHTMLSelectOptGroupAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsHTMLSelectOptionAccessible(aParent, aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* As a nsHTMLSelectOptGroupAccessible we can have the following states:
|
||||
* STATE_SELECTABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsHTMLSelectOptionAccessible::GetAccState(_retval);
|
||||
*_retval &= ~(STATE_FOCUSABLE|STATE_SELECTABLE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Secondly, the Listbox widget */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/** ----- nsHTMLListboxAccessible ----- */
|
||||
|
||||
/** Constructor */
|
||||
nsHTMLListboxAccessible::nsHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsListboxAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** Inherit the ISupports impl from nsAccessible, we handle nsIAccessibleSelectable */
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLListboxAccessible, nsListboxAccessible, nsIAccessibleSelectable)
|
||||
|
||||
/**
|
||||
* Our last (and only) child is an nsHTMLSelectListAccessible 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our first (and only) child is an nsHTMLSelectListAccessible 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. nsIDOMHTMLSelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if ( select ) {
|
||||
select->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleSelectable method.
|
||||
* - gets from the Select DOMNode the list of all Select Options
|
||||
* - iterates through all of the options looking for selected Options
|
||||
* - creates IAccessible objects for selected Options
|
||||
* - Returns the IAccessibles for selectd Options in the nsISupportsArray
|
||||
*
|
||||
* retval will be nsnull if:
|
||||
* - there are no Options in the Select Element
|
||||
* - 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;
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/** ----- nsHTMLComboboxAccessible ----- */
|
||||
|
||||
/** Constructor */
|
||||
nsHTMLComboboxAccessible::nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsComboboxAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Our last child is an 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our last child is an 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. nsIDOMHTMLSelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if (select) {
|
||||
select->GetValue(_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/** ----- nsHTMLComboboxTextFieldAccessible ----- */
|
||||
|
||||
/** Constructor */
|
||||
nsHTMLComboboxTextFieldAccessible::nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsComboboxTextFieldAccessible(aParent, aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Our next sibling is an 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;
|
||||
}
|
||||
|
||||
/** -----ComboboxButtonAccessible ----- */
|
||||
|
||||
/** Constructor -- cache our parent */
|
||||
nsHTMLComboboxButtonAccessible::nsHTMLComboboxButtonAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsComboboxButtonAccessible(aParent, aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our next sibling is an 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our next sibling is an 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;
|
||||
}
|
||||
|
||||
/** ----- nsHTMLComboboxWindowAccessible ----- */
|
||||
|
||||
/**
|
||||
* Constructor -- cache our parent
|
||||
*/
|
||||
nsHTMLComboboxWindowAccessible::nsHTMLComboboxWindowAccessible(nsIAccessible* aParent,
|
||||
nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell):
|
||||
nsComboboxWindowAccessible(aParent, aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Our previous sibling is 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 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;
|
||||
}
|
||||
|
||||
@@ -1,224 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef __nsHTMLSelectAccessible_h__
|
||||
#define __nsHTMLSelectAccessible_h__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsSelectAccessible.h"
|
||||
|
||||
/**
|
||||
* Selects, Listboxes and Comboboxes, are made up of a number of different
|
||||
* widgets, some of which are shared between the two. This file contains
|
||||
* all of the widgets for both of the Selects, for HTML only. Some of them
|
||||
* extend classes from nsSelectAccessible.cpp, which contains base classes
|
||||
* that are also extended by the XUL Select Accessibility support.
|
||||
*
|
||||
* Listbox:
|
||||
* - nsHTMLListboxAccessible
|
||||
* - nsHTMLSelectListAccessible
|
||||
* - nsHTMLSelectOptionAccessible
|
||||
*
|
||||
* Comboboxes:
|
||||
* - nsHTMLComboboxAccessible
|
||||
* - nsHTMLComboboxTextFieldAccessible
|
||||
* - nsHTMLComboboxButtonAccessible
|
||||
* - nsHTMLComboboxWindowAccessible
|
||||
* - nsHTMLSelectListAccessible
|
||||
* - nsHTMLSelectOptionAccessible(s)
|
||||
*/
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* The list that contains all the options in the select.
|
||||
*/
|
||||
class nsHTMLSelectListAccessible : public nsSelectListAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectListAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *aAccChildCount) ;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Options inside the select, contained within the list
|
||||
*/
|
||||
class nsHTMLSelectOptionAccessible : public nsSelectOptionAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectOptionAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
|
||||
static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsCOMPtr<nsIDOMNode>& aFocusedOptionNode);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Opt Groups inside the select, contained within the list
|
||||
*/
|
||||
class nsHTMLSelectOptGroupAccessible : public nsHTMLSelectOptionAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLSelectOptGroupAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLSelectOptGroupAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Secondly, the Listbox widget */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Listbox widget.
|
||||
*/
|
||||
class nsHTMLListboxAccessible : public nsListboxAccessible,
|
||||
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 GetAccValue(nsAString& _retval);
|
||||
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* A class the represents the HTML Combobox widget.
|
||||
*/
|
||||
class nsHTMLComboboxAccessible : public nsComboboxAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* A class the represents the text field in the Select to the left
|
||||
* of the drop down button
|
||||
*/
|
||||
class nsHTMLComboboxTextFieldAccessible : public nsComboboxTextFieldAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxTextFieldAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that represents the button inside the Select to the
|
||||
* right of the text field
|
||||
*/
|
||||
class nsHTMLComboboxButtonAccessible : public nsComboboxButtonAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxButtonAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* A class that represents the window that lives to the right
|
||||
* of the drop down button inside the Select. This is the window
|
||||
* that is made visible when the button is pressed.
|
||||
*/
|
||||
class nsHTMLComboboxWindowAccessible : public nsComboboxWindowAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsHTMLComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsHTMLComboboxWindowAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLTableAccessible.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccRole(PRUint32 *aResult)
|
||||
{
|
||||
*aResult = ROLE_CELL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTableCellAccessible::GetAccState(PRUint32 *aResult)
|
||||
{
|
||||
nsAccessible::GetAccState(aResult);
|
||||
*aResult &= ~STATE_FOCUSABLE; // Inherit all states except focusable state since table cells cannot be focused
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsHTMLTableAccessible::nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsBlockAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* unsigned long getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccRole(PRUint32 *aResult)
|
||||
{
|
||||
*aResult = ROLE_TABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccState(PRUint32 *aResult)
|
||||
{
|
||||
nsAccessible::GetAccState(aResult);
|
||||
*aResult &= ~STATE_FOCUSABLE; // Inherit all states except focusable state since tables cannot be focused
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetAccName(nsAString& aResult)
|
||||
{
|
||||
aResult.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNodeList> captions;
|
||||
element->GetElementsByTagName(NS_LITERAL_STRING("caption"), getter_AddRefs(captions));
|
||||
if (captions) {
|
||||
nsCOMPtr<nsIDOMNode> captionNode;
|
||||
captions->Item(0, getter_AddRefs(captionNode));
|
||||
if (captionNode) {
|
||||
nsCOMPtr<nsIContent> captionContent(do_QueryInterface(captionNode));
|
||||
AppendFlatStringFromSubtree(captionContent, &aResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsHTMLTableAccessible_H_
|
||||
#define _nsHTMLTableAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
|
||||
class nsHTMLTableCellAccessible : public nsBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aResult);
|
||||
};
|
||||
|
||||
|
||||
class nsHTMLTableAccessible : public nsBlockAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccState(PRUint32 *aResult);
|
||||
NS_IMETHOD GetAccName(nsAString& aResult);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,51 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsICheckboxControlFrame.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsTextAccessible(aDomNode, aShell)
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode):
|
||||
nsLeafDOMAccessible(aShell, aDomNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
return mDOMNode->GetNodeValue(_retval);
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString value;
|
||||
mNode->GetNodeValue(value);
|
||||
value.CompressWhitespace();
|
||||
*_retval = value.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString role(NS_LITERAL_STRING("text"));
|
||||
*_retval = role.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,54 +1,43 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsHTMLTextAccessible_H_
|
||||
#define _nsHTMLTextAccessible_H_
|
||||
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsGenericAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
class nsITextControlFrame;
|
||||
|
||||
class nsHTMLTextAccessible : public nsTextAccessible
|
||||
class nsHTMLTextAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDOMNode> mDomNode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -17,18 +17,37 @@
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH = ..\..
|
||||
DEPTH=..\..
|
||||
MODULE=accessibility
|
||||
LIBRARY_NAME=accessibility_s
|
||||
|
||||
include <$(DEPTH)\config\config.mak>
|
||||
CPP_OBJS=\
|
||||
.\$(OBJDIR)\nsAccessible.obj \
|
||||
.\$(OBJDIR)\nsRootAccessible.obj \
|
||||
.\$(OBJDIR)\nsMutableAccessible.obj \
|
||||
.\$(OBJDIR)\nsAccessibilityService.obj \
|
||||
.\$(OBJDIR)\nsSelectAccessible.obj \
|
||||
.\$(OBJDIR)\nsGenericAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsHTMLTextAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
DIRS = \
|
||||
base \
|
||||
html \
|
||||
!ifdef MOZ_XUL
|
||||
xul \
|
||||
!endif
|
||||
$(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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
252
mozilla/accessible/src/nsAccessibilityService.cpp
Normal file
252
mozilla/accessible/src/nsAccessibilityService.cpp
Normal file
@@ -0,0 +1,252 @@
|
||||
/* -*- 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 "nsMutableAccessible.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsSelectAccessible.h"
|
||||
#include "nsHTMLTextAccessible.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)
|
||||
{
|
||||
nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
NS_ASSERTION(s,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsRootAccessible(wr,f);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateMutableAccessible(nsISupports* aNode, nsIMutableAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsMutableAccessible(aNode);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLBlockAccessible(nsIAccessible* aAccessible, nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> n = do_QueryInterface(node);
|
||||
NS_ASSERTION(n,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
NS_ASSERTION(s,"Error not presshell!!");
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsHTMLBlockAccessible(aAccessible, n,wr);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLSelectAccessible(nsIAtom* aPopupAtom, nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIContent> n = do_QueryInterface(node);
|
||||
NS_ASSERTION(n,"Error non nsIContent passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresContext> c = do_QueryInterface(aPresContext);
|
||||
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
|
||||
|
||||
nsCOMPtr<nsIPresShell> s;
|
||||
c->GetShell(getter_AddRefs(s));
|
||||
|
||||
nsCOMPtr<nsIWeakReference> wr = getter_AddRefs(NS_GetWeakReference(s));
|
||||
|
||||
*_retval = new nsSelectAccessible(aPopupAtom, nsnull, n, wr);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLCheckboxAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
|
||||
*_retval = new nsHTMLRadioButtonAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLButtonAccessible(shell,node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
|
||||
NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsHTMLTextAccessible(shell, node);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
} else
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIPresShell** aShell, nsIDOMNode** aNode)
|
||||
{
|
||||
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
|
||||
nsCOMPtr<nsIContent> content;
|
||||
(*aRealFrame)->GetContent(getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||
*aNode = node;
|
||||
NS_ADDREF(*aNode);
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
#ifdef DEBUG
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
#endif
|
||||
|
||||
*aShell = document->GetShellAt(0);
|
||||
NS_IF_ADDREF(*aShell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewAccessibilityService(nsIAccessibilityService** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAccessibilityService* a = new nsAccessibilityService();
|
||||
if (a == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(a);
|
||||
*aResult = a;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
53
mozilla/accessible/src/nsAccessibilityService.h
Normal file
53
mozilla/accessible/src/nsAccessibilityService.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- 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"
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
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, nsIPresShell** aShell, nsIDOMNode** aContent);
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsIccessibilityService_h__ */
|
||||
968
mozilla/accessible/src/nsAccessible.cpp
Normal file
968
mozilla/accessible/src/nsAccessible.cpp
Normal file
@@ -0,0 +1,968 @@
|
||||
/* -*- 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 "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsRootAccessible.h"
|
||||
|
||||
//#define DEBUG_LEAKS
|
||||
|
||||
#ifdef DEBUG_LEAKS
|
||||
static gnsAccessibles = 0;
|
||||
#endif
|
||||
|
||||
|
||||
class nsFrameTreeWalker {
|
||||
public:
|
||||
nsFrameTreeWalker(nsIPresContext* aPresContext, nsAccessible* aOwner);
|
||||
nsIFrame* GetNextSibling(nsIFrame* aFrame);
|
||||
nsIFrame* GetPreviousSibling(nsIFrame* aFrame);
|
||||
nsIFrame* GetParent(nsIFrame* aFrame);
|
||||
nsIFrame* GetFirstChild(nsIFrame* aFrame);
|
||||
nsIFrame* GetLastChild(nsIFrame* aFrame);
|
||||
nsIFrame* GetChildBefore(nsIFrame* aParent, nsIFrame* aChild);
|
||||
PRInt32 GetCount(nsIFrame* aFrame);
|
||||
|
||||
static PRBool IsSameContent(nsIFrame* aFrame1, nsIFrame* aFrame2);
|
||||
static void GetAccessible(nsIFrame* aFrame, nsCOMPtr<nsIAccessible>& aAccessible, nsCOMPtr<nsIContent>& aContent);
|
||||
|
||||
nsCOMPtr<nsIPresContext> mPresContext;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsAccessible* mOwner;
|
||||
};
|
||||
|
||||
nsFrameTreeWalker::nsFrameTreeWalker(nsIPresContext* aPresContext, nsAccessible* aOwner)
|
||||
{
|
||||
mPresContext = aPresContext;
|
||||
mOwner = aOwner;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetParent(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get parent\n");
|
||||
|
||||
nsIFrame* parent = nsnull;
|
||||
aFrame->GetParent(&parent);
|
||||
|
||||
// if no parent then we hit the root
|
||||
// just return that top frame
|
||||
if (!parent) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return aFrame;
|
||||
}
|
||||
|
||||
GetAccessible(parent, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
return parent;
|
||||
|
||||
return GetParent(parent);
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetNextSibling(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get next\n");
|
||||
|
||||
// get next sibling
|
||||
nsIFrame* next = nsnull;
|
||||
aFrame->GetNextSibling(&next);
|
||||
|
||||
// skip any frames with the same content node
|
||||
while(IsSameContent(aFrame,next))
|
||||
next->GetNextSibling(&next);
|
||||
|
||||
// if failed
|
||||
if (!next)
|
||||
{
|
||||
// if parent has content
|
||||
nsIFrame* parent = nsnull;
|
||||
aFrame->GetParent(&parent);
|
||||
|
||||
// if no parent fail
|
||||
if (!parent) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// fail if we reach a parent that is accessible
|
||||
GetAccessible(parent, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// fail
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
} else {
|
||||
// next on parent
|
||||
return GetNextSibling(parent);
|
||||
}
|
||||
}
|
||||
|
||||
// if next has content
|
||||
GetAccessible(next, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// done
|
||||
return next;
|
||||
}
|
||||
|
||||
// if next doesn't have node
|
||||
|
||||
// call first on next
|
||||
nsIFrame* first = GetFirstChild(next);
|
||||
|
||||
// if found
|
||||
if (first)
|
||||
return first;
|
||||
|
||||
// call next on next
|
||||
return GetNextSibling(next);
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetFirstChild(nsIFrame* aFrame)
|
||||
{
|
||||
|
||||
//printf("Get first\n");
|
||||
|
||||
// get first child
|
||||
nsIFrame* child = nsnull;
|
||||
nsIAtom* list = nsnull;
|
||||
mOwner->GetListAtomForFrame(aFrame, list);
|
||||
aFrame->FirstChild(mPresContext, list, &child);
|
||||
|
||||
while(child)
|
||||
{
|
||||
// if first has a content node
|
||||
GetAccessible(child, mAccessible, mContent);
|
||||
if (mAccessible)
|
||||
{
|
||||
// done
|
||||
return child;
|
||||
} else {
|
||||
// call first on child
|
||||
nsIFrame* first = GetFirstChild(child);
|
||||
|
||||
// if succeeded
|
||||
if (first)
|
||||
{
|
||||
// return child
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
||||
// get next sibling
|
||||
nsIFrame* next;
|
||||
child->GetNextSibling(&next);
|
||||
|
||||
// skip children with duplicate content nodes
|
||||
while(IsSameContent(child,next))
|
||||
next->GetNextSibling(&next);
|
||||
|
||||
child = next;
|
||||
}
|
||||
|
||||
// fail
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetChildBefore(nsIFrame* aParent, nsIFrame* aChild)
|
||||
{
|
||||
nsIFrame* child = GetFirstChild(aParent);
|
||||
|
||||
// if the child is not us
|
||||
if (child == aChild) {
|
||||
mAccessible = nsnull;
|
||||
mContent = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame* prev = child;
|
||||
nsCOMPtr<nsIContent> prevContent = mContent;
|
||||
nsCOMPtr<nsIAccessible> prevAccessible = mAccessible;
|
||||
|
||||
while(child)
|
||||
{
|
||||
child = GetNextSibling(child);
|
||||
|
||||
if (child == aChild)
|
||||
break;
|
||||
|
||||
prev = child;
|
||||
prevContent = mContent;
|
||||
prevAccessible = mAccessible;
|
||||
}
|
||||
|
||||
mAccessible = prevAccessible;
|
||||
mContent = prevContent;
|
||||
return prev;
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetPreviousSibling(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get previous\n");
|
||||
|
||||
nsIFrame* parent = GetParent(aFrame);
|
||||
|
||||
return GetChildBefore(parent, aFrame);
|
||||
}
|
||||
|
||||
nsIFrame* nsFrameTreeWalker::GetLastChild(nsIFrame* aFrame)
|
||||
{
|
||||
//printf("Get last\n");
|
||||
|
||||
return GetChildBefore(aFrame, nsnull);
|
||||
}
|
||||
|
||||
PRInt32 nsFrameTreeWalker::GetCount(nsIFrame* aFrame)
|
||||
{
|
||||
|
||||
//printf("Get count\n");
|
||||
nsIFrame* child = GetFirstChild(aFrame);
|
||||
|
||||
PRInt32 count = 0;
|
||||
while(child)
|
||||
{
|
||||
count++;
|
||||
child = GetNextSibling(child);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void nsFrameTreeWalker::GetAccessible(nsIFrame* aFrame, nsCOMPtr<nsIAccessible>& aAccessible, nsCOMPtr<nsIContent>& aContent)
|
||||
{
|
||||
aContent = nsnull;
|
||||
aAccessible = nsnull;
|
||||
|
||||
aFrame->GetContent(getter_AddRefs(aContent));
|
||||
|
||||
if (!aContent)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
PRInt32 shells = document->GetNumberOfShells();
|
||||
NS_ASSERTION(shells > 0,"Error no shells!");
|
||||
nsIPresShell* shell = document->GetShellAt(0);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(aContent, &frame);
|
||||
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
aAccessible = do_QueryInterface(aFrame);
|
||||
|
||||
if (!aAccessible)
|
||||
aAccessible = do_QueryInterface(aContent);
|
||||
|
||||
if (aAccessible)
|
||||
printf("Found accessible!\n");
|
||||
}
|
||||
|
||||
PRBool nsFrameTreeWalker::IsSameContent(nsIFrame* aFrame1, nsIFrame* aFrame2)
|
||||
{
|
||||
if (!aFrame1 || !aFrame2)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIContent> content1;
|
||||
nsCOMPtr<nsIContent> content2;
|
||||
|
||||
aFrame1->GetContent(getter_AddRefs(content1));
|
||||
aFrame2->GetContent(getter_AddRefs(content2));
|
||||
|
||||
if (content1 == content2 && content1 != nsnull)
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class nsAccessible
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsAccessible::nsAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// get frame and node
|
||||
mContent = aContent;
|
||||
mAccessible = aAccessible;
|
||||
mPresShell = aShell;
|
||||
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("nsAccessibles=%d\n", ++gnsAccessibles);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsAccessible::~nsAccessible()
|
||||
{
|
||||
#ifdef DEBUG_LEAKS
|
||||
printf("nsAccessibles=%d\n", --gnsAccessibles);
|
||||
#endif
|
||||
}
|
||||
|
||||
//NS_IMPL_ISUPPORTS2(nsAccessible, nsIAccessible, nsIAccessibleWidgetAccess);
|
||||
NS_IMPL_ISUPPORTS1(nsAccessible, nsIAccessible);
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccParent(aAccParent);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
walker.GetParent(GetFrame());
|
||||
|
||||
// if no content or accessible then we hit the root
|
||||
if (!walker.mContent || !walker.mAccessible)
|
||||
{
|
||||
*aAccParent = new nsRootAccessible(mPresShell);
|
||||
NS_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aAccParent = CreateNewParentAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
/* readonly attribute nsIAccessible accNextSibling; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccNextSibling(nsIAccessible * *aAccNextSibling)
|
||||
{
|
||||
// delegate
|
||||
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccNextSibling(aAccNextSibling);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
|
||||
nsIFrame* next = walker.GetNextSibling(GetFrame());
|
||||
|
||||
if (next && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccNextSibling = CreateNewNextAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccNextSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccNextSibling = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accPreviousSibling; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccPreviousSibling(nsIAccessible * *aAccPreviousSibling)
|
||||
{
|
||||
// delegate
|
||||
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccPreviousSibling(aAccPreviousSibling);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* prev = walker.GetPreviousSibling(GetFrame());
|
||||
|
||||
if (prev && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccPreviousSibling = CreateNewPreviousAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccPreviousSibling);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccPreviousSibling = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accFirstChild; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccFirstChild(nsIAccessible * *aAccFirstChild)
|
||||
{
|
||||
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccFirstChild(aAccFirstChild);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* child = walker.GetFirstChild(GetFrame());
|
||||
|
||||
if (child && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccFirstChild = CreateNewFirstAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccFirstChild);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccFirstChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accFirstChild; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccLastChild(nsIAccessible * *aAccLastChild)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccLastChild(aAccLastChild);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
nsIFrame* last = walker.GetLastChild(GetFrame());
|
||||
|
||||
if (last && walker.mAccessible && walker.mContent)
|
||||
{
|
||||
*aAccLastChild = CreateNewLastAccessible(walker.mAccessible, walker.mContent, mPresShell);
|
||||
NS_ADDREF(*aAccLastChild);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aAccLastChild = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute long accChildCount; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccChildCount(PRInt32 *aAccChildCount)
|
||||
{
|
||||
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccChildCount(aAccChildCount);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
if (context) {
|
||||
nsFrameTreeWalker walker(context, this);
|
||||
*aAccChildCount = walker.GetCount(GetFrame());
|
||||
} else
|
||||
*aAccChildCount = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccName(PRUnichar * *aAccName)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccName(aAccName);
|
||||
if (NS_SUCCEEDED(rv) && *aAccName != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aAccName = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccDefaultAction(PRUnichar * *aDefaultAction)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccDefaultAction(aDefaultAction);
|
||||
if (NS_SUCCEEDED(rv) && *aDefaultAction != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aDefaultAction = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetAccName(const PRUnichar * aAccName)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->SetAccName(aAccName);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute wstring accValue; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccValue(PRUnichar * *aAccValue)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccValue(aAccValue);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && *aAccValue != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aAccValue = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::SetAccValue(const PRUnichar * aAccValue) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
/* readonly attribute wstring accDescription; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccDescription(PRUnichar * *aAccDescription)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccDescription(aAccDescription);
|
||||
if (NS_SUCCEEDED(rv) && *aAccDescription != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accRole; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccRole(PRUnichar * *aAccRole)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccRole(aAccRole);
|
||||
if (NS_SUCCEEDED(rv) && *aAccRole != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accState; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccState(PRUint32 *aAccState)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible)
|
||||
return mAccessible->GetAccState(aAccState);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::GetAccExtState(PRUint32 *aAccExtState)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible)
|
||||
return mAccessible->GetAccExtState(aAccExtState);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accHelp; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccHelp(PRUnichar * *aAccHelp)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->GetAccHelp(aAccHelp);
|
||||
if (NS_SUCCEEDED(rv) && *aAccHelp != nsnull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
// failed? Lets do some default behavior
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean accFocused; */
|
||||
NS_IMETHODIMP nsAccessible::GetAccFocused(PRBool *aAccFocused) { return NS_OK; }
|
||||
|
||||
/* nsIAccessible accGetChildAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h);
|
||||
if (tx > x && tx < x + w && ty > y && ty < y + h)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch;
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
if (tx > cx && tx < cx + cw && ty > cy && ty < cy + ch)
|
||||
{
|
||||
*_retval = child;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accNavigateRight (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateRight(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateLeft (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateLeft(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateUp (); */
|
||||
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateUp(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
/* void navigateDown (); */
|
||||
NS_IMETHODIMP nsAccessible::AccNavigateDown(nsIAccessible **_retval) { return NS_OK; }
|
||||
|
||||
|
||||
/* void addSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccAddSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccAddSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void removeSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccRemoveSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccRemoveSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void extendSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccExtendSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccExtendSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void takeSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::AccTakeSelection(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccTakeSelection();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void takeFocus (); */
|
||||
NS_IMETHODIMP nsAccessible::AccTakeFocus(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccTakeFocus();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void doDefaultAction (); */
|
||||
NS_IMETHODIMP nsAccessible::AccDoDefaultAction(void)
|
||||
{
|
||||
// delegate
|
||||
if (mAccessible) {
|
||||
nsresult rv = mAccessible->AccDoDefaultAction();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void accGetBounds (out long x, out long y, out long width, out long height); */
|
||||
NS_IMETHODIMP nsAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
nsIFrame* frame = GetBoundsFrame();
|
||||
|
||||
if (!frame || !context)
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// sum up all rects of frames with the same content node
|
||||
nsRect r;
|
||||
nsIFrame* start = frame;
|
||||
nsIFrame* next = nsnull;
|
||||
start->GetNextSibling(&next);
|
||||
|
||||
start->GetRect(r);
|
||||
|
||||
while (nsFrameTreeWalker::IsSameContent(start, next))
|
||||
{
|
||||
nsRect r2;
|
||||
next->GetRect(r2);
|
||||
r.UnionRect(r,r2);
|
||||
next->GetNextSibling(&next);
|
||||
}
|
||||
|
||||
nsPoint offset(r.x,r.y);
|
||||
|
||||
frame->GetParent(&frame);
|
||||
|
||||
nsPoint pos(0,0);
|
||||
while(frame) {
|
||||
nsIScrollableView* scrollingView;
|
||||
nsIView* view;
|
||||
// XXX hack
|
||||
frame->GetView(context, &view);
|
||||
if (view) {
|
||||
nsresult result = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nscoord xoff = 0;
|
||||
nscoord yoff = 0;
|
||||
scrollingView->GetScrollPosition(xoff, yoff);
|
||||
offset.x -= xoff;
|
||||
offset.y -= yoff;
|
||||
}
|
||||
}
|
||||
|
||||
frame->GetOrigin(pos);
|
||||
offset += pos;
|
||||
frame->GetParent(&frame);
|
||||
}
|
||||
|
||||
float t2p;
|
||||
context->GetTwipsToPixels(&t2p);
|
||||
|
||||
*x = (PRInt32)(offset.x*t2p);
|
||||
*y = (PRInt32)(offset.y*t2p);
|
||||
*width = (PRInt32)(r.width*t2p);
|
||||
*height = (PRInt32)(r.height*t2p);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helpers
|
||||
|
||||
nsIFrame* nsAccessible::GetBoundsFrame()
|
||||
{
|
||||
return GetFrame();
|
||||
}
|
||||
|
||||
nsIFrame* nsAccessible::GetFrame()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mContent, &frame);
|
||||
return frame;
|
||||
}
|
||||
|
||||
void nsAccessible::GetPresContext(nsCOMPtr<nsIPresContext>& aContext)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
|
||||
if (shell) {
|
||||
shell->GetPresContext(getter_AddRefs(aContext));
|
||||
} else
|
||||
aContext = nsnull;
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewParentAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
|
||||
// ------- nsHTMLBlockAccessible ------
|
||||
|
||||
nsHTMLBlockAccessible::nsHTMLBlockAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsIAccessible* nsHTMLBlockAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsHTMLBlockAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
/* nsIAccessible accGetAt (in long x, in long y); */
|
||||
NS_IMETHODIMP nsHTMLBlockAccessible::AccGetAt(PRInt32 tx, PRInt32 ty, nsIAccessible **_retval)
|
||||
{
|
||||
PRInt32 x,y,w,h;
|
||||
AccGetBounds(&x,&y,&w,&h);
|
||||
if (tx > x && tx < x + w && ty > y && ty < y + h)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> child;
|
||||
nsCOMPtr<nsIAccessible> smallestChild;
|
||||
PRInt32 smallestArea = -1;
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
GetAccFirstChild(getter_AddRefs(child));
|
||||
PRInt32 cx,cy,cw,ch;
|
||||
|
||||
while(child) {
|
||||
child->AccGetBounds(&cx,&cy,&cw,&ch);
|
||||
|
||||
// ok if there are multiple frames the contain the point
|
||||
// and they overlap then pick the smallest. We need to do this
|
||||
// for text frames.
|
||||
if (tx > cx && tx < cx + cw && ty > cy && ty < cy + ch)
|
||||
{
|
||||
if (smallestArea == -1 || cw*ch < smallestArea) {
|
||||
smallestArea = cw*ch;
|
||||
smallestChild = child;
|
||||
}
|
||||
}
|
||||
child->GetAccNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
}
|
||||
|
||||
if (smallestChild != nsnull)
|
||||
{
|
||||
*_retval = smallestChild;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = this;
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
79
mozilla/accessible/src/nsAccessible.h
Normal file
79
mozilla/accessible/src/nsAccessible.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* -*- 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 "nsIAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsIFrame;
|
||||
|
||||
class nsAccessible : public nsIAccessible
|
||||
// public nsIAccessibleWidgetAccess
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessibilityService methods:
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
|
||||
//NS_IMETHOD AccGetWidget(nsIWidget**);
|
||||
|
||||
public:
|
||||
nsAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsAccessible();
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList) { aList = nsnull; }
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetPresContext(nsCOMPtr<nsIPresContext>& aContext);
|
||||
virtual nsIAccessible* CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewParentAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIAccessible> mAccessible;
|
||||
};
|
||||
|
||||
/* Special Accessible that knows how to handle hit detection for flowing text */
|
||||
class nsHTMLBlockAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLBlockAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval);
|
||||
protected:
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aFrame, nsIWeakReference* aShell);
|
||||
};
|
||||
|
||||
#endif
|
||||
335
mozilla/accessible/src/nsGenericAccessible.cpp
Normal file
335
mozilla/accessible/src/nsGenericAccessible.cpp
Normal file
@@ -0,0 +1,335 @@
|
||||
/* -*- 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 "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWeakReference.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(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccValue (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccName (in wstring name); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccName(const PRUnichar *name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void setAccValue (in wstring value); */
|
||||
NS_IMETHODIMP nsGenericAccessible::SetAccValue(const PRUnichar *value)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDescription (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDescription(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccHelp (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccHelp(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* boolean getAccFocused (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccFocused(PRBool *_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;
|
||||
}
|
||||
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::AccDoDefaultAction()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* unsigned long getAccExtState (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//-------------
|
||||
// nsDOMAccessible
|
||||
//-------------
|
||||
|
||||
nsDOMAccessible::nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode)
|
||||
{
|
||||
mPresShell = do_GetWeakReference(aShell);
|
||||
mNode = aNode;
|
||||
}
|
||||
|
||||
|
||||
/* void accRemoveSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccRemoveSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = selection->Collapse(parent, 0);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accTakeSelection (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeSelection()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> control = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult rv = control->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
rv = mNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRInt32 offsetInParent = 0;
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
rv = parent->GetFirstChild(getter_AddRefs(child));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> next;
|
||||
|
||||
while(child)
|
||||
{
|
||||
if (child == mNode) {
|
||||
// Collapse selection to just before desired element,
|
||||
rv = selection->Collapse(parent, offsetInParent);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// then extend it to just after
|
||||
rv = selection->Extend(parent, offsetInParent+1);
|
||||
return rv;
|
||||
}
|
||||
|
||||
child->GetNextSibling(getter_AddRefs(next));
|
||||
child = next;
|
||||
offsetInParent++;
|
||||
}
|
||||
|
||||
// didn't find a child
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void accTakeFocus (); */
|
||||
NS_IMETHODIMP nsDOMAccessible::AccTakeFocus()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
shell->GetPresContext(getter_AddRefs(context));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mNode);
|
||||
content->SetFocus(context);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------
|
||||
// nsLeafFrameAccessible
|
||||
//-------------
|
||||
|
||||
nsLeafDOMAccessible::nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccFirstChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIAccessible getAccLastChild (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* long getAccChildCount (); */
|
||||
NS_IMETHODIMP nsLeafDOMAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
83
mozilla/accessible/src/nsGenericAccessible.h
Normal file
83
mozilla/accessible/src/nsGenericAccessible.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* -*- 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();
|
||||
};
|
||||
|
||||
/**
|
||||
* And accessible that observes a dom node
|
||||
* supports:
|
||||
* - selection
|
||||
* - focus
|
||||
*/
|
||||
class nsDOMAccessible : public nsGenericAccessible
|
||||
{
|
||||
public:
|
||||
nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD AccTakeSelection(void);
|
||||
NS_IMETHOD AccTakeFocus(void);
|
||||
NS_IMETHOD AccRemoveSelection(void);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIWeakReference> mPresShell;
|
||||
nsCOMPtr<nsIDOMNode> mNode;
|
||||
};
|
||||
|
||||
/* Leaf version of DOM Accessible
|
||||
* has no children
|
||||
*/
|
||||
class nsLeafDOMAccessible : public nsDOMAccessible
|
||||
{
|
||||
public:
|
||||
nsLeafDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
175
mozilla/accessible/src/nsHTMLFormControlAccessible.cpp
Normal file
175
mozilla/accessible/src/nsHTMLFormControlAccessible.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
/* -*- 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 "nsIFrame.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsLeafDOMAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
// go up tree get name of label if there is one.
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* wstring getAccState (); */
|
||||
NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// can be
|
||||
// focusable, focused, checked
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
*_retval = (checked ? STATE_CHECKED : 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("check box"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
// check or uncheck
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
if (checked)
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Check"));
|
||||
else
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("UnCheck"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void accDoDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
PRBool checked = PR_FALSE;
|
||||
element->GetChecked(&checked);
|
||||
element->SetChecked(checked ? PR_FALSE : PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//------ Radio button -------
|
||||
|
||||
nsHTMLRadioButtonAccessible::nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Select"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("radio button"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLRadioButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ----- Button -----
|
||||
|
||||
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode):
|
||||
nsHTMLFormControlAccessible(aShell, aNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccDefaultAction (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Press"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("push button"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> button = do_QueryInterface(mNode);
|
||||
|
||||
if (!button)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString name;
|
||||
button->GetValue(name);
|
||||
name.CompressWhitespace();
|
||||
|
||||
*_retval = name.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLButtonAccessible::AccDoDefaultAction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> element = do_QueryInterface(mNode);
|
||||
element->Click();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
77
mozilla/accessible/src/nsHTMLFormControlAccessible.h
Normal file
77
mozilla/accessible/src/nsHTMLFormControlAccessible.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- 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 "nsGenericAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
|
||||
/* Accessible for supporting for controls
|
||||
* supports:
|
||||
* - walking up to get name from label
|
||||
* - support basic state
|
||||
*/
|
||||
class nsHTMLFormControlAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLFormControlAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsHTMLCheckboxAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLCheckboxAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLRadioButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
};
|
||||
|
||||
class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLButtonAccessible(nsIPresShell* aShell, nsIDOMNode* aNode);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccDefaultAction(PRUnichar **_retval);
|
||||
NS_IMETHOD AccDoDefaultAction(void);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
51
mozilla/accessible/src/nsHTMLTextAccessible.cpp
Normal file
51
mozilla/accessible/src/nsHTMLTextAccessible.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Author: Eric Vaughan (evaughan@netscape.com)
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsICheckboxControlFrame.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode):
|
||||
nsLeafDOMAccessible(aShell, aDomNode)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString value;
|
||||
mNode->GetNodeValue(value);
|
||||
value.CompressWhitespace();
|
||||
*_retval = value.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccRole (); */
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString role(NS_LITERAL_STRING("text"));
|
||||
*_retval = role.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
43
mozilla/accessible/src/nsHTMLTextAccessible.h
Normal file
43
mozilla/accessible/src/nsHTMLTextAccessible.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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 "nsGenericAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
class nsITextControlFrame;
|
||||
|
||||
class nsHTMLTextAccessible : public nsLeafDOMAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIPresShell* aShell, nsIDOMNode* aDomNode);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDOMNode> mDomNode;
|
||||
};
|
||||
|
||||
#endif
|
||||
263
mozilla/accessible/src/nsMutableAccessible.cpp
Normal file
263
mozilla/accessible/src/nsMutableAccessible.cpp
Normal file
@@ -0,0 +1,263 @@
|
||||
/* -*- 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 "nsMutableAccessible.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMutableAccessible, nsIAccessible)
|
||||
|
||||
nsMutableAccessible::nsMutableAccessible(nsISupports* aNode)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
NS_ASSERTION(aNode,"We must have a valid node!!");
|
||||
mNode = aNode;
|
||||
mNameNodeValue = PR_FALSE;
|
||||
mNameStringSet = PR_FALSE;
|
||||
mRole = NS_LITERAL_STRING("unknown");
|
||||
mIsLeaf = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMutableAccessible::~nsMutableAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::SetIsLeaf(PRBool aLeaf)
|
||||
{
|
||||
mIsLeaf = aLeaf;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetNodeAsNodeValue (); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetNameAsNodeValue()
|
||||
{
|
||||
mNameNodeValue = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetName (in wstring name); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetName(const PRUnichar *aName)
|
||||
{
|
||||
mName = aName;
|
||||
mNameStringSet = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetNameAsAttribute (in nsIAtom atom); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetNameAsAttribute(nsIAtom *aAttribute)
|
||||
{
|
||||
mNameAttribute = aAttribute;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void SetNameAsAttribute (in nsIAtom atom); */
|
||||
NS_IMETHODIMP nsMutableAccessible::SetRole(const PRUnichar *aRole)
|
||||
{
|
||||
mRole = aRole;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
if (mIsLeaf) {
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
if (mIsLeaf) {
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
if (mIsLeaf) {
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsAutoString value;
|
||||
|
||||
if (mNameNodeValue) {
|
||||
// see if we can get nodevalue
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mNode);
|
||||
if (node) {
|
||||
node->GetNodeValue(value);
|
||||
value.CompressWhitespace();
|
||||
} else {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
} else if (mNameStringSet) {
|
||||
value = mName;
|
||||
} else if (mNameAttribute) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mNode);
|
||||
content->GetAttribute(kNameSpaceID_None, mNameAttribute, value);
|
||||
value.CompressWhitespace();
|
||||
} else {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
*_retval = value.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::SetAccName(const PRUnichar *name)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::SetAccValue(const PRUnichar *value)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccDescription(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = mRole.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccDefaultAction(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccHelp(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::GetAccFocused(PRBool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccGetAt(PRInt32 x, PRInt32 y, nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateRight(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateLeft(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateUp(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccNavigateDown(nsIAccessible **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccAddSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccRemoveSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccExtendSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccTakeSelection()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccTakeFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMutableAccessible::AccDoDefaultAction()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
51
mozilla/accessible/src/nsMutableAccessible.h
Normal file
51
mozilla/accessible/src/nsMutableAccessible.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef _nsMutableAccessible_H_
|
||||
#define _nsMutableAccessible_H_
|
||||
|
||||
#include "nsIMutableAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsMutableAccessible : public nsIMutableAccessible
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
NS_DECL_NSIMUTABLEACCESSIBLE
|
||||
|
||||
nsMutableAccessible(nsISupports* aNode);
|
||||
virtual ~nsMutableAccessible();
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISupports> mNode;
|
||||
nsString mName;
|
||||
nsString mRole;
|
||||
nsCOMPtr<nsIAtom> mNameAttribute;
|
||||
PRPackedBool mNameNodeValue;
|
||||
PRPackedBool mNameStringSet;
|
||||
PRPackedBool mIsLeaf;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
199
mozilla/accessible/src/nsRootAccessible.cpp
Normal file
199
mozilla/accessible/src/nsRootAccessible.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
/* -*- 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 "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"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleEventReceiver)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsAccessible);
|
||||
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame):nsAccessible(nsnull,nsnull,aShell)
|
||||
{
|
||||
// mFrame = aFrame;
|
||||
mListener = nsnull;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// destruction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::~nsRootAccessible()
|
||||
{
|
||||
RemoveAccessibleEventListener(mListener);
|
||||
}
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccName(PRUnichar * *aAccName)
|
||||
{
|
||||
*aAccName = ToNewUnicode(NS_LITERAL_STRING("Mozilla Document"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// helpers
|
||||
nsIFrame* nsRootAccessible::GetFrame()
|
||||
{
|
||||
//if (!mFrame) {
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* root = nsnull;
|
||||
if (shell)
|
||||
shell->GetRootFrame(&root);
|
||||
|
||||
return root;
|
||||
//}
|
||||
|
||||
// return mFrame;
|
||||
}
|
||||
|
||||
nsIAccessible* nsRootAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return new nsHTMLBlockAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIAccessible accParent; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccParent(nsIAccessible * *aAccParent)
|
||||
{
|
||||
*aAccParent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute wstring accRole; */
|
||||
NS_IMETHODIMP nsRootAccessible::GetAccRole(PRUnichar * *aAccRole)
|
||||
{
|
||||
*aAccRole = ToNewUnicode(NS_LITERAL_STRING("client"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
shell->GetDocument(getter_AddRefs(document));
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver;
|
||||
if (NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(receiver))) && receiver)
|
||||
{
|
||||
nsresult rv = receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *, this), NS_GET_IID(nsIDOMFocusListener));
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mListener) {
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
// create and accessible for the target
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(t);
|
||||
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
|
||||
if (mCurrentFocus == content)
|
||||
return NS_OK;
|
||||
|
||||
mCurrentFocus = content;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> a = do_QueryInterface(frame);
|
||||
|
||||
if (!a)
|
||||
a = do_QueryInterface(content);
|
||||
|
||||
nsCOMPtr<nsIAccessible> na = CreateNewAccessible(a, content, mPresShell);
|
||||
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, na);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
70
mozilla/accessible/src/nsRootAccessible.h
Normal file
70
mozilla/accessible/src/nsRootAccessible.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- 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 "nsIDOMFocusListener.h"
|
||||
|
||||
class nsRootAccessible : public nsAccessible,
|
||||
public nsIAccessibleEventReceiver,
|
||||
public nsIDOMFocusListener
|
||||
|
||||
{
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
public:
|
||||
nsRootAccessible(nsIWeakReference* aShell, nsIFrame* aFrame = nsnull);
|
||||
virtual ~nsRootAccessible();
|
||||
|
||||
/* attribute wstring accName; */
|
||||
NS_IMETHOD GetAccName(PRUnichar * *aAccName);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible * *aAccParent);
|
||||
NS_IMETHOD GetAccRole(PRUnichar * *aAccRole);
|
||||
|
||||
// ----- nsIAccessibleEventReceiver ------
|
||||
|
||||
NS_IMETHOD AddAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||
|
||||
// ----- nsIDOMEventListener --------
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent);
|
||||
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
|
||||
|
||||
protected:
|
||||
virtual nsIFrame* GetFrame();
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
// 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<nsIContent> mCurrentFocus;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
717
mozilla/accessible/src/nsSelectAccessible.cpp
Normal file
717
mozilla/accessible/src/nsSelectAccessible.cpp
Normal file
@@ -0,0 +1,717 @@
|
||||
/* -*- 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 "nsSelectAccessible.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 "nsMutableAccessible.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsIDOMMenuListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
class nsSelectChildAccessible : public nsAccessible,
|
||||
public nsIDOMMenuListener
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsSelectChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectChildAccessible();
|
||||
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccValue(PRUnichar **_retval);
|
||||
|
||||
virtual nsIAccessible* CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
// popup listener
|
||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Destroy(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Action(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; }
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIContent> mSelectContent;
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsSelectChildAccessible, nsAccessible, nsIDOMMenuListener)
|
||||
|
||||
class nsSelectWindowAccessible : public nsAccessible,
|
||||
public nsIDOMMenuListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsSelectWindowAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aPrev, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectWindowAccessible();
|
||||
|
||||
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 GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccExtState(PRUint32 *_retval);
|
||||
|
||||
// popup listener
|
||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Destroy(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Action(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; }
|
||||
|
||||
// helpers
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIAccessible> mPrev;
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
PRBool mRegistered;
|
||||
PRBool mOpen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsSelectWindowAccessible, nsAccessible, nsIDOMMenuListener)
|
||||
|
||||
class nsSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectListAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsSelectListAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList);
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
};
|
||||
|
||||
class nsListChildAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsListChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual ~nsListChildAccessible() {}
|
||||
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
|
||||
virtual void GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList);
|
||||
virtual nsIAccessible* CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
nsCOMPtr<nsIContent> mSelectContent;
|
||||
};
|
||||
|
||||
//---------
|
||||
|
||||
nsSelectAccessible::nsSelectAccessible(nsIAtom* aPopupAtom,
|
||||
nsIAccessible* aAccessible,
|
||||
nsIContent* aContent,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
// our value is our first child's value. Which is the combo boxes text.
|
||||
nsCOMPtr<nsIAccessible> text;
|
||||
nsresult rv = GetAccFirstChild(getter_AddRefs(text));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// look at our role
|
||||
return text->GetAccValue(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("combo box"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
// get the last child. Wrap it with a connector that connects it to the window accessible
|
||||
nsCOMPtr<nsIAccessible> last;
|
||||
nsresult rv = nsAccessible::GetAccLastChild(getter_AddRefs(last));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!last) {
|
||||
// we have a parent but not previous
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, this, nsnull, nsnull, mContent, mPresShell);
|
||||
} else {
|
||||
*_retval = last;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
// get the last child. Wrap it with a connector that connects it to the window accessible
|
||||
nsCOMPtr<nsIAccessible> first;
|
||||
nsresult rv = nsAccessible::GetAccFirstChild(getter_AddRefs(first));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!first) {
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, this, nsnull, nsnull, mContent, mPresShell);
|
||||
} else {
|
||||
*_retval = first;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewLastAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsSelectChildAccessible(mPopupAtom, mContent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
nsresult rv = nsAccessible::GetAccChildCount(_retval);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// always have one more that is our window child
|
||||
(*_retval)++;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//--------------------
|
||||
|
||||
nsSelectChildAccessible::nsSelectChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):
|
||||
nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
mSelectContent = aSelectContent;
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccValue(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
rv = nsAccessible::GetAccRole(&string);
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString role(string);
|
||||
|
||||
// if its the text in the combo box then
|
||||
// its value should be its name.
|
||||
if (role.EqualsIgnoreCase("text")) {
|
||||
rv = nsAccessible::GetAccName(_retval);
|
||||
} else {
|
||||
rv = nsAccessible::GetAccValue(_retval);
|
||||
}
|
||||
|
||||
delete string;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
rv = nsAccessible::GetAccRole(&string);
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoString role(string);
|
||||
|
||||
// any text in the combo box is static
|
||||
if (role.EqualsIgnoreCase("text")) {
|
||||
// if it the comboboxes text. Make it static
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("static text"));
|
||||
} else {
|
||||
rv = nsAccessible::GetAccRole(_retval);
|
||||
}
|
||||
|
||||
delete string;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar* string = nsnull;
|
||||
|
||||
// look at our role
|
||||
nsAccessible::GetAccRole(&string);
|
||||
nsAutoString role(string);
|
||||
|
||||
// if button then we need to make the name be open or close
|
||||
if (role.EqualsIgnoreCase("push button"))
|
||||
{
|
||||
// if its a button and not already registered,
|
||||
// register ourselves as a popup listener
|
||||
if (!mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mSelectContent);
|
||||
if (!eventReceiver) {
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
// 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 = ToNewUnicode(NS_LITERAL_STRING("Close"));
|
||||
else
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("Open"));
|
||||
|
||||
} else {
|
||||
/*rv = nsAccessible::GetAccName(_retval);*/
|
||||
rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
*_retval = nsnull;
|
||||
}
|
||||
|
||||
delete string;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsSelectChildAccessible::~nsSelectChildAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mSelectContent);
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
printf("Open\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectChildAccessible::CreateNewNextAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
return CreateNewPreviousAccessible(aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectChildAccessible::CreateNewPreviousAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsSelectChildAccessible(mPopupAtom, mSelectContent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectChildAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIAccessible> next;
|
||||
nsresult rv = nsAccessible::GetAccNextSibling(getter_AddRefs(next));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!next) {
|
||||
// ok no more siblings. Lets create our window
|
||||
nsCOMPtr<nsIAccessible> parent;
|
||||
GetAccParent(getter_AddRefs(parent));
|
||||
|
||||
*_retval = new nsSelectWindowAccessible(mPopupAtom, parent, nsnull, nsnull, mSelectContent, mPresShell);
|
||||
} else {
|
||||
*_retval = next;
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//---------------------
|
||||
|
||||
|
||||
nsSelectWindowAccessible::nsSelectWindowAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aPrev, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
mPrev = aPrev;
|
||||
mPopupAtom = aPopupAtom;
|
||||
mRegistered = PR_FALSE;
|
||||
mOpen = PR_FALSE;
|
||||
}
|
||||
|
||||
nsSelectWindowAccessible::~nsSelectWindowAccessible()
|
||||
{
|
||||
if (mRegistered) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mContent);
|
||||
if (eventReceiver)
|
||||
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Create(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_TRUE;
|
||||
printf("Open\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Destroy(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::Close(nsIDOMEvent* aEvent)
|
||||
{
|
||||
mOpen = PR_FALSE;
|
||||
printf("Close\n");
|
||||
|
||||
/* TBD send state change event */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// not not already one register ourselves as a popup listener
|
||||
|
||||
if (!mRegistered) {
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(mContent);
|
||||
if (!eventReceiver) {
|
||||
*_retval = 0;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult rv = eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
mRegistered = PR_TRUE;
|
||||
}
|
||||
|
||||
// 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 nsSelectWindowAccessible::GetAccExtState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval=0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("window"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mPrev;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsSelectListAccessible(mPopupAtom, this, nsnull, mContent, mPresShell);
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = new nsSelectListAccessible(mPopupAtom, this, nsnull, mContent, mPresShell);
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
NS_IMETHODIMP nsSelectWindowAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
nsIFrame* nsSelectWindowAccessible::GetBoundsFrame()
|
||||
{
|
||||
// get our frame
|
||||
nsIFrame* frame = GetFrame();
|
||||
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
GetPresContext(context);
|
||||
|
||||
// get its first popup child that should be the window
|
||||
frame->FirstChild(context, mPopupAtom, &frame);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
//----------
|
||||
|
||||
|
||||
nsSelectListAccessible::nsSelectListAccessible(nsIAtom* aPopupAtom, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
:nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mPopupAtom = aPopupAtom;
|
||||
mParent = aParent;
|
||||
}
|
||||
|
||||
void nsSelectListAccessible::GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mContent, &frame);
|
||||
if (aFrame == frame)
|
||||
aList = mPopupAtom;
|
||||
else
|
||||
aList = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
return mParent->AccGetBounds(x,y,width,height);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccName(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("list"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectListAccessible::CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mContent, this, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
nsIAccessible* nsSelectListAccessible::CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mContent, this, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
//--------
|
||||
|
||||
nsListChildAccessible::nsListChildAccessible(nsIAtom* aPopupAtom, nsIContent* aSelectContent, nsIAccessible* aParent, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell):
|
||||
nsAccessible(aAccessible, aContent, aShell)
|
||||
{
|
||||
mParent = aParent;
|
||||
mPopupAtom = aPopupAtom;
|
||||
mSelectContent = aSelectContent;
|
||||
}
|
||||
|
||||
nsIAccessible* nsListChildAccessible::CreateNewAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell)
|
||||
{
|
||||
NS_ASSERTION(aAccessible && aContent,"Error not accessible or content");
|
||||
return new nsListChildAccessible(mPopupAtom, mSelectContent, mParent, aAccessible, aContent, aShell);
|
||||
}
|
||||
|
||||
void nsListChildAccessible::GetListAtomForFrame(nsIFrame* aFrame, nsIAtom*& aList)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
nsIFrame* frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(mSelectContent, &frame);
|
||||
if (aFrame == frame)
|
||||
aList = mPopupAtom;
|
||||
else
|
||||
aList = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsListChildAccessible::GetAccRole(PRUnichar **_retval)
|
||||
{
|
||||
*_retval = ToNewUnicode(NS_LITERAL_STRING("list item"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsListChildAccessible::GetAccParent(nsIAccessible **_retval)
|
||||
{
|
||||
*_retval = mParent;
|
||||
NS_IF_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
51
mozilla/accessible/src/nsSelectAccessible.h
Normal file
51
mozilla/accessible/src/nsSelectAccessible.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
#ifndef __nsSelectAccessible_h__
|
||||
#define __nsSelectAccessible_h__
|
||||
|
||||
#include "nsAccessible.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsSelectAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsSelectAccessible(nsIAtom* aPopupAtom, nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccValue(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
virtual ~nsSelectAccessible() {}
|
||||
virtual nsIAccessible* CreateNewFirstAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
virtual nsIAccessible* CreateNewLastAccessible(nsIAccessible* aAccessible, nsIContent* aContent, nsIWeakReference* aShell);
|
||||
|
||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,70 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_xul_s
|
||||
REQUIRES = \
|
||||
content \
|
||||
content_xul \
|
||||
docshell \
|
||||
dom \
|
||||
gfx \
|
||||
gfx2 \
|
||||
htmlparser \
|
||||
imglib2 \
|
||||
intl \
|
||||
layout \
|
||||
locale \
|
||||
necko \
|
||||
string \
|
||||
uriloader \
|
||||
view \
|
||||
webshell \
|
||||
widget \
|
||||
xpcom \
|
||||
webbrwsr \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsXULColorPickerAccessible.cpp \
|
||||
nsXULFormControlAccessible.cpp \
|
||||
nsXULMenuAccessible.cpp \
|
||||
nsXULSelectAccessible.cpp \
|
||||
nsXULTabAccessible.cpp \
|
||||
nsXULTextAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../base \
|
||||
-I$(srcdir)/../html \
|
||||
$(NULL)
|
||||
@@ -1,67 +0,0 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): John Gaunt (jgaunt@netscape.com)
|
||||
|
||||
DEPTH = ..\..\..
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_xul_s
|
||||
REQUIRES = \
|
||||
content \
|
||||
dom \
|
||||
gfx \
|
||||
layout \
|
||||
necko \
|
||||
string \
|
||||
widget \
|
||||
xpcom \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\nsXULColorPickerAccessible.obj \
|
||||
.\$(OBJDIR)\nsXULFormControlAccessible.obj \
|
||||
.\$(OBJDIR)\nsXULMenuAccessible.obj \
|
||||
.\$(OBJDIR)\nsXULSelectAccessible.obj \
|
||||
.\$(OBJDIR)\nsXULTabAccessible.obj \
|
||||
.\$(OBJDIR)\nsXULTextAccessible.obj \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
-I..\base \
|
||||
-I..\html \
|
||||
-I..\..\..\layout\html\forms\public \
|
||||
-I..\..\..\layout\html\forms\src \
|
||||
-I..\..\..\layout\html\base\src \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBRARY_NAME).lib
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsXULColorPickerAccessible.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXULFormControlAccessible.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
|
||||
/**
|
||||
* XUL Color Picker Tile
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
nsXULColorPickerTileAccessible::nsXULColorPickerTileAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* We are a pushbutton
|
||||
*/
|
||||
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible states: focused, focusable, selected
|
||||
*/
|
||||
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// get focus and disable status from base class
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
|
||||
// Focused?
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No XUL Element for colorpicker");
|
||||
PRBool isFocused = PR_FALSE;
|
||||
element->HasAttribute(NS_LITERAL_STRING("hover"), &isFocused);
|
||||
if (isFocused)
|
||||
*_retval |= STATE_FOCUSED;
|
||||
|
||||
PRBool isSelected = PR_FALSE;
|
||||
element->HasAttribute(NS_LITERAL_STRING("selected"), &isSelected);
|
||||
if (isFocused)
|
||||
*_retval |= STATE_SELECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
_retval.Assign(NS_LITERAL_STRING(""));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULColorPickerTileAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No XUL Element for colorpicker");
|
||||
return element->GetAttribute(NS_LITERAL_STRING("color"), _retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL Color Picker
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
nsXULColorPickerAccessible::nsXULColorPickerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsXULColorPickerTileAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible states: focused, focusable, unavailable(disabled)
|
||||
*/
|
||||
NS_IMETHODIMP nsXULColorPickerAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// get focus and disable status from base class
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE | STATE_HASPOPUP;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsXULColorPickerAccessible_H_
|
||||
#define _nsXULColorPickerAccessible_H_
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsFormControlAccessible.h"
|
||||
|
||||
class nsXULColorPickerTileAccessible : public nsFormControlAccessible
|
||||
{
|
||||
public:
|
||||
nsXULColorPickerTileAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
};
|
||||
|
||||
class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible
|
||||
{
|
||||
public:
|
||||
nsXULColorPickerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,566 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIDOMXULDescriptionElement.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMXULLabelElement.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXULFormControlAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
/**
|
||||
* XUL Button: can contain arbitrary HTML content
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
|
||||
// Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
|
||||
nsXULButtonAccessible::nsXULButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccName(nsAString& aResult)
|
||||
{
|
||||
return GetXULAccName(aResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only one actions available
|
||||
*/
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of our only action
|
||||
*/
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the button to do it's action
|
||||
*/
|
||||
NS_IMETHODIMP nsXULButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == 0) {
|
||||
nsCOMPtr<nsIDOMXULButtonElement> buttonElement(do_QueryInterface(mDOMNode));
|
||||
if ( buttonElement )
|
||||
{
|
||||
buttonElement->DoCommand();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are a pushbutton
|
||||
*/
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible states: focused, focusable, unavailable(disabled)
|
||||
*/
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// get focus and disable status from base class
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode));
|
||||
if (xulFormElement) {
|
||||
xulFormElement->GetDisabled(&disabled);
|
||||
if (disabled)
|
||||
*_retval |= STATE_UNAVAILABLE;
|
||||
else
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
}
|
||||
|
||||
// Buttons can be checked -- they simply appear pressed in rather than checked
|
||||
nsCOMPtr<nsIDOMXULButtonElement> xulButtonElement(do_QueryInterface(mDOMNode));
|
||||
if (xulButtonElement) {
|
||||
PRBool checked = PR_FALSE;
|
||||
PRInt32 checkState = 0;
|
||||
xulButtonElement->GetChecked(&checked);
|
||||
if (checked) {
|
||||
*_retval |= STATE_PRESSED;
|
||||
xulButtonElement->GetCheckState(&checkState);
|
||||
if (checkState == nsIDOMXULButtonElement::CHECKSTATE_MIXED)
|
||||
*_retval |= STATE_MIXED;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
||||
PRBool isDefault = PR_FALSE;
|
||||
element->HasAttribute(NS_LITERAL_STRING("default"), &isDefault) ;
|
||||
if (isDefault)
|
||||
*_retval |= STATE_DEFAULT;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perhaps 1 child - if there's a <dropmarker>
|
||||
*/
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccFirstChild(nsIAccessible **aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessible> testAccessible;
|
||||
nsAccessible::GetAccLastChild(getter_AddRefs(testAccessible));
|
||||
|
||||
// If the anonymous tree walker can find accessible children, and the last one is a push button,
|
||||
// then use it as the only accessible child -- because this is the scenario where we have a dropmarker child
|
||||
|
||||
if (testAccessible) {
|
||||
PRUint32 role;
|
||||
if (NS_SUCCEEDED(testAccessible->GetAccRole(&role)) && role == ROLE_PUSHBUTTON) {
|
||||
*aResult = testAccessible;
|
||||
NS_ADDREF(*aResult);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccLastChild(nsIAccessible **aResult)
|
||||
{
|
||||
return GetAccFirstChild(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULButtonAccessible::GetAccChildCount(PRInt32 *aResult)
|
||||
{
|
||||
*aResult = 0;
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
GetAccFirstChild(getter_AddRefs(accessible));
|
||||
if (accessible)
|
||||
*aResult = 1;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL Dropmarker: can contain arbitrary HTML content
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
nsXULDropmarkerAccessible::nsXULDropmarkerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Only one actions available
|
||||
*/
|
||||
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccNumActions(PRUint8 *aResult)
|
||||
{
|
||||
*aResult = eSingle_Action;
|
||||
return NS_OK;;
|
||||
}
|
||||
|
||||
PRBool nsXULDropmarkerAccessible::DropmarkerOpen(PRBool aToggleOpen)
|
||||
{
|
||||
PRBool isOpen = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parentButtonNode;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(parentButtonNode));
|
||||
nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement(do_QueryInterface(parentButtonNode));
|
||||
|
||||
if (parentButtonElement) {
|
||||
parentButtonElement->GetOpen(&isOpen);
|
||||
if (aToggleOpen)
|
||||
parentButtonElement->SetOpen(!isOpen);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> parentMenuListElement(do_QueryInterface(parentButtonNode));
|
||||
if (parentMenuListElement) {
|
||||
parentMenuListElement->GetOpen(&isOpen);
|
||||
if (aToggleOpen)
|
||||
parentMenuListElement->SetOpen(!isOpen);
|
||||
}
|
||||
}
|
||||
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of our only action
|
||||
*/
|
||||
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccActionName(PRUint8 index, nsAString& aResult)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
if (DropmarkerOpen(PR_FALSE))
|
||||
aResult = NS_LITERAL_STRING("close");
|
||||
else
|
||||
aResult = NS_LITERAL_STRING("open");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the Dropmarker to do it's action
|
||||
*/
|
||||
NS_IMETHODIMP nsXULDropmarkerAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
DropmarkerOpen(PR_TRUE); // Reverse the open attribute
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
* We are a pushbutton
|
||||
*/
|
||||
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccRole(PRUint32 *aResult)
|
||||
{
|
||||
*aResult = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccState(PRUint32 *aResult)
|
||||
{
|
||||
*aResult = 0;
|
||||
|
||||
if (DropmarkerOpen(PR_FALSE))
|
||||
*aResult = STATE_PRESSED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL checkbox
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
nsXULCheckboxAccessible::nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* We are a CheckButton
|
||||
*/
|
||||
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_CHECKBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only one action available
|
||||
*/
|
||||
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of our only action
|
||||
*/
|
||||
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
// check or uncheck
|
||||
PRUint32 state;
|
||||
GetAccState(&state);
|
||||
|
||||
if (state & STATE_CHECKED)
|
||||
_retval = NS_LITERAL_STRING("uncheck");
|
||||
else
|
||||
_retval = NS_LITERAL_STRING("check");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the checkbox to do its only action -- check( or uncheck) itself
|
||||
*/
|
||||
NS_IMETHODIMP nsXULCheckboxAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
PRBool checked = PR_FALSE;
|
||||
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
|
||||
if (xulCheckboxElement) {
|
||||
xulCheckboxElement->GetChecked(&checked);
|
||||
xulCheckboxElement->SetChecked(!checked);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible states: focused, focusable, unavailable(disabled), checked
|
||||
*/
|
||||
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Get focus and disable status from base class
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
|
||||
// Determine Checked state
|
||||
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
|
||||
if (xulCheckboxElement) {
|
||||
PRBool checked = PR_FALSE;
|
||||
xulCheckboxElement->GetChecked(&checked);
|
||||
if (checked) {
|
||||
*_retval |= STATE_CHECKED;
|
||||
PRInt32 checkState = 0;
|
||||
xulCheckboxElement->GetCheckState(&checkState);
|
||||
if (checkState == nsIDOMXULCheckboxElement::CHECKSTATE_MIXED)
|
||||
*_retval |= STATE_MIXED;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL groupbox
|
||||
*/
|
||||
|
||||
nsXULGroupboxAccessible::nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_GROUPING;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Groupbox doesn't support any states!
|
||||
*_retval = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
nsCOMPtr<nsIDOMNodeList> captions;
|
||||
element->GetElementsByTagName(NS_LITERAL_STRING("caption"), getter_AddRefs(captions));
|
||||
if (captions) {
|
||||
nsCOMPtr<nsIDOMNode> captionNode;
|
||||
captions->Item(0, getter_AddRefs(captionNode));
|
||||
if (captionNode) {
|
||||
element = do_QueryInterface(captionNode);
|
||||
NS_ASSERTION(element, "No nsIDOMElement for caption node!");
|
||||
element->GetAttribute(NS_LITERAL_STRING("label"), _retval) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* progressmeter
|
||||
*/
|
||||
|
||||
nsXULProgressMeterAccessible::nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PROGRESSBAR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* No states supported for progressmeter
|
||||
*/
|
||||
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval =0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No element for DOM node!");
|
||||
element->GetAttribute(NS_LITERAL_STRING("value"), _retval);
|
||||
_retval.Append(NS_LITERAL_STRING("%"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL Radio Button
|
||||
*/
|
||||
|
||||
/** Constructor */
|
||||
nsXULRadioButtonAccessible::nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsRadioButtonAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** Our only action is to click */
|
||||
NS_IMETHODIMP nsXULRadioButtonAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
|
||||
if (radioButton) {
|
||||
radioButton->DoCommand();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/** We are Focusable and can be Checked and focused */
|
||||
NS_IMETHODIMP nsXULRadioButtonAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsFormControlAccessible::GetAccState(_retval);
|
||||
PRBool selected = PR_FALSE; // Radio buttons can be selected
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
|
||||
if (radioButton)
|
||||
radioButton->GetSelected(&selected);
|
||||
|
||||
if (selected)
|
||||
*_retval |= STATE_CHECKED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the parent of the RadioGroup (our grandparent) and sets it
|
||||
* as our parent, for future calls.
|
||||
*/
|
||||
NS_IMETHODIMP nsXULRadioButtonAccessible::GetAccParent(nsIAccessible ** aAccParent)
|
||||
{
|
||||
if (! mParent) {
|
||||
nsCOMPtr<nsIAccessible> tempParent;
|
||||
nsAccessible::GetAccParent(getter_AddRefs(tempParent));
|
||||
if (tempParent)
|
||||
tempParent->GetAccParent(getter_AddRefs(mParent));
|
||||
}
|
||||
NS_ASSERTION(mParent,"Whoa! This RadioButtonAcc doesn't have a parent! Better find out why.");
|
||||
*aAccParent = mParent;
|
||||
NS_ADDREF(*aAccParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL Radio Group
|
||||
* The Radio Group proxies for the Radio Buttons themselves. The Group gets
|
||||
* focus whereas the Buttons do not. So we only have an accessible object for
|
||||
* this for the purpose of getting the proper RadioButton. Need this here to
|
||||
* avoid circular reference problems when navigating the accessible tree and
|
||||
* for getting to the radiobuttons.
|
||||
*/
|
||||
|
||||
/** Constructor */
|
||||
nsXULRadioGroupAccessible::nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL StatusBar: can contain arbitrary HTML content
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
nsXULStatusBarAccessible::nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* We are a statusbar
|
||||
*/
|
||||
NS_IMETHODIMP nsXULStatusBarAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_STATUSBAR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULStatusBarAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = 0; // no special state flags for status bar
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsXULFormControlAccessible_H_
|
||||
#define _nsXULFormControlAccessible_H_
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
|
||||
class nsXULButtonAccessible : public nsAccessible
|
||||
// Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
|
||||
{
|
||||
public:
|
||||
nsXULButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& aResult);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
|
||||
};
|
||||
|
||||
class nsXULCheckboxAccessible : public nsFormControlAccessible
|
||||
{
|
||||
public:
|
||||
nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsXULDropmarkerAccessible : public nsFormControlAccessible
|
||||
{
|
||||
public:
|
||||
nsXULDropmarkerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
|
||||
private:
|
||||
PRBool DropmarkerOpen(PRBool aToggleOpen);
|
||||
};
|
||||
|
||||
class nsXULGroupboxAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
};
|
||||
|
||||
class nsXULProgressMeterAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString &_retval);
|
||||
};
|
||||
|
||||
class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsXULRadioGroupAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
};
|
||||
|
||||
class nsXULStatusBarAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsXULMenuAccessible.h"
|
||||
#include "nsAccessible.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
|
||||
// ------------------------ Menu Item -----------------------------
|
||||
|
||||
nsXULMenuitemAccessible::nsXULMenuitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
// Focused?
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No DOM element for menu node!");
|
||||
PRBool isFocused = PR_FALSE;
|
||||
element->HasAttribute(NS_LITERAL_STRING("_moz-menuactive"), &isFocused);
|
||||
if (isFocused)
|
||||
*_retval |= STATE_FOCUSED;
|
||||
|
||||
// Has Popup?
|
||||
nsAutoString tagName;
|
||||
element->GetLocalName(tagName);
|
||||
if (tagName.Equals(NS_LITERAL_STRING("menu")))
|
||||
*_retval |= STATE_HASPOPUP;
|
||||
|
||||
nsAutoString menuItemType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), menuItemType);
|
||||
|
||||
if (!menuItemType.IsEmpty()) {
|
||||
// Selectable?
|
||||
if (menuItemType.Equals(NS_LITERAL_STRING("radio")))
|
||||
*_retval |= STATE_SELECTABLE;
|
||||
|
||||
// Checked?
|
||||
PRBool isChecked = PR_FALSE;
|
||||
element->HasAttribute(NS_LITERAL_STRING("checked"), &isChecked);
|
||||
if (isChecked) {
|
||||
if (*_retval & STATE_SELECTABLE)
|
||||
*_retval |= STATE_SELECTED; // Use STATE_SELECTED for radio buttons
|
||||
else *_retval |= STATE_CHECKED;
|
||||
}
|
||||
}
|
||||
|
||||
// Offscreen?
|
||||
// If parent or grandparent menuitem is offscreen, then we're offscreen too
|
||||
// We get it by replacing the current offscreen bit with the parent's
|
||||
PRUint32 parentState = 0;
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccParent(getter_AddRefs(parentAccessible));
|
||||
parentAccessible->GetAccState(&parentState);
|
||||
*_retval &= ~STATE_OFFSCREEN; // clear the old OFFSCREEN bit
|
||||
*_retval |= (parentState & STATE_OFFSCREEN); // or it with the parent's offscreen bit
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No DOM element for menu node!");
|
||||
element->GetAttribute(NS_LITERAL_STRING("label"), _retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_MENUITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccFirstChild(nsIAccessible **aAccFirstChild)
|
||||
{
|
||||
*aAccFirstChild = nsnull;
|
||||
|
||||
// Last argument of PR_FALSE indicates we don't walk anonymous children for menuitems
|
||||
nsAccessibleTreeWalker walker(mPresShell, mDOMNode, mSiblingIndex, mSiblingList, PR_FALSE);
|
||||
if (NS_SUCCEEDED(walker.GetFirstChild())) {
|
||||
*aAccFirstChild = walker.mState.accessible;
|
||||
NS_ADDREF(*aAccFirstChild);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccLastChild(nsIAccessible **aAccLastChild)
|
||||
{
|
||||
*aAccLastChild = nsnull;
|
||||
|
||||
// Last argument of PR_FALSE indicates we don't walk anonymous children for menuitems
|
||||
nsAccessibleTreeWalker walker(mPresShell, mDOMNode, mSiblingIndex, mSiblingList, PR_FALSE);
|
||||
if (NS_SUCCEEDED(walker.GetLastChild())) {
|
||||
*aAccLastChild = walker.mState.accessible;
|
||||
NS_ADDREF(*aAccLastChild);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuitemAccessible::GetAccChildCount(PRInt32 *aAccChildCount)
|
||||
{
|
||||
// Last argument of PR_FALSE indicates we don't walk anonymous children for menuitems
|
||||
nsAccessibleTreeWalker walker(mPresShell, mDOMNode, mSiblingIndex, mSiblingList, PR_FALSE);
|
||||
*aAccChildCount = walker.GetChildCount();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ------------------------ Menu Separator ----------------------------
|
||||
|
||||
nsXULMenuSeparatorAccessible::nsXULMenuSeparatorAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsXULMenuitemAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Isn't focusable, but can be offscreen
|
||||
nsXULMenuitemAccessible::GetAccState(_retval);
|
||||
*_retval &= STATE_OFFSCREEN;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
_retval.Assign(NS_LITERAL_STRING(""));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_SEPARATOR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ------------------------ Menu Popup -----------------------------
|
||||
|
||||
nsXULMenupopupAccessible::nsXULMenupopupAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenupopupAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// We are onscreen if our parent is active
|
||||
*_retval = 0;
|
||||
PRBool isActive = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
element->HasAttribute(NS_LITERAL_STRING("menuactive"), &isActive);
|
||||
if (!isActive) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
GetAccParent(getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible)
|
||||
parentAccessible->AccGetDOMNode(getter_AddRefs(parentNode));
|
||||
element = do_QueryInterface(parentNode);
|
||||
if (element)
|
||||
element->HasAttribute(NS_LITERAL_STRING("open"), &isActive);
|
||||
}
|
||||
|
||||
if (!isActive)
|
||||
*_retval |= STATE_OFFSCREEN;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenupopupAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No element for popup node!");
|
||||
|
||||
while (element) {
|
||||
element->GetAttribute(NS_LITERAL_STRING("label"), _retval);
|
||||
if (!_retval.IsEmpty())
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIDOMNode> parentNode, node(do_QueryInterface(element));
|
||||
if (!node)
|
||||
return NS_ERROR_FAILURE;
|
||||
node->GetParentNode(getter_AddRefs(parentNode));
|
||||
element = do_QueryInterface(parentNode);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenupopupAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_MENUPOPUP;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// ------------------------ Menu Bar -----------------------------
|
||||
|
||||
nsXULMenubarAccessible::nsXULMenubarAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell): nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenubarAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
return nsAccessible::GetAccState(_retval);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsXULMenubarAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
_retval = NS_LITERAL_STRING("menubar");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULMenubarAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_MENUBAR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsXULMenuAccessible_H_
|
||||
#define _nsXULMenuAccessible_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
/* Accessible for supporting XUL menus
|
||||
*/
|
||||
|
||||
class nsXULMenuitemAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULMenuitemAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccFirstChild(nsIAccessible **aAccFirstChild);
|
||||
NS_IMETHOD GetAccLastChild(nsIAccessible **aAccLastChild);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *aAccChildCount);
|
||||
};
|
||||
|
||||
class nsXULMenuSeparatorAccessible : public nsXULMenuitemAccessible
|
||||
{
|
||||
public:
|
||||
nsXULMenuSeparatorAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsXULMenupopupAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULMenupopupAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
class nsXULMenubarAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULMenubarAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,360 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXULSelectAccessible.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
/**
|
||||
* Selects, Listboxes and Comboboxes, are made up of a number of different
|
||||
* widgets, some of which are shared between the two. This file contains
|
||||
* all of the widgets for both of the Selects, for XUL only. Some of them
|
||||
* extend classes from nsSelectAccessible.cpp, which contains base classes
|
||||
* that are also extended by the XUL Select Accessibility support.
|
||||
*
|
||||
* Listbox:
|
||||
* - nsXULListboxAccessible
|
||||
* - nsXULSelectListAccessible
|
||||
* - nsXULSelectOptionAccessible
|
||||
*
|
||||
* Comboboxes:
|
||||
* - nsXULComboboxAccessible
|
||||
* - nsHTMLTextFieldAccessible (editable) or nsTextAccessible (readonly)
|
||||
* - nsXULComboboxButtonAccessible
|
||||
* - nsXULSelectListAccessible
|
||||
* - nsXULSelectOptionAccessible
|
||||
*/
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/** ----- nsXULSelectListAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsXULSelectListAccessible::nsXULSelectListAccessible(nsIDOMNode* aDOMNode,
|
||||
nsIWeakReference* aShell)
|
||||
:nsAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULSelectListAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsXULSelectListAccessible we can have the following states:
|
||||
* STATE_MULTISELECTABLE
|
||||
* STATE_EXTSELECTABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsXULSelectListAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
nsAutoString selectionTypeString;
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No nsIDOMElement for caption node!");
|
||||
element->GetAttribute(NS_LITERAL_STRING("seltype"), selectionTypeString) ;
|
||||
if (selectionTypeString.EqualsIgnoreCase("multiple"))
|
||||
*_retval |= STATE_MULTISELECTABLE | STATE_EXTSELECTABLE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ----- nsXULSelectOptionAccessible ----- */
|
||||
|
||||
/** Default Constructor */
|
||||
nsXULSelectOptionAccessible::nsXULSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsXULMenuitemAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LISTITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsXULSelectOptionAccessible we can have the following states:
|
||||
* STATE_SELECTABLE
|
||||
* STATE_SELECTED
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsXULSelectOptionAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
nsXULMenuitemAccessible::GetAccState(_retval);
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(mDOMNode));
|
||||
PRBool isSelected = PR_FALSE;
|
||||
item->GetSelected(&isSelected);
|
||||
if (isSelected)
|
||||
*_retval |= STATE_SELECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Secondly, the Listbox widget */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/** ----- nsXULListboxAccessible ----- */
|
||||
|
||||
/** Constructor */
|
||||
nsXULListboxAccessible::nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsListboxAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** Inherit the ISupports impl from nsAccessible, we handle nsIAccessibleSelectable */
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsXULListboxAccessible, nsListboxAccessible, nsIAccessibleSelectable)
|
||||
|
||||
/**
|
||||
* Let Accessible count them up
|
||||
*/
|
||||
NS_IMETHODIMP nsXULListboxAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
return nsAccessible::GetAccChildCount(_retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* As a nsXULListboxAccessible we can have the following states:
|
||||
* STATE_FOCUSED
|
||||
* STATE_READONLY
|
||||
* STATE_FOCUSABLE
|
||||
*/
|
||||
NS_IMETHODIMP nsXULListboxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// Get focus status from base class
|
||||
nsListboxAccessible::GetAccState(_retval);
|
||||
|
||||
// see if we are multiple select if so set ourselves as such
|
||||
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
|
||||
if (element) {
|
||||
nsAutoString selType;
|
||||
element->GetAttribute(NS_LITERAL_STRING("seltype"), selType);
|
||||
if (!selType.IsEmpty() && selType.Equals(NS_LITERAL_STRING("multiple")))
|
||||
*_retval |= STATE_MULTISELECTABLE;
|
||||
}
|
||||
|
||||
*_retval |= STATE_FOCUSABLE ;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. nsIDOMXULSelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsXULListboxAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> select(do_QueryInterface(mDOMNode));
|
||||
if (select) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
|
||||
select->GetSelectedItem(getter_AddRefs(selectedItem));
|
||||
return selectedItem->GetValue(_retval);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULListboxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleSelectable method.
|
||||
* - gets from the Select DOMNode the list of all Select Options
|
||||
* - iterates through all of the options looking for selected Options
|
||||
* - creates IAccessible objects for selected Options
|
||||
* - Returns the IAccessibles for selected Options in the nsISupportsArray
|
||||
*
|
||||
* retval will be nsnull if:
|
||||
* - there are no Options in the Select Element
|
||||
* - there are Options but none are selected
|
||||
* - the DOMNode is not a nsIDOMXULSelectControlElement ( shouldn't happen )
|
||||
*/
|
||||
NS_IMETHODIMP nsXULListboxAccessible::GetSelectedChildren(nsISupportsArray **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||
nsCOMPtr<nsISupportsArray> selectedAccessibles;
|
||||
NS_NewISupportsArray(getter_AddRefs(selectedAccessibles));
|
||||
if (!selectedAccessibles || !accService)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList> selectedItems;
|
||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> listbox (do_QueryInterface(mDOMNode));
|
||||
PRInt32 length = 0;
|
||||
if (listbox) {
|
||||
listbox->GetSelectedCount(&length);
|
||||
for ( PRInt32 i = 0 ; i < length ; i++ ) {
|
||||
nsCOMPtr<nsIAccessible> tempAccessible;
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> tempNode;
|
||||
listbox->GetSelectedItem(i, getter_AddRefs(tempNode));
|
||||
nsCOMPtr<nsIDOMNode> tempDOMNode (do_QueryInterface(tempNode));
|
||||
accService->CreateXULListitemAccessible(tempDOMNode, getter_AddRefs(tempAccessible));
|
||||
if (tempAccessible)
|
||||
selectedAccessibles->AppendElement(tempAccessible);
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 uLength = 0;
|
||||
selectedAccessibles->Count(&uLength);
|
||||
if ( uLength != 0 ) { // length of nsISupportsArray containing selected options
|
||||
*_retval = selectedAccessibles;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
|
||||
// no options, not a select or none of the options are selected
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ----- nsXULListitemAccessible ----- */
|
||||
|
||||
/** Constructor */
|
||||
nsXULListitemAccessible::nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsXULMenuitemAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** Inherit the ISupports impl from nsAccessible, we handle nsIAccessibleSelectable */
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsXULListitemAccessible, nsXULMenuitemAccessible)
|
||||
|
||||
/**
|
||||
* If there is a Listcell as a child ( not anonymous ) use it, otherwise
|
||||
* default to getting the name from GetXULAccName
|
||||
*/
|
||||
NS_IMETHODIMP nsXULListitemAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
if (NS_SUCCEEDED(mDOMNode->GetFirstChild(getter_AddRefs(child)))) {
|
||||
nsCOMPtr<nsIDOMElement> childElement (do_QueryInterface(child));
|
||||
if (childElement) {
|
||||
nsAutoString tagName;
|
||||
childElement->GetLocalName(tagName);
|
||||
if (tagName.Equals(NS_LITERAL_STRING("listcell"))) {
|
||||
childElement->GetAttribute(NS_LITERAL_STRING("label"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GetXULAccName(_retval);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsXULListitemAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_LISTITEM;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsXULListitemAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// nsAccessible::GetAccState(_retval); // get focused state
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem (do_QueryInterface(mDOMNode));
|
||||
if (listItem) {
|
||||
PRBool isSelected;
|
||||
listItem->GetSelected(&isSelected);
|
||||
if (isSelected)
|
||||
*_retval |= STATE_SELECTED;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> domParent;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(domParent));
|
||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> parent(do_QueryInterface(domParent));
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> current;
|
||||
parent->GetCurrentItem(getter_AddRefs(current));
|
||||
if (listItem == current)
|
||||
*_retval |= STATE_FOCUSED;
|
||||
}
|
||||
|
||||
*_retval |= STATE_FOCUSABLE | STATE_SELECTABLE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/** ----- nsXULComboboxAccessible ----- */
|
||||
|
||||
/** Constructor */
|
||||
nsXULComboboxAccessible::nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
|
||||
nsComboboxAccessible(aDOMNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Our value is the value of our ( first ) selected child. nsIDOMXULSelectElement
|
||||
* returns this by default with GetValue().
|
||||
*/
|
||||
NS_IMETHODIMP nsXULComboboxAccessible::GetAccValue(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> select(do_QueryInterface(mDOMNode));
|
||||
if (select) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
|
||||
select->GetSelectedItem(getter_AddRefs(selectedItem));
|
||||
return selectedItem->GetValue(_retval);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Eric Vaughan (evaughan@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef __nsXULSelectAccessible_h__
|
||||
#define __nsXULSelectAccessible_h__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsSelectAccessible.h"
|
||||
#include "nsXULMenuAccessible.h"
|
||||
|
||||
/**
|
||||
* Selects, Listboxes and Comboboxes, are made up of a number of different
|
||||
* widgets, some of which are shared between the two. This file contains
|
||||
* all of the widgets for both of the Selects, for XUL only. Some of them
|
||||
* extend classes from nsSelectAccessible.cpp, which contains base classes
|
||||
* that are also extended by the XUL Select Accessibility support.
|
||||
*
|
||||
* Listbox:
|
||||
* - nsXULListboxAccessible
|
||||
* - nsXULSelectListAccessible
|
||||
* - nsXULSelectOptionAccessible
|
||||
*
|
||||
* Comboboxes:
|
||||
* - nsXULComboboxAccessible <menulist />
|
||||
* - nsHTMLTextFieldAccessible
|
||||
* - nsXULComboboxButtonAccessible
|
||||
* - nsXULSelectListAccessible <menupopup />
|
||||
* - nsXULSelectOptionAccessible(s) <menuitem />
|
||||
*/
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** First, the common widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* The list that contains all the options in the select.
|
||||
*/
|
||||
class nsXULSelectListAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsXULSelectListAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULSelectListAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
/*
|
||||
* Options inside the select, contained within the list
|
||||
*/
|
||||
class nsXULSelectOptionAccessible : public nsXULMenuitemAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsXULSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULSelectOptionAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
static nsresult GetFocusedOptionNode(nsIWeakReference *aPresShell, nsIDOMNode *aListNode, nsCOMPtr<nsIDOMNode>& aFocusedOptionNode);
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Secondly, the Listbox widget */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* A class the represents the XUL Listbox widget.
|
||||
*/
|
||||
class nsXULListboxAccessible : public nsListboxAccessible,
|
||||
public nsIAccessibleSelectable
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESELECTABLE
|
||||
|
||||
nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULListboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Listitems -- used in listboxes
|
||||
*/
|
||||
class nsXULListitemAccessible : public nsXULMenuitemAccessible
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULListitemAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
};
|
||||
|
||||
/** ------------------------------------------------------ */
|
||||
/** Finally, the Combobox widgets */
|
||||
/** ------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* A class the represents the XUL Combobox widget.
|
||||
*/
|
||||
class nsXULComboboxAccessible : public nsComboboxAccessible
|
||||
{
|
||||
public:
|
||||
|
||||
nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
|
||||
virtual ~nsXULComboboxAccessible() {}
|
||||
|
||||
/* ----- nsIAccessible ----- */
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,211 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsXULTabAccessible.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
|
||||
/**
|
||||
* XUL Tab
|
||||
*/
|
||||
|
||||
/** Constructor */
|
||||
nsXULTabAccessible::nsXULTabAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Might need to use the GetXULAccName method from nsFormControlAcc.cpp
|
||||
*/
|
||||
NS_IMETHODIMP nsXULTabAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> tab(do_QueryInterface(mDOMNode));
|
||||
if (tab)
|
||||
return GetXULAccName(_retval);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/** Only one action available */
|
||||
NS_IMETHODIMP nsXULTabAccessible::GetAccNumActions(PRUint8 *_retval)
|
||||
{
|
||||
*_retval = eSingle_Action;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Return the name of our only action */
|
||||
NS_IMETHODIMP nsXULTabAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("switch"), _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/** Tell the tab to do it's action */
|
||||
NS_IMETHODIMP nsXULTabAccessible::AccDoAction(PRUint8 index)
|
||||
{
|
||||
if (index == eAction_Switch) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> tab(do_QueryInterface(mDOMNode));
|
||||
if ( tab )
|
||||
{
|
||||
tab->DoCommand();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/** We are a tab */
|
||||
NS_IMETHODIMP nsXULTabAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PAGETAB;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible states: focused, focusable, unavailable(disabled), offscreen
|
||||
*/
|
||||
NS_IMETHODIMP nsXULTabAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// get focus and disable status from base class
|
||||
nsLeafAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL TabBox
|
||||
* to facilitate naming of the tabPanels object we will give this the name
|
||||
* of the selected tab in the tabs object.
|
||||
*/
|
||||
|
||||
/** Constructor */
|
||||
nsXULTabBoxAccessible::nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** We are a window*/
|
||||
NS_IMETHODIMP nsXULTabBoxAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_WINDOW;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** Possible states: normal */
|
||||
NS_IMETHODIMP nsXULTabBoxAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/** 2 children, tabs, tabpanels */
|
||||
NS_IMETHODIMP nsXULTabBoxAccessible::GetAccChildCount(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = 2;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL TabPanels
|
||||
* XXX jgaunt -- this has to report the info for the selected child, reachable through
|
||||
* the DOMNode. The TabPanels object has as its children the different
|
||||
* vbox/hbox/whatevers that provide what you look at when you click on
|
||||
* a tab.
|
||||
* Here is how this will work: when asked about an object the tabPanels object will find
|
||||
* out the selected child and create the tabPanel object using the child. That should wrap
|
||||
* any XUL/HTML content in the child, since it is a simple nsAccessible basically.
|
||||
* or maybe we just do that on creation. Not use the DOMnode we are given, but cache the selected
|
||||
* DOMnode and then run from there.
|
||||
*/
|
||||
|
||||
/** Constructor */
|
||||
nsXULTabPanelsAccessible::nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** We are a Property Page */
|
||||
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PROPERTYPAGE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible values: focused, focusable, unavailable
|
||||
*/
|
||||
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// get focus and disable status from base class -- skip container because we have state
|
||||
nsAccessible::GetAccState(_retval);
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name for the panel is the name from the tab associated with
|
||||
* the panel. XXX not sure if the "panels" object should have the
|
||||
* same name.
|
||||
*/
|
||||
NS_IMETHODIMP nsXULTabPanelsAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* XUL Tabs - the s really stands for strip. this is a collection of tab objects
|
||||
*/
|
||||
|
||||
/** Constructor */
|
||||
nsXULTabsAccessible::nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsContainerAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/** We are a Page Tab List */
|
||||
NS_IMETHODIMP nsXULTabsAccessible::GetAccRole(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = ROLE_PAGETABLIST;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsXULTabAccessible_H_
|
||||
#define _nsXULTabAccessible_H_
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
|
||||
/** An individual tab */
|
||||
class nsXULTabAccessible : public nsLeafAccessible
|
||||
{
|
||||
public:
|
||||
nsXULTabAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetAccActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
/**
|
||||
* Contains a tabs object and a tabPanels object. A complete
|
||||
* entity with relationships between tabs and content to
|
||||
* be displayed in the tabpanels object
|
||||
*/
|
||||
class nsXULTabBoxAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents the content area associated with the tabs object (when
|
||||
* used together)
|
||||
*/
|
||||
class nsXULTabPanelsAccessible : public nsAccessible
|
||||
{
|
||||
public:
|
||||
nsXULTabPanelsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMNode> mGParentDOMNode;
|
||||
nsCOMPtr<nsIDOMNode> mParentDOMNode;
|
||||
};
|
||||
|
||||
/** merely a container of tab obejcts */
|
||||
class nsXULTabsAccessible : public nsContainerAccessible
|
||||
{
|
||||
public:
|
||||
nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsIDOMXULDescriptionElement.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsXULTextAccessible.h"
|
||||
|
||||
/**
|
||||
* For XUL descriptions and labels
|
||||
*/
|
||||
nsXULTextAccessible::nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsTextAccessible(aDomNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
/* wstring getAccName (); */
|
||||
NS_IMETHODIMP nsXULTextAccessible::GetAccName(nsAString& _retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULDescriptionElement> descriptionElement(do_QueryInterface(mDOMNode));
|
||||
if (descriptionElement) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
return AppendFlatStringFromSubtree(content, &_retval);
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Author: John Gaunt (jgaunt@netscape.com)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsXULTextAccessible_H_
|
||||
#define _nsXULTextAccessible_H_
|
||||
|
||||
#include "nsFormControlAccessible.h"
|
||||
|
||||
class nsIWeakReference;
|
||||
|
||||
class nsXULTextAccessible : public nsTextAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetAccName(nsAString& _retval);
|
||||
};
|
||||
|
||||
#endif
|
||||
4
mozilla/aclocal.m4
vendored
4
mozilla/aclocal.m4
vendored
@@ -5,11 +5,9 @@ dnl
|
||||
|
||||
builtin(include, build/autoconf/glib.m4)dnl
|
||||
builtin(include, build/autoconf/gtk.m4)dnl
|
||||
builtin(include, build/autoconf/gdk-pixbuf.m4)dnl
|
||||
builtin(include, build/autoconf/libIDL.m4)dnl
|
||||
builtin(include, build/autoconf/nspr.m4)dnl
|
||||
builtin(include, build/autoconf/libart.m4)dnl
|
||||
builtin(include, build/autoconf/pkg.m4)dnl
|
||||
builtin(include, build/autoconf/freetype2.m4)dnl
|
||||
dnl
|
||||
define(MOZ_TOPSRCDIR,.)dnl MOZ_TOPSRCDIR is used in altoptions.m4
|
||||
builtin(include, build/autoconf/altoptions.m4)dnl
|
||||
|
||||
@@ -47,10 +47,11 @@ add_makefiles "
|
||||
Makefile
|
||||
build/Makefile
|
||||
build/unix/Makefile
|
||||
build/unix/mozilla-config
|
||||
config/Makefile
|
||||
config/autoconf.mk
|
||||
config/mkdepend/Makefile
|
||||
config/doxygen.cfg
|
||||
config/mkdetect/Makefile
|
||||
include/Makefile
|
||||
"
|
||||
|
||||
@@ -85,7 +86,6 @@ dom/public/idl/range/Makefile
|
||||
dom/public/idl/stylesheets/Makefile
|
||||
dom/public/idl/views/Makefile
|
||||
dom/public/idl/xbl/Makefile
|
||||
dom/public/idl/xpath/Makefile
|
||||
dom/public/idl/xul/Makefile
|
||||
dom/src/Makefile
|
||||
dom/src/base/Makefile
|
||||
@@ -96,6 +96,7 @@ dom/src/jsurl/Makefile
|
||||
|
||||
MAKEFILES_editor="
|
||||
editor/Makefile
|
||||
editor/base/Makefile
|
||||
editor/public/Makefile
|
||||
editor/idl/Makefile
|
||||
editor/txmgr/Makefile
|
||||
@@ -131,13 +132,14 @@ gfx/src/Makefile
|
||||
gfx/src/beos/Makefile
|
||||
gfx/src/gtk/Makefile
|
||||
gfx/src/ps/Makefile
|
||||
gfx/src/motif/Makefile
|
||||
gfx/src/photon/Makefile
|
||||
gfx/src/rhapsody/Makefile
|
||||
gfx/src/mac/Makefile
|
||||
gfx/src/qt/Makefile
|
||||
gfx/src/xlib/Makefile
|
||||
gfx/src/os2/Makefile
|
||||
gfx/src/xlibrgb/Makefile
|
||||
gfx/src/windows/Makefile
|
||||
gfx/tests/Makefile
|
||||
"
|
||||
|
||||
@@ -145,7 +147,6 @@ MAKEFILES_htmlparser="
|
||||
htmlparser/Makefile
|
||||
htmlparser/robot/Makefile
|
||||
htmlparser/robot/test/Makefile
|
||||
htmlparser/public/Makefile
|
||||
htmlparser/src/Makefile
|
||||
htmlparser/tests/Makefile
|
||||
htmlparser/tests/grabpage/Makefile
|
||||
@@ -176,7 +177,6 @@ intl/locale/idl/Makefile
|
||||
intl/locale/src/Makefile
|
||||
intl/locale/src/unix/Makefile
|
||||
intl/locale/src/os2/Makefile
|
||||
intl/locale/src/windows/Makefile
|
||||
intl/locale/tests/Makefile
|
||||
intl/lwbrk/Makefile
|
||||
intl/lwbrk/src/Makefile
|
||||
@@ -222,11 +222,6 @@ js/src/xpconnect/tools/idl/Makefile
|
||||
js/src/xpconnect/tools/idl/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_jsdebugger="
|
||||
js/jsd/Makefile
|
||||
js/jsd/idl/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_content="
|
||||
content/Makefile
|
||||
content/base/Makefile
|
||||
@@ -266,8 +261,7 @@ content/xbl/Makefile
|
||||
content/xbl/public/Makefile
|
||||
content/xbl/src/Makefile
|
||||
content/xbl/builtin/Makefile
|
||||
content/xbl/builtin/unix/Makefile
|
||||
content/xbl/builtin/win/Makefile
|
||||
content/xbl/builtin/os2/Makefile
|
||||
content/xsl/Makefile
|
||||
content/xsl/document/Makefile
|
||||
content/xsl/document/src/Makefile
|
||||
@@ -302,9 +296,9 @@ layout/xul/Makefile
|
||||
layout/xul/base/Makefile
|
||||
layout/xul/base/public/Makefile
|
||||
layout/xul/base/src/Makefile
|
||||
layout/xul/base/src/tree/Makefile
|
||||
layout/xul/base/src/tree/src/Makefile
|
||||
layout/xul/base/src/tree/public/Makefile
|
||||
layout/xul/base/src/outliner/Makefile
|
||||
layout/xul/base/src/outliner/src/Makefile
|
||||
layout/xul/base/src/outliner/public/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_mpfilelocprovider="
|
||||
@@ -315,6 +309,13 @@ modules/mpfilelocprovider/src/Makefile
|
||||
|
||||
MAKEFILES_libimg="
|
||||
modules/libimg/Makefile
|
||||
modules/libimg/public/Makefile
|
||||
modules/libimg/public_com/Makefile
|
||||
modules/libimg/src/Makefile
|
||||
modules/libimg/gifcom/Makefile
|
||||
modules/libimg/jpgcom/Makefile
|
||||
modules/libimg/pngcom/Makefile
|
||||
modules/libimg/mngcom/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_libjar="
|
||||
@@ -348,11 +349,11 @@ modules/oji/src/Makefile
|
||||
|
||||
MAKEFILES_plugin="
|
||||
modules/plugin/Makefile
|
||||
modules/plugin/base/src/Makefile
|
||||
modules/plugin/base/public/Makefile
|
||||
modules/plugin/samples/simple/Makefile
|
||||
modules/plugin/samples/SanePlugin/Makefile
|
||||
modules/plugin/samples/default/unix/Makefile
|
||||
modules/plugin/nglsrc/Makefile
|
||||
modules/plugin/public/Makefile
|
||||
modules/plugin/test/Makefile
|
||||
modules/plugin/SanePlugin/Makefile
|
||||
modules/plugin/default/unix/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_access_builtin="
|
||||
@@ -367,9 +368,12 @@ netwerk/base/public/Makefile
|
||||
netwerk/base/src/Makefile
|
||||
netwerk/build/Makefile
|
||||
netwerk/build2/Makefile
|
||||
netwerk/cache/build/Makefile
|
||||
netwerk/cache/filecache/Makefile
|
||||
netwerk/cache/Makefile
|
||||
netwerk/cache/memcache/Makefile
|
||||
netwerk/cache/mgr/Makefile
|
||||
netwerk/cache/public/Makefile
|
||||
netwerk/cache/src/Makefile
|
||||
netwerk/dns/Makefile
|
||||
netwerk/dns/public/Makefile
|
||||
netwerk/dns/src/Makefile
|
||||
@@ -464,6 +468,8 @@ rdf/datasource/Makefile
|
||||
rdf/datasource/public/Makefile
|
||||
rdf/datasource/src/Makefile
|
||||
rdf/tests/Makefile
|
||||
rdf/tests/domds/Makefile
|
||||
rdf/tests/domds/resources/Makefile
|
||||
rdf/tests/localfile/Makefile
|
||||
rdf/tests/rdfsink/Makefile
|
||||
rdf/tests/rdfcat/Makefile
|
||||
@@ -499,13 +505,16 @@ docshell/build/Makefile
|
||||
MAKEFILES_webshell="
|
||||
webshell/Makefile
|
||||
webshell/public/Makefile
|
||||
webshell/src/Makefile
|
||||
webshell/tests/Makefile
|
||||
webshell/tests/viewer/Makefile
|
||||
webshell/tests/viewer/public/Makefile
|
||||
webshell/tests/viewer/unix/Makefile
|
||||
webshell/tests/viewer/unix/gtk/Makefile
|
||||
webshell/tests/viewer/unix/motif/Makefile
|
||||
webshell/tests/viewer/unix/qt/Makefile
|
||||
webshell/tests/viewer/unix/xlib/Makefile
|
||||
webshell/embed/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_widget="
|
||||
@@ -517,20 +526,34 @@ widget/src/build/Makefile
|
||||
widget/src/gtk/Makefile
|
||||
widget/src/gtksuperwin/Makefile
|
||||
widget/src/gtkxtbin/Makefile
|
||||
widget/src/motif/Makefile
|
||||
widget/src/motif/app_context/Makefile
|
||||
widget/src/photon/Makefile
|
||||
widget/src/rhapsody/Makefile
|
||||
widget/src/mac/Makefile
|
||||
widget/src/cocoa/Makefile
|
||||
widget/src/xlib/Makefile
|
||||
widget/src/os2/Makefile
|
||||
widget/src/os2/res/Makefile
|
||||
widget/src/os2/tests/Makefile
|
||||
widget/src/qt/Makefile
|
||||
widget/src/windows/Makefile
|
||||
widget/src/windows/expose/Makefile
|
||||
widget/src/windows/expose/ISimpleDOMNode/Makefile
|
||||
widget/src/windows/expose/ISimpleDOMDocument/Makefile
|
||||
widget/src/xlibxtbin/Makefile
|
||||
widget/src/xlib/window_service/Makefile
|
||||
widget/src/xpwidgets/Makefile
|
||||
widget/src/support/Makefile
|
||||
widget/tests/Makefile
|
||||
widget/tests/scribble/Makefile
|
||||
widget/tests/widget/Makefile
|
||||
widget/timer/Makefile
|
||||
widget/timer/public/Makefile
|
||||
widget/timer/src/Makefile
|
||||
widget/timer/src/beos/Makefile
|
||||
widget/timer/src/rhapsody/Makefile
|
||||
widget/timer/src/unix/Makefile
|
||||
widget/timer/src/unix/gtk/Makefile
|
||||
widget/timer/src/unix/motif/Makefile
|
||||
widget/timer/src/unix/photon/Makefile
|
||||
widget/timer/src/unix/xlib/Makefile
|
||||
widget/timer/src/unix/qt/Makefile
|
||||
widget/timer/src/os2/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_xpcom="
|
||||
@@ -543,8 +566,6 @@ xpcom/base/Makefile
|
||||
xpcom/build/Makefile
|
||||
xpcom/components/Makefile
|
||||
xpcom/ds/Makefile
|
||||
xpcom/glue/Makefile
|
||||
xpcom/glue/standalone/Makefile
|
||||
xpcom/io/Makefile
|
||||
xpcom/typelib/Makefile
|
||||
xpcom/reflect/Makefile
|
||||
@@ -561,7 +582,6 @@ xpcom/reflect/xptcall/src/md/Makefile
|
||||
xpcom/reflect/xptcall/src/md/os2/Makefile
|
||||
xpcom/reflect/xptcall/src/md/test/Makefile
|
||||
xpcom/reflect/xptcall/src/md/unix/Makefile
|
||||
xpcom/reflect/xptcall/src/md/win32/Makefile
|
||||
xpcom/reflect/xptcall/tests/Makefile
|
||||
xpcom/reflect/xptinfo/Makefile
|
||||
xpcom/reflect/xptinfo/public/Makefile
|
||||
@@ -575,22 +595,17 @@ xpcom/sample/Makefile
|
||||
xpcom/threads/Makefile
|
||||
xpcom/tools/Makefile
|
||||
xpcom/tools/registry/Makefile
|
||||
xpcom/tools/windows/Makefile
|
||||
xpcom/windbgdlg/Makefile
|
||||
|
||||
$MAKEFILES_libreg
|
||||
$MAKEFILES_libjar
|
||||
intl/unicharutil/public/Makefile
|
||||
intl/uconv/public/Makefile
|
||||
netwerk/base/public/Makefile
|
||||
netwerk/build/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_xpcom_tests="
|
||||
xpcom/tests/Makefile
|
||||
xpcom/tests/dynamic/Makefile
|
||||
xpcom/tests/services/Makefile
|
||||
xpcom/tests/windows/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_string="$MAKEFILES_xpcom"
|
||||
@@ -606,14 +621,6 @@ xpinstall/wizard/libxpnet/Makefile
|
||||
xpinstall/wizard/libxpnet/src/Makefile
|
||||
xpinstall/wizard/libxpnet/test/Makefile
|
||||
xpinstall/wizard/unix/src2/Makefile
|
||||
xpinstall/wizard/windows/nsinstall/Makefile
|
||||
xpinstall/wizard/windows/nsztool/Makefile
|
||||
xpinstall/wizard/windows/uninstall/Makefile
|
||||
xpinstall/wizard/windows/setup/Makefile
|
||||
xpinstall/wizard/windows/setuprsc/Makefile
|
||||
xpinstall/wizard/windows/ren8dot3/Makefile
|
||||
xpinstall/wizard/windows/ds32/Makefile
|
||||
xpinstall/wizard/windows/GetShortPathName/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_xpfe="
|
||||
@@ -624,6 +631,7 @@ xpfe/browser/src/Makefile
|
||||
xpfe/browser/samples/Makefile
|
||||
xpfe/browser/samples/sampleimages/Makefile
|
||||
xpfe/components/Makefile
|
||||
xpfe/components/public/Makefile
|
||||
xpfe/components/shistory/Makefile
|
||||
xpfe/components/shistory/public/Makefile
|
||||
xpfe/components/shistory/src/Makefile
|
||||
@@ -631,18 +639,14 @@ xpfe/components/bookmarks/Makefile
|
||||
xpfe/components/bookmarks/public/Makefile
|
||||
xpfe/components/bookmarks/src/Makefile
|
||||
xpfe/components/directory/Makefile
|
||||
xpfe/components/download-manager/Makefile
|
||||
xpfe/components/download-manager/src/Makefile
|
||||
xpfe/components/download-manager/public/Makefile
|
||||
xpfe/components/timebomb/Makefile
|
||||
xpfe/components/timebomb/tools/Makefile
|
||||
xpfe/components/regviewer/Makefile
|
||||
xpfe/components/find/Makefile
|
||||
xpfe/components/find/public/Makefile
|
||||
xpfe/components/find/src/Makefile
|
||||
xpfe/components/filepicker/Makefile
|
||||
xpfe/components/filepicker/public/Makefile
|
||||
xpfe/components/filepicker/src/Makefile
|
||||
xpfe/components/filepicker/Makefile
|
||||
xpfe/components/history/Makefile
|
||||
xpfe/components/history/src/Makefile
|
||||
xpfe/components/history/public/Makefile
|
||||
@@ -650,7 +654,6 @@ xpfe/components/prefwindow/Makefile
|
||||
xpfe/components/prefwindow/resources/Makefile
|
||||
xpfe/components/prefwindow/resources/content/Makefile
|
||||
xpfe/components/prefwindow/resources/content/unix/Makefile
|
||||
xpfe/components/prefwindow/resources/content/win/Makefile
|
||||
xpfe/components/prefwindow/resources/locale/Makefile
|
||||
xpfe/components/prefwindow/resources/locale/en-US/Makefile
|
||||
xpfe/components/prefwindow/resources/locale/en-US/unix/Makefile
|
||||
@@ -671,21 +674,16 @@ xpfe/components/xfer/src/Makefile
|
||||
xpfe/components/ucth/Makefile
|
||||
xpfe/components/ucth/public/Makefile
|
||||
xpfe/components/ucth/src/Makefile
|
||||
xpfe/components/remote/Makefile
|
||||
xpfe/components/remote/public/Makefile
|
||||
xpfe/components/remote/src/Makefile
|
||||
xpfe/components/autocomplete/Makefile
|
||||
xpfe/components/autocomplete/public/Makefile
|
||||
xpfe/components/autocomplete/resources/Makefile
|
||||
xpfe/components/autocomplete/resources/content/Makefile
|
||||
xpfe/components/autocomplete/src/Makefile
|
||||
xpfe/components/urlbarhistory/Makefile
|
||||
xpfe/components/urlbarhistory/public/Makefile
|
||||
xpfe/components/urlbarhistory/src/Makefile
|
||||
xpfe/components/urlwidget/Makefile
|
||||
xpfe/components/winhooks/Makefile
|
||||
xpfe/components/alerts/Makefile
|
||||
xpfe/components/alerts/public/Makefile
|
||||
xpfe/components/alerts/src/Makefile
|
||||
xpfe/components/console/Makefile
|
||||
xpfe/components/resetPref/Makefile
|
||||
xpfe/components/build/Makefile
|
||||
xpfe/appshell/Makefile
|
||||
xpfe/appshell/src/Makefile
|
||||
@@ -696,7 +694,7 @@ xpfe/browser/src/Makefile
|
||||
xpfe/browser/resources/Makefile
|
||||
xpfe/browser/resources/content/Makefile
|
||||
xpfe/browser/resources/content/unix/Makefile
|
||||
xpfe/browser/resources/content/win/Makefile
|
||||
xpfe/browser/resources/content/os2/Makefile
|
||||
xpfe/browser/resources/locale/Makefile
|
||||
xpfe/browser/resources/locale/en-US/Makefile
|
||||
xpfe/browser/resources/locale/en-US/unix/Makefile
|
||||
@@ -716,17 +714,13 @@ xpfe/communicator/resources/Makefile
|
||||
xpfe/communicator/resources/locale/Makefile
|
||||
xpfe/communicator/resources/locale/en-US/Makefile
|
||||
xpfe/communicator/resources/content/Makefile
|
||||
xpfe/communicator/resources/content/unix/Makefile
|
||||
xpfe/communicator/resources/content/win/Makefile
|
||||
xpfe/communicator/resources/content/os2/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_embedding="
|
||||
embedding/Makefile
|
||||
embedding/base/Makefile
|
||||
embedding/browser/Makefile
|
||||
embedding/browser/activex/src/Makefile
|
||||
embedding/browser/activex/src/control/Makefile
|
||||
embedding/browser/activex/src/control_kicker/Makefile
|
||||
embedding/browser/build/Makefile
|
||||
embedding/browser/chrome/Makefile
|
||||
embedding/browser/webBrowser/Makefile
|
||||
@@ -743,19 +737,12 @@ embedding/components/windowwatcher/public/Makefile
|
||||
embedding/components/windowwatcher/src/Makefile
|
||||
embedding/components/ui/Makefile
|
||||
embedding/components/ui/helperAppDlg/Makefile
|
||||
embedding/components/ui/progressDlg/Makefile
|
||||
embedding/config/Makefile
|
||||
embedding/tests/Makefile
|
||||
embedding/tests/winEmbed/Makefile
|
||||
embedding/tests/mfcembed/Makefile
|
||||
embedding/tests/mfcembed/components/Makefile
|
||||
embedding/tests/gtkEmbed/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_psm2="
|
||||
security/manager/Makefile
|
||||
security/manager/boot/Makefile
|
||||
security/manager/boot/src/Makefile
|
||||
security/manager/boot/public/Makefile
|
||||
security/manager/ssl/Makefile
|
||||
security/manager/ssl/src/Makefile
|
||||
security/manager/ssl/resources/Makefile
|
||||
@@ -787,15 +774,61 @@ content/base/public/Makefile
|
||||
intl/locale/public/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_security="
|
||||
security/Makefile
|
||||
security/psm/Makefile
|
||||
security/psm/lib/Makefile
|
||||
security/psm/lib/client/Makefile
|
||||
security/psm/lib/protocol/Makefile
|
||||
|
||||
intl/strres/public/Makefile
|
||||
intl/locale/idl/Makefile
|
||||
intl/locale/public/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_psm_glue="
|
||||
extensions/psm-glue/public/Makefile
|
||||
extensions/psm-glue/Makefile
|
||||
extensions/psm-glue/src/Makefile
|
||||
netwerk/base/public/Makefile
|
||||
netwerk/build/Makefile
|
||||
netwerk/socket/base/Makefile
|
||||
dom/public/Makefile
|
||||
uriloader/base/Makefile
|
||||
modules/libpref/public/Makefile
|
||||
profile/public/Makefile
|
||||
caps/idl/Makefile
|
||||
caps/include/Makefile
|
||||
netwerk/protocol/http/public/Makefile
|
||||
widget/public/Makefile
|
||||
rdf/base/idl/Makefile
|
||||
xpfe/appshell/public/Makefile
|
||||
gfx/idl/Makefile
|
||||
gfx/public/Makefile
|
||||
docshell/base/Makefile
|
||||
layout/html/forms/public/Makefile
|
||||
layout/base/public/Makefile
|
||||
content/base/public/Makefile
|
||||
dom/src/base/Makefile
|
||||
modules/oji/public/Makefile
|
||||
gfx2/public/Makefile
|
||||
embedding/components/windowwatcher/public/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_inspector="
|
||||
extensions/inspector/Makefile
|
||||
extensions/inspector/base/Makefile
|
||||
extensions/inspector/base/public/Makefile
|
||||
extensions/inspector/base/Makefile
|
||||
extensions/inspector/base/src/Makefile
|
||||
extensions/inspector/base/src/win/Makefile
|
||||
extensions/inspector/build/Makefile
|
||||
extensions/inspector/Makefile
|
||||
extensions/inspector/build/src/Makefile
|
||||
extensions/inspector/build/Makefile
|
||||
extensions/inspector/resources/content/Makefile
|
||||
extensions/inspector/resources/Makefile
|
||||
extensions/inspector/resources/locale/en-US/Makefile
|
||||
extensions/inspector/resources/locale/Makefile
|
||||
extensions/inspector/resources/skin/classic/Makefile
|
||||
extensions/inspector/resources/skin/Makefile
|
||||
extensions/inspector/resources/skin/modern/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_transformiix="
|
||||
@@ -806,6 +839,8 @@ extensions/transformiix/source/xml/dom/standalone/Makefile
|
||||
extensions/transformiix/source/xml/dom/Makefile
|
||||
extensions/transformiix/source/xml/dom/mozImpl/Makefile
|
||||
extensions/transformiix/source/xml/parser/Makefile
|
||||
extensions/transformiix/source/xml/printer/Makefile
|
||||
extensions/transformiix/source/xml/util/Makefile
|
||||
extensions/transformiix/source/xml/Makefile
|
||||
extensions/transformiix/source/xpath/Makefile
|
||||
extensions/transformiix/source/xslt/functions/Makefile
|
||||
@@ -815,12 +850,6 @@ extensions/transformiix/source/Makefile
|
||||
extensions/transformiix/Makefile
|
||||
"
|
||||
|
||||
if [ "$MACOSX" ]; then
|
||||
MAKEFILES_macmorefiles="
|
||||
lib/mac/MoreFiles/Makefile
|
||||
"
|
||||
fi
|
||||
|
||||
if [ "$MOZ_MAIL_NEWS" ]; then
|
||||
if [ -f ${srcdir}/mailnews/makefiles ]; then
|
||||
MAKEFILES_mailnews=`cat ${srcdir}/mailnews/makefiles`
|
||||
@@ -828,6 +857,7 @@ if [ "$MOZ_MAIL_NEWS" ]; then
|
||||
fi
|
||||
|
||||
|
||||
if [ "$USE_IMG2" ]; then
|
||||
MAKEFILES_libpr0n="
|
||||
modules/libpr0n/Makefile
|
||||
modules/libpr0n/public/Makefile
|
||||
@@ -837,11 +867,6 @@ fi
|
||||
modules/libpr0n/decoders/png/Makefile
|
||||
modules/libpr0n/decoders/ppm/Makefile
|
||||
modules/libpr0n/decoders/jpeg/Makefile
|
||||
modules/libpr0n/decoders/bmp/Makefile
|
||||
modules/libpr0n/decoders/mng/Makefile
|
||||
modules/libpr0n/decoders/icon/Makefile
|
||||
modules/libpr0n/decoders/icon/win/Makefile
|
||||
modules/libpr0n/decoders/xbm/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_gfx2="
|
||||
@@ -854,11 +879,10 @@ fi
|
||||
accessible/Makefile
|
||||
accessible/public/Makefile
|
||||
accessible/src/Makefile
|
||||
accessible/src/base/Makefile
|
||||
accessible/src/html/Makefile
|
||||
accessible/src/xul/Makefile
|
||||
accessible/build/Makefile
|
||||
"
|
||||
fi
|
||||
|
||||
if [ ! "$SYSTEM_JPEG" ]; then
|
||||
MAKEFILES_jpeg="jpeg/Makefile"
|
||||
fi
|
||||
@@ -934,8 +958,7 @@ fi
|
||||
|
||||
# tools/jprof
|
||||
if [ "$MOZ_JPROF" ]; then
|
||||
MAKEFILES_jprof="tools/jprof/Makefile
|
||||
tools/jprof/stub/Makefile"
|
||||
MAKEFILES_jprof="tools/jprof/Makefile"
|
||||
fi
|
||||
|
||||
# tools/leaky
|
||||
@@ -943,16 +966,8 @@ if [ "$MOZ_LEAKY" ]; then
|
||||
MAKEFILES_leaky="tools/leaky/Makefile"
|
||||
fi
|
||||
|
||||
# tools/trace-malloc
|
||||
if [ "$NS_TRACE_MALLOC" ]; then
|
||||
MAKEFILES_tracemalloc="tools/trace-malloc/Makefile"
|
||||
fi
|
||||
|
||||
# MathML
|
||||
# layout/mathml
|
||||
if [ "$MOZ_MATHML" ]; then
|
||||
MAKEFILES_intl="$MAKEFILES_intl
|
||||
intl/uconv/ucvmath/Makefile
|
||||
"
|
||||
MAKEFILES_layout="$MAKEFILES_layout
|
||||
layout/mathml/Makefile
|
||||
layout/mathml/base/Makefile
|
||||
@@ -962,37 +977,15 @@ if [ "$MOZ_MATHML" ]; then
|
||||
"
|
||||
fi
|
||||
|
||||
#libart
|
||||
if [ "$MOZ_INTERNAL_LIBART_LGPL" ]; then
|
||||
MAKEFILES_libart="other-licenses/libart_lgpl/Makefile"
|
||||
fi
|
||||
|
||||
# svg
|
||||
# layout/svg
|
||||
if [ "$MOZ_SVG" ]; then
|
||||
MAKEFILES_content="$MAKEFILES_content
|
||||
content/svg/Makefile
|
||||
content/svg/document/Makefile
|
||||
content/svg/document/src/Makefile
|
||||
content/svg/content/Makefile
|
||||
content/svg/content/src/Makefile
|
||||
"
|
||||
MAKEFILES_dom="$MAKEFILES_dom
|
||||
dom/public/idl/svg/Makefile
|
||||
"
|
||||
MAKEFILES_layout="$MAKEFILES_layout
|
||||
layout/svg/Makefile
|
||||
layout/svg/base/Makefile
|
||||
layout/svg/base/public/Makefile
|
||||
layout/svg/base/src/Makefile
|
||||
"
|
||||
fi
|
||||
|
||||
if [ "$MOZ_ENABLE_XFT" ]; then
|
||||
MAKEFILES_xft="other-licenses/Xft/Makefile
|
||||
other-licenses/Xft/Xft/Makefile
|
||||
other-licenses/Xft/Xrender/Makefile
|
||||
other-licenses/Xft/fontconfig/Makefile
|
||||
other-licenses/Xft/fontconfig/fontconfig/Makefile
|
||||
other-licenses/Xft/fontconfig/src/Makefile
|
||||
layout/svg/content/Makefile
|
||||
layout/svg/content/src/Makefile
|
||||
"
|
||||
fi
|
||||
|
||||
@@ -1008,7 +1001,7 @@ fi
|
||||
|
||||
# modules/staticmod
|
||||
|
||||
if [ "$MOZ_STATIC_COMPONENTS" -o "$MOZ_META_COMPONENTS" ]; then
|
||||
if [ "$MOZ_STATIC_COMPONENTS" ]; then
|
||||
MAKEFILES_static_components="$MAKEFILES_static_components
|
||||
modules/staticmod/Makefile
|
||||
"
|
||||
@@ -1016,118 +1009,64 @@ fi
|
||||
|
||||
for extension in $MOZ_EXTENSIONS; do
|
||||
case "$extension" in
|
||||
access-builtin ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/access-builtin/Makefile
|
||||
extensions/access-builtin/accessproxy/Makefile
|
||||
" ;;
|
||||
content-packs ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/content-packs/Makefile
|
||||
extensions/content-packs/resources/Makefile
|
||||
" ;;
|
||||
cookie ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/cookie/Makefile
|
||||
extensions/cookie/tests/Makefile
|
||||
extensions/cookie/Makefile
|
||||
extensions/cookie/tests/Makefile
|
||||
" ;;
|
||||
ctl ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/ctl/Makefile
|
||||
extensions/ctl/public/Makefile
|
||||
extensions/ctl/src/Makefile
|
||||
extensions/ctl/src/pangoLite/Makefile
|
||||
extensions/ctl/src/thaiShaper/Makefile
|
||||
" ;;
|
||||
cview ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/cview/Makefile
|
||||
extensions/cview/resources/Makefile
|
||||
" ;;
|
||||
help ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/help/Makefile
|
||||
extensions/help/resources/Makefile
|
||||
" ;;
|
||||
inspector ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
$MAKEFILES_inspector"
|
||||
;;
|
||||
irc ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/irc/Makefile
|
||||
extensions/irc/Makefile
|
||||
" ;;
|
||||
p3p ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/p3p/Makefile
|
||||
extensions/p3p/public/Makefile
|
||||
extensions/p3p/src/Makefile
|
||||
" ;;
|
||||
pics ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/pics/Makefile
|
||||
extensions/pics/public/Makefile
|
||||
extensions/pics/src/Makefile
|
||||
extensions/pics/tests/Makefile
|
||||
" ;;
|
||||
pref ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/pref/Makefile
|
||||
extensions/pref/autoconfig/Makefile
|
||||
extensions/pref/autoconfig/public/Makefile
|
||||
extensions/pref/autoconfig/src/Makefile
|
||||
extensions/pref/autoconfig/resources/Makefile
|
||||
" ;;
|
||||
transformiix ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
$MAKEFILES_transformiix"
|
||||
;;
|
||||
universalchardet ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/universalchardet/Makefile
|
||||
extensions/universalchardet/src/Makefile
|
||||
extensions/universalchardet/tests/Makefile
|
||||
" ;;
|
||||
venkman ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/venkman/Makefile"
|
||||
;;
|
||||
transformiix ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
$MAKEFILES_transformiix"
|
||||
;;
|
||||
wallet ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/wallet/Makefile
|
||||
extensions/wallet/public/Makefile
|
||||
extensions/wallet/src/Makefile
|
||||
extensions/wallet/editor/Makefile
|
||||
extensions/wallet/cookieviewer/Makefile
|
||||
extensions/wallet/signonviewer/Makefile
|
||||
extensions/wallet/walletpreview/Makefile
|
||||
extensions/wallet/build/Makefile
|
||||
extensions/wallet/Makefile
|
||||
extensions/wallet/public/Makefile
|
||||
extensions/wallet/src/Makefile
|
||||
extensions/wallet/editor/Makefile
|
||||
extensions/wallet/cookieviewer/Makefile
|
||||
extensions/wallet/signonviewer/Makefile
|
||||
extensions/wallet/walletpreview/Makefile
|
||||
extensions/wallet/build/Makefile
|
||||
" ;;
|
||||
access-builtin ) MAKEFILES_access_builtin="$MAKEFILES_extensions
|
||||
extensions/access-builtin/Makefile
|
||||
extensions/access-builtin/accessproxy/Makefile
|
||||
" ;;
|
||||
xmlextras ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/xmlextras/Makefile
|
||||
extensions/xmlextras/base/Makefile
|
||||
extensions/xmlextras/base/src/Makefile
|
||||
extensions/xmlextras/base/public/Makefile
|
||||
extensions/xmlextras/build/Makefile
|
||||
extensions/xmlextras/build/src/Makefile
|
||||
extensions/xmlextras/proxy/Makefile
|
||||
extensions/xmlextras/proxy/public/Makefile
|
||||
extensions/xmlextras/proxy/src/Makefile
|
||||
extensions/xmlextras/schema/Makefile
|
||||
extensions/xmlextras/schema/public/Makefile
|
||||
extensions/xmlextras/schema/src/Makefile
|
||||
extensions/xmlextras/soap/Makefile
|
||||
extensions/xmlextras/soap/public/Makefile
|
||||
extensions/xmlextras/soap/src/Makefile
|
||||
extensions/xmlextras/tests/Makefile
|
||||
extensions/xmlextras/wsdl/Makefile
|
||||
extensions/xmlextras/wsdl/public/Makefile
|
||||
extensions/xmlextras/wsdl/src/Makefile
|
||||
" ;;
|
||||
xml-rpc ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/xml-rpc/Makefile
|
||||
extensions/xml-rpc/idl/Makefile
|
||||
extensions/xml-rpc/src/Makefile
|
||||
extensions/xmlextras/Makefile
|
||||
extensions/xmlextras/base/Makefile
|
||||
extensions/xmlextras/base/src/Makefile
|
||||
extensions/xmlextras/base/public/Makefile
|
||||
extensions/xmlextras/build/Makefile
|
||||
extensions/xmlextras/build/src/Makefile
|
||||
extensions/xmlextras/soap/Makefile
|
||||
extensions/xmlextras/soap/public/Makefile
|
||||
extensions/xmlextras/soap/src/Makefile
|
||||
extensions/xmlextras/tests/Makefile
|
||||
" ;;
|
||||
xmlterm ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/xmlterm/Makefile
|
||||
extensions/xmlterm/base/Makefile
|
||||
extensions/xmlterm/geckoterm/Makefile
|
||||
extensions/xmlterm/linetest/Makefile
|
||||
extensions/xmlterm/scripts/Makefile
|
||||
extensions/xmlterm/tests/Makefile
|
||||
extensions/xmlterm/ui/Makefile
|
||||
extensions/xmlterm/Makefile
|
||||
extensions/xmlterm/base/Makefile
|
||||
extensions/xmlterm/geckoterm/Makefile
|
||||
extensions/xmlterm/linetest/Makefile
|
||||
extensions/xmlterm/scripts/Makefile
|
||||
extensions/xmlterm/tests/Makefile
|
||||
extensions/xmlterm/ui/Makefile
|
||||
" ;;
|
||||
interfaceinfo ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/interfaceinfo/Makefile
|
||||
extensions/interfaceinfo/public/Makefile
|
||||
extensions/interfaceinfo/src/Makefile
|
||||
xml-rpc ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/xml-rpc/Makefile
|
||||
extensions/xml-rpc/idl/Makefile
|
||||
extensions/xml-rpc/src/Makefile
|
||||
" ;;
|
||||
inspector ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
$MAKEFILES_inspector"
|
||||
;;
|
||||
help ) MAKEFILES_extensions="$MAKEFILES_extensions
|
||||
extensions/help/resources/Makefile
|
||||
extensions/help/Makefile
|
||||
" ;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -1139,12 +1078,6 @@ if [ "$BUILD_MODULES" = "all" ]; then
|
||||
|
||||
MAKEFILES_themes=`cat ${srcdir}/themes/makefiles`
|
||||
|
||||
MAKEFILES_calendar="
|
||||
calendar/Makefile
|
||||
calendar/libxpical/Makefile
|
||||
calendar/resources/Makefile
|
||||
"
|
||||
|
||||
add_makefiles "
|
||||
$MAKEFILES_caps
|
||||
$MAKEFILES_db
|
||||
@@ -1167,23 +1100,20 @@ $MAKEFILES_leaky
|
||||
$MAKEFILES_jpeg
|
||||
$MAKEFILES_jprof
|
||||
$MAKEFILES_js
|
||||
$MAKEFILES_jsdebugger
|
||||
$MAKEFILES_l10n
|
||||
$MAKEFILES_l10n_lang
|
||||
$MAKEFILES_langpacks
|
||||
$MAKEFILES_content
|
||||
$MAKEFILES_layout
|
||||
$MAKEFILES_libart
|
||||
$MAKEFILES_libreg
|
||||
$MAKEFILES_libimg
|
||||
$MAKEFILES_libpr0n
|
||||
$MAKEFILES_libjar
|
||||
$MAKEFILES_libpref
|
||||
$MAKEFILES_libutil
|
||||
$MAKEFILES_liveconnect
|
||||
$MAKEFILES_macmorefiles
|
||||
$MAKEFILES_mailnews
|
||||
$MAKEFILES_mpfilelocprovider
|
||||
$MAKEFILES_liveconnect
|
||||
$MAKEFILES_mailnews
|
||||
$MAKEFILES_oji
|
||||
$MAKEFILES_plugin
|
||||
$MAKEFILES_netwerk
|
||||
@@ -1192,12 +1122,10 @@ $MAKEFILES_rdf
|
||||
$MAKEFILES_static_components
|
||||
$MAKEFILES_sun_java
|
||||
$MAKEFILES_themes
|
||||
$MAKEFILES_tracemalloc
|
||||
$MAKEFILES_uriloader
|
||||
$MAKEFILES_view
|
||||
$MAKEFILES_webshell
|
||||
$MAKEFILES_widget
|
||||
$MAKEFILES_xft
|
||||
$MAKEFILES_xpcom
|
||||
$MAKEFILES_xpcom_tests
|
||||
$MAKEFILES_xpconnect
|
||||
@@ -1206,14 +1134,6 @@ $MAKEFILES_xpfe
|
||||
$MAKEFILES_zlib
|
||||
"
|
||||
|
||||
if test -n "$MOZ_PSM"; then
|
||||
add_makefiles "$MAKEFILES_psm2"
|
||||
fi
|
||||
|
||||
if test -n "$MOZ_CALENDAR"; then
|
||||
add_makefiles "$MAKEFILES_calendar"
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
# Standalone modules go here
|
||||
@@ -1226,6 +1146,8 @@ else
|
||||
necko) add_makefiles "
|
||||
$MAKEFILES_netwerk $MAKEFILES_dbm $MAKEFILES_xpcom"
|
||||
;;
|
||||
psm) add_makefiles "$MAKEFILES_dbm $MAKEFILES_xpcom $MAKEFILES_security $MAKEFILES_js $MAKEFILES_psm_glue"
|
||||
;;
|
||||
psm2) add_makefiles "$MAKEFILES_dbm $MAKEFILES_js $MAKEFILES_xpcom $MAKEFILES_psm2"
|
||||
;;
|
||||
string) add_makefiles "$MAKEFILES_string"
|
||||
|
||||
@@ -27,13 +27,16 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifeq (,$(filter WINNT OS2,$(OS_ARCH)))
|
||||
ifneq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
DIRS = unix
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Install bloaturls.txt file for tinderbox Bloaty test.
|
||||
libs:: bloaturls.txt
|
||||
install:: $(srcdir)/bloaturls.txt
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
# Install startup.html, startup test page.
|
||||
install:: $(srcdir)/startup-test.html
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
@@ -99,7 +99,7 @@ if ($ARGV[0] =~ /^--srcdir=/) {
|
||||
# from files listed on the command-line.
|
||||
#
|
||||
@makefiles=();
|
||||
push @makefiles, split while (<STDIN>);
|
||||
push @makefiles, split while (<>);
|
||||
|
||||
# Create all the directories at once.
|
||||
# This can be much faster than calling mkdir() for each one.
|
||||
|
||||
@@ -38,28 +38,28 @@ dnl MOZ_CHECK_PTHREADS( NAME, IF-YES [, ELSE ])
|
||||
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
|
||||
|
||||
|
||||
dnl MOZ_TWO_STRING_TEST(NAME, VAL, STR1, IF-STR1, STR2, IF-STR2 [, ELSE])
|
||||
dnl MOZ_TWO_STRING_TEST(NAME, STR1, IF-STR1, STR2, IF-STR2 [, ELSE])
|
||||
AC_DEFUN(MOZ_TWO_STRING_TEST,
|
||||
[if test "[$2]" = "[$3]"; then
|
||||
ifelse([$4], , :, [$4])
|
||||
elif test "[$2]" = "[$5]"; then
|
||||
ifelse([$6], , :, [$6])
|
||||
[if test "$enableval" = "[$2]"; then
|
||||
ifelse([$3], , :, [$3])
|
||||
elif test "$enableval" = "[$4]"; then
|
||||
ifelse([$5], , :, [$5])
|
||||
else
|
||||
ifelse([$7], ,
|
||||
[AC_MSG_ERROR([Option, [$1], does not take an argument ([$2]).])],
|
||||
[$7])
|
||||
ifelse([$6], ,
|
||||
[AC_MSG_ERROR([Option, [$1], does not take an argument ($enableval).])],
|
||||
[$6])
|
||||
fi])
|
||||
|
||||
dnl MOZ_ARG_ENABLE_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE]])
|
||||
AC_DEFUN(MOZ_ARG_ENABLE_BOOL,
|
||||
[AC_ARG_ENABLE([$1], [$2],
|
||||
[MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4])],
|
||||
[MOZ_TWO_STRING_TEST([$1], yes, [$3], no, [$4])],
|
||||
[$5])])
|
||||
|
||||
dnl MOZ_ARG_DISABLE_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE]])
|
||||
AC_DEFUN(MOZ_ARG_DISABLE_BOOL,
|
||||
[AC_ARG_ENABLE([$1], [$2],
|
||||
[MOZ_TWO_STRING_TEST([$1], [$enableval], no, [$3], yes, [$4])],
|
||||
[MOZ_TWO_STRING_TEST([$1], no, [$3], yes, [$4])],
|
||||
[$5])])
|
||||
|
||||
dnl MOZ_ARG_ENABLE_STRING(NAME, HELP, IF-SET [, ELSE])
|
||||
@@ -73,19 +73,19 @@ AC_DEFUN(MOZ_ARG_ENABLE_BOOL_OR_STRING,
|
||||
])
|
||||
m4exit(1)],
|
||||
[AC_ARG_ENABLE([$1], [$2],
|
||||
[MOZ_TWO_STRING_TEST([$1], [$enableval], yes, [$3], no, [$4], [$5])],
|
||||
[MOZ_TWO_STRING_TEST([$1], yes, [$3], no, [$4], [$5])],
|
||||
[$6])])])
|
||||
|
||||
dnl MOZ_ARG_WITH_BOOL(NAME, HELP, IF-YES [, IF-NO [, ELSE])
|
||||
AC_DEFUN(MOZ_ARG_WITH_BOOL,
|
||||
[AC_ARG_WITH([$1], [$2],
|
||||
[MOZ_TWO_STRING_TEST([$1], [$withval], yes, [$3], no, [$4])],
|
||||
[MOZ_TWO_STRING_TEST([$1], yes, [$3], no, [$4])],
|
||||
[$5])])
|
||||
|
||||
dnl MOZ_ARG_WITHOUT_BOOL(NAME, HELP, IF-NO [, IF-YES [, ELSE])
|
||||
AC_DEFUN(MOZ_ARG_WITHOUT_BOOL,
|
||||
[AC_ARG_WITH([$1], [$2],
|
||||
[MOZ_TWO_STRING_TEST([$1], [$withval], no, [$3], yes, [$4])],
|
||||
[MOZ_TWO_STRING_TEST([$1], no, [$3], yes, [$4])],
|
||||
[$5])])
|
||||
|
||||
dnl MOZ_ARG_WITH_STRING(NAME, HELP, IF-SET [, ELSE])
|
||||
|
||||
492
mozilla/build/autoconf/config.guess
vendored
492
mozilla/build/autoconf/config.guess
vendored
@@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2002-03-20'
|
||||
timestamp='2001-03-30'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -24,9 +24,8 @@ timestamp='2002-03-20'
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Per Bothner <per@bothner.com>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
@@ -53,7 +52,7 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
@@ -96,25 +95,25 @@ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
|
||||
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
|
||||
# use `HOST_CC' if defined, but it is deprecated.
|
||||
|
||||
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
|
||||
,,) echo "int dummy(){}" > $dummy.c ;
|
||||
for c in cc gcc c89 c99 ; do
|
||||
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
|
||||
case $CC_FOR_BUILD,$HOST_CC,$CC in
|
||||
,,) echo "int dummy(){}" > $dummy.c
|
||||
for c in cc gcc c89 ; do
|
||||
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
|
||||
if test $? = 0 ; then
|
||||
CC_FOR_BUILD="$c"; break ;
|
||||
fi ;
|
||||
done ;
|
||||
rm -f $dummy.c $dummy.o $dummy.rel ;
|
||||
CC_FOR_BUILD="$c"; break
|
||||
fi
|
||||
done
|
||||
rm -f $dummy.c $dummy.o $dummy.rel
|
||||
if test x"$CC_FOR_BUILD" = x ; then
|
||||
CC_FOR_BUILD=no_compiler_found ;
|
||||
CC_FOR_BUILD=no_compiler_found
|
||||
fi
|
||||
;;
|
||||
,,*) CC_FOR_BUILD=$CC ;;
|
||||
,*,*) CC_FOR_BUILD=$HOST_CC ;;
|
||||
esac'
|
||||
esac
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 1994-08-24)
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
PATH=$PATH:/.attbin ; export PATH
|
||||
fi
|
||||
@@ -128,30 +127,29 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:NetBSD:*:*)
|
||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||
# Netbsd (nbsd) targets should (where applicable) match one or
|
||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||
# switched to ELF, *-*-netbsd* would select the old
|
||||
# object file format. This provides both forward
|
||||
# compatibility and a consistent mechanism for selecting the
|
||||
# object file format.
|
||||
#
|
||||
# Note: NetBSD doesn't particularly care about the vendor
|
||||
# portion of the name. We always set it to "unknown".
|
||||
sysctl="sysctl -n hw.machine_arch"
|
||||
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
|
||||
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
arm*) machine=arm-unknown ;;
|
||||
sh3el) machine=shl-unknown ;;
|
||||
sh3eb) machine=sh-unknown ;;
|
||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||
# Determine the machine/vendor (is the vendor relevant).
|
||||
case "${UNAME_MACHINE}" in
|
||||
amiga) machine=m68k-unknown ;;
|
||||
arm32) machine=arm-unknown ;;
|
||||
atari*) machine=m68k-atari ;;
|
||||
sun3*) machine=m68k-sun ;;
|
||||
mac68k) machine=m68k-apple ;;
|
||||
macppc) machine=powerpc-apple ;;
|
||||
hp3[0-9][05]) machine=m68k-hp ;;
|
||||
ibmrt|romp-ibm) machine=romp-ibm ;;
|
||||
*) machine=${UNAME_MACHINE}-unknown ;;
|
||||
esac
|
||||
# The Operating System including object format, if it has switched
|
||||
# to ELF recently, or will in the future.
|
||||
case "${UNAME_MACHINE_ARCH}" in
|
||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
case "${UNAME_MACHINE}" in
|
||||
i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep __ELF__ >/dev/null
|
||||
then
|
||||
@@ -173,45 +171,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit 0 ;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
macppc:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvmeppc:OpenBSD:*:*)
|
||||
echo powerpc-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mipseb-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
if test $UNAME_RELEASE = "V4.0"; then
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
@@ -245,7 +204,6 @@ main:
|
||||
jsr \$26,exit
|
||||
.end main
|
||||
EOF
|
||||
eval $set_cc_for_build
|
||||
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
case `./$dummy` in
|
||||
@@ -267,9 +225,6 @@ EOF
|
||||
2-307)
|
||||
UNAME_MACHINE="alphaev67"
|
||||
;;
|
||||
2-1307)
|
||||
UNAME_MACHINE="alphaev68"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f $dummy.s $dummy
|
||||
@@ -287,11 +242,29 @@ EOF
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-unknown-sysv4
|
||||
exit 0;;
|
||||
amiga:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:[Aa]miga[Oo][Ss]:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-amigaos
|
||||
exit 0 ;;
|
||||
*:[Mm]orph[Oo][Ss]:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-morphos
|
||||
arc64:OpenBSD:*:*)
|
||||
echo mips64el-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
arc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hkmips:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
pmax:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sgi:OpenBSD:*:*)
|
||||
echo mips-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OS/390:*:*)
|
||||
echo i370-ibm-openedition
|
||||
@@ -341,7 +314,7 @@ EOF
|
||||
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun*:*:4.2BSD:*)
|
||||
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
|
||||
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
|
||||
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
|
||||
case "`/bin/arch`" in
|
||||
sun3)
|
||||
@@ -355,6 +328,9 @@ EOF
|
||||
aushp:SunOS:*:*)
|
||||
echo sparc-auspex-sunos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
# The situation for MiNT is a little confusing. The machine name
|
||||
# can be virtually everything (everything which is not
|
||||
# "atarist" or "atariste" at least should have a processor
|
||||
@@ -381,6 +357,18 @@ EOF
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mac68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme68k:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mvme88k:OpenBSD:*:*)
|
||||
echo m88k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
powerpc:machten:*:*)
|
||||
echo powerpc-apple-machten${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -397,7 +385,6 @@ EOF
|
||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __cplusplus
|
||||
#include <stdio.h> /* for printf() prototype */
|
||||
@@ -425,9 +412,6 @@ EOF
|
||||
rm -f $dummy.c $dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Motorola:PowerMAX_OS:*:*)
|
||||
echo powerpc-motorola-powermax
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerunix
|
||||
exit 0 ;;
|
||||
@@ -475,7 +459,7 @@ EOF
|
||||
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||
i*86:AIX:*:*)
|
||||
i?86:AIX:*:*)
|
||||
echo i386-ibm-aix
|
||||
exit 0 ;;
|
||||
ia64:AIX:*:*)
|
||||
@@ -488,7 +472,6 @@ EOF
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
@@ -510,7 +493,7 @@ EOF
|
||||
fi
|
||||
exit 0 ;;
|
||||
*:AIX:*:[45])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
@@ -550,8 +533,10 @@ EOF
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/[678][0-9][0-9])
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
case "${HPUX_REV}" in
|
||||
11.[0-9][0-9])
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
@@ -560,13 +545,12 @@ EOF
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
fi ;;
|
||||
esac
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
@@ -599,10 +583,10 @@ EOF
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
|
||||
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
|
||||
rm -f $dummy.c $dummy
|
||||
fi ;;
|
||||
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
|
||||
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
|
||||
rm -f $dummy.c $dummy
|
||||
fi ;;
|
||||
esac
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
@@ -611,7 +595,6 @@ EOF
|
||||
echo ia64-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
@@ -647,7 +630,7 @@ EOF
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
|
||||
*9??*:MPE/iX:*:*)
|
||||
echo hppa1.0-hp-mpeix
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
@@ -656,7 +639,7 @@ EOF
|
||||
hp8??:OSF1:*:*)
|
||||
echo hppa1.0-hp-osf
|
||||
exit 0 ;;
|
||||
i*86:OSF1:*:*)
|
||||
i?86:OSF1:*:*)
|
||||
if [ -x /usr/sbin/sysversion ] ; then
|
||||
echo ${UNAME_MACHINE}-unknown-osf1mk
|
||||
else
|
||||
@@ -666,6 +649,9 @@ EOF
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
hppa*:OpenBSD:*:*)
|
||||
echo hppa-unknown-openbsd
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
@@ -684,14 +670,16 @@ EOF
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit 0 ;;
|
||||
CRAY*X-MP:*:*:*)
|
||||
echo xmp-cray-unicos
|
||||
exit 0 ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*[A-Z]90:*:*:*)
|
||||
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
|
||||
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
|
||||
-e 's/\.[^.]*$/.X/'
|
||||
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
exit 0 ;;
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
@@ -705,13 +693,19 @@ EOF
|
||||
CRAY*SV1:*:*:*)
|
||||
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sparc*:BSD/OS:*:*)
|
||||
@@ -723,6 +717,9 @@ EOF
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit 0 ;;
|
||||
@@ -734,17 +731,10 @@ EOF
|
||||
xx:WINNT:* | xx:WIN95:*)
|
||||
echo i586-pc-msvc
|
||||
exit 0 ;;
|
||||
# MKS Toolkit
|
||||
[34567]86:Windows_NT:*)
|
||||
echo i386-pc-mksnt
|
||||
exit 0 ;;
|
||||
### End MozillaHack
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit 0 ;;
|
||||
x86:Interix*:3*)
|
||||
echo i386-pc-interix3
|
||||
exit 0 ;;
|
||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||
@@ -770,49 +760,103 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux
|
||||
exit 0 ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
mips:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips
|
||||
#undef mipsel
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mipsel
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef __cplusplus
|
||||
#include <stdio.h> /* for printf() prototype */
|
||||
int main (int argc, char *argv[]) {
|
||||
#else
|
||||
int main (argc, argv) int argc; char *argv[]; {
|
||||
#endif
|
||||
#ifdef __MIPSEB__
|
||||
printf ("%s-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
#ifdef __MIPSEL__
|
||||
printf ("%sel-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
|
||||
rm -f $dummy.c
|
||||
test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
# Determine Lib Version
|
||||
cat >$dummy.c <<EOF
|
||||
#include <features.h>
|
||||
#if defined(__GLIBC__)
|
||||
extern char __libc_version[];
|
||||
extern char __libc_release[];
|
||||
#endif
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#if defined(__GLIBC__)
|
||||
printf("%s %s\n", __libc_version, __libc_release);
|
||||
#else
|
||||
printf("unknown\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
LIBC=""
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./$dummy | grep 1\.99 > /dev/null
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; fi
|
||||
fi
|
||||
rm -f $dummy.c $dummy
|
||||
echo powerpc-unknown-linux-gnu${LIBC}
|
||||
exit 0 ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
cat <<EOF >$dummy.s
|
||||
.data
|
||||
\$Lformat:
|
||||
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
|
||||
.text
|
||||
.globl main
|
||||
.align 4
|
||||
.ent main
|
||||
main:
|
||||
.frame \$30,16,\$26,0
|
||||
ldgp \$29,0(\$27)
|
||||
.prologue 1
|
||||
.long 0x47e03d80 # implver \$0
|
||||
lda \$2,-1
|
||||
.long 0x47e20c21 # amask \$2,\$1
|
||||
lda \$16,\$Lformat
|
||||
mov \$0,\$17
|
||||
not \$1,\$18
|
||||
jsr \$26,printf
|
||||
ldgp \$29,0(\$26)
|
||||
mov 0,\$16
|
||||
jsr \$26,exit
|
||||
.end main
|
||||
EOF
|
||||
LIBC=""
|
||||
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
case `./$dummy` in
|
||||
0-0) UNAME_MACHINE="alpha" ;;
|
||||
1-0) UNAME_MACHINE="alphaev5" ;;
|
||||
1-1) UNAME_MACHINE="alphaev56" ;;
|
||||
1-101) UNAME_MACHINE="alphapca56" ;;
|
||||
2-303) UNAME_MACHINE="alphaev6" ;;
|
||||
2-307) UNAME_MACHINE="alphaev67" ;;
|
||||
esac
|
||||
objdump --private-headers $dummy | \
|
||||
grep ld.so.1 > /dev/null
|
||||
if test "$?" = 0 ; then
|
||||
LIBC="libc1"
|
||||
fi
|
||||
fi
|
||||
rm -f $dummy.s $dummy
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit 0 ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
@@ -838,67 +882,78 @@ EOF
|
||||
x86_64:Linux:*:*)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
exit 0 ;;
|
||||
i*86:Linux:*:*)
|
||||
i?86:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
# problems with other programs or directories called `ld' in the path.
|
||||
# Set LC_ALL=C to ensure ld outputs messages in English.
|
||||
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
||||
| sed -ne '/supported targets:/!d
|
||||
ld_supported_emulations=`cd /; ld --help 2>&1 \
|
||||
| sed -ne '/supported emulations:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported targets: *//
|
||||
s/.*supported emulations: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_targets" in
|
||||
elf32-i386)
|
||||
case "$ld_supported_emulations" in
|
||||
i?86linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
elf_i?86)
|
||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
||||
;;
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0 ;;
|
||||
coff-i386)
|
||||
i?86coff)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||
exit 0 ;;
|
||||
"")
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||
# one that does not give us useful --help.
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
||||
exit 0 ;;
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld)
|
||||
# or one that does not give us useful --help.
|
||||
# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
# If ld does not provide *any* "supported emulations:"
|
||||
# that means it is gnuoldld.
|
||||
test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
case "${UNAME_MACHINE}" in
|
||||
i?86)
|
||||
VENDOR=pc;
|
||||
;;
|
||||
*)
|
||||
VENDOR=unknown;
|
||||
;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <features.h>
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
LIBC=gnu
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
#else
|
||||
#ifdef __INTEL_COMPILER
|
||||
LIBC=gnu
|
||||
#else
|
||||
LIBC=gnuaout
|
||||
#endif
|
||||
#endif
|
||||
cat >$dummy.c <<EOF
|
||||
#include <features.h>
|
||||
#ifdef __cplusplus
|
||||
#include <stdio.h> /* for printf() prototype */
|
||||
int main (int argc, char *argv[]) {
|
||||
#else
|
||||
int main (argc, argv) int argc; char *argv[]; {
|
||||
#endif
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
# else
|
||||
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
|
||||
# endif
|
||||
#else
|
||||
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
|
||||
rm -f $dummy.c
|
||||
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
|
||||
;;
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
# earlier versions are messed up and put the nodename in both
|
||||
# sysname and nodename.
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i?86:DYNIX/ptx:4*:*)
|
||||
echo i386-sequent-sysv4
|
||||
exit 0 ;;
|
||||
i*86:UNIX_SV:4.2MP:2.*)
|
||||
i?86:UNIX_SV:4.2MP:2.*)
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
@@ -906,7 +961,7 @@ EOF
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
|
||||
@@ -914,15 +969,16 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i*86:*:5:[78]*)
|
||||
case `/bin/uname -X | grep "^Machine"` in
|
||||
*486*) UNAME_MACHINE=i486 ;;
|
||||
*Pentium) UNAME_MACHINE=i586 ;;
|
||||
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
|
||||
esac
|
||||
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
|
||||
i?86:*:5:7*)
|
||||
# Fixed at (any) Pentium or better
|
||||
UNAME_MACHINE=i586
|
||||
if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
|
||||
echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i*86:*:3.2:*)
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
@@ -940,7 +996,7 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
i*86:*DOS:*:*)
|
||||
i?86:*DOS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msdosdjgpp
|
||||
exit 0 ;;
|
||||
pc:*:*:*)
|
||||
@@ -968,7 +1024,7 @@ EOF
|
||||
exit 0 ;;
|
||||
M68*:*:R3V[567]*:*)
|
||||
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
|
||||
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
|
||||
OS_REL=''
|
||||
test -r /etc/.relid \
|
||||
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
|
||||
@@ -985,7 +1041,7 @@ EOF
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:* | i?86:LynxOS:4.0*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
@@ -1014,8 +1070,8 @@ EOF
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit 0 ;;
|
||||
#### MozillaHack
|
||||
@@ -1037,10 +1093,6 @@ EOF
|
||||
# From seanf@swdc.stratus.com.
|
||||
echo i860-stratus-sysv4
|
||||
exit 0 ;;
|
||||
*:VOS:*:*)
|
||||
# From Paul.Green@stratus.com.
|
||||
echo hppa1.1-stratus-vos
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -1079,17 +1131,15 @@ EOF
|
||||
echo `uname -p`-apple-darwin${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
UNAME_PROCESSOR=`uname -p`
|
||||
if test "$UNAME_PROCESSOR" = "x86"; then
|
||||
UNAME_PROCESSOR=i386
|
||||
if test "${UNAME_MACHINE}" = "x86pc"; then
|
||||
UNAME_MACHINE=pc
|
||||
fi
|
||||
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
|
||||
echo `uname -p`-${UNAME_MACHINE}-nto-qnx
|
||||
exit 0 ;;
|
||||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit 0 ;;
|
||||
NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
|
||||
NSR-[KW]:NONSTOP_KERNEL:*:*)
|
||||
echo nsr-tandem-nsk${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:NonStop-UX:*:*)
|
||||
@@ -1112,10 +1162,17 @@ EOF
|
||||
fi
|
||||
echo ${UNAME_MACHINE}-unknown-plan9
|
||||
exit 0 ;;
|
||||
i*86:OS/2:*:*)
|
||||
i?86:OS/2:*:*)
|
||||
# If we were able to find `uname', then EMX Unix compatibility
|
||||
# is probably installed.
|
||||
echo ${UNAME_MACHINE}-pc-os2-emx
|
||||
# echo ${UNAME_MACHINE}-pc-os2-emx
|
||||
#### MozillaHack
|
||||
if test "$VACPP" = "yes"; then
|
||||
echo "i386-pc-os2_vacpp"
|
||||
else
|
||||
echo "i386-pc-os2_emx"
|
||||
fi
|
||||
#### End MozillaHack
|
||||
exit 0 ;;
|
||||
*:TOPS-10:*:*)
|
||||
echo pdp10-unknown-tops10
|
||||
@@ -1135,18 +1192,11 @@ EOF
|
||||
*:ITS:*:*)
|
||||
echo pdp10-unknown-its
|
||||
exit 0 ;;
|
||||
i*86:XTS-300:*:STOP)
|
||||
echo ${UNAME_MACHINE}-unknown-stop
|
||||
exit 0 ;;
|
||||
i*86:atheos:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-atheos
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
|
||||
288
mozilla/build/autoconf/config.sub
vendored
288
mozilla/build/autoconf/config.sub
vendored
@@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2002-04-26'
|
||||
timestamp='2001-03-30'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -29,8 +29,7 @@ timestamp='2002-04-26'
|
||||
# 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>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# 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.
|
||||
@@ -118,7 +117,7 @@ esac
|
||||
# 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* | windows32-* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@@ -158,14 +157,6 @@ case $os in
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusos*)
|
||||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
@@ -224,39 +215,25 @@ esac
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
#### MozillaHack
|
||||
# mips*el
|
||||
#### End MozillaHack
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dsp16xx \
|
||||
| fr30 \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
|
||||
| mips64vr4100 | mips64vr4100el | mips64vr4300 \
|
||||
| mips64vr4300el | mips64vr5000 | mips64vr5000el \
|
||||
| mipsbe | mipseb | mips*el | mipsle | mipstx39 | mipstx39el \
|
||||
| mipsisa32 | mipsisa64 \
|
||||
| mn10200 | mn10300 \
|
||||
| ns16k | ns32k \
|
||||
| openrisc | or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xstormy16 | xtensa \
|
||||
| z8k)
|
||||
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)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
@@ -264,13 +241,13 @@ case $basic_machine in
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
|
||||
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*86 | x86_64)
|
||||
i[234567]86 | x86_64)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
@@ -279,48 +256,30 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
#### MozillaHack
|
||||
# mips*el
|
||||
#### End MozillaHack
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* \
|
||||
| avr-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c54x-* \
|
||||
| clipper-* | cydra-* \
|
||||
| d10v-* | d30v-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
|
||||
| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
|
||||
| mipsle-* | mips*el-* | mipstx39-* | mipstx39el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
|
||||
| xtensa-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
# 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-* \
|
||||
| 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-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
@@ -383,10 +342,6 @@ case $basic_machine in
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
@@ -407,8 +362,16 @@ case $basic_machine in
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | j90)
|
||||
basic_machine=j90-cray
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[cjt]90)
|
||||
basic_machine=${basic_machine}-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
@@ -423,14 +386,6 @@ case $basic_machine in
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
decsystem10* | dec10*)
|
||||
basic_machine=pdp10-dec
|
||||
os=-tops10
|
||||
;;
|
||||
decsystem20* | dec20*)
|
||||
basic_machine=pdp10-dec
|
||||
os=-tops20
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
@@ -551,19 +506,19 @@ case $basic_machine in
|
||||
basic_machine=i370-ibm
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i*86v32)
|
||||
i[34567]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i*86v4*)
|
||||
i[34567]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i*86v)
|
||||
i[34567]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i*86sol2)
|
||||
i[34567]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
@@ -609,10 +564,6 @@ case $basic_machine in
|
||||
basic_machine=i386-pc
|
||||
os=-msvc
|
||||
;;
|
||||
i386-mksnt)
|
||||
basic_machine=i386-pc
|
||||
os=-mksnt
|
||||
;;
|
||||
#### End MozillaHack
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
@@ -621,6 +572,14 @@ case $basic_machine in
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
@@ -635,10 +594,6 @@ case $basic_machine in
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
morphos)
|
||||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
@@ -718,10 +673,6 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
or32 | or32-*)
|
||||
basic_machine=or32-unknown
|
||||
os=-coff
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
@@ -747,7 +698,7 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||
pentium | p5 | k5 | k6 | nexgen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
@@ -756,7 +707,7 @@ case $basic_machine in
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
@@ -780,16 +731,6 @@ case $basic_machine in
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64) basic_machine=powerpc64-unknown
|
||||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
;;
|
||||
ppc64le-* | powerpc64little-*)
|
||||
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
@@ -807,12 +748,6 @@ case $basic_machine in
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
s390 | s390-*)
|
||||
basic_machine=s390-ibm
|
||||
;;
|
||||
s390x | s390x-*)
|
||||
basic_machine=s390x-ibm
|
||||
;;
|
||||
sa29200)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
@@ -824,7 +759,7 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sparclite-wrs | simso-wrs)
|
||||
sparclite-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
@@ -882,7 +817,7 @@ case $basic_machine in
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
sv1)
|
||||
sv1)
|
||||
basic_machine=sv1-cray
|
||||
os=-unicos
|
||||
;;
|
||||
@@ -890,16 +825,8 @@ case $basic_machine in
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
t3d)
|
||||
basic_machine=alpha-cray
|
||||
os=-unicos
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=alphaev5-cray
|
||||
os=-unicos
|
||||
;;
|
||||
t90)
|
||||
basic_machine=t90-cray
|
||||
basic_machine=t3e-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
@@ -912,10 +839,6 @@ case $basic_machine in
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
toad1)
|
||||
basic_machine=pdp10-xkl
|
||||
os=-tops20
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
@@ -962,17 +885,13 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
windows32)
|
||||
basic_machine=i386-pc
|
||||
os=-windows32-msvcrt
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
z8k-*-coff)
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
@@ -993,6 +912,13 @@ case $basic_machine in
|
||||
op60c)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
@@ -1012,13 +938,10 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh3 | sh4 | sh3eb | sh4eb)
|
||||
sh3 | sh4)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
sparc | sparcv9)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@@ -1084,13 +1007,16 @@ 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.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
#### MozillaHack
|
||||
# msvc | mksnt
|
||||
#### End MozillaHack
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
@@ -1102,20 +1028,17 @@ case $os in
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -msvc* | -mksnt* \
|
||||
| -msvc* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* )
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
case $basic_machine in
|
||||
x86-* | i*86-*)
|
||||
x86-* | i[34567]86-*)
|
||||
;;
|
||||
*)
|
||||
os=-nto$os
|
||||
@@ -1162,18 +1085,12 @@ case $os in
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-atheos*)
|
||||
os=-atheos
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-nova*)
|
||||
os=-rtmk-nova
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
@@ -1248,7 +1165,6 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
;;
|
||||
@@ -1279,9 +1195,6 @@ case $basic_machine in
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
or32-*)
|
||||
os=-coff
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
@@ -1429,7 +1342,7 @@ case $basic_machine in
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks* | -windiss*)
|
||||
-vxsim* | -vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
@@ -1444,9 +1357,6 @@ case $basic_machine in
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
vendor=atari
|
||||
;;
|
||||
-vos*)
|
||||
vendor=stratus
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
# Configure paths for FreeType2
|
||||
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
|
||||
|
||||
dnl AM_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
|
||||
dnl
|
||||
AC_DEFUN(AC_CHECK_FT2,
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the freetype-config script
|
||||
dnl
|
||||
AC_ARG_WITH(freetype-prefix,
|
||||
[ --with-ft-prefix=PFX Prefix where FreeType is installed (optional)],
|
||||
ft_config_prefix="$withval", ft_config_prefix="")
|
||||
AC_ARG_WITH(freetype-exec-prefix,
|
||||
[ --with-ft-exec-prefix=PFX
|
||||
Exec prefix where FreeType is installed (optional)],
|
||||
ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
|
||||
AC_ARG_ENABLE(freetypetest,
|
||||
[ --disable-freetypetest
|
||||
Do not try to compile and run a test FreeType program],
|
||||
[], enable_fttest=yes)
|
||||
|
||||
if test x$ft_config_exec_prefix != x ; then
|
||||
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
|
||||
if test x${FT2_CONFIG+set} != xset ; then
|
||||
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
|
||||
fi
|
||||
fi
|
||||
if test x$ft_config_prefix != x ; then
|
||||
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
|
||||
if test x${FT2_CONFIG+set} != xset ; then
|
||||
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
|
||||
fi
|
||||
fi
|
||||
AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
|
||||
|
||||
min_ft_version=ifelse([$1], ,6.1.0,$1)
|
||||
AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
|
||||
no_ft=""
|
||||
if test "$FT2_CONFIG" = "no" ; then
|
||||
no_ft=yes
|
||||
else
|
||||
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
|
||||
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
|
||||
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
ft_min_major_version=`echo $min_ft_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
ft_min_minor_version=`echo $min_ft_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
ft_min_micro_version=`echo $min_ft_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_fttest" = "xyes" ; then
|
||||
ft_config_is_lt=no
|
||||
if test $ft_config_major_version -lt $ft_min_major_version ; then
|
||||
ft_config_is_lt=yes
|
||||
else
|
||||
if test $ft_config_major_version -eq $ft_min_major_version ; then
|
||||
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
|
||||
ft_config_is_lt=yes
|
||||
else
|
||||
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
|
||||
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
|
||||
ft_config_is_lt=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "x$ft_config_is_lt" = "xyes" ; then
|
||||
ifelse([$3], , :, [$3])
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $FT2_CFLAGS"
|
||||
LIBS="$FT2_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Sanity checks for the results of freetype-config to some extent
|
||||
dnl
|
||||
AC_TRY_RUN([
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
FT_Library library;
|
||||
FT_Error error;
|
||||
|
||||
error = FT_Init_FreeType(&library);
|
||||
|
||||
if (error)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
FT_Done_FreeType(library);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi # test $ft_config_version -lt $ft_min_version
|
||||
fi # test "x$enable_fttest" = "xyes"
|
||||
fi # test "$FT2_CONFIG" = "no"
|
||||
if test "x$ft_config_is_lt" != "xyes" ; then
|
||||
if test "x$no_ft" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$FT2_CONFIG" = "no" ; then
|
||||
echo "*** The freetype-config script installed by FreeType 2 could not be found."
|
||||
echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the FT2_CONFIG environment variable to the"
|
||||
echo "*** full path to freetype-config."
|
||||
else
|
||||
echo "*** The FreeType test program failed to run. If your system uses"
|
||||
echo "*** shared libraries and they are installed outside the normal"
|
||||
echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
|
||||
echo "*** (or whatever is appropiate for your system) is correctly set."
|
||||
fi
|
||||
FT2_CFLAGS=""
|
||||
FT2_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(FT2_CFLAGS)
|
||||
AC_SUBST(FT2_LIBS)
|
||||
fi
|
||||
])
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user