Title: [101855] trunk
Revision
101855
Author
[email protected]
Date
2011-12-02 14:34:53 -0800 (Fri, 02 Dec 2011)

Log Message

Send an AXCheckedStateChanged notification when the aria-checked attribute changes.
https://bugs.webkit.org/show_bug.cgi?id=72754

Patch by David Tseng <[email protected]> on 2011-12-02
Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/aria-checkbox-sends-notification.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::checkedStateChanged):
* accessibility/AXObjectCache.h:
* dom/Element.cpp:
(WebCore::Element::updateAfterAttributeChanged):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):

LayoutTests:

* accessibility/aria-checkbox-sends-notification.html: Added.
* platform/chromium/accessibility/aria-checkbox-sends-notification-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101854 => 101855)


--- trunk/LayoutTests/ChangeLog	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/LayoutTests/ChangeLog	2011-12-02 22:34:53 UTC (rev 101855)
@@ -1,3 +1,13 @@
+2011-12-02  David Tseng  <[email protected]>
+
+        Send an AXCheckedStateChanged notification when the aria-checked attribute changes.
+        https://bugs.webkit.org/show_bug.cgi?id=72754
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-checkbox-sends-notification.html: Added.
+        * platform/chromium/accessibility/aria-checkbox-sends-notification-expected.txt: Added.
+
 2011-12-02  Kent Tamura  <[email protected]>
 
         Unreviewed, rolling out r101337.

Added: trunk/LayoutTests/accessibility/aria-checkbox-sends-notification.html (0 => 101855)


--- trunk/LayoutTests/accessibility/aria-checkbox-sends-notification.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/aria-checkbox-sends-notification.html	2011-12-02 22:34:53 UTC (rev 101855)
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src=""
+<script>
+    function runTest() {
+        if (window.layoutTestController)
+            layoutTestController.waitUntilDone();
+
+        description("This tests that checking of an aria checkbox sends a notification.");
+        window.root = accessibilityController.rootElement;
+        window.body = root.childAtIndex(0);
+
+        var accessibleCheckbox = body.childAtIndex(0);
+        var notificationCount = 0;
+
+        function listener(notification) {
+        if (notification == "CheckedStateChanged")
+            notificationCount++;
+
+            document.getElementById("console").innerText += "Got notification: " + notification + "\n";
+
+            if (notificationCount == 2) {
+                accessibleCheckbox.removeNotificationListener(listener);
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+            }
+        }
+        accessibleCheckbox.addNotificationListener(listener);
+
+        // Check the checkbox.
+        document.getElementById('checkbox1').setAttribute('aria-checked', 'true');
+        document.getElementById('checkbox1').setAttribute('aria-checked', 'false');
+    };
+</script>
+</head>
+<body>
+
+<div id="checkbox1" tabindex=0 role="checkbox" aria-checked="false">Test Checkbox</div>
+
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    runTest();
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/accessibility/aria-checkbox-sends-notification-expected.txt (0 => 101855)


--- trunk/LayoutTests/platform/chromium/accessibility/aria-checkbox-sends-notification-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/accessibility/aria-checkbox-sends-notification-expected.txt	2011-12-02 22:34:53 UTC (rev 101855)
@@ -0,0 +1,12 @@
+Test Checkbox
+This tests that checking of an aria checkbox sends a notification.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Got notification: CheckedStateChanged
+Got notification: CheckedStateChanged
+

Modified: trunk/LayoutTests/platform/gtk/Skipped (101854 => 101855)


--- trunk/LayoutTests/platform/gtk/Skipped	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/LayoutTests/platform/gtk/Skipped	2011-12-02 22:34:53 UTC (rev 101855)
@@ -387,6 +387,7 @@
 ###############################################################################
 # TESTS FAILING
 ###############################################################################
+accessibility/aria-checkbox-sends-notification.html
 accessibility/aria-help.html
 accessibility/aria-hidden.html
 accessibility/aria-hidden-with-elements.html

Modified: trunk/LayoutTests/platform/mac/Skipped (101854 => 101855)


--- trunk/LayoutTests/platform/mac/Skipped	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/LayoutTests/platform/mac/Skipped	2011-12-02 22:34:53 UTC (rev 101855)
@@ -71,6 +71,7 @@
 accessibility/selection-states.html
 
 # Accessibility tests for notifications that don't exist or aren't needed on Mac OS X.
+accessibility/aria-checkbox-sends-notification.html
 accessibility/menu-list-sends-change-notification.html
 accessibility/multiselect-list-reports-active-option.html
 

Modified: trunk/LayoutTests/platform/win/Skipped (101854 => 101855)


--- trunk/LayoutTests/platform/win/Skipped	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/LayoutTests/platform/win/Skipped	2011-12-02 22:34:53 UTC (rev 101855)
@@ -538,6 +538,7 @@
 accessibility/label-element-press.html
 
 # Accessibility tests without results or with Mac-specific results.
+accessibility/aria-checkbox-sends-notification.html
 accessibility/aria-checkbox-text.html
 accessibility/aria-combobox.html
 accessibility/aria-controls-with-tabs.html

Modified: trunk/Source/WebCore/ChangeLog (101854 => 101855)


--- trunk/Source/WebCore/ChangeLog	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/Source/WebCore/ChangeLog	2011-12-02 22:34:53 UTC (rev 101855)
@@ -1,3 +1,20 @@
+2011-12-02  David Tseng  <[email protected]>
+
+        Send an AXCheckedStateChanged notification when the aria-checked attribute changes.
+        https://bugs.webkit.org/show_bug.cgi?id=72754
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/aria-checkbox-sends-notification.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::checkedStateChanged):
+        * accessibility/AXObjectCache.h:
+        * dom/Element.cpp:
+        (WebCore::Element::updateAfterAttributeChanged):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setChecked):
+
 2011-12-02  Grace Kloba  <[email protected]>
 
         [chromium] Recycle tile-sized textures during commit to prevent reallocations

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (101854 => 101855)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2011-12-02 22:34:53 UTC (rev 101855)
@@ -523,6 +523,11 @@
         postPlatformNotification(object, notification);
 }
 
+void AXObjectCache::checkedStateChanged(RenderObject* renderer)
+{
+    postNotification(renderer, AXObjectCache::AXCheckedStateChanged, true);
+}
+
 void AXObjectCache::selectedChildrenChanged(RenderObject* renderer)
 {
     // postToElement is false so that you can pass in any child of an element and it will go up the parent tree

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (101854 => 101855)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2011-12-02 22:34:53 UTC (rev 101855)
@@ -85,6 +85,7 @@
     void detachWrapper(AccessibilityObject*);
     void attachWrapper(AccessibilityObject*);
     void childrenChanged(RenderObject*);
+    void checkedStateChanged(RenderObject*);
     void selectedChildrenChanged(RenderObject*);
     // Called by a node when text or a text equivalent (e.g. alt) attribute is changed.
     void contentChanged(RenderObject*);
@@ -181,6 +182,7 @@
 inline void AXObjectCache::handleAriaRoleChanged(RenderObject*) { }
 inline void AXObjectCache::detachWrapper(AccessibilityObject*) { }
 inline void AXObjectCache::attachWrapper(AccessibilityObject*) { }
+inline void AXObjectCache::checkedStateChanged(RenderObject*) { }
 inline void AXObjectCache::selectedChildrenChanged(RenderObject*) { }
 inline void AXObjectCache::postNotification(RenderObject*, AXNotification, bool postToElement, PostType) { }
 inline void AXObjectCache::postNotification(AccessibilityObject*, Document*, AXNotification, bool postToElement, PostType) { }

Modified: trunk/Source/WebCore/dom/Element.cpp (101854 => 101855)


--- trunk/Source/WebCore/dom/Element.cpp	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/Source/WebCore/dom/Element.cpp	2011-12-02 22:34:53 UTC (rev 101855)
@@ -741,7 +741,9 @@
     } else if (attrName == aria_labelAttr || attrName == aria_labeledbyAttr || attrName == altAttr || attrName == titleAttr) {
         // If the content of an element changes due to an attribute change, notify accessibility.
         document()->axObjectCache()->contentChanged(renderer());
-    } else if (attrName == aria_selectedAttr)
+    } else if (attrName == aria_checkedAttr)
+        document()->axObjectCache()->checkedStateChanged(renderer());
+    else if (attrName == aria_selectedAttr)
         document()->axObjectCache()->selectedChildrenChanged(renderer());
     else if (attrName == aria_expandedAttr)
         document()->axObjectCache()->handleAriaExpandedChange(renderer());

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (101854 => 101855)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-12-02 22:30:08 UTC (rev 101854)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-12-02 22:34:53 UTC (rev 101855)
@@ -981,7 +981,7 @@
     // RenderTextView), but it's not possible to do it at the moment
     // because of the way the code is structured.
     if (renderer() && AXObjectCache::accessibilityEnabled())
-        renderer()->document()->axObjectCache()->postNotification(renderer(), AXObjectCache::AXCheckedStateChanged, true);
+        renderer()->document()->axObjectCache()->checkedStateChanged(renderer());
 
     // Only send a change event for items in the document (avoid firing during
     // parsing) and don't send a change event for a radio button that's getting
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to