Title: [105749] trunk/Source/WebCore
Revision
105749
Author
[email protected]
Date
2012-01-24 10:28:22 -0800 (Tue, 24 Jan 2012)

Log Message

[GTK] Refactor GTK's accessibilitity code to be more modular
https://bugs.webkit.org/show_bug.cgi?id=76783

Reviewed by Martin Robinson.

New files for the implementation of the AtkTable interface,
containing the related code from WebKitAccessibleWrapperAtk.cpp.

* accessibility/gtk/WebKitAccessibleInterfaceTable.cpp: Added.
(core):
(cell):
(cellIndex):
(cellAtIndex):
(webkitAccessibleTableInterfaceInit):
(webkitAccessibleTableRefAt):
(webkitAccessibleTableGetIndexAt):
(webkitAccessibleTableGetColumnAtIndex):
(webkitAccessibleTableGetRowAtIndex):
(webkitAccessibleTableGetNColumns):
(webkitAccessibleTableGetNRows):
(webkitAccessibleTableGetColumnExtentAt):
(webkitAccessibleTableGetRowExtentAt):
(webkitAccessibleTableGetColumnHeader):
(webkitAccessibleTableGetRowHeader):
(webkitAccessibleTableGetCaption):
(webkitAccessibleTableGetColumnDescription):
(webkitAccessibleTableGetRowDescription):
* accessibility/gtk/WebKitAccessibleInterfaceTable.h: Added.
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove code
related to the implementation of the AtkTable interface.

Add new files to build files.

* GNUmakefile.list.am: Add WebKitAccessibleInterfaceTable.[h|cpp].
* WebCore.gypi: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105748 => 105749)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 18:25:08 UTC (rev 105748)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 18:28:22 UTC (rev 105749)
@@ -1,3 +1,41 @@
+2012-01-24  Mario Sanchez Prada  <[email protected]>
+
+        [GTK] Refactor GTK's accessibilitity code to be more modular
+        https://bugs.webkit.org/show_bug.cgi?id=76783
+
+        Reviewed by Martin Robinson.
+
+        New files for the implementation of the AtkTable interface,
+        containing the related code from WebKitAccessibleWrapperAtk.cpp.
+
+        * accessibility/gtk/WebKitAccessibleInterfaceTable.cpp: Added.
+        (core):
+        (cell):
+        (cellIndex):
+        (cellAtIndex):
+        (webkitAccessibleTableInterfaceInit):
+        (webkitAccessibleTableRefAt):
+        (webkitAccessibleTableGetIndexAt):
+        (webkitAccessibleTableGetColumnAtIndex):
+        (webkitAccessibleTableGetRowAtIndex):
+        (webkitAccessibleTableGetNColumns):
+        (webkitAccessibleTableGetNRows):
+        (webkitAccessibleTableGetColumnExtentAt):
+        (webkitAccessibleTableGetRowExtentAt):
+        (webkitAccessibleTableGetColumnHeader):
+        (webkitAccessibleTableGetRowHeader):
+        (webkitAccessibleTableGetCaption):
+        (webkitAccessibleTableGetColumnDescription):
+        (webkitAccessibleTableGetRowDescription):
+        * accessibility/gtk/WebKitAccessibleInterfaceTable.h: Added.
+        * accessibility/gtk/WebKitAccessibleWrapperAtk.cpp: Remove code
+        related to the implementation of the AtkTable interface.
+
+        Add new files to build files.
+
+        * GNUmakefile.list.am: Add WebKitAccessibleInterfaceTable.[h|cpp].
+        * WebCore.gypi: Ditto.
+
 2012-01-24  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Scripts panel tabbed editor container should have gray background when there are no open tabs.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (105748 => 105749)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-01-24 18:25:08 UTC (rev 105748)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-01-24 18:28:22 UTC (rev 105749)
@@ -4439,6 +4439,8 @@
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceImage.h \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceSelection.cpp \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceSelection.h \
+	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.cpp \
+	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.h \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.h \
 	Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceValue.cpp \

Modified: trunk/Source/WebCore/WebCore.gypi (105748 => 105749)


--- trunk/Source/WebCore/WebCore.gypi	2012-01-24 18:25:08 UTC (rev 105748)
+++ trunk/Source/WebCore/WebCore.gypi	2012-01-24 18:28:22 UTC (rev 105749)
@@ -1361,6 +1361,8 @@
             'accessibility/gtk/WebKitAccessibleInterfaceImage.h',
             'accessibility/gtk/WebKitAccessibleInterfaceSelection.cpp',
             'accessibility/gtk/WebKitAccessibleInterfaceSelection.h',
+            'accessibility/gtk/WebKitAccessibleInterfaceTable.cpp',
+            'accessibility/gtk/WebKitAccessibleInterfaceTable.h',
             'accessibility/gtk/WebKitAccessibleInterfaceText.cpp',
             'accessibility/gtk/WebKitAccessibleInterfaceText.h',
             'accessibility/gtk/WebKitAccessibleInterfaceValue.cpp',

Added: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.cpp (0 => 105749)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.cpp	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.cpp	2012-01-24 18:28:22 UTC (rev 105749)
@@ -0,0 +1,248 @@
+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo
+ * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L.
+ *
+ * Portions from Mozilla a11y, copyright as follows:
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Sun Microsystems, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitAccessibleInterfaceTable.h"
+
+#include "AccessibilityListBox.h"
+#include "AccessibilityObject.h"
+#include "AccessibilityTable.h"
+#include "AccessibilityTableCell.h"
+#include "HTMLSelectElement.h"
+#include "HTMLTableCaptionElement.h"
+#include "HTMLTableElement.h"
+#include "RenderObject.h"
+#include "WebKitAccessibleInterfaceText.h"
+#include "WebKitAccessibleWrapperAtk.h"
+
+using namespace WebCore;
+
+static AccessibilityObject* core(AtkTable* table)
+{
+    if (!WEBKIT_IS_ACCESSIBLE(table))
+        return 0;
+
+    return webkitAccessibleGetAccessibilityObject(WEBKIT_ACCESSIBLE(table));
+}
+
+static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
+{
+    AccessibilityObject* accTable = core(table);
+    if (accTable->isAccessibilityRenderObject())
+        return static_cast<AccessibilityTable*>(accTable)->cellForColumnAndRow(column, row);
+    return 0;
+}
+
+static gint cellIndex(AccessibilityTableCell* axCell, AccessibilityTable* axTable)
+{
+    // Calculate the cell's index as if we had a traditional Gtk+ table in
+    // which cells are all direct children of the table, arranged row-first.
+    AccessibilityObject::AccessibilityChildrenVector allCells;
+    axTable->cells(allCells);
+    AccessibilityObject::AccessibilityChildrenVector::iterator position;
+    position = std::find(allCells.begin(), allCells.end(), axCell);
+    if (position == allCells.end())
+        return -1;
+    return position - allCells.begin();
+}
+
+static AccessibilityTableCell* cellAtIndex(AtkTable* table, gint index)
+{
+    AccessibilityObject* accTable = core(table);
+    if (accTable->isAccessibilityRenderObject()) {
+        AccessibilityObject::AccessibilityChildrenVector allCells;
+        static_cast<AccessibilityTable*>(accTable)->cells(allCells);
+        if (0 <= index && static_cast<unsigned>(index) < allCells.size()) {
+            AccessibilityObject* accCell = allCells.at(index).get();
+            return static_cast<AccessibilityTableCell*>(accCell);
+        }
+    }
+    return 0;
+}
+
+void webkitAccessibleTableInterfaceInit(AtkTableIface* iface)
+{
+    iface->ref_at = webkitAccessibleTableRefAt;
+    iface->get_index_at = webkitAccessibleTableGetIndexAt;
+    iface->get_column_at_index = webkitAccessibleTableGetColumnAtIndex;
+    iface->get_row_at_index = webkitAccessibleTableGetRowAtIndex;
+    iface->get_n_columns = webkitAccessibleTableGetNColumns;
+    iface->get_n_rows = webkitAccessibleTableGetNRows;
+    iface->get_column_extent_at = webkitAccessibleTableGetColumnExtentAt;
+    iface->get_row_extent_at = webkitAccessibleTableGetRowExtentAt;
+    iface->get_column_header = webkitAccessibleTableGetColumnHeader;
+    iface->get_row_header = webkitAccessibleTableGetRowHeader;
+    iface->get_caption = webkitAccessibleTableGetCaption;
+    iface->get_column_description = webkitAccessibleTableGetColumnDescription;
+    iface->get_row_description = webkitAccessibleTableGetRowDescription;
+}
+
+AtkObject* webkitAccessibleTableRefAt(AtkTable* table, gint row, gint column)
+{
+    AccessibilityTableCell* axCell = cell(table, row, column);
+    if (!axCell)
+        return 0;
+    return axCell->wrapper();
+}
+
+gint webkitAccessibleTableGetIndexAt(AtkTable* table, gint row, gint column)
+{
+    AccessibilityTableCell* axCell = cell(table, row, column);
+    AccessibilityTable* axTable = static_cast<AccessibilityTable*>(core(table));
+    return cellIndex(axCell, axTable);
+}
+
+gint webkitAccessibleTableGetColumnAtIndex(AtkTable* table, gint index)
+{
+    AccessibilityTableCell* axCell = cellAtIndex(table, index);
+    if (axCell) {
+        pair<int, int> columnRange;
+        axCell->columnIndexRange(columnRange);
+        return columnRange.first;
+    }
+    return -1;
+}
+
+gint webkitAccessibleTableGetRowAtIndex(AtkTable* table, gint index)
+{
+    AccessibilityTableCell* axCell = cellAtIndex(table, index);
+    if (axCell) {
+        pair<int, int> rowRange;
+        axCell->rowIndexRange(rowRange);
+        return rowRange.first;
+    }
+    return -1;
+}
+
+gint webkitAccessibleTableGetNColumns(AtkTable* table)
+{
+    AccessibilityObject* accTable = core(table);
+    if (accTable->isAccessibilityRenderObject())
+        return static_cast<AccessibilityTable*>(accTable)->columnCount();
+    return 0;
+}
+
+gint webkitAccessibleTableGetNRows(AtkTable* table)
+{
+    AccessibilityObject* accTable = core(table);
+    if (accTable->isAccessibilityRenderObject())
+        return static_cast<AccessibilityTable*>(accTable)->rowCount();
+    return 0;
+}
+
+gint webkitAccessibleTableGetColumnExtentAt(AtkTable* table, gint row, gint column)
+{
+    AccessibilityTableCell* axCell = cell(table, row, column);
+    if (axCell) {
+        pair<int, int> columnRange;
+        axCell->columnIndexRange(columnRange);
+        return columnRange.second;
+    }
+    return 0;
+}
+
+gint webkitAccessibleTableGetRowExtentAt(AtkTable* table, gint row, gint column)
+{
+    AccessibilityTableCell* axCell = cell(table, row, column);
+    if (axCell) {
+        pair<int, int> rowRange;
+        axCell->rowIndexRange(rowRange);
+        return rowRange.second;
+    }
+    return 0;
+}
+
+AtkObject* webkitAccessibleTableGetColumnHeader(AtkTable* table, gint column)
+{
+    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) {
+            pair<int, int> columnRange;
+            AccessibilityTableCell* cell = static_cast<AccessibilityTableCell*>(allColumnHeaders.at(k).get());
+            cell->columnIndexRange(columnRange);
+            if (columnRange.first <= column && column < columnRange.first + columnRange.second)
+                return allColumnHeaders[k]->wrapper();
+        }
+    }
+    return 0;
+}
+
+AtkObject* webkitAccessibleTableGetRowHeader(AtkTable* table, gint row)
+{
+    AccessibilityObject* accTable = core(table);
+    if (accTable->isAccessibilityRenderObject()) {
+        AccessibilityObject::AccessibilityChildrenVector allRowHeaders;
+        static_cast<AccessibilityTable*>(accTable)->rowHeaders(allRowHeaders);
+        unsigned rowCount = allRowHeaders.size();
+        for (unsigned k = 0; k < rowCount; ++k) {
+            pair<int, int> rowRange;
+            AccessibilityTableCell* cell = static_cast<AccessibilityTableCell*>(allRowHeaders.at(k).get());
+            cell->rowIndexRange(rowRange);
+            if (rowRange.first <= row && row < rowRange.first + rowRange.second)
+                return allRowHeaders[k]->wrapper();
+        }
+    }
+    return 0;
+}
+
+AtkObject* webkitAccessibleTableGetCaption(AtkTable* table)
+{
+    AccessibilityObject* accTable = core(table);
+    if (accTable->isAccessibilityRenderObject()) {
+        Node* node = accTable->node();
+        if (node && node->hasTagName(HTMLNames::tableTag)) {
+            HTMLTableCaptionElement* caption = static_cast<HTMLTableElement*>(node)->caption();
+            if (caption)
+                return AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->node())->wrapper();
+        }
+    }
+    return 0;
+}
+
+const gchar* webkitAccessibleTableGetColumnDescription(AtkTable* table, gint column)
+{
+    AtkObject* columnHeader = atk_table_get_column_header(table, column);
+    if (columnHeader && ATK_IS_TEXT(columnHeader))
+        return webkitAccessibleTextGetText(ATK_TEXT(columnHeader), 0, -1);
+
+    return 0;
+}
+
+const gchar* webkitAccessibleTableGetRowDescription(AtkTable* table, gint row)
+{
+    AtkObject* rowHeader = atk_table_get_row_header(table, row);
+    if (rowHeader && ATK_IS_TEXT(rowHeader))
+        return webkitAccessibleTextGetText(ATK_TEXT(rowHeader), 0, -1);
+
+    return 0;
+}

Added: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.h (0 => 105749)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.h	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceTable.h	2012-01-24 18:28:22 UTC (rev 105749)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Alonzo
+ * Copyright (C) 2009, 2010, 2011, 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitAccessibleInterfaceTable_h
+#define WebKitAccessibleInterfaceTable_h
+
+#include <atk/atk.h>
+
+void webkitAccessibleTableInterfaceInit(AtkTableIface*);
+AtkObject* webkitAccessibleTableRefAt(AtkTable*, gint row, gint column);
+gint webkitAccessibleTableGetIndexAt(AtkTable*, gint row, gint column);
+gint webkitAccessibleTableGetColumnAtIndex(AtkTable*, gint index);
+gint webkitAccessibleTableGetRowAtIndex(AtkTable*, gint index);
+gint webkitAccessibleTableGetNColumns(AtkTable*);
+gint webkitAccessibleTableGetNRows(AtkTable*);
+gint webkitAccessibleTableGetColumnExtentAt(AtkTable*, gint row, gint column);
+gint webkitAccessibleTableGetRowExtentAt(AtkTable*, gint row, gint column);
+AtkObject* webkitAccessibleTableGetColumnHeader(AtkTable*, gint column);
+AtkObject* webkitAccessibleTableGetRowHeader(AtkTable*, gint row);
+AtkObject* webkitAccessibleTableGetCaption(AtkTable*);
+const gchar* webkitAccessibleTableGetColumnDescription(AtkTable*, gint column);
+const gchar* webkitAccessibleTableGetRowDescription(AtkTable*, gint row);
+
+#endif // WebKitAccessibleInterfaceTable_h

Modified: trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp (105748 => 105749)


--- trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-01-24 18:25:08 UTC (rev 105748)
+++ trunk/Source/WebCore/accessibility/gtk/WebKitAccessibleWrapperAtk.cpp	2012-01-24 18:28:22 UTC (rev 105749)
@@ -71,6 +71,7 @@
 #include "WebKitAccessibleInterfaceHypertext.h"
 #include "WebKitAccessibleInterfaceImage.h"
 #include "WebKitAccessibleInterfaceSelection.h"
+#include "WebKitAccessibleInterfaceTable.h"
 #include "WebKitAccessibleInterfaceText.h"
 #include "WebKitAccessibleInterfaceValue.h"
 #include "WebKitAccessibleUtil.h"
@@ -117,11 +118,6 @@
     return core(WEBKIT_ACCESSIBLE(object));
 }
 
-static AccessibilityObject* core(AtkTable* table)
-{
-    return core(ATK_OBJECT(table));
-}
-
 static const gchar* webkit_accessible_get_name(AtkObject* object)
 {
     AccessibilityObject* coreObject = core(object);
@@ -793,203 +789,6 @@
     return type_volatile;
 }
 
-// Table
-
-static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
-{
-    AccessibilityObject* accTable = core(table);
-    if (accTable->isAccessibilityRenderObject())
-        return static_cast<AccessibilityTable*>(accTable)->cellForColumnAndRow(column, row);
-    return 0;
-}
-
-static gint cellIndex(AccessibilityTableCell* axCell, AccessibilityTable* axTable)
-{
-    // Calculate the cell's index as if we had a traditional Gtk+ table in
-    // which cells are all direct children of the table, arranged row-first.
-    AccessibilityObject::AccessibilityChildrenVector allCells;
-    axTable->cells(allCells);
-    AccessibilityObject::AccessibilityChildrenVector::iterator position;
-    position = std::find(allCells.begin(), allCells.end(), axCell);
-    if (position == allCells.end())
-        return -1;
-    return position - allCells.begin();
-}
-
-static AccessibilityTableCell* cellAtIndex(AtkTable* table, gint index)
-{
-    AccessibilityObject* accTable = core(table);
-    if (accTable->isAccessibilityRenderObject()) {
-        AccessibilityObject::AccessibilityChildrenVector allCells;
-        static_cast<AccessibilityTable*>(accTable)->cells(allCells);
-        if (0 <= index && static_cast<unsigned>(index) < allCells.size()) {
-            AccessibilityObject* accCell = allCells.at(index).get();
-            return static_cast<AccessibilityTableCell*>(accCell);
-        }
-    }
-    return 0;
-}
-
-static AtkObject* webkit_accessible_table_ref_at(AtkTable* table, gint row, gint column)
-{
-    AccessibilityTableCell* axCell = cell(table, row, column);
-    if (!axCell)
-        return 0;
-    return axCell->wrapper();
-}
-
-static gint webkit_accessible_table_get_index_at(AtkTable* table, gint row, gint column)
-{
-    AccessibilityTableCell* axCell = cell(table, row, column);
-    AccessibilityTable* axTable = static_cast<AccessibilityTable*>(core(table));
-    return cellIndex(axCell, axTable);
-}
-
-static gint webkit_accessible_table_get_column_at_index(AtkTable* table, gint index)
-{
-    AccessibilityTableCell* axCell = cellAtIndex(table, index);
-    if (axCell) {
-        pair<int, int> columnRange;
-        axCell->columnIndexRange(columnRange);
-        return columnRange.first;
-    }
-    return -1;
-}
-
-static gint webkit_accessible_table_get_row_at_index(AtkTable* table, gint index)
-{
-    AccessibilityTableCell* axCell = cellAtIndex(table, index);
-    if (axCell) {
-        pair<int, int> rowRange;
-        axCell->rowIndexRange(rowRange);
-        return rowRange.first;
-    }
-    return -1;
-}
-
-static gint webkit_accessible_table_get_n_columns(AtkTable* table)
-{
-    AccessibilityObject* accTable = core(table);
-    if (accTable->isAccessibilityRenderObject())
-        return static_cast<AccessibilityTable*>(accTable)->columnCount();
-    return 0;
-}
-
-static gint webkit_accessible_table_get_n_rows(AtkTable* table)
-{
-    AccessibilityObject* accTable = core(table);
-    if (accTable->isAccessibilityRenderObject())
-        return static_cast<AccessibilityTable*>(accTable)->rowCount();
-    return 0;
-}
-
-static gint webkit_accessible_table_get_column_extent_at(AtkTable* table, gint row, gint column)
-{
-    AccessibilityTableCell* axCell = cell(table, row, column);
-    if (axCell) {
-        pair<int, int> columnRange;
-        axCell->columnIndexRange(columnRange);
-        return columnRange.second;
-    }
-    return 0;
-}
-
-static gint webkit_accessible_table_get_row_extent_at(AtkTable* table, gint row, gint column)
-{
-    AccessibilityTableCell* axCell = cell(table, row, column);
-    if (axCell) {
-        pair<int, int> rowRange;
-        axCell->rowIndexRange(rowRange);
-        return rowRange.second;
-    }
-    return 0;
-}
-
-static AtkObject* webkit_accessible_table_get_column_header(AtkTable* table, gint column)
-{
-    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) {
-            pair<int, int> columnRange;
-            AccessibilityTableCell* cell = static_cast<AccessibilityTableCell*>(allColumnHeaders.at(k).get());
-            cell->columnIndexRange(columnRange);
-            if (columnRange.first <= column && column < columnRange.first + columnRange.second)
-                return allColumnHeaders[k]->wrapper();
-        }
-    }
-    return 0;
-}
-
-static AtkObject* webkit_accessible_table_get_row_header(AtkTable* table, gint row)
-{
-    AccessibilityObject* accTable = core(table);
-    if (accTable->isAccessibilityRenderObject()) {
-        AccessibilityObject::AccessibilityChildrenVector allRowHeaders;
-        static_cast<AccessibilityTable*>(accTable)->rowHeaders(allRowHeaders);
-        unsigned rowCount = allRowHeaders.size();
-        for (unsigned k = 0; k < rowCount; ++k) {
-            pair<int, int> rowRange;
-            AccessibilityTableCell* cell = static_cast<AccessibilityTableCell*>(allRowHeaders.at(k).get());
-            cell->rowIndexRange(rowRange);
-            if (rowRange.first <= row && row < rowRange.first + rowRange.second)
-                return allRowHeaders[k]->wrapper();
-        }
-    }
-    return 0;
-}
-
-static AtkObject* webkit_accessible_table_get_caption(AtkTable* table)
-{
-    AccessibilityObject* accTable = core(table);
-    if (accTable->isAccessibilityRenderObject()) {
-        Node* node = accTable->node();
-        if (node && node->hasTagName(HTMLNames::tableTag)) {
-            HTMLTableCaptionElement* caption = static_cast<HTMLTableElement*>(node)->caption();
-            if (caption)
-                return AccessibilityObject::firstAccessibleObjectFromNode(caption->renderer()->node())->wrapper();
-        }
-    }
-    return 0;
-}
-
-static const gchar* webkit_accessible_table_get_column_description(AtkTable* table, gint column)
-{
-    AtkObject* columnHeader = atk_table_get_column_header(table, column);
-    if (columnHeader && ATK_IS_TEXT(columnHeader))
-        return webkitAccessibleTextGetText(ATK_TEXT(columnHeader), 0, -1);
-
-    return 0;
-}
-
-static const gchar* webkit_accessible_table_get_row_description(AtkTable* table, gint row)
-{
-    AtkObject* rowHeader = atk_table_get_row_header(table, row);
-    if (rowHeader && ATK_IS_TEXT(rowHeader))
-        return webkitAccessibleTextGetText(ATK_TEXT(rowHeader), 0, -1);
-
-    return 0;
-}
-
-static void atk_table_interface_init(AtkTableIface* iface)
-{
-    iface->ref_at = webkit_accessible_table_ref_at;
-    iface->get_index_at = webkit_accessible_table_get_index_at;
-    iface->get_column_at_index = webkit_accessible_table_get_column_at_index;
-    iface->get_row_at_index = webkit_accessible_table_get_row_at_index;
-    iface->get_n_columns = webkit_accessible_table_get_n_columns;
-    iface->get_n_rows = webkit_accessible_table_get_n_rows;
-    iface->get_column_extent_at = webkit_accessible_table_get_column_extent_at;
-    iface->get_row_extent_at = webkit_accessible_table_get_row_extent_at;
-    iface->get_column_header = webkit_accessible_table_get_column_header;
-    iface->get_row_header = webkit_accessible_table_get_row_header;
-    iface->get_caption = webkit_accessible_table_get_caption;
-    iface->get_column_description = webkit_accessible_table_get_column_description;
-    iface->get_row_description = webkit_accessible_table_get_row_description;
-}
-
 static const GInterfaceInfo AtkInterfacesInitFunctions[] = {
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleActionInterfaceInit), 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleSelectionInterfaceInit), 0, 0},
@@ -997,8 +796,7 @@
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleTextInterfaceInit), 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleComponentInterfaceInit), 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleImageInterfaceInit), 0, 0},
-    {(GInterfaceInitFunc)atk_table_interface_init,
-     (GInterfaceFinalizeFunc) 0, 0},
+    {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleTableInterfaceInit), 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleHypertextInterfaceInit), 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleHyperlinkImplInterfaceInit), 0, 0},
     {reinterpret_cast<GInterfaceInitFunc>(webkitAccessibleDocumentInterfaceInit), 0, 0},
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to