Bug 492518 - xul:slider accessible of xul:scale is accessible illegally, r=marcoz, davidb, a=beltzner
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 15 May 2009 19:11:27 +0800
changeset 25193 63f9e39a84ae4423019b55a3e0ca3702df610793
parent 25192 a6445e2e869102554be119e388e2af01bbb19416
child 25194 c869ef44ba831f99dad5fff414dabc1fd6dc1aa1
push id1417
push usersurkov.alexander@gmail.com
push dateFri, 15 May 2009 10:11:59 +0000
reviewersmarcoz, davidb, beltzner
bugs492518
milestone1.9.1b5pre
Bug 492518 - xul:slider accessible of xul:scale is accessible illegally, r=marcoz, davidb, a=beltzner
accessible/src/xul/nsXULSliderAccessible.cpp
accessible/src/xul/nsXULSliderAccessible.h
accessible/tests/mochitest/Makefile.in
accessible/tests/mochitest/test_events_focus.xul
--- a/accessible/src/xul/nsXULSliderAccessible.cpp
+++ b/accessible/src/xul/nsXULSliderAccessible.cpp
@@ -129,27 +129,16 @@ nsXULSliderAccessible::SetCurrentValue(d
 
   // ARIA redefined current value.
   if (rv != NS_OK_NO_ARIA_VALUE)
     return rv;
 
   return SetSliderAttr(nsAccessibilityAtoms::curpos, aValue);
 }
 
-// nsPIAccessible
-NS_IMETHODIMP
-nsXULSliderAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
-{
-  NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
-
-  // Allow anonymous xul:thumb inside xul:slider.
-  *aAllowsAnonChildren = PR_TRUE;
-  return NS_OK;
-}
-
 // Utils
 
 already_AddRefed<nsIContent>
 nsXULSliderAccessible::GetSliderNode()
 {
   if (!mDOMNode)
     return nsnull;
 
--- a/accessible/src/xul/nsXULSliderAccessible.h
+++ b/accessible/src/xul/nsXULSliderAccessible.h
@@ -53,19 +53,16 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsIAccessibleValue
   NS_DECL_NSIACCESSIBLEVALUE
 
-  // nsPIAccessible
-  NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
-
 protected:
   already_AddRefed<nsIContent> GetSliderNode();
 
   nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue);
   nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue);
 
   nsresult GetSliderAttr(nsIAtom *aName, double *aValue);
   nsresult SetSliderAttr(nsIAtom *aName, double aValue);
--- a/accessible/tests/mochitest/Makefile.in
+++ b/accessible/tests/mochitest/Makefile.in
@@ -71,16 +71,17 @@ include $(topsrcdir)/config/rules.mk
 		test_bug420863.html \
 		$(warning	test_childAtPoint.xul temporarily disabled) \
 		test_cssattrs.html \
 		test_descr.html \
 		test_elm_filectrl.html \
 		test_elm_media.html \
 		test_elm_txtcntnr.html \
 		test_events_caretmove.html \
+		test_events_focus.xul \
 		test_events_mutation.html \
 		$(warning test_groupattrs.xul temporarily disabled) \
 	$(warning test_table_indexes.html temporarily disabled) \
  		test_nsHyperTextAcc_roles.html \
 		test_nsIAccessible_applicationAccessible.html \
 		test_nsIAccessible_name.html \
 		test_nsIAccessible_name_button.html \
 		test_nsIAccessible_name_link.html \
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/test_events_focus.xul
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+                 type="text/css"?>
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        title="Accessible focus event testing">
+
+  <script type="application/javascript" 
+          src="chrome://mochikit/content/MochiKit/packed.js" />
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/a11y/accessible/common.js" />
+  <script type="application/javascript"
+          src="chrome://mochikit/content/a11y/accessible/events.js" />
+
+  <script type="application/javascript">
+    /**
+     * Focus invoker.
+     */
+    function synthFocus(aNodeOrID)
+    {
+      this.DOMNode = getNode(aNodeOrID);
+
+      this.invoke = function synthFocus_invoke()
+      {
+        this.DOMNode.focus();
+      }
+
+      this.getID = function synthFocus_getID() { return aNodeOrID + " focus"; }
+    }
+
+    /**
+     * Do tests.
+     */
+    var gQueue = null;
+
+    function doTests()
+    {
+      // Test focus events.
+      gQueue = new eventQueue(nsIAccessibleEvent.EVENT_FOCUS);
+
+      gQueue.push(new synthFocus("textbox"));
+      gQueue.push(new synthFocus("scale"));
+
+      gQueue.invoke(); // Will call SimpleTest.finish();
+    }
+
+    SimpleTest.waitForExplicitFinish();
+    addLoadEvent(doTests);
+  </script>
+
+  <hbox flex="1" style="overflow: auto;">
+    <body xmlns="http://www.w3.org/1999/xhtml">
+      <a target="_blank"
+         href="https://bugzilla.mozilla.org/show_bug.cgi?id=492518"
+         title="xul:slider accessible of xul:scale is accessible illegally">
+        Mozilla Bug 492518
+      </a>
+      <p id="display"></p>
+      <div id="content" style="display: none"></div>
+      <pre id="test">
+      </pre>
+    </body>
+
+    <vbox flex="1">
+      <textbox id="textbox" value="hello"/>
+      <scale id="scale" min="0" max="9" value="5"/>
+    </vbox>
+  </hbox>
+</window>