[Gtk] Several tests launch g_object_ref/unref assertion messages
[WebKit-https.git] / Tools / DumpRenderTree / gtk / AccessibilityUIElementGtk.cpp
1 /*
2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3  * Copyright (C) 2009 Jan Michael Alonzo
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
18  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
25  */
26
27 #include "config.h"
28 #include "AccessibilityUIElement.h"
29
30 #include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
31 #include <JavaScriptCore/JSStringRef.h>
32 #include <atk/atk.h>
33 #include <gtk/gtk.h>
34 #include <wtf/Assertions.h>
35 #include <wtf/gobject/GOwnPtr.h>
36 #include <wtf/gobject/GRefPtr.h>
37 #include <wtf/text/WTFString.h>
38 #include <wtf/unicode/CharacterNames.h>
39
40 static inline gchar* replaceCharactersForResults(gchar* str)
41 {
42     String uString = String::fromUTF8(str);
43
44     // The object replacement character is passed along to ATs so we need to be
45     // able to test for their presence and do so without causing test failures.
46     uString.replace(objectReplacementCharacter, "<obj>");
47
48     // The presence of newline characters in accessible text of a single object
49     // is appropriate, but it makes test results (especially the accessible tree)
50     // harder to read.
51     uString.replace("\n", "<\\n>");
52
53     return g_strdup(uString.utf8().data());
54 }
55
56 AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
57     : m_element(element)
58 {
59     if (m_element)
60         g_object_ref(m_element);
61 }
62
63 AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other)
64     : m_element(other.m_element)
65 {
66     if (m_element)
67         g_object_ref(m_element);
68 }
69
70 AccessibilityUIElement::~AccessibilityUIElement()
71 {
72     if (m_element)
73         g_object_unref(m_element);
74 }
75
76 void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elements)
77 {
78     // FIXME: implement
79 }
80
81 void AccessibilityUIElement::getDocumentLinks(Vector<AccessibilityUIElement>&)
82 {
83     // FIXME: implement
84 }
85
86 void AccessibilityUIElement::getChildren(Vector<AccessibilityUIElement>& children)
87 {
88     int count = childrenCount();
89     for (int i = 0; i < count; i++) {
90         AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
91         children.append(AccessibilityUIElement(child));
92     }
93 }
94
95 void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>& elementVector, unsigned start, unsigned end)
96 {
97     for (unsigned i = start; i < end; i++) {
98         AtkObject* child = atk_object_ref_accessible_child(ATK_OBJECT(m_element), i);
99         elementVector.append(AccessibilityUIElement(child));
100     }
101 }
102
103 int AccessibilityUIElement::rowCount()
104 {
105     if (!m_element)
106         return 0;
107
108     ASSERT(ATK_IS_TABLE(m_element));
109
110     return atk_table_get_n_rows(ATK_TABLE(m_element));
111 }
112
113 int AccessibilityUIElement::columnCount()
114 {
115     if (!m_element)
116         return 0;
117
118     ASSERT(ATK_IS_TABLE(m_element));
119
120     return atk_table_get_n_columns(ATK_TABLE(m_element));
121 }
122
123 int AccessibilityUIElement::childrenCount()
124 {
125     if (!m_element)
126         return 0;
127
128     ASSERT(ATK_IS_OBJECT(m_element));
129
130     return atk_object_get_n_accessible_children(ATK_OBJECT(m_element));
131 }
132
133 AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y)
134 {
135     // FIXME: implement
136     return 0;
137 }
138
139 AccessibilityUIElement AccessibilityUIElement::linkedUIElementAtIndex(unsigned index)
140 {
141     // FIXME: implement
142     return 0;
143 }
144
145 AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index)
146 {
147     Vector<AccessibilityUIElement> children;
148     getChildrenWithRange(children, index, index + 1);
149
150     if (children.size() == 1)
151         return children.at(0);
152
153     return 0;
154 }
155
156 unsigned AccessibilityUIElement::indexOfChild(AccessibilityUIElement* element)
157
158     // FIXME: implement
159     return 0;
160 }
161
162 gchar* attributeSetToString(AtkAttributeSet* attributeSet)
163 {
164     GString* str = g_string_new(0);
165     for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
166         AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
167         GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL));
168         g_string_append(str, attributeData.get());
169         if (attributes->next)
170             g_string_append(str, ", ");
171     }
172
173     return g_string_free(str, FALSE);
174 }
175
176 JSStringRef AccessibilityUIElement::allAttributes()
177 {
178     if (!m_element)
179         return JSStringCreateWithCharacters(0, 0);
180
181     ASSERT(ATK_IS_OBJECT(m_element));
182     GOwnPtr<gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element))));
183     return JSStringCreateWithUTF8CString(attributeData.get());
184 }
185
186 JSStringRef AccessibilityUIElement::attributesOfLinkedUIElements()
187 {
188     // FIXME: implement
189     return JSStringCreateWithCharacters(0, 0);
190 }
191
192 JSStringRef AccessibilityUIElement::attributesOfDocumentLinks()
193 {
194     // FIXME: implement
195     return JSStringCreateWithCharacters(0, 0);
196 }
197
198 AccessibilityUIElement AccessibilityUIElement::titleUIElement()
199 {
200
201     if (!m_element)
202         return 0;
203
204     AtkRelationSet* set = atk_object_ref_relation_set(ATK_OBJECT(m_element));
205     if (!set)
206         return 0;
207
208     AtkObject* target = 0;
209     int count = atk_relation_set_get_n_relations(set);
210     for (int i = 0; i < count; i++) {
211         AtkRelation* relation = atk_relation_set_get_relation(set, i);
212         if (atk_relation_get_relation_type(relation) == ATK_RELATION_LABELLED_BY) {
213             GPtrArray* targetList = atk_relation_get_target(relation);
214             if (targetList->len)
215                 target = static_cast<AtkObject*>(g_ptr_array_index(targetList, 0));
216         }
217         g_object_unref(set);
218     }
219
220     return target ? AccessibilityUIElement(target) : 0;
221 }
222
223 AccessibilityUIElement AccessibilityUIElement::parentElement()
224 {
225     if (!m_element)
226         return 0;
227
228     ASSERT(ATK_IS_OBJECT(m_element));
229
230     AtkObject* parent =  atk_object_get_parent(ATK_OBJECT(m_element));
231     return parent ? AccessibilityUIElement(parent) : 0;
232 }
233
234 JSStringRef AccessibilityUIElement::attributesOfChildren()
235 {
236     // FIXME: implement
237     return JSStringCreateWithCharacters(0, 0);
238 }
239
240 JSStringRef AccessibilityUIElement::parameterizedAttributeNames()
241 {
242     // FIXME: implement
243     return JSStringCreateWithCharacters(0, 0);
244 }
245
246 JSStringRef AccessibilityUIElement::role()
247 {
248     AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
249
250     if (!role)
251         return JSStringCreateWithCharacters(0, 0);
252
253     const gchar* roleName = atk_role_get_name(role);
254     GOwnPtr<gchar> axRole(g_strdup_printf("AXRole: %s", roleName));
255
256     return JSStringCreateWithUTF8CString(axRole.get());
257 }
258
259 JSStringRef AccessibilityUIElement::subrole()
260 {
261     return 0;
262 }
263
264 JSStringRef AccessibilityUIElement::roleDescription()
265 {
266     return 0;
267 }
268
269 JSStringRef AccessibilityUIElement::title()
270 {
271     const gchar* name = atk_object_get_name(ATK_OBJECT(m_element));
272
273     if (!name)
274         return JSStringCreateWithCharacters(0, 0);
275
276     GOwnPtr<gchar> axTitle(g_strdup_printf("AXTitle: %s", name));
277
278     return JSStringCreateWithUTF8CString(axTitle.get());
279 }
280
281 JSStringRef AccessibilityUIElement::description()
282 {
283     const gchar* description = atk_object_get_description(ATK_OBJECT(m_element));
284
285     if (!description)
286         return JSStringCreateWithCharacters(0, 0);
287
288     GOwnPtr<gchar> axDesc(g_strdup_printf("AXDescription: %s", description));
289
290     return JSStringCreateWithUTF8CString(axDesc.get());
291 }
292
293 JSStringRef AccessibilityUIElement::stringValue()
294 {
295     if (!m_element || !ATK_IS_TEXT(m_element))
296         return JSStringCreateWithCharacters(0, 0);
297
298     gchar* text = atk_text_get_text(ATK_TEXT(m_element), 0, -1);
299     GOwnPtr<gchar> axValue(g_strdup_printf("AXValue: %s", replaceCharactersForResults(text)));
300     g_free(text);
301
302     return JSStringCreateWithUTF8CString(axValue.get());
303 }
304
305 JSStringRef AccessibilityUIElement::language()
306 {
307     // FIXME: implement
308     return JSStringCreateWithCharacters(0, 0);
309 }
310
311 JSStringRef AccessibilityUIElement::helpText() const
312 {
313     if (!m_element)
314         return JSStringCreateWithCharacters(0, 0);
315
316     ASSERT(ATK_IS_OBJECT(m_element));
317
318     CString helpText = DumpRenderTreeSupportGtk::accessibilityHelpText(ATK_OBJECT(m_element));
319     GOwnPtr<gchar> axHelpText(g_strdup_printf("AXHelp: %s", helpText.data()));
320     return JSStringCreateWithUTF8CString(axHelpText.get());
321 }
322
323 double AccessibilityUIElement::x()
324 {
325     int x, y;
326
327     atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
328
329     return x;
330 }
331
332 double AccessibilityUIElement::y()
333 {
334     int x, y;
335
336     atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);
337
338     return y;
339 }
340
341 double AccessibilityUIElement::width()
342 {
343     int width, height;
344
345     atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
346
347     return width;
348 }
349
350 double AccessibilityUIElement::height()
351 {
352     int width, height;
353
354     atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);
355
356     return height;
357 }
358
359 double AccessibilityUIElement::clickPointX()
360 {
361     return 0.f;
362 }
363
364 double AccessibilityUIElement::clickPointY()
365 {
366     return 0.f;
367 }
368
369 JSStringRef AccessibilityUIElement::orientation() const
370 {
371     return 0;
372 }
373
374 double AccessibilityUIElement::intValue() const
375 {
376     GValue value = { 0, { { 0 } } };
377
378     if (!ATK_IS_VALUE(m_element))
379         return 0.0f;
380
381     atk_value_get_current_value(ATK_VALUE(m_element), &value);
382     if (!G_VALUE_HOLDS_FLOAT(&value))
383         return 0.0f;
384     return g_value_get_float(&value);
385 }
386
387 double AccessibilityUIElement::minValue()
388 {
389     GValue value = { 0, { { 0 } } };
390
391     if (!ATK_IS_VALUE(m_element))
392         return 0.0f;
393
394     atk_value_get_minimum_value(ATK_VALUE(m_element), &value);
395     if (!G_VALUE_HOLDS_FLOAT(&value))
396         return 0.0f;
397     return g_value_get_float(&value);
398 }
399
400 double AccessibilityUIElement::maxValue()
401 {
402     GValue value = { 0, { { 0 } } };
403
404     if (!ATK_IS_VALUE(m_element))
405         return 0.0f;
406
407     atk_value_get_maximum_value(ATK_VALUE(m_element), &value);
408     if (!G_VALUE_HOLDS_FLOAT(&value))
409         return 0.0f;
410     return g_value_get_float(&value);
411 }
412
413 JSStringRef AccessibilityUIElement::valueDescription()
414 {
415     // FIXME: implement after it has been implemented in ATK.
416     // See: https://bugzilla.gnome.org/show_bug.cgi?id=684576
417     return JSStringCreateWithCharacters(0, 0);
418 }
419
420 static bool checkElementState(PlatformUIElement element, AtkStateType stateType)
421 {
422     if (!ATK_IS_OBJECT(element))
423          return false;
424
425     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(element)));
426     return atk_state_set_contains_state(stateSet.get(), stateType);
427 }
428
429 bool AccessibilityUIElement::isEnabled()
430 {
431     return checkElementState(m_element, ATK_STATE_ENABLED);
432 }
433
434 int AccessibilityUIElement::insertionPointLineNumber()
435 {
436     // FIXME: implement
437     return 0;
438 }
439
440 bool AccessibilityUIElement::isActionSupported(JSStringRef action)
441 {
442     // FIXME: implement
443     return false;
444 }
445
446 bool AccessibilityUIElement::isRequired() const
447 {
448     // FIXME: implement
449     return false;
450 }
451
452 bool AccessibilityUIElement::isFocused() const
453 {
454     if (!ATK_IS_OBJECT(m_element))
455         return false;
456
457     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
458     gboolean isFocused = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSED);
459
460     return isFocused;
461 }
462
463 bool AccessibilityUIElement::isSelected() const
464 {
465     return checkElementState(m_element, ATK_STATE_SELECTED);
466 }
467
468 int AccessibilityUIElement::hierarchicalLevel() const
469 {
470     // FIXME: implement
471     return 0;
472 }
473
474 bool AccessibilityUIElement::ariaIsGrabbed() const
475 {
476     return false;
477 }
478  
479 JSStringRef AccessibilityUIElement::ariaDropEffects() const
480 {   
481     return 0; 
482 }
483
484 bool AccessibilityUIElement::isExpanded() const
485 {
486     if (!ATK_IS_OBJECT(m_element))
487         return false;
488
489     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
490     gboolean isExpanded = atk_state_set_contains_state(stateSet.get(), ATK_STATE_EXPANDED);
491
492     return isExpanded;
493 }
494
495 bool AccessibilityUIElement::isChecked() const
496 {
497     if (!ATK_IS_OBJECT(m_element))
498         return false;
499
500     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
501     gboolean isChecked = atk_state_set_contains_state(stateSet.get(), ATK_STATE_CHECKED);
502
503     return isChecked;
504 }
505
506 JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
507 {
508     // FIXME: implement
509     return JSStringCreateWithCharacters(0, 0);
510 }
511
512 JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
513 {
514     // FIXME: implement
515     return JSStringCreateWithCharacters(0, 0);
516 }
517
518 JSStringRef AccessibilityUIElement::attributesOfColumns()
519 {
520     // FIXME: implement
521     return JSStringCreateWithCharacters(0, 0);
522 }
523
524 JSStringRef AccessibilityUIElement::attributesOfRows()
525 {
526     // FIXME: implement
527     return JSStringCreateWithCharacters(0, 0);
528 }
529
530 JSStringRef AccessibilityUIElement::attributesOfVisibleCells()
531 {
532     // FIXME: implement
533     return JSStringCreateWithCharacters(0, 0);
534 }
535
536 JSStringRef AccessibilityUIElement::attributesOfHeader()
537 {
538     // FIXME: implement
539     return JSStringCreateWithCharacters(0, 0);
540 }
541
542 int AccessibilityUIElement::indexInTable()
543 {
544     // FIXME: implement
545     return 0;
546 }
547
548 static JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
549 {
550     GOwnPtr<gchar> rangeString(g_strdup("{0, 0}"));
551
552     if (!element)
553         return JSStringCreateWithUTF8CString(rangeString.get());
554
555     ASSERT(ATK_IS_OBJECT(element));
556
557     AtkObject* axTable = atk_object_get_parent(ATK_OBJECT(element));
558     if (!axTable || !ATK_IS_TABLE(axTable))
559         return JSStringCreateWithUTF8CString(rangeString.get());
560
561     // Look for the cell in the table.
562     gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element));
563     if (indexInParent == -1)
564         return JSStringCreateWithUTF8CString(rangeString.get());
565
566     int row = -1;
567     int column = -1;
568     row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent);
569     column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent);
570
571     // Get the actual values, if row and columns are valid values.
572     if (row != -1 && column != -1) {
573         int base = 0;
574         int length = 0;
575         if (isRowRange) {
576             base = row;
577             length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
578         } else {
579             base = column;
580             length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
581         }
582         rangeString.set(g_strdup_printf("{%d, %d}", base, length));
583     }
584
585     return JSStringCreateWithUTF8CString(rangeString.get());
586 }
587
588 JSStringRef AccessibilityUIElement::rowIndexRange()
589 {
590     // Range in table for rows.
591     return indexRangeInTable(m_element, true);
592 }
593
594 JSStringRef AccessibilityUIElement::columnIndexRange()
595 {
596     // Range in table for columns.
597     return indexRangeInTable(m_element, false);
598 }
599
600 int AccessibilityUIElement::lineForIndex(int)
601 {
602     // FIXME: implement
603     return 0;
604 }
605
606 JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length)
607 {
608     // FIXME: implement
609     return JSStringCreateWithCharacters(0, 0);
610 }
611
612 JSStringRef AccessibilityUIElement::stringForRange(unsigned, unsigned) 
613 {
614     // FIXME: implement
615     return JSStringCreateWithCharacters(0, 0);
616
617
618 JSStringRef AccessibilityUIElement::attributedStringForRange(unsigned, unsigned)
619 {
620     // FIXME: implement
621     return JSStringCreateWithCharacters(0, 0);
622 }
623
624 bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length)
625 {
626     // FIXME: implement
627     return false;
628 }
629
630 AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(AccessibilityUIElement* startElement, bool isDirectionNext, JSStringRef searchKey, JSStringRef searchText)
631 {
632     // FIXME: implement
633     return 0;
634 }
635
636 AccessibilityUIElement AccessibilityUIElement::cellForColumnAndRow(unsigned column, unsigned row)
637 {
638     if (!m_element)
639         return 0;
640
641     ASSERT(ATK_IS_TABLE(m_element));
642
643     AtkObject* foundCell = atk_table_ref_at(ATK_TABLE(m_element), row, column);
644     return foundCell ? AccessibilityUIElement(foundCell) : 0;
645 }
646
647 JSStringRef AccessibilityUIElement::selectedTextRange()
648 {
649     // FIXME: implement
650     return JSStringCreateWithCharacters(0, 0);
651 }
652
653 void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length)
654 {
655     // FIXME: implement
656 }
657
658 JSStringRef AccessibilityUIElement::stringAttributeValue(JSStringRef attribute)
659 {
660     // FIXME: implement
661     return JSStringCreateWithCharacters(0, 0);
662 }
663
664 double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
665 {
666     // FIXME: implement
667     return 0.0f;
668 }
669
670 bool AccessibilityUIElement::boolAttributeValue(JSStringRef attribute)
671 {
672     // FIXME: implement
673     return false;
674 }
675
676 bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
677 {
678     // FIXME: implement
679     return false;
680 }
681
682 bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute)
683 {
684     return false;
685 }
686
687 static void alterCurrentValue(PlatformUIElement element, int factor)
688 {
689     if (!element)
690         return;
691
692     ASSERT(ATK_IS_VALUE(element));
693
694     GValue currentValue = G_VALUE_INIT;
695     atk_value_get_current_value(ATK_VALUE(element), &currentValue);
696
697     GValue increment = G_VALUE_INIT;
698     atk_value_get_minimum_increment(ATK_VALUE(element), &increment);
699
700     GValue newValue = G_VALUE_INIT;
701     g_value_init(&newValue, G_TYPE_FLOAT);
702
703     g_value_set_float(&newValue, g_value_get_float(&currentValue) + factor * g_value_get_float(&increment));
704     atk_value_set_current_value(ATK_VALUE(element), &newValue);
705
706     g_value_unset(&newValue);
707     g_value_unset(&increment);
708     g_value_unset(&currentValue);
709 }
710
711 void AccessibilityUIElement::increment()
712 {
713     alterCurrentValue(m_element, 1);
714 }
715
716 void AccessibilityUIElement::decrement()
717 {
718     alterCurrentValue(m_element, -1);
719 }
720
721 void AccessibilityUIElement::press()
722 {
723     if (!m_element)
724         return;
725
726     ASSERT(ATK_IS_OBJECT(m_element));
727
728     if (!ATK_IS_ACTION(m_element))
729         return;
730
731     // Only one action per object is supported so far.
732     atk_action_do_action(ATK_ACTION(m_element), 0);
733 }
734
735 void AccessibilityUIElement::showMenu()
736 {
737     // FIXME: implement
738 }
739
740 AccessibilityUIElement AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
741 {
742     return 0;
743 }
744
745 AccessibilityUIElement AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
746 {
747     return 0;
748 }
749
750 AccessibilityUIElement AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
751 {
752     return 0;
753 }
754
755 AccessibilityUIElement AccessibilityUIElement::selectedRowAtIndex(unsigned index)
756 {
757     return 0;
758 }
759
760 AccessibilityUIElement AccessibilityUIElement::rowAtIndex(unsigned index)
761 {
762     return 0;
763 }
764
765 AccessibilityUIElement AccessibilityUIElement::disclosedByRow()
766 {
767     return 0;
768 }
769
770 JSStringRef AccessibilityUIElement::accessibilityValue() const
771 {
772     // FIXME: implement
773     return JSStringCreateWithCharacters(0, 0);
774 }
775
776 JSStringRef AccessibilityUIElement::documentEncoding()
777 {
778     AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
779     if (role != ATK_ROLE_DOCUMENT_FRAME)
780         return JSStringCreateWithCharacters(0, 0);
781
782     return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "Encoding"));
783 }
784
785 JSStringRef AccessibilityUIElement::documentURI()
786 {
787     AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
788     if (role != ATK_ROLE_DOCUMENT_FRAME)
789         return JSStringCreateWithCharacters(0, 0);
790
791     return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "URI"));
792 }
793
794 JSStringRef AccessibilityUIElement::url()
795 {
796     // FIXME: implement
797     return JSStringCreateWithCharacters(0, 0);
798 }
799
800 bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback)
801 {
802     // FIXME: implement
803     return false;
804 }
805
806 void AccessibilityUIElement::removeNotificationListener()
807 {
808     // FIXME: implement
809 }
810
811 bool AccessibilityUIElement::isFocusable() const
812 {
813     if (!ATK_IS_OBJECT(m_element))
814         return false;
815
816     GRefPtr<AtkStateSet> stateSet = adoptGRef(atk_object_ref_state_set(ATK_OBJECT(m_element)));
817     gboolean isFocusable = atk_state_set_contains_state(stateSet.get(), ATK_STATE_FOCUSABLE);
818
819     return isFocusable;
820 }
821
822 bool AccessibilityUIElement::isSelectable() const
823 {
824     // FIXME: implement
825     return false;
826 }
827
828 bool AccessibilityUIElement::isMultiSelectable() const
829 {
830     // FIXME: implement
831     return false;
832 }
833
834 bool AccessibilityUIElement::isSelectedOptionActive() const
835 {
836     // FIXME: implement
837     return false;
838 }
839
840 bool AccessibilityUIElement::isVisible() const
841 {
842     // FIXME: implement
843     return false;
844 }
845
846 bool AccessibilityUIElement::isOffScreen() const
847 {
848     // FIXME: implement
849     return false;
850 }
851
852 bool AccessibilityUIElement::isCollapsed() const
853 {
854     // FIXME: implement
855     return false;
856 }
857
858 bool AccessibilityUIElement::isIgnored() const
859 {
860     // FIXME: implement
861     return false;
862 }
863
864 bool AccessibilityUIElement::hasPopup() const
865 {
866     // FIXME: implement
867     return false;
868 }
869
870 void AccessibilityUIElement::takeFocus()
871 {
872     // FIXME: implement
873 }
874
875 void AccessibilityUIElement::takeSelection()
876 {
877     // FIXME: implement
878 }
879
880 void AccessibilityUIElement::addSelection()
881 {
882     // FIXME: implement
883 }
884
885 void AccessibilityUIElement::removeSelection()
886 {
887     // FIXME: implement
888 }
889
890 void AccessibilityUIElement::scrollToMakeVisible()
891 {
892     // FIXME: implement
893 }
894
895 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height)
896 {
897     // FIXME: implement
898 }
899
900 void AccessibilityUIElement::scrollToGlobalPoint(int x, int y)
901 {
902     // FIXME: implement
903 }