Changeset 71026 in webkit


Ignore:
Timestamp:
Nov 1, 2010 8:05:36 AM (14 years ago)
Author:
mario@webkit.org
Message:

2010-11-01 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[Gtk] AtkHyperlink needs to be implemented
https://bugs.webkit.org/show_bug.cgi?id=33785

Implemented the AtkHyperlink/AtkHypertext stuff in the GTK port.

Even thought these kind of tasks are usually about implementing an
interface, in this case it was needed to implement some more
things due to the fact that AtkHyperlink is neither an interface
nor an AtkObject, but just an abstract class child of GObject that
needs to be redefined in a specific subclass of that one. On top
of that, it was needed to implement the AtkAction interface as
well for that new class, so exposed hyperlinks can work as
expected with Assistive Technologies based on ATK.

Furthermore, as there's no mechanism to get an instance of that
AtkHyperlink other than doing it through an AtkObject implementing
the AtkHypertext interface, it was needed to also add the code to
implement that one, so it makes possible to ask for the
'hyperlinks' under an 'hypertext' accessible object.

Finally, to complete the implementation of all this stuff and make
it all consistent, it was needed as well to implement the
AtkHyperlinkImpl interface (providing just one method only) so
that allows retrieving the AtkHyperlink object associated to an
AtkObject implementing such an interface.

  • GNUmakefile.am: Add the new WebKitAccessibleHyperlink.[h|cpp] files to the sources list for the GTK port.
  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (core): New function to return the core accessibility object related to an AtkObject implementing the AtkHypertext interface. (webkitAccessibleHypertextGetLink): New, part of the implementation of the AtkHypertext interface. (webkitAccessibleHypertextGetNLinks): New, likewise. (webkitAccessibleHypertextGetLinkIndex): New, likewise. (atkHypertextInterfaceInit): New, initialize the AtkHypertext interface. (webkitAccessibleHyperlinkImplGetHyperlink): New, part of the implementation of the AtkHyperlinkImpl interface. (atkHyperlinkImplInterfaceInit): New, initialize the AtkHyperlinkImpl interface. (GetAtkInterfaceTypeFromWAIType): Add ATK_TYPE_HYPERTEXT and ATK_TYPE_HYPERLINK_IMPL to the list of recognized types. (getInterfaceMaskFromObject): Decide when it's needed to add WAI_HYPERTEXT and WAI_HYPERLINK to the interface mask.
  • accessibility/gtk/WebKitAccessibleHyperlink.h: Added.
  • accessibility/gtk/WebKitAccessibleHyperlink.cpp: Added. (returnString): Return (const char*) from String variables. (core): Return the associated AccessibilityObject. (webkitAccessibleHyperlinkActionDoAction): Part of the implementation of the AtkAction interface. (webkitAccessibleHyperlinkActionGetNActions): Likewise. (webkitAccessibleHyperlinkActionGetDescription): Likewise. (webkitAccessibleHyperlinkActionGetKeybinding): Likewise. (webkitAccessibleHyperlinkActionGetName): Likewise. (atkActionInterfaceInit): Initialize the AtkAction interface. (getRangeLengthForObject): Returns the length for a given Range, considering special cases (e.g. List item markers). (webkitAccessibleHyperlinkGetURI): Implementation of one of the methods in the AtkHyperlink abstract class. (webkitAccessibleHyperlinkGetObject): Likewise. (webkitAccessibleHyperlinkGetStartIndex): Likewise. (webkitAccessibleHyperlinkGetEndIndex): Likewise. (webkitAccessibleHyperlinkIsValid): Likewise. (webkitAccessibleHyperlinkGetNAnchors): Likewise. (webkitAccessibleHyperlinkIsSelectedLink): Likewise. (webkitAccessibleHyperlinkGetProperty): Getter method. (webkitAccessibleHyperlinkSetProperty): Setter method. (webkitAccessibleHyperlinkFinalize): Finalize method. (webkitAccessibleHyperlinkClassInit): Initialize the WebKitAccessibleHyperlink class. (webkitAccessibleHyperlinkInit): Initialize the WebKitAccessibleHyperlink instance. (webkitAccessibleHyperlinkGetType): Implementation of the get_type() function for the WebKitAccessibleHyperlink class. (webkitAccessibleHyperlinkNew): Returns an instance of the class associated to a given AtkHyperlinkImpl object. (webkitAccessibleHyperlinkGetAccessibilityObject): Public function returning the AccessibilityObject associated to the instance of the WebKitAccessibleHyperlink class.

2010-11-01 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.

[Gtk] AtkHyperlink needs to be implemented
https://bugs.webkit.org/show_bug.cgi?id=33785

New test to ensure the AtkHypertext/AtkHyperlink stuff works.

  • tests/testatk.c: (testWebkitAtkHypertextAndHyperlinks): New test, checking both the implementation of the AtkHypertext interface, the subclass of the AtkHyperlink abstract class, and the implementation of the AtkAction interface in that subclass. (main): Added the new unit test.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71017 r71026  
     12010-11-01  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [Gtk] AtkHyperlink needs to be implemented
     6        https://bugs.webkit.org/show_bug.cgi?id=33785
     7
     8        Implemented the AtkHyperlink/AtkHypertext stuff in the GTK port.
     9
     10        Even thought these kind of tasks are usually about implementing an
     11        interface, in this case it was needed to implement some more
     12        things due to the fact that AtkHyperlink is neither an interface
     13        nor an AtkObject, but just an abstract class child of GObject that
     14        needs to be redefined in a specific subclass of that one. On top
     15        of that, it was needed to implement the AtkAction interface as
     16        well for that new class, so exposed hyperlinks can work as
     17        expected with Assistive Technologies based on ATK.
     18
     19        Furthermore, as there's no mechanism to get an instance of that
     20        AtkHyperlink other than doing it through an AtkObject implementing
     21        the AtkHypertext interface, it was needed to also add the code to
     22        implement that one, so it makes possible to ask for the
     23        'hyperlinks' under an 'hypertext' accessible object.
     24
     25        Finally, to complete the implementation of all this stuff and make
     26        it all consistent, it was needed as well to implement the
     27        AtkHyperlinkImpl interface (providing just one method only) so
     28        that allows retrieving the AtkHyperlink object associated to an
     29        AtkObject implementing such an interface.
     30
     31        * GNUmakefile.am: Add the new WebKitAccessibleHyperlink.[h|cpp]
     32        files to the sources list for the GTK port.
     33
     34        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     35        (core): New function to return the core accessibility object
     36        related to an AtkObject implementing the AtkHypertext interface.
     37        (webkitAccessibleHypertextGetLink): New, part of the
     38        implementation of the AtkHypertext interface.
     39        (webkitAccessibleHypertextGetNLinks): New, likewise.
     40        (webkitAccessibleHypertextGetLinkIndex): New, likewise.
     41        (atkHypertextInterfaceInit): New, initialize the AtkHypertext
     42        interface.
     43        (webkitAccessibleHyperlinkImplGetHyperlink): New, part of the
     44        implementation of the AtkHyperlinkImpl interface.
     45        (atkHyperlinkImplInterfaceInit): New, initialize the
     46        AtkHyperlinkImpl interface.
     47        (GetAtkInterfaceTypeFromWAIType): Add ATK_TYPE_HYPERTEXT and
     48        ATK_TYPE_HYPERLINK_IMPL to the list of recognized types.
     49        (getInterfaceMaskFromObject): Decide when it's needed to add
     50        WAI_HYPERTEXT and WAI_HYPERLINK to the interface mask.
     51
     52        * accessibility/gtk/WebKitAccessibleHyperlink.h: Added.
     53        * accessibility/gtk/WebKitAccessibleHyperlink.cpp: Added.
     54        (returnString): Return (const char*) from String variables.
     55        (core): Return the associated AccessibilityObject.
     56        (webkitAccessibleHyperlinkActionDoAction): Part of the
     57        implementation of the AtkAction interface.
     58        (webkitAccessibleHyperlinkActionGetNActions): Likewise.
     59        (webkitAccessibleHyperlinkActionGetDescription): Likewise.
     60        (webkitAccessibleHyperlinkActionGetKeybinding): Likewise.
     61        (webkitAccessibleHyperlinkActionGetName): Likewise.
     62        (atkActionInterfaceInit): Initialize the AtkAction interface.
     63        (getRangeLengthForObject): Returns the length for a given Range,
     64        considering special cases (e.g. List item markers).
     65        (webkitAccessibleHyperlinkGetURI): Implementation of one of the
     66        methods in the AtkHyperlink abstract class.
     67        (webkitAccessibleHyperlinkGetObject): Likewise.
     68        (webkitAccessibleHyperlinkGetStartIndex): Likewise.
     69        (webkitAccessibleHyperlinkGetEndIndex): Likewise.
     70        (webkitAccessibleHyperlinkIsValid): Likewise.
     71        (webkitAccessibleHyperlinkGetNAnchors): Likewise.
     72        (webkitAccessibleHyperlinkIsSelectedLink): Likewise.
     73        (webkitAccessibleHyperlinkGetProperty): Getter method.
     74        (webkitAccessibleHyperlinkSetProperty): Setter method.
     75        (webkitAccessibleHyperlinkFinalize): Finalize method.
     76        (webkitAccessibleHyperlinkClassInit): Initialize the
     77        WebKitAccessibleHyperlink class.
     78        (webkitAccessibleHyperlinkInit): Initialize the
     79        WebKitAccessibleHyperlink instance.
     80        (webkitAccessibleHyperlinkGetType): Implementation of the
     81        get_type() function for the WebKitAccessibleHyperlink class.
     82        (webkitAccessibleHyperlinkNew): Returns an instance of the class
     83        associated to a given AtkHyperlinkImpl object.
     84        (webkitAccessibleHyperlinkGetAccessibilityObject): Public function
     85        returning the AccessibilityObject associated to the instance of
     86        the WebKitAccessibleHyperlink class.
     87
    1882010-11-01  Pavel Feldman  <pfeldman@chromium.org>
    289
  • trunk/WebCore/GNUmakefile.am

    r71009 r71026  
    34973497        WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.h \
    34983498        WebCore/accessibility/gtk/AXObjectCacheAtk.cpp \
     3499        WebCore/accessibility/gtk/WebKitAccessibleHyperlink.h \
     3500        WebCore/accessibility/gtk/WebKitAccessibleHyperlink.cpp \
    34993501        WebCore/bindings/js/ScriptControllerGtk.cpp \
    35003502        WebCore/page/gtk/DragControllerGtk.cpp \
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r70634 r71026  
    6161#include "TextEncoding.h"
    6262#include "TextIterator.h"
    63 #include <wtf/text/CString.h>
    64 #include <wtf/text/AtomicString.h>
     63#include "WebKitAccessibleHyperlink.h"
    6564
    6665#include <atk/atk.h>
     
    6968#include <libgail-util/gail-util.h>
    7069#include <pango/pango.h>
     70#include <wtf/text/AtomicString.h>
     71#include <wtf/text/CString.h>
    7172
    7273using namespace WebCore;
     
    142143{
    143144    return core(ATK_OBJECT(table));
     145}
     146
     147static AccessibilityObject* core(AtkHypertext* hypertext)
     148{
     149    return core(ATK_OBJECT(hypertext));
    144150}
    145151
     
    19551961}
    19561962
     1963static AtkHyperlink* webkitAccessibleHypertextGetLink(AtkHypertext* hypertext, gint index)
     1964{
     1965    AccessibilityObject::AccessibilityChildrenVector children = core(hypertext)->children();
     1966    if (index < 0 || static_cast<unsigned>(index) >= children.size())
     1967        return 0;
     1968
     1969    gint currentLink = -1;
     1970    for (unsigned i = 0; i < children.size(); i++) {
     1971        AccessibilityObject* coreChild = children.at(i).get();
     1972        if (!coreChild->accessibilityIsIgnored() && coreChild->isLink()) {
     1973            currentLink++;
     1974            if (index != currentLink)
     1975                continue;
     1976
     1977            AtkObject* axObject = coreChild->wrapper();
     1978            if (!axObject || !ATK_IS_HYPERLINK_IMPL(axObject))
     1979                return 0;
     1980
     1981            return atk_hyperlink_impl_get_hyperlink(ATK_HYPERLINK_IMPL(axObject));
     1982        }
     1983    }
     1984
     1985    return 0;
     1986}
     1987
     1988static gint webkitAccessibleHypertextGetNLinks(AtkHypertext* hypertext)
     1989{
     1990    AccessibilityObject::AccessibilityChildrenVector children = core(hypertext)->children();
     1991    if (!children.size())
     1992        return 0;
     1993
     1994    gint linksFound = 0;
     1995    for (size_t i = 0; i < children.size(); i++) {
     1996        AccessibilityObject* coreChild = children.at(i).get();
     1997        if (!coreChild->accessibilityIsIgnored() && coreChild->isLink())
     1998            linksFound++;
     1999    }
     2000
     2001    return linksFound;
     2002}
     2003
     2004static gint webkitAccessibleHypertextGetLinkIndex(AtkHypertext* hypertext, gint charIndex)
     2005{
     2006    size_t linksCount = webkitAccessibleHypertextGetNLinks(hypertext);
     2007    if (!linksCount)
     2008        return -1;
     2009
     2010    for (size_t i = 0; i < linksCount; i++) {
     2011        AtkHyperlink* hyperlink = ATK_HYPERLINK(webkitAccessibleHypertextGetLink(hypertext, i));
     2012        gint startIndex = atk_hyperlink_get_start_index(hyperlink);
     2013        gint endIndex = atk_hyperlink_get_end_index(hyperlink);
     2014
     2015        // Check if the char index in the link's offset range
     2016        if (startIndex <= charIndex && charIndex < endIndex)
     2017            return i;
     2018    }
     2019
     2020    // Not found if reached
     2021    return -1;
     2022}
     2023
     2024static void atkHypertextInterfaceInit(AtkHypertextIface* iface)
     2025{
     2026    iface->get_link = webkitAccessibleHypertextGetLink;
     2027    iface->get_n_links = webkitAccessibleHypertextGetNLinks;
     2028    iface->get_link_index = webkitAccessibleHypertextGetLinkIndex;
     2029}
     2030
     2031static AtkHyperlink* webkitAccessibleHyperlinkImplGetHyperlink(AtkHyperlinkImpl* hyperlink)
     2032{
     2033    AtkHyperlink* hyperlinkObject = ATK_HYPERLINK(g_object_get_data(G_OBJECT(hyperlink), "hyperlink-object"));
     2034    if (!hyperlinkObject) {
     2035        hyperlinkObject = ATK_HYPERLINK(webkitAccessibleHyperlinkNew(hyperlink));
     2036        g_object_set_data(G_OBJECT(hyperlink), "hyperlink-object", hyperlinkObject);
     2037    }
     2038    return hyperlinkObject;
     2039}
     2040
     2041static void atkHyperlinkImplInterfaceInit(AtkHyperlinkImplIface* iface)
     2042{
     2043    iface->get_hyperlink = webkitAccessibleHyperlinkImplGetHyperlink;
     2044}
     2045
    19572046static const gchar* documentAttributeValue(AtkDocument* document, const gchar* attribute)
    19582047{
     
    20262115    {(GInterfaceInitFunc)atk_table_interface_init,
    20272116     (GInterfaceFinalizeFunc) 0, 0},
     2117    {(GInterfaceInitFunc)atkHypertextInterfaceInit,
     2118     (GInterfaceFinalizeFunc) 0, 0},
     2119    {(GInterfaceInitFunc)atkHyperlinkImplInterfaceInit,
     2120     (GInterfaceFinalizeFunc) 0, 0},
    20282121    {(GInterfaceInitFunc)atk_document_interface_init,
    20292122     (GInterfaceFinalizeFunc) 0, 0}
     
    20382131    WAI_IMAGE,
    20392132    WAI_TABLE,
     2133    WAI_HYPERTEXT,
     2134    WAI_HYPERLINK,
    20402135    WAI_DOCUMENT
    20412136};
     
    20432138static GType GetAtkInterfaceTypeFromWAIType(WAIType type)
    20442139{
    2045   switch (type) {
    2046   case WAI_ACTION:
    2047       return ATK_TYPE_ACTION;
    2048   case WAI_SELECTION:
    2049       return ATK_TYPE_SELECTION;
    2050   case WAI_EDITABLE_TEXT:
    2051       return ATK_TYPE_EDITABLE_TEXT;
    2052   case WAI_TEXT:
    2053       return ATK_TYPE_TEXT;
    2054   case WAI_COMPONENT:
    2055       return ATK_TYPE_COMPONENT;
    2056   case WAI_IMAGE:
    2057       return ATK_TYPE_IMAGE;
    2058   case WAI_TABLE:
    2059       return ATK_TYPE_TABLE;
    2060   case WAI_DOCUMENT:
    2061       return ATK_TYPE_DOCUMENT;
    2062   }
    2063 
    2064   return G_TYPE_INVALID;
     2140    switch (type) {
     2141    case WAI_ACTION:
     2142        return ATK_TYPE_ACTION;
     2143    case WAI_SELECTION:
     2144        return ATK_TYPE_SELECTION;
     2145    case WAI_EDITABLE_TEXT:
     2146        return ATK_TYPE_EDITABLE_TEXT;
     2147    case WAI_TEXT:
     2148        return ATK_TYPE_TEXT;
     2149    case WAI_COMPONENT:
     2150        return ATK_TYPE_COMPONENT;
     2151    case WAI_IMAGE:
     2152        return ATK_TYPE_IMAGE;
     2153    case WAI_TABLE:
     2154        return ATK_TYPE_TABLE;
     2155    case WAI_HYPERTEXT:
     2156        return ATK_TYPE_HYPERTEXT;
     2157    case WAI_HYPERLINK:
     2158        return ATK_TYPE_HYPERLINK_IMPL;
     2159    case WAI_DOCUMENT:
     2160        return ATK_TYPE_DOCUMENT;
     2161    }
     2162
     2163    return G_TYPE_INVALID;
    20652164}
    20662165
     
    20722171    interfaceMask |= 1 << WAI_COMPONENT;
    20732172
     2173    AccessibilityRole role = coreObject->roleValue();
     2174
    20742175    // Action
    2075     if (!coreObject->actionVerb().isEmpty())
     2176    if (!coreObject->actionVerb().isEmpty()) {
    20762177        interfaceMask |= 1 << WAI_ACTION;
     2178
     2179        if (!coreObject->accessibilityIsIgnored() && coreObject->isLink())
     2180            interfaceMask |= 1 << WAI_HYPERLINK;
     2181    }
    20772182
    20782183    // Selection
     
    20812186
    20822187    // Text & Editable Text
    2083     AccessibilityRole role = coreObject->roleValue();
    2084 
    20852188    if (role == StaticTextRole)
    20862189        interfaceMask |= 1 << WAI_TEXT;
    2087     else if (coreObject->isAccessibilityRenderObject())
     2190    else if (coreObject->isAccessibilityRenderObject()) {
    20882191        if (coreObject->isTextControl()) {
    20892192            interfaceMask |= 1 << WAI_TEXT;
     
    20932196            AccessibilityRenderObject* axRenderObject = static_cast<AccessibilityRenderObject*>(coreObject);
    20942197            RenderObject* renderer = axRenderObject->renderer();
    2095             if (role != TableRole && renderer && renderer->childrenInline())
    2096                 interfaceMask |= 1 << WAI_TEXT;
    2097             else if (role == ListItemRole) {
    2098                 // Add the TEXT interface for list items whose
    2099                 // first accessible child has a text renderer
     2198            if (role != TableRole) {
     2199                interfaceMask |= 1 << WAI_HYPERTEXT;
     2200                if (renderer && renderer->childrenInline())
     2201                    interfaceMask |= 1 << WAI_TEXT;
     2202            }
     2203
     2204            // Add the TEXT interface for list items whose
     2205            // first accessible child has a text renderer
     2206            if (role == ListItemRole) {
    21002207                AccessibilityObject::AccessibilityChildrenVector children = axRenderObject->children();
    21012208                if (children.size()) {
     
    21052212            }
    21062213        }
     2214    }
    21072215
    21082216    // Image
  • trunk/WebKit/gtk/ChangeLog

    r70983 r71026  
     12010-11-01  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [Gtk] AtkHyperlink needs to be implemented
     6        https://bugs.webkit.org/show_bug.cgi?id=33785
     7
     8        New test to ensure the AtkHypertext/AtkHyperlink stuff works.
     9
     10        * tests/testatk.c:
     11        (testWebkitAtkHypertextAndHyperlinks): New test, checking both the
     12        implementation of the AtkHypertext interface, the subclass of the
     13        AtkHyperlink abstract class, and the implementation of the
     14        AtkAction interface in that subclass.
     15        (main): Added the new unit test.
     16
    1172010-10-30  Xan Lopez  <xlopez@igalia.com>
    218
  • trunk/WebKit/gtk/tests/testatk.c

    r70639 r71026  
    4747static const char* formWithTextInputs = "<html><body><form><input type='text' name='entry' /></form></body></html>";
    4848
     49static 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>";
     50
    4951static 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>";
    5052
     
    10711073}
    10721074
     1075static void testWebkitAtkHypertextAndHyperlinks(void)
     1076{
     1077    WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     1078    g_object_ref_sink(webView);
     1079    GtkAllocation alloc = { 0, 0, 800, 600 };
     1080    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
     1081    webkit_web_view_load_string(webView, hypertextAndHyperlinks, 0, 0, 0);
     1082
     1083    // Manually spin the main context to get the accessible objects
     1084    while (g_main_context_pending(0))
     1085        g_main_context_iteration(0, TRUE);
     1086
     1087    AtkObject* obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
     1088    g_assert(obj);
     1089
     1090    AtkObject* paragraph1 = atk_object_ref_accessible_child(obj, 0);
     1091    g_assert(ATK_OBJECT(paragraph1));
     1092    g_assert(atk_object_get_role(paragraph1) == ATK_ROLE_PARAGRAPH);
     1093    g_assert(ATK_IS_HYPERTEXT(paragraph1));
     1094
     1095    // No links in the first paragraph
     1096    gint nLinks = atk_hypertext_get_n_links(ATK_HYPERTEXT(paragraph1));
     1097    g_assert_cmpint(nLinks, ==, 0);
     1098
     1099    AtkObject* paragraph2 = atk_object_ref_accessible_child(obj, 1);
     1100    g_assert(ATK_OBJECT(paragraph2));
     1101    g_assert(atk_object_get_role(paragraph2) == ATK_ROLE_PARAGRAPH);
     1102    g_assert(ATK_IS_HYPERTEXT(paragraph2));
     1103
     1104    // Check links in the second paragraph
     1105    nLinks = atk_hypertext_get_n_links(ATK_HYPERTEXT(paragraph2));
     1106    g_assert_cmpint(nLinks, ==, 3);
     1107
     1108    AtkHyperlink* hLink1 = atk_hypertext_get_link(ATK_HYPERTEXT(paragraph2), 0);
     1109    g_assert(ATK_HYPERLINK(hLink1));
     1110    AtkObject* hLinkObject1 = atk_hyperlink_get_object(hLink1, 0);
     1111    g_assert(ATK_OBJECT(hLinkObject1));
     1112    g_assert(atk_object_get_role(hLinkObject1) == ATK_ROLE_LINK);
     1113    g_assert_cmpint(atk_hyperlink_get_start_index(hLink1), ==, 0);
     1114    g_assert_cmpint(atk_hyperlink_get_end_index(hLink1), ==, 6);
     1115    g_assert_cmpint(atk_hyperlink_get_n_anchors(hLink1), ==, 1);
     1116    g_assert_cmpstr(atk_hyperlink_get_uri(hLink1, 0), ==, "http://foo.bar.baz/");
     1117
     1118    AtkHyperlink* hLink2 = atk_hypertext_get_link(ATK_HYPERTEXT(paragraph2), 1);
     1119    g_assert(ATK_HYPERLINK(hLink2));
     1120    AtkObject* hLinkObject2 = atk_hyperlink_get_object(hLink2, 0);
     1121    g_assert(ATK_OBJECT(hLinkObject2));
     1122    g_assert(atk_object_get_role(hLinkObject2) == ATK_ROLE_LINK);
     1123    g_assert_cmpint(atk_hyperlink_get_start_index(hLink2), ==, 12);
     1124    g_assert_cmpint(atk_hyperlink_get_end_index(hLink2), ==, 32);
     1125    g_assert_cmpint(atk_hyperlink_get_n_anchors(hLink2), ==, 1);
     1126    g_assert_cmpstr(atk_hyperlink_get_uri(hLink2, 0), ==, "http://bar.baz.foo/");
     1127
     1128    AtkHyperlink* hLink3 = atk_hypertext_get_link(ATK_HYPERTEXT(paragraph2), 2);
     1129    g_assert(ATK_HYPERLINK(hLink3));
     1130    AtkObject* hLinkObject3 = atk_hyperlink_get_object(hLink3, 0);
     1131    g_assert(ATK_OBJECT(hLinkObject3));
     1132    g_assert(atk_object_get_role(hLinkObject3) == ATK_ROLE_LINK);
     1133    g_assert_cmpint(atk_hyperlink_get_start_index(hLink3), ==, 65);
     1134    g_assert_cmpint(atk_hyperlink_get_end_index(hLink3), ==, 75);
     1135    g_assert_cmpint(atk_hyperlink_get_n_anchors(hLink3), ==, 1);
     1136    g_assert_cmpstr(atk_hyperlink_get_uri(hLink3, 0), ==, "http://baz.foo.bar/");
     1137
     1138    // Finally check the AtkAction interface for a given AtkHyperlink
     1139    g_assert(ATK_IS_ACTION(hLink1));
     1140    g_assert_cmpint(atk_action_get_n_actions(ATK_ACTION(hLink1)), ==, 1);
     1141    g_assert_cmpstr(atk_action_get_keybinding(ATK_ACTION(hLink1), 0), ==, "");
     1142    g_assert_cmpstr(atk_action_get_name(ATK_ACTION(hLink1), 0), ==, "jump");
     1143    g_assert(atk_action_do_action(ATK_ACTION(hLink1), 0));
     1144
     1145    g_object_unref(paragraph1);
     1146    g_object_unref(paragraph2);
     1147    g_object_unref(webView);
     1148}
     1149
    10731150static void testWebkitAtkListsOfItems(void)
    10741151{
     
    12231300    g_test_add_func("/webkit/atk/textSelections", testWekitAtkTextSelections);
    12241301    g_test_add_func("/webkit/atk/getExtents", testWebkitAtkGetExtents);
     1302    g_test_add_func("/webkit/atk/hypertextAndHyperlinks", testWebkitAtkHypertextAndHyperlinks);
    12251303    g_test_add_func("/webkit/atk/layoutAndDataTables", testWebkitAtkLayoutAndDataTables);
    12261304    g_test_add_func("/webkit/atk/linksWithInlineImages", testWebkitAtkLinksWithInlineImages);
Note: See TracChangeset for help on using the changeset viewer.