Bug 118969 - [ATK] Implement tables-related attributesOf*() functions for AccessibilityUIElement
Summary: [ATK] Implement tables-related attributesOf*() functions for AccessibilityUIE...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: LayoutTestFailure
Depends on:
Blocks: 98348
  Show dependency treegraph
 
Reported: 2013-07-22 07:07 PDT by Mario Sanchez Prada
Modified: 2013-11-06 05:53 PST (History)
3 users (show)

See Also:


Attachments
patch (9.33 KB, patch)
2013-11-05 04:42 PST, Krzysztof Czech
no flags Details | Formatted Diff | Diff
patch (9.34 KB, patch)
2013-11-05 04:50 PST, Krzysztof Czech
mario: review-
Details | Formatted Diff | Diff
patch (9.79 KB, patch)
2013-11-05 07:43 PST, Krzysztof Czech
no flags Details | Formatted Diff | Diff
patch (10.39 KB, patch)
2013-11-06 05:10 PST, Krzysztof Czech
no flags Details | Formatted Diff | Diff
patch (9.87 KB, patch)
2013-11-06 05:13 PST, Krzysztof Czech
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Sanchez Prada 2013-07-22 07:07:44 PDT
Implementing some table-related functions in AccessibilityUIElement would help to run properly the following tests, now in TestExpectations:

  accessibility/table-attributes.html
  accessibility/table-sections.html

The list of functions that should be implemented are:
  - attributesOfColumnHeaders()
  - attributesOfRowHeaders()
  - attributesOfColumns()
  - attributesOfRows()
  - attributesOfHeader()
  - attributesOfVisibleCell()

Additionally, it should help to to provide more accurate (and useful!) results for accessibility/aria-tables.html
Comment 1 Krzysztof Czech 2013-11-05 04:42:42 PST
Created attachment 216024 [details]
patch
Comment 2 WebKit Commit Bot 2013-11-05 04:43:54 PST
Attachment 216024 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp', u'Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp']" exit_code: 1
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:439:  Missing space before ( in for(  [whitespace/parens] [5]
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:449:  Missing space before ( in for(  [whitespace/parens] [5]
Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:455:  Missing space before ( in for(  [whitespace/parens] [5]
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:374:  Missing space before ( in for(  [whitespace/parens] [5]
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:384:  Missing space before ( in for(  [whitespace/parens] [5]
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:390:  Missing space before ( in for(  [whitespace/parens] [5]
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:398:  Missing space before ( in for(  [whitespace/parens] [5]
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:399:  Missing space before ( in for(  [whitespace/parens] [5]
Total errors found: 8 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Krzysztof Czech 2013-11-05 04:50:14 PST
Created attachment 216025 [details]
patch
Comment 4 Krzysztof Czech 2013-11-05 04:51:31 PST
I provided a proposed patch of missing implementation of table-related* functions. Generally it seems not every function could be implemented (example, attributesOfRows, attributesOfColumns, attributesOfHeader). Looks like columns, rows and header are not exposed in ATK so far.

So I guess we should provide new baselines for:
 accessibility/table-attributes.html
 accessibility/table-sections.html
Comment 5 Mario Sanchez Prada 2013-11-05 05:36:46 PST
Comment on attachment 216025 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=216025&action=review

(In reply to comment #4)
> I provided a proposed patch of missing implementation of table-related* functions. Generally it seems not every function could be implemented (example, attributesOfRows, attributesOfColumns, attributesOfHeader). Looks like columns, rows and header are not exposed in ATK so far.
> 
> So I guess we should provide new baselines for:
>  accessibility/table-attributes.html
>  accessibility/table-sections.html

I think that's right. Please consider my review below though. Thanks!

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:382
> +static void getRowHeaders(AtkObject* accessible, Vector<AccessibilityUIElement>& rowHeaders)

This function only works for AtkTable, so I think you can already expect that type as the first parameter and avoid the casts below. Just make sure you check and cast properly to AtkTable at the caller points

Also, I think this is one of those cases where you can use the "move semantics" feature of C++11, which is already supported by Vector through its move contructor Vector(Vector&&). See https://www.webkit.org/blog/3172/webkit-and-cxx11/

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:384
> +    for (int row = 0; row < atk_table_get_n_rows(ATK_TABLE(accessible)); ++row)

I think it's better to put the result of get_n_rows() in a variable and use it in the limit condition in the loop, to avoid too many calls to this function.

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:388
> +static void getColumnHeaders(AtkObject* accessible, Vector<AccessibilityUIElement>& columnHeaders)

Same considerations than before here (and in the rest of the patch)

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:400
> +    for (int row = 0; row < atk_table_get_n_rows(ATK_TABLE(accessibilityObject)); ++row)
> +        for (int column = 0; column < atk_table_get_n_columns(ATK_TABLE(accessibilityObject)); ++column)
> +            visibleCells.append(uiElement->cellForColumnAndRow(column, row));

Please use braces for the outermost loop. Also, you can store the get_n_rows() and get_n_columns() in variables too here

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:968
> +    Vector<AccessibilityUIElement> columnHeaders;
> +    getColumnHeaders(m_element, columnHeaders);

If the C++11 thing works, this will become one line :)

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:979
> +    Vector<AccessibilityUIElement> rowHeaders;
> +    getRowHeaders(m_element, rowHeaders);

Ditto.

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:1002
> +    Vector<AccessibilityUIElement> visibleCells;
> +    getVisibleCells(this, visibleCells);

Ditto.
Comment 6 Krzysztof Czech 2013-11-05 07:43:17 PST
Created attachment 216039 [details]
patch
Comment 7 Krzysztof Czech 2013-11-05 07:45:49 PST
> > Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:382
> > +static void getRowHeaders(AtkObject* accessible, Vector<AccessibilityUIElement>& rowHeaders)
> 
> This function only works for AtkTable, so I think you can already expect that type as the first parameter and avoid the casts below. Just make sure you check and cast properly to AtkTable at the caller points
Good point. Done.
> 
> Also, I think this is one of those cases where you can use the "move semantics" feature of C++11, which is already supported by Vector through its move contructor Vector(Vector&&). See https://www.webkit.org/blog/3172/webkit-and-cxx11/

Very good idea. Done.
> 
> > Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:384
> > +    for (int row = 0; row < atk_table_get_n_rows(ATK_TABLE(accessible)); ++row)
> 
> I think it's better to put the result of get_n_rows() in a variable and use it in the limit condition in the loop, to avoid too many calls to this function.
> 
You are right. Done.
> > Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:388
> > +static void getColumnHeaders(AtkObject* accessible, Vector<AccessibilityUIElement>& columnHeaders)
> 
> Same considerations than before here (and in the rest of the patch)
> 
> > Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:400
> > +    for (int row = 0; row < atk_table_get_n_rows(ATK_TABLE(accessibilityObject)); ++row)
> > +        for (int column = 0; column < atk_table_get_n_columns(ATK_TABLE(accessibilityObject)); ++column)
> > +            visibleCells.append(uiElement->cellForColumnAndRow(column, row));
> 
> Please use braces for the outermost loop. Also, you can store the get_n_rows() and get_n_columns() in variables too here

Right, Done.
> 
> > Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:968
> > +    Vector<AccessibilityUIElement> columnHeaders;
> > +    getColumnHeaders(m_element, columnHeaders);
> 
> If the C++11 thing works, this will become one line :)
Done.
> 
> > Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:979
> > +    Vector<AccessibilityUIElement> rowHeaders;
> > +    getRowHeaders(m_element, rowHeaders);
> 
> Ditto.
Done.
> 
> > Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:1002
> > +    Vector<AccessibilityUIElement> visibleCells;
> > +    getVisibleCells(this, visibleCells);
> 
> Ditto.
Done.

Thanks.
Comment 8 Mario Sanchez Prada 2013-11-06 01:59:44 PST
Comment on attachment 216039 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=216039&action=review

Looks good, except some nitpicks that would be great to fix. Same considerations apply to WKTR

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:374
> +    for (Vector<AccessibilityUIElement>::iterator it = elements.begin(); it != elements.end(); ++it) {

Sorry I haven't realized of this first, but as you don't need to modify this object, you can use const_iterator here instead

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:387
> +

I think this blank line is not needed

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:399
> +

Ditto

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:406
> +static Vector<AccessibilityUIElement> getVisibleCells(AccessibilityUIElement* uiElement)

In this file, we normally call this parameter "element", not "uiElement"

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:987
> +

Extra line not needed

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:997
> +

Ditto.

> Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:1019
> +

Ditto
Comment 9 Krzysztof Czech 2013-11-06 05:10:07 PST
Created attachment 216167 [details]
patch
Comment 10 WebKit Commit Bot 2013-11-06 05:11:13 PST
Attachment 216167 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp', u'Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp']" exit_code: 1
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:596:  Should have a space between // and comment  [whitespace/comments] [4]
Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:599:  Should have a space between // and comment  [whitespace/comments] [4]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Krzysztof Czech 2013-11-06 05:13:38 PST
Created attachment 216168 [details]
patch
Comment 12 Krzysztof Czech 2013-11-06 05:15:06 PST
Applied all suggestions.
Comment 13 Mario Sanchez Prada 2013-11-06 05:22:56 PST
Comment on attachment 216168 [details]
patch

Lgtm. Thanks
Comment 14 WebKit Commit Bot 2013-11-06 05:53:38 PST
Comment on attachment 216168 [details]
patch

Clearing flags on attachment: 216168

Committed r158742: <http://trac.webkit.org/changeset/158742>
Comment 15 WebKit Commit Bot 2013-11-06 05:53:41 PST
All reviewed patches have been landed.  Closing bug.