Merge bug 618411. a=blocking-beta8 CLOSED TREE
authorPhilipp von Weitershausen <philipp@weitershausen.de>
Mon, 13 Dec 2010 18:14:20 -0800
changeset 59179 43a54dd56ccd5ef4dad36a69f8f8b7e6465edd46
parent 59177 cd5a2a31cb8e2ed8acbadc5959f4adcd44268eae (diff)
parent 59178 82fb58046a619664d660045c0ce5d239943499a9 (current diff)
child 59180 66036625795f9052b761d9f7f2b1ce1fe69c521b
push id17564
push userpweitershausen@mozilla.com
push dateTue, 14 Dec 2010 02:14:30 +0000
treeherdermozilla-central@43a54dd56ccd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblocking-beta8
bugs618411
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge bug 618411. a=blocking-beta8 CLOSED TREE
services/sync/modules/base_records/crypto.js
new file mode 100644
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,34 @@
+# .hgignore - List of filenames hg should ignore
+
+# Filenames that should be ignored wherever they appear
+~$
+\.py(c|o)$
+(?i)(^|/)TAGS$
+(^|/)ID$
+(^|/)\.DS_Store$
+
+# User files that may appear at the root
+^\.mozconfig
+^mozconfig$
+^configure$
+^config\.cache$
+^config\.log$
+
+# Empty marker file that's generated when we check out NSS
+^security/manager/\.nss\.checkout$
+
+# Build directories
+^obj
+
+# Build directories for js shell
+_DBG\.OBJ/
+_OPT\.OBJ/
+
+# SpiderMonkey configury
+^js/src/configure$
+^js/src/autom4te.cache$
+# SpiderMonkey test result logs
+^js/src/tests/results-.*\.(html|txt)$
+
+# Java HTML5 parser classes
+^parser/html/java/(html|java)parser/
new file mode 100644
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1,55 @@
+df7a3c8ffeeaba229067efee5a20e21dae0dd877 MOZILLA_1_9_a4_BASE
+4209e16b58411750ac73f761023e46b76b793e2c MOZILLA_1_9_a6_BASE
+66a5c7bce7ee86a820d3c0d54fa07cb719be751c MOZILLA_1_9_a7_BASE
+caeba7562e495a9f604984df0b48b6f99bec3e2e FENNEC_M4
+9d9941eacb14827fdab4716710042fdde84eb60d FIREFOX_3_1a1_RELEASE
+9d9941eacb14827fdab4716710042fdde84eb60d FIREFOX_3_1a1_BUILD1
+c1d7e318a27574c995631fec166ad42672475702 FIREFOX_3_1a1_BUILD2
+c1d7e318a27574c995631fec166ad42672475702 FIREFOX_3_1a1_RELEASE
+afc4ee509d9ca3bb4031015c3c22963dcb4b7e7f FIREFOX_3_1a1_RELEASE
+afc4ee509d9ca3bb4031015c3c22963dcb4b7e7f FIREFOX_3_1a1_BUILD2
+f197b51bbc29a30860e750ee87fd0a047a024f2e FIREFOX_3_1a2_BUILD1
+f197b51bbc29a30860e750ee87fd0a047a024f2e FIREFOX_3_1a2_RELEASE
+269af1ed75649989575d41f53a12048015c6d50e FENNEC_M8
+920a4326d1087b174c2fa2b9a8358e12c697022c SEAMONKEY_2_0a1_BUILD1
+920a4326d1087b174c2fa2b9a8358e12c697022c SEAMONKEY_2_0a1_RELEASE
+f197b51bbc29a30860e750ee87fd0a047a024f2e UPDATE_PACKAGING_R5
+f197b51bbc29a30860e750ee87fd0a047a024f2e -m
+f197b51bbc29a30860e750ee87fd0a047a024f2e Adding UPDATE_PACKAGING_R5 tag in order to make patcher work.
+15cb5d25db054d2d0b56869a2f6351388bfcddcd THUNDERBIRD_3_0a3_RELEASE
+15cb5d25db054d2d0b56869a2f6351388bfcddcd THUNDERBIRD_3_0a3_BUILD1
+0000000000000000000000000000000000000000 -m
+0000000000000000000000000000000000000000 Adding UPDATE_PACKAGING_R5 tag in order to make patcher work.
+f197b51bbc29a30860e750ee87fd0a047a024f2e UPDATE_PACKAGING_R6
+d7d64f68423b68a671f623f123e90057ebc49dac UPDATE_PACKAGING_R6
+0000000000000000000000000000000000000000 THUNDERBIRD_3_0a3_BUILD1
+0000000000000000000000000000000000000000 THUNDERBIRD_3_0a3_RELEASE
+0cd41f5990807fb6ab52cb59ba3c8e8247281045 GECKO_1_9_1_BASE
+8df5a90281cd4d75835e4b7696da200555eed15f GECKO_1_9_1_BASE
+8a601ed6bc4c7b3d1e35aa9e81f257512d984bd5 FENNEC_A2
+d7d64f68423b68a671f623f123e90057ebc49dac UPDATE_PACKAGING_R7
+fb32f6e1859c07846a01b4478a7b1678019e0b45 UPDATE_PACKAGING_R7
+f817a4378f32b1ad0a7c4b5a9949586dba816da5 FENNEC_M11
+5c1e7c779b6edc8ff912001990edc579f80597f4 FENNEC_B1
+fe9cc55b8db7f56f7e68a246acba363743854979 UPDATE_PACKAGING_R8
+6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-r15462
+6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-latest
+376b78fc72230aaf2ca4e279a8f4ef1efd4a1d9f GECKO_1_9_2_BASE
+941ad9d7d079246481f365c3cfbfc75a5bbefc94 last-mozilla-central
+2bae3bbf866e7de2a4b2377e7c2f52cc9ac14a22 last-mozilla-central
+2bae3bbf866e7de2a4b2377e7c2f52cc9ac14a22 last-mozilla-central
+65c1582465efe99899189519fccaf7b2826fcb2e last-mozilla-central
+65c1582465efe99899189519fccaf7b2826fcb2e last-mozilla-central
+27937722da69ad0e8fd140a00671413068226a5b last-mozilla-central
+27937722da69ad0e8fd140a00671413068226a5b last-mozilla-central
+a732c6d3c078f80635255c78bfaadffa5828a8a5 last-mozilla-central
+a732c6d3c078f80635255c78bfaadffa5828a8a5 last-mozilla-central
+925595f3c08634cc42e33158ea6858bb55623ef7 last-mozilla-central
+dba2abb7db57078c5a4810884834d3056a5d56c2 last-mozilla-central
+138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R9
+138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R10
+138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R11
+0327e126ea245112c0aa7283fee154e084866fb5 bsmedberg-static-xpcom-registration-base
+0327e126ea245112c0aa7283fee154e084866fb5 bsmedberg-static-xpcom-registration-base
+2f83edbbeef0de7dd901411d270da61106c8afae bsmedberg-static-xpcom-registration-base
+138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R12
new file mode 100644
--- /dev/null
+++ b/LEGAL
@@ -0,0 +1,43 @@
+Please be apprised of the following Legal Notices:
+
+A) The U.S. District Court for the Eastern District of Virginia has
+ruled that the Netscape Navigator code does not infringe Wang's U.S.
+Patent No. 4,751,669 ("the '669 Patent") because: 1) HTML is not
+Videotex as defined by the '669 patent; 2) web servers are not central
+suppliers; and 3) Navigator does not "connect," as defined by the '669
+Patent, to web servers on the Internet. Wang may appeal this decision to
+the Federal Circuit. Wang contended that its Patent disclosing a
+"Videotex" system, is infringed by the following functionality in the
+Netscape Navigator code: 1) the animated logo and status line indicators
+--See Claims 1,8 and 9; 2) the "File Save As" function --See Claims
+23-27; 3) Bookmarks and Rename Bookmarks in the Properties window --See
+Claims 20-22; 4) storing HTML, GIF, and JPEG files and adding filename
+extensions --See Claim 38
+
+B) Intermind owns pending U.S. patent applications on communications
+systems which employ metadata ("channel objects") to define a control
+structure for information transfer. The Netscape code does not infringe
+as released; however, modifications which utilize channel objects as
+described by Intermind should be considered carefully. The following is
+a statement from Intermind: "Intermind's claims fundamentally involve
+the use of a control structure to automate communications. ...The
+essence of Intermind's top claim is that two devices sender and receiver
+have persistent storage, communicate over a network, and exchange a
+control structure including metadata which describes: 1) what
+information is to be updated, 2) when to update this information, and 3)
+how to transfer the updated information. In addition, at least the
+receiving device must be able to process the metadata in order to
+perform the update determination and transfer. Any digital
+communications system which incorporates all of these elements will be
+covered by Intermind's patents." See Intermind.com.
+
+C) Stac, Inc., and its licensing agent Hi/fn, own several patents which
+disclose data compression methods implementing an LZS compression
+algorithm, including U.S. Patent Nos. 4,701,745 and 5,016, 009 ("the
+Stac Patents"). The Netscape Communicator code does not perform
+compression. If you modify the Netscape source code to perform
+compression, please take notice of the Stac Patents.
+
+D) Netscape Communications Corporation ("Netscape") does not guarantee
+that any source code or executable code available from the mozilla.org
+domain is Year 2000 compliant.
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,9 @@
+Please see the file toolkit/content/license.html for the copyright licensing
+conditions attached to this codebase, including copies of the licenses
+concerned.
+
+You are not granted rights or licenses to the trademarks of the
+Mozilla Foundation or any party, including without limitation the
+Firefox name or logo.
+
+For more information, see: http://www.mozilla.org/foundation/licensing.html
new file mode 100644
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,244 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= .
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+ifndef .PYMAKE
+ifeq (,$(MAKE_VERSION))
+$(error GNU Make is required)
+endif
+ifeq (,$(filter-out 3.78 3.79,$(MAKE_VERSION)))
+$(error GNU Make 3.80 or higher is required)
+endif
+endif
+
+include $(DEPTH)/config/autoconf.mk
+
+default::
+
+TIERS += base
+
+#
+# tier "base" - basic setup
+#
+tier_base_dirs = \
+	config \
+	build \
+	probes \
+	$(NULL)
+
+ifndef LIBXUL_SDK
+tier_base_dirs += \
+	memory \
+	$(NULL)
+ifeq ($(OS_TARGET),Android)
+tier_base_dirs += other-licenses/android
+endif
+
+endif
+
+ifdef COMPILE_ENVIRONMENT
+include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
+endif
+
+
+include $(topsrcdir)/config/config.mk
+
+GARBAGE_DIRS += dist _javagen _profile _tests staticlib
+DIST_GARBAGE = config.cache config.log config.status config-defs.h \
+   dependencies.beos config/autoconf.mk \
+   unallmakefiles mozilla-config.h \
+   netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
+   $(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out
+
+ifdef WINCE
+check::
+	$(PYTHON) $(topsrcdir)/build/mobile/devicemanager-utils.py copy $(DIST)/bin
+endif
+
+default alldep all:: $(topsrcdir)/configure config.status
+	$(RM) -rf $(DIST)/sdk
+	$(RM) -rf $(DIST)/include
+	$(RM) -rf $(DIST)/private
+	$(RM) -rf $(DIST)/public
+	$(RM) -rf $(DIST)/bin/components
+	$(RM) -rf _tests
+
+$(topsrcdir)/configure: $(topsrcdir)/configure.in
+	@echo "STOP!  configure.in has changed, and your configure is out of date."
+	@echo "Please rerun autoconf and re-configure your build directory."
+	@echo "To ignore this message, touch 'configure' in the source directory,"
+	@echo "but your build might not succeed."
+	@exit 1
+
+config.status: $(topsrcdir)/configure
+	@echo "STOP!  configure has changed and needs to be run in this build directory."
+	@echo "Please rerun configure."
+	@echo "To ignore this message, touch 'config.status' in the build directory,"
+	@echo "but your build might not succeed."
+	@exit 1
+
+# Build pseudo-external modules first when export is explicitly called
+export::
+	$(RM) -rf $(DIST)/sdk
+	$(MAKE) -C config export
+	$(MAKE) tier_nspr
+
+ifdef ENABLE_TESTS
+# Additional makefile targets to call automated test suites
+include $(topsrcdir)/testing/testsuite-targets.mk
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+distclean::
+	cat unallmakefiles | $(XARGS) rm -f
+	rm -f unallmakefiles $(DIST_GARBAGE)
+
+ifeq ($(OS_ARCH),WINNT)
+# we want to copy PDB files on Windows
+MAKE_SYM_STORE_ARGS := -c
+ifdef PDBSTR_PATH
+MAKE_SYM_STORE_ARGS += -i
+endif
+ifeq (,$(CYGWIN_WRAPPER))
+# this doesn't work with Cygwin Python
+MAKE_SYM_STORE_ARGS += --vcs-info
+endif
+DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms.exe
+# PDB files don't get moved to dist, so we need to scan the whole objdir
+MAKE_SYM_STORE_PATH := .
+endif
+ifeq ($(OS_ARCH),Darwin)
+# need to pass arch flags for universal builds
+ifdef UNIVERSAL_BINARY
+MAKE_SYM_STORE_ARGS := -c -a "i386 x86_64" --vcs-info
+MAKE_SYM_STORE_PATH := $(DIST)/universal
+else
+MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
+MAKE_SYM_STORE_PATH := $(DIST)/bin
+endif
+DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
+endif
+ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
+MAKE_SYM_STORE_ARGS := -c --vcs-info
+DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
+MAKE_SYM_STORE_PATH := $(DIST)/bin
+endif
+
+SYM_STORE_SOURCE_DIRS := $(topsrcdir)
+
+include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
+
+ifdef MOZ_SYMBOLS_EXTRA_BUILDID
+EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
+endif
+
+export SYMBOL_INDEX_NAME = \
+  $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)$(EXTRA_BUILDID)-symbols.txt
+
+buildsymbols:
+ifdef MOZ_CRASHREPORTER
+	echo building symbol store
+	$(RM) -rf $(DIST)/crashreporter-symbols
+	$(RM) -f "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
+	$(NSINSTALL) -D $(DIST)/crashreporter-symbols
+	$(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
+	  $(MAKE_SYM_STORE_ARGS)                                          \
+	  $(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir))               \
+	  $(DUMP_SYMS_BIN)                                                \
+	  $(DIST)/crashreporter-symbols                                   \
+	  $(MAKE_SYM_STORE_PATH) >                                        \
+	  $(DIST)/crashreporter-symbols/$(SYMBOL_INDEX_NAME)
+	echo packing symbols
+	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
+	cd $(DIST)/crashreporter-symbols && \
+          zip -r9D "../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" .
+	cd $(DIST)/crashreporter-symbols && \
+	grep "sym" $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
+	  mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
+	cd $(DIST)/crashreporter-symbols && \
+          zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" . -i "*.sym" -i "*.txt"
+else
+ifdef WINCE
+ifdef SYMBOLSTORE_PATH
+	echo building symbol store with symstore.exe
+	$(RM) -rf $(DIST)/symbols
+	$(RM) -f "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
+	$(NSINSTALL) -D $(DIST)/symbols
+	$(SYMBOLSTORE_PATH) add -r -f "$(subst /,\,$(shell pwd -W))\*.PDB" \
+	  -s $(DIST)/symbols/ -t "$(MOZ_PKG_APPNAME)" -v "$(MOZ_PKG_VERSION)"
+	echo packing symbols
+	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
+	cd $(DIST)/symbols && \
+	  zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" .
+endif # SYMBOLSTORE_PATH
+endif # WINCE
+endif # MOZ_CRASHREPORTER
+
+uploadsymbols:
+ifdef MOZ_CRASHREPORTER
+	$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
+endif
+
+# defined in package-name.mk
+export MOZ_SOURCE_STAMP
+
+#XXX: this is a hack, since we don't want to clobber for MSVC
+# PGO support, but we can't do this test in client.mk
+ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
+# No point in clobbering if PGO has been explicitly disabled.
+ifndef NO_PROFILE_GUIDED_OPTIMIZE
+maybe_clobber_profiledbuild: clean
+else
+maybe_clobber_profiledbuild:
+endif
+else
+maybe_clobber_profiledbuild:
+endif
+
+.PHONY: maybe_clobber_profiledbuild
+
+# Look for R_386_PC32 relocations in shared libs, these
+# break x86_64 builds and SELinux users.
+ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
+scheck::
+	@relcount=`find $(DIST)/bin -name "*.so" | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo "FAILED: R_386_PC32 relocations detected in a shared library.  Did you use a system header without adding it to config/system-headers?"; exit 1; else echo "PASSED"; fi
+endif
new file mode 100644
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,25 @@
+An explanation of the Mozilla Source Code Directory Structure and links to
+project pages with documentation can be found at:
+
+    https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure
+
+For information on how to build Mozilla from the source code, see:
+
+    http://developer.mozilla.org/en/docs/Build_Documentation
+
+To have your bug fix / feature added to Mozilla, you should create a patch and
+submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at:
+
+    http://developer.mozilla.org/en/docs/Creating_a_patch
+    http://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree
+
+If you have a question about developing Mozilla, and can't find the solution
+on http://developer.mozilla.org, you can try asking your question in a
+mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
+are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]
+
+You can download nightly development builds from the Mozilla FTP server.
+Keep in mind that nightly builds, which are used by Mozilla developers for
+testing, may be buggy. Firefox nightlies, for example, can be found at:
+
+    ftp://ftp.mozilla.org/pub/firefox/nightly/latest-trunk/
new file mode 100644
--- /dev/null
+++ b/accessible/Makefile.in
@@ -0,0 +1,53 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH   = ..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH   = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE	= accessibility
+DIRS    = public src build
+
+ifdef ENABLE_TESTS
+DIRS    += tests
+endif
+
+include $(topsrcdir)/config/rules.mk
+
new file mode 100644
--- /dev/null
+++ b/accessible/accessible-docs.html
@@ -0,0 +1,1007 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <title>Implementing an MSAA Server - How Mozilla Does It, and
+Practical Tips for Developers</title>
+</head>
+<body>
+<h1>Implementing an MSAA Server</h1>
+<h2>Practical Tips for Developers, and How Mozilla Does It<br>
+</h2>
+<h2>Contents</h2>
+<div style="margin-left: 40px;">
+<p>This document is for people working to support MSAA in an
+application in order to make it accessible with 3rd party assistive
+technologies, as well as for hackers wishing to be involved in Mozilla's
+MSAA support specifically.<br>
+You may also wish to read <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 MSAA clients can utilize Gecko's
+MSAA support.</p>
+<a href="#intro">1. Intro: What is MSAA</a><br>
+<br>
+</div>
+<div style="margin-left: 40px;"><a href="#cheatsheets">2. Deciding
+Which MSAA Features to Support</a><br>
+<div style="margin-left: 40px;"><big></big><a href="#methods">Methods</a><br>
+<a href="#events">Events</a><br>
+<a href="#states">States</a><br>
+<a href="#roles">Roles</a><br>
+<a href="#objid">Object Identifiers</a><br>
+<br>
+</div>
+<a href="#quirks">3. </a><a href="#quirks">MSAA's Quirks and
+Workarounds</a><br>
+<div style="margin-left: 40px;"><a href="#Crash_prone">MSAA can be
+crash prone</a><br>
+<a href="#Hacky_caret_tracking_not_working">Hacky caret tracking not
+working</a><br>
+<a href="#Event_window_confusion">Event window confusion</a><br>
+<a href="#Confusion_with_system-generated_events">Confusion with
+system-generated events</a><br>
+<a href="#Hacky_caret_tracking_not_working">No unique child ID for
+object in window</a><br>
+<a href="#Not_all_MSAA_features_utilized_by_3rd">Not all MSAA features
+utilized by 3rd party vendors</a><br>
+<a href="#Missing_functionality_in_MSAA">Missing functionality in MSAA</a><br>
+<a href="#Dueling_text_equivalents">Dueling text equivalents</a><br>
+<a href="#Issues_with_Links">Issues with Links</a><br>
+<a href="#MSAA_Implementation_is_Not_Performant">Performance Problems</a><br>
+<a href="#Differing_client_implementations">Differing client
+implementations</a><br>
+<a href="#Undocumented_Window_Class_Usage">Undocumented Window Class
+Usage</a><br>
+<a href="#Vendor_quirks">Vendor quirks</a><br>
+<br>
+</div>
+<a href="#geckoimpl">4.
+Example: How Gecko and Mozilla Implement MSAA</a><br>
+<div style="margin-left: 40px;"><a
+ href="#Creation_of_IAccessible_Objects">Creation
+of IAccessible Objects</a><br>
+<a
+ href="#The_Accessible_Tree_vs._the_DOM_Tree">The
+Accessible Tree vs. the DOM Tree</a><br>
+<a
+ href="#The_Implementations_Behind_IAccessible">The
+Various Implementations of IAccessible</a><br>
+<a
+ href="#Generating_MSAA_Events">Generating
+MSAA Events</a><br>
+<br>
+</div>
+<a href="#feedback">5. Feedback</a><br>
+</div>
+<h2><a name="intro"></a>1. Intro: What is MSAA?</h2>
+<ul>
+  <p>MSAA is the <a
+ href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaastart_9w2t.asp?frame=true">Microsoft
+Active Accessibility (MSAA) API</a> , used on Windows operating systems.
+to support assistive technologies for users with disabilities. <br>
+  </p>
+  <p>Third party assistive technology, such as screen readers, screen
+magnifiers and voice input software, want to track what's happening
+inside Mozilla. They needs to know about focus changes and other events,
+and it needs to know what objects are contained in the current document
+or dialog box. Using this information, a screen reader will speak out
+loud important changes to the document or UI, and allow the user to
+track where they navigate. The screen reader user can navigate the web
+page using screen reader commands or browser commands, and the two
+pieces of software must remain in sync. Some screen readers can even
+show information on a <a href="http://www.deafblind.com/display.html">refreshable
+braille display</a>. Screen magnifiers will zoom to the focus, keeping
+it on the screen at all times, or even allow the user to enter a special
+low vision document reading mode, with a variety of features such as
+ticker mode where text is streamed on a single line.&nbsp; Finally,
+voice dictation software needs to know what's in the current document or
+UI in order to implement "say what you see" kinds of features.<br>
+  <br>
+On Microsoft Windows, these kinds of assistive technology acquire this
+necessary information via a combination of&nbsp; hacks, MSAA and
+proprietary DOMs. 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 (Gecko does not). This is so commonly done,
+that no one even bothers to support the MSAA caret, after all the hack
+is general solution works with pretty much all applications.</p>
+  <p>MSAA provides information in several different ways: </p>
+  <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>Custom interface extensions via interfaces via QueryInterface
+and QueryService. This can provide assistive technology with contextual
+information specific to your object model. For example, Gecko support
+ISimpleDOMNode to provide information about the DOM node for an
+accessible object.<br>
+    </li>
+    <li>A set of system messages  that confer accessibility-related
+events such as focus changes, changes to document content and state
+changes in UI objects like checkboxes.<br>
+    </li>
+  </ol>
+  <p></p>
+  <p> To really learn about MSAA, you need to download the entire <a
+ href="http://msdn.microsoft.com/library/default.asp?URL=/downloads/list/accessibility.asp">MSAA
+SDK</a>. Without downloading the SDK, you won't get the extremely
+useful tools, which help a great deal in the learning process. The
+Accessible Event Watcher 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, and what the screen boundaries of each object
+are. In addition, MSDN has improved their <a
+ href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaastart_9w2t.asp">MSAA
+documentation</a>.<br>
+  </p>
+</ul>
+<h2><a name="cheatsheets"></a>2. Deciding Which MSAA Features to Support<br>
+</h2>
+<h2 style="margin-left: 40px;"><a name="methods"></a>MSAA Methods -
+Cheat Sheet for Developers</h2>
+<div style="margin-left: 40px;"> </div>
+<ul style="margin-left: 40px;">
+  <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 - a minimal
+implementation would contain those marked "<span
+ style="font-weight: bold;">[important]</span>" :<br>
+  </p>
+  <ul>
+    <li>get_accParent: Get the parent of an IAccessible. <span
+ style="font-weight: bold;">[important]</span><br>
+    </li>
+    <li>get_accChildCount: Get the number of children of an
+IAccessible. <span style="font-weight: bold;">[important]</span></li>
+    <li>get_accChild: Get the child of an IAccessible. <span
+ style="font-weight: bold;">[important]</span></li>
+    <li>get_accName: Get the "name" of the IAccessible, for example the
+name of a button, checkbox or menu item. <span
+ style="font-weight: bold;">[important]</span></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. <span style="font-weight: bold;">[important]</span></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. <br>
+    </li>
+	  is it a link, static text, editable text, a checkbox, or a table
+cell, etc. <span style="font-weight: bold;">[important]</span><span
+ style="font-weight: bold;"></span><li>get_accState: a 32 bit field
+representing possible on/off states, such as focused, focusable,
+selected, selectable, visible, protected (for passwords), checked, etc. <span
+ style="font-weight: bold;">[important]</span> </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 (underlined alt+combo mnemonic)<br>
+    </li>
+    <li>get_accFocus: Which child is focused? <span
+ style="font-weight: bold;">[important]</span></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. <span
+ style="font-weight: bold;">[important]</span></li>
+    <li>accLocation: Get the x,y coordinates, and the height and width
+of this IAccessible node. <span style="font-weight: bold;">[important]<br>
+      </span></li>
+    <li>accNavigate: Navigate to the first/last child, previous/next
+sibling, up, down, left or right from this IAccessible. <span
+ style="font-weight: bold;">[important, </span><span
+ style="font-weight: bold;">but no need to implement up/down/left/right</span><span
+ style="font-weight: bold;">]</span></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>
+</ul>
+<div style="margin-left: 40px;"> </div>
+<h2 style="margin-left: 40px;"><a name="events"></a>MSAA Events Cheat
+Sheet<br>
+</h2>
+<div style="margin-left: 40px;"> </div>
+<ul style="margin-left: 40px;">
+  <p>For information on what each event does, see the <a
+ href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaaccrf_7jlf.asp">MSDN
+Event Constants page</a>.</p>
+  <p>Check with your assistive technology partners to find out what
+events you need to support. There's a very good chance they won't ask
+for more than the events marked <span style="font-weight: bold;">[important]</span>:<br>
+  </p>
+</ul>
+<div style="margin-left: 40px;"> </div>
+<table
+ style="text-align: left; width: 75%; margin-right: auto; margin-left: auto;"
+ border="0" cellspacing="2" cellpadding="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">EVENT_SYSTEM_SOUND<br>
+EVENT_SYSTEM_ALERT<br>
+EVENT_SYSTEM_FOREGROUND<br>
+EVENT_SYSTEM_MENUSTART<br>
+EVENT_SYSTEM_MENUEND<br>
+EVENT_SYSTEM_MENUPOPUPSTART <span style="font-weight: bold;">[important]</span><br>
+EVENT_SYSTEM_MENUPOPUPEND <span style="font-weight: bold;">[important]</span><br>
+EVENT_SYSTEM_CAPTURESTART<br>
+EVENT_SYSTEM_CAPTUREEND<br>
+EVENT_SYSTEM_MOVESIZESTART<br>
+EVENT_SYSTEM_MOVESIZEEND<br>
+EVENT_SYSTEM_CONTEXTHELPSTART<br>
+EVENT_SYSTEM_CONTEXTHELPEND<br>
+EVENT_SYSTEM_DRAGDROPSTART<br>
+EVENT_SYSTEM_DRAGDROPEND<br>
+EVENT_SYSTEM_DIALOGSTART<br>
+EVENT_SYSTEM_DIALOGEND<br>
+EVENT_SYSTEM_SCROLLINGSTART<br>
+EVENT_SYSTEM_SCROLLINGEND <span style="font-weight: bold;">[possibly
+important, talk to AT vendor]</span><br>
+EVENT_SYSTEM_SWITCHSTART<br>
+EVENT_SYSTEM_SWITCHEND<br>
+EVENT_SYSTEM_MINIMIZESTART<br>
+EVENT_SYSTEM_MINIMIZEEND<br>
+      </td>
+      <td style="vertical-align: top;">EVENT_OBJECT_CREATE <span
+ style="font-weight: bold;">[don't implement, watching system generated
+versions of this event causes </span><span style="font-weight: bold;">assistive
+technology </span><span style="font-weight: bold;">crashes]</span><br>
+EVENT_OBJECT_DESTROY <span style="font-weight: bold;">[don't
+implement, watching system generated versions of this event causes
+assistive technology crashes]</span><br>
+EVENT_OBJECT_SHOW<br>
+EVENT_OBJECT_HIDE<br>
+EVENT_OBJECT_REORDER <span style="font-weight: bold;">[important for
+mutating docs in future, but not yet]</span><br>
+EVENT_OBJECT_FOCUS <span style="font-weight: bold;">[important]</span><br>
+EVENT_OBJECT_SELECTION<br>
+EVENT_OBJECT_SELECTIONADD<br>
+EVENT_OBJECT_SELECTIONREMOVE<br>
+EVENT_OBJECT_SELECTIONWITHIN<br>
+EVENT_OBJECT_STATECHANGE <span style="font-weight: bold;">[important
+for checkboxes and radio buttons]</span><br>
+EVENT_OBJECT_LOCATIONCHANGE<br>
+EVENT_OBJECT_NAMECHANGE<br>
+EVENT_OBJECT_DESCRIPTIONCHANGE<br>
+EVENT_OBJECT_VALUECHANGE<br>
+EVENT_OBJECT_PARENTCHANGE<br>
+EVENT_OBJECT_HELPCHANGE<br>
+EVENT_OBJECT_DEFACTIONCHANGE<br>
+EVENT_OBJECT_ACCELERATORCHANGE<br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"> </div>
+<h2 style="margin-left: 40px;"><a name="states"></a>MSAA States Cheat
+Sheet<br>
+</h2>
+<div style="margin-left: 40px;"> </div>
+<ul style="margin-left: 40px;">
+  <p>For information on what each state does, see the <a
+ href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaaccrf_7jlf.asp">MSDN
+State Constants page</a>.</p>
+  <p>Check with your assistive technology partners to find out what
+states you need to support. There's a very good chance they won't ask
+for more than the states marked <span style="font-weight: bold;">[important]</span>:</p>
+</ul>
+<div style="margin-left: 40px;"></div>
+<table
+ style="text-align: left; width: 75%; margin-right: auto; margin-left: auto;"
+ border="0" cellspacing="2" cellpadding="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">STATE_UNAVAILABLE <span
+ style="font-weight: bold;">[important]</span><br>
+STATE_SELECTED <span style="font-weight: bold;">[important]</span><br>
+STATE_FOCUSED <span style="font-weight: bold;">[important]</span><br>
+STATE_PRESSED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+STATE_CHECKED <span style="font-weight: bold;">[important]</span><br>
+STATE_MIXED<br>
+STATE_READONLY <span style="font-weight: bold;">[important]</span><br>
+STATE_HOTTRACKED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
+STATE_DEFAULT <span style="font-weight: bold;">[important]</span><br>
+STATE_EXPANDED <span style="font-weight: bold;">[important]</span><br>
+STATE_COLLAPSED <span style="font-weight: bold;">[important]</span><br>
+STATE_BUSY <span style="font-weight: bold;">[important]</span><br>
+STATE_FLOATING&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
+STATE_MARQUEED&nbsp; <br>
+STATE_ANIMATED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
+STATE_INVISIBLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
+      <br>
+      </td>
+      <td style="vertical-align: top;">STATE_OFFSCREEN <span
+ style="font-weight: bold;">[important]</span><br>
+STATE_SIZEABLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
+STATE_MOVEABLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
+STATE_SELFVOICING&nbsp;&nbsp; &nbsp;<br>
+STATE_FOCUSABLE <span style="font-weight: bold;">[important]</span><br>
+STATE_SELECTABLE <span style="font-weight: bold;">[important]</span><br>
+STATE_LINKED <span style="font-weight: bold;">[important]</span><br>
+STATE_TRAVERSED <span style="font-weight: bold;">[important]</span><br>
+STATE_MULTISELECTABLE <span style="font-weight: bold;">[important]</span><br>
+STATE_EXTSELECTABLE &nbsp;<br>
+STATE_ALERT_LOW&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>
+STATE_ALERT_MEDIUM&nbsp; &nbsp;<br>
+STATE_ALERT_HIGH&nbsp;&nbsp;&nbsp; &nbsp;<br>
+STATE_PROTECTED <span style="font-weight: bold;">[important]</span><br>
+STATE_HASPOPUP <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<h2 style="margin-left: 40px;"><a name="roles"></a>MSAA Roles Cheat
+Sheet<br>
+</h2>
+<div style="margin-left: 40px;"> </div>
+<ul style="margin-left: 40px;">
+  <p>For information on what each role does, see the <a
+ href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaaccrf_7jlf.asp">MSDN
+Role Constants page</a>.</p>
+  <p>Check with your assistive technology partners to find out what
+roles you need to support. There's a very good chance they won't ask for
+more than the roles marked <span style="font-weight: bold;">[important]</span>:<br>
+There is no need to support the objects marked <span
+ style="font-weight: bold;">[inserted by system]. </span>Windows will
+add those objects to your hierarchy for you.<br>
+  </p>
+</ul>
+<div style="margin-left: 40px;"> </div>
+<table
+ style="text-align: left; width: 75%; margin-right: auto; margin-left: auto;"
+ border="0" cellspacing="2" cellpadding="2">
+  <tbody>
+    <tr>
+      <td style="vertical-align: top;">ROLE_TITLEBAR <span
+ style="font-weight: bold;">[inserted by system]</span><br>
+ROLE_MENUBAR <span style="font-weight: bold;">[important if you don't
+use native menus]</span><br>
+ROLE_SCROLLBAR<br>
+ROLE_GRIP<br>
+ROLE_SOUND<br>
+ROLE_CURSOR<br>
+ROLE_CARET<br>
+ROLE_ALERT<br>
+ROLE_WINDOW <span style="font-weight: bold;">[inserted by system]</span><br>
+ROLE_CLIENT <span style="font-weight: bold;">[important]</span><br>
+ROLE_MENUPOPUP <span style="font-weight: bold;">[important]</span><br>
+ROLE_MENUITEM <span style="font-weight: bold;">[important]</span><br>
+ROLE_TOOLTIP<br>
+ROLE_APPLICATION<br>
+ROLE_DOCUMENT<br>
+ROLE_PANE <span style="font-weight: bold;">[important]</span><br>
+ROLE_CHART<br>
+ROLE_DIALOG<br>
+ROLE_BORDER<br>
+ROLE_GROUPING<br>
+ROLE_SEPARATOR <span style="font-weight: bold;">[important]</span><br>
+ROLE_TOOLBAR<br>
+ROLE_STATUSBAR <span style="font-weight: bold;">[important]</span><br>
+ROLE_TABLE <span style="font-weight: bold;">[important]</span><br>
+ROLE_COLUMNHEADER<br>
+ROLE_ROWHEADER<br>
+ROLE_COLUMN<br>
+ROLE_ROW<br>
+ROLE_CELL <span style="font-weight: bold;">[important]</span><br>
+ROLE_LINK <span style="font-weight: bold;">[important]</span><br>
+ROLE_HELPBALLOON<br>
+ROLE_CHARACTER<br>
+      </td>
+      <td style="vertical-align: top;">ROLE_LIST <span
+ style="font-weight: bold;">[important]</span><br>
+ROLE_LISTITEM <span style="font-weight: bold;">[important]</span><br>
+ROLE_OUTLINE <span style="font-weight: bold;">[important]</span><br>
+ROLE_OUTLINEITEM <span style="font-weight: bold;">[important]</span><br>
+ROLE_PAGETAB <span style="font-weight: bold;">[important]</span><br>
+ROLE_PROPERTYPAGE <span style="font-weight: bold;">[important]</span><br>
+ROLE_INDICATOR<br>
+ROLE_GRAPHIC <span style="font-weight: bold;">[important]</span><br>
+ROLE_STATICTEXT <span style="font-weight: bold;">[important]</span><br>
+ROLE_TEXT <span style="font-weight: bold;">[important]</span><br>
+ROLE_PUSHBUTTON <span style="font-weight: bold;">[important]</span><br>
+ROLE_CHECKBUTTON <span style="font-weight: bold;">[important]</span><br>
+ROLE_RADIOBUTTON <span style="font-weight: bold;">[important]</span><br>
+ROLE_COMBOBOX <span style="font-weight: bold;">[important]</span><br>
+ROLE_DROPLIST <span style="font-weight: bold;">[important]</span><br>
+ROLE_PROGRESSBAR <span style="font-weight: bold;">[important]</span><br>
+ROLE_DIAL<br>
+ROLE_HOTKEYFIELD<br>
+ROLE_SLIDER<br>
+ROLE_SPINBUTTON<br>
+ROLE_DIAGRAM<br>
+ROLE_ANIMATION<br>
+ROLE_EQUATION<br>
+ROLE_BUTTONDROPDOWN<br>
+ROLE_BUTTONMENU<br>
+ROLE_BUTTONDROPDOWNGRID<br>
+ROLE_WHITESPACE<br>
+ROLE_PAGETABLIST <span style="font-weight: bold;">[important]</span><br>
+ROLE_CLOCK<br>
+ROLE_SPLITBUTTON<br>
+ROLE_IPADDRESS<br>
+ROLE_NOTHING<br>
+      <br>
+      </td>
+    </tr>
+  </tbody>
+</table>
+<div style="margin-left: 40px;"></div>
+<h2 style="margin-left: 40px;"><a name="objid"></a>MSAA Object
+Identifiers Cheat Sheet<br>
+</h2>
+<div style="margin-left: 40px;"> </div>
+<p style="margin-left: 80px;">For information on what each object
+identifier does, see the <a
+ href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaaccrf_7jlf.asp">MSDN
+Object Identifiers Constants page</a>.</p>
+<div style="margin-left: 80px;">Check with <big><big></big></big>our
+assistive technology partners to find out what object identifiers you
+need to support. There's a very good chance they won't ask for more than
+the object itentifiers marked <span style="font-weight: bold;">[important]</span>:<br>
+</div>
+<dl style="margin-left: 120px;">
+  <dt>OBJID_ALERT<br>
+OBJID_CARET<br>
+OBJID_CLIENT <span style="font-weight: bold;">[important]</span><br>
+OBJID_CURSOR<br>
+OBJID_HSCROLL<br>
+OBJID_NATIVEOM <span style="font-weight: bold;">[important? might be
+useful for supporting custom interfaces, need to research]</span><br>
+OBJID_MENU<br>
+OBJID_QUERYCLASSNAMEIDX<br>
+OBJID_SIZEGRIP<br>
+OBJID_SOUND<br>
+OBJID_SYSMENU<br>
+OBJID_TITLEBAR<br>
+OBJID_VSCROLL<br>
+OBJID_WINDOW<br>
+  </dt>
+</dl>
+<h2><a name="quirks"></a>3. Dealing with the Quirks of MSAA</h2>
+<div style="margin-left: 40px;"> </div>
+<p style="margin-left: 40px;">MSAA has a well deseved reputation for
+quirkiness. It is not "plug and play", and will take a lot of
+testing/refinement before your solution works with any product. Here are
+some of its quirks and some solutions/workarounds:<br>
+</p>
+<div style="margin-left: 40px;"><big><a name="Crash_prone"></a>MSAA can
+be crash prone</big><br>
+</div>
+<div style="margin-left: 80px;"><br>
+<span style="text-decoration: underline;">Problem</span>: Many of
+MSAA's crash occur because more than one process is refcounting the same
+objects, and because pointers are being shared between processes. When
+your application closes, different signals are typically broadcast. For
+example, the application window closes and the window is blurred. It is
+impossible to know if and when the 3rd party assistive technology will
+use one of these signals to release the objects of yours that is is
+refcounting. This can lead to crashes where it releases something and
+the wrong time, when some of your dll's are unloaded but not others,
+and a destructor is called in an unloaded DLL.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Create a
+"shutdown" method for each internal accessible object, to remove any
+references to other internal objects before any of your dll's are
+unloaded. In order to do this effectively, you will have to keep track
+of every accessible object that you create. The shutdown method for an
+accessibility object should be called whenever the document or UI object
+it refers to goes away. The easiest way to do that is to keep a pointer
+to an accessible in each internal UI object. If that pointer is
+non-null, then there is an accessible object for it. Whenever the UI
+object is destroyed, shutdown its accessible object as well. In
+Gecko/Mozilla we are not allowed to keep this extra pointer for each
+accessible object, so when accessibility is turned on we use a hash
+table to cache these objects. Such a cache must be kept in perfect sync
+with the tree of UI and document objects, which is difficult. Therefore,
+unless 4 bytes extra on each object is criticial in your application,
+just keep the extra pointer around instead of using a hash table.<br>
+<br>
+Also, don't implement EVENT_OBJECT_CREATE or EVENT_OBJECT_DESTROY.
+Vendors have found that watching these events causes crashes.<br>
+<br>
+</div>
+<div style="margin-left: 40px;"><big><a
+ name="Hacky_caret_tracking_not_working"></a>Hacky caret tracking
+causes problems<br>
+</big></div>
+<div style="margin-left: 80px;"><br>
+<span style="text-decoration: underline;">Problem</span>: Assistive
+technologies do not use the MSAA caret. They follow screen draws,
+looking for a vertical blinking line. Unfortunately, some products can
+get confused by the vertical lines on other objects, such as list boxes,
+even though those lines are not blinking. The assistive technology may
+not see your caret at all.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Make sure
+there is a configuration file for each assistive technology specific to
+your application. Read the manual or help, and find the keystroke or
+commands for training the caret, and save this information in the
+configuration file. Don't support the MSAA caret, none of the vendors
+use it.<br>
+<br>
+</div>
+<div style="margin-left: 40px;"> <big><a name="Event_window_confusion"></a>Event
+window handle is incorrect</big><br>
+<br>
+<div style="margin-left: 40px;"><span
+ style="text-decoration: underline;">Problem</span>: The screen reader
+or other assistive technology does not track the focus or other events
+correctly.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: This may be
+because you are reporting that the events in a different window from the
+current system focused. The assistive technology may be asking
+GetGUIThreadInfo for its hwndFocus, and throwing away MSAA events that
+are not in the currently focused window. Even if you are visibly showing
+window focus on the correct window, you must also tell the operating
+system to focus this window before any other accessibility events get
+fired in it. </div>
+<br>
+<big><a name="Confusion_with_system-generated_events"></a>Confusion
+with system-generated events</big><br>
+<br>
+<div style="margin-left: 40px;"> <span
+ style="text-decoration: underline;">Problem</span>: When you test with
+Accessible Event Watcher in the MSAA SDK, you will see many events that
+your application did not generate. Microsoft Windows generates some
+events for you. This is extremely annoying. The assistive technology has
+no way to tell whether the event came from your application or from
+Windows. For example, when you set window focus, Windows will generate
+an EVENT_OBJECT_FOCUS event an a ROLE_WINDOW object it also generated
+for you. If you happen to set window focus after you fired your own
+EVENT_OBJECT_FOCUS event on an object in the widnow, your event will be
+ignored, because assistive technology software tends to pay attention
+only to the last focus event.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: When an
+object is about to get focused in a different window, make sure you
+focus a window before you fire your own focus events for objects inside
+it. Test using Accessible Event Watcher in the MSAA SDK, and use the
+settings panel to watch subsets of accessibility events. Count on the
+assistive technology to make sense out the jumble of extra
+system-generated events, it's not your problem.<br>
+</div>
+<br>
+<big><a name="No_unique_child_ID_for_object_in_window"></a>No unique
+child ID for event target in window</big><br>
+<br>
+<div style="margin-left: 40px;"> <span
+ style="text-decoration: underline;">Problem</span>: MSAA expects
+events to be reported using NotifyWinEvent(eventNum, hWnd, worldID,
+childID), and there may not be an obvious way to get a window handle and
+a 32 bit childID for an object. You may be using windowless controls, or
+have an entire document with lots of objects in a given window. The
+child ID must be unique, because this is what the assistive technology
+will use to retrieve the accessible via AccessibleObjectFromEvent()
+which ends up using get_accChild on the accessible for the given window.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: In
+Gecko/Mozilla, we did not want to store an extra 32 bit unique ID value
+on every object. Instead, we hand back a 32 bit value derived from the
+UI object's pointer, which is unique. We ensure that the value we hand
+back is always negative. When the get_accChild call comes back, we check
+our hash table cache for that window to see if there's an accessible
+object still associated with that unique value. This means the client
+must use AccessibleObjectFromEvent immediately, because there is a
+danger that the object will go away, and another different object will
+be created with the same pointer value.That case seems extremely remote,
+because information from events is generally retrieved right after the
+event.<br>
+<br>
+If you're not using a hash table to keep track of unique ID's, store
+the child ID's and objects for the last 50 or so events in a circular
+array. In practice, this is enough to keep AccessibleObjectFromEvent()
+happy.<br>
+</div>
+<br>
+<big><a name="Not_all_MSAA_features_utilized_by_3rd"></a>Not all MSAA
+features utilized by 3rd party vendors</big><br>
+<br>
+<div style="margin-left: 40px;"> <span
+ style="text-decoration: underline;">Problem</span>: The assistive
+technology does not use 50% of what's available in MSAA, e.g. MSAA
+caret, a lot of events, roles, states and methods. It's difficult to
+know which things to support.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Use this
+document to see what is generally considered important by assistive
+technology manufacturers. Contact the the top vendors early and often as
+you plan and implement your architecture, to see what's important to
+them. Implement only what's needed -- supporting everything would take
+too long for zero results.<br>
+</div>
+<br>
+<big><a name="Missing_functionality_in_MSAA"></a>Missing functionality
+in MSAA</big><br>
+<br>
+<div style="margin-left: 40px;"><span
+ style="text-decoration: underline;">Problem and solutions:</span>
+Assistive technology vendors need some things which MSAA does not
+provide, such as:<br>
+</div>
+</div>
+<ul style="margin-left: 40px;">
+  <ul>
+    <li>No way of signifying that a document has finished
+loading.&nbsp; Fire EVENT_OBJECT_STATECHANGE for a window/client/pane
+object when it starts to load a new document. Use STATE_BUSY to indicate
+that a new document is being loaded. When the loading has finished, fire
+another EVENT_OBJECT_STATECHANGE event and clear the STATE_BUSY
+flag.&nbsp; </li>
+    <li>No method to get clipped/unclipped bounds of a piece of text
+within a text object. This is needed by screen magnifiers. No scrollTo
+method, also needed by screen magnifiers. Implement a custom interface
+for text objects, and support it through QueryInterface or QueryService
+if it's being implemented on a different object than IAccessible is.
+Support a scrollTo method which takes a text index, and a
+getClippedBounds and getUnclippedBounds method which takes a start and
+end index. Publish your custom interface.</li>
+    <li>No way for assistive technology to know when scrolling has
+stopped. Fire the EVENT_SYSTEM_SCROLLINGEND event to indicate when
+scrolling has ended (try not to fire too many of these, wait until
+scrolling has truly stopped). There is no need to support
+EVENT_SYSTEM_SCROLLINGSTART, it is not used by assistive technology.<br>
+    </li>
+  </ul>
+  <ul>
+    <li>No support for document formatting or "DOM" as requested by
+some vendors: support a custom interface that gives them the formatting
+information they are requesting.<br>
+    </li>
+  </ul>
+</ul>
+<div style="margin-left: 40px;"><big><a name="Dueling_text_equivalents"></a>Dueling
+text equivalents</big><br>
+<br>
+<div style="margin-left: 40px;"><span
+ style="text-decoration: underline;"> Problem</span>: There are three
+kinds of text equivalents, and it is difficult to know when to use each.
+Different applications behave differently in this regard. For example,
+Acrobat uses accessible value for text labels where as most programs use
+accessible name. There are different roles for text objects,
+ROLE_STATICTEXT and ROLE_TEXT (editable text), which seems to be used
+for non-editable text in many places.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Be as
+consistent with Internet Explorer as possible. Use accessible name for
+most text equivalents, and accessible value for URL's. Don't use
+accessible description unless you really do have a long description for
+the object you need to expose -- most assistive technology makes little
+use of it. Use ROLE_STATICTEXT for labels specific to dialog and UI
+controls, and always use ROLE_TEXT for document text even if the text is
+not editable (in that case use ROLE_TEXT with STATE_READONLY).<br>
+</div>
+<br>
+<big><a name="Issues_with_Links"></a>Issues with Links</big><br>
+<br>
+<div style="margin-left: 40px;"> <span
+ style="text-decoration: underline;">Problem</span>: The assistive
+technology has inflexible heuristics when it comes to reading links.
+First, it won't read the object unless the states are correctly set.
+Second, it can mishandle the object if it cannot parse the whitespace
+according to its own rules.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Make sure
+the ROLE_LINK object and its child ROLE_TEXT objects all have
+STATE_LINKED set. For multi-line links with a line break in the middle,
+make sure there is no whitespace at the beginning or end of any of the
+accessible names, and make sure there is a \r\n where the line breaks
+occur in the accessible name for the ROLE_LINK. For an example of how to
+do this properly, see Internet Explorer or Gecko. Again, if it's not
+done exactly this way, some links will not be read.<br>
+</div>
+<br>
+<big><a name="MSAA_Implementation_is_Not_Performant"></a>MSAA
+Implementation is Not Performant</big><br>
+<br>
+<div style="margin-left: 40px;"><span
+ style="text-decoration: underline;"> Problem</span>: The assistive
+technology may interact slowly with your application.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Try not to
+calculate the same things more than once or create the same objects more
+than once. For example, create and cache an object's children when you
+look for them in get_accChildCount(), so that you can just hand them
+back when asked for using get_accChild() or accNavigate(). Support
+IEnumVARIANT so that the MSAA client can ask for a number of children in
+one call. In custom interfaces, create methods that hand back a lot of
+data in one call, rather than requiring a large number of calls. Fewer
+calls are much better better because COM Marshaling is slow.<br>
+</div>
+<br>
+<big><a name="Differing_client_implementations"></a>Differing client
+implementations</big><br>
+<br>
+<div style="margin-left: 40px;"> <span
+ style="text-decoration: underline;">Problem</span>: Every assistive
+technology uses MSAA differently.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: We don't
+know of any outright conflicts in the differing uses of MSAA (yet).
+However, be on guard. If a vendors asks you to do something different
+from the spec, it's better to check with the other vendors before moving
+forward. Check to see what applications from Microsoft do in a similar
+situation.<br>
+</div>
+<br>
+<big><a name="Undocumented_Window_Class_Usage"></a>Undocumented Window
+Class Usage</big><br>
+<br>
+<div style="margin-left: 40px;"> <span
+ style="text-decoration: underline;">Problem</span>: most assistive
+technologies won't use your MSAA implementation out of the box. They
+must list your window classes somewhere in their implementation, and
+then turn on MSAA support when a window of that class receives focus.
+The window class is also used to determine a host of hard-coded
+behaviors, such as whether or not a screen reader will load the entire
+MSAA tree into a special buffer for the user to navigate with screen
+reader commands. This is only supposed to occur for document navigation,
+not for UI/dialogs. where your application's keyboard commands will be
+solely used to navigate.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Contact each
+vendor and let them know what window classes you will be using MSAA for.
+If possible, use a different window class name for documents/content
+than you use for UI/dialogs. Or, do what Mozilla does&nbsp; - expose a
+control ID (GWL_ID) of 1 for content, and 0 for UI. Consistent window
+class names are important for the assistive technology vendors, so that
+they can determine what code to run for a given window. Don't change
+window class names after you have shipped a version.<br>
+</div>
+<br>
+<big><a name="Vendor_quirks"></a>Vendor quirks</big><br>
+<br>
+<div style="margin-left: 40px;"> <span
+ style="text-decoration: underline;">Problem</span>: Because assistive
+technology tends to utilize MSAA as an additional solution resting on
+top of old hacks, rather than a completely clean and separate way to
+deal with an application, and because of the quirky nature of MSAA and
+of the inflexible heuristics that screen readers use, we do not have a
+"plug and play solution". In addition, assistive technology vendors are
+tiny companies, often scrambling to keep up with changes in the
+applications they already support, or new products other than yours
+which they need to support. It's very difficult to get vendors to spend
+time testing an MSAA implementation, send feedback or help find out why
+things aren't working. Time and version commitments often fall through.
+There is always a belated new version due around corner, after which you
+will be promised to be the next priority.<br>
+<br>
+<span style="text-decoration: underline;">Solution</span>: Try to reach
+out in a friendly manner to the assistive technology company. Be as easy
+to work with as you possibly can -- this includes being extremely
+responsive to their bug reports with new test builds, as well as being
+very communicative about what you have changed and when. Do as much work
+as you possibly can without their help. See if your organization can
+offer something they can't get for themselves. Be patient, and set your
+expectations to a reasonable level. Realize that it's about both pride
+and revenue for these companies, and that they need to sell a lot of
+copies of their software to make up the work they put in to support
+your app. Remember that no matter how small they are, you need them more
+than they need you, unless your application's accessibility is being
+demanded by end-users.</div>
+</div>
+<h2><a name="geckoimpl"></a>4. Example: How Gecko and Mozilla Implement
+MSAA<br>
+</h2>
+<p style="margin-left: 40px;">The <a
+ href="http://lxr.mozilla.org/seamonkey/source/accessible/">Accessible
+module</a> is where the Mozilla MSAA implementation lives. Feel free to <a
+ href="http://lxr.mozilla.org/seamonkey/source/accessible/">peruse the
+source code in the accessible module</a> whenever you want to see how
+something can be implemented.<br>
+</p>
+<p style="margin-left: 40px;">The accessible module is also where
+support for Sun's <a
+ href="http://wwws.sun.com/software/star/gnome/accessibility/architecture.html">ATK</a>
+accessibility API for Linux and UNIX is implemented. For documentation
+specific to the Mozilla ATK effort, supported by Sun Microsystems, see
+the <a
+ href="http://www.mozilla.org/projects/ui/accessibility/unix/index.html">Mozilla
+accessibility on Unix</a> page.</p>
+<h3 style="margin-left: 40px;"><a name="Creation_of_IAccessible_Objects"></a>Creation
+of IAccessible Objects<br>
+</h3>
+<ul style="margin-left: 40px;">
+  <p> The first thing that happens when an assistive technology wants to
+watch our application is that calls the Windows API function
+AccessibleObjectFromWindow(). This usually happens right after a window
+gets focused.<br>
+  </p>
+  <p>When the WIN32 API function AccessibleObjectFromWindow() is
+called, Windows 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 your root object in the window. In
+our case, this event is received in <a
+ href="http://lxr.mozilla.org/seamonkey/source/widget/src/windows/nsWindow.cpp#4370">mozilla/widget/src/windows/nsWindow.cpp</a>.
+We send back an IAccessible pointer which can be used by the client to
+get information about this root object. The assistive technology will
+use that root IAccessible to traverse the rest of the object tree, by
+navigating to children and then siblings, etc. Every navigation function
+such as accNavigate(), get_accChild() and get_accParent() returns an
+IAccessible pointer. <br>
+  </p>
+  <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 <a
+ href="http://lxr.mozilla.org/seamonkey/source/layout/html/base/src/nsPresShell.cpp#6345">PresShell::HandleEventInternal()</a>
+via the creation of an <a
+ href="http://lxr.mozilla.org/seamonkey/find?string=msaa/nsDocAccessibleWrap">nsDocAccessibleWrap</a>
+for an inner window or <a
+ href="http://lxr.mozilla.org/seamonkey/find?string=msaa/nsRootAccessibleWrap">nsRootAccessibleWrap</a>
+for a top level window. These classes implement both nsIAccessible, our
+cross platform API, as well as IAccessible, which is specific to
+Windows/MSAA/COM. The cross-platform nsDocAccessible and
+nsRootAccessible classes they inherit from are then told to start
+listening for DOM, page load and scroll events.&nbsp; These events cause
+MSAA-specific events, such as EVENT_OBJECT_FOCUS or
+EVENT_OBJECT_STATECHANGE, to fire on UI and document objects within the
+applicable window. We'll explain more about events later in this section.<br>
+  </p>
+  <p>Until the WM_GETOBJECT message is processed, the Gecko
+accessibility service is not used, and thus the accessibility.dll is not
+loaded, so there is almost zero overhead for accessibility API support
+in Mozilla or Gecko, in the general case. Once the accessibility
+service is created, however, Gecko loads code to create an object on
+demand for every UI or document object that should support IAccessible.
+The created objects are cached in a hash table, and shutdown when
+they're no longer needed. They may still exist in memory in a
+nonfunctional state until the assistive technology completely releases
+them. See the section on accessible roles to see what kinds of objects
+Gecko support IAccessible for.<br>
+  </p>
+</ul>
+<div style="margin-left: 40px;"> </div>
+<h3 style="margin-left: 40px;"><a
+ name="The_Accessible_Tree_vs._the_DOM_Tree"></a>The Accessible Tree
+vs. the DOM Tree<br>
+</h3>
+<div style="margin-left: 40px;"> </div>
+<ul style="margin-left: 40px;">
+  <p>After the root or doc accessible for a window has been created and
+handed back to the MSAA client, it is used to traverse the rest of the
+IAccessible tree using accNavigation, get_accChild and get_accParent.
+Any IAccessible will support those methods. We also support
+IEnumVARIANT::Next() which allows for fast marshaling of all of an
+objects children to a client via COM. In other words, the assistive
+technology can say "give me all 20 children of this object into this
+array". That's much faster than 20 separate calls, one for each child.<br>
+  </p>
+  <p>In Mozilla, the client has another choice for tree navigation --
+it can utilize data stored in the DOM via Mozilla's custom <a
+ href="http://lxr.mozilla.org/seamonkey/source/accessible/public/msaa/ISimpleDOMNode.idl">ISimpleDOMNode</a>
+COM interface. Any IAccessible can be used to QueryInterface to an
+ISimpleDOMNode, and vice versa for a round trip. However, one might QI
+ISimpleDOMNode to IAccessible only to find it is null, which means that
+particular node in question is not exposed in the IAccessible tree. See
+the following diagram for examples of nodes that do no support
+IAccessible.<br>
+  </p>
+</ul>
+<div style="margin-left: 40px;"> </div>
+<h3 style="margin-left: 40px;">MSAA tree vs. DOM tree - what's the
+relationship?</h3>
+<div style="margin-left: 40px;"> </div>
+<ul style="margin-left: 40px;">
+  <p> <img
+ src="http://www.mozilla.org/projects/ui/accessibility/images/tree-relativity.gif"
+ alt="Diagram showing MSAA tree is a subset of the DOM tree"
+ title="Diagram showing MSAA tree is a subset of the DOM tree"> </p>
+The MSAA tree and the DOM tree are parallel structures, although the
+MSAA tree is a subset of the DOM tree. <code>QueryInterface()</code> can
+be used to switch between the interfaces used in the two trees
+(IAccessible and ISimpleDOMNode).     If there is no MSAA node for a DOM
+node,&nbsp; pAccessible-&gt;<code>QueryInterface(IID_IAccessible)</code>
+will return null.
+</ul>
+<h3 style="margin-left: 40px;"><a
+ name="The_Implementations_Behind_IAccessible"></a>A Variety of
+Implementations for IAccessible</h3>
+<div style="margin-left: 40px;">
+<div style="margin-left: 40px;">
+<p>There are two main kinds of classes in Mozilla's accessibility class
+hierarchy, platform-specifc and cross-platform. All of the
+platform-specific classes have the word "Wrap" appended to them. The
+Wrap classes contain implementations and interfaces specific to MSAA or
+ATK. These platform-specific classes inherit from cross-platform
+classes, where the most of the implementation is done. For example,
+nsAccessibleWrap inherits from nsAccessible. Every accessible object in
+the MSAA tree has an implementation dertived from nsAccessible, which
+exposes accessibility information through nsIAccessible, in a generic
+cross-platform manner. <br>
+</p>
+<p>This default implementation for nsIAccessible knows how to use
+nsAccessibleTreeWalker to walk Mozilla's content DOM and frame tree,
+exposing only the objects that are needed for accessibility. The
+nsAccessibleTreeWalker class knows what it needs to expose by asking
+each DOM node's primary frame (a Gecko formatting object) for an
+nsIAccessible, using the nsIFrame::GetAccessible() method. If
+nsAccessibleTreeWalker gets an nsIAccessible back, then the DOM node
+considered to be an accessible object. The nsIAccessible that is
+returned is either a new one, or reused from the accessibility cache,
+and the correct type of accessibility object to correctly expose that
+DOM node through the cross-platform nsIAccessible and MSAA-specific
+IAccessible interfaces.<br>
+</p>
+<p>Every accessibility object created must be cached, and must inherit
+from nsAccessibleWrap so that it supports a base implementation of
+nsIAccessible and IAccessible. Apart from that, it is free to override
+IAccessible or nsIAccessible methods. In this way each class is tailored
+to the specific abilities and properties of the HTML or XUL/UI objects
+it applies to, and can support both MSAA, ATK and hopefully any future
+accessibility API's we need to support. For example
+nsHTMLButtonAccessible overrides nsIAccessible::GetAccRole to expose
+ROLE_BUTTON for IAccessible::get_accRole which uses that. <br>
+</p>
+</div>
+</div>
+<ul style="margin-left: 40px;">
+  <p>A more complicated set of nsIAccessible methods which can be
+overridden are GetAccFirstChild/GetAccLastChild/GetAccChildCount, which
+allows for objects to define their own decendant subtrees. The default
+behavior for nsIAccessible::getAccFirstChild is to instantiate 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. This is necessary
+because the image map areas can be in a completely different area of the
+DOM from the image they apply to.<br>
+  </p>
+</ul>
+<div style="margin-left: 40px;"> </div>
+<h3 style="margin-left: 40px;"><a name="Generating_MSAA_Events"></a>Generating
+MSAA Events</h3>
+<div style="margin-left: 40px;"> </div>
+<ul style="margin-left: 40px;">
+  <p>First, keep in mind that most MSAA events aren't utilized by
+accessibility aids. Therefore we implement only the handful that matter.
+See the <a
+ href="file:///c%7C/moz/mozdocs/mozilla-org/html/projects/ui/accessibility/accessible-architecture.html#events">Events</a>
+cheat sheet above for the list of events we implement. By far the most
+important one is EVENT_OBJECT_FOCUS.<br>
+  </p>
+  <p>When a potential accessibility-related event occurs within
+Mozilla, it is typically listened for by nsDocAccessible or
+nsRootAccessible. The event listeners on these classes call
+FireToolkitEvent(), which is implemented for every accessible.
+Eventually, the event ends up at nsDocAccessibleWrap::FireToolkitEvent()
+which calls NotifyWinEvent from the Win32 API. NotifyWinEvent is passed
+arguments for the window the event occurred in, and the ID of the child
+within that window. Accessibility aids use the Win32 call
+SetWinEventHook() to register as a listener for these events. Creating
+a unique child ID for every object within a window can be difficult,
+see the problem and solution for <a
+ href="file:///c%7C/moz/mozdocs/mozilla-org/html/projects/ui/accessibility/accessible-architecture.html#Hacky_caret_tracking_not_working">no
+unique child ID for object in window</a>.<br>
+  </p>
+  <p>The assistive technology chooses which events it is interested in
+learning more about by calling the Win32 method
+AccessibleObjectFromEvent, which returns the IAccessible to the node
+corresponding to the child number that had been indicated from
+NotifyWinEvent(). This ends up asking
+nsDocAccessibleWrap::get_accChild() for a child IAccessible which
+matches the child ID we indicated through NotifyWinEvent(). </p>
+  <p>In Mozilla, we use the DOM node pointer in the accessible object
+as a basis for its child ID, which is also used as a hash key into our
+cache. We also negate the 32 bit value so that it is always &lt;0,
+telling us that they're really looking for the IAccessible for an event,
+not child number x. During the callback, we look up the original
+accessible node in the nsDocAccessible's cache and return it. <br>
+  </p>
+</ul>
+<div style="margin-left: 40px;"> </div>
+<div style="margin-left: 40px;"> </div>
+<h2><a name="feedback"></a>5. Feedback</h2>
+<div style="margin-left: 40px;">How can this document be improved? Was
+it useful? Questions? Contact <a href="mailto:aaronl@netscape.com">aaronl@netscape.com</a><br>
+</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/accessible/build/Makefile.in
@@ -0,0 +1,99 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   John Gaunt (jgaunt@netscape.com)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../..
+topsrcdir	= @top_srcdir@
+srcdir	= @srcdir@
+VPATH		= @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE		= accessibility
+LIBRARY_NAME	= accessibility
+EXPORT_LIBRARY = 1
+SHORT_LIBNAME	= access
+IS_COMPONENT	= 1
+MODULE_NAME	= nsAccessibilityModule
+GRE_MODULE	= 1
+LIBXUL_LIBRARY	= 1
+
+CPPSRCS		= nsAccessibilityFactory.cpp
+
+LOCAL_INCLUDES	= -I$(srcdir)/../src
+
+SHARED_LIBRARY_LIBS = \
+	../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
+	../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
+	../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \
+	../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \
+	$(NULL)
+
+ifdef MOZ_XUL
+SHARED_LIBRARY_LIBS += ../src/xul/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
+endif
+
+ifndef DISABLE_XFORMS_HOOKS
+SHARED_LIBRARY_LIBS += ../src/xforms/$(LIB_PREFIX)accessibility_xforms_s.$(LIB_SUFFIX)
+endif
+
+EXTRA_DSO_LIBS = \
+	gkgfx \
+	thebes \
+	$(NULL)
+
+EXTRA_DSO_LDOPTS =           \
+	$(LIBS_DIR)              \
+	$(EXTRA_DSO_LIBS)        \
+	$(MOZ_UNICHARUTIL_LIBS)  \
+	$(MOZ_COMPONENT_LIBS)    \
+	$(NULL)
+
+ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
+endif
+
+ifeq ($(OS_ARCH),WINNT)
+OS_LIBS += \
+	oleaut32.lib \
+	version.lib \
+	ole32.lib \
+	$(NULL)
+endif
+
+include $(topsrcdir)/config/rules.mk
+
new file mode 100644
--- /dev/null
+++ b/accessible/build/nsAccessibilityFactory.cpp
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsCOMPtr.h"
+#include "mozilla/ModuleUtils.h"
+
+#include "nsIServiceManager.h"
+#include "nsIComponentManager.h"
+#include "nsIAccessibilityService.h"
+#include "nsIAccessibleRetrieval.h"
+#include "nscore.h"
+
+static nsresult
+NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aResult)
+{
+    nsresult rv;
+    NS_ASSERTION(aOuter == nsnull, "no aggregation");
+    nsIAccessibilityService* accessibility;
+    rv = NS_GetAccessibilityService(&accessibility);
+    if (NS_FAILED(rv)) {
+        NS_ERROR("Unable to construct accessibility service");
+        return rv;
+    }
+    rv = accessibility->QueryInterface(aIID, aResult);
+    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
+    NS_RELEASE(accessibility);
+    return rv;
+}
+
+NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
+NS_DEFINE_NAMED_CID(NS_ACCESSIBLE_RETRIEVAL_CID);
+
+static const mozilla::Module::CIDEntry kA11yCIDs[] = {
+    { &kNS_ACCESSIBILITY_SERVICE_CID, false, NULL, NS_ConstructAccessibilityService },
+    { NULL }
+};
+
+static const mozilla::Module::ContractIDEntry kA11yContracts[] = {
+    { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
+    { "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
+    { NULL }
+};
+
+static const mozilla::Module kA11yModule = {
+    mozilla::Module::kVersion,
+    kA11yCIDs,
+    kA11yContracts
+};
+
+NSMODULE_DEFN(nsAccessibilityModule) = &kA11yModule;
+
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/Makefile.in
@@ -0,0 +1,81 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH   = ../..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH   = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
+DIRS = msaa ia2
+endif
+
+MODULE    = accessibility
+XPIDL_MODULE= accessibility
+GRE_MODULE	= 1
+
+XPIDLSRCS = \
+      nsIAccessibleTypes.idl \
+      nsIAccessibleRetrieval.idl \
+      nsIAccessible.idl \
+      nsIAccessibleApplication.idl \
+      nsIAccessibleRelation.idl \
+      nsIAccessibleRole.idl \
+      nsIAccessibleStates.idl \
+      nsIAccessibleDocument.idl \
+      nsIAccessibleProvider.idl \
+      nsIAccessibleSelectable.idl \
+      nsIAccessNode.idl \
+      nsIAccessibleEvent.idl \
+      nsIAccessibleEditableText.idl \
+      nsIAccessibleHyperLink.idl \
+      nsIAccessibleHyperText.idl \
+      nsIAccessibleTable.idl \
+      nsIAccessibleText.idl \
+      nsIAccessibleValue.idl \
+      nsIAccessibleImage.idl \
+      nsIXBLAccessible.idl \
+      $(NULL)
+
+EXPORTS		= \
+      nsIAccessibilityService.h \
+      $(NULL)
+
+include $(topsrcdir)/config/rules.mk
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/ia2/IA2Marshal.def
@@ -0,0 +1,6 @@
+LIBRARY        IA2Marshal.dll
+EXPORTS        DllGetClassObject      PRIVATE
+               DllCanUnloadNow        PRIVATE
+               DllRegisterServer      PRIVATE
+               DllUnregisterServer    PRIVATE
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/ia2/Makefile.in
@@ -0,0 +1,137 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code
+#
+# The Initial Developer of the Original Code is
+# Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2007
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH     = ../../..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+
+LIBRARY_NAME  = IA2Marshal
+MODULE        = accessibility
+GRE_MODULE    = 1
+DEFFILE       = $(win_srcdir)/IA2Marshal.def
+
+IA2DIR        = $(topsrcdir)/other-licenses/ia2
+
+include $(DEPTH)/config/autoconf.mk
+
+DEFINES       += -DREGISTER_PROXY_DLL -D_WIN32_WINNT=0x400
+
+GARBAGE       += $(MIDL_GENERATED_FILES)
+
+FORCE_SHARED_LIB = 1
+
+SRCS_IN_OBJDIR   = 1
+
+MIDL_INTERFACES = \
+  Accessible2.idl \
+  AccessibleAction.idl \
+  AccessibleApplication.idl \
+  AccessibleComponent.idl \
+  AccessibleEditableText.idl \
+  AccessibleHyperlink.idl \
+  AccessibleHypertext.idl \
+  AccessibleImage.idl \
+  AccessibleRelation.idl \
+  AccessibleTable.idl \
+  AccessibleTable2.idl \
+  AccessibleTableCell.idl \
+  AccessibleText.idl \
+  AccessibleValue.idl \
+  $(NULL)
+
+MIDL_ENUMS = \
+  AccessibleEventId.idl \
+  AccessibleRole.idl \
+  AccessibleStates.idl \
+  IA2CommonTypes.idl \
+  $(NULL)
+
+EXPORTS = \
+  $(MIDL_INTERFACES:%.idl=%.h) \
+  $(MIDL_INTERFACES:%.idl=%_i.c) \
+  $(MIDL_ENUMS:%.idl=%.h) \
+  $(NULL)
+
+CSRCS	= \
+  dlldata.c \
+  $(MIDL_INTERFACES:%.idl=%_p.c) \
+  $(MIDL_INTERFACES:%.idl=%_i.c) \
+  $(NULL)
+
+MIDL_GENERATED_FILES = \
+  dlldata.c \
+  $(MIDL_INTERFACES:%.idl=%_p.c) \
+  $(MIDL_INTERFACES:%.idl=%_i.c) \
+  $(MIDL_INTERFACES:%.idl=%.h) \
+  $(MIDL_ENUMS:%.idl=%.h) \
+  $(NULL)
+
+EMBED_MANIFEST_AT = 2
+
+include $(topsrcdir)/config/rules.mk
+
+OS_LIBS = \
+  kernel32.lib \
+  rpcns4.lib \
+  rpcrt4.lib \
+  ole32.lib \
+  oleaut32.lib \
+  $(NULL)
+
+# generate list of to-be-generated files that are missing
+# but ignore special file dlldata.c
+missing:=$(strip $(foreach onefile,$(strip $(subst dlldata.c,,$(MIDL_GENERATED_FILES))),$(if $(wildcard $(onefile)),,$(onefile))))
+
+missing_base:=$(sort $(basename $(subst _p.c,,$(subst _i.c,,$(missing)))))
+
+$(MIDL_GENERATED_FILES) : midl_done
+
+ifneq ("$(missing)","")
+midl_done : FORCE
+endif
+
+midl_done : $(addprefix $(IA2DIR)/,$(MIDL_INTERFACES) $(MIDL_ENUMS))
+	for idl in $(sort $(subst FORCE,,$?) $(addsuffix .idl,$(addprefix $(IA2DIR)/,$(missing_base)))); do \
+	  $(MIDL) $(MIDL_FLAGS) -app_config -I $(IA2DIR) -Oicf $$idl; \
+	done
+	touch $@
+
+# This marshall dll is also registered in the installer
+register::
+	regsvr32 -s $(DIST)/bin/$(SHARED_LIBRARY)
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/msaa/AccessibleMarshal.def
@@ -0,0 +1,7 @@
+LIBRARY        AccessibleMarshal.dll
+
+EXPORTS        DllGetClassObject      PRIVATE
+               DllCanUnloadNow        PRIVATE
+               DllRegisterServer      PRIVATE
+               DllUnregisterServer    PRIVATE
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/msaa/ISimpleDOMDocument.idl
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Author: Aaron Leventhal (aaronl@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
+cpp_quote("//")
+cpp_quote("// ISimpleDOMDocument")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("//")
+cpp_quote("// get_URL(out] BSTR *url)")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Get the internet URL associated with this document.")
+cpp_quote("//")
+cpp_quote("// get_title([out BSTR *title")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Get the document's title from the <TITLE> element")
+cpp_quote("//")
+cpp_quote("// get_mimeType([out BSTR *mimeType")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Get the registered mime type, such as text/html")
+cpp_quote("//")
+cpp_quote("// get_docType([out] BSTR *docType")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Get doctype associated with the <!DOCTYPE ..> element")
+cpp_quote("//")
+cpp_quote("// get_nameSpaceURIForID([in] short nameSpaceID, [out] BSTR *nameSpaceURI)")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Some of the methods for ISimpleDOMNode return a nameSpaceID (-1,0,1,2,3,....)")
+cpp_quote("// This method returns the associated namespace URI for each ID.")
+cpp_quote("//")
+cpp_quote("// set_alternateViewMediaTypes([in] BSTR *commaSeparatedMediaType)")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// For style property retrieval on nsISimpleDOMNode elements, ")
+cpp_quote("// set the additional alternate media types that properties are available for.")
+cpp_quote("// [in] BSTR *commaSeparatedMediaTypes is a comma separate list, for example \"aural, braille\".")
+cpp_quote("// The alternate media properties are requested with nsISimpleDOMNode::get_computedStyle.")
+cpp_quote("// Note: setting this value on a document will increase memory overhead, and may create a small delay.")
+cpp_quote("//")
+cpp_quote("// W3C media Types:")
+cpp_quote("// * all:        Suitable for all devices. ")
+cpp_quote("// * aural:      Intended for speech synthesizers. See the section on aural style sheets for details. ")
+cpp_quote("// * braille:    Intended for braille tactile feedback devices. ")
+cpp_quote("// * embossed:   Intended for paged braille printers. ")
+cpp_quote("// * handheld:   Intended for handheld devices - typically small screen, monochrome, limited bandwidth. ")
+cpp_quote("// * print:      Intended for paged, opaque material and for documents viewed on screen in print preview mode. Please consult the section on paged media for information about formatting issues that are specific to paged media. ")
+cpp_quote("// * projection: Intended for projected presentations, for example projectors or print to transparencies. Please consult the section on paged media for information about formatting issues that are specific to paged media. ")
+cpp_quote("// * screen:     Intended primarily for color computer screens. ")
+cpp_quote("// * tty:        intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. Authors should not use pixel units with the tty media type. ")
+cpp_quote("// * tv:         Intended for television-type devices - low resolution, color, limited-scrollability screens, sound")
+cpp_quote("// * See latest W3C CSS specs for complete list of media types")
+cpp_quote("//")
+cpp_quote("//")
+cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
+cpp_quote("")
+cpp_quote("")
+
+import "objidl.idl";
+import "oaidl.idl";
+
+[object, uuid(0D68D6D0-D93D-4d08-A30D-F00DD1F45B24)]
+interface ISimpleDOMDocument : IUnknown
+{
+  [propget] HRESULT URL(
+    [out, retval] BSTR * url
+  );
+  [propget] HRESULT title(
+    [out, retval] BSTR * title
+  );
+  [propget] HRESULT mimeType(
+    [out, retval] BSTR * mimeType
+  );
+  [propget] HRESULT docType(
+    [out, retval] BSTR * docType
+  );
+  [propget] HRESULT nameSpaceURIForID(
+    [in]  short nameSpaceID,
+    [out, retval] BSTR * nameSpaceURI
+  );
+  [propput] HRESULT alternateViewMediaTypes(
+    [in] BSTR * commaSeparatedMediaTypes
+	);
+}
new file mode 100644
--- /dev/null
+++ b/accessible/public/msaa/ISimpleDOMNode.idl
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Author: Aaron Leventhal (aaronl@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
+cpp_quote("//")
+cpp_quote("// ISimpleDOMNode")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// An interface that extends MSAA's IAccessible to provide readonly DOM node information via cross-process COM.")
+cpp_quote("//")
+cpp_quote("// get_nodeInfo(")
+cpp_quote("//  /* [out] */ BSTR  *nodeName,   // For elements, this is the tag name")
+cpp_quote("//  /* [out] */ short  *nameSpaceID,")
+cpp_quote("//  /* [out] */ BSTR  *nodeValue, ")
+cpp_quote("//  /* [out] */ unsigned int    *numChildren); ") 
+cpp_quote("//  /* [out] */ unsigned int    *uniqueID;  // In Win32 accessible events we generate, the target's childID matches to this")
+cpp_quote("//  /* [out] */ unsigned short  *nodeType,")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Get the basic information about a node.")
+cpp_quote("// The namespace ID can be mapped to an URI using nsISimpleDOMDocument::get_nameSpaceURIForID()")
+cpp_quote("//")
+cpp_quote("// get_attributes(")
+cpp_quote("//  /* [in]  */ unsigned short maxAttribs,")
+cpp_quote("//  /* [out] */ unsigned short  *numAttribs,")
+cpp_quote("//  /* [out] */ BSTR  *attribNames,")
+cpp_quote("//  /* [out] */ short *nameSpaceID,")
+cpp_quote("//  /* [out] */ BSTR  *attribValues);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Returns 3 arrays - the attribute names and values, and a namespace ID for each")
+cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
+cpp_quote("//")
+cpp_quote("// get_attributesForNames(")
+cpp_quote("//  /* [in] */ unsigned short numAttribs,")
+cpp_quote("//  /* [in] */ BSTR   *attribNames,")
+cpp_quote("//  /* [in] */ short  *nameSpaceID,")
+cpp_quote("//  /* [out] */ BSTR  *attribValues);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Takes 2 arrays - the attribute names and namespace IDs, and returns an array of corresponding values")
+cpp_quote("// If the namespace ID is 0, it's the same namespace as the node's namespace")
+cpp_quote("//")
+cpp_quote("// computedStyle(  ")
+cpp_quote("//  /* [in]  */ unsigned short maxStyleProperties,")
+cpp_quote("//  /* [out] */ unsigned short *numStyleProperties, ")
+cpp_quote("//  /* [in]  */ boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
+cpp_quote("//  /* [out] */ BSTR *styleProperties, ")
+cpp_quote("//  /* [out] */ BSTR *styleValues);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Returns 2 arrays -- the style properties and their values")
+cpp_quote("//  useAlternateView=FALSE: gets properties for the default media type (usually screen)")
+cpp_quote("//  useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
+cpp_quote("//")
+cpp_quote("// computedStyleForProperties(  ")
+cpp_quote("//  /* [in] */  unsigned short numStyleProperties, ")
+cpp_quote("//  /* [in] */  boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes")
+cpp_quote("//  /* [in] */  BSTR *styleProperties, ")
+cpp_quote("//  /* [out] */ BSTR *styleValues);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Scroll the current view so that this dom node is visible.")
+cpp_quote("//  placeTopLeft=TRUE: scroll until the top left corner of the dom node is at the top left corner of the view.")
+cpp_quote("//  placeTopLeft=FALSE: scroll minimally to make the dom node visible. Don't scroll at all if already visible.")
+cpp_quote("//")
+cpp_quote("// scrollTo( ")
+cpp_quote("//  /* [in] */ boolean placeTopLeft); ")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Returns style property values for those properties in the styleProperties [in] array")
+cpp_quote("// Returns 2 arrays -- the style properties and their values")
+cpp_quote("//  useAlternateView=FALSE: gets properties for the default media type (usually screen)")
+cpp_quote("//  useAlternateView=TRUE: properties for media types set w/ nsIDOMSimpleDocument::set_alternateViewMediaTypes()")
+cpp_quote("//")
+cpp_quote("// get_parentNode     (/* [out] */ ISimpleDOMNode **newNodePtr);")
+cpp_quote("// get_firstChild     (/* [out] */ ISimpleDOMNode **newNodePtr);")
+cpp_quote("// get_lastChild      (/* [out] */ ISimpleDOMNode **newNodePtr);")
+cpp_quote("// get_previousSibling(/* [out] */ ISimpleDOMNode **newNodePtr);")
+cpp_quote("// get_nextSibling    (/* [out] */ ISimpleDOMNode **newNodePtr);")
+cpp_quote("// get_childAt        (/* [in] */ unsigned childIndex, /* [out] */ ISimpleDOMNode **newNodePtr);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// DOM navigation - get a different node.")
+cpp_quote("//")
+cpp_quote("// get_innerHTML(/* [out] */ BSTR *htmlText);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Returns HTML of this DOM node's subtree. Does not include the start and end tag for this node/element.")
+cpp_quote("//")
+cpp_quote("//")
+cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer")
+cpp_quote("//")
+cpp_quote("//")
+cpp_quote("// get_language(/* [out] */ BSTR *htmlText);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Returns the computed language for this node, or empty string if unknown.")
+cpp_quote("//")
+cpp_quote("//")
+cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
+cpp_quote("")
+cpp_quote("")
+
+import "objidl.idl";
+import "oaidl.idl";
+
+import "ISimpleDOMText.idl";
+import "ISimpleDOMDocument.idl";
+
+[object, uuid(1814ceeb-49e2-407f-af99-fa755a7d2607)]
+interface ISimpleDOMNode : IUnknown
+{
+  const unsigned short NODETYPE_ELEMENT = 1;
+  const unsigned short NODETYPE_ATTRIBUTE = 2;
+  const unsigned short NODETYPE_TEXT = 3;
+  const unsigned short NODETYPE_CDATA_SECTION = 4;
+  const unsigned short NODETYPE_ENTITY_REFERENCE = 5;
+  const unsigned short NODETYPE_ENTITY = 6;
+  const unsigned short NODETYPE_PROCESSING_INSTRUCTION = 7;
+  const unsigned short NODETYPE_COMMENT = 8;
+  const unsigned short NODETYPE_DOCUMENT = 9;
+  const unsigned short NODETYPE_DOCUMENT_TYPE = 10;
+  const unsigned short NODETYPE_DOCUMENT_FRAGMENT = 11;
+  const unsigned short NODETYPE_NOTATION = 12;
+
+  [propget] HRESULT nodeInfo(
+    [out] BSTR *nodeName,   // for performance returns NULL for text nodes (true nodeName would be "#text")
+    [out] short *nameSpaceID,
+    [out] BSTR *nodeValue,
+    [out] unsigned int *numChildren,
+    [out] unsigned int *uniqueID, // In Win32 accessible events we generate, the target's childID matches to this
+    [out, retval] unsigned short *nodeType
+  );
+
+  [propget] HRESULT attributes(  
+    [in] unsigned short maxAttribs,
+    [out, size_is(maxAttribs), length_is(*numAttribs)] BSTR *attribNames, 
+    [out, size_is(maxAttribs), length_is(*numAttribs)] short *nameSpaceID,  
+    [out, size_is(maxAttribs), length_is(*numAttribs)] BSTR *attribValues,
+    [out, retval] unsigned short *numAttribs
+  );
+
+  [propget] HRESULT attributesForNames(  
+    [in] unsigned short numAttribs,
+    [in, size_is(numAttribs), length_is(numAttribs)] BSTR *attribNames, 
+    [in, size_is(numAttribs), length_is(numAttribs)] short *nameSpaceID,  
+    [out, retval, size_is(numAttribs), length_is(numAttribs)] BSTR *attribValues
+  );
+
+  [propget] HRESULT computedStyle(  
+    [in] unsigned short maxStyleProperties,
+    [in] boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes
+    [out, size_is(maxStyleProperties), length_is(*numStyleProperties)] BSTR *styleProperties, 
+    [out, size_is(maxStyleProperties), length_is(*numStyleProperties)] BSTR *styleValues,
+    [out, retval] unsigned short *numStyleProperties
+  );
+
+  [propget] HRESULT computedStyleForProperties(  
+    [in] unsigned short numStyleProperties, 
+    [in] boolean useAlternateView,  // If TRUE, returns properites for media as set in nsIDOMDocument::set_alternateViewMediaTypes
+    [in, size_is(numStyleProperties), length_is(numStyleProperties)] BSTR *styleProperties, 
+    [out, retval, size_is(numStyleProperties), length_is(numStyleProperties)] BSTR *styleValues
+  );
+
+  HRESULT scrollTo([in] boolean placeTopLeft);
+
+  [propget] HRESULT parentNode([out, retval] ISimpleDOMNode **node);
+  [propget] HRESULT firstChild([out, retval] ISimpleDOMNode **node);
+  [propget] HRESULT lastChild([out, retval] ISimpleDOMNode **node);
+  [propget] HRESULT previousSibling([out, retval] ISimpleDOMNode **node);
+  [propget] HRESULT nextSibling([out, retval] ISimpleDOMNode **node);
+  [propget] HRESULT childAt([in] unsigned childIndex, 
+                            [out, retval] ISimpleDOMNode **node);
+
+  [propget] HRESULT innerHTML([out, retval] BSTR *innerHTML);
+
+  [propget, local] HRESULT localInterface([out][retval] void **localInterface);
+
+  [propget] HRESULT language([out, retval] BSTR *language);
+}
+
+
+[
+    uuid(a6245497-9c0b-4449-85a5-bd6ad07df8ea), 
+    helpstring("ISimpleDOM Type Library")
+] 
+library ISimpleDOM 
+{
+  interface ISimpleDOMNode;
+  interface ISimpleDOMText;
+  interface ISimpleDOMDocument;
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/msaa/ISimpleDOMText.idl
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+import "objidl.idl";
+import "oaidl.idl";
+        
+cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
+cpp_quote("//")
+cpp_quote("// ISimpleDOMText")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// An interface that extends MSAA's IAccessible to provide important additional capabilities on text nodes")
+cpp_quote("//")
+cpp_quote("// [propget] domText(/* out,retval */ BSTR *domText")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Similar to IAccessible::get_accName, but does not strip out whitespace characters.")
+cpp_quote("// Important for retrieving the correct start/end substring indices to use with other")
+cpp_quote("// methods in ISimpleDOMText.")
+cpp_quote("//")
+cpp_quote("//")
+cpp_quote("// get_[un]clippedSubstringBounds(")
+cpp_quote("//   /* [in] */ unsigned int startIndex,")
+cpp_quote("//   /* [in] */ unsigned int endIndex,")
+cpp_quote("//   /* [out] */ int *x,")
+cpp_quote("//   /* [out] */ int *y,")
+cpp_quote("//   /* [out] */ int *width,")
+cpp_quote("//   /* [out] */ int *height);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Both methods get_clippedSubstringBounds and get_unclippedSubstringBounds return the screen pixel")
+cpp_quote("// coordinates of the given text substring. The in parameters for start and end indices refer")
+cpp_quote("// to the string returned by ISimpleDOMText::get_domText().")
+cpp_quote("//")
+cpp_quote("//")
+cpp_quote("// scrollToSubstring(")
+cpp_quote("//   /* [in] */ unsigned int startIndex,")
+cpp_quote("//   /* [in] */ unsigned int endIndex);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// In scrollable views, scrolls to ensure that the specified substring is visible onscreen.")
+cpp_quote("// The in parameters for start and end indices refer to the string returned")
+cpp_quote("// by ISimpleDOMText::get_domText().")
+cpp_quote("//")
+cpp_quote("//")
+cpp_quote("// [propget] fontFamily(/* out,retval */ BSTR *fontFamily);")
+cpp_quote("// ---------------------------------------------------------------------------------------------------=")
+cpp_quote("// Return a single computed font family name, which is better than the comma delineated list")
+cpp_quote("// that is returned by the ISimpleDOMNode computed style methods for font-family.")
+cpp_quote("// In other words, return something like 'Arial' instead of 'Arial, Helvetica, Sans-serif'.")
+cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
+cpp_quote("")
+cpp_quote("")
+
+[object, uuid(4e747be5-2052-4265-8af0-8ecad7aad1c0)]
+interface ISimpleDOMText: IUnknown
+{
+  // Includes whitespace in DOM
+  [propget] HRESULT domText([out, retval] BSTR *domText);
+
+  HRESULT get_clippedSubstringBounds([in] unsigned int startIndex, 
+                                     [in] unsigned int endIndex, 
+                                     [out] int *x,
+                                     [out] int *y,
+                                     [out] int *width,
+                                     [out] int *height);
+
+  HRESULT get_unclippedSubstringBounds([in] unsigned int startIndex, 
+                                       [in] unsigned int endIndex, 
+                                       [out] int *x,
+                                       [out] int *y,
+                                       [out] int *width,
+                                       [out] int *height);
+
+  HRESULT scrollToSubstring([in] unsigned int startIndex, 
+                            [in] unsigned int endIndex);
+
+  [propget] HRESULT fontFamily([out, retval] BSTR *fontFamily);
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/msaa/Makefile.in
@@ -0,0 +1,124 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code
+#
+# The Initial Developer of the Original Code is
+# Aaron Leventhal
+# Portions created by the Initial Developer are Copyright (C) 2003
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#  Chase Phillips <cmp@mozilla.org>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH		= ../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+
+LIBRARY_NAME	= AccessibleMarshal
+MODULE    = accessibility
+XPIDL_MODULE = accessibility-msaa
+GRE_MODULE   = 1
+DEFFILE = $(win_srcdir)/AccessibleMarshal.def
+
+include $(DEPTH)/config/autoconf.mk
+
+XPIDLSRCS = \
+      nsIAccessibleWin32Object.idl \
+      nsIWinAccessNode.idl \
+      $(NULL)
+
+DEFINES		+= -DREGISTER_PROXY_DLL -D_WIN32_WINNT=0x400
+
+GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
+
+FORCE_SHARED_LIB = 1
+
+SRCS_IN_OBJDIR	= 1
+
+CSRCS	= \
+	dlldata.c \
+	ISimpleDOMNode_p.c \
+	ISimpleDOMNode_i.c \
+	ISimpleDOMDocument_p.c \
+	ISimpleDOMDocument_i.c \
+	ISimpleDOMText_p.c \
+	ISimpleDOMText_i.c \
+	$(NULL)
+
+MIDL_GENERATED_FILES = \
+	ISimpleDOMNode.h \
+	ISimpleDOMNode_p.c \
+	ISimpleDOMNode_i.c \
+	ISimpleDOMDocument.h \
+	ISimpleDOMDocument_p.c \
+	ISimpleDOMDocument_i.c \
+	ISimpleDOMText.h \
+	ISimpleDOMText_p.c \
+	ISimpleDOMText_i.c \
+	$(NULL)
+
+SRCDIR_CSRCS	= $(addprefix $(srcdir)/,$(CSRCS))
+
+OS_LIBS = \
+	kernel32.lib \
+	rpcns4.lib \
+	rpcrt4.lib \
+	oleaut32.lib \
+	$(NULL)
+
+$(MIDL_GENERATED_FILES): done_gen
+
+done_gen: ISimpleDOMNode.idl \
+          ISimpleDOMDocument.idl \
+          ISimpleDOMText.idl
+
+	$(MIDL) $(MIDL_FLAGS) -I $(srcdir) -Oicf $(srcdir)/ISimpleDOMNode.idl
+	$(MIDL) $(MIDL_FLAGS) -Oicf $(srcdir)/ISimpleDOMDocument.idl
+	$(MIDL) $(MIDL_FLAGS) -Oicf $(srcdir)/ISimpleDOMText.idl
+	touch $@
+
+EXPORTS = \
+	ISimpleDOMNode.h \
+	ISimpleDOMNode_i.c \
+	ISimpleDOMDocument.h \
+	ISimpleDOMDocument_i.c \
+	ISimpleDOMText.h \
+	ISimpleDOMText_i.c \
+	$(NULL)
+
+export:: done_gen
+
+# This marshall dll is also registered in the installer
+register::
+	regsvr32 -s $(DIST)/bin/$(SHARED_LIBRARY)
+
+EMBED_MANIFEST_AT = 2
+
+include $(topsrcdir)/config/rules.mk
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/msaa/nsIAccessibleWin32Object.idl
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(ca7a3a93-822f-4cdf-8cb4-c52d16b9afc7)]
+interface nsIAccessibleWin32Object : nsISupports
+{
+  /** handle to the external window implementing IAccessible */
+  [noscript] readonly attribute voidPtr hwnd;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/msaa/nsIWinAccessNode.idl
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+%{C++
+#include "Guiddef.h"
+%}
+
+[ref] native MSCOMIIDRef(IID);
+
+[uuid(63efe9c5-2610-4d2f-861b-e4ddfe1b70d9)]
+interface nsIWinAccessNode : nsISupports
+{
+  voidPtr queryNativeInterface([const] in MSCOMIIDRef aIID);
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessNode.idl
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Original Author: Aaron Leventhal (aaronl@netscape.com)
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+interface nsIDOMNode;
+interface nsIAccessibleDocument;
+interface nsIDOMCSSPrimitiveValue;
+
+/**
+ * An interface used by in-process accessibility clients
+ * to get style, window, markup and other information about
+ * a DOM node. When accessibility is active in Gecko,
+ * every DOM node can have one nsIAccessNode for each
+ * pres shell the DOM node is rendered in.
+ * The nsIAccessNode implementations are instantiated lazily.
+ * The nsIAccessNode tree for a given dom window
+ * has a one to one relationship to the DOM tree.
+ * If the DOM node for this access node is "accessible",
+ * then a QueryInterface to nsIAccessible will succeed.
+ */
+[scriptable, uuid(ef16ff42-0256-4b48-ae87-b18a95b7f7d6)]
+interface nsIAccessNode : nsISupports
+{
+  /**
+   * The DOM node this nsIAccessNode is associated with.
+   */
+  readonly attribute nsIDOMNode DOMNode;
+
+  /**
+   * The document accessible that this access node resides in.
+   */
+  readonly attribute nsIAccessibleDocument document;
+
+  /**
+   * The root document accessible that this access node resides in.
+   */
+  readonly attribute nsIAccessibleDocument rootDocument;
+
+  /**
+   * The innerHTML for the DOM node
+   * This is a text string of all the markup inside the DOM
+   * node, not including the start and end tag for the node.
+   */
+  readonly attribute DOMString innerHTML;
+
+  /**
+   * Makes an object visible on screen.
+   *
+   * @param scrollType - defines where the object should be placed on
+   *                     the screen (see nsIAccessibleScrollType for
+   *                     available constants).
+   */
+  void scrollTo(in unsigned long aScrollType);
+
+  /**
+   * Moves the top left of an object to a specified location.
+   *
+   * @param coordinateType - specifies whether the coordinates are relative to
+   *                         the screen or the parent object (for available
+   *                         constants refer to nsIAccessibleCoordinateType)
+   * @param aX - defines the x coordinate
+   * @param aY - defines the y coordinate
+  */
+  void scrollToPoint(in unsigned long aCoordinateType, in long aX, in long aY);
+
+  /**
+   * The OS window handle for the window this node
+   * is being displayed in.
+   */
+  [noscript] readonly attribute voidPtr ownerWindow;
+  
+  /**
+   * A unique ID calculated for this DOM node, for the 
+   * purposes of caching and referencing this object.
+   */
+  [noscript] readonly attribute voidPtr uniqueID;
+
+  /**
+   * Retrieve the computed style value for this DOM node, if it is a DOM element.
+   * Note: the meanings of width, height and other size measurements depend
+   * on the version of CSS being used. Therefore, for bounds information, 
+   * it is better to use nsIAccessible::accGetBounds.
+   * @param pseudoElt The pseudo element to retrieve style for, or NULL
+   *                  for general computed style information for this node.
+   * @param propertyName Retrieve the computed style value for this property name,
+   *                     for example "border-bottom".
+   */
+  DOMString getComputedStyleValue(in DOMString pseudoElt, in DOMString propertyName);
+
+  /**
+   * The method is similar to getComputedStyleValue() excepting that this one
+   * returns nsIDOMCSSPrimitiveValue.
+   */
+  nsIDOMCSSPrimitiveValue getComputedStyleCSSValue(in DOMString pseudoElt,
+                                                   in DOMString propertyName);
+
+  /**
+   * The language for the current DOM node, e.g. en, de, etc.
+   */
+  readonly attribute DOMString language;
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibilityService.h
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Eric Vaughan <evaughan@netscape.com> (original author)
+ *   Alexander Surkov <surkov.alexander@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _nsIAccessibilityService_h_
+#define _nsIAccessibilityService_h_
+
+#include "nsIAccessibleRetrieval.h"
+#include "nsIAccessibleEvent.h"
+
+#include "nsAutoPtr.h"
+
+class nsAccessible;
+class nsINode;
+class nsIContent;
+class nsIDocument;
+class nsIFrame;
+class nsIPresShell;
+class nsObjectFrame;
+
+// 10ff6dca-b219-4b64-9a4c-67a62b86edce
+#define NS_IACCESSIBILITYSERVICE_IID \
+{ 0x10ff6dca, 0xb219, 0x4b64, \
+ { 0x9a, 0x4c, 0x67, 0xa6, 0x2b, 0x86, 0xed, 0xce } }
+
+class nsIAccessibilityService : public nsIAccessibleRetrieval
+{
+public:
+  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IACCESSIBILITYSERVICE_IID)
+
+  /**
+   * Return an accessible object for a DOM node in the given pres shell.
+   *
+   * @param  aNode      [in] the DOM node to get an accessible for
+   * @param  aPresShell [in] the presentation shell which contains layout info
+   *                         for the DOM node
+   */
+  virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
+                                             nsIPresShell* aPresShell) = 0;
+
+  /**
+   * Return root document accessible that is or contains a document accessible
+   * for the given presshell.
+   *
+   * @param aPresShell  [in] the presshell
+   * @param aCanCreate  [in] points whether the root document accessible
+   *                        should be returned from the cache or can be created
+   */
+  virtual nsAccessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
+                                                  PRBool aCanCreate) = 0;
+
+  /**
+   * Creates accessible for the given DOM node or frame.
+   */
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLImageAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
+                                    nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+  virtual already_AddRefed<nsAccessible>
+    CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
+
+  /**
+   * Adds/remove ATK root accessible for gtk+ native window to/from children
+   * of the application accessible.
+   */
+  virtual nsAccessible* AddNativeRootAccessible(void* aAtkAccessible) = 0;
+  virtual void RemoveNativeRootAccessible(nsAccessible* aRootAccessible) = 0;
+
+  /**
+   * Notification used to update the accessible tree when new content is
+   * inserted.
+   */
+  virtual void ContentRangeInserted(nsIPresShell* aPresShell,
+                                    nsIContent* aContainer,
+                                    nsIContent* aStartChild,
+                                    nsIContent* aEndChild) = 0;
+
+  /**
+   * Notification used to update the accessible tree when content is removed.
+   */
+  virtual void ContentRemoved(nsIPresShell* aPresShell, nsIContent* aContainer,
+                              nsIContent* aChild) = 0;
+
+  /**
+   * Notify accessibility that anchor jump has been accomplished to the given
+   * target. Used by layout.
+   */
+  virtual void NotifyOfAnchorJumpTo(nsIContent *aTarget) = 0;
+
+  /**
+   * Notify the accessibility service that the given presshell is
+   * being destroyed.
+   */
+  virtual void PresShellDestroyed(nsIPresShell *aPresShell) = 0;
+
+  /**
+   * Recreate an accessible for the given content node in the presshell.
+   */
+  virtual void RecreateAccessible(nsIPresShell* aPresShell,
+                                  nsIContent* aContent) = 0;
+
+  /**
+   * Fire accessible event of the given type for the given target.
+   *
+   * @param aEvent   [in] accessible event type
+   * @param aTarget  [in] target of accessible event
+   */
+  virtual void FireAccessibleEvent(PRUint32 aEvent, nsAccessible* aTarget) = 0;
+};
+
+NS_DEFINE_STATIC_IID_ACCESSOR(nsIAccessibilityService,
+                              NS_IACCESSIBILITYSERVICE_IID)
+
+// for component registration
+// {DE401C37-9A7F-4278-A6F8-3DE2833989EF}
+#define NS_ACCESSIBILITY_SERVICE_CID \
+{ 0xde401c37, 0x9a7f, 0x4278, { 0xa6, 0xf8, 0x3d, 0xe2, 0x83, 0x39, 0x89, 0xef } }
+
+extern nsresult
+NS_GetAccessibilityService(nsIAccessibilityService** aResult);
+
+#endif
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessible.idl
@@ -0,0 +1,326 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Original Author: Eric D Vaughan (evaughan@netscape.com)
+ * Contributor(s): Aaron Leventhal (aaronl@netscape.com)
+ *                 John Gaunt (jgaunt@netscape.com)
+ *                 Kyle Yuan (kyle.yuan@sun.com)
+ *                 HÃ¥kan Waara (hwaara@gmail.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+#include "nsIArray.idl"
+
+interface nsIPersistentProperties;
+interface nsIDOMDOMStringList;
+interface nsIAccessibleRelation;
+
+/**
+ * A cross-platform interface that supports platform-specific 
+ * accessibility APIs like MSAA and ATK. Contains the sum of what's needed
+ * to support IAccessible as well as ATK's generic accessibility objects.
+ * Can also be used by in-process accessibility clients to get information
+ * about objects in the accessible tree. The accessible tree is a subset of 
+ * nodes in the DOM tree -- such as documents, focusable elements and text.
+ * Mozilla creates the implementations of nsIAccessible on demand.
+ * See http://www.mozilla.org/projects/ui/accessibility for more information.
+ */
+[scriptable, uuid(c81d8f8c-8585-4094-bc7c-71dd01494906)]
+interface nsIAccessible : nsISupports
+{
+  /**
+   * Parent node in accessible tree.
+   */
+  readonly attribute nsIAccessible parent;
+
+  /**
+   * Next sibling in accessible tree
+   */
+  readonly attribute nsIAccessible nextSibling;
+
+  /**
+   * Previous sibling in accessible tree
+   */
+  readonly attribute nsIAccessible previousSibling;
+
+  /**
+   * First child in accessible tree
+   */
+  readonly attribute nsIAccessible firstChild;
+
+  /**
+   * Last child in accessible tree
+   */
+  readonly attribute nsIAccessible lastChild;
+  
+  /**
+   * Array of all this element's children.
+   */
+  readonly attribute nsIArray children;
+
+  /**
+   * Number of accessible children
+   */
+  readonly attribute long childCount;
+
+  /**
+   * The 0-based index of this accessible in its parent's list of children,
+   * or -1 if this accessible does not have a parent.
+   */
+  readonly attribute long indexInParent;
+
+  /**
+   * Accessible name -- the main text equivalent for this node. The name is
+   * specified by ARIA or by native markup. Example of ARIA markup is
+   * aria-labelledby attribute placed on element of this accessible. Example
+   * of native markup is HTML label linked with HTML element of this accessible.
+   *
+   * Value can be string or null. A null value indicates that AT may attempt to
+   * compute the name. Any string value, including the empty string, should be
+   * considered author-intentional, and respected.
+   */
+  attribute AString name;
+
+  /**
+   * Accessible value -- a number or a secondary text equivalent for this node
+   * Widgets that use role attribute can force a value using the valuenow attribute
+   */
+  readonly attribute AString value;
+
+  /**
+   * Accessible description -- long text associated with this node
+   */
+  readonly attribute AString description;
+
+  /**
+   * Provides localized string of accesskey name, such as Alt+D.
+   * The modifier may be affected by user and platform preferences.
+   * Usually alt+letter, or just the letter alone for menu items. 
+   */
+  readonly attribute AString keyboardShortcut;
+
+  /**
+   * Provides localized string of global keyboard accelerator for default
+   * action, such as Ctrl+O for Open file
+   */
+  readonly attribute AString defaultKeyBinding;
+
+  /**
+   * Provides array of localized string of global keyboard accelerator for
+   * the given action index supported by accessible.
+   *
+   * @param aActionIndex - index of the given action
+   */
+  nsIDOMDOMStringList getKeyBindings(in PRUint8 aActionIndex);
+
+  /**
+   * Enumerated accessible role (see the constants defined in nsIAccessibleRole).
+   *
+   * @note  The values might depend on platform because of variations. Widgets
+   *        can use ARIA role attribute to force the final role.
+   */
+  readonly attribute unsigned long role;
+
+  /**
+   * Accessible states -- bit fields which describe boolean properties of node.
+   * Many states are only valid given a certain role attribute that supports
+   * them.
+   *
+   * @param aState - the first bit field (see nsIAccessibleStates::STATE_*
+   *                 constants)
+   * @param aExtraState - the second bit field
+   *                      (see nsIAccessibleStates::EXT_STATE_* constants)
+   */
+  void getState(out unsigned long aState, out unsigned long aExtraState);
+
+  /**
+   * Help text associated with node
+   */
+  readonly attribute AString help;
+
+  /**
+   * Focused accessible child of node
+   */
+  readonly attribute nsIAccessible focusedChild;
+
+  /**
+   * Attributes of accessible
+   */
+  readonly attribute nsIPersistentProperties attributes;
+
+  /**
+   * Returns grouping information. Used for tree items, list items, tab panel
+   * labels, radio buttons, etc. Also used for collectons of non-text objects.
+   *
+   * @param groupLevel - 1-based, similar to ARIA 'level' property
+   * @param similarItemsInGroup - 1-based, similar to ARIA 'setsize' property,
+   *                              inclusive of the current item
+   * @param positionInGroup - 1-based, similar to ARIA 'posinset' property
+   */
+  void groupPosition(out long aGroupLevel, out long aSimilarItemsInGroup,
+                     out long aPositionInGroup);
+
+  /**
+   * Accessible child which contains the coordinate at (x, y) in screen pixels.
+   * If the point is in the current accessible but not in a child, the
+   * current accessible will be returned.
+   * If the point is in neither the current accessible or a child, then
+   * null will be returned.
+   *
+   * @param x  screen's x coordinate
+   * @param y  screen's y coordinate
+   * @return   the deepest accessible child containing the given point
+   */
+  nsIAccessible getChildAtPoint(in long x, in long y);
+
+  /**
+   * Deepest accessible child which contains the coordinate at (x, y) in screen
+   * pixels. If the point is in the current accessible but not in a child, the
+   * current accessible will be returned. If the point is in neither the current
+   * accessible or a child, then null will be returned.
+   *
+   * @param x  screen's x coordinate
+   * @param y  screen's y coordinate
+   * @return   the deepest accessible child containing the given point
+   */
+  nsIAccessible getDeepestChildAtPoint(in long x, in long y);
+
+  /**
+   * Nth accessible child using zero-based index or last child if index less than zero
+   */
+  nsIAccessible getChildAt(in long aChildIndex);
+
+  /**
+   * Accessible node geometrically to the right of this one
+   */
+  nsIAccessible getAccessibleToRight();
+
+  /**
+   * Accessible node geometrically to the left of this one
+   */
+  nsIAccessible getAccessibleToLeft();
+
+  /**
+   * Accessible node geometrically above this one
+   */
+  nsIAccessible getAccessibleAbove();
+
+  /**
+   * Accessible node geometrically below this one
+   */
+  nsIAccessible getAccessibleBelow();
+
+  /**
+   * Return accessible relation by the given relation type (see.
+   * constants defined in nsIAccessibleRelation).
+   */
+  nsIAccessibleRelation getRelationByType(in unsigned long aRelationType);
+
+  /**
+   * Returns the number of accessible relations for this object.
+   */
+  readonly attribute unsigned long relationsCount;
+
+  /**
+   * Returns one accessible relation for this object.
+   *
+   * @param index - relation index (0-based)
+   */
+  nsIAccessibleRelation getRelation(in unsigned long index);
+
+  /**
+   * Returns multiple accessible relations for this object.
+   */
+  nsIArray getRelations();
+
+  /**
+   * Return accessible's x and y coordinates relative to the screen and
+   * accessible's width and height.
+   */
+  void getBounds(out long x, out long y, out long width, out long height);
+
+  /**
+   * Add or remove this accessible to the current selection
+   */
+  void setSelected(in boolean isSelected);
+
+  /**
+   * Extend the current selection from its current accessible anchor node
+   * to this accessible
+   */
+  void extendSelection();
+
+  /**
+   * Select this accessible node only
+   */
+  void takeSelection();
+
+  /**
+   * Focus this accessible node,
+   * The state STATE_FOCUSABLE indicates whether this node is normally focusable.
+   * It is the callers responsibility to determine whether this node is focusable.
+   * accTakeFocus on a node that is not normally focusable (such as a table),
+   * will still set focus on that node, although normally that will not be visually 
+   * indicated in most style sheets.
+   */
+  void takeFocus();
+
+  /**
+   * The number of accessible actions associated with this accessible
+   */
+  readonly attribute PRUint8 numActions;
+
+  /**
+   * The name of the accessible action at the given zero-based index
+   */
+  AString getActionName(in PRUint8 index);
+
+  /**
+   * The description of the accessible action at the given zero-based index
+   */
+  AString getActionDescription(in PRUint8 aIndex);
+
+  /**
+   * Perform the accessible action at the given zero-based index
+   * Action number 0 is the default action
+   */
+  void doAction(in PRUint8 index);   
+
+  /**
+   * Get a pointer to accessibility interface for this node, which is specific 
+   * to the OS/accessibility toolkit we're running on.
+   */
+  [noscript] void getNativeInterface(out voidPtr aOutAccessible);
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleApplication.idl
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+/**
+ * This interface is implemented by top level accessible object in hierarchy and
+ * provides information about application.
+ */
+[scriptable, uuid(79251626-387c-4531-89f3-680d31d6cf05)]
+interface nsIAccessibleApplication : nsISupports
+{
+  /**
+   * Returns the application name.
+   */
+  readonly attribute DOMString appName;
+
+  /**
+   * Returns the application version.
+   */
+  readonly attribute DOMString appVersion;
+
+  /**
+   * Returns the platform name.
+   */
+  readonly attribute DOMString platformName;
+
+  /**
+   * Returns the platform version.
+   */
+  readonly attribute DOMString platformVersion;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleDocument.idl
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Original Author: Aaron Leventhal (aaronl@netscape.com)
+ * Contributor(s): John Gaunt (jgaunt@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+interface nsIAccessible;
+interface nsIAccessNode;
+interface nsIDOMDocument;
+interface nsIDOMNode;
+interface nsIDOMWindow;
+
+/**
+ * An interface for in-process accessibility clients
+ * that wish to retrieve information about a document.
+ * When accessibility is turned on in Gecko,
+ * there is an nsIAccessibleDocument for each document
+ * whether it is XUL, HTML or whatever.
+ * You can QueryInterface to nsIAccessibleDocument from
+ * the nsIAccessible or nsIAccessNode for the root node
+ * of a document. You can also get one from 
+ * nsIAccessNode::GetAccessibleDocument() or 
+ * nsIAccessibleEvent::GetAccessibleDocument()
+ */
+[scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)]
+interface nsIAccessibleDocument : nsISupports
+{
+  /**
+   * The URL of the document
+   */
+  readonly attribute AString URL;
+
+  /**
+   * The title of the document, as specified in the document.
+   */
+  readonly attribute AString title;
+
+  /**
+   * The mime type of the document
+   */
+  readonly attribute AString mimeType;
+
+  /**
+   * The doc type of the document, as specified in the document.
+   */
+  readonly attribute AString docType;
+
+  /**
+   * The nsIDOMDocument interface associated with this document.
+   */
+  readonly attribute nsIDOMDocument DOMDocument;
+
+  /**
+   * The nsIDOMWindow that the document resides in.
+   */
+  readonly attribute nsIDOMWindow window;
+
+  /**
+   * The namespace for each ID that is handed back.
+   */
+  AString getNameSpaceURIForID(in short nameSpaceID);
+
+  /**
+   * The window handle for the OS window the document is being displayed in.
+   * For example, in Windows you can static cast it to an HWND.
+   */
+  [noscript] readonly attribute voidPtr windowHandle;
+
+  /**
+   * Return the parent document accessible.
+   */
+  readonly attribute nsIAccessibleDocument parentDocument;
+
+  /**
+   * Return the count of child document accessibles.
+   */
+  readonly attribute unsigned long childDocumentCount;
+
+  /**
+   * Return the child document accessible at the given index.
+   */
+  nsIAccessibleDocument getChildDocumentAt(in unsigned long index);
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleEditableText.idl
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Paul Sandoz (paul.sandoz@sun.com)
+ *   Bill Haneman (bill.haneman@sun.com)
+ *   John Gaunt (jgaunt@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+interface nsIEditor;
+
+[scriptable, uuid(52837507-202d-4e72-a482-5f068a1fd720)]
+interface nsIAccessibleEditableText : nsISupports
+{
+  /**
+   * Sets the attributes for the text between the two given indices. The old
+   * attributes are replaced by the new list of attributes. For example,
+   * sets font styles, such as italic, bold...
+   *
+   * @param startPos - start index of the text whose attributes are modified.
+   * @param endPos - end index of the text whose attributes are modified.
+   * @param attributes - set of attributes that replaces the old list of
+   *                     attributes of the specified text portion.
+   */
+  void setAttributes (in long startPos, in long endPos,
+                      in nsISupports attributes);
+
+  /**
+   * Replaces the text represented by this object by the given text.
+   */
+  void setTextContents (in AString text);
+
+  /**
+   * Inserts text at the specified position.
+   *
+   * @param text - text that is inserted.
+   * @param position - index at which to insert the text.
+   */
+  void insertText (in AString text, in long position);
+
+  /**
+   * Copies the text range into the clipboard.
+   *
+   * @param startPos - start index of the text to moved into the clipboard.
+   * @param endPos - end index of the text to moved into the clipboard.
+   */
+  void copyText (in long startPos, in long endPos);
+
+  /**
+   * Deletes a range of text and copies it to the clipboard.
+   *
+   * @param startPos - start index of the text to be deleted.
+   * @param endOffset - end index of the text to be deleted.
+   */
+  void cutText (in long startPos, in long endPos);
+
+  /**
+   * Deletes a range of text.
+   *
+   * @param startPos - start index of the text to be deleted.
+   * @param endPos - end index of the text to be deleted.
+   */
+  void deleteText (in long startPos, in long endPos);
+
+  /**
+   * Pastes text from the clipboard.
+   *
+   * @param position - index at which to insert the text from the system
+   *                   clipboard into the text represented by this object.
+   */
+  void pasteText (in long position);
+
+  /**
+   * Returns an editor associated with the accessible.
+   */
+  [noscript] readonly attribute nsIEditor associatedEditor;
+};
+
+/*
+ Assumptions:
+
+ selectAttributes method takes an nsISupports parameter.
+        'set' methods throw exception on failure.
+ 'wstring' inputs are potentially multibyte (UTF-16 for
+        instance); 'string' and UTF-8 may be a better choice.
+
+*/
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleEvent.idl
@@ -0,0 +1,550 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributors:
+ *   Aaron Leventhal <aleventh@us.ibm.com> (original author)
+ *   Alexander Surkov <surkov.alexander@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+interface nsIAccessible;
+interface nsIAccessibleDocument;
+interface nsIDOMNode;
+
+%{C++
+#define NS_ACCESSIBLE_EVENT_TOPIC "accessible-event"
+%}
+
+/**
+ * An interface for accessibility events listened to
+ * by in-process accessibility clients, which can be used
+ * to find out how to get accessibility and DOM interfaces for
+ * the event and its target. To listen to in-process accessibility invents,
+ * make your object an nsIObserver, and listen for accessible-event by 
+ * using code something like this:
+ *   nsCOMPtr<nsIObserverService> observerService = 
+ *     do_GetService("@mozilla.org/observer-service;1", &rv);
+ *   if (NS_SUCCEEDED(rv)) 
+ *     rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
+ */
+[scriptable, uuid(fd1378c5-c606-4a5e-a321-8e7fc107e5cf)]
+interface nsIAccessibleEvent : nsISupports
+{
+  /**
+   * An object has been created.
+   */
+  const unsigned long EVENT_SHOW = 0x0001;
+
+  /**
+   * An object has been destroyed.
+   */
+  const unsigned long EVENT_HIDE = 0x0002;
+
+  /**
+   * An object's children have changed
+   */
+  const unsigned long EVENT_REORDER = 0x0003;
+
+  /**
+   * The active descendant of a component has changed. The active descendant
+   * is used in objects with transient children.
+   */
+  const unsigned long EVENT_ACTIVE_DECENDENT_CHANGED = 0x0004;
+
+  /**
+   * An object has received the keyboard focus.
+   */
+  const unsigned long EVENT_FOCUS = 0x0005;
+
+  /**
+   * An object's state has changed.
+   */
+  const unsigned long EVENT_STATE_CHANGE = 0x0006;
+
+  /**
+   * An object has changed location, shape, or size.
+   */
+  const unsigned long EVENT_LOCATION_CHANGE = 0x0007;
+
+  /**
+   * An object's Name property has changed.
+   */
+  const unsigned long EVENT_NAME_CHANGE = 0x0008;
+
+  /**
+   * An object's Description property has changed.
+   */
+  const unsigned long EVENT_DESCRIPTION_CHANGE = 0x0009;
+
+  /**
+   * An object's Value property has changed.
+   */
+  const unsigned long EVENT_VALUE_CHANGE = 0x000A;
+
+  /**
+   * An object's help has changed.
+   */
+  const unsigned long EVENT_HELP_CHANGE = 0x000B;
+
+  /**
+   * An object's default action has changed.
+   */
+  const unsigned long EVENT_DEFACTION_CHANGE = 0x000C;
+
+  /**
+   * An object's action has changed.
+   */
+  const unsigned long EVENT_ACTION_CHANGE = 0x000D;
+
+  /**
+   * An object's keyboard shortcut has changed.
+   */
+  const unsigned long EVENT_ACCELERATOR_CHANGE = 0x000E;
+
+  /**
+   * The selection within a container object has changed.
+   */
+  const unsigned long EVENT_SELECTION = 0x000F;
+
+  /**
+   * An item within a container object has been added to the selection.
+   */
+  const unsigned long EVENT_SELECTION_ADD = 0x0010;
+
+  /**
+   * An item within a container object has been removed from the selection.
+   */
+  const unsigned long EVENT_SELECTION_REMOVE = 0x0011;
+
+  /**
+   * Numerous selection changes have occurred within a container object.
+   */
+  const unsigned long EVENT_SELECTION_WITHIN = 0x0012;
+
+  /**
+   * An alert has been generated. Server applications send this event when a
+   * user needs to know that a user interface element has changed.
+   */
+  const unsigned long EVENT_ALERT = 0x0013;
+
+  /**
+   * The foreground window has changed.
+   */
+  const unsigned long EVENT_FOREGROUND = 0x0014;
+
+  /**
+   * A menu item on the menu bar has been selected.
+   */
+  const unsigned long EVENT_MENU_START = 0x0015;
+
+  /**
+   * A menu from the menu bar has been closed.
+   */
+  const unsigned long EVENT_MENU_END = 0x0016;
+
+  /**
+   * A pop-up menu has been displayed.
+   */
+  const unsigned long EVENT_MENUPOPUP_START = 0x0017;
+
+  /**
+   * A pop-up menu has been closed.
+   */
+  const unsigned long EVENT_MENUPOPUP_END = 0x0018;
+
+  /**
+   * A window has received mouse capture.
+   */
+  const unsigned long EVENT_CAPTURE_START = 0x0019;
+
+  /**
+   * A window has lost mouse capture.
+   */
+  const unsigned long EVENT_CAPTURE_END = 0x001A;
+
+  /**
+   * A window is being moved or resized.
+   */
+  const unsigned long EVENT_MOVESIZE_START = 0x001B;
+
+  /**
+  * The movement or resizing of a window has finished
+  */
+  const unsigned long EVENT_MOVESIZE_END = 0x001C;
+
+  /**
+   * A window has entered context-sensitive Help mode
+   */
+  const unsigned long EVENT_CONTEXTHELP_START = 0x001D;
+
+  /**
+   * A window has exited context-sensitive Help mode
+   */
+  const unsigned long EVENT_CONTEXTHELP_END = 0x001E;
+
+  /**
+   * An application is about to enter drag-and-drop mode
+   */
+  const unsigned long EVENT_DRAGDROP_START = 0x001F;
+
+  /**
+   * An application is about to exit drag-and-drop mode
+   */
+  const unsigned long EVENT_DRAGDROP_END = 0x0020;
+  
+  /**
+   * A dialog box has been displayed
+   */
+  const unsigned long EVENT_DIALOG_START = 0x0021;
+
+  /**
+   * A dialog box has been closed
+   */
+  const unsigned long EVENT_DIALOG_END = 0x0022;
+
+  /**
+   * Scrolling has started on a scroll bar
+   */
+  const unsigned long EVENT_SCROLLING_START = 0x0023;
+
+  /**
+   * Scrolling has ended on a scroll bar
+   */
+  const unsigned long EVENT_SCROLLING_END = 0x0024;
+
+  /**
+   * A window object is about to be minimized or maximized
+   */
+  const unsigned long EVENT_MINIMIZE_START = 0x0025;
+
+  /**
+   * A window object has been minimized or maximized
+   */
+  const unsigned long EVENT_MINIMIZE_END = 0x0026;
+
+  /**
+   * The loading of the document has completed.
+   */
+  const unsigned long EVENT_DOCUMENT_LOAD_COMPLETE = 0x0027;
+
+  /**
+   * The document contents are being reloaded.
+   */
+  const unsigned long EVENT_DOCUMENT_RELOAD = 0x0028;
+
+  /**
+   * The loading of the document was interrupted.
+   */
+  const unsigned long EVENT_DOCUMENT_LOAD_STOPPED = 0x0029;
+
+  /**
+   * The document wide attributes of the document object have changed.
+   */
+  const unsigned long EVENT_DOCUMENT_ATTRIBUTES_CHANGED = 0x002A;
+
+  /**
+   * The contents of the document have changed.
+   */
+  const unsigned long EVENT_DOCUMENT_CONTENT_CHANGED = 0x002B;
+
+  const unsigned long EVENT_PROPERTY_CHANGED = 0x002C;
+  const unsigned long EVENT_SELECTION_CHANGED = 0x002D;
+
+  /**
+   * A text object's attributes changed.
+   * Also see EVENT_OBJECT_ATTRIBUTE_CHANGED.
+   */
+  const unsigned long EVENT_TEXT_ATTRIBUTE_CHANGED = 0x002E;
+
+  /**
+   * The caret has moved to a new position.
+   */
+  const unsigned long EVENT_TEXT_CARET_MOVED = 0x002F;
+
+  /**
+   * This event indicates general text changes, i.e. changes to text that is
+   * exposed through the IAccessibleText and IAccessibleEditableText interfaces.
+   */
+  const unsigned long EVENT_TEXT_CHANGED = 0x0030;
+
+  /**
+   * Text was inserted.
+   */
+  const unsigned long EVENT_TEXT_INSERTED = 0x0031;
+
+  /**
+   * Text was removed.
+   */
+  const unsigned long EVENT_TEXT_REMOVED = 0x0032;
+
+  /**
+   * Text was updated.
+   */
+  const unsigned long EVENT_TEXT_UPDATED = 0x0033;
+
+  /**
+   * The text selection changed.
+   */
+  const unsigned long EVENT_TEXT_SELECTION_CHANGED = 0x0034;
+
+  /**
+   * A visibile data event indicates the change of the visual appearance
+   * of an accessible object.  This includes for example most of the
+   * attributes available via the IAccessibleComponent interface.
+   */
+  const unsigned long EVENT_VISIBLE_DATA_CHANGED = 0x0035;
+
+  /**
+   * The caret moved from one column to the next.
+   */
+  const unsigned long EVENT_TEXT_COLUMN_CHANGED = 0x0036;
+
+  /**
+   * The caret moved from one section to the next.
+   */
+  const unsigned long EVENT_SECTION_CHANGED = 0x0037;
+
+  /**
+   * A table caption changed.
+   */
+  const unsigned long EVENT_TABLE_CAPTION_CHANGED = 0x0038;
+
+  /**
+   * A table's data changed.
+   */
+  const unsigned long EVENT_TABLE_MODEL_CHANGED = 0x0039;
+
+  /**
+   * A table's summary changed.
+   */
+  const unsigned long EVENT_TABLE_SUMMARY_CHANGED = 0x003A;
+
+  /**
+   * A table's row description changed.
+   */
+  const unsigned long EVENT_TABLE_ROW_DESCRIPTION_CHANGED = 0x003B;
+
+  /**
+   * A table's row header changed.
+   */
+  const unsigned long EVENT_TABLE_ROW_HEADER_CHANGED = 0x003C;
+
+  const unsigned long EVENT_TABLE_ROW_INSERT = 0x003D;
+  const unsigned long EVENT_TABLE_ROW_DELETE = 0x003E;
+  const unsigned long EVENT_TABLE_ROW_REORDER = 0x003F;
+
+  /**
+   * A table's column description changed.
+   */
+  const unsigned long EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED = 0x0040;
+
+  /**
+   * A table's column header changed.
+   */
+  const unsigned long EVENT_TABLE_COLUMN_HEADER_CHANGED = 0x0041;
+
+  const unsigned long EVENT_TABLE_COLUMN_INSERT = 0x0042;
+  const unsigned long EVENT_TABLE_COLUMN_DELETE = 0x0043;
+  const unsigned long EVENT_TABLE_COLUMN_REORDER = 0x0044;
+
+  const unsigned long EVENT_WINDOW_ACTIVATE = 0x0045;
+  const unsigned long EVENT_WINDOW_CREATE = 0x0046;
+  const unsigned long EVENT_WINDOW_DEACTIVATE = 0x0047;
+  const unsigned long EVENT_WINDOW_DESTROY = 0x0048;
+  const unsigned long EVENT_WINDOW_MAXIMIZE = 0x0049;
+  const unsigned long EVENT_WINDOW_MINIMIZE = 0x004A;
+  const unsigned long EVENT_WINDOW_RESIZE = 0x004B;
+  const unsigned long EVENT_WINDOW_RESTORE = 0x004C;
+
+  /**
+   * The ending index of this link within the containing string has changed.
+   */
+  const unsigned long EVENT_HYPERLINK_END_INDEX_CHANGED = 0x004D;
+
+  /**
+   * The number of anchors assoicated with this hyperlink object has changed.
+   */
+  const unsigned long EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED = 0x004E;
+
+  /**
+   * The hyperlink selected state changed from selected to unselected or
+   * from unselected to selected.
+   */
+  const unsigned long EVENT_HYPERLINK_SELECTED_LINK_CHANGED = 0x004F;
+
+  /**
+   * One of the links associated with the hypertext object has been activated.
+   */
+  const unsigned long EVENT_HYPERTEXT_LINK_ACTIVATED = 0x0050;
+
+  /**
+   * One of the links associated with the hypertext object has been selected.
+   */
+  const unsigned long EVENT_HYPERTEXT_LINK_SELECTED = 0x0051;
+
+  /**
+   * The starting index of this link within the containing string has changed.
+   */
+  const unsigned long EVENT_HYPERLINK_START_INDEX_CHANGED = 0x0052;
+
+  /**
+   * Focus has changed from one hypertext object to another, or focus moved
+   * from a non-hypertext object to a hypertext object, or focus moved from a
+   * hypertext object to a non-hypertext object.
+   */
+  const unsigned long EVENT_HYPERTEXT_CHANGED = 0x0053;
+
+  /**
+   * The number of hyperlinks associated with a hypertext object changed.
+   */
+  const unsigned long EVENT_HYPERTEXT_NLINKS_CHANGED = 0x0054;
+
+  /**
+   * An object's attributes changed. Also see EVENT_TEXT_ATTRIBUTE_CHANGED.
+   */
+  const unsigned long EVENT_OBJECT_ATTRIBUTE_CHANGED = 0x0055;
+
+  /**
+   * A slide changed in a presentation document or a page boundary was
+   * crossed in a word processing document.
+   */
+  const unsigned long EVENT_PAGE_CHANGED = 0x0056;
+
+  /**
+   * Help make sure event map does not get out-of-line.
+   */
+  const unsigned long EVENT_LAST_ENTRY = 0x0057;
+
+  /**
+   * The type of event, based on the enumerated event values
+   * defined in this interface.
+   */
+  readonly attribute unsigned long eventType;
+  
+  /**
+   * The nsIAccessible associated with the event.
+   * May return null if no accessible is available
+   */
+  readonly attribute nsIAccessible accessible;
+  
+  /**
+   * The nsIAccessibleDocument that the event target nsIAccessible
+   * resides in. This can be used to get the DOM window,
+   * the DOM document and the window handler, among other things.
+   */
+  readonly attribute nsIAccessibleDocument accessibleDocument;
+
+  /**
+   * The nsIDOMNode associated with the event
+   * May return null if accessible for event has been shut down
+   */
+  readonly attribute nsIDOMNode DOMNode;
+
+  /**
+   * Returns true if the event was caused by explicit user input,
+   * as opposed to purely originating from a timer or mouse movement
+   */
+  readonly attribute boolean isFromUserInput;
+};
+
+
+[scriptable, uuid(9addd25d-8fa1-415e-94ec-6038f220d3e4)]
+interface nsIAccessibleStateChangeEvent : nsISupports
+{
+  /**
+   * Returns the state of accessible (see constants declared
+   * in nsIAccessibleStates).
+   */
+  readonly attribute unsigned long state;
+
+  /**
+   * Returns true if the state is extra state.
+   */
+  boolean isExtraState();
+
+  /**
+   * Returns true if the state is turned on.
+   */
+  boolean isEnabled();
+};
+
+
+[scriptable, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
+interface nsIAccessibleTextChangeEvent : nsISupports
+{
+  /**
+   * Returns offset of changed text in accessible.
+   */
+  readonly attribute long start;
+
+  /**
+   * Returns length of changed text.
+   */
+  readonly attribute unsigned long length;
+
+  /**
+   * Returns true if text was inserted, otherwise false.
+   */
+  boolean isInserted();
+
+  /**
+   * The inserted or removed text
+   */
+  readonly attribute DOMString modifiedText;
+};
+
+[scriptable, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
+interface nsIAccessibleCaretMoveEvent: nsISupports
+{
+  /**
+   * Return caret offset.
+   */
+  readonly attribute long caretOffset;
+};
+
+[scriptable, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
+interface nsIAccessibleTableChangeEvent: nsISupports
+{
+  /**
+   * Return the row or column index.
+   */
+  readonly attribute long rowOrColIndex;
+
+  /**
+   * Return the number of rows or cols
+   */
+  readonly attribute long numRowsOrCols;
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleHyperLink.idl
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Bill Haneman (bill.haneman@sun.com)
+ *   John Gaunt (jgaunt@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+interface nsIURI;
+interface nsIAccessible;
+
+/**
+ * A cross-platform interface that supports hyperlink-specific properties and
+ * methods.  Anchors, image maps, xul:labels with class="text-link" implement this interface.
+ */
+[scriptable, uuid(38c60bfa-6040-4bfe-93f2-acd6a909bb60)]
+interface nsIAccessibleHyperLink : nsISupports
+{
+  /**
+   * Returns the offset of the link within the parent accessible.
+   */
+  readonly attribute long startIndex;
+
+  /**
+   * Returns the end index of the link within the parent accessible.
+   *
+   * @note  The link itself is represented by one embedded character within the
+   * parent text, so the endIndex should be startIndex + 1.
+   */
+  readonly attribute long endIndex;
+
+  /**
+   * Determines whether the link is valid (e. g. points to a valid URL).
+   *
+   * @note  XXX Currently only used with ARIA links, and the author has to
+   * specify that the link is invalid via the aria-invalid="true" attribute.
+   * In all other cases, TRUE is returned.
+   */
+  readonly attribute boolean valid;
+
+  /**
+   * Determines whether the element currently has the focus, e. g. after
+   * returning from the destination page.
+   *
+   * @note  ARIA links can only be focused if they have the tabindex
+   * attribute set.  Also, state_focused should then be set on the accessible
+   * for this link.
+   */
+  readonly attribute boolean selected;
+
+  /**
+   * The numbber of anchors within this Hyperlink. Is normally 1 for anchors.
+   * This anchor is, for example, the visible output of the html:a tag.
+   * With an Image Map, reflects the actual areas within the map.
+   */
+  readonly attribute long anchorCount;
+
+  /**
+   * Returns the URI at the given index.
+   *
+   * @note  ARIA hyperlinks do not have an URI to point to, since clicks are
+   * processed via JavaScript. Therefore this property does not work on ARIA
+   * links.
+   *
+   * @param index  The 0-based index of the URI to be returned.
+   *
+   * @return the nsIURI object containing the specifications for the URI.
+   */
+  nsIURI getURI (in long index);
+
+  /**
+   * Returns a reference to the object at the given index.
+   *
+   * @param index  The 0-based index whose object is to be returned.
+   *
+   * @return the nsIAccessible object at the desired index.
+   */
+  nsIAccessible getAnchor (in long index);
+};
+
+/*
+ Assumptions:
+
+ The object associated with object or anchor index
+ is an nsIAccessible.
+ A URI can be represented by the nsIURI interface
+ (or nsIURL interface).
+
+ Note that an object which supports nsIAccessibleHyperlink
+ does *not* generally implement nsIAccessible, unlike the
+    case of the other nsiAccessible* interfaces in this directory.
+
+    Aaron: would the nsISupports return from
+    getObject be queryable for nsIURI and nsIURL directly?
+
+*/
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleHyperText.idl
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Bill Haneman (bill.haneman@sun.com)
+ *   Paul Sandoz (paul.sandoz@sun.com)
+ *   John Gaunt (jgaunt@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+#include "nsIAccessibleHyperLink.idl"
+
+/**
+ * A cross-platform interface that deals with text which contains hyperlinks.
+ * Each link is an embedded object representing exactly 1 character within
+ * the hypertext.
+ *
+ * Current implementation assumes every embedded object is a link.
+ */
+
+[scriptable, uuid(b33684e2-090c-4e1d-a3d9-f4b46f4237b9)]
+interface nsIAccessibleHyperText : nsISupports
+{
+  /**
+   * Return the number of links contained within this hypertext object.
+   */
+  readonly attribute long linkCount;
+
+  /**
+   * Return link accessible at the given index.
+   *
+   * @param index  [in] 0-based index of the link that is to be retrieved
+   *
+   * @return       link accessible or null if there is no link at that index
+   */
+  nsIAccessibleHyperLink getLinkAt(in long index);
+
+  /**
+   * Return index of the given link.
+   *
+   * @param link  [in] link accessible the index is requested for
+   *
+   * @return      index of the given link or null if there's no link within
+   *                hypertext accessible
+   */
+  long getLinkIndex(in nsIAccessibleHyperLink link);
+
+  /*
+   * Return link index at the given offset within hypertext accessible.
+   *
+   * @param offset  [in] the 0-based character index
+   *
+   * @return        0-based link's index or -1 if no link is present at that
+   *                  offset
+   */
+  long getLinkIndexAtOffset(in long offset);
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleImage.idl
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is IBM Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Original Author: Gao, Ming (gaoming@cn.ibm.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(09086623-0f09-4310-ac56-c2cda7c29648)]
+interface nsIAccessibleImage : nsISupports
+{
+  /**
+   * Returns the coordinates of the image.
+   *
+   * @param coordType  specifies coordinates origin (for available constants
+   *                   refer to nsIAccessibleCoordinateType)
+   * @param x          the x coordinate
+   * @param y          the y coordinate
+   */
+  void getImagePosition(in unsigned long coordType,
+                        out long x,
+                        out long y);
+
+  /**
+   * Returns the size of the image.
+   *
+   * @param width      the heigth
+   * @param height     the width
+   */
+  void getImageSize(out long width, out long height);
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleProvider.idl
@@ -0,0 +1,172 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   John Gaunt
+ *   Alexander Surkov <surkov.alexander@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+/**
+ * nsIAccessibleProvider interface is used to link element and accessible
+   object. For that XBL binding of element should implement the interface.
+ */
+
+[scriptable, uuid(ac0639d5-f95b-4e2b-970c-9eab281fb6a5)]
+interface nsIAccessibleProvider : nsISupports
+{
+  /**
+   * Constants set of common use.
+   */
+
+  /** Do not create an accessible for this object
+   * This is useful if an ancestor binding already implements nsIAccessibleProvider,
+   * but no accessible is desired for the inheriting binding
+   */
+  const long NoAccessible = 0;
+
+  /** For elements that spawn a new document. For example now it is used by
+    <xul:iframe>, <xul:browser> and <xul:editor>. */
+  const long OuterDoc = 0x00000001;
+
+  /**
+   * Constants set is used by XUL controls.
+   */
+
+  const long XULAlert = 0x00001001;
+  const long XULButton = 0x00001002;
+  const long XULCheckbox = 0x00001003;
+  const long XULColorPicker = 0x00001004;
+  const long XULColorPickerTile = 0x00001005;
+  const long XULCombobox = 0x00001006;
+  const long XULDropmarker = 0x00001007;
+  const long XULGroupbox = 0x00001008;
+  const long XULImage = 0x00001009;
+  const long XULLink = 0x0000100A;
+  const long XULListbox = 0x0000100B;
+  const long XULListCell = 0x00001026;
+  const long XULListHead = 0x00001024;
+  const long XULListHeader = 0x00001025;
+  const long XULListitem = 0x0000100C;
+  const long XULMenubar = 0x0000100D;
+  const long XULMenuitem = 0x0000100E;
+  const long XULMenupopup = 0x0000100F;
+  const long XULMenuSeparator = 0x00001010;
+  const long XULPane    = 0x00001011;
+  const long XULProgressMeter = 0x00001012;
+  const long XULScale = 0x00001013;
+  const long XULStatusBar = 0x00001014;
+  const long XULRadioButton = 0x00001015;
+  const long XULRadioGroup = 0x00001016;
+
+  /** Used for XUL tab element */
+  const long XULTab = 0x00001017;
+  /** Used for XUL tabs element, a container for tab elements */
+  const long XULTabs = 0x00001018;
+  /** Used for XUL tabpanels container element */
+  const long XULTabpanels = 0x00001019;
+
+  const long XULText             = 0x0000101A;
+  const long XULTextBox          = 0x0000101B;
+  const long XULThumb            = 0x0000101C;
+  const long XULTree             = 0x0000101D;
+  const long XULTreeColumns      = 0x0000101E;
+  const long XULTreeColumnItem   = 0x0000101F;
+  const long XULToolbar          = 0x00001020;
+  const long XULToolbarSeparator = 0x00001021;
+  const long XULTooltip          = 0x00001022;
+  const long XULToolbarButton    = 0x00001023;
+
+
+  /**
+   * Constants set is used by XForms elements.
+   */
+
+  /** Used for xforms elements that provide accessible object for itself as
+   * well for anonymous content. This property are used for upload,
+   * input[type="xsd:gDay"] and input[type="xsd:gMonth"] */
+  const long XFormsContainer = 0x00002000;
+
+  /** Used for label element */
+  const long XFormsLabel = 0x00002001;
+  /** Used for output element */
+  const long XFormsOutput = 0x00002002;
+  /** Used for trigger and submit elements */
+  const long XFormsTrigger = 0x00002003;
+  /** Used for input and textarea elements */
+  const long XFormsInput = 0x00002004;
+  /** Used for input[xsd:boolean] element */
+  const long XFormsInputBoolean = 0x00002005;
+  /** Used for input[xsd:date] element */
+  const long XFormsInputDate = 0x00002006;
+  /** Used for secret element */
+  const long XFormsSecret = 0x00002007;
+  /** Used for range element represented by slider */
+  const long XFormsSliderRange = 0x00002008;
+
+  /** Used for select and select1 that are implemented using host document's
+   * native widget. For example, a select1 in a xhtml document may be
+   * represented by the native html control html:select */
+  const long XFormsSelect = 0x00002009;
+  /** Used for xforms choices element */
+  const long XFormsChoices = 0x00002010;
+  /** Used for xforms full select/select1 elements that may be represented by
+   * group of checkboxes and radiogroup */
+  const long XFormsSelectFull = 0x00002011;
+  /** Used for xforms item element that is used inside xforms select elements
+   * represented by group of checkboxes */
+  const long XFormsItemCheckgroup = 0x00002012;
+  /** Used for xforms item element that is used inside xforms select1 elements
+   * represented by radio group */
+  const long XFormsItemRadiogroup = 0x00002013;
+  /** Used for xforms select1 element that is represented by combobox */
+  const long XFormsSelectCombobox = 0x00002014;
+  /** Used for xforms item element that is used inside xforms select1
+   * elements represented by combobox */
+  const long XFormsItemCombobox = 0x00002015;
+
+  /** Used for dropmarker widget that is used by xforms elements */
+  const long XFormsDropmarkerWidget = 0x00002101;
+  /** Used for calendar widget that is used by xforms elements */
+  const long XFormsCalendarWidget = 0x00002102;
+  /** Used for popup widget that is used by xforms minimal select1 elements */
+  const long XFormsComboboxPopupWidget = 0x00002103;
+
+  /**
+   * Return one of constants declared above.
+   */
+  readonly attribute long accessibleType;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleRelation.idl
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+#include "nsIArray.idl"
+
+interface nsIAccessible;
+
+/**
+ * This interface gives access to an accessible's set of relations.
+ * Be carefull, do not change constants until ATK has a structure to map gecko
+ * constants into ATK constants.
+ */
+[scriptable, uuid(f42a1589-70ab-4704-877f-4a9162bbe188)]
+interface nsIAccessibleRelation : nsISupports
+{
+
+  const unsigned long RELATION_NUL = 0x00;
+
+  /**
+   * Some attribute of this object is affected by a target object.
+   */
+  const unsigned long RELATION_CONTROLLED_BY = 0x01;
+
+  // First relation
+  const unsigned long RELATION_FIRST = RELATION_CONTROLLED_BY;
+
+  /**
+   * This object is interactive and controls some attribute of a target object.
+   */
+  const unsigned long RELATION_CONTROLLER_FOR = 0x02;
+
+  /**
+   * This object is label for a target object.
+   */
+  const unsigned long RELATION_LABEL_FOR = 0x03;
+
+  /**
+   * This object is labelled by a target object.
+   */
+  const unsigned long RELATION_LABELLED_BY = 0x04;
+
+  /**
+   * This object is a member of a group of one or more objects. When there is
+   * more than one object in the group each member may have one and the same
+   * target, e.g. a grouping object.  It is also possible that each member has
+   * multiple additional targets, e.g. one for every other member in the group.
+   */
+  const unsigned long RELATION_MEMBER_OF = 0x05;
+
+  /**
+   * This object is a child of a target object.
+   */
+  const unsigned long RELATION_NODE_CHILD_OF = 0x06;
+
+  /**
+   * Content flows from this object to a target object, i.e. has content that
+   * flows logically to another object in a sequential way, e.g. text flow.
+   */
+  const unsigned long RELATION_FLOWS_TO = 0x07;
+
+  /**
+   * Content flows to this object from a target object, i.e. has content that
+   * flows logically from another object in a sequential way, e.g. text flow.
+   */
+  const unsigned long RELATION_FLOWS_FROM = 0x08;
+
+  /**
+   * This object is a sub window of a target object.
+   */
+  const unsigned long RELATION_SUBWINDOW_OF = 0x09;
+
+  /**
+   * This object embeds a target object. This relation can be used on the
+   * OBJID_CLIENT accessible for a top level window to show where the content
+   * areas are.
+   */
+  const unsigned long RELATION_EMBEDS = 0x0a;
+
+  /**
+   * This object is embedded by a target object.
+   */
+  const unsigned long RELATION_EMBEDDED_BY = 0x0b;
+
+  /**
+   * This object is a transient component related to the target object. When
+   * this object is activated the target object doesn't lose focus.
+   */
+  const unsigned long RELATION_POPUP_FOR = 0x0c;
+
+  /**
+   * This object is a parent window of the target object.
+   */
+  const unsigned long RELATION_PARENT_WINDOW_OF = 0x0d;
+
+  /**
+   * This object is described by the target object.
+   */
+  const unsigned long RELATION_DESCRIBED_BY = 0x0e;
+
+  /**
+   * This object is describes the target object.
+   */
+  const unsigned long RELATION_DESCRIPTION_FOR = 0x0f;
+
+  // Last relation that is standard to desktop accessibility APIs
+  const unsigned long RELATION_LAST = RELATION_DESCRIPTION_FOR;
+
+  /**
+   * Part of a form/dialog with a related default button. It is used for
+   * MSAA only, no for IA2 nor ATK.
+   */
+  const unsigned long RELATION_DEFAULT_BUTTON = 0x4000;
+
+  /**
+   * Returns the type of the relation.
+   */
+  readonly attribute unsigned long relationType;
+
+  /**
+   * Returns the number of targets for this relation.
+   */
+  readonly attribute unsigned long targetsCount;
+
+  /**
+   * Returns one accessible relation target.
+   * @param index - 0 based index of relation target.
+   */
+  nsIAccessible getTarget(in unsigned long index);
+
+  /**
+   * Returns multiple accessible relation targets.
+   */
+  nsIArray getTargets();
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleRetrieval.idl
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Original Author: Aaron Leventhal (aaronl@netscape.com)
+ * Contributor(s): Kyle Yuan (kyle.yuan@sun.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+interface nsIDOMNode;
+interface nsIAccessible;
+interface nsIWeakReference;
+interface nsIPresShell;
+interface nsIDOMWindow;
+interface nsIAccessNode;
+interface nsIDOMDOMStringList;
+
+
+/**
+ * An interface for in-process accessibility clients
+ * wishing to get an nsIAccessible or nsIAccessNode for
+ * a given DOM node.
+ * More documentation at:
+ *   http://www.mozilla.org/projects/ui/accessibility
+ */
+[scriptable, uuid(310ce77d-c92b-4761-82e8-77e1a728e8d4)]
+interface nsIAccessibleRetrieval : nsISupports
+{
+  /**
+   * Return application accessible.
+   */
+  nsIAccessible getApplicationAccessible();
+
+  /**
+   * Return an nsIAccessible for a DOM node in pres shell 0.
+   * Create a new accessible of the appropriate type if necessary,
+   * or use one from the accessibility cache if it already exists.
+   * @param aNode The DOM node to get an accessible for.
+   * @return The nsIAccessible for the given DOM node.
+   */
+  nsIAccessible getAccessibleFor(in nsIDOMNode aNode);
+
+   /**
+    * Returns accessible role as a string.
+    *
+    * @param aRole - the accessible role constants.
+    */
+  AString getStringRole(in unsigned long aRole);
+
+   /**
+    * Returns list which contains accessible states as a strings.
+    *
+    * @param aStates - accessible states.
+    * @param aExtraStates - accessible extra states.
+    */
+  nsIDOMDOMStringList getStringStates(in unsigned long aStates,
+                                      in unsigned long aExtraStates);
+
+  /**
+   * Get the type of accessible event as a string.
+   *
+   * @param aEventType - the accessible event type constant
+   * @return - accessible event type presented as human readable string
+   */
+  AString getStringEventType(in unsigned long aEventType);
+
+  /**
+   * Get the type of accessible relation as a string.
+   *
+   * @param aRelationType - the accessible relation type constant
+   * @return - accessible relation type presented as human readable string
+   */
+  AString getStringRelationType(in unsigned long aRelationType);
+
+  /**
+   * Return an accessible for the given DOM node from the cache.
+   * @note  the method is intended for testing purposes
+   *
+   * @param aNode  [in] the DOM node to get an accessible for
+   *
+   * @return       cached accessible for the given DOM node if any
+   */
+  nsIAccessible getAccessibleFromCache(in nsIDOMNode aNode);
+};
+
+
+%{ C++
+
+// for component registration
+// {663CA4A8-D219-4000-925D-D8F66406B626}
+#define NS_ACCESSIBLE_RETRIEVAL_CID \
+{ 0x663ca4a8, 0xd219, 0x4000, { 0x92, 0x5d, 0xd8, 0xf6, 0x64, 0x6, 0xb6, 0x26 } }
+
+%}
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleRole.idl
@@ -0,0 +1,796 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Alexander Surkov <surkov.alexander@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+/**
+ * Defines cross platform (Gecko) roles.
+ *
+ * @note - When adding a new role, be sure to also add it to nsRoleMap.h for
+ *         each platform.
+ */
+[scriptable, uuid(f134da65-39a8-4330-843c-5bd42780b34c)]
+interface nsIAccessibleRole : nsISupports
+{
+  /**
+   * Used when accessible hans't strong defined role.
+   */
+  const unsigned long ROLE_NOTHING = 0;
+
+  /**
+   * Represents a title or caption bar for a window. It is used by MSAA only,
+   * supported automatically by MS Windows.
+   */
+  const unsigned long ROLE_TITLEBAR = 1;
+
+  /**
+   * Represents the menu bar (positioned beneath the title bar of a window)
+   * from which menus are selected by the user. The role is used by
+   * xul:menubar or role="menubar".
+   */
+  const unsigned long ROLE_MENUBAR = 2;
+
+  /**
+   * Represents a vertical or horizontal scroll bar, which is part of the client
+   * area or used in a control.
+   */
+  const unsigned long ROLE_SCROLLBAR = 3;
+
+  /**
+   * Represents a special mouse pointer, which allows a user to manipulate user
+   * interface elements such as windows. For example, a user clicks and drags
+   * a sizing grip in the lower-right corner of a window to resize it.
+   */
+  const unsigned long ROLE_GRIP = 4;
+
+  /**
+   * Represents a system sound, which is associated with various system events.
+   */
+  const unsigned long ROLE_SOUND = 5;
+
+  /**
+   * Represents the system mouse pointer.
+   */
+  const unsigned long ROLE_CURSOR = 6;
+
+  /**
+   * Represents the system caret. The role is supported for caret.
+   */
+  const unsigned long ROLE_CARET = 7;
+
+  /**
+   * Represents an alert or a condition that a user should be notified about.
+   * Assistive Technologies typically respond to the role by reading the entire
+   * onscreen contents of containers advertising this role. Should be used for
+   * warning dialogs, etc. The role is used by xul:browsermessage,
+   * role="alert", xforms:message.
+   */
+  const unsigned long ROLE_ALERT = 8;
+
+  /**
+   * Represents the window frame, which contains child objects such as
+   * a title bar, client, and other objects contained in a window. The role
+   * is supported automatically by MS Windows.
+   */
+  const unsigned long ROLE_WINDOW = 9;
+
+  /**
+   * A sub-document (<frame> or <iframe>)
+   */
+  const unsigned long ROLE_INTERNAL_FRAME = 10;
+
+  /**
+   * Represents a menu, which presents a list of options from which the user can
+   * make a selection to perform an action. It is used for role="menu".
+   */
+  const unsigned long ROLE_MENUPOPUP = 11;
+
+  /**
+   * Represents a menu item, which is an entry in a menu that a user can choose
+   * to carry out a command, select an option. It is used for xul:menuitem,
+   * role="menuitem".
+   */
+  const unsigned long ROLE_MENUITEM = 12;
+
+  /**
+   * Represents a ToolTip that provides helpful hints.
+   */
+  const unsigned long ROLE_TOOLTIP = 13;
+
+  /**
+   * Represents a main window for an application. It is used for
+   * role="application". Also refer to ROLE_APP_ROOT
+   */
+  const unsigned long ROLE_APPLICATION = 14;
+
+  /**
+   * Represents a document window. A document window is always contained within
+   * an application window. It is used for role="document".
+   */
+  const unsigned long ROLE_DOCUMENT = 15;
+
+  /**
+   * Represents a pane within a frame or document window. Users can navigate
+   * between panes and within the contents of the current pane, but cannot
+   * navigate between items in different panes. Thus, panes represent a level
+   * of grouping lower than frame windows or documents, but above individual
+   * controls. It is used for the first child of a <frame> or <iframe>.
+   */
+  const unsigned long ROLE_PANE = 16;
+
+  /**
+   * Represents a graphical image used to represent data.
+   */
+  const unsigned long ROLE_CHART = 17;
+
+  /**
+   * Represents a dialog box or message box. It is used for xul:dialog, 
+   * role="dialog".
+   */
+  const unsigned long ROLE_DIALOG = 18;
+
+  /**
+   * Represents a window border.
+   */
+  const unsigned long ROLE_BORDER = 19;
+
+  /**
+   * Logically groups other objects. There is not always a parent-child
+   * relationship between the grouping object and the objects it contains. It
+   * is used for html:textfield, xul:groupbox, role="group".
+   */
+  const unsigned long ROLE_GROUPING = 20;
+
+  /**
+   * Used to visually divide a space into two regions, such as a separator menu
+   * item or a bar that divides split panes within a window. It is used for
+   * xul:separator, html:hr, role="separator".
+   */
+  const unsigned long ROLE_SEPARATOR = 21;
+
+  /**
+   * Represents a toolbar, which is a grouping of controls (push buttons or
+   * toggle buttons) that provides easy access to frequently used features. It
+   * is used for xul:toolbar, role="toolbar".
+   */
+  const unsigned long ROLE_TOOLBAR = 22;
+
+  /**
+   * Represents a status bar, which is an area at the bottom of a window that
+   * displays information about the current operation, state of the application,
+   * or selected object. The status bar has multiple fields, which display
+   * different kinds of information. It is used for xul:statusbar.
+   */
+  const unsigned long ROLE_STATUSBAR = 23;
+
+  /**
+   * Represents a table that contains rows and columns of cells, and optionally,
+   * row headers and column headers. It is used for html:table,
+   * role="grid". Also refer to the following roles: ROLE_COLUMNHEADER,
+   * ROLE_ROWHEADER, ROLE_COLUMN, ROLE_ROW, ROLE_CELL.
+   */
+  const unsigned long ROLE_TABLE = 24;
+
+  /**
+   * Represents a column header, providing a visual label for a column in
+   * a table. It is used for XUL tree column headers, html:th,
+   * role="colheader". Also refer to ROLE_TABLE.
+   */
+  const unsigned long ROLE_COLUMNHEADER = 25;
+
+  /**
+   * Represents a row header, which provides a visual label for a table row.
+   * It is used for role="rowheader". Also, see ROLE_TABLE.
+   */
+  const unsigned long ROLE_ROWHEADER = 26;
+
+  /**
+   * Represents a column of cells within a table. Also, see ROLE_TABLE.
+   */
+  const unsigned long ROLE_COLUMN = 27;
+
+  /**
+   * Represents a row of cells within a table. Also, see ROLE_TABLE.
+   */
+  const unsigned long ROLE_ROW = 28;
+
+  /**
+   * Represents a cell within a table. It is used for html:td,
+   * xul:tree cell and xul:listcell. Also, see ROLE_TABLE.
+   */
+  const unsigned long ROLE_CELL = 29;
+
+  /**
+   * Represents a link to something else. This object might look like text or
+   * a graphic, but it acts like a button. It is used for
+   * xul:label@class="text-link", html:a, html:area,
+   * xforms:trigger@appearance="minimal".
+   */
+  const unsigned long ROLE_LINK = 30;
+
+  /**
+   * Displays a Help topic in the form of a ToolTip or Help balloon.
+   */
+  const unsigned long ROLE_HELPBALLOON = 31;
+
+  /**
+   * Represents a cartoon-like graphic object, such as Microsoft Office
+   * Assistant, which is displayed to provide help to users of an application.
+   */
+  const unsigned long ROLE_CHARACTER = 32;
+
+  /**
+   * Represents a list box, allowing the user to select one or more items. It
+   * is used for xul:listbox, html:select@size, role="list". See also
+   * ROLE_LIST_ITEM.
+   */
+  const unsigned long ROLE_LIST = 33;
+
+  /**
+   * Represents an item in a list. See also ROLE_LIST.
+   */
+  const unsigned long ROLE_LISTITEM = 34;
+
+  /**
+   * Represents an outline or tree structure, such as a tree view control,
+   * that displays a hierarchical list and allows the user to expand and
+   * collapse branches. Is is used for role="tree".
+   */
+  const unsigned long ROLE_OUTLINE = 35;
+
+  /**
+   * Represents an item in an outline or tree structure. It is used for
+   * role="treeitem".
+   */
+  const unsigned long ROLE_OUTLINEITEM = 36;
+
+  /**
+   * Represents a page tab, it is a child of a page tab list. It is used for
+   * xul:tab, role="treeitem". Also refer to ROLE_PAGETABLIST.
+   */
+  const unsigned long ROLE_PAGETAB = 37;
+
+  /**
+   * Represents a property sheet. It is used for xul:tabpanel,
+   * role="tabpanel".
+   */
+  const unsigned long ROLE_PROPERTYPAGE = 38;
+
+  /**
+   * Represents an indicator, such as a pointer graphic, that points to the
+   * current item.
+   */
+  const unsigned long ROLE_INDICATOR = 39;
+
+  /**
+   * Represents a picture. Is is used for xul:image, html:img.
+   */
+  const unsigned long ROLE_GRAPHIC = 40;
+
+  /**
+   * Represents read-only text, such as labels for other controls or
+   * instructions in a dialog box. Static text cannot be modified or selected.
+   * Is is used for xul:label, xul:description, html:label, role="label",
+   * or xforms:output.
+   */
+  const unsigned long ROLE_STATICTEXT = 41;
+
+  /**
+   * Represents selectable text that allows edits or is designated read-only.
+   */
+  const unsigned long ROLE_TEXT_LEAF = 42;
+
+  /**
+   * Represents a push button control. It is used for xul:button, html:button,
+   * role="button", xforms:trigger, xforms:submit.
+   */
+  const unsigned long ROLE_PUSHBUTTON = 43;
+
+  /**
+   * Represents a check box control. It is used for xul:checkbox,
+   * html:input@type="checkbox", role="checkbox", boolean xforms:input.
+   */
+  const unsigned long ROLE_CHECKBUTTON = 44;
+
+  /**
+   * Represents an option button, also called a radio button. It is one of a
+   * group of mutually exclusive options. All objects sharing a single parent
+   * that have this attribute are assumed to be part of single mutually
+   * exclusive group. It is used for xul:radio, html:input@type="radio",
+   * role="radio".
+   */
+  const unsigned long ROLE_RADIOBUTTON = 45;
+
+  /**
+   * Represents a combo box; an edit control with an associated list box that
+   * provides a set of predefined choices. It is used for html:select,
+   * xul:menulist, role="combobox".
+   */
+  const unsigned long ROLE_COMBOBOX = 46;
+
+  /**
+   * Represents the calendar control. It is used for date xforms:input.
+   */
+  const unsigned long ROLE_DROPLIST = 47;
+
+  /**
+   * Represents a progress bar, dynamically showing the user the percent
+   * complete of an operation in progress. It is used for xul:progressmeter,
+   * role="progressbar".
+   */
+  const unsigned long ROLE_PROGRESSBAR = 48;
+
+  /**
+   * Represents a dial or knob whose purpose is to allow a user to set a value.
+   */
+  const unsigned long ROLE_DIAL = 49;
+
+  /**
+   * Represents a hot-key field that allows the user to enter a combination or
+   * sequence of keystrokes.
+   */
+  const unsigned long ROLE_HOTKEYFIELD = 50;
+
+  /**
+   * Represents a slider, which allows the user to adjust a setting in given
+   * increments between minimum and maximum values. It is used by xul:scale,
+   * role="slider", xforms:range.
+   */
+  const unsigned long ROLE_SLIDER = 51;
+
+  /**
+   * Represents a spin box, which is a control that allows the user to increment
+   * or decrement the value displayed in a separate "buddy" control associated
+   * with the spin box. It is used for xul:spinbuttons.
+   */
+  const unsigned long ROLE_SPINBUTTON = 52;
+
+  /**
+   * Represents a graphical image used to diagram data. It is used for svg:svg.
+   */
+  const unsigned long ROLE_DIAGRAM = 53;
+
+  /**
+   * Represents an animation control, which contains content that changes over
+   * time, such as a control that displays a series of bitmap frames.
+   */
+  const unsigned long ROLE_ANIMATION = 54;
+
+  /**
+   * Represents a mathematical equation. It is used by MATHML, where there is a
+   * rich DOM subtree for an equation. Use ROLE_FLAT_EQUATION for <img role="math" alt="[TeX]"/>
+   */
+  const unsigned long ROLE_EQUATION = 55;
+
+  /**
+   * Represents a button that drops down a list of items.
+   */
+  const unsigned long ROLE_BUTTONDROPDOWN = 56;
+
+  /**
+   * Represents a button that drops down a menu.
+   */
+  const unsigned long ROLE_BUTTONMENU = 57;
+
+  /**
+   * Represents a button that drops down a grid. It is used for xul:colorpicker.
+   */
+  const unsigned long ROLE_BUTTONDROPDOWNGRID = 58;
+
+  /**
+   * Represents blank space between other objects.
+   */
+  const unsigned long ROLE_WHITESPACE = 59;
+
+  /**
+   * Represents a container of page tab controls. Is it used for xul:tabs,
+   * DHTML: role="tabs". Also refer to ROLE_PAGETAB.
+   */
+  const unsigned long ROLE_PAGETABLIST = 60;
+
+  /**
+   * Represents a control that displays time.
+   */
+  const unsigned long ROLE_CLOCK = 61;
+
+  /**
+   * Represents a button on a toolbar that has a drop-down list icon directly
+   * adjacent to the button.
+   */
+  const unsigned long ROLE_SPLITBUTTON = 62;
+
+  /**
+   * Represents an edit control designed for an Internet Protocol (IP) address.
+   * The edit control is divided into sections for the different parts of the
+   * IP address.
+   */
+  const unsigned long ROLE_IPADDRESS = 63;
+
+  /**
+   * Represents a label control that has an accelerator.
+   */
+  const unsigned long ROLE_ACCEL_LABEL = 64;
+
+  /**
+   * Represents an arrow in one of the four cardinal directions.
+   */
+  const unsigned long ROLE_ARROW  = 65;
+
+  /**
+   * Represents a control that can be drawn into and is used to trap events.
+   * It is used for html:canvas.
+   */
+  const unsigned long ROLE_CANVAS = 66;
+
+  /**
+   * Represents a menu item with a check box.
+   */
+  const unsigned long ROLE_CHECK_MENU_ITEM = 67;
+
+  /**
+   * Represents a specialized dialog that lets the user choose a color.
+   */
+  const unsigned long ROLE_COLOR_CHOOSER  = 68;
+
+  /**
+   * Represents control whose purpose is to allow a user to edit a date.
+   */
+  const unsigned long ROLE_DATE_EDITOR = 69;
+
+  /**
+   * An iconified internal frame in an ROLE_DESKTOP_PANE. Also refer to
+   * ROLE_INTERNAL_FRAME.
+   */
+  const unsigned long ROLE_DESKTOP_ICON = 70;
+
+  /**
+   * A desktop pane. A pane that supports internal frames and iconified
+   * versions of those internal frames.
+   */
+  const unsigned long ROLE_DESKTOP_FRAME = 71;
+
+  /**
+   * A directory pane. A pane that allows the user to navigate through
+   * and select the contents of a directory. May be used by a file chooser.
+   * Also refer to ROLE_FILE_CHOOSER.
+   */
+  const unsigned long ROLE_DIRECTORY_PANE = 72;
+
+  /**
+   * A file chooser. A specialized dialog that displays the files in the
+   * directory and lets the user select a file, browse a different directory,
+   * or specify a filename. May use the directory pane to show the contents of
+   * a directory. Also refer to ROLE_DIRECTORY_PANE.
+   */
+  const unsigned long ROLE_FILE_CHOOSER = 73;
+
+  /**
+   * A font chooser. A font chooser is a component that lets the user pick
+   * various attributes for fonts.
+   */
+  const unsigned long ROLE_FONT_CHOOSER = 74;
+
+  /**
+   * Frame role. A top level window with a title bar, border, menu bar, etc.
+   * It is often used as the primary window for an application.
+   */
+  const unsigned long ROLE_CHROME_WINDOW = 75;
+
+  /**
+   *  A glass pane. A pane that is guaranteed to be painted on top of all
+   * panes beneath it. Also refer to ROLE_ROOT_PANE.
+   */
+  const unsigned long ROLE_GLASS_PANE = 76;
+
+  /**
+   * A document container for HTML, whose children represent the document
+   * content.
+   */
+  const unsigned long ROLE_HTML_CONTAINER = 77;
+
+  /**
+   * A small fixed size picture, typically used to decorate components.
+   */
+  const unsigned long ROLE_ICON = 78;
+
+  /**
+   * Presents an icon or short string in an interface.
+   */
+  const unsigned long ROLE_LABEL = 79;
+
+  /**
+   * A layered pane. A specialized pane that allows its children to be drawn
+   * in layers, providing a form of stacking order. This is usually the pane
+   * that holds the menu bar as  well as the pane that contains most of the
+   * visual components in a window. Also refer to ROLE_GLASS_PANE and
+   * ROLE_ROOT_PANE.
+   */
+  const unsigned long ROLE_LAYERED_PANE = 80;
+
+  /**
+   * A specialized pane whose primary use is inside a dialog.
+   */
+  const unsigned long ROLE_OPTION_PANE = 81;
+
+  /**
+   * A text object uses for passwords, or other places where the text content
+   * is not shown visibly to the user.
+   */
+  const unsigned long ROLE_PASSWORD_TEXT = 82;
+
+  /**
+   * A temporary window that is usually used to offer the user a list of
+   * choices, and then hides when the user selects one of those choices.
+   */
+  const unsigned long ROLE_POPUP_MENU = 83;
+
+  /**
+   * A radio button that is a menu item.
+   */
+  const unsigned long ROLE_RADIO_MENU_ITEM = 84;
+
+  /**
+   * A root pane. A specialized pane that has a glass pane and a layered pane
+   * as its children. Also refer to ROLE_GLASS_PANE and ROLE_LAYERED_PANE.
+   */
+  const unsigned long ROLE_ROOT_PANE = 85;
+
+  /**
+   * A scroll pane. An object that allows a user to incrementally view a large
+   * amount of information.  Its children can include scroll bars and a
+   * viewport. Also refer to ROLE_VIEW_PORT.
+   */
+  const unsigned long ROLE_SCROLL_PANE = 86;
+
+  /**
+   * A split pane. A specialized panel that presents two other panels at the
+   * same time. Between the two panels is a divider the user can manipulate to
+   * make one panel larger and the other panel smaller.
+   */
+  const unsigned long ROLE_SPLIT_PANE = 87;
+
+  /**
+   * The header for a column of a table.
+   * XXX: it looks this role is dupe of ROLE_COLUMNHEADER.
+   */
+  const unsigned long ROLE_TABLE_COLUMN_HEADER = 88;
+
+  /**
+   * The header for a row of a table.
+   * XXX: it looks this role is dupe of ROLE_ROWHEADER
+   */
+  const unsigned long ROLE_TABLE_ROW_HEADER = 89;
+
+  /**
+   * A menu item used to tear off and reattach its menu.
+   */
+  const unsigned long ROLE_TEAR_OFF_MENU_ITEM = 90;
+
+  /**
+   * Represents an accessible terminal.
+   */
+  const unsigned long ROLE_TERMINAL = 91;
+
+  /**
+   * Collection of objects that constitute a logical text entity.
+   */
+  const unsigned long ROLE_TEXT_CONTAINER = 92;
+
+  /**
+   * A toggle button. A specialized push button that can be checked or
+   * unchecked, but does not provide a separate indicator for the current state.
+   */
+  const unsigned long ROLE_TOGGLE_BUTTON = 93;
+
+  /**
+   * Representas a control that is capable of expanding and collapsing rows as
+   * well as showing multiple columns of data.
+   * XXX: it looks like this role is dupe of ROLE_OUTLINE.
+   */
+  const unsigned long ROLE_TREE_TABLE = 94;
+
+  /**
+   * A viewport. An object usually used in a scroll pane. It represents the
+   * portion of the entire data that the user can see. As the user manipulates
+   * the scroll bars, the contents of the viewport can change. Also refer to
+   * ROLE_SCROLL_PANE.
+   */
+  const unsigned long ROLE_VIEWPORT = 95;
+
+  /**
+   * Header of a document page. Also refer to ROLE_FOOTER.
+   */
+  const unsigned long ROLE_HEADER = 96;
+
+  /**
+   * Footer of a document page. Also refer to ROLE_HEADER.
+   */
+  const unsigned long ROLE_FOOTER = 97;
+
+  /**
+   * A paragraph of text.
+   */
+  const unsigned long ROLE_PARAGRAPH = 98;
+
+  /**
+   * A ruler such as those used in word processors.
+   */
+  const unsigned long ROLE_RULER = 99;
+
+  /**
+   * A text entry having dialog or list containing items for insertion into
+   * an entry widget, for instance a list of words for completion of a
+   * text entry. It is used for xul:textbox@autocomplete
+   */
+  const unsigned long ROLE_AUTOCOMPLETE = 100;
+
+  /**
+   *  An editable text object in a toolbar.
+   */
+  const unsigned long ROLE_EDITBAR = 101;
+
+  /**
+   * An control whose textual content may be entered or modified by the user.
+   */
+  const unsigned long ROLE_ENTRY = 102;
+
+  /**
+   * A caption describing another object.
+   */
+  const unsigned long ROLE_CAPTION = 103;
+
+  /**
+   * A visual frame or container which contains a view of document content.
+   * Document frames may occur within another Document instance, in which case
+   * the second document may be said to be embedded in the containing instance.
+   * HTML frames are often ROLE_DOCUMENT_FRAME. Either this object, or a
+   * singleton descendant, should implement the Document interface.
+   */
+  const unsigned long ROLE_DOCUMENT_FRAME = 104;
+
+  /**
+   * Heading.
+   */
+  const unsigned long ROLE_HEADING = 105;
+
+  /**
+   * An object representing a page of document content.  It is used in documents
+   * which are accessed by the user on a page by page basis.
+   */
+  const unsigned long ROLE_PAGE = 106;
+
+  /**
+   * A container of document content.  An example of the use of this role is to
+   * represent an html:div.
+   */
+  const unsigned long ROLE_SECTION = 107;
+
+  /**
+   * An object which is redundant with another object in the accessible
+   * hierarchy. ATs typically ignore objects with this role.
+   */
+  const unsigned long ROLE_REDUNDANT_OBJECT = 108;
+
+  /**
+   * A container of form controls. An example of the use of this role is to
+   * represent an html:form.
+   */
+  const unsigned long ROLE_FORM = 109;
+
+  /**
+   * An object which is used to allow input of characters not found on a
+   * keyboard, such as the input of Chinese characters on a Western keyboard.
+   */
+  const unsigned long ROLE_IME = 110;
+
+  /**
+   * XXX: document this.
+   */
+  const unsigned long ROLE_APP_ROOT = 111;
+
+  /**
+   * Represents a menu item, which is an entry in a menu that a user can choose
+   * to display another menu.
+   */
+  const unsigned long ROLE_PARENT_MENUITEM = 112;
+
+  /**
+   * A calendar that allows the user to select a date.
+   */
+  const unsigned long ROLE_CALENDAR = 113;
+
+  /**
+   * A list of items that is shown by combobox.
+   */
+  const unsigned long ROLE_COMBOBOX_LIST = 114;
+
+  /**
+   * A item of list that is shown by combobox;
+   */
+  const unsigned long ROLE_COMBOBOX_OPTION = 115;
+
+  /**
+   * An image map -- has child links representing the areas
+   */
+  const unsigned long ROLE_IMAGE_MAP = 116;
+  
+  /**
+   * An option in a listbox
+   */
+  const unsigned long ROLE_OPTION = 117;
+  
+  /**
+   * A rich option in a listbox, it can have other widgets as children
+   */
+  const unsigned long ROLE_RICH_OPTION = 118;
+  
+  /**
+   * A list of options
+   */
+  const unsigned long ROLE_LISTBOX = 119;
+
+  /**
+   * Represents a mathematical equation in the accessible name
+   */
+  const unsigned long ROLE_FLAT_EQUATION = 120;
+  
+  /**
+   * Represents a cell within a grid. It is used for role="gridcell". Unlike
+   * ROLE_CELL, it allows the calculation of the accessible name from subtree.
+   * Also, see ROLE_TABLE.
+   */
+  const unsigned long ROLE_GRID_CELL = 121;
+
+  /**
+   * Represents an embedded object. It is used for html:object or html:embed.
+   */
+  const unsigned long ROLE_EMBEDDED_OBJECT = 122;
+
+  /**
+   * A note. Originally intended to be hidden until activated, but now also used
+   * for things like html 'aside'.
+   */
+  const unsigned long ROLE_NOTE = 123;
+
+  /**
+   * It's not role actually. This constant is important to help ensure
+   * nsRoleMap's are synchronized.
+   */
+  const unsigned long ROLE_LAST_ENTRY = 124;
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleSelectable.idl
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Marc Mulcahy (marc.mulcahy@sun.com)
+ *   Paul Sandoz (paul.sandoz@sun.com)
+ *   Bill Haneman (bill.haneman@sun.com)
+ *   Kyle Yuan (kyle.yuan@sun.com)
+ *   Aaron Leventhal (aaronl@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+#include "nsISupports.idl"
+#include "nsIAccessible.idl"
+#include "nsIArray.idl"
+
+/**
+ * An interface for the accessibility module and in-process accessibility clients
+ * for dealing with getting and changing the selection of accessible nodes.
+ */
+[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
+interface nsIAccessibleSelectable : nsISupports
+{
+    const unsigned long eSelection_Add = 0;
+    const unsigned long eSelection_Remove = 1;
+    const unsigned long eSelection_GetState = 2;
+
+    /**
+     * Return an nsIArray of selected nsIAccessible children 
+     */
+    nsIArray GetSelectedChildren();
+    
+    /**
+     * Returns the number of accessible children currently selected.
+     */
+    readonly attribute long selectionCount;
+
+    /**
+     * Adds the specified accessible child of the object to the
+     * object's selection.
+     * If the specified object is already selected, then it does nothing.
+     * @throws NS_ERROR_FAILURE if the specified object is not selectable.
+     */
+    void addChildToSelection(in long index);
+
+    /**
+     * Removes the specified child of the object from the object's selection.
+     * If the specified object was not selected, then it does nothing.
+     * @throws NS_ERROR_FAILURE if the specified object is not selectable.
+     */
+    void removeChildFromSelection(in long index);
+
+    /**
+     * Clears the selection in the object so that no children in the object
+     * are selected.
+     */
+    void clearSelection();
+
+    /**
+     * Returns a reference to the accessible object representing the specified
+     * selected child of the object.
+     * @param index Zero-based selected accessible child index 
+     * @return The nth selected accessible child
+     */
+    nsIAccessible refSelection(in long index);
+
+    /**
+      * Determines if the current child of this object is selected
+      * @param The zero-based accessible child index
+      * @return Returns true if the child is selected, false if not.
+      */
+    boolean isChildSelected(in long index);
+
+    /**
+     * Select all children
+     * @return If the object does not accept multiple selection, return false.
+     *         Otherwise, returns true.
+     */
+    boolean selectAllSelection();
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleStates.idl
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Alexander Surkov <surkov.alexander@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(7fe1ee90-edaa-43f1-9f3b-071099b51f08)]
+interface nsIAccessibleStates : nsISupports
+{
+  /**
+   * MSAA State flags - used for bitfield. More than 1 allowed.
+   */
+  const unsigned long  STATE_UNAVAILABLE        = 0x00000001;  // Disabled, maps to opposite of Java ENABLED, Gnome/ATK SENSITIVE?
+  const unsigned long  STATE_SELECTED           = 0x00000002;
+  const unsigned long  STATE_FOCUSED            = 0x00000004;
+  const unsigned long  STATE_PRESSED            = 0x00000008;
+  const unsigned long  STATE_CHECKED            = 0x00000010;
+  const unsigned long  STATE_MIXED              = 0x00000020; // 3-state checkbox or toolbar button
+  const unsigned long  STATE_READONLY           = 0x00000040; // Maps to opposite of Java/Gnome/ATK EDITABLE state
+  const unsigned long  STATE_HOTTRACKED         = 0x00000080;
+  const unsigned long  STATE_DEFAULT            = 0x00000100;
+  const unsigned long  STATE_EXPANDED           = 0x00000200;
+  const unsigned long  STATE_COLLAPSED          = 0x00000400;
+  const unsigned long  STATE_BUSY               = 0x00000800;
+  const unsigned long  STATE_FLOATING           = 0x00001000;  // Children "owned" not "contained" by parent
+  const unsigned long  STATE_MARQUEED           = 0x00002000;
+  const unsigned long  STATE_ANIMATED           = 0x00004000;
+  const unsigned long  STATE_INVISIBLE          = 0x00008000;  // Programatically hidden
+  const unsigned long  STATE_OFFSCREEN          = 0x00010000;  // Scrolled off
+  const unsigned long  STATE_SIZEABLE           = 0x00020000;
+  const unsigned long  STATE_MOVEABLE           = 0x00040000;
+  const unsigned long  STATE_SELFVOICING        = 0x00080000;
+  const unsigned long  STATE_FOCUSABLE          = 0x00100000;
+  const unsigned long  STATE_SELECTABLE         = 0x00200000;
+  const unsigned long  STATE_LINKED             = 0x00400000;
+  const unsigned long  STATE_TRAVERSED          = 0x00800000;
+  const unsigned long  STATE_MULTISELECTABLE    = 0x01000000;  // Supports multiple selection
+  const unsigned long  STATE_EXTSELECTABLE      = 0x02000000;  // Supports extended selection
+  const unsigned long  STATE_ALERT_LOW          = 0x04000000;  // This information is of low priority
+  const unsigned long  STATE_ALERT_MEDIUM       = 0x08000000;  // This information is of medium priority
+  const unsigned long  STATE_ALERT_HIGH         = 0x10000000;  // This information is of high priority
+  const unsigned long  STATE_PROTECTED          = 0x20000000;  // Maps to Gnome's *Role* ATK_ROLE_PASSWD_TEXT, nothing for Java?
+  const unsigned long  STATE_HASPOPUP           = 0x40000000;  // New in MSAA 2.0
+
+  // Mapping important states that we don't have to unused alert states on MSAA
+  // as per discussions with AT vendors. On ATK there will be legitimate states for
+  // STATE_REQUIRED AND STATE_INVALID
+  const unsigned long  STATE_REQUIRED           = STATE_ALERT_LOW;
+  const unsigned long  STATE_IMPORTANT          = STATE_ALERT_MEDIUM; // Not currently used
+  const unsigned long  STATE_INVALID            = STATE_ALERT_HIGH;
+  const unsigned long  STATE_CHECKABLE          = STATE_MARQUEED;
+
+/**
+ * Extended state flags (for now non-MSAA, for Java and Gnome/ATK support)
+ * "Extended state flags" has separate value space from "MSAA State flags".
+ */
+  const unsigned long  EXT_STATE_SUPPORTS_AUTOCOMPLETION = 0x00000001;  // For editable areas that have any kind of autocompletion
+  const unsigned long  EXT_STATE_DEFUNCT                 = 0x00000002;  // Object no longer exists
+  const unsigned long  EXT_STATE_SELECTABLE_TEXT         = 0x00000004;  // For text which is selectable, object must implement nsIAccessibleText
+  const unsigned long  EXT_STATE_EDITABLE                = 0x00000008;  // Implements nsIAccessibleEditableText
+  const unsigned long  EXT_STATE_ACTIVE                  = 0x00000010;  // This window is currently the active window    
+  const unsigned long  EXT_STATE_MODAL                   = 0x00000020;  // Must do something with control before leaving it    
+  const unsigned long  EXT_STATE_MULTI_LINE              = 0x00000040;  // Edit control that can take multiple lines    
+  const unsigned long  EXT_STATE_HORIZONTAL              = 0x00000080;  // Uses horizontal layout
+  const unsigned long  EXT_STATE_OPAQUE                  = 0x00000100;  // Indicates this object paints every pixel within its rectangular region.
+  const unsigned long  EXT_STATE_SINGLE_LINE             = 0x00000200;  // This text object can only contain 1 line of text    
+  const unsigned long  EXT_STATE_TRANSIENT               = 0x00000400;  // 
+  const unsigned long  EXT_STATE_VERTICAL                = 0x00000800;  // Especially used for sliders and scrollbars  
+  const unsigned long  EXT_STATE_STALE                   = 0x00001000;  // Object not dead, but not up-to-date either
+  const unsigned long  EXT_STATE_ENABLED                 = 0x00002000;  // A widget that is not unavailable
+  const unsigned long  EXT_STATE_SENSITIVE               = 0x00004000;  // Same as ENABLED for now
+  const unsigned long  EXT_STATE_EXPANDABLE              = 0x00008000;  // If COLLAPSED or EXPANDED
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleTable.idl
@@ -0,0 +1,304 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Paul Sandoz (paul.sandoz@sun.com)
+ *   Bill Haneman (bill.haneman@sun.com)
+ *   John Gaunt (jgaunt@netscape.com)
+ *   Alexander Surkov <surkov.alexander@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+interface nsIAccessible;
+interface nsIArray;
+
+[scriptable, uuid(cb0bf7b9-117e-40e2-9e46-189c3d43ce4a)]
+interface nsIAccessibleTable : nsISupports
+{
+  /**
+   * Return the caption accessible for the table. For example, html:caption
+   * element of html:table element.
+   */
+  readonly attribute nsIAccessible caption;
+
+  /**
+   * Return summary description for the table. For example, @summary attribute
+   * on html:table element.
+   */
+  readonly attribute AString summary;
+
+  /**
+   * Return columns count in the table.
+   */
+  readonly attribute long columnCount;
+
+  /**
+   * Return rows count in the table.
+   */
+  readonly attribute long rowCount;
+
+  /**
+   * Return the accessible object at the specified row and column in the table.
+   * If both row and column index are valid then the corresponding accessible
+   * object is returned that represents the requested cell regardless of whether
+   * the cell is currently visible (on the screen).
+   *
+   * @param  rowIndex     [in] the row index to retrieve the cell at
+   * @param  columnIndex  [in] the column index to retrieve the cell at
+   */
+  nsIAccessible getCellAt(in long rowIndex, in long columnIndex);
+
+  /**
+   * Translate the given row and column indices into the corresponding cell
+   * index.
+   *
+   * @param  rowIndex    [in] the row index to return cell index at
+   * @param  columnIndex [in] the column index to return cell index at
+   */
+  long getCellIndexAt(in long rowIndex, in long columnIndex);
+
+  /**
+   * Translate the given cell index into the corresponding column index.
+   *
+   * @param  cellIndex  [in] index of the table cell to return column index for
+   */
+  long getColumnIndexAt(in long cellIndex);
+
+  /**
+   * Translate the given cell index into the corresponding row index.
+   *
+   * @param cellIndex  [in] index of the table cell to return row index for
+   */
+  long getRowIndexAt(in long cellIndex);
+
+  /**
+   * Translate the given cell index into the corresponding row and column
+   * indices.
+   *
+   * @param cellIndex    [in] cell index to return row and column indices for
+   * @param rowIndex     [out] row index at the given cell index
+   * @param columnIndex  [out] column index at the given cell index
+   */
+  void getRowAndColumnIndicesAt(in long cellIndex,
+                                out long rowIndex, out long columnIndex);
+
+  /**
+   * Return the number of columns occupied by the accessible cell at
+   * the specified row and column in the table. The result differs from 1 if
+   * the specified cell spans multiple columns.
+   *
+   * @param  row     [in] row index of the cell to return the column extent for
+   * @param  column  [in] column index of the cell to return the column extent
+   *                  for
+   */
+  long getColumnExtentAt(in long row, in long column);
+
+  /**
+   * Return the number of rows occupied by the accessible cell at the specified
+   * row and column in the table. The result differs from 1 if the specified
+   * cell spans multiple rows.
+   *
+   * @param  row     [in] row index of the cell to return the column extent for
+   * @param  column  [in] column index of the cell to return the column extent
+   *                  for
+   */
+  long getRowExtentAt(in long row, in long column);
+
+  /**
+   * Return the description text of the specified column in the table.
+   *
+   * @param  columnIndex  [in] the column index to retrieve description for
+   */
+  AString getColumnDescription(in long columnIndex);
+
+  /**
+   * Return the description text of the specified row in the table.
+   *
+   * @param  rowIndex  [in] the row index to retrieve description for
+   */
+  AString getRowDescription(in long rowIndex);
+
+  /**
+   * Return a boolean value indicating whether the specified column is
+   * selected, i.e. all cells within the column are selected.
+   *
+   * @param  columnIndex  [in] the column index to determine if it's selected
+   */
+  boolean isColumnSelected(in long columnIndex);
+
+  /**
+   * Return a boolean value indicating whether the specified row is selected,
+   * i.e. all cells within the row are selected.
+   *
+   * @param  rowIndex  [in] the row index to determine whether it's selected
+   */
+  boolean isRowSelected(in long rowIndex);
+
+  /**
+   * Return a boolean value indicating whether the specified cell is selected.
+   *
+   * @param  rowIndex     [in] the row index of the cell
+   * @param  columnIndex  [in] the column index of the cell
+   */
+  boolean isCellSelected(in long rowIndex, in long columnIndex);
+
+  /**
+   * Return the total number of selected cells.
+   */
+  readonly attribute unsigned long selectedCellCount;
+
+  /**
+   * Return the total number of selected columns.
+   */
+  readonly attribute unsigned long selectedColumnCount;
+
+  /**
+   * Return the total number of selected rows.
+   */
+  readonly attribute unsigned long selectedRowCount;
+
+  /**
+   * Return an array of selected cells.
+   */
+  readonly attribute nsIArray selectedCells;
+
+  /**
+   * Return an array of cell indices currently selected.
+   *
+   * @param  cellsArraySize  [in] length of array
+   * @param  cellsArray      [in] array of indexes of selected cells
+   */
+  void getSelectedCellIndices(out unsigned long cellsArraySize,
+                              [retval, array, size_is(cellsArraySize)] out long cellsArray);
+
+  /**
+   * Return an array of column indices currently selected.
+   *
+   * @param  columnsArraySize  [in] length of array
+   * @param  columnsArray      [in] array of indices of selected columns
+   */
+  void getSelectedColumnIndices(out unsigned long columnsArraySize,
+                                [retval, array, size_is(columnsArraySize)] out long columnsArray);
+
+  /**
+   * Return an array of row indices currently selected.
+   *
+   * @param  rowsArraySize  [in] Length of array
+   * @param  rowsArray      [in] array of indices of selected rows
+   */
+  void getSelectedRowIndices(out unsigned long rowsArraySize,
+                             [retval, array, size_is(rowsArraySize)] out long rowsArray);
+
+  /**
+   * Select a row and unselects all previously selected rows.
+   *
+   * @param  rowIndex  [in] the row index to select
+   */
+  void selectRow(in long rowIndex);
+
+  /**
+   * Select a column and unselects all previously selected columns.
+   *
+   * @param  columnIndex  [in] the column index to select
+   */
+  void selectColumn(in long columnIndex);
+
+  /**
+   * Unselect the given row, leaving other selected rows selected (if any).
+   *
+   * @param  rowIndex  [in] the row index to select
+  */
+  void unselectRow(in long rowIndex);
+
+  /**
+   * Unselect the given column, leaving other selected columns selected (if any).
+   *
+   * @param  columnIndex  [in] the column index to select
+   */
+  void unselectColumn(in long columnIndex);
+
+  /**
+   * Use heuristics to determine if table is most likely used for layout.
+   */
+  boolean isProbablyForLayout();
+};
+
+
+[scriptable, uuid(654e296d-fae6-452b-987d-746b20b9514b)]
+interface nsIAccessibleTableCell : nsISupports
+{
+  /**
+   * Return host table accessible.
+   */
+  readonly attribute nsIAccessibleTable table;
+
+  /**
+   * Return column index of this cell.
+   */
+  readonly attribute long columnIndex;
+
+  /**
+   * Return row index of this cell.
+   */
+  readonly attribute long rowIndex;
+
+  /**
+   * Return the number of columns occupied by this cell. The result differs
+   * from 1 if the specified cell spans multiple columns.
+   */
+  readonly attribute long columnExtent;
+
+  /**
+   * Return the number of rows occupied by this accessible cell. The result
+   * differs from 1 if the specified cell spans multiple rows.
+   */
+  readonly attribute long rowExtent;
+
+  /**
+   * Return an array of column header cells for this cell.
+   */
+  readonly attribute nsIArray columnHeaderCells;
+
+  /**
+   * Return an array of row header cells for this cell.
+   */
+  readonly attribute nsIArray rowHeaderCells;
+
+  /**
+   * Return a boolean value indicating whether this cell is selected.
+   */
+  boolean isSelected();
+};
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleText.idl
@@ -0,0 +1,243 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Paul Sandoz (paul.sandoz@sun.com)
+ *   Bill Haneman (bill.haneman@sun.com)
+ *   John Gaunt (jgaunt@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+typedef long nsAccessibleTextBoundary;
+
+interface nsIAccessible;
+interface nsIPersistentProperties;
+
+[scriptable, uuid(0f4633b1-550c-4b50-8c04-0eb1005eef2f)]
+interface nsIAccessibleText : nsISupports
+{
+  // In parameters for character offsets:
+  //  -1 will be treated as the equal to the end of the text
+  //  -2 will be treated as the caret position
+  const PRInt32 TEXT_OFFSET_END_OF_TEXT = -1;
+  const PRInt32 TEXT_OFFSET_CARET       = -2;
+
+  const nsAccessibleTextBoundary BOUNDARY_CHAR = 0;
+  const nsAccessibleTextBoundary BOUNDARY_WORD_START = 1;
+  const nsAccessibleTextBoundary BOUNDARY_WORD_END = 2;
+  const nsAccessibleTextBoundary BOUNDARY_SENTENCE_START = 3; // don't use, deprecated
+  const nsAccessibleTextBoundary BOUNDARY_SENTENCE_END = 4;  // don't use, deprecated
+  const nsAccessibleTextBoundary BOUNDARY_LINE_START = 5;
+  const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
+  const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
+
+  /**
+   * The current current caret offset.
+   * If set < 0 then caret will be placed  at the end of the text
+   */
+  attribute long caretOffset;
+
+  readonly attribute long characterCount;
+  readonly attribute long selectionCount;
+
+    /**
+      * String methods may need to return multibyte-encoded strings,
+      * since some locales can't be encoded using 16-bit chars.
+      * So the methods below might return UTF-16 strings, or they could
+      * return "string" values which are UTF-8.
+      */
+  AString getText (in long startOffset, in long endOffset);
+
+  AString getTextAfterOffset (in long offset,
+                              in nsAccessibleTextBoundary boundaryType,
+                              out long startOffset,
+                              out long endOffset);
+
+  AString getTextAtOffset (in long offset,
+                           in nsAccessibleTextBoundary boundaryType,
+                           out long startOffset,
+                           out long endOffset);
+
+  AString getTextBeforeOffset (in long offset,
+                               in nsAccessibleTextBoundary boundaryType,
+                               out long startOffset,
+                               out long endOffset);
+
+    /**
+      * It would be better to return an unsigned long here,
+      * to allow unicode chars > 16 bits
+      */
+  wchar getCharacterAtOffset (in long offset);
+
+  /**
+   * Get the accessible start/end offsets around the given offset,
+   * return the text attributes for this range of text.
+   *
+   * @param  includeDefAttrs   [in] points whether text attributes applied to
+   *                           the entire accessible should be included or not.
+   * @param  offset            [in] text offset
+   * @param  rangeStartOffset  [out] start offset of the range of text
+   * @param  rangeEndOffset    [out] end offset of the range of text
+   */
+  nsIPersistentProperties getTextAttributes(in boolean includeDefAttrs,
+                                            in long offset,
+                                            out long rangeStartOffset,
+                                            out long rangeEndOffset);
+
+  /**
+   * Return the text attributes that apply to the entire accessible.
+   */
+  readonly attribute nsIPersistentProperties defaultTextAttributes;
+
+  /**
+   * Returns the bounding box of the specified position.
+   *
+   * The virtual character after the last character of the represented text,
+   * i.e. the one at position length is a special case. It represents the
+   * current input position and will therefore typically be queried by AT more
+   * often than other positions. Because it does not represent an existing
+   * character its bounding box is defined in relation to preceding characters.
+   * It should be roughly equivalent to the bounding box of some character when
+   * inserted at the end of the text. Its height typically being the maximal
+   * height of all the characters in the text or the height of the preceding
+   * character, its width being at least one pixel so that the bounding box is
+   * not degenerate.
+   *
+   * @param offset - Index of the character for which to return its bounding
+   *                  box. The valid range is 0..length.
+   * @param x - X coordinate of the bounding box of the referenced character.
+   * @param y - Y coordinate of the bounding box of the referenced character.
+   * @param width - Width of the bounding box of the referenced character.
+   * @param height - Height of the bounding box of the referenced character.
+   * @param coordType - Specifies if the coordinates are relative to the screen
+   *                    or to the parent window (see constants declared in
+   *                    nsIAccessibleCoordinateType).
+  */
+  void getCharacterExtents (in long offset,
+                            out long x,
+                            out long y,
+                            out long width,
+                            out long height,
+                            in unsigned long coordType);
+
+  void getRangeExtents (in long startOffset,
+                        in long endOffset,
+                        out long x,
+                        out long y,
+                        out long width,
+                        out long height,
+                        in unsigned long coordType);
+
+  /**
+   * Get the text offset at the given point, or return -1
+   * if no character exists at that point
+   *
+   * @param x - The position's x value for which to look up the index of the
+   *            character that is rendered on to the display at that point.
+   * @param y - The position's y value for which to look up the index of the
+   *            character that is rendered on to the display at that point.
+   * @param coordType - Screen coordinates or window coordinates (see constants
+   *                    declared in nsIAccessibleCoordinateType).
+   * @return offset - Index of the character under the given point or -1 if
+   *                  the point is invalid or there is no character under
+   *                  the point.
+   */
+  long getOffsetAtPoint (in long x, in long y,
+                         in unsigned long coordType);
+
+  void getSelectionBounds (in long selectionNum,
+                           out long startOffset,
+                           out long endOffset);
+
+  /**
+   * Set the bounds for the given selection range
+   */
+  void setSelectionBounds (in long selectionNum,
+                           in long startOffset,
+                           in long endOffset);
+
+  void addSelection (in long startOffset, in long endOffset);
+
+  void removeSelection (in long selectionNum);
+
+
+  /**
+   * Makes a specific part of string visible on screen.
+   *
+   * @param startIndex  0-based character offset
+   * @param endIndex    0-based character offset - the offset of the
+   *                    character just past the last character of the
+   *                    string
+   * @param scrollType  defines how to scroll (see nsIAccessibleScrollType for
+   *                    available constants)
+   */
+  void scrollSubstringTo(in long startIndex, in long endIndex,
+                         in unsigned long scrollType);
+
+  /**
+   * Moves the top left of a substring to a specified location.
+   *
+   * @param startIndex      0-based character offset
+   * @param endIndex        0-based character offset - the offset of the
+   *                        character just past the last character of
+   *                        the string
+   * @param coordinateType  specifies the coordinates origin (for available
+   *                        constants refer to nsIAccessibleCoordinateType)
+   * @param x               defines the x coordinate
+   * @param y               defines the y coordinate
+   */
+  void scrollSubstringToPoint(in long startIndex, in long endIndex,
+                              in unsigned long coordinateType,
+                              in long x, in long y);
+};
+
+/*
+ Assumptions:
+
+ Using wstring (UCS2) instead of string encoded in UTF-8.
+ Multibyte encodings (or at least potentially multi-byte
+ encodings) would be preferred for the reasons cited above.
+
+ The following methods will throw an exception on failure
+ (since not every text component will allow every operation):
+ setSelectionBounds, addSelection, removeSelection, setCaretOffset.
+
+ we assume that all text components support the idea of
+ a caret offset, whether visible or "virtual".  If this
+ isn't the case, caretOffset can be made readonly and
+ a setCaretOffset method provided which throws an exception
+ on failure (as with *selection methods above).
+*/
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleTypes.idl
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+/**
+ * These constants control the scrolling of an object or substring into a
+ * window. Note, keep them synchronized with IA2ScrollType.
+ */
+[scriptable, uuid(05cd38b1-94b3-4cdf-8371-3935a9611405)]
+interface nsIAccessibleScrollType : nsISupports
+{
+  /**
+   * Scroll the top left of the object or substring to the top left of the
+   * window (or as close as possible).
+   */
+  const unsigned long SCROLL_TYPE_TOP_LEFT =0x00;
+
+  /**
+   * Scroll the bottom right of the object or substring to the bottom right of
+   * the window (or as close as possible).
+   */
+  const unsigned long SCROLL_TYPE_BOTTOM_RIGHT = 0x01;
+
+  /**
+   * Scroll the top edge of the object or substring to the top edge of the
+   * window (or as close as possible).
+   */
+  const unsigned long SCROLL_TYPE_TOP_EDGE = 0x02;
+
+  /**
+   * Scroll the bottom edge of the object or substring to the bottom edge of
+   * the window (or as close as possible).
+   */
+  const unsigned long SCROLL_TYPE_BOTTOM_EDGE = 0x03;
+
+  /**
+   * Scroll the left edge of the object or substring to the left edge of the
+   * window (or as close as possible).
+   */
+  const unsigned long SCROLL_TYPE_LEFT_EDGE =0x04;
+
+  /**
+   * Scroll the right edge of the object or substring to the right edge of the
+   * window (or as close as possible).
+   */
+  const unsigned long SCROLL_TYPE_RIGHT_EDGE = 0x05;
+
+  /**
+   * Scroll an object the minimum amount necessary in order for the entire
+   * frame to be visible (if possible).
+   */
+  const unsigned long SCROLL_TYPE_ANYWHERE = 0x06;
+};
+
+
+/**
+ * These constants define which coordinate system a point is located in.
+ */
+[scriptable, uuid(c9fbdf10-619e-436f-bf4b-8566686f1577)]
+interface nsIAccessibleCoordinateType : nsISupports
+{
+  /**
+   * The coordinates are relative to the screen.
+   */
+  const unsigned long COORDTYPE_SCREEN_RELATIVE = 0x00;
+
+  /**
+   * The coordinates are relative to the window.
+   */
+  const unsigned long COORDTYPE_WINDOW_RELATIVE = 0x01;
+
+  /**
+   * The coordinates are relative to the upper left corner of the bounding box
+   * of the immediate parent.
+   */
+  const unsigned long COORDTYPE_PARENT_RELATIVE = 0x02;
+};
+
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIAccessibleValue.idl
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   John Gaunt (jgaunt@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(42a1e1dc-58cf-419d-bff0-ed3314c70016)]
+interface nsIAccessibleValue : nsISupports
+{
+  readonly attribute double maximumValue;
+  readonly attribute double minimumValue;
+  attribute double currentValue;
+  readonly attribute double minimumIncrement;
+};
+
+/*
+ Assumptions:
+
+ The attribute currentValue will throw an exception
+ if it cannot be set i.e. if the value is not a
+ member of the interval.
+ This may not be the 'desired' behaviour given gObject
+ equivalent. Thus it could be changed to be:
+
+ readonly attribute double currentValue;
+ boolean setCurrentValue (double long value);
+
+ GValue can represent many basic types.
+ Since this interface is designed to represent
+ an interval and a member of double should
+ cover the cases of char int and float.
+
+*/
new file mode 100644
--- /dev/null
+++ b/accessible/public/nsIXBLAccessible.idl
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsISupports.idl"
+
+/**
+ * XBL controls can implement this interface to provide own implementation of
+ * accessible properties.
+ */
+[scriptable, uuid(3716eb86-166b-445b-a94a-9b522fee96e6)]
+interface nsIXBLAccessible : nsISupports
+{
+  /**
+   * Return accessible name.
+   */
+  readonly attribute DOMString accessibleName;
+};
new file mode 100644
--- /dev/null
+++ b/accessible/src/Makefile.in
@@ -0,0 +1,81 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   John Gaunt (jgaunt@netscape.com)
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
+PLATFORM_DIR = atk
+else
+ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
+PLATFORM_DIR = msaa
+else
+ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
+PLATFORM_DIR += mac
+else
+PLATFORM_DIR += other
+endif
+endif
+endif
+
+DIRS += $(PLATFORM_DIR)
+
+DIRS += \
+  base \
+  html \
+  xpcom \
+  $(null)
+
+ifdef MOZ_XUL
+DIRS +=   xul
+endif
+
+ifndef DISABLE_XFORMS_HOOKS
+DIRS +=   xforms
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+GARBAGE += $(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX)  $(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX).fake
+
+libs::
+	$(INSTALL) $(PLATFORM_DIR)/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) $(wildcard $(PLATFORM_DIR)/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX).fake) .
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/Makefile.in
@@ -0,0 +1,101 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code
+#
+# The Initial Developer of the Original Code is
+# Aaron Leventhal
+# Portions created by the Initial Developer are Copyright (C) 2003
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = accessibility
+LIBRARY_NAME = accessibility_toolkit_s
+LIBXUL_LIBRARY = 1
+
+
+CPPSRCS = \
+  nsAccessNodeWrap.cpp \
+  nsAccessibleWrap.cpp \
+  nsDocAccessibleWrap.cpp \
+  nsRootAccessibleWrap.cpp \
+  nsApplicationAccessibleWrap.cpp \
+  nsMaiInterfaceComponent.cpp \
+  nsMaiInterfaceAction.cpp \
+  nsMaiInterfaceText.cpp \
+  nsMaiInterfaceEditableText.cpp \
+  nsMaiInterfaceSelection.cpp \
+  nsMaiInterfaceValue.cpp \
+  nsMaiHyperlink.cpp \
+  nsMaiInterfaceHypertext.cpp \
+  nsMaiInterfaceHyperlinkImpl.cpp \
+  nsMaiInterfaceTable.cpp \
+  nsMaiInterfaceDocument.cpp \
+  nsMaiInterfaceImage.cpp \
+  $(NULL)
+
+EXPORTS = \
+  nsAccessNodeWrap.h \
+  nsARIAGridAccessibleWrap.h \
+  nsAccessibleWrap.h \
+  nsDocAccessibleWrap.h \
+  nsRootAccessibleWrap.h \
+  nsTextAccessibleWrap.h \
+  nsXULMenuAccessibleWrap.h \
+  nsXULListboxAccessibleWrap.h \
+  nsXULTreeGridAccessibleWrap.h \
+  nsHyperTextAccessibleWrap.h \
+  nsHTMLImageAccessibleWrap.h \
+  nsHTMLTableAccessibleWrap.h \
+  nsAccessibleRelationWrap.h \
+  $(NULL)
+
+# we want to force the creation of a static lib.
+FORCE_STATIC_LIB = 1
+
+EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
+
+include $(topsrcdir)/config/rules.mk
+
+CFLAGS		+= $(MOZ_GTK2_CFLAGS)
+CXXFLAGS	+= $(MOZ_GTK2_CFLAGS)
+
+LOCAL_INCLUDES += \
+  -I$(srcdir) \
+  -I$(srcdir)/../base \
+  -I$(srcdir)/../html \
+  -I$(srcdir)/../xul \
+  -I$(topsrcdir)/other-licenses/atk-1.0 \
+  $(NULL)
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsARIAGridAccessibleWrap.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:expandtab:shiftwidth=2:tabstop=2:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
+#define _NSARIAGRIDACCESSIBLEWRAP_H
+
+#include "nsARIAGridAccessible.h"
+
+typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
+typedef class nsARIAGridCellAccessible nsARIAGridCellAccessibleWrap;
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsAccessNodeWrap.cpp
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Original Author: Aaron Leventhal (aaronl@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsAccessNodeWrap.h"
+#include "nsApplicationAccessibleWrap.h"
+
+/* For documentation of the accessibility architecture, 
+ * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
+ */
+
+
+////////////////////////////////////////////////////////////////////////////////
+// nsAccessNodeWrap
+////////////////////////////////////////////////////////////////////////////////
+
+//-----------------------------------------------------
+// construction 
+//-----------------------------------------------------
+
+nsAccessNodeWrap::
+    nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) :
+    nsAccessNode(aContent, aShell)
+{
+}
+
+//-----------------------------------------------------
+// destruction
+//-----------------------------------------------------
+nsAccessNodeWrap::~nsAccessNodeWrap()
+{
+}
+
+void nsAccessNodeWrap::InitAccessibility()
+{
+  nsAccessNode::InitXPAccessibility();
+}
+
+void nsAccessNodeWrap::ShutdownAccessibility()
+{
+  nsAccessNode::ShutdownXPAccessibility();
+}
+
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsAccessNodeWrap.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2003
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Original Author: Aaron Leventhal (aaronl@netscape.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* For documentation of the accessibility architecture, 
+ * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
+ */
+
+#ifndef _nsAccessNodeWrap_H_
+#define _nsAccessNodeWrap_H_
+
+#include "nsAccessNode.h"
+
+class nsAccessNodeWrap :  public nsAccessNode
+{
+public: // construction, destruction
+    nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell);
+    virtual ~nsAccessNodeWrap();
+
+    static void InitAccessibility();
+    static void ShutdownAccessibility();
+};
+
+#endif
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsAccessibleRelationWrap.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:expandtab:shiftwidth=2:tabstop=2:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _NS_ACCESSIBLE_RELATION_WRAP_H
+#define _NS_ACCESSIBLE_RELATION_WRAP_H
+
+#include "nsAccessibleRelation.h"
+
+typedef class nsAccessibleRelation nsAccessibleRelationWrap;
+
+#endif
+
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -0,0 +1,1393 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Sun Microsystems, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Bolian Yin (bolian.yin@sun.com)
+ *   John Sun (john.sun@sun.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsAccessibleWrap.h"
+
+#include "nsAccUtils.h"
+#include "nsApplicationAccessibleWrap.h"
+#include "nsRootAccessible.h"
+#include "nsDocAccessibleWrap.h"
+#include "nsIAccessibleValue.h"
+#include "nsString.h"
+#include "nsAutoPtr.h"
+#include "prprf.h"
+#include "nsRoleMap.h"
+#include "nsRelUtils.h"
+#include "nsStateMap.h"
+
+#include "nsMaiInterfaceComponent.h"
+#include "nsMaiInterfaceAction.h"
+#include "nsMaiInterfaceText.h"
+#include "nsMaiInterfaceEditableText.h"
+#include "nsMaiInterfaceSelection.h"
+#include "nsMaiInterfaceValue.h"
+#include "nsMaiInterfaceHypertext.h"
+#include "nsMaiInterfaceHyperlinkImpl.h"
+#include "nsMaiInterfaceTable.h"
+#include "nsXPCOMStrings.h"
+#include "nsComponentManagerUtils.h"
+#include "nsMaiInterfaceDocument.h"
+#include "nsMaiInterfaceImage.h"
+
+//defined in nsApplicationAccessibleWrap.cpp
+extern "C" GType g_atk_hyperlink_impl_type;
+
+/* MaiAtkObject */
+
+enum {
+  ACTIVATE,
+  CREATE,
+  DEACTIVATE,
+  DESTROY,
+  MAXIMIZE,
+  MINIMIZE,
+  RESIZE,
+  RESTORE,
+  LAST_SIGNAL
+};
+
+enum MaiInterfaceType {
+    MAI_INTERFACE_COMPONENT, /* 0 */
+    MAI_INTERFACE_ACTION,
+    MAI_INTERFACE_VALUE,
+    MAI_INTERFACE_EDITABLE_TEXT,
+    MAI_INTERFACE_HYPERTEXT,
+    MAI_INTERFACE_HYPERLINK_IMPL,
+    MAI_INTERFACE_SELECTION,
+    MAI_INTERFACE_TABLE,
+    MAI_INTERFACE_TEXT,
+    MAI_INTERFACE_DOCUMENT, 
+    MAI_INTERFACE_IMAGE /* 10 */
+};
+
+static GType GetAtkTypeForMai(MaiInterfaceType type)
+{
+  switch (type) {
+    case MAI_INTERFACE_COMPONENT:
+      return ATK_TYPE_COMPONENT;
+    case MAI_INTERFACE_ACTION:
+      return ATK_TYPE_ACTION;
+    case MAI_INTERFACE_VALUE:
+      return ATK_TYPE_VALUE;
+    case MAI_INTERFACE_EDITABLE_TEXT:
+      return ATK_TYPE_EDITABLE_TEXT;
+    case MAI_INTERFACE_HYPERTEXT:
+      return ATK_TYPE_HYPERTEXT;
+    case MAI_INTERFACE_HYPERLINK_IMPL:
+       return g_atk_hyperlink_impl_type;
+    case MAI_INTERFACE_SELECTION:
+      return ATK_TYPE_SELECTION;
+    case MAI_INTERFACE_TABLE:
+      return ATK_TYPE_TABLE;
+    case MAI_INTERFACE_TEXT:
+      return ATK_TYPE_TEXT;
+    case MAI_INTERFACE_DOCUMENT:
+      return ATK_TYPE_DOCUMENT;
+    case MAI_INTERFACE_IMAGE:
+      return ATK_TYPE_IMAGE;
+  }
+  return G_TYPE_INVALID;
+}
+
+static const char* kNonUserInputEvent = ":system";
+    
+static const GInterfaceInfo atk_if_infos[] = {
+    {(GInterfaceInitFunc)componentInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL}, 
+    {(GInterfaceInitFunc)actionInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)valueInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)editableTextInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)hypertextInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)hyperlinkImplInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)selectionInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)tableInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)textInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)documentInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL},
+    {(GInterfaceInitFunc)imageInterfaceInitCB,
+     (GInterfaceFinalizeFunc) NULL, NULL}
+};
+
+/**
+ * This MaiAtkObject is a thin wrapper, in the MAI namespace, for AtkObject
+ */
+struct MaiAtkObject
+{
+    AtkObject parent;
+    /*
+     * The nsAccessibleWrap whose properties and features are exported
+     * via this object instance.
+     */
+    nsAccessibleWrap *accWrap;
+};
+
+struct MaiAtkObjectClass
+{
+    AtkObjectClass parent_class;
+};
+
+static guint mai_atk_object_signals [LAST_SIGNAL] = { 0, };
+
+#ifdef MAI_LOGGING
+PRInt32 sMaiAtkObjCreated = 0;
+PRInt32 sMaiAtkObjDeleted = 0;
+#endif
+
+G_BEGIN_DECLS
+/* callbacks for MaiAtkObject */
+static void classInitCB(AtkObjectClass *aClass);
+static void initializeCB(AtkObject *aAtkObj, gpointer aData);
+static void finalizeCB(GObject *aObj);
+
+/* callbacks for AtkObject virtual functions */
+static const gchar*        getNameCB (AtkObject *aAtkObj);
+/* getDescriptionCB is also used by image interface */
+       const gchar*        getDescriptionCB (AtkObject *aAtkObj);
+static AtkRole             getRoleCB(AtkObject *aAtkObj);
+static AtkAttributeSet*    getAttributesCB(AtkObject *aAtkObj);
+static AtkObject*          getParentCB(AtkObject *aAtkObj);
+static gint                getChildCountCB(AtkObject *aAtkObj);
+static AtkObject*          refChildCB(AtkObject *aAtkObj, gint aChildIndex);
+static gint                getIndexInParentCB(AtkObject *aAtkObj);
+static AtkStateSet*        refStateSetCB(AtkObject *aAtkObj);
+static AtkRelationSet*     refRelationSetCB(AtkObject *aAtkObj);
+
+/* the missing atkobject virtual functions */
+/*
+  static AtkLayer            getLayerCB(AtkObject *aAtkObj);
+  static gint                getMdiZorderCB(AtkObject *aAtkObj);
+  static void                SetNameCB(AtkObject *aAtkObj,
+  const gchar *name);
+  static void                SetDescriptionCB(AtkObject *aAtkObj,
+  const gchar *description);
+  static void                SetParentCB(AtkObject *aAtkObj,
+  AtkObject *parent);
+  static void                SetRoleCB(AtkObject *aAtkObj,
+  AtkRole role);
+  static guint               ConnectPropertyChangeHandlerCB(
+  AtkObject  *aObj,
+  AtkPropertyChangeHandler *handler);
+  static void                RemovePropertyChangeHandlerCB(
+  AtkObject *aAtkObj,
+  guint handler_id);
+  static void                InitializeCB(AtkObject *aAtkObj,
+  gpointer data);
+  static void                ChildrenChangedCB(AtkObject *aAtkObj,
+  guint change_index,
+  gpointer changed_child);
+  static void                FocusEventCB(AtkObject *aAtkObj,
+  gboolean focus_in);
+  static void                PropertyChangeCB(AtkObject *aAtkObj,
+  AtkPropertyValues *values);
+  static void                StateChangeCB(AtkObject *aAtkObj,
+  const gchar *name,
+  gboolean state_set);
+  static void                VisibleDataChangedCB(AtkObject *aAtkObj);
+*/
+G_END_DECLS
+
+static GType GetMaiAtkType(PRUint16 interfacesBits);
+static const char * GetUniqueMaiAtkTypeName(PRUint16 interfacesBits);
+
+static gpointer parent_class = NULL;
+
+static GQuark quark_mai_hyperlink = 0;
+
+GType
+mai_atk_object_get_type(void)
+{
+    static GType type = 0;
+
+    if (!type) {
+        static const GTypeInfo tinfo = {
+            sizeof(MaiAtkObjectClass),
+            (GBaseInitFunc)NULL,
+            (GBaseFinalizeFunc)NULL,
+            (GClassInitFunc)classInitCB,
+            (GClassFinalizeFunc)NULL,
+            NULL, /* class data */
+            sizeof(MaiAtkObject), /* instance size */
+            0, /* nb preallocs */
+            (GInstanceInitFunc)NULL,
+            NULL /* value table */
+        };
+
+        type = g_type_register_static(ATK_TYPE_OBJECT,
+                                      "MaiAtkObject", &tinfo, GTypeFlags(0));
+        quark_mai_hyperlink = g_quark_from_static_string("MaiHyperlink");
+    }
+    return type;
+}
+
+#ifdef MAI_LOGGING
+PRInt32 nsAccessibleWrap::mAccWrapCreated = 0;
+PRInt32 nsAccessibleWrap::mAccWrapDeleted = 0;
+#endif
+
+nsAccessibleWrap::
+    nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
+    nsAccessible(aContent, aShell), mAtkObject(nsnull)
+{
+#ifdef MAI_LOGGING
+    ++mAccWrapCreated;
+#endif
+    MAI_LOG_DEBUG(("==nsAccessibleWrap creating: this=%p,total=%d left=%d\n",
+                   (void*)this, mAccWrapCreated,
+                  (mAccWrapCreated-mAccWrapDeleted)));
+}
+
+nsAccessibleWrap::~nsAccessibleWrap()
+{
+    NS_ASSERTION(!mAtkObject, "ShutdownAtkObject() is not called");
+
+#ifdef MAI_LOGGING
+    ++mAccWrapDeleted;
+#endif
+    MAI_LOG_DEBUG(("==nsAccessibleWrap deleting: this=%p,total=%d left=%d\n",
+                   (void*)this, mAccWrapDeleted,
+                   (mAccWrapCreated-mAccWrapDeleted)));
+}
+
+void nsAccessibleWrap::ShutdownAtkObject()
+{
+    if (mAtkObject) {
+        if (IS_MAI_OBJECT(mAtkObject)) {
+            MAI_ATK_OBJECT(mAtkObject)->accWrap = nsnull;
+        }
+        SetMaiHyperlink(nsnull);
+        g_object_unref(mAtkObject);
+        mAtkObject = nsnull;
+    }
+}
+
+void
+nsAccessibleWrap::Shutdown()
+{
+    ShutdownAtkObject();
+    nsAccessible::Shutdown();
+}
+
+MaiHyperlink* nsAccessibleWrap::GetMaiHyperlink(PRBool aCreate /* = PR_TRUE */)
+{
+    // make sure mAtkObject is created
+    GetAtkObject();
+
+    NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
+    NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
+    MaiHyperlink* maiHyperlink = nsnull;
+    if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
+        maiHyperlink = (MaiHyperlink*)g_object_get_qdata(G_OBJECT(mAtkObject),
+                                                         quark_mai_hyperlink);
+        if (!maiHyperlink && aCreate) {
+            maiHyperlink = new MaiHyperlink(this);
+            SetMaiHyperlink(maiHyperlink);
+        }
+    }
+    return maiHyperlink;
+}
+
+void nsAccessibleWrap::SetMaiHyperlink(MaiHyperlink* aMaiHyperlink)
+{
+    NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
+    NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
+    if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
+        MaiHyperlink* maiHyperlink = GetMaiHyperlink(PR_FALSE);
+        if (!maiHyperlink && !aMaiHyperlink) {
+            return; // Never set and we're shutting down
+        }
+        if (maiHyperlink) {
+            delete maiHyperlink;
+        }
+        g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
+                           aMaiHyperlink);
+    }
+}
+
+NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
+{
+    *aOutAccessible = nsnull;
+
+    if (!mAtkObject) {
+        if (!mWeakShell || !nsAccUtils::IsEmbeddedObject(this)) {
+            // We don't create ATK objects for node which has been shutdown, or
+            // nsIAccessible plain text leaves
+            return NS_ERROR_FAILURE;
+        }
+
+        GType type = GetMaiAtkType(CreateMaiInterfaces());
+        NS_ENSURE_TRUE(type, NS_ERROR_FAILURE);
+        mAtkObject =
+            reinterpret_cast<AtkObject *>
+                            (g_object_new(type, NULL));
+        NS_ENSURE_TRUE(mAtkObject, NS_ERROR_OUT_OF_MEMORY);
+
+        atk_object_initialize(mAtkObject, this);
+        mAtkObject->role = ATK_ROLE_INVALID;
+        mAtkObject->layer = ATK_LAYER_INVALID;
+    }
+
+    *aOutAccessible = mAtkObject;
+    return NS_OK;
+}
+
+AtkObject *
+nsAccessibleWrap::GetAtkObject(void)
+{
+    void *atkObj = nsnull;
+    GetNativeInterface(&atkObj);
+    return static_cast<AtkObject *>(atkObj);
+}
+
+// Get AtkObject from nsIAccessible interface
+/* static */
+AtkObject *
+nsAccessibleWrap::GetAtkObject(nsIAccessible * acc)
+{
+    void *atkObjPtr = nsnull;
+    acc->GetNativeInterface(&atkObjPtr);
+    return atkObjPtr ? ATK_OBJECT(atkObjPtr) : nsnull;    
+}
+
+/* private */
+PRUint16
+nsAccessibleWrap::CreateMaiInterfaces(void)
+{
+    PRUint16 interfacesBits = 0;
+    
+    // Add Interfaces for each nsIAccessible.ext interfaces
+
+    // the Component interface are supported by all nsIAccessible
+    interfacesBits |= 1 << MAI_INTERFACE_COMPONENT;
+
+    // Add Action interface if the action count is more than zero.
+    PRUint8 actionCount = 0;
+    nsresult rv = GetNumActions(&actionCount);
+    if (NS_SUCCEEDED(rv) && actionCount > 0) {
+       interfacesBits |= 1 << MAI_INTERFACE_ACTION; 
+    }
+
+    //nsIAccessibleText
+    nsCOMPtr<nsIAccessibleText> accessInterfaceText;
+    QueryInterface(NS_GET_IID(nsIAccessibleText),
+                   getter_AddRefs(accessInterfaceText));
+    if (accessInterfaceText) {
+        interfacesBits |= 1 << MAI_INTERFACE_TEXT;
+    }
+
+    //nsIAccessibleEditableText
+    nsCOMPtr<nsIAccessibleEditableText> accessInterfaceEditableText;
+    QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
+                   getter_AddRefs(accessInterfaceEditableText));
+    if (accessInterfaceEditableText) {
+        interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;
+    }
+
+    //nsIAccessibleValue
+    nsCOMPtr<nsIAccessibleValue> accessInterfaceValue;
+    QueryInterface(NS_GET_IID(nsIAccessibleValue),
+                   getter_AddRefs(accessInterfaceValue));
+    if (accessInterfaceValue) {
+       interfacesBits |= 1 << MAI_INTERFACE_VALUE; 
+    }
+
+    //nsIAccessibleDocument
+    nsCOMPtr<nsIAccessibleDocument> accessInterfaceDocument;
+    QueryInterface(NS_GET_IID(nsIAccessibleDocument),
+                              getter_AddRefs(accessInterfaceDocument));
+    if (accessInterfaceDocument) {
+        interfacesBits |= 1 << MAI_INTERFACE_DOCUMENT;
+    }
+
+    //nsIAccessibleImage
+    nsCOMPtr<nsIAccessibleImage> accessInterfaceImage;
+    QueryInterface(NS_GET_IID(nsIAccessibleImage),
+                              getter_AddRefs(accessInterfaceImage));
+    if (accessInterfaceImage) {
+        interfacesBits |= 1 << MAI_INTERFACE_IMAGE;
+    }
+
+    // HyperLinkAccessible
+    if (IsHyperLink()) {
+       interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
+    }
+
+    if (!nsAccUtils::MustPrune(this)) {  // These interfaces require children
+      //nsIAccessibleHypertext
+      nsCOMPtr<nsIAccessibleHyperText> accessInterfaceHypertext;
+      QueryInterface(NS_GET_IID(nsIAccessibleHyperText),
+                     getter_AddRefs(accessInterfaceHypertext));
+      if (accessInterfaceHypertext) {
+          interfacesBits |= 1 << MAI_INTERFACE_HYPERTEXT;
+      }
+
+      //nsIAccessibleTable
+      nsCOMPtr<nsIAccessibleTable> accessInterfaceTable;
+      QueryInterface(NS_GET_IID(nsIAccessibleTable),
+                     getter_AddRefs(accessInterfaceTable));
+      if (accessInterfaceTable) {
+          interfacesBits |= 1 << MAI_INTERFACE_TABLE;
+      }
+      
+      //nsIAccessibleSelection
+      if (IsSelect()) {
+          interfacesBits |= 1 << MAI_INTERFACE_SELECTION;
+      }
+    }
+
+    return interfacesBits;
+}
+
+static GType
+GetMaiAtkType(PRUint16 interfacesBits)
+{
+    GType type;
+    static const GTypeInfo tinfo = {
+        sizeof(MaiAtkObjectClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) NULL,
+        (GClassFinalizeFunc) NULL,
+        NULL, /* class data */
+        sizeof(MaiAtkObject), /* instance size */
+        0, /* nb preallocs */
+        (GInstanceInitFunc) NULL,
+        NULL /* value table */
+    };
+
+    /*
+     * The members we use to register GTypes are GetAtkTypeForMai
+     * and atk_if_infos, which are constant values to each MaiInterface
+     * So we can reuse the registered GType when having
+     * the same MaiInterface types.
+     */
+    const char *atkTypeName = GetUniqueMaiAtkTypeName(interfacesBits);
+    type = g_type_from_name(atkTypeName);
+    if (type) {
+        return type;
+    }
+
+    /*
+     * gobject limits the number of types that can directly derive from any
+     * given object type to 4095.
+     */
+    static PRUint16 typeRegCount = 0;
+    if (typeRegCount++ >= 4095) {
+        return G_TYPE_INVALID;
+    }
+    type = g_type_register_static(MAI_TYPE_ATK_OBJECT,
+                                  atkTypeName,
+                                  &tinfo, GTypeFlags(0));
+
+    for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(atk_if_infos); index++) {
+      if (interfacesBits & (1 << index)) {
+        g_type_add_interface_static(type,
+                                    GetAtkTypeForMai((MaiInterfaceType)index),
+                                    &atk_if_infos[index]);
+      }
+    }
+
+    return type;
+}
+
+static const char *
+GetUniqueMaiAtkTypeName(PRUint16 interfacesBits)
+{
+#define MAI_ATK_TYPE_NAME_LEN (30)     /* 10+sizeof(PRUint16)*8/4+1 < 30 */
+
+    static gchar namePrefix[] = "MaiAtkType";   /* size = 10 */
+    static gchar name[MAI_ATK_TYPE_NAME_LEN + 1];
+
+    PR_snprintf(name, MAI_ATK_TYPE_NAME_LEN, "%s%x", namePrefix,
+                interfacesBits);
+    name[MAI_ATK_TYPE_NAME_LEN] = '\0';
+
+    MAI_LOG_DEBUG(("MaiWidget::LastedTypeName=%s\n", name));
+
+    return name;
+}
+
+PRBool nsAccessibleWrap::IsValidObject()
+{
+    // to ensure we are not shut down
+    return !IsDefunct();
+}
+
+/* static functions for ATK callbacks */
+void
+classInitCB(AtkObjectClass *aClass)
+{
+    GObjectClass *gobject_class = G_OBJECT_CLASS(aClass);
+
+    parent_class = g_type_class_peek_parent(aClass);
+
+    aClass->get_name = getNameCB;
+    aClass->get_description = getDescriptionCB;
+    aClass->get_parent = getParentCB;
+    aClass->get_n_children = getChildCountCB;
+    aClass->ref_child = refChildCB;
+    aClass->get_index_in_parent = getIndexInParentCB;
+    aClass->get_role = getRoleCB;
+    aClass->get_attributes = getAttributesCB;
+    aClass->ref_state_set = refStateSetCB;
+    aClass->ref_relation_set = refRelationSetCB;
+
+    aClass->initialize = initializeCB;
+
+    gobject_class->finalize = finalizeCB;
+
+    mai_atk_object_signals [ACTIVATE] =
+    g_signal_new ("activate",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+    mai_atk_object_signals [CREATE] =
+    g_signal_new ("create",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+    mai_atk_object_signals [DEACTIVATE] =
+    g_signal_new ("deactivate",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+    mai_atk_object_signals [DESTROY] =
+    g_signal_new ("destroy",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+    mai_atk_object_signals [MAXIMIZE] =
+    g_signal_new ("maximize",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+    mai_atk_object_signals [MINIMIZE] =
+    g_signal_new ("minimize",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+    mai_atk_object_signals [RESIZE] =
+    g_signal_new ("resize",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+    mai_atk_object_signals [RESTORE] =
+    g_signal_new ("restore",
+                  MAI_TYPE_ATK_OBJECT,
+                  G_SIGNAL_RUN_LAST,
+                  0, /* default signal handler */
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+
+}
+
+void
+initializeCB(AtkObject *aAtkObj, gpointer aData)
+{
+    NS_ASSERTION((IS_MAI_OBJECT(aAtkObj)), "Invalid AtkObject");
+    NS_ASSERTION(aData, "Invalid Data to init AtkObject");
+    if (!aAtkObj || !aData)
+        return;
+
+    /* call parent init function */
+    /* AtkObjectClass has not a "initialize" function now,
+     * maybe it has later
+     */
+
+    if (ATK_OBJECT_CLASS(parent_class)->initialize)
+        ATK_OBJECT_CLASS(parent_class)->initialize(aAtkObj, aData);
+
+    /* initialize object */
+    MAI_ATK_OBJECT(aAtkObj)->accWrap =
+        static_cast<nsAccessibleWrap*>(aData);
+
+#ifdef MAI_LOGGING
+    ++sMaiAtkObjCreated;
+#endif
+    MAI_LOG_DEBUG(("MaiAtkObj Create obj=%p for AccWrap=%p, all=%d, left=%d\n",
+                   (void*)aAtkObj, (void*)aData, sMaiAtkObjCreated,
+                   (sMaiAtkObjCreated-sMaiAtkObjDeleted)));
+}
+
+void
+finalizeCB(GObject *aObj)
+{
+    if (!IS_MAI_OBJECT(aObj))
+        return;
+    NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == nsnull, "AccWrap NOT null");
+
+#ifdef MAI_LOGGING
+    ++sMaiAtkObjDeleted;
+#endif
+    MAI_LOG_DEBUG(("MaiAtkObj Delete obj=%p, all=%d, left=%d\n",
+                   (void*)aObj, sMaiAtkObjCreated,
+                   (sMaiAtkObjCreated-sMaiAtkObjDeleted)));
+
+    // call parent finalize function
+    // finalize of GObjectClass will unref the accessible parent if has
+    if (G_OBJECT_CLASS (parent_class)->finalize)
+        G_OBJECT_CLASS (parent_class)->finalize(aObj);
+}
+
+const gchar *
+getNameCB(AtkObject *aAtkObj)
+{
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap) {
+        return nsnull;
+    }
+
+    /* nsIAccessible is responsible for the non-NULL name */
+    nsAutoString uniName;
+    nsresult rv = accWrap->GetName(uniName);
+    NS_ENSURE_SUCCESS(rv, nsnull);
+
+    NS_ConvertUTF8toUTF16 objName(aAtkObj->name);
+    if (!uniName.Equals(objName)) {
+        atk_object_set_name(aAtkObj,
+                            NS_ConvertUTF16toUTF8(uniName).get());
+    }
+    return aAtkObj->name;
+}
+
+const gchar *
+getDescriptionCB(AtkObject *aAtkObj)
+{
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap) {
+        return nsnull;
+    }
+
+    /* nsIAccessible is responsible for the non-NULL description */
+    nsAutoString uniDesc;
+    nsresult rv = accWrap->GetDescription(uniDesc);
+    NS_ENSURE_SUCCESS(rv, nsnull);
+
+    NS_ConvertUTF8toUTF16 objDesc(aAtkObj->description);
+    if (!uniDesc.Equals(objDesc)) {
+        atk_object_set_description(aAtkObj,
+                                   NS_ConvertUTF16toUTF8(uniDesc).get());
+    }
+    return aAtkObj->description;
+}
+
+AtkRole
+getRoleCB(AtkObject *aAtkObj)
+{
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap) {
+        return ATK_ROLE_INVALID;
+    }
+
+#ifdef DEBUG_A11Y
+    NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
+                 "Does not support nsIAccessibleText when it should");
+#endif
+
+    if (aAtkObj->role == ATK_ROLE_INVALID) {
+        // map to the actual value
+        PRUint32 atkRole = atkRoleMap[accWrap->Role()];
+        NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
+                     kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
+        aAtkObj->role = static_cast<AtkRole>(atkRole);
+    }
+    return aAtkObj->role;
+}
+
+AtkAttributeSet*
+ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes)
+{
+    if (!aAttributes)
+        return nsnull;
+
+    AtkAttributeSet *objAttributeSet = nsnull;
+    nsCOMPtr<nsISimpleEnumerator> propEnum;
+    nsresult rv = aAttributes->Enumerate(getter_AddRefs(propEnum));
+    NS_ENSURE_SUCCESS(rv, nsnull);
+
+    PRBool hasMore;
+    while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
+        nsCOMPtr<nsISupports> sup;
+        rv = propEnum->GetNext(getter_AddRefs(sup));
+        NS_ENSURE_SUCCESS(rv, objAttributeSet);
+
+        nsCOMPtr<nsIPropertyElement> propElem(do_QueryInterface(sup));
+        NS_ENSURE_TRUE(propElem, objAttributeSet);
+
+        nsCAutoString name;
+        rv = propElem->GetKey(name);
+        NS_ENSURE_SUCCESS(rv, objAttributeSet);
+
+        nsAutoString value;
+        rv = propElem->GetValue(value);
+        NS_ENSURE_SUCCESS(rv, objAttributeSet);
+
+        AtkAttribute *objAttr = (AtkAttribute *)g_malloc(sizeof(AtkAttribute));
+        objAttr->name = g_strdup(name.get());
+        objAttr->value = g_strdup(NS_ConvertUTF16toUTF8(value).get());
+        objAttributeSet = g_slist_prepend(objAttributeSet, objAttr);
+    }
+
+    //libspi will free it
+    return objAttributeSet;
+}
+
+AtkAttributeSet *
+GetAttributeSet(nsIAccessible* aAccessible)
+{
+    nsCOMPtr<nsIPersistentProperties> attributes;
+    aAccessible->GetAttributes(getter_AddRefs(attributes));
+
+    if (attributes) {
+        // Deal with attributes that we only need to expose in ATK
+        PRUint32 state;
+        aAccessible->GetState(&state, nsnull);
+        if (state & nsIAccessibleStates::STATE_HASPOPUP) {
+          // There is no ATK state for haspopup, must use object attribute to expose the same info
+          nsAutoString oldValueUnused;
+          attributes->SetStringProperty(NS_LITERAL_CSTRING("haspopup"), NS_LITERAL_STRING("true"),
+                                        oldValueUnused);
+        }
+
+        return ConvertToAtkAttributeSet(attributes);
+    }
+
+    return nsnull;
+}
+
+AtkAttributeSet *
+getAttributesCB(AtkObject *aAtkObj)
+{
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+
+    return accWrap ? GetAttributeSet(accWrap) : nsnull;
+}
+
+AtkObject *
+getParentCB(AtkObject *aAtkObj)
+{
+    if (!aAtkObj->accessible_parent) {
+        nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+        if (!accWrap) {
+            return nsnull;
+        }
+
+        nsAccessible* accParent = accWrap->GetParent();
+        if (!accParent)
+            return nsnull;
+
+        AtkObject *parent = nsAccessibleWrap::GetAtkObject(accParent);
+        if (parent)
+            atk_object_set_parent(aAtkObj, parent);
+    }
+    return aAtkObj->accessible_parent;
+}
+
+gint
+getChildCountCB(AtkObject *aAtkObj)
+{
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
+        return 0;
+    }
+
+    return accWrap->GetEmbeddedChildCount();
+}
+
+AtkObject *
+refChildCB(AtkObject *aAtkObj, gint aChildIndex)
+{
+    // aChildIndex should not be less than zero
+    if (aChildIndex < 0) {
+      return nsnull;
+    }
+
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
+        return nsnull;
+    }
+
+    nsAccessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
+    if (!accChild)
+        return nsnull;
+
+    AtkObject* childAtkObj = nsAccessibleWrap::GetAtkObject(accChild);
+
+    NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
+    if (!childAtkObj)
+        return nsnull;
+    g_object_ref(childAtkObj);
+    
+    //this will addref parent
+    atk_object_set_parent(childAtkObj, aAtkObj);
+    return childAtkObj;
+}
+
+gint
+getIndexInParentCB(AtkObject *aAtkObj)
+{
+    // We don't use nsIAccessible::GetIndexInParent() because
+    // for ATK we don't want to include text leaf nodes as children
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap) {
+        return -1;
+    }
+
+    nsAccessible *parent = accWrap->GetParent();
+    if (!parent) {
+        return -1; // No parent
+    }
+
+    return parent->GetIndexOfEmbeddedChild(accWrap);
+}
+
+static void TranslateStates(PRUint32 aState, const AtkStateMap *aStateMap,
+                            AtkStateSet *aStateSet)
+{
+  NS_ASSERTION(aStateSet, "Can't pass in null state set");
+
+  // Convert every state to an entry in AtkStateMap
+  PRUint32 stateIndex = 0;
+  PRUint32 bitMask = 1;
+  while (aStateMap[stateIndex].stateMapEntryType != kNoSuchState) {
+    if (aStateMap[stateIndex].atkState) {    // There's potentially an ATK state for this
+      PRBool isStateOn = (aState & bitMask) != 0;
+      if (aStateMap[stateIndex].stateMapEntryType == kMapOpposite) {
+        isStateOn = !isStateOn;
+      }
+      if (isStateOn) {
+        atk_state_set_add_state(aStateSet, aStateMap[stateIndex].atkState);
+      }
+    }
+    // Map extended state
+    bitMask <<= 1;
+    ++ stateIndex;
+  }
+}
+
+AtkStateSet *
+refStateSetCB(AtkObject *aAtkObj)
+{
+    AtkStateSet *state_set = nsnull;
+    state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
+
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap) {
+        TranslateStates(nsIAccessibleStates::EXT_STATE_DEFUNCT,
+                        gAtkStateMapExt, state_set);
+        return state_set;
+    }
+
+    // Map states
+    PRUint32 accState = 0, accExtState = 0;
+    nsresult rv = accWrap->GetState(&accState, &accExtState);
+    NS_ENSURE_SUCCESS(rv, state_set);
+
+    TranslateStates(accState, gAtkStateMap, state_set);
+    TranslateStates(accExtState, gAtkStateMapExt, state_set);
+
+    return state_set;
+}
+
+AtkRelationSet *
+refRelationSetCB(AtkObject *aAtkObj)
+{
+    AtkRelationSet *relation_set = nsnull;
+    relation_set = ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj);
+
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
+    if (!accWrap) {
+        return relation_set;
+    }
+
+    AtkRelation* relation;
+    
+    PRUint32 relationType[] = {nsIAccessibleRelation::RELATION_LABELLED_BY,
+                               nsIAccessibleRelation::RELATION_LABEL_FOR,
+                               nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
+                               nsIAccessibleRelation::RELATION_CONTROLLED_BY,
+                               nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
+                               nsIAccessibleRelation::RELATION_EMBEDS,
+                               nsIAccessibleRelation::RELATION_FLOWS_TO,
+                               nsIAccessibleRelation::RELATION_FLOWS_FROM,
+                               nsIAccessibleRelation::RELATION_DESCRIBED_BY,
+                               nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
+                               };
+
+    for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationType); i++) {
+        relation = atk_relation_set_get_relation_by_type(relation_set, static_cast<AtkRelationType>(relationType[i]));
+        if (relation) {
+            atk_relation_set_remove(relation_set, relation);
+        }
+
+        nsCOMPtr<nsIAccessibleRelation> geckoRelation;
+        nsresult rv = accWrap->GetRelationByType(relationType[i],
+                                                 getter_AddRefs(geckoRelation));
+        if (NS_SUCCEEDED(rv) && geckoRelation) {
+            PRUint32 targetsCount = 0;
+            geckoRelation->GetTargetsCount(&targetsCount);
+            if (targetsCount) {
+                AtkObject** accessible_array = new AtkObject*[targetsCount];
+                for (PRUint32 index = 0; index < targetsCount; index++) {
+                    nsCOMPtr<nsIAccessible> geckoTarget;
+                    geckoRelation->GetTarget(index, getter_AddRefs(geckoTarget));
+                    accessible_array[index] =
+                        nsAccessibleWrap::GetAtkObject(geckoTarget);
+                }
+
+                relation = atk_relation_new(accessible_array, targetsCount,
+                                            static_cast<AtkRelationType>(relationType[i]));
+                atk_relation_set_add(relation_set, relation);
+                g_object_unref(relation);
+
+                delete [] accessible_array;
+            }
+        }
+    }
+
+    return relation_set;
+}
+
+// Check if aAtkObj is a valid MaiAtkObject, and return the nsAccessibleWrap
+// for it.
+nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
+{
+    NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nsnull);
+    nsAccessibleWrap *tmpAccWrap = MAI_ATK_OBJECT(aAtkObj)->accWrap;
+
+    // Check if AccessibleWrap was deconstructed
+    if (tmpAccWrap == nsnull) {
+        return nsnull;
+    }
+
+    NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
+
+    nsApplicationAccessible *applicationAcc =
+        nsAccessNode::GetApplicationAccessible();
+    nsAccessibleWrap* tmpAppAccWrap =
+        static_cast<nsAccessibleWrap*>(applicationAcc);
+
+    if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
+        return nsnull;
+
+    return tmpAccWrap;
+}
+
+nsresult
+nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
+{
+    nsresult rv = nsAccessible::HandleAccEvent(aEvent);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    return FirePlatformEvent(aEvent);
+}
+
+nsresult
+nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
+{
+    nsAccessible *accessible = aEvent->GetAccessible();
+    NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
+
+    PRUint32 type = aEvent->GetEventType();
+
+    AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);
+
+    // We don't create ATK objects for nsIAccessible plain text leaves,
+    // just return NS_OK in such case
+    if (!atkObj) {
+        NS_ASSERTION(type == nsIAccessibleEvent::EVENT_SHOW ||
+                     type == nsIAccessibleEvent::EVENT_HIDE,
+                     "Event other than SHOW and HIDE fired for plain text leaves");
+        return NS_OK;
+    }
+
+    nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj);
+    if (!accWrap) {
+        return NS_OK; // Node is shut down
+    }
+
+    switch (type) {
+    case nsIAccessibleEvent::EVENT_STATE_CHANGE:
+        return FireAtkStateChangeEvent(aEvent, atkObj);
+
+    case nsIAccessibleEvent::EVENT_TEXT_REMOVED:
+    case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
+        return FireAtkTextChangedEvent(aEvent, atkObj);
+
+    case nsIAccessibleEvent::EVENT_FOCUS:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
+        nsRefPtr<nsRootAccessible> rootAccWrap = accWrap->GetRootAccessible();
+        if (rootAccWrap && rootAccWrap->mActivated) {
+            atk_focus_tracker_notify(atkObj);
+            // Fire state change event for focus
+            nsRefPtr<AccEvent> stateChangeEvent =
+              new AccStateChangeEvent(accessible,
+                                      nsIAccessibleStates::STATE_FOCUSED,
+                                      PR_FALSE, PR_TRUE);
+            return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
+        }
+      } break;
+
+    case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n"));
+        nsCOMPtr<nsIAccessibleValue> value(do_QueryObject(accessible));
+        if (value) {    // Make sure this is a numeric value
+            // Don't fire for MSAA string value changes (e.g. text editing)
+            // ATK values are always numeric
+            g_object_notify( (GObject*)atkObj, "accessible-value" );
+        }
+      } break;
+
+    case nsIAccessibleEvent::EVENT_SELECTION_CHANGED:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
+        g_signal_emit_by_name(atkObj, "selection_changed");
+        break;
+
+    case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
+        g_signal_emit_by_name(atkObj, "text_selection_changed");
+        break;
+
+    case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
+
+        AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
+        NS_ASSERTION(caretMoveEvent, "Event needs event data");
+        if (!caretMoveEvent)
+            break;
+
+        PRInt32 caretOffset = caretMoveEvent->GetCaretOffset();
+
+        MAI_LOG_DEBUG(("\n\nCaret postion: %d", caretOffset));
+        g_signal_emit_by_name(atkObj,
+                              "text_caret_moved",
+                              // Curent caret position
+                              caretOffset);
+      } break;
+
+    case nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_ATTRIBUTE_CHANGED\n"));
+
+        g_signal_emit_by_name(atkObj,
+                              "text-attributes-changed");
+        break;
+
+    case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
+        g_signal_emit_by_name(atkObj, "model_changed");
+        break;
+
+    case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
+        NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
+
+        PRInt32 rowIndex = tableEvent->GetIndex();
+        PRInt32 numRows = tableEvent->GetCount();
+
+        g_signal_emit_by_name(atkObj,
+                              "row_inserted",
+                              // After which the rows are inserted
+                              rowIndex,
+                              // The number of the inserted
+                              numRows);
+     } break;
+
+   case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
+     {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
+        NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
+
+        PRInt32 rowIndex = tableEvent->GetIndex();
+        PRInt32 numRows = tableEvent->GetCount();
+
+        g_signal_emit_by_name(atkObj,
+                              "row_deleted",
+                              // After which the rows are deleted
+                              rowIndex,
+                              // The number of the deleted
+                              numRows);
+      } break;
+
+    case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
+        g_signal_emit_by_name(atkObj, "row_reordered");
+        break;
+      }
+
+    case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
+        NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
+
+        PRInt32 colIndex = tableEvent->GetIndex();
+        PRInt32 numCols = tableEvent->GetCount();
+
+        g_signal_emit_by_name(atkObj,
+                              "column_inserted",
+                              // After which the columns are inserted
+                              colIndex,
+                              // The number of the inserted
+                              numCols);
+      } break;
+
+    case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
+        AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
+        NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
+
+        PRInt32 colIndex = tableEvent->GetIndex();
+        PRInt32 numCols = tableEvent->GetCount();
+
+        g_signal_emit_by_name(atkObj,
+                              "column_deleted",
+                              // After which the columns are deleted
+                              colIndex,
+                              // The number of the deleted
+                              numCols);
+      } break;
+
+    case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_REORDER\n"));
+        g_signal_emit_by_name(atkObj, "column_reordered");
+        break;
+
+    case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_SECTION_CHANGED\n"));
+        g_signal_emit_by_name(atkObj, "visible_data_changed");
+        break;
+
+    case nsIAccessibleEvent::EVENT_SHOW:
+        return FireAtkShowHideEvent(aEvent, atkObj, PR_TRUE);
+
+    case nsIAccessibleEvent::EVENT_HIDE:
+        return FireAtkShowHideEvent(aEvent, atkObj, PR_FALSE);
+
+        /*
+         * Because dealing with menu is very different between nsIAccessible
+         * and ATK, and the menu activity is important, specially transfer the
+         * following two event.
+         * Need more verification by AT test.
+         */
+    case nsIAccessibleEvent::EVENT_MENU_START:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_START\n"));
+        break;
+
+    case nsIAccessibleEvent::EVENT_MENU_END:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_END\n"));
+        break;
+
+    case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
+        nsRootAccessible *rootAcc =
+          static_cast<nsRootAccessible *>(accessible);
+        rootAcc->mActivated = PR_TRUE;
+        guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
+        g_signal_emit(atkObj, id, 0);
+
+        // Always fire a current focus event after activation.
+        rootAcc->FireCurrentFocusEvent();
+      } break;
+
+    case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
+        nsRootAccessible *rootAcc =
+          static_cast<nsRootAccessible *>(accessible);
+        rootAcc->mActivated = PR_FALSE;
+        guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
+        g_signal_emit(atkObj, id, 0);
+      } break;
+
+    case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_COMPLETE\n"));
+        g_signal_emit_by_name (atkObj, "load_complete");
+      } break;
+
+    case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_RELOAD\n"));
+        g_signal_emit_by_name (atkObj, "reload");
+      } break;
+
+    case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
+      {
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_STOPPED\n"));
+        g_signal_emit_by_name (atkObj, "load_stopped");
+      } break;
+
+    case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_START\n"));
+        atk_focus_tracker_notify(atkObj); // fire extra focus event
+        atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_TRUE);
+        atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_TRUE);
+        break;
+
+    case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
+        MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_END\n"));
+        atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_FALSE);
+        atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_FALSE);
+        break;
+    }
+
+    return NS_OK;
+}
+
+nsresult
+nsAccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
+                                          AtkObject *aObject)
+{
+    MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
+
+    AccStateChangeEvent* event = downcast_accEvent(aEvent);
+    NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
+
+    PRUint32 state = event->GetState();
+    PRBool isExtra = event->IsExtraState();
+    PRBool isEnabled = event->IsStateEnabled();
+
+    PRInt32 stateIndex = AtkStateMap::GetStateIndexFor(state);
+    if (stateIndex >= 0) {
+        const AtkStateMap *atkStateMap = isExtra ? gAtkStateMapExt : gAtkStateMap;
+        NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
+                     "No such state");
+
+        if (atkStateMap[stateIndex].atkState != kNone) {
+            NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoStateChange,
+                         "State changes should not fired for this state");
+
+            if (atkStateMap[stateIndex].stateMapEntryType == kMapOpposite)
+                isEnabled = !isEnabled;
+
+            // Fire state change for first state if there is one to map
+            atk_object_notify_state_change(aObject,
+                                           atkStateMap[stateIndex].atkState,
+                                           isEnabled);
+        }
+    }
+
+    return NS_OK;
+}
+
+nsresult
+nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
+                                          AtkObject *aObject)
+{
+    MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_REMOVED/INSERTED\n"));
+
+    AccTextChangeEvent* event = downcast_accEvent(aEvent);
+    NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
+
+    PRInt32 start = event->GetStartOffset();
+    PRUint32 length = event->GetLength();
+    PRBool isInserted = event->IsTextInserted();
+
+    PRBool isFromUserInput = aEvent->IsFromUserInput();
+
+    char *signal_name = g_strconcat(isInserted ? "text_changed::insert" : "text_changed::delete",
+                                    isFromUserInput ? "" : kNonUserInputEvent, NULL);
+    g_signal_emit_by_name(aObject, signal_name, start, length);
+    g_free (signal_name);
+
+    return NS_OK;
+}
+
+nsresult
+nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
+                                       AtkObject *aObject, PRBool aIsAdded)
+{
+    if (aIsAdded)
+        MAI_LOG_DEBUG(("\n\nReceived: Show event\n"));
+    else
+        MAI_LOG_DEBUG(("\n\nReceived: Hide event\n"));
+
+    PRInt32 indexInParent = getIndexInParentCB(aObject);
+    AtkObject *parentObject = getParentCB(aObject);
+    NS_ENSURE_STATE(parentObject);
+
+    PRBool isFromUserInput = aEvent->IsFromUserInput();
+    char *signal_name = g_strconcat(aIsAdded ? "children_changed::add" :  "children_changed::remove",
+                                    isFromUserInput ? "" : kNonUserInputEvent, NULL);
+    g_signal_emit_by_name(parentObject, signal_name, indexInParent, aObject, NULL);
+    g_free(signal_name);
+
+    return NS_OK;
+}
+
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsAccessibleWrap.h
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Sun Microsystems, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Bolian Yin (bolian.yin@sun.com)
+ *   John Sun (john.sun@sun.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef __NS_ACCESSIBLE_WRAP_H__
+#define __NS_ACCESSIBLE_WRAP_H__
+
+#include "nsCOMPtr.h"
+#include "nsAccessible.h"
+#include "prlog.h"
+
+#ifdef PR_LOGGING
+#define MAI_LOGGING
+#endif /* #ifdef PR_LOGGING */
+
+struct _AtkObject;
+typedef struct _AtkObject AtkObject;
+
+enum AtkProperty {
+  PROP_0,           // gobject convention
+  PROP_NAME,
+  PROP_DESCRIPTION,
+  PROP_PARENT,      // ancestry has changed
+  PROP_ROLE,
+  PROP_LAYER,
+  PROP_MDI_ZORDER,
+  PROP_TABLE_CAPTION,
+  PROP_TABLE_COLUMN_DESCRIPTION,
+  PROP_TABLE_COLUMN_HEADER,
+  PROP_TABLE_ROW_DESCRIPTION,
+  PROP_TABLE_ROW_HEADER,
+  PROP_TABLE_SUMMARY,
+  PROP_LAST         // gobject convention
+};
+
+struct AtkPropertyChange {
+  PRInt32 type;     // property type as listed above
+  void *oldvalue;
+  void *newvalue;
+};
+
+class MaiHyperlink;
+
+/**
+ * nsAccessibleWrap, and its descendents in atk directory provide the
+ * implementation of AtkObject.
+ */
+class nsAccessibleWrap: public nsAccessible
+{
+public:
+    nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
+    virtual ~nsAccessibleWrap();
+    void ShutdownAtkObject();
+
+    // nsAccessNode
+    virtual void Shutdown();
+
+#ifdef MAI_LOGGING
+    virtual void DumpnsAccessibleWrapInfo(int aDepth) {}
+    static PRInt32 mAccWrapCreated;
+    static PRInt32 mAccWrapDeleted;
+#endif
+
+    // return the atk object for this nsAccessibleWrap
+    NS_IMETHOD GetNativeInterface(void **aOutAccessible);
+    virtual nsresult HandleAccEvent(AccEvent* aEvent);
+
+    AtkObject * GetAtkObject(void);
+    static AtkObject * GetAtkObject(nsIAccessible * acc);
+
+    PRBool IsValidObject();
+    
+    // get/set the MaiHyperlink object for this nsAccessibleWrap
+    MaiHyperlink* GetMaiHyperlink(PRBool aCreate = PR_TRUE);
+    void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
+
+    static const char * ReturnString(nsAString &aString) {
+      static nsCString returnedString;
+      returnedString = NS_ConvertUTF16toUTF8(aString);
+      return returnedString.get();
+    }
+
+protected:
+    virtual nsresult FirePlatformEvent(AccEvent* aEvent);
+
+    nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
+    nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
+    nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
+                                  PRBool aIsAdded);
+
+    AtkObject *mAtkObject;
+
+private:
+    PRUint16 CreateMaiInterfaces(void);
+};
+
+#endif /* __NS_ACCESSIBLE_WRAP_H__ */
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsApplicationAccessibleWrap.cpp
@@ -0,0 +1,770 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Sun Microsystems, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Bolian Yin (bolian.yin@sun.com)
+ *   Ginn Chen (ginn.chen@sun.com)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsApplicationAccessibleWrap.h"
+
+#include "nsCOMPtr.h"
+#include "nsMai.h"
+#include "prlink.h"
+#include "prenv.h"
+#include "nsIPrefBranch.h"
+#include "nsIServiceManager.h"
+#include "nsAutoPtr.h"
+#include "nsAccessibilityService.h"
+
+#include <gtk/gtk.h>
+#include <atk/atk.h>
+
+typedef GType (* AtkGetTypeType) (void);
+GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
+static PRBool sATKChecked = PR_FALSE;
+static PRLibrary *sATKLib = nsnull;
+static const char sATKLibName[] = "libatk-1.0.so.0";
+static const char sATKHyperlinkImplGetTypeSymbol[] =
+    "atk_hyperlink_impl_get_type";
+static const char sAccEnv [] = "GNOME_ACCESSIBILITY";
+static const char sSysPrefService [] =
+    "@mozilla.org/system-preference-service;1";
+static const char sAccessibilityKey [] =
+    "config.use_system_prefs.accessibility";
+
+/* gail function pointer */
+static guint (* gail_add_global_event_listener) (GSignalEmissionHook listener,
+                                                 const gchar *event_type);
+static void (* gail_remove_global_event_listener) (guint remove_listener);
+static void (* gail_remove_key_event_listener) (guint remove_listener);
+static AtkObject * (*gail_get_root) (void);
+
+/* maiutil */
+
+static guint mai_util_add_global_event_listener(GSignalEmissionHook listener,
+                                                const gchar *event_type);
+static void mai_util_remove_global_event_listener(guint remove_listener);
+static guint mai_util_add_key_event_listener(AtkKeySnoopFunc listener,
+                                             gpointer data);
+static void mai_util_remove_key_event_listener(guint remove_listener);
+static AtkObject *mai_util_get_root(void);
+static G_CONST_RETURN gchar *mai_util_get_toolkit_name(void);
+static G_CONST_RETURN gchar *mai_util_get_toolkit_version(void);
+
+
+/* Misc */
+
+static void _listener_info_destroy(gpointer data);
+static guint add_listener (GSignalEmissionHook listener,
+                           const gchar *object_type,
+                           const gchar *signal,
+                           const gchar *hook_data,
+                           guint gail_listenerid = 0);
+static AtkKeyEventStruct *atk_key_event_from_gdk_event_key(GdkEventKey *key);
+static gboolean notify_hf(gpointer key, gpointer value, gpointer data);
+static void insert_hf(gpointer key, gpointer value, gpointer data);
+static gint mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event,
+                            gpointer func_data);
+
+static GHashTable *listener_list = NULL;
+static gint listener_idx = 1;
+
+#define MAI_TYPE_UTIL              (mai_util_get_type ())
+#define MAI_UTIL(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                                    MAI_TYPE_UTIL, MaiUtil))
+#define MAI_UTIL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), \
+                                    MAI_TYPE_UTIL, MaiUtilClass))
+#define MAI_IS_UTIL(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                                    MAI_TYPE_UTIL))
+#define MAI_IS_UTIL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                                    MAI_TYPE_UTIL))
+#define MAI_UTIL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                                    MAI_TYPE_UTIL, MaiUtilClass))
+
+static GHashTable *key_listener_list = NULL;
+static guint key_snooper_id = 0;
+
+G_BEGIN_DECLS
+typedef void (*GnomeAccessibilityInit) (void);
+typedef void (*GnomeAccessibilityShutdown) (void);
+G_END_DECLS
+
+struct MaiUtil
+{
+    AtkUtil parent;
+    GList *listener_list;
+};
+
+struct MaiKeyEventInfo
+{
+    AtkKeyEventStruct *key_event;
+    gpointer func_data;
+};
+
+union AtkKeySnoopFuncPointer
+{
+    AtkKeySnoopFunc func_ptr;
+    gpointer data;
+};
+
+struct GnomeAccessibilityModule
+{
+    const char *libName;
+    PRLibrary *lib;
+    const char *initName;
+    GnomeAccessibilityInit init;
+    const char *shutdownName;
+    GnomeAccessibilityShutdown shutdown;
+};
+
+struct MaiUtilClass
+{
+    AtkUtilClass parent_class;
+};
+
+GType mai_util_get_type (void);
+static void mai_util_class_init(MaiUtilClass *klass);
+
+/* supporting */
+PRLogModuleInfo *gMaiLog = NULL;
+
+#define MAI_VERSION MOZILLA_VERSION
+#define MAI_NAME "Gecko"
+
+struct MaiUtilListenerInfo
+{
+    gint key;
+    guint signal_id;
+    gulong hook_id;
+    // For window create/destory/minimize/maximize/restore/activate/deactivate
+    // events, we'll chain gail_util's add/remove_global_event_listener.
+    // So we store the listenerid returned by gail's add_global_event_listener
+    // in this structure to call gail's remove_global_event_listener later.
+    guint gail_listenerid;
+};
+
+static GnomeAccessibilityModule sAtkBridge = {
+#ifdef AIX
+    "libatk-bridge.a(libatk-bridge.so.0)", NULL,
+#else
+    "libatk-bridge.so", NULL,
+#endif
+    "gnome_accessibility_module_init", NULL,
+    "gnome_accessibility_module_shutdown", NULL
+};
+
+static GnomeAccessibilityModule sGail = {
+    "libgail.so", NULL,
+    "gnome_accessibility_module_init", NULL,
+    "gnome_accessibility_module_shutdown", NULL
+};
+
+GType
+mai_util_get_type(void)
+{
+    static GType type = 0;
+
+    if (!type) {
+        static const GTypeInfo tinfo = {
+            sizeof(MaiUtilClass),
+            (GBaseInitFunc) NULL, /* base init */
+            (GBaseFinalizeFunc) NULL, /* base finalize */
+            (GClassInitFunc) mai_util_class_init, /* class init */
+            (GClassFinalizeFunc) NULL, /* class finalize */
+            NULL, /* class data */
+            sizeof(MaiUtil), /* instance size */
+            0, /* nb preallocs */
+            (GInstanceInitFunc) NULL, /* instance init */
+            NULL /* value table */
+        };
+
+        type = g_type_register_static(ATK_TYPE_UTIL,
+                                      "MaiUtil", &tinfo, GTypeFlags(0));
+    }
+    return type;
+}
+
+/* intialize the the atk interface (function pointers) with MAI implementation.
+ * When atk bridge get loaded, these interface can be used.
+ */
+static void
+mai_util_class_init(MaiUtilClass *klass)
+{
+    AtkUtilClass *atk_class;
+    gpointer data;
+
+    data = g_type_class_peek(ATK_TYPE_UTIL);
+    atk_class = ATK_UTIL_CLASS(data);
+
+    // save gail function pointer
+    gail_add_global_event_listener = atk_class->add_global_event_listener;
+    gail_remove_global_event_listener = atk_class->remove_global_event_listener;
+    gail_remove_key_event_listener = atk_class->remove_key_event_listener;
+    gail_get_root = atk_class->get_root;
+
+    atk_class->add_global_event_listener =
+        mai_util_add_global_event_listener;
+    atk_class->remove_global_event_listener =
+        mai_util_remove_global_event_listener;
+    atk_class->add_key_event_listener = mai_util_add_key_event_listener;
+    atk_class->remove_key_event_listener = mai_util_remove_key_event_listener;
+    atk_class->get_root = mai_util_get_root;
+    atk_class->get_toolkit_name = mai_util_get_toolkit_name;
+    atk_class->get_toolkit_version = mai_util_get_toolkit_version;
+
+    listener_list = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
+                                          _listener_info_destroy);
+}
+
+static guint
+mai_util_add_global_event_listener(GSignalEmissionHook listener,
+                                   const gchar *event_type)
+{
+    guint rc = 0;
+    gchar **split_string;
+
+    split_string = g_strsplit (event_type, ":", 3);
+
+    if (split_string) {
+        if (!strcmp ("window", split_string[0])) {
+            guint gail_listenerid = 0;
+            if (gail_add_global_event_listener) {
+                // call gail's function to track gtk native window events
+                gail_listenerid =
+                    gail_add_global_event_listener(listener, event_type);
+            }
+            
+            rc = add_listener (listener, "MaiAtkObject", split_string[1],
+                               event_type, gail_listenerid);
+        }
+        else {
+            rc = add_listener (listener, split_string[1], split_string[2],
+                               event_type);
+        }
+        g_strfreev(split_string);
+    }
+    return rc;
+}
+
+static void
+mai_util_remove_global_event_listener(guint remove_listener)
+{
+    if (remove_listener > 0) {
+        MaiUtilListenerInfo *listener_info;
+        gint tmp_idx = remove_listener;
+
+        listener_info = (MaiUtilListenerInfo *)
+            g_hash_table_lookup(listener_list, &tmp_idx);
+
+        if (listener_info != NULL) {
+            if (gail_remove_global_event_listener &&
+                listener_info->gail_listenerid) {
+              gail_remove_global_event_listener(listener_info->gail_listenerid);
+            }
+            
+            /* Hook id of 0 and signal id of 0 are invalid */
+            if (listener_info->hook_id != 0 && listener_info->signal_id != 0) {
+                /* Remove the emission hook */
+                g_signal_remove_emission_hook(listener_info->signal_id,
+                                              listener_info->hook_id);
+
+                /* Remove the element from the hash */
+                g_hash_table_remove(listener_list, &tmp_idx);
+            }
+            else {
+                g_warning("Invalid listener hook_id %ld or signal_id %d\n",
+                          listener_info->hook_id, listener_info->signal_id);
+            }
+        }
+        else {
+            // atk-bridge is initialized with gail (e.g. yelp)
+            // try gail_remove_global_event_listener
+            if (gail_remove_global_event_listener) {
+                return gail_remove_global_event_listener(remove_listener);
+            }
+
+            g_warning("No listener with the specified listener id %d",
+                      remove_listener);
+        }
+    }
+    else {
+        g_warning("Invalid listener_id %d", remove_listener);
+    }
+}
+
+static AtkKeyEventStruct *
+atk_key_event_from_gdk_event_key (GdkEventKey *key)
+{
+    AtkKeyEventStruct *event = g_new0(AtkKeyEventStruct, 1);
+    switch (key->type) {
+    case GDK_KEY_PRESS:
+        event->type = ATK_KEY_EVENT_PRESS;
+        break;
+    case GDK_KEY_RELEASE:
+        event->type = ATK_KEY_EVENT_RELEASE;
+        break;
+    default:
+        g_assert_not_reached ();
+        return NULL;
+    }
+    event->state = key->state;
+    event->keyval = key->keyval;
+    event->length = key->length;
+    if (key->string && key->string [0] && 
+        (key->state & GDK_CONTROL_MASK ||
+         g_unichar_isgraph (g_utf8_get_char (key->string)))) {
+        event->string = key->string;
+    }
+    else if (key->type == GDK_KEY_PRESS ||
+             key->type == GDK_KEY_RELEASE) {
+        event->string = gdk_keyval_name (key->keyval);	    
+    }
+    event->keycode = key->hardware_keycode;
+    event->timestamp = key->time;
+
+    MAI_LOG_DEBUG(("MaiKey:\tsym %u\n\tmods %x\n\tcode %u\n\ttime %lx\n",
+                   (unsigned int) event->keyval,
+                   (unsigned int) event->state,
+                   (unsigned int) event->keycode,
+                   (unsigned long int) event->timestamp));
+    return event;
+}
+
+static gboolean
+notify_hf(gpointer key, gpointer value, gpointer data)
+{
+    MaiKeyEventInfo *info = (MaiKeyEventInfo *)data;
+    AtkKeySnoopFuncPointer atkKeySnoop;
+    atkKeySnoop.data = value;
+    return (atkKeySnoop.func_ptr)(info->key_event, info->func_data) ? TRUE : FALSE;
+}
+
+static void
+insert_hf(gpointer key, gpointer value, gpointer data)
+{
+    GHashTable *new_table = (GHashTable *) data;
+    g_hash_table_insert (new_table, key, value);
+}
+
+static gint
+mai_key_snooper(GtkWidget *the_widget, GdkEventKey *event, gpointer func_data)
+{
+    /* notify each AtkKeySnoopFunc in turn... */
+
+    MaiKeyEventInfo *info = g_new0(MaiKeyEventInfo, 1);
+    gint consumed = 0;
+    if (key_listener_list) {
+        GHashTable *new_hash = g_hash_table_new(NULL, NULL);
+        g_hash_table_foreach (key_listener_list, insert_hf, new_hash);
+        info->key_event = atk_key_event_from_gdk_event_key (event);
+        info->func_data = func_data;
+        consumed = g_hash_table_foreach_steal (new_hash, notify_hf, info);
+        g_hash_table_destroy (new_hash);
+        g_free(info->key_event);
+    }
+    g_free(info);
+    return (consumed ? 1 : 0);
+}
+
+static guint
+mai_util_add_key_event_listener (AtkKeySnoopFunc listener,
+                                 gpointer data)
+{
+    NS_ENSURE_TRUE(listener, 0);
+
+    static guint key=0;
+
+    if (!key_listener_list) {
+        key_listener_list = g_hash_table_new(NULL, NULL);
+        key_snooper_id = gtk_key_snooper_install(mai_key_snooper, data);
+    }
+    AtkKeySnoopFuncPointer atkKeySnoop;
+    atkKeySnoop.func_ptr = listener;
+    g_hash_table_insert(key_listener_list, GUINT_TO_POINTER (key++),
+                        atkKeySnoop.data);
+    return key;
+}
+
+static void
+mai_util_remove_key_event_listener (guint remove_listener)
+{
+    if (!key_listener_list) {
+        // atk-bridge is initialized with gail (e.g. yelp)
+        // try gail_remove_key_event_listener
+        return gail_remove_key_event_listener(remove_listener);
+    }
+
+    g_hash_table_remove(key_listener_list, GUINT_TO_POINTER (remove_listener));
+    if (g_hash_table_size(key_listener_list) == 0) {
+        gtk_key_snooper_remove(key_snooper_id);
+    }
+}
+
+AtkObject *
+mai_util_get_root(void)
+{
+    if (nsAccessibilityService::IsShutdown()) {
+        // We've shutdown, try to use gail instead
+        // (to avoid assert in spi_atk_tidy_windows())
+        if (gail_get_root)
+            return gail_get_root();
+
+        return nsnull;
+    }
+
+    nsApplicationAccessible *applicationAcc =
+        nsAccessNode::GetApplicationAccessible();
+
+    if (applicationAcc)
+        return applicationAcc->GetAtkObject();
+
+    return nsnull;
+}
+
+G_CONST_RETURN gchar *
+mai_util_get_toolkit_name(void)
+{
+    return MAI_NAME;
+}
+
+G_CONST_RETURN gchar *
+mai_util_get_toolkit_version(void)
+{
+    return MAI_VERSION;
+}
+
+void
+_listener_info_destroy(gpointer data)
+{
+    g_free(data);
+}
+
+guint
+add_listener (GSignalEmissionHook listener,
+              const gchar *object_type,
+              const gchar *signal,
+              const gchar *hook_data,
+              guint gail_listenerid)
+{
+    GType type;
+    guint signal_id;
+    gint rc = 0;
+
+    type = g_type_from_name(object_type);
+    if (type) {
+        signal_id = g_signal_lookup(signal, type);
+        if (signal_id > 0) {
+            MaiUtilListenerInfo *listener_info;
+
+            rc = listener_idx;
+
+            listener_info =  (MaiUtilListenerInfo *)
+                g_malloc(sizeof(MaiUtilListenerInfo));
+            listener_info->key = listener_idx;
+            listener_info->hook_id =
+                g_signal_add_emission_hook(signal_id, 0, listener,
+                                           g_strdup(hook_data),
+                                           (GDestroyNotify)g_free);
+            listener_info->signal_id = signal_id;
+            listener_info->gail_listenerid = gail_listenerid;
+
+            g_hash_table_insert(listener_list, &(listener_info->key),
+                                listener_info);
+            listener_idx++;
+        }
+        else {
+            g_warning("Invalid signal type %s\n", signal);
+        }
+    }
+    else {
+        g_warning("Invalid object type %s\n", object_type);
+    }
+    return rc;
+}
+
+static nsresult LoadGtkModule(GnomeAccessibilityModule& aModule);
+
+// nsApplicationAccessibleWrap
+
+nsApplicationAccessibleWrap::nsApplicationAccessibleWrap():
+    nsApplicationAccessible()
+{
+    MAI_LOG_DEBUG(("======Create AppRootAcc=%p\n", (void*)this));
+}
+
+nsApplicationAccessibleWrap::~nsApplicationAccessibleWrap()
+{
+    MAI_LOG_DEBUG(("======Destory AppRootAcc=%p\n", (void*)this));
+    nsAccessibleWrap::ShutdownAtkObject();
+}
+
+PRBool
+nsApplicationAccessibleWrap::Init()
+{
+    // XXX following code is copied from widget/src/gtk2/nsWindow.cpp
+    // we should put it to somewhere that can be used from both modules
+    // see bug 390761
+
+    // check if accessibility enabled/disabled by environment variable
+    PRBool isGnomeATEnabled = PR_FALSE;
+    const char *envValue = PR_GetEnv(sAccEnv);
+    if (envValue) {
+        isGnomeATEnabled = !!atoi(envValue);
+    } else {
+        //check gconf-2 setting
+        nsresult rv;
+        nsCOMPtr<nsIPrefBranch> sysPrefService =
+            do_GetService(sSysPrefService, &rv);
+        if (NS_SUCCEEDED(rv) && sysPrefService) {
+            sysPrefService->GetBoolPref(sAccessibilityKey, &isGnomeATEnabled);
+        }
+    }
+
+    if (isGnomeATEnabled) {
+        // load and initialize gail library
+        nsresult rv = LoadGtkModule(sGail);
+        if (NS_SUCCEEDED(rv)) {
+            (*sGail.init)();
+        }
+        else {
+            MAI_LOG_DEBUG(("Fail to load lib: %s\n", sGail.libName));
+        }
+
+        MAI_LOG_DEBUG(("Mozilla Atk Implementation initializing\n"));
+        // Initialize the MAI Utility class
+        // it will overwrite gail_util
+        g_type_class_unref(g_type_class_ref(MAI_TYPE_UTIL));
+
+        // Init atk-bridge now
+        PR_SetEnv("NO_AT_BRIDGE=0");
+
+        // load and initialize atk-bridge library
+        rv = LoadGtkModule(sAtkBridge);
+        if (NS_SUCCEEDED(rv)) {
+            // init atk-bridge
+            (*sAtkBridge.init)();
+        }
+        else
+            MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
+    }
+
+    return nsApplicationAccessible::Init();
+}
+
+void
+nsApplicationAccessibleWrap::Unload()
+{
+    if (sAtkBridge.lib) {
+        // Do not shutdown/unload atk-bridge,
+        // an exit function registered will take care of it
+        // if (sAtkBridge.shutdown)
+        //     (*sAtkBridge.shutdown)();
+        // PR_UnloadLibrary(sAtkBridge.lib);
+        sAtkBridge.lib = NULL;
+        sAtkBridge.init = NULL;
+        sAtkBridge.shutdown = NULL;
+    }
+    if (sGail.lib) {
+        // Do not shutdown gail because
+        // 1) Maybe it's not init-ed by us. e.g. GtkEmbed
+        // 2) We need it to avoid assert in spi_atk_tidy_windows
+        // if (sGail.shutdown)
+        //   (*sGail.shutdown)();
+        // PR_UnloadLibrary(sGail.lib);
+        sGail.lib = NULL;
+        sGail.init = NULL;
+        sGail.shutdown = NULL;
+    }
+    // if (sATKLib) {
+    //     PR_UnloadLibrary(sATKLib);
+    //     sATKLib = nsnull;
+    // }
+}
+
+NS_IMETHODIMP
+nsApplicationAccessibleWrap::GetNativeInterface(void **aOutAccessible)
+{
+    *aOutAccessible = nsnull;
+
+    if (!mAtkObject) {
+        mAtkObject =
+            reinterpret_cast<AtkObject *>
+                            (g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
+        NS_ENSURE_TRUE(mAtkObject, NS_ERROR_OUT_OF_MEMORY);
+
+        atk_object_initialize(mAtkObject, this);
+        mAtkObject->role = ATK_ROLE_INVALID;
+        mAtkObject->layer = ATK_LAYER_INVALID;
+    }
+
+    *aOutAccessible = mAtkObject;
+    return NS_OK;
+}
+
+struct AtkRootAccessibleAddedEvent {
+  AtkObject *app_accessible;
+  AtkObject *root_accessible;
+  PRUint32 index;
+};
+
+gboolean fireRootAccessibleAddedCB(gpointer data)
+{
+    AtkRootAccessibleAddedEvent* eventData = (AtkRootAccessibleAddedEvent*)data;
+    g_signal_emit_by_name(eventData->app_accessible, "children_changed::add",
+                          eventData->index, eventData->root_accessible, NULL);
+    g_object_unref(eventData->app_accessible);
+    g_object_unref(eventData->root_accessible);
+    free(data);
+    
+    return FALSE;
+}
+
+PRBool
+nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
+{
+    if (!nsApplicationAccessible::AppendChild(aChild))
+      return PR_FALSE;
+
+    AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aChild);
+    atk_object_set_parent(atkAccessible, mAtkObject);
+
+    PRUint32 count = mChildren.Length();
+
+    // Emit children_changed::add in a timeout
+    // to make sure aRootAccWrap is fully initialized.
+    AtkRootAccessibleAddedEvent* eventData = (AtkRootAccessibleAddedEvent*)
+      malloc(sizeof(AtkRootAccessibleAddedEvent));
+    if (eventData) {
+      eventData->app_accessible = mAtkObject;
+      eventData->root_accessible = atkAccessible;
+      eventData->index = count -1;
+      g_object_ref(mAtkObject);
+      g_object_ref(atkAccessible);
+      g_timeout_add(0, fireRootAccessibleAddedCB, eventData);
+    }
+
+    return PR_TRUE;
+}
+
+PRBool
+nsApplicationAccessibleWrap::RemoveChild(nsAccessible* aChild)
+{
+    PRInt32 index = aChild->GetIndexInParent();
+
+    AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aChild);
+    atk_object_set_parent(atkAccessible, NULL);
+    g_signal_emit_by_name(mAtkObject, "children_changed::remove", index,
+                          atkAccessible, NULL);
+
+    return nsApplicationAccessible::RemoveChild(aChild);
+}
+
+void
+nsApplicationAccessibleWrap::PreCreate()
+{
+    if (!sATKChecked) {
+        sATKLib = PR_LoadLibrary(sATKLibName);
+        if (sATKLib) {
+            AtkGetTypeType pfn_atk_hyperlink_impl_get_type = (AtkGetTypeType) PR_FindFunctionSymbol(sATKLib, sATKHyperlinkImplGetTypeSymbol);
+            if (pfn_atk_hyperlink_impl_get_type) {
+                g_atk_hyperlink_impl_type = pfn_atk_hyperlink_impl_get_type();
+            }
+        }
+        sATKChecked = PR_TRUE;
+    }
+}
+
+static nsresult
+LoadGtkModule(GnomeAccessibilityModule& aModule)
+{
+    NS_ENSURE_ARG(aModule.libName);
+
+    if (!(aModule.lib = PR_LoadLibrary(aModule.libName))) {
+
+        MAI_LOG_DEBUG(("Fail to load lib: %s in default path\n", aModule.libName));
+
+        //try to load the module with "gtk-2.0/modules" appended
+        char *curLibPath = PR_GetLibraryPath();
+        nsCAutoString libPath(curLibPath);
+#if defined(LINUX) && defined(__x86_64__)
+        libPath.Append(":/usr/lib64:/usr/lib");
+#else
+        libPath.Append(":/usr/lib");
+#endif
+        MAI_LOG_DEBUG(("Current Lib path=%s\n", libPath.get()));
+        PR_FreeLibraryName(curLibPath);
+
+        PRInt16 loc1 = 0, loc2 = 0;
+        PRInt16 subLen = 0;
+        while (loc2 >= 0) {
+            loc2 = libPath.FindChar(':', loc1);
+            if (loc2 < 0)
+                subLen = libPath.Length() - loc1;
+            else
+                subLen = loc2 - loc1;
+            nsCAutoString sub(Substring(libPath, loc1, subLen));
+            sub.Append("/gtk-2.0/modules/");
+            sub.Append(aModule.libName);
+            aModule.lib = PR_LoadLibrary(sub.get());
+            if (aModule.lib) {
+                MAI_LOG_DEBUG(("Ok, load %s from %s\n", aModule.libName, sub.get()));
+                break;
+            }
+            loc1 = loc2+1;
+        }
+        if (!aModule.lib) {
+            MAI_LOG_DEBUG(("Fail to load %s\n", aModule.libName));
+            return NS_ERROR_FAILURE;
+        }
+    }
+
+    //we have loaded the library, try to get the function ptrs
+    if (!(aModule.init = PR_FindFunctionSymbol(aModule.lib,
+                                               aModule.initName)) ||
+        !(aModule.shutdown = PR_FindFunctionSymbol(aModule.lib,
+                                                   aModule.shutdownName))) {
+
+        //fail, :(
+        MAI_LOG_DEBUG(("Fail to find symbol %s in %s",
+                       aModule.init ? aModule.shutdownName : aModule.initName,
+                       aModule.libName));
+        PR_UnloadLibrary(aModule.lib);
+        aModule.lib = NULL;
+        return NS_ERROR_FAILURE;
+    }
+    return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/accessible/src/atk/nsApplicationAccessibleWrap.h
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *