Skip to content
  • zandobersek@gmail.com's avatar
    [Gtk] Incorrect/unexpected characters in the text of certain accessibles · a2613b79
    zandobersek@gmail.com authored
    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
    a2613b79