Changeset 81587 in webkit


Ignore:
Timestamp:
Mar 21, 2011 9:32:27 AM (13 years ago)
Author:
mario@webkit.org
Message:

2011-03-21 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[GTK] [Stable] AtkHypertext exposes wrong offsets for links placed inside <span> nodes
https://bugs.webkit.org/show_bug.cgi?id=56737

Only consider parent objects not ignoring accessibility.

  • accessibility/gtk/WebKitAccessibleHyperlink.cpp: (webkitAccessibleHyperlinkGetStartIndex): Look for the parent object not ignoring accessibility for the current hyperlink. (webkitAccessibleHyperlinkGetEndIndex): Ditto.

2011-03-21 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[GTK] [Stable] AtkHypertext exposes wrong offsets for links placed inside <span> nodes
https://bugs.webkit.org/show_bug.cgi?id=56737

  • tests/testatk.c: (testWebkitAtkHypertextAndHyperlinks): Updated unit test to also check offsets for hyperlinks inside <span> nodes.
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r81584 r81587  
     12011-03-21  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] [Stable] AtkHypertext exposes wrong offsets for links placed inside <span> nodes
     6        https://bugs.webkit.org/show_bug.cgi?id=56737
     7
     8        Only consider parent objects not ignoring accessibility.
     9
     10        * accessibility/gtk/WebKitAccessibleHyperlink.cpp:
     11        (webkitAccessibleHyperlinkGetStartIndex): Look for the parent
     12        object not ignoring accessibility for the current hyperlink.
     13        (webkitAccessibleHyperlinkGetEndIndex): Ditto.
     14
    1152011-03-21  Andreas Kling  <kling@webkit.org>
    216
  • trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleHyperlink.cpp

    r71026 r81587  
    3333#include "RenderObject.h"
    3434#include "TextIterator.h"
     35#include "htmlediting.h"
    3536
    3637#include <atk/atk.h>
     
    231232        return 0;
    232233
     234    AccessibilityObject* parentUnignored = coreObject->parentObjectUnignored();
     235    if (!parentUnignored)
     236        return 0;
     237
    233238    Node* node = coreObject->node();
    234239    if (!node)
    235240        return 0;
    236241
    237     RefPtr<Range> range = Range::create(node->document(), firstPositionInNode(node->parentNode()), firstPositionInNode(node));
     242    Node* parentNode = parentUnignored->node();
     243    if (!parentNode)
     244        return 0;
     245
     246    RefPtr<Range> range = Range::create(node->document(), firstPositionInOrBeforeNode(parentNode), firstPositionInOrBeforeNode(node));
    238247    return getRangeLengthForObject(coreObject, range.get());
    239248}
     
    247256        return 0;
    248257
     258    AccessibilityObject* parentUnignored = coreObject->parentObjectUnignored();
     259    if (!parentUnignored)
     260        return 0;
     261
    249262    Node* node = coreObject->node();
    250263    if (!node)
    251264        return 0;
    252265
    253     RefPtr<Range> range = Range::create(node->document(), firstPositionInNode(node->parentNode()), lastPositionInNode(node));
     266    Node* parentNode = parentUnignored->node();
     267    if (!parentNode)
     268        return 0;
     269
     270    RefPtr<Range> range = Range::create(node->document(), firstPositionInOrBeforeNode(parentNode), lastPositionInOrAfterNode(node));
    254271    return getRangeLengthForObject(coreObject, range.get());
    255272}
  • trunk/Source/WebKit/gtk/ChangeLog

    r81486 r81587  
     12011-03-21  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] [Stable] AtkHypertext exposes wrong offsets for links placed inside <span> nodes
     6        https://bugs.webkit.org/show_bug.cgi?id=56737
     7
     8        * tests/testatk.c:
     9        (testWebkitAtkHypertextAndHyperlinks): Updated unit test to also
     10        check offsets for hyperlinks inside <span> nodes.
     11
    1122011-03-18  David Keijser  <keijser@gmail.com> and Xan Lopez <xlopez@igalia.com>
    213
  • trunk/Source/WebKit/gtk/tests/testatk.c

    r78978 r81587  
    5353static const char* formWithTextInputs = "<html><body><form><input type='text' name='entry' /></form></body></html>";
    5454
    55 static const char* hypertextAndHyperlinks = "<html><body><p>A paragraph with no links at all</p><p><a href='http://foo.bar.baz/'>A line</a> with <a href='http://bar.baz.foo/'>a link in the middle</a> as well as at the beginning and <a href='http://baz.foo.bar/'>at the end</a></p></body></html>";
     55static const char* hypertextAndHyperlinks = "<html><body><p>A paragraph with no links at all</p><p><a href='http://foo.bar.baz/'>A line</a> with <a href='http://bar.baz.foo/'>a link in the middle</a> as well as at the beginning and <a href='http://baz.foo.bar/'>at the end</a></p><ol><li>List item with a <span><a href='http://foo.bar.baz/'>link inside a span node</a></span></li></ol></body></html>";
    5656
    5757static const char* layoutAndDataTables = "<html><body><table><tr><th>Odd</th><th>Even</th></tr><tr><td>1</td><td>2</td></tr></table><table><tr><td>foo</td><td>bar</td></tr></table></body></html>";
     
    14061406    g_assert_cmpstr(atk_hyperlink_get_uri(hLink3, 0), ==, "http://baz.foo.bar/");
    14071407
     1408    AtkObject* list = atk_object_ref_accessible_child(object, 2);
     1409    g_assert(ATK_OBJECT(list));
     1410    g_assert(atk_object_get_role(list) == ATK_ROLE_LIST);
     1411    g_assert_cmpint(atk_object_get_n_accessible_children(list), ==, 1);
     1412
     1413    AtkObject* listItem = atk_object_ref_accessible_child(list, 0);
     1414    g_assert(ATK_IS_TEXT(listItem));
     1415    g_assert(ATK_IS_HYPERTEXT(listItem));
     1416
     1417    AtkHyperlink* hLinkInListItem = atk_hypertext_get_link(ATK_HYPERTEXT(listItem), 0);
     1418    g_assert(ATK_HYPERLINK(hLinkInListItem));
     1419    AtkObject* hLinkObject = atk_hyperlink_get_object(hLinkInListItem, 0);
     1420    g_assert(ATK_OBJECT(hLinkObject));
     1421    g_assert(atk_object_get_role(hLinkObject) == ATK_ROLE_LINK);
     1422    g_assert_cmpint(atk_hyperlink_get_start_index(hLinkInListItem), ==, 20);
     1423    g_assert_cmpint(atk_hyperlink_get_end_index(hLinkInListItem), ==, 43);
     1424    g_assert_cmpint(atk_hyperlink_get_n_anchors(hLinkInListItem), ==, 1);
     1425    g_assert_cmpstr(atk_hyperlink_get_uri(hLinkInListItem, 0), ==, "http://foo.bar.baz/");
     1426
    14081427    /* Finally check the AtkAction interface for a given AtkHyperlink. */
    14091428    g_assert(ATK_IS_ACTION(hLink1));
     
    14151434    g_object_unref(paragraph1);
    14161435    g_object_unref(paragraph2);
     1436    g_object_unref(list);
     1437    g_object_unref(listItem);
    14171438    g_object_unref(webView);
    14181439}
Note: See TracChangeset for help on using the changeset viewer.