Bug 492518 - xul:slider accessible of xul:scale is accessible illegally, r=marcoz, davidb
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 14 May 2009 13:50:17 +0800
changeset 28318 768064b2ee156414d7711d92b9c86b08874ad06d
parent 28317 d655dc32a9884443ce4374b109651d68741cde5d
child 28319 3251f66498f9b594e455b924f5b4d468b7b4ba47
push id7003
push usersurkov.alexander@gmail.com
push dateThu, 14 May 2009 04:50:57 +0000
treeherdermozilla-central@768064b2ee15 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarcoz, davidb
bugs492518
milestone1.9.2a1pre
Bug 492518 - xul:slider accessible of xul:scale is accessible illegally, r=marcoz, davidb
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
@@ -127,27 +127,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
@@ -52,19 +52,16 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsIAccessibleValue
   NS_DECL_NSIACCESSIBLEVALUE
 
-  // nsPIAccessible
-  NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
-
   // nsAccessible
   virtual nsresult GetRoleInternal(PRUint32 *aRole);
 
 protected:
   already_AddRefed<nsIContent> GetSliderNode();
 
   nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue);
   nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue);
--- a/accessible/tests/mochitest/Makefile.in
+++ b/accessible/tests/mochitest/Makefile.in
@@ -79,16 +79,17 @@ include $(topsrcdir)/config/rules.mk
 	$(warning   test_childAtPoint.html temporarily disabled) \
 	$(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 \
 		test_events_tree.xul \
 		test_groupattrs.xul \
 		test_groupattrs.html \
 		test_name.html \
 		test_name.xul \
 		test_name_button.html \
 		test_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>