Title: [204062] trunk
Revision
204062
Author
n_w...@apple.com
Date
2016-08-02 19:38:35 -0700 (Tue, 02 Aug 2016)

Log Message

AX: Simulated touch events are not working on iOS
https://bugs.webkit.org/show_bug.cgi?id=160395
<rdar://problem/27633597>

Reviewed by Chris Fleizach.

Source/WebCore:

We should mark the simulated touch as a potential tap otherwise it won't
be handled on iOS. Also, we need to dispatch both touch start and touch end
to mimic the real touch events. Last, added a has event listeners check,
because iOS is dispatching mouse click events for elements without touch event
listeners.

Test: accessibility/ios-simulator/press-fires-touch-events.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::press):
(WebCore::AccessibilityObject::dispatchTouchEvent):
* page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::dispatchSimulatedTouchEvent):
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::PlatformTouchEventBuilder::PlatformTouchEventBuilder):

Tools:

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::press):
(WTR::AccessibilityUIElement::setSelectedChild):

LayoutTests:

* accessibility/ios-simulator/press-fires-touch-events-expected.txt: Added.
* accessibility/ios-simulator/press-fires-touch-events.html: Added.
* platform/ios-simulator-wk2/TestExpectations:
* platform/ios-simulator/ios/accessibility/press-fires-touch-events-expected.txt: Removed.
* platform/ios-simulator/ios/accessibility/press-fires-touch-events.html: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204061 => 204062)


--- trunk/LayoutTests/ChangeLog	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/LayoutTests/ChangeLog	2016-08-03 02:38:35 UTC (rev 204062)
@@ -1,3 +1,17 @@
+2016-08-02  Nan Wang  <n_w...@apple.com>
+
+        AX: Simulated touch events are not working on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=160395
+        <rdar://problem/27633597>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/press-fires-touch-events-expected.txt: Added.
+        * accessibility/ios-simulator/press-fires-touch-events.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations:
+        * platform/ios-simulator/ios/accessibility/press-fires-touch-events-expected.txt: Removed.
+        * platform/ios-simulator/ios/accessibility/press-fires-touch-events.html: Removed.
+
 2016-08-02  Saam Barati  <sbar...@apple.com>
 
         update a class extending null w.r.t the ES7 spec

Copied: trunk/LayoutTests/accessibility/ios-simulator/press-fires-touch-events-expected.txt (from rev 204061, trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events-expected.txt) (0 => 204062)


--- trunk/LayoutTests/accessibility/ios-simulator/press-fires-touch-events-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/press-fires-touch-events-expected.txt	2016-08-03 02:38:35 UTC (rev 204062)
@@ -0,0 +1,12 @@
+button
+Ensure that if an element on handles touch events, the simulated accessibility press will still activate those elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Received touch start [object TouchEvent]
+Received touch ended [object TouchEvent]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/accessibility/ios-simulator/press-fires-touch-events.html (from rev 204061, trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events.html) (0 => 204062)


--- trunk/LayoutTests/accessibility/ios-simulator/press-fires-touch-events.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/press-fires-touch-events.html	2016-08-03 02:38:35 UTC (rev 204062)
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script>
+var successfullyParsed = false;
+if (window.testRunner)
+   testRunner.dumpAsText();
+
+function touchEnd(event) {
+    debug("Received touch ended " + event);
+    event.stopPropagation(); 
+    event.preventDefault();
+}
+
+function touchStart(event) {
+    debug("Received touch start " + event);
+    event.stopPropagation(); 
+    event.preventDefault();
+}
+
+</script>
+</head>
+<body>
+
+<div role="button" id="button" _ontouchstart_="touchStart(event);" _ontouchend_="touchEnd(event);">button</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("Ensure that if an element on handles touch events, the simulated accessibility press will still activate those elements.");
+
+    if (window.accessibilityController) {
+        var button = accessibilityController.accessibleElementById("button");
+        button.press();
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+
+</body>
+</html>
+

Deleted: trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events-expected.txt (204061 => 204062)


--- trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events-expected.txt	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events-expected.txt	2016-08-03 02:38:35 UTC (rev 204062)
@@ -1,12 +0,0 @@
-button
-Ensure that if an element on handles touch events, the simulated accessibility press will still activate those elements.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Received touch start [object TouchEvent]
-Received touch ended [object TouchEvent]
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events.html (204061 => 204062)


--- trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events.html	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/LayoutTests/platform/ios-simulator/ios/accessibility/press-fires-touch-events.html	2016-08-03 02:38:35 UTC (rev 204062)
@@ -1,47 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-<script>
-var successfullyParsed = false;
-if (window.testRunner)
-   testRunner.dumpAsText();
-
-function touchEnd(event) {
-    debug("Received touch ended " + event);
-    event.stopPropagation(); 
-    event.preventDefault();
-}
-
-function touchStart(event) {
-    debug("Received touch start " + event);
-    event.stopPropagation(); 
-    event.preventDefault();
-}
-
-</script>
-</head>
-<body>
-
-<div role="button" id="button" _ontouchstart_="touchStart(event);" _ontouchend_="touchEnd(event);">button</div>
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-
-    description("Ensure that if an element on handles touch events, the simulated accessibility press will still activate those elements.");
-
-    if (window.accessibilityController) {
-        var button = accessibilityController.accessibleElementById("button");
-        button.press();
-    }
-
-    successfullyParsed = true;
-</script>
-
-<script src=""
-
-</body>
-</html>
-

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (204061 => 204062)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-08-03 02:38:35 UTC (rev 204062)
@@ -1794,7 +1794,7 @@
 fast/replaced/border-radius-clip.html [ Failure ]
 fast/writing-mode/japanese-lr-selection.html [ Failure ]
 fast/writing-mode/japanese-rl-selection.html [ Failure ]
-platform/ios-simulator/ios/accessibility/press-fires-touch-events.html [ Failure ]
+accessibility/ios-simulator/press-fires-touch-events.html [ Skip ]
 
 fast/text/combining-character-sequence-vertical.html [ ImageOnlyFailure ]
 fast/text/vertical-quotation-marks.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (204061 => 204062)


--- trunk/Source/WebCore/ChangeLog	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/Source/WebCore/ChangeLog	2016-08-03 02:38:35 UTC (rev 204062)
@@ -1,3 +1,27 @@
+2016-08-02  Nan Wang  <n_w...@apple.com>
+
+        AX: Simulated touch events are not working on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=160395
+        <rdar://problem/27633597>
+
+        Reviewed by Chris Fleizach.
+
+        We should mark the simulated touch as a potential tap otherwise it won't
+        be handled on iOS. Also, we need to dispatch both touch start and touch end
+        to mimic the real touch events. Last, added a has event listeners check,
+        because iOS is dispatching mouse click events for elements without touch event
+        listeners.
+
+        Test: accessibility/ios-simulator/press-fires-touch-events.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::press):
+        (WebCore::AccessibilityObject::dispatchTouchEvent):
+        * page/ios/EventHandlerIOS.mm:
+        (WebCore::EventHandler::dispatchSimulatedTouchEvent):
+        * platform/ios/PlatformEventFactoryIOS.mm:
+        (WebCore::PlatformTouchEventBuilder::PlatformTouchEventBuilder):
+
 2016-08-02  Benjamin Poulain  <bpoul...@apple.com>
 
         Clean up some useless AtomicString atoms

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (204061 => 204062)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2016-08-03 02:38:35 UTC (rev 204062)
@@ -922,8 +922,11 @@
     
     UserGestureIndicator gestureIndicator(ProcessingUserGesture, document);
     
-    // FIXME: dispatchTouchEvent() is not dispatching the touch event correctly.
-    bool dispatchedTouchEvent = dispatchTouchEvent();
+    bool dispatchedTouchEvent = false;
+#if PLATFORM(IOS)
+    if (hasTouchEventListener())
+        dispatchedTouchEvent = dispatchTouchEvent();
+#endif
     if (!dispatchedTouchEvent)
         pressElement->accessKeyAction(true);
     
@@ -938,7 +941,7 @@
     if (!frame)
         return false;
 
-    frame->eventHandler().dispatchSimulatedTouchEvent(clickPoint());
+    handled = frame->eventHandler().dispatchSimulatedTouchEvent(clickPoint());
 #endif
     return handled;
 }

Modified: trunk/Source/WebCore/page/ios/EventHandlerIOS.mm (204061 => 204062)


--- trunk/Source/WebCore/page/ios/EventHandlerIOS.mm	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/Source/WebCore/page/ios/EventHandlerIOS.mm	2016-08-03 02:38:35 UTC (rev 204062)
@@ -108,8 +108,7 @@
 bool EventHandler::dispatchSimulatedTouchEvent(IntPoint location)
 {
     bool handled = handleTouchEvent(PlatformEventFactory::createPlatformSimulatedTouchEvent(PlatformEvent::TouchStart, location));
-    if (handled)
-        handleTouchEvent(PlatformEventFactory::createPlatformSimulatedTouchEvent(PlatformEvent::TouchEnd, location));
+    handled |= handleTouchEvent(PlatformEventFactory::createPlatformSimulatedTouchEvent(PlatformEvent::TouchEnd, location));
     return handled;
 }
     

Modified: trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm (204061 => 204062)


--- trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm	2016-08-03 02:38:35 UTC (rev 204062)
@@ -272,6 +272,7 @@
         m_isGesture = 0;
         m_position = location;
         m_globalPosition = location;
+        m_isPotentialTap = true;
         
         unsigned touchCount = 1;
         m_touchPoints.reserveInitialCapacity(touchCount);

Modified: trunk/Tools/ChangeLog (204061 => 204062)


--- trunk/Tools/ChangeLog	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/Tools/ChangeLog	2016-08-03 02:38:35 UTC (rev 204062)
@@ -1,3 +1,15 @@
+2016-08-02  Nan Wang  <n_w...@apple.com>
+
+        AX: Simulated touch events are not working on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=160395
+        <rdar://problem/27633597>
+
+        Reviewed by Chris Fleizach.
+
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::press):
+        (WTR::AccessibilityUIElement::setSelectedChild):
+
 2016-08-02  Filip Pizlo  <fpi...@apple.com>
 
         run-_javascript_core-tests should accept multiple --extra-tests

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (204061 => 204062)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2016-08-03 02:20:40 UTC (rev 204061)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2016-08-03 02:38:35 UTC (rev 204062)
@@ -806,6 +806,7 @@
 
 void AccessibilityUIElement::press()
 {
+    [m_element _accessibilityActivate];
 }
 
 void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement* element) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to