Bug 482055 - use 'role' if there is no 'finalRole' in accessible object, r=sdwilsh, sr=neil
authorAlexander Surkov <surkov.alexander@gmail.com>
Wed, 11 Mar 2009 10:14:59 +0800
changeset 702 c5138e1ef96dfd08973dc9ad0700283a0d627585
parent 701 3a50d3e1506c1db87d317f8d9996a8ab5d21e8ca
child 703 af03273e28f873b705d194e4557ed268d3f283cb
push id52
push usersurkov.alexander@gmail.com
push dateWed, 11 Mar 2009 02:15:34 +0000
reviewerssdwilsh, neil
bugs482055
Bug 482055 - use 'role' if there is no 'finalRole' in accessible object, r=sdwilsh, sr=neil
resources/content/viewers/accessibleProps/accessibleProps.js
resources/content/viewers/accessibleRelations/accessibleRelations.js
resources/content/viewers/accessibleTree/accessibleTree.js
--- a/resources/content/viewers/accessibleProps/accessibleProps.js
+++ b/resources/content/viewers/accessibleProps/accessibleProps.js
@@ -216,17 +216,20 @@ AccessiblePropsViewer.prototype =
     for (var i = 0; i < containers.length; ++i)
       containers[i].textContent = "";
 
     this.removeAccessibleAttributes();
   },
 
   get role()
   {
-    return this.mAccService.getStringRole(this.mAccSubject.finalRole);
+    // 'finalRole' is replaced by 'role' property in Gecko 1.9.2.
+    var role = "finalRole" in this.mAccSubject ?
+      this.mAccSubject.finalRole : this.mAccSubject.role;
+    return this.mAccService.getStringRole(role);
   },
 
   get name()
   {
     return this.mAccSubject.name;
   },
 
   get description()
--- a/resources/content/viewers/accessibleRelations/accessibleRelations.js
+++ b/resources/content/viewers/accessibleRelations/accessibleRelations.js
@@ -231,18 +231,22 @@ function rowCount()
   return this.mTargets.length;
 });
 
 AccessibleTargetsView.prototype.getCellText =
 function getCellText(aRow, aCol)
 {
   if (aCol.id == "olcRole") {
     var accessible = this.getAccessible(aRow);
-    if (accessible)
-      return gAccService.getStringRole(accessible.finalRole);
+    if (accessible) {
+      // 'finalRole' is replaced by 'role' property in Gecko 1.9.2.
+      var role = "finalRole" in this.mAccSubject ?
+        this.mAccSubject.finalRole : this.mAccSubject.role;
+      return gAccService.getStringRole(role);
+    }
   } else if (aCol.id == "olcNodeName") {
     var node = this.getDOMNode(aRow);
     if (node)
       return node.nodeName;
   }
 
   return "";
 }
--- a/resources/content/viewers/accessibleTree/accessibleTree.js
+++ b/resources/content/viewers/accessibleTree/accessibleTree.js
@@ -202,18 +202,22 @@ inAccTreeView.prototype.getCellText =
 function getCellText(aRow, aCol)
 {
   var node = this.rowToNode(aRow);
   if (!node)
     return "";
 
   var accessible = node.accessible;
 
-  if (aCol.id == "olcRole")
-    return this.mAccService.getStringRole(accessible.finalRole);
+  if (aCol.id == "olcRole") {
+    // 'finalRole' is replaced by 'role' property in Gecko 1.9.2.
+    var role = "finalRole" in this.mAccSubject ?
+      this.mAccSubject.finalRole : this.mAccSubject.role;
+    return this.mAccService.getStringRole(role);
+  }
 
   if (aCol.id == "olcName")
     return accessible.name;
 
   if (aCol.id == "olcNodeName") {
     var node = this.getDOMNodeFor(accessible);
     return node ? node.nodeName : "";
   }