Bug 131933

Summary: AX: [ATK] caret-moved not emitted by text directly in html body
Product: WebKit Reporter: Jarek Czekalski <jarekczek>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bugs-noreply, jdiggs, webkit-bug-importer
Priority: P2 Keywords: Gtk, InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
patch with a test case none

Description Jarek Czekalski 2014-04-21 04:35:37 PDT
Created attachment 229799 [details]
patch with a test case

Under some circumstances text enclosed directly in <body> does not behave like text. atk_text_set_caret_offset does not allow to position the cursor inside it and caret-moved events are not emitted.

The simple example is as follows:

<html><body>
<div>div1</div>abc<div>div2</div>
</body></html>

Divs are accessible, but the text between them is not. If there were no misleading divs, the text alone is accessible. Once a div after or before is added, the problem arises.

I prepared a test case for that. To make such tests easier I prepared a helper testWebkitAtkCaretWalk method. So in this testatk.c diff there is also a test case for bug #130941 included. The name of the test for this bug report is caretInBody.
Comment 1 Radar WebKit Bug Importer 2014-04-21 04:37:14 PDT
<rdar://problem/16673736>
Comment 2 Jarek Czekalski 2014-04-26 08:07:17 PDT
First clue.

In Source/WebCore/accessibility/AccessibilityRenderObject.cpp, function AccessibilityRenderObject::textUnderElement, line 664, we have a comment:
            // For anonymous blocks, we work around not having a direct node to create a range from
            // defining one based in the two external positions defining the boundaries of the subtree.

But when we set cursor position, we rely on visiblePositionForIndex, the same file, line 1859. There it returns empty position for anonymous blocks (!node).