Bug 767269 - ia2Accessible Text/EditableText QI shouldn't call QI for nsIAccessible Text/EditableText, r=tbsaunde

This commit is contained in:
Mark Capella 2012-07-01 23:42:45 -04:00
parent 7b6abb6f47
commit 3273de0738
7 changed files with 25 additions and 71 deletions

View File

@ -12,10 +12,31 @@
NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap,
HyperTextAccessible)
IMPL_IUNKNOWN_INHERITED2(HyperTextAccessibleWrap,
AccessibleWrap,
ia2AccessibleHypertext,
ia2AccessibleEditableText);
STDMETHODIMP
HyperTextAccessibleWrap::QueryInterface(REFIID aIID, void** aInstancePtr)
{
if (!aInstancePtr)
return E_FAIL;
*aInstancePtr = NULL;
if (IsTextRole()) {
if (aIID == IID_IAccessibleText)
*aInstancePtr =
static_cast<IAccessibleText*>(static_cast<ia2AccessibleText*>(this));
else if (aIID == IID_IAccessibleHypertext)
*aInstancePtr = static_cast<IAccessibleHypertext*>(this);
else if (aIID == IID_IAccessibleEditableText)
*aInstancePtr = static_cast<IAccessibleEditableText*>(this);
if (*aInstancePtr) {
AddRef();
return S_OK;
}
}
return AccessibleWrap::QueryInterface(aIID, aInstancePtr);
}
nsresult
HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)

View File

@ -13,25 +13,6 @@
#include "nsCOMPtr.h"
#include "nsString.h"
// IUnknown
STDMETHODIMP
ia2AccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleEditableText == iid) {
nsCOMPtr<nsIAccessibleEditableText> editTextAcc(do_QueryObject(this));
if (!editTextAcc)
return E_NOINTERFACE;
*ppv = static_cast<IAccessibleEditableText*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// IAccessibleEditableText
STDMETHODIMP

View File

@ -17,9 +17,6 @@ class ia2AccessibleEditableText: public IAccessibleEditableText
{
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleEditableText
virtual HRESULT STDMETHODCALLTYPE copyText(
/* [in] */ long startOffset,

View File

@ -11,25 +11,6 @@
#include "HyperTextAccessibleWrap.h"
// IUnknown
STDMETHODIMP
ia2AccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleHypertext == iid) {
HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperAcc->IsTextRole()) {
*ppv = static_cast<IAccessibleHypertext*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
return ia2AccessibleText::QueryInterface(iid, ppv);
}
// IAccessibleHypertext
STDMETHODIMP

View File

@ -18,9 +18,6 @@ class ia2AccessibleHypertext : public ia2AccessibleText,
{
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleText
FORWARD_IACCESSIBLETEXT(ia2AccessibleText)

View File

@ -14,26 +14,6 @@
#include "nsIPersistentProperties2.h"
// IUnknown
STDMETHODIMP
ia2AccessibleText::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleText == iid) {
nsCOMPtr<nsIAccessibleText> textAcc(do_QueryObject(this));
if (!textAcc) {
return E_NOINTERFACE;
}
*ppv = static_cast<IAccessibleText*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// IAccessibleText
STDMETHODIMP

View File

@ -17,9 +17,6 @@ class ia2AccessibleText: public IAccessibleText
{
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleText
virtual HRESULT STDMETHODCALLTYPE addSelection(
/* [in] */ long startOffset,