bug 1209615 - add RootAccessible::GetPrimaryRemoteTopLevelContentDoc() r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Tue, 06 Oct 2015 14:00:20 -0400
changeset 266686 605191307c3a7530db1172f51039c5bee01499c1
parent 266685 61a73fb354823369942af685d267837a13d5d8ae
child 266687 81ed1750e33aab9f2fcdc3834e79e7a3168daa60
push id66255
push usertsaunders@mozilla.com
push dateWed, 07 Oct 2015 22:27:42 +0000
treeherdermozilla-inbound@f48787d52534 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1209615
milestone44.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 1209615 - add RootAccessible::GetPrimaryRemoteTopLevelContentDoc() r=davidb
accessible/generic/RootAccessible.cpp
accessible/generic/RootAccessible.h
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -711,8 +711,25 @@ RootAccessible::HandleTreeInvalidatedEve
   propBag->GetPropertyAsInt32(NS_LITERAL_STRING("startcolumn"),
                               &startCol);
   propBag->GetPropertyAsInt32(NS_LITERAL_STRING("endcolumn"),
                               &endCol);
 
   aAccessible->TreeViewInvalidated(startRow, endRow, startCol, endCol);
 }
 #endif
+
+ProxyAccessible*
+RootAccessible::GetPrimaryRemoteTopLevelContentDoc() const
+{
+  nsCOMPtr<nsIDocShellTreeOwner> owner;
+  mDocumentNode->GetDocShell()->GetTreeOwner(getter_AddRefs(owner));
+  NS_ENSURE_TRUE(owner, nullptr);
+
+  nsCOMPtr<nsITabParent> tabParent;
+  owner->GetPrimaryTabParent(getter_AddRefs(tabParent));
+  if (!tabParent) {
+    return nullptr;
+  }
+
+  auto tab = static_cast<dom::TabParent*>(tabParent.get());
+  return tab->GetTopLevelDocAccessible();
+}
--- a/accessible/generic/RootAccessible.h
+++ b/accessible/generic/RootAccessible.h
@@ -37,16 +37,21 @@ public:
 
   // RootAccessible
 
   /**
    * Notify that the sub document presshell was activated.
    */
   virtual void DocumentActivated(DocAccessible* aDocument);
 
+  /**
+   * Return the primary remote top level document if any.
+   */
+  ProxyAccessible* GetPrimaryRemoteTopLevelContentDoc() const;
+
 protected:
   virtual ~RootAccessible();
 
   /**
    * Add/remove DOM event listeners.
    */
   virtual nsresult AddEventListeners() override;
   virtual nsresult RemoveEventListeners() override;