Bug 355540. Accessible objects for xforms upload and some inputs. Patch by Alexander Surkov. r=aaronlev, r=aaronr, sr=neil

This commit is contained in:
aaronleventhal%moonset.net 2006-11-02 14:50:32 +00:00
Родитель 861de64c6c
Коммит 781b78f5af
6 изменённых файлов: 87 добавлений и 5 удалений

Просмотреть файл

@ -122,6 +122,11 @@ interface nsIAccessibleProvider : nsISupports
const long XFormsSecret = 0x00002006;
/** Used for range element represented by slider */
const long XFormsSliderRange = 0x00002007;
/** Used for xforms elements that provide accessible object for itself as
* well for anonymous content. This property are used for upload,
* input[type="xsd:gDay"] and input[type="xsd:gMonth"].
*/
const long XFormsContainer = 0x00002008;
/**
* Return one of constants declared above.

Просмотреть файл

@ -1571,6 +1571,9 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
case nsIAccessibleProvider::XFormsSliderRange:
*aAccessible = new nsXFormsRangeAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XFormsContainer:
*aAccessible = new nsXFormsContainerAccessible(aNode, weakShell);
break;
#endif
default:

Просмотреть файл

@ -183,3 +183,29 @@ nsXFormsAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
return NS_OK;
}
// nsXFormsContainerAccessible
nsXFormsContainerAccessible::
nsXFormsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsXFormsAccessible(aNode, aShell)
{
}
NS_IMETHODIMP
nsXFormsContainerAccessible::GetRole(PRUint32 *aRole)
{
NS_ENSURE_ARG_POINTER(aRole);
*aRole = ROLE_GROUPING;
return NS_OK;
}
NS_IMETHODIMP
nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
{
NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
*aAllowsAnonChildren = PR_TRUE;
return NS_OK;
}

Просмотреть файл

@ -45,7 +45,9 @@
#define NS_NAMESPACE_XFORMS "http://www.w3.org/2002/xforms"
/**
* The class is base for accessible objects of all XForms elements.
* Every XForms element that is bindable to XForms model or is able to contain
* XForms hint and XForms label elements should have accessible object. This
* class is base class for accessible objects for these XForms elements.
*/
class nsXFormsAccessible : public nsAccessibleWrap
{
@ -82,5 +84,31 @@ protected:
static nsIXFormsUtilityService *sXFormsService;
};
/**
* This class is accessible object for XForms elements that provide accessible
* object for itself as well for anonymous content. You should use this class
* if accessible XForms element is complex, i.e. it is composed from elements
* that should be accessible too. Especially for elements that have multiple
* areas that a user can interact with or multiple visual areas. For example,
* objects for XForms input[type="xsd:gMonth"] that contains combobox element
* to choose month. It has an entryfield, a drop-down button and a drop-down
* list, all of which need to be accessible. Another example would be
* an XForms upload element since it is constructed from textfield and
* 'pick up file' and 'clear file' buttons.
*/
class nsXFormsContainerAccessible : public nsXFormsAccessible
{
public:
nsXFormsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
// Returns ROLE_GROUP.
NS_IMETHOD GetRole(PRUint32 *aRole);
// Allows accessible nodes in anonymous content of xforms element by
// always returning PR_TRUE value.
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
};
#endif

Просмотреть файл

@ -220,7 +220,13 @@
-->
<binding id="xformswidget-input-month-base"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<implementation implements="nsIXFormsUIWidget">
<implementation implements="nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
return Components.interfaces.nsIAccessibleProvider.XFormsContainer;
</getter>
</property>
<method name="refresh">
<body>
@ -293,7 +299,14 @@
-->
<binding id="xformswidget-input-day-base"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<implementation implements="nsIXFormsUIWidget">
<implementation implements="nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
return Components.interfaces.nsIAccessibleProvider.XFormsContainer;
</getter>
</property>
<method name="refresh">
<body>
<![CDATA[

Просмотреть файл

@ -483,9 +483,16 @@
focus(); // set focus
}
-->
<binding id="xformswidget-upload-base" extends="#xformswidget-base">
<binding id="xformswidget-upload-base"
extends="#xformswidget-base">
<implementation implements="nsIXFormsUploadUIElement, nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
return Components.interfaces.nsIAccessibleProvider.XFormsContainer;
</getter>
</property>
<implementation implements="nsIXFormsUIWidget, nsIXFormsUploadUIElement">
<method name="refresh">
<body>
this.control.readonly = this.accessors.isReadonly();