+2012-02-02 Mario Sanchez Prada <msanchez@igalia.com>
+
+ [Gtk] atk_text_get_text_at_offset() sometimes fails to provide the correct line
+ https://bugs.webkit.org/show_bug.cgi?id=72382
+
+ Reviewed by Martin Robinson.
+
+ Do not add unnecesary blanks at the end of a line of text.
+
+ * accessibility/gtk/WebKitAccessibleInterfaceText.cpp:
+ (textForRenderer): Do not just append a '\n' at the end of a line
+ if the linebreak for that line was already considered.
+
2012-02-02 Raul Hudea <rhudea@adobe.com>
Regions should ignore the saved currentRenderFlowThread during repainting
// Newline chars in the source result in separate text boxes, so check
// before adding a newline in the layout. See bug 25415 comment #78.
// If the next sibling is a BR, we'll add the newline when we examine that child.
- if (!box->nextOnLineExists() && (!object->nextSibling() || !object->nextSibling()->isBR()))
+ if (!box->nextOnLineExists() && !(object->nextSibling() && object->nextSibling()->isBR())) {
+ // If there was a '\n' in the last position of the
+ // current text box, it would have been converted to a
+ // space in String::replace(), so remove it first.
+ if (renderText->characters()[box->end()] == '\n')
+ g_string_erase(resultText, resultText->len - 1, -1);
+
g_string_append(resultText, "\n");
+ }
box = box->nextTextBox();
}
}
+2012-02-02 Mario Sanchez Prada <msanchez@igalia.com>
+
+ [Gtk] atk_text_get_text_at_offset() sometimes fails to provide the correct line
+ https://bugs.webkit.org/show_bug.cgi?id=72382
+
+ Reviewed by Martin Robinson.
+
+ New unit test to ensure the right line is retrieved for the first
+ position of each line in a multiline preformatted portion of text.
+
+ * tests/testatk.c:
+ (testWebkitAtkGetTextAtOffsetWithPreformattedText): New unit test.
+ (main): Add the new unit test.
+
2012-02-01 Philippe Normand <pnormand@igalia.com>
[GStreamer] FFTFrame implementation
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>";
+static const char* contentsWithPreformattedText = "<html><body><pre>\n\t\n\tfirst line\n\tsecond line\n</pre></body></html>";
+
static const char* contentsWithSpecialChars = "<html><body><p>« This is a paragraph with “special” characters inside. »</p></body></html>";
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>";
g_object_unref(webView);
}
+static void testWebkitAtkGetTextAtOffsetWithPreformattedText()
+{
+ WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ g_object_ref_sink(webView);
+ GtkAllocation allocation = { 0, 0, 800, 600 };
+ gtk_widget_size_allocate(GTK_WIDGET(webView), &allocation);
+ webkit_web_view_load_string(webView, contentsWithPreformattedText, 0, 0, 0);
+
+ AtkObject* object = getWebAreaObject(webView);
+ g_assert(object);
+
+ AtkObject* preformattedText = atk_object_ref_accessible_child(object, 0);
+ g_assert(ATK_IS_OBJECT(preformattedText));
+ g_assert(atk_object_get_role(preformattedText) == ATK_ROLE_PANEL);
+ g_assert(ATK_IS_TEXT(preformattedText));
+ char* text = atk_text_get_text(ATK_TEXT(preformattedText), 0, -1);
+ g_assert_cmpstr(text, ==, "\t\n\tfirst line\n\tsecond line\n");
+ g_free(text);
+
+ /* Try retrieving all the lines indicating the position of the offsets at the beginning of each of them. */
+ testGetTextFunction(ATK_TEXT(preformattedText), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, "\t\n", 0, 2);
+ testGetTextFunction(ATK_TEXT(preformattedText), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 2, "\tfirst line\n", 2, 14);
+ testGetTextFunction(ATK_TEXT(preformattedText), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 14, "\tsecond line\n", 14, 27);
+
+ g_object_unref(preformattedText);
+ g_object_unref(webView);
+}
+
static void testWebkitAtkGetTextAtOffsetWithSpecialCharacters()
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_test_add_func("/webkit/atk/getTextAtOffsetNewlines", testWebkitAtkGetTextAtOffsetNewlines);
g_test_add_func("/webkit/atk/getTextAtOffsetTextarea", testWebkitAtkGetTextAtOffsetTextarea);
g_test_add_func("/webkit/atk/getTextAtOffsetTextInput", testWebkitAtkGetTextAtOffsetTextInput);
+ g_test_add_func("/webkit/atk/getTextAtOffsetWithPreformattedText", testWebkitAtkGetTextAtOffsetWithPreformattedText);
g_test_add_func("/webkit/atk/getTextAtOffsetWithSpecialCharacters", testWebkitAtkGetTextAtOffsetWithSpecialCharacters);
g_test_add_func("/webkit/atk/getTextInParagraphAndBodySimple", testWebkitAtkGetTextInParagraphAndBodySimple);
g_test_add_func("/webkit/atk/getTextInParagraphAndBodyModerate", testWebkitAtkGetTextInParagraphAndBodyModerate);