Fix for bug 376832 - L0, 1 of 1 being exposed for acc_description on everything, r=aaronlev
authorsurkov.alexander@gmail.com
Mon, 16 Apr 2007 22:13:24 -0700
changeset 579 1d7f10ad11483eac5a70244ed18aeeef32361080
parent 578 865dec66fdd53685d4a49c9c9cd5d4603d961bf7
child 580 f89bda59b409208a05b87bccbe17d9bda88a1a6d
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaaronlev
bugs376832
milestone1.9a4pre
Fix for bug 376832 - L0, 1 of 1 being exposed for acc_description on everything, r=aaronlev
accessible/public/nsIAccessible.idl
accessible/src/base/nsAccessible.cpp
accessible/src/msaa/nsAccessibleWrap.cpp
--- a/accessible/public/nsIAccessible.idl
+++ b/accessible/public/nsIAccessible.idl
@@ -179,19 +179,19 @@ interface nsIAccessible : nsISupports
    * Attributes of accessible
    */
   readonly attribute nsIPersistentProperties attributes;
 
   /**
    * Returns grouping information. Used for tree items, list items, tab panel
    * labels, radio buttons, etc. Also used for collectons of non-text objects.
    *
-   * @param groupLevel - 0-based, similar to ARIA 'level' property
+   * @param groupLevel - 1-based, similar to ARIA 'level' property
    * @param similarItemsInGroup - 1-based, similar to ARIA 'setsize' property
-   * @param positionInGroup - 0-based, similar to ARIA 'posinset' property
+   * @param positionInGroup - 1-based, similar to ARIA 'posinset' property
    */
   void groupPosition(out long aGroupLevel, out long aSimilarItemsInGroup,
                      out long aPositionInGroup);
 
   /**
    * Accessible child which contains the coordinate at (x, y) in screen pixels.
    */
   nsIAccessible getChildAtPoint(in long x, in long y);
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -2285,17 +2285,17 @@ nsAccessible::GroupPosition(PRInt32 *aGr
   nsAccessibilityUtils::GetAccGroupAttrs(attributes,
                                          &level, &posInSet, &setSize);
 
   if (!posInSet && !setSize)
     return NS_OK;
 
   *aGroupLevel = level;
 
-  *aPositionInGroup = posInSet - 1;
+  *aPositionInGroup = posInSet;
   *aSimilarItemsInGroup = setSize - 1;
 
   return NS_OK;
 }
 
 PRBool nsAccessible::MappedAttrState(nsIContent *aContent, PRUint32 *aStateInOut,
                                      nsStateMapEntry *aStateMapEntry)
 {
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -325,18 +325,18 @@ nsAccessibleWrap::get_accDescription(VAR
   // Try nsIAccessible::groupPosition to make a positional description string.
   PRInt32 groupLevel;
   PRInt32 similarItemsInGroup;
   PRInt32 positionInGroup;
 
   nsresult rv = xpAccessible->GroupPosition(&groupLevel, &similarItemsInGroup,
                                             &positionInGroup);
   if (NS_SUCCEEDED(rv)) {
-    if (positionInGroup != -1 && similarItemsInGroup != -1) {
-      if (groupLevel != -1) {
+    if (positionInGroup > 0) {
+      if (groupLevel > 0) {
         // XXX: How do we calculate the number of children? Now we append
         // " with [numChildren]c" for tree item. In the future we may need to
         // use the ARIA owns property to calculate that if it's present.
         PRInt32 numChildren = 0;
 
         PRUint32 currentRole = 0;
         rv = xpAccessible->GetFinalRole(&currentRole);
         if (NS_SUCCEEDED(rv) &&
@@ -362,28 +362,28 @@ nsAccessibleWrap::get_accDescription(VAR
             child->GetNextSibling(getter_AddRefs(nextChild));
             child.swap(nextChild);
           }
         }
 
         if (numChildren) {
           nsTextFormatter::ssprintf(description,
                                     NS_LITERAL_STRING("L%d, %d of %d with %d").get(),
-                                    groupLevel, positionInGroup + 1,
+                                    groupLevel, positionInGroup,
                                     similarItemsInGroup + 1, numChildren);
         } else {
           nsTextFormatter::ssprintf(description,
                                     NS_LITERAL_STRING("L%d, %d of %d").get(),
-                                    groupLevel, positionInGroup + 1,
+                                    groupLevel, positionInGroup,
                                     similarItemsInGroup + 1);
         }
       } else { // Position has no level
         nsTextFormatter::ssprintf(description,
                                   NS_LITERAL_STRING("%d of %d").get(),
-                                  positionInGroup + 1, similarItemsInGroup + 1);
+                                  positionInGroup, similarItemsInGroup + 1);
       }
 
       *pszDescription = ::SysAllocString(description.get());
       return S_OK;
     }
   }
 
   xpAccessible->GetDescription(description);