Merge m-c to Ionmonkey.
authorSean Stangl <sstangl@mozilla.com>
Mon, 04 Jun 2012 13:30:29 -0700
changeset 106280 56ba58a77e8f11cff724a9ddb50839a0c5663e2c
parent 106279 c4ba8fc5a1d0c52f91da1e6dccd119212de02edc (current diff)
parent 95762 fe758ebc1707f681cc58df5651f1f68c1c761560 (diff)
child 106281 9e1ad66c4e85d3d116a2233eaa66499934a7166c
push id1075
push uservporof@mozilla.com
push dateThu, 13 Sep 2012 10:46:49 +0000
treeherderfx-team@f39786e8364d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone16.0a1
Merge m-c to Ionmonkey.
.hgtags
accessible/src/atk/AccessibleWrap.cpp
accessible/src/atk/nsHTMLImageAccessibleWrap.h
accessible/src/atk/nsHyperTextAccessibleWrap.h
accessible/src/base/NotificationController.cpp
accessible/src/base/NotificationController.h
accessible/src/base/TextAttrs.cpp
accessible/src/base/TextAttrs.h
accessible/src/base/nsAccDocManager.cpp
accessible/src/base/nsAccUtils.cpp
accessible/src/base/nsAccUtils.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsBaseWidgetAccessible.h
accessible/src/base/nsCaretAccessible.cpp
accessible/src/generic/ARIAGridAccessible.cpp
accessible/src/generic/ARIAGridAccessible.h
accessible/src/generic/Accessible.cpp
accessible/src/generic/Accessible.h
accessible/src/generic/DocAccessible.cpp
accessible/src/generic/DocAccessible.h
accessible/src/generic/HyperTextAccessible.cpp
accessible/src/generic/HyperTextAccessible.h
accessible/src/generic/ImageAccessible.cpp
accessible/src/generic/ImageAccessible.h
accessible/src/generic/OuterDocAccessible.cpp
accessible/src/generic/RootAccessible.cpp
accessible/src/html/HTMLFormControlAccessible.cpp
accessible/src/html/HTMLFormControlAccessible.h
accessible/src/html/nsHTMLImageAccessible.cpp
accessible/src/html/nsHTMLImageAccessible.h
accessible/src/html/nsHTMLImageMapAccessible.cpp
accessible/src/html/nsHTMLLinkAccessible.cpp
accessible/src/html/nsHTMLLinkAccessible.h
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.h
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.h
accessible/src/html/nsHTMLTextAccessible.cpp
accessible/src/html/nsHTMLTextAccessible.h
accessible/src/html/nsHyperTextAccessible.cpp
accessible/src/html/nsHyperTextAccessible.h
accessible/src/mac/nsHTMLImageAccessibleWrap.h
accessible/src/mac/nsHyperTextAccessibleWrap.h
accessible/src/msaa/CAccessibleText.cpp
accessible/src/msaa/DocAccessibleWrap.cpp
accessible/src/msaa/HyperTextAccessibleWrap.cpp
accessible/src/msaa/HyperTextAccessibleWrap.h
accessible/src/msaa/nsAccessNodeWrap.h
accessible/src/msaa/nsHTMLImageAccessibleWrap.cpp
accessible/src/msaa/nsHTMLImageAccessibleWrap.h
accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
accessible/src/msaa/nsHyperTextAccessibleWrap.h
accessible/src/other/nsHTMLImageAccessibleWrap.h
accessible/src/other/nsHyperTextAccessibleWrap.h
accessible/src/xforms/nsXFormsAccessible.cpp
accessible/src/xforms/nsXFormsAccessible.h
accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
accessible/src/xforms/nsXFormsFormControlsAccessible.h
accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
accessible/src/xul/XULFormControlAccessible.cpp
accessible/src/xul/XULFormControlAccessible.h
accessible/src/xul/nsXULColorPickerAccessible.cpp
accessible/src/xul/nsXULColorPickerAccessible.h
accessible/src/xul/nsXULComboboxAccessible.cpp
accessible/src/xul/nsXULListboxAccessible.cpp
accessible/src/xul/nsXULListboxAccessible.h
accessible/src/xul/nsXULMenuAccessible.cpp
accessible/src/xul/nsXULMenuAccessible.h
accessible/src/xul/nsXULSliderAccessible.cpp
accessible/src/xul/nsXULSliderAccessible.h
accessible/src/xul/nsXULTabAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.h
accessible/src/xul/nsXULTreeGridAccessible.cpp
accessible/src/xul/nsXULTreeGridAccessible.h
accessible/tests/mochitest/common.js
accessible/tests/mochitest/events.js
b2g/confvars.sh
b2g/installer/package-manifest.in
browser/app/profile/firefox.js
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/tabbrowser.xml
browser/base/content/test/browser_tab_dragdrop.js
browser/components/tabview/ui.js
browser/config/version.txt
browser/devtools/highlighter/test/browser_inspector_highlighter.js
browser/devtools/jar.mn
browser/devtools/styleinspector/StyleInspector.jsm
browser/devtools/webconsole/HUDService.jsm
browser/devtools/webconsole/test/Makefile.in
browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js
browser/extensions/pdfjs/content/web/images/bookmark.svg
browser/extensions/pdfjs/content/web/images/check.svg
browser/extensions/pdfjs/content/web/images/comment.svg
browser/extensions/pdfjs/content/web/images/document-print.svg
browser/extensions/pdfjs/content/web/images/download.svg
browser/extensions/pdfjs/content/web/images/go-down.svg
browser/extensions/pdfjs/content/web/images/go-up.svg
browser/extensions/pdfjs/content/web/images/nav-outline.svg
browser/extensions/pdfjs/content/web/images/nav-thumbs.svg
browser/extensions/pdfjs/content/web/images/pin-down.svg
browser/extensions/pdfjs/content/web/images/pin-up.svg
browser/extensions/pdfjs/content/web/images/zoom-in.svg
browser/extensions/pdfjs/content/web/images/zoom-out.svg
browser/extensions/pdfjs/content/web/viewer-snippet-firefox-extension.html
browser/locales/en-US/chrome/browser/browser.dtd
build/mobile/devicemanagerSUT.py
config/autoconf.mk.in
config/milestone.txt
configure.in
content/base/public/nsContentUtils.h
content/base/public/nsDOMFile.h
content/base/public/nsIDocument.h
content/base/src/nsContentUtils.cpp
content/base/src/nsDOMFile.cpp
content/base/src/nsDOMFileReader.cpp
content/base/src/nsDOMFileReader.h
content/base/src/nsDocument.cpp
content/base/src/nsFrameLoader.cpp
content/base/src/nsInProcessTabChildGlobal.cpp
content/base/src/nsXMLHttpRequest.cpp
content/base/src/nsXMLHttpRequest.h
content/base/test/Makefile.in
content/canvas/src/WebGLContext.cpp
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextValidate.cpp
content/canvas/src/nsCanvasRenderingContext2D.cpp
content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
content/events/src/nsDOMEventTargetHelper.h
content/html/content/public/nsHTMLCanvasElement.h
content/html/content/public/nsHTMLMediaElement.h
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsHTMLImageElement.cpp
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsHTMLLinkElement.cpp
content/html/content/src/nsHTMLMediaElement.cpp
content/html/content/src/nsHTMLOptGroupElement.cpp
content/html/content/src/nsHTMLOptionElement.cpp
content/html/content/src/nsHTMLOptionElement.h
content/html/content/src/nsHTMLStyleElement.cpp
content/html/content/src/nsHTMLTextAreaElement.cpp
content/html/content/src/nsTextEditorState.cpp
content/html/content/src/nsTextEditorState.h
content/media/VideoUtils.h
content/media/nsAudioStream.cpp
content/media/nsAudioStream.h
content/media/nsBuiltinDecoderReader.cpp
content/media/nsBuiltinDecoderReader.h
content/media/nsBuiltinDecoderStateMachine.cpp
content/media/nsIDOMMediaStream.idl
content/media/ogg/nsOggCodecState.cpp
content/media/ogg/nsOggCodecState.h
content/media/ogg/nsOggReader.cpp
content/media/ogg/nsOggReader.h
content/media/raw/nsRawReader.cpp
content/media/webm/nsWebMReader.cpp
content/smil/nsSMILCSSProperty.cpp
content/smil/nsSMILMappedAttribute.cpp
content/svg/content/src/SVGAnimatedPreserveAspectRatio.cpp
content/svg/content/src/nsSVGAngle.cpp
content/svg/content/src/nsSVGBoolean.cpp
content/svg/content/src/nsSVGClass.cpp
content/svg/content/src/nsSVGEnum.cpp
content/svg/content/src/nsSVGGraphicElement.cpp
content/svg/content/src/nsSVGInteger.cpp
content/svg/content/src/nsSVGIntegerPair.cpp
content/svg/content/src/nsSVGLength2.cpp
content/svg/content/src/nsSVGNumber2.cpp
content/svg/content/src/nsSVGNumberPair.cpp
content/svg/content/src/nsSVGSVGElement.cpp
content/svg/content/src/nsSVGSVGElement.h
content/svg/content/src/nsSVGString.cpp
content/svg/content/src/nsSVGViewBox.cpp
dom/Makefile.in
dom/base/ConsoleAPI.js
dom/base/Webapps.js
dom/base/Webapps.jsm
dom/base/Webapps.manifest
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/base/nsDOMScriptObjectFactory.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsFocusManager.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/dom-config.mk
dom/indexedDB/AsyncConnectionHelper.cpp
dom/indexedDB/AsyncConnectionHelper.h
dom/indexedDB/IDBCursor.cpp
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBEvents.cpp
dom/indexedDB/IDBFactory.cpp
dom/indexedDB/IDBIndex.cpp
dom/indexedDB/IDBKeyRange.cpp
dom/indexedDB/IDBKeyRange.h
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBObjectStore.h
dom/indexedDB/IDBTransaction.cpp
dom/indexedDB/IndexedDatabaseManager.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/Makefile.in
dom/ipc/PBrowser.ipdl
dom/ipc/PContent.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/locales/en-US/chrome/dom/dom.properties
dom/tests/browser/browser_ConsoleAPITests.js
dom/wifi/WifiWorker.js
dom/workers/XMLHttpRequest.cpp
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsEditor.h
editor/libeditor/html/nsHTMLCSSUtils.cpp
editor/libeditor/html/nsHTMLCSSUtils.h
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/nsHTMLEditRules.h
editor/libeditor/html/nsHTMLEditor.cpp
editor/libeditor/html/nsHTMLEditor.h
editor/libeditor/html/nsHTMLEditorStyle.cpp
embedding/android/AndroidManifest.xml.in
embedding/android/Makefile.in
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLContextProviderGLX.cpp
gfx/gl/GLContextProviderOSMesa.cpp
gfx/gl/GLContextProviderWGL.cpp
gfx/gl/WGLLibrary.h
gfx/harfbuzz/src/hb-ot-shape.cc
gfx/layers/ImageLayers.h
gfx/layers/basic/BasicLayers.cpp
gfx/layers/basic/BasicLayers.h
gfx/layers/d3d10/ImageLayerD3D10.cpp
gfx/layers/ipc/PLayers.ipdl
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/ipc/ShadowLayersParent.cpp
gfx/layers/ipc/ShadowLayersParent.h
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/thebes/gfxMatrix.h
js/src/assembler/jit/ExecutableAllocator.h
js/src/config/milestone.txt
js/src/configure.in
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
js/src/frontend/ParseNode.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/frontend/SemanticAnalysis.cpp
js/src/gc/Barrier.h
js/src/gc/Marking.h
js/src/jit-test/tests/jaeger/bug563000/trap-from-add-ool.js
js/src/js.msg
js/src/jsanalyze.cpp
js/src/jsanalyze.h
js/src/jsapi-tests/testBug604087.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/jscntxtinlines.h
js/src/jsdbgapi.cpp
js/src/jsfun.cpp
js/src/jsfun.h
js/src/jsgc.cpp
js/src/jsinfer.cpp
js/src/jsinfer.h
js/src/jsinterp.cpp
js/src/jsinterp.h
js/src/jsinterpinlines.h
js/src/jsiter.cpp
js/src/jsiter.h
js/src/jsnum.cpp
js/src/jsobj.cpp
js/src/jsopcode.cpp
js/src/jsopcode.h
js/src/jsopcode.tbl
js/src/jsprvtd.h
js/src/jsscope.cpp
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jsscriptinlines.h
js/src/jsstr.cpp
js/src/jsval.h
js/src/jswrapper.cpp
js/src/jswrapper.h
js/src/methodjit/Compiler.cpp
js/src/methodjit/Compiler.h
js/src/methodjit/InvokeHelpers.cpp
js/src/methodjit/MethodJIT.cpp
js/src/methodjit/MethodJIT.h
js/src/methodjit/MonoIC.cpp
js/src/methodjit/PolyIC.cpp
js/src/methodjit/StubCalls.cpp
js/src/methodjit/StubCalls.h
js/src/shell/js.cpp
js/src/vm/ArgumentsObject.cpp
js/src/vm/ArgumentsObject.h
js/src/vm/Debugger.cpp
js/src/vm/ScopeObject.cpp
js/src/vm/Stack-inl.h
js/src/vm/Stack.cpp
js/src/vm/Stack.h
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/dom_quickstubs.qsconf
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/wrappers/AccessCheck.cpp
layout/base/crashtests/crashtests.list
layout/base/nsCSSRendering.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/build/Makefile.in
layout/build/nsLayoutStatics.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsComboboxControlFrame.h
layout/forms/nsIComboboxControlFrame.h
layout/forms/nsIListControlFrame.h
layout/forms/nsListControlFrame.cpp
layout/forms/nsListControlFrame.h
layout/inspector/src/inDOMUtils.cpp
layout/reftests/abs-pos/reftest.list
layout/reftests/border-radius/reftest.list
layout/reftests/bugs/reftest.list
layout/reftests/reftest.list
layout/reftests/scrolling/reftest.list
layout/reftests/svg/smil/transform/reftest.list
layout/reftests/text-overflow/reftest.list
layout/style/nsCSSStyleSheet.cpp
layout/style/nsCSSStyleSheet.h
layout/svg/base/src/nsSVGUtils.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/xul/base/public/nsXULPopupManager.h
layout/xul/base/src/grid/reftests/reftest.list
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppShell.java
mobile/android/base/GeckoStateListDrawable.java
mobile/android/base/Makefile.in
mobile/android/base/resources/drawable-hdpi/address_bar_url_bg.9.png
mobile/android/base/resources/drawable-hdpi/address_bar_url_outline.9.png
mobile/android/base/resources/drawable-land-hdpi-v14/address_bar_url_bg.9.png
mobile/android/base/resources/drawable-land-hdpi-v14/address_bar_url_outline.9.png
mobile/android/base/resources/drawable-land-mdpi-v14/address_bar_url_bg.9.png
mobile/android/base/resources/drawable-land-mdpi-v14/address_bar_url_outline.9.png
mobile/android/base/resources/drawable-land-xhdpi-v14/address_bar_url_bg.9.png
mobile/android/base/resources/drawable-land-xhdpi-v14/address_bar_url_outline.9.png
mobile/android/base/resources/drawable-land-xhdpi-v14/tabs_button_tail.9.png
mobile/android/base/resources/drawable-xhdpi-v11/address_bar_url_bg.9.png
mobile/android/base/resources/drawable-xhdpi-v11/address_bar_url_outline.9.png
mobile/android/base/resources/drawable-xhdpi-v11/tabs_button_tail.9.png
mobile/android/base/resources/drawable/address_bar_url_bg.9.png
mobile/android/base/resources/drawable/address_bar_url_default.xml
mobile/android/base/resources/drawable/address_bar_url_outline.9.png
mobile/android/base/resources/drawable/address_bar_url_pressed.xml
mobile/android/base/resources/values-sw600dp/styles.xml
mobile/android/base/resources/values-sw600dp/themes.xml
mobile/android/base/resources/values-xlarge/styles.xml
mobile/android/base/resources/values-xlarge/themes.xml
mobile/xul/confvars.sh
mobile/xul/installer/package-manifest.in
modules/libpref/src/init/all.js
mozglue/android/APKOpen.cpp
netwerk/cache/nsCacheEntry.cpp
netwerk/cache/nsCacheEntry.h
netwerk/cache/nsCacheEntryDescriptor.cpp
netwerk/cache/nsCacheRequest.h
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsCacheService.h
netwerk/cache/nsCacheSession.cpp
netwerk/cache/nsCacheSession.h
netwerk/cache/nsDiskCacheBlockFile.cpp
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/cache/nsDiskCacheDeviceSQL.h
netwerk/cache/nsDiskCacheMap.cpp
netwerk/cache/nsDiskCacheStreams.cpp
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/HttpBaseChannel.h
netwerk/protocol/http/SpdySession2.cpp
netwerk/protocol/http/SpdySession2.h
netwerk/protocol/http/SpdySession3.cpp
netwerk/protocol/http/SpdySession3.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpChannel.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/http/nsHttpResponseHead.cpp
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/websocket/WebSocketChannel.h
nsprpub/TAG-INFO
other-licenses/virtualenv/virtualenv.egg-info/PKG-INFO
other-licenses/virtualenv/virtualenv.egg-info/SOURCES.txt
other-licenses/virtualenv/virtualenv.egg-info/dependency_links.txt
other-licenses/virtualenv/virtualenv.egg-info/entry_points.txt
other-licenses/virtualenv/virtualenv.egg-info/not-zip-safe
other-licenses/virtualenv/virtualenv.egg-info/top_level.txt
testing/xpcshell/xpcshell.ini
toolkit/components/autocomplete/nsAutoCompleteController.cpp
toolkit/components/autocomplete/nsAutoCompleteController.h
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/places/tests/head_common.js
toolkit/content/widgets/videocontrols.xml
toolkit/mozapps/update/nsUpdateService.js
uriloader/prefetch/OfflineCacheUpdateChild.cpp
uriloader/prefetch/OfflineCacheUpdateGlue.cpp
uriloader/prefetch/OfflineCacheUpdateGlue.h
uriloader/prefetch/OfflineCacheUpdateParent.cpp
uriloader/prefetch/nsOfflineCacheUpdate.cpp
uriloader/prefetch/nsOfflineCacheUpdate.h
uriloader/prefetch/nsOfflineCacheUpdateService.cpp
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/AndroidJNI.cpp
widget/android/nsAppShell.cpp
widget/android/nsWindow.cpp
widget/cocoa/nsChildView.mm
widget/gtk2/nsGtkIMModule.cpp
widget/gtk2/nsWindow.cpp
widget/nsIRollupListener.h
widget/os2/nsWindow.cpp
widget/qt/nsWindow.cpp
widget/windows/nsWindow.cpp
widget/xpwidgets/nsBaseWidget.cpp
widget/xpwidgets/nsBaseWidget.h
xpcom/base/nsError.h
xpcom/components/Module.h
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStreamUtils.h
--- a/.gitignore
+++ b/.gitignore
@@ -41,8 +41,10 @@ js/src/tests/results-*.txt
 parser/html/java/htmlparser/
 parser/html/java/javaparser/
 
 # Ignore the files and directory that Eclipse IDE creates
 .project
 .cproject
 .settings/
 
+# Python stuff installed at build-time
+*.egg-info/
--- a/.hgignore
+++ b/.hgignore
@@ -40,8 +40,11 @@
 
 # SVN directories
 \.svn/
 
 # Ignore the files and directory that Eclipse IDE creates
 \.project$
 \.cproject$
 \.settings/
+
+# Python stuff installed at build-time
+\.egg-info/
--- a/.hgtags
+++ b/.hgtags
@@ -75,8 +75,9 @@ a8506ab2c65480cf2f85f54e203ea746522c62bb
 462c726144bc1fb45b61e774f64ac5d61b4e047c UPDATE_PACKAGING_R16
 bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
 bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
 0000000000000000000000000000000000000000 AURORA_BASE_20120131
 0000000000000000000000000000000000000000 AURORA_BASE_20120131
 bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
 b6627f28b7ec17e1b46a594df0f780d3a40847e4 FIREFOX_AURORA_13_BASE
 357da346ceb705d196a46574804c7c4ec44ac186 FIREFOX_AURORA_14_BASE
+26dcd1b1a20893ad99341c61c6b1239ff1523858 FIREFOX_AURORA_15_BASE
--- a/accessible/src/atk/AccessibleWrap.cpp
+++ b/accessible/src/atk/AccessibleWrap.cpp
@@ -371,17 +371,17 @@ AccessibleWrap::CreateMaiInterfaces(void
   // The Component interface is supported by all accessibles.
   interfacesBits |= 1 << MAI_INTERFACE_COMPONENT;
 
   // Add Action interface if the action count is more than zero.
   if (ActionCount() > 0)
     interfacesBits |= 1 << MAI_INTERFACE_ACTION;
 
   // Text, Editabletext, and Hypertext interface.
-  nsHyperTextAccessible* hyperText = AsHyperText();
+  HyperTextAccessible* hyperText = AsHyperText();
   if (hyperText && hyperText->IsTextRole()) {
     interfacesBits |= 1 << MAI_INTERFACE_TEXT;
     interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;
     if (!nsAccUtils::MustPrune(this))
       interfacesBits |= 1 << MAI_INTERFACE_HYPERTEXT;
   }
 
   // Value interface.
rename from accessible/src/atk/nsHyperTextAccessibleWrap.h
rename to accessible/src/atk/HyperTextAccessibleWrap.h
--- a/accessible/src/atk/nsHyperTextAccessibleWrap.h
+++ b/accessible/src/atk/HyperTextAccessibleWrap.h
@@ -1,15 +1,15 @@
 /* -*- 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 _NSHYPERTEXTACCESSIBLEWRAP_H
-#define _NSHYPERTEXTACCESSIBLEWRAP_H
+#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
+#define mozilla_a11y_HyperTextAccessibleWrap_h__
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
-typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
+typedef class HyperTextAccessible HyperTextAccessibleWrap;
 
 #endif
 
rename from accessible/src/atk/nsHTMLImageAccessibleWrap.h
rename to accessible/src/atk/ImageAccessibleWrap.h
--- a/accessible/src/atk/nsHTMLImageAccessibleWrap.h
+++ b/accessible/src/atk/ImageAccessibleWrap.h
@@ -1,15 +1,21 @@
 /* -*- 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 _NSHTMLIMAGEACCESSIBLEWRAP_H
-#define _NSHTMLIMAGEACCESSIBLEWRAP_H
+#ifndef mozilla_a11y_ImageAccessibleWrap_h__
+#define mozilla_a11y_ImageAccessibleWrap_h__
+
+#include "ImageAccessible.h"
 
-#include "nsHTMLImageAccessible.h"
+namespace mozilla {
+namespace a11y {
 
-typedef class nsHTMLImageAccessible nsHTMLImageAccessibleWrap;
+typedef class ImageAccessible ImageAccessibleWrap;
+
+} // namespace a11y
+} // namespace mozilla
 
 #endif
 
--- a/accessible/src/atk/nsMaiInterfaceEditableText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceEditableText.cpp
@@ -1,17 +1,17 @@
 /* -*- 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/. */
 
 #include "InterfaceInitFuncs.h"
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 #include "nsMai.h"
 
 #include "nsString.h"
 
 extern "C" {
 
 static gboolean
 setRunAttributesCB(AtkEditableText *aText, AtkAttributeSet *aAttribSet,
--- a/accessible/src/atk/nsMaiInterfaceHypertext.cpp
+++ b/accessible/src/atk/nsMaiInterfaceHypertext.cpp
@@ -1,30 +1,30 @@
 /* -*- 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/. */
 
 #include "InterfaceInitFuncs.h"
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 #include "nsMai.h"
 #include "nsMaiHyperlink.h"
 
 extern "C" {
 
 static AtkHyperlink*
 getLinkCB(AtkHypertext *aText, gint aLinkIndex)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return nsnull;
 
-  nsHyperTextAccessible* hyperText = accWrap->AsHyperText();
+  HyperTextAccessible* hyperText = accWrap->AsHyperText();
   NS_ENSURE_TRUE(hyperText, nsnull);
 
   Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
   if (!hyperLink)
     return nsnull;
 
   AtkObject* hyperLinkAtkObj = AccessibleWrap::GetAtkObject(hyperLink);
   AccessibleWrap* accChild = GetAccessibleWrap(hyperLinkAtkObj);
@@ -37,30 +37,30 @@ getLinkCB(AtkHypertext *aText, gint aLin
 
 static gint
 getLinkCountCB(AtkHypertext *aText)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return -1;
 
-  nsHyperTextAccessible* hyperText = accWrap->AsHyperText();
+  HyperTextAccessible* hyperText = accWrap->AsHyperText();
   NS_ENSURE_TRUE(hyperText, -1);
 
   return hyperText->GetLinkCount();
 }
 
 static gint
 getLinkIndexCB(AtkHypertext *aText, gint aCharIndex)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return -1;
 
-  nsHyperTextAccessible* hyperText = accWrap->AsHyperText();
+  HyperTextAccessible* hyperText = accWrap->AsHyperText();
   NS_ENSURE_TRUE(hyperText, -1);
 
   PRInt32 index = -1;
   nsresult rv = hyperText->GetLinkIndexAtOffset(aCharIndex, &index);
   NS_ENSURE_SUCCESS(rv, -1);
 
   return index;
 }
--- a/accessible/src/atk/nsMaiInterfaceImage.cpp
+++ b/accessible/src/atk/nsMaiInterfaceImage.cpp
@@ -2,31 +2,34 @@
 /* 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/. */
 
 #include "InterfaceInitFuncs.h"
 
 #include "AccessibleWrap.h"
-#include "nsHTMLImageAccessible.h"
+#include "ImageAccessible.h"
 #include "nsMai.h"
 
+using namespace mozilla;
+using namespace mozilla::a11y;
+
 extern "C" {
 const gchar* getDescriptionCB(AtkObject* aAtkObj);
 
 static void
 getImagePositionCB(AtkImage* aImage, gint* aAccX, gint* aAccY,
                    AtkCoordType aCoordType)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
   if (!accWrap || !accWrap->IsImage())
     return;
 
-  nsHTMLImageAccessible* image = accWrap->AsImage();
+  ImageAccessible* image = accWrap->AsImage();
   PRUint32 geckoCoordType = (aCoordType == ATK_XY_WINDOW) ?
     nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
   // Returned in screen coordinates
   image->GetImagePosition(geckoCoordType, aAccX, aAccY);
 }
 
 static const gchar*
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -1,17 +1,17 @@
 /* -*- 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/. */
 
 #include "InterfaceInitFuncs.h"
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 #include "nsMai.h"
 
 #include "nsIPersistentProperties2.h"
 
 using namespace mozilla::a11y;
 
 AtkAttributeSet* ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes);
 
@@ -309,17 +309,17 @@ getRangeExtentsCB(AtkText *aText, gint a
 
 static gint
 getCharacterCountCB(AtkText *aText)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return 0;
 
-  nsHyperTextAccessible* textAcc = accWrap->AsHyperText();
+  HyperTextAccessible* textAcc = accWrap->AsHyperText();
   return textAcc->IsDefunct() ?
     0 : static_cast<gint>(textAcc->CharacterCount());
 }
 
 static gint
 getOffsetAtPointCB(AtkText *aText,
                    gint aX, gint aY,
                    AtkCoordType aCoords)
--- a/accessible/src/base/FocusManager.cpp
+++ b/accessible/src/base/FocusManager.cpp
@@ -1,15 +1,16 @@
 /* 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/. */
 
 #include "FocusManager.h"
 
 #include "Accessible-inl.h"
+#include "DocAccessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "Role.h"
 #include "RootAccessible.h"
 
 #include "nsEventStateManager.h"
 #include "nsFocusManager.h"
 
--- a/accessible/src/base/Logging.cpp
+++ b/accessible/src/base/Logging.cpp
@@ -2,23 +2,25 @@
 /* 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/. */
 
 #include "Logging.h"
 
 #include "AccEvent.h"
+#include "DocAccessible.h"
 #include "nsAccessibilityService.h"
 #include "nsCoreUtils.h"
-#include "DocAccessible.h"
+#include "OuterDocAccessible.h"
 
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIInterfaceRequestorUtils.h"
+#include "nsISelectionPrivate.h"
 #include "nsTraceRefcntImpl.h"
 #include "nsIWebProgress.h"
 #include "prenv.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -38,17 +40,27 @@ EnableLogging(const char* aModulesStr)
   if (!aModulesStr)
     return;
 
   static ModuleRep modules[] = {
     { "docload", logging::eDocLoad },
     { "doccreate", logging::eDocCreate },
     { "docdestroy", logging::eDocDestroy },
     { "doclifecycle", logging::eDocLifeCycle },
-    { "platforms", logging::ePlatforms }
+
+    { "events", logging::eEvents },
+    { "platforms", logging::ePlatforms },
+    { "stack", logging::eStack },
+    { "text", logging::eText },
+    { "tree", logging::eTree },
+
+    { "DOMEvents", logging::eDOMEvents },
+    { "focus", logging::eFocus },
+    { "selection", logging::eSelection },
+    { "notifications", logging::eNotifications }
   };
 
   const char* token = aModulesStr;
   while (*token != '\0') {
     size_t tokenLen = strcspn(token, ",");
     for (unsigned int idx = 0; idx < ArrayLength(modules); idx++) {
       if (strncmp(token, modules[idx].mStr, tokenLen) == 0) {
         sModules |= modules[idx].mModule;
@@ -177,18 +189,16 @@ LogDocParent(nsIDocument* aDocumentNode)
     LogDocURI(parentDoc);
     printf("\n");
   }
 }
 
 static void
 LogDocInfo(nsIDocument* aDocumentNode, DocAccessible* aDocument)
 {
-  printf("  {\n");
-
   printf("    DOM id: %p, acc id: %p\n    ",
          static_cast<void*>(aDocumentNode), static_cast<void*>(aDocument));
 
   // log document info
   if (aDocumentNode) {
     LogDocURI(aDocumentNode);
     printf("\n    ");
     LogDocShellState(aDocumentNode);
@@ -201,18 +211,16 @@ LogDocInfo(nsIDocument* aDocumentNode, D
     printf("\n    ");
     LogPresShell(aDocumentNode);
     printf("\n    ");
     LogDocLoadGroup(aDocumentNode);
     printf(", ");
     LogDocParent(aDocumentNode);
     printf("\n");
   }
-
-  printf("  }\n");
 }
 
 static void
 LogShellLoadType(nsIDocShell* aDocShell)
 {
   printf("load type: ");
 
   PRUint32 loadType = 0;
@@ -329,145 +337,263 @@ GetDocLoadEventType(AccEvent* aEvent, ns
         aEventType.AppendLiteral("false");
     }
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // namespace logging:: document life cycle logging methods
 
+static const char* sDocLoadTitle = "DOCLOAD";
+static const char* sDocCreateTitle = "DOCCREATE";
+static const char* sDocDestroyTitle = "DOCDESTROY";
+static const char* sDocEventTitle = "DOCEVENT";
+
 void
 logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
                  nsIRequest* aRequest, PRUint32 aStateFlags)
 {
-  printf("\nA11Y DOCLOAD: %s\n", aMsg);
+  MsgBegin(sDocLoadTitle, aMsg);
 
   nsCOMPtr<nsIDOMWindow> DOMWindow;
   aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow));
-  if (!DOMWindow)
+  if (!DOMWindow) {
+    MsgEnd();
     return;
+  }
 
   nsCOMPtr<nsIDOMDocument> DOMDocument;
   DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
-  if (!DOMDocument)
+  if (!DOMDocument) {
+    MsgEnd();
     return;
+  }
 
   nsCOMPtr<nsIDocument> documentNode(do_QueryInterface(DOMDocument));
   DocAccessible* document =
     GetAccService()->GetDocAccessibleFromCache(documentNode);
 
   LogDocInfo(documentNode, document);
 
-  printf("  {\n");
   nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(DOMWindow));
   nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(webNav));
-  printf("    ");
+  printf("\n    ");
   LogShellLoadType(docShell);
   printf("\n");
   LogRequest(aRequest);
   printf("\n");
   printf("    state flags: %x", aStateFlags);
   bool isDocLoading;
   aWebProgress->GetIsLoadingDocument(&isDocLoading);
   printf(", document is %sloading\n", (isDocLoading ? "" : "not "));
-  printf("  }\n");
+
+  MsgEnd();
 }
 
 void
 logging::DocLoad(const char* aMsg, nsIDocument* aDocumentNode)
 {
-  printf("\nA11Y DOCLOAD: %s\n", aMsg);
+  MsgBegin(sDocLoadTitle, aMsg);
 
   DocAccessible* document =
     GetAccService()->GetDocAccessibleFromCache(aDocumentNode);
   LogDocInfo(aDocumentNode, document);
+
+  MsgEnd();
 }
 
 void
 logging::DocLoadEventFired(AccEvent* aEvent)
 {
   nsCAutoString strEventType;
   GetDocLoadEventType(aEvent, strEventType);
   if (!strEventType.IsEmpty())
     printf("  fire: %s\n", strEventType.get());
 }
 
 void
 logging::DocLoadEventHandled(AccEvent* aEvent)
 {
   nsCAutoString strEventType;
   GetDocLoadEventType(aEvent, strEventType);
-  if (!strEventType.IsEmpty()) {
-    printf("\nA11Y DOCEVENT: handled '%s' event ", strEventType.get());
+  if (strEventType.IsEmpty())
+    return;
+
+  MsgBegin(sDocEventTitle, "handled '%s' event", strEventType.get());
 
-    nsINode* node = aEvent->GetNode();
-    if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
-      nsIDocument* documentNode = static_cast<nsIDocument*>(node);
-      DocAccessible* document = aEvent->GetDocAccessible();
-      LogDocInfo(documentNode, document);
-    }
+  nsINode* node = aEvent->GetNode();
+  if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
+    nsIDocument* documentNode = static_cast<nsIDocument*>(node);
+    DocAccessible* document = aEvent->GetDocAccessible();
+    LogDocInfo(documentNode, document);
+  }
 
-    printf("\n");
-  }
+  MsgEnd();
 }
 
 void
 logging::DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
                    DocAccessible* aDocument)
 {
   DocAccessible* document = aDocument ?
     aDocument : GetAccService()->GetDocAccessibleFromCache(aDocumentNode);
 
-  printf("\nA11Y DOCCREATE: %s\n", aMsg);
+  MsgBegin(sDocCreateTitle, aMsg);
   LogDocInfo(aDocumentNode, document);
+  MsgEnd();
 }
 
 void
 logging::DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
                     DocAccessible* aDocument)
 {
   DocAccessible* document = aDocument ?
     aDocument : GetAccService()->GetDocAccessibleFromCache(aDocumentNode);
 
-  printf("\nA11Y DOCDESTROY: %s\n", aMsg);
+  MsgBegin(sDocDestroyTitle, aMsg);
   LogDocInfo(aDocumentNode, document);
+  MsgEnd();
+}
+
+void
+logging::OuterDocDestroy(OuterDocAccessible* aOuterDoc)
+{
+  MsgBegin(sDocDestroyTitle, "outerdoc shutdown");
+  logging::Address("outerdoc", aOuterDoc);
+  MsgEnd();
 }
 
 void
-logging::Address(const char* aDescr, Accessible* aAcc)
+logging::SelChange(nsISelection* aSelection, DocAccessible* aDocument)
 {
-  nsINode* node = aAcc->GetNode();
-  nsIDocument* docNode = aAcc->GetDocumentNode();
-  DocAccessible* doc = GetAccService()->GetDocAccessibleFromCache(docNode);
-  printf("  %s accessible: %p, node: %p\n", aDescr,
-         static_cast<void*>(aAcc), static_cast<void*>(node));
-  printf("  docacc for %s accessible: %p, node: %p\n", aDescr,
-         static_cast<void*>(doc), static_cast<void*>(docNode));
-  printf("  ");
-  LogDocURI(docNode);
-  printf("\n");
+  nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
+
+  PRInt16 type = 0;
+  privSel->GetType(&type);
+
+  const char* strType = 0;
+  if (type == nsISelectionController::SELECTION_NORMAL)
+    strType = "normal";
+  else if (type == nsISelectionController::SELECTION_SPELLCHECK)
+    strType = "spellcheck";
+  else
+    strType = "unknown";
+
+  bool isIgnored = !aDocument || !aDocument->IsContentLoaded();
+  printf("\nSelection changed, selection type: %s, notification %s\n",
+         strType, (isIgnored ? "ignored" : "pending"));
 }
 
 void
-logging::Msg(const char* aMsg)
+logging::MsgBegin(const char* aTitle, const char* aMsgText, ...)
+{
+  printf("\nA11Y %s: ", aTitle);
+
+  va_list argptr;
+  va_start(argptr, aMsgText);
+  vprintf(aMsgText, argptr);
+  va_end(argptr);
+
+  printf("\n  {\n");
+}
+
+void
+logging::MsgEnd()
 {
-  printf("\n%s\n", aMsg);
+  printf("  }\n");
+}
+
+void
+logging::MsgEntry(const char* aEntryText, ...)
+{
+  printf("    ");
+
+  va_list argptr;
+  va_start(argptr, aEntryText);
+  vprintf(aEntryText, argptr);
+  va_end(argptr);
+
+  printf("\n");
 }
 
 void
 logging::Text(const char* aText)
 {
   printf("  %s\n", aText);
 }
 
 void
+logging::Address(const char* aDescr, Accessible* aAcc)
+{
+  if (!aAcc->IsDoc()) {
+    printf("    %s accessible: %p, node: %p\n", aDescr,
+           static_cast<void*>(aAcc), static_cast<void*>(aAcc->GetNode()));
+  }
+
+  DocAccessible* doc = aAcc->Document();
+  nsIDocument* docNode = aAcc->GetDocumentNode();
+  printf("    document: %p, node: %p\n",
+         static_cast<void*>(doc), static_cast<void*>(docNode));
+
+  printf("    ");
+  LogDocURI(docNode);
+  printf("\n");
+}
+
+void
+logging::Node(const char* aDescr, nsINode* aNode)
+{
+  printf("    ");
+
+  if (!aNode) {
+    printf("%s: null\n", aDescr);
+    return;
+  }
+
+  if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) {
+    printf("%s: %p, document\n", aDescr, static_cast<void*>(aNode));
+    return;
+  }
+
+  nsINode* parentNode = aNode->GetNodeParent();
+  PRInt32 idxInParent = parentNode ? parentNode->IndexOf(aNode) : - 1;
+
+  if (aNode->IsNodeOfType(nsINode::eTEXT)) {
+    printf("%s: %p, text node, idx in parent: %d\n",
+           aDescr, static_cast<void*>(aNode), idxInParent);
+    return;
+  }
+
+  if (!aNode->IsElement()) {
+    printf("%s: %p, not accessible node type, idx in parent: %d\n",
+           aDescr, static_cast<void*>(aNode), idxInParent);
+    return;
+  }
+
+  dom::Element* elm = aNode->AsElement();
+
+  nsCAutoString tag;
+  elm->Tag()->ToUTF8String(tag);
+
+  nsIAtom* idAtom = elm->GetID();
+  nsCAutoString id;
+  if (idAtom)
+    idAtom->ToUTF8String(id);
+
+  printf("%s: %p, %s@id='%s', idx in parent: %d\n",
+         aDescr, static_cast<void*>(elm), tag.get(), id.get(), idxInParent);
+}
+
+void
 logging::Stack()
 {
-  printf("  stack: \n");
-  nsTraceRefcntImpl::WalkTheStack(stdout);
+  if (IsEnabled(eStack)) {
+    printf("  stack: \n");
+    nsTraceRefcntImpl::WalkTheStack(stdout);
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // namespace logging:: initialization
 
 bool
 logging::IsEnabled(PRUint32 aModules)
 {
--- a/accessible/src/base/Logging.h
+++ b/accessible/src/base/Logging.h
@@ -8,36 +8,52 @@
 #define mozilla_a11y_logs_h__
 
 #include "nscore.h"
 #include "nsAString.h"
 
 class AccEvent;
 class Accessible;
 class DocAccessible;
+
 class nsIDocument;
+class nsINode;
 class nsIRequest;
+class nsISelection;
 class nsIWebProgress;
 
 namespace mozilla {
 namespace a11y {
+
+class OuterDocAccessible;
+
 namespace logging {
 
 enum EModules {
   eDocLoad = 1 << 0,
   eDocCreate = 1 << 1,
   eDocDestroy = 1 << 2,
   eDocLifeCycle = eDocLoad | eDocCreate | eDocDestroy,
-  ePlatforms = 1 << 3
+
+  eEvents = 1 << 3,
+  ePlatforms = 1 << 4,
+  eStack = 1 << 5,
+  eText = 1 << 6,
+  eTree = 1 << 7,
+
+  eDOMEvents = 1 << 8,
+  eFocus = 1 << 9,
+  eSelection = 1 << 10,
+  eNotifications = eDOMEvents | eSelection | eFocus
 };
 
 /**
- * Return true if the given module is logged.
+ * Return true if any of the given modules is logged.
  */
-bool IsEnabled(PRUint32 aModule);
+bool IsEnabled(PRUint32 aModules);
 
 /**
  * Log the document loading progress.
  */
 void DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
              nsIRequest* aRequest, PRUint32 aStateFlags);
 void DocLoad(const char* aMsg, nsIDocument* aDocumentNode);
 
@@ -59,31 +75,54 @@ void DocCreate(const char* aMsg, nsIDocu
 
 /**
  * Log the document was destroyed.
  */
 void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
                 DocAccessible* aDocument = nsnull);
 
 /**
- * Log the message, a piece of text on own line, no offset.
+ * Log the outer document was destroyed.
+ */
+void OuterDocDestroy(OuterDocAccessible* OuterDoc);
+
+/**
+ * Log the selection change.
  */
-void Msg(const char* aMsg);
+void SelChange(nsISelection* aSelection, DocAccessible* aDocument);
+
+/**
+ * Log the message ('title: text' format) on new line. Print the start and end
+ * boundaries of the message body designated by '{' and '}' (2 spaces indent for
+ * body).
+ */
+void MsgBegin(const char* aTitle, const char* aMsgText, ...);
+void MsgEnd();
+
+/**
+ * Log the entry into message body (4 spaces indent).
+ */
+void MsgEntry(const char* aEntryText, ...);
 
 /**
  * Log the text, two spaces offset is used.
  */
 void Text(const char* aText);
 
 /**
- * Log the accesisble object address, two spaces offset is used.
+ * Log the accessible object address as message entry (4 spaces indent).
  */
 void Address(const char* aDescr, Accessible* aAcc);
 
 /**
+ * Log the DOM node info as message entry.
+ */
+void Node(const char* aDescr, nsINode* aNode);
+
+/**
  * Log the call stack, two spaces offset is used.
  */
 void Stack();
 
 /**
  * Enable logging of the specified modules, all other modules aren't logged.
  */
 void Enable(const nsAFlatCString& aModules);
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -11,16 +11,20 @@
 #include "nsCoreUtils.h"
 #include "DocAccessible.h"
 #include "nsEventShell.h"
 #include "FocusManager.h"
 #include "Role.h"
 #include "TextLeafAccessible.h"
 #include "TextUpdater.h"
 
+#ifdef DEBUG
+#include "Logging.h"
+#endif
+
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla::a11y;
 
 // Defines the number of selection add/remove events in the queue when they
 // aren't packed into single selection within event.
 const unsigned int kSelChangeCountToPack = 5;
 
@@ -185,19 +189,22 @@ NotificationController::WillRefresh(mozi
   if (!mDocument->HasLoadState(DocAccessible::eTreeConstructed)) {
     // If document is not bound to parent at this point then the document is not
     // ready yet (process notifications later).
     if (!mDocument->IsBoundToParent()) {
       mObservingState = eRefreshObserving;
       return;
     }
 
-#ifdef DEBUG_NOTIFICATIONS
-    printf("\ninitial tree created, document: %p, document node: %p\n",
-           mDocument.get(), mDocument->GetDocumentNode());
+#ifdef DEBUG
+    if (logging::IsEnabled(logging::eTree)) {
+      logging::MsgBegin("TREE", "initial tree created");
+      logging::Address("document", mDocument);
+      logging::MsgEnd();
+    }
 #endif
 
     mDocument->DoInitialUpdate();
 
     NS_ASSERTION(mContentInsertions.Length() == 0,
                  "Pending content insertions while initial accessible tree isn't created!");
   }
 
@@ -287,16 +294,24 @@ NotificationController::WillRefresh(mozi
   // process it synchronously.
   mObservingState = eRefreshObserving;
 
   // Process only currently queued events.
   nsTArray<nsRefPtr<AccEvent> > events;
   events.SwapElements(mEvents);
 
   PRUint32 eventCount = events.Length();
+#ifdef DEBUG
+  if (eventCount > 0 && logging::IsEnabled(logging::eEvents)) {
+    logging::MsgBegin("EVENTS", "events processing");
+    logging::Address("document", mDocument);
+    logging::MsgEnd();
+  }
+#endif
+
   for (PRUint32 idx = 0; idx < eventCount; idx++) {
     AccEvent* accEvent = events[idx];
     if (accEvent->mEventRule != AccEvent::eDoNotEmit) {
       Accessible* target = accEvent->GetAccessible();
       if (!target || target->IsDefunct())
         continue;
 
       // Dispatch the focus event if target is still focused.
@@ -641,17 +656,17 @@ NotificationController::CoalesceTextChan
 void
 NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent)
 {
   DocAccessible* document = aEvent->GetDocAccessible();
   Accessible* container = document->GetContainerAccessible(aEvent->mNode);
   if (!container)
     return;
 
-  nsHyperTextAccessible* textAccessible = container->AsHyperText();
+  HyperTextAccessible* textAccessible = container->AsHyperText();
   if (!textAccessible)
     return;
 
   // Don't fire event for the first html:br in an editor.
   if (aEvent->mAccessible->Role() == roles::WHITESPACE) {
     nsCOMPtr<nsIEditor> editor = textAccessible->GetEditor();
     if (editor) {
       bool isEmpty = false;
@@ -704,75 +719,56 @@ NotificationController::TextEnumerator(n
     containerNode->AsElement() : nsnull;
 
   nsAutoString text;
   textFrame->GetRenderedText(&text);
 
   // Remove text accessible if rendered text is empty.
   if (textAcc) {
     if (text.IsEmpty()) {
-#ifdef DEBUG_NOTIFICATIONS
-      PRUint32 index = containerNode->IndexOf(textNode);
-
-      nsCAutoString tag;
-      nsCAutoString id;
-      if (containerElm) {
-        containerElm->Tag()->ToUTF8String(tag);
-        nsIAtom* atomid = containerElm->GetID();
-        if (atomid)
-          atomid->ToUTF8String(id);
+#ifdef DEBUG
+      if (logging::IsEnabled(logging::eTree | logging::eText)) {
+        logging::MsgBegin("TREE", "text node lost its content");
+        logging::Node("container", containerElm);
+        logging::Node("content", textNode);
+        logging::MsgEnd();
       }
-
-      printf("\npending text node removal: container: %s@id='%s', index in container: %d\n\n",
-             tag.get(), id.get(), index);
 #endif
 
       document->ContentRemoved(containerElm, textNode);
       return PL_DHASH_NEXT;
     }
 
     // Update text of the accessible and fire text change events.
-#ifdef DEBUG_TEXTCHANGE
-      PRUint32 index = containerNode->IndexOf(textNode);
-
-      nsCAutoString tag;
-      nsCAutoString id;
-      if (containerElm) {
-        containerElm->Tag()->ToUTF8String(tag);
-        nsIAtom* atomid = containerElm->GetID();
-        if (atomid)
-          atomid->ToUTF8String(id);
-      }
-
-      printf("\ntext may be changed: container: %s@id='%s', index in container: %d, old text '%s', new text: '%s'\n\n",
-             tag.get(), id.get(), index,
-             NS_ConvertUTF16toUTF8(textAcc->AsTextLeaf()->Text()).get(),
-             NS_ConvertUTF16toUTF8(text).get());
+#ifdef DEBUG
+    if (logging::IsEnabled(logging::eText)) {
+      logging::MsgBegin("TEXT", "text may be changed");
+      logging::Node("container", containerElm);
+      logging::Node("content", textNode);
+      logging::MsgEntry("old text '%s'",
+                        NS_ConvertUTF16toUTF8(textAcc->AsTextLeaf()->Text()).get());
+      logging::MsgEntry("new text: '%s'",
+                        NS_ConvertUTF16toUTF8(text).get());
+      logging::MsgEnd();
+    }
 #endif
 
     TextUpdater::Run(document, textAcc->AsTextLeaf(), text);
     return PL_DHASH_NEXT;
   }
 
   // Append an accessible if rendered text is not empty.
   if (!text.IsEmpty()) {
-#ifdef DEBUG_NOTIFICATIONS
-      PRUint32 index = containerNode->IndexOf(textNode);
-
-      nsCAutoString tag;
-      nsCAutoString id;
-      if (containerElm) {
-        containerElm->Tag()->ToUTF8String(tag);
-        nsIAtom* atomid = containerElm->GetID();
-        if (atomid)
-          atomid->ToUTF8String(id);
-      }
-
-      printf("\npending text node insertion: container: %s@id='%s', index in container: %d\n\n",
-             tag.get(), id.get(), index);
+#ifdef DEBUG
+    if (logging::IsEnabled(logging::eTree | logging::eText)) {
+      logging::MsgBegin("TREE", "text node gains new content");
+      logging::Node("container", containerElm);
+      logging::Node("content", textNode);
+      logging::MsgEnd();
+    }
 #endif
 
     // Make sure the text node is in accessible document still.
     Accessible* container = document->GetAccessibleOrContainer(containerNode);
     NS_ASSERTION(container,
                  "Text node having rendered text hasn't accessible document!");
     if (container) {
       nsTArray<nsCOMPtr<nsIContent> > insertedContents;
@@ -830,40 +826,15 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(NotificationController::ContentInsertion,
                                      AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(NotificationController::ContentInsertion,
                                        Release)
 
 void
 NotificationController::ContentInsertion::Process()
 {
-#ifdef DEBUG_NOTIFICATIONS
-  nsIContent* firstChildNode = mInsertedContent[0];
-
-  nsCAutoString tag;
-  firstChildNode->Tag()->ToUTF8String(tag);
-
-  nsIAtom* atomid = firstChildNode->GetID();
-  nsCAutoString id;
-  if (atomid)
-    atomid->ToUTF8String(id);
-
-  nsCAutoString ctag;
-  nsCAutoString cid;
-  nsIAtom* catomid = nsnull;
-  if (mContainer->IsContent()) {
-    mContainer->GetContent()->Tag()->ToUTF8String(ctag);
-    catomid = mContainer->GetContent()->GetID();
-    if (catomid)
-      catomid->ToUTF8String(cid);
-  }
-
-  printf("\npending content insertion: %s@id='%s', container: %s@id='%s', inserted content amount: %d\n\n",
-         tag.get(), id.get(), ctag.get(), cid.get(), mInsertedContent.Length());
-#endif
-
   mDocument->ProcessContentInserted(mContainer, &mInsertedContent);
 
   mDocument = nsnull;
   mContainer = nsnull;
   mInsertedContent.Clear();
 }
 
--- a/accessible/src/base/NotificationController.h
+++ b/accessible/src/base/NotificationController.h
@@ -5,28 +5,24 @@
 
 #ifndef NotificationController_h_
 #define NotificationController_h_
 
 #include "AccEvent.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsRefreshDriver.h"
 
+#ifdef DEBUG
+#include "Logging.h"
+#endif
+
 class Accessible;
 class DocAccessible;
 class nsIContent;
 
-// Uncomment to log notifications processing.
-//#define DEBUG_NOTIFICATIONS
-
-#ifdef DEBUG_NOTIFICATIONS
-#define DEBUG_CONTENTMUTATION
-#define DEBUG_TEXTCHANGE
-#endif
-
 /**
  * Notification interface.
  */
 class Notification
 {
 public:
   virtual ~Notification() { };
 
@@ -135,18 +131,19 @@ public:
    *        the notification is processed.
    */
   template<class Class, class Arg>
   inline void HandleNotification(Class* aInstance,
                                  typename TNotification<Class, Arg>::Callback aMethod,
                                  Arg* aArg)
   {
     if (!IsUpdatePending()) {
-#ifdef DEBUG_NOTIFICATIONS
-      printf("\nsync notification processing\n");
+#ifdef DEBUG
+      if (mozilla::a11y::logging::IsEnabled(mozilla::a11y::logging::eNotifications))
+        mozilla::a11y::logging::Text("sync notification processing");
 #endif
       (aInstance->*aMethod)(aArg);
       return;
     }
 
     nsRefPtr<Notification> notification =
       new TNotification<Class, Arg>(aInstance, aMethod, aArg);
     if (notification && mNotifications.AppendElement(notification))
--- a/accessible/src/base/TextAttrs.cpp
+++ b/accessible/src/base/TextAttrs.cpp
@@ -1,18 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "TextAttrs.h"
 
+#include "HyperTextAccessibleWrap.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
-#include "nsHyperTextAccessibleWrap.h"
 #include "StyleInfo.h"
 
 #include "gfxFont.h"
 #include "gfxUserFontSet.h"
 #include "nsFontMetrics.h"
 #include "nsLayoutUtils.h"
 
 using namespace mozilla;
@@ -194,17 +194,17 @@ TextAttrsMgr::GetRange(TextAttr* aAttrAr
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // LangTextAttr
 ////////////////////////////////////////////////////////////////////////////////
 
 TextAttrsMgr::LangTextAttr::
-  LangTextAttr(nsHyperTextAccessible* aRoot,
+  LangTextAttr(HyperTextAccessible* aRoot,
                nsIContent* aRootElm, nsIContent* aElm) :
   TTextAttr<nsString>(!aElm), mRootContent(aRootElm)
 {
   aRoot->Language(mRootNativeValue);
   mIsRootDefined =  !mRootNativeValue.IsEmpty();
 
   if (aElm)
     mIsDefined = GetLang(aElm, mNativeValue);
--- a/accessible/src/base/TextAttrs.h
+++ b/accessible/src/base/TextAttrs.h
@@ -6,51 +6,51 @@
 #ifndef nsTextAttrs_h_
 #define nsTextAttrs_h_
 
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsIPersistentProperties2.h"
 #include "nsStyleConsts.h"
 
-class nsHyperTextAccessible;
+class HyperTextAccessible;
 
 namespace mozilla {
 namespace a11y {
 
 /**
  * Used to expose text attributes for the hyper text accessible (see
- * nsHyperTextAccessible class).
+ * HyperTextAccessible class).
  *
  * @note "invalid: spelling" text attribute is implemented entirely in
- *       nsHyperTextAccessible class.
+ *       HyperTextAccessible class.
  */
 class TextAttrsMgr
 {
 public:
   /**
    * Constructor. Used to expose default text attributes.
    */
-  TextAttrsMgr(nsHyperTextAccessible* aHyperTextAcc) :
+  TextAttrsMgr(HyperTextAccessible* aHyperTextAcc) :
     mOffsetAcc(nsnull),  mHyperTextAcc(aHyperTextAcc),
     mOffsetAccIdx(-1), mIncludeDefAttrs(true) { }
 
   /**
    * Constructor. Used to expose text attributes at the given offset.
    *
    * @param aHyperTextAcc    [in] hyper text accessible text attributes are
    *                          calculated for
    * @param aIncludeDefAttrs [optional] indicates whether default text
    *                          attributes should be included into list of exposed
    *                          text attributes
    * @param oOffsetAcc       [optional] offset an accessible the text attributes
    *                          should be calculated for
    * @param oOffsetAccIdx    [optional] index in parent of offset accessible
    */
-  TextAttrsMgr(nsHyperTextAccessible* aHyperTextAcc,
+  TextAttrsMgr(HyperTextAccessible* aHyperTextAcc,
                bool aIncludeDefAttrs,
                Accessible* aOffsetAcc,
                PRInt32 aOffsetAccIdx) :
     mOffsetAcc(aOffsetAcc), mHyperTextAcc(aHyperTextAcc),
     mOffsetAccIdx(aOffsetAccIdx), mIncludeDefAttrs(aIncludeDefAttrs) { }
 
   /*
    * Return text attributes and hyper text offsets where these attributes are
@@ -79,17 +79,17 @@ protected:
    * @param aEndHTOffset    [in, out] the end offset
    */
   class TextAttr;
   void GetRange(TextAttr* aAttrArray[], PRUint32 aAttrArrayLen,
                 PRInt32* aStartHTOffset, PRInt32* aEndHTOffset);
 
 private:
   Accessible* mOffsetAcc;
-  nsHyperTextAccessible* mHyperTextAcc;
+  HyperTextAccessible* mHyperTextAcc;
   PRInt32 mOffsetAccIdx;
   bool mIncludeDefAttrs;
 
 protected:
 
   /**
    * Interface class of text attribute class implementations.
    */
@@ -186,17 +186,17 @@ protected:
 
 
   /**
    * Class is used for the work with 'language' text attribute.
    */
   class LangTextAttr : public TTextAttr<nsString>
   {
   public:
-    LangTextAttr(nsHyperTextAccessible* aRoot, nsIContent* aRootElm,
+    LangTextAttr(HyperTextAccessible* aRoot, nsIContent* aRootElm,
                  nsIContent* aElm);
     virtual ~LangTextAttr() { }
 
   protected:
 
     // TextAttr
     virtual bool GetValueFor(nsIContent* aElm, nsString* aValue);
     virtual void ExposeValue(nsIPersistentProperties* aAttributes,
--- a/accessible/src/base/TextUpdater.h
+++ b/accessible/src/base/TextUpdater.h
@@ -2,17 +2,17 @@
 /* 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 TextUpdater_h_
 #define TextUpdater_h_
 
 #include "AccEvent.h"
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
 /**
  * Used to find a difference between old and new text and fire text change
  * events.
  */
 class TextUpdater
 {
 public:
@@ -80,13 +80,13 @@ private:
    * The constant used to skip string difference calculation in case of long
    * strings.
    */
   const static PRUint32 kMaxStrLen = 1 << 6;
 
 private:
   DocAccessible* mDocument;
   mozilla::a11y::TextLeafAccessible* mTextLeaf;
-  nsHyperTextAccessible* mHyperText;
+  HyperTextAccessible* mHyperText;
   PRInt32 mTextOffset;
 };
 
 #endif
--- a/accessible/src/base/filters.cpp
+++ b/accessible/src/base/filters.cpp
@@ -15,17 +15,17 @@ bool
 filters::GetSelected(Accessible* aAccessible)
 {
   return aAccessible->State() & states::SELECTED;
 }
 
 bool
 filters::GetSelectable(Accessible* aAccessible)
 {
-  return aAccessible->State() & states::SELECTABLE;
+  return aAccessible->InteractiveState() & states::SELECTABLE;
 }
 
 bool
 filters::GetRow(Accessible* aAccessible)
 {
   return aAccessible->Role() == roles::ROW;
 }
 
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "nsAccDocManager.h"
 
 #include "ApplicationAccessible.h"
+#include "DocAccessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsARIAMap.h"
 #include "RootAccessibleWrap.h"
 #include "States.h"
 
 #ifdef DEBUG
 #include "Logging.h"
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -5,17 +5,17 @@
 
 #include "nsAccUtils.h"
 
 #include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsARIAMap.h"
 #include "nsCoreUtils.h"
 #include "DocAccessible.h"
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 #include "nsIAccessibleTypes.h"
 #include "Role.h"
 #include "States.h"
 #include "TextLeafAccessible.h"
 
 #include "nsIDOMXULContainerElement.h"
 #include "nsIDOMXULSelectCntrlEl.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
@@ -249,17 +249,17 @@ nsAccUtils::GetSelectableContainer(Acces
 bool
 nsAccUtils::IsARIASelected(Accessible* aAccessible)
 {
   return aAccessible->GetContent()->
     AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_selected,
                 nsGkAtoms::_true, eCaseMatters);
 }
 
-nsHyperTextAccessible*
+HyperTextAccessible*
 nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection)
 {
   // Get accessible from selection's focus DOM point (the DOM point where
   // selection is ended).
 
   nsCOMPtr<nsIDOMNode> focusDOMNode;
   aSelection->GetFocusNode(getter_AddRefs(focusDOMNode));
   if (!focusDOMNode)
@@ -278,17 +278,17 @@ nsAccUtils::GetTextAccessibleFromSelecti
   Accessible* accessible = doc ? 
     doc->GetAccessibleOrContainer(resultNode) : nsnull;
   if (!accessible) {
     NS_NOTREACHED("No nsIAccessibleText for selection change event!");
     return nsnull;
   }
 
   do {
-    nsHyperTextAccessible* textAcc = accessible->AsHyperText();
+    HyperTextAccessible* textAcc = accessible->AsHyperText();
     if (textAcc)
       return textAcc;
 
     accessible = accessible->Parent();
   } while (accessible);
 
   NS_NOTREACHED("We must reach document accessible implementing nsIAccessibleText!");
   return nsnull;
--- a/accessible/src/base/nsAccUtils.h
+++ b/accessible/src/base/nsAccUtils.h
@@ -18,17 +18,17 @@
 #include "nsIDocShell.h"
 #include "nsIDOMNode.h"
 #include "nsIPersistentProperties2.h"
 #include "nsIPresShell.h"
 #include "nsPoint.h"
 
 class nsAccessNode;
 class Accessible;
-class nsHyperTextAccessible;
+class HyperTextAccessible;
 class nsHTMLTableAccessible;
 class DocAccessible;
 struct nsRoleMapEntry;
 #ifdef MOZ_XUL
 class nsXULTreeAccessible;
 #endif
 
 class nsAccUtils
@@ -152,17 +152,17 @@ public:
 
   /**
    * Return text accessible containing focus point of the given selection.
    * Used for normal and misspelling selection changes processing.
    *
    * @param aSelection  [in] the given selection
    * @return            text accessible
    */
-  static nsHyperTextAccessible*
+  static HyperTextAccessible*
     GetTextAccessibleFromSelection(nsISelection* aSelection);
 
   /**
    * Converts the given coordinates to coordinates relative screen.
    *
    * @param aX               [in] the given x coord
    * @param aY               [in] the given y coord
    * @param aCoordinateType  [in] specifies coordinates origin (refer to
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -7,29 +7,30 @@
 
 // NOTE: alphabetically ordered
 #include "Accessible-inl.h"
 #include "ApplicationAccessibleWrap.h"
 #include "ARIAGridAccessibleWrap.h"
 #ifdef MOZ_ACCESSIBILITY_ATK
 #include "AtkSocketAccessible.h"
 #endif
+#include "DocAccessible-inl.h"
 #include "FocusManager.h"
+#include "HTMLElementAccessibles.h"
 #include "HTMLListAccessible.h"
+#include "HyperTextAccessibleWrap.h"
 #include "nsAccessiblePivot.h"
 #include "nsAccUtils.h"
 #include "nsARIAMap.h"
 #include "nsIAccessibleProvider.h"
 #include "nsHTMLCanvasAccessible.h"
 #include "nsHTMLImageMapAccessible.h"
 #include "nsHTMLLinkAccessible.h"
 #include "nsHTMLSelectAccessible.h"
 #include "nsHTMLTableAccessibleWrap.h"
-#include "nsHTMLTextAccessible.h"
-#include "nsHyperTextAccessibleWrap.h"
 #include "nsXFormsFormControlsAccessible.h"
 #include "nsXFormsWidgetsAccessible.h"
 #include "OuterDocAccessible.h"
 #include "Role.h"
 #include "RootAccessibleWrap.h"
 #include "States.h"
 #include "Statistics.h"
 #ifdef XP_WIN
@@ -200,17 +201,17 @@ nsAccessibilityService::CreateHTMLLIAcce
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHyperTextAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
   Accessible* accessible =
-    new nsHyperTextAccessibleWrap(aContent, GetDocAccessible(aPresShell));
+    new HyperTextAccessibleWrap(aContent, GetDocAccessible(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIContent* aContent,
                                                      nsIPresShell* aPresShell)
 {
@@ -250,17 +251,17 @@ nsAccessibilityService::CreateHTMLFileIn
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
   Accessible* accessible =
-    new nsHTMLImageAccessibleWrap(aContent, GetDocAccessible(aPresShell));
+    new ImageAccessibleWrap(aContent, GetDocAccessible(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLImageMapAccessible(nsIContent* aContent,
                                                      nsIPresShell* aPresShell)
 {
@@ -429,37 +430,37 @@ nsAccessibilityService::CreateHTMLTextFi
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLLabelAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
   Accessible* accessible =
-    new nsHTMLLabelAccessible(aContent, GetDocAccessible(aPresShell));
+    new HTMLLabelAccessible(aContent, GetDocAccessible(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLHRAccessible(nsIContent* aContent,
                                                nsIPresShell* aPresShell)
 {
   Accessible* accessible =
-    new nsHTMLHRAccessible(aContent, GetDocAccessible(aPresShell));
+    new HTMLHRAccessible(aContent, GetDocAccessible(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLBRAccessible(nsIContent* aContent,
                                                nsIPresShell* aPresShell)
 {
   Accessible* accessible =
-    new nsHTMLBRAccessible(aContent, GetDocAccessible(aPresShell));
+    new HTMLBRAccessible(aContent, GetDocAccessible(aPresShell));
   NS_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLCaptionAccessible(nsIContent* aContent,
                                                     nsIPresShell* aPresShell)
 {
@@ -470,72 +471,45 @@ nsAccessibilityService::CreateHTMLCaptio
 }
 
 void
 nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell,
                                              nsIContent* aContainer,
                                              nsIContent* aStartChild,
                                              nsIContent* aEndChild)
 {
-#ifdef DEBUG_CONTENTMUTATION
-  nsAutoString tag;
-  aStartChild->Tag()->ToString(tag);
-
-  nsIAtom* atomid = aStartChild->GetID();
-  nsCAutoString id;
-  if (atomid)
-    atomid->ToUTF8String(id);
-
-  nsAutoString ctag;
-  nsCAutoString cid;
-  nsIAtom* catomid = nsnull;
-  if (aContainer) {
-    aContainer->Tag()->ToString(ctag);
-    catomid = aContainer->GetID();
-    if (catomid)
-      catomid->ToUTF8String(cid);
+#ifdef DEBUG
+  if (logging::IsEnabled(logging::eTree)) {
+    logging::MsgBegin("TREE", "content inserted");
+    logging::Node("container", aContainer);
+    for (nsIContent* child = aStartChild; child != aEndChild;
+         child = child->GetNextSibling()) {
+      logging::Node("content", child);
+    }
+    logging::MsgEnd();
   }
-
-  printf("\ncontent inserted: %s@id='%s', container: %s@id='%s', end node: %p\n\n",
-         NS_ConvertUTF16toUTF8(tag).get(), id.get(),
-         NS_ConvertUTF16toUTF8(ctag).get(), cid.get(), aEndChild);
 #endif
 
   DocAccessible* docAccessible = GetDocAccessible(aPresShell);
   if (docAccessible)
     docAccessible->ContentInserted(aContainer, aStartChild, aEndChild);
 }
 
 void
 nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell,
                                        nsIContent* aContainer,
                                        nsIContent* aChild)
 {
-#ifdef DEBUG_CONTENTMUTATION
-  nsAutoString tag;
-  aChild->Tag()->ToString(tag);
-
-  nsIAtom* atomid = aChild->GetID();
-  nsCAutoString id;
-  if (atomid)
-    atomid->ToUTF8String(id);
-
-  nsAutoString ctag;
-  nsCAutoString cid;
-  nsIAtom* catomid = nsnull;
-  if (aContainer) {
-    aContainer->Tag()->ToString(ctag);
-    catomid = aContainer->GetID();
-    if (catomid)
-      catomid->ToUTF8String(cid);
+#ifdef DEBUG
+  if (logging::IsEnabled(logging::eTree)) {
+    logging::MsgBegin("TREE", "content removed");
+    logging::Node("container", aContainer);
+    logging::Node("content", aChild);
+    logging::MsgEnd();
   }
-
-  printf("\ncontent removed: %s@id='%s', container: %s@id='%s'\n\n",
-           NS_ConvertUTF16toUTF8(tag).get(), id.get(),
-           NS_ConvertUTF16toUTF8(ctag).get(), cid.get());
 #endif
 
   DocAccessible* docAccessible = GetDocAccessible(aPresShell);
   if (docAccessible)
     docAccessible->ContentRemoved(aContainer, aChild);
 }
 
 void
@@ -1038,26 +1012,26 @@ nsAccessibilityService::GetOrCreateAcces
   if (isHTML && content->Tag() == nsGkAtoms::map) {
     // Create hyper text accessible for HTML map if it is used to group links
     // (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML
     // map rect is empty then it is used for links grouping. Otherwise it should
     // be used in conjunction with HTML image element and in this case we don't
     // create any accessible for it and don't walk into it. The accessibles for
     // HTML area (nsHTMLAreaAccessible) the map contains are attached as
     // children of the appropriate accessible for HTML image
-    // (nsHTMLImageAccessible).
+    // (ImageAccessible).
     if (nsLayoutUtils::GetAllInFlowRectsUnion(weakFrame,
                                               weakFrame->GetParent()).IsEmpty()) {
       if (aIsSubtreeHidden)
         *aIsSubtreeHidden = true;
 
       return nsnull;
     }
 
-    newAcc = new nsHyperTextAccessibleWrap(content, docAcc);
+    newAcc = new HyperTextAccessibleWrap(content, docAcc);
     if (docAcc->BindToDocument(newAcc, aria::GetRoleMap(aNode)))
       return newAcc;
     return nsnull;
   }
 
   nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aNode);
   if (roleMapEntry && !nsCRT::strcmp(roleMapEntry->roleString, "presentation")) {
     // Ignore presentation role if element is focusable (focus event shouldn't
@@ -1222,17 +1196,17 @@ nsAccessibilityService::GetOrCreateAcces
        (isHTML && nsCoreUtils::HasClickListener(content)) ||
        HasUniversalAriaProperty(content) || roleMapEntry ||
        HasRelatedContent(content) || nsCoreUtils::IsXLink(content))) {
     // This content is focusable or has an interesting dynamic content accessibility property.
     // If it's interesting we need it in the accessibility hierarchy so that events or
     // other accessibles can point to it, or so that it can hold a state, etc.
     if (isHTML) {
       // Interesting HTML container which may have selectable text and/or embedded objects
-      newAcc = new nsHyperTextAccessibleWrap(content, docAcc);
+      newAcc = new HyperTextAccessibleWrap(content, docAcc);
     }
     else {  // XUL, SVG, MathML etc.
       // Interesting generic non-HTML container
       newAcc = new AccessibleWrap(content, docAcc);
     }
   }
 
   return docAcc->BindToDocument(newAcc, roleMapEntry) ? newAcc : nsnull;
@@ -1382,17 +1356,17 @@ nsAccessibilityService::CreateAccessible
 
     case nsIAccessibleProvider::XULImage:
     {
       // Don't include nameless images in accessible tree.
       if (!aContent->HasAttr(kNameSpaceID_None,
                              nsGkAtoms::tooltiptext))
         return nsnull;
 
-      accessible = new nsHTMLImageAccessibleWrap(aContent, aDoc);
+      accessible = new ImageAccessibleWrap(aContent, aDoc);
       break;
 
     }
     case nsIAccessibleProvider::XULLink:
       accessible = new nsXULLinkAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULListbox:
@@ -1652,17 +1626,17 @@ nsAccessibilityService::CreateHTMLAccess
   }
 
   if (tag == nsGkAtoms::a) {
     // Only some roles truly enjoy life as nsHTMLLinkAccessibles, for details
     // see closed bug 494807.
     nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aContent);
     if (roleMapEntry && roleMapEntry->role != roles::NOTHING &&
         roleMapEntry->role != roles::LINK) {
-      Accessible* accessible = new nsHyperTextAccessibleWrap(aContent, aDoc);
+      Accessible* accessible = new HyperTextAccessibleWrap(aContent, aDoc);
       NS_IF_ADDREF(accessible);
       return accessible;
     }
 
     Accessible* accessible = new nsHTMLLinkAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
@@ -1685,30 +1659,30 @@ nsAccessibilityService::CreateHTMLAccess
       tag == nsGkAtoms::form ||
       tag == nsGkAtoms::h1 ||
       tag == nsGkAtoms::h2 ||
       tag == nsGkAtoms::h3 ||
       tag == nsGkAtoms::h4 ||
       tag == nsGkAtoms::h5 ||
       tag == nsGkAtoms::h6 ||
       tag == nsGkAtoms::q) {
-    Accessible* accessible = new nsHyperTextAccessibleWrap(aContent, aDoc);
+    Accessible* accessible = new HyperTextAccessibleWrap(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (nsCoreUtils::IsHTMLTableHeader(aContent)) {
     Accessible* accessible = new nsHTMLTableHeaderCellAccessibleWrap(aContent,
                                                                      aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::output) {
-    Accessible* accessible = new nsHTMLOutputAccessible(aContent, aDoc);
+    Accessible* accessible = new HTMLOutputAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::progress) {
     Accessible* accessible =
       new HTMLProgressMeterAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
--- a/accessible/src/base/nsAccessiblePivot.cpp
+++ b/accessible/src/base/nsAccessiblePivot.cpp
@@ -2,19 +2,19 @@
 /* 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/. */
 
 #include "nsAccessiblePivot.h"
 
 #include "Accessible-inl.h"
+#include "DocAccessible.h"
+#include "HyperTextAccessible.h"
 #include "nsAccUtils.h"
-#include "nsHyperTextAccessible.h"
-#include "DocAccessible.h"
 #include "States.h"
 
 #include "nsArrayUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsISupportsPrimitives.h"
 
 using namespace mozilla::a11y;
 
@@ -150,17 +150,17 @@ nsAccessiblePivot::SetTextRange(nsIAcces
   NS_ENSURE_ARG(aTextAccessible);
 
   // Check that start offset is smaller than end offset, and that if a value is
   // smaller than 0, both should be -1.
   NS_ENSURE_TRUE(aStartOffset <= aEndOffset &&
                  (aStartOffset >= 0 || (aStartOffset != -1 && aEndOffset != -1)),
                  NS_ERROR_INVALID_ARG);
 
-  nsRefPtr<nsHyperTextAccessible> newPosition = do_QueryObject(aTextAccessible);
+  nsRefPtr<HyperTextAccessible> newPosition = do_QueryObject(aTextAccessible);
   if (!newPosition || !IsRootDescendant(newPosition))
     return NS_ERROR_INVALID_ARG;
 
   // Make sure the given offsets don't exceed the character count.
   PRInt32 charCount = newPosition->CharacterCount();
 
   if (aEndOffset > charCount)
     return NS_ERROR_FAILURE;
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -1,20 +1,20 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "nsBaseWidgetAccessible.h"
 
 #include "Accessible-inl.h"
+#include "HyperTextAccessibleWrap.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
-#include "nsHyperTextAccessibleWrap.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsGUIEvent.h"
 #include "nsILink.h"
 #include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
--- a/accessible/src/base/nsBaseWidgetAccessible.h
+++ b/accessible/src/base/nsBaseWidgetAccessible.h
@@ -2,17 +2,17 @@
 /* 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 _nsBaseWidgetAccessible_H_
 #define _nsBaseWidgetAccessible_H_
 
 #include "AccessibleWrap.h"
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 #include "nsIContent.h"
 
 /**
   * This file contains a number of classes that are used as base
   *  classes for the different accessibility implementations of
   *  the HTML and XUL widget sets.  --jgaunt
   */
 
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "nsCaretAccessible.h"
 
+#include "DocAccessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsIAccessibleEvent.h"
 #include "RootAccessible.h"
 
 #include "nsCaret.h"
 #include "nsIDOMDocument.h"
@@ -175,37 +176,19 @@ nsCaretAccessible::NotifySelectionChange
                                           PRInt16 aReason)
 {
   NS_ENSURE_ARG(aDOMDocument);
   NS_ENSURE_STATE(mRootAccessible);
 
   nsCOMPtr<nsIDocument> documentNode(do_QueryInterface(aDOMDocument));
   DocAccessible* document = GetAccService()->GetDocAccessible(documentNode);
 
-#ifdef DEBUG_NOTIFICATIONS
-  nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
-
-  PRInt16 type = 0;
-  privSel->GetType(&type);
-
-  if (type == nsISelectionController::SELECTION_NORMAL ||
-      type == nsISelectionController::SELECTION_SPELLCHECK) {
-
-    bool isNormalSelection =
-      (type == nsISelectionController::SELECTION_NORMAL);
-
-    bool isIgnored = !document || !document->IsContentLoaded();
-    printf("\nSelection changed, selection type: %s, notification %s\n",
-           (isNormalSelection ? "normal" : "spellcheck"),
-           (isIgnored ? "ignored" : "pending"));
-  } else {
-    bool isIgnored = !document || !document->IsContentLoaded();
-    printf("\nSelection changed, selection type: unknown, notification %s\n",
-               (isIgnored ? "ignored" : "pending"));
-  }
+#ifdef DEBUG
+  if (logging::IsEnabled(logging::eSelection))
+    logging::SelChange(aSelection, document);
 #endif
 
   // Don't fire events until document is loaded.
   if (document && document->IsContentLoaded()) {
     // The caret accessible has the same lifetime as the root accessible, and
     // this outlives all its descendant document accessibles, so that we are
     // guaranteed that the notification is processed before the caret accessible
     // is destroyed.
@@ -238,17 +221,17 @@ nsCaretAccessible::NormalSelectionChange
 
   PRInt32 rangeCount = 0;
   aSelection->GetRangeCount(&rangeCount);
   if (rangeCount == 0) {
     mLastTextAccessible = nsnull;
     return; // No selection
   }
 
-  nsHyperTextAccessible* textAcc =
+  HyperTextAccessible* textAcc =
     nsAccUtils::GetTextAccessibleFromSelection(aSelection);
   if (!textAcc)
     return;
 
   PRInt32 caretOffset = -1;
   nsresult rv = textAcc->GetCaretOffset(&caretOffset);
   if (NS_FAILED(rv))
     return;
@@ -273,17 +256,17 @@ void
 nsCaretAccessible::SpellcheckSelectionChanged(nsISelection* aSelection)
 {
   // XXX: fire an event for accessible of focus node of the selection. If
   // spellchecking is enabled then we will fire the number of events for
   // the same accessible for newly appended range of the selection (for every
   // misspelled word). If spellchecking is disabled (for example,
   // @spellcheck="false" on html:body) then we won't fire any event.
 
-  nsHyperTextAccessible* textAcc =
+  HyperTextAccessible* textAcc =
     nsAccUtils::GetTextAccessibleFromSelection(aSelection);
   if (!textAcc)
     return;
 
   nsRefPtr<AccEvent> event =
     new AccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED, textAcc);
   if (event)
     textAcc->Document()->FireDelayedAccessibleEvent(event);
--- a/accessible/src/base/nsCaretAccessible.h
+++ b/accessible/src/base/nsCaretAccessible.h
@@ -1,18 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 __nsCaretAccessible_h__
 #define __nsCaretAccessible_h__
 
-#include "NotificationController.h"
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
 #include "nsISelectionListener.h"
 
 /*
  * This special accessibility class is for the caret, which is really the currently focused selection.
  * There is only 1 visible caret per top level window (RootAccessible),
  * However, there may be several visible selections.
  *
@@ -113,15 +112,15 @@ private:
 
   // Currently focused control.
   nsCOMPtr<nsIContent> mCurrentControl;
 
   // Info for the the last selection event.
   // If it was on a control, then its control's selection. Otherwise, it's for
   // a document where the selection changed.
   nsCOMPtr<nsIWeakReference> mLastUsedSelection; // Weak ref to nsISelection
-  nsRefPtr<nsHyperTextAccessible> mLastTextAccessible;
+  nsRefPtr<HyperTextAccessible> mLastTextAccessible;
   PRInt32 mLastCaretOffset;
 
   mozilla::a11y::RootAccessible* mRootAccessible;
 };
 
 #endif
--- a/accessible/src/generic/ARIAGridAccessible.cpp
+++ b/accessible/src/generic/ARIAGridAccessible.cpp
@@ -769,25 +769,25 @@ ARIAGridAccessible::GetSelectedColumnsAr
 ////////////////////////////////////////////////////////////////////////////////
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor
 
 ARIAGridCellAccessible::
   ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridCellAccessible,
-                             nsHyperTextAccessible,
+                             HyperTextAccessible,
                              nsIAccessibleTableCell)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleTableCell
 
 NS_IMETHODIMP
 ARIAGridCellAccessible::GetTable(nsIAccessibleTable** aTable)
 {
@@ -951,17 +951,17 @@ ARIAGridCellAccessible::IsSelected(bool*
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible
 
 void
 ARIAGridCellAccessible::ApplyARIAState(PRUint64* aState) const
 {
-  nsHyperTextAccessibleWrap::ApplyARIAState(aState);
+  HyperTextAccessibleWrap::ApplyARIAState(aState);
 
   // Return if the gridcell has aria-selected="true".
   if (*aState & states::SELECTED)
     return;
 
   // Check aria-selected="true" on the row.
   Accessible* row = Parent();
   if (!row || row->Role() != roles::ROW)
@@ -977,17 +977,17 @@ ARIAGridCellAccessible::ApplyARIAState(P
 }
 
 nsresult
 ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
   
-  nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
+  nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expose "table-cell-index" attribute.
 
   Accessible* thisRow = Parent();
   if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
--- a/accessible/src/generic/ARIAGridAccessible.h
+++ b/accessible/src/generic/ARIAGridAccessible.h
@@ -3,17 +3,17 @@
  * 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_ARIAGridAccessible_h_
 #define MOZILLA_A11Y_ARIAGridAccessible_h_
 
 #include "nsIAccessibleTable.h"
 
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 #include "TableAccessible.h"
 #include "xpcAccessibleTable.h"
 
 namespace mozilla {
 namespace a11y {
 
 /**
  * Accessible for ARIA grid and treegrid.
@@ -83,17 +83,17 @@ protected:
   nsresult GetSelectedColumnsArray(PRUint32 *acolumnCount,
                                    PRInt32 **aColumns = nsnull);
 };
 
 
 /**
  * Accessible for ARIA gridcell and rowheader/columnheader.
  */
-class ARIAGridCellAccessible : public nsHyperTextAccessibleWrap,
+class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
                                public nsIAccessibleTableCell
 {
 public:
   ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -648,43 +648,26 @@ PRUint64
 Accessible::NativeState()
 {
   PRUint64 state = 0;
 
   DocAccessible* document = Document();
   if (!document || !document->IsInDocument(this))
     state |= states::STALE;
 
-  bool disabled = false;
   if (mContent->IsElement()) {
     nsEventStates elementState = mContent->AsElement()->State();
 
     if (elementState.HasState(NS_EVENT_STATE_INVALID))
       state |= states::INVALID;
 
     if (elementState.HasState(NS_EVENT_STATE_REQUIRED))
       state |= states::REQUIRED;
 
-    disabled = mContent->IsHTML() ? 
-      (elementState.HasState(NS_EVENT_STATE_DISABLED)) :
-      (mContent->AttrValueIs(kNameSpaceID_None,
-                             nsGkAtoms::disabled,
-                             nsGkAtoms::_true,
-                             eCaseMatters));
-  }
-
-  // Set unavailable state based on disabled state, otherwise set focus states
-  if (disabled) {
-    state |= states::UNAVAILABLE;
-  }
-  else if (mContent->IsElement()) {
-    nsIFrame* frame = GetFrame();
-    if (frame && frame->IsFocusable())
-      state |= states::FOCUSABLE;
-
+    state |= NativeInteractiveState();
     if (FocusMgr()->IsFocused(this))
       state |= states::FOCUSED;
   }
 
   // Gather states::INVISIBLE and states::OFFSCREEN flags for this object.
   state |= VisibilityState();
 
   nsIFrame *frame = GetFrame();
@@ -700,22 +683,48 @@ Accessible::NativeState()
   if (!mRoleMapEntry || mRoleMapEntry->roleRule == kUseNativeRole ||
       mRoleMapEntry->role == roles::LINK)
     state |= NativeLinkState();
 
   return state;
 }
 
 PRUint64
+Accessible::NativeInteractiveState() const
+{
+  if (!mContent->IsElement())
+    return 0;
+
+  if (NativelyUnavailable())
+    return states::UNAVAILABLE;
+
+  nsIFrame* frame = GetFrame();
+  if (frame && frame->IsFocusable())
+    return states::FOCUSABLE;
+
+  return 0;
+}
+
+PRUint64
 Accessible::NativeLinkState() const
 {
   // Expose linked state for simple xlink.
   return nsCoreUtils::IsXLink(mContent) ? states::LINKED : 0;
 }
 
+bool
+Accessible::NativelyUnavailable() const
+{
+  if (mContent->IsHTML())
+    return mContent->AsElement()->State().HasState(NS_EVENT_STATE_DISABLED);
+
+  return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
+                               nsGkAtoms::_true, eCaseMatters);
+}
+
   /* readonly attribute boolean focusedChild; */
 NS_IMETHODIMP
 Accessible::GetFocusedChild(nsIAccessible** aChild)
 {
   NS_ENSURE_ARG_POINTER(aChild);
   *aChild = nsnull;
 
   if (IsDefunct())
@@ -1833,81 +1842,83 @@ Accessible::GetActionCount(PRUint8* aAct
 
   *aActionCount = ActionCount();
   return NS_OK;
 }
 
 PRUint8
 Accessible::ActionCount()
 {
-  return GetActionRule(State()) == eNoAction ? 0 : 1;
+  return GetActionRule() == eNoAction ? 0 : 1;
 }
 
 /* DOMString getAccActionName (in PRUint8 index); */
 NS_IMETHODIMP
 Accessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   aName.Truncate();
 
   if (aIndex != 0)
     return NS_ERROR_INVALID_ARG;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  PRUint64 states = State();
-  PRUint32 actionRule = GetActionRule(states);
+  PRUint32 actionRule = GetActionRule();
 
  switch (actionRule) {
    case eActivateAction:
      aName.AssignLiteral("activate");
      return NS_OK;
 
    case eClickAction:
      aName.AssignLiteral("click");
      return NS_OK;
 
    case ePressAction:
      aName.AssignLiteral("press");
      return NS_OK;
 
    case eCheckUncheckAction:
-     if (states & states::CHECKED)
+   {
+     PRUint64 state = State();
+     if (state & states::CHECKED)
        aName.AssignLiteral("uncheck");
-     else if (states & states::MIXED)
+     else if (state & states::MIXED)
        aName.AssignLiteral("cycle");
      else
        aName.AssignLiteral("check");
      return NS_OK;
+   }
 
    case eJumpAction:
      aName.AssignLiteral("jump");
      return NS_OK;
 
    case eOpenCloseAction:
-     if (states & states::COLLAPSED)
+     if (State() & states::COLLAPSED)
        aName.AssignLiteral("open");
      else
        aName.AssignLiteral("close");
      return NS_OK;
 
    case eSelectAction:
      aName.AssignLiteral("select");
      return NS_OK;
 
    case eSwitchAction:
      aName.AssignLiteral("switch");
      return NS_OK;
-     
+
    case eSortAction:
      aName.AssignLiteral("sort");
      return NS_OK;
-   
+
    case eExpandAction:
-     if (states & states::COLLAPSED)
+     if (State() & states::COLLAPSED)
        aName.AssignLiteral("expand");
      else
        aName.AssignLiteral("collapse");
      return NS_OK;
   }
 
   return NS_ERROR_INVALID_ARG;
 }
@@ -1930,17 +1941,17 @@ NS_IMETHODIMP
 Accessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex != 0)
     return NS_ERROR_INVALID_ARG;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  if (GetActionRule(State()) != eNoAction) {
+  if (GetActionRule() != eNoAction) {
     DoCommand();
     return NS_OK;
   }
 
   return NS_ERROR_INVALID_ARG;
 }
 
 /* DOMString getHelp (); */
@@ -2731,26 +2742,26 @@ Accessible::IsLink()
   return mParent && mParent->IsHyperText() && nsAccUtils::IsEmbeddedObject(this);
 }
 
 PRUint32
 Accessible::StartOffset()
 {
   NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
 
-  nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
+  HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
   return hyperText ? hyperText->GetChildOffset(this) : 0;
 }
 
 PRUint32
 Accessible::EndOffset()
 {
   NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
 
-  nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
+  HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
   return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
 }
 
 bool
 Accessible::IsLinkSelected()
 {
   NS_PRECONDITION(IsLink(),
                   "IsLinkSelected() called on something that is not a hyper link!");
@@ -3137,21 +3148,21 @@ Accessible::GetAttrValue(nsIAtom *aPrope
   double value = attrValue.ToDouble(&error);
   if (NS_SUCCEEDED(error))
     *aValue = value;
 
   return NS_OK;
 }
 
 PRUint32
-Accessible::GetActionRule(PRUint64 aStates)
+Accessible::GetActionRule()
 {
-  if (aStates & states::UNAVAILABLE)
+  if (InteractiveState() & states::UNAVAILABLE)
     return eNoAction;
-  
+
   // Check if it's simple xlink.
   if (nsCoreUtils::IsXLink(mContent))
     return eJumpAction;
 
   // Return "click" action on elements that have an attached popup menu.
   if (mContent->IsXUL())
     if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
       return eClickAction;
--- a/accessible/src/generic/Accessible.h
+++ b/accessible/src/generic/Accessible.h
@@ -21,26 +21,26 @@
 #include "nsTArray.h"
 #include "nsRefPtrHashtable.h"
 
 class AccEvent;
 class AccGroupInfo;
 class EmbeddedObjCollector;
 class KeyBinding;
 class Accessible;
-class nsHyperTextAccessible;
-class nsHTMLImageAccessible;
+class HyperTextAccessible;
 class nsHTMLImageMapAccessible;
 struct nsRoleMapEntry;
 class Relation;
 
 namespace mozilla {
 namespace a11y {
 
 class HTMLLIAccessible;
+class ImageAccessible;
 class TableAccessible;
 class TextLeafAccessible;
 
 /**
  * Name type flags.
  */
 enum ENameValueFlag {
   /**
@@ -203,54 +203,74 @@ public:
   virtual mozilla::a11y::role NativeRole();
 
   /**
    * Return all states of accessible (including ARIA states).
    */
   virtual PRUint64 State();
 
   /**
+   * Return interactive states present on the accessible
+   * (@see NativeInteractiveState).
+   */
+  PRUint64 InteractiveState() const
+  {
+    PRUint64 state = NativeInteractiveState();
+    ApplyARIAState(&state);
+    return state;
+  }
+
+  /**
    * Return link states present on the accessible.
    */
   PRUint64 LinkState() const
   {
     PRUint64 state = NativeLinkState();
     ApplyARIAState(&state);
     return state;
   }
 
   /**
    * Return the states of accessible, not taking into account ARIA states.
    * Use State() to get complete set of states.
    */
   virtual PRUint64 NativeState();
 
   /**
+   * Return native interactice state (unavailable, focusable or selectable).
+   */
+  virtual PRUint64 NativeInteractiveState() const;
+
+  /**
    * Return native link states present on the accessible.
    */
   virtual PRUint64 NativeLinkState() const;
 
   /**
    * Return bit set of invisible and offscreen states.
    */
   PRUint64 VisibilityState();
 
   /**
+   * Return true if native unavailable state present.
+   */
+  virtual bool NativelyUnavailable() const;
+
+  /**
    * Returns attributes for accessible without explicitly setted ARIA
    * attributes.
    */
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   /**
    * Return group position (level, position in set and set size).
    */
   virtual mozilla::a11y::GroupPos GroupPosition();
 
   /**
-  /**
    * Used by ChildAtPoint() method to get direct or deepest child at point.
    */
   enum EWhichChildAtPoint {
     eDirectChild,
     eDeepestChild
   };
 
   /**
@@ -468,25 +488,25 @@ public:
   inline bool IsAutoCompletePopup() const { return mFlags & eAutoCompletePopupAccessible; }
 
   inline bool IsCombobox() const { return mFlags & eComboboxAccessible; }
 
   inline bool IsDoc() const { return mFlags & eDocAccessible; }
   DocAccessible* AsDoc();
 
   inline bool IsHyperText() const { return mFlags & eHyperTextAccessible; }
-  nsHyperTextAccessible* AsHyperText();
+  HyperTextAccessible* AsHyperText();
 
   inline bool IsHTMLFileInput() const { return mFlags & eHTMLFileInputAccessible; }
 
   inline bool IsHTMLListItem() const { return mFlags & eHTMLListItemAccessible; }
   mozilla::a11y::HTMLLIAccessible* AsHTMLListItem();
 
   inline bool IsImage() const { return mFlags & eImageAccessible; }
-  nsHTMLImageAccessible* AsImage();
+  mozilla::a11y::ImageAccessible* AsImage();
 
   bool IsImageMapAccessible() const { return mFlags & eImageMapAccessible; }
   nsHTMLImageMapAccessible* AsImageMap();
 
   inline bool IsXULTree() const { return mFlags & eXULTreeAccessible; }
   nsXULTreeAccessible* AsXULTree();
 
   inline bool IsListControl() const { return mFlags & eListControlAccessible; }
@@ -820,20 +840,18 @@ protected:
    *
    * @return - NS_OK_NO_ARIA_VALUE if there is no setted ARIA attribute
    */
   nsresult GetAttrValue(nsIAtom *aAriaProperty, double *aValue);
 
   /**
    * Return the action rule based on ARIA enum constants EActionRule
    * (see nsARIAMap.h). Used by ActionCount() and GetActionName().
-   *
-   * @param aStates  [in] states of the accessible
    */
-  PRUint32 GetActionRule(PRUint64 aStates);
+  PRUint32 GetActionRule();
 
   /**
    * Return group info.
    */
   AccGroupInfo* GetGroupInfo();
 
   /**
    * Fires platform accessible event. It's notification method only. It does
--- a/accessible/src/generic/DocAccessible-inl.h
+++ b/accessible/src/generic/DocAccessible-inl.h
@@ -4,16 +4,39 @@
  * 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_DocAccessible_inl_h_
 #define mozilla_a11y_DocAccessible_inl_h_
 
 #include "DocAccessible.h"
 #include "nsAccessibilityService.h"
+#include "NotificationController.h"
 
-inline DocAccessible*
-DocAccessible::ParentDocument() const
+inline void
+DocAccessible::BindChildDocument(DocAccessible* aDocument)
+{
+  mNotificationController->ScheduleChildDocBinding(aDocument);
+}
+
+template<class Class, class Arg>
+inline void
+DocAccessible::HandleNotification(Class* aInstance,
+                                  typename TNotification<Class, Arg>::Callback aMethod,
+                                  Arg* aArg)
 {
-  return GetAccService()->GetDocAccessible(mDocument->GetParentDocument());
+  if (mNotificationController) {
+    mNotificationController->HandleNotification<Class, Arg>(aInstance,
+                                                            aMethod, aArg);
+  }
+}
+
+inline void
+DocAccessible::UpdateText(nsIContent* aTextNode)
+{
+  NS_ASSERTION(mNotificationController, "The document was shut down!");
+
+  // Ignore the notification if initial tree construction hasn't been done yet.
+  if (mNotificationController && HasLoadState(eTreeConstructed))
+    mNotificationController->ScheduleTextUpdate(aTextNode);
 }
 
 #endif
--- a/accessible/src/generic/DocAccessible.cpp
+++ b/accessible/src/generic/DocAccessible.cpp
@@ -73,17 +73,17 @@ static nsIAtom** kRelationAttrs[] =
 static const PRUint32 kRelationAttrsLen = NS_ARRAY_LENGTH(kRelationAttrs);
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 DocAccessible::
   DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                   nsIPresShell* aPresShell) :
-  nsHyperTextAccessibleWrap(aRootContent, this),
+  HyperTextAccessibleWrap(aRootContent, this),
   mDocument(aDocument), mScrollPositionChangedTicks(0),
   mLoadState(eTreeConstructionPending), mLoadEventType(0),
   mVirtualCursor(nsnull),
   mPresShell(aPresShell)
 {
   mFlags |= eDocAccessible;
 
   mDependentIDsHash.Init();
@@ -157,36 +157,35 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_
   NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivotObserver)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleCursorable,
                                      mIsCursorable)
     foundInterface = 0;
 
   nsresult status;
   if (!foundInterface) {
-    // HTML document accessible must inherit from nsHyperTextAccessible to get
+    // HTML document accessible must inherit from HyperTextAccessible to get
     // support text interfaces. XUL document accessible doesn't need this.
     // However at some point we may push <body> to implement the interfaces and
     // return DocAccessible to inherit from AccessibleWrap.
 
     status = IsHyperText() ? 
-      nsHyperTextAccessible::QueryInterface(aIID,
-                                            (void**)&foundInterface) :
+      HyperTextAccessible::QueryInterface(aIID, (void**)&foundInterface) :
       Accessible::QueryInterface(aIID, (void**)&foundInterface);
   } else {
     NS_ADDREF(foundInterface);
     status = NS_OK;
   }
 
   *aInstancePtr = foundInterface;
   return status;
 }
 
-NS_IMPL_ADDREF_INHERITED(DocAccessible, nsHyperTextAccessible)
-NS_IMPL_RELEASE_INHERITED(DocAccessible, nsHyperTextAccessible)
+NS_IMPL_ADDREF_INHERITED(DocAccessible, HyperTextAccessible)
+NS_IMPL_RELEASE_INHERITED(DocAccessible, HyperTextAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 ENameValueFlag
 DocAccessible::Name(nsString& aName)
 {
   aName.Truncate();
@@ -281,17 +280,17 @@ PRUint64
 DocAccessible::NativeState()
 {
   // The root content of the document might be removed so that mContent is
   // out of date.
   PRUint64 state = (mContent->GetCurrentDoc() == mDocument) ?
     0 : states::STALE;
 
   // Document is always focusable.
-  state |= states::FOCUSABLE;
+  state |= states::FOCUSABLE; // keep in sync with NativeIteractiveState() impl
   if (FocusMgr()->IsFocused(this))
     state |= states::FOCUSED;
 
   // Expose stale state until the document is ready (DOM is loaded and tree is
   // constructed).
   if (!HasLoadState(eReady))
     state |= states::STALE;
 
@@ -307,16 +306,29 @@ DocAccessible::NativeState()
   }
 
   nsCOMPtr<nsIEditor> editor = GetEditor();
   state |= editor ? states::EDITABLE : states::READONLY;
 
   return state;
 }
 
+PRUint64
+DocAccessible::NativeInteractiveState() const
+{
+  // Document is always focusable.
+  return states::FOCUSABLE;
+}
+
+bool
+DocAccessible::NativelyUnavailable() const
+{
+  return false;
+}
+
 // Accessible public method
 void
 DocAccessible::ApplyARIAState(PRUint64* aState) const
 {
   // Combine with states from outer doc
   // 
   Accessible::ApplyARIAState(aState);
 
@@ -526,17 +538,17 @@ DocAccessible::GetVirtualCursor(nsIAcces
     mVirtualCursor = new nsAccessiblePivot(this);
     mVirtualCursor->AddObserver(this);
   }
 
   NS_ADDREF(*aVirtualCursor = mVirtualCursor);
   return NS_OK;
 }
 
-// nsHyperTextAccessible method
+// HyperTextAccessible method
 already_AddRefed<nsIEditor>
 DocAccessible::GetEditor() const
 {
   // Check if document is editable (designMode="on" case). Otherwise check if
   // the html:body (for HTML document case) or document element is editable.
   if (!mDocument->HasFlag(NODE_IS_EDITABLE) &&
       !mContent->HasFlag(NODE_IS_EDITABLE))
     return nsnull;
@@ -627,17 +639,19 @@ DocAccessible::Shutdown()
   if (mNotificationController) {
     mNotificationController->Shutdown();
     mNotificationController = nsnull;
   }
 
   RemoveEventListeners();
 
   // Mark the document as shutdown before AT is notified about the document
-  // removal from its container (valid for root documents on ATK).
+  // removal from its container (valid for root documents on ATK and due to
+  // some reason for MSAA, refer to bug 757392 for details).
+  mFlags |= eIsDefunct;
   nsCOMPtr<nsIDocument> kungFuDeathGripDoc = mDocument;
   mDocument = nsnull;
 
   if (mParent) {
     DocAccessible* parentDocument = mParent->Document();
     if (parentDocument)
       parentDocument->RemoveChildDocument(this);
 
@@ -658,17 +672,17 @@ DocAccessible::Shutdown()
   }
 
   mPresShell = nsnull;  // Avoid reentrancy
 
   mDependentIDsHash.Clear();
   mNodeToAccessibleMap.Clear();
   ClearCache(mAccessibleCache);
 
-  nsHyperTextAccessibleWrap::Shutdown();
+  HyperTextAccessibleWrap::Shutdown();
 
   GetAccService()->NotifyOfDocumentShutdown(kungFuDeathGripDoc);
 }
 
 nsIFrame*
 DocAccessible::GetFrame() const
 {
   nsIFrame* root = nsnull;
@@ -1300,17 +1314,17 @@ DocAccessible::ParentChainChanged(nsICon
 
 #ifdef DEBUG
 nsresult
 DocAccessible::HandleAccEvent(AccEvent* aEvent)
 {
   if (logging::IsEnabled(logging::eDocLoad))
     logging::DocLoadEventHandled(aEvent);
 
-  return nsHyperTextAccessible::HandleAccEvent(aEvent);
+  return HyperTextAccessible::HandleAccEvent(aEvent);
 }
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
 // Public members
 
 void*
 DocAccessible::GetNativeWindow() const
@@ -1757,17 +1771,17 @@ DocAccessible::FireDelayedAccessibleEven
   return NS_OK;
 }
 
 void
 DocAccessible::ProcessPendingEvent(AccEvent* aEvent)
 {
   PRUint32 eventType = aEvent->GetEventType();
   if (eventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) {
-    nsHyperTextAccessible* hyperText = aEvent->GetAccessible()->AsHyperText();
+    HyperTextAccessible* hyperText = aEvent->GetAccessible()->AsHyperText();
     PRInt32 caretOffset;
     if (hyperText &&
         NS_SUCCEEDED(hyperText->GetCaretOffset(&caretOffset))) {
       nsRefPtr<AccEvent> caretMoveEvent =
         new AccCaretMoveEvent(hyperText, caretOffset);
       nsEventShell::FireEvent(caretMoveEvent);
 
       PRInt32 selectionCount;
@@ -1832,16 +1846,31 @@ DocAccessible::ProcessContentInserted(Ac
 void
 DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
                           bool aIsInsert)
 {
   PRUint32 updateFlags = eNoAccessible;
 
   // If child node is not accessible then look for its accessible children.
   Accessible* child = GetAccessible(aChildNode);
+#ifdef DEBUG
+  if (logging::IsEnabled(logging::eTree)) {
+    logging::MsgBegin("TREE", "process content %s",
+                      (aIsInsert ? "insertion" : "removal"));
+    logging::Node("container", aContainer->GetNode());
+    logging::Node("child", aChildNode);
+    if (child)
+      logging::Address("child", child);
+    else
+      logging::MsgEntry("child accessible: null");
+
+    logging::MsgEnd();
+  }
+#endif
+
   if (child) {
     updateFlags |= UpdateTreeInternal(child, aIsInsert);
 
   } else {
     nsAccTreeWalker walker(this, aChildNode,
                            aContainer->CanHaveAnonChildren(), true);
 
     while ((child = walker.NextChild()))
@@ -2024,17 +2053,21 @@ DocAccessible::IsLoadEventTarget() const
     do_QueryInterface(container);
   NS_ASSERTION(docShellTreeItem, "No document shell for document!");
 
   nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
   docShellTreeItem->GetParent(getter_AddRefs(parentTreeItem));
 
   // Return true if it's not a root document (either tab document or
   // frame/iframe document) and its parent document is not in loading state.
-  if (parentTreeItem)
-    return ParentDocument()->HasLoadState(eCompletelyLoaded);
+  // Note: we can get notifications while document is loading (and thus
+  // while there's no parent document yet).
+  if (parentTreeItem) {
+    DocAccessible* parentDoc = ParentDocument();
+    return parentDoc && parentDoc->HasLoadState(eCompletelyLoaded);
+  }
 
   // It's content (not chrome) root document.
   PRInt32 contentType;
   docShellTreeItem->GetItemType(&contentType);
   return (contentType == nsIDocShellTreeItem::typeContent);
 }
 
--- a/accessible/src/generic/DocAccessible.h
+++ b/accessible/src/generic/DocAccessible.h
@@ -5,38 +5,41 @@
 
 #ifndef mozilla_a11y_DocAccessible_h__
 #define mozilla_a11y_DocAccessible_h__
 
 #include "nsIAccessibleCursorable.h"
 #include "nsIAccessibleDocument.h"
 #include "nsIAccessiblePivot.h"
 
+#include "HyperTextAccessibleWrap.h"
 #include "nsEventShell.h"
-#include "nsHyperTextAccessibleWrap.h"
-#include "NotificationController.h"
 
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "nsIDocument.h"
 #include "nsIDocumentObserver.h"
 #include "nsIEditor.h"
 #include "nsIObserver.h"
 #include "nsIScrollPositionListener.h"
 #include "nsITimer.h"
 #include "nsIWeakReference.h"
 #include "nsCOMArray.h"
 #include "nsIDocShellTreeNode.h"
 
+template<class Class, class Arg>
+class TNotification;
+class NotificationController;
+
 class nsIScrollableView;
 class nsAccessiblePivot;
 
 const PRUint32 kDefaultCacheSize = 256;
 
-class DocAccessible : public nsHyperTextAccessibleWrap,
+class DocAccessible : public HyperTextAccessibleWrap,
                       public nsIAccessibleDocument,
                       public nsIDocumentObserver,
                       public nsIObserver,
                       public nsIScrollPositionListener,
                       public nsSupportsWeakReference,
                       public nsIAccessibleCursorable,
                       public nsIAccessiblePivotObserver
 {
@@ -76,27 +79,29 @@ public:
   virtual nsIDocument* GetDocumentNode() const { return mDocument; }
 
   // Accessible
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
   virtual void Description(nsString& aDescription);
   virtual Accessible* FocusedChild();
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
+  virtual PRUint64 NativeInteractiveState() const;
+  virtual bool NativelyUnavailable() const;
   virtual void ApplyARIAState(PRUint64* aState) const;
 
   virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
 
 #ifdef DEBUG
   virtual nsresult HandleAccEvent(AccEvent* aEvent);
 #endif
 
   virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
 
-  // nsHyperTextAccessible
+  // HyperTextAccessible
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
   // DocAccessible
 
   /**
    * Return presentation shell for this document accessible.
    */
   nsIPresShell* PresShell() const { return mPresShell; }
@@ -144,17 +149,18 @@ public:
   /**
    * Return a native window handler or pointer depending on platform.
    */
   virtual void* GetNativeWindow() const;
 
   /**
    * Return the parent document.
    */
-  DocAccessible* ParentDocument() const;
+  DocAccessible* ParentDocument() const
+    { return mParent ? mParent->Document() : nsnull; }
 
   /**
    * Return the child document count.
    */
   PRUint32 ChildDocumentCount() const
     { return mChildDocuments.Length(); }
 
   /**
@@ -203,38 +209,29 @@ public:
     { return GetAccessibleOrContainer(mAnchorJumpElm); }
 
   void SetAnchorJump(nsIContent* aTargetNode)
     { mAnchorJumpElm = aTargetNode; }
 
   /**
    * Bind the child document to the tree.
    */
-  void BindChildDocument(DocAccessible* aDocument)
-  {
-    mNotificationController->ScheduleChildDocBinding(aDocument);
-  }
+  void BindChildDocument(DocAccessible* aDocument);
 
   /**
    * Process the generic notification.
    *
    * @note  The caller must guarantee that the given instance still exists when
    *          notification is processed.
    * @see   NotificationController::HandleNotification
    */
   template<class Class, class Arg>
   void HandleNotification(Class* aInstance,
-                                 typename TNotification<Class, Arg>::Callback aMethod,
-                                 Arg* aArg)
-  {
-    if (mNotificationController) {
-      mNotificationController->HandleNotification<Class, Arg>(aInstance,
-                                                              aMethod, aArg);
-    }
-  }
+                          typename TNotification<Class, Arg>::Callback aMethod,
+                          Arg* aArg);
 
   /**
    * Return the cached accessible by the given DOM node if it's in subtree of
    * this document accessible or the document accessible itself, otherwise null.
    *
    * @return the accessible object
    */
   Accessible* GetAccessible(nsINode* aNode) const;
@@ -324,24 +321,17 @@ public:
   /**
    * Notify the document accessible that content was removed.
    */
   void ContentRemoved(nsIContent* aContainerNode, nsIContent* aChildNode);
 
   /**
    * Updates accessible tree when rendered text is changed.
    */
-  void UpdateText(nsIContent* aTextNode)
-  {
-    NS_ASSERTION(mNotificationController, "The document was shut down!");
-
-    // Ignore the notification if initial tree construction hasn't been done yet.
-    if (mNotificationController && HasLoadState(eTreeConstructed))
-      mNotificationController->ScheduleTextUpdate(aTextNode);
-  }
+  void UpdateText(nsIContent* aTextNode);
 
   /**
    * Recreate an accessible, results in hide/show events pair.
    */
   void RecreateAccessible(nsIContent* aContent);
 
 protected:
 
rename from accessible/src/html/nsHyperTextAccessible.cpp
rename to accessible/src/generic/HyperTextAccessible.cpp
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
 #include "Accessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "DocAccessible.h"
 #include "Role.h"
 #include "States.h"
 #include "TextAttrs.h"
@@ -32,35 +32,36 @@
 #include "nsIServiceManager.h"
 #include "nsTextFragment.h"
 #include "nsTypedSelection.h"
 #include "gfxSkipChars.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHyperTextAccessible
+// HyperTextAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHyperTextAccessible::
-  nsHyperTextAccessible(nsIContent* aNode, DocAccessible* aDoc) :
+HyperTextAccessible::
+  HyperTextAccessible(nsIContent* aNode, DocAccessible* aDoc) :
   AccessibleWrap(aNode, aDoc)
 {
   mFlags |= eHyperTextAccessible;
 }
 
-NS_IMPL_ADDREF_INHERITED(nsHyperTextAccessible, AccessibleWrap)
-NS_IMPL_RELEASE_INHERITED(nsHyperTextAccessible, AccessibleWrap)
+NS_IMPL_ADDREF_INHERITED(HyperTextAccessible, AccessibleWrap)
+NS_IMPL_RELEASE_INHERITED(HyperTextAccessible, AccessibleWrap)
 
-nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
+nsresult
+HyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
   *aInstancePtr = nsnull;
 
-  if (aIID.Equals(NS_GET_IID(nsHyperTextAccessible))) {
-    *aInstancePtr = static_cast<nsHyperTextAccessible*>(this);
+  if (aIID.Equals(NS_GET_IID(HyperTextAccessible))) {
+    *aInstancePtr = static_cast<HyperTextAccessible*>(this);
     NS_ADDREF_THIS();
     return NS_OK;
   }
 
   // ARIA roles that these interfaces are not appropriate for.
   if (!IsTextRole())
     return Accessible::QueryInterface(aIID, aInstancePtr);
 
@@ -81,17 +82,17 @@ nsresult nsHyperTextAccessible::QueryInt
     NS_ADDREF_THIS();
     return NS_OK;
   }
 
   return Accessible::QueryInterface(aIID, aInstancePtr);
 }
 
 role
-nsHyperTextAccessible::NativeRole()
+HyperTextAccessible::NativeRole()
 {
   nsIAtom *tag = mContent->Tag();
 
   if (tag == nsGkAtoms::dd)
     return roles::DEFINITION;
 
   if (tag == nsGkAtoms::form)
     return roles::FORM;
@@ -122,17 +123,17 @@ nsHyperTextAccessible::NativeRole()
   nsIFrame *frame = GetFrame();
   if (frame && frame->GetType() == nsGkAtoms::blockFrame)
     return roles::PARAGRAPH;
 
   return roles::TEXT_CONTAINER; // In ATK this works
 }
 
 PRUint64
-nsHyperTextAccessible::NativeState()
+HyperTextAccessible::NativeState()
 {
   PRUint64 states = AccessibleWrap::NativeState();
 
   nsCOMPtr<nsIEditor> editor = GetEditor();
   if (editor) {
     states |= states::EDITABLE;
 
   } else if (mContent->Tag() == nsGkAtoms::article) {
@@ -142,18 +143,19 @@ nsHyperTextAccessible::NativeState()
 
   if (HasChildren())
     states |= states::SELECTABLE_TEXT;
 
   return states;
 }
 
 // Substring must be entirely within the same text node
-nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 aStartRenderedOffset,
-                                                    PRUint32 aEndRenderedOffset)
+nsIntRect
+HyperTextAccessible::GetBoundsForString(nsIFrame* aFrame, PRUint32 aStartRenderedOffset,
+                                        PRUint32 aEndRenderedOffset)
 {
   nsIntRect screenRect;
   NS_ENSURE_TRUE(aFrame, screenRect);
   if (aFrame->GetType() != nsGkAtoms::textFrame) {
     // XXX fallback for non-text frames, happens for bullets right now
     // but in the future bullets will have proper text frames
     return aFrame->GetScreenRectExternal();
   }
@@ -210,21 +212,21 @@ nsIntRect nsHyperTextAccessible::GetBoun
 
   return screenRect;
 }
 
 /*
  * Gets the specified text.
  */
 nsIFrame*
-nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
-                                     nsAString *aText, nsIFrame **aEndFrame,
-                                     nsIntRect *aBoundsRect,
-                                     Accessible** aStartAcc,
-                                     Accessible** aEndAcc)
+HyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
+                                   nsAString* aText, nsIFrame** aEndFrame,
+                                   nsIntRect* aBoundsRect,
+                                   Accessible** aStartAcc,
+                                   Accessible** aEndAcc)
 {
   if (aStartOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT) {
     aStartOffset = CharacterCount();
   }
   if (aStartOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
     GetCaretOffset(&aStartOffset);
   }
   if (aEndOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT) {
@@ -409,18 +411,18 @@ nsHyperTextAccessible::GetPosAndText(PRI
     if (aStartAcc && aEndAcc)
       NS_IF_ADDREF(*aEndAcc = *aStartAcc);
   }
 
   return startFrame;
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset,
-                               nsAString &aText)
+HyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset,
+                             nsAString& aText)
 {
   aText.Truncate();
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   PRInt32 startOffset = ConvertMagicOffset(aStartOffset);
   PRInt32 endOffset = ConvertMagicOffset(aEndOffset);
@@ -464,32 +466,34 @@ nsHyperTextAccessible::GetText(PRInt32 a
   endChild->AppendTextTo(aText, 0, endOffset - endChildOffset);
 
   return NS_OK;
 }
 
 /*
  * Gets the character count.
  */
-NS_IMETHODIMP nsHyperTextAccessible::GetCharacterCount(PRInt32 *aCharacterCount)
+NS_IMETHODIMP
+HyperTextAccessible::GetCharacterCount(PRInt32* aCharacterCount)
 {
   NS_ENSURE_ARG_POINTER(aCharacterCount);
   *aCharacterCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   *aCharacterCount = CharacterCount();
   return NS_OK;
 }
 
 /*
  * Gets the specified character.
  */
-NS_IMETHODIMP nsHyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter)
+NS_IMETHODIMP
+HyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar* aCharacter)
 {
   NS_ENSURE_ARG_POINTER(aCharacter);
   *aCharacter = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAutoString character;
@@ -497,20 +501,20 @@ NS_IMETHODIMP nsHyperTextAccessible::Get
     *aCharacter = character.First();
     return NS_OK;
   }
 
   return NS_ERROR_INVALID_ARG;
 }
 
 Accessible*
-nsHyperTextAccessible::DOMPointToHypertextOffset(nsINode *aNode,
-                                                 PRInt32 aNodeOffset,
-                                                 PRInt32 *aHyperTextOffset,
-                                                 bool aIsEndOffset)
+HyperTextAccessible::DOMPointToHypertextOffset(nsINode* aNode,
+                                               PRInt32 aNodeOffset,
+                                               PRInt32* aHyperTextOffset,
+                                               bool aIsEndOffset)
 {
   if (!aHyperTextOffset)
     return nsnull;
   *aHyperTextOffset = 0;
 
   if (!aNode)
     return nsnull;
 
@@ -632,34 +636,34 @@ nsHyperTextAccessible::DOMPointToHyperte
       return childAccAtOffset;
     }
   }
 
   return nsnull;
 }
 
 nsresult
-nsHyperTextAccessible::HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
-                                                 nsIDOMNode **aNode,
-                                                 PRInt32 *aOffset)
+HyperTextAccessible::HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
+                                               nsIDOMNode** aNode,
+                                               PRInt32* aOffset)
 {
   nsCOMPtr<nsIDOMNode> endNode;
   PRInt32 endOffset;
 
   return HypertextOffsetsToDOMRange(aHTOffset, aHTOffset, aNode, aOffset,
                                     getter_AddRefs(endNode), &endOffset);
 }
 
 nsresult
-nsHyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
-                                                  PRInt32 aEndHTOffset,
-                                                  nsIDOMNode **aStartNode,
-                                                  PRInt32 *aStartOffset,
-                                                  nsIDOMNode **aEndNode,
-                                                  PRInt32 *aEndOffset)
+HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
+                                                PRInt32 aEndHTOffset,
+                                                nsIDOMNode** aStartNode,
+                                                PRInt32* aStartOffset,
+                                                nsIDOMNode** aEndNode,
+                                                PRInt32* aEndOffset)
 {
   NS_ENSURE_ARG_POINTER(aStartNode);
   *aStartNode = nsnull;
 
   NS_ENSURE_ARG_POINTER(aStartOffset);
   *aStartOffset = -1;
 
   NS_ENSURE_ARG_POINTER(aEndNode);
@@ -720,23 +724,23 @@ nsHyperTextAccessible::HypertextOffsetsT
 
   NS_ADDREF(*aEndNode = endNode);
   *aEndOffset = endOffset;
 
   return NS_OK;
 }
 
 PRInt32
-nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
-                                         nsIFrame *aFromFrame,
-                                         PRInt32 aFromOffset,
-                                         Accessible* aFromAccessible,
-                                         nsSelectionAmount aAmount,
-                                         nsDirection aDirection,
-                                         bool aNeedsStart)
+HyperTextAccessible::GetRelativeOffset(nsIPresShell* aPresShell,
+                                       nsIFrame* aFromFrame,
+                                       PRInt32 aFromOffset,
+                                       Accessible* aFromAccessible,
+                                       nsSelectionAmount aAmount,
+                                       nsDirection aDirection,
+                                       bool aNeedsStart)
 {
   const bool kIsJumpLinesOk = true;          // okay to jump lines
   const bool kIsScrollViewAStop = false;     // do not stop at scroll views
   const bool kIsKeyboardSelect = true;       // is keyboard selection
   const bool kIsVisualBidi = false;          // use visual order for bidi text
 
   EWordMovementType wordMovementType = aNeedsStart ? eStartWord : eEndWord;
   if (aAmount == eSelectLine) {
@@ -829,19 +833,19 @@ Gets the specified text relative to aBou
 BOUNDARY_CHAR             The character before/at/after the offset is returned.
 BOUNDARY_WORD_START       From the word start before/at/after the offset to the next word start.
 BOUNDARY_WORD_END         From the word end before/at/after the offset to the next work end.
 BOUNDARY_LINE_START       From the line start before/at/after the offset to the next line start.
 BOUNDARY_LINE_END         From the line end before/at/after the offset to the next line start.
 */
 
 nsresult
-nsHyperTextAccessible::GetTextHelper(EGetTextType aType, AccessibleTextBoundary aBoundaryType,
-                                              PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
-                                              nsAString &aText)
+HyperTextAccessible::GetTextHelper(EGetTextType aType, AccessibleTextBoundary aBoundaryType,
+                                   PRInt32 aOffset, PRInt32* aStartOffset, PRInt32* aEndOffset,
+                                   nsAString& aText)
 {
   aText.Truncate();
 
   NS_ENSURE_ARG_POINTER(aStartOffset);
   NS_ENSURE_ARG_POINTER(aEndOffset);
   *aStartOffset = *aEndOffset = 0;
 
   if (!mDoc)
@@ -1012,62 +1016,66 @@ nsHyperTextAccessible::GetTextHelper(EGe
   GetPosAndText(finalStartOffset, finalEndOffset, &aText);
   return NS_OK;
 }
 
 /**
   * nsIAccessibleText impl.
   */
 NS_IMETHODIMP
-nsHyperTextAccessible::GetTextBeforeOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
-                                                         PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
+HyperTextAccessible::GetTextBeforeOffset(PRInt32 aOffset,
+                                         AccessibleTextBoundary aBoundaryType,
+                                         PRInt32* aStartOffset,
+                                         PRInt32* aEndOffset, nsAString& aText)
 {
   if (aBoundaryType == BOUNDARY_CHAR) {
     GetCharAt(aOffset, eGetBefore, aText, aStartOffset, aEndOffset);
     return NS_OK;
   }
 
   return GetTextHelper(eGetBefore, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::GetTextAtOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
-                                                     PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
+HyperTextAccessible::GetTextAtOffset(PRInt32 aOffset,
+                                     AccessibleTextBoundary aBoundaryType,
+                                     PRInt32* aStartOffset,
+                                     PRInt32* aEndOffset, nsAString& aText)
 {
   if (aBoundaryType == BOUNDARY_CHAR) {
     GetCharAt(aOffset, eGetAt, aText, aStartOffset, aEndOffset);
     return NS_OK;
   }
 
   return GetTextHelper(eGetAt, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::GetTextAfterOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
-                                                        PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
+HyperTextAccessible::GetTextAfterOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
+                                        PRInt32* aStartOffset, PRInt32* aEndOffset, nsAString& aText)
 {
   if (aBoundaryType == BOUNDARY_CHAR) {
     GetCharAt(aOffset, eGetAfter, aText, aStartOffset, aEndOffset);
     return NS_OK;
   }
 
   return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, aText);
 }
 
 // nsIPersistentProperties
 // nsIAccessibleText::getTextAttributes(in boolean includeDefAttrs,
 //                                      in long offset,
 //                                      out long rangeStartOffset,
 //                                      out long rangeEndOffset);
 NS_IMETHODIMP
-nsHyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
-                                         PRInt32 aOffset,
-                                         PRInt32 *aStartOffset,
-                                         PRInt32 *aEndOffset,
-                                         nsIPersistentProperties **aAttributes)
+HyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
+                                       PRInt32 aOffset,
+                                       PRInt32* aStartOffset,
+                                       PRInt32* aEndOffset,
+                                       nsIPersistentProperties** aAttributes)
 {
   // 1. Get each attribute and its ranges one after another.
   // 2. As we get each new attribute, we pass the current start and end offsets
   //    as in/out parameters. In other words, as attributes are collected,
   //    the attribute range itself can only stay the same or get smaller.
 
   NS_ENSURE_ARG_POINTER(aStartOffset);
   *aStartOffset = 0;
@@ -1129,17 +1137,17 @@ nsHyperTextAccessible::GetTextAttributes
   *aStartOffset = startOffset;
   *aEndOffset = endOffset;
   return NS_OK;
 }
 
 // nsIPersistentProperties
 // nsIAccessibleText::defaultTextAttributes
 NS_IMETHODIMP
-nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttributes)
+HyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties** aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);
   *aAttributes = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIPersistentProperties> attributes =
@@ -1149,17 +1157,17 @@ nsHyperTextAccessible::GetDefaultTextAtt
   NS_ADDREF(*aAttributes = attributes);
 
   TextAttrsMgr textAttrsMgr(this);
   textAttrsMgr.GetAttributes(*aAttributes);
   return NS_OK;
 }
 
 PRInt32
-nsHyperTextAccessible::GetLevelInternal()
+HyperTextAccessible::GetLevelInternal()
 {
   nsIAtom *tag = mContent->Tag();
   if (tag == nsGkAtoms::h1)
     return 1;
   if (tag == nsGkAtoms::h2)
     return 2;
   if (tag == nsGkAtoms::h3)
     return 3;
@@ -1169,17 +1177,17 @@ nsHyperTextAccessible::GetLevelInternal(
     return 5;
   if (tag == nsGkAtoms::h6)
     return 6;
 
   return AccessibleWrap::GetLevelInternal();
 }
 
 nsresult
-nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
+HyperTextAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
   nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Indicate when the current object uses block-level formatting
   // via formatting: block
   // XXX: 'formatting' attribute is deprecated and will be removed in Mozilla2,
   // use 'display' attribute instead.
@@ -1218,30 +1226,32 @@ nsHyperTextAccessible::GetAttributesInte
                            NS_LITERAL_STRING("complementary"));
 
   return  NS_OK;
 }
 
 /*
  * Given an offset, the x, y, width, and height values are filled appropriately.
  */
-NS_IMETHODIMP nsHyperTextAccessible::GetCharacterExtents(PRInt32 aOffset, PRInt32 *aX, PRInt32 *aY,
-                                                         PRInt32 *aWidth, PRInt32 *aHeight,
-                                                         PRUint32 aCoordType)
+NS_IMETHODIMP
+HyperTextAccessible::GetCharacterExtents(PRInt32 aOffset, PRInt32* aX, PRInt32* aY,
+                                         PRInt32* aWidth, PRInt32* aHeight,
+                                         PRUint32 aCoordType)
 {
   return GetRangeExtents(aOffset, aOffset + 1, aX, aY, aWidth, aHeight, aCoordType);
 }
 
 /*
  * Given a start & end offset, the x, y, width, and height values are filled appropriately.
  */
-NS_IMETHODIMP nsHyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
-                                                     PRInt32 *aX, PRInt32 *aY,
-                                                     PRInt32 *aWidth, PRInt32 *aHeight,
-                                                     PRUint32 aCoordType)
+NS_IMETHODIMP
+HyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
+                                     PRInt32* aX, PRInt32* aY,
+                                     PRInt32* aWidth, PRInt32* aHeight,
+                                     PRUint32 aCoordType)
 {
   nsIntRect boundsRect;
   nsIFrame *endFrameUnused;
   if (!GetPosAndText(aStartOffset, aEndOffset, nsnull, &endFrameUnused, &boundsRect) ||
       boundsRect.IsEmpty()) {
     return NS_ERROR_FAILURE;
   }
 
@@ -1253,18 +1263,18 @@ NS_IMETHODIMP nsHyperTextAccessible::Get
   return nsAccUtils::ConvertScreenCoordsTo(aX, aY, aCoordType, this);
 }
 
 /*
  * Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to
  * the screen or this widget's window depending on coords.
  */
 NS_IMETHODIMP
-nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
-                                        PRUint32 aCoordType, PRInt32 *aOffset)
+HyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
+                                      PRUint32 aCoordType, PRInt32* aOffset)
 {
   *aOffset = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsIFrame *hyperFrame = GetFrame();
   if (!hyperFrame) {
@@ -1334,175 +1344,176 @@ nsHyperTextAccessible::GetOffsetAtPoint(
   return NS_OK; // Not found, will return -1
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleHyperText
 
 NS_IMETHODIMP
-nsHyperTextAccessible::GetLinkCount(PRInt32 *aLinkCount)
+HyperTextAccessible::GetLinkCount(PRInt32* aLinkCount)
 {
   NS_ENSURE_ARG_POINTER(aLinkCount);
   *aLinkCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   *aLinkCount = GetLinkCount();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::GetLinkAt(PRInt32 aIndex, nsIAccessibleHyperLink** aLink)
+HyperTextAccessible::GetLinkAt(PRInt32 aIndex, nsIAccessibleHyperLink** aLink)
 {
   NS_ENSURE_ARG_POINTER(aLink);
   *aLink = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   Accessible* link = GetLinkAt(aIndex);
   if (link)
     CallQueryInterface(link, aLink);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::GetLinkIndex(nsIAccessibleHyperLink* aLink,
-                                    PRInt32* aIndex)
+HyperTextAccessible::GetLinkIndex(nsIAccessibleHyperLink* aLink,
+                                  PRInt32* aIndex)
 {
   NS_ENSURE_ARG_POINTER(aLink);
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsRefPtr<Accessible> link(do_QueryObject(aLink));
   *aIndex = GetLinkIndex(link);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::GetLinkIndexAtOffset(PRInt32 aOffset,
-                                            PRInt32* aLinkIndex)
+HyperTextAccessible::GetLinkIndexAtOffset(PRInt32 aOffset, PRInt32* aLinkIndex)
 {
   NS_ENSURE_ARG_POINTER(aLinkIndex);
   *aLinkIndex = -1; // API says this magic value means 'not found'
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   *aLinkIndex = GetLinkIndexAtOffset(aOffset);
   return NS_OK;
 }
 
 /**
   * nsIAccessibleEditableText impl.
   */
-NS_IMETHODIMP nsHyperTextAccessible::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos,
-                                                   nsISupports *aAttributes)
+NS_IMETHODIMP
+HyperTextAccessible::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos,
+                                   nsISupports* aAttributes)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP nsHyperTextAccessible::SetTextContents(const nsAString &aText)
+NS_IMETHODIMP
+HyperTextAccessible::SetTextContents(const nsAString& aText)
 {
   PRInt32 numChars = CharacterCount();
   if (numChars == 0 || NS_SUCCEEDED(DeleteText(0, numChars))) {
     return InsertText(aText, 0);
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::InsertText(const nsAString &aText, PRInt32 aPosition)
+HyperTextAccessible::InsertText(const nsAString& aText, PRInt32 aPosition)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIEditor> editor = GetEditor();
 
   nsCOMPtr<nsIPlaintextEditor> peditor(do_QueryInterface(editor));
   NS_ENSURE_STATE(peditor);
 
   nsresult rv = SetSelectionRange(aPosition, aPosition);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return peditor->InsertText(aText);
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
+HyperTextAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIEditor> editor = GetEditor();
   NS_ENSURE_STATE(editor);
 
   nsresult rv = SetSelectionRange(aStartPos, aEndPos);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return editor->Copy();
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
+HyperTextAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIEditor> editor = GetEditor();
   NS_ENSURE_STATE(editor);
 
   nsresult rv = SetSelectionRange(aStartPos, aEndPos);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return editor->Cut();
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
+HyperTextAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIEditor> editor = GetEditor();
   NS_ENSURE_STATE(editor);
 
   nsresult rv = SetSelectionRange(aStartPos, aEndPos);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return editor->DeleteSelection(nsIEditor::eNone, nsIEditor::eStrip);
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::PasteText(PRInt32 aPosition)
+HyperTextAccessible::PasteText(PRInt32 aPosition)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIEditor> editor = GetEditor();
   NS_ENSURE_STATE(editor);
 
   nsresult rv = SetSelectionRange(aPosition, aPosition);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return editor->Paste(nsIClipboard::kGlobalClipboard);
 }
 
 already_AddRefed<nsIEditor>
-nsHyperTextAccessible::GetEditor() const
+HyperTextAccessible::GetEditor() const
 {
   if (!mContent->HasFlag(NODE_IS_EDITABLE)) {
     // If we're inside an editable container, then return that container's editor
     Accessible* ancestor = Parent();
     while (ancestor) {
-      nsHyperTextAccessible* hyperText = ancestor->AsHyperText();
+      HyperTextAccessible* hyperText = ancestor->AsHyperText();
       if (hyperText) {
         // Recursion will stop at container doc because it has its own impl
         // of GetEditor()
         return hyperText->GetEditor();
       }
 
       ancestor = ancestor->Parent();
     }
@@ -1523,19 +1534,19 @@ nsHyperTextAccessible::GetEditor() const
   return editor.forget();
 }
 
 /**
   * =================== Caret & Selection ======================
   */
 
 nsresult
-nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
+HyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
 {
-  bool isFocusable = State() & states::FOCUSABLE;
+  bool isFocusable = InteractiveState() & states::FOCUSABLE;
 
   // If accessible is focusable then focus it before setting the selection to
   // neglect control's selection changes on focus if any (for example, inputs
   // that do select all on focus).
   // some input controls
   if (isFocusable)
     TakeFocus();
 
@@ -1576,37 +1587,37 @@ nsHyperTextAccessible::SetSelectionRange
     DOMFocusManager->MoveFocus(window, nsnull, nsIFocusManager::MOVEFOCUS_CARET,
                                nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result));
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHyperTextAccessible::SetCaretOffset(PRInt32 aCaretOffset)
+HyperTextAccessible::SetCaretOffset(PRInt32 aCaretOffset)
 {
   return SetSelectionRange(aCaretOffset, aCaretOffset);
 }
 
 /*
  * Gets the offset position of the caret (cursor).
  */
 NS_IMETHODIMP
-nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
+HyperTextAccessible::GetCaretOffset(PRInt32* aCaretOffset)
 {
   NS_ENSURE_ARG_POINTER(aCaretOffset);
   *aCaretOffset = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   // Not focused focusable accessible except document accessible doesn't have
   // a caret.
   if (!IsDoc() && !FocusMgr()->IsFocused(this) &&
-      (State() & states::FOCUSABLE)) {
+      (InteractiveState() & states::FOCUSABLE)) {
     return NS_OK;
   }
 
   // No caret if the focused node is not inside this DOM node and this DOM node
   // is not inside of focused node.
   FocusManager::FocusDisposition focusDisp =
     FocusMgr()->IsInOrContainsFocus(this);
   if (focusDisp == FocusManager::eNone)
@@ -1642,17 +1653,17 @@ nsHyperTextAccessible::GetCaretOffset(PR
       return NS_OK;
   }
 
   DOMPointToHypertextOffset(focusNode, focusOffset, aCaretOffset);
   return NS_OK;
 }
 
 PRInt32
-nsHyperTextAccessible::CaretLineNumber()
+HyperTextAccessible::CaretLineNumber()
 {
   // Provide the line number for the caret, relative to the
   // currently focused node. Use a 1-based index
   nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
   if (!frameSelection)
     return -1;
 
   nsISelection* domSel =
@@ -1709,25 +1720,25 @@ nsHyperTextAccessible::CaretLineNumber()
     caretFrame = parentFrame;
   }
 
   NS_NOTREACHED("DOM ancestry had this hypertext but frame ancestry didn't");
   return lineNumber;
 }
 
 already_AddRefed<nsFrameSelection>
-nsHyperTextAccessible::FrameSelection()
+HyperTextAccessible::FrameSelection()
 {
   nsIFrame* frame = GetFrame();
   return frame ? frame->GetFrameSelection() : nsnull;
 }
 
 void
-nsHyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
-                                             nsTArray<nsRange*>* aRanges)
+HyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
+                                           nsTArray<nsRange*>* aRanges)
 {
   nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
   if (!frameSelection)
     return;
 
   nsISelection* domSel = frameSelection->GetSelection(aType);
   if (!domSel)
     return;
@@ -1760,35 +1771,35 @@ nsHyperTextAccessible::GetSelectionDOMRa
     }
   }
 }
 
 /*
  * Gets the number of selected regions.
  */
 NS_IMETHODIMP
-nsHyperTextAccessible::GetSelectionCount(PRInt32* aSelectionCount)
+HyperTextAccessible::GetSelectionCount(PRInt32* aSelectionCount)
 {
   NS_ENSURE_ARG_POINTER(aSelectionCount);
   *aSelectionCount = 0;
 
   nsTArray<nsRange*> ranges;
   GetSelectionDOMRanges(nsISelectionController::SELECTION_NORMAL, &ranges);
   *aSelectionCount = PRInt32(ranges.Length());
 
   return NS_OK;
 }
 
 /*
  * Gets the start and end offset of the specified selection.
  */
 NS_IMETHODIMP
-nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum,
-                                          PRInt32* aStartOffset,
-                                          PRInt32* aEndOffset)
+HyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum,
+                                        PRInt32* aStartOffset,
+                                        PRInt32* aEndOffset)
 {
   NS_ENSURE_ARG_POINTER(aStartOffset);
   NS_ENSURE_ARG_POINTER(aEndOffset);
   *aStartOffset = *aEndOffset = 0;
 
   nsTArray<nsRange*> ranges;
   GetSelectionDOMRanges(nsISelectionController::SELECTION_NORMAL, &ranges);
 
@@ -1825,19 +1836,19 @@ nsHyperTextAccessible::GetSelectionBound
   DOMPointToHypertextOffset(endNode, endOffset, aEndOffset, true);
   return NS_OK;
 }
 
 /*
  * Changes the start and end offset of the specified selection.
  */
 NS_IMETHODIMP
-nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
-                                          PRInt32 aStartOffset,
-                                          PRInt32 aEndOffset)
+HyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
+                                        PRInt32 aStartOffset,
+                                        PRInt32 aEndOffset)
 {
   nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
   NS_ENSURE_STATE(frameSelection);
 
   nsCOMPtr<nsISelection> domSel =
     frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
   NS_ENSURE_STATE(domSel);
 
@@ -1882,17 +1893,17 @@ nsHyperTextAccessible::SetSelectionBound
   domSel->AddRange(range);
   return NS_OK;
 }
 
 /*
  * Adds a selection bounded by the specified offsets.
  */
 NS_IMETHODIMP
-nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
+HyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
 {
   nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
   NS_ENSURE_STATE(frameSelection);
 
   nsCOMPtr<nsISelection> domSel =
     frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
   NS_ENSURE_STATE(domSel);
 
@@ -1901,17 +1912,17 @@ nsHyperTextAccessible::AddSelection(PRIn
 
   return SetSelectionBounds(rangeCount, aStartOffset, aEndOffset);
 }
 
 /*
  * Removes the specified selection.
  */
 NS_IMETHODIMP
-nsHyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
+HyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
 {
   nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
   NS_ENSURE_STATE(frameSelection);
 
   nsCOMPtr<nsISelection> domSel =
     frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
   NS_ENSURE_STATE(domSel);
 
@@ -1924,18 +1935,18 @@ nsHyperTextAccessible::RemoveSelection(P
   domSel->GetRangeAt(aSelectionNum, getter_AddRefs(range));
   return domSel->RemoveRange(range);
 }
 
 // void nsIAccessibleText::
 //   scrollSubstringTo(in long startIndex, in long endIndex,
 //                     in unsigned long scrollType);
 NS_IMETHODIMP
-nsHyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
-                                         PRUint32 aScrollType)
+HyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
+                                       PRUint32 aScrollType)
 {
   PRInt32 startOffset, endOffset;
   nsCOMPtr<nsIDOMNode> startNode, endNode;
 
   nsresult rv = HypertextOffsetsToDOMRange(aStartIndex, aEndIndex,
                                            getter_AddRefs(startNode),
                                            &startOffset,
                                            getter_AddRefs(endNode),
@@ -1946,20 +1957,20 @@ nsHyperTextAccessible::ScrollSubstringTo
                                         endNode, endOffset, aScrollType);
 }
 
 // void nsIAccessibleText::
 //   scrollSubstringToPoint(in long startIndex, in long endIndex,
 //                          in unsigned long coordinateType,
 //                          in long x, in long y);
 NS_IMETHODIMP
-nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
-                                              PRInt32 aEndIndex,
-                                              PRUint32 aCoordinateType,
-                                              PRInt32 aX, PRInt32 aY)
+HyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
+                                            PRInt32 aEndIndex,
+                                            PRUint32 aCoordinateType,
+                                            PRInt32 aX, PRInt32 aY)
 {
   nsIFrame *frame = GetFrame();
   if (!frame)
     return NS_ERROR_FAILURE;
 
   nsIntPoint coords;
   nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
                                                   this, &coords);
@@ -2018,17 +2029,17 @@ nsHyperTextAccessible::ScrollSubstringTo
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible public
 
 nsresult
-nsHyperTextAccessible::GetNameInternal(nsAString& aName)
+HyperTextAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = AccessibleWrap::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Get name from title attribute for HTML abbr and acronym elements making it
   // a valid name from markup. Otherwise their name isn't picked up by recursive
   // name computation algorithm. See NS_OK_NAME_FROM_TOOLTIP.
   if (aName.IsEmpty() && IsAbbreviation()) {
@@ -2037,39 +2048,40 @@ nsHyperTextAccessible::GetNameInternal(n
       name.CompressWhitespace();
       aName = name;
     }
   }
   return NS_OK;
 }
 
 void
-nsHyperTextAccessible::InvalidateChildren()
+HyperTextAccessible::InvalidateChildren()
 {
   mOffsets.Clear();
 
   AccessibleWrap::InvalidateChildren();
 }
 
 bool
-nsHyperTextAccessible::RemoveChild(Accessible* aAccessible)
+HyperTextAccessible::RemoveChild(Accessible* aAccessible)
 {
   PRInt32 childIndex = aAccessible->IndexInParent();
   PRInt32 count = mOffsets.Length() - childIndex;
   if (count > 0)
     mOffsets.RemoveElementsAt(childIndex, count);
 
   return Accessible::RemoveChild(aAccessible);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHyperTextAccessible public static
+// HyperTextAccessible public static
 
-nsresult nsHyperTextAccessible::ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
-                                                        PRUint32 *aRenderedOffset)
+nsresult
+HyperTextAccessible::ContentToRenderedOffset(nsIFrame* aFrame, PRInt32 aContentOffset,
+                                             PRUint32* aRenderedOffset)
 {
   if (!aFrame) {
     // Current frame not rendered -- this can happen if text is set on
     // something with display: none
     *aRenderedOffset = 0;
     return NS_OK;
   }
   NS_ASSERTION(aFrame->GetType() == nsGkAtoms::textFrame,
@@ -2087,18 +2099,19 @@ nsresult nsHyperTextAccessible::ContentT
   PRInt32 ourContentStart = iter.GetOriginalOffset();
 
   *aRenderedOffset = iter.ConvertOriginalToSkipped(aContentOffset + ourContentStart) -
                     ourRenderedStart;
 
   return NS_OK;
 }
 
-nsresult nsHyperTextAccessible::RenderedToContentOffset(nsIFrame *aFrame, PRUint32 aRenderedOffset,
-                                                        PRInt32 *aContentOffset)
+nsresult
+HyperTextAccessible::RenderedToContentOffset(nsIFrame* aFrame, PRUint32 aRenderedOffset,
+                                             PRInt32* aContentOffset)
 {
   *aContentOffset = 0;
   NS_ENSURE_TRUE(aFrame, NS_ERROR_FAILURE);
 
   NS_ASSERTION(aFrame->GetType() == nsGkAtoms::textFrame,
                "Need text frame for offset conversion");
   NS_ASSERTION(aFrame->GetPrevContinuation() == nsnull,
                "Call on primary frame only");
@@ -2113,22 +2126,22 @@ nsresult nsHyperTextAccessible::Rendered
   PRInt32 ourContentStart = iter.GetOriginalOffset();
 
   *aContentOffset = iter.ConvertSkippedToOriginal(aRenderedOffset + ourRenderedStart) - ourContentStart;
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHyperTextAccessible public
+// HyperTextAccessible public
 
 bool
-nsHyperTextAccessible::GetCharAt(PRInt32 aOffset, EGetTextType aShift,
-                                 nsAString& aChar, PRInt32* aStartOffset,
-                                 PRInt32* aEndOffset)
+HyperTextAccessible::GetCharAt(PRInt32 aOffset, EGetTextType aShift,
+                               nsAString& aChar, PRInt32* aStartOffset,
+                               PRInt32* aEndOffset)
 {
   aChar.Truncate();
 
   PRInt32 offset = ConvertMagicOffset(aOffset) + static_cast<PRInt32>(aShift);
   PRInt32 childIdx = GetChildIndexAtOffset(offset);
   if (childIdx == -1)
     return false;
 
@@ -2139,18 +2152,18 @@ nsHyperTextAccessible::GetCharAt(PRInt32
     *aStartOffset = offset;
   if (aEndOffset)
     *aEndOffset = aChar.IsEmpty() ? offset : offset + 1;
 
   return true;
 }
 
 PRInt32
-nsHyperTextAccessible::GetChildOffset(PRUint32 aChildIndex,
-                                      bool aInvalidateAfter)
+HyperTextAccessible::GetChildOffset(PRUint32 aChildIndex,
+                                    bool aInvalidateAfter)
 {
   if (aChildIndex == 0) {
     if (aInvalidateAfter)
       mOffsets.Clear();
 
     return aChildIndex;
   }
 
@@ -2170,17 +2183,17 @@ nsHyperTextAccessible::GetChildOffset(PR
     lastOffset += nsAccUtils::TextLength(child);
     mOffsets.AppendElement(lastOffset);
   }
 
   return mOffsets[aChildIndex - 1];
 }
 
 PRInt32
-nsHyperTextAccessible::GetChildIndexAtOffset(PRUint32 aOffset)
+HyperTextAccessible::GetChildIndexAtOffset(PRUint32 aOffset)
 {
   PRUint32 lastOffset = 0;
   PRUint32 offsetCount = mOffsets.Length();
   if (offsetCount > 0) {
     lastOffset = mOffsets[offsetCount - 1];
     if (aOffset < lastOffset) {
       PRUint32 low = 0, high = offsetCount;
       while (high > low) {
@@ -2211,24 +2224,24 @@ nsHyperTextAccessible::GetChildIndexAtOf
 
   if (aOffset == lastOffset)
     return mOffsets.Length() - 1;
 
   return -1;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHyperTextAccessible protected
+// HyperTextAccessible protected
 
 nsresult
-nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
-                                                PRInt32 aOffset,
-                                                Accessible* aAccessible,
-                                                nsIDOMNode** aNode,
-                                                PRInt32* aNodeOffset)
+HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
+                                              PRInt32 aOffset,
+                                              Accessible* 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.
@@ -2263,22 +2276,22 @@ nsHyperTextAccessible::GetDOMPointByFram
     *aNodeOffset = parent->IndexOf(content);
     node = do_QueryInterface(parent);
   }
 
   NS_IF_ADDREF(*aNode = node);
   return NS_OK;
 }
 
-// nsHyperTextAccessible
+// HyperTextAccessible
 nsresult
-nsHyperTextAccessible::RangeBoundToHypertextOffset(nsRange *aRange,
-                                                   bool aIsStartBound,
-                                                   bool aIsStartHTOffset,
-                                                   PRInt32 *aHTOffset)
+HyperTextAccessible::RangeBoundToHypertextOffset(nsRange* aRange,
+                                                 bool aIsStartBound,
+                                                 bool aIsStartHTOffset,
+                                                 PRInt32* aHTOffset)
 {
   nsINode* node = nsnull;
   PRInt32 nodeOffset = 0;
 
   if (aIsStartBound) {
     node = aRange->GetStartParent();
     nodeOffset = aRange->StartOffset();
   } else {
@@ -2290,23 +2303,23 @@ nsHyperTextAccessible::RangeBoundToHyper
     DOMPointToHypertextOffset(node, nodeOffset, aHTOffset);
 
   if (aIsStartHTOffset && !startAcc)
     *aHTOffset = 0;
 
   return NS_OK;
 }
 
-// nsHyperTextAccessible
+// HyperTextAccessible
 nsresult
-nsHyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
-                                             PRInt32 aNodeOffset,
-                                             PRInt32 *aHTStartOffset,
-                                             PRInt32 *aHTEndOffset,
-                                             nsIPersistentProperties *aAttributes)
+HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
+                                           PRInt32 aNodeOffset,
+                                           PRInt32* aHTStartOffset,
+                                           PRInt32* aHTEndOffset,
+                                           nsIPersistentProperties* aAttributes)
 {
   nsTArray<nsRange*> ranges;
   GetSelectionDOMRanges(nsISelectionController::SELECTION_SPELLCHECK, &ranges);
 
   PRUint32 rangeCount = ranges.Length();
   if (!rangeCount)
     return NS_OK;
 
@@ -2367,17 +2380,17 @@ nsHyperTextAccessible::GetSpellTextAttri
       return NS_OK;
     }
   }
 
   return NS_OK;
 }
 
 bool 
-nsHyperTextAccessible::IsTextRole()
+HyperTextAccessible::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;
rename from accessible/src/html/nsHyperTextAccessible.h
rename to accessible/src/generic/HyperTextAccessible.h
--- a/accessible/src/html/nsHyperTextAccessible.h
+++ b/accessible/src/generic/HyperTextAccessible.h
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 _nsHyperTextAccessible_H_
-#define _nsHyperTextAccessible_H_
+#ifndef mozilla_a11y_HyperTextAccessible_h__
+#define mozilla_a11y_HyperTextAccessible_h__
 
 #include "nsIAccessibleText.h"
 #include "nsIAccessibleHyperText.h"
 #include "nsIAccessibleEditableText.h"
 
 #include "AccCollector.h"
 #include "AccessibleWrap.h"
 
@@ -30,24 +30,24 @@ const PRUnichar kForcedNewLineChar = '\n
   0x224f,                                               \
   0x4839,                                               \
   { 0xa9, 0x2e, 0x95, 0x23, 0x97, 0x05, 0xf3, 0x0b }    \
 }
 
 /**
   * Special Accessible that knows how contain both text and embedded objects
   */
-class nsHyperTextAccessible : public AccessibleWrap,
-                              public nsIAccessibleText,
-                              public nsIAccessibleHyperText,
-                              public nsIAccessibleEditableText
+class HyperTextAccessible : public AccessibleWrap,
+                            public nsIAccessibleText,
+                            public nsIAccessibleHyperText,
+                            public nsIAccessibleEditableText
 {
 public:
-  nsHyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~nsHyperTextAccessible() { }
+  HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
+  virtual ~HyperTextAccessible() { }
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLETEXT
   NS_DECL_NSIACCESSIBLEHYPERTEXT
   NS_DECL_NSIACCESSIBLEEDITABLETEXT
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_HYPERTEXTACCESSIBLE_IMPL_CID)
 
   // Accessible
@@ -55,17 +55,17 @@ public:
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   virtual void InvalidateChildren();
   virtual bool RemoveChild(Accessible* aAccessible);
 
-  // nsHyperTextAccessible (static helper method)
+  // HyperTextAccessible (static helper method)
 
   // Convert content offset to rendered text offset  
   static nsresult ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
                                           PRUint32 *aRenderedOffset);
   
   // Convert rendered text offset to content offset
   static nsresult RenderedToContentOffset(nsIFrame *aFrame, PRUint32 aRenderedOffset,
                                           PRInt32 *aContentOffset);
@@ -102,41 +102,41 @@ public:
    */
   PRInt32 GetLinkIndexAtOffset(PRUint32 aOffset)
   {
     Accessible* child = GetChildAtOffset(aOffset);
     return child ? GetLinkIndex(child) : -1;
   }
 
   //////////////////////////////////////////////////////////////////////////////
-  // nsHyperTextAccessible: DOM point to text offset conversions.
+  // HyperTextAccessible: DOM point to text offset conversions.
 
   /**
     * Turn a DOM Node and offset into a character offset into this hypertext.
     * Will look for closest match when the DOM node does not have an accessible
     * object associated with it. Will return an offset for the end of
     * the string if the node is not found.
     *
     * @param aNode - the node to look for
     * @param aNodeOffset - the offset to look for
     *                      if -1 just look directly for the node
     *                      if >=0 and aNode is text, this represents a char offset
     *                      if >=0 and aNode is not text, this represents a child node offset
     * @param aResultOffset - the character offset into the current
-    *                        nsHyperTextAccessible
+    *                        HyperTextAccessible
     * @param aIsEndOffset - if true, then then this offset is not inclusive. The character
     *                       indicated by the offset returned is at [offset - 1]. This means
     *                       if the passed-in offset is really in a descendant, then the offset returned
     *                       will come just after the relevant embedded object characer.
     *                       If false, then the offset is inclusive. The character indicated
     *                       by the offset returned is at [offset]. If the passed-in offset in inside a
     *                       descendant, then the returned offset will be on the relevant embedded object char.
     *
     * @return               the accessible child which contained the offset, if
-    *                       it is within the current nsHyperTextAccessible,
+    *                       it is within the current HyperTextAccessible,
     *                       otherwise nsnull
     */
   Accessible* DOMPointToHypertextOffset(nsINode *aNode,
                                         PRInt32 aNodeOffset,
                                         PRInt32* aHypertextOffset,
                                         bool aIsEndOffset = false);
 
   /**
@@ -256,17 +256,17 @@ public:
   // EditableTextAccessible
 
   /**
    * Return the editor associated with the accessible.
    */
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
 protected:
-  // nsHyperTextAccessible
+  // HyperTextAccessible
 
   /**
    * Transform magic offset into text offset.
    */
   PRInt32 ConvertMagicOffset(PRInt32 aOffset)
   {
     if (aOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT)
       return CharacterCount();
@@ -405,24 +405,24 @@ protected:
 
 private:
   /**
    * End text offsets array.
    */
   nsTArray<PRUint32> mOffsets;
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(nsHyperTextAccessible,
+NS_DEFINE_STATIC_IID_ACCESSOR(HyperTextAccessible,
                               NS_HYPERTEXTACCESSIBLE_IMPL_CID)
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
-inline nsHyperTextAccessible*
+inline HyperTextAccessible*
 Accessible::AsHyperText()
 {
   return mFlags & eHyperTextAccessible ?
-    static_cast<nsHyperTextAccessible*>(this) : nsnull;
+    static_cast<HyperTextAccessible*>(this) : nsnull;
 }
 
-#endif  // _nsHyperTextAccessible_H_
+#endif
 
rename from accessible/src/html/nsHTMLImageAccessible.cpp
rename to accessible/src/generic/ImageAccessible.cpp
--- a/accessible/src/html/nsHTMLImageAccessible.cpp
+++ b/accessible/src/generic/ImageAccessible.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "nsHTMLImageAccessible.h"
+#include "ImageAccessible.h"
 
 #include "nsAccUtils.h"
 #include "Role.h"
 #include "AccIterator.h"
 #include "States.h"
 
 #include "imgIContainer.h"
 #include "imgIRequest.h"
@@ -20,34 +20,34 @@
 #include "nsIServiceManager.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIDOMDocument.h"
 #include "nsPIDOMWindow.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLImageAccessible
+// ImageAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLImageAccessible::
-  nsHTMLImageAccessible(nsIContent* aContent, DocAccessible* aDoc) :
+ImageAccessible::
+  ImageAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   nsLinkableAccessible(aContent, aDoc)
 {
   mFlags |= eImageAccessible;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageAccessible, Accessible,
+NS_IMPL_ISUPPORTS_INHERITED1(ImageAccessible, Accessible,
                              nsIAccessibleImage)
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible public
 
 PRUint64
-nsHTMLImageAccessible::NativeState()
+ImageAccessible::NativeState()
 {
   // The state is a bitfield, get our inherited state, then logically OR it with
   // states::ANIMATED if this is an animated image.
 
   PRUint64 state = nsLinkableAccessible::NativeState();
 
   nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mContent));
   nsCOMPtr<imgIRequest> imageRequest;
@@ -66,17 +66,17 @@ nsHTMLImageAccessible::NativeState()
     if (animated)
       state |= states::ANIMATED;
   }
 
   return state;
 }
 
 nsresult
-nsHTMLImageAccessible::GetNameInternal(nsAString& aName)
+ImageAccessible::GetNameInternal(nsAString& aName)
 {
   bool hasAltAttrib =
     mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
   if (!aName.IsEmpty())
     return NS_OK;
 
   nsresult rv = Accessible::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -88,48 +88,48 @@ nsHTMLImageAccessible::GetNameInternal(n
     // nsIAccessible::name attribute for details).
     return NS_OK_EMPTY_NAME;
   }
 
   return NS_OK;
 }
 
 role
-nsHTMLImageAccessible::NativeRole()
+ImageAccessible::NativeRole()
 {
   return roles::GRAPHIC;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 PRUint8
-nsHTMLImageAccessible::ActionCount()
+ImageAccessible::ActionCount()
 {
   PRUint8 actionCount = nsLinkableAccessible::ActionCount();
   return HasLongDesc() ? actionCount + 1 : actionCount;
 }
 
 NS_IMETHODIMP
-nsHTMLImageAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
+ImageAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   aName.Truncate();
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   if (IsLongDescIndex(aIndex) && HasLongDesc()) {
     aName.AssignLiteral("showlongdesc"); 
     return NS_OK;
   }
   return nsLinkableAccessible::GetActionName(aIndex, aName);
 }
 
 NS_IMETHODIMP
-nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
+ImageAccessible::DoAction(PRUint8 aIndex)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   // Get the long description uri and open in a new window.
   if (!IsLongDescIndex(aIndex))
     return nsLinkableAccessible::DoAction(aIndex);
 
@@ -144,67 +144,65 @@ nsHTMLImageAccessible::DoAction(PRUint8 
   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)
+ImageAccessible::GetImagePosition(PRUint32 aCoordType, PRInt32* aX, PRInt32* aY)
 {
   PRInt32 width, height;
   nsresult rv = GetBounds(aX, aY, &width, &height);
   if (NS_FAILED(rv))
     return rv;
 
   return nsAccUtils::ConvertScreenCoordsTo(aX, aY, aCoordType, this);
 }
 
 NS_IMETHODIMP
-nsHTMLImageAccessible::GetImageSize(PRInt32 *aWidth, PRInt32 *aHeight)
+ImageAccessible::GetImageSize(PRInt32* aWidth, PRInt32* aHeight)
 {
   PRInt32 x, y;
   return GetBounds(&x, &y, aWidth, aHeight);
 }
 
 // Accessible
 nsresult
-nsHTMLImageAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
+ImageAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
-  
+
   nsresult rv = nsLinkableAccessible::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoString src;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src);
   if (!src.IsEmpty())
     nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::src, src);
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Private methods
 
 already_AddRefed<nsIURI>
-nsHTMLImageAccessible::GetLongDescURI() const
+ImageAccessible::GetLongDescURI() const
 {
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc)) {
-    nsGenericHTMLElement* element = 
+    nsGenericHTMLElement* element =
       nsGenericHTMLElement::FromContent(mContent);
     if (element) {
       nsCOMPtr<nsIURI> uri;
       element->GetURIAttr(nsGkAtoms::longdesc, nsnull, getter_AddRefs(uri));
       return uri.forget();
     }
   }
 
@@ -223,13 +221,13 @@ nsHTMLImageAccessible::GetLongDescURI() 
       }
     }
   }
 
   return nsnull;
 }
 
 bool
-nsHTMLImageAccessible::IsLongDescIndex(PRUint8 aIndex)
+ImageAccessible::IsLongDescIndex(PRUint8 aIndex)
 {
   return aIndex == nsLinkableAccessible::ActionCount();
 }
 
rename from accessible/src/html/nsHTMLImageAccessible.h
rename to accessible/src/generic/ImageAccessible.h
--- a/accessible/src/html/nsHTMLImageAccessible.h
+++ b/accessible/src/generic/ImageAccessible.h
@@ -1,45 +1,48 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 _nsHTMLImageAccessible_H_
-#define _nsHTMLImageAccessible_H_
+#ifndef mozilla_a11y_ImageAccessible_h__
+#define mozilla_a11y_ImageAccessible_h__
 
 #include "nsBaseWidgetAccessible.h"
 #include "nsIAccessibleImage.h"
 
 class nsGenericHTMLElement;
 
+namespace mozilla {
+namespace a11y {
+
 /* Accessible for supporting images
  * supports:
  * - gets name, role
  * - support basic state
  */
-class nsHTMLImageAccessible : public nsLinkableAccessible,
-                              public nsIAccessibleImage
+class ImageAccessible : public nsLinkableAccessible,
+                        public nsIAccessibleImage
 {
 public:
-  nsHTMLImageAccessible(nsIContent* aContent, DocAccessible* aDoc);
+  ImageAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleImage
   NS_DECL_NSIACCESSIBLEIMAGE
 
   // Accessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual mozilla::a11y::role NativeRole();
+  virtual a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 private:
   /**
@@ -66,20 +69,23 @@ private:
    * @param aIndex  The 0-based index to be tested.
    *
    * @returns  true if index is valid for longdesc action.
    */
   inline bool IsLongDescIndex(PRUint8 aIndex);
 
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
-inline nsHTMLImageAccessible*
+inline mozilla::a11y::ImageAccessible*
 Accessible::AsImage()
 {
   return IsImage() ?
-    static_cast<nsHTMLImageAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::ImageAccessible*>(this) : nsnull;
 }
 
 #endif
 
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -15,36 +15,41 @@ LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   Accessible.cpp \
   ApplicationAccessible.cpp \
   ARIAGridAccessible.cpp \
   DocAccessible.cpp \
   FormControlAccessible.cpp \
+  HyperTextAccessible.cpp \
+  ImageAccessible.cpp \
   OuterDocAccessible.cpp \
   RootAccessible.cpp \
   TextLeafAccessible.cpp \
   $(NULL)
+
 EXPORTS_NAMESPACES = mozilla/a11y
 
 EXPORTS_mozilla/a11y = \
   Accessible.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)/../xpcom \
   -I$(srcdir)/../base \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xul \
+  -I$(srcdir)/../../../content/base/src \
+  -I$(srcdir)/../../../content/html/content/src \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/xul/base/src \
   $(NULL)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
   $(NULL)
--- a/accessible/src/generic/OuterDocAccessible.cpp
+++ b/accessible/src/generic/OuterDocAccessible.cpp
@@ -119,28 +119,26 @@ OuterDocAccessible::DoAction(PRUint8 aIn
 void
 OuterDocAccessible::Shutdown()
 {
   // XXX: sometimes outerdoc accessible is shutdown because of layout style
   // change however the presshell of underlying document isn't destroyed and
   // the document doesn't get pagehide events. Shutdown underlying document if
   // any to avoid hanging document accessible.
 #ifdef DEBUG
-  if (logging::IsEnabled(logging::eDocDestroy)) {
-    logging::Msg("A11y outerdoc shutdown");
-    logging::Address("outerdoc", this);
-  }
+  if (logging::IsEnabled(logging::eDocDestroy))
+    logging::OuterDocDestroy(this);
 #endif
 
   Accessible* childAcc = mChildren.SafeElementAt(0, nsnull);
   if (childAcc) {
 #ifdef DEBUG
     if (logging::IsEnabled(logging::eDocDestroy)) {
       logging::DocDestroy("outerdoc's child document shutdown",
-                      childAcc->GetDocumentNode());
+                          childAcc->GetDocumentNode());
     }
 #endif
     childAcc->Shutdown();
   }
 
   AccessibleWrap::Shutdown();
 }
 
@@ -174,17 +172,17 @@ OuterDocAccessible::AppendChild(Accessib
     mChildren[0]->Shutdown();
 
   if (!AccessibleWrap::AppendChild(aAccessible))
     return false;
 
 #ifdef DEBUG
   if (logging::IsEnabled(logging::eDocCreate)) {
     logging::DocCreate("append document to outerdoc",
-                   aAccessible->GetDocumentNode());
+                       aAccessible->GetDocumentNode());
     logging::Address("outerdoc", this);
   }
 #endif
 
   return true;
 }
 
 bool
@@ -194,17 +192,17 @@ OuterDocAccessible::RemoveChild(Accessib
   if (child != aAccessible) {
     NS_ERROR("Wrong child to remove!");
     return false;
   }
 
 #ifdef DEBUG
   if (logging::IsEnabled(logging::eDocDestroy)) {
     logging::DocDestroy("remove document from outerdoc", child->GetDocumentNode(),
-                    child->AsDoc());
+                        child->AsDoc());
     logging::Address("outerdoc", this);
   }
 #endif
 
   bool wasRemoved = AccessibleWrap::RemoveChild(child);
 
   NS_ASSERTION(!mChildren.Length(),
                "This child document of outerdoc accessible wasn't removed!");
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -6,16 +6,17 @@
 #include "RootAccessible.h"
 
 #include "mozilla/Util.h"
 
 #define CreateEvent CreateEventA
 #include "nsIDOMDocument.h"
 
 #include "Accessible-inl.h"
+#include "DocAccessible-inl.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
 #include "mozilla/dom/Element.h"
@@ -267,34 +268,25 @@ RootAccessible::HandleEvent(nsIDOMEvent*
   nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
   if (!origTargetNode)
     return NS_OK;
 
   DocAccessible* document =
     GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
 
   if (document) {
-#ifdef DEBUG_NOTIFICATIONS
-    if (origTargetNode->IsElement()) {
-      nsIContent* elm = origTargetNode->AsElement();
-
-      nsAutoString tag;
-      elm->Tag()->ToString(tag);
-
-      nsIAtom* atomid = elm->GetID();
-      nsCAutoString id;
-      if (atomid)
-        atomid->ToUTF8String(id);
-
+#ifdef DEBUG
+    if (logging::IsEnabled(logging::eDOMEvents)) {
       nsAutoString eventType;
       aDOMEvent->GetType(eventType);
 
-      printf("\nPend DOM event processing for %s@id='%s', type: %s\n\n",
-             NS_ConvertUTF16toUTF8(tag).get(), id.get(),
-             NS_ConvertUTF16toUTF8(eventType).get());
+      logging::MsgBegin("DOMEvents", "event '%s' handled",
+                        NS_ConvertUTF16toUTF8(eventType).get());
+      logging::Node("target", origTargetNode);
+      logging::MsgEnd();
     }
 #endif
 
     // Root accessible exists longer than any of its descendant documents so
     // that we are guaranteed notification is processed before root accessible
     // is destroyed.
     document->HandleNotification<RootAccessible, nsIDOMEvent>
       (this, &RootAccessible::ProcessDOMEvent, aDOMEvent);
rename from accessible/src/html/nsHTMLTextAccessible.cpp
rename to accessible/src/html/HTMLElementAccessibles.cpp
--- a/accessible/src/html/nsHTMLTextAccessible.cpp
+++ b/accessible/src/html/HTMLElementAccessibles.cpp
@@ -1,127 +1,102 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "nsHTMLTextAccessible.h"
+#include "HTMLElementAccessibles.h"
 
 #include "DocAccessible.h"
 #include "nsAccUtils.h"
 #include "nsIAccessibleRelation.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLHRAccessible
+// HTMLHRAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLHRAccessible::
-  nsHTMLHRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsLeafAccessible(aContent, aDoc)
-{
-}
-
 role
-nsHTMLHRAccessible::NativeRole()
+HTMLHRAccessible::NativeRole()
 {
   return roles::SEPARATOR;
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLBRAccessible
+// HTMLBRAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLBRAccessible::
-  nsHTMLBRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsLeafAccessible(aContent, aDoc)
-{
-}
-
 role
-nsHTMLBRAccessible::NativeRole()
+HTMLBRAccessible::NativeRole()
 {
   return roles::WHITESPACE;
 }
 
 PRUint64
-nsHTMLBRAccessible::NativeState()
+HTMLBRAccessible::NativeState()
 {
   return states::READONLY;
 }
 
 nsresult
-nsHTMLBRAccessible::GetNameInternal(nsAString& aName)
+HTMLBRAccessible::GetNameInternal(nsAString& aName)
 {
   aName = static_cast<PRUnichar>('\n');    // Newline char
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsHTMLLabelAccessible
+// HTMLLabelAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLLabelAccessible::
-  nsHTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
-{
-}
-
-NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(HTMLLabelAccessible, HyperTextAccessible)
 
 nsresult
-nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
+HTMLLabelAccessible::GetNameInternal(nsAString& aName)
 {
   return nsTextEquivUtils::GetNameFromSubtree(this, aName);
 }
 
 role
-nsHTMLLabelAccessible::NativeRole()
+HTMLLabelAccessible::NativeRole()
 {
   return roles::LABEL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLOuputAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-nsHTMLOutputAccessible::
-  nsHTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
-{
-}
-
-NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLOutputAccessible, nsHyperTextAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(HTMLOutputAccessible, HyperTextAccessible)
 
 Relation
-nsHTMLOutputAccessible::RelationByType(PRUint32 aType)
+HTMLOutputAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = AccessibleWrap::RelationByType(aType);
   if (aType == nsIAccessibleRelation::RELATION_CONTROLLED_BY)
     rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::_for));
 
   return rel;
 }
 
 role
-nsHTMLOutputAccessible::NativeRole()
+HTMLOutputAccessible::NativeRole()
 {
   return roles::SECTION;
 }
 
 nsresult
-nsHTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
+HTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
   nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::live,
                          NS_LITERAL_STRING("polite"));
-  
+
   return NS_OK;
 }
 
rename from accessible/src/html/nsHTMLTextAccessible.h
rename to accessible/src/html/HTMLElementAccessibles.h
--- a/accessible/src/html/nsHTMLTextAccessible.h
+++ b/accessible/src/html/HTMLElementAccessibles.h
@@ -1,69 +1,83 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 _nsHTMLTextAccessible_H_
-#define _nsHTMLTextAccessible_H_
+#ifndef mozilla_a11y_HTMLElementAccessibles_h__
+#define mozilla_a11y_HTMLElementAccessibles_h__
 
 #include "nsAutoPtr.h"
 #include "nsBaseWidgetAccessible.h"
 
+namespace mozilla {
+namespace a11y {
+
 /**
  * Used for HTML hr element.
  */
-class nsHTMLHRAccessible : public nsLeafAccessible
+class HTMLHRAccessible : public nsLeafAccessible
 {
 public:
-  nsHTMLHRAccessible(nsIContent* aContent, DocAccessible* aDoc);
+
+  HTMLHRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
+    nsLeafAccessible(aContent, aDoc) {};
 
   // Accessible
-  virtual mozilla::a11y::role NativeRole();
+  virtual a11y::role NativeRole();
 };
 
 /**
  * Used for HTML br element.
  */
-class nsHTMLBRAccessible : public nsLeafAccessible
+class HTMLBRAccessible : public nsLeafAccessible
 {
 public:
-  nsHTMLBRAccessible(nsIContent* aContent, DocAccessible* aDoc);
+
+  HTMLBRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
+    nsLeafAccessible(aContent, aDoc) {};
 
   // Accessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual mozilla::a11y::role NativeRole();
+  virtual a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 /**
  * Used for HTML label element.
  */
-class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
+class HTMLLabelAccessible : public HyperTextAccessibleWrap
 {
 public:
-  nsHTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc);
+
+  HTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc) :
+    HyperTextAccessibleWrap(aContent, aDoc) {};
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual mozilla::a11y::role NativeRole();
+  virtual a11y::role NativeRole();
 };
 
 /**
  * Used for HTML output element.
  */
-class nsHTMLOutputAccessible : public nsHyperTextAccessibleWrap
+class HTMLOutputAccessible : public HyperTextAccessibleWrap
 {
 public:
-  nsHTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc);
+
+  HTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
+    HyperTextAccessibleWrap(aContent, aDoc) {};
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual mozilla::a11y::role NativeRole();
+  virtual a11y::role NativeRole();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
   virtual Relation RelationByType(PRUint32 aType);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/html/HTMLFormControlAccessible.cpp
+++ b/accessible/src/html/HTMLFormControlAccessible.cpp
@@ -199,17 +199,17 @@ HTMLRadioButtonAccessible::GetPositionAn
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLButtonAccessible::
   HTMLButtonAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 PRUint8
 HTMLButtonAccessible::ActionCount()
 {
   return 1;
 }
@@ -232,17 +232,17 @@ HTMLButtonAccessible::DoAction(PRUint8 a
 
   DoCommand();
   return NS_OK;
 }
 
 PRUint64
 HTMLButtonAccessible::State()
 {
-  PRUint64 state = nsHyperTextAccessibleWrap::State();
+  PRUint64 state = HyperTextAccessibleWrap::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.
   if (mParent && mParent->IsHTMLFileInput()) {
     PRUint64 parentState = mParent->State();
@@ -251,17 +251,17 @@ HTMLButtonAccessible::State()
   }
 
   return state;
 }
 
 PRUint64
 HTMLButtonAccessible::NativeState()
 {
-  PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
+  PRUint64 state = HyperTextAccessibleWrap::NativeState();
 
   nsEventStates elmState = mContent->AsElement()->State();
   if (elmState.HasState(NS_EVENT_STATE_DEFAULT))
     state |= states::DEFAULT;
 
   return state;
 }
 
@@ -315,23 +315,23 @@ HTMLButtonAccessible::IsWidget() const
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTextFieldAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLTextFieldAccessible::
   HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(HTMLTextFieldAccessible,
                              Accessible,
-                             nsHyperTextAccessible,
+                             HyperTextAccessible,
                              nsIAccessibleText,
                              nsIAccessibleEditableText)
 
 role
 HTMLTextFieldAccessible::NativeRole()
 {
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::password, eIgnoreCase)) {
@@ -388,25 +388,25 @@ HTMLTextFieldAccessible::Value(nsString&
   if (inputElement) {
     inputElement->GetValue(aValue);
   }
 }
 
 void
 HTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState) const
 {
-  nsHyperTextAccessibleWrap::ApplyARIAState(aState);
+  HyperTextAccessibleWrap::ApplyARIAState(aState);
 
   aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
 }
 
 PRUint64
 HTMLTextFieldAccessible::State()
 {
-  PRUint64 state = nsHyperTextAccessibleWrap::State();
+  PRUint64 state = HyperTextAccessibleWrap::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.
   if (mParent && mParent->IsHTMLFileInput()) {
     PRUint64 parentState = mParent->State();
@@ -415,17 +415,17 @@ HTMLTextFieldAccessible::State()
   }
 
   return state;
 }
 
 PRUint64
 HTMLTextFieldAccessible::NativeState()
 {
-  PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
+  PRUint64 state = HyperTextAccessibleWrap::NativeState();
 
   // can be focusable, focused, protected. readonly, unavailable, selected
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::password, eIgnoreCase)) {
     state |= states::PROTECTED;
   }
 
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
@@ -552,33 +552,33 @@ HTMLTextFieldAccessible::ContainerWidget
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLFileInputAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLFileInputAccessible::
 HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
   mFlags |= eHTMLFileInputAccessible;
 }
 
 role
 HTMLFileInputAccessible::NativeRole()
 {
   // JAWS wants a text container, others don't mind. No specific role in
   // AT APIs.
   return roles::TEXT_CONTAINER;
 }
 
 nsresult
 HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
 {
-  nsresult rv = nsHyperTextAccessibleWrap::HandleAccEvent(aEvent);
+  nsresult rv = HyperTextAccessibleWrap::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);
   if (event &&
       (event->GetState() == states::BUSY ||
@@ -607,17 +607,17 @@ HTMLFileInputAccessible::HandleAccEvent(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLGroupboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLGroupboxAccessible::
   HTMLGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 role
 HTMLGroupboxAccessible::NativeRole()
 {
   return roles::GROUPING;
 }
@@ -653,38 +653,38 @@ HTMLGroupboxAccessible::GetNameInternal(
   }
 
   return NS_OK;
 }
 
 Relation
 HTMLGroupboxAccessible::RelationByType(PRUint32 aType)
 {
-  Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
+  Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
     // No override for label, so use <legend> for this <fieldset>
   if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
     rel.AppendTarget(mDoc, GetLegend());
 
   return rel;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLegendAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLLegendAccessible::
   HTMLLegendAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 Relation
 HTMLLegendAccessible::RelationByType(PRUint32 aType)
 {
-  Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
+  Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
     return rel;
 
   Accessible* groupbox = Parent();
   if (groupbox && groupbox->Role() == roles::GROUPING)
     rel.AppendTarget(groupbox);
 
   return rel;
@@ -697,24 +697,24 @@ HTMLLegendAccessible::NativeRole()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLFigureAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLFigureAccessible::
   HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 nsresult
 HTMLFigureAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
-  nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
+  nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expose figure xml-role.
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
                          NS_LITERAL_STRING("figure"));
   return NS_OK;
 }
 
@@ -722,17 +722,17 @@ role
 HTMLFigureAccessible::NativeRole()
 {
   return roles::FIGURE;
 }
 
 nsresult
 HTMLFigureAccessible::GetNameInternal(nsAString& aName)
 {
-  nsresult rv = nsHyperTextAccessibleWrap::GetNameInternal(aName);
+  nsresult rv = HyperTextAccessibleWrap::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aName.IsEmpty())
     return NS_OK;
 
   nsIContent* captionContent = Caption();
   if (captionContent) {
     return nsTextEquivUtils::
@@ -740,17 +740,17 @@ HTMLFigureAccessible::GetNameInternal(ns
   }
 
   return NS_OK;
 }
 
 Relation
 HTMLFigureAccessible::RelationByType(PRUint32 aType)
 {
-  Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
+  Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
   if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
     rel.AppendTarget(mDoc, Caption());
 
   return rel;
 }
 
 nsIContent*
 HTMLFigureAccessible::Caption() const
@@ -767,30 +767,30 @@ HTMLFigureAccessible::Caption() const
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLFigcaptionAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLFigcaptionAccessible::
   HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 role
 HTMLFigcaptionAccessible::NativeRole()
 {
   return roles::CAPTION;
 }
 
 Relation
 HTMLFigcaptionAccessible::RelationByType(PRUint32 aType)
 {
-  Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
+  Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
     return rel;
 
   Accessible* figure = Parent();
   if (figure &&
       figure->GetContent()->NodeInfo()->Equals(nsGkAtoms::figure,
                                                mContent->GetNameSpaceID())) {
     rel.AppendTarget(figure);
--- a/accessible/src/html/HTMLFormControlAccessible.h
+++ b/accessible/src/html/HTMLFormControlAccessible.h
@@ -2,17 +2,17 @@
 /* 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_HTMLFormControlAccessible_H_
 #define MOZILLA_A11Y_HTMLFormControlAccessible_H_
 
 #include "FormControlAccessible.h"
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 
 namespace mozilla {
 namespace a11y {
 
 /**
  * Accessible for HTML progress element.
  */
 typedef ProgressMeterAccessible<1> HTMLProgressMeterAccessible;
@@ -59,17 +59,17 @@ public:
                                           PRInt32 *aSetSize);
 };
 
 
 /**
  * Accessible for HTML input@type="button", @type="submit", @type="image"
  * and HTML button elements.
  */
-class HTMLButtonAccessible : public nsHyperTextAccessibleWrap
+class HTMLButtonAccessible : public HyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
 
   HTMLButtonAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsIAccessible
@@ -88,31 +88,31 @@ public:
   // Widgets
   virtual bool IsWidget() const;
 };
 
 
 /**
  * Accessible for HTML input@type="text" element.
  */
-class HTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
+class HTMLTextFieldAccessible : public HyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
 
   HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
-  // nsHyperTextAccessible
+  // HyperTextAccessible
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
   // Accessible
   virtual void Value(nsString& aValue);
   virtual void ApplyARIAState(PRUint64* aState) const;
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 State();
@@ -125,30 +125,30 @@ public:
   virtual bool IsWidget() const;
   virtual Accessible* ContainerWidget() const;
 };
 
 
 /**
  * Accessible for input@type="file" element.
  */
-class HTMLFileInputAccessible : public nsHyperTextAccessibleWrap
+class HTMLFileInputAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
   virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
 };
 
 /**
  * Accessible for HTML fieldset element.
  */
-class HTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
+class HTMLGroupboxAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
@@ -156,30 +156,30 @@ public:
 protected:
   nsIContent* GetLegend();
 };
 
 
 /**
  * Accessible for HTML legend element.
  */
-class HTMLLegendAccessible : public nsHyperTextAccessibleWrap
+class HTMLLegendAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLLegendAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 };
 
 /**
  * Accessible for HTML5 figure element.
  */
-class HTMLFigureAccessible : public nsHyperTextAccessibleWrap
+class HTMLFigureAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
@@ -188,17 +188,17 @@ public:
 protected:
   nsIContent* Caption() const;
 };
 
 
 /**
  * Accessible for HTML5 figcaption element.
  */
-class HTMLFigcaptionAccessible : public nsHyperTextAccessibleWrap
+class HTMLFigcaptionAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 };
--- a/accessible/src/html/HTMLListAccessible.cpp
+++ b/accessible/src/html/HTMLListAccessible.cpp
@@ -15,75 +15,75 @@
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLListAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLListAccessible, nsHyperTextAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(HTMLListAccessible, HyperTextAccessible)
 
 role
 HTMLListAccessible::NativeRole()
 {
   if (mContent->Tag() == nsGkAtoms::dl)
     return roles::DEFINITION_LIST;
 
   return roles::LIST;
 }
 
 PRUint64
 HTMLListAccessible::NativeState()
 {
-  return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
+  return HyperTextAccessibleWrap::NativeState() | states::READONLY;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLIAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLLIAccessible::
   HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc), mBullet(nsnull)
+  HyperTextAccessibleWrap(aContent, aDoc), mBullet(nsnull)
 {
   mFlags |= eHTMLListItemAccessible;
 
   nsBlockFrame* blockFrame = do_QueryFrame(GetFrame());
   if (blockFrame && blockFrame->HasBullet()) {
     mBullet = new HTMLListBulletAccessible(mContent, mDoc);
     if (!Document()->BindToDocument(mBullet, nsnull))
       mBullet = nsnull;
   }
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLLIAccessible, nsHyperTextAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(HTMLLIAccessible, HyperTextAccessible)
 
 void
 HTMLLIAccessible::Shutdown()
 {
   mBullet = nsnull;
 
-  nsHyperTextAccessibleWrap::Shutdown();
+  HyperTextAccessibleWrap::Shutdown();
 }
 
 role
 HTMLLIAccessible::NativeRole()
 {
   if (mContent->Tag() == nsGkAtoms::dt)
     return roles::TERM;
 
   return roles::LISTITEM;
 }
 
 PRUint64
 HTMLLIAccessible::NativeState()
 {
-  return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
+  return HyperTextAccessibleWrap::NativeState() | states::READONLY;
 }
 
 NS_IMETHODIMP
 HTMLLIAccessible::GetBounds(PRInt32* aX, PRInt32* aY,
                             PRInt32* aWidth, PRInt32* aHeight)
 {
   nsresult rv = AccessibleWrap::GetBounds(aX, aY, aWidth, aHeight);
   if (NS_FAILED(rv) || !mBullet || mBullet->IsInside())
@@ -183,21 +183,17 @@ role
 HTMLListBulletAccessible::NativeRole()
 {
   return roles::STATICTEXT;
 }
 
 PRUint64
 HTMLListBulletAccessible::NativeState()
 {
-  PRUint64 state = nsLeafAccessible::NativeState();
-
-  state &= ~states::FOCUSABLE;
-  state |= states::READONLY;
-  return state;
+  return nsLeafAccessible::NativeState() | states::READONLY;
 }
 
 void
 HTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
                                        PRUint32 aLength)
 {
   nsAutoString bulletText;
   nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
--- a/accessible/src/html/HTMLListAccessible.h
+++ b/accessible/src/html/HTMLListAccessible.h
@@ -2,47 +2,47 @@
 /* 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_HTMLListAccessible_h__
 #define mozilla_a11y_HTMLListAccessible_h__
 
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 #include "nsBaseWidgetAccessible.h"
 
 namespace mozilla {
 namespace a11y {
 
 class HTMLListBulletAccessible;
 
 /**
  * Used for HTML list (like HTML ul).
  */
-class HTMLListAccessible : public nsHyperTextAccessibleWrap
+class HTMLListAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-    nsHyperTextAccessibleWrap(aContent, aDoc) { }
+    HyperTextAccessibleWrap(aContent, aDoc) { }
   virtual ~HTMLListAccessible() { }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 
 /**
  * Used for HTML list item (e.g. HTML li).
  */
-class HTMLLIAccessible : public nsHyperTextAccessibleWrap
+class HTMLLIAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~HTMLLIAccessible() { }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
--- a/accessible/src/html/Makefile.in
+++ b/accessible/src/html/Makefile.in
@@ -12,42 +12,35 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_html_s
 LIBXUL_LIBRARY = 1
 
 
 
 CPPSRCS = \
-  nsHTMLCanvasAccessible.cpp \
+  HTMLElementAccessibles.cpp \
   HTMLFormControlAccessible.cpp \
   HTMLListAccessible.cpp \
-  nsHTMLImageAccessible.cpp \
+  nsHTMLCanvasAccessible.cpp \
   nsHTMLImageMapAccessible.cpp \
   nsHTMLLinkAccessible.cpp \
   nsHTMLSelectAccessible.cpp \
   nsHTMLTableAccessible.cpp \
-  nsHTMLTextAccessible.cpp \
-  nsHyperTextAccessible.cpp \
-  $(NULL)
-
-EXPORTS = \
-  nsHyperTextAccessible.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)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
--- a/accessible/src/html/nsHTMLCanvasAccessible.cpp
+++ b/accessible/src/html/nsHTMLCanvasAccessible.cpp
@@ -6,17 +6,17 @@
 #include "nsHTMLCanvasAccessible.h"
 
 #include "Role.h"
 
 using namespace mozilla::a11y;
 
 nsHTMLCanvasAccessible::
   nsHTMLCanvasAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessible(aContent, aDoc)
+  HyperTextAccessible(aContent, aDoc)
 {
 }
 
 role
 nsHTMLCanvasAccessible::NativeRole()
 {
   return roles::CANVAS;
 }
--- a/accessible/src/html/nsHTMLCanvasAccessible.h
+++ b/accessible/src/html/nsHTMLCanvasAccessible.h
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
 #ifndef _nsHTMLCanvasAccessible_H_
 #define _nsHTMLCanvasAccessible_H_
 
 /**
  * HTML canvas accessible (html:canvas).
  */
-class nsHTMLCanvasAccessible : public nsHyperTextAccessible
+class nsHTMLCanvasAccessible : public HyperTextAccessible
 {
 public:
   nsHTMLCanvasAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsHTMLCanvasAccessible() { }
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
 };
--- a/accessible/src/html/nsHTMLImageMapAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageMapAccessible.cpp
@@ -21,25 +21,25 @@
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLImageMapAccessible::
   nsHTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHTMLImageAccessibleWrap(aContent, aDoc)
+  ImageAccessibleWrap(aContent, aDoc)
 {
   mFlags |= eImageMapAccessible;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, nsHTMLImageAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, ImageAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: Accessible public
 
 role
 nsHTMLImageMapAccessible::NativeRole()
 {
   return roles::IMAGE_MAP;
@@ -174,17 +174,17 @@ nsHTMLAreaAccessible::GetNameInternal(ns
 
 void
 nsHTMLAreaAccessible::Description(nsString& aDescription)
 {
   aDescription.Truncate();
 
   // Still to do - follow IE's standard here
   nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mContent));
-  if (area) 
+  if (area)
     area->GetShape(aDescription);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLAreaAccessible: nsAccessNode public
 
 bool
 nsHTMLAreaAccessible::IsPrimaryForNode() const
--- a/accessible/src/html/nsHTMLImageMapAccessible.h
+++ b/accessible/src/html/nsHTMLImageMapAccessible.h
@@ -1,25 +1,25 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 _nsHTMLAreaAccessible_H_
 #define _nsHTMLAreaAccessible_H_
 
+#include "ImageAccessibleWrap.h"
 #include "nsHTMLLinkAccessible.h"
-#include "nsHTMLImageAccessibleWrap.h"
 
 #include "nsIDOMHTMLMapElement.h"
 
 /**
  * Used for HTML image maps.
  */
-class nsHTMLImageMapAccessible : public nsHTMLImageAccessibleWrap
+class nsHTMLImageMapAccessible : public mozilla::a11y::ImageAccessibleWrap
 {
 public:
   nsHTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsHTMLImageMapAccessible() { }
 
   // nsISupports and cycle collector
   NS_DECL_ISUPPORTS_INHERITED
 
@@ -77,9 +77,9 @@ public:
   virtual PRUint32 EndOffset();
 
 protected:
 
   // Accessible
   virtual void CacheChildren();
 };
 
-#endif  
+#endif
--- a/accessible/src/html/nsHTMLLinkAccessible.cpp
+++ b/accessible/src/html/nsHTMLLinkAccessible.cpp
@@ -17,48 +17,37 @@
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLLinkAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLLinkAccessible::
   nsHTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 // Expose nsIAccessibleHyperLink unconditionally
-NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
+NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, HyperTextAccessibleWrap,
                              nsIAccessibleHyperLink)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 role
 nsHTMLLinkAccessible::NativeRole()
 {
   return roles::LINK;
 }
 
 PRUint64
 nsHTMLLinkAccessible::NativeState()
 {
-  PRUint64 states = nsHyperTextAccessibleWrap::NativeState();
-
-  states  &= ~states::READONLY;
-
-  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::name)) {
-    // This is how we indicate it is a named anchor
-    // In other words, this anchor can be selected as a location :)
-    // There is no other better state to use to indicate this.
-    states |= states::SELECTABLE;
-  }
-
-  return states;
+  return HyperTextAccessibleWrap::NativeState() & ~states::READONLY;
 }
 
 PRUint64
 nsHTMLLinkAccessible::NativeLinkState() const
 {
   nsEventStates eventState = mContent->AsElement()->State();
   if (eventState.HasState(NS_EVENT_STATE_UNVISITED))
     return states::LINKED;
@@ -67,53 +56,67 @@ nsHTMLLinkAccessible::NativeLinkState() 
     return states::LINKED | states::TRAVERSED;
 
   // This is a either named anchor (a link with also a name attribute) or
   // it doesn't have any attributes. Check if 'click' event handler is
   // registered, otherwise bail out.
   return nsCoreUtils::HasClickListener(mContent) ? states::LINKED : 0;
 }
 
+PRUint64
+nsHTMLLinkAccessible::NativeInteractiveState() const
+{
+  PRUint64 state = HyperTextAccessibleWrap::NativeInteractiveState();
+
+  // This is how we indicate it is a named anchor. In other words, this anchor
+  // can be selected as a location :) There is no other better state to use to
+  // indicate this.
+  if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::name))
+    state |= states::SELECTABLE;
+
+  return state;
+}
+
 void
 nsHTMLLinkAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
 
-  nsHyperTextAccessible::Value(aValue);
+  HyperTextAccessible::Value(aValue);
   if (aValue.IsEmpty())
     nsContentUtils::GetLinkLocation(mContent->AsElement(), aValue);
 }
 
 PRUint8
 nsHTMLLinkAccessible::ActionCount()
 {
-  return IsLinked() ? 1 : nsHyperTextAccessible::ActionCount();
+  return IsLinked() ? 1 : HyperTextAccessible::ActionCount();
 }
 
 NS_IMETHODIMP
 nsHTMLLinkAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   aName.Truncate();
 
   if (!IsLinked())
-    return nsHyperTextAccessible::GetActionName(aIndex, aName);
+    return HyperTextAccessible::GetActionName(aIndex, aName);
 
   // Action 0 (default action): Jump to link
   if (aIndex != eAction_Jump)
     return NS_ERROR_INVALID_ARG;
 
   aName.AssignLiteral("jump");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLLinkAccessible::DoAction(PRUint8 aIndex)
 {
   if (!IsLinked())
-    return nsHyperTextAccessible::DoAction(aIndex);
+    return HyperTextAccessible::DoAction(aIndex);
 
   // Action 0 (default action): Jump to link
   if (aIndex != eAction_Jump)
     return NS_ERROR_INVALID_ARG;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
--- a/accessible/src/html/nsHTMLLinkAccessible.h
+++ b/accessible/src/html/nsHTMLLinkAccessible.h
@@ -1,34 +1,35 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 _nsHTMLLinkAccessible_H_
 #define _nsHTMLLinkAccessible_H_
 
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 
-class nsHTMLLinkAccessible : public nsHyperTextAccessibleWrap
+class nsHTMLLinkAccessible : public HyperTextAccessibleWrap
 {
 public:
   nsHTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc);
  
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // Accessible
   virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual PRUint64 NativeLinkState() const;
+  virtual PRUint64 NativeInteractiveState() const;
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // HyperLinkAccessible
   virtual bool IsLink();
   virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
 
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -169,17 +169,17 @@ nsHTMLSelectListAccessible::CacheOptSibl
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectOptionAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLSelectOptionAccessible::
   nsHTMLSelectOptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectOptionAccessible: Accessible public
 
 role
 nsHTMLSelectOptionAccessible::NativeRole()
@@ -220,32 +220,28 @@ nsHTMLSelectOptionAccessible::GetNameInt
   return NS_OK;
 }
 
 PRUint64
 nsHTMLSelectOptionAccessible::NativeState()
 {
   // As a nsHTMLSelectOptionAccessible we can have the following states:
   // SELECTABLE, SELECTED, FOCUSED, FOCUSABLE, OFFSCREEN
-  // Upcall to Accessible, but skip nsHyperTextAccessible impl
+  // Upcall to Accessible, but skip HyperTextAccessible impl
   // because we don't want EDITABLE or SELECTABLE_TEXT
   PRUint64 state = Accessible::NativeState();
 
   Accessible* select = GetSelect();
   if (!select)
     return state;
 
   PRUint64 selectState = select->State();
   if (selectState & states::INVISIBLE)
     return state;
 
-  // Focusable and selectable
-  if (!(state & states::UNAVAILABLE))
-    state |= (states::FOCUSABLE | states::SELECTABLE);
-
   // Are we selected?
   bool isSelected = false;
   nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mContent));
   if (option) {
     option->GetSelected(&isSelected);
     if (isSelected)
       state |= states::SELECTED;
   }
@@ -280,16 +276,23 @@ nsHTMLSelectOptionAccessible::NativeStat
         state |= states::OFFSCREEN;
       }
     }
   }
  
   return state;
 }
 
+PRUint64
+nsHTMLSelectOptionAccessible::NativeInteractiveState() const
+{
+  return NativelyUnavailable() ?
+    states::UNAVAILABLE : states::FOCUSABLE | states::SELECTABLE;
+}
+
 PRInt32
 nsHTMLSelectOptionAccessible::GetLevelInternal()
 {
   nsIContent *parentContent = mContent->GetParent();
 
   PRInt32 level =
     parentContent->NodeInfo()->Equals(nsGkAtoms::optgroup) ? 2 : 1;
 
@@ -302,17 +305,17 @@ nsHTMLSelectOptionAccessible::GetLevelIn
 void
 nsHTMLSelectOptionAccessible::GetBoundsRect(nsRect& aTotalBounds,
                                             nsIFrame** aBoundingFrame)
 {
   Accessible* combobox = GetCombobox();
   if (combobox && (combobox->State() & states::COLLAPSED))
     combobox->GetBoundsRect(aTotalBounds, aBoundingFrame);
   else
-    nsHyperTextAccessibleWrap::GetBoundsRect(aTotalBounds, aBoundingFrame);
+    HyperTextAccessibleWrap::GetBoundsRect(aTotalBounds, aBoundingFrame);
 }
 
 /** select us! close combo box if necessary*/
 NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   if (aIndex == eAction_Select) {
     aName.AssignLiteral("select"); 
     return NS_OK;
@@ -371,23 +374,19 @@ nsHTMLSelectOptGroupAccessible::
 
 role
 nsHTMLSelectOptGroupAccessible::NativeRole()
 {
   return roles::HEADING;
 }
 
 PRUint64
-nsHTMLSelectOptGroupAccessible::NativeState()
+nsHTMLSelectOptGroupAccessible::NativeInteractiveState() const
 {
-  PRUint64 state = nsHTMLSelectOptionAccessible::NativeState();
-
-  state &= ~(states::FOCUSABLE | states::SELECTABLE);
-
-  return state;
+  return NativelyUnavailable() ? states::UNAVAILABLE : 0;
 }
 
 NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::DoAction(PRUint8 index)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
--- a/accessible/src/html/nsHTMLSelectAccessible.h
+++ b/accessible/src/html/nsHTMLSelectAccessible.h
@@ -64,33 +64,34 @@ protected:
    * Recursive helper for CacheChildren().
    */
   void CacheOptSiblings(nsIContent *aParentContent);
 };
 
 /*
  * Options inside the select, contained within the list
  */
-class nsHTMLSelectOptionAccessible : public nsHyperTextAccessibleWrap
+class nsHTMLSelectOptionAccessible : public HyperTextAccessibleWrap
 {
 public:
   enum { eAction_Select = 0 };  
   
   nsHTMLSelectOptionAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~nsHTMLSelectOptionAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD SetSelected(bool aSelect);
 
   // Accessible
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
+  virtual PRUint64 NativeInteractiveState() const;
 
   virtual PRInt32 GetLevelInternal();
   virtual void GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame);
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
@@ -136,17 +137,17 @@ public:
   virtual ~nsHTMLSelectOptGroupAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);  
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
-  virtual PRUint64 NativeState();
+  virtual PRUint64 NativeInteractiveState() const;
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 protected:
   // Accessible
   virtual void CacheChildren();
 };
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -39,60 +39,63 @@
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLTableCellAccessible::
   nsHTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsHyperTextAccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible: nsISupports implementation
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible,
-                             nsHyperTextAccessible,
+                             HyperTextAccessible,
                              nsIAccessibleTableCell)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible: Accessible implementation
 
 role
 nsHTMLTableCellAccessible::NativeRole()
 {
   return roles::CELL;
 }
 
 PRUint64
 nsHTMLTableCellAccessible::NativeState()
 {
-  PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
+  PRUint64 state = HyperTextAccessibleWrap::NativeState();
 
   nsIFrame *frame = mContent->GetPrimaryFrame();
   NS_ASSERTION(frame, "No frame for valid cell accessible!");
 
-  if (frame) {
-    state |= states::SELECTABLE;
-    if (frame->IsSelected())
-      state |= states::SELECTED;
-  }
+  if (frame && frame->IsSelected())
+    state |= states::SELECTED;
 
   return state;
 }
 
+PRUint64
+nsHTMLTableCellAccessible::NativeInteractiveState() const
+{
+  return HyperTextAccessibleWrap::NativeInteractiveState() | states::SELECTABLE;
+}
+
 nsresult
 nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
+  nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // table-cell-index attribute
   nsCOMPtr<nsIAccessibleTable> tableAcc(GetTableAccessible());
   if (!tableAcc)
     return NS_OK;
 
   PRInt32 rowIdx = -1, colIdx = -1;
@@ -1507,17 +1510,17 @@ nsHTMLTableAccessible::IsProbablyLayoutT
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLCaptionAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 Relation
 nsHTMLCaptionAccessible::RelationByType(PRUint32 aType)
 {
-  Relation rel = nsHyperTextAccessible::RelationByType(aType);
+  Relation rel = HyperTextAccessible::RelationByType(aType);
   if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR)
     rel.AppendTarget(Parent());
 
   return rel;
 }
 
 role
 nsHTMLCaptionAccessible::NativeRole()
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -1,42 +1,43 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 _nsHTMLTableAccessible_H_
 #define _nsHTMLTableAccessible_H_
 
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 #include "nsIAccessibleTable.h"
 #include "TableAccessible.h"
 #include "xpcAccessibleTable.h"
 
 class nsITableLayout;
 class nsITableCellLayout;
 
 /**
  * HTML table cell accessible (html:td).
  */
-class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap,
+class nsHTMLTableCellAccessible : public HyperTextAccessibleWrap,
                                   public nsIAccessibleTableCell
 {
 public:
   nsHTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTableCell
   NS_DECL_NSIACCESSIBLETABLECELL
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
+  virtual PRUint64 NativeInteractiveState() const;
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
 protected:
   /**
    * Return host table accessible.
    */
   already_AddRefed<nsIAccessibleTable> GetTableAccessible();
 
@@ -173,21 +174,21 @@ protected:
 #ifdef SHOW_LAYOUT_HEURISTIC
   nsString mLayoutHeuristic;
 #endif
 };
 
 /**
  * HTML caption accessible (html:caption).
  */
-class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
+class nsHTMLCaptionAccessible : public HyperTextAccessibleWrap
 {
 public:
   nsHTMLCaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-    nsHyperTextAccessibleWrap(aContent, aDoc) { }
+    HyperTextAccessibleWrap(aContent, aDoc) { }
   virtual ~nsHTMLCaptionAccessible() { }
 
   // nsIAccessible
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aRelationType);
 };
--- a/accessible/src/jsat/AccessFu.jsm
+++ b/accessible/src/jsat/AccessFu.jsm
@@ -346,16 +346,21 @@ var AccessFu = {
           this.presenters.forEach(
             function(p) {
               p.textChanged(isInserted, event.start, event.length, text, event.modifiedText);
             }
           );
         }
         break;
       }
+      case Ci.nsIAccessibleEvent.EVENT_SCROLLING_START:
+      {
+        VirtualCursorController.moveCursorToObject(aEvent.accessible);
+        break;
+      }
       default:
         break;
     }
   },
 
   /**
    * Check if accessible is a top-level content document (i.e. a child of a XUL
    * browser node).
--- a/accessible/src/jsat/VirtualCursorController.jsm
+++ b/accessible/src/jsat/VirtualCursorController.jsm
@@ -160,16 +160,32 @@ var VirtualCursorController = {
     }
   },
 
   getVirtualCursor: function getVirtualCursor(document) {
     return gAccRetrieval.getAccessibleFor(document).
       QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
   },
 
+  moveCursorToObject: function moveCursorToObject(aAccessible, aRule) {
+    let doc = aAccessible.document;
+    while (doc) {
+      let vc = null;
+      try {
+        vc = doc.QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
+      } catch (x) {
+        doc = doc.parentDocument;
+        continue;
+      }
+      if (vc)
+        vc.moveNext(aRule || this.SimpleTraversalRule, aAccessible, true);
+      break;
+    }
+  },
+
   SimpleTraversalRule: {
     getMatchRoles: function SimpleTraversalRule_getmatchRoles(aRules) {
       aRules.value = this._matchRoles;
       return this._matchRoles.length;
     },
 
     preFilter: Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
       Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE,
rename from accessible/src/mac/nsHyperTextAccessibleWrap.h
rename to accessible/src/mac/HyperTextAccessibleWrap.h
--- a/accessible/src/mac/nsHyperTextAccessibleWrap.h
+++ b/accessible/src/mac/HyperTextAccessibleWrap.h
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 _NSHYPERTEXTACCESSIBLEWRAP_H
-#define _NSHYPERTEXTACCESSIBLEWRAP_H
+#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
+#define mozilla_a11y_HyperTextAccessibleWrap_h__
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
-typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
+typedef class HyperTextAccessible HyperTextAccessibleWrap;
 
 #endif
 
rename from accessible/src/mac/nsHTMLImageAccessibleWrap.h
rename to accessible/src/mac/ImageAccessibleWrap.h
--- a/accessible/src/mac/nsHTMLImageAccessibleWrap.h
+++ b/accessible/src/mac/ImageAccessibleWrap.h
@@ -1,16 +1,22 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* 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 _NSHTMLIMAGEACCESSIBLEWRAP_H
-#define _NSHTMLIMAGEACCESSIBLEWRAP_H
+#ifndef mozilla_a11y_ImageAccessibleWrap_h__
+#define mozilla_a11y_ImageAccessibleWrap_h__
+
+#include "ImageAccessible.h"
 
-#include "nsHTMLImageAccessible.h"
+namespace mozilla {
+namespace a11y {
 
-typedef class nsHTMLImageAccessible nsHTMLImageAccessibleWrap;
+typedef class ImageAccessible ImageAccessibleWrap;
+
+} // namespace a11y
+} // namespace mozilla
 
 #endif
 
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -551,33 +551,33 @@ GetNativeFromGeckoAccessible(nsIAccessib
 
   return [NSString stringWithFormat:@"(%p) %@", self, [self role]];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (BOOL)isFocused
 {
-  return (mGeckoAccessible->State() & states::FOCUSED) != 0;
+  return FocusMgr()->IsFocused(mGeckoAccessible);
 }
 
 - (BOOL)canBeFocused
 {
-  return mGeckoAccessible->State() & states::FOCUSABLE;
+  return mGeckoAccessible->InteractiveState() & states::FOCUSABLE;
 }
 
 - (BOOL)focus
 {
   nsresult rv = mGeckoAccessible->TakeFocus();
   return NS_SUCCEEDED(rv);
 }
 
 - (BOOL)isEnabled
 {
-  return (mGeckoAccessible->State() & states::UNAVAILABLE) == 0;
+  return (mGeckoAccessible->InteractiveState() & states::UNAVAILABLE) == 0;
 }
 
 // The root accessible calls this when the focused node was
 // changed to us.
 - (void)didReceiveFocus
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
--- a/accessible/src/mac/mozHTMLAccessible.mm
+++ b/accessible/src/mac/mozHTMLAccessible.mm
@@ -2,17 +2,17 @@
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* 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/. */
 
 #import "mozHTMLAccessible.h"
 
-#import "nsHyperTextAccessible.h"
+#import "HyperTextAccessible.h"
 
 #import "nsCocoaUtils.h"
 
 @implementation mozHeadingAccessible
 
 - (id)value
 {
   if (!mGeckoAccessible || !mGeckoAccessible->IsHyperText())
--- a/accessible/src/mac/mozTextAccessible.h
+++ b/accessible/src/mac/mozTextAccessible.h
@@ -1,16 +1,16 @@
 /* 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/. */
 
 #import "mozAccessible.h"
 
-#import "nsHyperTextAccessible.h"
+#import "HyperTextAccessible.h"
 
 @interface mozTextAccessible : mozAccessible
 {
   // both of these are the same old mGeckoAccessible, but already
   // QI'd for us, to the right type, for convenience.
-  nsHyperTextAccessible     *mGeckoTextAccessible;         // strong
+  HyperTextAccessible *mGeckoTextAccessible; // strong
   nsIAccessibleEditableText *mGeckoEditableTextAccessible; // strong
 }
 @end
--- a/accessible/src/msaa/ARIAGridAccessibleWrap.cpp
+++ b/accessible/src/msaa/ARIAGridAccessibleWrap.cpp
@@ -25,11 +25,11 @@ IMPL_IUNKNOWN_INHERITED1(ARIAGridAccessi
 ////////////////////////////////////////////////////////////////////////////////
 // ARIAGridCellAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridCellAccessibleWrap,
                              ARIAGridCellAccessible)
 
 IMPL_IUNKNOWN_INHERITED1(ARIAGridCellAccessibleWrap,
-                         nsHyperTextAccessibleWrap,
+                         HyperTextAccessibleWrap,
                          CAccessibleTableCell)
 
--- a/accessible/src/msaa/CAccessibleEditableText.cpp
+++ b/accessible/src/msaa/CAccessibleEditableText.cpp
@@ -3,17 +3,17 @@
  */
 /* 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/. */
 
 #include "CAccessibleEditableText.h"
 
 #include "AccessibleEditableText_i.c"
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 
 // IUnknown
 
 STDMETHODIMP
 CAccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
@@ -33,47 +33,47 @@ CAccessibleEditableText::QueryInterface(
 }
 
 // IAccessibleEditableText
 
 STDMETHODIMP
 CAccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->CopyText(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::insertText(long aOffset, BSTR *aText)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRUint32 length = ::SysStringLen(*aText);
   nsAutoString text(*aText, length);
 
   nsresult rv = textAcc->InsertText(text, aOffset);
   return GetHRESULT(rv);
@@ -81,48 +81,48 @@ CAccessibleEditableText::insertText(long
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->CutText(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::pasteText(long aOffset)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->PasteText(aOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
                                      BSTR *aText)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   PRUint32 length = ::SysStringLen(*aText);
--- a/accessible/src/msaa/CAccessibleText.cpp
+++ b/accessible/src/msaa/CAccessibleText.cpp
@@ -5,17 +5,17 @@
  * 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/. */
 
 #include "CAccessibleText.h"
 
 #include "Accessible2.h"
 #include "AccessibleText_i.c"
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 
 #include "nsIPersistentProperties2.h"
 
 // IUnknown
 
 STDMETHODIMP
 CAccessibleText::QueryInterface(REFIID iid, void** ppv)
 {
@@ -35,17 +35,17 @@ CAccessibleText::QueryInterface(REFIID i
 }
 
 // IAccessibleText
 
 STDMETHODIMP
 CAccessibleText::addSelection(long aStartOffset, long aEndOffset)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->AddSelection(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
@@ -58,17 +58,17 @@ CAccessibleText::get_attributes(long aOf
 __try {
   if (!aStartOffset || !aEndOffset || !aTextAttributes)
     return E_INVALIDARG;
 
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aTextAttributes = NULL;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRInt32 startOffset = 0, endOffset = 0;
   nsCOMPtr<nsIPersistentProperties> attributes;
   nsresult rv = textAcc->GetTextAttributes(true, aOffset,
                                            &startOffset, &endOffset,
                                            getter_AddRefs(attributes));
@@ -90,17 +90,17 @@ CAccessibleText::get_attributes(long aOf
 }
 
 STDMETHODIMP
 CAccessibleText::get_caretOffset(long *aOffset)
 {
 __try {
   *aOffset = -1;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRInt32 offset = 0;
   nsresult rv = textAcc->GetCaretOffset(&offset);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
@@ -118,17 +118,17 @@ CAccessibleText::get_characterExtents(lo
                                       long *aWidth, long *aHeight)
 {
 __try {
   *aX = 0;
   *aY = 0;
   *aWidth = 0;
   *aHeight = 0;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
   PRInt32 x = 0, y =0, width = 0, height = 0;
@@ -148,17 +148,17 @@ CAccessibleText::get_characterExtents(lo
 }
 
 STDMETHODIMP
 CAccessibleText::get_nSelections(long *aNSelections)
 {
 __try {
   *aNSelections = 0;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRInt32 selCount = 0;
   nsresult rv = textAcc->GetSelectionCount(&selCount);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
@@ -172,17 +172,17 @@ CAccessibleText::get_nSelections(long *a
 STDMETHODIMP
 CAccessibleText::get_offsetAtPoint(long aX, long aY,
                                    enum IA2CoordinateType aCoordType,
                                    long *aOffset)
 {
 __try {
   *aOffset = 0;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
   PRInt32 offset = 0;
@@ -200,17 +200,17 @@ CAccessibleText::get_offsetAtPoint(long 
 STDMETHODIMP
 CAccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
                                long *aEndOffset)
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRInt32 startOffset = 0, endOffset = 0;
   nsresult rv = textAcc->GetSelectionBounds(aSelectionIndex,
                                             &startOffset, &endOffset);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
@@ -224,17 +224,17 @@ CAccessibleText::get_selection(long aSel
 }
 
 STDMETHODIMP
 CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
 {
 __try {
   *aText = NULL;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString text;
   nsresult rv = textAcc->GetText(aStartOffset, aEndOffset, text);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
@@ -254,17 +254,17 @@ CAccessibleText::get_textBeforeOffset(lo
                                       long *aStartOffset, long *aEndOffset,
                                       BSTR *aText)
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aText = NULL;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = NS_OK;
   nsAutoString text;
   PRInt32 startOffset = 0, endOffset = 0;
 
   if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
@@ -301,17 +301,17 @@ CAccessibleText::get_textAfterOffset(lon
                                      long *aStartOffset, long *aEndOffset,
                                      BSTR *aText)
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aText = NULL;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = NS_OK;
   nsAutoString text;
   PRInt32 startOffset = 0, endOffset = 0;
 
   if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
@@ -348,17 +348,17 @@ CAccessibleText::get_textAtOffset(long a
                                   long *aStartOffset, long *aEndOffset,
                                   BSTR *aText)
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aText = NULL;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = NS_OK;
   nsAutoString text;
   PRInt32 startOffset = 0, endOffset = 0;
 
   if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
@@ -388,48 +388,48 @@ CAccessibleText::get_textAtOffset(long a
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::removeSelection(long aSelectionIndex)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->RemoveSelection(aSelectionIndex);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::setCaretOffset(long aOffset)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->SetCaretOffset(aOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
                               long aEndOffset)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->SetSelectionBounds(aSelectionIndex,
                                             aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@@ -437,50 +437,50 @@ CAccessibleText::setSelection(long aSele
 }
 
 STDMETHODIMP
 CAccessibleText::get_nCharacters(long *aNCharacters)
 {
 __try {
   *aNCharacters = 0;
 
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aNCharacters  = textAcc->CharacterCount();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
                                    enum IA2ScrollType aScrollType)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
                                         enum IA2CoordinateType aCoordType,
                                         long aX, long aY)
 {
 __try {
-  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
   nsresult rv = textAcc->ScrollSubstringToPoint(aStartIndex, aEndIndex,
--- a/accessible/src/msaa/DocAccessibleWrap.cpp
+++ b/accessible/src/msaa/DocAccessibleWrap.cpp
@@ -62,17 +62,17 @@ STDMETHODIMP_(ULONG) DocAccessibleWrap::
 
 // Microsoft COM QueryInterface
 STDMETHODIMP
 DocAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
 
   if (IID_ISimpleDOMDocument != iid)
-    return nsHyperTextAccessibleWrap::QueryInterface(iid, ppv);
+    return HyperTextAccessibleWrap::QueryInterface(iid, ppv);
 
   statistics::ISimpleDOMUsed();
   *ppv = static_cast<ISimpleDOMDocument*>(this);
   (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
   return S_OK;
 }
 
 STDMETHODIMP
rename from accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
rename to accessible/src/msaa/HyperTextAccessibleWrap.cpp
--- a/accessible/src/msaa/nsHyperTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/HyperTextAccessibleWrap.cpp
@@ -1,29 +1,29 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* 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/. */
 
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 
 #include "nsEventShell.h"
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsHyperTextAccessibleWrap,
-                             nsHyperTextAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap,
+                             HyperTextAccessible)
 
-IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
+IMPL_IUNKNOWN_INHERITED2(HyperTextAccessibleWrap,
                          AccessibleWrap,
                          ia2AccessibleHypertext,
                          CAccessibleEditableText);
 
 nsresult
-nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
+HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
   PRUint32 eventType = aEvent->GetEventType();
 
   if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
       eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) {
     Accessible* accessible = aEvent->GetAccessible();
     if (accessible) {
       nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(accessible));
@@ -36,24 +36,24 @@ nsHyperTextAccessibleWrap::HandleAccEven
           NS_IF_ADDREF(gTextEvent = downcast_accEvent(aEvent));
 
           (static_cast<IUnknown*>(instancePtr))->Release();
         }
       }
     }
   }
 
-  return nsHyperTextAccessible::HandleAccEvent(aEvent);
+  return HyperTextAccessible::HandleAccEvent(aEvent);
 }
 
 nsresult
-nsHyperTextAccessibleWrap::GetModifiedText(bool aGetInsertedText,
-                                           nsAString& aText,
-                                           PRUint32 *aStartOffset,
-                                           PRUint32 *aEndOffset)
+HyperTextAccessibleWrap::GetModifiedText(bool aGetInsertedText,
+                                         nsAString& aText,
+                                         PRUint32* aStartOffset,
+                                         PRUint32* aEndOffset)
 {
   aText.Truncate();
   *aStartOffset = 0;
   *aEndOffset = 0;
 
   if (!gTextEvent)
     return NS_OK;
 
rename from accessible/src/msaa/nsHyperTextAccessibleWrap.h
rename to accessible/src/msaa/HyperTextAccessibleWrap.h
--- a/accessible/src/msaa/nsHyperTextAccessibleWrap.h
+++ b/accessible/src/msaa/HyperTextAccessibleWrap.h
@@ -1,30 +1,30 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* 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 _NSHYPERTEXTACCESSIBLEWRAP_H
-#define _NSHYPERTEXTACCESSIBLEWRAP_H
+#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
+#define mozilla_a11y_HyperTextAccessibleWrap_h__
 
-#include "nsHyperTextAccessible.h"
+#include "HyperTextAccessible.h"
 #include "CAccessibleText.h"
 #include "CAccessibleEditableText.h"
 #include "ia2AccessibleHyperText.h"
 
-class nsHyperTextAccessibleWrap : public nsHyperTextAccessible,
-                                  public ia2AccessibleHypertext,
-                                  public CAccessibleEditableText
+class HyperTextAccessibleWrap : public HyperTextAccessible,
+                                public ia2AccessibleHypertext,
+                                public CAccessibleEditableText
 {
 public:
-  nsHyperTextAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
-    nsHyperTextAccessible(aContent, aDoc) {}
+  HyperTextAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
+    HyperTextAccessible(aContent, aDoc) {}
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
rename from accessible/src/msaa/nsHTMLImageAccessibleWrap.cpp
rename to accessible/src/msaa/ImageAccessibleWrap.cpp
--- a/accessible/src/msaa/nsHTMLImageAccessibleWrap.cpp
+++ b/accessible/src/msaa/ImageAccessibleWrap.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* 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/. */
 
-#include "nsHTMLImageAccessibleWrap.h"
+#include "ImageAccessibleWrap.h"
+
+using namespace mozilla;
+using namespace mozilla::a11y;
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageAccessibleWrap,
-                             nsHTMLImageAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(ImageAccessibleWrap,
+                             ImageAccessible)
 
-IMPL_IUNKNOWN_INHERITED1(nsHTMLImageAccessibleWrap,
+IMPL_IUNKNOWN_INHERITED1(ImageAccessibleWrap,
                          AccessibleWrap,
                          ia2AccessibleImage);
 
rename from accessible/src/msaa/nsHTMLImageAccessibleWrap.h
rename to accessible/src/msaa/ImageAccessibleWrap.h
--- a/accessible/src/msaa/nsHTMLImageAccessibleWrap.h
+++ b/accessible/src/msaa/ImageAccessibleWrap.h
@@ -1,29 +1,35 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* 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 _NSHTMLIMAGEACCESSIBLEWRAP_H
-#define _NSHTMLIMAGEACCESSIBLEWRAP_H
+#ifndef mozilla_a11y_ImageAccessibleWrap_h__
+#define mozilla_a11y_ImageAccessibleWrap_h__
 
-#include "nsHTMLImageAccessible.h"
+#include "ImageAccessible.h"
 #include "ia2AccessibleImage.h"
 
-class nsHTMLImageAccessibleWrap : public nsHTMLImageAccessible,
-                                  public ia2AccessibleImage
+namespace mozilla {
+namespace a11y {
+
+class ImageAccessibleWrap : public ImageAccessible,
+                            public ia2AccessibleImage
 {
 public:
-  nsHTMLImageAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
-    nsHTMLImageAccessible(aContent, aDoc) {}
+  ImageAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
+    ImageAccessible(aContent, aDoc) {}
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
 
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -15,23 +15,23 @@ EXPORT_LIBRARY = ..
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   AccessibleWrap.cpp \
   ApplicationAccessibleWrap.cpp \
   ARIAGridAccessibleWrap.cpp \
   DocAccessibleWrap.cpp \
+  HyperTextAccessibleWrap.cpp \
+  ImageAccessibleWrap.cpp \
   nsAccessNodeWrap.cpp \
   nsHTMLWin32ObjectAccessible.cpp \
   nsXULMenuAccessibleWrap.cpp \
   nsXULListboxAccessibleWrap.cpp \
   nsXULTreeGridAccessibleWrap.cpp \
-  nsHyperTextAccessibleWrap.cpp \
-  nsHTMLImageAccessibleWrap.cpp \
   nsHTMLTableAccessibleWrap.cpp \
   nsWinUtils.cpp \
   CAccessibleText.cpp \
   CAccessibleEditableText.cpp \
   CAccessibleHyperlink.cpp \
   CAccessibleTable.cpp \
   CAccessibleTableCell.cpp \
   CAccessibleValue.cpp \
--- a/accessible/src/msaa/ia2AccessibleHypertext.cpp
+++ b/accessible/src/msaa/ia2AccessibleHypertext.cpp
@@ -4,26 +4,26 @@
 /* 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/. */
 
 #include "ia2AccessibleHypertext.h"
 
 #include "AccessibleHypertext_i.c"
 
-#include "nsHyperTextAccessibleWrap.h"
+#include "HyperTextAccessibleWrap.h"
 
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
   if (IID_IAccessibleHypertext == iid) {
-    nsHyperTextAccessibleWrap* hyperAcc = static_cast<nsHyperTextAccessibleWrap*>(this);
+    HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
     if (hyperAcc->IsTextRole()) {
       *ppv = static_cast<IAccessibleHypertext*>(this);
       (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
       return S_OK;
     }
     return E_NOINTERFACE;
   }
 
@@ -33,17 +33,17 @@ ia2AccessibleHypertext::QueryInterface(R
 // IAccessibleHypertext
 
 STDMETHODIMP
 ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
 {
 __try {
   *aHyperlinkCount = 0;
 
-  nsHyperTextAccessibleWrap* hyperText = static_cast<nsHyperTextAccessibleWrap*>(this);
+  HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
   if (hyperText->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkCount = hyperText->GetLinkCount();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
@@ -51,17 +51,17 @@ ia2AccessibleHypertext::get_nHyperlinks(
 
 STDMETHODIMP
 ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
                                       IAccessibleHyperlink** aHyperlink)
 {
 __try {
   *aHyperlink = NULL;
 
-  nsHyperTextAccessibleWrap* hyperText = static_cast<nsHyperTextAccessibleWrap*>(this);
+  HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
   if (hyperText->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
   nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(hyperLink));
   if (!winAccessNode)
     return E_FAIL;
 
@@ -79,17 +79,17 @@ ia2AccessibleHypertext::get_hyperlink(lo
 }
 
 STDMETHODIMP
 ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkIndex)
 {
 __try {
   *aHyperlinkIndex = 0;
 
-  nsHyperTextAccessibleWrap* hyperAcc = static_cast<nsHyperTextAccessibleWrap*>(this);
+  HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (hyperAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkIndex = hyperAcc->GetLinkIndexAtOffset(aCharIndex);
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
--- a/accessible/src/msaa/ia2AccessibleImage.cpp
+++ b/accessible/src/msaa/ia2AccessibleImage.cpp
@@ -4,26 +4,28 @@
 /* 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/. */
 
 #include "ia2AccessibleImage.h"
 
 #include "AccessibleImage_i.c"
 
-#include "nsHTMLImageAccessibleWrap.h"
-#include "nsHTMLImageAccessible.h"
+#include "ImageAccessibleWrap.h"
 
 #include "nsIAccessible.h"
 #include "nsIAccessibleImage.h"
 #include "nsIAccessibleTypes.h"
 #include "nsAccessNodeWrap.h"
 
 #include "nsString.h"
 
+using namespace mozilla;
+using namespace mozilla::a11y;
+
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleImage::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
 
   if (IID_IAccessibleImage == iid) {
@@ -38,18 +40,17 @@ ia2AccessibleImage::QueryInterface(REFII
 // IAccessibleImage
 
 STDMETHODIMP
 ia2AccessibleImage::get_description(BSTR* aDescription)
 {
 __try {
   *aDescription = NULL;
 
-  nsHTMLImageAccessibleWrap* acc =
-    static_cast<nsHTMLImageAccessibleWrap*>(this);
+  ImageAccessibleWrap* acc = static_cast<ImageAccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString description;
   nsresult rv = acc->GetName(description);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
@@ -67,18 +68,17 @@ STDMETHODIMP
 ia2AccessibleImage::get_imagePosition(enum IA2CoordinateType aCoordType,
                                       long* aX,
                                       long* aY)
 {
 __try {
   *aX = 0;
   *aY = 0;
 
-  nsHTMLImageAccessibleWrap* imageAcc =
-    static_cast<nsHTMLImageAccessibleWrap*>(this);
+  ImageAccessibleWrap* imageAcc = static_cast<ImageAccessibleWrap*>(this);
   if (imageAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
   PRInt32 x = 0, y = 0;
 
@@ -97,18 +97,17 @@ ia2AccessibleImage::get_imagePosition(en
 
 STDMETHODIMP
 ia2AccessibleImage::get_imageSize(long* aHeight, long* aWidth)
 {
 __try {
   *aHeight = 0;
   *aWidth = 0;
 
-  nsHTMLImageAccessibleWrap* imageAcc =
-    static_cast<nsHTMLImageAccessibleWrap*>(this);
+  ImageAccessibleWrap* imageAcc = static_cast<ImageAccessibleWrap*>(this);
   if (imageAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   PRInt32 width = 0, height = 0;
   nsresult rv = imageAcc->GetImageSize(&width, &height);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
--- a/accessible/src/msaa/nsAccessNodeWrap.h
+++ b/accessible/src/msaa/nsAccessNodeWrap.h
@@ -127,17 +127,17 @@ protected:
    * Return ISimpleDOMNode instance for existing accessible object or
    * creates new nsAccessNode instance if the accessible doesn't exist.
    *
    * @note ISimpleDOMNode is returned addrefed
    */
   ISimpleDOMNode *MakeAccessNode(nsINode *aNode);
 
     /**
-     * It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
+     * It is used in HyperTextAccessibleWrap for IA2::newText/oldText
      * implementation.
      */
     static AccTextChangeEvent* gTextEvent;
 };
 
 /**
  * Converts nsresult to HRESULT.
  */
--- a/accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsHTMLTableAccessibleWrap.cpp
@@ -22,22 +22,22 @@ IMPL_IUNKNOWN_INHERITED1(nsHTMLTableAcce
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableCellAccessibleWrap,
                              nsHTMLTableCellAccessible)
 
 IMPL_IUNKNOWN_INHERITED1(nsHTMLTableCellAccessibleWrap,
-                         nsHyperTextAccessibleWrap,
+                         HyperTextAccessibleWrap,
                          CAccessibleTableCell)
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeaderCellAccessibleWrap,
                              nsHTMLTableHeaderCellAccessible)
 
 IMPL_IUNKNOWN_INHERITED1(nsHTMLTableHeaderCellAccessibleWrap,
-                         nsHyperTextAccessibleWrap,
+                         HyperTextAccessibleWrap,
                          CAccessibleTableCell)
--- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
+++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
@@ -37,22 +37,22 @@ nsHTMLWin32ObjectOwnerAccessible::Shutdo
 // nsHTMLWin32ObjectOwnerAccessible: Accessible implementation
 
 role
 nsHTMLWin32ObjectOwnerAccessible::NativeRole()
 {
   return roles::EMBEDDED_OBJECT;
 }
 
-PRUint64
-nsHTMLWin32ObjectOwnerAccessible::NativeState()
+bool
+nsHTMLWin32ObjectOwnerAccessible::NativelyUnavailable() const
 {
   // XXX: No HWND means this is windowless plugin which is not accessible in
   // the meantime.
-  return mHwnd ? AccessibleWrap::NativeState() : states::UNAVAILABLE;
+  return !mHwnd;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLWin32ObjectOwnerAccessible: Accessible protected implementation
 
 void
 nsHTMLWin32ObjectOwnerAccessible::CacheChildren()
 {
--- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h
+++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h
@@ -23,17 +23,17 @@ public:
                                    DocAccessible* aDoc, void* aHwnd);
   virtual ~nsHTMLWin32ObjectOwnerAccessible() {}
 
   // nsAccessNode
   virtual void Shutdown();
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
-  virtual PRUint64 NativeState();
+  virtual bool NativelyUnavailable() const;
 
 protected:
 
   // Accessible
   virtual void CacheChildren();
 
   void* mHwnd;
   nsRefPtr<Accessible> mNativeAccessible;
--- a/accessible/src/msaa/nsXULListboxAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsXULListboxAccessibleWrap.cpp
@@ -33,10 +33,10 @@ nsXULListCellAccessibleWrap::
   nsXULListCellAccessible(aContent, aDoc)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsXULListCellAccessibleWrap,
                              nsXULListCellAccessible)
 
 IMPL_IUNKNOWN_INHERITED1(nsXULListCellAccessibleWrap,
-                         nsHyperTextAccessibleWrap,
+                         HyperTextAccessibleWrap,