Bug 423603 - A elements with no HREF should not have state_linked, regression from bug 421066, patch=marco, aaronlev, r=aaronlev, marco, a=beltzner

This commit is contained in:
surkov.alexander@gmail.com 2008-03-19 19:05:35 -07:00
parent 74bbe79eb1
commit 009b028516
2 changed files with 9 additions and 2 deletions

View File

@ -272,7 +272,8 @@ nsLinkableAccessible::CacheActionContent()
GetAccService()->GetAccessibleInWeakShell(walkUpNode, mWeakShell,
getter_AddRefs(walkUpAcc));
if (walkUpAcc && Role(walkUpAcc) == nsIAccessibleRole::ROLE_LINK) {
if (walkUpAcc && Role(walkUpAcc) == nsIAccessibleRole::ROLE_LINK &&
(State(walkUpAcc) & nsIAccessibleStates::STATE_LINKED)) {
mIsLink = PR_TRUE;
mActionContent = walkUpContent;
return;

View File

@ -97,12 +97,18 @@ nsHTMLLinkAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
*aState |= nsIAccessibleStates::STATE_SELECTABLE;
}
*aState |= nsIAccessibleStates::STATE_LINKED;
nsCOMPtr<nsILink> link = do_QueryInterface(mDOMNode);
NS_ENSURE_STATE(link);
nsLinkState linkState;
link->GetLinkState(linkState);
if (linkState == eLinkState_NotLink) {
// This is a named anchor, not a link with also a name attribute. bail out.
return NS_OK;
}
*aState |= nsIAccessibleStates::STATE_LINKED;
if (linkState == eLinkState_Visited)
*aState |= nsIAccessibleStates::STATE_TRAVERSED;