Changeset 51342 in webkit


Ignore:
Timestamp:
Nov 24, 2009 10:47:14 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-11-24 Joanmarie Diggs <joanmarie.diggs@gmail.com>

Reviewed by Xan Lopez.

https://bugs.webkit.org/show_bug.cgi?id=25415
[GTK][ATK] Please implement support for get_text_at_offset

When building up the pango layout from text boxes, only append a
newline char after verifying there are no more boxes on this line.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (getPangoLayoutForAtk):

2009-11-24 Joanmarie Diggs <joanmarie.diggs@gmail.com>

Reviewed by Xan Lopez.

https://bugs.webkit.org/show_bug.cgi?id=25415
[GTK][ATK] Please implement support for get_text_at_offset

When building up the pango layout from text boxes, only append a
newline char after verifying there are no more boxes on this line.

  • tests/testatk.c (test_webkit_atk_get_text_at_offset_newlines): (main):
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51341 r51342  
     12009-11-24  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25415
     6        [GTK][ATK] Please implement support for get_text_at_offset
     7
     8        When building up the pango layout from text boxes, only append a
     9        newline char after verifying there are no more boxes on this line.
     10
     11        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     12        (getPangoLayoutForAtk):
     13
    1142009-11-24  Joseph Pecoraro  <joepeck@webkit.org>
    215
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r50797 r51342  
    891891        gchar* text = convertUniCharToUTF8(renderText->characters(), renderText->textLength(), box->start(), box->end());
    892892        g_string_append(str, text);
    893         g_string_append(str, "\n");
     893        // Newline chars in the source result in separate text boxes, so check
     894        // before adding a newline in the layout. See bug 25415 comment #78.
     895        if (!box->nextOnLineExists())
     896            g_string_append(str, "\n");
    894897        box = box->nextTextBox();
    895898    }
  • trunk/WebKit/gtk/ChangeLog

    r51188 r51342  
     12009-11-24  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25415
     6        [GTK][ATK] Please implement support for get_text_at_offset
     7
     8        When building up the pango layout from text boxes, only append a
     9        newline char after verifying there are no more boxes on this line.
     10
     11        * tests/testatk.c
     12        (test_webkit_atk_get_text_at_offset_newlines):
     13        (main):
     14
    1152009-11-19  Pavel Feldman  <pfeldman@chromium.org>
    216
  • trunk/WebKit/gtk/tests/testatk.c

    r50208 r51342  
    2929static const char* contents = "<html><body><p>This is a test. This is the second sentence. And this the third.</p></body></html>";
    3030
     31static const char* contentsWithNewlines = "<html><body><p>This is a test. \n\nThis\n is the second sentence. And this the third.</p></body></html>";
     32
    3133static gboolean bail_out(GMainLoop* loop)
    3234{
     
    260262}
    261263
     264static void test_webkit_atk_get_text_at_offset_newlines(void)
     265{
     266    WebKitWebView* webView;
     267    AtkObject* obj;
     268    GMainLoop* loop;
     269    AtkText* text_obj;
     270
     271    webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     272    g_object_ref_sink(webView);
     273    GtkAllocation alloc = { 0, 0, 800, 600 };
     274    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
     275    webkit_web_view_load_string(webView, contentsWithNewlines, NULL, NULL, NULL);
     276    loop = g_main_loop_new(NULL, TRUE);
     277
     278    g_timeout_add(100, (GSourceFunc)bail_out, loop);
     279    g_main_loop_run(loop);
     280
     281    /* Get to the inner AtkText object */
     282    obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
     283    g_assert(obj);
     284    obj = atk_object_ref_accessible_child(obj, 0);
     285    g_assert(obj);
     286    obj = atk_object_ref_accessible_child(obj, 0);
     287    g_assert(obj);
     288
     289    text_obj = ATK_TEXT(obj);
     290    g_assert(ATK_IS_TEXT(text_obj));
     291
     292    run_get_text_tests(text_obj);
     293
     294    g_object_unref(webView);
     295}
     296
    262297int main(int argc, char** argv)
    263298{
     
    268303    g_test_add_func("/webkit/atk/get_text_at_offset", test_webkit_atk_get_text_at_offset);
    269304    g_test_add_func("/webkit/atk/get_text_at_offset_forms", test_webkit_atk_get_text_at_offset_forms);
     305    g_test_add_func("/webkit/atk/get_text_at_offset_newlines", test_webkit_atk_get_text_at_offset_newlines);
    270306    return g_test_run ();
    271307}
Note: See TracChangeset for help on using the changeset viewer.