Bug 137899 - Avoid confusion between AccessibilityObject::isTable() / isAccessibilityTable()
Summary: Avoid confusion between AccessibilityObject::isTable() / isAccessibilityTable()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-20 17:06 PDT by Chris Dumez
Modified: 2014-10-22 14:45 PDT (History)
11 users (show)

See Also:


Attachments
Patch (29.42 KB, patch)
2014-10-20 17:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (29.64 KB, patch)
2014-10-20 17:57 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (31.77 KB, patch)
2014-10-20 18:58 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (31.98 KB, patch)
2014-10-20 19:12 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (31.99 KB, patch)
2014-10-20 19:28 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (32.62 KB, patch)
2014-10-22 13:37 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-10-20 17:06:36 PDT
Avoid confusion between AccessibilityObject::isTable() / isAccessibilityTable().

isTable() is equivalent to is<AccessibilityTable>(), while isAccessibilityTable() is an AccessibilityTable that is exposed as an AccessibilityTable to the platform.
We should likely rename isAccessibilityTable() to something else (maybe isExposedThroughAccessibility()?), have it on AccessibilityTable class only and make it non-virtual.
Comment 1 Chris Dumez 2014-10-20 17:48:36 PDT
Created attachment 240165 [details]
Patch
Comment 2 WebKit Commit Bot 2014-10-20 17:49:58 PDT
Attachment 240165 [details] did not pass style-queue:


ERROR: Source/WebCore/accessibility/AccessibilityTable.cpp:585:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Chris Dumez 2014-10-20 17:57:59 PDT
Created attachment 240168 [details]
Patch
Comment 4 WebKit Commit Bot 2014-10-20 18:29:09 PDT
Attachment 240168 [details] did not pass style-queue:


ERROR: Source/WebCore/accessibility/AccessibilityTable.cpp:585:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Chris Dumez 2014-10-20 18:58:19 PDT
Created attachment 240173 [details]
Patch
Comment 6 WebKit Commit Bot 2014-10-20 19:05:25 PDT
Attachment 240173 [details] did not pass style-queue:


ERROR: Source/WebCore/accessibility/AccessibilityTable.cpp:585:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Chris Dumez 2014-10-20 19:12:05 PDT
Created attachment 240175 [details]
Patch
Comment 8 WebKit Commit Bot 2014-10-20 19:14:56 PDT
Attachment 240175 [details] did not pass style-queue:


ERROR: Source/WebCore/accessibility/AccessibilityTable.cpp:585:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Chris Dumez 2014-10-20 19:28:06 PDT
Created attachment 240177 [details]
Patch
Comment 10 WebKit Commit Bot 2014-10-20 19:29:07 PDT
Attachment 240177 [details] did not pass style-queue:


ERROR: Source/WebCore/accessibility/AccessibilityTable.cpp:585:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Darin Adler 2014-10-21 15:46:35 PDT
Comment on attachment 240177 [details]
Patch

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

While I do think we are getting more clarity here, the really verbose repeated is && downcast dance is irritating. I wish there was a cleaner way to write all of those.

> Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp:66
> +    if (!is<AccessibilityTable>(parent) || !downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility())
>          return nullptr;

Maybe this would read better as !(a && b) rather than !a || !b?

> Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1631
> +    if (is<AccessibilityList>(*obj)
> +        || (is<AccessibilityTable>(*obj) && downcast<AccessibilityTable>(*obj).isExposableThroughAccessibility())
> +        || obj->isTree()
> +        || obj->isCanvas())
>          return false;

How about 3 or 4 separate if statements? I don’t see why we need to use one with || here.

> Source/WebCore/accessibility/AccessibilityTable.cpp:54
> +    , m_isExposableThroughAccessibility(true)

Seems a little strange to initialize this both here and in the init function. It seems like we’d have a problem if we looked at this before calling init.

> Source/WebCore/accessibility/AccessibilityTable.h:63
> +    virtual int tableLevel() const override final;

Glad you marked this final. I’d like to see more of these public virtual override functions made private, protected, or final.

> Source/WebCore/accessibility/AccessibilityTable.h:96
> +    virtual bool computeIsTableExposableThroughAccessibility() const;

Not sure why this is protected instead of private. Do derived classes call through to the base class?

> Source/WebCore/accessibility/AccessibilityTableRow.cpp:79
> -    if (!table || !table->isAccessibilityTable())
> +    if (!is<AccessibilityTable>(table) || !downcast<AccessibilityTable>(*table).isExposableThroughAccessibility())
>          return false;
>      
>      return true;

This should be:

    return is<AccessibilityTable>(table) && downcast<AccessibilityTable>(*table).isExposableThroughAccessibility();

> Source/WebCore/accessibility/AccessibilityTableRow.cpp:110
>          if (is<AccessibilityTable>(*parent))
> -            return downcast<AccessibilityTable>(*parent).isAccessibilityTable() ? downcast<AccessibilityTable>(parent) : nullptr;
> +            return downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility() ? downcast<AccessibilityTable>(parent) : nullptr;

Seems like this goes out of its way to use ? : when it could just fall through to return nullptr.
Comment 12 Chris Dumez 2014-10-22 13:37:55 PDT
Created attachment 240293 [details]
Patch
Comment 13 WebKit Commit Bot 2014-10-22 13:38:51 PDT
Attachment 240293 [details] did not pass style-queue:


ERROR: Source/WebCore/accessibility/AccessibilityTable.cpp:585:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 WebKit Commit Bot 2014-10-22 14:45:19 PDT
Comment on attachment 240293 [details]
Patch

Clearing flags on attachment: 240293

Committed r175068: <http://trac.webkit.org/changeset/175068>
Comment 15 WebKit Commit Bot 2014-10-22 14:45:25 PDT
All reviewed patches have been landed.  Closing bug.