2001-10-09 21:52:36 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Author: John Gaunt (jgaunt@netscape.com)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
// NOTE: alphabetically ordered
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIDOMNodeList.h"
|
|
|
|
#include "nsIDOMXULButtonElement.h"
|
|
|
|
#include "nsIDOMXULCheckboxElement.h"
|
2001-11-07 00:12:16 +00:00
|
|
|
#include "nsIDOMXULDescriptionElement.h"
|
2001-10-09 21:52:36 +00:00
|
|
|
#include "nsIDOMXULDocument.h"
|
2001-11-07 00:12:16 +00:00
|
|
|
#include "nsIDOMXULLabelElement.h"
|
2002-01-11 03:48:02 +00:00
|
|
|
#include "nsIDOMXULMenuListElement.h"
|
2001-11-07 00:12:16 +00:00
|
|
|
#include "nsIDOMXULSelectCntrlEl.h"
|
|
|
|
#include "nsIDOMXULSelectCntrlItemEl.h"
|
2001-10-09 21:52:36 +00:00
|
|
|
#include "nsReadableUtils.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsXULFormControlAccessible.h"
|
2002-01-09 10:02:29 +00:00
|
|
|
#include "nsIAccessibilityService.h"
|
|
|
|
#include "nsIServiceManager.h"
|
2001-10-09 21:52:36 +00:00
|
|
|
|
|
|
|
/**
|
2001-11-07 00:12:16 +00:00
|
|
|
* XUL Button: can contain arbitrary HTML content
|
2001-10-09 21:52:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2001-11-07 00:12:16 +00:00
|
|
|
* Default Constructor
|
2001-10-09 21:52:36 +00:00
|
|
|
*/
|
2002-01-09 10:02:29 +00:00
|
|
|
|
|
|
|
// Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
|
2001-10-09 21:52:36 +00:00
|
|
|
nsXULButtonAccessible::nsXULButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
2002-05-10 22:34:53 +00:00
|
|
|
nsAccessible(aNode, aShell)
|
2001-10-09 21:52:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccName(nsAString& aResult)
|
2002-01-09 10:02:29 +00:00
|
|
|
{
|
|
|
|
return GetXULAccName(aResult);
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Only one actions available
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccNumActions(PRUint8 *_retval)
|
|
|
|
{
|
2001-11-07 00:12:16 +00:00
|
|
|
*_retval = eSingle_Action;
|
2001-10-09 21:52:36 +00:00
|
|
|
return NS_OK;;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Return the name of our only action
|
|
|
|
*/
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
2001-10-09 21:52:36 +00:00
|
|
|
{
|
2001-11-07 00:12:16 +00:00
|
|
|
if (index == eAction_Click) {
|
2002-01-12 00:23:06 +00:00
|
|
|
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("press"), _retval);
|
2001-10-09 21:52:36 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Tell the button to do it's action
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::AccDoAction(PRUint8 index)
|
|
|
|
{
|
|
|
|
if (index == 0) {
|
|
|
|
nsCOMPtr<nsIDOMXULButtonElement> buttonElement(do_QueryInterface(mDOMNode));
|
|
|
|
if ( buttonElement )
|
|
|
|
{
|
|
|
|
buttonElement->DoCommand();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* We are a pushbutton
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccRole(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
*_retval = ROLE_PUSHBUTTON;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Possible states: focused, focusable, unavailable(disabled)
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccState(PRUint32 *_retval)
|
|
|
|
{
|
2001-11-07 00:12:16 +00:00
|
|
|
// get focus and disable status from base class
|
2002-01-09 10:02:29 +00:00
|
|
|
nsAccessible::GetAccState(_retval);
|
|
|
|
|
|
|
|
PRBool disabled = PR_FALSE;
|
|
|
|
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mDOMNode));
|
|
|
|
if (xulFormElement) {
|
|
|
|
xulFormElement->GetDisabled(&disabled);
|
|
|
|
if (disabled)
|
|
|
|
*_retval |= STATE_UNAVAILABLE;
|
|
|
|
else
|
|
|
|
*_retval |= STATE_FOCUSABLE;
|
|
|
|
}
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
|
|
|
|
// Buttons can be checked -- they simply appear pressed in rather than checked
|
|
|
|
nsCOMPtr<nsIDOMXULButtonElement> xulButtonElement(do_QueryInterface(mDOMNode));
|
|
|
|
if (xulButtonElement) {
|
|
|
|
PRBool checked = PR_FALSE;
|
|
|
|
PRInt32 checkState = 0;
|
|
|
|
xulButtonElement->GetChecked(&checked);
|
|
|
|
if (checked) {
|
|
|
|
*_retval |= STATE_PRESSED;
|
|
|
|
xulButtonElement->GetCheckState(&checkState);
|
|
|
|
if (checkState == nsIDOMXULButtonElement::CHECKSTATE_MIXED)
|
|
|
|
*_retval |= STATE_MIXED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-10 05:14:24 +00:00
|
|
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
|
|
|
NS_ASSERTION(element, "No nsIDOMElement for button node!");
|
|
|
|
PRBool isDefault = PR_FALSE;
|
|
|
|
element->HasAttribute(NS_LITERAL_STRING("default"), &isDefault) ;
|
|
|
|
if (isDefault)
|
|
|
|
*_retval |= STATE_DEFAULT;
|
|
|
|
|
2001-10-09 21:52:36 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-01-09 10:02:29 +00:00
|
|
|
/**
|
|
|
|
* Perhaps 1 child - if there's a <dropmarker>
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccFirstChild(nsIAccessible **aResult)
|
|
|
|
{
|
|
|
|
*aResult = nsnull;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAccessible> testAccessible;
|
|
|
|
nsAccessible::GetAccLastChild(getter_AddRefs(testAccessible));
|
|
|
|
|
|
|
|
// If the anonymous tree walker can find accessible children, and the last one is a push button,
|
|
|
|
// then use it as the only accessible child -- because this is the scenario where we have a dropmarker child
|
|
|
|
|
|
|
|
if (testAccessible) {
|
|
|
|
PRUint32 role;
|
|
|
|
if (NS_SUCCEEDED(testAccessible->GetAccRole(&role)) && role == ROLE_PUSHBUTTON) {
|
|
|
|
*aResult = testAccessible;
|
|
|
|
NS_ADDREF(*aResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccLastChild(nsIAccessible **aResult)
|
|
|
|
{
|
|
|
|
return GetAccFirstChild(aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsXULButtonAccessible::GetAccChildCount(PRInt32 *aResult)
|
|
|
|
{
|
|
|
|
*aResult = 0;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAccessible> accessible;
|
|
|
|
GetAccFirstChild(getter_AddRefs(accessible));
|
|
|
|
if (accessible)
|
|
|
|
*aResult = 1;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* XUL Dropmarker: can contain arbitrary HTML content
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default Constructor
|
|
|
|
*/
|
|
|
|
nsXULDropmarkerAccessible::nsXULDropmarkerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
|
|
|
nsFormControlAccessible(aNode, aShell)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Only one actions available
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccNumActions(PRUint8 *aResult)
|
|
|
|
{
|
|
|
|
*aResult = eSingle_Action;
|
|
|
|
return NS_OK;;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool nsXULDropmarkerAccessible::DropmarkerOpen(PRBool aToggleOpen)
|
|
|
|
{
|
|
|
|
PRBool isOpen = PR_FALSE;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMNode> parentButtonNode;
|
|
|
|
mDOMNode->GetParentNode(getter_AddRefs(parentButtonNode));
|
|
|
|
nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement(do_QueryInterface(parentButtonNode));
|
|
|
|
|
|
|
|
if (parentButtonElement) {
|
|
|
|
parentButtonElement->GetOpen(&isOpen);
|
|
|
|
if (aToggleOpen)
|
|
|
|
parentButtonElement->SetOpen(!isOpen);
|
|
|
|
}
|
2002-01-11 03:48:02 +00:00
|
|
|
else {
|
|
|
|
nsCOMPtr<nsIDOMXULMenuListElement> parentMenuListElement(do_QueryInterface(parentButtonNode));
|
|
|
|
if (parentMenuListElement) {
|
|
|
|
parentMenuListElement->GetOpen(&isOpen);
|
|
|
|
if (aToggleOpen)
|
|
|
|
parentMenuListElement->SetOpen(!isOpen);
|
|
|
|
}
|
|
|
|
}
|
2002-01-09 10:02:29 +00:00
|
|
|
|
|
|
|
return isOpen;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the name of our only action
|
|
|
|
*/
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccActionName(PRUint8 index, nsAString& aResult)
|
2002-01-09 10:02:29 +00:00
|
|
|
{
|
|
|
|
if (index == eAction_Click) {
|
|
|
|
if (DropmarkerOpen(PR_FALSE))
|
|
|
|
aResult = NS_LITERAL_STRING("close");
|
|
|
|
else
|
|
|
|
aResult = NS_LITERAL_STRING("open");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tell the Dropmarker to do it's action
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsXULDropmarkerAccessible::AccDoAction(PRUint8 index)
|
|
|
|
{
|
|
|
|
if (index == eAction_Click) {
|
|
|
|
DropmarkerOpen(PR_TRUE); // Reverse the open attribute
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* We are a pushbutton
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccRole(PRUint32 *aResult)
|
|
|
|
{
|
|
|
|
*aResult = ROLE_PUSHBUTTON;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsXULDropmarkerAccessible::GetAccState(PRUint32 *aResult)
|
|
|
|
{
|
|
|
|
*aResult = 0;
|
|
|
|
|
|
|
|
if (DropmarkerOpen(PR_FALSE))
|
|
|
|
*aResult = STATE_PRESSED;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* XUL checkbox
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Default Constructor
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
nsXULCheckboxAccessible::nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
2001-11-07 00:12:16 +00:00
|
|
|
nsFormControlAccessible(aNode, aShell)
|
2001-10-09 21:52:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* We are a CheckButton
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccRole(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
*_retval = ROLE_CHECKBUTTON;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Only one action available
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccNumActions(PRUint8 *_retval)
|
|
|
|
{
|
2001-11-07 00:12:16 +00:00
|
|
|
*_retval = eSingle_Action;
|
2001-10-09 21:52:36 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Return the name of our only action
|
|
|
|
*/
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccActionName(PRUint8 index, nsAString& _retval)
|
2001-10-09 21:52:36 +00:00
|
|
|
{
|
2001-11-07 00:12:16 +00:00
|
|
|
if (index == eAction_Click) {
|
2001-10-09 21:52:36 +00:00
|
|
|
// check or uncheck
|
|
|
|
PRUint32 state;
|
|
|
|
GetAccState(&state);
|
|
|
|
|
|
|
|
if (state & STATE_CHECKED)
|
|
|
|
_retval = NS_LITERAL_STRING("uncheck");
|
|
|
|
else
|
|
|
|
_retval = NS_LITERAL_STRING("check");
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Tell the checkbox to do its only action -- check( or uncheck) itself
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULCheckboxAccessible::AccDoAction(PRUint8 index)
|
|
|
|
{
|
2001-11-07 00:12:16 +00:00
|
|
|
if (index == eAction_Click) {
|
2001-10-09 21:52:36 +00:00
|
|
|
PRBool checked = PR_FALSE;
|
|
|
|
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
|
|
|
|
if (xulCheckboxElement) {
|
|
|
|
xulCheckboxElement->GetChecked(&checked);
|
|
|
|
xulCheckboxElement->SetChecked(!checked);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
2001-11-07 00:12:16 +00:00
|
|
|
/**
|
|
|
|
* Possible states: focused, focusable, unavailable(disabled), checked
|
|
|
|
*/
|
2001-10-09 21:52:36 +00:00
|
|
|
NS_IMETHODIMP nsXULCheckboxAccessible::GetAccState(PRUint32 *_retval)
|
|
|
|
{
|
2001-11-07 00:12:16 +00:00
|
|
|
// Get focus and disable status from base class
|
|
|
|
nsFormControlAccessible::GetAccState(_retval);
|
2001-10-09 21:52:36 +00:00
|
|
|
|
|
|
|
// Determine Checked state
|
|
|
|
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement(do_QueryInterface(mDOMNode));
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
if (xulCheckboxElement) {
|
|
|
|
PRBool checked = PR_FALSE;
|
|
|
|
xulCheckboxElement->GetChecked(&checked);
|
|
|
|
if (checked) {
|
|
|
|
*_retval |= STATE_CHECKED;
|
|
|
|
PRInt32 checkState = 0;
|
|
|
|
xulCheckboxElement->GetCheckState(&checkState);
|
|
|
|
if (checkState == nsIDOMXULCheckboxElement::CHECKSTATE_MIXED)
|
|
|
|
*_retval |= STATE_MIXED;
|
|
|
|
}
|
|
|
|
}
|
2001-10-09 21:52:36 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
/**
|
|
|
|
* XUL groupbox
|
|
|
|
*/
|
|
|
|
|
|
|
|
nsXULGroupboxAccessible::nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
|
|
|
nsAccessible(aNode, aShell)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccRole(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
*_retval = ROLE_GROUPING;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccState(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
// Groupbox doesn't support any states!
|
|
|
|
*_retval = 0;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHODIMP nsXULGroupboxAccessible::GetAccName(nsAString& _retval)
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
{
|
|
|
|
_retval.Assign(NS_LITERAL_STRING("")); // Default name is blank
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
|
|
|
if (element) {
|
|
|
|
nsCOMPtr<nsIDOMNodeList> captions;
|
|
|
|
element->GetElementsByTagName(NS_LITERAL_STRING("caption"), getter_AddRefs(captions));
|
|
|
|
if (captions) {
|
|
|
|
nsCOMPtr<nsIDOMNode> captionNode;
|
|
|
|
captions->Item(0, getter_AddRefs(captionNode));
|
|
|
|
if (captionNode) {
|
|
|
|
element = do_QueryInterface(captionNode);
|
|
|
|
NS_ASSERTION(element, "No nsIDOMElement for caption node!");
|
|
|
|
element->GetAttribute(NS_LITERAL_STRING("label"), _retval) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* progressmeter
|
|
|
|
*/
|
|
|
|
|
|
|
|
nsXULProgressMeterAccessible::nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
|
|
|
nsAccessible(aNode, aShell)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccRole(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
*_retval = ROLE_PROGRESSBAR;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* No states supported for progressmeter
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccState(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
*_retval =0;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-03-23 21:52:27 +00:00
|
|
|
NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccValue(nsAString& _retval)
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 02:05:26 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
|
|
|
NS_ASSERTION(element, "No element for DOM node!");
|
|
|
|
element->GetAttribute(NS_LITERAL_STRING("value"), _retval);
|
|
|
|
_retval.Append(NS_LITERAL_STRING("%"));
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-12-11 20:49:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* XUL Radio Button
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Constructor */
|
|
|
|
nsXULRadioButtonAccessible::nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
|
|
|
nsRadioButtonAccessible(aNode, aShell)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Our only action is to click */
|
|
|
|
NS_IMETHODIMP nsXULRadioButtonAccessible::AccDoAction(PRUint8 index)
|
|
|
|
{
|
|
|
|
if (index == eAction_Click) {
|
|
|
|
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
|
|
|
|
if (radioButton) {
|
|
|
|
radioButton->DoCommand();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** We are Focusable and can be Checked and focused */
|
|
|
|
NS_IMETHODIMP nsXULRadioButtonAccessible::GetAccState(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
nsFormControlAccessible::GetAccState(_retval);
|
|
|
|
PRBool selected = PR_FALSE; // Radio buttons can be selected
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton(do_QueryInterface(mDOMNode));
|
|
|
|
if (radioButton)
|
|
|
|
radioButton->GetSelected(&selected);
|
|
|
|
|
|
|
|
if (selected)
|
|
|
|
*_retval |= STATE_CHECKED;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This gets the parent of the RadioGroup (our grandparent) and sets it
|
|
|
|
* as our parent, for future calls.
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsXULRadioButtonAccessible::GetAccParent(nsIAccessible ** aAccParent)
|
|
|
|
{
|
|
|
|
if (! mParent) {
|
|
|
|
nsCOMPtr<nsIAccessible> tempParent;
|
|
|
|
nsAccessible::GetAccParent(getter_AddRefs(tempParent));
|
|
|
|
if (tempParent)
|
|
|
|
tempParent->GetAccParent(getter_AddRefs(mParent));
|
|
|
|
}
|
|
|
|
NS_ASSERTION(mParent,"Whoa! This RadioButtonAcc doesn't have a parent! Better find out why.");
|
|
|
|
*aAccParent = mParent;
|
|
|
|
NS_ADDREF(*aAccParent);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* XUL Radio Group
|
|
|
|
* The Radio Group proxies for the Radio Buttons themselves. The Group gets
|
|
|
|
* focus whereas the Buttons do not. So we only have an accessible object for
|
|
|
|
* this for the purpose of getting the proper RadioButton. Need this here to
|
|
|
|
* avoid circular reference problems when navigating the accessible tree and
|
|
|
|
* for getting to the radiobuttons.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Constructor */
|
|
|
|
nsXULRadioGroupAccessible::nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
2002-01-14 21:00:08 +00:00
|
|
|
nsAccessible(aNode, aShell)
|
2001-12-11 20:49:49 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-01-09 10:02:29 +00:00
|
|
|
/**
|
|
|
|
* XUL StatusBar: can contain arbitrary HTML content
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default Constructor
|
|
|
|
*/
|
|
|
|
nsXULStatusBarAccessible::nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
2002-01-11 03:48:02 +00:00
|
|
|
nsAccessible(aNode, aShell)
|
2002-01-09 10:02:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* We are a statusbar
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP nsXULStatusBarAccessible::GetAccRole(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
*_retval = ROLE_STATUSBAR;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP nsXULStatusBarAccessible::GetAccState(PRUint32 *_retval)
|
|
|
|
{
|
|
|
|
*_retval = 0; // no special state flags for status bar
|
|
|
|
return NS_OK;
|
|
|
|
}
|