mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 539683 - defunct object methods should return CO_E_OBJNOTCONNECTED, patch=tbsaunde, surkov, r=surkov, tbsaunde
This commit is contained in:
parent
46695bea53
commit
2cbd610e66
@ -80,8 +80,8 @@ __try {
|
||||
*aY = 0;
|
||||
|
||||
nsRefPtr<nsAccessible> acc(do_QueryObject(this));
|
||||
if (!acc)
|
||||
return E_FAIL;
|
||||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// If the object is not on any screen the returned position is (0,0).
|
||||
PRUint64 state = acc->State();
|
||||
@ -128,7 +128,7 @@ CAccessibleComponent::get_foreground(IA2Color* aForeground)
|
||||
__try {
|
||||
nsRefPtr<nsAccessible> acc(do_QueryObject(this));
|
||||
if (acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsIFrame* frame = acc->GetFrame();
|
||||
if (frame)
|
||||
@ -147,7 +147,7 @@ CAccessibleComponent::get_background(IA2Color* aBackground)
|
||||
__try {
|
||||
nsRefPtr<nsAccessible> acc(do_QueryObject(this));
|
||||
if (acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsIFrame* frame = acc->GetFrame();
|
||||
if (frame)
|
||||
|
@ -40,20 +40,12 @@
|
||||
|
||||
#include "CAccessibleEditableText.h"
|
||||
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
#include "AccessibleEditableText_i.c"
|
||||
#include "nsAccessNodeWrap.h"
|
||||
#include "nsHyperTextAccessible.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define GET_NSIACCESSIBLEEDITABLETEXT \
|
||||
nsCOMPtr<nsIAccessibleEditableText> textAcc(do_QueryObject(this));\
|
||||
NS_ASSERTION(textAcc,\
|
||||
"Subclass of CAccessibleEditableText doesn't implement nsIAccessibleEditableText");\
|
||||
if (!textAcc)\
|
||||
return E_FAIL;\
|
||||
|
||||
// IUnknown
|
||||
|
||||
STDMETHODIMP
|
||||
@ -79,7 +71,9 @@ STDMETHODIMP
|
||||
CAccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
__try {
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->CopyText(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
@ -92,7 +86,9 @@ STDMETHODIMP
|
||||
CAccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
__try {
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
@ -105,7 +101,9 @@ STDMETHODIMP
|
||||
CAccessibleEditableText::insertText(long aOffset, BSTR *aText)
|
||||
{
|
||||
__try {
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 length = ::SysStringLen(*aText);
|
||||
nsAutoString text(*aText, length);
|
||||
@ -121,7 +119,9 @@ STDMETHODIMP
|
||||
CAccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
__try {
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->CutText(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
@ -134,7 +134,9 @@ STDMETHODIMP
|
||||
CAccessibleEditableText::pasteText(long aOffset)
|
||||
{
|
||||
__try {
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->PasteText(aOffset);
|
||||
return GetHRESULT(rv);
|
||||
@ -148,7 +150,9 @@ CAccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
|
||||
BSTR *aText)
|
||||
{
|
||||
__try {
|
||||
GET_NSIACCESSIBLEEDITABLETEXT
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -76,12 +76,15 @@ __try {
|
||||
VariantInit(aAnchor);
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
if (thisObj->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!thisObj->IsLink())
|
||||
return S_FALSE;
|
||||
|
||||
nsAccessibleWrap* anchor =
|
||||
static_cast<nsAccessibleWrap*>(thisObj->AnchorAt(aIndex));
|
||||
if (!anchor)
|
||||
@ -108,12 +111,15 @@ __try {
|
||||
VariantInit(aAnchorTarget);
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
if (thisObj->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!thisObj->IsLink())
|
||||
return S_FALSE;
|
||||
|
||||
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
|
||||
if (!uri)
|
||||
return S_FALSE;
|
||||
@ -148,8 +154,11 @@ __try {
|
||||
*aIndex = 0;
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
if (thisObj->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (!thisObj->IsLink())
|
||||
return S_FALSE;
|
||||
|
||||
*aIndex = thisObj->StartOffset();
|
||||
return S_OK;
|
||||
@ -165,8 +174,11 @@ __try {
|
||||
*aIndex = 0;
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
if (thisObj->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (!thisObj->IsLink())
|
||||
return S_FALSE;
|
||||
|
||||
*aIndex = thisObj->EndOffset();
|
||||
return S_OK;
|
||||
@ -182,8 +194,11 @@ __try {
|
||||
*aValid = false;
|
||||
|
||||
nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
|
||||
if (thisObj->IsDefunct() || !thisObj->IsLink())
|
||||
return E_FAIL;
|
||||
if (thisObj->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (!thisObj->IsLink())
|
||||
return S_FALSE;
|
||||
|
||||
*aValid = thisObj->IsLinkValid();
|
||||
return S_OK;
|
||||
|
@ -72,8 +72,8 @@ __try {
|
||||
*aHyperlinkCount = 0;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(this);
|
||||
if (!hyperText)
|
||||
return E_FAIL;
|
||||
if (hyperText->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aHyperlinkCount = hyperText->GetLinkCount();
|
||||
return S_OK;
|
||||
@ -90,8 +90,8 @@ __try {
|
||||
*aHyperlink = NULL;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(this);
|
||||
if (!hyperText)
|
||||
return E_FAIL;
|
||||
if (hyperText->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(hyperLink));
|
||||
@ -118,8 +118,8 @@ __try {
|
||||
*aHyperlinkIndex = 0;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> hyperAcc(do_QueryObject(this));
|
||||
if (!hyperAcc)
|
||||
return E_FAIL;
|
||||
if (hyperAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aHyperlinkIndex = hyperAcc->GetLinkIndexAtOffset(aCharIndex);
|
||||
return S_OK;
|
||||
|
@ -74,6 +74,9 @@ CAccessibleText::addSelection(long aStartOffset, long aEndOffset)
|
||||
{
|
||||
__try {
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->AddSelection(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
|
||||
@ -94,6 +97,8 @@ __try {
|
||||
*aTextAttributes = NULL;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
@ -124,6 +129,8 @@ __try {
|
||||
*aOffset = -1;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRInt32 offset = 0;
|
||||
nsresult rv = textAcc->GetCaretOffset(&offset);
|
||||
@ -150,6 +157,8 @@ __try {
|
||||
*aHeight = 0;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
@ -179,7 +188,7 @@ __try {
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRInt32 selCount = 0;
|
||||
nsresult rv = textAcc->GetSelectionCount(&selCount);
|
||||
@ -202,6 +211,8 @@ __try {
|
||||
*aOffset = 0;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
@ -228,6 +239,8 @@ __try {
|
||||
*aEndOffset = 0;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRInt32 startOffset = 0, endOffset = 0;
|
||||
nsresult rv = textAcc->GetSelectionBounds(aSelectionIndex,
|
||||
@ -250,6 +263,8 @@ __try {
|
||||
*aText = NULL;
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString text;
|
||||
nsresult rv = textAcc->GetText(aStartOffset, aEndOffset, text);
|
||||
@ -279,7 +294,7 @@ __try {
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString text;
|
||||
@ -326,7 +341,7 @@ __try {
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString text;
|
||||
@ -373,7 +388,7 @@ __try {
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString text;
|
||||
@ -412,6 +427,8 @@ CAccessibleText::removeSelection(long aSelectionIndex)
|
||||
{
|
||||
__try {
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->RemoveSelection(aSelectionIndex);
|
||||
return GetHRESULT(rv);
|
||||
@ -425,6 +442,8 @@ CAccessibleText::setCaretOffset(long aOffset)
|
||||
{
|
||||
__try {
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->SetCaretOffset(aOffset);
|
||||
return GetHRESULT(rv);
|
||||
@ -439,6 +458,8 @@ CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
|
||||
{
|
||||
__try {
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->SetSelectionBounds(aSelectionIndex,
|
||||
aStartOffset, aEndOffset);
|
||||
@ -456,7 +477,7 @@ __try {
|
||||
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aNCharacters = textAcc->CharacterCount();
|
||||
return S_OK;
|
||||
@ -471,6 +492,8 @@ CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
|
||||
{
|
||||
__try {
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
|
||||
return GetHRESULT(rv);
|
||||
@ -486,6 +509,8 @@ CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
|
||||
{
|
||||
__try {
|
||||
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
|
@ -73,7 +73,7 @@ __try {
|
||||
|
||||
nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aActionCount = acc->ActionCount();
|
||||
return S_OK;
|
||||
@ -88,7 +88,7 @@ ia2AccessibleAction::doAction(long aActionIndex)
|
||||
__try {
|
||||
nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint8 index = static_cast<PRUint8>(aActionIndex);
|
||||
nsresult rv = acc->DoAction(index);
|
||||
@ -106,7 +106,7 @@ __try {
|
||||
|
||||
nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString description;
|
||||
PRUint8 index = static_cast<PRUint8>(aActionIndex);
|
||||
@ -144,7 +144,7 @@ __try {
|
||||
|
||||
nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// Expose keyboard shortcut if it's not exposed via MSAA keyboard shortcut.
|
||||
KeyBinding keyBinding = acc->AccessKey();
|
||||
@ -183,7 +183,7 @@ __try {
|
||||
|
||||
nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString name;
|
||||
PRUint8 index = static_cast<PRUint8>(aActionIndex);
|
||||
|
@ -168,7 +168,7 @@ __try {
|
||||
*ppdispParent = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsRefPtr<nsDocAccessible> doc(do_QueryObject(this));
|
||||
if (doc) {
|
||||
@ -210,7 +210,7 @@ __try {
|
||||
*pcountChildren = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (nsAccUtils::MustPrune(this))
|
||||
return S_OK;
|
||||
@ -228,7 +228,7 @@ STDMETHODIMP nsAccessibleWrap::get_accChild(
|
||||
__try {
|
||||
*ppdispChild = NULL;
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// IAccessible::accChild is used to return this accessible or child accessible
|
||||
// at the given index or to get an accessible by child ID in the case of
|
||||
@ -236,12 +236,17 @@ __try {
|
||||
// on the document accessible). The getting an accessible by child ID is used
|
||||
// by AccessibleObjectFromEvent() called by AT when AT handles our MSAA event.
|
||||
nsAccessible* child = GetXPAccessibleFor(varChild);
|
||||
if (child)
|
||||
*ppdispChild = NativeAccessible(child);
|
||||
if (!child)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (child->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*ppdispChild = NativeAccessible(child);
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return (*ppdispChild)? S_OK: E_INVALIDARG;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsAccessibleWrap::get_accName(
|
||||
@ -250,9 +255,17 @@ STDMETHODIMP nsAccessibleWrap::get_accName(
|
||||
{
|
||||
__try {
|
||||
*pszName = NULL;
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_FAIL;
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = xpAccessible->GetName(name);
|
||||
if (NS_FAILED(rv))
|
||||
@ -281,9 +294,15 @@ STDMETHODIMP nsAccessibleWrap::get_accValue(
|
||||
__try {
|
||||
*pszValue = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible || xpAccessible->IsDefunct())
|
||||
return E_FAIL;
|
||||
if (!xpAccessible)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (xpAccessible->NativeRole() == roles::PASSWORD_TEXT)
|
||||
return E_ACCESSDENIED;
|
||||
@ -312,9 +331,15 @@ nsAccessibleWrap::get_accDescription(VARIANT varChild,
|
||||
__try {
|
||||
*pszDescription = NULL;
|
||||
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible || xpAccessible->IsDefunct())
|
||||
return E_FAIL;
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString description;
|
||||
xpAccessible->Description(description);
|
||||
@ -335,11 +360,14 @@ __try {
|
||||
VariantInit(pvarRole);
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_FAIL;
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
#ifdef DEBUG_A11Y
|
||||
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
|
||||
@ -412,9 +440,15 @@ __try {
|
||||
pvarState->vt = VT_I4;
|
||||
pvarState->lVal = 0;
|
||||
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_FAIL;
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// MSAA only has 31 states and the lowest 31 bits of our state bit mask
|
||||
// are the same states as MSAA.
|
||||
@ -469,9 +503,15 @@ __try {
|
||||
return E_INVALIDARG;
|
||||
*pszKeyboardShortcut = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* acc = GetXPAccessibleFor(varChild);
|
||||
if (!acc || acc->IsDefunct())
|
||||
return E_FAIL;
|
||||
if (!acc)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (acc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
KeyBinding keyBinding = acc->AccessKey();
|
||||
if (keyBinding.IsEmpty())
|
||||
@ -498,7 +538,7 @@ STDMETHODIMP nsAccessibleWrap::get_accFocus(
|
||||
// for the child object with the keyboard focus.
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
VariantInit(pvarChild);
|
||||
|
||||
@ -672,6 +712,9 @@ __try {
|
||||
VariantInit(pvarChildren);
|
||||
pvarChildren->vt = VT_EMPTY;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (IsSelect()) {
|
||||
nsCOMPtr<nsIArray> selectedItems = SelectedItems();
|
||||
if (selectedItems) {
|
||||
@ -696,16 +739,24 @@ STDMETHODIMP nsAccessibleWrap::get_accDefaultAction(
|
||||
{
|
||||
__try {
|
||||
*pszDefaultAction = NULL;
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (xpAccessible) {
|
||||
nsAutoString defaultAction;
|
||||
if (NS_FAILED(xpAccessible->GetActionName(0, defaultAction)))
|
||||
return E_FAIL;
|
||||
|
||||
*pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
|
||||
defaultAction.Length());
|
||||
return *pszDefaultAction ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString defaultAction;
|
||||
if (NS_FAILED(xpAccessible->GetActionName(0, defaultAction)))
|
||||
return E_FAIL;
|
||||
|
||||
*pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
|
||||
defaultAction.Length());
|
||||
return *pszDefaultAction ? S_OK : E_OUTOFMEMORY;
|
||||
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
@ -716,9 +767,16 @@ STDMETHODIMP nsAccessibleWrap::accSelect(
|
||||
/* [optional][in] */ VARIANT varChild)
|
||||
{
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// currently only handle focus and selection
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
NS_ENSURE_TRUE(xpAccessible, E_FAIL);
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (flagsSelect & (SELFLAG_TAKEFOCUS|SELFLAG_TAKESELECTION|SELFLAG_REMOVESELECTION))
|
||||
{
|
||||
@ -752,19 +810,26 @@ STDMETHODIMP nsAccessibleWrap::accLocation(
|
||||
/* [optional][in] */ VARIANT varChild)
|
||||
{
|
||||
__try {
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (xpAccessible) {
|
||||
PRInt32 x, y, width, height;
|
||||
if (NS_FAILED(xpAccessible->GetBounds(&x, &y, &width, &height)))
|
||||
return E_FAIL;
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRInt32 x, y, width, height;
|
||||
if (NS_FAILED(xpAccessible->GetBounds(&x, &y, &width, &height)))
|
||||
return E_FAIL;
|
||||
|
||||
*pxLeft = x;
|
||||
*pyTop = y;
|
||||
*pcxWidth = width;
|
||||
*pcyHeight = height;
|
||||
return S_OK;
|
||||
|
||||
*pxLeft = x;
|
||||
*pyTop = y;
|
||||
*pcxWidth = width;
|
||||
*pcyHeight = height;
|
||||
return S_OK;
|
||||
}
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_FAIL;
|
||||
@ -779,9 +844,15 @@ __try {
|
||||
if (!pvarEndUpAt)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* accessible = GetXPAccessibleFor(varStart);
|
||||
if (!accessible || accessible->IsDefunct())
|
||||
return E_FAIL;
|
||||
if (!accessible)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (accessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
VariantInit(pvarEndUpAt);
|
||||
|
||||
@ -886,8 +957,9 @@ STDMETHODIMP nsAccessibleWrap::accHitTest(
|
||||
{
|
||||
__try {
|
||||
VariantInit(pvarChild);
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
|
||||
|
||||
@ -915,12 +987,20 @@ STDMETHODIMP nsAccessibleWrap::accDoDefaultAction(
|
||||
/* [optional][in] */ VARIANT varChild)
|
||||
{
|
||||
__try {
|
||||
nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible || FAILED(xpAccessible->DoAction(0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
|
||||
if (!xpAccessible)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (xpAccessible->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
return GetHRESULT(xpAccessible->DoAction(0));
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsAccessibleWrap::put_accName(
|
||||
@ -1035,7 +1115,7 @@ __try {
|
||||
*aNRelations = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
|
||||
relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
|
||||
@ -1059,7 +1139,7 @@ __try {
|
||||
*aRelation = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 relIdx = 0;
|
||||
for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
|
||||
@ -1094,7 +1174,7 @@ __try {
|
||||
*aNRelations = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
|
||||
relType <= nsIAccessibleRelation::RELATION_LAST &&
|
||||
@ -1120,7 +1200,7 @@ __try {
|
||||
*aRole = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
NS_ASSERTION(gWindowsRoleMap[roles::LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
|
||||
"MSAA role map skewed");
|
||||
@ -1146,6 +1226,9 @@ STDMETHODIMP
|
||||
nsAccessibleWrap::scrollTo(enum IA2ScrollType aScrollType)
|
||||
{
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAccessNode::ScrollTo(aScrollType);
|
||||
return S_OK;
|
||||
|
||||
@ -1158,6 +1241,9 @@ nsAccessibleWrap::scrollToPoint(enum IA2CoordinateType aCoordType,
|
||||
long aX, long aY)
|
||||
{
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
@ -1175,6 +1261,9 @@ nsAccessibleWrap::get_groupPosition(long *aGroupLevel,
|
||||
long *aPositionInGroup)
|
||||
{
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
PRInt32 groupLevel = 0;
|
||||
PRInt32 similarItemsInGroup = 0;
|
||||
PRInt32 positionInGroup = 0;
|
||||
@ -1206,6 +1295,9 @@ nsAccessibleWrap::get_states(AccessibleStates *aStates)
|
||||
__try {
|
||||
*aStates = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
// XXX: bug 344674 should come with better approach that we have here.
|
||||
|
||||
PRUint64 state = State();
|
||||
@ -1328,7 +1420,7 @@ __try {
|
||||
*aWindowHandle = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aWindowHandle = GetHWNDFor(this);
|
||||
return S_OK;
|
||||
@ -1346,7 +1438,7 @@ __try {
|
||||
|
||||
*aIndexInParent = -1;
|
||||
if (IsDefunct())
|
||||
return E_FAIL;
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aIndexInParent = IndexInParent();
|
||||
if (*aIndexInParent == -1)
|
||||
@ -1366,6 +1458,9 @@ __try {
|
||||
// Two-letter primary codes are reserved for [ISO639] language abbreviations.
|
||||
// Any two-letter subcode is understood to be a [ISO3166] country code.
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString lang;
|
||||
Language(lang);
|
||||
|
||||
@ -1409,6 +1504,9 @@ nsAccessibleWrap::get_attributes(BSTR *aAttributes)
|
||||
__try {
|
||||
*aAttributes = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
nsresult rv = GetAttributes(getter_AddRefs(attributes));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -102,6 +102,9 @@ nsApplicationAccessibleWrap::get_appName(BSTR *aName)
|
||||
__try {
|
||||
*aName = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = GetAppName(name);
|
||||
if (NS_FAILED(rv))
|
||||
@ -123,6 +126,9 @@ nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
|
||||
__try {
|
||||
*aVersion = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString version;
|
||||
nsresult rv = GetAppVersion(version);
|
||||
if (NS_FAILED(rv))
|
||||
@ -142,6 +148,9 @@ STDMETHODIMP
|
||||
nsApplicationAccessibleWrap::get_toolkitName(BSTR *aName)
|
||||
{
|
||||
__try {
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString name;
|
||||
nsresult rv = GetPlatformName(name);
|
||||
if (NS_FAILED(rv))
|
||||
@ -163,6 +172,9 @@ nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
|
||||
__try {
|
||||
*aVersion = NULL;
|
||||
|
||||
if (IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString version;
|
||||
nsresult rv = GetPlatformVersion(version);
|
||||
if (NS_FAILED(rv))
|
||||
|
Loading…
Reference in New Issue
Block a user