[Gtk] Incorrect/unexpected characters in the text of certain accessibles
https://bugs.webkit.org/show_bug.cgi?id=95180

Patch by Joanmarie Diggs <jdiggs@igalia.com> on 2012-09-01
Reviewed by Chris Fleizach.

Source/WebCore: 

The bug was caused by failing to properly handle anonymous block text
which had object replacement characters (multibyte) in it. Calculating
the string length based on the UTF-8 string meant that we were returning
more characters than were there and in danger of splitting a multibyte
character.

Tests: platform/gtk/accessibility/entry-and-password.html
       platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html

* accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
(webkitAccessibleTextGetText): Convert the text returned by textForObject()
to Unicode before calculating its length.

Source/WebKit/gtk: 

Corrected a unit test in which the expected accessible text was wrong as
a result of this bug. In particular, the AtkText inserted into an empty
text field is expected to be the same text atk_text_get_text() returns.
That was not happening -- and presumably not noticed as a result of the
hard to read textual representation of the multibyte password field
bullets.

* tests/testatk.c:
(testWebkitAtkTextChangedNotifications): Corrected the test and added a
comment so that one knows what the multibyte character is.

Tools: 

The bug that was fixed stood in the way of fully implementing stringValue().
Testing that the bug is fixed requires stringValue() to be fully implemented
and object replacement characters to be printable.

* DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
(replaceCharactersForResults): New method which turns object replacement
characters into "<obj>" so that the characters can be properly shown in
Layout Test results. Also turns "\n" into "<\\n>" so that printing the
accessible text of a single object in the accessible tree doesn't mess up
the readibility of the results.
(AccessibilityUIElement::stringValue): Remove the code that immediately
returned upon encountering an object of ATK_ROLE_PANEL and call the new
replaceCharactersForResults() prior to returning the accessible string
value.

LayoutTests: 

Two new layout tests, plus one updated one.

* platform/gtk/accessibility/deleting-iframe-destroys-axcache-expected.txt: Indicated replaced objects.
* platform/gtk/accessibility/entry-and-password-expected.txt: Added.
* platform/gtk/accessibility/entry-and-password.html: Added.
* platform/gtk/accessibility/replaced-objects-in-anonymous-blocks-expected.txt: Added.
* platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Gtk] No accessible caret-moved events found in certain content
https://bugs.webkit.org/show_bug.cgi?id=72811

Part of the bug was due to extraneous accessible objects resulting
from unignored inline and block spans.

Patch by Joanmarie Diggs <jdiggs@igalia.com> on 2012-09-01
Reviewed by Chris Fleizach.

Source/WebCore: 

Test: platform/gtk/accessibility/spans.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityIsIgnored): Ignore objects that have spanTag tag name.
* accessibility/gtk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): Ignore most anonymous blocks.
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
(roleIsTextType): Add ListItem to the roles which should implement AtkText.

LayoutTests: 

Added new test, updated the results of one test to reflect the fix,
corrected a test with a mismatched element tag.

* platform/gtk/accessibility/aria-roles-unignored-expected.txt: Corrected results having fixed tag.
* platform/gtk/accessibility/aria-roles-unignored.html: Fixed mismatched element tag.
* platform/gtk/accessibility/media-element-expected.txt: Updated to reflect removal of extraneous object.
* platform/gtk/accessibility/spans-expected.txt: Added.
* platform/gtk/accessibility/spans.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127368 268f45cc-cd09-0410-ab3c-d52691b4dbfc