All pastes #1819939 Raw Edit

diego

public text v1 · immutable
#1819939 ·published 2010-03-02 21:17 UTC
rendered paste body
diff --git a/WebCore/accessibility/AXObjectCache.cpp b/WebCore/accessibility/AXObjectCache.cppindex c347a81..f79cf0f 100644--- a/WebCore/accessibility/AXObjectCache.cpp+++ b/WebCore/accessibility/AXObjectCache.cpp@@ -200,6 +200,8 @@ AccessibilityObject* AXObjectCache::getOrCreate(RenderObject* renderer)             newObj = AccessibilityTable::create(renderer);         else if (renderer->isTableRow())             newObj = AccessibilityTableRow::create(renderer);+        else if (renderer->isTableCol())+            newObj = AccessibilityTableColumn::create(renderer);         else if (renderer->isTableCell())             newObj = AccessibilityTableCell::create(renderer); @@ -240,9 +242,6 @@ AccessibilityObject* AXObjectCache::getOrCreate(AccessibilityRole role)     case ImageMapLinkRole:         obj = AccessibilityImageMapLink::create();         break;-    case ColumnRole:-        obj = AccessibilityTableColumn::create();-        break;                 case TableHeaderContainerRole:         obj = AccessibilityTableHeaderContainer::create();         break;   diff --git a/WebCore/accessibility/AccessibilityTableCell.cpp b/WebCore/accessibility/AccessibilityTableCell.cppindex 7674cb8..85d1de0 100644--- a/WebCore/accessibility/AccessibilityTableCell.cpp+++ b/WebCore/accessibility/AccessibilityTableCell.cpp@@ -83,7 +83,7 @@ AccessibilityRole AccessibilityTableCell::roleValue() const {     if (!isTableCell())         return AccessibilityRenderObject::roleValue();-    +     return CellRole; }     diff --git a/WebCore/accessibility/AccessibilityTableColumn.cpp b/WebCore/accessibility/AccessibilityTableColumn.cppindex ee8531e..b243242 100644--- a/WebCore/accessibility/AccessibilityTableColumn.cpp+++ b/WebCore/accessibility/AccessibilityTableColumn.cpp@@ -42,8 +42,9 @@ namespace WebCore {      using namespace HTMLNames; -AccessibilityTableColumn::AccessibilityTableColumn()-    : m_parentTable(0)+AccessibilityTableColumn::AccessibilityTableColumn(RenderObject *renderer)+    : m_parentTable(0),+      AccessibilityRenderObject(renderer) { } @@ -51,9 +52,9 @@ AccessibilityTableColumn::~AccessibilityTableColumn() { }     -PassRefPtr<AccessibilityTableColumn> AccessibilityTableColumn::create()+PassRefPtr<AccessibilityTableColumn> AccessibilityTableColumn::create(RenderObject *renderer) {-    return adoptRef(new AccessibilityTableColumn());+    return adoptRef(new AccessibilityTableColumn(renderer)); }  void AccessibilityTableColumn::setParentTable(AccessibilityTable* table)@@ -73,6 +74,18 @@ IntSize AccessibilityTableColumn::size() const {     return elementRect().size(); }++AccessibilityRole AccessibilityTableColumn::roleValue() const+{+    if (!isTableColumn())+        return AccessibilityRenderObject::roleValue();++    Node* node = m_renderer->node();+    if (node && node->hasTagName(thTag))+        return ColumnHeaderRole;+    +    return ColumnRole;+}    const AccessibilityObject::AccessibilityChildrenVector& AccessibilityTableColumn::children() {diff --git a/WebCore/accessibility/AccessibilityTableColumn.h b/WebCore/accessibility/AccessibilityTableColumn.hindex 6270398..ca9ae76 100644--- a/WebCore/accessibility/AccessibilityTableColumn.h+++ b/WebCore/accessibility/AccessibilityTableColumn.h@@ -37,21 +37,21 @@ namespace WebCore {      class RenderTableSection; -class AccessibilityTableColumn : public AccessibilityObject {+class AccessibilityTableColumn : public AccessibilityRenderObject {      private:-    AccessibilityTableColumn();+    AccessibilityTableColumn(RenderObject*); public:-    static PassRefPtr<AccessibilityTableColumn> create();+    static PassRefPtr<AccessibilityTableColumn> create(RenderObject*);     virtual ~AccessibilityTableColumn();          void setParentTable(AccessibilityTable*);     virtual AccessibilityObject* parentObject() const { return m_parentTable; }     AccessibilityObject* headerObject();         -    virtual AccessibilityRole roleValue() const { return ColumnRole; }     virtual bool accessibilityIsIgnored() const { return false; }     virtual bool isTableColumn() const { return true; }+    virtual AccessibilityRole roleValue() const;          void setColumnIndex(int columnIndex) { m_columnIndex = columnIndex; }     int columnIndex() const { return m_columnIndex; }    diff --git a/WebCore/accessibility/AccessibilityTableRow.cpp b/WebCore/accessibility/AccessibilityTableRow.cppindex 71f8b2b..c151849 100644--- a/WebCore/accessibility/AccessibilityTableRow.cpp+++ b/WebCore/accessibility/AccessibilityTableRow.cpp@@ -61,6 +61,10 @@ AccessibilityRole AccessibilityTableRow::roleValue() const {     if (!isTableRow())         return AccessibilityRenderObject::roleValue();++    Node* node = m_renderer->node();+    if (node && node->hasTagName(thTag))+        return RowHeaderRole;          return RowRole; }diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cppindex 61135e3..30047c8 100644--- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp+++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp@@ -1,3 +1,4 @@+/* vim: set sw=4 ts=4 sts=4 et: */ /*  * Copyright (C) 2008 Nuanti Ltd.  * Copyright (C) 2009 Igalia S.L.@@ -338,6 +339,7 @@ static AtkAttributeSet* webkit_accessible_get_attributes(AtkObject* object)  static AtkRole atkRole(AccessibilityRole role) {+    g_debug ("role atkRole: %d", role);     switch (role) {     case UnknownRole:         return ATK_ROLE_UNKNOWN;@@ -366,11 +368,13 @@ static AtkRole atkRole(AccessibilityRole role)     case MenuListOptionRole:     case MenuItemRole:         return ATK_ROLE_MENU_ITEM;+    case RowHeaderRole:+        return ATK_ROLE_TABLE_ROW_HEADER; // Is this right?+    case ColumnHeaderRole:+        return ATK_ROLE_TABLE_COLUMN_HEADER; // Is this right?     case ColumnRole:-        //return ATK_ROLE_TABLE_COLUMN_HEADER; // Is this right?         return ATK_ROLE_UNKNOWN; // Matches Mozilla     case RowRole:-        //return ATK_ROLE_TABLE_ROW_HEADER; // Is this right?         return ATK_ROLE_LIST_ITEM; // Matches Mozilla     case ToolbarRole:         return ATK_ROLE_TOOL_BAR;@@ -1460,8 +1464,23 @@ static gint webkit_accessible_table_get_row_extent_at(AtkTable* table, gint row,  static AtkObject* webkit_accessible_table_get_column_header(AtkTable* table, gint column) {-    // FIXME: This needs to be implemented.-    notImplemented();+    AccessibilityObject* accTable = core(table);+    if (accTable->isAccessibilityRenderObject()) {+        AccessibilityObject::AccessibilityChildrenVector allColumnHeaders;+        static_cast<AccessibilityTable*>(accTable)->columnHeaders(allColumnHeaders);++        unsigned columnCount = allColumnHeaders.size();+        for (unsigned k = 0; k < columnCount; ++k) {+            AccessibilityObject* columnObject = allColumnHeaders[k]->parentObject();++            g_debug ("column: %d; header: %d",+        column,+        static_cast<AccessibilityTableColumn*>(columnObject)->columnIndex());++            if (static_cast<AccessibilityTableColumn*>(columnObject)->columnIndex() == column)+                return allColumnHeaders[k]->wrapper();+        }+    }     return 0; } @@ -1641,6 +1660,13 @@ static GType GetAtkInterfaceTypeFromWAIType(WAIType type)   return G_TYPE_INVALID; } +/*+ * getInterfaceMaskFromObject:+ * @coreObject: an AccesibilityObject+ *+ * Returns an guint representing all the relevant interfaces @coreObject+ * requires to be initted to.+ */ static guint16 getInterfaceMaskFromObject(AccessibilityObject* coreObject) {     guint16 interfaceMask = 0;diff --git a/WebKit/gtk/tests/testatkroles.c b/WebKit/gtk/tests/testatkroles.cindex d0a792c..576b5c9 100644--- a/WebKit/gtk/tests/testatkroles.c+++ b/WebKit/gtk/tests/testatkroles.c@@ -47,6 +47,8 @@ #define HTML_PASSWORD_TEXT "<html><body><input type='password' /></body></html>" #define HTML_PUSH_BUTTON "<html><body><input type='submit' value='ok' />This is a test.</body></html>" #define HTML_RADIO_BUTTON "<html><body><input type='radio' />This is a test.</body></html>"+/* more complex stuff */+#define HTML_COMPLEX_TABLE "<html><body><table border='1'><tr><th>1</th><th>2</th></tr><tr><th>rowheader</th><td>This is</td><td>a test.</td></tr></table></body></html>"  typedef struct {     AtkObject* documentFrame;@@ -182,6 +184,38 @@ static void test_webkit_atk_get_role_table(AtkRolesFixture *fixture, gconstpoint     _get_child_and_test_role(fixture->documentFrame, 0, ATK_ROLE_TABLE); } +static void test_webkit_atk_table_get_row_header(AtkRolesFixture *fixture, gconstpointer data)+{+    AtkObject* table;++    table = atk_object_ref_accessible_child(fixture->documentFrame, 0);+    g_assert(table);++    AtkObject* header;+    header = atk_table_get_row_header(ATK_TABLE (table), 1);+    g_assert (header);++    g_debug ("description: %s", atk_object_get_description (header));+    g_debug ("name: %s", atk_object_get_name (header));+    g_assert_cmpstr("1", ==, "1");+}++static void test_webkit_atk_table_get_column_header(AtkRolesFixture *fixture, gconstpointer data)+{+    AtkObject* table;++    table = atk_object_ref_accessible_child(fixture->documentFrame, 0);+    g_assert(table);++    AtkObject* header;+    header = atk_table_get_column_header(ATK_TABLE (table), 1);+    g_assert (header);++    g_debug ("description: %s", atk_object_get_description (header));+    g_debug ("name: %s", atk_object_get_name (header));+    g_assert_cmpstr("1", ==, "1");+}+ static void test_webkit_atk_get_role_separator(AtkRolesFixture *fixture, gconstpointer data) {     _get_child_and_test_role(fixture->documentFrame, 0, ATK_ROLE_SEPARATOR);@@ -358,6 +392,16 @@ int main(int argc, char** argv)                atk_roles_fixture_setup,                test_webkit_atk_get_role_table,                atk_roles_fixture_teardown);+    g_test_add("/webkit/atk/test_webkit_atk_table_get_row_header",+               AtkRolesFixture, HTML_COMPLEX_TABLE,+               atk_roles_fixture_setup,+               test_webkit_atk_table_get_row_header,+               atk_roles_fixture_teardown);+    g_test_add("/webkit/atk/test_webkit_atk_table_get_column_header",+               AtkRolesFixture, HTML_COMPLEX_TABLE,+               atk_roles_fixture_setup,+               test_webkit_atk_table_get_column_header,+               atk_roles_fixture_teardown);      g_test_add("/webkit/atk/test_webkit_atk_get_role_separator",                AtkRolesFixture, HTML_SEPARATOR,