Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
bug 657719 - followup nsAccessible::IsValid() -> nsAccessible::IsLink…
Browse files Browse the repository at this point in the history
…Valid() r=surkov

From e703a428b799fe24d5244e7a4566fd3fbe0f76a7 Mon Sep 17 00:00:00 2001
 nsAccessible::IsLinkValid()
---
 accessible/src/atk/nsMaiHyperlink.cpp        |    2 +-
 accessible/src/base/nsAccessible.cpp         |   14 +-------------
 accessible/src/base/nsAccessible.h           |   12 +++++++++++-
 accessible/src/msaa/CAccessibleHyperlink.cpp |    2 +-
 4 files changed, 14 insertions(+), 16 deletions(-)
  • Loading branch information
Trevor Saunders committed Jun 22, 2011
1 parent 690e96f commit 662ed7a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion accessible/src/atk/nsMaiHyperlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ isValidCB(AtkHyperlink *aLink)
nsAccessible* hyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(hyperlink, FALSE);

return static_cast<gboolean>(hyperlink->IsValid());
return static_cast<gboolean>(hyperlink->IsLinkValid());
}

gint
Expand Down
1 change: 1 addition & 0 deletions accessible/src/base/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ EXPORTS = \
nsAccessible.h \
nsAccessNode.h \
nsARIAMap.h \
States.h \
$(NULL)

# we don't want the shared lib, but we want to force the creation of a static lib.
Expand Down
14 changes: 1 addition & 13 deletions accessible/src/base/nsAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2612,7 +2612,7 @@ nsAccessible::GetValid(PRBool *aValid)
if (IsDefunct())
return NS_ERROR_FAILURE;

*aValid = IsValid();
*aValid = IsLinkValid();
return NS_OK;
}

Expand Down Expand Up @@ -2920,18 +2920,6 @@ nsAccessible::EndOffset()
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
}

bool
nsAccessible::IsValid()
{
NS_PRECONDITION(IsHyperLink(), "IsValid is called on not hyper link!");

return (0 == (State() & states::INVALID));
// XXX In order to implement this we would need to follow every link
// Perhaps we can get information about invalid links from the cache
// In the mean time authors can use role="link" aria-invalid="true"
// to force it for links they internally know to be invalid
}

PRUint32
nsAccessible::AnchorCount()
{
Expand Down
12 changes: 11 additions & 1 deletion accessible/src/base/nsAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#define _nsAccessible_H_

#include "nsAccessNodeWrap.h"
#include "States.h"

#include "nsIAccessible.h"
#include "nsIAccessibleHyperLink.h"
Expand Down Expand Up @@ -421,7 +422,16 @@ class nsAccessible : public nsAccessNodeWrap,
/**
* Return true if the link is valid (e. g. points to a valid URL).
*/
virtual bool IsValid();
inline bool IsLinkValid()
{
NS_PRECONDITION(IsHyperLink(), "IsLinkValid is called on not hyper link!");

// XXX In order to implement this we would need to follow every link
// Perhaps we can get information about invalid links from the cache
// In the mean time authors can use role="link" aria-invalid="true"
// to force it for links they internally know to be invalid
return (0 == (State() & states::INVALID));
}

/**
* Return true if the link currently has the focus.
Expand Down
2 changes: 1 addition & 1 deletion accessible/src/msaa/CAccessibleHyperlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ __try {
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
return E_FAIL;

*aValid = thisObj->IsValid();
*aValid = thisObj->IsLinkValid();
return S_OK;

} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
Expand Down

0 comments on commit 662ed7a

Please sign in to comment.