зеркало из https://github.com/mozilla/gecko-dev.git
bug 300778. Expose elements with onclick handlers. Patch by Peter Parente. r=aaronlev, sr=neil, a=mkaply
This commit is contained in:
Родитель
74ad5c528d
Коммит
9bc60ce040
|
@ -39,7 +39,7 @@
|
|||
/******
|
||||
|
||||
This file contains the list of all accessibility nsIAtoms and their values
|
||||
|
||||
|
||||
It is designed to be used as inline input to nsAccessibilityAtoms.cpp *only*
|
||||
through the magic of C preprocessing.
|
||||
|
||||
|
@ -113,6 +113,7 @@ ACCESSIBILITY_ATOM(id, "id")
|
|||
ACCESSIBILITY_ATOM(lang, "lang")
|
||||
ACCESSIBILITY_ATOM(multiline, "multiline")
|
||||
ACCESSIBILITY_ATOM(name, "name")
|
||||
ACCESSIBILITY_ATOM(onclick, "onclick")
|
||||
ACCESSIBILITY_ATOM(readonly, "readonly")
|
||||
ACCESSIBILITY_ATOM(src, "src")
|
||||
ACCESSIBILITY_ATOM(summary, "summary")
|
||||
|
|
|
@ -521,6 +521,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsISupports *aFrame,
|
|||
tag == nsAccessibilityAtoms::tbody ||
|
||||
tag == nsAccessibilityAtoms::tfoot ||
|
||||
tag == nsAccessibilityAtoms::thead ||
|
||||
content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::onclick) ||
|
||||
#else
|
||||
else if (
|
||||
#endif
|
||||
|
|
|
@ -1889,21 +1889,56 @@ NS_IMETHODIMP nsAccessible::GetRole(PRUint32 *aRole)
|
|||
}
|
||||
|
||||
/* PRUint8 getAccNumActions (); */
|
||||
NS_IMETHODIMP nsAccessible::GetNumActions(PRUint8 *_retval)
|
||||
NS_IMETHODIMP nsAccessible::GetNumActions(PRUint8 *aNumActions)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content && content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::onclick)) {
|
||||
*aNumActions = 1;
|
||||
} else {
|
||||
*aNumActions = 0;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* DOMString getAccActionName (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsAccessible::GetActionName(PRUint8 index, nsAString& _retval)
|
||||
NS_IMETHODIMP nsAccessible::GetActionName(PRUint8 index, nsAString& aName)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content && content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::onclick)) {
|
||||
// Action 0 (default action): Click on element
|
||||
if (index == eAction_Click) {
|
||||
nsAccessible::GetTranslatedString(NS_LITERAL_STRING("click"), aName);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* void doAction (in PRUint8 index); */
|
||||
NS_IMETHODIMP nsAccessible::DoAction(PRUint8 index)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
if (content && content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::onclick)) {
|
||||
// Action 0 (default action): Click on element
|
||||
if (index == eAction_Click) {
|
||||
nsCOMPtr<nsPresContext> presContext(GetPresContext());
|
||||
if (presContext && content) {
|
||||
nsMouseEvent linkClickEvent(PR_TRUE, NS_MOUSE_LEFT_CLICK, nsnull,
|
||||
nsMouseEvent::eReal);
|
||||
|
||||
nsEventStatus eventStatus = nsEventStatus_eIgnore;
|
||||
content->HandleDOMEvent(presContext,
|
||||
&linkClickEvent,
|
||||
nsnull,
|
||||
NS_EVENT_FLAG_INIT,
|
||||
&eventStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* DOMString getHelp (); */
|
||||
|
|
Загрузка…
Ссылка в новой задаче