Bug 71298

Summary: AX: WK2: layout tests that require hit testing do not work with WK2
Product: WebKit Reporter: chris fleizach <cfleizach>
Component: AccessibilityAssignee: chris fleizach <cfleizach>
Status: NEW ---    
Severity: Normal CC: dbates, webkit-bug-importer, zan
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description chris fleizach 2011-11-01 10:06:19 PDT
These tests

+platform/mac/accessibility/html-slider-indicator.html
+platform/mac/accessibility/listbox-hit-test.html
+platform/mac/accessibility/iframe-with-title-correct-hierarchy.html

which require hit testing do not work with WK2 right now.
Comment 1 Radar WebKit Bug Importer 2013-12-20 11:25:30 PST
<rdar://problem/15710006>
Comment 2 Martin Robinson 2015-05-08 16:07:23 PDT
*** Bug 98371 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Bates 2015-06-19 19:01:08 PDT
From looking at <http://trac.webkit.org/browser/trunk/Source/WebKit/mac/WebView/WebHTMLView.mm?rev=185021#L4636> and <http://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm?rev=165870#L51>, window.accessibilityController.elementAtPoint() expects that the specified coordinates of the point are with respect to the screen coordinate system and ultimately converts them to document ("content") coordinates. But the analogous function in WebKitTestRunner, <http://trac.webkit.org/browser/trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp?rev=179409#L92>, expects the specified coordinates to be with respect to the document coordinate system (*). We need to teach WebKitTestRunner to convert from screen coordinates to document coordinates.

On another note, I'm unclear how we came to the decision to have methods on AccessibilityController and AccessibilityUIElement take and return points with respect to the screen coordinate system as opposed to the document coordinate system. I take it there is value in using screen coordinates?

(*) The point is ultimately passed unchanged through to AccessibilityRenderObject::accessibilityHitTest(). And AccessibilityRenderObject::accessibilityHitTest() assumes the point is in document coordinates. The call chain has the form:
... => JSAccessibilityController::elementAtPoint() => AccessibilityController::elementAtPoint() => AccessibilityUIElement::elementAtPoint() => -[WebAccessibilityObjectWrapper accessibilityHitTest:] => AccessibilityScrollView::accessibilityHitTest() => AccessibilityRenderObject::accessibilityHitTest().
Comment 4 chris fleizach 2015-06-19 19:06:20 PDT
(In reply to comment #3)
> From looking at
> <http://trac.webkit.org/browser/trunk/Source/WebKit/mac/WebView/WebHTMLView.
> mm?rev=185021#L4636> and
> <http://trac.webkit.org/browser/trunk/Tools/DumpRenderTree/mac/
> AccessibilityControllerMac.mm?rev=165870#L51>,
> window.accessibilityController.elementAtPoint() expects that the specified
> coordinates of the point are with respect to the screen coordinate system
> and ultimately converts them to document ("content") coordinates. But the
> analogous function in WebKitTestRunner,
> <http://trac.webkit.org/browser/trunk/Tools/WebKitTestRunner/InjectedBundle/
> AccessibilityController.cpp?rev=179409#L92>, expects the specified
> coordinates to be with respect to the document coordinate system (*). We
> need to teach WebKitTestRunner to convert from screen coordinates to
> document coordinates.
> 
> On another note, I'm unclear how we came to the decision to have methods on
> AccessibilityController and AccessibilityUIElement take and return points
> with respect to the screen coordinate system as opposed to the document
> coordinate system. I take it there is value in using screen coordinates?
> 
> (*) The point is ultimately passed unchanged through to
> AccessibilityRenderObject::accessibilityHitTest(). And
> AccessibilityRenderObject::accessibilityHitTest() assumes the point is in
> document coordinates. The call chain has the form:
> ... => JSAccessibilityController::elementAtPoint() =>
> AccessibilityController::elementAtPoint() =>
> AccessibilityUIElement::elementAtPoint() => -[WebAccessibilityObjectWrapper
> accessibilityHitTest:] => AccessibilityScrollView::accessibilityHitTest() =>
> AccessibilityRenderObject::accessibilityHitTest().

I think we generally want the testing points to be in document coordinates, but i think we may have done it this way so that we could take the value for the origin or the clickPoint and pass that back into the hit test. those points coming out i believe are converted to system coords