Merge from mozilla-central.
authorDavid Anderson <danderson@mozilla.com>
Wed, 18 Apr 2012 10:23:31 -0700
changeset 106163 0e6d579045c8200b5433098f418a3c1ebbf64a1b
parent 106162 67bf9a4a1f770344ed3e215141281fd81923542f (current diff)
parent 91842 c61e7c3a232aad0d8fb1bc2455487ce61dd9e182 (diff)
child 106164 b333b5d0e755bf9384f4e24513e4b07cae1b0d8c
push id14706
push usereakhgari@mozilla.com
push dateTue, 11 Sep 2012 20:39:52 +0000
treeherdermozilla-inbound@d50bf1edaabe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone14.0a1
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 from mozilla-central.
accessible/src/base/Makefile.in
accessible/src/base/NotificationController.cpp
accessible/src/base/nsARIAMap.cpp
accessible/src/base/nsARIAMap.h
accessible/src/base/nsAccDocManager.cpp
accessible/src/base/nsAccUtils.cpp
accessible/src/base/nsAccUtils.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsFormControlAccessible.cpp
accessible/src/base/nsFormControlAccessible.h
accessible/src/base/nsRootAccessible.cpp
accessible/src/base/nsTextEquivUtils.cpp
accessible/src/generic/ARIAGridAccessible.cpp
accessible/src/generic/FormControlAccessible.cpp
accessible/src/generic/FormControlAccessible.h
accessible/src/html/HTMLFormControlAccessible.cpp
accessible/src/html/HTMLFormControlAccessible.h
accessible/src/html/nsHTMLFormControlAccessible.cpp
accessible/src/html/nsHTMLFormControlAccessible.h
accessible/src/html/nsHTMLImageAccessible.cpp
accessible/src/html/nsHTMLImageAccessible.h
accessible/src/html/nsHTMLImageMapAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.h
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.h
accessible/src/html/nsHyperTextAccessible.cpp
accessible/src/html/nsHyperTextAccessible.h
accessible/src/mac/mozTextAccessible.mm
accessible/src/mac/nsAccessibleWrap.mm
accessible/src/msaa/CAccessibleComponent.cpp
accessible/src/msaa/CAccessibleComponent.h
accessible/src/msaa/CAccessibleHypertext.cpp
accessible/src/msaa/CAccessibleHypertext.h
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
accessible/src/msaa/nsHyperTextAccessibleWrap.h
accessible/src/xul/Makefile.in
accessible/src/xul/XULFormControlAccessible.cpp
accessible/src/xul/XULFormControlAccessible.h
accessible/src/xul/nsXULColorPickerAccessible.cpp
accessible/src/xul/nsXULComboboxAccessible.cpp
accessible/src/xul/nsXULFormControlAccessible.cpp
accessible/src/xul/nsXULFormControlAccessible.h
accessible/src/xul/nsXULListboxAccessible.cpp
accessible/src/xul/nsXULMenuAccessible.cpp
accessible/src/xul/nsXULTreeGridAccessible.cpp
b2g/chrome/jar.mn
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/highlighter.css
browser/base/content/tabbrowser.xml
browser/components/migration/src/nsSafariProfileMigrator.cpp
browser/components/migration/src/nsSafariProfileMigrator.h
browser/components/places/tests/browser/browser_457473_no_copy_guid.js
browser/components/preferences/aboutPermissions.js
browser/components/sessionstore/src/nsSessionStore.js
browser/components/tabview/groupitems.js
browser/components/tabview/tabitems.js
browser/components/tabview/tabview.js
browser/components/tabview/ui.js
browser/devtools/debugger/debugger.js
browser/devtools/jar.mn
browser/locales/en-US/chrome/browser/devtools/inspector.properties
build/mobile/devicemanagerSUT.py
caps/include/nsScriptSecurityManager.h
caps/src/nsScriptSecurityManager.cpp
config/autoconf.mk.in
configure.in
content/base/public/nsContentUtils.h
content/base/public/nsDeprecatedOperationList.h
content/base/public/nsIContent.h
content/base/public/nsIDOMFileException.idl
content/base/public/nsIDocument.h
content/base/public/nsINode.h
content/base/src/Makefile.in
content/base/src/nsContentUtils.cpp
content/base/src/nsDOMFileReader.h
content/base/src/nsDocument.cpp
content/base/src/nsDocument.h
content/base/src/nsFrameMessageManager.cpp
content/base/src/nsGenericDOMDataNode.cpp
content/base/src/nsGenericDOMDataNode.h
content/base/src/nsGenericElement.cpp
content/base/src/nsGenericElement.h
content/base/src/nsGkAtomList.h
content/base/src/nsObjectLoadingContent.cpp
content/base/src/nsRange.cpp
content/base/src/nsStyledElement.cpp
content/base/src/nsStyledElement.h
content/base/test/Makefile.in
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextValidate.cpp
content/canvas/test/webgl/test_webgl_conformance_test_suite.html
content/events/public/nsEventNameList.h
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMEvent.h
content/events/src/nsDOMMouseEvent.cpp
content/events/src/nsDOMUIEvent.cpp
content/events/src/nsDOMUIEvent.h
content/events/src/nsEventListenerService.cpp
content/events/src/nsEventStateManager.cpp
content/events/src/nsEventStateManager.h
content/html/content/src/nsGenericHTMLElement.h
content/html/document/src/VideoDocument.cpp
content/html/document/src/nsHTMLDocument.h
content/media/nsAudioStream.cpp
content/media/ogg/nsOggCodecState.cpp
content/svg/content/src/nsSVGFilters.cpp
content/xslt/src/base/txCore.h
content/xslt/src/xpath/txCoreFunctionCall.cpp
content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp
content/xslt/src/xpath/txNumberExpr.cpp
content/xslt/src/xpath/txUnionNodeTest.cpp
content/xslt/src/xslt/txEXSLTFunctions.cpp
content/xslt/src/xslt/txFormatNumberFunctionCall.cpp
content/xslt/src/xslt/txStylesheet.cpp
content/xslt/src/xslt/txStylesheetCompileHandlers.cpp
content/xslt/src/xslt/txXSLTNumber.cpp
content/xslt/src/xslt/txXSLTPatterns.cpp
content/xul/content/src/nsXULElement.cpp
docshell/base/nsDocShell.cpp
dom/Makefile.in
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/base/nsDOMScriptObjectFactory.cpp
dom/base/nsDOMScriptObjectFactory.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsIDOMScriptObjectFactory.h
dom/base/nsJSEnvironment.cpp
dom/base/nsJSEnvironment.h
dom/bindings/parser/__init__.py
dom/indexedDB/IDBCursor.cpp
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBEvents.cpp
dom/indexedDB/IDBFactory.cpp
dom/indexedDB/nsIIDBDatabaseException.idl
dom/interfaces/core/nsIDOMDocument.idl
dom/interfaces/core/nsIDOMXMLDocument.idl
dom/interfaces/geolocation/nsIDOMGeoPositionOptions.idl
dom/interfaces/html/nsIDOMHTMLDocument.idl
dom/interfaces/storage/nsPIDOMStorage.h
dom/interfaces/svg/nsIDOMSVGDocument.idl
dom/ipc/ContentParent.cpp
dom/ipc/CrashReporterParent.cpp
dom/locales/en-US/chrome/dom/dom.properties
dom/plugins/base/nsJSNPRuntime.cpp
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPluginStreamListener.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginHost.h
dom/plugins/ipc/PluginInstanceParent.h
dom/plugins/ipc/PluginModuleParent.cpp
dom/src/geolocation/nsGeolocation.cpp
dom/src/geolocation/nsGeolocation.h
dom/src/storage/nsDOMStorage.cpp
dom/src/storage/nsDOMStorage.h
dom/system/unix/MaemoLocationProvider.h
dom/tests/mochitest/bugs/test_bug531176.html
dom/tests/mochitest/w3c/Makefile.in
dom/tests/mochitest/w3c/README
dom/tests/mochitest/w3c/WebIDLParser.js
dom/tests/mochitest/w3c/failures.txt
dom/tests/mochitest/w3c/html.json
dom/tests/mochitest/w3c/html.mk
dom/tests/mochitest/w3c/html.txt
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/Makefile.in
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/nested-document-write-external.js
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/test_body-onload.html
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/test_pageload-image.html
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/test_pageload-video.html
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/test_script-for-onload.html
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/test_window-onerror-parse-error.html
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/test_window-onerror-runtime-error-throw.html
dom/tests/mochitest/w3c/html/tests/submission/Mozilla/test_window-onerror-runtime-error.html
dom/tests/mochitest/w3c/idlharness.js
dom/tests/mochitest/w3c/importTestsuite.py
dom/tests/mochitest/w3c/parseManifest.py
dom/tests/mochitest/w3c/testharness.css
dom/tests/mochitest/w3c/testharness.js
dom/tests/mochitest/w3c/testharnessreport.js.in
dom/tests/mochitest/w3c/updateTestharness.py
dom/tests/mochitest/w3c/webapps.json
dom/tests/mochitest/w3c/webapps.mk
dom/tests/mochitest/w3c/webapps.txt
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/Makefile.in
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-01.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-02.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-03.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-04.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-05.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-06.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-07.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-08.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-09.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-10.xml
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-11.xml
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-12.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-13.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-14.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-15.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-16.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-17.htm
dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-18.htm
dom/tests/mochitest/w3c/writeReporter.py
dom/wifi/WifiWorker.js
dom/workers/RuntimeService.cpp
dom/workers/WorkerPrivate.cpp
editor/composer/src/nsComposerCommands.cpp
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/nsHTMLEditor.cpp
editor/libeditor/html/nsHTMLEditor.h
embedding/android/GeckoAppShell.java
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
gfx/angle/Makefile.in
gfx/angle/README.mozilla
gfx/angle/angle-intrinsic-msvc2005.patch
gfx/angle/angle-renaming-debug.patch
gfx/angle/samples/translator/translator.cpp
gfx/angle/src/common/version.h
gfx/angle/src/compiler/BuiltInFunctionEmulator.cpp
gfx/angle/src/compiler/BuiltInFunctionEmulator.h
gfx/angle/src/compiler/OutputHLSL.cpp
gfx/angle/src/compiler/OutputHLSL.h
gfx/angle/src/compiler/ParseHelper.cpp
gfx/angle/src/compiler/preprocessor/new/Context.cpp
gfx/angle/src/compiler/preprocessor/new/Context.h
gfx/angle/src/compiler/preprocessor/new/Preprocessor.cpp
gfx/angle/src/compiler/preprocessor/new/Preprocessor.h
gfx/angle/src/compiler/preprocessor/new/Token.cpp
gfx/angle/src/compiler/preprocessor/new/Token.h
gfx/angle/src/compiler/preprocessor/new/pp.l
gfx/angle/src/compiler/preprocessor/new/pp.y
gfx/angle/src/compiler/preprocessor/new/pp_lex.cpp
gfx/angle/src/compiler/preprocessor/new/pp_tab.cpp
gfx/angle/src/compiler/preprocessor/new/pp_tab.h
gfx/angle/src/libEGL/Display.cpp
gfx/angle/src/libEGL/Display.h
gfx/angle/src/libEGL/Makefile.in
gfx/angle/src/libEGL/Surface.cpp
gfx/angle/src/libGLESv2/Context.cpp
gfx/angle/src/libGLESv2/Context.h
gfx/angle/src/libGLESv2/IndexDataManager.cpp
gfx/angle/src/libGLESv2/IndexDataManager.h
gfx/angle/src/libGLESv2/Makefile.in
gfx/angle/src/libGLESv2/Program.cpp
gfx/angle/src/libGLESv2/Program.h
gfx/angle/src/libGLESv2/VertexDataManager.cpp
gfx/angle/src/libGLESv2/VertexDataManager.h
gfx/angle/src/libGLESv2/libGLESv2.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLContextProviderGLX.cpp
gfx/gl/GLXLibrary.h
gfx/layers/d3d10/LayerManagerD3D10.cpp
gfx/layers/d3d10/LayerManagerD3D10.h
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/thebes/gfxDWriteFonts.h
gfx/thebes/gfxDrawable.cpp
gfx/thebes/gfxFT2FontBase.h
gfx/thebes/gfxFont.h
gfx/thebes/gfxGDIFont.cpp
gfx/thebes/gfxGDIFont.h
gfx/thebes/gfxMacFont.h
gfx/thebes/gfxOS2Fonts.h
gfx/thebes/gfxPlatformGtk.cpp
gfx/thebes/gfxPlatformGtk.h
gfx/thebes/gfxUtils.h
gfx/thebes/gfxWindowsPlatform.cpp
js/public/Vector.h
js/src/Makefile.in
js/src/MemoryMetrics.cpp
js/src/builtin/ParallelArray.cpp
js/src/configure.in
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
js/src/frontend/FoldConstants.cpp
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/gc/Barrier.h
js/src/ion/CodeGenerator.cpp
js/src/ion/Ion.cpp
js/src/ion/IonBuilder.cpp
js/src/ion/IonBuilder.h
js/src/ion/VMFunctions.cpp
js/src/ion/VMFunctions.h
js/src/jsanalyze.h
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jsarray.h
js/src/jsbool.cpp
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/jscntxtinlines.h
js/src/jscompartment.cpp
js/src/jscompartment.h
js/src/jsdate.cpp
js/src/jsdate.h
js/src/jsdbgapi.cpp
js/src/jsdbgapi.h
js/src/jsexn.cpp
js/src/jsfriendapi.h
js/src/jsfun.cpp
js/src/jsfun.h
js/src/jsfuninlines.h
js/src/jsgc.cpp
js/src/jsgcinlines.h
js/src/jsgcmark.cpp
js/src/jsgcmark.h
js/src/jsinfer.cpp
js/src/jsinferinlines.h
js/src/jsinterp.cpp
js/src/jsinterp.h
js/src/jsinterpinlines.h
js/src/jsiter.cpp
js/src/jsiter.h
js/src/jslibmath.h
js/src/jsnum.cpp
js/src/jsnum.h
js/src/jsobj.cpp
js/src/jsobj.h
js/src/jsobjinlines.h
js/src/json.cpp
js/src/jsopcode.cpp
js/src/jspropertycache.cpp
js/src/jsproxy.cpp
js/src/jsprvtd.h
js/src/jspubtd.h
js/src/jsreflect.cpp
js/src/jsscope.cpp
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jsstr.cpp
js/src/jsstr.h
js/src/jstypedarray.cpp
js/src/jsval.h
js/src/jswrapper.cpp
js/src/jswrapper.h
js/src/jsxml.cpp
js/src/methodjit/Compiler.cpp
js/src/methodjit/InvokeHelpers.cpp
js/src/methodjit/PolyIC.cpp
js/src/methodjit/StubCalls.cpp
js/src/shell/js.cpp
js/src/v8-dtoa/README
js/src/v8-dtoa/cached-powers.h
js/src/v8-dtoa/checks.cc
js/src/v8-dtoa/checks.h
js/src/v8-dtoa/conversions.cc
js/src/v8-dtoa/conversions.h
js/src/v8-dtoa/diy-fp.cc
js/src/v8-dtoa/diy-fp.h
js/src/v8-dtoa/double.h
js/src/v8-dtoa/dtoa.h
js/src/v8-dtoa/fast-dtoa.cc
js/src/v8-dtoa/fast-dtoa.h
js/src/v8-dtoa/globals.h
js/src/v8-dtoa/include-v8.h
js/src/v8-dtoa/platform.cc
js/src/v8-dtoa/platform.h
js/src/v8-dtoa/powers-ten.h
js/src/v8-dtoa/utils.cc
js/src/v8-dtoa/utils.h
js/src/v8-dtoa/v8-dtoa.cc
js/src/v8-dtoa/v8.h
js/src/vm/ArgumentsObject.cpp
js/src/vm/ArgumentsObject.h
js/src/vm/Debugger.cpp
js/src/vm/RegExpObject.cpp
js/src/vm/RegExpObject.h
js/src/vm/Stack.cpp
js/src/vm/Stack.h
js/src/vm/String.cpp
js/src/vm/String.h
js/xpconnect/idl/nsIXPConnect.idl
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/dom_quickstubs.qsconf
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/qsgen.py
js/xpconnect/src/xpcprivate.h
js/xpconnect/src/xpcpublic.h
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/base/nsIPresShell.h
layout/base/nsLayoutUtils.cpp
layout/base/nsPresArena.cpp
layout/base/nsPresShell.cpp
layout/forms/nsFieldSetFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsTextRunTransformations.cpp
layout/reftests/font-inflation/input-text-1-ref.html
layout/reftests/font-inflation/input-text-1.html
layout/reftests/font-inflation/input-text-2-ref.html
layout/reftests/font-inflation/input-text-2.html
layout/reftests/font-inflation/input-text-3-ref.html
layout/reftests/font-inflation/input-text-3.html
layout/reftests/scrolling/reftest.list
layout/reftests/text-overflow/reftest.list
layout/style/nsCSSParser.cpp
layout/style/nsRuleNode.h
layout/style/nsStyleStruct.h
layout/style/test/property_database.js
layout/svg/base/src/nsISVGChildFrame.h
layout/svg/base/src/nsSVGContainerFrame.cpp
layout/svg/base/src/nsSVGContainerFrame.h
layout/svg/base/src/nsSVGFilterFrame.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.h
layout/svg/base/src/nsSVGGlyphFrame.cpp
layout/svg/base/src/nsSVGGlyphFrame.h
layout/svg/base/src/nsSVGMarkerFrame.cpp
layout/svg/base/src/nsSVGMarkerFrame.h
layout/svg/base/src/nsSVGPathGeometryFrame.cpp
layout/svg/base/src/nsSVGPathGeometryFrame.h
layout/svg/base/src/nsSVGSwitchFrame.cpp
layout/svg/base/src/nsSVGTextFrame.cpp
layout/svg/base/src/nsSVGTextFrame.h
layout/svg/base/src/nsSVGUtils.cpp
layout/svg/base/src/nsSVGUtils.h
layout/tables/nsTableFrame.cpp
layout/tools/reftest/remotereftest.py
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppShell.java
mobile/android/base/Makefile.in
mobile/android/base/resources/drawable/address_bar_bg_shadow.xml
mobile/android/base/sync/repositories/android/AndroidBrowserPasswordsDataAccessor.java
mobile/android/base/sync/repositories/android/AndroidBrowserPasswordsRepository.java
mobile/android/base/sync/repositories/android/AndroidBrowserPasswordsRepositorySession.java
modules/libjar/nsJARInputStream.cpp
modules/libjar/nsZipArchive.cpp
modules/libpref/src/init/all.js
mozglue/android/nsGeckoUtils.cpp
netwerk/base/src/nsInputStreamPump.cpp
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsStandardURL.cpp
netwerk/base/src/nsURLHelper.cpp
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsCacheService.h
netwerk/cache/nsDiskCacheBlockFile.h
netwerk/cache/nsDiskCacheDevice.cpp
netwerk/cache/nsDiskCacheDevice.h
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/cookie/nsCookieService.cpp
netwerk/mime/nsMIMEHeaderParamImpl.cpp
netwerk/protocol/device/Makefile.in
netwerk/protocol/http/HttpChannelParentListener.cpp
netwerk/protocol/http/PHttpChannelParams.h
netwerk/protocol/http/SpdySession.h
netwerk/protocol/http/SpdyStream.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
netwerk/test/TestCookie.cpp
parser/html/nsHtml5Parser.cpp
services/sync/tests/unit/test_bookmark_smart_bookmarks.js
toolkit/components/places/AsyncFaviconHelpers.cpp
toolkit/components/places/nsNavBookmarks.cpp
toolkit/components/places/nsNavBookmarks.h
toolkit/components/places/tests/bookmarks/test_360134.js
toolkit/components/places/tests/bookmarks/test_484026.js
toolkit/components/places/tests/bookmarks/test_restore_guids.js
toolkit/components/places/tests/favicons/test_favicons.js
toolkit/components/places/tests/head_common.js
toolkit/components/places/tests/unit/test_txnGUIDs.js
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/telemetry/TelemetryHistograms.h
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
toolkit/content/widgets/videocontrols.xml
toolkit/mozapps/extensions/XPIProvider.jsm
toolkit/mozapps/installer/packager.mk
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsNativeAppSupportOS2.cpp
toolkit/xre/nsNativeAppSupportWin.cpp
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/nsAppShell.cpp
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/nsChildView.h
widget/gtk2/nsSound.cpp
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
widget/nsGUIEvent.h
widget/nsIWidget.h
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/windows/JumpListBuilder.cpp
widget/windows/nsFilePicker.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/xpwidgets/nsBaseWidget.h
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsError.h
xpcom/glue/nsVoidArray.h
xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp
xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp
xpcom/string/public/nsAString.h
xpcom/string/public/nsTSubstring.h
xpcom/string/src/nsPrintfCString.cpp
xpcom/string/src/nsTSubstring.cpp
--- a/accessible/src/Makefile.in
+++ b/accessible/src/Makefile.in
@@ -58,16 +58,17 @@ endif
 endif
 
 DIRS += $(PLATFORM_DIR)
 
 DIRS += \
   base \
   generic \
   html \
+  jsat \
   xpcom \
   xforms \
   $(null)
 
 ifdef MOZ_XUL
 DIRS +=   xul
 endif
 
--- a/accessible/src/base/ARIAStateMap.cpp
+++ b/accessible/src/base/ARIAStateMap.cpp
@@ -282,16 +282,25 @@ aria::MapToState(EStateRule aRule, dom::
     case eReadonlyUntilEditable:
     {
       if (!(*aState & states::EDITABLE))
         *aState |= states::READONLY;
 
       return true;
     }
 
+    case eIndeterminateIfNoValue:
+    {
+      if (!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow) &&
+          !aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext))
+        *aState |= states::MIXED;
+
+      return true;
+    }
+
     default:
       return false;
   }
 }
 
 static void
 MapEnumType(dom::Element* aElement, PRUint64* aState, const EnumTypeData& aData)
 {
--- a/accessible/src/base/ARIAStateMap.h
+++ b/accessible/src/base/ARIAStateMap.h
@@ -36,17 +36,18 @@ enum EStateRule
   eARIAMultiline,
   eARIAMultiSelectable,
   eARIAOrientation,
   eARIAPressed,
   eARIAReadonly,
   eARIAReadonlyOrEditable,
   eARIARequired,
   eARIASelectable,
-  eReadonlyUntilEditable
+  eReadonlyUntilEditable,
+  eIndeterminateIfNoValue
 };
 
 /**
  * Expose the accessible states for the given element accordingly to state
  * mapping rule.
  *
  * @param  aRule     [in] state mapping rule ID
  * @param  aElement  [in] node of the accessible
--- a/accessible/src/base/AccGroupInfo.h
+++ b/accessible/src/base/AccGroupInfo.h
@@ -33,17 +33,17 @@
  * 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 AccGroupInfo_h_
 #define AccGroupInfo_h_
 
-#include "nsAccessible.h"
+#include "Accessible-inl.h"
 #include "nsAccUtils.h"
 
 /**
  * Calculate and store group information.
  */
 class AccGroupInfo
 {
 public:
--- a/accessible/src/base/FocusManager.cpp
+++ b/accessible/src/base/FocusManager.cpp
@@ -32,16 +32,17 @@
  * 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 "FocusManager.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsRootAccessible.h"
 #include "Role.h"
 
 #include "nsEventStateManager.h"
 #include "nsFocusManager.h"
 
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -63,40 +63,37 @@ CPPSRCS = \
   nsCoreUtils.cpp \
   nsAccUtils.cpp \
   nsAccessibilityService.cpp \
   nsAccessible.cpp \
   nsAccessiblePivot.cpp \
   nsAccTreeWalker.cpp \
   nsBaseWidgetAccessible.cpp \
   nsEventShell.cpp \
-  nsFormControlAccessible.cpp \
   nsRootAccessible.cpp \
   nsApplicationAccessible.cpp \
   nsCaretAccessible.cpp \
   nsTextAccessible.cpp \
   nsTextEquivUtils.cpp \
   StyleInfo.cpp \
   TextAttrs.cpp \
   TextUpdater.cpp \
   $(NULL)
 
 EXPORTS = \
   a11yGeneric.h \
   nsAccDocManager.h \
   nsAccessibilityService.h \
   nsAccessible.h \
   nsAccessNode.h \
-  nsARIAMap.h \
   $(NULL)
 
 EXPORTS_NAMESPACES = mozilla/a11y
 
 EXPORTS_mozilla/a11y = \
-  ARIAStateMap.h \
   FocusManager.h \
   States.h \
   Role.h \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -33,16 +33,17 @@
  * 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 "NotificationController.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "nsEventShell.h"
 #include "nsTextAccessible.h"
 #include "FocusManager.h"
 #include "Role.h"
--- a/accessible/src/base/Role.h
+++ b/accessible/src/base/Role.h
@@ -35,16 +35,20 @@
  * 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 _role_h_
 #define _role_h_
 
+/**
+ * Note: Make sure to update the localized role names when changing the list.
+ */
+
 namespace mozilla {
 namespace a11y {
 namespace roles {
   enum Role {
   /**
    * Used when accessible hans't strong defined role.
    */
   NOTHING = 0,
--- a/accessible/src/base/TextUpdater.cpp
+++ b/accessible/src/base/TextUpdater.cpp
@@ -33,16 +33,17 @@
  * 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 "TextUpdater.h"
 
+#include "Accessible-inl.h"
 #include "nsDocAccessible.h"
 #include "nsTextAccessible.h"
 
 void
 TextUpdater::Run(nsDocAccessible* aDocument, nsTextAccessible* aTextLeaf,
                  const nsAString& aNewText)
 {
   NS_ASSERTION(aTextLeaf, "No text leaf accessible?");
--- a/accessible/src/base/filters.cpp
+++ b/accessible/src/base/filters.cpp
@@ -32,17 +32,17 @@
  * 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 "filters.h"
 
-#include "nsAccessible.h"
+#include "Accessible-inl.h"
 #include "nsAccUtils.h"
 #include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 bool
 filters::GetSelected(nsAccessible* aAccessible)
--- a/accessible/src/base/nsARIAMap.cpp
+++ b/accessible/src/base/nsARIAMap.cpp
@@ -34,21 +34,24 @@
  * 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 "nsARIAMap.h"
 
+#include "nsCoreUtils.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsIContent.h"
+#include "nsWhitespaceTokenizer.h"
 
+using namespace mozilla;
 using namespace mozilla::a11y;
 using namespace mozilla::a11y::aria;
 
 /**
  *  This list of WAI-defined roles are currently hardcoded.
  *  Eventually we will most likely be loading an RDF resource that contains this information
  *  Using RDF will also allow for role extensibility. See bug 280138.
  *
@@ -57,17 +60,17 @@ using namespace mozilla::a11y::aria;
  *  When no nsIAccessibleRole enum mapping exists for an ARIA role, the
  *  role will be exposed via the object attribute "xml-roles".
  *  In addition, in MSAA, the unmapped role will also be exposed as a BSTR string role.
  *
  *  There are no nsIAccessibleRole enums for the following landmark roles:
  *    banner, contentinfo, main, navigation, note, search, secondary, seealso, breadcrumbs
  */
 
-nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = 
+static nsRoleMapEntry sWAIRoleMaps[] =
 {
   {
     "alert",
     roles::ALERT,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
@@ -375,17 +378,18 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] 
   },
   {
     "progressbar",
     roles::PROGRESSBAR,
     kUseMapRole,
     eHasValueMinMax,
     eNoAction,
     eNoLiveAttr,
-    states::READONLY
+    states::READONLY,
+    eIndeterminateIfNoValue
   },
   {
     "radio",
     roles::RADIOBUTTON,
     kUseMapRole,
     eNoValue,
     eSelectAction,
     eNoLiveAttr,
@@ -580,19 +584,17 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] 
                      // on states
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable,
     eARIACheckedMixed
   }
 };
 
-PRUint32 nsARIAMap::gWAIRoleMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIRoleMap);
-
-nsRoleMapEntry nsARIAMap::gLandmarkRoleMap = {
+static nsRoleMapEntry sLandmarkRoleMap = {
   "",
   roles::NOTHING,
   kUseNativeRole,
   eNoValue,
   eNoAction,
   eNoLiveAttr,
   kNoReqStates
 };
@@ -661,8 +663,44 @@ nsAttributeCharacteristics nsARIAMap::gW
   {&nsGkAtoms::aria_sort,                               ATTR_VALTOKEN },
   {&nsGkAtoms::aria_valuenow,          ATTR_BYPASSOBJ                 },
   {&nsGkAtoms::aria_valuemin,          ATTR_BYPASSOBJ                 },
   {&nsGkAtoms::aria_valuemax,          ATTR_BYPASSOBJ                 },
   {&nsGkAtoms::aria_valuetext,         ATTR_BYPASSOBJ                 }
 };
 
 PRUint32 nsARIAMap::gWAIUnivAttrMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIUnivAttrMap);
+
+nsRoleMapEntry*
+aria::GetRoleMap(nsINode* aNode)
+{
+  nsIContent* content = nsCoreUtils::GetRoleContent(aNode);
+  nsAutoString roleString;
+  if (!content ||
+      !content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString) ||
+      roleString.IsEmpty()) {
+    // We treat role="" as if the role attribute is absent (per aria spec:8.1.1)
+    return nsnull;
+  }
+
+  nsWhitespaceTokenizer tokenizer(roleString);
+  while (tokenizer.hasMoreTokens()) {
+    // Do a binary search through table for the next role in role list
+    NS_LossyConvertUTF16toASCII role(tokenizer.nextToken());
+    PRUint32 low = 0;
+    PRUint32 high = ArrayLength(sWAIRoleMaps);
+    while (low < high) {
+      PRUint32 idx = (low + high) / 2;
+      PRInt32 compare = strcmp(role.get(), sWAIRoleMaps[idx].roleString);
+      if (compare == 0) 
+        return sWAIRoleMaps + idx;
+
+      if (compare < 0)
+        high = idx;
+      else
+        low = idx + 1;
+    }
+  }
+
+  // Always use some entry if there is a non-empty role string
+  // To ensure an accessible object is created
+  return &sLandmarkRoleMap;
+}
--- a/accessible/src/base/nsARIAMap.h
+++ b/accessible/src/base/nsARIAMap.h
@@ -35,22 +35,22 @@
  * 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 _nsARIAMap_H_
 #define _nsARIAMap_H_
 
-#include "mozilla/a11y/ARIAStateMap.h"
+#include "ARIAStateMap.h"
 #include "mozilla/a11y/Role.h"
-#include "prtypes.h"
 
 class nsIAtom;
 class nsIContent;
+class nsINode;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Value constants
 
 /**
  * Used to define if role requires to expose nsIAccessibleValue.
  */
 enum EValueRule
@@ -207,28 +207,16 @@ struct nsRoleMapEntry
 /**
  *  These are currently initialized (hardcoded) in nsARIAMap.cpp, 
  *  and provide the mappings for WAI-ARIA roles and properties using the 
  *  structs defined in this file.
  */
 struct nsARIAMap
 {
   /**
-   * Array of supported ARIA role map entries and its length.
-   */
-  static nsRoleMapEntry gWAIRoleMap[];
-  static PRUint32 gWAIRoleMapLength;
-
-  /**
-   * Landmark role map entry. Used when specified ARIA role isn't mapped to
-   * accessibility API.
-   */
-  static nsRoleMapEntry gLandmarkRoleMap;
-
-  /**
    * Empty role map entry. Used by accessibility service to create an accessible
    * if the accessible can't use role of used accessible class. For example,
    * it is used for table cells that aren't contained by table.
    */
   static nsRoleMapEntry gEmptyRoleMap;
 
   /**
    * State map of ARIA states applied to any accessible not depending on
@@ -253,9 +241,27 @@ struct nsARIAMap
     while (mozilla::a11y::aria::MapToState(gWAIUnivStateMap[index],
                                            aElement, &state))
       index++;
 
     return state;
   }
 };
 
+namespace mozilla {
+namespace a11y {
+namespace aria {
+
+/**
+ * Get the role map entry for a given DOM node. This will use the first
+ * ARIA role if the role attribute provides a space delimited list of roles.
+ *
+ * @param aNode  [in] the DOM node to get the role map entry for
+ * @return        a pointer to the role map entry for the ARIA role, or nsnull
+ *                if none
+ */
+nsRoleMapEntry* GetRoleMap(nsINode* aNode);
+
+} // namespace aria
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -36,16 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAccDocManager.h"
 
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsApplicationAccessible.h"
+#include "nsARIAMap.h"
 #include "nsRootAccessibleWrap.h"
 #include "States.h"
 
 #include "nsCURILoader.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIContentViewer.h"
 #include "nsIDOMDocument.h"
@@ -397,17 +398,17 @@ nsAccDocManager::CreateDocOrRootAccessib
   if (!docAcc || !mDocAccessibleCache.Put(aDocument, docAcc))
     return nsnull;
 
   // Initialize the document accessible.
   if (!docAcc->Init()) {
     docAcc->Shutdown();
     return nsnull;
   }
-  docAcc->SetRoleMapEntry(nsAccUtils::GetRoleMapEntry(aDocument));
+  docAcc->SetRoleMapEntry(aria::GetRoleMap(aDocument));
 
   // Bind the document to the tree.
   if (isRootDoc) {
     nsAccessible* appAcc = nsAccessNode::GetApplicationAccessible();
     if (!appAcc->AppendChild(docAcc)) {
       docAcc->Shutdown();
       return nsnull;
     }
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -31,29 +31,29 @@
  * 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 "nsCoreUtils.h"
 #include "nsAccUtils.h"
 
+#include "Accessible-inl.h"
+#include "nsAccessibilityService.h"
+#include "nsARIAMap.h"
+#include "nsCoreUtils.h"
+#include "nsDocAccessible.h"
+#include "nsHyperTextAccessible.h"
 #include "nsIAccessibleTypes.h"
+#include "nsTextAccessible.h"
 #include "Role.h"
 #include "States.h"
 
-#include "nsAccessibilityService.h"
-#include "nsARIAMap.h"
-#include "nsDocAccessible.h"
-#include "nsHyperTextAccessible.h"
-#include "nsTextAccessible.h"
-
 #include "nsIDOMXULContainerElement.h"
 #include "nsIDOMXULSelectCntrlEl.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsWhitespaceTokenizer.h"
 #include "nsComponentManagerUtils.h"
 
 namespace dom = mozilla::dom;
 using namespace mozilla::a11y;
@@ -169,17 +169,17 @@ nsAccUtils::SetLiveContainerAttributes(n
     // container-relevant attribute
     if (relevant.IsEmpty() &&
         nsAccUtils::HasDefinedARIAToken(ancestor, nsGkAtoms::aria_relevant) &&
         ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_relevant, relevant))
       SetAccAttr(aAttributes, nsGkAtoms::containerRelevant, relevant);
 
     // container-live, and container-live-role attributes
     if (live.IsEmpty()) {
-      nsRoleMapEntry *role = GetRoleMapEntry(ancestor);
+      nsRoleMapEntry* role = aria::GetRoleMap(ancestor);
       if (nsAccUtils::HasDefinedARIAToken(ancestor,
                                           nsGkAtoms::aria_live)) {
         ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_live,
                           live);
       } else if (role) {
         GetLiveAttrValue(role->liveAttRule, live);
       }
       if (!live.IsEmpty()) {
@@ -413,55 +413,16 @@ nsAccUtils::GetScreenCoordsForParent(nsA
   nsIFrame *parentFrame = parent->GetFrame();
   if (!parentFrame)
     return nsIntPoint(0, 0);
 
   nsIntRect parentRect = parentFrame->GetScreenRectExternal();
   return nsIntPoint(parentRect.x, parentRect.y);
 }
 
-nsRoleMapEntry*
-nsAccUtils::GetRoleMapEntry(nsINode *aNode)
-{
-  nsIContent *content = nsCoreUtils::GetRoleContent(aNode);
-  nsAutoString roleString;
-  if (!content ||
-      !content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString) ||
-      roleString.IsEmpty()) {
-    // We treat role="" as if the role attribute is absent (per aria spec:8.1.1)
-    return nsnull;
-  }
-
-  nsWhitespaceTokenizer tokenizer(roleString);
-  while (tokenizer.hasMoreTokens()) {
-    // Do a binary search through table for the next role in role list
-    NS_LossyConvertUTF16toASCII role(tokenizer.nextToken());
-    PRUint32 low = 0;
-    PRUint32 high = nsARIAMap::gWAIRoleMapLength;
-    while (low < high) {
-      PRUint32 index = (low + high) / 2;
-      PRInt32 compare = PL_strcmp(role.get(), nsARIAMap::gWAIRoleMap[index].roleString);
-      if (compare == 0) {
-        // The  role attribute maps to an entry in the role table
-        return &nsARIAMap::gWAIRoleMap[index];
-      }
-      if (compare < 0) {
-        high = index;
-      }
-      else {
-        low = index + 1;
-      }
-    }
-  }
-
-  // Always use some entry if there is a non-empty role string
-  // To ensure an accessible object is created
-  return &nsARIAMap::gLandmarkRoleMap;
-}
-
 PRUint8
 nsAccUtils::GetAttributeCharacteristics(nsIAtom* aAtom)
 {
     for (PRUint32 i = 0; i < nsARIAMap::gWAIUnivAttrMapLength; i++)
       if (*nsARIAMap::gWAIUnivAttrMap[i].attributeName == aAtom)
         return nsARIAMap::gWAIUnivAttrMap[i].characteristics;
 
     return 0;
--- a/accessible/src/base/nsAccUtils.h
+++ b/accessible/src/base/nsAccUtils.h
@@ -39,32 +39,32 @@
 #ifndef nsAccUtils_h_
 #define nsAccUtils_h_
 
 #include "nsIAccessible.h"
 #include "nsIAccessibleRole.h"
 #include "nsIAccessibleText.h"
 #include "nsIAccessibleTable.h"
 
-#include "nsARIAMap.h"
 #include "nsAccessibilityService.h"
 #include "nsCoreUtils.h"
 
 #include "mozilla/dom/Element.h"
 #include "nsIDocShell.h"
 #include "nsIDOMNode.h"
 #include "nsIPersistentProperties2.h"
 #include "nsIPresShell.h"
 #include "nsPoint.h"
 
 class nsAccessNode;
 class nsAccessible;
 class nsHyperTextAccessible;
 class nsHTMLTableAccessible;
 class nsDocAccessible;
+struct nsRoleMapEntry;
 #ifdef MOZ_XUL
 class nsXULTreeAccessible;
 #endif
 
 class nsAccUtils
 {
 public:
   /**
@@ -245,26 +245,16 @@ public:
   /**
    * Returns coordinates relative screen for the parent of the given accessible.
    *
    * @param aAccessNode  the accessible
    */
   static nsIntPoint GetScreenCoordsForParent(nsAccessNode *aAccessNode);
 
   /**
-   * Get the role map entry for a given DOM node. This will use the first
-   * ARIA role if the role attribute provides a space delimited list of roles.
-   *
-   * @param aNode  [in] the DOM node to get the role map entry for
-   * @return        a pointer to the role map entry for the ARIA role, or nsnull
-   *                if none
-   */
-  static nsRoleMapEntry *GetRoleMapEntry(nsINode *aNode);
-
-  /**
    * Return the role of the given accessible.
    */
   static PRUint32 Role(nsIAccessible *aAcc)
   {
     PRUint32 role = nsIAccessibleRole::ROLE_NOTHING;
     if (aAcc)
       aAcc->GetRole(&role);
 
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -34,16 +34,17 @@
  * 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 "nsAccessibilityService.h"
 
 // NOTE: alphabetically ordered
+#include "Accessible-inl.h"
 #include "ARIAGridAccessibleWrap.h"
 #ifdef MOZ_ACCESSIBILITY_ATK
 #include "AtkSocketAccessible.h"
 #endif
 #include "FocusManager.h"
 #include "nsAccessiblePivot.h"
 #include "nsAccUtils.h"
 #include "nsARIAMap.h"
@@ -90,17 +91,17 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/Services.h"
 #include "mozilla/Util.h"
 
 #ifdef MOZ_XUL
 #include "nsXULAlertAccessible.h"
 #include "nsXULColorPickerAccessible.h"
 #include "nsXULComboboxAccessible.h"
-#include "nsXULFormControlAccessible.h"
+#include "XULFormControlAccessible.h"
 #include "nsXULListboxAccessibleWrap.h"
 #include "nsXULMenuAccessibleWrap.h"
 #include "nsXULSliderAccessible.h"
 #include "nsXULTabAccessible.h"
 #include "nsXULTextAccessible.h"
 #include "nsXULTreeGridAccessibleWrap.h"
 #endif
 
@@ -207,18 +208,18 @@ nsAccessibilityService::CreateOuterDocAc
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLButtonAccessible(nsIContent* aContent,
                                                    nsIPresShell* aPresShell)
 {
   nsAccessible* accessible = 
-    new nsHTMLButtonAccessible(aContent, 
-                               nsAccUtils::GetDocAccessibleFor(aPresShell));
+    new HTMLButtonAccessible(aContent, 
+                             nsAccUtils::GetDocAccessibleFor(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLLIAccessible(nsIContent* aContent,
                                                nsIPresShell* aPresShell)
 {
@@ -240,18 +241,18 @@ nsAccessibilityService::CreateHyperTextA
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIContent* aContent,
                                                      nsIPresShell* aPresShell)
 {
   nsAccessible* accessible = 
-    new nsHTMLCheckboxAccessible(aContent, 
-                                 nsAccUtils::GetDocAccessibleFor(aPresShell));
+    new HTMLCheckboxAccessible(aContent, 
+                               nsAccUtils::GetDocAccessibleFor(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLComboboxAccessible(nsIContent* aContent,
                                                      nsIPresShell* aPresShell)
 {
@@ -273,18 +274,18 @@ nsAccessibilityService::CreateHTMLCanvas
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLFileInputAccessible(nsIContent* aContent,
                                                       nsIPresShell* aPresShell)
 {
   nsAccessible* accessible = 
-    new nsHTMLFileInputAccessible(aContent, 
-                                  nsAccUtils::GetDocAccessibleFor(aPresShell));
+    new HTMLFileInputAccessible(aContent, 
+                                nsAccUtils::GetDocAccessibleFor(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
@@ -306,18 +307,18 @@ nsAccessibilityService::CreateHTMLImageM
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIContent* aContent,
                                                      nsIPresShell* aPresShell)
 {
   nsAccessible* accessible = 
-    new nsHTMLGroupboxAccessible(aContent, 
-                                 nsAccUtils::GetDocAccessibleFor(aPresShell));
+    new HTMLGroupboxAccessible(aContent, 
+                               nsAccUtils::GetDocAccessibleFor(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLListboxAccessible(nsIContent* aContent,
                                                     nsIPresShell* aPresShell)
 {
@@ -409,18 +410,18 @@ nsAccessibilityService::CreateHTMLObject
   return frame ? frame->CreateAccessible() : nsnull;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIContent* aContent,
                                                         nsIPresShell* aPresShell)
 {
   nsAccessible* accessible = 
-    new nsHTMLRadioButtonAccessible(aContent, 
-                                    nsAccUtils::GetDocAccessibleFor(aPresShell));
+    new HTMLRadioButtonAccessible(aContent, 
+                                  nsAccUtils::GetDocAccessibleFor(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLTableAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
@@ -453,18 +454,18 @@ nsAccessibilityService::CreateHTMLTextAc
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIContent* aContent,
                                                       nsIPresShell* aPresShell)
 {
   nsAccessible* accessible = 
-    new nsHTMLTextFieldAccessible(aContent, 
-                                  nsAccUtils::GetDocAccessibleFor(aPresShell));
+    new HTMLTextFieldAccessible(aContent, 
+                                nsAccUtils::GetDocAccessibleFor(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLLabelAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
@@ -1069,22 +1070,22 @@ nsAccessibilityService::GetOrCreateAcces
                                               weakFrame->GetParent()).IsEmpty()) {
       if (aIsSubtreeHidden)
         *aIsSubtreeHidden = true;
 
       return nsnull;
     }
 
     newAcc = new nsHyperTextAccessibleWrap(content, docAcc);
-    if (docAcc->BindToDocument(newAcc, nsAccUtils::GetRoleMapEntry(aNode)))
+    if (docAcc->BindToDocument(newAcc, aria::GetRoleMap(aNode)))
       return newAcc;
     return nsnull;
   }
 
-  nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aNode);
+  nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aNode);
   if (roleMapEntry && !nsCRT::strcmp(roleMapEntry->roleString, "presentation")) {
     // Ignore presentation role if element is focusable (focus event shouldn't
     // be ever lost and should be sensible).
     if (content->IsFocusable())
       roleMapEntry = nsnull;
     else
       return nsnull;
   }
@@ -1121,18 +1122,17 @@ nsAccessibilityService::GetOrCreateAcces
               if (role != roles::TABLE && role != roles::TREE_TABLE)
                 roleMapEntry = &nsARIAMap::gEmptyRoleMap;
             }
 
             break;
           }
 
 #ifdef DEBUG
-          nsRoleMapEntry *tableRoleMapEntry =
-            nsAccUtils::GetRoleMapEntry(tableContent);
+          nsRoleMapEntry* tableRoleMapEntry = aria::GetRoleMap(tableContent);
           NS_ASSERTION(tableRoleMapEntry &&
                        !nsCRT::strcmp(tableRoleMapEntry->roleString, "presentation"),
                        "No accessible for parent table and it didn't have role of presentation");
 #endif
 
           if (!roleMapEntry && !content->IsFocusable()) {
             // Table-related descendants of presentation table are also
             // presentation if they aren't focusable and have not explicit ARIA
@@ -1359,41 +1359,41 @@ nsAccessibilityService::CreateAccessible
       return nsnull;
 
     // XUL controls
     case nsIAccessibleProvider::XULAlert:
       accessible = new nsXULAlertAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULButton:
-      accessible = new nsXULButtonAccessible(aContent, aDoc);
+      accessible = new XULButtonAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULCheckbox:
-      accessible = new nsXULCheckboxAccessible(aContent, aDoc);
+      accessible = new XULCheckboxAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULColorPicker:
       accessible = new nsXULColorPickerAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULColorPickerTile:
       accessible = new nsXULColorPickerTileAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULCombobox:
       accessible = new nsXULComboboxAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULDropmarker:
-      accessible = new nsXULDropmarkerAccessible(aContent, aDoc);
+      accessible = new XULDropmarkerAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULGroupbox:
-      accessible = new nsXULGroupboxAccessible(aContent, aDoc);
+      accessible = new XULGroupboxAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULImage:
     {
       // Don't include nameless images in accessible tree.
       if (!aContent->HasAttr(kNameSpaceID_None,
                              nsGkAtoms::tooltiptext))
         return nsnull;
@@ -1460,29 +1460,29 @@ nsAccessibilityService::CreateAccessible
                                             roles::PANE);
       break;
 
     case nsIAccessibleProvider::XULProgressMeter:
       accessible = new XULProgressMeterAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULStatusBar:
-      accessible = new nsXULStatusBarAccessible(aContent, aDoc);
+      accessible = new XULStatusBarAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULScale:
       accessible = new nsXULSliderAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULRadioButton:
-      accessible = new nsXULRadioButtonAccessible(aContent, aDoc);
+      accessible = new XULRadioButtonAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULRadioGroup:
-      accessible = new nsXULRadioGroupAccessible(aContent, aDoc);
+      accessible = new XULRadioGroupAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULTab:
       accessible = new nsXULTabAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULTabs:
       accessible = new nsXULTabsAccessible(aContent, aDoc);
@@ -1492,17 +1492,17 @@ nsAccessibilityService::CreateAccessible
       accessible = new nsXULTabpanelsAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULText:
       accessible = new nsXULTextAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULTextBox:
-      accessible = new nsXULTextFieldAccessible(aContent, aDoc);
+      accessible = new XULTextFieldAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULThumb:
       accessible = new nsXULThumbAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULTree:
       return CreateAccessibleForXULTree(aContent, aDoc);
@@ -1511,29 +1511,29 @@ nsAccessibilityService::CreateAccessible
       accessible = new nsXULTreeColumnsAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULTreeColumnItem:
       accessible = new nsXULColumnItemAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULToolbar:
-      accessible = new nsXULToolbarAccessible(aContent, aDoc);
+      accessible = new XULToolbarAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULToolbarSeparator:
-      accessible = new nsXULToolbarSeparatorAccessible(aContent, aDoc);
+      accessible = new XULToolbarSeparatorAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULTooltip:
       accessible = new nsXULTooltipAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULToolbarButton:
-      accessible = new nsXULToolbarButtonAccessible(aContent, aDoc);
+      accessible = new XULToolbarButtonAccessible(aContent, aDoc);
       break;
 
 #endif // MOZ_XUL
 
     // XForms elements
     case nsIAccessibleProvider::XFormsContainer:
       accessible = new nsXFormsContainerAccessible(aContent, aDoc);
       break;
@@ -1621,30 +1621,29 @@ nsAccessibilityService::CreateAccessible
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
                                                      nsIContent* aContent,
                                                      nsDocAccessible* aDoc)
 {
   // This method assumes we're in an HTML namespace.
   nsIAtom* tag = aContent->Tag();
   if (tag == nsGkAtoms::figcaption) {
-    nsAccessible* accessible =
-      new nsHTMLFigcaptionAccessible(aContent, aDoc);
+    nsAccessible* accessible = new HTMLFigcaptionAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::figure) {
-    nsAccessible* accessible = new nsHTMLFigureAccessible(aContent, aDoc);
+    nsAccessible* accessible = new HTMLFigureAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::legend) {
-    nsAccessible* accessible = new nsHTMLLegendAccessible(aContent, aDoc);
+    nsAccessible* accessible = new HTMLLegendAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::option) {
     nsAccessible* accessible = new nsHTMLSelectOptionAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
@@ -1662,17 +1661,17 @@ nsAccessibilityService::CreateHTMLAccess
     nsAccessible* accessible = new nsHTMLListAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::a) {
     // Only some roles truly enjoy life as nsHTMLLinkAccessibles, for details
     // see closed bug 494807.
-    nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aContent);
+    nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aContent);
     if (roleMapEntry && roleMapEntry->role != roles::NOTHING &&
         roleMapEntry->role != roles::LINK) {
       nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent, aDoc);
       NS_IF_ADDREF(accessible);
       return accessible;
     }
 
     nsAccessible* accessible = new nsHTMLLinkAccessible(aContent, aDoc);
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -32,17 +32,17 @@
  * 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 "nsAccessible.h"
+#include "Accessible-inl.h"
 
 #include "nsIXBLAccessible.h"
 
 #include "AccGroupInfo.h"
 #include "AccIterator.h"
 #include "nsAccUtils.h"
 #include "nsAccEvent.h"
 #include "nsAccessibleRelation.h"
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -45,30 +45,30 @@
 
 #include "nsIAccessible.h"
 #include "nsIAccessibleHyperLink.h"
 #include "nsIAccessibleSelectable.h"
 #include "nsIAccessibleValue.h"
 #include "nsIAccessibleRole.h"
 #include "nsIAccessibleStates.h"
 
-#include "nsARIAMap.h"
 #include "nsStringGlue.h"
 #include "nsTArray.h"
 #include "nsRefPtrHashtable.h"
 
 class AccEvent;
 class AccGroupInfo;
 class EmbeddedObjCollector;
 class KeyBinding;
 class nsAccessible;
 class nsHyperTextAccessible;
 class nsHTMLImageAccessible;
 class nsHTMLImageMapAccessible;
 class nsHTMLLIAccessible;
+struct nsRoleMapEntry;
 class Relation;
 namespace mozilla {
 namespace a11y {
 class TableAccessible;
 }
 }
 class nsTextAccessible;
 class nsXULTreeAccessible;
@@ -175,43 +175,29 @@ public:
    *                           explicitly (see nsIAccessible::name attribute for
    *                           details)
    */
   virtual nsresult GetNameInternal(nsAString& aName);
 
   /**
    * Return enumerated accessible role (see constants in Role.h).
    */
-  inline mozilla::a11y::role Role()
-  {
-    if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
-      return ARIATransformRole(NativeRole());
-
-    return ARIATransformRole(mRoleMapEntry->role);
-  }
+  mozilla::a11y::role Role();
 
   /**
    * Return true if ARIA role is specified on the element.
    */
-  inline bool HasARIARole() const
-  {
-    return mRoleMapEntry;
-  }
+  bool HasARIARole() const
+    { return mRoleMapEntry; }
 
   /**
    * Return accessible role specified by ARIA (see constants in
    * roles).
    */
-  inline mozilla::a11y::role ARIARole()
-  {
-    if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
-      return mozilla::a11y::roles::NOTHING;
-
-    return ARIATransformRole(mRoleMapEntry->role);
-  }
+  mozilla::a11y::role ARIARole();
 
   /**
    * Returns enumerated accessible role from native markup (see constants in
    * Role.h). Doesn't take into account ARIA roles.
    */
   virtual mozilla::a11y::role NativeRole();
 
   /**
@@ -285,17 +271,17 @@ public:
 
   /**
    * Set the ARIA role map entry for a new accessible.
    * For a newly created accessible, specify which role map entry should be used.
    *
    * @param aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or 
    *                      nsnull if none.
    */
-  virtual void SetRoleMapEntry(nsRoleMapEntry *aRoleMapEntry);
+  virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
 
   /**
    * Update the children cache.
    */
   inline bool UpdateChildren()
   {
     InvalidateChildren();
     return EnsureChildren();
@@ -845,18 +831,21 @@ protected:
   PRUint32 mFlags;
 
   nsAutoPtr<EmbeddedObjCollector> mEmbeddedObjCollector;
   PRInt32 mIndexOfEmbeddedChild;
   friend class EmbeddedObjCollector;
 
   nsAutoPtr<AccGroupInfo> mGroupInfo;
   friend class AccGroupInfo;
-
-  nsRoleMapEntry *mRoleMapEntry; // Non-null indicates author-supplied role; possibly state & value as well
+  
+  /**
+   * Non-null indicates author-supplied role; possibly state & value as well
+   */
+  nsRoleMapEntry* mRoleMapEntry;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessible,
                               NS_ACCESSIBLE_IMPL_IID)
 
 
 /**
  * Represent key binding associated with accessible (such as access key and
--- a/accessible/src/base/nsAccessiblePivot.cpp
+++ b/accessible/src/base/nsAccessiblePivot.cpp
@@ -34,17 +34,17 @@
  * 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 "nsAccessiblePivot.h"
 
-#include "nsAccessible.h"
+#include "Accessible-inl.h"
 #include "nsAccUtils.h"
 #include "nsHyperTextAccessible.h"
 #include "States.h"
 
 #include "nsArrayUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsISupportsPrimitives.h"
 
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -34,16 +34,17 @@
  * 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 "nsBaseWidgetAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsHyperTextAccessibleWrap.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsGUIEvent.h"
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -31,16 +31,17 @@
  * 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 "Accessible-inl.h"
 #include "AccIterator.h"
 #include "nsAccCache.h"
 #include "nsAccessibilityService.h"
 #include "nsAccessiblePivot.h"
 #include "nsAccTreeWalker.h"
 #include "nsAccUtils.h"
 #include "nsRootAccessible.h"
 #include "nsTextEquivUtils.h"
@@ -279,17 +280,17 @@ nsDocAccessible::SetRoleMapEntry(nsRoleM
 
   nsIDocument *parentDoc = mDocument->GetParentDocument();
   if (!parentDoc)
     return; // No parent document for the root document
 
   // Allow use of ARIA role from outer to override
   nsIContent *ownerContent = parentDoc->FindContentForSubDocument(mDocument);
   if (ownerContent) {
-    nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(ownerContent);
+    nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(ownerContent);
     if (roleMapEntry)
       mRoleMapEntry = roleMapEntry; // Override
   }
 }
 
 void
 nsDocAccessible::Description(nsString& aDescription)
 {
@@ -1692,17 +1693,17 @@ nsDocAccessible::RemoveDependentIDsFor(n
 bool
 nsDocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
                                               nsIAtom* aAttribute)
 {
   if (aAttribute == nsGkAtoms::role) {
     // It is common for js libraries to set the role on the body element after
     // the document has loaded. In this case we just update the role map entry.
     if (mContent == aElement) {
-      SetRoleMapEntry(nsAccUtils::GetRoleMapEntry(aElement));
+      SetRoleMapEntry(aria::GetRoleMap(aElement));
       return true;
     }
 
     // Recreate the accessible when role is changed because we might require a
     // different accessible class for the new role or the accessible may expose
     // a different sets of interfaces (COM restriction).
     RecreateAccessible(aElement);
 
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -35,16 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/Util.h"
 
 #define CreateEvent CreateEventA
 #include "nsIDOMDocument.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsApplicationAccessibleWrap.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -34,19 +34,19 @@
  * 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 "nsTextEquivUtils.h"
 
+#include "Accessible-inl.h"
 #include "AccIterator.h"
 #include "nsAccessibilityService.h"
-#include "nsAccessible.h"
 #include "nsAccUtils.h"
 
 #include "nsIDOMXULLabeledControlEl.h"
 
 #include "nsArrayUtils.h"
 
 #define NS_OK_NO_NAME_CLAUSE_HANDLED \
 NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x24)
--- a/accessible/src/generic/ARIAGridAccessible.cpp
+++ b/accessible/src/generic/ARIAGridAccessible.cpp
@@ -33,16 +33,17 @@
  * 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 "ARIAGridAccessible.h"
 
+#include "Accessible-inl.h"
 #include "AccIterator.h"
 #include "nsAccUtils.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsIMutableArray.h"
 #include "nsComponentManagerUtils.h"
 
@@ -79,28 +80,16 @@ ARIAGridAccessible::Shutdown()
   mTable = nsnull;
   nsAccessibleWrap::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleTable
 
 NS_IMETHODIMP
-ARIAGridAccessible::GetSummary(nsAString& aSummary)
-{
-  aSummary.Truncate();
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  // XXX: should be pointed by aria-describedby on grid?
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 ARIAGridAccessible::GetColumnCount(PRInt32* aColumnCount)
 {
   NS_ENSURE_ARG_POINTER(aColumnCount);
   *aColumnCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
new file mode 100644
--- /dev/null
+++ b/accessible/src/generic/Accessible-inl.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_a11y_Accessible_inl_h_
+#define mozilla_a11y_Accessible_inl_h_
+
+#include "nsAccessible.h"
+#include "nsARIAMap.h"
+
+inline mozilla::a11y::role
+nsAccessible::Role()
+{
+  if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
+    return ARIATransformRole(NativeRole());
+
+  return ARIATransformRole(mRoleMapEntry->role);
+}
+
+inline mozilla::a11y::role
+nsAccessible::ARIARole()
+{
+  if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
+    return mozilla::a11y::roles::NOTHING;
+
+  return ARIATransformRole(mRoleMapEntry->role);
+}
+
+#endif
rename from accessible/src/base/nsFormControlAccessible.cpp
rename to accessible/src/generic/FormControlAccessible.cpp
--- a/accessible/src/base/nsFormControlAccessible.cpp
+++ b/accessible/src/generic/FormControlAccessible.cpp
@@ -34,62 +34,62 @@
  * 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 ***** */
 
 // NOTE: alphabetically ordered
 
+#include "FormControlAccessible.h"
 #include "Role.h"
 
-#include "nsFormControlAccessible.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULControlElement.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // ProgressMeterAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-template class ProgressMeterAccessible<1>;
-template class ProgressMeterAccessible<100>;
+template class mozilla::a11y::ProgressMeterAccessible<1>;
+template class mozilla::a11y::ProgressMeterAccessible<100>;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
 template<int Max>
-NS_IMPL_ADDREF_INHERITED(ProgressMeterAccessible<Max>, nsFormControlAccessible)
+NS_IMPL_ADDREF_INHERITED(ProgressMeterAccessible<Max>, nsLeafAccessible)
 
 template<int Max>
-NS_IMPL_RELEASE_INHERITED(ProgressMeterAccessible<Max>, nsFormControlAccessible)
+NS_IMPL_RELEASE_INHERITED(ProgressMeterAccessible<Max>, nsLeafAccessible)
 
 template<int Max>
 NS_IMPL_QUERY_INTERFACE_INHERITED1(ProgressMeterAccessible<Max>,
-                                   nsFormControlAccessible,
+                                   nsLeafAccessible,
                                    nsIAccessibleValue)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible
 
 template<int Max>
 role
 ProgressMeterAccessible<Max>::NativeRole()
 {
   return roles::PROGRESSBAR;
 }
 
 template<int Max>
 PRUint64
 ProgressMeterAccessible<Max>::NativeState()
 {
-  PRUint64 state = nsFormControlAccessible::NativeState();
+  PRUint64 state = nsLeafAccessible::NativeState();
 
   // An undetermined progressbar (i.e. without a value) has a mixed state.
   nsAutoString attrValue;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
 
   if (attrValue.IsEmpty())
     state |= states::MIXED;
 
@@ -108,43 +108,43 @@ ProgressMeterAccessible<Max>::IsWidget()
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleValue
 
 template<int Max>
 void
 ProgressMeterAccessible<Max>::Value(nsString& aValue)
 {
-  nsFormControlAccessible::Value(aValue);
+  nsLeafAccessible::Value(aValue);
   if (!aValue.IsEmpty())
     return;
 
   double maxValue = 0;
   nsresult rv = GetMaximumValue(&maxValue);
-  NS_ENSURE_SUCCESS(rv, );
-  if (maxValue == 0)
+  if (NS_FAILED(rv) || maxValue == 0)
     return;
 
   double curValue = 0;
   GetCurrentValue(&curValue);
-  NS_ENSURE_SUCCESS(rv, );
+  if (NS_FAILED(rv))
+    return;
 
   // Treat the current value bigger than maximum as 100%.
   double percentValue = (curValue < maxValue) ?
     (curValue / maxValue) * 100 : 100;
 
   aValue.AppendFloat(percentValue);
   aValue.AppendLiteral("%");
 }
 
 template<int Max>
 NS_IMETHODIMP
 ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
 {
-  nsresult rv = nsFormControlAccessible::GetMaximumValue(aMaximumValue);
+  nsresult rv = nsLeafAccessible::GetMaximumValue(aMaximumValue);
   if (rv != NS_OK_NO_ARIA_VALUE)
     return rv;
 
   nsAutoString value;
   if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) {
     PRInt32 result = NS_OK;
     *aMaximumValue = value.ToDouble(&result);
     return result;
@@ -153,41 +153,41 @@ ProgressMeterAccessible<Max>::GetMaximum
   *aMaximumValue = Max;
   return NS_OK;
 }
 
 template<int Max>
 NS_IMETHODIMP
 ProgressMeterAccessible<Max>::GetMinimumValue(double* aMinimumValue)
 {
-  nsresult rv = nsFormControlAccessible::GetMinimumValue(aMinimumValue);
+  nsresult rv = nsLeafAccessible::GetMinimumValue(aMinimumValue);
   if (rv != NS_OK_NO_ARIA_VALUE)
     return rv;
 
   *aMinimumValue = 0;
   return NS_OK;
 }
 
 template<int Max>
 NS_IMETHODIMP
 ProgressMeterAccessible<Max>::GetMinimumIncrement(double* aMinimumIncrement)
 {
-  nsresult rv = nsFormControlAccessible::GetMinimumIncrement(aMinimumIncrement);
+  nsresult rv = nsLeafAccessible::GetMinimumIncrement(aMinimumIncrement);
   if (rv != NS_OK_NO_ARIA_VALUE)
     return rv;
 
   *aMinimumIncrement = 0;
   return NS_OK;
 }
 
 template<int Max>
 NS_IMETHODIMP
 ProgressMeterAccessible<Max>::GetCurrentValue(double* aCurrentValue)
 {
-  nsresult rv = nsFormControlAccessible::GetCurrentValue(aCurrentValue);
+  nsresult rv = nsLeafAccessible::GetCurrentValue(aCurrentValue);
   if (rv != NS_OK_NO_ARIA_VALUE)
     return rv;
 
   nsAutoString attrValue;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
 
   // Return zero value if there is no attribute or its value is empty.
   if (attrValue.IsEmpty())
@@ -205,56 +205,57 @@ ProgressMeterAccessible<Max>::GetCurrent
 template<int Max>
 NS_IMETHODIMP
 ProgressMeterAccessible<Max>::SetCurrentValue(double aValue)
 {
   return NS_ERROR_FAILURE; // Progress meters are readonly.
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsRadioButtonAccessible
+// RadioButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsRadioButtonAccessible::
-  nsRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsFormControlAccessible(aContent, aDoc)
+RadioButtonAccessible::
+  RadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+  nsLeafAccessible(aContent, aDoc)
 {
 }
 
 PRUint8
-nsRadioButtonAccessible::ActionCount()
+RadioButtonAccessible::ActionCount()
 {
   return 1;
 }
 
-NS_IMETHODIMP nsRadioButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+NS_IMETHODIMP
+RadioButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {
     aName.AssignLiteral("select"); 
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 NS_IMETHODIMP
-nsRadioButtonAccessible::DoAction(PRUint8 aIndex)
+RadioButtonAccessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex != eAction_Click)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
 role
-nsRadioButtonAccessible::NativeRole()
+RadioButtonAccessible::NativeRole()
 {
   return roles::RADIOBUTTON;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsRadioButtonAccessible: Widgets
+// RadioButtonAccessible: Widgets
 
 bool
-nsRadioButtonAccessible::IsWidget() const
+RadioButtonAccessible::IsWidget() const
 {
   return true;
 }
rename from accessible/src/base/nsFormControlAccessible.h
rename to accessible/src/generic/FormControlAccessible.h
--- a/accessible/src/base/nsFormControlAccessible.h
+++ b/accessible/src/generic/FormControlAccessible.h
@@ -31,32 +31,33 @@
  * 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 _nsFormControlAccessible_H_
-#define _nsFormControlAccessible_H_
+#ifndef MOZILLA_A11Y_FormControlAccessible_H_
+#define MOZILLA_A11Y_FormControlAccessible_H_
 
 #include "nsBaseWidgetAccessible.h"
 
-typedef nsLeafAccessible nsFormControlAccessible;
+namespace mozilla {
+namespace a11y {
 
 /**
   * Generic class used for progress meters.
   */
 template<int Max>
-class ProgressMeterAccessible: public nsFormControlAccessible
+class ProgressMeterAccessible : public nsLeafAccessible
 {
 public:
   ProgressMeterAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-    nsFormControlAccessible(aContent, aDoc)
+    nsLeafAccessible(aContent, aDoc)
   {
   }
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLEVALUE
 
   // nsAccessible
   virtual void Value(nsString& aValue);
@@ -65,21 +66,21 @@ public:
 
   // Widgets
   virtual bool IsWidget() const;
 };
 
 /**
   * Generic class used for radio buttons.
   */
-class nsRadioButtonAccessible : public nsFormControlAccessible
+class RadioButtonAccessible : public nsLeafAccessible
 {
 
 public:
-  nsRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  RadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
 
@@ -87,11 +88,13 @@ public:
   virtual PRUint8 ActionCount();
 
   enum { eAction_Click = 0 };
 
   // Widgets
   virtual bool IsWidget() const;
 };
 
+} // namespace a11y
+} // namespace mozilla
 
 #endif
 
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -11,16 +11,17 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_generic_s
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   ARIAGridAccessible.cpp \
+  FormControlAccessible.cpp \
   OuterDocAccessible.cpp \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
rename from accessible/src/html/nsHTMLFormControlAccessible.cpp
rename to accessible/src/html/HTMLFormControlAccessible.cpp
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/HTMLFormControlAccessible.cpp
@@ -31,19 +31,21 @@
  * 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 "nsHTMLFormControlAccessible.h"
+#include "HTMLFormControlAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccUtils.h"
+#include "nsARIAMap.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsIAccessibleRelation.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLInputElement.h"
@@ -59,38 +61,39 @@
 #include "jsapi.h"
 #include "nsIJSContextStack.h"
 #include "nsIServiceManager.h"
 #include "nsITextControlFrame.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLCheckboxAccessible
+// HTMLCheckboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLCheckboxAccessible::
-  nsHTMLCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsFormControlAccessible(aContent, aDoc)
+HTMLCheckboxAccessible::
+  HTMLCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+  nsLeafAccessible(aContent, aDoc)
 {
 }
 
 role
-nsHTMLCheckboxAccessible::NativeRole()
+HTMLCheckboxAccessible::NativeRole()
 {
   return roles::CHECKBUTTON;
 }
 
 PRUint8
-nsHTMLCheckboxAccessible::ActionCount()
+HTMLCheckboxAccessible::ActionCount()
 {
   return 1;
 }
 
-NS_IMETHODIMP nsHTMLCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+NS_IMETHODIMP
+HTMLCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {    // 0 is the magic value for default action
     // cycle, check or uncheck
     PRUint64 state = NativeState();
 
     if (state & states::CHECKED)
       aName.AssignLiteral("uncheck"); 
     else if (state & states::MIXED)
@@ -99,29 +102,29 @@ NS_IMETHODIMP nsHTMLCheckboxAccessible::
       aName.AssignLiteral("check"); 
 
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 NS_IMETHODIMP
-nsHTMLCheckboxAccessible::DoAction(PRUint8 aIndex)
+HTMLCheckboxAccessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex != 0)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
 PRUint64
-nsHTMLCheckboxAccessible::NativeState()
+HTMLCheckboxAccessible::NativeState()
 {
-  PRUint64 state = nsFormControlAccessible::NativeState();
+  PRUint64 state = nsLeafAccessible::NativeState();
 
   state |= states::CHECKABLE;
   bool checkState = false;   // Radio buttons and check boxes can be checked or mixed
 
   nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement =
     do_QueryInterface(mContent);
            
   if (htmlCheckboxElement) {
@@ -135,37 +138,37 @@ nsHTMLCheckboxAccessible::NativeState()
       if (checkState)
         state |= states::CHECKED;
     }
   }
   return state;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLCheckboxAccessible: Widgets
+// HTMLCheckboxAccessible: Widgets
 
 bool
-nsHTMLCheckboxAccessible::IsWidget() const
+HTMLCheckboxAccessible::IsWidget() const
 {
   return true;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLRadioButtonAccessible
+// HTMLRadioButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLRadioButtonAccessible::
-  nsHTMLRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsRadioButtonAccessible(aContent, aDoc)
+HTMLRadioButtonAccessible::
+  HTMLRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+  RadioButtonAccessible(aContent, aDoc)
 {
 }
 
 PRUint64
-nsHTMLRadioButtonAccessible::NativeState()
+HTMLRadioButtonAccessible::NativeState()
 {
   PRUint64 state = nsAccessibleWrap::NativeState();
 
   state |= states::CHECKABLE;
   
   bool checked = false;   // Radio buttons and check boxes can be checked
 
   nsCOMPtr<nsIDOMHTMLInputElement> htmlRadioElement =
@@ -175,18 +178,18 @@ nsHTMLRadioButtonAccessible::NativeState
 
   if (checked)
     state |= states::CHECKED;
 
   return state;
 }
 
 void
-nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
-                                                        PRInt32 *aSetSize)
+HTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32* aPosInSet,
+                                                      PRInt32* aSetSize)
 {
   nsAutoString nsURI;
   mContent->NodeInfo()->GetNamespaceURI(nsURI);
   nsAutoString tagName;
   mContent->NodeInfo()->GetName(tagName);
 
   nsAutoString type;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
@@ -234,52 +237,53 @@ nsHTMLRadioButtonAccessible::GetPosition
     }
   }
 
   *aPosInSet = indexOf;
   *aSetSize = count;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLButtonAccessible
+// HTMLButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLButtonAccessible::
-  nsHTMLButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+HTMLButtonAccessible::
+  HTMLButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 PRUint8
-nsHTMLButtonAccessible::ActionCount()
+HTMLButtonAccessible::ActionCount()
 {
   return 1;
 }
 
-NS_IMETHODIMP nsHTMLButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+NS_IMETHODIMP
+HTMLButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {
     aName.AssignLiteral("press"); 
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 NS_IMETHODIMP
-nsHTMLButtonAccessible::DoAction(PRUint8 aIndex)
+HTMLButtonAccessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex != eAction_Click)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
 PRUint64
-nsHTMLButtonAccessible::State()
+HTMLButtonAccessible::State()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::State();
   if (state == states::DEFUNCT)
     return state;
 
   // Inherit states from input@type="file" suitable for the button. Note,
   // no special processing for unavailable state since inheritance is supplied
   // other code paths.
@@ -288,35 +292,35 @@ nsHTMLButtonAccessible::State()
     state |= parentState & (states::BUSY | states::REQUIRED |
                             states::HASPOPUP | states::INVALID);
   }
 
   return state;
 }
 
 PRUint64
-nsHTMLButtonAccessible::NativeState()
+HTMLButtonAccessible::NativeState()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
 
   nsEventStates elmState = mContent->AsElement()->State();
   if (elmState.HasState(NS_EVENT_STATE_DEFAULT))
     state |= states::DEFAULT;
 
   return state;
 }
 
 role
-nsHTMLButtonAccessible::NativeRole()
+HTMLButtonAccessible::NativeRole()
 {
   return roles::PUSHBUTTON;
 }
 
 nsresult
-nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
+HTMLButtonAccessible::GetNameInternal(nsAString& aName)
 {
   nsAccessible::GetNameInternal(aName);
   if (!aName.IsEmpty() || mContent->Tag() != nsGkAtoms::input)
     return NS_OK;
 
   // No name from HTML or ARIA
   nsAutoString name;
   if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value,
@@ -339,50 +343,54 @@ nsHTMLButtonAccessible::GetNameInternal(
 
   name.CompressWhitespace();
   aName = name;
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLButtonAccessible: Widgets
+// HTMLButtonAccessible: Widgets
 
 bool
-nsHTMLButtonAccessible::IsWidget() const
+HTMLButtonAccessible::IsWidget() const
 {
   return true;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLTextFieldAccessible
+// HTMLTextFieldAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLTextFieldAccessible::
-  nsHTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+HTMLTextFieldAccessible::
+  HTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
+NS_IMPL_ISUPPORTS_INHERITED3(HTMLTextFieldAccessible,
+                             nsAccessible,
+                             nsHyperTextAccessible,
+                             nsIAccessibleText,
+                             nsIAccessibleEditableText)
 
 role
-nsHTMLTextFieldAccessible::NativeRole()
+HTMLTextFieldAccessible::NativeRole()
 {
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::password, eIgnoreCase)) {
     return roles::PASSWORD_TEXT;
   }
   
   return roles::ENTRY;
 }
 
 nsresult
-nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
+HTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = nsAccessible::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aName.IsEmpty())
     return NS_OK;
 
   if (mContent->GetBindingParent())
@@ -402,17 +410,17 @@ nsHTMLTextFieldAccessible::GetNameIntern
 
   // text inputs and textareas might have useful placeholder text
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, aName);
 
   return NS_OK;
 }
 
 void
-nsHTMLTextFieldAccessible::Value(nsString& aValue)
+HTMLTextFieldAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
   if (NativeState() & states::PROTECTED)    // Don't return password text!
     return;
 
   nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mContent));
   if (textArea) {
     textArea->GetValue(aValue);
@@ -421,25 +429,25 @@ nsHTMLTextFieldAccessible::Value(nsStrin
   
   nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mContent));
   if (inputElement) {
     inputElement->GetValue(aValue);
   }
 }
 
 void
-nsHTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState)
+HTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState)
 {
   nsHyperTextAccessibleWrap::ApplyARIAState(aState);
 
   aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
 }
 
 PRUint64
-nsHTMLTextFieldAccessible::State()
+HTMLTextFieldAccessible::State()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::State();
   if (state & states::DEFUNCT)
     return state;
 
   // Inherit states from input@type="file" suitable for the button. Note,
   // no special processing for unavailable state since inheritance is supplied
   // by other code paths.
@@ -448,17 +456,17 @@ nsHTMLTextFieldAccessible::State()
     state |= parentState & (states::BUSY | states::REQUIRED |
       states::HASPOPUP | states::INVALID);
   }
 
   return state;
 }
 
 PRUint64
-nsHTMLTextFieldAccessible::NativeState()
+HTMLTextFieldAccessible::NativeState()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
 
   // can be focusable, focused, protected. readonly, unavailable, selected
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::password, eIgnoreCase)) {
     state |= states::PROTECTED;
   }
@@ -511,44 +519,46 @@ nsHTMLTextFieldAccessible::NativeState()
         state |= states::SUPPORTS_AUTOCOMPLETION;
     }
   }
 
   return state;
 }
 
 PRUint8
-nsHTMLTextFieldAccessible::ActionCount()
+HTMLTextFieldAccessible::ActionCount()
 {
   return 1;
 }
 
-NS_IMETHODIMP nsHTMLTextFieldAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+NS_IMETHODIMP
+HTMLTextFieldAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {
     aName.AssignLiteral("activate");
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
-NS_IMETHODIMP nsHTMLTextFieldAccessible::DoAction(PRUint8 index)
+NS_IMETHODIMP
+HTMLTextFieldAccessible::DoAction(PRUint8 aIndex)
 {
-  if (index == 0) {
+  if (aIndex == 0) {
     nsCOMPtr<nsIDOMHTMLElement> element(do_QueryInterface(mContent));
-    if ( element ) {
+    if (element)
       return element->Focus();
-    }
+
     return NS_ERROR_FAILURE;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 already_AddRefed<nsIEditor>
-nsHTMLTextFieldAccessible::GetEditor() const
+HTMLTextFieldAccessible::GetEditor() const
 {
   nsCOMPtr<nsIDOMNSEditableElement> editableElt(do_QueryInterface(mContent));
   if (!editableElt)
     return nsnull;
 
   // nsGenericHTMLElement::GetEditor has a security check.
   // Make sure we're not restricted by the permissions of
   // whatever script is currently running.
@@ -564,52 +574,52 @@ nsHTMLTextFieldAccessible::GetEditor() c
     stack->Pop(&cx);
     NS_ASSERTION(!cx, "context should be null");
   }
 
   return editor.forget();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLTextFieldAccessible: Widgets
+// HTMLTextFieldAccessible: Widgets
 
 bool
-nsHTMLTextFieldAccessible::IsWidget() const
+HTMLTextFieldAccessible::IsWidget() const
 {
   return true;
 }
 
 nsAccessible*
-nsHTMLTextFieldAccessible::ContainerWidget() const
+HTMLTextFieldAccessible::ContainerWidget() const
 {
   return mParent && mParent->Role() == roles::AUTOCOMPLETE ? mParent : nsnull;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLGroupboxAccessible
+// HTMLFileInputAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLFileInputAccessible::
-nsHTMLFileInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+HTMLFileInputAccessible::
+HTMLFileInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
   mFlags |= eHTMLFileInputAccessible;
 }
 
 role
-nsHTMLFileInputAccessible::NativeRole()
+HTMLFileInputAccessible::NativeRole()
 {
   // JAWS wants a text container, others don't mind. No specific role in
   // AT APIs.
   return roles::TEXT_CONTAINER;
 }
 
 nsresult
-nsHTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
+HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
 {
   nsresult rv = nsHyperTextAccessibleWrap::HandleAccEvent(aEvent);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Redirect state change events for inherited states to child controls. Note,
   // unavailable state is not redirected. That's a standard for unavailable
   // state handling.
   AccStateChangeEvent* event = downcast_accEvent(aEvent);
@@ -635,48 +645,48 @@ nsHTMLFileInputAccessible::HandleAccEven
                                 (event->IsFromUserInput() ? eFromUserInput : eNoUserInput));
       nsEventShell::FireEvent(childEvent);
     }
   }
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLGroupboxAccessible
+// HTMLGroupboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLGroupboxAccessible::
-  nsHTMLGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+HTMLGroupboxAccessible::
+  HTMLGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 role
-nsHTMLGroupboxAccessible::NativeRole()
+HTMLGroupboxAccessible::NativeRole()
 {
   return roles::GROUPING;
 }
 
 nsIContent*
-nsHTMLGroupboxAccessible::GetLegend()
+HTMLGroupboxAccessible::GetLegend()
 {
   for (nsIContent* legendContent = mContent->GetFirstChild(); legendContent;
        legendContent = legendContent->GetNextSibling()) {
     if (legendContent->NodeInfo()->Equals(nsGkAtoms::legend,
                                           mContent->GetNameSpaceID())) {
       // Either XHTML namespace or no namespace
       return legendContent;
     }
   }
 
   return nsnull;
 }
 
 nsresult
-nsHTMLGroupboxAccessible::GetNameInternal(nsAString& aName)
+HTMLGroupboxAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = nsAccessible::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aName.IsEmpty())
     return NS_OK;
 
   nsIContent *legendContent = GetLegend();
@@ -684,86 +694,86 @@ nsHTMLGroupboxAccessible::GetNameInterna
     return nsTextEquivUtils::
       AppendTextEquivFromContent(this, legendContent, &aName);
   }
 
   return NS_OK;
 }
 
 Relation
-nsHTMLGroupboxAccessible::RelationByType(PRUint32 aType)
+HTMLGroupboxAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
     // No override for label, so use <legend> for this <fieldset>
   if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
     rel.AppendTarget(GetLegend());
 
   return rel;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLLegendAccessible
+// HTMLLegendAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLLegendAccessible::
-  nsHTMLLegendAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+HTMLLegendAccessible::
+  HTMLLegendAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 Relation
-nsHTMLLegendAccessible::RelationByType(PRUint32 aType)
+HTMLLegendAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
     return rel;
 
   nsAccessible* groupbox = Parent();
   if (groupbox && groupbox->Role() == roles::GROUPING)
     rel.AppendTarget(groupbox);
 
   return rel;
 }
 
 role
-nsHTMLLegendAccessible::NativeRole()
+HTMLLegendAccessible::NativeRole()
 {
   return roles::LABEL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLFigureAccessible
+// HTMLFigureAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLFigureAccessible::
-  nsHTMLFigureAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+HTMLFigureAccessible::
+  HTMLFigureAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 nsresult
-nsHTMLFigureAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
+HTMLFigureAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expose figure xml-role.
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
                          NS_LITERAL_STRING("figure"));
   return NS_OK;
 }
 
 role
-nsHTMLFigureAccessible::NativeRole()
+HTMLFigureAccessible::NativeRole()
 {
   return roles::FIGURE;
 }
 
 nsresult
-nsHTMLFigureAccessible::GetNameInternal(nsAString& aName)
+HTMLFigureAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aName.IsEmpty())
     return NS_OK;
 
   nsIContent* captionContent = Caption();
@@ -771,57 +781,57 @@ nsHTMLFigureAccessible::GetNameInternal(
     return nsTextEquivUtils::
       AppendTextEquivFromContent(this, captionContent, &aName);
   }
 
   return NS_OK;
 }
 
 Relation
-nsHTMLFigureAccessible::RelationByType(PRUint32 aType)
+HTMLFigureAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
   if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
     rel.AppendTarget(Caption());
 
   return rel;
 }
 
 nsIContent*
-nsHTMLFigureAccessible::Caption() const
+HTMLFigureAccessible::Caption() const
 {
   for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
        childContent = childContent->GetNextSibling()) {
     if (childContent->NodeInfo()->Equals(nsGkAtoms::figcaption,
                                          mContent->GetNameSpaceID())) {
       return childContent;
     }
   }
 
   return nsnull;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLFigcaptionAccessible
+// HTMLFigcaptionAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLFigcaptionAccessible::
-  nsHTMLFigcaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+HTMLFigcaptionAccessible::
+  HTMLFigcaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 role
-nsHTMLFigcaptionAccessible::NativeRole()
+HTMLFigcaptionAccessible::NativeRole()
 {
   return roles::CAPTION;
 }
 
 Relation
-nsHTMLFigcaptionAccessible::RelationByType(PRUint32 aType)
+HTMLFigcaptionAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
     return rel;
 
   nsAccessible* figure = Parent();
   if (figure &&
       figure->GetContent()->NodeInfo()->Equals(nsGkAtoms::figure,
rename from accessible/src/html/nsHTMLFormControlAccessible.h
rename to accessible/src/html/HTMLFormControlAccessible.h
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/HTMLFormControlAccessible.h
@@ -31,37 +31,40 @@
  * 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 _nsHTMLFormControlAccessible_H_
-#define _nsHTMLFormControlAccessible_H_
+#ifndef MOZILLA_A11Y_HTMLFormControlAccessible_H_
+#define MOZILLA_A11Y_HTMLFormControlAccessible_H_
 
-#include "nsFormControlAccessible.h"
+#include "FormControlAccessible.h"
 #include "nsHyperTextAccessibleWrap.h"
 
+namespace mozilla {
+namespace a11y {
+
 /**
  * Accessible for HTML progress element.
  */
 typedef ProgressMeterAccessible<1> HTMLProgressMeterAccessible;
 
 /**
  * Accessible for HTML input@type="checkbox".
  */
-class nsHTMLCheckboxAccessible : public nsFormControlAccessible
+class HTMLCheckboxAccessible : public nsLeafAccessible
 {
 
 public:
   enum { eAction_Click = 0 };
 
-  nsHTMLCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
@@ -72,40 +75,40 @@ public:
   // Widgets
   virtual bool IsWidget() const;
 };
 
 
 /**
  * Accessible for HTML input@type="radio" element.
  */
-class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
+class HTMLRadioButtonAccessible : public RadioButtonAccessible
 {
 
 public:
-  nsHTMLRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual PRUint64 NativeState();
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
 };
 
 
 /**
  * Accessible for HTML input@type="button", @type="submit", @type="image"
  * and HTML button elements.
  */
-class nsHTMLButtonAccessible : public nsHyperTextAccessibleWrap
+class HTMLButtonAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
 
-  nsHTMLButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
@@ -118,23 +121,23 @@ public:
   // Widgets
   virtual bool IsWidget() const;
 };
 
 
 /**
  * Accessible for HTML input@type="text" element.
  */
-class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
+class HTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
 
-  nsHTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsHyperTextAccessible
@@ -155,82 +158,85 @@ public:
   virtual bool IsWidget() const;
   virtual nsAccessible* ContainerWidget() const;
 };
 
 
 /**
  * Accessible for input@type="file" element.
  */
-class nsHTMLFileInputAccessible : public nsHyperTextAccessibleWrap
+class HTMLFileInputAccessible : public nsHyperTextAccessibleWrap
 {
 public:
-  nsHTMLFileInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLFileInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
 };
 
 /**
  * Accessible for HTML fieldset element.
  */
-class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
+class HTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
 {
 public:
-  nsHTMLGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 
 protected:
   nsIContent* GetLegend();
 };
 
 
 /**
  * Accessible for HTML legend element.
  */
-class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap
+class HTMLLegendAccessible : public nsHyperTextAccessibleWrap
 {
 public:
-  nsHTMLLegendAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLLegendAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 };
 
 /**
  * Accessible for HTML5 figure element.
  */
-class nsHTMLFigureAccessible : public nsHyperTextAccessibleWrap
+class HTMLFigureAccessible : public nsHyperTextAccessibleWrap
 {
 public:
-  nsHTMLFigureAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLFigureAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 
 protected:
   nsIContent* Caption() const;
 };
 
 
 /**
  * Accessible for HTML5 figcaption element.
  */
-class nsHTMLFigcaptionAccessible : public nsHyperTextAccessibleWrap
+class HTMLFigcaptionAccessible : public nsHyperTextAccessibleWrap
 {
 public:
-  nsHTMLFigcaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  HTMLFigcaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/html/Makefile.in
+++ b/accessible/src/html/Makefile.in
@@ -46,35 +46,36 @@ include $(DEPTH)/config/autoconf.mk
 MODULE = accessibility
 LIBRARY_NAME = accessibility_html_s
 LIBXUL_LIBRARY = 1
 
 
 
 CPPSRCS = \
   nsHTMLCanvasAccessible.cpp \
-  nsHTMLFormControlAccessible.cpp \
+  HTMLFormControlAccessible.cpp \
   nsHTMLImageAccessible.cpp \
   nsHTMLImageMapAccessible.cpp \
   nsHTMLLinkAccessible.cpp \
   nsHTMLSelectAccessible.cpp \
   nsHTMLTableAccessible.cpp \
   nsHTMLTextAccessible.cpp \
   nsHyperTextAccessible.cpp \
   $(NULL)
 
 EXPORTS = \
   nsHyperTextAccessible.h \
-  nsHTMLFormControlAccessible.h \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES = \
   -I$(srcdir)/../base \
   -I$(srcdir)/../generic \
   -I$(srcdir)/../xpcom \
+  -I$(srcdir)/../../../content/base/src \
+  -I$(srcdir)/../../../content/html/content/src \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/xul/base/src \
   $(NULL)
--- a/accessible/src/html/nsHTMLImageAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageAccessible.cpp
@@ -35,20 +35,22 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsHTMLImageAccessible.h"
 
 #include "nsAccUtils.h"
 #include "Role.h"
+#include "AccIterator.h"
 #include "States.h"
 
 #include "imgIContainer.h"
 #include "imgIRequest.h"
+#include "nsGenericHTMLElement.h"
 #include "nsIDocument.h"
 #include "nsIImageLoadingContent.h"
 #include "nsILink.h"
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIDOMDocument.h"
 #include "nsPIDOMWindow.h"
@@ -141,47 +143,50 @@ nsHTMLImageAccessible::ActionCount()
 NS_IMETHODIMP
 nsHTMLImageAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   aName.Truncate();
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  if (IsValidLongDescIndex(aIndex)) {
+  if (IsLongDescIndex(aIndex) && HasLongDesc()) {
     aName.AssignLiteral("showlongdesc"); 
     return NS_OK;
   }
   return nsLinkableAccessible::GetActionName(aIndex, aName);
 }
 
 NS_IMETHODIMP
 nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  if (IsValidLongDescIndex(aIndex)) {
-    //get the long description uri and open in a new window
-    nsCOMPtr<nsIDOMHTMLImageElement> element(do_QueryInterface(mContent));
-    NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
+  // Get the long description uri and open in a new window.
+  if (!IsLongDescIndex(aIndex))
+    return nsLinkableAccessible::DoAction(aIndex);
 
-    nsAutoString longDesc;
-    nsresult rv = element->GetLongDesc(longDesc);
-    NS_ENSURE_SUCCESS(rv, rv);
+  nsCOMPtr<nsIURI> uri = GetLongDescURI();
+  if (!uri)
+    return NS_ERROR_INVALID_ARG;
 
-    nsIDocument* document = mContent->OwnerDoc();
-    nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
-    nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(piWindow);
-    NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
-    nsCOMPtr<nsIDOMWindow> tmp;
-    return win->Open(longDesc, EmptyString(), EmptyString(),
-                     getter_AddRefs(tmp));
-  }
-  return nsLinkableAccessible::DoAction(aIndex);
+  nsCAutoString utf8spec;
+  uri->GetSpec(utf8spec);
+  NS_ConvertUTF8toUTF16 spec(utf8spec);
+
+  nsIDocument* document = mContent->OwnerDoc();
+  nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
+  nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(piWindow);
+  NS_ENSURE_STATE(win);
+
+  nsCOMPtr<nsIDOMWindow> tmp;
+  return win->Open(spec, EmptyString(), EmptyString(),
+                   getter_AddRefs(tmp));
+
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleImage
 
 NS_IMETHODIMP
 nsHTMLImageAccessible::GetImagePosition(PRUint32 aCoordType,
                                         PRInt32 *aX, PRInt32 *aY)
@@ -217,25 +222,46 @@ nsHTMLImageAccessible::GetAttributesInte
     nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::src, src);
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Private methods
 
-bool
-nsHTMLImageAccessible::HasLongDesc()
+already_AddRefed<nsIURI>
+nsHTMLImageAccessible::GetLongDescURI() const
 {
-  if (IsDefunct())
-    return false;
+  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc)) {
+    nsGenericHTMLElement* element = 
+      nsGenericHTMLElement::FromContent(mContent);
+    if (element) {
+      nsCOMPtr<nsIURI> uri;
+      element->GetURIAttr(nsGkAtoms::longdesc, nsnull, getter_AddRefs(uri));
+      return uri.forget();
+    }
+  }
 
-  return mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc);
+  nsDocAccessible* document = Document();
+  if (document) {
+    IDRefsIterator iter(document, mContent, nsGkAtoms::aria_describedby);
+    while (nsIContent* target = iter.NextElem()) {
+      if ((target->IsHTML(nsGkAtoms::a) || target->IsHTML(nsGkAtoms::area)) &&
+          target->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
+        nsGenericHTMLElement* element =
+          nsGenericHTMLElement::FromContent(target);
+
+        nsCOMPtr<nsIURI> uri;
+        element->GetURIAttr(nsGkAtoms::href, nsnull, getter_AddRefs(uri));
+        return uri.forget();
+      }
+    }
+  }
+
+  return nsnull;
 }
 
 bool
-nsHTMLImageAccessible::IsValidLongDescIndex(PRUint8 aIndex)
+nsHTMLImageAccessible::IsLongDescIndex(PRUint8 aIndex)
 {
-  if (!HasLongDesc())
-    return false;
-
   return aIndex == nsLinkableAccessible::ActionCount();
 }
+
--- a/accessible/src/html/nsHTMLImageAccessible.h
+++ b/accessible/src/html/nsHTMLImageAccessible.h
@@ -37,16 +37,18 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsHTMLImageAccessible_H_
 #define _nsHTMLImageAccessible_H_
 
 #include "nsBaseWidgetAccessible.h"
 #include "nsIAccessibleImage.h"
 
+class nsGenericHTMLElement;
+
 /* Accessible for supporting images
  * supports:
  * - gets name, role
  * - support basic state
  */
 class nsHTMLImageAccessible : public nsLinkableAccessible,
                               public nsIAccessibleImage
 {
@@ -69,36 +71,47 @@ public:
   virtual PRUint64 NativeState();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 private:
   /**
-   * Determine if this image accessible has a longdesc attribute.
-   *
-   * @returns  true if the longdesc attribute is present.
+   * Return whether the element has a longdesc URI.
    */
-  bool HasLongDesc();
-  
+  bool HasLongDesc() const
+  {
+    nsCOMPtr<nsIURI> uri = GetLongDescURI();
+    return uri;
+  }
+
+  /**
+   * Return an URI for showlongdesc action if any.
+   */
+  already_AddRefed<nsIURI> GetLongDescURI() const;
+
   /**
    * Used by GetActionName and DoAction to ensure the index for opening the
    * longdesc URL is valid.
    * It is always assumed that the highest possible index opens the longdesc.
+   * This doesn't check that there is actually a longdesc, just that the index
+   * would be correct if there was one.
    *
    * @param aIndex  The 0-based index to be tested.
    *
    * @returns  true if index is valid for longdesc action.
    */
-  bool IsValidLongDescIndex(PRUint8 aIndex);
+  inline bool IsLongDescIndex(PRUint8 aIndex);
+
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible downcasting method
+
 inline nsHTMLImageAccessible*
 nsAccessible::AsImage()
 {
   return IsImageAccessible() ?
     static_cast<nsHTMLImageAccessible*>(this) : nsnull;
 }
 
 #endif
--- a/accessible/src/html/nsHTMLImageMapAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageMapAccessible.cpp
@@ -35,16 +35,17 @@
  * 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 "nsHTMLImageMapAccessible.h"
 
 #include "nsAccUtils.h"
+#include "nsARIAMap.h"
 #include "nsDocAccessible.h"
 #include "Role.h"
 
 #include "nsIDOMHTMLCollection.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIFrame.h"
@@ -137,17 +138,17 @@ nsHTMLImageMapAccessible::UpdateChildAre
   // Insert new areas into the tree.
   PRUint32 areaElmCount = imageMapObj->AreaCount();
   for (PRUint32 idx = 0; idx < areaElmCount; idx++) {
     nsIContent* areaContent = imageMapObj->GetAreaAt(idx);
 
     nsAccessible* area = mChildren.SafeElementAt(idx);
     if (!area || area->GetContent() != areaContent) {
       nsRefPtr<nsAccessible> area = new nsHTMLAreaAccessible(areaContent, mDoc);
-      if (!mDoc->BindToDocument(area, nsAccUtils::GetRoleMapEntry(areaContent)))
+      if (!mDoc->BindToDocument(area, aria::GetRoleMap(areaContent)))
         break;
 
       if (!InsertChildAt(idx, area)) {
         mDoc->UnbindFromDocument(area);
         break;
       }
 
       if (aDoFireEvents) {
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -33,16 +33,17 @@
  * 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 "nsHTMLSelectAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "nsEventShell.h"
 #include "nsIAccessibleEvent.h"
 #include "nsTextEquivUtils.h"
 #include "Role.h"
 #include "States.h"
--- a/accessible/src/html/nsHTMLSelectAccessible.h
+++ b/accessible/src/html/nsHTMLSelectAccessible.h
@@ -34,17 +34,17 @@
  * 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 __nsHTMLSelectAccessible_h__
 #define __nsHTMLSelectAccessible_h__
 
-#include "nsHTMLFormControlAccessible.h"
+#include "HTMLFormControlAccessible.h"
 #include "nsIDOMHTMLOptionsCollection.h"
 #include "nsIDOMHTMLOptionElement.h"
 #include "nsIDOMNode.h"
 
 class nsIMutableArray;
 
 /**
   *  Selects, Listboxes and Comboboxes, are made up of a number of different
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -34,16 +34,17 @@
  * 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 "nsHTMLTableAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccTreeWalker.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
@@ -548,23 +549,23 @@ nsHTMLTableAccessible::RelationByType(PR
 
 nsAccessible*
 nsHTMLTableAccessible::Caption()
 {
   nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
   return child && child->Role() == roles::CAPTION ? child : nsnull;
 }
 
-NS_IMETHODIMP
-nsHTMLTableAccessible::GetSummary(nsAString &aSummary)
+void
+nsHTMLTableAccessible::Summary(nsString& aSummary)
 {
   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mContent));
-  NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
-
-  return table->GetSummary(aSummary);
+  
+  if (table)
+    table->GetSummary(aSummary);
 }
 
 NS_IMETHODIMP
 nsHTMLTableAccessible::GetColumnCount(PRInt32 *acolumnCount)
 {
   NS_ENSURE_ARG_POINTER(acolumnCount);
   *acolumnCount = nsnull;
 
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -124,16 +124,17 @@ public:
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible Table
   NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
 
   // TableAccessible
   virtual nsAccessible* Caption();
+  virtual void Summary(nsString& aSummary);
   virtual bool IsProbablyLayoutTable();
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
   virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
   virtual void Description(nsString& aDescription);
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -34,16 +34,17 @@
  * 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 "nsHyperTextAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "Role.h"
 #include "States.h"
 #include "TextAttrs.h"
 
 #include "nsIClipboard.h"
@@ -87,25 +88,19 @@ nsresult nsHyperTextAccessible::QueryInt
   *aInstancePtr = nsnull;
 
   if (aIID.Equals(NS_GET_IID(nsHyperTextAccessible))) {
     *aInstancePtr = static_cast<nsHyperTextAccessible*>(this);
     NS_ADDREF_THIS();
     return NS_OK;
   }
 
-  if (mRoleMapEntry &&
-      (mRoleMapEntry->role == roles::GRAPHIC ||
-       mRoleMapEntry->role == roles::IMAGE_MAP ||
-       mRoleMapEntry->role == roles::SLIDER ||
-       mRoleMapEntry->role == roles::PROGRESSBAR ||
-       mRoleMapEntry->role == roles::SEPARATOR)) {
-    // ARIA roles that these interfaces are not appropriate for
+  // ARIA roles that these interfaces are not appropriate for.
+  if (!IsTextRole())
     return nsAccessible::QueryInterface(aIID, aInstancePtr);
-  }
 
   if (aIID.Equals(NS_GET_IID(nsIAccessibleText))) {
     *aInstancePtr = static_cast<nsIAccessibleText*>(this);
     NS_ADDREF_THIS();
     return NS_OK;
   }
 
   if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperText))) {
@@ -2241,36 +2236,36 @@ nsHyperTextAccessible::GetChildIndexAtOf
 
   return -1;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHyperTextAccessible protected
 
 nsresult
-nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame *aFrame,
+nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
                                                 PRInt32 aOffset,
-                                                nsIAccessible *aAccessible,
-                                                nsIDOMNode **aNode,
-                                                PRInt32 *aNodeOffset)
+                                                nsAccessible* aAccessible,
+                                                nsIDOMNode** aNode,
+                                                PRInt32* aNodeOffset)
 {
   NS_ENSURE_ARG(aAccessible);
 
   nsCOMPtr<nsIDOMNode> node;
 
   if (!aFrame) {
     // If the given frame is null then set offset after the DOM node of the
     // given accessible.
-    nsCOMPtr<nsIDOMNode> DOMNode;
-    aAccessible->GetDOMNode(getter_AddRefs(DOMNode));
-    nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode));
-    NS_ENSURE_STATE(content);
+    NS_ASSERTION(!aAccessible->IsDoc(), 
+                 "Shouldn't be called on document accessible!");
 
-    nsCOMPtr<nsIContent> parent(content->GetParent());
-    NS_ENSURE_STATE(parent);
+    nsIContent* content = aAccessible->GetContent();
+    NS_ASSERTION(content, "Shouldn't operate on defunct accessible!");
+
+    nsIContent* parent = content->GetParent();
 
     *aNodeOffset = parent->IndexOf(content) + 1;
     node = do_QueryInterface(parent);
 
   } else if (aFrame->GetType() == nsGkAtoms::textFrame) {
     nsCOMPtr<nsIContent> content(aFrame->GetContent());
     NS_ENSURE_STATE(content);
 
@@ -2392,8 +2387,22 @@ nsHyperTextAccessible::GetSpellTextAttri
       }
 
       return NS_OK;
     }
   }
 
   return NS_OK;
 }
+
+bool 
+nsHyperTextAccessible::IsTextRole()
+{
+  if (mRoleMapEntry &&
+      (mRoleMapEntry->role == roles::GRAPHIC ||
+       mRoleMapEntry->role == roles::IMAGE_MAP ||
+       mRoleMapEntry->role == roles::SLIDER ||
+       mRoleMapEntry->role == roles::PROGRESSBAR ||
+       mRoleMapEntry->role == roles::SEPARATOR))
+    return false;
+
+  return true;
+}
--- a/accessible/src/html/nsHyperTextAccessible.h
+++ b/accessible/src/html/nsHyperTextAccessible.h
@@ -196,16 +196,22 @@ public:
    */
   nsresult HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
                                       PRInt32 aEndHTOffset,
                                       nsIDOMNode **aStartNode,
                                       PRInt32 *aStartOffset,
                                       nsIDOMNode **aEndNode,
                                       PRInt32 *aEndOffset);
 
+  /**
+   * Return true if the used ARIA role (if any) allows the hypertext accessible
+   * to expose text interfaces.
+   */
+  bool IsTextRole();
+
   //////////////////////////////////////////////////////////////////////////////
   // TextAccessible
 
   /**
    * Return character count within the hypertext accessible.
    */
   inline PRUint32 CharacterCount()
   {
@@ -385,19 +391,19 @@ protected:
   /**
    * Return selection ranges within the accessible subtree.
    */
   void GetSelectionDOMRanges(PRInt16 aType, nsTArray<nsRange*>* aRanges);
 
   nsresult SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos);
 
   // Helpers
-  nsresult GetDOMPointByFrameOffset(nsIFrame *aFrame, PRInt32 aOffset,
-                                    nsIAccessible *aAccessible,
-                                    nsIDOMNode **aNode, PRInt32 *aNodeOffset);
+  nsresult GetDOMPointByFrameOffset(nsIFrame* aFrame, PRInt32 aOffset,
+                                    nsAccessible* aAccessible,
+                                    nsIDOMNode** aNode, PRInt32* aNodeOffset);
 
   
   /**
    * Return hyper text offset for the specified bound of the given DOM range.
    * If the bound is outside of the hyper text then offset value is either
    * 0 or number of characters of hyper text, it depends on type of requested
    * offset. The method is a wrapper for DOMPointToHypertextOffset.
    *
new file mode 100644
--- /dev/null
+++ b/accessible/src/jsat/AccessFu.css
@@ -0,0 +1,22 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#virtual-cursor-box { 
+  position: fixed;
+  border: 1px solid orange;
+  pointer-events: none;
+  display: none;
+  border-radius: 2px;
+  box-shadow: 1px 1px 1px #444;
+}
+
+#virtual-cursor-inset { 
+  border-radius: 1px;
+  box-shadow: inset 1px 1px 1px #444;
+  display: block;
+  box-sizing: border-box;
+  width: 100%;
+  height: 100%;
+  pointer-events: none;
+}
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/accessible/src/jsat/AccessFu.jsm
@@ -0,0 +1,258 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+const Cr = Components.results;
+
+var EXPORTED_SYMBOLS = ['AccessFu'];
+
+Cu.import('resource://gre/modules/Services.jsm');
+
+Cu.import('resource://gre/modules/accessibility/Presenters.jsm');
+Cu.import('resource://gre/modules/accessibility/VirtualCursorController.jsm');
+
+var AccessFu = {
+  /**
+   * Attach chrome-layer accessibility functionality to the given chrome window.
+   * If accessibility is enabled on the platform (currently Android-only), then
+   * a special accessibility mode is started (see startup()).
+   * @param {ChromeWindow} aWindow Chrome window to attach to.
+   * @param {boolean} aForceEnabled Skip platform accessibility check and enable
+   *  AccessFu.
+   */
+  attach: function attach(aWindow) {
+    dump('AccessFu attach!! ' + Services.appinfo.OS + '\n');
+    this.chromeWin = aWindow;
+    this.presenters = [];
+
+    function checkA11y() {
+      if (Services.appinfo.OS == 'Android') {
+        let msg = Cc['@mozilla.org/android/bridge;1'].
+          getService(Ci.nsIAndroidBridge).handleGeckoMessage(
+            JSON.stringify(
+                { gecko: {
+                    type: 'Accessibility:IsEnabled',
+                    eventType: 1,
+                    text: []
+                  }
+                }));
+        return JSON.parse(msg).enabled;
+      }
+      return false;
+    }
+
+    if (checkA11y())
+      this.enable();
+  },
+
+  /**
+   * Start the special AccessFu mode, this primarily means controlling the virtual
+   * cursor with arrow keys. Currently, on platforms other than Android this needs
+   * to be called explicitly.
+   */
+  enable: function enable() {
+    dump('AccessFu enable');
+    this.addPresenter(new VisualPresenter());
+
+    // Implicitly add the Android presenter on Android.
+    if (Services.appinfo.OS == 'Android')
+      this.addPresenter(new AndroidPresenter());
+
+    VirtualCursorController.attach(this.chromeWin);
+
+    Services.obs.addObserver(this, 'accessible-event', false);
+    this.chromeWin.addEventListener('DOMActivate', this, true);
+    this.chromeWin.addEventListener('resize', this, true);
+    this.chromeWin.addEventListener('scroll', this, true);
+    this.chromeWin.addEventListener('TabOpen', this, true);
+    this.chromeWin.addEventListener('TabSelect', this, true);
+    this.chromeWin.addEventListener('TabClosed', this, true);
+  },
+
+  /**
+   * Disable AccessFu and return to default interaction mode.
+   */
+  disable: function disable() {
+    dump('AccessFu disable');
+
+    this.presenters.forEach(function(p) {p.detach();});
+    this.presenters = [];
+
+    VirtualCursorController.detach();
+
+    Services.obs.addObserver(this, 'accessible-event', false);
+    this.chromeWin.removeEventListener('DOMActivate', this);
+    this.chromeWin.removeEventListener('resize', this);
+    this.chromeWin.removeEventListener('scroll', this);
+    this.chromeWin.removeEventListener('TabOpen', this);
+    this.chromeWin.removeEventListener('TabSelect', this);
+    this.chromeWin.removeEventListener('TabClose', this);
+  },
+
+  addPresenter: function addPresenter(presenter) {
+    this.presenters.push(presenter);
+    presenter.attach(this.chromeWin);
+  },
+
+  handleEvent: function handleEvent(aEvent) {
+    switch (aEvent.type) {
+      case 'TabSelect':
+        {
+          this.getDocAccessible(
+              function(docAcc) {
+                this.presenters.forEach(function(p) {p.tabSelected(docAcc);});
+              });
+          break;
+        }
+      case 'DOMActivate':
+      {
+        let activatedAcc = getAccessible(aEvent.originalTarget);
+        let state = {};
+        activatedAcc.getState(state, {});
+
+        // Checkable objects will have a state changed event that we will use
+        // instead of this hackish DOMActivate. We will also know the true
+        // action that was taken.
+        if (state.value & Ci.nsIAccessibleStates.STATE_CHECKABLE)
+          return;
+
+        this.presenters.forEach(function(p) {
+                                  p.actionInvoked(activatedAcc, 'click');
+                                });
+        break;
+      }
+      case 'scroll':
+      case 'resize':
+      {
+        this.presenters.forEach(function(p) {p.viewportChanged();});
+        break;
+      }
+    }
+  },
+
+  getDocAccessible: function getDocAccessible(aCallback) {
+    let browserApp = (Services.appinfo.OS == 'Android') ?
+      this.chromeWin.BrowserApp : this.chromeWin.gBrowser;
+
+    let docAcc = getAccessible(browserApp.selectedBrowser.contentDocument);
+    if (!docAcc) {
+      // Wait for a reorder event fired by the parent of the new doc.
+      this._pendingDocuments[browserApp.selectedBrowser] = aCallback;
+    } else {
+      aCallback.apply(this, [docAcc]);
+    }
+  },
+
+  observe: function observe(aSubject, aTopic, aData) {
+    switch (aTopic) {
+      case 'accessible-event':
+        let event;
+        try {
+          event = aSubject.QueryInterface(Ci.nsIAccessibleEvent);
+          this.handleAccEvent(event);
+        } catch (ex) {
+          dump(ex);
+          return;
+        }
+    }
+  },
+
+  handleAccEvent: function handleAccEvent(aEvent) {
+    switch (aEvent.eventType) {
+      case Ci.nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED:
+        {
+          let pivot = aEvent.accessible.
+            QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
+          let event = aEvent.
+            QueryInterface(Ci.nsIAccessibleVirtualCursorChangeEvent);
+
+          let newContext = this.getNewContext(event.oldAccessible,
+                                              pivot.position);
+          this.presenters.forEach(
+            function(p) {
+              p.pivotChanged(pivot.position, newContext);
+            });
+          break;
+        }
+      case Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE:
+        {
+          let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
+          if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
+              !(event.isExtraState())) {
+            this.presenters.forEach(
+              function(p) {
+                p.actionInvoked(aEvent.accessible,
+                                event.isEnabled() ? 'check' : 'uncheck');
+              }
+            );
+          }
+          break;
+        }
+      case Ci.nsIAccessibleEvent.EVENT_REORDER:
+        {
+          let node = aEvent.accessible.DOMNode;
+          let callback = this._pendingDocuments[node];
+          if (callback && aEvent.accessible.childCount) {
+            // We have a callback associated with a document.
+            callback.apply(this, [aEvent.accessible.getChildAt(0)]);
+            delete this._pendingDocuments[node];
+          }
+          break;
+        }
+      default:
+        break;
+    }
+  },
+
+  getNewContext: function getNewContext(aOldObject, aNewObject) {
+    let newLineage = [];
+    let oldLineage = [];
+
+    let parent = aNewObject;
+    while ((parent = parent.parent))
+      newLineage.push(parent);
+
+    if (aOldObject) {
+      parent = aOldObject;
+      while ((parent = parent.parent))
+        oldLineage.push(parent);
+    }
+
+//    newLineage.reverse();
+//    oldLineage.reverse();
+
+    let i = 0;
+    let newContext = [];
+
+    while (true) {
+      let newAncestor = newLineage.pop();
+      let oldAncestor = oldLineage.pop();
+
+      if (newAncestor == undefined)
+        break;
+
+      if (newAncestor != oldAncestor)
+        newContext.push(newAncestor);
+      i++;
+    }
+
+    return newContext;
+  },
+
+  // A hash of documents that don't yet have an accessible tree.
+  _pendingDocuments: {}
+};
+
+function getAccessible(aNode) {
+  try {
+    return Cc['@mozilla.org/accessibleRetrieval;1'].
+      getService(Ci.nsIAccessibleRetrieval).getAccessibleFor(aNode);
+  } catch (e) {
+    return null;
+  }
+}
new file mode 100644
--- /dev/null
+++ b/accessible/src/jsat/Makefile.in
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH     = ../../..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+include $(topsrcdir)/config/rules.mk
+
+libs::
+	$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/accessibility
new file mode 100644
--- /dev/null
+++ b/accessible/src/jsat/Presenters.jsm
@@ -0,0 +1,273 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+const Cr = Components.results;
+
+Cu.import('resource://gre/modules/accessibility/UtteranceGenerator.jsm');
+Cu.import('resource://gre/modules/Services.jsm');
+
+var EXPORTED_SYMBOLS = ['VisualPresenter',
+                        'AndroidPresenter',
+                        'DummyAndroidPresenter'];
+
+/**
+ * The interface for all presenter classes. A presenter could be, for example,
+ * a speech output module, or a visual cursor indicator.
+ */
+function Presenter() {}
+
+Presenter.prototype = {
+  /**
+   * The padding in pixels between the object and the highlight border.
+   */
+  BORDER_PADDING: 2,
+
+  /**
+   * Attach function for presenter.
+   * @param {ChromeWindow} aWindow Chrome window the presenter could use.
+   */
+  attach: function attach(aWindow) {},
+
+  /**
+   * Detach function.
+   */
+  detach: function detach() {},
+
+  /**
+   * The virtual cursor's position changed.
+   * @param {nsIAccessible} aObject the new position.
+   * @param {nsIAccessible[]} aNewContext the ancestry of the new position that
+   *    is different from the old virtual cursor position.
+   */
+  pivotChanged: function pivotChanged(aObject, aNewContext) {},
+
+  /**
+   * An object's action has been invoked.
+   * @param {nsIAccessible} aObject the object that has been invoked.
+   * @param {string} aActionName the name of the action.
+   */
+  actionInvoked: function actionInvoked(aObject, aActionName) {},
+
+  /**
+   * Text has changed, either by the user or by the system. TODO.
+   */
+  textChanged: function textChanged() {},
+
+  /**
+   * Text selection has changed. TODO.
+   */
+  textSelectionChanged: function textSelectionChanged() {},
+
+  /**
+   * Selection has changed. TODO.
+   * @param {nsIAccessible} aObject the object that has been selected.
+   */
+  selectionChanged: function selectionChanged(aObject) {},
+
+  /**
+   * The page state has changed, loading, stopped loading, etc. TODO.
+   */
+  pageStateChanged: function pageStateChanged() {},
+
+  /**
+   * The tab has changed.
+   * @param {nsIAccessible} aObject the document contained in the tab.
+   */
+  tabSelected: function tabSelected(aObject) {},
+
+  /**
+   * The viewport has changed, either a scroll, pan, zoom, or
+   *    landscape/portrait toggle.
+   */
+  viewportChanged: function viewportChanged() {}
+};
+
+/**
+ * Visual presenter. Draws a box around the virtual cursor's position.
+ */
+
+function VisualPresenter() {}
+
+VisualPresenter.prototype = new Presenter();
+
+VisualPresenter.prototype.attach = function(aWindow) {
+  this.chromeWin = aWindow;
+
+  // Add stylesheet
+  let stylesheetURL = 'chrome://global/content/accessibility/AccessFu.css';
+  this.stylesheet = aWindow.document.createProcessingInstruction(
+    'xml-stylesheet', 'href="' + stylesheetURL + '" type="text/css"');
+  aWindow.document.insertBefore(this.stylesheet, aWindow.document.firstChild);
+
+  // Add highlight box
+  this.highlightBox = this.chromeWin.document.
+    createElementNS('http://www.w3.org/1999/xhtml', 'div');
+  this.chromeWin.document.documentElement.appendChild(this.highlightBox);
+  this.highlightBox.id = 'virtual-cursor-box';
+
+  // Add highlight inset for inner shadow
+  let inset = this.chromeWin.document.
+    createElementNS('http://www.w3.org/1999/xhtml', 'div');
+  inset.id = 'virtual-cursor-inset';
+
+  this.highlightBox.appendChild(inset);
+};
+
+VisualPresenter.prototype.detach = function() {
+  this.chromeWin.document.removeChild(this.stylesheet);
+  this.highlightBox.parentNode.removeChild(this.highlightBox);
+  this.highlightBox = this.stylesheet = null;
+};
+
+VisualPresenter.prototype.viewportChanged = function() {
+  if (this._currentObject)
+    this.highlight(this._currentObject);
+};
+
+VisualPresenter.prototype.pivotChanged = function(aObject, aNewContext) {
+  this._currentObject = aObject;
+
+  if (!aObject) {
+    this.hide();
+    return;
+  }
+
+  try {
+    aObject.scrollTo(Ci.nsIAccessibleScrollType.SCROLL_TYPE_ANYWHERE);
+    this.highlight(aObject);
+  } catch (e) {
+    dump('Error getting bounds: ' + e);
+    return;
+  }
+};
+
+VisualPresenter.prototype.tabSelected = function(aObject) {
+  let vcDoc = aObject.QueryInterface(Ci.nsIAccessibleCursorable);
+  this.pivotChanged(vcDoc.virtualCursor.position);
+};
+
+// Internals
+
+VisualPresenter.prototype.hide = function hide() {
+  this.highlightBox.style.display = 'none';
+};
+
+VisualPresenter.prototype.highlight = function(aObject) {
+  let vp = (Services.appinfo.OS == 'Android') ?
+    this.chromeWin.BrowserApp.selectedTab.getViewport() :
+    { zoom: 1.0, offsetY: 0 };
+
+  let bounds = this.getBounds(aObject, vp.zoom);
+
+  // First hide it to avoid flickering when changing the style.
+  this.highlightBox.style.display = 'none';
+  this.highlightBox.style.top = bounds.top + 'px';
+  this.highlightBox.style.left = bounds.left + 'px';
+  this.highlightBox.style.width = bounds.width + 'px';
+  this.highlightBox.style.height = bounds.height + 'px';
+  this.highlightBox.style.display = 'block';
+};
+
+VisualPresenter.prototype.getBounds = function(aObject, aZoom, aStart, aEnd) {
+  let objX = {}, objY = {}, objW = {}, objH = {};
+
+  if (aEnd >= 0 && aStart >= 0 && aEnd != aStart) {
+    // TODO: Get bounds for text ranges. Leaving this blank until we have
+    // proper text navigation in the virtual cursor.
+  }
+
+  aObject.getBounds(objX, objY, objW, objH);
+
+  // Can't specify relative coords in nsIAccessible.getBounds, so we do it.
+  let docX = {}, docY = {};
+  let docRoot = aObject.rootDocument.QueryInterface(Ci.nsIAccessible);
+  docRoot.getBounds(docX, docY, {}, {});
+
+  let rv = {
+    left: Math.round((objX.value - docX.value - this.BORDER_PADDING) * aZoom),
+    top: Math.round((objY.value - docY.value - this.BORDER_PADDING) * aZoom),
+    width: Math.round((objW.value + (this.BORDER_PADDING * 2)) * aZoom),
+    height: Math.round((objH.value + (this.BORDER_PADDING * 2)) * aZoom)
+  };
+
+  return rv;
+};
+
+/**
+ * Android presenter. Fires Android a11y events.
+ */
+
+const ANDROID_TYPE_VIEW_CLICKED = 0x01;
+const ANDROID_TYPE_VIEW_LONG_CLICKED = 0x02;
+const ANDROID_TYPE_VIEW_SELECTED = 0x04;
+const ANDROID_TYPE_VIEW_FOCUSED = 0x08;
+const ANDROID_TYPE_VIEW_TEXT_CHANGED = 0x10;
+const ANDROID_TYPE_WINDOW_STATE_CHANGED = 0x20;
+
+function AndroidPresenter() {}
+
+AndroidPresenter.prototype = new Presenter();
+
+AndroidPresenter.prototype.pivotChanged = function(aObject, aNewContext) {
+  let output = [];
+  for (let i in aNewContext)
+    output.push.apply(output,
+                      UtteranceGenerator.genForObject(aNewContext[i]));
+
+  output.push.apply(output,
+                    UtteranceGenerator.genForObject(aObject, true));
+
+  this.sendMessageToJava({
+    gecko: {
+      type: 'Accessibility:Event',
+      eventType: ANDROID_TYPE_VIEW_FOCUSED,
+      text: output
+    }
+  });
+};
+
+AndroidPresenter.prototype.actionInvoked = function(aObject, aActionName) {
+  this.sendMessageToJava({
+    gecko: {
+      type: 'Accessibility:Event',
+      eventType: ANDROID_TYPE_VIEW_CLICKED,
+      text: [UtteranceGenerator.genForAction(aObject, aActionName)]
+    }
+  });
+};
+
+AndroidPresenter.prototype.tabSelected = function(aObject) {
+  let vcDoc = aObject.QueryInterface(Ci.nsIAccessibleCursorable);
+  let context = [];
+
+  let parent = vcDoc.virtualCursor.position || aObject;
+  while ((parent = parent.parent))
+    context.push(parent);
+  context.reverse();
+
+  this.pivotChanged(vcDoc.virtualCursor.position, context);
+};
+
+AndroidPresenter.prototype.sendMessageToJava = function(aMessage) {
+  return Cc['@mozilla.org/android/bridge;1'].
+    getService(Ci.nsIAndroidBridge).
+    handleGeckoMessage(JSON.stringify(aMessage));
+};
+
+/**
+ * A dummy Android presenter for desktop testing
+ */
+
+function DummyAndroidPresenter() {}
+
+DummyAndroidPresenter.prototype = new AndroidPresenter();
+
+DummyAndroidPresenter.prototype.sendMessageToJava = function(aMessage) {
+  dump(JSON.stringify(aMessage, null, 2) + '\n');
+};
new file mode 100644
--- /dev/null
+++ b/accessible/src/jsat/UtteranceGenerator.jsm
@@ -0,0 +1,162 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+const Cr = Components.results;
+
+const INCLUDE_ROLE = 0x01;
+const INCLUDE_NAME = 0x02;
+const INCLUDE_CUSTOM = 0x04;
+
+var gStringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
+  getService(Ci.nsIStringBundleService).
+  createBundle('chrome://global/locale/AccessFu.properties');
+
+var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
+  getService(Ci.nsIAccessibleRetrieval);
+
+var EXPORTED_SYMBOLS = ['UtteranceGenerator'];
+
+var UtteranceGenerator = {
+  gActionMap: {
+    jump: 'jumpAction',
+    press: 'pressAction',
+    check: 'checkAction',
+    uncheck: 'uncheckAction',
+    select: 'selectAction',
+    open: 'openAction',
+    close: 'closeAction',
+    switch: 'switchAction',
+    click: 'clickAction',
+    collapse: 'collapseAction',
+    expand: 'expandAction',
+    activate: 'activateAction',
+    cycle: 'cycleAction'
+  },
+
+  genForObject: function(aAccessible, aForceName) {
+    let roleString = gAccRetrieval.getStringRole(aAccessible.role);
+
+    let func = this.objectUtteranceFunctions[roleString] ||
+      this.objectUtteranceFunctions.defaultFunc;
+
+    let flags = this.verbosityRoleMap[roleString] || 0;
+
+    if (aForceName)
+      flags |= INCLUDE_NAME;
+
+    return func(aAccessible, roleString, flags);
+  },
+
+  genForAction: function(aObject, aActionName) {
+    return gStringBundle.GetStringFromName(this.gActionMap[aActionName]);
+  },
+
+  verbosityRoleMap: {
+    'menubar': INCLUDE_ROLE,
+    'scrollbar': INCLUDE_ROLE,
+    'grip': INCLUDE_ROLE,
+    'alert': INCLUDE_ROLE,
+    'menupopup': INCLUDE_ROLE,
+    'menuitem': INCLUDE_ROLE,
+    'tooltip': INCLUDE_ROLE,
+    'application': INCLUDE_NAME,
+    'document': INCLUDE_NAME,
+    'toolbar': INCLUDE_ROLE,
+    'link': INCLUDE_ROLE,
+    'list': INCLUDE_ROLE,
+    'listitem': INCLUDE_ROLE,
+    'outline': INCLUDE_ROLE,
+    'outlineitem': INCLUDE_ROLE,
+    'pagetab': INCLUDE_ROLE,
+    'graphic': INCLUDE_ROLE | INCLUDE_NAME,
+    'statictext': INCLUDE_NAME,
+    'text leaf': INCLUDE_NAME,
+    'pushbutton': INCLUDE_ROLE,
+    'checkbutton': INCLUDE_ROLE | INCLUDE_NAME,
+    'radiobutton': INCLUDE_ROLE | INCLUDE_NAME,
+    'combobox': INCLUDE_ROLE,
+    'droplist': INCLUDE_ROLE,
+    'progressbar': INCLUDE_ROLE,
+    'slider': INCLUDE_ROLE,
+    'spinbutton': INCLUDE_ROLE,
+    'diagram': INCLUDE_ROLE,
+    'animation': INCLUDE_ROLE,
+    'equation': INCLUDE_ROLE,
+    'buttonmenu': INCLUDE_ROLE,
+    'pagetablist': INCLUDE_ROLE,
+    'canvas': INCLUDE_ROLE,
+    'check menu item': INCLUDE_ROLE,
+    'label': INCLUDE_ROLE,
+    'password text': INCLUDE_ROLE,
+    'popup menu': INCLUDE_ROLE,
+    'radio menu item': INCLUDE_ROLE,
+    'toggle button': INCLUDE_ROLE,
+    'header': INCLUDE_ROLE,
+    'footer': INCLUDE_ROLE,
+    'entry': INCLUDE_ROLE,
+    'caption': INCLUDE_ROLE,
+    'document frame': INCLUDE_ROLE,
+    'heading': INCLUDE_ROLE,
+    'calendar': INCLUDE_ROLE,
+    'combobox list': INCLUDE_ROLE,
+    'combobox option': INCLUDE_ROLE,
+    'image map': INCLUDE_ROLE,
+    'option': INCLUDE_ROLE,
+    'listbox': INCLUDE_ROLE},
+
+  objectUtteranceFunctions: {
+    defaultFunc: function defaultFunc(aAccessible, aRoleStr, aFlags) {
+      let name = (aFlags & INCLUDE_NAME) ? (aAccessible.name || '') : '';
+      let desc = (aFlags & INCLUDE_ROLE) ?
+        gStringBundle.GetStringFromName(aRoleStr) : '';
+
+      if (!name && !desc)
+        return [];
+
+      let state = {};
+      let extState = {};
+      aAccessible.getState(state, extState);
+
+      if (state.value & Ci.nsIAccessibleStates.STATE_CHECKABLE) {
+        let stateStr = (state.value & Ci.nsIAccessibleStates.STATE_CHECKED) ?
+          'objChecked' : 'objNotChecked';
+        desc = gStringBundle.formatStringFromName(stateStr, [desc], 1);
+      }
+
+      if (extState.value & Ci.nsIAccessibleStates.EXT_STATE_EXPANDABLE) {
+        let stateStr = (state.value & Ci.nsIAccessibleStates.STATE_EXPANDED) ?
+          'objExpanded' : 'objCollapsed';
+        desc = gStringBundle.formatStringFromName(stateStr, [desc], 1);
+      }
+
+      return [desc, name];
+    },
+
+    heading: function(aAccessible, aRoleStr, aFlags) {
+      let name = (aFlags & INCLUDE_NAME) ? (aAccessible.name || '') : '';
+      let level = {};
+      aAccessible.groupPosition(level, {}, {});
+      let desc = gStringBundle.formatStringFromName('headingLevel',
+                                                   [level.value], 1);
+      return [desc, name];
+    },
+
+    listitem: function(aAccessible, aRoleStr, aFlags) {
+      let name = (aFlags & INCLUDE_NAME) ? (aAccessible.name || '') : '';
+      let localizedRole = gStringBundle.GetStringFromName(aRoleStr);
+      let itemno = {};
+      let itemof = {};
+      aAccessible.groupPosition({}, itemof, itemno);
+      let desc = gStringBundle.formatStringFromName(
+          'objItemOf', [localizedRole, itemno.value, itemof.value], 3);
+
+      return [desc, name];
+    }
+  }
+};
new file mode 100644
--- /dev/null
+++ b/accessible/src/jsat/VirtualCursorController.jsm
@@ -0,0 +1,143 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+'use strict';
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+const Cr = Components.results;
+
+var EXPORTED_SYMBOLS = ['VirtualCursorController'];
+
+Cu.import('resource://gre/modules/XPCOMUtils.jsm');
+Cu.import('resource://gre/modules/Services.jsm');
+
+var gAccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
+  getService(Ci.nsIAccessibleRetrieval);
+
+var VirtualCursorController = {
+  attach: function attach(aWindow) {
+    this.chromeWin = aWindow;
+    this.chromeWin.document.addEventListener('keypress', this.onkeypress, true);
+  },
+
+  detach: function detach() {
+    this.chromeWin.document.removeEventListener('keypress', this.onkeypress);
+  },
+
+  getBrowserApp: function getBrowserApp() {
+    switch (Services.appinfo.OS) {
+      case 'Android':
+        return this.chromeWin.BrowserApp;
+      default:
+        return this.chromeWin.gBrowser;
+    }
+  },
+
+  onkeypress: function onkeypress(aEvent) {
+    let document = VirtualCursorController.getBrowserApp().
+      selectedBrowser.contentDocument;
+
+    dump('keypress ' + aEvent.keyCode + '\n');
+
+    switch (aEvent.keyCode) {
+      case aEvent.DOM_END:
+        VirtualCursorController.moveForward(document, true);
+        break;
+      case aEvent.DOM_HOME:
+        VirtualCursorController.moveBackward(document, true);
+        break;
+      case aEvent.DOM_VK_DOWN:
+        VirtualCursorController.moveForward(document, aEvent.shiftKey);
+        break;
+      case aEvent.DOM_VK_UP:
+        VirtualCursorController.moveBackward(document, aEvent.shiftKey);
+        break;
+      case aEvent.DOM_VK_RETURN:
+        //It is true that desktop does not map the kp enter key to ENTER.
+        //So for desktop we require a ctrl+return instead.
+        if (Services.appinfo.OS == 'Android' || !aEvent.ctrlKey)
+          return;
+      case aEvent.DOM_VK_ENTER:
+        VirtualCursorController.activateCurrent(document);
+        break;
+      default:
+        return;
+    }
+
+    aEvent.preventDefault();
+    aEvent.stopPropagation();
+  },
+
+  moveForward: function moveForward(document, last) {
+    let virtualCursor = this.getVirtualCursor(document);
+    if (last) {
+      virtualCursor.moveLast(this.SimpleTraversalRule);
+    } else {
+      virtualCursor.moveNext(this.SimpleTraversalRule);
+    }
+  },
+
+  moveBackward: function moveBackward(document, first) {
+    let virtualCursor = this.getVirtualCursor(document);
+
+    if (first) {
+      virtualCursor.moveFirst(this.SimpleTraversalRule);
+      return
+
+    }
+
+    if (!virtualCursor.movePrevious(this.SimpleTraversalRule) &&
+        Services.appinfo.OS == 'Android') {
+      // Return focus to browser chrome, which in Android is a native widget.
+      Cc['@mozilla.org/android/bridge;1'].
+        getService(Ci.nsIAndroidBridge).handleGeckoMessage(
+          JSON.stringify({ gecko: { type: 'ToggleChrome:Focus' } }));
+      virtualCursor.position = null;
+    }
+  },
+
+  activateCurrent: function activateCurrent(document) {
+    let virtualCursor = this.getVirtualCursor(document);
+    let acc = virtualCursor.position;
+
+    if (acc.numActions > 0)
+      acc.doAction(0);
+  },
+
+  getVirtualCursor: function getVirtualCursor(document) {
+    return gAccRetrieval.getAccessibleFor(document).
+      QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
+  },
+
+  SimpleTraversalRule: {
+    getMatchRoles: function(aRules) {
+      aRules.value = [];
+      return 0;
+    },
+
+    preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
+      Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
+
+    match: function(aAccessible) {
+      let rv = Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
+      if (aAccessible.childCount == 0) {
+        // TODO: Find a better solution for ROLE_STATICTEXT.
+        // Right now it helps filter list bullets, but it is also used
+        // in CSS generated content.
+        let ignoreRoles = [Ci.nsIAccessibleRole.ROLE_WHITESPACE,
+                           Ci.nsIAccessibleRole.ROLE_STATICTEXT];
+        let state = {};
+        aAccessible.getState(state, {});
+        if ((state.value & Ci.nsIAccessibleStates.STATE_FOCUSABLE) ||
+          (aAccessible.name && ignoreRoles.indexOf(aAccessible.role) < 0))
+          rv = Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
+        }
+      return rv;
+    },
+
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsIAccessibleTraversalRule])
+  }
+};
new file mode 100644
--- /dev/null
+++ b/accessible/src/jsat/jar.mn
@@ -0,0 +1,2 @@
+toolkit.jar:
+    content/global/accessibility/AccessFu.css (AccessFu.css)
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -86,12 +86,13 @@ EXPORTS = \
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
   -I$(srcdir) \
   -I$(srcdir)/../base \
+  -I$(srcdir)/../generic \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xul \
   $(NULL)
 
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -37,33 +37,30 @@
  * ***** END LICENSE BLOCK ***** */
  
 #import "mozAccessible.h"
 
 #import "MacUtils.h"
 #import "mozView.h"
 #import "nsRoleMap.h"
 
+#include "Accessible-inl.h"
+#include "nsIAccessibleRelation.h"
+#include "nsIAccessibleText.h"
+#include "nsIAccessibleEditableText.h"
+#include "nsRootAccessible.h"
+#include "Relation.h"
+#include "Role.h"
+
+#include "mozilla/Services.h"
 #include "nsRect.h"
 #include "nsCocoaUtils.h"
 #include "nsCoord.h"
 #include "nsObjCExceptions.h"
 
-#include "nsIAccessible.h"
-#include "nsIAccessibleRelation.h"
-#include "nsIAccessibleText.h"
-#include "nsIAccessibleEditableText.h"
-#include "Relation.h"
-#include "Role.h"
-
-#include "nsAccessNode.h"
-#include "nsRootAccessible.h"
-
-#include "mozilla/Services.h"
-
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 // converts a screen-global point in the cocoa coordinate system (with origo in the bottom-left corner
 // of the screen), into a top-left screen point, that gecko can use.
 static inline void
 ConvertCocoaToGeckoPoint(NSPoint &aInPoint, nsPoint &aOutPoint)
 {
@@ -227,17 +224,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
   if ([attribute isEqualToString:NSAccessibilityEnabledAttribute])
     return [NSNumber numberWithBool:[self isEnabled]];
   if ([attribute isEqualToString:NSAccessibilityValueAttribute])
     return [self value];
   if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
     if (mRole == roles::DOCUMENT)
       return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
 
-    return NSAccessibilityRoleDescription([self role], nil);
+    return NSAccessibilityRoleDescription([self role], [self subrole]);
   }
   
   if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute])
     return [self customDescription];
   if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
     return [NSNumber numberWithBool:[self isFocused]];
   if ([attribute isEqualToString:NSAccessibilitySizeAttribute])
     return [self size];
@@ -470,16 +467,51 @@ GetNativeFromGeckoAccessible(nsIAccessib
   NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(mGeckoAccessible),
                "Does not support nsIAccessibleText when it should");
 #endif
   return (NSString*) AXRoles[mRole];
 }
 
 - (NSString*)subrole
 {
+  if (!mGeckoAccessible)
+    return nil;
+
+  nsIContent* content = mGeckoAccessible->GetContent();
+  if (!content || !content->IsHTML())
+    return nil;
+
+  nsIAtom* tag = content->Tag();
+
+  switch (mRole) {
+    case roles::LIST:
+      if ((tag == nsGkAtoms::ul) || (tag == nsGkAtoms::ol))
+        return NSAccessibilityContentListSubrole;
+
+      if (tag == nsGkAtoms::dl)
+        return NSAccessibilityDefinitionListSubrole;
+
+      break;
+
+    case roles::LISTITEM:
+      if (tag == nsGkAtoms::dt)
+        return @"AXTerm";
+
+      break;
+
+    case roles::PARAGRAPH:
+      if (tag == nsGkAtoms::dd)
+        return @"AXDefinition";
+
+      break;
+
+    default:
+      break;
+  }
+
   return nil;
 }
 
 - (NSString*)title
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   nsAutoString title;
--- a/accessible/src/mac/mozActionElements.mm
+++ b/accessible/src/mac/mozActionElements.mm
@@ -34,19 +34,18 @@
  * 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 "mozActionElements.h"
 
 #import "MacUtils.h"
-
-#import "nsIAccessible.h"
-#import "nsXULTabAccessible.h"
+#include "Accessible-inl.h"
+#include "nsXULTabAccessible.h"
 
 #include "nsObjCExceptions.h"
 
 using namespace mozilla::a11y;
 
 enum CheckboxValue {
   // these constants correspond to the values in the OS
   kUnchecked = 0,
--- a/accessible/src/mac/mozTextAccessible.mm
+++ b/accessible/src/mac/mozTextAccessible.mm
@@ -285,17 +285,19 @@ ToNSString(id aValue)
 
   [super accessibilitySetValue:value forAttribute:attribute];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (NSString*)subrole
 {
-  // TODO: text accessibles have two different subroles in Cocoa: secure textfield (passwords) and search field
+  if(mRole == roles::PASSWORD_TEXT)
+    return NSAccessibilitySecureTextFieldSubrole;
+
   return nil;
 }
 
 - (void)expire
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   NS_IF_RELEASE(mGeckoTextAccessible);
@@ -342,17 +344,21 @@ ToNSString(id aValue)
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (NSString*)text
 {
   if (!mGeckoTextAccessible)
     return nil;
-    
+
+  // A password text field returns an empty value
+  if (mRole == roles::PASSWORD_TEXT)
+    return @"";
+
   nsAutoString text;
   nsresult rv = mGeckoTextAccessible->
     GetText(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text);
   NS_ENSURE_SUCCESS(rv, @"");
 
   return nsCocoaUtils::ToNSString(text);
 }
 
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -36,16 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsDocAccessible.h"
 #include "nsObjCExceptions.h"
 
 #import "nsRoleMap.h"
 
+#include "Accessible-inl.h"
 #include "Role.h"
 
 #import "mozAccessible.h"
 #import "mozActionElements.h"
 #import "mozHTMLAccessible.h"
 #import "mozTextAccessible.h"
 
 using namespace mozilla::a11y;
@@ -113,20 +114,20 @@ nsAccessibleWrap::GetNativeType ()
     case roles::HEADING:
       return [mozHeadingAccessible class];
 
     case roles::PAGETABLIST:
       return [mozTabsAccessible class];
       
     case roles::ENTRY:
     case roles::STATICTEXT:
-    case roles::LABEL:
     case roles::CAPTION:
     case roles::ACCEL_LABEL:
     case roles::TEXT_LEAF:
+    case roles::PASSWORD_TEXT:
       // normal textfield (static or editable)
       return [mozTextAccessible class]; 
 
     case roles::LINK:
       return [mozLinkAccessible class];
 
     case roles::COMBOBOX:
       return [mozPopupButtonAccessible class];
--- a/accessible/src/mac/nsRoleMap.h
+++ b/accessible/src/mac/nsRoleMap.h
@@ -71,17 +71,17 @@ static const NSString* AXRoles [] = {
   NSAccessibilityGroupRole,                     // roles::ROWHEADER            26
   NSAccessibilityColumnRole,                    // roles::COLUMN               27
   NSAccessibilityRowRole,                       // roles::ROW                  28
   NSAccessibilityGroupRole,                     // roles::CELL                 29
   @"AXLink",                                    // roles::LINK                 30     10.4+ the attr first define in SDK 10.4, so we define it here too. ROLE_LINK
   @"AXHelpTag",                                 // roles::HELPBALLOON          31
   NSAccessibilityUnknownRole,                   // roles::CHARACTER            32     Unused on OS X.
   NSAccessibilityListRole,                      // roles::LIST                 33
-  NSAccessibilityRowRole,                       // roles::LISTITEM             34
+  NSAccessibilityGroupRole,                     // roles::LISTITEM             34
   NSAccessibilityOutlineRole,                   // roles::OUTLINE              35
   NSAccessibilityRowRole,                       // roles::OUTLINEITEM          36     XXX: use OutlineRow as subrole.
   NSAccessibilityRadioButtonRole,               // roles::PAGETAB              37
   NSAccessibilityGroupRole,                     // roles::PROPERTYPAGE         38
   NSAccessibilityUnknownRole,                   // roles::INDICATOR            39
   NSAccessibilityImageRole,                     // roles::GRAPHIC              40
   NSAccessibilityStaticTextRole,                // roles::STATICTEXT           41
   NSAccessibilityStaticTextRole,                // roles::TEXT_LEAF            42
@@ -116,17 +116,17 @@ static const NSString* AXRoles [] = {
   NSAccessibilityUnknownRole,                   // roles::DESKTOP_FRAME        71
   NSAccessibilityBrowserRole,                   // roles::DIRECTORY_PANE       72
   NSAccessibilityUnknownRole,                   // roles::FILE_CHOOSER         73     Unused on OS X
   NSAccessibilityUnknownRole,                   // roles::FONT_CHOOSER         74
   NSAccessibilityUnknownRole,                   // roles::CHROME_WINDOW        75     Unused on OS X
   NSAccessibilityGroupRole,                     // roles::GLASS_PANE           76
   NSAccessibilityUnknownRole,                   // roles::HTML_CONTAINER       77
   NSAccessibilityImageRole,                     // roles::ICON                 78
-  NSAccessibilityStaticTextRole,                // roles::LABEL                79
+  NSAccessibilityGroupRole,                     // roles::LABEL                79
   NSAccessibilityGroupRole,                     // roles::LAYERED_PANE         80
   NSAccessibilityGroupRole,                     // roles::OPTION_PANE          81
   NSAccessibilityTextFieldRole,                 // roles::PASSWORD_TEXT        82
   NSAccessibilityUnknownRole,                   // roles::POPUP_MENU           83     Unused
   NSAccessibilityMenuItemRole,                  // roles::RADIO_MENU_ITEM      84
   NSAccessibilityGroupRole,                     // roles::ROOT_PANE            85
   NSAccessibilityScrollAreaRole,                // roles::SCROLL_PANE          86
   NSAccessibilitySplitGroupRole,                // roles::SPLIT_PANE           87
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -59,22 +59,22 @@ CPPSRCS = \
   nsXULListboxAccessibleWrap.cpp \
   nsXULTreeGridAccessibleWrap.cpp \
   nsHyperTextAccessibleWrap.cpp \
   nsHTMLImageAccessibleWrap.cpp \
   nsHTMLTableAccessibleWrap.cpp \
   nsApplicationAccessibleWrap.cpp \
   nsWinUtils.cpp \
   ia2AccessibleAction.cpp \
+  ia2AccessibleComponent.cpp \
   CAccessibleImage.cpp \
-  CAccessibleComponent.cpp \
   CAccessibleText.cpp \
   CAccessibleEditableText.cpp \
   CAccessibleHyperlink.cpp \
-  CAccessibleHypertext.cpp \
+  ia2AccessibleHypertext.cpp \
   ia2AccessibleRelation.cpp \
   CAccessibleTable.cpp \
   CAccessibleTableCell.cpp \
   CAccessibleValue.cpp \
   Compatibility.cpp \
   $(NULL)
 
 EXPORTS = \
@@ -88,22 +88,22 @@ EXPORTS = \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   nsApplicationAccessibleWrap.h \
   ia2AccessibleAction.h \
+  ia2AccessibleComponent.h \
   CAccessibleImage.h \
-  CAccessibleComponent.h \
   CAccessibleText.h \
   CAccessibleEditableText.h \
   CAccessibleHyperlink.h \
-  CAccessibleHypertext.h \
+  ia2AccessibleHypertext.h \
   CAccessibleTable.h \
   CAccessibleTableCell.h \
   CAccessibleValue.h \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
rename from accessible/src/msaa/CAccessibleComponent.cpp
rename to accessible/src/msaa/ia2AccessibleComponent.cpp
--- a/accessible/src/msaa/CAccessibleComponent.cpp
+++ b/accessible/src/msaa/ia2AccessibleComponent.cpp
@@ -33,75 +33,67 @@
  * 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 "CAccessibleComponent.h"
+#include "ia2AccessibleComponent.h"
 
 #include "AccessibleComponent_i.c"
 
-#include "nsAccessible.h"
-#include "nsCoreUtils.h"
-#include "nsWinUtils.h"
+#include "nsAccessibleWrap.h"
 #include "States.h"
 
-#include "nsString.h"
-
-#include "nsIDOMCSSPrimitiveValue.h"
-#include "nsIDOMNSRGBAColor.h"
+#include "nsIFrame.h"
 
 using namespace mozilla::a11y;
 
 // IUnknown
 
 STDMETHODIMP
-CAccessibleComponent::QueryInterface(REFIID iid, void** ppv)
+ia2AccessibleComponent::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
 
   if (IID_IAccessibleComponent == iid) {
     *ppv = static_cast<IAccessibleComponent*>(this);
     (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
     return S_OK;
   }
 
   return E_NOINTERFACE;
 }
 
 // IAccessibleComponent
 
 STDMETHODIMP
-CAccessibleComponent::get_locationInParent(long *aX, long *aY)
+ia2AccessibleComponent::get_locationInParent(long* aX, long* aY)
 {
 __try {
   *aX = 0;
   *aY = 0;
 
-  nsRefPtr<nsAccessible> acc(do_QueryObject(this));
+  nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   // If the object is not on any screen the returned position is (0,0).
   PRUint64 state = acc->State();
   if (state & states::INVISIBLE)
     return S_OK;
 
   PRInt32 x = 0, y = 0, width = 0, height = 0;
   nsresult rv = acc->GetBounds(&x, &y, &width, &height);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
-  nsCOMPtr<nsIAccessible> parentAcc;
-  rv = acc->GetParent(getter_AddRefs(parentAcc));
-  if (NS_FAILED(rv))
-    return GetHRESULT(rv);
+  nsAccessible* parentAcc = acc->Parent();
 
   // The coordinates of the returned position are relative to this object's
   // parent or relative to the screen on which this object is rendered if it
   // has no parent.
   if (!parentAcc) {
     *aX = x;
     *aY = y;
     return S_OK;
@@ -118,39 +110,39 @@ CAccessibleComponent::get_locationInPare
   *aY = y - parenty;
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
-CAccessibleComponent::get_foreground(IA2Color* aForeground)
+ia2AccessibleComponent::get_foreground(IA2Color* aForeground)
 {
 __try {
-  nsRefPtr<nsAccessible> acc(do_QueryObject(this));
+  nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsIFrame* frame = acc->GetFrame();
   if (frame)
     *aForeground = frame->GetStyleColor()->mColor;
 
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return E_FAIL;
 }
 
 STDMETHODIMP
-CAccessibleComponent::get_background(IA2Color* aBackground)
+ia2AccessibleComponent::get_background(IA2Color* aBackground)
 {
 __try {
-  nsRefPtr<nsAccessible> acc(do_QueryObject(this));
+  nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsIFrame* frame = acc->GetFrame();
   if (frame)
     *aBackground = frame->GetStyleBackground()->mBackgroundColor;
 
   return S_OK;
rename from accessible/src/msaa/CAccessibleComponent.h
rename to accessible/src/msaa/ia2AccessibleComponent.h
--- a/accessible/src/msaa/CAccessibleComponent.h
+++ b/accessible/src/msaa/ia2AccessibleComponent.h
@@ -33,39 +33,34 @@
  * 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 _ACCESSIBLE_COMPONENt_H
-#define _ACCESSIBLE_COMPONENT_H
-
-#include "nsISupports.h"
+#ifndef IA2_ACCESSIBLE_COMPONENT_H_
+#define IA2_ACCESSIBLE_COMPONENT_H_
 
 #include "AccessibleComponent.h"
 
-class CAccessibleComponent: public IAccessibleComponent
+class ia2AccessibleComponent : public IAccessibleComponent
 {
 public:
 
   // IUnknown
   STDMETHODIMP QueryInterface(REFIID, void**);
 
   // IAccessibleComponent
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_locationInParent(
       /* [out] */ long *x,
       /* [retval][out] */ long *y);
 
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_foreground(
       /* [retval][out] */ IA2Color *foreground);
 
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_background(
       /* [retval][out] */ IA2Color *background);
-
-  // nsISupports
-  NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
 };
 
 #endif
 
rename from accessible/src/msaa/CAccessibleHypertext.cpp
rename to accessible/src/msaa/ia2AccessibleHypertext.cpp
--- a/accessible/src/msaa/CAccessibleHypertext.cpp
+++ b/accessible/src/msaa/ia2AccessibleHypertext.cpp
@@ -33,68 +33,68 @@
  * 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 "CAccessibleHypertext.h"
+#include "ia2AccessibleHypertext.h"
 
 #include "AccessibleHypertext_i.c"
 
-#include "nsHyperTextAccessible.h"
+#include "nsHyperTextAccessibleWrap.h"
 
 // IUnknown
 
 STDMETHODIMP
-CAccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
+ia2AccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
   if (IID_IAccessibleHypertext == iid) {
-    nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryObject(this));
-    if (!hyperAcc)
-      return E_NOINTERFACE;
-
-    *ppv = static_cast<IAccessibleHypertext*>(this);
-    (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
-    return S_OK;
+    nsHyperTextAccessibleWrap* hyperAcc = static_cast<nsHyperTextAccessibleWrap*>(this);
+    if (hyperAcc->IsTextRole()) {
+      *ppv = static_cast<IAccessibleHypertext*>(this);
+      (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
+      return S_OK;
+    }
+    return E_NOINTERFACE;
   }
 
   return CAccessibleText::QueryInterface(iid, ppv);
 }
 
 // IAccessibleHypertext
 
 STDMETHODIMP
-CAccessibleHypertext::get_nHyperlinks(long *aHyperlinkCount)
+ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
 {
 __try {
   *aHyperlinkCount = 0;
 
-  nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(this);
+  nsHyperTextAccessibleWrap* hyperText = static_cast<nsHyperTextAccessibleWrap*>(this);
   if (hyperText->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkCount = hyperText->GetLinkCount();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
-CAccessibleHypertext::get_hyperlink(long aLinkIndex,
-                                    IAccessibleHyperlink **aHyperlink)
+ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
+                                      IAccessibleHyperlink** aHyperlink)
 {
 __try {
   *aHyperlink = NULL;
 
-  nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(this);
+  nsHyperTextAccessibleWrap* hyperText = static_cast<nsHyperTextAccessibleWrap*>(this);
   if (hyperText->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAccessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
   nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(hyperLink));
   if (!winAccessNode)
     return E_FAIL;
 
@@ -107,22 +107,22 @@ CAccessibleHypertext::get_hyperlink(long
   *aHyperlink = static_cast<IAccessibleHyperlink*>(instancePtr);
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
-CAccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long *aHyperlinkIndex)
+ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkIndex)
 {
 __try {
   *aHyperlinkIndex = 0;
 
-  nsRefPtr<nsHyperTextAccessible> hyperAcc(do_QueryObject(this));
+  nsHyperTextAccessibleWrap* hyperAcc = static_cast<nsHyperTextAccessibleWrap*>(this);
   if (hyperAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkIndex = hyperAcc->GetLinkIndexAtOffset(aCharIndex);
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
rename from accessible/src/msaa/CAccessibleHypertext.h
rename to accessible/src/msaa/ia2AccessibleHypertext.h
--- a/accessible/src/msaa/CAccessibleHypertext.h
+++ b/accessible/src/msaa/ia2AccessibleHypertext.h
@@ -41,37 +41,37 @@
 #ifndef _ACCESSIBLE_HYPERTEXT_H
 #define _ACCESSIBLE_HYPERTEXT_H
 
 #include "nsISupports.h"
 
 #include "CAccessibleText.h"
 #include "AccessibleHypertext.h"
 
-class CAccessibleHypertext: public CAccessibleText,
-                            public IAccessibleHypertext
+class ia2AccessibleHypertext : public CAccessibleText,
+                               public IAccessibleHypertext
 {
 public:
 
   // IUnknown
   STDMETHODIMP QueryInterface(REFIID, void**);
 
   // IAccessibleText
   FORWARD_IACCESSIBLETEXT(CAccessibleText)
 
   // IAccessibleHypertext
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nHyperlinks(
-      /* [retval][out] */ long *hyperlinkCount);
+      /* [retval][out] */ long* hyperlinkCount);
 
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_hyperlink(
       /* [in] */ long index,
-      /* [retval][out] */ IAccessibleHyperlink **hyperlink);
+      /* [retval][out] */ IAccessibleHyperlink** hyperlink);
 
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_hyperlinkIndex(
       /* [in] */ long charIndex,
-      /* [retval][out] */ long *hyperlinkIndex);
+      /* [retval][out] */ long* hyperlinkIndex);
 
   // nsISupports
   NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
 };
 
 #endif
 
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -128,17 +128,17 @@ STDMETHODIMP nsAccessibleWrap::QueryInte
     if (numChildren > 0)  // Don't support this interface for leaf elements
       *ppv = static_cast<IEnumVARIANT*>(this);
   } else if (IID_IServiceProvider == iid)
     *ppv = static_cast<IServiceProvider*>(this);
   else if (IID_IAccessible2 == iid && !Compatibility::IsIA2Off())
     *ppv = static_cast<IAccessible2*>(this);
 
   if (NULL == *ppv) {
-    HRESULT hr = CAccessibleComponent::QueryInterface(iid, ppv);
+    HRESULT hr = ia2AccessibleComponent::QueryInterface(iid, ppv);
     if (SUCCEEDED(hr))
       return hr;
   }
 
   if (NULL == *ppv) {
     HRESULT hr = CAccessibleHyperlink::QueryInterface(iid, ppv);
     if (SUCCEEDED(hr))
       return hr;
--- a/accessible/src/msaa/nsAccessibleWrap.h
+++ b/accessible/src/msaa/nsAccessibleWrap.h
@@ -41,17 +41,17 @@
  */
 
 #ifndef _nsAccessibleWrap_H_
 #define _nsAccessibleWrap_H_
 
 #include "nsCOMPtr.h"
 #include "nsAccessible.h"
 #include "Accessible2.h"
-#include "CAccessibleComponent.h"
+#include "ia2AccessibleComponent.h"
 #include "CAccessibleHyperlink.h"
 #include "CAccessibleValue.h"
 
 #define DECL_IUNKNOWN_INHERITED                                               \
 public:                                                                       \
 STDMETHODIMP QueryInterface(REFIID, void**);                                  \
 
 #define IMPL_IUNKNOWN_QUERY_HEAD(Class)                                       \
@@ -92,17 +92,17 @@ Class::QueryInterface(REFIID iid, void**
   IMPL_IUNKNOWN_QUERY_HEAD(Class)                                             \
   IMPL_IUNKNOWN_QUERY_ENTRY(I1);                                              \
   IMPL_IUNKNOWN_QUERY_ENTRY(I2);                                              \
   IMPL_IUNKNOWN_QUERY_ENTRY(Super)                                            \
   IMPL_IUNKNOWN_QUERY_TAIL                                                    \
 
 
 class nsAccessibleWrap : public nsAccessible,
-                         public CAccessibleComponent,
+                         public ia2AccessibleComponent,
                          public CAccessibleHyperlink,
                          public CAccessibleValue,
                          public IAccessible2,
                          public IEnumVARIANT
 {
 public: // construction, destruction
   nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc);
   virtual ~nsAccessibleWrap();
--- a/accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
@@ -42,17 +42,17 @@
 
 #include "nsEventShell.h"
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsHyperTextAccessibleWrap,
                              nsHyperTextAccessible)
 
 IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
                          nsAccessibleWrap,
-                         CAccessibleHypertext,
+                         ia2AccessibleHypertext,
                          CAccessibleEditableText);
 
 nsresult
 nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
   PRUint32 eventType = aEvent->GetEventType();
 
   if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
--- a/accessible/src/msaa/nsHyperTextAccessibleWrap.h
+++ b/accessible/src/msaa/nsHyperTextAccessibleWrap.h
@@ -39,20 +39,20 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _NSHYPERTEXTACCESSIBLEWRAP_H
 #define _NSHYPERTEXTACCESSIBLEWRAP_H
 
 #include "nsHyperTextAccessible.h"
 #include "CAccessibleText.h"
 #include "CAccessibleEditableText.h"
-#include "CAccessibleHyperText.h"
+#include "ia2AccessibleHyperText.h"
 
 class nsHyperTextAccessibleWrap : public nsHyperTextAccessible,
-                                  public CAccessibleHypertext,
+                                  public ia2AccessibleHypertext,
                                   public CAccessibleEditableText
 {
 public:
   nsHyperTextAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
     nsHyperTextAccessible(aContent, aDoc) {}
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
--- a/accessible/src/xpcom/xpcAccessibleTable.cpp
+++ b/accessible/src/xpcom/xpcAccessibleTable.cpp
@@ -17,16 +17,29 @@ xpcAccessibleTable::GetCaption(nsIAccess
   if (!mTable)
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aCaption = mTable->Caption());
   return NS_OK;
 }
 
 nsresult
+xpcAccessibleTable::GetSummary(nsAString& aSummary)
+{
+  if (!mTable)
+    return NS_ERROR_FAILURE;
+
+  nsAutoString summary;
+  mTable->Summary(summary);
+  aSummary.Assign(summary);
+
+  return NS_OK;
+}
+
+nsresult
 xpcAccessibleTable::IsProbablyForLayout(bool* aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = false;
   if (!mTable)
     return NS_ERROR_FAILURE;
 
   *aResult = mTable->IsProbablyLayoutTable();
--- a/accessible/src/xpcom/xpcAccessibleTable.h
+++ b/accessible/src/xpcom/xpcAccessibleTable.h
@@ -2,41 +2,44 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
 #define MOZILLA_A11Y_XPCOM_XPACCESSIBLETABLE_H_
 
+#include "nsAString.h"
 #include "nscore.h"
 
 class nsIAccessible;
 namespace mozilla {
 namespace a11y {
 class TableAccessible;
 }
 }
 
 class xpcAccessibleTable
 {
 public:
   xpcAccessibleTable(mozilla::a11y::TableAccessible* aTable) : mTable(aTable) { }
 
   nsresult GetCaption(nsIAccessible** aCaption);
+  nsresult GetSummary(nsAString& aSummary);
   nsresult IsProbablyForLayout(bool* aIsForLayout);
 
 protected:
   mozilla::a11y::TableAccessible* mTable;
 };
 
 #define NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE \
   NS_IMETHOD GetCaption(nsIAccessible** aCaption) \
     { return xpcAccessibleTable::GetCaption(aCaption); } \
-  NS_SCRIPTABLE NS_IMETHOD GetSummary(nsAString & aSummary); \
+  NS_SCRIPTABLE NS_IMETHOD GetSummary(nsAString & aSummary) \
+    { return xpcAccessibleTable::GetSummary(aSummary); } \
   NS_SCRIPTABLE NS_IMETHOD GetColumnCount(PRInt32 *aColumnCount); \
   NS_SCRIPTABLE NS_IMETHOD GetRowCount(PRInt32 *aRowCount); \
   NS_SCRIPTABLE NS_IMETHOD GetCellAt(PRInt32 rowIndex, PRInt32 columnIndex, nsIAccessible * *_retval NS_OUTPARAM); \
   NS_SCRIPTABLE NS_IMETHOD GetCellIndexAt(PRInt32 rowIndex, PRInt32 columnIndex, PRInt32 *_retval NS_OUTPARAM); \
   NS_SCRIPTABLE NS_IMETHOD GetColumnIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
   NS_SCRIPTABLE NS_IMETHOD GetRowIndexAt(PRInt32 cellIndex, PRInt32 *_retval NS_OUTPARAM); \
   NS_SCRIPTABLE NS_IMETHOD GetRowAndColumnIndicesAt(PRInt32 cellIndex, PRInt32 *rowIndex NS_OUTPARAM, PRInt32 *columnIndex NS_OUTPARAM); \
   NS_SCRIPTABLE NS_IMETHOD GetColumnExtentAt(PRInt32 row, PRInt32 column, PRInt32 *_retval NS_OUTPARAM); \
--- a/accessible/src/xul/Makefile.in
+++ b/accessible/src/xul/Makefile.in
@@ -49,17 +49,17 @@ LIBXUL_LIBRARY = 1
 
 
 
 CPPSRCS = \
   XULSelectControlAccessible.cpp \
   nsXULAlertAccessible.cpp \
   nsXULColorPickerAccessible.cpp \
   nsXULComboboxAccessible.cpp \
-  nsXULFormControlAccessible.cpp \
+  XULFormControlAccessible.cpp \
   nsXULListboxAccessible.cpp \
   nsXULMenuAccessible.cpp \
   nsXULSliderAccessible.cpp \
   nsXULTabAccessible.cpp \
   nsXULTextAccessible.cpp \
   nsXULTreeAccessible.cpp \
   nsXULTreeGridAccessible.cpp \
   $(NULL)
rename from accessible/src/xul/nsXULFormControlAccessible.cpp
rename to accessible/src/xul/XULFormControlAccessible.cpp
--- a/accessible/src/xul/nsXULFormControlAccessible.cpp
+++ b/accessible/src/xul/XULFormControlAccessible.cpp
@@ -32,102 +32,102 @@
  * 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 "nsXULFormControlAccessible.h"
+#include "XULFormControlAccessible.h"
 
+#include "Accessible-inl.h"
+#include "HTMLFormControlAccessible.h"
 #include "nsAccUtils.h"
 #include "nsAccTreeWalker.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
+#include "nsIAccessibleRelation.h"
+#include "nsXULMenuAccessible.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
-// NOTE: alphabetically ordered
-#include "nsHTMLFormControlAccessible.h"
-#include "nsXULMenuAccessible.h"
-#include "nsIAccessibleRelation.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNSEditableElement.h"
 #include "nsIDOMXULButtonElement.h"
 #include "nsIDOMXULCheckboxElement.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULTextboxElement.h"
 #include "nsIEditor.h"
 #include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsITextControlFrame.h"
 #include "nsMenuPopupFrame.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULButtonAccessible
+// XULButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULButtonAccessible::
-  nsXULButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+XULButtonAccessible::
+  XULButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsAccessibleWrap(aContent, aDoc)
 {
   if (ContainsMenu())
     mFlags |= eMenuButtonAccessible;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULButtonAccessible: nsISupports
+// XULButtonAccessible: nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsXULButtonAccessible, nsAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(XULButtonAccessible, nsAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULButtonAccessible: nsIAccessible
+// XULButtonAccessible: nsIAccessible
 
 PRUint8
-nsXULButtonAccessible::ActionCount()
+XULButtonAccessible::ActionCount()
 {
   return 1;
 }
 
 NS_IMETHODIMP
-nsXULButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+XULButtonAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {
     aName.AssignLiteral("press"); 
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 NS_IMETHODIMP
-nsXULButtonAccessible::DoAction(PRUint8 aIndex)
+XULButtonAccessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex != 0)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULButtonAccessible: nsAccessible
+// XULButtonAccessible: nsAccessible
 
 role
-nsXULButtonAccessible::NativeRole()
+XULButtonAccessible::NativeRole()
 {
   return roles::PUSHBUTTON;
 }
 
 PRUint64
-nsXULButtonAccessible::NativeState()
+XULButtonAccessible::NativeState()
 {
   // Possible states: focused, focusable, unavailable(disabled).
 
   // get focus and disable status from base class
   PRUint64 state = nsAccessible::NativeState();
 
   bool disabled = false;
   nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mContent));
@@ -164,56 +164,56 @@ nsXULButtonAccessible::NativeState()
 
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::_default))
     state |= states::DEFAULT;
 
   return state;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULButtonAccessible: Widgets
+// XULButtonAccessible: Widgets
 
 bool
-nsXULButtonAccessible::IsWidget() const
+XULButtonAccessible::IsWidget() const
 {
   return true;
 }
 
 bool
-nsXULButtonAccessible::IsActiveWidget() const
+XULButtonAccessible::IsActiveWidget() const
 {
   return FocusMgr()->HasDOMFocus(mContent);
 }
 
 bool
-nsXULButtonAccessible::AreItemsOperable() const
+XULButtonAccessible::AreItemsOperable() const
 {
   if (IsMenuButton()) {
     nsAccessible* menuPopup = mChildren.SafeElementAt(0, nsnull);
     if (menuPopup) {
       nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(menuPopup->GetFrame());
       return menuPopupFrame->IsOpen();
     }
   }
   return false; // no items
 }
 
 nsAccessible*
-nsXULButtonAccessible::ContainerWidget() const
+XULButtonAccessible::ContainerWidget() const
 {
   if (IsMenuButton() && mParent && mParent->IsAutoComplete())
     return mParent;
   return nsnull;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULButtonAccessible: nsAccessible protected
+// XULButtonAccessible: nsAccessible protected
 
 void
-nsXULButtonAccessible::CacheChildren()
+XULButtonAccessible::CacheChildren()
 {
   // In general XUL button has not accessible children. Nevertheless menu
   // buttons can have button (@type="menu-button") and popup accessibles
   // (@type="menu-button" or @type="menu").
 
   // XXX: no children until the button is menu button. Probably it's not
   // totally correct but in general AT wants to have leaf buttons.
   bool isMenu = mContent->AttrValueIs(kNameSpaceID_None,
@@ -259,46 +259,47 @@ nsXULButtonAccessible::CacheChildren()
     return;
 
   AppendChild(menupopup);
   if (button)
     AppendChild(button);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULButtonAccessible protected
+// XULButtonAccessible protected
 
 bool
-nsXULButtonAccessible::ContainsMenu()
+XULButtonAccessible::ContainsMenu()
 {
   static nsIContent::AttrValuesArray strings[] =
     {&nsGkAtoms::menu, &nsGkAtoms::menuButton, nsnull};
 
   return mContent->FindAttrValueIn(kNameSpaceID_None,
                                    nsGkAtoms::type,
                                    strings, eCaseMatters) >= 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULDropmarkerAccessible
+// XULDropmarkerAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULDropmarkerAccessible::
-  nsXULDropmarkerAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsFormControlAccessible(aContent, aDoc)
+XULDropmarkerAccessible::
+  XULDropmarkerAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+  nsLeafAccessible(aContent, aDoc)
 {
 }
 
 PRUint8
-nsXULDropmarkerAccessible::ActionCount()
+XULDropmarkerAccessible::ActionCount()
 {
   return 1;
 }
 
-bool nsXULDropmarkerAccessible::DropmarkerOpen(bool aToggleOpen)
+bool
+XULDropmarkerAccessible::DropmarkerOpen(bool aToggleOpen)
 {
   bool isOpen = false;
 
   nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement =
     do_QueryInterface(mContent->GetParent());
 
   if (parentButtonElement) {
     parentButtonElement->GetOpen(&isOpen);
@@ -316,79 +317,82 @@ bool nsXULDropmarkerAccessible::Dropmark
   }
 
   return isOpen;
 }
 
 /**
   * Return the name of our only action
   */
-NS_IMETHODIMP nsXULDropmarkerAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+NS_IMETHODIMP
+XULDropmarkerAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {
     if (DropmarkerOpen(false))
       aName.AssignLiteral("close");
     else
       aName.AssignLiteral("open");
     return NS_OK;
   }
 
   return NS_ERROR_INVALID_ARG;
 }
 
 /**
   * Tell the Dropmarker to do its action
   */
-NS_IMETHODIMP nsXULDropmarkerAccessible::DoAction(PRUint8 index)
+NS_IMETHODIMP
+XULDropmarkerAccessible::DoAction(PRUint8 index)
 {
   if (index == eAction_Click) {
     DropmarkerOpen(true); // Reverse the open attribute
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 role
-nsXULDropmarkerAccessible::NativeRole()
+XULDropmarkerAccessible::NativeRole()
 {
   return roles::PUSHBUTTON;
 }
 
 PRUint64
-nsXULDropmarkerAccessible::NativeState()
+XULDropmarkerAccessible::NativeState()
 {
   return DropmarkerOpen(false) ? states::PRESSED : 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULCheckboxAccessible
+// XULCheckboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULCheckboxAccessible::
-  nsXULCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsFormControlAccessible(aContent, aDoc)
+XULCheckboxAccessible::
+  XULCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+  nsLeafAccessible(aContent, aDoc)
 {
 }
 
 role
-nsXULCheckboxAccessible::NativeRole()
+XULCheckboxAccessible::NativeRole()
 {
   return roles::CHECKBUTTON;
 }
 
 PRUint8
-nsXULCheckboxAccessible::ActionCount()
+XULCheckboxAccessible::ActionCount()
 {
   return 1;
 }
 
 /**
   * Return the name of our only action
   */
-NS_IMETHODIMP nsXULCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+NS_IMETHODIMP
+XULCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {
     // check or uncheck
 
     if (NativeState() & states::CHECKED)
       aName.AssignLiteral("uncheck");
     else
       aName.AssignLiteral("check");
@@ -397,31 +401,31 @@ NS_IMETHODIMP nsXULCheckboxAccessible::G
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 /**
   * Tell the checkbox to do its only action -- check( or uncheck) itself
   */
 NS_IMETHODIMP
-nsXULCheckboxAccessible::DoAction(PRUint8 aIndex)
+XULCheckboxAccessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex != eAction_Click)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
 PRUint64
-nsXULCheckboxAccessible::NativeState()
+XULCheckboxAccessible::NativeState()
 {
   // Possible states: focused, focusable, unavailable(disabled), checked
   // Get focus and disable status from base class
-  PRUint64 state = nsFormControlAccessible::NativeState();
+  PRUint64 state = nsLeafAccessible::NativeState();
   
   state |= states::CHECKABLE;
   
   // Determine Checked state
   nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement =
     do_QueryInterface(mContent);
   if (xulCheckboxElement) {
     bool checked = false;
@@ -434,45 +438,45 @@ nsXULCheckboxAccessible::NativeState()
         state |= states::MIXED;
     }
   }
 
   return state;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULGroupboxAccessible
+// XULGroupboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULGroupboxAccessible::
-  nsXULGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+XULGroupboxAccessible::
+  XULGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsAccessibleWrap(aContent, aDoc)
 {
 }
 
 role
-nsXULGroupboxAccessible::NativeRole()
+XULGroupboxAccessible::NativeRole()
 {
   return roles::GROUPING;
 }
 
 nsresult
-nsXULGroupboxAccessible::GetNameInternal(nsAString& aName)
+XULGroupboxAccessible::GetNameInternal(nsAString& aName)
 {
   // XXX: we use the first related accessible only.
   nsAccessible* label =
     RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY).Next();
   if (label)
     return label->GetName(aName);
 
   return NS_OK;
 }
 
 Relation
-nsXULGroupboxAccessible::RelationByType(PRUint32 aType)
+XULGroupboxAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
     return rel;
 
   // The label for xul:groupbox is generated from xul:label that is
   // inside the anonymous content of the xul:caption.
   // The xul:label has an accessible object but the xul:caption does not
@@ -491,29 +495,29 @@ nsXULGroupboxAccessible::RelationByType(
         }
     }
   }
 
   return rel;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULRadioButtonAccessible
+// XULRadioButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULRadioButtonAccessible::
-  nsXULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsRadioButtonAccessible(aContent, aDoc)
+XULRadioButtonAccessible::
+  XULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+  RadioButtonAccessible(aContent, aDoc)
 {
 }
 
 PRUint64
-nsXULRadioButtonAccessible::NativeState()
+XULRadioButtonAccessible::NativeState()
 {
-  PRUint64 state = nsFormControlAccessible::NativeState();
+  PRUint64 state = nsLeafAccessible::NativeState();
   state |= states::CHECKABLE;
 
   if (!(state & states::UNAVAILABLE))
     state |= states::FOCUSABLE;
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton =
     do_QueryInterface(mContent);
   if (radioButton) {
@@ -523,111 +527,111 @@ nsXULRadioButtonAccessible::NativeState(
       state |= states::CHECKED;
     }
   }
 
   return state;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULRadioButtonAccessible: Widgets
+// XULRadioButtonAccessible: Widgets
 
 nsAccessible*
-nsXULRadioButtonAccessible::ContainerWidget() const
+XULRadioButtonAccessible::ContainerWidget() const
 {
   return mParent;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULRadioGroupAccessible
+// XULRadioGroupAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
   * XUL Radio Group
   *   The Radio Group proxies for the Radio Buttons themselves. The Group gets
   *   focus whereas the Buttons do not. So we only have an accessible object for
   *   this for the purpose of getting the proper RadioButton. Need this here to 
   *   avoid circular reference problems when navigating the accessible tree and
   *   for getting to the radiobuttons.
   */
 
-nsXULRadioGroupAccessible::
-  nsXULRadioGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+XULRadioGroupAccessible::
+  XULRadioGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   XULSelectControlAccessible(aContent, aDoc)
 { 
 }
 
 role
-nsXULRadioGroupAccessible::NativeRole()
+XULRadioGroupAccessible::NativeRole()
 {
   return roles::GROUPING;
 }
 
 PRUint64
-nsXULRadioGroupAccessible::NativeState()
+XULRadioGroupAccessible::NativeState()
 {
   // The radio group is not focusable. Sometimes the focus controller will
   // report that it is focused. That means that the actual selected radio button
   // should be considered focused.
   return nsAccessible::NativeState() & ~(states::FOCUSABLE | states::FOCUSED);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULRadioGroupAccessible: Widgets
+// XULRadioGroupAccessible: Widgets
 
 bool
-nsXULRadioGroupAccessible::IsWidget() const
+XULRadioGroupAccessible::IsWidget() const
 {
   return true;
 }
 
 bool
-nsXULRadioGroupAccessible::IsActiveWidget() const
+XULRadioGroupAccessible::IsActiveWidget() const
 {
   return FocusMgr()->HasDOMFocus(mContent);
 }
 
 bool
-nsXULRadioGroupAccessible::AreItemsOperable() const
+XULRadioGroupAccessible::AreItemsOperable() const
 {
   return true;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULStatusBarAccessible
+// XULStatusBarAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULStatusBarAccessible::
-  nsXULStatusBarAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+XULStatusBarAccessible::
+  XULStatusBarAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsAccessibleWrap(aContent, aDoc)
 {
 }
 
 role
-nsXULStatusBarAccessible::NativeRole()
+XULStatusBarAccessible::NativeRole()
 {
   return roles::STATUSBAR;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULToolbarButtonAccessible
+// XULToolbarButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULToolbarButtonAccessible::
-  nsXULToolbarButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
-  nsXULButtonAccessible(aContent, aDoc)
+XULToolbarButtonAccessible::
+  XULToolbarButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+  XULButtonAccessible(aContent, aDoc)
 {
 }
 
 void
-nsXULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
-                                                         PRInt32 *aSetSize)
+XULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32* aPosInSet,
+                                                       PRInt32* aSetSize)
 {
   PRInt32 setSize = 0;
   PRInt32 posInSet = 0;
 
   nsAccessible* parent = Parent();
   if (!parent)
     return;
 
@@ -648,93 +652,96 @@ nsXULToolbarButtonAccessible::GetPositio
     }
   }
 
   *aPosInSet = posInSet;
   *aSetSize = setSize;
 }
 
 bool
-nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible)
+XULToolbarButtonAccessible::IsSeparator(nsAccessible* aAccessible)
 {
   nsIContent* content = aAccessible->GetContent();
   return content && ((content->Tag() == nsGkAtoms::toolbarseparator) ||
                      (content->Tag() == nsGkAtoms::toolbarspacer) ||
                      (content->Tag() == nsGkAtoms::toolbarspring)); }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULToolbarAccessible
+// XULToolbarAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULToolbarAccessible::
-  nsXULToolbarAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+XULToolbarAccessible::
+  XULToolbarAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsAccessibleWrap(aContent, aDoc)
 {
 }
 
 role
-nsXULToolbarAccessible::NativeRole()
+XULToolbarAccessible::NativeRole()
 {
   return roles::TOOLBAR;
 }
 
 nsresult
-nsXULToolbarAccessible::GetNameInternal(nsAString& aName)
+XULToolbarAccessible::GetNameInternal(nsAString& aName)
 {
   nsAutoString name;
   if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::toolbarname, name)) {
     name.CompressWhitespace();
     aName = name;
   }
 
   return NS_OK;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULToolbarAccessible
+// XULToolbarAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULToolbarSeparatorAccessible::
-  nsXULToolbarSeparatorAccessible(nsIContent* aContent,
-                                  nsDocAccessible* aDoc) :
+XULToolbarSeparatorAccessible::
+  XULToolbarSeparatorAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsLeafAccessible(aContent, aDoc)
 {
 }
 
 role
-nsXULToolbarSeparatorAccessible::NativeRole()
+XULToolbarSeparatorAccessible::NativeRole()
 {
   return roles::SEPARATOR;
 }
 
 PRUint64
-nsXULToolbarSeparatorAccessible::NativeState()
+XULToolbarSeparatorAccessible::NativeState()
 {
   return 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULTextFieldAccessible
+// XULTextFieldAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsXULTextFieldAccessible::
- nsXULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+XULTextFieldAccessible::
+ XULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
  nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED3(nsXULTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
+NS_IMPL_ISUPPORTS_INHERITED3(XULTextFieldAccessible,
+                             nsAccessible,
+                             nsHyperTextAccessible,
+                             nsIAccessibleText,
+                             nsIAccessibleEditableText)
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULTextFieldAccessible: nsIAccessible
+// XULTextFieldAccessible: nsIAccessible
 
 void
-nsXULTextFieldAccessible::Value(nsString& aValue)
+XULTextFieldAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
   if (NativeRole() == roles::PASSWORD_TEXT) // Don't return password text!
     return;
 
   nsCOMPtr<nsIDOMXULTextBoxElement> textBox(do_QueryInterface(mContent));
   if (textBox) {
     textBox->GetValue(aValue);
@@ -742,36 +749,36 @@ nsXULTextFieldAccessible::Value(nsString
   }
 
   nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
   if (menuList)
     menuList->GetLabel(aValue);
 }
 
 void
-nsXULTextFieldAccessible::ApplyARIAState(PRUint64* aState)
+XULTextFieldAccessible::ApplyARIAState(PRUint64* aState)
 {
   nsHyperTextAccessibleWrap::ApplyARIAState(aState);
 
   aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
 
 }
 
 PRUint64
-nsXULTextFieldAccessible::NativeState()
+XULTextFieldAccessible::NativeState()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
 
   nsCOMPtr<nsIContent> inputField(GetInputField());
   NS_ENSURE_TRUE(inputField, state);
 
   // Create a temporary accessible from the HTML text field to get
   // the accessible state from. Doesn't add to cache into document cache.
-  nsRefPtr<nsHTMLTextFieldAccessible> tempAccessible =
-    new nsHTMLTextFieldAccessible(inputField, mDoc);
+  nsRefPtr<HTMLTextFieldAccessible> tempAccessible =
+    new HTMLTextFieldAccessible(inputField, mDoc);
   if (!tempAccessible)
     return state;
 
   state |= tempAccessible->NativeState();
 
   nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
   if (menuList) {
     // <xul:menulist droppable="false">
@@ -781,130 +788,132 @@ nsXULTextFieldAccessible::NativeState()
       state |= states::READONLY;
     }
   }
 
   return state;
 }
 
 role
-nsXULTextFieldAccessible::NativeRole()
+XULTextFieldAccessible::NativeRole()
 {
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::password, eIgnoreCase))
     return roles::PASSWORD_TEXT;
   
   return roles::ENTRY;
 }
 
 /**
   * Only one actions available
   */
 PRUint8
-nsXULTextFieldAccessible::ActionCount()
+XULTextFieldAccessible::ActionCount()
 {
   return 1;
 }
 
 /**
   * Return the name of our only action
   */
-NS_IMETHODIMP nsXULTextFieldAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+NS_IMETHODIMP
+XULTextFieldAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Click) {
     aName.AssignLiteral("activate"); 
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 /**
   * Tell the button to do its action
   */
-NS_IMETHODIMP nsXULTextFieldAccessible::DoAction(PRUint8 index)
+NS_IMETHODIMP
+XULTextFieldAccessible::DoAction(PRUint8 index)
 {
   if (index == 0) {
     nsCOMPtr<nsIDOMXULElement> element(do_QueryInterface(mContent));
     if (element)
     {
       element->Focus();
       return NS_OK;
     }
     return NS_ERROR_FAILURE;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 bool
-nsXULTextFieldAccessible::CanHaveAnonChildren()
+XULTextFieldAccessible::CanHaveAnonChildren()
 {
   return false;
 }
 
 already_AddRefed<nsIEditor>
-nsXULTextFieldAccessible::GetEditor() const
+XULTextFieldAccessible::GetEditor() const
 {
   nsCOMPtr<nsIContent> inputField = GetInputField();
   nsCOMPtr<nsIDOMNSEditableElement> editableElt(do_QueryInterface(inputField));
   if (!editableElt)
     return nsnull;
 
   nsCOMPtr<nsIEditor> editor;
   editableElt->GetEditor(getter_AddRefs(editor));
   return editor.forget();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULTextFieldAccessible: nsAccessible protected
+// XULTextFieldAccessible: nsAccessible protected
 
 void
-nsXULTextFieldAccessible::CacheChildren()
+XULTextFieldAccessible::CacheChildren()
 {
   NS_ENSURE_TRUE(mDoc,);
   // Create child accessibles for native anonymous content of underlying HTML
   // input element.
   nsCOMPtr<nsIContent> inputContent(GetInputField());
   if (!inputContent)
     return;
 
   nsAccTreeWalker walker(mDoc, inputContent, false);
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULTextFieldAccessible: nsHyperTextAccessible protected
+// XULTextFieldAccessible: nsHyperTextAccessible protected
 
 already_AddRefed<nsFrameSelection>
-nsXULTextFieldAccessible::FrameSelection()
+XULTextFieldAccessible::FrameSelection()
 {
   nsCOMPtr<nsIContent> inputContent(GetInputField());
   nsIFrame* frame = inputContent->GetPrimaryFrame();
   return frame ? frame->GetFrameSelection() : nsnull;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsXULTextFieldAccessible protected
+// XULTextFieldAccessible protected
 
 already_AddRefed<nsIContent>
-nsXULTextFieldAccessible::GetInputField() const
+XULTextFieldAccessible::GetInputField() const
 {
   nsCOMPtr<nsIDOMNode> inputFieldDOMNode;
   nsCOMPtr<nsIDOMXULTextBoxElement> textBox = do_QueryInterface(mContent);
   if (textBox) {
     textBox->GetInputField(getter_AddRefs(inputFieldDOMNode));
 
   } else {
     // <xul:menulist droppable="false">
     nsCOMPtr<nsIDOMXULMenuListElement> menuList = do_QueryInterface(mContent);
     if (menuList)
       menuList->GetInputField(getter_AddRefs(inputFieldDOMNode));
   }
 
-  NS_ASSERTION(inputFieldDOMNode, "No input field for nsXULTextFieldAccessible");
+  NS_ASSERTION(inputFieldDOMNode, "No input field for XULTextFieldAccessible");
 
   nsIContent* inputField = nsnull;
   if (inputFieldDOMNode)
     CallQueryInterface(inputFieldDOMNode, &inputField);
 
   return inputField;
 }
rename from accessible/src/xul/nsXULFormControlAccessible.h
rename to accessible/src/xul/XULFormControlAccessible.h
--- a/accessible/src/xul/nsXULFormControlAccessible.h
+++ b/accessible/src/xul/XULFormControlAccessible.h
@@ -32,41 +32,44 @@
  * 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 _nsXULFormControlAccessible_H_
-#define _nsXULFormControlAccessible_H_
+#ifndef MOZILLA_A11Y_XULFormControlAccessible_H_
+#define MOZILLA_A11Y_XULFormControlAccessible_H_
 
 // NOTE: alphabetically ordered
 #include "nsAccessibleWrap.h"
-#include "nsFormControlAccessible.h"
+#include "FormControlAccessible.h"
 #include "nsHyperTextAccessibleWrap.h"
 #include "XULSelectControlAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 /**
  * Used for XUL progressmeter element.
  */
 typedef ProgressMeterAccessible<100> XULProgressMeterAccessible;
 
 /**
  * Used for XUL button.
  *
- * @note  Don't inherit from nsFormControlAccessible - it doesn't allow children
+ * @note  Don't inherit from nsLeafAccessible - it doesn't allow children
  *         and a button can have a dropmarker child.
  */
-class nsXULButtonAccessible : public nsAccessibleWrap
+class XULButtonAccessible : public nsAccessibleWrap
 {
 public:
   enum { eAction_Click = 0 };
-  nsXULButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
@@ -83,50 +86,50 @@ public:
   virtual bool AreItemsOperable() const;
   virtual nsAccessible* ContainerWidget() const;
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
 
-  // nsXULButtonAccessible
+  // XULButtonAccessible
   bool ContainsMenu();
 };
 
 
 /**
  * Used for XUL checkbox element.
  */
-class nsXULCheckboxAccessible : public nsFormControlAccessible
+class XULCheckboxAccessible : public nsLeafAccessible
 {
 public:
   enum { eAction_Click = 0 };
-  nsXULCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 /**
  * Used for XUL dropmarker element.
  */
-class nsXULDropmarkerAccessible : public nsFormControlAccessible
+class XULDropmarkerAccessible : public nsLeafAccessible
 {
 public:
   enum { eAction_Click = 0 };
-  nsXULDropmarkerAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULDropmarkerAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
@@ -136,125 +139,125 @@ public:
 
 private:
   bool DropmarkerOpen(bool aToggleOpen);
 };
 
 /**
  * Used for XUL groupbox element.
  */
-class nsXULGroupboxAccessible : public nsAccessibleWrap
+class XULGroupboxAccessible : public nsAccessibleWrap
 {
 public:
-  nsXULGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual Relation RelationByType(PRUint32 aRelationType);
 };
 
 /**
  * Used for XUL radio element (radio button).
  */
-class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
+class XULRadioButtonAccessible : public RadioButtonAccessible
 {
 
 public:
-  nsXULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual nsAccessible* ContainerWidget() const;
 };
 
 /**
  * Used for XUL radiogroup element.
  */
-class nsXULRadioGroupAccessible : public XULSelectControlAccessible
+class XULRadioGroupAccessible : public XULSelectControlAccessible
 {
 public:
-  nsXULRadioGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULRadioGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
 };
 
 /**
  * Used for XUL statusbar element.
  */
-class nsXULStatusBarAccessible : public nsAccessibleWrap
+class XULStatusBarAccessible : public nsAccessibleWrap
 {
 public:
-  nsXULStatusBarAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULStatusBarAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
 };
 
 /**
  * Used for XUL toolbarbutton element.
  */
-class nsXULToolbarButtonAccessible : public nsXULButtonAccessible
+class XULToolbarButtonAccessible : public XULButtonAccessible
 {
 public:
-  nsXULToolbarButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULToolbarButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
 
   // nsXULToolbarButtonAccessible
   static bool IsSeparator(nsAccessible *aAccessible);
 };
 
 /**
  * Used for XUL toolbar element.
  */
-class nsXULToolbarAccessible : public nsAccessibleWrap
+class XULToolbarAccessible : public nsAccessibleWrap
 {
 public:
-  nsXULToolbarAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULToolbarAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual nsresult GetNameInternal(nsAString& aName);
 };
 
 /**
  * Used for XUL toolbarseparator element.
  */
-class nsXULToolbarSeparatorAccessible : public nsLeafAccessible
+class XULToolbarSeparatorAccessible : public nsLeafAccessible
 {
 public:
-  nsXULToolbarSeparatorAccessible(nsIContent* aContent,
+  XULToolbarSeparatorAccessible(nsIContent* aContent,
                                   nsDocAccessible* aDoc);
 
   // nsAccessible
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 /**
  * Used for XUL textbox element.
  */
-class nsXULTextFieldAccessible : public nsHyperTextAccessibleWrap
+class XULTextFieldAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   enum { eAction_Click = 0 };
 
-  nsXULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  XULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsHyperTextAccessible
@@ -276,11 +279,13 @@ protected:
 
   // nsHyperTextAccessible
   virtual already_AddRefed<nsFrameSelection> FrameSelection();
 
   // nsXULTextFieldAccessible
   already_AddRefed<nsIContent> GetInputField() const;
 };
 
+} // namespace a11y
+} // namespace mozilla
 
 #endif
 
--- a/accessible/src/xul/nsXULColorPickerAccessible.cpp
+++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp
@@ -33,16 +33,17 @@
  * 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 "nsXULColorPickerAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccUtils.h"
 #include "nsAccTreeWalker.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsIDOMElement.h"
--- a/accessible/src/xul/nsXULComboboxAccessible.cpp
+++ b/accessible/src/xul/nsXULComboboxAccessible.cpp
@@ -35,16 +35,17 @@
  * 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 "nsXULComboboxAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsDocAccessible.h"
 #include "nsCoreUtils.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsIAutoCompleteInput.h"
 #include "nsIDOMXULMenuListElement.h"
--- a/accessible/src/xul/nsXULListboxAccessible.cpp
+++ b/accessible/src/xul/nsXULListboxAccessible.cpp
@@ -35,16 +35,17 @@
  * 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 "nsXULListboxAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsComponentManagerUtils.h"
 #include "nsIAutoCompleteInput.h"
@@ -236,24 +237,16 @@ nsXULListboxAccessible::NativeRole()
 
   return IsMulticolumn() ? roles::TABLE : roles::LISTBOX;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULListboxAccessible. nsIAccessibleTable
 
 NS_IMETHODIMP
-nsXULListboxAccessible::GetSummary(nsAString &aSummary)
-{
-  aSummary.Truncate();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
 {
   NS_ENSURE_ARG_POINTER(aColumnsCout);
   *aColumnsCout = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
--- a/accessible/src/xul/nsXULMenuAccessible.cpp
+++ b/accessible/src/xul/nsXULMenuAccessible.cpp
@@ -33,22 +33,23 @@
  * 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 "nsXULMenuAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
-#include "nsXULFormControlAccessible.h"
 #include "Role.h"
 #include "States.h"
+#include "XULFormControlAccessible.h"
 
 #include "nsIDOMElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIMutableArray.h"
 #include "nsIDOMXULContainerElement.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #include "nsIDOMKeyEvent.h"
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -35,16 +35,17 @@
  * 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 ***** */
 
 // NOTE: groups are alphabetically ordered
 #include "nsXULTextAccessible.h"
 
+#include "Accessible-inl.h"
 #include "nsAccUtils.h"
 #include "nsBaseWidgetAccessible.h"
 #include "nsCoreUtils.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -68,23 +68,16 @@ nsXULTreeGridAccessible::
 NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeGridAccessible,
                              nsXULTreeAccessible,
                              nsIAccessibleTable)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeGridAccessible: nsIAccessibleTable implementation
 
 NS_IMETHODIMP
-nsXULTreeGridAccessible::GetSummary(nsAString &aSummary)
-{
-  aSummary.Truncate();
-  return IsDefunct() ? NS_ERROR_FAILURE : NS_OK;
-}
-
-NS_IMETHODIMP
 nsXULTreeGridAccessible::GetColumnCount(PRInt32 *aColumnCount)
 {
   NS_ENSURE_ARG_POINTER(aColumnCount);
   *aColumnCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
--- a/accessible/tests/mochitest/events/test_focus_menu.xul
+++ b/accessible/tests/mochitest/events/test_focus_menu.xul
@@ -17,17 +17,17 @@
           src="../role.js" />
   <script type="application/javascript"
           src="../states.js" />
   <script type="application/javascript"
           src="../events.js" />
 
   <script type="application/javascript">
     //gA11yEventDumpID = "eventdump"; // debug stuff
-    //gA11yEventDumpToConsole = true; // debug stuff
+    gA11yEventDumpToConsole = true; // debug stuff
 
     var gQueue = null;
     function doTests()
     {
       // Test focus events.
       gQueue = new eventQueue();
 
       if (WIN) {
--- a/accessible/tests/mochitest/states/test_aria.html
+++ b/accessible/tests/mochitest/states/test_aria.html
@@ -158,16 +158,22 @@
       testStates("aria_vscrollbar", 0, EXT_STATE_VERTICAL);
       testStates("aria_separator", 0, EXT_STATE_HORIZONTAL);
       testStates("aria_hseparator", 0, EXT_STATE_HORIZONTAL);
       testStates("aria_vseparator", 0, EXT_STATE_VERTICAL);
       testStates("aria_slider", 0, EXT_STATE_HORIZONTAL);
       testStates("aria_hslider", 0, EXT_STATE_HORIZONTAL);
       testStates("aria_vslider", 0, EXT_STATE_VERTICAL);
 
+      // indeterminate ARIA progressbars (no aria-valuenow or aria-valuetext attribute)
+      // should expose mixed state
+      testStates("aria_progressbar", STATE_MIXED);
+      testStates("aria_progressbar_valuenow", 0, 0, STATE_MIXED);
+      testStates("aria_progressbar_valuetext", 0, 0, STATE_MIXED);
+
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 
 </head>
@@ -209,16 +215,21 @@
      title="Expose active state on current item of selectable widgets">
     Mozilla Bug 689847
   </a>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=457226"
      title="Mochitests for ARIA states">
     Mozilla Bug 457226
   </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=740851"
+     title="ARIA undetermined progressmeters should expose mixed state">
+    Mozilla Bug 740851
+  </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <div id="textbox_autocomplete_inline" role="textbox" aria-autocomplete="inline"></div>
   <div id="textbox_autocomplete_list" role="textbox" aria-autocomplete="list"></div>
   <div id="textbox_autocomplete_both" role="textbox" aria-autocomplete="both"></div>
@@ -308,10 +319,15 @@
   <div id="aria_hscrollbar" role="scrollbar" aria-orientation="horizontal">horizontal scrollbar</div>
   <div id="aria_vscrollbar"