Bug 640707 - Add event support for aria-sort. r=surkov
authorDavid Bolter <dbolter@mozilla.com>
Tue, 17 May 2011 12:33:45 -0400
changeset 69632 43fa778d3f1b57bda5ee9093d5855c8c1ecf49ab
parent 69631 f792fa7755dc46ad8cfa10c579af52229348ea97
child 69633 cef02273a027457947bc1f31314b903f99867029
push id20045
push userdbolter@mozilla.com
push dateTue, 17 May 2011 16:36:51 +0000
treeherdermozilla-central@43fa778d3f1b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs640707
milestone6.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 640707 - Add event support for aria-sort. r=surkov Yahoo mail needs this ASAP.
accessible/src/base/nsDocAccessible.cpp
accessible/tests/mochitest/events/Makefile.in
accessible/tests/mochitest/events/test_aria_hidden.html
accessible/tests/mochitest/events/test_aria_objattr.html
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1109,17 +1109,18 @@ nsDocAccessible::ARIAAttributeChanged(ns
     }
     return;
   }
 
   // For aria drag and drop changes we fire a generic attribute change event;
   // at least until native API comes up with a more meaningful event.
   if (aAttribute == nsAccessibilityAtoms::aria_grabbed ||
       aAttribute == nsAccessibilityAtoms::aria_dropeffect ||
-      aAttribute == nsAccessibilityAtoms::aria_hidden) {
+      aAttribute == nsAccessibilityAtoms::aria_hidden ||
+      aAttribute == nsAccessibilityAtoms::aria_sort) {
     FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
                                aContent);
   }
 
   // We treat aria-expanded as a global ARIA state for historical reasons
   if (aAttribute == nsAccessibilityAtoms::aria_expanded) {
     nsRefPtr<AccEvent> event =
       new AccStateChangeEvent(aContent, states::EXPANDED);
--- a/accessible/tests/mochitest/events/Makefile.in
+++ b/accessible/tests/mochitest/events/Makefile.in
@@ -46,18 +46,18 @@ include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES =\
 		docload_wnd.html \
 		docload_wnd.xul \
 		focus.html \
 		scroll.html \
 		test_aria_alert.html \
-		test_aria_hidden.html \
 		test_aria_menu.html \
+		test_aria_objattr.html \
 		test_aria_statechange.html \
 		test_attrs.html \
 		test_caretmove.html \
 		test_caretmove.xul \
 		test_coalescence.html \
 		test_contextmenu.html \
 		test_docload.html \
 		test_docload.xul \
rename from accessible/tests/mochitest/events/test_aria_hidden.html
rename to accessible/tests/mochitest/events/test_aria_objattr.html
--- a/accessible/tests/mochitest/events/test_aria_hidden.html
+++ b/accessible/tests/mochitest/events/test_aria_objattr.html
@@ -1,12 +1,12 @@
 <html>
 
 <head>
-  <title>Accessible ARIA hidden attribute</title>
+  <title>Accessible ARIA object attribute changes</title>
 
   <link rel="stylesheet" type="text/css"
         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 
   <script type="application/javascript"
           src="chrome://mochikit/content/MochiKit/packed.js"></script>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
@@ -38,42 +38,73 @@
       }
 
       this.getID = function hideNode_getID()
       {
         return "aria-hidden for " + aID + " " + bHide;
       }
     }
 
+    function updateSort(aID, aSort)
+    {
+      this.node = getNode(aID);
+      this.accessible = getAccessible(this.node);
+
+      this.eventSeq = [
+        new invokerChecker(EVENT_OBJECT_ATTRIBUTE_CHANGED, this.accessible),
+      ];
+
+      this.invoke = function updateSort_invoke()
+      {
+        this.node.setAttribute("aria-sort", aSort);
+      }
+
+      this.getID = function updateSort_getID()
+      {
+        return "aria-sort for " + aID + " " + aSort;
+      }
+    }
+
+    // Debug stuff.
+    // gA11yEventDumpID = "eventdump";
+    // gA11yEventDumpToConsole = true;
+    
     function doTests()
     {
-      //gA11yEventDumpID = "eventdump"; // debug stuff
-
       gQueue = new eventQueue();
 
       gQueue.push(new hideNode("hideable", "true"));
 
+      gQueue.push(new updateSort("sortable", "ascending"));
+
       gQueue.invoke(); // Will call SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTests);
   </script>
 </head>
 
 <body>
 
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=581096"
      title="Add support for aria-hidden">
     Mozilla Bug 581096
   </a>
 
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=640707"
+     title="Add event support for aria-sort">
+    Mozilla Bug 640707
+  </a>
+
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
   <div id="eventdump"></div>
 
   <div id="hideable"><div>Hi</div><div>there</div></div>
 
+  <div id="sortable" role="columnheader" aria-sort"none">aria-sort</div>
 </body>
 </html>