Title: [97177] trunk
Revision
97177
Author
[email protected]
Date
2011-10-11 13:46:25 -0700 (Tue, 11 Oct 2011)

Log Message

AccessibilityMenuList should fire change notification when popup is not open.
https://bugs.webkit.org/show_bug.cgi?id=69440

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/menu-list-sends-change-notification.html

* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::didUpdateActiveOption):

LayoutTests:

* accessibility/menu-list-sends-change-notification.html: Added.
* platform/chromium/accessibility/menu-list-sends-change-notification-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97176 => 97177)


--- trunk/LayoutTests/ChangeLog	2011-10-11 20:44:37 UTC (rev 97176)
+++ trunk/LayoutTests/ChangeLog	2011-10-11 20:46:25 UTC (rev 97177)
@@ -1,3 +1,13 @@
+2011-10-11  Dominic Mazzoni  <[email protected]>
+
+        AccessibilityMenuList should fire change notification when popup is not open.
+        https://bugs.webkit.org/show_bug.cgi?id=69440
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/menu-list-sends-change-notification.html: Added.
+        * platform/chromium/accessibility/menu-list-sends-change-notification-expected.txt: Added.
+
 2011-10-11  Dimitri Glazkov  <[email protected]>
 
         [Chromium] Suddenly, things are crashing sporadically.

Added: trunk/LayoutTests/accessibility/menu-list-sends-change-notification.html (0 => 97177)


--- trunk/LayoutTests/accessibility/menu-list-sends-change-notification.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/menu-list-sends-change-notification.html	2011-10-11 20:46:25 UTC (rev 97177)
@@ -0,0 +1,54 @@
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script>
+    if (window.layoutTestController)
+        layoutTestController.waitUntilDone();
+
+    function runTest() {
+        description("This tests that changing the value of a menu list sends a notification even when it's not popped open.");
+
+        var menulist = document.getElementById("menulist");
+        menulist.focus();
+        var accessibleMenulist = accessibilityController.focusedElement;
+
+        function listener(notification) {
+            document.getElementById("console").innerText += "Got notification: " + notification + "\n";
+            accessibleMenulist.removeNotificationListener(listener);
+            debug('<br /><span class="pass">TEST COMPLETE</span>');
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+        accessibleMenulist.addNotificationListener(listener);
+
+        // Change the selected index.
+        menulist.selectedIndex = 1;
+
+        // Make the test finish quickly whether we get the notification or not.
+        window.setTimeout(function() {
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }, 10);
+    }
+
+    if (window.layoutTestController && window.accessibilityController) {
+        window.addEventListener('load', function() {
+            setTimeout(runTest, 10);
+        }, false);
+    }
+</script>
+</head>
+<body>
+
+<select id="menulist">
+  <option selected>One</option>
+  <option>Two</option>
+  <option>Three</option>
+</select>
+
+<p id="description"></p>
+<div id="console"></div>
+
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/accessibility/menu-list-sends-change-notification-expected.txt (0 => 97177)


--- trunk/LayoutTests/platform/chromium/accessibility/menu-list-sends-change-notification-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/accessibility/menu-list-sends-change-notification-expected.txt	2011-10-11 20:46:25 UTC (rev 97177)
@@ -0,0 +1,10 @@
+
+This tests that changing the value of a menu list sends a notification even when it's not popped open.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Got notification: MenuListValueChanged
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (97176 => 97177)


--- trunk/Source/WebCore/ChangeLog	2011-10-11 20:44:37 UTC (rev 97176)
+++ trunk/Source/WebCore/ChangeLog	2011-10-11 20:46:25 UTC (rev 97177)
@@ -1,3 +1,15 @@
+2011-10-11  Dominic Mazzoni  <[email protected]>
+
+        AccessibilityMenuList should fire change notification when popup is not open.
+        https://bugs.webkit.org/show_bug.cgi?id=69440
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/menu-list-sends-change-notification.html
+
+        * accessibility/AccessibilityMenuList.cpp:
+        (WebCore::AccessibilityMenuList::didUpdateActiveOption):
+
 2011-10-11  Joshua Bell  <[email protected]>
 
         IndexedDB: implement IDBFactory.cmp method

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp (97176 => 97177)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2011-10-11 20:44:37 UTC (rev 97176)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2011-10-11 20:46:25 UTC (rev 97177)
@@ -84,19 +84,20 @@
 
 void AccessibilityMenuList::didUpdateActiveOption(int optionIndex)
 {
-    const AccessibilityChildrenVector& childObjects = children();
-    if (childObjects.isEmpty())
-        return;
-
-    ASSERT(childObjects.size() == 1);
-    ASSERT(childObjects[0]->isMenuListPopup());
-
     RefPtr<Document> document = m_renderer->document();
     AXObjectCache* cache = document->axObjectCache();
 
-    if (AccessibilityMenuListPopup* popup = static_cast<AccessibilityMenuListPopup*>(childObjects[0].get()))
-        popup->didUpdateActiveOption(optionIndex);
+    const AccessibilityChildrenVector& childObjects = children();
+    if (!childObjects.isEmpty()) {
+        ASSERT(childObjects.size() == 1);
+        ASSERT(childObjects[0]->isMenuListPopup());
 
+        if (childObjects[0]->isMenuListPopup()) {
+            if (AccessibilityMenuListPopup* popup = static_cast<AccessibilityMenuListPopup*>(childObjects[0].get()))
+                popup->didUpdateActiveOption(optionIndex);
+        }
+    }
+
     cache->postNotification(this, document.get(), AXObjectCache::AXMenuListValueChanged, true, PostSynchronously);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to