Skip to content
Permalink
Browse files
AX: Add a check for touch event listener on iOS accessibility object
https://bugs.webkit.org/show_bug.cgi?id=160388

Reviewed by Chris Fleizach.

Source/WebCore:

dispatchTouchEvent() is not working correctly within AXPress() sometimes. Need to
investigate it more in the future. Now, adding a check for the touch event listener
on the object's node so that iOS can handle dispatching the touch event instead.

Test: accessibility/ios-simulator/has-touch-event-listener.html

* accessibility/AccessibilityObject.h:
* accessibility/ios/AccessibilityObjectIOS.mm:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
(WebCore::AccessibilityObject::hasTouchEventListener):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(appendStringToResult):
(-[WebAccessibilityObjectWrapper _accessibilityHasTouchEventListener]):
(-[WebAccessibilityObjectWrapper _accessibilityValueIsAutofilled]):

Tools:

* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::boolAttributeValue):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::boolAttributeValue):

LayoutTests:

* accessibility/ios-simulator/has-touch-event-listener-expected.txt: Added.
* accessibility/ios-simulator/has-touch-event-listener.html: Added.


Canonical link: https://commits.webkit.org/178538@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Nan Wang committed Jul 31, 2016
1 parent 6ac1d74 commit e42939f4c1a6043de060ba50dc13e09c720cee0f
Showing 11 changed files with 124 additions and 1 deletion.
@@ -1,3 +1,13 @@
2016-07-31 Nan Wang <n_wang@apple.com>

AX: Add a check for touch event listener on iOS accessibility object
https://bugs.webkit.org/show_bug.cgi?id=160388

Reviewed by Chris Fleizach.

* accessibility/ios-simulator/has-touch-event-listener-expected.txt: Added.
* accessibility/ios-simulator/has-touch-event-listener.html: Added.

2016-07-30 Mark Lam <mark.lam@apple.com>

Assertion failure while setting the length of an ArrayClass array.
@@ -0,0 +1,13 @@
button
link
Makes sure that we can check if an AXObject has touch event listener.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS button.boolAttributeValue('AXHasTouchEventListener') is true
PASS link.boolAttributeValue('AXHasTouchEventListener') is true
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script>
var successfullyParsed = false;
if (window.testRunner)
testRunner.dumpAsText();

function click() {}

</script>
</head>
<body>

<div role="button" id="button" ontouchstart="chick();"">button</div>
<div role="link" ontouchend="chick();"><div id="link">link</div></div>

<p id="description"></p>
<div id="console"></div>

<script>

description("Makes sure that we can check if an AXObject has touch event listener.");

if (window.accessibilityController) {
var button = accessibilityController.accessibleElementById("button");
var link = accessibilityController.accessibleElementById("link");
shouldBeTrue("button.boolAttributeValue('AXHasTouchEventListener')");
shouldBeTrue("link.boolAttributeValue('AXHasTouchEventListener')");
}

successfullyParsed = true;
</script>

<script src="../../resources/js-test-post.js"></script>

</body>
</html>

@@ -1,3 +1,25 @@
2016-07-31 Nan Wang <n_wang@apple.com>

AX: Add a check for touch event listener on iOS accessibility object
https://bugs.webkit.org/show_bug.cgi?id=160388

Reviewed by Chris Fleizach.

dispatchTouchEvent() is not working correctly within AXPress() sometimes. Need to
investigate it more in the future. Now, adding a check for the touch event listener
on the object's node so that iOS can handle dispatching the touch event instead.

Test: accessibility/ios-simulator/has-touch-event-listener.html

* accessibility/AccessibilityObject.h:
* accessibility/ios/AccessibilityObjectIOS.mm:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
(WebCore::AccessibilityObject::hasTouchEventListener):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(appendStringToResult):
(-[WebAccessibilityObjectWrapper _accessibilityHasTouchEventListener]):
(-[WebAccessibilityObjectWrapper _accessibilityValueIsAutofilled]):

2016-07-30 Chris Dumez <cdumez@apple.com>

Unreviewed, rebaseline bindings tests.
@@ -922,6 +922,7 @@ bool AccessibilityObject::press()

UserGestureIndicator gestureIndicator(ProcessingUserGesture, document);

// FIXME: dispatchTouchEvent() is not dispatching the touch event correctly.
bool dispatchedTouchEvent = dispatchTouchEvent();
if (!dispatchedTouchEvent)
pressElement->accessKeyAction(true);
@@ -1040,6 +1040,7 @@ class AccessibilityObject : public RefCounted<AccessibilityObject> {

#if PLATFORM(IOS)
int accessibilityPasswordFieldLength();
bool hasTouchEventListener() const;
#endif

// allows for an AccessibilityObject to update its render tree or perform
@@ -26,6 +26,7 @@
#import "config.h"
#import "AccessibilityObject.h"
#import "AccessibilityRenderObject.h"
#import "EventNames.h"
#import "HTMLInputElement.h"
#import "RenderObject.h"
#import "WAKView.h"
@@ -80,7 +81,16 @@ - (BOOL)accessibilityIsIgnored
{
return DefaultBehavior;
}


bool AccessibilityObject::hasTouchEventListener() const
{
for (Node* node = this->node(); node; node = node->parentNode()) {
if (node->hasEventListeners(eventNames().touchstartEvent) || node->hasEventListeners(eventNames().touchendEvent))
return true;
}
return false;
}

} // WebCore

#endif // HAVE(ACCESSIBILITY) && PLATFORM(IOS)
@@ -949,6 +949,14 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
[result appendString:string];
}

- (BOOL)_accessibilityHasTouchEventListener
{
if (![self _prepareAccessibilityCall])
return NO;

return m_object->hasTouchEventListener();
}

- (BOOL)_accessibilityValueIsAutofilled
{
if (![self _prepareAccessibilityCall])
@@ -1,3 +1,15 @@
2016-07-31 Nan Wang <n_wang@apple.com>

AX: Add a check for touch event listener on iOS accessibility object
https://bugs.webkit.org/show_bug.cgi?id=160388

Reviewed by Chris Fleizach.

* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::boolAttributeValue):
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::boolAttributeValue):

2016-07-30 Manuel Rego Casasnovas <rego@igalia.com>

Unreviewed: add myself to the reviewers list.
@@ -95,6 +95,7 @@ - (NSUInteger)accessibilityARIARowIndex;
- (NSUInteger)accessibilityARIAColumnIndex;
- (UIAccessibilityTraits)_axContainedByFieldsetTrait;
- (id)_accessibilityFieldsetAncestor;
- (BOOL)_accessibilityHasTouchEventListener;

// TextMarker related
- (NSArray *)textMarkerRange;
@@ -667,6 +668,8 @@ static void _CGPathEnumerationIteration(void *info, const CGPathElement *element

bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
{
if (JSStringIsEqualToUTF8CString(attribute, "AXHasTouchEventListener"))
return [m_element _accessibilityHasTouchEventListener];
return false;
}

@@ -72,6 +72,7 @@ - (NSUInteger)accessibilityARIARowIndex;
- (NSUInteger)accessibilityARIAColumnIndex;
- (UIAccessibilityTraits)_axContainedByFieldsetTrait;
- (id)_accessibilityFieldsetAncestor;
- (BOOL)_accessibilityHasTouchEventListener;

// TextMarker related
- (NSArray *)textMarkerRange;
@@ -379,6 +380,8 @@ static JSValueRef convertElementsToObjectArray(JSContextRef context, Vector<RefP

bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
{
if (JSStringIsEqualToUTF8CString(attribute, "AXHasTouchEventListener"))
return [m_element _accessibilityHasTouchEventListener];
return false;
}

0 comments on commit e42939f

Please sign in to comment.