Bug 118577

Summary: [GTK] platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html is failing
Product: WebKit Reporter: Mario Sanchez Prada <mario>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: simon.pena, webkit-bug-importer
Priority: P2 Keywords: Gtk, InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Mario Sanchez Prada 2013-07-11 14:35:14 PDT
The layout test platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html is failing after r152574, although the root cause might have appeared with r152537.

This is the current diff between the expected and actual results:

--- /home/slave/webkitgtk/gtk-linux-64-debug-wk1/build/layout-test-results/platform/gtk/accessibility/replaced-objects-in-anonymous-blocks-expected.txt
+++ /home/slave/webkitgtk/gtk-linux-64-debug-wk1/build/layout-test-results/platform/gtk/accessibility/replaced-objects-in-anonymous-blocks-actual.txt
@@ -12,7 +12,7 @@
 End of test
 AXRole: AXWebArea 
     AXRole: AXParagraph AXValue: Paragraph
-    AXRole: AXGroup AXValue: <obj>button<\n>
+    AXRole: AXGroup AXValue: button
         AXRole: AXButton 
     AXRole: AXGroup AXValue: <obj>
         AXRole: AXScrollArea 

I will add it to the TestExpectations file while the issue is being investigated.
Comment 1 Radar WebKit Bug Importer 2013-07-11 14:35:56 PDT
<rdar://problem/14419663>
Comment 2 Mario Sanchez Prada 2013-10-01 08:46:19 PDT
It seems that the problem is that in the following code from the test...

   <body> 
   <p>Paragraph</p>
   <button>button</button>
   <p></p>
   [...]

The button is placed inside of a render object without an associated DOM node (wrapped by an AccessibilityObject of role GroupRole), which avoids AccessibilityRenderObject::textUnderElement() from using the TextIterator to extract the text under that GroupRole object.

In that scenario, as a consequence of this->node() returning NULL, AccessibilityRenderObject::textUnderElement() ends up calling AccessibilityNodeObject::textUnderElement(), which iterates over every children and finally return the text corresponding to the button but not the object replacement character since it's already asking for the text under that button, not from the point of view of its parent container.

In the same way, if we changed the test to this...

   <body> 
   <p>Paragraph</p>
   lorem ipsum <button>button</button> foo bar baz
   <p></p>
   [...]

... we would still obtain "lorem ipsum button foo bar baz" (no OR character) when exposing the anonymous block containing that test, which is bad for ATK based ATs (Joanie, correct me if I'm wrong).

I'll try to investigate this issue and see if I can find a reasonable solution for this that does not disturb other ports (emitting object replacement characters in these cases is only used in GTK, AFAIK).

Any hint or tip is welcome anyway of course.
Comment 3 Mario Sanchez Prada 2013-10-22 06:21:28 PDT
(In reply to comment #2)
> It seems that the problem is that in the following code from the test...
> 
>    <body> 
>    <p>Paragraph</p>
>    <button>button</button>
>    <p></p>
>    [...]
> 
> The button is placed inside of a render object without an associated DOM node (wrapped by an AccessibilityObject of role GroupRole), which avoids AccessibilityRenderObject::textUnderElement() from using the TextIterator to extract the text under that GroupRole object.
> 
> In that scenario, as a consequence of this->node() returning NULL, AccessibilityRenderObject::textUnderElement() ends up calling AccessibilityNodeObject::textUnderElement(), which iterates over every children and finally return the text corresponding to the button but not the object replacement character since it's already asking for the text under that button, not from the point of view of its parent container.
> 
> In the same way, if we changed the test to this...
> 
>    <body> 
>    <p>Paragraph</p>
>    lorem ipsum <button>button</button> foo bar baz
>    <p></p>
>    [...]
> 
> ... we would still obtain "lorem ipsum button foo bar baz" (no OR character) when exposing the anonymous block containing that test, which is bad for ATK based ATs (Joanie, correct me if I'm wrong).
> 
> I'll try to investigate this issue and see if I can find a reasonable solution for this that does not disturb other ports (emitting object replacement characters in these cases is only used in GTK, AFAIK).
> 
> Any hint or tip is welcome anyway of course.

I found that the root issue behind this was actually not that simple and that it all boils down to a wrong way of doing things in the AtkText implementation.

I'm working on fixing the whole problem in bug 123153, so I'm resolving this one as a duplicate of that one.

*** This bug has been marked as a duplicate of bug 123153 ***