Bug 721947 - use nsIPresShell instead of nsIWeakShell. r=surkov
authorHub Figuière <hfiguiere@mozilla.com>
Thu, 09 Feb 2012 08:49:17 -0800
changeset 86542 7a93dc11d7b7b585db36c0316d01be458e9ecf40
parent 86541 f72a9d8fd21d27a80bb2158a8708c0db7819329a
child 86543 1a01259eb5c8daa732b44db34cba0f6af07e22a2
push id525
push usertim.taubert@gmx.de
push dateFri, 10 Feb 2012 13:27:32 +0000
treeherderfx-team@157ec7365fb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs721947
milestone13.0a1
Bug 721947 - use nsIPresShell instead of nsIWeakShell. r=surkov
accessible/public/nsIAccessibilityService.h
accessible/src/atk/nsDocAccessibleWrap.cpp
accessible/src/atk/nsDocAccessibleWrap.h
accessible/src/base/AccEvent.cpp
accessible/src/base/AccIterator.cpp
accessible/src/base/Relation.h
accessible/src/base/nsAccDocManager.cpp
accessible/src/base/nsAccTreeWalker.cpp
accessible/src/base/nsAccTreeWalker.h
accessible/src/base/nsAccUtils.cpp
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessibilityService.h
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsCoreUtils.h
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsDocAccessible.h
accessible/src/base/nsRootAccessible.cpp
accessible/src/base/nsRootAccessible.h
accessible/src/base/nsTextEquivUtils.cpp
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/mac/nsDocAccessibleWrap.h
accessible/src/mac/nsDocAccessibleWrap.mm
accessible/src/mac/nsRootAccessibleWrap.h
accessible/src/mac/nsRootAccessibleWrap.mm
accessible/src/msaa/nsDocAccessibleWrap.cpp
accessible/src/msaa/nsDocAccessibleWrap.h
accessible/src/msaa/nsRootAccessibleWrap.cpp
accessible/src/msaa/nsRootAccessibleWrap.h
accessible/src/other/nsRootAccessibleWrap.cpp
accessible/src/other/nsRootAccessibleWrap.h
accessible/src/xforms/nsXFormsAccessible.cpp
accessible/src/xul/nsXULColorPickerAccessible.cpp
accessible/src/xul/nsXULFormControlAccessible.cpp
accessible/src/xul/nsXULListboxAccessible.cpp
accessible/src/xul/nsXULMenuAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.cpp
--- a/accessible/public/nsIAccessibilityService.h
+++ b/accessible/public/nsIAccessibilityService.h
@@ -66,18 +66,18 @@ public:
 
   /**
    * Return an accessible object for a DOM node in the given pres shell.
    *
    * @param  aNode      [in] the DOM node to get an accessible for
    * @param  aPresShell [in] the presentation shell which contains layout info
    *                         for the DOM node
    */
-  virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
-                                             nsIPresShell* aPresShell) = 0;
+  virtual nsAccessible* GetAccessible(nsINode* aNode,
+                                      nsIPresShell* aPresShell) = 0;
 
   /**
    * Return root document accessible that is or contains a document accessible
    * for the given presshell.
    *
    * @param aPresShell  [in] the presshell
    * @param aCanCreate  [in] points whether the root document accessible
    *                        should be returned from the cache or can be created
--- a/accessible/src/atk/nsDocAccessibleWrap.cpp
+++ b/accessible/src/atk/nsDocAccessibleWrap.cpp
@@ -42,18 +42,18 @@
 #include "nsMai.h"
 #include "nsDocAccessibleWrap.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsDocAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 nsDocAccessibleWrap::
-    nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                        nsIWeakReference *aShell) :
-    nsDocAccessible(aDocument, aRootContent, aShell), mActivated(false)
+  nsDocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                      nsIPresShell* aPresShell) :
+  nsDocAccessible(aDocument, aRootContent, aPresShell), mActivated(false)
 {
 }
 
 nsDocAccessibleWrap::~nsDocAccessibleWrap()
 {
 }
 
--- a/accessible/src/atk/nsDocAccessibleWrap.h
+++ b/accessible/src/atk/nsDocAccessibleWrap.h
@@ -45,16 +45,16 @@
 #ifndef _nsDocAccessibleWrap_H_
 #define _nsDocAccessibleWrap_H_
 
 #include "nsDocAccessible.h"
 
 class nsDocAccessibleWrap: public nsDocAccessible
 {
 public:
-  nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                      nsIWeakReference *aShell);
+  nsDocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                      nsIPresShell* aPresShell);
   virtual ~nsDocAccessibleWrap();
 
   bool mActivated;
 };
 
 #endif
--- a/accessible/src/base/AccEvent.cpp
+++ b/accessible/src/base/AccEvent.cpp
@@ -134,17 +134,17 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(Acc
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccEvent protected methods
 
 nsAccessible*
 AccEvent::GetAccessibleForNode() const
 {
-  return mNode ? GetAccService()->GetAccessible(mNode) : nsnull;
+  return mNode ? GetAccService()->GetAccessible(mNode, nsnull) : nsnull;
 }
 
 void
 AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
 {
   nsINode *targetNode = GetNode();
 
 #ifdef DEBUG
--- a/accessible/src/base/AccIterator.cpp
+++ b/accessible/src/base/AccIterator.cpp
@@ -339,17 +339,17 @@ IDRefsIterator::GetElem(const nsDependen
 
   return mDocument->GetElementById(aID);
 }
 
 nsAccessible*
 IDRefsIterator::Next()
 {
   nsIContent* nextElm = NextElem();
-  return nextElm ? GetAccService()->GetAccessible(nextElm) : nsnull;
+  return nextElm ? GetAccService()->GetAccessible(nextElm, nsnull) : nsnull;
 }
 
 nsAccessible*
 SingleAccIterator::Next()
 {
   nsRefPtr<nsAccessible> nextAcc;
   mAcc.swap(nextAcc);
   return (nextAcc && !nextAcc->IsDefunct()) ? nextAcc : nsnull;
--- a/accessible/src/base/Relation.h
+++ b/accessible/src/base/Relation.h
@@ -118,17 +118,17 @@ public:
 
   /**
    * Append the one accessible for this content node to the set of related
    * accessibles.
    */
   inline void AppendTarget(nsIContent* aContent)
   {
     if (aContent)
-      AppendTarget(GetAccService()->GetAccessible(aContent));
+      AppendTarget(GetAccService()->GetAccessible(aContent, nsnull));
   }
 
   /**
    * compute and return the next related accessible.
    */
   inline nsAccessible* Next()
   {
     nsAccessible* target = nsnull;
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -376,32 +376,28 @@ nsAccDocManager::CreateDocOrRootAccessib
     return nsnull;
 
   bool isRootDoc = nsCoreUtils::IsRootDocument(aDocument);
 
   nsDocAccessible* parentDocAcc = nsnull;
   if (!isRootDoc) {
     // XXXaaronl: ideally we would traverse the presshell chain. Since there's
     // no easy way to do that, we cheat and use the document hierarchy.
-    // GetAccessible() is bad because it doesn't support our concept of multiple
-    // presshells per doc. It should be changed to use
-    // GetAccessibleInWeakShell().
     parentDocAcc = GetDocAccessible(aDocument->GetParentDocument());
     NS_ASSERTION(parentDocAcc,
                  "Can't create an accessible for the document!");
     if (!parentDocAcc)
       return nsnull;
   }
 
   // We only create root accessibles for the true root, otherwise create a
   // doc accessible.
-  nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(presShell));
   nsRefPtr<nsDocAccessible> docAcc = isRootDoc ?
-    new nsRootAccessibleWrap(aDocument, rootElm, weakShell) :
-    new nsDocAccessibleWrap(aDocument, rootElm, weakShell);
+    new nsRootAccessibleWrap(aDocument, rootElm, presShell) :
+    new nsDocAccessibleWrap(aDocument, rootElm, presShell);
 
   // Cache the document accessible into document cache.
   if (!docAcc || !mDocAccessibleCache.Put(aDocument, docAcc))
     return nsnull;
 
   // Initialize the document accessible.
   if (!docAcc->Init()) {
     docAcc->Shutdown();
--- a/accessible/src/base/nsAccTreeWalker.cpp
+++ b/accessible/src/base/nsAccTreeWalker.cpp
@@ -36,19 +36,19 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAccTreeWalker.h"
 
 #include "nsAccessible.h"
 #include "nsAccessibilityService.h"
+#include "nsDocAccessible.h"
 
 #include "nsINodeList.h"
-#include "nsIPresShell.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // WalkState
 ////////////////////////////////////////////////////////////////////////////////
 
 struct WalkState
 {
   WalkState(nsIContent *aContent) :
@@ -60,19 +60,19 @@ struct WalkState
   WalkState *prevState;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccTreeWalker
 ////////////////////////////////////////////////////////////////////////////////
 
 nsAccTreeWalker::
-  nsAccTreeWalker(nsIWeakReference* aShell, nsIContent* aContent,
+  nsAccTreeWalker(nsDocAccessible* aDoc, nsIContent* aContent,
                   bool aWalkAnonContent, bool aWalkCache) :
-  mWeakShell(aShell), mWalkCache(aWalkCache), mState(nsnull)
+  mDoc(aDoc), mWalkCache(aWalkCache), mState(nsnull)
 {
   NS_ASSERTION(aContent, "No node for the accessible tree walker!");
 
   if (aContent)
     mState = new WalkState(aContent);
 
   mChildFilter = aWalkAnonContent ? nsIContent::eAllChildren :
                                   nsIContent::eAllButXBL;
@@ -98,31 +98,27 @@ nsAccessible*
 nsAccTreeWalker::NextChildInternal(bool aNoWalkUp)
 {
   if (!mState || !mState->content)
     return nsnull;
 
   if (!mState->childList)
     mState->childList = mState->content->GetChildren(mChildFilter);
 
-  nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
-
   PRUint32 length = 0;
   if (mState->childList)
     mState->childList->GetLength(&length);
 
   while (mState->childIdx < length) {
     nsIContent* childNode = mState->childList->GetNodeAt(mState->childIdx);
     mState->childIdx++;
 
     bool isSubtreeHidden = false;
-    nsAccessible* accessible = mWalkCache ?
-      GetAccService()->GetAccessibleInWeakShell(childNode, mWeakShell) :
-      GetAccService()->GetOrCreateAccessible(childNode, presShell, mWeakShell,
-                                             &isSubtreeHidden);
+    nsAccessible* accessible = mWalkCache ? mDoc->GetAccessible(childNode) :
+      GetAccService()->GetOrCreateAccessible(childNode, mDoc, &isSubtreeHidden);
 
     if (accessible)
       return accessible;
 
     // Walk down into subtree to find accessibles.
     if (!isSubtreeHidden) {
       if (!PushState(childNode))
         break;
--- a/accessible/src/base/nsAccTreeWalker.h
+++ b/accessible/src/base/nsAccTreeWalker.h
@@ -37,28 +37,28 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsAccTreeWalker_H_
 #define _nsAccTreeWalker_H_
 
 #include "nsAutoPtr.h"
 #include "nsIContent.h"
-#include "nsIWeakReference.h"
 
 class nsAccessible;
+class nsDocAccessible;
 struct WalkState;
 
 /**
  * This class is used to walk the DOM tree to create accessible tree.
  */
 class nsAccTreeWalker
 {
 public:
-  nsAccTreeWalker(nsIWeakReference *aShell, nsIContent *aNode, 
+  nsAccTreeWalker(nsDocAccessible* aDoc, nsIContent* aNode, 
                   bool aWalkAnonymousContent, bool aWalkCache = false);
   virtual ~nsAccTreeWalker();
 
   /**
    * Return the next child accessible.
    *
    * @note Returned accessible is bound to the document, if the accessible is
    *       rejected during tree creation then the caller should be unbind it
@@ -88,15 +88,15 @@ private:
    */
   bool PushState(nsIContent *aNode);
 
   /**
    * Pop state from stack.
    */
   void PopState();
 
-  nsCOMPtr<nsIWeakReference> mWeakShell;
+  nsDocAccessible* mDoc;
   PRInt32 mChildFilter;
   bool mWalkCache;
   WalkState* mState;
 };
 
 #endif 
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -158,17 +158,17 @@ nsAccUtils::GetPositionAndSizeForXULSele
   *aPosInSet = indexOf;
 
   for (PRUint32 index = 0; index < itemsCount; index++) {
     nsCOMPtr<nsIDOMXULSelectControlItemElement> currItem;
     control->GetItemAtIndex(index, getter_AddRefs(currItem));
     nsCOMPtr<nsINode> currNode(do_QueryInterface(currItem));
 
     nsAccessible* itemAcc = currNode ?
-      GetAccService()->GetAccessible(currNode) : nsnull;
+      GetAccService()->GetAccessible(currNode, nsnull) : nsnull;
 
     if (!itemAcc || itemAcc->State() & states::INVISIBLE) {
       (*aSetSize)--;
       if (index < static_cast<PRUint32>(indexOf))
         (*aPosInSet)--;
     }
   }
 
@@ -200,17 +200,17 @@ nsAccUtils::GetPositionAndSizeForXULCont
   // Calculate set size and position in the set.
   *aSetSize = 0, *aPosInSet = 0;
   for (PRInt32 index = indexOf; index >= 0; index--) {
     nsCOMPtr<nsIDOMXULElement> item;
     container->GetItemAtIndex(index, getter_AddRefs(item));
     nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
 
     nsAccessible* itemAcc = itemNode ?
-      GetAccService()->GetAccessible(itemNode) : nsnull;
+      GetAccService()->GetAccessible(itemNode, nsnull) : nsnull;
 
     if (itemAcc) {
       PRUint32 itemRole = Role(itemAcc);
       if (itemRole == nsIAccessibleRole::ROLE_SEPARATOR)
         break; // We reached the beginning of our group.
 
       if (!(itemAcc->State() & states::INVISIBLE)) {
         (*aSetSize)++;
@@ -221,17 +221,17 @@ nsAccUtils::GetPositionAndSizeForXULCont
 
   for (PRInt32 index = indexOf + 1; index < static_cast<PRInt32>(itemsCount);
        index++) {
     nsCOMPtr<nsIDOMXULElement> item;
     container->GetItemAtIndex(index, getter_AddRefs(item));
     nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
 
     nsAccessible* itemAcc =
-      itemNode ? GetAccService()->GetAccessible(itemNode) : nsnull;
+      itemNode ? GetAccService()->GetAccessible(itemNode, nsnull) : nsnull;
 
     if (itemAcc) {
       PRUint32 itemRole = Role(itemAcc);
       if (itemRole == nsIAccessibleRole::ROLE_SEPARATOR)
         break; // We reached the end of our group.
 
       if (!(itemAcc->State() & states::INVISIBLE))
         (*aSetSize)++;
@@ -384,17 +384,17 @@ nsAccUtils::GetSelectableContainer(nsAcc
       return nsnull;
   }
   return parent;
 }
 
 nsAccessible*
 nsAccUtils::GetMultiSelectableContainer(nsINode* aNode)
 {
-  nsAccessible* accessible = GetAccService()->GetAccessible(aNode);
+  nsAccessible* accessible = GetAccService()->GetAccessible(aNode, nsnull);
   if (accessible) {
     nsAccessible* container = GetSelectableContainer(accessible,
                                                      accessible->State());
     if (container && container->State() & states::MULTISELECTABLE)
       return container;
   }
 
   return nsnull;
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -690,17 +690,17 @@ nsAccessibilityService::GetAccessibleFor
   *aAccessible = nsnull;
   if (!aNode)
     return NS_OK;
 
   nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
   if (!node)
     return NS_ERROR_INVALID_ARG;
 
-  NS_IF_ADDREF(*aAccessible = GetAccessible(node));
+  NS_IF_ADDREF(*aAccessible = GetAccessible(node, nsnull));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
 {
   if ( aRole >= ArrayLength(kRoleNames)) {
     aString.AssignLiteral("unknown");
@@ -901,36 +901,25 @@ nsAccessibilityService::CreateAccessible
   NS_ENSURE_TRUE(accessibleRoot, NS_ERROR_INVALID_ARG);
 
   nsAccessiblePivot* pivot = new nsAccessiblePivot(accessibleRoot);
   NS_ADDREF(*aPivot = pivot);
 
   return NS_OK;
 }
 
-// nsIAccesibilityService
-nsAccessible*
-nsAccessibilityService::GetAccessibleInShell(nsINode* aNode,
-                                             nsIPresShell* aPresShell)
-{
-  if (!aNode || !aPresShell)
-    return nsnull;
-
-  nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
-  return GetAccessibleInWeakShell(aNode, weakShell);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibilityService public
 
 nsAccessible*
-nsAccessibilityService::GetAccessible(nsINode* aNode)
+nsAccessibilityService::GetAccessible(nsINode* aNode, nsIPresShell* aPresShell)
 {
   NS_PRECONDITION(aNode, "Getting an accessible for null node! Crash.");
 
+  // XXX handle the presshell
   nsDocAccessible* document = GetDocAccessible(aNode->OwnerDoc());
   return document ? document->GetAccessible(aNode) : nsnull;
 }
 
 nsAccessible*
 nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode, nsDocAccessible* aDoc)
 {
   if (!aNode)
@@ -951,28 +940,27 @@ static bool HasRelatedContent(nsIContent
   // If the given ID is referred by relation attribute then create an accessible
   // for it. Take care of HTML elements only for now.
   return aContent->IsHTML() &&
     nsAccUtils::GetDocAccessibleFor(aContent)->IsDependentID(id);
 }
 
 nsAccessible*
 nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
-                                              nsIPresShell* aPresShell,
-                                              nsIWeakReference* aWeakShell,
+                                              nsDocAccessible* aDoc,
                                               bool* aIsSubtreeHidden)
 {
-  if (!aPresShell || !aWeakShell || !aNode || gIsShutdown)
+  if (!aDoc || !aNode || gIsShutdown)
     return nsnull;
 
   if (aIsSubtreeHidden)
     *aIsSubtreeHidden = false;
 
   // Check to see if we already have an accessible for this node in the cache.
-  nsAccessible* cachedAccessible = GetAccessibleInWeakShell(aNode, aWeakShell);
+  nsAccessible* cachedAccessible = aDoc->GetAccessible(aNode);
   if (cachedAccessible)
     return cachedAccessible;
 
   // No cache entry, so we must create the accessible.
 
   if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) {
     // If it's document node then ask accessible document loader for
     // document accessible, otherwise return null.
@@ -981,18 +969,18 @@ nsAccessibilityService::GetOrCreateAcces
   }
 
   // We have a content node.
   if (!aNode->IsInDoc()) {
     NS_WARNING("Creating accessible for node with no document");
     return nsnull;
   }
 
-  if (aNode->OwnerDoc() != aPresShell->GetDocument()) {
-    NS_ERROR("Creating accessible for wrong pres shell");
+  if (aNode->OwnerDoc() != aDoc->GetDocumentNode()) {
+    NS_ERROR("Creating accessible for wrong document");
     return nsnull;
   }
 
   nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
   if (!content)
     return nsnull;
 
   // Frames can be deallocated when we flush layout, or when we call into code
@@ -1113,18 +1101,17 @@ nsAccessibilityService::GetOrCreateAcces
       // accessibles
       nsIContent *tableContent = content;
       while ((tableContent = tableContent->GetParent()) != nsnull) {
         nsIFrame *tableFrame = tableContent->GetPrimaryFrame();
         if (!tableFrame)
           continue;
 
         if (tableFrame->GetType() == nsGkAtoms::tableOuterFrame) {
-          nsAccessible *tableAccessible =
-            GetAccessibleInWeakShell(tableContent, aWeakShell);
+          nsAccessible* tableAccessible = aDoc->GetAccessible(tableContent);
 
           if (tableAccessible) {
             if (!roleMapEntry) {
               roles::Role role = tableAccessible->Role();
               // No ARIA role and not in table: override role. For example,
               // <table role="label"><td>content</td></table>
               if (role != roles::TABLE && role != roles::TREE_TABLE)
                 roleMapEntry = &nsARIAMap::gEmptyRoleMap;
@@ -1197,17 +1184,17 @@ nsAccessibilityService::GetOrCreateAcces
         // Do not create accessible object subtrees for non-rendered table
         // captions. This could not be done in
         // nsTableCaptionFrame::GetAccessible() because the descendants of
         // the table caption would still be created. By setting
         // *aIsSubtreeHidden = true we ensure that no descendant accessibles
         // are created.
         nsIFrame* f = weakFrame.GetFrame();
         if (!f) {
-          f = aPresShell->GetRealPrimaryFrameFor(content);
+          f = aDoc->PresShell()->GetRealPrimaryFrameFor(content);
         }
         if (f->GetType() == nsGkAtoms::tableCaptionFrame &&
            f->GetRect().IsEmpty()) {
           // XXX This is not the ideal place for this code, but right now there
           // is no better place:
           if (aIsSubtreeHidden)
             *aIsSubtreeHidden = true;
 
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -82,18 +82,16 @@ class nsAccessibilityService : public ns
 public:
   virtual ~nsAccessibilityService();
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLERETRIEVAL
   NS_DECL_NSIOBSERVER
 
   // nsIAccessibilityService
-  virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
-                                             nsIPresShell* aPresShell);
   virtual nsAccessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
                                                   bool aCanCreate);
 
   virtual already_AddRefed<nsAccessible>
     CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
     CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
@@ -181,42 +179,28 @@ public:
    */
   static bool IsShutdown() { return gIsShutdown; }
 
   /**
    * Return an accessible for the given DOM node from the cache or create new
    * one.
    *
    * @param  aNode             [in] the given node
-   * @param  aPresShell        [in] the pres shell of the node
-   * @param  aWeakShell        [in] the weak shell for the pres shell
+   * @param  aDoc              [in] the doc accessible of the node  
    * @param  aIsSubtreeHidden  [out, optional] indicates whether the node's
    *                             frame and its subtree is hidden
    */
-  nsAccessible* GetOrCreateAccessible(nsINode* aNode, nsIPresShell* aPresShell,
-                                      nsIWeakReference* aWeakShell,
+  nsAccessible* GetOrCreateAccessible(nsINode* aNode, nsDocAccessible* aDoc,
                                       bool* aIsSubtreeHidden = nsnull);
 
   /**
-   * Return an accessible for the given DOM node.
+   * Return an accessible for the given DOM node and eventually a presentation
+   * shell.
    */
-  nsAccessible* GetAccessible(nsINode* aNode);
-
-  /**
-   * Return an accessible for a DOM node in the given presshell.
-   *
-   * @param aNode       [in] the given node
-   * @param aWeakShell  [in] the presentation shell for the given node
-   */
-  inline nsAccessible* GetAccessibleInWeakShell(nsINode* aNode,
-                                                nsIWeakReference* aWeakShell)
-  {
-    // XXX: weak shell is ignored until multiple shell documents are supported.
-    return GetAccessible(aNode);
-  }
+  nsAccessible* GetAccessible(nsINode* aNode, nsIPresShell* aPresShell);
 
   /**
    * Return an accessible for the given DOM node or container accessible if
    * the node is not accessible.
    *
    * @param aNode [in] the given node
    * @param aDoc  [in] the document accessible. Can't be null.
    */
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -3077,17 +3077,17 @@ nsAccessible::ContainerWidget() const
 // nsAccessible protected methods
 
 void
 nsAccessible::CacheChildren()
 {
   nsDocAccessible* doc = Document();
   NS_ENSURE_TRUE(doc,);
 
-  nsAccTreeWalker walker(doc->GetWeakShell(), mContent, CanHaveAnonChildren());
+  nsAccTreeWalker walker(doc, mContent, CanHaveAnonChildren());
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 void
 nsAccessible::TestChildCache(nsAccessible* aCachedChild) const
 {
--- a/accessible/src/base/nsCoreUtils.h
+++ b/accessible/src/base/nsCoreUtils.h
@@ -251,22 +251,16 @@ public:
 
   /**
    * Return presShell for the document containing the given DOM node.
    */
   static nsIPresShell *GetPresShellFor(nsINode *aNode)
   {
     return aNode->OwnerDoc()->GetShell();
   }
-  static already_AddRefed<nsIWeakReference> GetWeakShellFor(nsINode *aNode)
-  {
-    nsCOMPtr<nsIWeakReference> weakShell =
-      do_GetWeakReference(GetPresShellFor(aNode));
-    return weakShell.forget();
-  }
 
   /**
    * Return document node for the given document shell tree item.
    */
   static already_AddRefed<nsIDOMNode>
     GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer);
 
   /**
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -98,22 +98,22 @@ static nsIAtom** kRelationAttrs[] =
 
 static const PRUint32 kRelationAttrsLen = NS_ARRAY_LENGTH(kRelationAttrs);
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 nsDocAccessible::
   nsDocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
-                  nsIWeakReference* aShell) :
+                  nsIPresShell* aPresShell) :
   nsHyperTextAccessibleWrap(aRootContent, this),
   mDocument(aDocument), mScrollPositionChangedTicks(0),
   mLoadState(eTreeConstructionPending), mLoadEventType(0),
   mVirtualCursor(nsnull),
-  mPresShell(nsCOMPtr<nsIPresShell>(do_QueryReferent(aShell)).get())
+  mPresShell(aPresShell)
 {
   mFlags |= eDocAccessible;
 
   mDependentIDsHash.Init();
   // XXX aaronl should we use an algorithm for the initial cache size?
   mAccessibleCache.Init(kDefaultCacheSize);
   mNodeToAccessibleMap.Init(kDefaultCacheSize);
 
@@ -1510,17 +1510,17 @@ nsDocAccessible::ProcessInvalidationList
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible protected
 
 void
 nsDocAccessible::CacheChildren()
 {
   // Search for accessible children starting from the document element since
   // some web pages tend to insert elements under it rather than document body.
-  nsAccTreeWalker walker(do_GetWeakReference(mPresShell).get(), mDocument->GetRootElement(),
+  nsAccTreeWalker walker(this, mDocument->GetRootElement(),
                          CanHaveAnonChildren());
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected members
@@ -1866,17 +1866,17 @@ nsDocAccessible::UpdateTree(nsAccessible
   PRUint32 updateFlags = eNoAccessible;
 
   // If child node is not accessible then look for its accessible children.
   nsAccessible* child = GetAccessible(aChildNode);
   if (child) {
     updateFlags |= UpdateTreeInternal(child, aIsInsert);
 
   } else {
-    nsAccTreeWalker walker(do_GetWeakReference(mPresShell).get(), aChildNode,
+    nsAccTreeWalker walker(this, aChildNode,
                            aContainer->CanHaveAnonChildren(), true);
 
     while ((child = walker.NextChild()))
       updateFlags |= UpdateTreeInternal(child, aIsInsert);
   }
 
   // Content insertion/removal is not cause of accessible tree change.
   if (updateFlags == eNoAccessible)
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -92,17 +92,17 @@ class nsDocAccessible : public nsHyperTe
   NS_DECL_NSIACCESSIBLECURSORABLE
 
   NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
 
 public:
   using nsAccessible::GetParent;
 
   nsDocAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
-                  nsIWeakReference* aShell);
+                  nsIPresShell* aPresShell);
   virtual ~nsDocAccessible();
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
   NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
   NS_IMETHOD TakeFocus(void);
 
   // nsIScrollPositionListener
@@ -139,22 +139,16 @@ public:
   // nsDocAccessible
 
   /**
    * Return presentation shell for this document accessible.
    */
   nsIPresShell* PresShell() const { return mPresShell; }
 
   /**
-   * Return weak reference to presentation shell for this document accessible.
-   */
-  nsIWeakReference* GetWeakShell() const
-    { return do_GetWeakReference(mPresShell).get(); }
-
-  /**
    * 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.
     return mDocument && mDocument->IsVisible() &&
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -103,19 +103,19 @@ NS_IMPL_QUERY_TAIL_INHERITING(nsDocAcces
 
 NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsDocAccessible) 
 NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsDocAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 nsRootAccessible::
-  nsRootAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
-                   nsIWeakReference *aShell) :
-  nsDocAccessibleWrap(aDocument, aRootContent, aShell)
+  nsRootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
+                   nsIPresShell* aPresShell) :
+  nsDocAccessibleWrap(aDocument, aRootContent, aPresShell)
 {
   mFlags |= eRootAccessible;
 }
 
 nsRootAccessible::~nsRootAccessible()
 {
 }
 
--- a/accessible/src/base/nsRootAccessible.h
+++ b/accessible/src/base/nsRootAccessible.h
@@ -63,18 +63,18 @@ class Relation;
 const PRInt32 SCROLL_HASH_START_SIZE = 6;
 
 class nsRootAccessible : public nsDocAccessibleWrap,
                          public nsIDOMEventListener
 {
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
-  nsRootAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
-                   nsIWeakReference *aShell);
+  nsRootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
+                   nsIPresShell* aPresShell);
   virtual ~nsRootAccessible();
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsIDOMEventListener
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
 
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -113,35 +113,35 @@ nsTextEquivUtils::AppendTextEquivFromCon
                                              nsAString *aString)
 {
   // Prevent recursion which can cause infinite loops.
   if (gInitiatorAcc)
     return NS_OK;
 
   gInitiatorAcc = aInitiatorAcc;
 
-  nsCOMPtr<nsIWeakReference> shell = nsCoreUtils::GetWeakShellFor(aContent);
+  nsIPresShell* shell = nsCoreUtils::GetPresShellFor(aContent);
   if (!shell) {
     NS_ASSERTION(true, "There is no presshell!");
     gInitiatorAcc = nsnull;
     return NS_ERROR_UNEXPECTED;
   }
 
   // If the given content is not visible or isn't accessible then go down
   // through the DOM subtree otherwise go down through accessible subtree and
   // calculate the flat string.
   nsIFrame *frame = aContent->GetPrimaryFrame();
   bool isVisible = frame && frame->GetStyleVisibility()->IsVisible();
 
   nsresult rv = NS_ERROR_FAILURE;
   bool goThroughDOMSubtree = true;
 
   if (isVisible) {
-    nsAccessible *accessible =
-      GetAccService()->GetAccessibleInWeakShell(aContent, shell);
+    nsAccessible* accessible =
+      GetAccService()->GetAccessible(aContent, shell);
     if (accessible) {
       rv = AppendFromAccessible(accessible, aString);
       goThroughDOMSubtree = false;
     }
   }
 
   if (goThroughDOMSubtree)
     rv = AppendFromDOMNode(aContent, aString);
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -174,31 +174,29 @@ nsHTMLSelectListAccessible::CacheChildre
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectListAccessible protected
 
 void
 nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
 {
-  nsIPresShell* presShell(mDoc->PresShell());
   for (nsIContent* childContent = aParentContent->GetFirstChild(); childContent;
        childContent = childContent->GetNextSibling()) {
     if (!childContent->IsHTML()) {
       continue;
     }
 
     nsCOMPtr<nsIAtom> tag = childContent->Tag();
     if (tag == nsGkAtoms::option ||
         tag == nsGkAtoms::optgroup) {
 
       // Get an accessible for option or optgroup and cache it.
       nsRefPtr<nsAccessible> accessible =
-        GetAccService()->GetOrCreateAccessible(childContent, presShell,
-                                               mDoc->GetWeakShell());
+        GetAccService()->GetOrCreateAccessible(childContent, mDoc);
       if (accessible)
         AppendChild(accessible);
 
       // Deep down into optgroup element.
       if (tag == nsGkAtoms::optgroup)
         CacheOptSiblings(childContent);
     }
   }
@@ -434,17 +432,17 @@ nsHTMLSelectOptionAccessible::GetSelectS
   *aState = 0;
 
   nsIContent *content = mContent;
   while (content && content->Tag() != nsGkAtoms::select) {
     content = content->GetParent();
   }
 
   if (content) {
-    nsAccessible* selAcc = GetAccService()->GetAccessible(content);
+    nsAccessible* selAcc = GetAccService()->GetAccessible(content, nsnull);
     if (selAcc) {
       *aState = selAcc->State();
       return content;
     }
   }
   return nsnull; 
 }
 
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -452,17 +452,17 @@ NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTable
 
 void
 nsHTMLTableAccessible::CacheChildren()
 {
   // Move caption accessible so that it's the first child. Check for the first
   // caption only, because nsAccessibilityService ensures we don't create
   // accessibles for the other captions, since only the first is actually
   // visible.
-  nsAccTreeWalker walker(mDoc->GetWeakShell(), mContent, CanHaveAnonChildren());
+  nsAccTreeWalker walker(mDoc, mContent, CanHaveAnonChildren());
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild())) {
     if (child->Role() == roles::CAPTION) {
       InsertChildAt(0, child);
       while ((child = walker.NextChild()) && AppendChild(child));
       break;
     }
--- a/accessible/src/mac/nsDocAccessibleWrap.h
+++ b/accessible/src/mac/nsDocAccessibleWrap.h
@@ -39,15 +39,15 @@
 #ifndef _nsDocAccessibleWrap_H_
 #define _nsDocAccessibleWrap_H_
 
 #include "nsDocAccessible.h"
 
 class nsDocAccessibleWrap: public nsDocAccessible
 {
 public:
-  nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                      nsIWeakReference *aShell);
+  nsDocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                      nsIPresShell* aPresShell);
   virtual ~nsDocAccessibleWrap();
 
 };
 
 #endif
--- a/accessible/src/mac/nsDocAccessibleWrap.mm
+++ b/accessible/src/mac/nsDocAccessibleWrap.mm
@@ -35,18 +35,18 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsDocAccessibleWrap.h"
 
 #import "mozAccessible.h"
 
 nsDocAccessibleWrap::
-  nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                      nsIWeakReference *aShell) :
-  nsDocAccessible(aDocument, aRootContent, aShell)
+  nsDocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                      nsIPresShell* aPresShell) :
+  nsDocAccessible(aDocument, aRootContent, aPresShell)
 {
 }
 
 nsDocAccessibleWrap::~nsDocAccessibleWrap()
 {
 }
 
--- a/accessible/src/mac/nsRootAccessibleWrap.h
+++ b/accessible/src/mac/nsRootAccessibleWrap.h
@@ -45,18 +45,18 @@
 
 #include "nsRootAccessible.h"
 
 struct objc_class;
 
 class nsRootAccessibleWrap : public nsRootAccessible
 {
 public:
-  nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                       nsIWeakReference *aShell);
+  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                       nsIPresShell* aPresShell);
   virtual ~nsRootAccessibleWrap();
 
     Class GetNativeType ();
     
     // let's our native accessible get in touch with the
     // native cocoa view that is our accessible parent.
     void GetNativeWidget (void **aOutView);
 };
--- a/accessible/src/mac/nsRootAccessibleWrap.mm
+++ b/accessible/src/mac/nsRootAccessibleWrap.mm
@@ -41,19 +41,19 @@
 #include "mozDocAccessible.h"
 
 #include "nsCOMPtr.h"
 #include "nsObjCExceptions.h"
 #include "nsIWidget.h"
 #include "nsIViewManager.h"
 
 nsRootAccessibleWrap::
-  nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                       nsIWeakReference *aShell) :
-  nsRootAccessible(aDocument, aRootContent, aShell)
+  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                       nsIPresShell* aPresShell) :
+  nsRootAccessible(aDocument, aRootContent, aPresShell)
 {
 }
 
 nsRootAccessibleWrap::~nsRootAccessibleWrap()
 {
 }
 
 Class
--- a/accessible/src/msaa/nsDocAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsDocAccessibleWrap.cpp
@@ -63,19 +63,19 @@ using namespace mozilla::a11y;
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsDocAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 nsDocAccessibleWrap::
-  nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                      nsIWeakReference *aShell) :
-  nsDocAccessible(aDocument, aRootContent, aShell), mHWND(NULL)
+  nsDocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                      nsIPresShell* aPresShell) :
+  nsDocAccessible(aDocument, aRootContent, aPresShell), mHWND(NULL)
 {
 }
 
 nsDocAccessibleWrap::~nsDocAccessibleWrap()
 {
 }
 
 //-----------------------------------------------------
--- a/accessible/src/msaa/nsDocAccessibleWrap.h
+++ b/accessible/src/msaa/nsDocAccessibleWrap.h
@@ -48,18 +48,18 @@
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "nsIDocShellTreeItem.h"
 
 class nsDocAccessibleWrap: public nsDocAccessible,
                            public ISimpleDOMDocument
 {
 public:
-  nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                      nsIWeakReference *aShell);
+  nsDocAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                      nsIPresShell* aPresShell);
   virtual ~nsDocAccessibleWrap();
 
     // IUnknown
     STDMETHODIMP_(ULONG) AddRef();
     STDMETHODIMP_(ULONG) Release();
     STDMETHODIMP      QueryInterface(REFIID, void**);
 
     // ISimpleDOMDocument
--- a/accessible/src/msaa/nsRootAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsRootAccessibleWrap.cpp
@@ -46,18 +46,18 @@
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 nsRootAccessibleWrap::
   nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIWeakReference* aShell) :
-  nsRootAccessible(aDocument, aRootContent, aShell)
+                       nsIPresShell* aPresShell) :
+  nsRootAccessible(aDocument, aRootContent, aPresShell)
 {
 }
 
 nsRootAccessibleWrap::~nsRootAccessibleWrap()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/msaa/nsRootAccessibleWrap.h
+++ b/accessible/src/msaa/nsRootAccessibleWrap.h
@@ -41,16 +41,16 @@
 #define _nsRootAccessibleWrap_H_
 
 #include "nsRootAccessible.h"
 
 class nsRootAccessibleWrap : public nsRootAccessible
 {
 public:
   nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
-                       nsIWeakReference* aShell);
+                       nsIPresShell* aPresShell);
   virtual ~nsRootAccessibleWrap();
 
   // nsRootAccessible
   virtual void DocumentActivated(nsDocAccessible* aDocument);
 };
 
 #endif
--- a/accessible/src/other/nsRootAccessibleWrap.cpp
+++ b/accessible/src/other/nsRootAccessibleWrap.cpp
@@ -41,18 +41,18 @@
 #include "nsIServiceManager.h"
 #include "nsIAccessibilityService.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsRootAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 nsRootAccessibleWrap::
-  nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                       nsIWeakReference *aShell) :
-  nsRootAccessible(aDocument, aRootContent, aShell)
+  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                       nsIPresShell* aPresShell) :
+  nsRootAccessible(aDocument, aRootContent, aPresShell)
 {
 }
 
 nsRootAccessibleWrap::~nsRootAccessibleWrap()
 {
 }
 
--- a/accessible/src/other/nsRootAccessibleWrap.h
+++ b/accessible/src/other/nsRootAccessibleWrap.h
@@ -43,15 +43,15 @@
 #ifndef _nsRootAccessibleWrap_H_
 #define _nsRootAccessibleWrap_H_
 
 #include "nsRootAccessible.h"
 
 class nsRootAccessibleWrap: public nsRootAccessible
 {
 public:
-  nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
-                       nsIWeakReference *aShell);
+  nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
+                       nsIPresShell* aPresShell);
   virtual ~nsRootAccessibleWrap();
 };
 
 
 #endif
--- a/accessible/src/xforms/nsXFormsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsAccessible.cpp
@@ -121,30 +121,28 @@ nsXFormsAccessible::CacheSelectChildren(
     container = do_QueryInterface(mContent);
 
   nsCOMPtr<nsIDOMNodeList> children;
   sXFormsService->GetSelectChildrenFor(container, getter_AddRefs(children));
 
   if (!children)
     return;
 
-  nsIPresShell* presShell(mDoc->PresShell());
-
   PRUint32 length = 0;
   children->GetLength(&length);
 
   for (PRUint32 index = 0; index < length; index++) {
     nsCOMPtr<nsIDOMNode> DOMChild;
     children->Item(index, getter_AddRefs(DOMChild));
     if (!DOMChild)
       continue;
 
     nsCOMPtr<nsIContent> child(do_QueryInterface(DOMChild));
     nsAccessible* accessible =
-      GetAccService()->GetOrCreateAccessible(child, presShell, mDoc->GetWeakShell());
+      GetAccService()->GetOrCreateAccessible(child, mDoc);
     if (!accessible)
       continue;
 
     AppendChild(accessible);
   }
 }
 
 // nsIAccessible
--- a/accessible/src/xul/nsXULColorPickerAccessible.cpp
+++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp
@@ -174,17 +174,17 @@ nsXULColorPickerAccessible::AreItemsOper
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerAccessible: protected nsAccessible
 
 void
 nsXULColorPickerAccessible::CacheChildren()
 {
   NS_ENSURE_TRUE(mDoc,);
 
-  nsAccTreeWalker walker(mDoc->GetWeakShell(), mContent, true);
+  nsAccTreeWalker walker(mDoc, mContent, true);
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild())) {
     PRUint32 role = child->Role();
 
     // Get an accessible for menupopup or panel elements.
     if (role == roles::ALERT) {
       AppendChild(child);
--- a/accessible/src/xul/nsXULFormControlAccessible.cpp
+++ b/accessible/src/xul/nsXULFormControlAccessible.cpp
@@ -228,17 +228,17 @@ nsXULButtonAccessible::CacheChildren()
 
   NS_ENSURE_TRUE(mDoc,);
   if (!isMenu && !isMenuButton)
     return;
 
   nsAccessible* menupopup = nsnull;
   nsAccessible* button = nsnull;
 
-  nsAccTreeWalker walker(mDoc->GetWeakShell(), mContent, true);
+  nsAccTreeWalker walker(mDoc, mContent, true);
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild())) {
     roles::Role role = child->Role();
 
     if (role == roles::MENUPOPUP) {
       // Get an accessible for menupopup or panel elements.
       menupopup = child;
@@ -868,17 +868,17 @@ nsXULTextFieldAccessible::CacheChildren(
 {
   NS_ENSURE_TRUE(mDoc,);
   // Create child accessibles for native anonymous content of underlying HTML
   // input element.
   nsCOMPtr<nsIContent> inputContent(GetInputField());
   if (!inputContent)
     return;
 
-  nsAccTreeWalker walker(mDoc->GetWeakShell(), inputContent, false);
+  nsAccTreeWalker walker(mDoc, inputContent, false);
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTextFieldAccessible: nsHyperTextAccessible protected
 
--- a/accessible/src/xul/nsXULListboxAccessible.cpp
+++ b/accessible/src/xul/nsXULListboxAccessible.cpp
@@ -881,17 +881,18 @@ nsXULListboxAccessible::ContainerWidget(
     nsCOMPtr<nsIDOMXULMenuListElement> menuListElm =
       do_QueryInterface(mContent->GetParent());
     if (menuListElm) {
       nsCOMPtr<nsIDOMNode> inputElm;
       menuListElm->GetInputField(getter_AddRefs(inputElm));
       if (inputElm) {
         nsCOMPtr<nsINode> inputNode = do_QueryInterface(inputElm);
         if (inputNode) {
-          nsAccessible* input = GetAccService()->GetAccessible(inputNode);
+          nsAccessible* input = 
+            GetAccService()->GetAccessible(inputNode, nsnull);
           return input ? input->ContainerWidget() : nsnull;
         }
       }
     }
   }
   return nsnull;
 }
 
--- a/accessible/src/xul/nsXULMenuAccessible.cpp
+++ b/accessible/src/xul/nsXULMenuAccessible.cpp
@@ -642,17 +642,17 @@ nsXULMenubarAccessible::AreItemsOperable
 nsAccessible*
 nsXULMenubarAccessible::CurrentItem()
 {
   nsMenuBarFrame* menuBarFrame = do_QueryFrame(GetFrame());
   if (menuBarFrame) {
     nsMenuFrame* menuFrame = menuBarFrame->GetCurrentMenuItem();
     if (menuFrame) {
       nsIContent* menuItemNode = menuFrame->GetContent();
-      return GetAccService()->GetAccessible(menuItemNode);
+      return GetAccService()->GetAccessible(menuItemNode, nsnull);
     }
   }
   return nsnull;
 }
 
 void
 nsXULMenubarAccessible::SetCurrentItem(nsAccessible* aItem)
 {
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -511,17 +511,18 @@ nsXULTreeAccessible::ContainerWidget() c
     nsCOMPtr<nsIDOMXULMenuListElement> menuListElm =
       do_QueryInterface(mContent->GetParent());
     if (menuListElm) {
       nsCOMPtr<nsIDOMNode> inputElm;
       menuListElm->GetInputField(getter_AddRefs(inputElm));
       if (inputElm) {
         nsCOMPtr<nsINode> inputNode = do_QueryInterface(inputElm);
         if (inputNode) {
-          nsAccessible* input = GetAccService()->GetAccessible(inputNode);
+          nsAccessible* input = 
+            GetAccService()->GetAccessible(inputNode, nsnull);
           return input ? input->ContainerWidget() : nsnull;
         }
       }
     }
   }
   return nsnull;
 }