Changeset 76721 in webkit
- Timestamp:
- Jan 26, 2011 2:43:44 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76719 r76721 1 2011-01-26 Mario Sanchez Prada <msanchez@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Reliable crash with getTextAtOffset() 6 https://bugs.webkit.org/show_bug.cgi?id=53131 7 8 Properly calculate length in bytes for a UTF8 substring. 9 10 * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: 11 (utf8Substr): Use character instead of bytes as units to 12 calculate the length in bytes for the UTF8 string. 13 1 14 2011-01-25 Dimitri Glazkov <dglazkov@chromium.org> 2 15 -
trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
r76442 r76721 995 995 return 0; 996 996 gchar* startPtr = g_utf8_offset_to_pointer(string, start); 997 gsize lenInBytes = g_utf8_offset_to_pointer(string, end ) - startPtr + 1;997 gsize lenInBytes = g_utf8_offset_to_pointer(string, end + 1) - startPtr; 998 998 gchar* output = static_cast<gchar*>(g_malloc0(lenInBytes + 1)); 999 999 return g_utf8_strncpy(output, startPtr, end - start + 1); -
trunk/Source/WebKit/gtk/ChangeLog
r76351 r76721 1 2011-01-26 Mario Sanchez Prada <msanchez@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Reliable crash with getTextAtOffset() 6 https://bugs.webkit.org/show_bug.cgi?id=53131 7 8 New unit test to check the fix for this bug. 9 10 * tests/testatk.c: 11 (testWebkitAtkGetTextAtOffsetWithSpecialCharacters): New. 12 (main): Add new unit test. 13 1 14 2011-01-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/Source/WebKit/gtk/tests/testatk.c
r75250 r76721 33 33 static const char* contentsWithNewlines = "<html><body><p>This is a test. \n\nThis\n is the second sentence. And this the third.</p></body></html>"; 34 34 35 static const char* contentsWithSpecialChars = "<html><body><p>« This is a paragraph with “special” characters inside. »</p></body></html>"; 36 35 37 static const char* contentsInTextarea = "<html><body><textarea cols='80'>This is a test. This is the second sentence. And this the third.</textarea></body></html>"; 36 38 … … 450 452 451 453 runGetTextTests(textObject); 454 455 g_object_unref(webView); 456 } 457 458 static void testWebkitAtkGetTextAtOffsetWithSpecialCharacters() 459 { 460 WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); 461 g_object_ref_sink(webView); 462 GtkAllocation allocation = { 0, 0, 800, 600 }; 463 gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation); 464 webkit_web_view_load_string(webView, contentsWithSpecialChars, 0, 0, 0); 465 466 /* Wait for the accessible objects to be created. */ 467 waitForAccessibleObjects(); 468 469 /* Get to the inner AtkText object. */ 470 AtkObject* object = gtk_widget_get_accessible(GTK_WIDGET(webView)); 471 g_assert(object); 472 object = atk_object_ref_accessible_child(object, 0); 473 g_assert(object); 474 475 AtkText* textObject = ATK_TEXT(object); 476 g_assert(ATK_IS_TEXT(textObject)); 477 478 const gchar* expectedText = "\302\253\302\240This is a paragraph with \342\200\234special\342\200\235 characters inside.\302\240\302\273"; 479 char* text = atk_text_get_text(textObject, 0, -1); 480 g_assert_cmpstr(text, ==, expectedText); 481 g_free(text); 482 483 /* Check that getting the text with ATK_TEXT_BOUNDARY_LINE_START 484 and ATK_TEXT_BOUNDARY_LINE_END does not crash because of not 485 properly handling characters inside the UTF-8 string. */ 486 testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, expectedText, 0, 57); 487 testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, expectedText, 0, 57); 452 488 453 489 g_object_unref(webView); … … 1321 1357 g_test_add_func("/webkit/atk/getTextAtOffsetTextarea", testWebkitAtkGetTextAtOffsetTextarea); 1322 1358 g_test_add_func("/webkit/atk/getTextAtOffsetTextInput", testWebkitAtkGetTextAtOffsetTextInput); 1359 g_test_add_func("/webkit/atk/getTextAtOffsetWithSpecialCharacters", testWebkitAtkGetTextAtOffsetWithSpecialCharacters); 1323 1360 g_test_add_func("/webkit/atk/getTextInParagraphAndBodySimple", testWebkitAtkGetTextInParagraphAndBodySimple); 1324 1361 g_test_add_func("/webkit/atk/getTextInParagraphAndBodyModerate", testWebkitAtkGetTextInParagraphAndBodyModerate);
Note: See TracChangeset
for help on using the changeset viewer.