Changeset 107086 in webkit


Ignore:
Timestamp:
Feb 8, 2012 7:38:19 AM (12 years ago)
Author:
mario@webkit.org
Message:

[Gtk] atk_text_get_text_at_offset() fails to provide the correct line for list items whose text wraps
https://bugs.webkit.org/show_bug.cgi?id=73431

Reviewed by Chris Fleizach.

Source/WebCore:

Don't replace item's markers with the objectReplacementCharacter
character, as they will be treated in an special way later on.

  • accessibility/gtk/WebKitAccessibleInterfaceText.cpp:

(textForRenderer): Don't append the objectReplacementCharacter
character for list item's markers.

Source/WebKit/gtk:

Updated unit test to check text wrapping accross different lines
inside list items with bullet markers.

  • tests/testatk.c:

(testWebkitAtkGetTextAtOffsetWithSpecialCharacters): Updated test.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107083 r107086  
     12012-02-08  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        [Gtk] atk_text_get_text_at_offset() fails to provide the correct line for list items whose text wraps
     4        https://bugs.webkit.org/show_bug.cgi?id=73431
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Don't replace item's markers with the objectReplacementCharacter
     9        character, as they will be treated in an special way later on.
     10
     11        * accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
     12        (textForRenderer): Don't append the objectReplacementCharacter
     13        character for list item's markers.
     14
    1152012-02-08  Pavel Feldman  <pfeldman@google.com>
    216
  • trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp

    r106545 r107086  
    7878            renderText = toRenderText(object);
    7979        else {
    80             if (object->isReplaced())
     80            // List item's markers will be treated in an special way
     81            // later on this function, so ignore them here.
     82            if (object->isReplaced() && !renderer->isListItem())
    8183                g_string_append_unichar(resultText, objectReplacementCharacter);
    8284
  • trunk/Source/WebKit/gtk/ChangeLog

    r106901 r107086  
     12012-02-08  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        [Gtk] atk_text_get_text_at_offset() fails to provide the correct line for list items whose text wraps
     4        https://bugs.webkit.org/show_bug.cgi?id=73431
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Updated unit test to check text wrapping accross different lines
     9        inside list items with bullet markers.
     10
     11        * tests/testatk.c:
     12        (testWebkitAtkGetTextAtOffsetWithSpecialCharacters): Updated test.
     13
    1142012-02-06  Martin Robinson  <mrobinson@igalia.com> and Nayan Kumar K  <nayankk@motorola.com>
    215
  • trunk/Source/WebKit/gtk/tests/testatk.c

    r106545 r107086  
    3636static const char* contentsWithPreformattedText = "<html><body><pre>\n\t\n\tfirst line\n\tsecond line\n</pre></body></html>";
    3737
    38 static const char* contentsWithSpecialChars = "<html><body><p>&laquo;&nbsp;This is a paragraph with &ldquo;special&rdquo; characters inside.&nbsp;&raquo;</p></body></html>";
     38static const char* contentsWithSpecialChars = "<html><body><p>&laquo;&nbsp;This is a paragraph with &ldquo;special&rdquo; characters inside.&nbsp;&raquo;</p><ul><li style='max-width:100px;'>List item with some text that wraps across different lines.</li></ul></body></html>";
    3939
    4040static const char* contentsInTextarea = "<html><body><textarea cols='80'>This is a test. This is the second sentence. And this the third.</textarea></body></html>";
     
    811811    AtkObject* object = getWebAreaObject(webView);
    812812    g_assert(object);
    813     object = atk_object_ref_accessible_child(object, 0);
    814     g_assert(object);
    815 
    816     AtkText* textObject = ATK_TEXT(object);
    817     g_assert(ATK_IS_TEXT(textObject));
    818 
    819     const gchar* expectedText = "\302\253\302\240This is a paragraph with \342\200\234special\342\200\235 characters inside.\302\240\302\273";
    820     char* text = atk_text_get_text(textObject, 0, -1);
     813
     814    AtkObject* paragraph = atk_object_ref_accessible_child(object, 0);
     815    g_assert(ATK_IS_TEXT(paragraph));
     816
     817    gchar* expectedText = g_strdup("\302\253\302\240This is a paragraph with \342\200\234special\342\200\235 characters inside.\302\240\302\273");
     818    char* text = atk_text_get_text(ATK_TEXT(paragraph), 0, -1);
    821819    g_assert_cmpstr(text, ==, expectedText);
    822820    g_free(text);
     
    825823       and ATK_TEXT_BOUNDARY_LINE_END does not crash because of not
    826824       properly handling characters inside the UTF-8 string. */
    827     testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, expectedText, 0, 57);
    828     testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, expectedText, 0, 57);
    829 
     825    testGetTextFunction(ATK_TEXT(paragraph), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, expectedText, 0, 57);
     826    testGetTextFunction(ATK_TEXT(paragraph), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, expectedText, 0, 57);
     827    g_free(expectedText);
     828
     829    AtkObject* list = atk_object_ref_accessible_child(object, 1);
     830    g_assert(ATK_OBJECT(list));
     831
     832    AtkText* listItem = ATK_TEXT(atk_object_ref_accessible_child(list, 0));
     833    g_assert(ATK_IS_TEXT(listItem));
     834
     835    text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
     836    g_assert_cmpstr(text, ==, "\342\200\242 List item with some text that wraps across different lines.");
     837    g_free(text);
     838
     839    /* Check that getting the text with ATK_TEXT_BOUNDARY_LINE_START
     840       and ATK_TEXT_BOUNDARY_LINE_END for line items with bullets
     841       (special character) and wrapped text always return the right
     842       piece of text for each line. */
     843    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 3, "\342\200\242 List item ", 0, 12);
     844    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 13, "with some ", 12, 22);
     845    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, "\342\200\242 List item", 0, 11);
     846    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 12, " with some", 11, 21);
     847
     848    g_object_unref(list);
     849    g_object_unref(listItem);
     850    g_object_unref(paragraph);
    830851    g_object_unref(webView);
    831852}
Note: See TracChangeset for help on using the changeset viewer.