summaryrefslogtreecommitdiffstats
path: root/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp')
-rw-r--r--Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp76
1 files changed, 64 insertions, 12 deletions
diff --git a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
index ff76e4b..8a4a490 100644
--- a/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
+++ b/Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
@@ -26,15 +26,14 @@
#include "config.h"
#include "AccessibilityUIElement.h"
+
#include "GOwnPtr.h"
#include "GRefPtr.h"
-
+#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
#include <JavaScriptCore/JSStringRef.h>
-#include <wtf/Assertions.h>
-
#include <atk/atk.h>
#include <gtk/gtk.h>
-
+#include <wtf/Assertions.h>
AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
: m_element(element)
@@ -488,16 +487,56 @@ int AccessibilityUIElement::indexInTable()
return 0;
}
+static JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
+{
+ GOwnPtr<gchar> rangeString(g_strdup("{0, 0}"));
+
+ if (!element)
+ return JSStringCreateWithUTF8CString(rangeString.get());
+
+ ASSERT(ATK_IS_OBJECT(element));
+
+ AtkObject* axTable = atk_object_get_parent(ATK_OBJECT(element));
+ if (!axTable || !ATK_IS_TABLE(axTable))
+ return JSStringCreateWithUTF8CString(rangeString.get());
+
+ // Look for the cell in the table.
+ gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element));
+ if (indexInParent == -1)
+ return JSStringCreateWithUTF8CString(rangeString.get());
+
+ int row = -1;
+ int column = -1;
+ row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent);
+ column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent);
+
+ // Get the actual values, if row and columns are valid values.
+ if (row != -1 && column != -1) {
+ int base = 0;
+ int length = 0;
+ if (isRowRange) {
+ base = row;
+ length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
+ } else {
+ base = column;
+ length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
+ }
+ rangeString.set(g_strdup_printf("{%d, %d}", base, length));
+ }
+
+ return JSStringCreateWithUTF8CString(rangeString.get());
+}
+
JSStringRef AccessibilityUIElement::rowIndexRange()
{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
+ // Range in table for rows.
+ return indexRangeInTable(m_element, true);
}
JSStringRef AccessibilityUIElement::columnIndexRange()
{
- // FIXME: implement
- return JSStringCreateWithCharacters(0, 0);
+ // Range in table for columns.
+ return indexRangeInTable(m_element, false);
}
int AccessibilityUIElement::lineForIndex(int)
@@ -532,8 +571,13 @@ bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location
AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
{
- // FIXME: implement
- return 0;
+ if (!m_element)
+ return 0;
+
+ ASSERT(ATK_IS_TABLE(m_element));
+
+ AtkObject* foundCell = atk_table_ref_at(ATK_TABLE(m_element), row, column);
+ return foundCell ? AccessibilityUIElement(foundCell) : 0;
}
JSStringRef AccessibilityUIElement::selectedTextRange()
@@ -572,12 +616,20 @@ bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
void AccessibilityUIElement::increment()
{
- // FIXME: implement
+ if (!m_element)
+ return;
+
+ ASSERT(ATK_IS_OBJECT(m_element));
+ DumpRenderTreeSupportGtk::incrementAccessibilityValue(ATK_OBJECT(m_element));
}
void AccessibilityUIElement::decrement()
{
- // FIXME: implement
+ if (!m_element)
+ return;
+
+ ASSERT(ATK_IS_OBJECT(m_element));
+ DumpRenderTreeSupportGtk::decrementAccessibilityValue(ATK_OBJECT(m_element));
}
void AccessibilityUIElement::press()