Bug 743568 - Fire name change event when a XUL row's name updates, r=tbsaunde.
authorJonathan Wei <jwei@mozilla.com>
Wed, 12 Mar 2014 15:25:14 -0400
changeset 173213 a26842289599de90c1bb14d75c9519f0c09c825a
parent 173212 907d5bc3bd26ebb6db9fe95128c275cd94aaa698
child 173214 08b977b5bf56410f8deba6086750a7fa385bd7a5
push id40956
push userjwei@mozilla.com
push dateWed, 12 Mar 2014 19:25:39 +0000
treeherdermozilla-inbound@a26842289599 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs743568
milestone30.0a1
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 743568 - Fire name change event when a XUL row's name updates, r=tbsaunde.
accessible/src/xul/XULTreeGridAccessible.cpp
accessible/src/xul/XULTreeGridAccessible.h
accessible/tests/mochitest/events/test_tree.xul
--- a/accessible/src/xul/XULTreeGridAccessible.cpp
+++ b/accessible/src/xul/XULTreeGridAccessible.cpp
@@ -404,16 +404,24 @@ XULTreeGridRowAccessible::RowInvalidated
       Accessible* cellAccessible = GetCellAccessible(column);
       if (cellAccessible) {
         nsRefPtr<XULTreeGridCellAccessible> cellAcc = do_QueryObject(cellAccessible);
 
         cellAcc->CellInvalidated();
       }
     }
   }
+
+  nsAutoString name;
+  Name(name);
+
+  if (name != mCachedName) {
+    nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
+    mCachedName = name;
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridRowAccessible: Accessible protected implementation
 
 void
 XULTreeGridRowAccessible::CacheChildren()
 {
--- a/accessible/src/xul/XULTreeGridAccessible.h
+++ b/accessible/src/xul/XULTreeGridAccessible.h
@@ -101,16 +101,17 @@ public:
 
 protected:
 
   // Accessible
   virtual void CacheChildren();
 
   // XULTreeItemAccessibleBase
   mutable AccessibleHashtable mAccessibleCache;
+  nsString mCachedName;
 };
 
 
 /**
  * Represents an accessible for XUL tree cell in the case when XUL tree has
  * multiple columns.
  */
 
--- a/accessible/tests/mochitest/events/test_tree.xul
+++ b/accessible/tests/mochitest/events/test_tree.xul
@@ -92,16 +92,36 @@
       Object.defineProperty(this, "target", { get: targetGetter });
 
       this.getID = function getID()
       {
         return aMsg + "name changed";
       }
     }
 
+    /**
+     * Check name changed a11y event for a row.
+     */
+    function rowNameChangeChecker(aMsg, aRow)
+    {
+      this.type = EVENT_NAME_CHANGE;
+
+      function targetGetter()
+      {
+        var acc = getAccessible(gTree);
+        return acc.getChildAt(aRow + 1);
+      }
+      Object.defineProperty(this, "target", { get: targetGetter });
+
+      this.getID = function getID()
+      {
+        return aMsg + "name changed";
+      }
+    }
+
     ////////////////////////////////////////////////////////////////////////////
     // Invokers
 
     /**
      * Set tree view.
      */
     function setTreeView()
     {
@@ -216,19 +236,20 @@
           column = column.getNext();
         }
 
         gTreeBox.invalidateRow(1);
       }
 
       this.eventSeq =
       [
-        new nameChangeChecker("invalidateColumn: ", 1, 0),
-        new nameChangeChecker("invalidateColumn: ", 1, 1),
-        new treeInvalidatedChecker("invalidateColumn", 1, 1, null, null)
+        new nameChangeChecker("invalidateRow: ", 1, 0),
+        new nameChangeChecker("invalidateRow: ", 1, 1),
+        new rowNameChangeChecker("invalidateRow: ", 1),
+        new treeInvalidatedChecker("invalidateRow", 1, 1, null, null)
       ];
 
       this.getID = function invalidateRow_getID()
       {
         return "invalidate row";
       }
     }
 
@@ -272,21 +293,26 @@
          href="https://bugzilla.mozilla.org/show_bug.cgi?id=368835"
          title="Fire TreeViewChanged/TreeRowCountChanged events.">
         Mozilla Bug 368835
       </a><br/>
       <a target="_blank"
          href="https://bugzilla.mozilla.org/show_bug.cgi?id=308564"
          title="No accessibility events when data in a tree row changes.">
         Mozilla Bug 308564
-      </a>
+      </a><br/>
       <a target="_blank"
          href="https://bugzilla.mozilla.org/show_bug.cgi?id=739524"
          title="replace TreeViewChanged DOM event on direct call from XUL tree.">
         Mozilla Bug 739524
+      </a><br/>
+      <a target="_blank"
+         href="https://bugzilla.mozilla.org/show_bug.cgi?id=743568"
+         title="Thunderbird message list tree emitting incorrect focus signals after message deleted.">
+        Mozilla Bug 743568
       </a>
       <p id="display"></p>
       <div id="content" style="display: none">
       </div>
       <pre id="test">
       </pre>
     </body>