Bug 416756. Handle crashes in all a11y COM interfaces. r=surkov, a=schrep

This commit is contained in:
aaronleventhal@moonset.net 2008-02-12 07:48:51 -08:00
Родитель 49a49cbc27
Коммит aef1433652
18 изменённых файлов: 481 добавлений и 83 удалений

Просмотреть файл

@ -43,7 +43,7 @@
#include "AccessibleAction_i.c"
#include "nsIAccessible.h"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIDOMDOMStringList.h"
@ -69,6 +69,7 @@ CAccessibleAction::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleAction::nActions(long *aNumActions)
{
__try {
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
@ -79,12 +80,15 @@ CAccessibleAction::nActions(long *aNumActions)
if (NS_SUCCEEDED(rv))
return NS_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleAction::doAction(long aActionIndex)
{
__try {
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
@ -92,12 +96,15 @@ CAccessibleAction::doAction(long aActionIndex)
PRUint8 index = static_cast<PRUint8>(aActionIndex);
if (NS_SUCCEEDED(acc->DoAction(index)))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleAction::get_description(long aActionIndex, BSTR *aDescription)
{
__try {
*aDescription = NULL;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
@ -115,6 +122,7 @@ CAccessibleAction::get_description(long aActionIndex, BSTR *aDescription)
if (!result)
return E_OUTOFMEMORY;
}
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -124,6 +132,7 @@ CAccessibleAction::get_keyBinding(long aActionIndex, long aNumMaxBinding,
BSTR **aKeyBinding,
long *aNumBinding)
{
__try {
*aKeyBinding = NULL;
aNumBinding = 0;
@ -159,6 +168,7 @@ CAccessibleAction::get_keyBinding(long aActionIndex, long aNumMaxBinding,
if (!result)
return E_OUTOFMEMORY;
}
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -166,6 +176,7 @@ CAccessibleAction::get_keyBinding(long aActionIndex, long aNumMaxBinding,
STDMETHODIMP
CAccessibleAction::get_name(long aActionIndex, BSTR *aName)
{
__try {
*aName = NULL;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
@ -182,6 +193,7 @@ CAccessibleAction::get_name(long aActionIndex, BSTR *aName)
if (!result)
return E_OUTOFMEMORY;
}
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsIAccessNode.h"
#include "nsIAccessible.h"
#include "nsIAccessibleStates.h"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -80,6 +81,7 @@ CAccessibleComponent::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleComponent::get_locationInParent(long *aX, long *aY)
{
__try {
*aX = 0;
*aY = 0;
@ -124,6 +126,7 @@ CAccessibleComponent::get_locationInParent(long *aX, long *aY)
*aX = x - parentx;
*aY = y - parenty;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -131,20 +134,29 @@ CAccessibleComponent::get_locationInParent(long *aX, long *aY)
STDMETHODIMP
CAccessibleComponent::get_foreground(IA2Color *aForeground)
{
__try {
return GetARGBValueFromCSSProperty(NS_LITERAL_STRING("color"), aForeground);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleComponent::get_background(IA2Color *aBackground)
{
__try {
return GetARGBValueFromCSSProperty(NS_LITERAL_STRING("background-color"),
aBackground);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
HRESULT
CAccessibleComponent::GetARGBValueFromCSSProperty(const nsAString& aPropName,
IA2Color *aColorValue)
{
__try {
*aColorValue = 0;
nsCOMPtr<nsIAccessNode> acc(do_QueryInterface(this));
@ -215,6 +227,7 @@ CAccessibleComponent::GetARGBValueFromCSSProperty(const nsAString& aPropName,
(((IA2Color) green) << IA2GreenShift) |
(((IA2Color) red) << IA2RedShift) |
(((IA2Color) (alpha * 0xff)) << IA2AlphaShift);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

Просмотреть файл

@ -42,6 +42,7 @@
#include "nsIAccessibleEditableText.h"
#include "AccessibleEditableText_i.c"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -77,55 +78,81 @@ CAccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
{
__try {
GET_NSIACCESSIBLEEDITABLETEXT
nsresult rv = textAcc->CopyText(aStartOffset, aEndOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
{
__try {
GET_NSIACCESSIBLEEDITABLETEXT
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleEditableText::insertText(long aOffset, BSTR *aText)
{
__try {
GET_NSIACCESSIBLEEDITABLETEXT
PRUint32 length = ::SysStringLen(*aText);
nsAutoString text(*aText, length);
nsresult rv = textAcc->InsertText(text, aOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
{
__try {
GET_NSIACCESSIBLEEDITABLETEXT
nsresult rv = textAcc->CutText(aStartOffset, aEndOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleEditableText::pasteText(long aOffset)
{
__try {
GET_NSIACCESSIBLEEDITABLETEXT
nsresult rv = textAcc->PasteText(aOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
BSTR *aText)
{
__try {
GET_NSIACCESSIBLEEDITABLETEXT
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
@ -136,7 +163,11 @@ CAccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
nsAutoString text(*aText, length);
rv = textAcc->InsertText(text, aStartOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP

Просмотреть файл

@ -47,6 +47,7 @@
#include "nsIAccessible.h"
#include "nsIAccessibleHyperlink.h"
#include "nsIWinAccessNode.h"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -78,6 +79,7 @@ CAccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleHyperlink::get_anchor(long aIndex, VARIANT *aAnchor)
{
__try {
VariantInit(aAnchor);
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
@ -102,6 +104,7 @@ CAccessibleHyperlink::get_anchor(long aIndex, VARIANT *aAnchor)
IUnknown *unknownPtr = static_cast<IUnknown*>(instancePtr);
aAnchor->ppunkVal = &unknownPtr;
aAnchor->vt = VT_UNKNOWN;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -109,6 +112,7 @@ CAccessibleHyperlink::get_anchor(long aIndex, VARIANT *aAnchor)
STDMETHODIMP
CAccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT *aAnchorTarget)
{
__try {
VariantInit(aAnchorTarget);
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
@ -135,14 +139,17 @@ CAccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT *aAnchorTarget)
AppendUTF8toUTF16(path, stringURI);
aAnchorTarget->vt = VT_BSTR;
INT result = ::SysReAllocStringLen(&aAnchorTarget->bstrVal, stringURI.get(),
stringURI.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(&aAnchorTarget->bstrVal, stringURI.get(), stringURI.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
CAccessibleHyperlink::get_startIndex(long *aIndex)
{
__try {
*aIndex = 0;
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
@ -152,13 +159,17 @@ CAccessibleHyperlink::get_startIndex(long *aIndex)
PRInt32 index = 0;
nsresult rv = acc->GetStartIndex(&index);
*aIndex = index;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_FAILED(rv) ? E_FAIL : S_OK;
return E_FAIL;
}
STDMETHODIMP
CAccessibleHyperlink::get_endIndex(long *aIndex)
{
__try {
*aIndex = 0;
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
@ -169,12 +180,17 @@ CAccessibleHyperlink::get_endIndex(long *aIndex)
nsresult rv = acc->GetEndIndex(&index);
*aIndex = index;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleHyperlink::get_valid(boolean *aValid)
{
__try {
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
@ -182,7 +198,10 @@ CAccessibleHyperlink::get_valid(boolean *aValid)
PRBool isValid = PR_FALSE;
nsresult rv = acc->IsValid(&isValid);
*aValid = isValid;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_FAILED(rv) ? E_FAIL : S_OK;
return E_FAIL;
}

Просмотреть файл

@ -44,6 +44,7 @@
#include "nsIAccessibleHypertext.h"
#include "nsIWinAccessNode.h"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
@ -53,7 +54,6 @@ STDMETHODIMP
CAccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleHypertext == iid) {
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryInterface(this));
if (!hyperAcc)
@ -72,6 +72,7 @@ CAccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleHypertext::get_nHyperlinks(long *aHyperlinkCount)
{
__try {
*aHyperlinkCount = 0;
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryInterface(this));
@ -82,13 +83,17 @@ CAccessibleHypertext::get_nHyperlinks(long *aHyperlinkCount)
nsresult rv = hyperAcc->GetLinks(&count);
*aHyperlinkCount = count;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleHypertext::get_hyperlink(long aIndex,
IAccessibleHyperlink **aHyperlink)
{
__try {
*aHyperlink = NULL;
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryInterface(this));
@ -108,13 +113,17 @@ CAccessibleHypertext::get_hyperlink(long aIndex,
nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessibleHyperlink,
&instancePtr);
*aHyperlink = static_cast<IAccessibleHyperlink*>(instancePtr);
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_FAILED(rv) ? E_FAIL : S_OK;
return E_FAIL;
}
STDMETHODIMP
CAccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long *aHyperlinkIndex)
{
__try {
*aHyperlinkIndex = 0;
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryInterface(this));
@ -124,7 +133,10 @@ CAccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long *aHyperlinkIndex)
PRInt32 index = 0;
nsresult rv = hyperAcc->GetLinkIndex(aCharIndex, &index);
*aHyperlinkIndex = index;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_FAILED(rv) ? E_FAIL : S_OK;
return E_FAIL;
}

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsIAccessible.h"
#include "nsIAccessibleImage.h"
#include "nsIAccessibleTypes.h"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -74,6 +75,7 @@ CAccessibleImage::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleImage::get_description(BSTR *aDescription)
{
__try {
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
@ -83,9 +85,11 @@ CAccessibleImage::get_description(BSTR *aDescription)
if (NS_FAILED(rv))
return E_FAIL;
INT result = ::SysReAllocStringLen(aDescription, description.get(),
description.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aDescription, description.get(), description.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
@ -93,6 +97,7 @@ CAccessibleImage::get_imagePosition(enum IA2CoordinateType aCoordType,
long *aX,
long *aY)
{
__try {
*aX = 0;
*aY = 0;
@ -111,6 +116,7 @@ CAccessibleImage::get_imagePosition(enum IA2CoordinateType aCoordType,
*aX = x;
*aY = y;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -118,6 +124,7 @@ CAccessibleImage::get_imagePosition(enum IA2CoordinateType aCoordType,
STDMETHODIMP
CAccessibleImage::get_imageSize(long *aHeight, long *aWidth)
{
__try {
*aHeight = 0;
*aWidth = 0;
@ -132,6 +139,7 @@ CAccessibleImage::get_imageSize(long *aHeight, long *aWidth)
*aHeight = width;
*aWidth = height;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

Просмотреть файл

@ -46,6 +46,7 @@
#include "nsIAccessible.h"
#include "nsIAccessibleTable.h"
#include "nsIWinAccessNode.h"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -75,6 +76,7 @@ STDMETHODIMP
CAccessibleTable::get_accessibleAt(long aRow, long aColumn,
IUnknown **aAccessible)
{
__try {
*aAccessible = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -96,12 +98,15 @@ CAccessibleTable::get_accessibleAt(long aRow, long aColumn,
return E_FAIL;
*aAccessible = static_cast<IUnknown*>(instancePtr);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
CAccessibleTable::get_caption(IUnknown **aAccessible)
{
__try {
*aAccessible = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -123,6 +128,8 @@ CAccessibleTable::get_caption(IUnknown **aAccessible)
return E_FAIL;
*aAccessible = static_cast<IUnknown*>(instancePtr);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -130,6 +137,7 @@ STDMETHODIMP
CAccessibleTable::get_childIndex(long aRowIndex, long aColumnIndex,
long *aChildIndex)
{
__try {
*aChildIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -141,12 +149,17 @@ CAccessibleTable::get_childIndex(long aRowIndex, long aColumnIndex,
nsresult rv = tableAcc->GetIndexAt(aRowIndex, aColumnIndex, &childIndex);
*aChildIndex = childIndex;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_columnDescription(long aColumn, BSTR *aDescription)
{
__try {
*aDescription = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -159,14 +172,17 @@ CAccessibleTable::get_columnDescription(long aColumn, BSTR *aDescription)
if (NS_FAILED(rv))
return E_FAIL;
INT result = ::SysReAllocStringLen(aDescription, descr.get(), descr.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aDescription, descr.get(), descr.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
CAccessibleTable::get_columnExtentAt(long aRow, long aColumn,
long *nColumnsSpanned)
{
__try {
*nColumnsSpanned = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -178,13 +194,18 @@ CAccessibleTable::get_columnExtentAt(long aRow, long aColumn,
nsresult rv = tableAcc->GetColumnExtentAt(aRow, aColumn, &columnsSpanned);
*nColumnsSpanned = columnsSpanned;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_columnHeader(IAccessibleTable **aAccessibleTable,
long *aStartingRowIndex)
{
__try {
*aAccessibleTable = NULL;
// XXX: starting row index is always 0.
@ -210,12 +231,15 @@ CAccessibleTable::get_columnHeader(IAccessibleTable **aAccessibleTable,
return E_FAIL;
*aAccessibleTable = static_cast<IAccessibleTable*>(instancePtr);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
CAccessibleTable::get_columnIndex(long aChildIndex, long *aColumnIndex)
{
__try {
*aColumnIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -226,13 +250,17 @@ CAccessibleTable::get_columnIndex(long aChildIndex, long *aColumnIndex)
PRInt32 columnIndex = 0;
nsresult rv = tableAcc->GetColumnAtIndex(aChildIndex, &columnIndex);
*aColumnIndex = columnIndex;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_FAILED(rv) ? E_FAIL : S_OK;
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_nColumns(long *aColumnCount)
{
__try {
*aColumnCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -244,12 +272,17 @@ CAccessibleTable::get_nColumns(long *aColumnCount)
nsresult rv = tableAcc->GetColumns(&columnCount);
*aColumnCount = columnCount;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_nRows(long *aRowCount)
{
__try {
*aRowCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -261,12 +294,17 @@ CAccessibleTable::get_nRows(long *aRowCount)
nsresult rv = tableAcc->GetRows(&rowCount);
*aRowCount = rowCount;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_nSelectedChildren(long *aChildCount)
{
__try {
*aChildCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -278,12 +316,17 @@ CAccessibleTable::get_nSelectedChildren(long *aChildCount)
nsresult rv = tableAcc->GetSelectedCellsCount(&count);
*aChildCount = count;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_nSelectedColumns(long *aColumnCount)
{
__try {
*aColumnCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -295,12 +338,17 @@ CAccessibleTable::get_nSelectedColumns(long *aColumnCount)
nsresult rv = tableAcc->GetSelectedColumnsCount(&count);
*aColumnCount = count;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_nSelectedRows(long *aRowCount)
{
__try {
*aRowCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -312,12 +360,17 @@ CAccessibleTable::get_nSelectedRows(long *aRowCount)
nsresult rv = tableAcc->GetSelectedRowsCount(&count);
*aRowCount = count;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_rowDescription(long aRow, BSTR *aDescription)
{
__try {
*aDescription = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -330,13 +383,16 @@ CAccessibleTable::get_rowDescription(long aRow, BSTR *aDescription)
if (NS_FAILED(rv))
return E_FAIL;
INT result = ::SysReAllocStringLen(aDescription, descr.get(), descr.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aDescription, descr.get(), descr.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
CAccessibleTable::get_rowExtentAt(long aRow, long aColumn, long *aNRowsSpanned)
{
__try {
*aNRowsSpanned = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -348,13 +404,18 @@ CAccessibleTable::get_rowExtentAt(long aRow, long aColumn, long *aNRowsSpanned)
nsresult rv = tableAcc->GetRowExtentAt(aRow, aColumn, &rowsSpanned);
*aNRowsSpanned = rowsSpanned;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_rowHeader(IAccessibleTable **aAccessibleTable,
long *aStartingColumnIndex)
{
__try {
*aAccessibleTable = NULL;
// XXX: starting column index is always 0.
@ -381,12 +442,15 @@ CAccessibleTable::get_rowHeader(IAccessibleTable **aAccessibleTable,
return E_FAIL;
*aAccessibleTable = static_cast<IAccessibleTable*>(instancePtr);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
CAccessibleTable::get_rowIndex(long aChildIndex, long *aRowIndex)
{
__try {
*aRowIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
@ -398,27 +462,40 @@ CAccessibleTable::get_rowIndex(long aChildIndex, long *aRowIndex)
nsresult rv = tableAcc->GetRowAtIndex(aChildIndex, &rowIndex);
*aRowIndex = rowIndex;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_selectedChildren(long aMaxChildren, long **aChildren,
long *aNChildren)
{
__try {
return GetSelectedItems(aMaxChildren, aChildren, aNChildren, ITEMSTYPE_CELLS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_selectedColumns(long aMaxColumns, long **aColumns,
long *aNColumns)
{
__try {
return GetSelectedItems(aMaxColumns, aColumns, aNColumns, ITEMSTYPE_COLUMNS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_selectedRows(long aMaxRows, long **aRows, long *aNRows)
{
__try {
return GetSelectedItems(aMaxRows, aRows, aNRows, ITEMSTYPE_ROWS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
@ -436,6 +513,7 @@ CAccessibleTable::get_summary(IUnknown **aAccessible)
STDMETHODIMP
CAccessibleTable::get_isColumnSelected(long aColumn, boolean *aIsSelected)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
@ -445,12 +523,17 @@ CAccessibleTable::get_isColumnSelected(long aColumn, boolean *aIsSelected)
nsresult rv = tableAcc->IsColumnSelected(aColumn, &isSelected);
*aIsSelected = isSelected;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_isRowSelected(long aRow, boolean *aIsSelected)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
@ -460,12 +543,17 @@ CAccessibleTable::get_isRowSelected(long aRow, boolean *aIsSelected)
nsresult rv = tableAcc->IsRowSelected(aRow, &isSelected);
*aIsSelected = isSelected;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_isSelected(long aRow, long aColumn, boolean *aIsSelected)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
@ -475,55 +563,79 @@ CAccessibleTable::get_isSelected(long aRow, long aColumn, boolean *aIsSelected)
nsresult rv = tableAcc->IsCellSelected(aRow, aColumn, &isSelected);
*aIsSelected = isSelected;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::selectRow(long aRow)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
nsresult rv = tableAcc->SelectRow(aRow);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::selectColumn(long aColumn)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
nsresult rv = tableAcc->SelectColumn(aColumn);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::unselectRow(long aRow)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
nsresult rv = tableAcc->UnselectRow(aRow);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::unselectColumn(long aColumn)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
nsresult rv = tableAcc->UnselectColumn(aColumn);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
@ -533,6 +645,7 @@ CAccessibleTable::get_rowColumnExtentsAtIndex(long aIndex, long *aRow,
long *aColumnExtents,
boolean *aIsSelected)
{
__try {
*aRow = 0;
*aColumn = 0;
*aRowExtents = 0;
@ -574,6 +687,7 @@ CAccessibleTable::get_rowColumnExtentsAtIndex(long aIndex, long *aRow,
*aRowExtents = rowExtents;
*aColumnExtents = columnExtents;
*aIsSelected = isSelected;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

Просмотреть файл

@ -47,6 +47,7 @@
#include "nsIAccessibleText.h"
#include "nsIAccessibleTypes.h"
#include "nsIWinAccessNode.h"
#include "nsAccessNodeWrap.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -83,16 +84,22 @@ CAccessibleText::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleText::addSelection(long aStartOffset, long aEndOffset)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = textAcc->AddSelection(aStartOffset, aEndOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_attributes(long aOffset, long *aStartOffset,
long *aEndOffset, BSTR *aTextAttributes)
{
__try {
GET_NSIACCESSIBLETEXT
nsCOMPtr<nsIAccessible> accessible;
@ -117,20 +124,25 @@ CAccessibleText::get_attributes(long aOffset, long *aStartOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
return hr;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_caretOffset(long *aOffset)
{
__try {
GET_NSIACCESSIBLETEXT
PRInt32 offset = 0;
nsresult rv = textAcc->GetCaretOffset(&offset);
*aOffset = offset;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_FAILED(rv) ? E_FAIL : S_OK;
return E_FAIL;
}
STDMETHODIMP
@ -139,6 +151,7 @@ CAccessibleText::get_characterExtents(long aOffset,
long *aX, long *aY,
long *aWidth, long *aHeight)
{
__try {
GET_NSIACCESSIBLETEXT
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
@ -153,19 +166,28 @@ CAccessibleText::get_characterExtents(long aOffset,
*aWidth = width;
*aHeight = height;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_nSelections(long *aNSelections)
{
__try {
GET_NSIACCESSIBLETEXT
PRInt32 selCount = 0;
nsresult rv = textAcc->GetSelectionCount(&selCount);
*aNSelections = selCount;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
@ -173,6 +195,7 @@ CAccessibleText::get_offsetAtPoint(long aX, long aY,
enum IA2CoordinateType aCoordType,
long *aOffset)
{
__try {
GET_NSIACCESSIBLETEXT
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
@ -183,13 +206,18 @@ CAccessibleText::get_offsetAtPoint(long aX, long aY,
nsresult rv = textAcc->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
*aOffset = offset;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
long *aEndOffset)
{
__try {
GET_NSIACCESSIBLETEXT
PRInt32 startOffset = 0, endOffset = 0;
@ -198,12 +226,17 @@ CAccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
{
__try {
GET_NSIACCESSIBLETEXT
nsAutoString text;
@ -211,8 +244,11 @@ CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
if (NS_FAILED(rv))
return E_FAIL;
INT result = ::SysReAllocStringLen(aText, text.get(), text.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
@ -221,6 +257,7 @@ CAccessibleText::get_textBeforeOffset(long aOffset,
long *aStartOffset, long *aEndOffset,
BSTR *aText)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = NS_OK;
@ -245,8 +282,11 @@ CAccessibleText::get_textBeforeOffset(long aOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
INT result = ::SysReAllocStringLen(aText, text.get(), text.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
@ -255,6 +295,7 @@ CAccessibleText::get_textAfterOffset(long aOffset,
long *aStartOffset, long *aEndOffset,
BSTR *aText)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = NS_OK;
@ -279,8 +320,11 @@ CAccessibleText::get_textAfterOffset(long aOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
INT result = ::SysReAllocStringLen(aText, text.get(), text.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
@ -289,6 +333,7 @@ CAccessibleText::get_textAtOffset(long aOffset,
long *aStartOffset, long *aEndOffset,
BSTR *aText)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = NS_OK;
@ -313,59 +358,87 @@ CAccessibleText::get_textAtOffset(long aOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
INT result = ::SysReAllocStringLen(aText, text.get(), text.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aText, text.get(), text.Length()))
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
CAccessibleText::removeSelection(long aSelectionIndex)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = textAcc->RemoveSelection(aSelectionIndex);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::setCaretOffset(long aOffset)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = textAcc->SetCaretOffset(aOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
long aEndOffset)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = textAcc->SetSelectionBounds(aSelectionIndex,
aStartOffset, aEndOffset);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_nCharacters(long *aNCharacters)
{
__try {
GET_NSIACCESSIBLETEXT
PRInt32 charCount = 0;
nsresult rv = textAcc->GetCharacterCount(&charCount);
*aNCharacters = charCount;
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
enum IA2ScrollType aScrollType)
{
__try {
GET_NSIACCESSIBLETEXT
nsresult rv = textAcc->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
@ -373,6 +446,7 @@ CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
enum IA2CoordinateType aCoordType,
long aX, long aY)
{
__try {
GET_NSIACCESSIBLETEXT
PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
@ -381,19 +455,29 @@ CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
nsresult rv = textAcc->ScrollSubstringToPoint(aStartIndex, aEndIndex,
geckoCoordType, aX, aY);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_newText(IA2TextSegment *aNewText)
{
__try {
return GetModifiedText(PR_TRUE, aNewText);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleText::get_oldText(IA2TextSegment *aOldText)
{
__try {
return GetModifiedText(PR_FALSE, aOldText);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
// CAccessibleText

Просмотреть файл

@ -46,6 +46,8 @@
#include "nsCOMPtr.h"
#include "nsAccessNodeWrap.h"
// IUnknown
STDMETHODIMP
@ -71,6 +73,7 @@ CAccessibleValue::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
CAccessibleValue::get_currentValue(VARIANT *aCurrentValue)
{
__try {
VariantInit(aCurrentValue);
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
@ -85,12 +88,14 @@ CAccessibleValue::get_currentValue(VARIANT *aCurrentValue)
aCurrentValue->vt = VT_R8;
aCurrentValue->dblVal = currentValue;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_OK;
}
STDMETHODIMP
CAccessibleValue::setCurrentValue(VARIANT aValue)
{
__try {
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
if (!valueAcc)
return E_FAIL;
@ -98,13 +103,17 @@ CAccessibleValue::setCurrentValue(VARIANT aValue)
if (aValue.vt != VT_R8)
return E_INVALIDARG;
nsresult rv = valueAcc->SetCurrentValue(aValue.dblVal);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_SUCCEEDED(valueAcc->SetCurrentValue(aValue.dblVal)))
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP
CAccessibleValue::get_maximumValue(VARIANT *aMaximumValue)
{
__try {
VariantInit(aMaximumValue);
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
@ -118,6 +127,7 @@ CAccessibleValue::get_maximumValue(VARIANT *aMaximumValue)
aMaximumValue->vt = VT_R8;
aMaximumValue->dblVal = maximumValue;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_OK;
}
@ -125,6 +135,7 @@ CAccessibleValue::get_maximumValue(VARIANT *aMaximumValue)
STDMETHODIMP
CAccessibleValue::get_minimumValue(VARIANT *aMinimumValue)
{
__try {
VariantInit(aMinimumValue);
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
@ -138,6 +149,7 @@ CAccessibleValue::get_minimumValue(VARIANT *aMinimumValue)
aMinimumValue->vt = VT_R8;
aMinimumValue->dblVal = minimumValue;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_OK;
}

Просмотреть файл

@ -168,6 +168,7 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeInfo(
/* [out] */ unsigned int __RPC_FAR *aUniqueID,
/* [out] */ unsigned short __RPC_FAR *aNodeType)
{
__try{
*aNodeName = nsnull;
*aNodeValue = nsnull;
@ -207,6 +208,7 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeInfo(
if (nodeList && NS_OK == nodeList->GetLength(&numChildren))
*aNumChildren = static_cast<unsigned int>(numChildren);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -219,6 +221,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributes(
/* [length_is][size_is][out] */ BSTR __RPC_FAR *aAttribValues,
/* [out] */ unsigned short __RPC_FAR *aNumAttribs)
{
__try{
*aNumAttribs = 0;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
@ -243,6 +246,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributes(
content->GetAttr(name->NamespaceID(), name->LocalName(), attributeValue);
aAttribValues[index] = ::SysAllocString(attributeValue.get());
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -254,6 +258,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributesForNames(
/* [length_is][size_is][in] */ short __RPC_FAR *aNameSpaceID,
/* [length_is][size_is][retval] */ BSTR __RPC_FAR *aAttribValues)
{
__try {
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
@ -285,6 +290,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributesForNames(
aAttribValues[index] = ::SysAllocString(attributeValue.get());
}
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -297,6 +303,7 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyle(
/* [length_is][size_is][out] */ BSTR __RPC_FAR *aStyleValues,
/* [out] */ unsigned short __RPC_FAR *aNumStyleProperties)
{
__try{
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
if (!domElement)
return E_FAIL;
@ -321,6 +328,7 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyle(
}
}
*aNumStyleProperties = static_cast<unsigned short>(realIndex);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -332,6 +340,7 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties(
/* [length_is][size_is][in] */ BSTR __RPC_FAR *aStyleProperties,
/* [length_is][size_is][out] */ BSTR __RPC_FAR *aStyleValues)
{
__try {
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mDOMNode));
if (!domElement)
return E_FAIL;
@ -347,12 +356,14 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties(
cssDecl->GetPropertyValue(nsDependentString(static_cast<PRUnichar*>(aStyleProperties[index])), value); // Get property value
aStyleValues[index] = ::SysAllocString(value.get());
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP nsAccessNodeWrap::scrollTo(/* [in] */ boolean aScrollTopLeft)
{
__try {
PRUint32 scrollType =
aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT :
nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT;
@ -360,6 +371,7 @@ STDMETHODIMP nsAccessNodeWrap::scrollTo(/* [in] */ boolean aScrollTopLeft)
nsresult rv = ScrollTo(scrollType);
if (NS_SUCCEEDED(rv))
return S_OK;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
@ -416,60 +428,70 @@ ISimpleDOMNode* nsAccessNodeWrap::MakeAccessNode(nsIDOMNode *node)
STDMETHODIMP nsAccessNodeWrap::get_parentNode(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (!mDOMNode)
return E_FAIL;
nsCOMPtr<nsIDOMNode> node;
mDOMNode->GetParentNode(getter_AddRefs(node));
*aNode = MakeAccessNode(node);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP nsAccessNodeWrap::get_firstChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (!mDOMNode)
return E_FAIL;
nsCOMPtr<nsIDOMNode> node;
mDOMNode->GetFirstChild(getter_AddRefs(node));
*aNode = MakeAccessNode(node);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP nsAccessNodeWrap::get_lastChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (!mDOMNode)
return E_FAIL;
nsCOMPtr<nsIDOMNode> node;
mDOMNode->GetLastChild(getter_AddRefs(node));
*aNode = MakeAccessNode(node);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP nsAccessNodeWrap::get_previousSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (!mDOMNode)
return E_FAIL;
nsCOMPtr<nsIDOMNode> node;
mDOMNode->GetPreviousSibling(getter_AddRefs(node));
*aNode = MakeAccessNode(node);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP nsAccessNodeWrap::get_nextSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (!mDOMNode)
return E_FAIL;
nsCOMPtr<nsIDOMNode> node;
mDOMNode->GetNextSibling(getter_AddRefs(node));
*aNode = MakeAccessNode(node);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -478,6 +500,7 @@ STDMETHODIMP
nsAccessNodeWrap::get_childAt(unsigned aChildIndex,
ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
*aNode = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
@ -491,6 +514,7 @@ nsAccessNodeWrap::get_childAt(unsigned aChildIndex,
return E_FAIL; // No such child
*aNode = MakeAccessNode(node);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -498,6 +522,7 @@ nsAccessNodeWrap::get_childAt(unsigned aChildIndex,
STDMETHODIMP
nsAccessNodeWrap::get_innerHTML(BSTR __RPC_FAR *aInnerHTML)
{
__try {
*aInnerHTML = nsnull;
nsCOMPtr<nsIDOMNSHTMLElement> domNSElement(do_QueryInterface(mDOMNode));
@ -507,6 +532,7 @@ nsAccessNodeWrap::get_innerHTML(BSTR __RPC_FAR *aInnerHTML)
nsAutoString innerHTML;
domNSElement->GetInnerHTML(innerHTML);
*aInnerHTML = ::SysAllocString(innerHTML.get());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -514,6 +540,7 @@ nsAccessNodeWrap::get_innerHTML(BSTR __RPC_FAR *aInnerHTML)
STDMETHODIMP
nsAccessNodeWrap::get_language(BSTR __RPC_FAR *aLanguage)
{
__try {
*aLanguage = nsnull;
nsAutoString language;
@ -521,6 +548,8 @@ nsAccessNodeWrap::get_language(BSTR __RPC_FAR *aLanguage)
return E_FAIL;
}
*aLanguage = ::SysAllocString(language.get());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -528,8 +557,10 @@ STDMETHODIMP
nsAccessNodeWrap::get_localInterface(
/* [out] */ void __RPC_FAR *__RPC_FAR *localInterface)
{
__try {
*localInterface = static_cast<nsIAccessNode*>(this);
NS_ADDREF_THIS();
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

Просмотреть файл

@ -43,6 +43,13 @@
#ifndef _nsAccessNodeWrap_H_
#define _nsAccessNodeWrap_H_
// Avoid warning C4509:
// nonstandard extension used: 'nsAccessibleWrap::[methodname]'
// uses SEH and 'xpAccessible' has destructor
// At this point we're catching a crash which is of much greater
// importance than the missing dereference for the nsCOMPtr<>
#pragma warning( disable : 4509 )
#include "nsCOMPtr.h"
#include "nsIAccessible.h"
#include "nsIAccessibleEvent.h"

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsAccessibleRelationWrap.h"
#include "AccessibleRelation_i.c"
#include "nsAccessNodeWrap.h"
#include "nsArrayUtils.h"
@ -84,6 +85,7 @@ nsAccessibleRelationWrap::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
nsAccessibleRelationWrap::get_relationType(BSTR *aRelationType)
{
__try {
*aRelationType = NULL;
PRUint32 type = 0;
@ -141,7 +143,11 @@ nsAccessibleRelationWrap::get_relationType(BSTR *aRelationType)
return E_FAIL;
}
return !aRelationType ? E_OUTOFMEMORY : S_OK;
if (!aRelationType)
return E_OUTOFMEMORY;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
@ -153,16 +159,21 @@ nsAccessibleRelationWrap::get_localizedRelationType(BSTR *aLocalizedRelationType
STDMETHODIMP
nsAccessibleRelationWrap::get_nTargets(long *aNTargets)
{
__try {
PRUint32 count = 0;
nsresult rv = GetTargetsCount(&count);
*aNTargets = count;
if (NS_FAILED(rv))
return E_FAIL;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return NS_FAILED(rv) ? E_FAIL : S_OK;
return S_OK;
}
STDMETHODIMP
nsAccessibleRelationWrap::get_target(long aTargetIndex, IUnknown **aTarget)
{
__try {
nsCOMPtr<nsIAccessible> accessible;
nsresult rv = GetTarget(aTargetIndex, getter_AddRefs(accessible));
@ -176,6 +187,8 @@ nsAccessibleRelationWrap::get_target(long aTargetIndex, IUnknown **aTarget)
return E_FAIL;
*aTarget = static_cast<IUnknown*>(instancePtr);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -183,6 +196,7 @@ STDMETHODIMP
nsAccessibleRelationWrap::get_targets(long aMaxTargets, IUnknown **aTarget,
long *aNTargets)
{
__try {
*aNTargets = 0;
nsCOMPtr<nsIArray> targets;
@ -221,6 +235,8 @@ nsAccessibleRelationWrap::get_targets(long aMaxTargets, IUnknown **aTarget,
}
*aNTargets = count;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

Просмотреть файл

@ -62,13 +62,6 @@
#include "nsEventMap.h"
#include "nsArrayUtils.h"
// Avoid warning C4509:
// nonstandard extension used: 'nsAccessibleWrap::[methodname]'
// uses SEH and 'xpAccessible' has destructor
// At this point we're catching a crash which is of much greater
// importance than the missing dereference for the nsCOMPtr<>
#pragma warning( disable : 4509 )
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/

Просмотреть файл

@ -71,6 +71,7 @@ nsApplicationAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP
nsApplicationAccessibleWrap::get_appName(BSTR *aName)
{
__try {
if (!sAppInfo)
return E_FAIL;
@ -81,13 +82,17 @@ nsApplicationAccessibleWrap::get_appName(BSTR *aName)
return E_FAIL;
NS_ConvertUTF8toUTF16 name(cname);
INT result = ::SysReAllocStringLen(aName, name.get(), name.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aName, name.get(), name.Length()))
return E_OUTOFMEMORY;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
{
__try {
if (!sAppInfo)
return E_FAIL;
@ -98,8 +103,10 @@ nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
return E_FAIL;
NS_ConvertUTF8toUTF16 version(cversion);
INT result = ::SysReAllocStringLen(aVersion, version.get(), version.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aVersion, version.get(), version.Length()))
return E_OUTOFMEMORY;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
STDMETHODIMP
@ -111,6 +118,7 @@ nsApplicationAccessibleWrap::get_toolkitName(BSTR *aName)
STDMETHODIMP
nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
{
__try {
if (!sAppInfo)
return E_FAIL;
@ -121,8 +129,10 @@ nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
return E_FAIL;
NS_ConvertUTF8toUTF16 version(cversion);
INT result = ::SysReAllocStringLen(aVersion, version.get(), version.Length());
return result ? NS_OK : E_OUTOFMEMORY;
if (!::SysReAllocStringLen(aVersion, version.get(), version.Length()))
return E_OUTOFMEMORY;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
// nsApplicationAccessibleWrap

Просмотреть файл

@ -117,6 +117,7 @@ STDMETHODIMP nsDocAccessibleWrap::get_accChild(
/* [in] */ VARIANT varChild,
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
{
__try {
*ppdispChild = NULL;
if (varChild.vt == VT_I4 && varChild.lVal < 0) {
@ -157,6 +158,8 @@ STDMETHODIMP nsDocAccessibleWrap::get_accChild(
// Otherwise, the normal get_accChild() will do
return nsAccessibleWrap::get_accChild(varChild, ppdispChild);
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
NS_IMETHODIMP nsDocAccessibleWrap::Shutdown()
@ -202,51 +205,60 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireAnchorJumpEvent()
STDMETHODIMP nsDocAccessibleWrap::get_URL(/* [out] */ BSTR __RPC_FAR *aURL)
{
__try {
*aURL = NULL;
nsAutoString URL;
if (NS_SUCCEEDED(GetURL(URL))) {
*aURL= ::SysAllocString(URL.get());
return S_OK;
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP nsDocAccessibleWrap::get_title( /* [out] */ BSTR __RPC_FAR *aTitle)
{
__try {
*aTitle = NULL;
nsAutoString title;
if (NS_SUCCEEDED(GetTitle(title))) { // getter_Copies(pszTitle)))) {
*aTitle= ::SysAllocString(title.get());
return S_OK;
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP nsDocAccessibleWrap::get_mimeType(/* [out] */ BSTR __RPC_FAR *aMimeType)
{
__try {
*aMimeType = NULL;
nsAutoString mimeType;
if (NS_SUCCEEDED(GetMimeType(mimeType))) {
*aMimeType= ::SysAllocString(mimeType.get());
return S_OK;
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP nsDocAccessibleWrap::get_docType(/* [out] */ BSTR __RPC_FAR *aDocType)
{
__try {
*aDocType = NULL;
nsAutoString docType;
if (NS_SUCCEEDED(GetDocType(docType))) {
*aDocType= ::SysAllocString(docType.get());
return S_OK;
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}
STDMETHODIMP nsDocAccessibleWrap::get_nameSpaceURIForID(/* [in] */ short aNameSpaceID,
/* [out] */ BSTR __RPC_FAR *aNameSpaceURI)
{
__try {
if (aNameSpaceID < 0) {
return E_FAIL; // -1 is kNameSpaceID_Unknown
}
@ -256,6 +268,7 @@ STDMETHODIMP nsDocAccessibleWrap::get_nameSpaceURIForID(/* [in] */ short aNameS
*aNameSpaceURI = ::SysAllocString(nameSpaceURI.get());
return S_OK;
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
}

Просмотреть файл

@ -84,6 +84,7 @@ STDMETHODIMP nsTextAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
STDMETHODIMP nsTextAccessibleWrap::get_domText(
/* [retval][out] */ BSTR __RPC_FAR *aDomText)
{
__try {
*aDomText = nsnull;
if (!mDOMNode) {
@ -93,6 +94,7 @@ STDMETHODIMP nsTextAccessibleWrap::get_domText(
mDOMNode->GetNodeValue(nodeValue);
*aDomText = ::SysAllocString(nodeValue.get());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -105,6 +107,8 @@ STDMETHODIMP nsTextAccessibleWrap::get_clippedSubstringBounds(
/* [out] */ int __RPC_FAR *aWidth,
/* [out] */ int __RPC_FAR *aHeight)
{
__try {
*aX = *aY = *aWidth = *aHeight = 0;
nscoord x, y, width, height, docX, docY, docWidth, docHeight;
HRESULT rv = get_unclippedSubstringBounds(aStartIndex, aEndIndex, &x, &y, &width, &height);
if (FAILED(rv)) {
@ -127,6 +131,7 @@ STDMETHODIMP nsTextAccessibleWrap::get_clippedSubstringBounds(
*aY = clippedRect.y;
*aWidth = clippedRect.width;
*aHeight = clippedRect.height;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -139,6 +144,9 @@ STDMETHODIMP nsTextAccessibleWrap::get_unclippedSubstringBounds(
/* [out] */ int __RPC_FAR *aWidth,
/* [out] */ int __RPC_FAR *aHeight)
{
__try {
*aX = *aY = *aWidth = *aHeight = 0;
if (!mDOMNode) {
return E_FAIL; // Node already shut down
}
@ -147,6 +155,7 @@ STDMETHODIMP nsTextAccessibleWrap::get_unclippedSubstringBounds(
aX, aY, aWidth, aHeight))) {
return NS_ERROR_FAILURE;
}
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
@ -156,10 +165,14 @@ STDMETHODIMP nsTextAccessibleWrap::scrollToSubstring(
/* [in] */ unsigned int aStartIndex,
/* [in] */ unsigned int aEndIndex)
{
__try {
nsresult rv = nsAccUtils::ScrollSubstringTo(GetFrame(), mDOMNode, aStartIndex,
mDOMNode, aEndIndex,
nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
return NS_FAILED(rv) ? E_FAIL : S_OK;
if (NS_FAILED(rv))
return E_FAIL;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}
nsIFrame* nsTextAccessibleWrap::GetPointFromOffset(nsIFrame *aContainingFrame,
@ -175,7 +188,6 @@ nsIFrame* nsTextAccessibleWrap::GetPointFromOffset(nsIFrame *aContainingFrame,
}
textFrame->GetPointFromOffset(aOffset, &aOutPoint);
return textFrame;
}
@ -186,6 +198,7 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
PRInt32* aX, PRInt32* aY,
PRInt32* aWidth, PRInt32* aHeight)
{
*aX = *aY = *aWidth = *aHeight = 0;
nsPresContext *presContext = GetPresContext();
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
@ -226,6 +239,7 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
STDMETHODIMP nsTextAccessibleWrap::get_fontFamily(
/* [retval][out] */ BSTR __RPC_FAR *aFontFamily)
{
__try {
*aFontFamily = nsnull;
nsIFrame *frame = GetFrame();
@ -264,5 +278,7 @@ STDMETHODIMP nsTextAccessibleWrap::get_fontFamily(
deviceContext->FirstExistingFont(fm->Font(), fontFamily);
*aFontFamily = ::SysAllocString(fontFamily.get());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
}

Просмотреть файл

@ -51,6 +51,8 @@ nsXULMenuitemAccessible(aDOMNode, aShell)
NS_IMETHODIMP nsXULMenuitemAccessibleWrap::GetName(nsAString& aName)
{
// XXX This should be done in get_accName() so that nsIAccessible::GetName()]
// provides the same results on all platforms
nsresult rv = nsXULMenuitemAccessible::GetName(aName);
if (NS_FAILED(rv)) {
return rv;

Просмотреть файл

@ -51,7 +51,7 @@ nsXULTreeAccessible(aDOMNode, aShell)
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRole(PRUint32 *aRole)
{
NS_ASSERTION(mTree, "No tree view");
NS_ENSURE_STATE(mTree);
nsCOMPtr<nsITreeColumns> cols;
mTree->GetColumns(getter_AddRefs(cols));
@ -84,11 +84,12 @@ NS_IMETHODIMP nsXULTreeitemAccessibleWrap::GetRole(PRUint32 *aRole)
{
// No primary column means we're in a list
// In fact, history and mail turn off the primary flag when switching to a flat view
NS_ASSERTION(mColumn, "mColumn is null");
NS_ENSURE_STATE(mColumn);
PRBool isPrimary = PR_FALSE;
mColumn->GetPrimary(&isPrimary);
*aRole = isPrimary ? nsIAccessibleRole::ROLE_OUTLINEITEM :
nsIAccessibleRole::ROLE_LISTITEM;
return NS_OK;
}
@ -102,16 +103,19 @@ NS_IMETHODIMP nsXULTreeitemAccessibleWrap::GetBounds(PRInt32 *x, PRInt32 *y, PRI
if (frame) {
// Will subtract first cell's start x from total width
PRInt32 cellStartX, cellStartY;
NS_ENSURE_STATE(mTree);
mTree->GetCoordsForCellItem(mRow, mColumn, EmptyCString(), &cellStartX, &cellStartY, width, height);
// Use entire row width, not just key column's width
*width = GetPresContext()->AppUnitsToDevPixels(frame->GetRect().width) -
cellStartX;
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeitemAccessibleWrap::GetName(nsAString& aName)
{
NS_ENSURE_STATE(mTree);
nsCOMPtr<nsITreeColumns> cols;
mTree->GetColumns(getter_AddRefs(cols));
if (!cols) {
@ -127,6 +131,7 @@ NS_IMETHODIMP nsXULTreeitemAccessibleWrap::GetName(nsAString& aName)
column->GetNext(getter_AddRefs(nextColumn));
column = nextColumn;
}
return NS_OK;
}