Bug 1068734 - dexpcomify remaining accessible classes, r=tbsaunde
authorAlexander Surkov <surkov.alexander@gmail.com>
Tue, 23 Sep 2014 08:23:02 -0400
changeset 206697 dbf096855eb520fa3b376ee41acd80d305614aea
parent 206696 d353d79e0610791923a6c4765f9aa0003a47cee5
child 206698 f41dc09ee34be2da0fd173c72334c4b2eeba24f1
push id27538
push userkwierso@gmail.com
push dateTue, 23 Sep 2014 22:30:46 +0000
treeherdermozilla-central@bb61415bd7e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs1068734
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1068734 - dexpcomify remaining accessible classes, r=tbsaunde
accessible/atk/ApplicationAccessibleWrap.cpp
accessible/atk/nsMaiInterfaceDocument.cpp
accessible/generic/ApplicationAccessible.cpp
accessible/generic/ApplicationAccessible.h
accessible/generic/DocAccessible-inl.h
accessible/generic/DocAccessible.cpp
accessible/generic/DocAccessible.h
accessible/generic/ImageAccessible.cpp
accessible/generic/ImageAccessible.h
accessible/interfaces/nsIAccessibleDocument.idl
accessible/windows/msaa/ApplicationAccessibleWrap.cpp
accessible/windows/msaa/DocAccessibleWrap.cpp
accessible/windows/sdn/sdnDocAccessible.cpp
accessible/xpcom/moz.build
accessible/xpcom/xpcAccessibleApplication.cpp
accessible/xpcom/xpcAccessibleApplication.h
accessible/xpcom/xpcAccessibleDocument.cpp
accessible/xpcom/xpcAccessibleDocument.h
accessible/xpcom/xpcAccessibleImage.cpp
accessible/xpcom/xpcAccessibleImage.h
--- a/accessible/atk/ApplicationAccessibleWrap.cpp
+++ b/accessible/atk/ApplicationAccessibleWrap.cpp
@@ -80,17 +80,17 @@ toplevel_event_watcher(GSignalInvocation
 
 ENameValueFlag
 ApplicationAccessibleWrap::Name(nsString& aName)
 {
   // ATK doesn't provide a way to obtain an application name (for example,
   // Firefox or Thunderbird) like IA2 does. Thus let's return an application
   // name as accessible name that was used to get a branding name (for example,
   // Minefield aka nightly Firefox or Daily aka nightly Thunderbird).
-  GetAppName(aName);
+  AppName(aName);
   return eNameOK;
 }
 
 NS_IMETHODIMP
 ApplicationAccessibleWrap::GetNativeInterface(void** aOutAccessible)
 {
     *aOutAccessible = nullptr;
 
--- a/accessible/atk/nsMaiInterfaceDocument.cpp
+++ b/accessible/atk/nsMaiInterfaceDocument.cpp
@@ -74,29 +74,26 @@ getDocumentAttributesCB(AtkDocument *aDo
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
   if (!accWrap || !accWrap->IsDoc())
     return nullptr;
 
   // according to atkobject.h, AtkAttributeSet is a GSList
   GSList* attributes = nullptr;
   DocAccessible* document = accWrap->AsDoc();
   nsAutoString aURL;
-  nsresult rv = document->GetURL(aURL);
-  if (NS_SUCCEEDED(rv))
-    attributes = prependToList(attributes, kDocUrlName, aURL);
+  document->URL(aURL);
+  attributes = prependToList(attributes, kDocUrlName, aURL);
 
   nsAutoString aW3CDocType;
-  rv = document->GetDocType(aW3CDocType);
-  if (NS_SUCCEEDED(rv))
-    attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
+  document->GetDocType(aW3CDocType);
+  attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
 
   nsAutoString aMimeType;
-  rv = document->GetMimeType(aMimeType);
-  if (NS_SUCCEEDED(rv))
-    attributes = prependToList(attributes, kMimeTypeName, aMimeType);
+  document->MimeType(aMimeType);
+  attributes = prependToList(attributes, kMimeTypeName, aMimeType);
 
   return attributes;
 }
 
 const gchar *
 getDocumentAttributeValueCB(AtkDocument *aDocument,
                             const gchar *aAttrName)
 {
@@ -105,18 +102,18 @@ getDocumentAttributeValueCB(AtkDocument 
     return nullptr;
 
   DocAccessible* document = accWrap->AsDoc();
   nsresult rv;
   nsAutoString attrValue;
   if (!strcasecmp(aAttrName, kDocTypeName))
     rv = document->GetDocType(attrValue);
   else if (!strcasecmp(aAttrName, kDocUrlName))
-    rv = document->GetURL(attrValue);
+    document->URL(attrValue);
   else if (!strcasecmp(aAttrName, kMimeTypeName))
-    rv = document->GetMimeType(attrValue);
+    document->MimeType(attrValue);
   else
     return nullptr;
 
   NS_ENSURE_SUCCESS(rv, nullptr);
   return attrValue.IsEmpty() ? nullptr : AccessibleWrap::ReturnString(attrValue);
 }
 }
--- a/accessible/generic/ApplicationAccessible.cpp
+++ b/accessible/generic/ApplicationAccessible.cpp
@@ -124,74 +124,16 @@ ApplicationAccessible::RelationByType(Re
 
 nsIntRect
 ApplicationAccessible::Bounds() const
 {
   return nsIntRect();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsIAccessibleApplication
-
-NS_IMETHODIMP
-ApplicationAccessible::GetAppName(nsAString& aName)
-{
-  aName.Truncate();
-
-  if (!mAppInfo)
-    return NS_ERROR_FAILURE;
-
-  nsAutoCString cname;
-  nsresult rv = mAppInfo->GetName(cname);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  AppendUTF8toUTF16(cname, aName);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ApplicationAccessible::GetAppVersion(nsAString& aVersion)
-{
-  aVersion.Truncate();
-
-  if (!mAppInfo)
-    return NS_ERROR_FAILURE;
-
-  nsAutoCString cversion;
-  nsresult rv = mAppInfo->GetVersion(cversion);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  AppendUTF8toUTF16(cversion, aVersion);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ApplicationAccessible::GetPlatformName(nsAString& aName)
-{
-  aName.AssignLiteral("Gecko");
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ApplicationAccessible::GetPlatformVersion(nsAString& aVersion)
-{
-  aVersion.Truncate();
-
-  if (!mAppInfo)
-    return NS_ERROR_FAILURE;
-
-  nsAutoCString cversion;
-  nsresult rv = mAppInfo->GetPlatformVersion(cversion);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  AppendUTF8toUTF16(cversion, aVersion);
-  return NS_OK;
-}
-
-////////////////////////////////////////////////////////////////////////////////
 // Accessible public methods
 
 void
 ApplicationAccessible::Shutdown()
 {
   mAppInfo = nullptr;
 }
 
--- a/accessible/generic/ApplicationAccessible.h
+++ b/accessible/generic/ApplicationAccessible.h
@@ -4,17 +4,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_ApplicationAccessible_h__
 #define mozilla_a11y_ApplicationAccessible_h__
 
 #include "AccessibleWrap.h"
-#include "nsIAccessibleApplication.h"
+#include "xpcAccessibleApplication.h"
 
 #include "nsIMutableArray.h"
 #include "nsIXULAppInfo.h"
 
 namespace mozilla {
 namespace a11y {
 
 /**
@@ -23,28 +23,25 @@ namespace a11y {
  * And this one should be created when Mozilla Startup (if accessibility
  * feature has been enabled) and destroyed when Mozilla Shutdown.
  *
  * All the accessibility objects for toplevel windows are direct children of
  * the ApplicationAccessible instance.
  */
 
 class ApplicationAccessible : public AccessibleWrap,
-                              public nsIAccessibleApplication
+                              public xpcAccessibleApplication
 {
 public:
 
   ApplicationAccessible();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
-  // nsIAccessibleApplication
-  NS_DECL_NSIACCESSIBLEAPPLICATION
-
   // Accessible
   virtual void Shutdown();
   virtual nsIntRect Bounds() const MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
   virtual GroupPos GroupPosition();
   virtual ENameValueFlag Name(nsString& aName);
   virtual void ApplyARIAState(uint64_t* aState) const;
   virtual void Description(nsString& aDescription);
@@ -58,16 +55,43 @@ public:
                                    EWhichChildAtPoint aWhichChild);
   virtual Accessible* FocusedChild();
 
   virtual void InvalidateChildren();
 
   // ActionAccessible
   virtual KeyBinding AccessKey() const;
 
+  // ApplicationAccessible
+  void AppName(nsAString& aName) const
+  {
+    nsAutoCString cname;
+    mAppInfo->GetName(cname);
+    AppendUTF8toUTF16(cname, aName);
+  }
+
+  void AppVersion(nsAString& aVersion) const
+  {
+    nsAutoCString cversion;
+    mAppInfo->GetVersion(cversion);
+    AppendUTF8toUTF16(cversion, aVersion);
+  }
+
+  void PlatformName(nsAString& aName) const
+  {
+    aName.AssignLiteral("Gecko");
+  }
+
+  void PlatformVersion(nsAString& aVersion) const
+  {
+    nsAutoCString cversion;
+    mAppInfo->GetPlatformVersion(cversion);
+    AppendUTF8toUTF16(cversion, aVersion);
+  }
+
 protected:
   virtual ~ApplicationAccessible() {}
 
   // Accessible
   virtual void CacheChildren();
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
                                          nsresult *aError = nullptr) const;
 
--- a/accessible/generic/DocAccessible-inl.h
+++ b/accessible/generic/DocAccessible-inl.h
@@ -4,27 +4,38 @@
  * 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 "nsAccessiblePivot.h"
 #include "NotificationController.h"
 #include "States.h"
 #include "nsIScrollableFrame.h"
 
 #ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 namespace mozilla {
 namespace a11y {
 
+inline nsIAccessiblePivot*
+DocAccessible::VirtualCursor()
+{
+  if (!mVirtualCursor) {
+    mVirtualCursor = new nsAccessiblePivot(this);
+    mVirtualCursor->AddObserver(this);
+  }
+  return mVirtualCursor;
+}
+
 inline void
 DocAccessible::FireDelayedEvent(AccEvent* aEvent)
 {
 #ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocLoad))
     logging::DocLoadEventFired(aEvent);
 #endif
 
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -35,17 +35,16 @@
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
 #include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsUnicharUtils.h"
 #include "nsIURI.h"
 #include "nsIWebNavigation.h"
 #include "nsFocusManager.h"
-#include "nsNameSpaceManager.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/dom/DocumentType.h"
 #include "mozilla/dom/Element.h"
 
 #ifdef MOZ_XUL
 #include "nsIXULDocument.h"
@@ -71,17 +70,17 @@ static nsIAtom** kRelationAttrs[] =
 static const uint32_t kRelationAttrsLen = ArrayLength(kRelationAttrs);
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 DocAccessible::
   DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                   nsIPresShell* aPresShell) :
-  HyperTextAccessibleWrap(aRootContent, this),
+  HyperTextAccessibleWrap(aRootContent, this), xpcAccessibleDocument(),
   // XXX aaronl should we use an algorithm for the initial cache size?
   mAccessibleCache(kDefaultCacheLength),
   mNodeToAccessibleMap(kDefaultCacheLength),
   mDocumentNode(aDocument),
   mScrollPositionChangedTicks(0),
   mLoadState(eTreeConstructionPending), mDocFlags(0), mLoadEventType(0),
   mVirtualCursor(nullptr),
   mPresShell(aPresShell)
@@ -170,22 +169,22 @@ DocAccessible::Name(nsString& aName)
   if (mParent) {
     mParent->Name(aName); // Allow owning iframe to override the name
   }
   if (aName.IsEmpty()) {
     // Allow name via aria-labelledby or title attribute
     Accessible::Name(aName);
   }
   if (aName.IsEmpty()) {
-    GetTitle(aName);   // Try title element
+    Title(aName); // Try title element
   }
   if (aName.IsEmpty()) {   // Last resort: use URL
-    GetURL(aName);
+    URL(aName);
   }
- 
+
   return eNameOK;
 }
 
 // Accessible public method
 role
 DocAccessible::NativeRole()
 {
   nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode);
@@ -318,184 +317,16 @@ DocAccessible::TakeFocus()
 {
   // Focus the document.
   nsFocusManager* fm = nsFocusManager::GetFocusManager();
   nsCOMPtr<nsIDOMElement> newFocus;
   fm->MoveFocus(mDocumentNode->GetWindow(), nullptr,
                 nsFocusManager::MOVEFOCUS_ROOT, 0, getter_AddRefs(newFocus));
 }
 
-
-////////////////////////////////////////////////////////////////////////////////
-// nsIAccessibleDocument
-
-NS_IMETHODIMP
-DocAccessible::GetURL(nsAString& aURL)
-{
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
-  nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(container));
-  nsAutoCString theURL;
-  if (webNav) {
-    nsCOMPtr<nsIURI> pURI;
-    webNav->GetCurrentURI(getter_AddRefs(pURI));
-    if (pURI)
-      pURI->GetSpec(theURL);
-  }
-  CopyUTF8toUTF16(theURL, aURL);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetTitle(nsAString& aTitle)
-{
-  if (!mDocumentNode) {
-    return NS_ERROR_FAILURE;
-  }
-  nsString title;
-  mDocumentNode->GetTitle(title);
-  aTitle = title;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetMimeType(nsAString& aMimeType)
-{
-  if (!mDocumentNode) {
-    return NS_ERROR_FAILURE;
-  }
-  return mDocumentNode->GetContentType(aMimeType);
-}
-
-NS_IMETHODIMP
-DocAccessible::GetDocType(nsAString& aDocType)
-{
-#ifdef MOZ_XUL
-  nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocumentNode));
-  if (xulDoc) {
-    aDocType.AssignLiteral("window"); // doctype not implemented for XUL at time of writing - causes assertion
-    return NS_OK;
-  } else
-#endif
-  if (mDocumentNode) {
-    dom::DocumentType* docType = mDocumentNode->GetDoctype();
-    if (docType) {
-      return docType->GetPublicId(aDocType);
-    }
-  }
-
-  return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetNameSpaceURIForID(int16_t aNameSpaceID, nsAString& aNameSpaceURI)
-{
-  if (mDocumentNode) {
-    nsNameSpaceManager* nameSpaceManager = nsNameSpaceManager::GetInstance();
-    if (nameSpaceManager)
-      return nameSpaceManager->GetNameSpaceURI(aNameSpaceID, aNameSpaceURI);
-  }
-  return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetWindowHandle(void** aWindow)
-{
-  NS_ENSURE_ARG_POINTER(aWindow);
-  *aWindow = GetNativeWindow();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetWindow(nsIDOMWindow** aDOMWin)
-{
-  *aDOMWin = nullptr;
-  if (!mDocumentNode) {
-    return NS_ERROR_FAILURE;  // Accessible is Shutdown()
-  }
-  *aDOMWin = mDocumentNode->GetWindow();
-
-  if (!*aDOMWin)
-    return NS_ERROR_FAILURE;  // No DOM Window
-
-  NS_ADDREF(*aDOMWin);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetDOMDocument(nsIDOMDocument** aDOMDocument)
-{
-  NS_ENSURE_ARG_POINTER(aDOMDocument);
-  *aDOMDocument = nullptr;
-
-  if (mDocumentNode)
-    CallQueryInterface(mDocumentNode, aDOMDocument);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetParentDocument(nsIAccessibleDocument** aDocument)
-{
-  NS_ENSURE_ARG_POINTER(aDocument);
-  *aDocument = nullptr;
-
-  if (!IsDefunct())
-    NS_IF_ADDREF(*aDocument = ParentDocument());
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetChildDocumentCount(uint32_t* aCount)
-{
-  NS_ENSURE_ARG_POINTER(aCount);
-  *aCount = 0;
-
-  if (!IsDefunct())
-    *aCount = ChildDocumentCount();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetChildDocumentAt(uint32_t aIndex,
-                                  nsIAccessibleDocument** aDocument)
-{
-  NS_ENSURE_ARG_POINTER(aDocument);
-  *aDocument = nullptr;
-
-  if (IsDefunct())
-    return NS_OK;
-
-  NS_IF_ADDREF(*aDocument = GetChildDocumentAt(aIndex));
-  return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
-}
-
-NS_IMETHODIMP
-DocAccessible::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
-{
-  NS_ENSURE_ARG_POINTER(aVirtualCursor);
-  *aVirtualCursor = nullptr;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  if (!mVirtualCursor) {
-    mVirtualCursor = new nsAccessiblePivot(this);
-    mVirtualCursor->AddObserver(this);
-  }
-
-  NS_ADDREF(*aVirtualCursor = mVirtualCursor);
-  return NS_OK;
-}
-
 // 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 (!mDocumentNode->HasFlag(NODE_IS_EDITABLE) &&
       (!mContent || !mContent->HasFlag(NODE_IS_EDITABLE)))
@@ -515,16 +346,47 @@ DocAccessible::GetEditor() const
   editor->GetIsDocumentEditable(&isEditable);
   if (isEditable)
     return editor.forget();
 
   return nullptr;
 }
 
 // DocAccessible public method
+
+void
+DocAccessible::URL(nsAString& aURL) const
+{
+  nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
+  nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(container));
+  nsAutoCString theURL;
+  if (webNav) {
+    nsCOMPtr<nsIURI> pURI;
+    webNav->GetCurrentURI(getter_AddRefs(pURI));
+    if (pURI)
+      pURI->GetSpec(theURL);
+  }
+  CopyUTF8toUTF16(theURL, aURL);
+}
+
+void
+DocAccessible::DocType(nsAString& aType) const
+{
+#ifdef MOZ_XUL
+  nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocumentNode));
+  if (xulDoc) {
+    aType.AssignLiteral("window"); // doctype not implemented for XUL at time of writing - causes assertion
+    return;
+  }
+#endif
+  dom::DocumentType* docType = mDocumentNode->GetDoctype();
+  if (docType)
+    docType->GetPublicId(aType);
+}
+
 Accessible*
 DocAccessible::GetAccessible(nsINode* aNode) const
 {
   Accessible* accessible = mNodeToAccessibleMap.Get(aNode);
 
   // No accessible in the cache, check if the given ID is unique ID of this
   // document accessible.
   if (!accessible) {
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -1,17 +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/. */
 
 #ifndef mozilla_a11y_DocAccessible_h__
 #define mozilla_a11y_DocAccessible_h__
 
-#include "nsIAccessibleDocument.h"
+#include "xpcAccessibleDocument.h"
 #include "nsIAccessiblePivot.h"
 
 #include "AccEvent.h"
 #include "HyperTextAccessibleWrap.h"
 
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "nsIDocument.h"
@@ -33,28 +33,26 @@ namespace a11y {
 
 class DocManager;
 class NotificationController;
 class RelatedAccIterator;
 template<class Class, class Arg>
 class TNotification;
 
 class DocAccessible : public HyperTextAccessibleWrap,
-                      public nsIAccessibleDocument,
+                      public xpcAccessibleDocument,
                       public nsIDocumentObserver,
                       public nsIObserver,
                       public nsIScrollPositionListener,
                       public nsSupportsWeakReference,
                       public nsIAccessiblePivotObserver
 {
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DocAccessible, Accessible)
 
-  NS_DECL_NSIACCESSIBLEDOCUMENT
-
   NS_DECL_NSIOBSERVER
 
   NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
 
 public:
 
   DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                 nsIPresShell* aPresShell);
@@ -92,25 +90,50 @@ public:
   virtual nsRect RelativeBounds(nsIFrame** aRelativeFrame) const MOZ_OVERRIDE;
 
   // HyperTextAccessible
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
   // DocAccessible
 
   /**
+   * Return document URL.
+   */
+  void URL(nsAString& aURL) const;
+
+  /**
+   * Return DOM document title.
+   */
+  void Title(nsString& aTitle) const { mDocumentNode->GetTitle(aTitle); }
+
+  /**
+   * Return DOM document mime type.
+   */
+  void MimeType(nsAString& aType) const { mDocumentNode->GetContentType(aType); }
+
+  /**
+   * Return DOM document type.
+   */
+  void DocType(nsAString& aType) const;
+
+  /**
+   * Return virtual cursor associated with the document.
+   */
+  nsIAccessiblePivot* VirtualCursor();
+
+  /**
    * Return presentation shell for this document accessible.
    */
   nsIPresShell* PresShell() const { return mPresShell; }
 
   /**
    * Return the presentation shell's context.
    */
   nsPresContext* PresContext() const { return mPresShell->GetPresContext(); }
-    
+
   /**
    * Return true if associated DOM document was loaded and isn't unloading.
    */
   bool IsContentLoaded() const
   {
     // eDOMLoaded flag check is used for error pages as workaround to make this
     // method return correct result since error pages do not receive 'pageshow'
     // event and as consequence nsIDocument::IsShowing() returns false.
--- a/accessible/generic/ImageAccessible.cpp
+++ b/accessible/generic/ImageAccessible.cpp
@@ -141,43 +141,30 @@ ImageAccessible::DoAction(uint8_t aIndex
     return false;
 
   nsCOMPtr<nsIDOMWindow> tmp;
   return NS_SUCCEEDED(win->Open(spec, EmptyString(), EmptyString(),
                                 getter_AddRefs(tmp)));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsIAccessibleImage
+// ImageAccessible
 
-NS_IMETHODIMP
-ImageAccessible::GetImagePosition(uint32_t aCoordType, int32_t* aX, int32_t* aY)
+nsIntPoint
+ImageAccessible::Position(uint32_t aCoordType)
 {
-  NS_ENSURE_ARG_POINTER(aX);
-  NS_ENSURE_ARG_POINTER(aY);
-
   nsIntRect rect = Bounds();
-  *aX = rect.x;
-  *aY = rect.y;
-  nsAccUtils::ConvertScreenCoordsTo(aX, aY, aCoordType, this);
-
-  return NS_OK;
+  nsAccUtils::ConvertScreenCoordsTo(&rect.x, &rect.y, aCoordType, this);
+  return rect.TopLeft();
 }
 
-NS_IMETHODIMP
-ImageAccessible::GetImageSize(int32_t* aWidth, int32_t* aHeight)
+nsIntSize
+ImageAccessible::Size()
 {
-  NS_ENSURE_ARG_POINTER(aWidth);
-  NS_ENSURE_ARG_POINTER(aHeight);
-
-  nsIntRect rect = Bounds();
-  *aWidth = rect.width;
-  *aHeight = rect.height;
-
-  return NS_OK;
+  return Bounds().Size();
 }
 
 // Accessible
 already_AddRefed<nsIPersistentProperties>
 ImageAccessible::NativeAttributes()
 {
   nsCOMPtr<nsIPersistentProperties> attributes =
     LinkableAccessible::NativeAttributes();
--- a/accessible/generic/ImageAccessible.h
+++ b/accessible/generic/ImageAccessible.h
@@ -2,50 +2,51 @@
 /* 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_ImageAccessible_h__
 #define mozilla_a11y_ImageAccessible_h__
 
 #include "BaseAccessibles.h"
-#include "nsIAccessibleImage.h"
+#include "xpcAccessibleImage.h"
 
 class nsGenericHTMLElement;
 
 namespace mozilla {
 namespace a11y {
 
 /* Accessible for supporting images
  * supports:
  * - gets name, role
  * - support basic state
  */
 class ImageAccessible : public LinkableAccessible,
-                        public nsIAccessibleImage
+                        public xpcAccessibleImage
 {
 public:
   ImageAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
-  // nsIAccessibleImage
-  NS_DECL_NSIACCESSIBLEIMAGE
-
   // Accessible
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
+  // ImageAccessible
+  nsIntPoint Position(uint32_t aCoordType);
+  nsIntSize Size();
+
 protected:
   virtual ~ImageAccessible();
 
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
 private:
   /**
--- a/accessible/interfaces/nsIAccessibleDocument.idl
+++ b/accessible/interfaces/nsIAccessibleDocument.idl
@@ -1,33 +1,30 @@
 /* -*- 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 "nsISupports.idl"
 
-interface nsIAccessible;
 interface nsIAccessiblePivot;
 interface nsIDOMDocument;
-interface nsIDOMNode;
 interface nsIDOMWindow;
 
 /**
  * An interface for in-process accessibility clients
  * that wish to retrieve information about a document.
  * When accessibility is turned on in Gecko,
  * there is an nsIAccessibleDocument for each document
  * whether it is XUL, HTML or whatever.
  * You can QueryInterface to nsIAccessibleDocument from the nsIAccessible for
- * the root node of a document. You can also get one from 
- * nsIAccessible::GetAccessibleDocument() or 
- * nsIAccessibleEvent::GetAccessibleDocument()
+ * the root node of a document or you can get one from
+ * nsIAccessible::GetDocument().
  */
-[scriptable, uuid(fe5b3886-2b6a-491a-80cd-a3e6342c451d)]
+[scriptable, uuid(c80f6600-3210-4893-8f71-fde381ca39c9)]
 interface nsIAccessibleDocument : nsISupports
 {
   /**
    * The URL of the document
    */
   readonly attribute AString URL;
 
   /**
@@ -51,27 +48,16 @@ interface nsIAccessibleDocument : nsISup
   readonly attribute nsIDOMDocument DOMDocument;
 
   /**
    * The nsIDOMWindow that the document resides in.
    */
   readonly attribute nsIDOMWindow window;
 
   /**
-   * The namespace for each ID that is handed back.
-   */
-  AString getNameSpaceURIForID(in short nameSpaceID);
-
-  /**
-   * The window handle for the OS window the document is being displayed in.
-   * For example, in Windows you can static cast it to an HWND.
-   */
-  [noscript] readonly attribute voidPtr windowHandle;
-
-  /**
    * Return the parent document accessible.
    */
   readonly attribute nsIAccessibleDocument parentDocument;
 
   /**
    * Return the count of child document accessibles.
    */
   readonly attribute unsigned long childDocumentCount;
@@ -79,10 +65,11 @@ interface nsIAccessibleDocument : nsISup
   /**
    * The virtual cursor pivot this document manages.
    */
   readonly attribute nsIAccessiblePivot virtualCursor;
 
   /**
    * Return the child document accessible at the given index.
    */
+  [binaryname(ScriptableGetChildDocumentAt)]
   nsIAccessibleDocument getChildDocumentAt(in unsigned long index);
 };
--- a/accessible/windows/msaa/ApplicationAccessibleWrap.cpp
+++ b/accessible/windows/msaa/ApplicationAccessibleWrap.cpp
@@ -74,20 +74,17 @@ ApplicationAccessibleWrap::get_appName(B
     return E_INVALIDARG;
 
   *aName = nullptr;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString name;
-  nsresult rv = GetAppName(name);
-  if (NS_FAILED(rv))
-    return GetHRESULT(rv);
-
+  AppName(name);
   if (name.IsEmpty())
     return S_FALSE;
 
   *aName = ::SysAllocStringLen(name.get(), name.Length());
   return *aName ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
@@ -101,20 +98,17 @@ ApplicationAccessibleWrap::get_appVersio
     return E_INVALIDARG;
 
   *aVersion = nullptr;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString version;
-  nsresult rv = GetAppVersion(version);
-  if (NS_FAILED(rv))
-    return GetHRESULT(rv);
-
+  AppVersion(version);
   if (version.IsEmpty())
     return S_FALSE;
 
   *aVersion = ::SysAllocStringLen(version.get(), version.Length());
   return *aVersion ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
@@ -126,20 +120,17 @@ ApplicationAccessibleWrap::get_toolkitNa
 
   if (!aName)
     return E_INVALIDARG;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString name;
-  nsresult rv = GetPlatformName(name);
-  if (NS_FAILED(rv))
-    return GetHRESULT(rv);
-
+  PlatformName(name);
   if (name.IsEmpty())
     return S_FALSE;
 
   *aName = ::SysAllocStringLen(name.get(), name.Length());
   return *aName ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
@@ -153,20 +144,17 @@ ApplicationAccessibleWrap::get_toolkitVe
     return E_INVALIDARG;
 
   *aVersion = nullptr;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString version;
-  nsresult rv = GetPlatformVersion(version);
-  if (NS_FAILED(rv))
-    return GetHRESULT(rv);
-
+  PlatformVersion(version);
   if (version.IsEmpty())
     return S_FALSE;
 
   *aVersion = ::SysAllocStringLen(version.get(), version.Length());
   return *aVersion ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
--- a/accessible/windows/msaa/DocAccessibleWrap.cpp
+++ b/accessible/windows/msaa/DocAccessibleWrap.cpp
@@ -56,26 +56,26 @@ DocAccessibleWrap::get_accValue(VARIANT 
   // For backwards-compat, we still support old MSAA hack to provide URL in accValue
   // Check for real value first
   HRESULT hr = AccessibleWrap::get_accValue(aVarChild, aValue);
   if (FAILED(hr) || *aValue || aVarChild.lVal != CHILDID_SELF)
     return hr;
 
   // If document is being used to create a widget, don't use the URL hack
   roles::Role role = Role();
-  if (role != roles::DOCUMENT && role != roles::APPLICATION && 
-      role != roles::DIALOG && role != roles::ALERT) 
+  if (role != roles::DOCUMENT && role != roles::APPLICATION &&
+      role != roles::DIALOG && role != roles::ALERT)
     return hr;
 
-  nsAutoString URL;
-  nsresult rv = GetURL(URL);
-  if (URL.IsEmpty())
+  nsAutoString url;
+  URL(url);
+  if (url.IsEmpty())
     return S_FALSE;
 
-  *aValue = ::SysAllocStringLen(URL.get(), URL.Length());
+  *aValue = ::SysAllocStringLen(url.get(), url.Length());
   return *aValue ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible
 
--- a/accessible/windows/sdn/sdnDocAccessible.cpp
+++ b/accessible/windows/sdn/sdnDocAccessible.cpp
@@ -3,16 +3,18 @@
 /* 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 "sdnDocAccessible.h"
 
 #include "ISimpleDOMDocument_i.c"
 
+#include "nsNameSpaceManager.h"
+
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // sdnDocAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 IMPL_IUNKNOWN_QUERY_HEAD(sdnDocAccessible)
@@ -27,20 +29,17 @@ sdnDocAccessible::get_URL(BSTR __RPC_FAR
   if (!aURL)
     return E_INVALIDARG;
   *aURL = nullptr;
 
   if (mAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString URL;
-  nsresult rv = mAccessible->GetURL(URL);
-  if (NS_FAILED(rv))
-    return E_FAIL;
-
+  mAccessible->URL(URL);
   if (URL.IsEmpty())
     return S_FALSE;
 
   *aURL = ::SysAllocStringLen(URL.get(), URL.Length());
   return *aURL ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
@@ -53,20 +52,17 @@ sdnDocAccessible::get_title(BSTR __RPC_F
   if (!aTitle)
     return E_INVALIDARG;
   *aTitle = nullptr;
 
   if (mAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString title;
-  nsresult rv = mAccessible->GetTitle(title);
-  if (NS_FAILED(rv))
-    return E_FAIL;
-
+  mAccessible->Title(title);
   *aTitle = ::SysAllocStringLen(title.get(), title.Length());
   return *aTitle ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 sdnDocAccessible::get_mimeType(BSTR __RPC_FAR* aMimeType)
@@ -132,19 +128,19 @@ sdnDocAccessible::get_nameSpaceURIForID(
 
   if (mAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (aNameSpaceID < 0)
     return E_INVALIDARG;  // -1 is kNameSpaceID_Unknown
 
   nsAutoString nameSpaceURI;
-  nsresult rv = mAccessible->GetNameSpaceURIForID(aNameSpaceID, nameSpaceURI);
-  if (NS_FAILED(rv))
-    return E_FAIL;
+  nsNameSpaceManager* nameSpaceManager = nsNameSpaceManager::GetInstance();
+  if (nameSpaceManager)
+    nameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpaceURI);
 
   if (nameSpaceURI.IsEmpty())
     return S_FALSE;
 
   *aNameSpaceURI = ::SysAllocStringLen(nameSpaceURI.get(),
                                        nameSpaceURI.Length());
 
   return *aNameSpaceURI ? S_OK : E_OUTOFMEMORY;
--- a/accessible/xpcom/moz.build
+++ b/accessible/xpcom/moz.build
@@ -1,27 +1,31 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 EXPORTS += [
     'xpcAccessible.h',
+    'xpcAccessibleDocument.h',
     'xpcAccessibleHyperLink.h',
     'xpcAccessibleHyperText.h',
     'xpcAccessibleSelectable.h',
     'xpcAccessibleValue.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsAccessibleRelation.cpp',
     'xpcAccessible.cpp',
+    'xpcAccessibleApplication.cpp',
+    'xpcAccessibleDocument.cpp',
     'xpcAccessibleHyperLink.cpp',
     'xpcAccessibleHyperText.cpp',
+    'xpcAccessibleImage.cpp',
     'xpcAccessibleSelectable.cpp',
     'xpcAccessibleTable.cpp',
     'xpcAccessibleTableCell.cpp',
     'xpcAccessibleTextRange.cpp',
     'xpcAccessibleValue.cpp',
 ]
 
 GENERATED_SOURCES += [
new file mode 100644
--- /dev/null
+++ b/accessible/xpcom/xpcAccessibleApplication.cpp
@@ -0,0 +1,59 @@
+/* -*- 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 "xpcAccessibleApplication.h"
+
+#include "ApplicationAccessible.h"
+
+using namespace mozilla::a11y;
+
+NS_IMETHODIMP
+xpcAccessibleApplication::GetAppName(nsAString& aName)
+{
+  aName.Truncate();
+
+  if (static_cast<ApplicationAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  static_cast<ApplicationAccessible*>(this)->AppName(aName);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleApplication::GetAppVersion(nsAString& aVersion)
+{
+  aVersion.Truncate();
+
+  if (static_cast<ApplicationAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  static_cast<ApplicationAccessible*>(this)->AppVersion(aVersion);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleApplication::GetPlatformName(nsAString& aName)
+{
+  aName.Truncate();
+
+  if (static_cast<ApplicationAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  static_cast<ApplicationAccessible*>(this)->PlatformName(aName);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleApplication::GetPlatformVersion(nsAString& aVersion)
+{
+  aVersion.Truncate();
+
+  if (static_cast<ApplicationAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  static_cast<ApplicationAccessible*>(this)->PlatformVersion(aVersion);
+  return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/accessible/xpcom/xpcAccessibleApplication.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_a11y_xpcAccessibleApplication_h_
+#define mozilla_a11y_xpcAccessibleApplication_h_
+
+#include "nsIAccessibleApplication.h"
+
+class nsIAccessible;
+
+namespace mozilla {
+namespace a11y {
+
+class xpcAccessibleApplication : public nsIAccessibleApplication
+{
+public:
+  NS_IMETHOD GetAppName(nsAString& aName) MOZ_FINAL;
+  NS_IMETHOD GetAppVersion(nsAString& aVersion) MOZ_FINAL;
+  NS_IMETHOD GetPlatformName(nsAString& aName) MOZ_FINAL;
+  NS_IMETHOD GetPlatformVersion(nsAString& aVersion) MOZ_FINAL;
+
+private:
+  xpcAccessibleApplication() { }
+  friend class ApplicationAccessible;
+
+  xpcAccessibleApplication(const xpcAccessibleApplication&) MOZ_DELETE;
+  xpcAccessibleApplication& operator =(const xpcAccessibleApplication&) MOZ_DELETE;
+};
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif
new file mode 100644
--- /dev/null
+++ b/accessible/xpcom/xpcAccessibleDocument.cpp
@@ -0,0 +1,135 @@
+/* -*- 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 "xpcAccessibleDocument.h"
+
+#include "DocAccessible-inl.h"
+#include "nsIDOMDocument.h"
+
+using namespace mozilla::a11y;
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetURL(nsAString& aURL)
+{
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  static_cast<DocAccessible*>(this)->URL(aURL);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetTitle(nsAString& aTitle)
+{
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  nsAutoString title;
+  static_cast<DocAccessible*>(this)->Title(title);
+  aTitle = title;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetMimeType(nsAString& aType)
+{
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  static_cast<DocAccessible*>(this)->MimeType(aType);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetDocType(nsAString& aType)
+{
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  static_cast<DocAccessible*>(this)->DocType(aType);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetDOMDocument(nsIDOMDocument** aDOMDocument)
+{
+  NS_ENSURE_ARG_POINTER(aDOMDocument);
+  *aDOMDocument = nullptr;
+
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  if (static_cast<DocAccessible*>(this)->DocumentNode())
+    CallQueryInterface(static_cast<DocAccessible*>(this)->DocumentNode(), aDOMDocument);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetWindow(nsIDOMWindow** aDOMWindow)
+{
+  NS_ENSURE_ARG_POINTER(aDOMWindow);
+  *aDOMWindow = nullptr;
+
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  NS_IF_ADDREF(*aDOMWindow = static_cast<DocAccessible*>(this)->DocumentNode()->GetWindow());
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetParentDocument(nsIAccessibleDocument** aDocument)
+{
+  NS_ENSURE_ARG_POINTER(aDocument);
+  *aDocument = nullptr;
+
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  NS_IF_ADDREF(*aDocument = static_cast<DocAccessible*>(this)->ParentDocument());
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetChildDocumentCount(uint32_t* aCount)
+{
+  NS_ENSURE_ARG_POINTER(aCount);
+  *aCount = 0;
+
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  *aCount = static_cast<DocAccessible*>(this)->ChildDocumentCount();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::ScriptableGetChildDocumentAt(uint32_t aIndex,
+                                                    nsIAccessibleDocument** aDocument)
+{
+  NS_ENSURE_ARG_POINTER(aDocument);
+  *aDocument = nullptr;
+
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  NS_IF_ADDREF(*aDocument = static_cast<DocAccessible*>(this)->GetChildDocumentAt(aIndex));
+  return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
+}
+
+NS_IMETHODIMP
+xpcAccessibleDocument::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
+{
+  NS_ENSURE_ARG_POINTER(aVirtualCursor);
+  *aVirtualCursor = nullptr;
+
+  if (static_cast<DocAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  NS_ADDREF(*aVirtualCursor = static_cast<DocAccessible*>(this)->VirtualCursor());
+  return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/accessible/xpcom/xpcAccessibleDocument.h
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_a11y_xpcAccessibleDocument_h_
+#define mozilla_a11y_xpcAccessibleDocument_h_
+
+#include "nsIAccessibleDocument.h"
+
+namespace mozilla {
+namespace a11y {
+
+class xpcAccessibleDocument : public nsIAccessibleDocument
+{
+public:
+  NS_IMETHOD GetURL(nsAString& aURL) MOZ_FINAL;
+  NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL;
+  NS_IMETHOD GetMimeType(nsAString& aType) MOZ_FINAL;
+  NS_IMETHOD GetDocType(nsAString& aType) MOZ_FINAL;
+  NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDOMDocument) MOZ_FINAL;
+  NS_IMETHOD GetWindow(nsIDOMWindow** aDOMWindow) MOZ_FINAL;
+  NS_IMETHOD GetParentDocument(nsIAccessibleDocument** aDocument) MOZ_FINAL;
+  NS_IMETHOD GetChildDocumentCount(uint32_t* aCount) MOZ_FINAL;
+  NS_IMETHOD ScriptableGetChildDocumentAt(uint32_t aIndex,
+                                          nsIAccessibleDocument** aDocument) MOZ_FINAL;
+  NS_IMETHOD GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) MOZ_FINAL;
+
+private:
+  friend class DocAccessible;
+
+  xpcAccessibleDocument() { }
+
+  xpcAccessibleDocument(const xpcAccessibleDocument&) MOZ_DELETE;
+  xpcAccessibleDocument& operator =(const xpcAccessibleDocument&) MOZ_DELETE;
+};
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif
new file mode 100644
--- /dev/null
+++ b/accessible/xpcom/xpcAccessibleImage.cpp
@@ -0,0 +1,44 @@
+/* -*- 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 "xpcAccessibleImage.h"
+
+#include "ImageAccessible.h"
+
+using namespace mozilla::a11y;
+
+NS_IMETHODIMP
+xpcAccessibleImage::GetImagePosition(uint32_t aCoordType, int32_t* aX, int32_t* aY)
+{
+  NS_ENSURE_ARG_POINTER(aX);
+  *aX = 0;
+  NS_ENSURE_ARG_POINTER(aY);
+  *aY = 0;
+
+  if (static_cast<ImageAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  nsIntPoint point = static_cast<ImageAccessible*>(this)->Position(aCoordType);
+  *aX = point.x; *aY = point.y;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+xpcAccessibleImage::GetImageSize(int32_t* aWidth, int32_t* aHeight)
+{
+  NS_ENSURE_ARG_POINTER(aWidth);
+  *aWidth = 0;
+  NS_ENSURE_ARG_POINTER(aHeight);
+  *aHeight = 0;
+
+  if (static_cast<ImageAccessible*>(this)->IsDefunct())
+    return NS_ERROR_FAILURE;
+
+  nsIntSize size = static_cast<ImageAccessible*>(this)->Size();
+  *aWidth = size.width;
+  *aHeight = size.height;
+  return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/accessible/xpcom/xpcAccessibleImage.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_a11y_xpcAccessibleImage_h_
+#define mozilla_a11y_xpcAccessibleImage_h_
+
+#include "nsIAccessibleImage.h"
+
+namespace mozilla {
+namespace a11y {
+
+class xpcAccessibleImage : public nsIAccessibleImage
+{
+public:
+  NS_IMETHOD GetImagePosition(uint32_t aCoordType,
+                              int32_t* aX, int32_t* aY) MOZ_FINAL;
+  NS_IMETHOD GetImageSize(int32_t* aWidth, int32_t* aHeight) MOZ_FINAL;
+
+private:
+  friend class ImageAccessible;
+
+  xpcAccessibleImage() { }
+
+  xpcAccessibleImage(const xpcAccessibleImage&) MOZ_DELETE;
+  xpcAccessibleImage& operator =(const xpcAccessibleImage&) MOZ_DELETE;
+};
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif