Changeset 158742 in webkit


Ignore:
Timestamp:
Nov 6, 2013 5:55:36 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

[ATK] Implement tables-related attributesOf*() functions for AccessibilityUIElement
https://bugs.webkit.org/show_bug.cgi?id=118969

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-11-06
Reviewed by Mario Sanchez Prada.

Added missing implementation of attributesOfColumnHeaders, attributesOfRowHeaders, attributesOfVisibleCells.

  • DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:

(AccessibilityUIElement::attributesOfChildren):
(AccessibilityUIElement::attributesOfColumnHeaders):
(AccessibilityUIElement::attributesOfRowHeaders):
(AccessibilityUIElement::attributesOfVisibleCells):

  • WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:

(WTR::AccessibilityUIElement::attributesOfChildren):
(WTR::AccessibilityUIElement::attributesOfColumnHeaders):
(WTR::AccessibilityUIElement::attributesOfRowHeaders):
(WTR::AccessibilityUIElement::attributesOfVisibleCells):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r158689 r158742  
     12013-11-06  Krzysztof Czech  <k.czech@samsung.com>
     2
     3        [ATK] Implement tables-related attributesOf*() functions for AccessibilityUIElement
     4        https://bugs.webkit.org/show_bug.cgi?id=118969
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        Added missing implementation of attributesOfColumnHeaders, attributesOfRowHeaders, attributesOfVisibleCells.
     9
     10        * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
     11        (AccessibilityUIElement::attributesOfChildren):
     12        (AccessibilityUIElement::attributesOfColumnHeaders):
     13        (AccessibilityUIElement::attributesOfRowHeaders):
     14        (AccessibilityUIElement::attributesOfVisibleCells):
     15        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
     16        (WTR::AccessibilityUIElement::attributesOfChildren):
     17        (WTR::AccessibilityUIElement::attributesOfColumnHeaders):
     18        (WTR::AccessibilityUIElement::attributesOfRowHeaders):
     19        (WTR::AccessibilityUIElement::attributesOfVisibleCells):
     20
    1212013-11-05  Benjamin Poulain  <benjamin@webkit.org>
    222
  • trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp

    r158664 r158742  
    368368}
    369369
     370static JSStringRef createStringWithAttributes(const Vector<AccessibilityUIElement>& elements)
     371{
     372    StringBuilder builder;
     373
     374    for (Vector<AccessibilityUIElement>::const_iterator it = elements.begin(); it != elements.end(); ++it) {
     375        builder.append(attributesOfElement(const_cast<AccessibilityUIElement*>(it)));
     376        builder.append("\n------------\n");
     377    }
     378
     379    return JSStringCreateWithUTF8CString(builder.toString().utf8().data());
     380}
     381
     382static Vector<AccessibilityUIElement> getRowHeaders(AtkTable* accessible)
     383{
     384    Vector<AccessibilityUIElement> rowHeaders;
     385
     386    int rowsCount = atk_table_get_n_rows(accessible);
     387    for (int row = 0; row < rowsCount; ++row)
     388        rowHeaders.append(AccessibilityUIElement(atk_table_get_row_header(accessible, row)));
     389
     390    return rowHeaders;
     391}
     392
     393static Vector<AccessibilityUIElement> getColumnHeaders(AtkTable* accessible)
     394{
     395    Vector<AccessibilityUIElement> columnHeaders;
     396
     397    int columnsCount = atk_table_get_n_columns(accessible);
     398    for (int column = 0; column < columnsCount; ++column)
     399        columnHeaders.append(AccessibilityUIElement(atk_table_get_column_header(accessible, column)));
     400
     401    return columnHeaders;
     402}
     403
     404static Vector<AccessibilityUIElement> getVisibleCells(AccessibilityUIElement* element)
     405{
     406    Vector<AccessibilityUIElement> visibleCells;
     407
     408    AtkTable* accessible = ATK_TABLE(element->platformUIElement());
     409    int rowsCount = atk_table_get_n_rows(accessible);
     410    int columnsCount = atk_table_get_n_columns(accessible);
     411
     412    for (int row = 0; row < rowsCount; ++row) {
     413        for (int column = 0; column < columnsCount; ++column)
     414            visibleCells.append(element->cellForColumnAndRow(column, row));
     415    }
     416
     417    return visibleCells;
     418}
     419
    370420} // namespace
    371421
     
    603653    getChildren(children);
    604654
    605     StringBuilder builder;
    606     for (Vector<AccessibilityUIElement>::iterator it = children.begin(); it != children.end(); ++it) {
    607         builder.append(attributesOfElement(it));
    608         builder.append("\n------------\n");
    609     }
    610 
    611     return JSStringCreateWithUTF8CString(builder.toString().utf8().data());
     655    return createStringWithAttributes(children);
    612656}
    613657
     
    938982JSStringRef AccessibilityUIElement::attributesOfColumnHeaders()
    939983{
     984    if (!ATK_IS_TABLE(m_element))
     985        return JSStringCreateWithCharacters(0, 0);
     986
     987    Vector<AccessibilityUIElement> columnHeaders = getColumnHeaders(ATK_TABLE(m_element));
     988    return createStringWithAttributes(columnHeaders);
     989}
     990
     991JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
     992{
     993    if (!ATK_IS_TABLE(m_element))
     994        return JSStringCreateWithCharacters(0, 0);
     995
     996    Vector<AccessibilityUIElement> rowHeaders = getRowHeaders(ATK_TABLE(m_element));
     997    return createStringWithAttributes(rowHeaders);
     998}
     999
     1000JSStringRef AccessibilityUIElement::attributesOfColumns()
     1001{
    9401002    // FIXME: implement
    9411003    return JSStringCreateWithCharacters(0, 0);
    9421004}
    9431005
    944 JSStringRef AccessibilityUIElement::attributesOfRowHeaders()
     1006JSStringRef AccessibilityUIElement::attributesOfRows()
    9451007{
    9461008    // FIXME: implement
     
    9481010}
    9491011
    950 JSStringRef AccessibilityUIElement::attributesOfColumns()
    951 {
    952     // FIXME: implement
    953     return JSStringCreateWithCharacters(0, 0);
    954 }
    955 
    956 JSStringRef AccessibilityUIElement::attributesOfRows()
    957 {
    958     // FIXME: implement
    959     return JSStringCreateWithCharacters(0, 0);
    960 }
    961 
    9621012JSStringRef AccessibilityUIElement::attributesOfVisibleCells()
    9631013{
    964     // FIXME: implement
    965     return JSStringCreateWithCharacters(0, 0);
     1014    if (!ATK_IS_TABLE(m_element))
     1015        return JSStringCreateWithCharacters(0, 0);
     1016
     1017    Vector<AccessibilityUIElement> visibleCells = getVisibleCells(this);
     1018    return createStringWithAttributes(visibleCells);
    9661019}
    9671020
  • trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

    r158674 r158742  
    433433}
    434434
     435static JSRetainPtr<JSStringRef> createStringWithAttributes(const Vector<RefPtr<AccessibilityUIElement> >& elements)
     436{
     437    StringBuilder builder;
     438
     439    for (Vector<RefPtr<AccessibilityUIElement> >::const_iterator it = elements.begin(); it != elements.end(); ++it) {
     440        builder.append(attributesOfElement(const_cast<AccessibilityUIElement*>(it->get())));
     441        builder.append("\n------------\n");
     442    }
     443
     444    return JSStringCreateWithUTF8CString(builder.toString().utf8().data());
     445}
     446
     447static Vector<RefPtr<AccessibilityUIElement> > getRowHeaders(AtkTable* accessible)
     448{
     449    Vector<RefPtr<AccessibilityUIElement> > rowHeaders;
     450
     451    int rowsCount = atk_table_get_n_rows(accessible);
     452    for (int row = 0; row < rowsCount; ++row)
     453        rowHeaders.append(AccessibilityUIElement::create(atk_table_get_row_header(accessible, row)));
     454
     455    return rowHeaders;
     456}
     457
     458static Vector<RefPtr<AccessibilityUIElement> > getColumnHeaders(AtkTable* accessible)
     459{
     460    Vector<RefPtr<AccessibilityUIElement> > columnHeaders;
     461
     462    int columnsCount = atk_table_get_n_columns(accessible);
     463    for (int column = 0; column < columnsCount; ++column)
     464        columnHeaders.append(AccessibilityUIElement::create(atk_table_get_column_header(accessible, column)));
     465
     466    return columnHeaders;
     467}
     468
     469static Vector<RefPtr<AccessibilityUIElement> > getVisibleCells(AccessibilityUIElement* element)
     470{
     471    Vector<RefPtr<AccessibilityUIElement> > visibleCells;
     472
     473    AtkTable* accessible = ATK_TABLE(element->platformUIElement().get());
     474    int rowsCount = atk_table_get_n_rows(accessible);
     475    int columnsCount = atk_table_get_n_columns(accessible);
     476
     477    for (int row = 0; row < rowsCount; ++row) {
     478        for (int column = 0; column < columnsCount; ++column)
     479            visibleCells.append(element->cellForColumnAndRow(column, row));
     480    }
     481
     482    return visibleCells;
     483}
     484
    435485} // namespace
    436486
     
    632682    getChildren(children);
    633683
    634     StringBuilder builder;
    635     for (Vector<RefPtr<AccessibilityUIElement> >::iterator it = children.begin(); it != children.end(); ++it) {
    636         builder.append(attributesOfElement(it->get()));
    637         builder.append("\n------------\n");
    638     }
    639 
    640     return JSStringCreateWithUTF8CString(builder.toString().utf8().data());
     684    return createStringWithAttributes(children);
    641685}
    642686
     
    10971141JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfColumnHeaders()
    10981142{
    1099     // FIXME: implement
    1100     return JSStringCreateWithCharacters(0, 0);
     1143    if (!ATK_IS_TABLE(m_element.get()))
     1144        return JSStringCreateWithCharacters(0, 0);
     1145
     1146    Vector<RefPtr<AccessibilityUIElement> > columnHeaders = getColumnHeaders(ATK_TABLE(m_element.get()));
     1147    return createStringWithAttributes(columnHeaders);
    11011148}
    11021149
    11031150JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfRowHeaders()
    11041151{
    1105     // FIXME: implement
    1106     return JSStringCreateWithCharacters(0, 0);
     1152    if (!ATK_IS_TABLE(m_element.get()))
     1153        return JSStringCreateWithCharacters(0, 0);
     1154
     1155    Vector<RefPtr<AccessibilityUIElement> > rowHeaders = getRowHeaders(ATK_TABLE(m_element.get()));
     1156    return createStringWithAttributes(rowHeaders);
    11071157}
    11081158
     
    11211171JSRetainPtr<JSStringRef> AccessibilityUIElement::attributesOfVisibleCells()
    11221172{
    1123     // FIXME: implement
    1124     return JSStringCreateWithCharacters(0, 0);
     1173    if (!ATK_IS_TABLE(m_element.get()))
     1174        return JSStringCreateWithCharacters(0, 0);
     1175
     1176    Vector<RefPtr<AccessibilityUIElement> > visibleCells = getVisibleCells(this);
     1177    return createStringWithAttributes(visibleCells);
    11251178}
    11261179
Note: See TracChangeset for help on using the changeset viewer.