зеркало из https://github.com/mozilla/gecko-dev.git
Bug 280262. Remove unneeded class nsGenericAccessible. Use nsAccessibleWrap for generic accessibles from now on. r=pkw, sr=jst
This commit is contained in:
Родитель
21d4b2141a
Коммит
bf9489220d
|
@ -83,6 +83,7 @@ ACCESSIBILITY_ATOM(ul, "ul")
|
|||
// Alphabetical list of attributes
|
||||
ACCESSIBILITY_ATOM(accesskey, "accesskey")
|
||||
ACCESSIBILITY_ATOM(control, "control")
|
||||
ACCESSIBILITY_ATOM(disabled, "disabled")
|
||||
ACCESSIBILITY_ATOM(_for, "for")
|
||||
ACCESSIBILITY_ATOM(id, "id")
|
||||
ACCESSIBILITY_ATOM(name, "name")
|
||||
|
|
|
@ -448,7 +448,8 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsISupports *aFrame,
|
|||
*aAccessible = new nsHTMLLinkAccessible(node, weakShell, frame);
|
||||
}
|
||||
#endif
|
||||
else if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::tabindex)
|
||||
else if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::tabindex) ||
|
||||
content->HasAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role)
|
||||
#ifndef MOZ_ACCESSIBILITY_ATK
|
||||
||
|
||||
tag == nsAccessibilityAtoms::blockquote ||
|
||||
|
@ -462,13 +463,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsISupports *aFrame,
|
|||
tag == nsAccessibilityAtoms::q
|
||||
#endif
|
||||
) {
|
||||
*aAccessible = new nsGenericAccessible(node, weakShell);
|
||||
}
|
||||
else {
|
||||
nsAutoString role;
|
||||
if (content->GetAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role, role) == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
*aAccessible = new nsGenericAccessible(node, weakShell);
|
||||
}
|
||||
*aAccessible = new nsAccessibleWrap(node, weakShell);
|
||||
}
|
||||
NS_IF_ADDREF(*aAccessible);
|
||||
return NS_OK;
|
||||
|
@ -593,7 +588,7 @@ nsAccessibilityService::CreateHTMLGenericAccessible(nsISupports *aFrame, nsIAcce
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
*_retval = new nsGenericAccessible(node, weakShell);
|
||||
*_retval = new nsAccessibleWrap(node, weakShell);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
|
|
@ -588,25 +588,26 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
|
|||
/* readonly attribute wstring state; */
|
||||
NS_IMETHODIMP nsAccessible::GetState(PRUint32 *aState)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
*aState = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> currElement(do_QueryInterface(mDOMNode));
|
||||
if (currElement) {
|
||||
// Set STATE_UNAVAILABLE state based on disabled attribute
|
||||
// The disabled attribute is mostly used in XUL elements and HTML forms, but
|
||||
// if someone sets it on another attribute,
|
||||
// it seems reasonable to consider it unavailable
|
||||
PRBool isDisabled = PR_FALSE;
|
||||
currElement->HasAttribute(NS_LITERAL_STRING("disabled"), &isDisabled);
|
||||
if (isDisabled)
|
||||
*aState |= STATE_UNAVAILABLE;
|
||||
else {
|
||||
*aState |= STATE_FOCUSABLE;
|
||||
nsCOMPtr<nsIDOMNode> focusedNode;
|
||||
if (gLastFocusedNode == mDOMNode) {
|
||||
*aState |= STATE_FOCUSED;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content) {
|
||||
return NS_ERROR_FAILURE; // Node shut down
|
||||
}
|
||||
|
||||
// Set STATE_UNAVAILABLE state based on disabled attribute
|
||||
// The disabled attribute is mostly used in XUL elements and HTML forms, but
|
||||
// if someone sets it on another attribute,
|
||||
// it seems reasonable to consider it unavailable
|
||||
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::disabled)) {
|
||||
*aState |= STATE_UNAVAILABLE;
|
||||
}
|
||||
else if (!mRoleMapEntry || content->IsFocusable()) {
|
||||
// Default state is focusable unless role manually set
|
||||
// Subclasses of nsAccessible will clear focusable state if necessary
|
||||
*aState |= STATE_FOCUSABLE;
|
||||
if (gLastFocusedNode == mDOMNode) {
|
||||
*aState |= STATE_FOCUSED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,7 +619,7 @@ NS_IMETHODIMP nsAccessible::GetState(PRUint32 *aState)
|
|||
*aState |= STATE_OFFSCREEN;
|
||||
}
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean focusedChild; */
|
||||
|
@ -1427,9 +1428,10 @@ NS_IMETHODIMP nsAccessible::GetKeyBinding(nsAString& _retval)
|
|||
}
|
||||
|
||||
/* unsigned long getRole (); */
|
||||
NS_IMETHODIMP nsAccessible::GetRole(PRUint32 *_retval)
|
||||
NS_IMETHODIMP nsAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*aRole = ROLE_NOTHING;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
|
|
|
@ -325,74 +325,3 @@ NS_IMETHODIMP nsLinkableAccessible::Shutdown()
|
|||
return nsAccessibleWrap::Shutdown();
|
||||
}
|
||||
|
||||
|
||||
//----------------
|
||||
// nsGenericAccessible
|
||||
//----------------
|
||||
|
||||
nsGenericAccessible::nsGenericAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
|
||||
nsAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsGenericAccessible, nsAccessible)
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::TakeFocus()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (!content || !mWeakShell) {
|
||||
return NS_ERROR_FAILURE; // Node already shut down
|
||||
}
|
||||
|
||||
content->SetFocus(nsCOMPtr<nsPresContext>(GetPresContext()));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
*aRole = ROLE_NOTHING;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::GetState(PRUint32 *aState)
|
||||
{
|
||||
// XXX todo: use DHTML state attribs to fill in accessible states
|
||||
|
||||
nsAccessible::GetState(aState);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsGenericAccessible::GetValue(nsAString& aValue)
|
||||
{
|
||||
// XXX todo: use value attrib or property to fill in accessible value
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetNumActions(PRUint8 *aNumActions)
|
||||
{
|
||||
// XXX todo: use XML events to fill in accessible actions
|
||||
|
||||
*aNumActions = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* wstring getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::GetActionName(PRUint8 index, nsAString& _retval)
|
||||
{
|
||||
// XXX todo: use XML events to fill in accessible actions
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void accDoAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsGenericAccessible::DoAction(PRUint8 index)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -100,23 +100,4 @@ protected:
|
|||
PRPackedBool mIsLinkVisited;
|
||||
};
|
||||
|
||||
/**
|
||||
* A type of accessible for DOM nodes containing a non-negative tabindex
|
||||
* (thus they're focusable), or a role attrib which defines how to expose them.
|
||||
*/
|
||||
class nsGenericAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsGenericAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_IMETHOD TakeFocus();
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetState(PRUint32 *aState);
|
||||
NS_IMETHOD GetValue(nsAString& aValue);
|
||||
NS_IMETHOD GetNumActions(PRUint8 *_retval);
|
||||
NS_IMETHOD GetActionName(PRUint8 index, nsAString& _retval);
|
||||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче