Changeset 70554 in webkit


Ignore:
Timestamp:
Oct 26, 2010 12:19:29 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-10-26 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Chris Fleizach.

[Gtk] Layout tables should indicate that they are not data tables via an object attribute
https://bugs.webkit.org/show_bug.cgi?id=35422

Set the 'layout-guess' attribute to 'true' for data tables.

Reorganized some code in AccessibilityTable so now the function
isDataTable() is more coherent by just answering that very
specific question, regardless of whether the table is being
exposed or not to Assistive Technologies.

Hence, now it's possible to make two questions separately instead
of just one, meaning that the new function isAccessibleTable() is
now what we formerly defined as the isDataTable() function.

  • accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::isAccessibilityTable):

New function to allow asking tables both whether they are
exposed and whether they are data tables, which are different
questions whose answers might be the same in many situations,
but different sometimes (as it can happen in the GTK port).

  • accessibility/AccessibilityTable.h:
  • accessibility/AccessibilityTable.cpp: (WebCore::AccessibilityTable::hasARIARole):

New, checks whether the table has a valid ARIA role.

(WebCore::AccessibilityTable::isAccessibilityTable):

New, returns the value of m_isAccessibilityTable. It's
basically the former isDataTable() function renamed.

(WebCore::AccessibilityTable::isDataTable):

Changed behaviour. Instead of just returning the value of
m_isAccessibilityTable as it did so far (which was confusing
because of that's not what the name suggests), focus on
checking whether it's a data table or not and return a bool
value accordingly. It's basically a rename of the former
isTableExposableThroughAccessibility() function, but withouth
the GTK-specific if-endif region (which didn't make sense
here now, because that was answering the question "is the table
exposed in the GTK port?", instead of "is it a data table?").

(WebCore::AccessibilityTable::isTableExposableThroughAccessibility):

Uses the hasAriaRole(), and isDataTable() to determine whether
a table should be exposed or not. Also includes the GTK-specific
if-region coming from the former implementation of the function
isTableExposableThroughAccessibility() not to check whether it's
a data table in case the rest of the checks succeeded (all
tables are exposed in the GTK port).

(WebCore::AccessibilityTable::addChildren):

Replace usage of isDataTable() with isAccessibilityTable(), to
keep exactly the same behaviour happening before this patch.

(WebCore::AccessibilityTable::roleValue): Ditto.
(WebCore::AccessibilityTable::accessibilityIsIgnored): Ditto.
(WebCore::AccessibilityTable::title): Ditto.

Updated usage of the former function isDataTable() everywhere
else, replacing it with the new isAccessibilityTable(), so keeping
exactly the same behaviour happening before this patch.

  • accessibility/AccessibilityARIAGrid.cpp: (WebCore::AccessibilityARIAGrid::addChildren):

Use isAccessibilityTable() instead of isDataTable().

  • accessibility/AccessibilityARIAGridCell.cpp: (WebCore::AccessibilityARIAGridCell::parentTable): Ditto.
  • accessibility/AccessibilityARIAGridRow.cpp: (WebCore::AccessibilityARIAGridRow::disclosedRows): Ditto. (WebCore::AccessibilityARIAGridRow::disclosedByRow): Ditto. (WebCore::AccessibilityARIAGridRow::parentTable): Ditto.
  • accessibility/AccessibilityTableCell.cpp: (WebCore::AccessibilityTableCell::isTableCell):

Use isAccessibilityTable() instead of isDataTable().

  • accessibility/AccessibilityTableHeaderContainer.cpp: (WebCore::AccessibilityTableHeaderContainer::addChildren): Ditto.
  • accessibility/AccessibilityTableRow.cpp: (WebCore::AccessibilityTableRow::isTableRow): Ditto
  • accessibility/mac/AccessibilityObjectWrapper.mm: (-[AccessibilityObjectWrapper additionalAccessibilityAttributeNames]):

Use isAccessibilityTable() instead of isDataTable().

(-[AccessibilityObjectWrapper accessibilityAttributeNames]): Ditto.
(-[AccessibilityObjectWrapper accessibilityAttributeValue:]): Ditto.
(-[AccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): Ditto.
(-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]): Ditto.
(-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto.

Use the new function isAccessibilityTable() together with the
modified implementation of isDataTable() to set the 'layout-guess'
attribute when needed.

  • accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: (webkit_accessible_get_attributes):

Set the 'layout-guess' attribute to 'true' to help Assistive
Technologies guessing which tables are not data tables.

2010-10-26 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Chris Fleizach.

[Gtk] Layout tables should indicate that they are not data tables via an object attribute
https://bugs.webkit.org/show_bug.cgi?id=35422

New unit test to check the 'layout-guess' attribute in tables.

  • tests/testatk.c: (atkAttributeSetAttributeNameHasValue): New, looks for a attribute with a specific value, by the name of attribute. (atkAttributeSetContainsAttributeName): New, just checks whether an attribute with a specified name is present in the set. (atkAttributeSetAttributeHasValue): Modified to relay on the new function atkAttributeSetAttributeNameHasValue(). (testWebkitAtkLayoutAndDataTables): New test. (main): Added the new test.
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r70553 r70554  
     12010-10-26  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Chris Fleizach.
     4
     5        [Gtk] Layout tables should indicate that they are not data tables via an object attribute
     6        https://bugs.webkit.org/show_bug.cgi?id=35422
     7
     8        Set the 'layout-guess' attribute to 'true' for data tables.
     9
     10        Reorganized some code in AccessibilityTable so now the function
     11        isDataTable() is more coherent by just answering that very
     12        specific question, regardless of whether the table is being
     13        exposed or not to Assistive Technologies.
     14
     15        Hence, now it's possible to make two questions separately instead
     16        of just one, meaning that the new function isAccessibleTable() is
     17        now what we formerly defined as the isDataTable() function.
     18
     19        * accessibility/AccessibilityObject.h:
     20        (WebCore::AccessibilityObject::isAccessibilityTable):
     21           New function to allow asking tables both whether they are
     22           exposed and whether they are data tables, which are different
     23           questions whose answers might be the same in many situations,
     24           but different sometimes (as it can happen in the GTK port).
     25        * accessibility/AccessibilityTable.h:
     26        * accessibility/AccessibilityTable.cpp:
     27        (WebCore::AccessibilityTable::hasARIARole):
     28           New, checks whether the table has a valid ARIA role.
     29        (WebCore::AccessibilityTable::isAccessibilityTable):
     30           New, returns the value of m_isAccessibilityTable. It's
     31           basically the former isDataTable() function renamed.
     32        (WebCore::AccessibilityTable::isDataTable):
     33           Changed behaviour. Instead of just returning the value of
     34           m_isAccessibilityTable as it did so far (which was confusing
     35           because of that's not what the name suggests), focus on
     36           checking whether it's a data table or not and return a bool
     37           value accordingly. It's basically a rename of the former
     38           isTableExposableThroughAccessibility() function, but withouth
     39           the GTK-specific if-endif region (which didn't make sense
     40           here now, because that was answering the question "is the table
     41           exposed in the GTK port?", instead of "is it a data table?").
     42        (WebCore::AccessibilityTable::isTableExposableThroughAccessibility):
     43           Uses the hasAriaRole(), and isDataTable() to determine whether
     44           a table should be exposed or not. Also includes the GTK-specific
     45           if-region coming from the former implementation of the function
     46           isTableExposableThroughAccessibility() not to check whether it's
     47           a data table in case the rest of the checks succeeded (all
     48           tables are exposed in the GTK port).
     49        (WebCore::AccessibilityTable::addChildren):
     50           Replace usage of isDataTable() with isAccessibilityTable(), to
     51           keep exactly the same behaviour happening before this patch.
     52        (WebCore::AccessibilityTable::roleValue): Ditto.
     53        (WebCore::AccessibilityTable::accessibilityIsIgnored): Ditto.
     54        (WebCore::AccessibilityTable::title): Ditto.
     55
     56        Updated usage of the former function isDataTable() everywhere
     57        else, replacing it with the new isAccessibilityTable(), so keeping
     58        exactly the same behaviour happening before this patch.
     59
     60        * accessibility/AccessibilityARIAGrid.cpp:
     61        (WebCore::AccessibilityARIAGrid::addChildren):
     62           Use isAccessibilityTable() instead of isDataTable().
     63        * accessibility/AccessibilityARIAGridCell.cpp:
     64        (WebCore::AccessibilityARIAGridCell::parentTable): Ditto.
     65        * accessibility/AccessibilityARIAGridRow.cpp:
     66        (WebCore::AccessibilityARIAGridRow::disclosedRows): Ditto.
     67        (WebCore::AccessibilityARIAGridRow::disclosedByRow): Ditto.
     68        (WebCore::AccessibilityARIAGridRow::parentTable): Ditto.
     69        * accessibility/AccessibilityTableCell.cpp:
     70        (WebCore::AccessibilityTableCell::isTableCell):
     71           Use isAccessibilityTable() instead of isDataTable().
     72        * accessibility/AccessibilityTableHeaderContainer.cpp:
     73        (WebCore::AccessibilityTableHeaderContainer::addChildren): Ditto.
     74        * accessibility/AccessibilityTableRow.cpp:
     75        (WebCore::AccessibilityTableRow::isTableRow): Ditto
     76        * accessibility/mac/AccessibilityObjectWrapper.mm:
     77        (-[AccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
     78           Use isAccessibilityTable() instead of isDataTable().
     79        (-[AccessibilityObjectWrapper accessibilityAttributeNames]): Ditto.
     80        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]): Ditto.
     81        (-[AccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): Ditto.
     82        (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]): Ditto.
     83        (-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): Ditto.
     84
     85        Use the new function isAccessibilityTable() together with the
     86        modified implementation of isDataTable() to set the 'layout-guess'
     87        attribute when needed.
     88
     89        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
     90        (webkit_accessible_get_attributes):
     91           Set the 'layout-guess' attribute to 'true' to help Assistive
     92           Technologies guessing which tables are not data tables.
     93
    1942010-10-26  Chris Marrin  <cmarrin@apple.com>
    295
  • trunk/WebCore/accessibility/AccessibilityARIAGrid.cpp

    r69707 r70554  
    8484    ASSERT(!m_haveChildren);
    8585   
    86     if (!isDataTable()) {
     86    if (!isAccessibilityTable()) {
    8787        AccessibilityRenderObject::addChildren();
    8888        return;
  • trunk/WebCore/accessibility/AccessibilityARIAGridCell.cpp

    r44151 r70554  
    5858   
    5959    parent = parent->parentObjectUnignored();
    60     if (!parent || !parent->isDataTable())
     60    if (!parent || !parent->isAccessibilityTable())
    6161        return 0;
    6262   
  • trunk/WebCore/accessibility/AccessibilityARIAGridRow.cpp

    r52159 r70554  
    6666    // have an aria-level of plus 1 from this row.
    6767    AccessibilityObject* parent = parentObjectUnignored();
    68     if (!parent || !parent->isDataTable())
     68    if (!parent || !parent->isAccessibilityTable())
    6969        return;
    7070   
     
    9393    // that is aria-level subtract 1 from this row.
    9494    AccessibilityObject* parent = parentObjectUnignored();
    95     if (!parent || !parent->isDataTable())
     95    if (!parent || !parent->isAccessibilityTable())
    9696        return 0;
    9797   
     
    120120{
    121121    AccessibilityObject* parent = parentObjectUnignored();
    122     if (!parent->isDataTable())
     122    if (!parent->isAccessibilityTable())
    123123        return 0;
    124124   
  • trunk/WebCore/accessibility/AccessibilityObject.h

    r70256 r70554  
    286286    virtual bool isControl() const { return false; }
    287287    virtual bool isList() const { return false; }
     288    virtual bool isAccessibilityTable() const { return false; }
    288289    virtual bool isDataTable() const { return false; }
    289290    virtual bool isTableRow() const { return false; }
  • trunk/WebCore/accessibility/AccessibilityTable.cpp

    r64874 r70554  
    6868}
    6969
    70 bool AccessibilityTable::isTableExposableThroughAccessibility()
    71 {
    72     // the following is a heuristic used to determine if a
    73     // <table> should be exposed as an AXTable. The goal
    74     // is to only show "data" tables
    75    
    76     if (!renderer())
    77         return false;
    78    
    79     // if the developer assigned an aria role to this, then we shouldn't
    80     // expose it as a table, unless, of course, the aria role is a table
     70bool AccessibilityTable::hasARIARole() const
     71{
     72    if (!m_renderer)
     73        return false;
     74   
    8175    AccessibilityRole ariaRole = ariaRoleAttribute();
    8276    if (ariaRole != UnknownRole)
    83         return false;
     77        return true;
     78
     79    return false;
     80}
     81
     82bool AccessibilityTable::isAccessibilityTable() const
     83{
     84    if (!m_renderer)
     85        return false;
     86   
     87    return m_isAccessibilityTable;
     88}
     89
     90bool AccessibilityTable::isDataTable() const
     91{
     92    if (!m_renderer)
     93        return false;
     94
     95    // Do not consider it a data table is it has an ARIA role.
     96    if (hasARIARole())
     97        return false;
     98
     99    // This employs a heuristic to determine if this table should appear.
     100    // Only "data" tables should be exposed as tables.
     101    // Unfortunately, there is no good way to determine the difference
     102    // between a "layout" table and a "data" table.
    84103   
    85104    RenderTable* table = toRenderTable(m_renderer);
    86    
    87     // this employs a heuristic to determine if this table should appear.
    88     // Only "data" tables should be exposed as tables.
    89     // Unfortunately, there is no good way to determine the difference
    90     // between a "layout" table and a "data" table
    91    
    92105    Node* tableNode = table->node();
    93106    if (!tableNode || !tableNode->hasTagName(tableTag))
    94107        return false;
    95108
    96     // Gtk+ ATs expect all tables to be exposed as tables.
    97 #if PLATFORM(GTK)
    98     return true;
    99 #endif
    100    
    101109    // if there is a caption element, summary, THEAD, or TFOOT section, it's most certainly a data table
    102110    HTMLTableElement* tableElement = static_cast<HTMLTableElement*>(tableNode);
     
    243251}
    244252   
     253bool AccessibilityTable::isTableExposableThroughAccessibility() const
     254{
     255    // The following is a heuristic used to determine if a
     256    // <table> should be exposed as an AXTable. The goal
     257    // is to only show "data" tables.
     258
     259    if (!m_renderer)
     260        return false;
     261
     262    // If the developer assigned an aria role to this, then we
     263    // shouldn't expose it as a table, unless, of course, the aria
     264    // role is a table.
     265    if (hasARIARole())
     266        return false;
     267
     268    // Gtk+ ATs expect all tables to be exposed as tables.
     269#if PLATFORM(GTK)
     270    Node* tableNode = toRenderTable(m_renderer)->node();
     271    return tableNode && tableNode->hasTagName(tableTag);
     272#endif
     273
     274    return isDataTable();
     275}
     276
    245277void AccessibilityTable::clearChildren()
    246278{
     
    252284void AccessibilityTable::addChildren()
    253285{
    254     if (!isDataTable()) {
     286    if (!isAccessibilityTable()) {
    255287        AccessibilityRenderObject::addChildren();
    256288        return;
     
    489521AccessibilityRole AccessibilityTable::roleValue() const
    490522{
    491     if (!isDataTable())
     523    if (!isAccessibilityTable())
    492524        return AccessibilityRenderObject::roleValue();
    493525
     
    503535        return true;
    504536   
    505     if (!isDataTable())
     537    if (!isAccessibilityTable())
    506538        return AccessibilityRenderObject::accessibilityIsIgnored();
    507539       
     
    511543String AccessibilityTable::title() const
    512544{
    513     if (!isDataTable())
     545    if (!isAccessibilityTable())
    514546        return AccessibilityRenderObject::title();
    515547   
     
    533565}
    534566
    535 bool AccessibilityTable::isDataTable() const
    536 {
    537     if (!m_renderer)
    538         return false;
    539    
    540     return m_isAccessibilityTable;
    541 }
    542 
    543567} // namespace WebCore
  • trunk/WebCore/accessibility/AccessibilityTable.h

    r65021 r70554  
    5252    virtual ~AccessibilityTable();
    5353
     54    virtual bool isAccessibilityTable() const;
    5455    virtual bool isDataTable() const;
     56
    5557    virtual AccessibilityRole roleValue() const;
    5658    virtual bool isAriaTable() const { return false; }
     
    8789    mutable bool m_isAccessibilityTable;
    8890
    89     bool isTableExposableThroughAccessibility();
     91    bool hasARIARole() const;
     92    bool isTableExposableThroughAccessibility() const;
    9093};
    9194
  • trunk/WebCore/accessibility/AccessibilityTableCell.cpp

    r63994 r70554  
    8585{
    8686    AccessibilityObject* table = parentTable();
    87     if (!table || !table->isDataTable())
     87    if (!table || !table->isAccessibilityTable())
    8888        return false;
    8989   
  • trunk/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp

    r55818 r70554  
    8686   
    8787    m_haveChildren = true;
    88     if (!m_parentTable || !m_parentTable->isDataTable())
     88    if (!m_parentTable || !m_parentTable->isAccessibilityTable())
    8989        return;
    9090   
  • trunk/WebCore/accessibility/AccessibilityTableRow.cpp

    r67407 r70554  
    6969{
    7070    AccessibilityObject* table = parentTable();
    71     if (!table || !table->isDataTable())
     71    if (!table || !table->isAccessibilityTable())
    7272        return false;
    7373   
  • trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp

    r70089 r70554  
    330330{
    331331    AtkAttributeSet* attributeSet = 0;
    332 
    333332    attributeSet = addAttributeToSet(attributeSet, "toolkit", "WebKitGtk");
    334333
    335     int headingLevel = core(object)->headingLevel();
     334    AccessibilityObject* coreObject = core(object);
     335    if (!coreObject)
     336        return attributeSet;
     337
     338    int headingLevel = coreObject->headingLevel();
    336339    if (headingLevel) {
    337340        String value = String::number(headingLevel);
    338341        attributeSet = addAttributeToSet(attributeSet, "level", value.utf8().data());
    339342    }
     343
     344    // Set the 'layout-guess' attribute to help Assistive
     345    // Technologies know when an exposed table is not data table.
     346    if (coreObject->isAccessibilityTable() && !coreObject->isDataTable())
     347        attributeSet = addAttributeToSet(attributeSet, "layout-guess", "true");
     348
    340349    return attributeSet;
    341350}
  • trunk/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm

    r68680 r70554  
    648648        [additional addObject:NSAccessibilityDropEffectsAttribute];
    649649
    650     if (m_object->isDataTable() && static_cast<AccessibilityTable*>(m_object)->supportsSelectedRows())
     650    if (m_object->isAccessibilityTable() && static_cast<AccessibilityTable*>(m_object)->supportsSelectedRows())
    651651        [additional addObject:NSAccessibilitySelectedRowsAttribute];       
    652652   
     
    949949        objectAttributes = anchorAttrs;
    950950
    951     else if (m_object->isDataTable())
     951    else if (m_object->isAccessibilityTable())
    952952        objectAttributes = tableAttrs;
    953953    else if (m_object->isTableColumn())
     
    16371637    }   
    16381638   
    1639     if (m_object->isDataTable()) {
     1639    if (m_object->isAccessibilityTable()) {
    16401640        // TODO: distinguish between visible and non-visible rows
    16411641        if ([attributeName isEqualToString:NSAccessibilityRowsAttribute] ||
     
    20872087        return textParamAttrs;
    20882088   
    2089     if (m_object->isDataTable())
     2089    if (m_object->isAccessibilityTable())
    20902090        return tableParamAttrs;
    20912091   
     
    22482248        AccessibilityObject::AccessibilityChildrenVector selectedRows;
    22492249        convertToVector(array, selectedRows);
    2250         if (m_object->isTree() || m_object->isDataTable())
     2250        if (m_object->isTree() || m_object->isAccessibilityTable())
    22512251            m_object->setSelectedRows(selectedRows);
    22522252    } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
     
    25422542    }
    25432543   
    2544     if (m_object->isDataTable()) {
     2544    if (m_object->isAccessibilityTable()) {
    25452545        if ([attribute isEqualToString:NSAccessibilityCellForColumnAndRowParameterizedAttribute]) {
    25462546            if (array == nil || [array count] != 2)
  • trunk/WebKit/gtk/ChangeLog

    r70514 r70554  
     12010-10-26  Mario Sanchez Prada  <msanchez@igalia.com>
     2
     3        Reviewed by Chris Fleizach.
     4
     5        [Gtk] Layout tables should indicate that they are not data tables via an object attribute
     6        https://bugs.webkit.org/show_bug.cgi?id=35422
     7
     8        New unit test to check the 'layout-guess' attribute in tables.
     9
     10        * tests/testatk.c:
     11        (atkAttributeSetAttributeNameHasValue): New, looks for a attribute
     12        with a specific value, by the name of attribute.
     13        (atkAttributeSetContainsAttributeName): New, just checks whether
     14        an attribute with a specified name is present in the set.
     15        (atkAttributeSetAttributeHasValue): Modified to relay on the new
     16        function atkAttributeSetAttributeNameHasValue().
     17        (testWebkitAtkLayoutAndDataTables): New test.
     18        (main): Added the new test.
     19
    1202010-10-26  Xan Lopez  <xlopez@igalia.com>
    221
  • trunk/WebKit/gtk/tests/testatk.c

    r68415 r70554  
    4747static const char* formWithTextInputs = "<html><body><form><input type='text' name='entry' /></form></body></html>";
    4848
     49static 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>";
     50
    4951static const char* listsOfItems = "<html><body><ul><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ul><ol><li>text only</li><li><a href='foo'>link only</a></li><li>text and a <a href='bar'>link</a></li></ol></body></html>";
    5052
     
    597599}
    598600
     601static gboolean atkAttributeSetAttributeNameHasValue(AtkAttributeSet* set, const gchar* attributeName, const gchar* value)
     602{
     603    GSList* element;
     604    AtkAttribute at;
     605    at.name = (gchar*)attributeName;
     606    element = g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName);
     607    return element && !g_strcmp0(((AtkAttribute*)(element->data))->value, value);
     608}
     609
     610static gboolean atkAttributeSetContainsAttributeName(AtkAttributeSet* set, const gchar* attributeName)
     611{
     612    AtkAttribute at;
     613    at.name = (gchar*)attributeName;
     614    return g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName) ? true : false;
     615}
     616
    599617static gboolean atkAttributeSetAttributeHasValue(AtkAttributeSet* set, AtkTextAttribute attribute, const gchar* value)
    600618{
    601     GSList *element;
    602     AtkAttribute at;
    603     gboolean result;
    604     at.name = (gchar *)atk_text_attribute_get_name(attribute);
    605     element = g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName);
    606     result = element && !g_strcmp0(((AtkAttribute*)(element->data))->value, value);
    607     return result;
     619    return atkAttributeSetAttributeNameHasValue(set, atk_text_attribute_get_name(attribute), value);
    608620}
    609621
     
    965977}
    966978
     979static void testWebkitAtkLayoutAndDataTables(void)
     980{
     981    WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
     982    g_object_ref_sink(webView);
     983    GtkAllocation alloc = { 0, 0, 800, 600 };
     984    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
     985    webkit_web_view_load_string(webView, layoutAndDataTables, 0, 0, 0);
     986
     987    // Manually spin the main context to get the accessible objects
     988    while (g_main_context_pending(0))
     989        g_main_context_iteration(0, TRUE);
     990
     991    AtkObject* obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
     992    g_assert(obj);
     993
     994    // Check the non-layout table (data table)
     995
     996    AtkObject* table1 = atk_object_ref_accessible_child(obj, 0);
     997    g_assert(ATK_IS_TABLE(table1));
     998    AtkAttributeSet* set1 = atk_object_get_attributes(table1);
     999    g_assert(set1);
     1000    g_assert(!atkAttributeSetContainsAttributeName(set1, "layout-guess"));
     1001    atk_attribute_set_free(set1);
     1002
     1003    // Check the layout table
     1004
     1005    AtkObject* table2 = atk_object_ref_accessible_child(obj, 1);
     1006    g_assert(ATK_IS_TABLE(table2));
     1007    AtkAttributeSet* set2 = atk_object_get_attributes(table2);
     1008    g_assert(set2);
     1009    g_assert(atkAttributeSetContainsAttributeName(set2, "layout-guess"));
     1010    g_assert(atkAttributeSetAttributeNameHasValue(set2, "layout-guess", "true"));
     1011    atk_attribute_set_free(set2);
     1012
     1013    g_object_unref(table1);
     1014    g_object_unref(table2);
     1015    g_object_unref(webView);
     1016}
     1017
    9671018static void testWebkitAtkListsOfItems(void)
    9681019{
     
    11171168    g_test_add_func("/webkit/atk/textSelections", testWekitAtkTextSelections);
    11181169    g_test_add_func("/webkit/atk/getExtents", testWebkitAtkGetExtents);
     1170    g_test_add_func("/webkit/atk/layoutAndDataTables", testWebkitAtkLayoutAndDataTables);
    11191171    g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
    11201172    g_test_add_func("/webkit/atk/textChangedNotifications", testWebkitAtkTextChangedNotifications);
Note: See TracChangeset for help on using the changeset viewer.