From 7b769473fbe651c6f2e3e1cd4a824903c6353375 Mon Sep 17 00:00:00 2001 From: "aaronleventhal@moonset.net" Date: Wed, 26 Sep 2007 10:32:33 -0700 Subject: [PATCH] Bug 395923. The whole page's contents are repeated inside an anchor with no href. r=evan.yan, a=dsicore --- accessible/src/base/nsBaseWidgetAccessible.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index 80803c5501f..a2fc23b72e8 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -226,6 +226,11 @@ void nsLinkableAccessible::CacheActionContent() for (nsCOMPtr walkUpContent(do_QueryInterface(mDOMNode)); walkUpContent; walkUpContent = walkUpContent->GetParent()) { + if (nsAccUtils::HasListener(walkUpContent, NS_LITERAL_STRING("click"))) { + mActionContent = walkUpContent; + mIsOnclick = PR_TRUE; + break; + } nsIAtom *tag = walkUpContent->Tag(); if ((tag == nsAccessibilityAtoms::a || tag == nsAccessibilityAtoms::area) && walkUpContent->IsNodeOfType(nsINode::eHTML)) { @@ -242,11 +247,13 @@ void nsLinkableAccessible::CacheActionContent() break; } } - } - if (nsAccUtils::HasListener(walkUpContent, NS_LITERAL_STRING("click"))) { - mActionContent = walkUpContent; - mIsOnclick = PR_TRUE; - break; + if (SameCOMIdentity(mDOMNode, walkUpContent)) { + // This is the element that caused the creation of a linkable accessible + // Don't let it keep walking up, otherwise we may report the wrong container + // as the action node + mActionContent = walkUpContent; + break; + } } } }