зеркало из https://github.com/mozilla/pjs.git
Bug 334650 When tabbing between links, link-selected events do not seem
to be issued reliably (fix for image link) r=aaronleventhal sr=darin
This commit is contained in:
Родитель
8ae55f592b
Коммит
1db0e95880
|
@ -349,6 +349,7 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
|
|||
|
||||
case nsIAccessibleEvent::EVENT_ATK_LINK_SELECTED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_ATK_LINK_SELECTED\n"));
|
||||
atk_focus_tracker_notify(accWrap->GetAtkObject());
|
||||
g_signal_emit_by_name(accWrap->GetAtkObject(),
|
||||
"link_selected",
|
||||
// Selected link index
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
|
@ -524,6 +525,25 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
|||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
nsCOMPtr<nsIDOMHTMLAnchorElement> anchorElement(do_QueryInterface(targetNode));
|
||||
// For ATK, check whether this link is for an image.
|
||||
// If so, fire event for the image.
|
||||
if (anchorElement) {
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
if (NS_SUCCEEDED(targetNode->GetFirstChild(getter_AddRefs(childNode)))) {
|
||||
while (childNode) {
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> imgNode(do_QueryInterface(childNode));
|
||||
if (imgNode) {
|
||||
anchorElement = nsnull; // ignore the link
|
||||
targetNode = childNode; // only fire event for image
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> tmpNode;
|
||||
tmpNode.swap(childNode);
|
||||
tmpNode->GetNextSibling(getter_AddRefs(childNode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (anchorElement) {
|
||||
nsCOMPtr<nsIDOMNode> blockNode;
|
||||
// For ATK, we don't create any individual object for hyperlink, use its parent who has block frame instead
|
||||
|
@ -789,7 +809,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
|||
else if (anchorElement) {
|
||||
nsCOMPtr<nsIAccessibleHyperText> hyperText(do_QueryInterface(accessible));
|
||||
if (hyperText) {
|
||||
nsCOMPtr<nsIDOMNode> focusedNode(do_QueryInterface(anchorElement));
|
||||
nsCOMPtr<nsIDOMNode> focusedNode(do_QueryInterface(anchorElement));
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
gLastFocusedNode = focusedNode;
|
||||
NS_IF_ADDREF(gLastFocusedNode);
|
||||
|
|
Загрузка…
Ссылка в новой задаче