Source/WebCore: [ATK] Expose missing functionalities of AtkTableCell to AT.
authork.czech@samsung.com <k.czech@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Mar 2014 15:16:08 +0000 (15:16 +0000)
committerk.czech@samsung.com <k.czech@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Mar 2014 15:16:08 +0000 (15:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=129492

Reviewed by Mario Sanchez Prada.

Implemented missing API of AtkTableCell.

No new tests. Covered by existing ones.

* accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
(webkitAccessibleTableCellGetColumnSpan):
(webkitAccessibleTableCellGetRowSpan):
(webkitAccessibleTableCellGetPosition):
(webkitAccessibleTableCellGetTable):
(webkitAccessibleTableCellInterfaceInit):

Tools: [ATK] Expose missing functionalities of AtkTableCell to AT
https://bugs.webkit.org/show_bug.cgi?id=129492

Reviewed by Mario Sanchez Prada.

Reducing some code by using new API of AtkTableCell.

* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165107 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp
Tools/ChangeLog
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

index dacf3c6..9084de4 100644 (file)
@@ -1,3 +1,21 @@
+2014-03-05  Krzysztof Czech  <k.czech@samsung.com>
+
+        [ATK] Expose missing functionalities of AtkTableCell to AT.
+        https://bugs.webkit.org/show_bug.cgi?id=129492
+
+        Reviewed by Mario Sanchez Prada.
+
+        Implemented missing API of AtkTableCell.
+
+        No new tests. Covered by existing ones.
+
+        * accessibility/atk/WebKitAccessibleInterfaceTableCell.cpp:
+        (webkitAccessibleTableCellGetColumnSpan):
+        (webkitAccessibleTableCellGetRowSpan):
+        (webkitAccessibleTableCellGetPosition):
+        (webkitAccessibleTableCellGetTable):
+        (webkitAccessibleTableCellInterfaceInit):
+
 2014-03-05  Andres Gomez  <agomez@igalia.com>
 
         [GStreamer] WebSource doesn't need the "iradio-mode" property
index 498c266..bfe6101 100644 (file)
@@ -78,10 +78,82 @@ GPtrArray* webkitAccessibleTableCellGetRowHeaderCells(AtkTableCell* cell)
     return convertToGPtrArray(rowHeaders);
 }
 
+gint webkitAccessibleTableCellGetColumnSpan(AtkTableCell* cell)
+{
+    g_return_val_if_fail(ATK_TABLE_CELL(cell), 0);
+    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), 0);
+
+    AccessibilityObject* axObject = core(cell);
+    if (!axObject || !axObject->isTableCell())
+        return 0;
+
+    std::pair<unsigned, unsigned> columnRange;
+    toAccessibilityTableCell(axObject)->columnIndexRange(columnRange);
+
+    return columnRange.second;
+}
+
+gint webkitAccessibleTableCellGetRowSpan(AtkTableCell* cell)
+{
+    g_return_val_if_fail(ATK_TABLE_CELL(cell), 0);
+    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), 0);
+
+    AccessibilityObject* axObject = core(cell);
+    if (!axObject || !axObject->isTableCell())
+        return 0;
+
+    std::pair<unsigned, unsigned> rowRange;
+    toAccessibilityTableCell(axObject)->rowIndexRange(rowRange);
+
+    return rowRange.second;
+}
+
+gboolean webkitAccessibleTableCellGetPosition(AtkTableCell* cell, gint* row, gint* column)
+{
+    g_return_val_if_fail(ATK_TABLE_CELL(cell), false);
+    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), false);
+
+    AccessibilityObject* axObject = core(cell);
+    if (!axObject || !axObject->isTableCell())
+        return false;
+
+    std::pair<unsigned, unsigned> columnRowRange;
+    if (row) {
+        toAccessibilityTableCell(axObject)->rowIndexRange(columnRowRange);
+        *row = columnRowRange.first;
+    }
+    if (column) {
+        toAccessibilityTableCell(axObject)->columnIndexRange(columnRowRange);
+        *column = columnRowRange.first;
+    }
+
+    return true;
+}
+
+AtkObject* webkitAccessibleTableCellGetTable(AtkTableCell* cell)
+{
+    g_return_val_if_fail(ATK_TABLE_CELL(cell), nullptr);
+    returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), nullptr);
+
+    AccessibilityObject* axObject = core(cell);
+    if (!axObject || !axObject->isTableCell())
+        return nullptr;
+
+    AtkObject* table = atk_object_get_parent(axObject->wrapper());
+    if (!table || !ATK_IS_TABLE(table))
+        return nullptr;
+
+    return ATK_OBJECT(g_object_ref(table));
+}
+
 void webkitAccessibleTableCellInterfaceInit(AtkTableCellIface* iface)
 {
     iface->get_column_header_cells = webkitAccessibleTableCellGetColumnHeaderCells;
     iface->get_row_header_cells = webkitAccessibleTableCellGetRowHeaderCells;
+    iface->get_column_span = webkitAccessibleTableCellGetColumnSpan;
+    iface->get_row_span = webkitAccessibleTableCellGetRowSpan;
+    iface->get_position = webkitAccessibleTableCellGetPosition;
+    iface->get_table = webkitAccessibleTableCellGetTable;
 }
 
 #endif
index 240e754..fa6e9f2 100644 (file)
@@ -1,3 +1,15 @@
+2014-03-05  Krzysztof Czech  <k.czech@samsung.com>
+
+        [ATK] Expose missing functionalities of AtkTableCell to AT
+        https://bugs.webkit.org/show_bug.cgi?id=129492
+
+        Reviewed by Mario Sanchez Prada.
+
+        Reducing some code by using new API of AtkTableCell.
+
+        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+
 2014-03-04  Alex Christensen  <achristensen@webkit.org>
 
         Preparing to run layout tests on Wincairo.
index c96d58e..67af458 100644 (file)
@@ -495,12 +495,14 @@ static void convertGPtrArrayToVector(const GPtrArray* array, Vector<Accessibilit
 }
 #endif
 
-} // namespace
-
 JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
 {
     GUniquePtr<gchar> rangeString(g_strdup("{0, 0}"));
 
+#if ATK_CHECK_VERSION(2,11,90)
+    if (!ATK_IS_TABLE_CELL(element))
+        return JSStringCreateWithUTF8CString(rangeString.get());
+#else
     if (!ATK_IS_OBJECT(element))
         return JSStringCreateWithUTF8CString(rangeString.get());
 
@@ -512,11 +514,20 @@ JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
     gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element));
     if (indexInParent == -1)
         return JSStringCreateWithUTF8CString(rangeString.get());
+#endif
 
-    int row = -1;
-    int column = -1;
+    gint row = -1;
+    gint column = -1;
+    gint rowSpan = -1;
+    gint columnSpan = -1;
+#if ATK_CHECK_VERSION(2,11,90)
+    atk_table_cell_get_row_column_span(ATK_TABLE_CELL(element), &row, &column, &rowSpan, &columnSpan);
+#else
     row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent);
     column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent);
+    rowSpan = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
+    columnSpan = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
+#endif
 
     // Get the actual values, if row and columns are valid values.
     if (row != -1 && column != -1) {
@@ -524,10 +535,10 @@ JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
         int length = 0;
         if (isRowRange) {
             base = row;
-            length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
+            length = rowSpan;
         } else {
             base = column;
-            length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
+            length = columnSpan;
         }
         rangeString.reset(g_strdup_printf("{%d, %d}", base, length));
     }
@@ -557,6 +568,8 @@ void alterCurrentValue(PlatformUIElement element, int factor)
     g_value_unset(&currentValue);
 }
 
+} // namespace
+
 AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
     : m_element(element)
 {
index f73597c..8fa2b63 100644 (file)
@@ -206,7 +206,10 @@ bool checkElementState(PlatformUIElement element, AtkStateType stateType)
 JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
 {
     GUniquePtr<gchar> rangeString(g_strdup("{0, 0}"));
-
+#if ATK_CHECK_VERSION(2,11,90)
+    if (!ATK_IS_TABLE_CELL(element.get()))
+        return JSStringCreateWithUTF8CString(rangeString.get());
+#else
     if (!ATK_IS_OBJECT(element.get()))
         return JSStringCreateWithUTF8CString(rangeString.get());
 
@@ -218,11 +221,20 @@ JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
     gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element.get()));
     if (indexInParent == -1)
         return JSStringCreateWithUTF8CString(rangeString.get());
+#endif
 
-    int row = -1;
-    int column = -1;
+    gint row = -1;
+    gint column = -1;
+    gint rowSpan = -1;
+    gint columnSpan = -1;
+#if ATK_CHECK_VERSION(2,11,90)
+    atk_table_cell_get_row_column_span(ATK_TABLE_CELL(element.get()), &row, &column, &rowSpan, &columnSpan);
+#else
     row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent);
     column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent);
+    rowSpan = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
+    columnSpan = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
+#endif
 
     // Get the actual values, if row and columns are valid values.
     if (row != -1 && column != -1) {
@@ -230,10 +242,10 @@ JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
         int length = 0;
         if (isRowRange) {
             base = row;
-            length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
+            length = rowSpan;
         } else {
             base = column;
-            length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
+            length = columnSpan;
         }
         rangeString.reset(g_strdup_printf("{%d, %d}", base, length));
     }