Changeset 77817 in webkit


Ignore:
Timestamp:
Feb 7, 2011 8:23:10 AM (13 years ago)
Author:
mario@webkit.org
Message:

2011-02-07 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Xan Lopez.

[Gtk] atk_text_get_caret_offset fails for list items
https://bugs.webkit.org/show_bug.cgi?id=53436

Consider list item markers when calculating the offset.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (webkit_accessible_text_get_caret_offset): Adjust the offset with the item marker's length for list items. (webkit_accessible_text_set_caret_offset): Replace usage of g_utf8_strlen() by calling to markerText.length().

2011-02-07 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Xan Lopez.

[Gtk] atk_text_get_caret_offset fails for list items
https://bugs.webkit.org/show_bug.cgi?id=53436

Update unit test to check the fix for this bug.

  • tests/testatk.c: (testWebkitAtkCaretOffsets): Check that the caret offset returned match the value previously set.
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77814 r77817  
     12011-02-07  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [Gtk] atk_text_get_caret_offset fails for list items
     6        https://bugs.webkit.org/show_bug.cgi?id=53436
     7
     8        Consider list item markers when calculating the offset.
     9
     10        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     11        (webkit_accessible_text_get_caret_offset): Adjust the offset
     12        with the item marker's length for list items.
     13        (webkit_accessible_text_set_caret_offset): Replace usage of
     14        g_utf8_strlen() by calling to markerText.length().
     15
    1162011-02-07  Yi Shen  <yi.4.shen@nokia.com>
    217
  • trunk/Source/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r77234 r77817  
    12101210    // focusedObject is the object with the caret. It is likely ignored -- unless it's a link.
    12111211    AccessibilityObject* coreObject = core(text);
     1212    if (!coreObject->isAccessibilityRenderObject())
     1213        return 0;
     1214
    12121215    Node* focusedNode = coreObject->selection().end().node();
    1213 
    12141216    if (!focusedNode)
    12151217        return 0;
     
    12221224    if (!objectAndOffsetUnignored(focusedObject, offset, !coreObject->isLink()))
    12231225        return 0;
     1226
     1227    RenderObject* renderer = toAccessibilityRenderObject(coreObject)->renderer();
     1228    if (renderer && renderer->isListItem()) {
     1229        String markerText = toRenderListItem(renderer)->markerTextWithSuffix();
     1230
     1231        // We need to adjust the offset for the list item marker.
     1232        offset += markerText.length();
     1233    }
    12241234
    12251235    // TODO: Verify this for RTL text.
     
    17071717    if (renderer && renderer->isListItem()) {
    17081718        String markerText = toRenderListItem(renderer)->markerTextWithSuffix();
    1709         int markerLength = g_utf8_strlen(markerText.utf8().data(), -1);
     1719        int markerLength = markerText.length();
    17101720        if (offset < markerLength)
    17111721            return FALSE;
  • trunk/Source/WebKit/gtk/ChangeLog

    r77734 r77817  
     12011-02-07  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [Gtk] atk_text_get_caret_offset fails for list items
     6        https://bugs.webkit.org/show_bug.cgi?id=53436
     7
     8        Update unit test to check the fix for this bug.
     9
     10        * tests/testatk.c:
     11        (testWebkitAtkCaretOffsets): Check that the caret offset returned
     12        match the value previously set.
     13
    1142011-02-04  Joone Hur  <joone.hur@collabora.co.uk>
    215
  • trunk/Source/WebKit/gtk/tests/testatk.c

    r77235 r77817  
    296296    result = atk_text_set_caret_offset(ATK_TEXT(listItem), 5);
    297297    g_assert_cmpint(result, ==, TRUE);
    298 
    299     /* Uncomment the following two lines when fixing bug 53436. */
    300     /* offset = atk_text_get_caret_offset(ATK_TEXT(listItem)); */
    301     /* g_assert_cmpint(offset, ==, 5); */
     298    offset = atk_text_get_caret_offset(ATK_TEXT(listItem));
     299    g_assert_cmpint(offset, ==, 5);
    302300
    303301    AtkObject* panel = atk_object_ref_accessible_child(object, 3);
Note: See TracChangeset for help on using the changeset viewer.