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 createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
|
||||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||||
|
nsIAccessible createHTMLCheckboxAccessibleXBL(in nsIDOMNode aNode);
|
||||||
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||||
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
|
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
|
||||||
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
|
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
|
||||||
|
|||||||
@ -195,6 +195,9 @@ void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell,
|
|||||||
*aOwnerShell = parentPresShell;
|
*aOwnerShell = parentPresShell;
|
||||||
NS_ADDREF(*aOwnerShell);
|
NS_ADDREF(*aOwnerShell);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
NS_WARNING("Cannot find content for sub document");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -460,6 +463,25 @@ nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAcc
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
|
||||||
{
|
{
|
||||||
@ -1280,29 +1302,33 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
|||||||
|
|
||||||
nsCOMPtr<nsIAccessible> newAcc;
|
nsCOMPtr<nsIAccessible> newAcc;
|
||||||
|
|
||||||
#ifdef MOZ_XUL
|
|
||||||
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aNode));
|
|
||||||
if (xulElement) {
|
|
||||||
#ifdef DEBUG_aaronl
|
#ifdef DEBUG_aaronl
|
||||||
// Please leave this in for now, it's a convenient debugging method
|
// Please leave this in for now, it's a convenient debugging method
|
||||||
nsAutoString name;
|
nsAutoString name;
|
||||||
aNode->GetLocalName(name);
|
aNode->GetLocalName(name);
|
||||||
if (name.Equals(NS_LITERAL_STRING("dropmarker")))
|
if (name.Equals(NS_LITERAL_STRING("INPUT")))
|
||||||
printf("## aaronl debugging tag name\n");
|
printf("## aaronl debugging tag name\n");
|
||||||
|
|
||||||
nsAutoString className;
|
nsAutoString attrib;
|
||||||
xulElement->GetAttribute(NS_LITERAL_STRING("class"), className);
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aNode));
|
||||||
if (className.Equals(NS_LITERAL_STRING("toolbarbutton-menubutton-dropmarker")))
|
if (element) {
|
||||||
|
element->GetAttribute(NS_LITERAL_STRING("type"), attrib);
|
||||||
|
if (attrib.Equals(NS_LITERAL_STRING("checkbox")))
|
||||||
printf("## aaronl debugging attribute\n");
|
printf("## aaronl debugging attribute\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
nsCOMPtr<nsIAccessibleProvider> accProv(do_QueryInterface(aNode));
|
nsCOMPtr<nsIAccessibleProvider> accProv(do_QueryInterface(aNode));
|
||||||
if (accProv) {
|
if (accProv) {
|
||||||
accProv->GetAccessible(_retval);
|
accProv->GetAccessible(_retval);
|
||||||
if (*_retval)
|
if (*_retval)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_XUL
|
||||||
|
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aNode));
|
||||||
|
if (xulElement)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
#endif // MOZ_XUL
|
#endif // MOZ_XUL
|
||||||
|
|
||||||
// ---- Get the document for this node ----
|
// ---- Get the document for this node ----
|
||||||
|
|||||||
@ -426,7 +426,7 @@ PRBool nsAccessibleTreeWalker::GetAccessible()
|
|||||||
* Class nsAccessible
|
* Class nsAccessible
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//-------------------------`----------------------------
|
//-----------------------------------------------------
|
||||||
// construction
|
// construction
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): mDOMNode(aNode), mPresShell(aShell), mSiblingIndex(eSiblingsUninitialized)
|
nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): mDOMNode(aNode), mPresShell(aShell), mSiblingIndex(eSiblingsUninitialized)
|
||||||
|
|||||||
@ -40,7 +40,20 @@
|
|||||||
xmlns="http://www.mozilla.org/xbl"
|
xmlns="http://www.mozilla.org/xbl"
|
||||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
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>
|
</bindings>
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,20 @@
|
|||||||
xmlns="http://www.mozilla.org/xbl"
|
xmlns="http://www.mozilla.org/xbl"
|
||||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
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>
|
</bindings>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user