Bug 420993 - dead accessible objects should not be present in the hierarchy, r=davidb
authorAlexander Surkov <surkov.alexander@gmail.com>
Sun, 15 Aug 2010 20:29:02 +0900
changeset 50623 3812ddb37a3560158b22ac3e6ccee766aabfbc9f
parent 50622 dec698262ea89ce531f25178682de5ac25cae934
child 50625 cfeb77de159c2fb2e05777b9ac9830408e0610e1
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs420993
milestone2.0b4pre
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 420993 - dead accessible objects should not be present in the hierarchy, r=davidb
accessible/src/atk/nsAccessibleWrap.cpp
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -843,19 +843,18 @@ AtkObject *
 getParentCB(AtkObject *aAtkObj)
 {
     if (!aAtkObj->accessible_parent) {
         nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
         if (!accWrap) {
             return nsnull;
         }
 
-        nsCOMPtr<nsIAccessible> accParent;
-        nsresult rv = accWrap->GetParent(getter_AddRefs(accParent));
-        if (NS_FAILED(rv) || !accParent)
+        nsAccessible* accParent = accWrap->GetParent();
+        if (!accParent)
             return nsnull;
 
         AtkObject *parent = nsAccessibleWrap::GetAtkObject(accParent);
         if (parent)
             atk_object_set_parent(aAtkObj, parent);
     }
     return aAtkObj->accessible_parent;
 }
@@ -863,42 +862,33 @@ getParentCB(AtkObject *aAtkObj)
 gint
 getChildCountCB(AtkObject *aAtkObj)
 {
     nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
     if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
         return 0;
     }
 
-    // Links within hypertext accessible play role of accessible children in
-    // ATK since every embedded object is a link and text accessibles are
-    // ignored.
-    nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(accWrap);
-    return hyperText ? hyperText->GetLinkCount() : accWrap->GetChildCount();
+    return accWrap->GetEmbeddedChildCount();
 }
 
 AtkObject *
 refChildCB(AtkObject *aAtkObj, gint aChildIndex)
 {
     // aChildIndex should not be less than zero
     if (aChildIndex < 0) {
       return nsnull;
     }
 
     nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
     if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
         return nsnull;
     }
 
-    // Links within hypertext accessible play role of accessible children in
-    // ATK since every embedded object is a link and text accessibles are
-    // ignored.
-    nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(accWrap);
-    nsAccessible* accChild = hyperText ? hyperText->GetLinkAt(aChildIndex) :
-                                         accWrap->GetChildAt(aChildIndex);
+    nsAccessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
     if (!accChild)
         return nsnull;
 
     AtkObject* childAtkObj = nsAccessibleWrap::GetAtkObject(accChild);
 
     NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
     if (!childAtkObj)
         return nsnull;
@@ -919,22 +909,17 @@ getIndexInParentCB(AtkObject *aAtkObj)
         return -1;
     }
 
     nsAccessible *parent = accWrap->GetParent();
     if (!parent) {
         return -1; // No parent
     }
 
-    // Links within hypertext accessible play role of accessible children in
-    // ATK since every embedded object is a link and text accessibles are
-    // ignored.
-    nsRefPtr<nsHyperTextAccessible> hyperTextParent(do_QueryObject(parent));
-    return hyperTextParent ?
-        hyperTextParent->GetLinkIndex(accWrap) : accWrap->GetIndexInParent();
+    return parent->GetIndexOfEmbeddedChild(accWrap);
 }
 
 static void TranslateStates(PRUint32 aState, const AtkStateMap *aStateMap,
                             AtkStateSet *aStateSet)
 {
   NS_ASSERTION(aStateSet, "Can't pass in null state set");
 
   // Convert every state to an entry in AtkStateMap