Backing out bug 398021, it caused regression bug 404343.
authoraaronleventhal@moonset.net
Tue, 20 Nov 2007 11:54:18 -0800
changeset 8230 0803ba216f221c176688f827b60c7872c3a0a57a
parent 8229 41d2ac4daaa2b9d10ebcd5291f3f1d6e1c7a35c9
child 8231 20c46a02ec9203cfefc280b8aed9593ca0654713
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherderautoland@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs398021, 404343
milestone1.9b2pre
Backing out bug 398021, it caused regression bug 404343.
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsDocAccessible.h
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1803,20 +1803,16 @@ NS_IMETHODIMP nsDocAccessible::Invalidat
   nsCOMPtr<nsIAccessNode> childAccessNode;
   GetCachedAccessNode(childNode, getter_AddRefs(childAccessNode));
   nsCOMPtr<nsIAccessible> childAccessible = do_QueryInterface(childAccessNode);
   if (!childAccessible && !isHiding) {
     // If not about to hide it, make sure there's an accessible so we can fire an
     // event for it
     GetAccService()->GetAttachedAccessibleFor(childNode,
                                               getter_AddRefs(childAccessible));
-    if (childAccessible) {
-      // New accessible created -- to make sure to adopt the children from the old parent.
-      AdoptChildren(childAccessible);
-    }
   }
 
 #ifdef DEBUG_A11Y
   nsAutoString localName;
   childNode->GetLocalName(localName);
   const char *hasAccessible = childAccessible ? " (acc)" : "";
   if (aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE) {
     printf("[Hide %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
@@ -1934,23 +1930,16 @@ NS_IMETHODIMP nsDocAccessible::Invalidat
       NS_ENSURE_TRUE(reorderEvent, NS_ERROR_OUT_OF_MEMORY);
       FireDelayedAccessibleEvent(reorderEvent, eCoalesceFromSameSubtree, isAsynch);
     }
   }
 
   return NS_OK;
 }
 
-void nsDocAccessible::AdoptChildren(nsIAccessible *aAccessible)
-{
-  PRInt32 childCountUnused;
-  // Force CacheChildren()
-  aAccessible->GetChildCount(&childCountUnused);
-}
-
 NS_IMETHODIMP
 nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
                                             PRBool aCanCreate,
                                             nsIAccessible **aAccessible)
 {
   // Find accessible in parent chain of DOM nodes, or return null
   *aAccessible = nsnull;
   nsCOMPtr<nsIDOMNode> currentNode(aNode), parentNode;
@@ -1967,27 +1956,24 @@ nsDocAccessible::GetAccessibleInParentCh
       *aAccessible = this;
       break;
     }
 
     nsCOMPtr<nsIDOMNode> relevantNode;
     if (NS_SUCCEEDED(accService->GetRelevantContentNodeFor(currentNode, getter_AddRefs(relevantNode))) && relevantNode) {
       currentNode = relevantNode;
     }
-    // Try cached accessible
-    nsCOMPtr<nsIAccessNode> accessNode;
-    GetCachedAccessNode(currentNode, getter_AddRefs(accessNode)); // AddRefs
-    if (accessNode) {
-      CallQueryInterface(accessNode, aAccessible); // AddRefs
+    if (aCanCreate) {
+      accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
     }
-    if (!*aAccessible && aCanCreate) {
-      accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
-      if (*aAccessible) {
-        // New accessible created -- to make sure to adopt the children from the old parent.
-        AdoptChildren(*aAccessible);
+    else { // Only return cached accessibles, don't create anything
+      nsCOMPtr<nsIAccessNode> accessNode;
+      GetCachedAccessNode(currentNode, getter_AddRefs(accessNode)); // AddRefs
+      if (accessNode) {
+        CallQueryInterface(accessNode, aAccessible); // AddRefs
       }
     }
   } while (!*aAccessible);
 
   return NS_OK;
 }
 
 nsresult
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -199,24 +199,16 @@ class nsDocAccessible : public nsHyperTe
      * @param aDOMNode               the given node
      * @param aEventType             event type to fire an event
      * @param aDelay                 whether to fire the event on a delay
      * @param aForceIsFromUserInput  the event is known to be from user input
      */
     nsresult FireShowHideEvents(nsIDOMNode *aDOMNode, PRUint32 aEventType,
                                 PRBool aDelay, PRBool aForceIsFromUserInput);
 
-    /**
-     * For a new accessible that is created because of a DOM mutation,
-     * make sure that any children it has, which were already children
-     * of the parent should be assigned to it
-     * @param aAccessible The new accessible
-     */
-    void AdoptChildren(nsIAccessible *aAccessible);
-
     nsAccessNodeHashtable mAccessNodeCache;
     void *mWnd;
     nsCOMPtr<nsIDocument> mDocument;
     nsCOMPtr<nsITimer> mScrollWatchTimer;
     nsCOMPtr<nsITimer> mFireEventTimer;
     PRUint16 mScrollPositionChangedTicks; // Used for tracking scroll events
     PRPackedBool mIsContentLoaded;
     nsCOMArray<nsIAccessibleEvent> mEventsToFire;