Title: [107086] trunk/Source
Revision
107086
Author
ma...@webkit.org
Date
2012-02-08 07:38:19 -0800 (Wed, 08 Feb 2012)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107085 => 107086)


--- trunk/Source/WebCore/ChangeLog	2012-02-08 15:11:37 UTC (rev 107085)
+++ trunk/Source/WebCore/ChangeLog	2012-02-08 15:38:19 UTC (rev 107086)
@@ -1,3 +1,17 @@
+2012-02-08  Mario Sanchez Prada  <msanc...@igalia.com>
+
+        [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.
+
+        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.
+
 2012-02-08  Pavel Feldman  <pfeld...@google.com>
 
         Web Inspector: do not clear entire tree map upon last element deletion.

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp (107085 => 107086)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp	2012-02-08 15:11:37 UTC (rev 107085)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp	2012-02-08 15:38:19 UTC (rev 107086)
@@ -77,7 +77,9 @@
         if (object->isText())
             renderText = toRenderText(object);
         else {
-            if (object->isReplaced())
+            // List item's markers will be treated in an special way
+            // later on this function, so ignore them here.
+            if (object->isReplaced() && !renderer->isListItem())
                 g_string_append_unichar(resultText, objectReplacementCharacter);
 
             // We need to check children, if any, to consider when

Modified: trunk/Source/WebKit/gtk/ChangeLog (107085 => 107086)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-02-08 15:11:37 UTC (rev 107085)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-02-08 15:38:19 UTC (rev 107086)
@@ -1,3 +1,16 @@
+2012-02-08  Mario Sanchez Prada  <msanc...@igalia.com>
+
+        [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.
+
+        Updated unit test to check text wrapping accross different lines
+        inside list items with bullet markers.
+
+        * tests/testatk.c:
+        (testWebkitAtkGetTextAtOffsetWithSpecialCharacters): Updated test.
+
 2012-02-06  Martin Robinson  <mrobin...@igalia.com> and Nayan Kumar K  <naya...@motorola.com>
 
         [GTK] Add TextureMapperGL implementation

Modified: trunk/Source/WebKit/gtk/tests/testatk.c (107085 => 107086)


--- trunk/Source/WebKit/gtk/tests/testatk.c	2012-02-08 15:11:37 UTC (rev 107085)
+++ trunk/Source/WebKit/gtk/tests/testatk.c	2012-02-08 15:38:19 UTC (rev 107086)
@@ -35,7 +35,7 @@
 
 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>&laquo;&nbsp;This is a paragraph with &ldquo;special&rdquo; characters inside.&nbsp;&raquo;</p></body></html>";
+static 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>";
 
 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>";
 
@@ -810,23 +810,44 @@
     /* Get to the inner AtkText object. */
     AtkObject* object = getWebAreaObject(webView);
     g_assert(object);
-    object = atk_object_ref_accessible_child(object, 0);
-    g_assert(object);
 
-    AtkText* textObject = ATK_TEXT(object);
-    g_assert(ATK_IS_TEXT(textObject));
+    AtkObject* paragraph = atk_object_ref_accessible_child(object, 0);
+    g_assert(ATK_IS_TEXT(paragraph));
 
-    const gchar* expectedText = "\302\253\302\240This is a paragraph with \342\200\234special\342\200\235 characters inside.\302\240\302\273";
-    char* text = atk_text_get_text(textObject, 0, -1);
+    gchar* expectedText = g_strdup("\302\253\302\240This is a paragraph with \342\200\234special\342\200\235 characters inside.\302\240\302\273");
+    char* text = atk_text_get_text(ATK_TEXT(paragraph), 0, -1);
     g_assert_cmpstr(text, ==, expectedText);
     g_free(text);
 
     /* Check that getting the text with ATK_TEXT_BOUNDARY_LINE_START
        and ATK_TEXT_BOUNDARY_LINE_END does not crash because of not
        properly handling characters inside the UTF-8 string. */
-    testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, expectedText, 0, 57);
-    testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, expectedText, 0, 57);
+    testGetTextFunction(ATK_TEXT(paragraph), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, expectedText, 0, 57);
+    testGetTextFunction(ATK_TEXT(paragraph), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, expectedText, 0, 57);
+    g_free(expectedText);
 
+    AtkObject* list = atk_object_ref_accessible_child(object, 1);
+    g_assert(ATK_OBJECT(list));
+
+    AtkText* listItem = ATK_TEXT(atk_object_ref_accessible_child(list, 0));
+    g_assert(ATK_IS_TEXT(listItem));
+
+    text = atk_text_get_text(ATK_TEXT(listItem), 0, -1);
+    g_assert_cmpstr(text, ==, "\342\200\242 List item with some text that wraps across different lines.");
+    g_free(text);
+
+    /* Check that getting the text with ATK_TEXT_BOUNDARY_LINE_START
+       and ATK_TEXT_BOUNDARY_LINE_END for line items with bullets
+       (special character) and wrapped text always return the right
+       piece of text for each line. */
+    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 3, "\342\200\242 List item ", 0, 12);
+    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 13, "with some ", 12, 22);
+    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, "\342\200\242 List item", 0, 11);
+    testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 12, " with some", 11, 21);
+
+    g_object_unref(list);
+    g_object_unref(listItem);
+    g_object_unref(paragraph);
     g_object_unref(webView);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to