Bug 428954. Wrong accessible name on iframe-based ARIA widgets. r=surkov, a=beltzner
authoraaronleventhal@moonset.net
Tue, 15 Apr 2008 08:17:59 -0700
changeset 14340 d4b868d41659bc87f5428e1b94d9a9611b3f7b7b
parent 14339 3ccf5853463cb63f5fbb651c379046d4b3a411b9
child 14341 9c292b69aec58a2a00a1258411ae978711034a38
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)
reviewerssurkov, beltzner
bugs428954
milestone1.9pre
Bug 428954. Wrong accessible name on iframe-based ARIA widgets. r=surkov, a=beltzner
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsOuterDocAccessible.cpp
accessible/src/base/nsOuterDocAccessible.h
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -154,17 +154,20 @@ NS_IMETHODIMP nsDocAccessible::GetName(n
   aName.Truncate();
   if (mParent) {
     rv = mParent->GetName(aName); // Allow owning iframe to override the name
   }
   if (aName.IsEmpty()) {
     rv = nsAccessible::GetName(aName); // Allow name via aria-labelledby or title attribute
   }
   if (aName.IsEmpty()) {
-    rv = GetTitle(aName);   // Finally try title element
+    rv = GetTitle(aName);   // Try title element
+  }
+  if (aName.IsEmpty()) {   // Last resort: use URL
+    rv = GetURL(aName);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP nsDocAccessible::GetRole(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
--- a/accessible/src/base/nsOuterDocAccessible.cpp
+++ b/accessible/src/base/nsOuterDocAccessible.cpp
@@ -47,35 +47,16 @@
 NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible, nsAccessible)
 
 nsOuterDocAccessible::nsOuterDocAccessible(nsIDOMNode* aNode, 
                                            nsIWeakReference* aShell):
   nsAccessibleWrap(aNode, aShell)
 {
 }
 
-  /* attribute wstring accName; */
-NS_IMETHODIMP nsOuterDocAccessible::GetName(nsAString& aName) 
-{
-  nsCOMPtr<nsIAccessible> accessible;
-  GetFirstChild(getter_AddRefs(accessible));
-  nsCOMPtr<nsIAccessibleDocument> accDoc(do_QueryInterface(accessible));
-  if (!accDoc) {
-    return NS_ERROR_FAILURE;
-  }
-  nsresult rv = accDoc->GetTitle(aName);
-  if (NS_FAILED(rv) || aName.IsEmpty()) {
-    rv = nsAccessible::GetName(aName);
-    if (aName.IsEmpty()) {
-      rv = accDoc->GetURL(aName);
-    }
-  }
-  return rv;
-}
-
 /* unsigned long getRole (); */
 NS_IMETHODIMP nsOuterDocAccessible::GetRole(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME;
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/accessible/src/base/nsOuterDocAccessible.h
+++ b/accessible/src/base/nsOuterDocAccessible.h
@@ -47,17 +47,16 @@ class nsIWeakReference;
 class nsOuterDocAccessible : public nsAccessibleWrap
 {
   NS_DECL_ISUPPORTS_INHERITED
 
   public:
     nsOuterDocAccessible(nsIDOMNode* aNode, 
                          nsIWeakReference* aShell);
 
-    NS_IMETHOD GetName(nsAString& aName);
     NS_IMETHOD GetRole(PRUint32 *aRole);
     NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
     NS_IMETHOD GetChildAtPoint(PRInt32 aX, PRInt32 aY,
                                nsIAccessible **aAccessible);
     void CacheChildren();
     nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 };