Title: [95641] trunk
Revision
95641
Author
commit-qu...@webkit.org
Date
2011-09-21 09:45:12 -0700 (Wed, 21 Sep 2011)

Log Message

Report AXValueChanged when value changes in element with role=textbox.
https://bugs.webkit.org/show_bug.cgi?id=68201

Patch by Alice Boxhall <aboxh...@chromium.org> on 2011-09-21
Reviewed by Chris Fleizach.

Source/WebCore:

Test: platform/mac/accessibility/textbox-role-reports-notifications.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isARIATextControl):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::contentChanged):
(WebCore::AccessibilityRenderObject::childrenChanged):

LayoutTests:

* platform/mac/accessibility/textbox-role-reports-notifications-expected.txt: Added.
* platform/mac/accessibility/textbox-role-reports-notifications.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95640 => 95641)


--- trunk/LayoutTests/ChangeLog	2011-09-21 16:39:50 UTC (rev 95640)
+++ trunk/LayoutTests/ChangeLog	2011-09-21 16:45:12 UTC (rev 95641)
@@ -1,3 +1,13 @@
+2011-09-21  Alice Boxhall  <aboxh...@chromium.org>
+
+        Report AXValueChanged when value changes in element with role=textbox.
+        https://bugs.webkit.org/show_bug.cgi?id=68201
+
+        Reviewed by Chris Fleizach.
+
+        * platform/mac/accessibility/textbox-role-reports-notifications-expected.txt: Added.
+        * platform/mac/accessibility/textbox-role-reports-notifications.html: Added.
+
 2011-09-21  Anna Cavender  <ann...@chromium.org>
 
         New layout tests for the JS bindings related to <track>:

Added: trunk/LayoutTests/platform/mac/accessibility/textbox-role-reports-notifications-expected.txt (0 => 95641)


--- trunk/LayoutTests/platform/mac/accessibility/textbox-role-reports-notifications-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/textbox-role-reports-notifications-expected.txt	2011-09-21 16:45:12 UTC (rev 95641)
@@ -0,0 +1,6 @@
+ALERT: Successfully received AXValueChanged.
+ALERT: Successfully received AXValueChanged.
+ALERT: Successfully received AXValueChanged.
+This tests that the AXValueChanged notification is correctly reported for non-native text boxes when content is changed.
+changed innerText
+

Added: trunk/LayoutTests/platform/mac/accessibility/textbox-role-reports-notifications.html (0 => 95641)


--- trunk/LayoutTests/platform/mac/accessibility/textbox-role-reports-notifications.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/textbox-role-reports-notifications.html	2011-09-21 16:45:12 UTC (rev 95641)
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body>
+This tests that the AXValueChanged notification is correctly reported for non-native text boxes when content is changed.<br>
+<div role="textbox" id="ariaTextBox" aria-multiline="false" tabindex="0">Some text in a textbox.</div>
+<div id="console"></div>
+<script>
+    if (window.layoutTestController && window.accessibilityController) {
+        window.layoutTestController.waitUntilDone();
+
+        accessibilityController.logAccessibilityEvents();
+        window.layoutTestController.dumpAsText();
+
+        var ariaTextBox = document.getElementById("ariaTextBox");
+        ariaTextBox.focus();
+        var textboxAxElement = accessibilityController.focusedElement;
+        textboxAxElement.addNotificationListener(logNotification);
+        pendingNotifications = 3;
+        ariaTextBox.firstChild.deleteData(0, 5);
+        ariaTextBox.textContent = "changed textContent";
+        ariaTextBox.innerText = "changed innerText";
+    }
+
+    function logNotification(notification) {
+        if (notification == "AXValueChanged") {
+            alert("Successfully received AXValueChanged.");
+            pendingNotifications--;
+            if (pendingNotifications == 0) {
+                textboxAxElement.removeNotificationListener();
+                window.layoutTestController.notifyDone();
+            }
+        }
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (95640 => 95641)


--- trunk/Source/WebCore/ChangeLog	2011-09-21 16:39:50 UTC (rev 95640)
+++ trunk/Source/WebCore/ChangeLog	2011-09-21 16:45:12 UTC (rev 95641)
@@ -1,3 +1,19 @@
+2011-09-21  Alice Boxhall  <aboxh...@chromium.org>
+
+        Report AXValueChanged when value changes in element with role=textbox.
+        https://bugs.webkit.org/show_bug.cgi?id=68201
+
+        Reviewed by Chris Fleizach.
+
+        Test: platform/mac/accessibility/textbox-role-reports-notifications.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isARIATextControl):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::contentChanged):
+        (WebCore::AccessibilityRenderObject::childrenChanged):
+
 2011-09-21  Pavel Feldman  <pfeld...@google.com>
 
         Web Inspector: introduce Page.enable and Page.disable

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (95640 => 95641)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2011-09-21 16:39:50 UTC (rev 95640)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2011-09-21 16:45:12 UTC (rev 95641)
@@ -245,6 +245,12 @@
     return node() && node()->hasTagName(blockquoteTag);
 }
 
+
+bool AccessibilityObject::isARIATextControl() const
+{
+    return ariaRoleAttribute() == TextAreaRole || ariaRoleAttribute() == TextFieldRole;
+}
+
 bool AccessibilityObject::isLandmark() const
 {
     AccessibilityRole role = roleValue();

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (95640 => 95641)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2011-09-21 16:39:50 UTC (rev 95640)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2011-09-21 16:45:12 UTC (rev 95641)
@@ -370,6 +370,7 @@
     virtual bool isMenuListPopup() const { return false; }
     virtual bool isMenuListOption() const { return false; }
     bool isTextControl() const { return roleValue() == TextAreaRole || roleValue() == TextFieldRole; }
+    bool isARIATextControl() const;
     bool isTabList() const { return roleValue() == TabListRole; }
     bool isTabItem() const { return roleValue() == TabRole; }
     bool isRadioGroup() const { return roleValue() == RadioGroupRole; }

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (95640 => 95641)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-09-21 16:39:50 UTC (rev 95640)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-09-21 16:45:12 UTC (rev 95641)
@@ -767,7 +767,7 @@
 {
     return roleValue() == GroupRole;
 }
-    
+
 AccessibilityObject* AccessibilityRenderObject::selectedRadioButton()
 {
     if (!isRadioGroup())
@@ -3354,19 +3354,19 @@
 
 void AccessibilityRenderObject::contentChanged()
 {
-    // If this element supports ARIA live regions, then notify the AT of changes.
+    // If this element supports ARIA live regions, or is part of a region with an ARIA editable role,
+    // then notify the AT of changes.
     AXObjectCache* cache = axObjectCache();
     for (RenderObject* renderParent = m_renderer; renderParent; renderParent = renderParent->parent()) {
         AccessibilityObject* parent = cache->get(renderParent);
         if (!parent)
             continue;
         
-        // If we find a parent that has ARIA live region on, send the notification and stop processing.
-        // The spec does not talk about nested live regions.
-        if (parent->supportsARIALiveRegion()) {
-            axObjectCache()->postNotification(renderParent, AXObjectCache::AXLiveRegionChanged, true);
-            break;
-        }
+        if (parent->supportsARIALiveRegion())
+            cache->postNotification(renderParent, AXObjectCache::AXLiveRegionChanged, true);
+
+        if (parent->isARIATextControl() && !parent->isNativeTextControl() && !parent->node()->isContentEditable())
+            cache->postNotification(renderParent, AXObjectCache::AXValueChanged, true);
     }
 }
     
@@ -3375,7 +3375,7 @@
     // This method is meant as a quick way of marking a portion of the accessibility tree dirty.
     if (!m_renderer)
         return;
-    
+
     bool sentChildrenChanged = false;
     
     // Go up the accessibility parent chain, but only if the element already exists. This method is
@@ -3403,6 +3403,10 @@
             // If this element supports ARIA live regions, then notify the AT of changes.
             if (axParent->supportsARIALiveRegion())
                 axObjectCache()->postNotification(axParent->renderer(), AXObjectCache::AXLiveRegionChanged, true);
+
+            // If this element is an ARIA text control, notify the AT of changes.
+            if (axParent->isARIATextControl() && !axParent->isNativeTextControl() && !axParent->node()->isContentEditable())
+                axObjectCache()->postNotification(axParent->renderer(), AXObjectCache::AXValueChanged, true);
         }
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to