Bug 34612 - MSAA: accSelect returns error codes for most elements that arent listbox or menupopup related
Summary: MSAA: accSelect returns error codes for most elements that arent listbox or m...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Alice Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-02-04 13:17 PST by Alice Liu
Modified: 2010-02-04 15:34 PST (History)
1 user (show)

See Also:


Attachments
patch (3.15 KB, patch)
2010-02-04 13:27 PST, Alice Liu
jhoneycutt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alice Liu 2010-02-04 13:17:14 PST
Webkit on Windows implementation of IAccessible::accSelect() returns error codes for most elements that aren't listbox or menupopup related elements.  For example, using Microsoft's AccExplorer 2.0 tool on an anchor element in TOT returns E_INVALIDARG for all of the accSelect_* MSAA verification tests.  (In contrast, firefox returns S_OK for all the cases that make sense, most of which do.)

<rdar://problem/7554699>
Comment 1 Alice Liu 2010-02-04 13:27:02 PST
Created attachment 48162 [details]
patch
Comment 2 WebKit Review Bot 2010-02-04 13:32:05 PST
Attachment 48162 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebKit/win/AccessibleBase.cpp:393:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
WebKit/win/AccessibleBase.cpp:394:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
WebKit/win/AccessibleBase.cpp:422:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
WebKit/win/AccessibleBase.cpp:423:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
WebKit/win/AccessibleBase.cpp:424:  Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side.  [whitespace/operators] [4]
Total errors found: 5


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Jon Honeycutt 2010-02-04 14:35:51 PST
Comment on attachment 48162 [details]
patch

> Index: WebKit/win/AccessibleBase.cpp
> ===================================================================
> --- WebKit/win/AccessibleBase.cpp	(revision 54295)
> +++ WebKit/win/AccessibleBase.cpp	(working copy)
> @@ -388,6 +388,13 @@ HRESULT STDMETHODCALLTYPE AccessibleBase
>          ((selectionFlags & (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)))
>          return E_INVALIDARG;
>  
> +    // Match Firefox by returning E_FAIL for these situations that don't make sense.
> +    const long allSELFLAGs = SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION | SELFLAG_EXTENDSELECTION | SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION;
> +    if (((selectionFlags & allSELFLAGs) == SELFLAG_NONE) ||
> +        ((selectionFlags & allSELFLAGs) == SELFLAG_ADDSELECTION) ||
> +        ((selectionFlags & allSELFLAGs) == SELFLAG_EXTENDSELECTION))
> +        return E_FAIL;
> +

Firefox doesn't allow you to add an object to the selection or extend the selection without also passing TAKEFOCUS? MSDN seems to say that ADDSELECTION and EXTENDSELECTION are valid without any other flags.

>      AccessibilityObject* childObject;
>      HRESULT hr = getAccessibilityObjectForChild(vChild, childObject);
>  
> @@ -406,15 +413,16 @@ HRESULT STDMETHODCALLTYPE AccessibleBase
>              Vector<RefPtr<AccessibilityObject> > selectedChildren(1);
>              selectedChildren[0] = childObject;
>              static_cast<AccessibilityListBox*>(parentObject)->setSelectedChildren(selectedChildren);
> -        } else if (parentObject->isMenuListPopup())
> +        } else // any element may be selectable by virtue of it having the aria-selected property
>              childObject->setSelected(true);
> -        else
> -            return E_INVALIDARG;
>      }

TAKESELECTION is meant to select that object and deselect any other objects, so it might be good to ASSERT(!parentObject->isMultiSelectable()) in the else condition to catch cases where TAKESELECTION could allow multiple items to be selected.

r=me! Thanks for fixing this!
Comment 4 Jon Honeycutt 2010-02-04 14:42:57 PST
Comment on attachment 48162 [details]
patch

> Index: WebKit/win/AccessibleBase.cpp
> ===================================================================
> --- WebKit/win/AccessibleBase.cpp	(revision 54295)
> +++ WebKit/win/AccessibleBase.cpp	(working copy)
> @@ -388,6 +388,13 @@ HRESULT STDMETHODCALLTYPE AccessibleBase
>          ((selectionFlags & (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)))

This is a copy/paste error. It should read:

           ((selectionFlags & (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)))

Feel free to fix that :)
Comment 5 Alice Liu 2010-02-04 15:11:49 PST
(In reply to comment #3)
> (From update of attachment 48162 [details])
> > Index: WebKit/win/AccessibleBase.cpp
> > ===================================================================
> > --- WebKit/win/AccessibleBase.cpp	(revision 54295)
> > +++ WebKit/win/AccessibleBase.cpp	(working copy)
> > @@ -388,6 +388,13 @@ HRESULT STDMETHODCALLTYPE AccessibleBase
> >          ((selectionFlags & (SELFLAG_EXTENDSELECTION | SELFLAG_TAKESELECTION)) == (SELFLAG_REMOVESELECTION | SELFLAG_TAKESELECTION)))
> >          return E_INVALIDARG;
> >  
> > +    // Match Firefox by returning E_FAIL for these situations that don't make sense.
> > +    const long allSELFLAGs = SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION | SELFLAG_EXTENDSELECTION | SELFLAG_ADDSELECTION | SELFLAG_REMOVESELECTION;
> > +    if (((selectionFlags & allSELFLAGs) == SELFLAG_NONE) ||
> > +        ((selectionFlags & allSELFLAGs) == SELFLAG_ADDSELECTION) ||
> > +        ((selectionFlags & allSELFLAGs) == SELFLAG_EXTENDSELECTION))
> > +        return E_FAIL;
> > +
> 
> Firefox doesn't allow you to add an object to the selection or extend the
> selection without also passing TAKEFOCUS? MSDN seems to say that ADDSELECTION
> and EXTENDSELECTION are valid without any other flags.

Ya, this is the way it is in Firefox.  However, after checking with IE8, i'm deciding to remove this chunk of code because this isn't what IE8 does.
Comment 6 Alice Liu 2010-02-04 15:34:39 PST
thanks Jon for reivew.  

I've removed the firefox-specific section, as mentioned in a previous comment.  I also fixed what the style bot mentioned, added the assert that jon wanted, and fixed the copy-paste issue.  

committed r54376