Bug 134787. Active Accessibility: support XBL checkbox (first XBL-based HTML form control to be supported). r=jgaunt, sr=jst
git-svn-id: svn://10.0.0.236/trunk@121739 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
4d019d22a4
commit
002526cf90
@ -42,6 +42,7 @@ interface nsIAccessibilityService : nsISupports
|
||||
nsIAccessible createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLCheckboxAccessibleXBL(in nsIDOMNode aNode);
|
||||
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
|
||||
|
||||
@ -195,6 +195,9 @@ void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell,
|
||||
*aOwnerShell = parentPresShell;
|
||||
NS_ADDREF(*aOwnerShell);
|
||||
}
|
||||
else {
|
||||
NS_WARNING("Cannot find content for sub document");
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -460,6 +463,25 @@ nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAcc
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLCheckboxAccessibleXBL(nsIDOMNode *aNode, nsIAccessible **_retval)
|
||||
{
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
GetShellFromNode(aNode, getter_AddRefs(weakShell));
|
||||
|
||||
// reusing the HTML accessible widget and enhancing for XUL
|
||||
*_retval = new nsHTMLCheckboxAccessible(aNode, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
#else
|
||||
*_retval = nsnull;
|
||||
#endif // MOZ_XUL
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||
{
|
||||
@ -1280,29 +1302,33 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
||||
|
||||
nsCOMPtr<nsIAccessible> newAcc;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aNode));
|
||||
if (xulElement) {
|
||||
#ifdef DEBUG_aaronl
|
||||
// Please leave this in for now, it's a convenient debugging method
|
||||
nsAutoString name;
|
||||
aNode->GetLocalName(name);
|
||||
if (name.Equals(NS_LITERAL_STRING("dropmarker")))
|
||||
printf("## aaronl debugging tag name\n");
|
||||
// Please leave this in for now, it's a convenient debugging method
|
||||
nsAutoString name;
|
||||
aNode->GetLocalName(name);
|
||||
if (name.Equals(NS_LITERAL_STRING("INPUT")))
|
||||
printf("## aaronl debugging tag name\n");
|
||||
|
||||
nsAutoString className;
|
||||
xulElement->GetAttribute(NS_LITERAL_STRING("class"), className);
|
||||
if (className.Equals(NS_LITERAL_STRING("toolbarbutton-menubutton-dropmarker")))
|
||||
nsAutoString attrib;
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aNode));
|
||||
if (element) {
|
||||
element->GetAttribute(NS_LITERAL_STRING("type"), attrib);
|
||||
if (attrib.Equals(NS_LITERAL_STRING("checkbox")))
|
||||
printf("## aaronl debugging attribute\n");
|
||||
}
|
||||
#endif
|
||||
nsCOMPtr<nsIAccessibleProvider> accProv(do_QueryInterface(aNode));
|
||||
if (accProv) {
|
||||
accProv->GetAccessible(_retval);
|
||||
if (*_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIAccessibleProvider> accProv(do_QueryInterface(aNode));
|
||||
if (accProv) {
|
||||
accProv->GetAccessible(_retval);
|
||||
if (*_retval)
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aNode));
|
||||
if (xulElement)
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif // MOZ_XUL
|
||||
|
||||
// ---- Get the document for this node ----
|
||||
|
||||
@ -426,7 +426,7 @@ PRBool nsAccessibleTreeWalker::GetAccessible()
|
||||
* Class nsAccessible
|
||||
*/
|
||||
|
||||
//-------------------------`----------------------------
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): mDOMNode(aNode), mPresShell(aShell), mSiblingIndex(eSiblingsUninitialized)
|
||||
|
||||
@ -40,7 +40,20 @@
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="checkbox" extends="xul:image"/>
|
||||
<binding id="checkbox" extends="xul:image">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); // Temporary, until bug 104907 is fixed
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createHTMLCheckboxAccessibleXBL(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
|
||||
@ -40,7 +40,20 @@
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="checkbox" extends="xul:image"/>
|
||||
<binding id="checkbox" extends="xul:image">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); // Temporary, until bug 104907 is fixed
|
||||
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
|
||||
return accService.createHTMLCheckboxAccessibleXBL(this);
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user