Title: [170008] trunk
Revision
170008
Author
[email protected]
Date
2014-06-16 08:01:06 -0700 (Mon, 16 Jun 2014)

Log Message

[ATK] Missing 'selection-changed' signal when navigating a combo box with keyboard
https://bugs.webkit.org/show_bug.cgi?id=133512

Reviewed by Chris Fleizach.

Source/WebCore:
Make sure that AccessibilityMenuList objects update their active
option when it changes, which will send a platform-dependent
accessibility-related notification when needed.

Test: accessibility/combo-box-collapsed-selection-changed.html

* rendering/RenderMenuList.cpp:
(RenderMenuList::didUpdateActiveOption): Keep the out-of-bounds
check for the index passed but don't avoid updating the option for
the associated AccessibilityMenuList object if the selected list
item does not have a renderer, because that could be the case for
cases where the popup (and its elements) would be rendered in the
UI Process (e.g. GTK+ port uses GtkMenu and GtkMenuItem for that).

* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::didUpdateActiveOption): Ensure
that the AccessibilityMenuListPopup object for a given menu list
has accessibility children before updating its active option.

Tools:
Added support for connecting to AtkSelection's 'selection-changed'
signal, and print it out as AXSelectedChildrenChanged in the tests.

Also removed some dead code, that became useless after r169487.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
(WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks): Updated.

LayoutTests:
Re-implemented test for combo boxes in terms of addNotificationListener()
instead of using the (already deprecated) logAccessibilityEvents method,
and made the test cross platform (as the fix is not platform specific).

* accessibility/combo-box-collapsed-selection-changed.html:
Implemented based on the former gtk-only test, and made it cross-platform.
* accessibility/combo-box-collapsed-selection-changed-expected.txt: New.
* platform/gtk/accessibility/combo-box-collapsed-selection-changed.html: Removed.
* platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt: Removed.

Updated expectation for test that checks that a notification is
sent when navigating through a multiselection list box, now that
we are actually printing such a notification.

* accessibility/multiselect-list-reports-active-option-expected.txt: Updated.

Removed two expected failures from TestExpectations for tests that
are now passing, one for the combo box test mentioned above and
another one for a test that is passing as well now, after applying
this fix: accessibility/menu-list-sends-change-notification.html

* platform/gtk/TestExpectations: Removed two 'failure' expectations.

* platform/mac/TestExpectations: Skip accessiblity test timing out, probably because
those kind of notifications while navigating a combo box are not needed in the Mac.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (170007 => 170008)


--- trunk/LayoutTests/ChangeLog	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/LayoutTests/ChangeLog	2014-06-16 15:01:06 UTC (rev 170008)
@@ -1,3 +1,36 @@
+2014-06-16  Mario Sanchez Prada  <[email protected]>
+
+        [ATK] Missing 'selection-changed' signal when navigating a combo box with keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=133512
+
+        Reviewed by Chris Fleizach.
+
+        Re-implemented test for combo boxes in terms of addNotificationListener()
+        instead of using the (already deprecated) logAccessibilityEvents method,
+        and made the test cross platform (as the fix is not platform specific).
+
+        * accessibility/combo-box-collapsed-selection-changed.html:
+        Implemented based on the former gtk-only test, and made it cross-platform.
+        * accessibility/combo-box-collapsed-selection-changed-expected.txt: New.
+        * platform/gtk/accessibility/combo-box-collapsed-selection-changed.html: Removed.
+        * platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt: Removed.
+
+        Updated expectation for test that checks that a notification is
+        sent when navigating through a multiselection list box, now that
+        we are actually printing such a notification.
+
+        * accessibility/multiselect-list-reports-active-option-expected.txt: Updated.
+
+        Removed two expected failures from TestExpectations for tests that
+        are now passing, one for the combo box test mentioned above and
+        another one for a test that is passing as well now, after applying
+        this fix: accessibility/menu-list-sends-change-notification.html
+
+        * platform/gtk/TestExpectations: Removed two 'failure' expectations.
+
+        * platform/mac/TestExpectations: Skip accessiblity test timing out, probably because
+        those kind of notifications while navigating a combo box are not needed in the Mac.
+
 2014-06-16  Frédéric Wang  <[email protected]>
 
         Draw radicals with glyphs for better rendering

Added: trunk/LayoutTests/accessibility/combo-box-collapsed-selection-changed-expected.txt (0 => 170008)


--- trunk/LayoutTests/accessibility/combo-box-collapsed-selection-changed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/combo-box-collapsed-selection-changed-expected.txt	2014-06-16 15:01:06 UTC (rev 170008)
@@ -0,0 +1,11 @@
+
+This tests that a combo box notifies when the selected child has changed while arrowing through the options of a combobox while collapsed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS selectionChangedNotifications is 4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/combo-box-collapsed-selection-changed.html (0 => 170008)


--- trunk/LayoutTests/accessibility/combo-box-collapsed-selection-changed.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/combo-box-collapsed-selection-changed.html	2014-06-16 15:01:06 UTC (rev 170008)
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+
+</script>
+</head>
+<body>
+<form>
+<select id="combo">
+<option selected value='foo'>foo</option>
+<option value='bar'>bar</option>
+<option value='baz'>baz</option>
+</select>
+</form>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+window.jsTestIsAsync = true;
+
+description("This tests that a combo box notifies when the selected child has changed while arrowing through the options of a combobox while collapsed.");
+
+var selectionChangedNotifications = 0;
+
+if (window.testRunner && window.accessibilityController) {
+    testRunner.dumpAsText();
+
+    // Focus in the combobox and move around the options. The signal
+    // 'state-change:selected' should be emitted with every change.
+    document.getElementById("combo").focus();
+
+    axCombo = accessibilityController.focusedElement;
+    axCombo.addNotificationListener(function (notification) {
+        if (notification == "AXSelectedChildrenChanged")
+            selectionChangedNotifications++;
+    });
+
+    eventSender.keyDown("downArrow");
+    eventSender.keyDown("downArrow");
+    eventSender.keyDown("upArrow");
+    eventSender.keyDown("upArrow");
+
+    window.setTimeout(function() {
+        if (window.accessibilityController)
+            axCombo.removeNotificationListener();
+
+        shouldBe("selectionChangedNotifications", "4");
+        finishJSTest();
+    }, 0);
+}
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/accessibility/multiselect-list-reports-active-option-expected.txt (170007 => 170008)


--- trunk/LayoutTests/accessibility/multiselect-list-reports-active-option-expected.txt	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/LayoutTests/accessibility/multiselect-list-reports-active-option-expected.txt	2014-06-16 15:01:06 UTC (rev 170008)
@@ -22,6 +22,8 @@
 PASS accessibleTwo.isSelectedOptionActive is false
 PASS accessibleThree.isSelected is true
 PASS accessibleThree.isSelectedOptionActive is true
+List notification: AXSelectedChildrenChanged
+List notification: AXSelectedChildrenChanged
 
 TEST COMPLETE
 

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (170007 => 170008)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2014-06-16 15:01:06 UTC (rev 170008)
@@ -1681,8 +1681,6 @@
 webkit.org/b/113772 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation.html [ Failure ]
 webkit.org/b/113772 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_cached.html [ Failure ]
 
-webkit.org/b/114259 platform/gtk/accessibility/combo-box-collapsed-selection-changed.html [ Failure ]
-
 webkit.org/b/115025 fast/events/constructors/mouse-event-constructor.html [ Failure ]
 webkit.org/b/115025 fast/events/constructors/wheel-event-constructor.html [ Failure ]
 
@@ -1786,8 +1784,6 @@
 
 webkit.org/b/125406 fast/regions/relative-in-absolute-borders-overflow.html [ ImageOnlyFailure ]
 
-webkit.org/b/126521 accessibility/menu-list-sends-change-notification.html [ Failure ]
-
 webkit.org/b/126619 http/tests/media/video-auth.html [ Failure ]
 
 # Subpixel rendering: borders are reporting float values.

Deleted: trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt (170007 => 170008)


--- trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt	2014-06-16 15:01:06 UTC (rev 170008)
@@ -1,36 +0,0 @@
-Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 11
-Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 11
-Accessibility object emitted "state-change:selected = 1" / Name: "bar" / Role: 34
-Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 34
-Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 34
-Accessibility object emitted "focus-event = 1" / Name: "baz" / Role: 11
-Accessibility object emitted "state-change:focused = 1" / Name: "baz" / Role: 11
-Accessibility object emitted "focus-event = 0" / Name: "bar" / Role: 34
-Accessibility object emitted "state-change:focused = 0" / Name: "bar" / Role: 34
-Accessibility object emitted "state-change:selected = 1" / Name: "baz" / Role: 34
-Accessibility object emitted "focus-event = 1" / Name: "baz" / Role: 34
-Accessibility object emitted "state-change:focused = 1" / Name: "baz" / Role: 34
-Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 11
-Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 11
-Accessibility object emitted "focus-event = 0" / Name: "baz" / Role: 34
-Accessibility object emitted "state-change:focused = 0" / Name: "baz" / Role: 34
-Accessibility object emitted "state-change:selected = 1" / Name: "bar" / Role: 34
-Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 34
-Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 34
-Accessibility object emitted "focus-event = 1" / Name: "foo" / Role: 11
-Accessibility object emitted "state-change:focused = 1" / Name: "foo" / Role: 11
-Accessibility object emitted "focus-event = 0" / Name: "bar" / Role: 34
-Accessibility object emitted "state-change:focused = 0" / Name: "bar" / Role: 34
-Accessibility object emitted "state-change:selected = 1" / Name: "foo" / Role: 34
-Accessibility object emitted "focus-event = 1" / Name: "foo" / Role: 34
-Accessibility object emitted "state-change:focused = 1" / Name: "foo" / Role: 34
-
-This tests that the 'state-changed:selected' signal is emitted when arrowing through the options of a combobox while collapsed.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed.html (170007 => 170008)


--- trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed.html	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed.html	2014-06-16 15:01:06 UTC (rev 170008)
@@ -1,42 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-<script>
-
-function runTest() {
-  description("This tests that the 'state-changed:selected' signal is emitted when arrowing through the options of a combobox while collapsed.");
-
-  if (window.testRunner) {
-    testRunner.dumpAsText();
-  }
-
-  if (window.accessibilityController) {
-    accessibilityController.logAccessibilityEvents();
-  }
-
-  // Focus in the combobox and move around the options. The signal
-  // 'state-change:selected' should be emitted with every change.
-  document.getElementById("combo").focus();
-  eventSender.keyDown("downArrow");
-  eventSender.keyDown("downArrow");
-  eventSender.keyDown("upArrow");
-  eventSender.keyDown("upArrow");
-}
-</script>
-</head>
-<body _onload_="runTest();">
-<form>
-<select id="combo">
-<option selected value='foo'>foo</option>
-<option value='bar'>bar</option>
-<option value='baz'>baz</option>
-</select>
-</form>
-<p id="description"></p>
-<div id="console"></div>
-<script>
-</script>
-<script src=""
-</body>
-</html>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (170007 => 170008)


--- trunk/LayoutTests/platform/mac/TestExpectations	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2014-06-16 15:01:06 UTC (rev 170008)
@@ -41,6 +41,7 @@
 
 # Accessibility tests for notifications that don't exist or aren't needed on Mac OS X.
 accessibility/aria-checkbox-sends-notification.html
+accessibility/combo-box-collapsed-selection-changed.html
 accessibility/children-changed-sends-notification.html
 accessibility/menu-list-sends-change-notification.html
 accessibility/multiselect-list-reports-active-option.html

Modified: trunk/Source/WebCore/ChangeLog (170007 => 170008)


--- trunk/Source/WebCore/ChangeLog	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/Source/WebCore/ChangeLog	2014-06-16 15:01:06 UTC (rev 170008)
@@ -1,3 +1,29 @@
+2014-06-16  Mario Sanchez Prada  <[email protected]>
+
+        [ATK] Missing 'selection-changed' signal when navigating a combo box with keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=133512
+
+        Reviewed by Chris Fleizach.
+
+        Make sure that AccessibilityMenuList objects update their active
+        option when it changes, which will send a platform-dependent
+        accessibility-related notification when needed.
+
+        Test: accessibility/combo-box-collapsed-selection-changed.html
+
+        * rendering/RenderMenuList.cpp:
+        (RenderMenuList::didUpdateActiveOption): Keep the out-of-bounds
+        check for the index passed but don't avoid updating the option for
+        the associated AccessibilityMenuList object if the selected list
+        item does not have a renderer, because that could be the case for
+        cases where the popup (and its elements) would be rendered in the
+        UI Process (e.g. GTK+ port uses GtkMenu and GtkMenuItem for that).
+
+        * accessibility/AccessibilityMenuList.cpp:
+        (WebCore::AccessibilityMenuList::didUpdateActiveOption): Ensure
+        that the AccessibilityMenuListPopup object for a given menu list
+        has accessibility children before updating its active option.
+
 2014-06-16  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r170003.

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp (170007 => 170008)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2014-06-16 15:01:06 UTC (rev 170008)
@@ -113,7 +113,14 @@
         ASSERT(childObjects.size() == 1);
         ASSERT(childObjects[0]->isMenuListPopup());
 
-        if (childObjects[0]->isMenuListPopup()) {
+        // We might be calling this method in situations where the renderers for list items
+        // associated to the menu list have not been created (e.g. they might be rendered
+        // in the UI process, as it's the case in the GTK+ port, which uses GtkMenuItem).
+        // So, we need to make sure that the accessibility popup object has some children
+        // before asking it to update its active option, or it will read invalid memory.
+        // You can reproduce the issue in the GTK+ port by removing this check and running
+        // accessibility/insert-selected-option-into-select-causes-crash.html (will crash).
+        if (childObjects[0]->isMenuListPopup() && childObjects[0]->children().size()) {
             if (AccessibilityMenuListPopup* popup = toAccessibilityMenuListPopup(childObjects[0].get()))
                 popup->didUpdateActiveOption(optionIndex);
         }

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (170007 => 170008)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2014-06-16 15:01:06 UTC (rev 170008)
@@ -436,10 +436,8 @@
     if (listIndex < 0 || listIndex >= static_cast<int>(selectElement().listItems().size()))
         return;
 
-    HTMLElement* listItem = selectElement().listItems()[listIndex];
-    ASSERT(listItem);
-    if (listItem->renderer()) {
-        if (AccessibilityMenuList* menuList = toAccessibilityMenuList(document().axObjectCache()->get(this)))
+    if (AXObjectCache* cache = document().existingAXObjectCache()) {
+        if (AccessibilityMenuList* menuList = toAccessibilityMenuList(cache->get(this)))
             menuList->didUpdateActiveOption(optionIndex);
     }
 }

Modified: trunk/Tools/ChangeLog (170007 => 170008)


--- trunk/Tools/ChangeLog	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/Tools/ChangeLog	2014-06-16 15:01:06 UTC (rev 170008)
@@ -1,3 +1,18 @@
+2014-06-16  Mario Sanchez Prada  <[email protected]>
+
+        [ATK] Missing 'selection-changed' signal when navigating a combo box with keyboard
+        https://bugs.webkit.org/show_bug.cgi?id=133512
+
+        Reviewed by Chris Fleizach.
+
+        Added support for connecting to AtkSelection's 'selection-changed'
+        signal, and print it out as AXSelectedChildrenChanged in the tests.
+
+        Also removed some dead code, that became useless after r169487.
+
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
+        (WTR::AccessibilityNotificationHandler::connectAccessibilityCallbacks): Updated.
+
 2014-06-15  Ryuan Choi  <[email protected]>
 
         [EFL][WK2] Change ewk_view_settings_get to ewk_page_group_settings_get

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp (170007 => 170008)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp	2014-06-16 12:17:10 UTC (rev 170007)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp	2014-06-16 15:01:06 UTC (rev 170008)
@@ -63,44 +63,35 @@
 #endif
 
     GSignalQuery signalQuery;
-    GUniquePtr<char> signalName;
-    GUniquePtr<char> signalValue;
     const char* notificationName = nullptr;
     Vector<JSValueRef> extraArgs;
 
     g_signal_query(signalHint->signal_id, &signalQuery);
 
     if (!g_strcmp0(signalQuery.signal_name, "state-change")) {
-        signalName.reset(g_strdup_printf("state-change:%s", g_value_get_string(&paramValues[1])));
-        signalValue.reset(g_strdup_printf("%d", g_value_get_boolean(&paramValues[2])));
         if (!g_strcmp0(g_value_get_string(&paramValues[1]), "checked"))
             notificationName = "CheckedStateChanged";
         else if (!g_strcmp0(g_value_get_string(&paramValues[1]), "invalid-entry"))
             notificationName = "AXInvalidStatusChanged";
     } else if (!g_strcmp0(signalQuery.signal_name, "focus-event")) {
-        signalName.reset(g_strdup("focus-event"));
-        signalValue.reset(g_strdup_printf("%d", g_value_get_boolean(&paramValues[1])));
         if (g_value_get_boolean(&paramValues[1]))
             notificationName = "AXFocusedUIElementChanged";
+    } else if (!g_strcmp0(signalQuery.signal_name, "selection-changed")) {
+        notificationName = "AXSelectedChildrenChanged";
     } else if (!g_strcmp0(signalQuery.signal_name, "children-changed")) {
         const gchar* childrenChangedDetail = g_quark_to_string(signalHint->detail);
-        signalName.reset(g_strdup_printf("children-changed:%s", childrenChangedDetail));
-        signalValue.reset(g_strdup_printf("%d", g_value_get_uint(&paramValues[1])));
         notificationName = !g_strcmp0(childrenChangedDetail, "add") ? "AXChildrenAdded" : "AXChildrenRemoved";
     } else if (!g_strcmp0(signalQuery.signal_name, "property-change")) {
-        signalName.reset(g_strdup_printf("property-change:%s", g_quark_to_string(signalHint->detail)));
         if (!g_strcmp0(g_quark_to_string(signalHint->detail), "accessible-value"))
             notificationName = "AXValueChanged";
     } else if (!g_strcmp0(signalQuery.signal_name, "load-complete"))
         notificationName = "AXLoadComplete";
     else if (!g_strcmp0(signalQuery.signal_name, "text-caret-moved")) {
         notificationName = "AXTextCaretMoved";
-        signalName.reset(g_strdup(signalQuery.signal_name));
-        signalValue.reset(g_strdup_printf("%d", g_value_get_int(&paramValues[1])));
+        GUniquePtr<char> signalValue(g_strdup_printf("%d", g_value_get_int(&paramValues[1])));
         JSRetainPtr<JSStringRef> jsSignalValue(Adopt, JSStringCreateWithUTF8CString(signalValue.get()));
         extraArgs.append(JSValueMakeString(jsContext, jsSignalValue.get()));
-    } else
-        signalName.reset(g_strdup(signalQuery.signal_name));
+    }
 
     if (!jsContext)
         return true;
@@ -225,6 +216,7 @@
         "ATK:AtkObject:property-change",
         "ATK:AtkObject:visible-data-changed",
         "ATK:AtkDocument:load-complete",
+        "ATK:AtkSelection:selection-changed",
         "ATK:AtkText:text-caret-moved",
         0
     };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to