[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 14:58:32 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a9398ddd6e58f02f9fc2077ca9477773bdb3c357
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 26 19:19:29 2010 +0000

    2010-10-26  Mario Sanchez Prada  <msanchez at 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 at 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.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70554 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a404250..bfad927 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,96 @@
+2010-10-26  Mario Sanchez Prada  <msanchez at 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  Chris Marrin  <cmarrin at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/accessibility/AccessibilityARIAGrid.cpp b/WebCore/accessibility/AccessibilityARIAGrid.cpp
index 0d9f845..8651a80 100644
--- a/WebCore/accessibility/AccessibilityARIAGrid.cpp
+++ b/WebCore/accessibility/AccessibilityARIAGrid.cpp
@@ -83,7 +83,7 @@ void AccessibilityARIAGrid::addChildren()
 {
     ASSERT(!m_haveChildren); 
     
-    if (!isDataTable()) {
+    if (!isAccessibilityTable()) {
         AccessibilityRenderObject::addChildren();
         return;
     }
diff --git a/WebCore/accessibility/AccessibilityARIAGridCell.cpp b/WebCore/accessibility/AccessibilityARIAGridCell.cpp
index 1771bb8..c8157f5 100644
--- a/WebCore/accessibility/AccessibilityARIAGridCell.cpp
+++ b/WebCore/accessibility/AccessibilityARIAGridCell.cpp
@@ -57,7 +57,7 @@ AccessibilityObject* AccessibilityARIAGridCell::parentTable() const
         return 0;
     
     parent = parent->parentObjectUnignored();
-    if (!parent || !parent->isDataTable())
+    if (!parent || !parent->isAccessibilityTable())
         return 0;
     
     return parent;
diff --git a/WebCore/accessibility/AccessibilityARIAGridRow.cpp b/WebCore/accessibility/AccessibilityARIAGridRow.cpp
index 7d562d9..2b96036 100644
--- a/WebCore/accessibility/AccessibilityARIAGridRow.cpp
+++ b/WebCore/accessibility/AccessibilityARIAGridRow.cpp
@@ -65,7 +65,7 @@ void AccessibilityARIAGridRow::disclosedRows(AccessibilityChildrenVector& disclo
     // The contiguous disclosed rows will be the rows in the table that 
     // have an aria-level of plus 1 from this row.
     AccessibilityObject* parent = parentObjectUnignored();
-    if (!parent || !parent->isDataTable())
+    if (!parent || !parent->isAccessibilityTable())
         return;
     
     // Search for rows that match the correct level. 
@@ -92,7 +92,7 @@ AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const
     // The row that discloses this one is the row in the table
     // that is aria-level subtract 1 from this row.
     AccessibilityObject* parent = parentObjectUnignored();
-    if (!parent || !parent->isDataTable())
+    if (!parent || !parent->isAccessibilityTable())
         return 0;
     
     // If the level is 1 or less, than nothing discloses this row.
@@ -119,7 +119,7 @@ AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const
 AccessibilityObject* AccessibilityARIAGridRow::parentTable() const
 {
     AccessibilityObject* parent = parentObjectUnignored();
-    if (!parent->isDataTable())
+    if (!parent->isAccessibilityTable())
         return 0;
     
     return parent;
diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h
index f2e1efe..66424ea 100644
--- a/WebCore/accessibility/AccessibilityObject.h
+++ b/WebCore/accessibility/AccessibilityObject.h
@@ -285,6 +285,7 @@ public:
     virtual bool isSlider() const { return false; }
     virtual bool isControl() const { return false; }
     virtual bool isList() const { return false; }
+    virtual bool isAccessibilityTable() const { return false; }
     virtual bool isDataTable() const { return false; }
     virtual bool isTableRow() const { return false; }
     virtual bool isTableColumn() const { return false; }
diff --git a/WebCore/accessibility/AccessibilityTable.cpp b/WebCore/accessibility/AccessibilityTable.cpp
index 7f7b6f2..aa51f9e 100644
--- a/WebCore/accessibility/AccessibilityTable.cpp
+++ b/WebCore/accessibility/AccessibilityTable.cpp
@@ -67,37 +67,45 @@ PassRefPtr<AccessibilityTable> AccessibilityTable::create(RenderObject* renderer
     return adoptRef(new AccessibilityTable(renderer));
 }
 
-bool AccessibilityTable::isTableExposableThroughAccessibility()
+bool AccessibilityTable::hasARIARole() const
 {
-    // the following is a heuristic used to determine if a
-    // <table> should be exposed as an AXTable. The goal
-    // is to only show "data" tables
-    
-    if (!renderer())
+    if (!m_renderer)
         return false;
     
-    // if the developer assigned an aria role to this, then we shouldn't 
-    // expose it as a table, unless, of course, the aria role is a table
     AccessibilityRole ariaRole = ariaRoleAttribute();
     if (ariaRole != UnknownRole)
+        return true;
+
+    return false;
+}
+
+bool AccessibilityTable::isAccessibilityTable() const
+{
+    if (!m_renderer)
         return false;
     
-    RenderTable* table = toRenderTable(m_renderer);
-    
-    // this employs a heuristic to determine if this table should appear. 
-    // Only "data" tables should be exposed as tables. 
+    return m_isAccessibilityTable;
+}
+
+bool AccessibilityTable::isDataTable() const
+{
+    if (!m_renderer)
+        return false;
+
+    // Do not consider it a data table is it has an ARIA role.
+    if (hasARIARole())
+        return false;
+
+    // This employs a heuristic to determine if this table should appear.
+    // Only "data" tables should be exposed as tables.
     // Unfortunately, there is no good way to determine the difference
-    // between a "layout" table and a "data" table
+    // between a "layout" table and a "data" table.
     
+    RenderTable* table = toRenderTable(m_renderer);
     Node* tableNode = table->node();
     if (!tableNode || !tableNode->hasTagName(tableTag))
         return false;
 
-    // Gtk+ ATs expect all tables to be exposed as tables.
-#if PLATFORM(GTK)
-    return true;
-#endif
-    
     // if there is a caption element, summary, THEAD, or TFOOT section, it's most certainly a data table
     HTMLTableElement* tableElement = static_cast<HTMLTableElement*>(tableNode);
     if (!tableElement->summary().isEmpty() || tableElement->tHead() || tableElement->tFoot() || tableElement->caption())
@@ -242,6 +250,30 @@ bool AccessibilityTable::isTableExposableThroughAccessibility()
     return false;
 }
     
+bool AccessibilityTable::isTableExposableThroughAccessibility() const
+{
+    // The following is a heuristic used to determine if a
+    // <table> should be exposed as an AXTable. The goal
+    // is to only show "data" tables.
+
+    if (!m_renderer)
+        return false;
+
+    // If the developer assigned an aria role to this, then we
+    // shouldn't expose it as a table, unless, of course, the aria
+    // role is a table.
+    if (hasARIARole())
+        return false;
+
+    // Gtk+ ATs expect all tables to be exposed as tables.
+#if PLATFORM(GTK)
+    Node* tableNode = toRenderTable(m_renderer)->node();
+    return tableNode && tableNode->hasTagName(tableTag);
+#endif
+
+    return isDataTable();
+}
+
 void AccessibilityTable::clearChildren()
 {
     AccessibilityRenderObject::clearChildren();
@@ -251,7 +283,7 @@ void AccessibilityTable::clearChildren()
 
 void AccessibilityTable::addChildren()
 {
-    if (!isDataTable()) {
+    if (!isAccessibilityTable()) {
         AccessibilityRenderObject::addChildren();
         return;
     }
@@ -488,7 +520,7 @@ AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column,
 
 AccessibilityRole AccessibilityTable::roleValue() const
 {
-    if (!isDataTable())
+    if (!isAccessibilityTable())
         return AccessibilityRenderObject::roleValue();
 
     return TableRole;
@@ -502,7 +534,7 @@ bool AccessibilityTable::accessibilityIsIgnored() const
     if (decision == IgnoreObject)
         return true;
     
-    if (!isDataTable())
+    if (!isAccessibilityTable())
         return AccessibilityRenderObject::accessibilityIsIgnored();
         
     return false;
@@ -510,7 +542,7 @@ bool AccessibilityTable::accessibilityIsIgnored() const
     
 String AccessibilityTable::title() const
 {
-    if (!isDataTable())
+    if (!isAccessibilityTable())
         return AccessibilityRenderObject::title();
     
     String title;
@@ -532,12 +564,4 @@ String AccessibilityTable::title() const
     return title;
 }
 
-bool AccessibilityTable::isDataTable() const
-{
-    if (!m_renderer)
-        return false;
-    
-    return m_isAccessibilityTable;
-}
-
 } // namespace WebCore
diff --git a/WebCore/accessibility/AccessibilityTable.h b/WebCore/accessibility/AccessibilityTable.h
index 2ee5812..1666367 100644
--- a/WebCore/accessibility/AccessibilityTable.h
+++ b/WebCore/accessibility/AccessibilityTable.h
@@ -51,7 +51,9 @@ public:
     static PassRefPtr<AccessibilityTable> create(RenderObject*);
     virtual ~AccessibilityTable();
 
+    virtual bool isAccessibilityTable() const;
     virtual bool isDataTable() const;
+
     virtual AccessibilityRole roleValue() const;
     virtual bool isAriaTable() const { return false; }
     
@@ -86,7 +88,8 @@ protected:
     AccessibilityTableHeaderContainer* m_headerContainer;
     mutable bool m_isAccessibilityTable;
 
-    bool isTableExposableThroughAccessibility();
+    bool hasARIARole() const;
+    bool isTableExposableThroughAccessibility() const;
 };
 
 } // namespace WebCore 
diff --git a/WebCore/accessibility/AccessibilityTableCell.cpp b/WebCore/accessibility/AccessibilityTableCell.cpp
index e2efb5e..7ad6063 100644
--- a/WebCore/accessibility/AccessibilityTableCell.cpp
+++ b/WebCore/accessibility/AccessibilityTableCell.cpp
@@ -84,7 +84,7 @@ AccessibilityObject* AccessibilityTableCell::parentTable() const
 bool AccessibilityTableCell::isTableCell() const
 {
     AccessibilityObject* table = parentTable();
-    if (!table || !table->isDataTable())
+    if (!table || !table->isAccessibilityTable())
         return false;
     
     return true;
diff --git a/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp b/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp
index e2da83c..dad6963 100644
--- a/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp
+++ b/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp
@@ -85,7 +85,7 @@ void AccessibilityTableHeaderContainer::addChildren()
     ASSERT(!m_haveChildren); 
     
     m_haveChildren = true;
-    if (!m_parentTable || !m_parentTable->isDataTable())
+    if (!m_parentTable || !m_parentTable->isAccessibilityTable())
         return;
     
     static_cast<AccessibilityTable*>(m_parentTable)->columnHeaders(m_children);
diff --git a/WebCore/accessibility/AccessibilityTableRow.cpp b/WebCore/accessibility/AccessibilityTableRow.cpp
index 5e9f05c..09db132 100644
--- a/WebCore/accessibility/AccessibilityTableRow.cpp
+++ b/WebCore/accessibility/AccessibilityTableRow.cpp
@@ -68,7 +68,7 @@ AccessibilityRole AccessibilityTableRow::roleValue() const
 bool AccessibilityTableRow::isTableRow() const
 {
     AccessibilityObject* table = parentTable();
-    if (!table || !table->isDataTable())
+    if (!table || !table->isAccessibilityTable())
         return false;
     
     return true;
diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
index aa88217..b52ad16 100644
--- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
+++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
@@ -329,14 +329,23 @@ static AtkAttributeSet* addAttributeToSet(AtkAttributeSet* attributeSet, const c
 static AtkAttributeSet* webkit_accessible_get_attributes(AtkObject* object)
 {
     AtkAttributeSet* attributeSet = 0;
-
     attributeSet = addAttributeToSet(attributeSet, "toolkit", "WebKitGtk");
 
-    int headingLevel = core(object)->headingLevel();
+    AccessibilityObject* coreObject = core(object);
+    if (!coreObject)
+        return attributeSet;
+
+    int headingLevel = coreObject->headingLevel();
     if (headingLevel) {
         String value = String::number(headingLevel);
         attributeSet = addAttributeToSet(attributeSet, "level", value.utf8().data());
     }
+
+    // Set the 'layout-guess' attribute to help Assistive
+    // Technologies know when an exposed table is not data table.
+    if (coreObject->isAccessibilityTable() && !coreObject->isDataTable())
+        attributeSet = addAttributeToSet(attributeSet, "layout-guess", "true");
+
     return attributeSet;
 }
 
diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
index e4b7d8e..7a13f11 100644
--- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
+++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
@@ -647,7 +647,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache
     if (m_object->supportsARIADropping())
         [additional addObject:NSAccessibilityDropEffectsAttribute];
 
-    if (m_object->isDataTable() && static_cast<AccessibilityTable*>(m_object)->supportsSelectedRows())
+    if (m_object->isAccessibilityTable() && static_cast<AccessibilityTable*>(m_object)->supportsSelectedRows())
         [additional addObject:NSAccessibilitySelectedRowsAttribute];        
     
     if (m_object->supportsARIALiveRegion()) {
@@ -948,7 +948,7 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(AXObjectCache
     else if (m_object->isAnchor() || m_object->isImage() || m_object->isLink())
         objectAttributes = anchorAttrs;
 
-    else if (m_object->isDataTable())
+    else if (m_object->isAccessibilityTable())
         objectAttributes = tableAttrs;
     else if (m_object->isTableColumn())
         objectAttributes = tableColAttrs;
@@ -1636,7 +1636,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         }
     }    
     
-    if (m_object->isDataTable()) {
+    if (m_object->isAccessibilityTable()) {
         // TODO: distinguish between visible and non-visible rows
         if ([attributeName isEqualToString:NSAccessibilityRowsAttribute] || 
             [attributeName isEqualToString:NSAccessibilityVisibleRowsAttribute]) {
@@ -2086,7 +2086,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if (m_object->isTextControl())
         return textParamAttrs;
     
-    if (m_object->isDataTable())
+    if (m_object->isAccessibilityTable())
         return tableParamAttrs;
     
     if (m_object->isMenuRelated())
@@ -2247,7 +2247,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     else if ([attributeName isEqualToString:NSAccessibilitySelectedRowsAttribute]) {
         AccessibilityObject::AccessibilityChildrenVector selectedRows;
         convertToVector(array, selectedRows);
-        if (m_object->isTree() || m_object->isDataTable())
+        if (m_object->isTree() || m_object->isAccessibilityTable())
             m_object->setSelectedRows(selectedRows);
     } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
         m_object->setARIAGrabbed([number boolValue]);
@@ -2541,7 +2541,7 @@ static RenderObject* rendererForView(NSView* view)
         return [self textMarkerForVisiblePosition:visiblePosRange.end];
     }
     
-    if (m_object->isDataTable()) {
+    if (m_object->isAccessibilityTable()) {
         if ([attribute isEqualToString:NSAccessibilityCellForColumnAndRowParameterizedAttribute]) {
             if (array == nil || [array count] != 2)
                 return nil;
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index f4d4b08..48d2377 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-26  Mario Sanchez Prada  <msanchez at 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.
+
 2010-10-26  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/tests/testatk.c b/WebKit/gtk/tests/testatk.c
index c8df4ef..8f21fff 100644
--- a/WebKit/gtk/tests/testatk.c
+++ b/WebKit/gtk/tests/testatk.c
@@ -46,6 +46,8 @@ static const char* contentsInTableWithHeaders = "<html><body><table><tr><th>foo<
 
 static const char* formWithTextInputs = "<html><body><form><input type='text' name='entry' /></form></body></html>";
 
+static 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>";
+
 static 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>";
 
 static const char* textForSelections = "<html><body><p>A paragraph with plain text</p><p>A paragraph with <a href='http://webkit.org'>a link</a> in the middle</p></body></html>";
@@ -596,15 +598,25 @@ static gint compAtkAttributeName(AtkAttribute* a1, AtkAttribute* a2)
     return g_strcmp0(a1->name, a2->name);
 }
 
-static gboolean atkAttributeSetAttributeHasValue(AtkAttributeSet* set, AtkTextAttribute attribute, const gchar* value)
+static gboolean atkAttributeSetAttributeNameHasValue(AtkAttributeSet* set, const gchar* attributeName, const gchar* value)
 {
-    GSList *element;
+    GSList* element;
     AtkAttribute at;
-    gboolean result;
-    at.name = (gchar *)atk_text_attribute_get_name(attribute);
+    at.name = (gchar*)attributeName;
     element = g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName);
-    result = element && !g_strcmp0(((AtkAttribute*)(element->data))->value, value);
-    return result;
+    return element && !g_strcmp0(((AtkAttribute*)(element->data))->value, value);
+}
+
+static gboolean atkAttributeSetContainsAttributeName(AtkAttributeSet* set, const gchar* attributeName)
+{
+    AtkAttribute at;
+    at.name = (gchar*)attributeName;
+    return g_slist_find_custom(set, &at, (GCompareFunc)compAtkAttributeName) ? true : false;
+}
+
+static gboolean atkAttributeSetAttributeHasValue(AtkAttributeSet* set, AtkTextAttribute attribute, const gchar* value)
+{
+    return atkAttributeSetAttributeNameHasValue(set, atk_text_attribute_get_name(attribute), value);
 }
 
 static gboolean atkAttributeSetAreEqual(AtkAttributeSet* set1, AtkAttributeSet* set2)
@@ -964,6 +976,45 @@ static void testWebkitAtkGetExtents(void)
     g_object_unref(webView);
 }
 
+static void testWebkitAtkLayoutAndDataTables(void)
+{
+    WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+    g_object_ref_sink(webView);
+    GtkAllocation alloc = { 0, 0, 800, 600 };
+    gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
+    webkit_web_view_load_string(webView, layoutAndDataTables, 0, 0, 0);
+
+    // Manually spin the main context to get the accessible objects
+    while (g_main_context_pending(0))
+        g_main_context_iteration(0, TRUE);
+
+    AtkObject* obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
+    g_assert(obj);
+
+    // Check the non-layout table (data table)
+
+    AtkObject* table1 = atk_object_ref_accessible_child(obj, 0);
+    g_assert(ATK_IS_TABLE(table1));
+    AtkAttributeSet* set1 = atk_object_get_attributes(table1);
+    g_assert(set1);
+    g_assert(!atkAttributeSetContainsAttributeName(set1, "layout-guess"));
+    atk_attribute_set_free(set1);
+
+    // Check the layout table
+
+    AtkObject* table2 = atk_object_ref_accessible_child(obj, 1);
+    g_assert(ATK_IS_TABLE(table2));
+    AtkAttributeSet* set2 = atk_object_get_attributes(table2);
+    g_assert(set2);
+    g_assert(atkAttributeSetContainsAttributeName(set2, "layout-guess"));
+    g_assert(atkAttributeSetAttributeNameHasValue(set2, "layout-guess", "true"));
+    atk_attribute_set_free(set2);
+
+    g_object_unref(table1);
+    g_object_unref(table2);
+    g_object_unref(webView);
+}
+
 static void testWebkitAtkListsOfItems(void)
 {
     WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
@@ -1116,6 +1167,7 @@ int main(int argc, char** argv)
     g_test_add_func("/webkit/atk/textAttributes", testWebkitAtkTextAttributes);
     g_test_add_func("/webkit/atk/textSelections", testWekitAtkTextSelections);
     g_test_add_func("/webkit/atk/getExtents", testWebkitAtkGetExtents);
+    g_test_add_func("/webkit/atk/layoutAndDataTables", testWebkitAtkLayoutAndDataTables);
     g_test_add_func("/webkit/atk/listsOfItems", testWebkitAtkListsOfItems);
     g_test_add_func("/webkit/atk/textChangedNotifications", testWebkitAtkTextChangedNotifications);
     return g_test_run ();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list