bug 657719 - rename IsHyperlink() to IsLink() r=surkov

From cdac78ca863280f3ef9fd2b34a28e566230f60b8 Mon Sep 17 00:00:00 2001
---
 accessible/src/atk/nsAccessibleWrap.cpp            |    7 +++----
 accessible/src/atk/nsMaiHyperlink.cpp              |   12 ++++++------
 accessible/src/atk/nsMaiHyperlink.h                |    5 ++---
 accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp |   17 ++++++++---------
 accessible/src/base/nsAccessible.cpp               |   14 +++++++-------
 accessible/src/base/nsAccessible.h                 |    8 ++++----
 accessible/src/base/nsBaseWidgetAccessible.cpp     |    4 ++--
 accessible/src/html/nsHTMLLinkAccessible.cpp       |    2 +-
 accessible/src/html/nsHTMLLinkAccessible.h         |    2 +-
 accessible/src/msaa/CAccessibleHyperlink.cpp       |   12 ++++++------
 accessible/src/xul/nsXULTextAccessible.cpp         |    6 +++---
 accessible/src/xul/nsXULTextAccessible.h           |    2 +-
 12 files changed, 44 insertions(+), 47 deletions(-)
This commit is contained in:
Trevor Saunders 2011-06-23 21:29:43 -07:00
parent 1e7f9f7e34
commit b5577770b8
12 changed files with 43 additions and 46 deletions

View File

@ -450,10 +450,9 @@ nsAccessibleWrap::CreateMaiInterfaces(void)
interfacesBits |= 1 << MAI_INTERFACE_IMAGE;
}
// HyperLinkAccessible
if (IsHyperLink()) {
interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
}
// HyperLinkAccessible
if (IsLink())
interfacesBits |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
if (!nsAccUtils::MustPrune(this)) { // These interfaces require children
//nsIAccessibleHypertext

View File

@ -135,16 +135,16 @@ MaiHyperlink::~MaiHyperlink()
}
}
AtkHyperlink *
AtkHyperlink*
MaiHyperlink::GetAtkHyperlink(void)
{
NS_ENSURE_TRUE(mHyperlink, nsnull);
NS_ENSURE_TRUE(mHyperlink, nsnull);
if (mMaiAtkHyperlink)
return mMaiAtkHyperlink;
if (mMaiAtkHyperlink)
return mMaiAtkHyperlink;
if (!mHyperlink->IsHyperLink())
return nsnull;
if (!mHyperlink->IsLink())
return nsnull;
mMaiAtkHyperlink =
reinterpret_cast<AtkHyperlink *>

View File

@ -58,9 +58,8 @@ public:
public:
AtkHyperlink *GetAtkHyperlink(void);
nsAccessible* GetAccHyperlink(void) {
return mHyperlink && mHyperlink->IsHyperLink() ? mHyperlink : nsnull;
}
nsAccessible* GetAccHyperlink()
{ return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nsnull; }
protected:
nsAccessible* mHyperlink;

View File

@ -49,16 +49,15 @@ hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface)
}
AtkHyperlink*
getHyperlinkCB(AtkHyperlinkImpl *aImpl)
getHyperlinkCB(AtkHyperlinkImpl* aImpl)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
if (!accWrap)
return nsnull;
nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
if (!accWrap)
return nsnull;
NS_ENSURE_TRUE(accWrap->IsHyperLink(), nsnull);
MaiHyperlink *maiHyperlink = accWrap->GetMaiHyperlink();
NS_ENSURE_TRUE(maiHyperlink, nsnull);
return maiHyperlink->GetAtkHyperlink();
NS_ENSURE_TRUE(accWrap->IsLink(), nsnull);
MaiHyperlink* maiHyperlink = accWrap->GetMaiHyperlink();
NS_ENSURE_TRUE(maiHyperlink, nsnull);
return maiHyperlink->GetAtkHyperlink();
}

View File

@ -174,7 +174,7 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperLink))) {
if (IsHyperLink()) {
if (IsLink()) {
*aInstancePtr = static_cast<nsIAccessibleHyperLink*>(this);
NS_ADDREF_THIS();
return NS_OK;
@ -2895,7 +2895,7 @@ nsAccessible::GetIndexOfEmbeddedChild(nsAccessible* aChild)
// HyperLinkAccessible methods
bool
nsAccessible::IsHyperLink()
nsAccessible::IsLink()
{
// Every embedded accessible within hypertext accessible implements
// hyperlink interface.
@ -2905,7 +2905,7 @@ nsAccessible::IsHyperLink()
PRUint32
nsAccessible::StartOffset()
{
NS_PRECONDITION(IsHyperLink(), "StartOffset is called not on hyper link!");
NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
return hyperText ? hyperText->GetChildOffset(this) : 0;
@ -2914,7 +2914,7 @@ nsAccessible::StartOffset()
PRUint32
nsAccessible::EndOffset()
{
NS_PRECONDITION(IsHyperLink(), "EndOffset is called on not hyper link!");
NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
@ -2923,21 +2923,21 @@ nsAccessible::EndOffset()
PRUint32
nsAccessible::AnchorCount()
{
NS_PRECONDITION(IsHyperLink(), "AnchorCount is called on not hyper link!");
NS_PRECONDITION(IsLink(), "AnchorCount is called on not hyper link!");
return 1;
}
nsAccessible*
nsAccessible::AnchorAt(PRUint32 aAnchorIndex)
{
NS_PRECONDITION(IsHyperLink(), "GetAnchor is called on not hyper link!");
NS_PRECONDITION(IsLink(), "GetAnchor is called on not hyper link!");
return aAnchorIndex == 0 ? this : nsnull;
}
already_AddRefed<nsIURI>
nsAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
{
NS_PRECONDITION(IsHyperLink(), "AnchorURIAt is called on not hyper link!");
NS_PRECONDITION(IsLink(), "AnchorURIAt is called on not hyper link!");
if (aAnchorIndex != 0)
return nsnull;

View File

@ -407,7 +407,7 @@ public:
/**
* Return true if the accessible is hyper link accessible.
*/
virtual bool IsHyperLink();
virtual bool IsLink();
/**
* Return the start offset of the link within the parent accessible.
@ -424,7 +424,7 @@ public:
*/
inline bool IsLinkValid()
{
NS_PRECONDITION(IsHyperLink(), "IsLinkValid is called on not hyper link!");
NS_PRECONDITION(IsLink(), "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
@ -438,7 +438,7 @@ public:
*/
inline bool IsLinkSelected()
{
NS_PRECONDITION(IsHyperlink(),
NS_PRECONDITION(IsLink(),
"IsLinkSelected() called on something that is not a hyper link!");
return gLastFocusedNode == GetNode();
}

View File

@ -203,10 +203,10 @@ already_AddRefed<nsIURI>
nsLinkableAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
{
if (mIsLink) {
NS_ASSERTION(mActionAcc->IsHyperLink(),
NS_ASSERTION(mActionAcc->IsLink(),
"nsIAccessibleHyperLink isn't implemented.");
if (mActionAcc->IsHyperLink())
if (mActionAcc->IsLink())
return mActionAcc->AnchorURIAt(aAnchorIndex);
}

View File

@ -166,7 +166,7 @@ nsHTMLLinkAccessible::DoAction(PRUint8 aIndex)
// HyperLinkAccessible
bool
nsHTMLLinkAccessible::IsHyperLink()
nsHTMLLinkAccessible::IsLink()
{
// Expose HyperLinkAccessible unconditionally.
return true;

View File

@ -61,7 +61,7 @@ public:
virtual PRUint64 NativeState();
// HyperLinkAccessible
virtual bool IsHyperLink();
virtual bool IsLink();
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
protected:

View File

@ -56,7 +56,7 @@ CAccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
if (IID_IAccessibleHyperlink == iid) {
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
if (!thisObj->IsHyperLink())
if (!thisObj->IsLink())
return E_NOINTERFACE;
*ppv = static_cast<IAccessibleHyperlink*>(this);
@ -76,7 +76,7 @@ __try {
VariantInit(aAnchor);
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
if (thisObj->IsDefunct() || !thisObj->IsLink())
return E_FAIL;
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
@ -111,7 +111,7 @@ __try {
VariantInit(aAnchorTarget);
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
if (thisObj->IsDefunct() || !thisObj->IsLink())
return E_FAIL;
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
@ -151,7 +151,7 @@ __try {
*aIndex = 0;
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
if (thisObj->IsDefunct() || !thisObj->IsLink())
return E_FAIL;
*aIndex = thisObj->StartOffset();
@ -168,7 +168,7 @@ __try {
*aIndex = 0;
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
if (thisObj->IsDefunct() || !thisObj->IsLink())
return E_FAIL;
*aIndex = thisObj->EndOffset();
@ -185,7 +185,7 @@ __try {
*aValid = false;
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
if (thisObj->IsDefunct() || !thisObj->IsHyperLink())
if (thisObj->IsDefunct() || !thisObj->IsLink())
return E_FAIL;
*aValid = thisObj->IsLinkValid();

View File

@ -225,7 +225,7 @@ nsXULLinkAccessible::DoAction(PRUint8 aIndex)
// nsXULLinkAccessible: HyperLinkAccessible
bool
nsXULLinkAccessible::IsHyperLink()
nsXULLinkAccessible::IsLink()
{
// Expose HyperLinkAccessible unconditionally.
return true;
@ -239,7 +239,7 @@ nsXULLinkAccessible::StartOffset()
// a text.
// XXX: accessible parent of XUL link accessible should be a hypertext
// accessible.
if (nsAccessible::IsHyperLink())
if (nsAccessible::IsLink())
return nsAccessible::StartOffset();
return IndexInParent();
}
@ -247,7 +247,7 @@ nsXULLinkAccessible::StartOffset()
PRUint32
nsXULLinkAccessible::EndOffset()
{
if (nsAccessible::IsHyperLink())
if (nsAccessible::IsLink())
return nsAccessible::EndOffset();
return IndexInParent() + 1;
}

View File

@ -97,7 +97,7 @@ public:
virtual PRUint64 NativeState();
// HyperLinkAccessible
virtual bool IsHyperLink();
virtual bool IsLink();
virtual PRUint32 StartOffset();
virtual PRUint32 EndOffset();
virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);