Title: [241190] trunk
Revision
241190
Author
[email protected]
Date
2019-02-08 00:37:26 -0800 (Fri, 08 Feb 2019)

Log Message

Source/WebCore:
When performing AXPress, check to see if the menu list is disabled.
https://bugs.webkit.org/show_bug.cgi?id=193878

Patch by Eric Liang <[email protected]> on 2019-02-08
Reviewed by Chris Fleizach.

Test: accessibility/mac/press-not-work-for-disabled-menu-list.html

* accessibility/AXObjectCache.h:
* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::press):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):

LayoutTests:
Check if receive AXPressDidFail notification when performing AXPress action on disabled MenuList.
https://bugs.webkit.org/show_bug.cgi?id=193878

Patch by Eric Liang <[email protected]> on 2019-02-08
Reviewed by Chris Fleizach.

* accessibility/mac/press-not-work-for-disabled-menu-list.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (241189 => 241190)


--- trunk/LayoutTests/ChangeLog	2019-02-08 06:51:52 UTC (rev 241189)
+++ trunk/LayoutTests/ChangeLog	2019-02-08 08:37:26 UTC (rev 241190)
@@ -1,3 +1,12 @@
+2019-02-08  Eric Liang  <[email protected]>
+
+        Check if receive AXPressDidFail notification when performing AXPress action on disabled MenuList.
+        https://bugs.webkit.org/show_bug.cgi?id=193878
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/press-not-work-for-disabled-menu-list.html: Added.
+
 2019-02-07  Devin Rousso  <[email protected]>
 
         PseudoElement created for any ::before/::after selector regardless of whether a content property exists

Added: trunk/LayoutTests/accessibility/mac/press-not-work-for-disabled-menu-list-expected.txt (0 => 241190)


--- trunk/LayoutTests/accessibility/mac/press-not-work-for-disabled-menu-list-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/press-not-work-for-disabled-menu-list-expected.txt	2019-02-08 08:37:26 UTC (rev 241190)
@@ -0,0 +1,13 @@
+    
+This tests that menu lists that are disabled will not be triggered by AXPress actions.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Got notification: AXPressDidFail
+Got notification: AXPressDidFail
+Got notification: AXPressDidFail
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/press-not-work-for-disabled-menu-list.html (0 => 241190)


--- trunk/LayoutTests/accessibility/mac/press-not-work-for-disabled-menu-list.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/press-not-work-for-disabled-menu-list.html	2019-02-08 08:37:26 UTC (rev 241190)
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+<div id="content">
+
+<select id="test0" disabled>
+     <option value="1">Cork</option>
+     <option value="2">Cupertino</option>
+     <option value="3">London</option>
+     <option value="4">New York</option>
+     <option value="5">Singapore</option>
+     <option value="6">Tokyo</option>
+</select>
+
+<select id="test1" disabled aria-disabled="false">
+    <option value="1">Cork</option>
+    <option value="2">Cupertino</option>
+    <option value="3">London</option>
+    <option value="4">New York</option>
+    <option value="5">Singapore</option>
+    <option value="6">Tokyo</option>
+</select>
+
+<select id="test2" disabled aria-disabled="true">
+    <option value="1">Cork</option>
+    <option value="2">Cupertino</option>
+    <option value="3">London</option>
+    <option value="4">New York</option>
+    <option value="5">Singapore</option>
+    <option value="6">Tokyo</option>
+</select>
+
+<p id="description"></p>
+<div id="console"></div>
+
+</div>
+
+<script>
+    description("This tests that menu lists that are disabled will not be triggered by AXPress actions.");
+
+    // We don't test for enabled controls because opening menu lists waits on the UI process to display the menu.
+    var numOfTests = 3, notificationCount = 0;
+    var lists = [null, null, null];
+    if (window.accessibilityController) {
+        jsTestIsAsync = true;
+        pressNext(0);
+    }
+
+    function pressNext(testId) {
+        if (testId > numOfTests)
+            return;
+        var menulist = accessibilityController.accessibleElementById("test" + testId);
+        menulist.addNotificationListener(pressListener);
+        menulist.press();
+        lists[testId] = menulist;
+        window.setTimeout(function() {
+            pressNext(testId + 1);
+        }, 0);
+    }
+
+    function pressListener(notification) {
+        if (notification == "AXPressDidFail" || notification == "AXPressDidSucceed")
+            notificationCount++;
+
+        debug("Got notification: " + notification);
+        lists[notificationCount-1].removeNotificationListener(pressListener);
+        if (notificationCount == numOfTests) {
+            finishJSTest();
+        }
+    }
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (241189 => 241190)


--- trunk/Source/WebCore/ChangeLog	2019-02-08 06:51:52 UTC (rev 241189)
+++ trunk/Source/WebCore/ChangeLog	2019-02-08 08:37:26 UTC (rev 241190)
@@ -1,3 +1,18 @@
+2019-02-08  Eric Liang  <[email protected]>
+
+        When performing AXPress, check to see if the menu list is disabled.
+        https://bugs.webkit.org/show_bug.cgi?id=193878
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/mac/press-not-work-for-disabled-menu-list.html
+
+        * accessibility/AXObjectCache.h:
+        * accessibility/AccessibilityMenuList.cpp:
+        (WebCore::AccessibilityMenuList::press):
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postPlatformNotification):
+
 2019-02-07  Devin Rousso  <[email protected]>
 
         PseudoElement created for any ::before/::after selector regardless of whether a content property exists

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (241189 => 241190)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2019-02-08 06:51:52 UTC (rev 241189)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2019-02-08 08:37:26 UTC (rev 241190)
@@ -291,6 +291,8 @@
         AXRowExpanded,
         AXExpandedChanged,
         AXInvalidStatusChanged,
+        AXPressDidSucceed,
+        AXPressDidFail,
         AXPressedStateChanged,
         AXReadOnlyStatusChanged,
         AXRequiredStatusChanged,

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp (241189 => 241190)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2019-02-08 06:51:52 UTC (rev 241189)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp	2019-02-08 08:37:26 UTC (rev 241190)
@@ -45,15 +45,21 @@
 bool AccessibilityMenuList::press()
 {
 #if !PLATFORM(IOS_FAMILY)
-    RenderMenuList* menuList = static_cast<RenderMenuList*>(renderer());
-    if (menuList->popupIsVisible())
-        menuList->hidePopup();
-    else
-        menuList->showPopup();
+    auto element = this->element();
+    AXObjectCache::AXNotification notification = AXObjectCache::AXPressDidFail;
+    if (element && !element->isDisabledFormControl() && is<RenderMenuList>(renderer())) {
+        RenderMenuList* menuList = downcast<RenderMenuList>(renderer());
+        if (menuList->popupIsVisible())
+            menuList->hidePopup();
+        else
+            menuList->showPopup();
+        notification = AXObjectCache::AXPressDidSucceed;
+    }
+    if (auto cache = axObjectCache())
+        cache->postNotification(element, notification);
     return true;
-#else
+#endif
     return false;
-#endif
 }
 
 void AccessibilityMenuList::addChildren()

Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (241189 => 241190)


--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2019-02-08 06:51:52 UTC (rev 241189)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm	2019-02-08 08:37:26 UTC (rev 241190)
@@ -346,6 +346,12 @@
         case AXMenuListItemSelected:
             macNotification = (id)kAXMenuItemSelectedNotification;
             break;
+        case AXPressDidSucceed:
+            macNotification = @"AXPressDidSucceed";
+            break;
+        case AXPressDidFail:
+            macNotification = @"AXPressDidFail";
+            break;
         case AXMenuOpened:
             macNotification = (id)kAXMenuOpenedNotification;
             break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to