Bug 762394 - Replace do_QueryObject() with static_cast in CAccessibleText; r=tbsaunde

--HG--
rename : accessible/src/msaa/CAccessibleText.cpp => accessible/src/msaa/ia2AccessibleText.cpp
rename : accessible/src/msaa/CAccessibleText.h => accessible/src/msaa/ia2AccessibleText.h
This commit is contained in:
Andrew Quartey 2012-06-16 17:28:31 +12:00
Родитель ce8ebecccb
Коммит 4b91a0a661
6 изменённых файлов: 69 добавлений и 70 удалений

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

@ -9,7 +9,6 @@
#define mozilla_a11y_HyperTextAccessibleWrap_h__ #define mozilla_a11y_HyperTextAccessibleWrap_h__
#include "HyperTextAccessible.h" #include "HyperTextAccessible.h"
#include "CAccessibleText.h"
#include "CAccessibleEditableText.h" #include "CAccessibleEditableText.h"
#include "ia2AccessibleHyperText.h" #include "ia2AccessibleHyperText.h"

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

@ -26,7 +26,6 @@ CPPSRCS = \
nsAccessNodeWrap.cpp \ nsAccessNodeWrap.cpp \
nsHTMLWin32ObjectAccessible.cpp \ nsHTMLWin32ObjectAccessible.cpp \
nsWinUtils.cpp \ nsWinUtils.cpp \
CAccessibleText.cpp \
CAccessibleEditableText.cpp \ CAccessibleEditableText.cpp \
CAccessibleHyperlink.cpp \ CAccessibleHyperlink.cpp \
CAccessibleTable.cpp \ CAccessibleTable.cpp \
@ -39,6 +38,7 @@ CPPSRCS = \
ia2AccessibleImage.cpp \ ia2AccessibleImage.cpp \
ia2AccessibleHypertext.cpp \ ia2AccessibleHypertext.cpp \
ia2AccessibleRelation.cpp \ ia2AccessibleRelation.cpp \
ia2AccessibleText.cpp \
RootAccessibleWrap.cpp \ RootAccessibleWrap.cpp \
TextLeafAccessibleWrap.cpp \ TextLeafAccessibleWrap.cpp \
$(NULL) $(NULL)

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

@ -27,7 +27,7 @@ ia2AccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
return E_NOINTERFACE; return E_NOINTERFACE;
} }
return CAccessibleText::QueryInterface(iid, ppv); return ia2AccessibleText::QueryInterface(iid, ppv);
} }
// IAccessibleHypertext // IAccessibleHypertext

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

@ -10,10 +10,10 @@
#include "nsISupports.h" #include "nsISupports.h"
#include "CAccessibleText.h" #include "ia2AccessibleText.h"
#include "AccessibleHypertext.h" #include "AccessibleHypertext.h"
class ia2AccessibleHypertext : public CAccessibleText, class ia2AccessibleHypertext : public ia2AccessibleText,
public IAccessibleHypertext public IAccessibleHypertext
{ {
public: public:
@ -22,7 +22,7 @@ public:
STDMETHODIMP QueryInterface(REFIID, void**); STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleText // IAccessibleText
FORWARD_IACCESSIBLETEXT(CAccessibleText) FORWARD_IACCESSIBLETEXT(ia2AccessibleText)
// IAccessibleHypertext // IAccessibleHypertext
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nHyperlinks( virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nHyperlinks(

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

@ -5,19 +5,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CAccessibleText.h" #include "ia2AccessibleText.h"
#include "Accessible2.h" #include "Accessible2.h"
#include "AccessibleText_i.c" #include "AccessibleText_i.c"
#include "HyperTextAccessible.h" #include "HyperTextAccessibleWrap.h"
#include "nsIPersistentProperties2.h" #include "nsIPersistentProperties2.h"
// IUnknown // IUnknown
STDMETHODIMP STDMETHODIMP
CAccessibleText::QueryInterface(REFIID iid, void** ppv) ia2AccessibleText::QueryInterface(REFIID iid, void** ppv)
{ {
*ppv = NULL; *ppv = NULL;
@ -37,10 +37,10 @@ CAccessibleText::QueryInterface(REFIID iid, void** ppv)
// IAccessibleText // IAccessibleText
STDMETHODIMP STDMETHODIMP
CAccessibleText::addSelection(long aStartOffset, long aEndOffset) ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
{ {
__try { __try {
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -52,8 +52,8 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_attributes(long aOffset, long *aStartOffset, ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset,
long *aEndOffset, BSTR *aTextAttributes) long *aEndOffset, BSTR *aTextAttributes)
{ {
__try { __try {
if (!aStartOffset || !aEndOffset || !aTextAttributes) if (!aStartOffset || !aEndOffset || !aTextAttributes)
@ -63,7 +63,7 @@ __try {
*aEndOffset = 0; *aEndOffset = 0;
*aTextAttributes = NULL; *aTextAttributes = NULL;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -90,12 +90,12 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_caretOffset(long *aOffset) ia2AccessibleText::get_caretOffset(long *aOffset)
{ {
__try { __try {
*aOffset = -1; *aOffset = -1;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -112,10 +112,10 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_characterExtents(long aOffset, ia2AccessibleText::get_characterExtents(long aOffset,
enum IA2CoordinateType aCoordType, enum IA2CoordinateType aCoordType,
long *aX, long *aY, long *aX, long *aY,
long *aWidth, long *aHeight) long *aWidth, long *aHeight)
{ {
__try { __try {
*aX = 0; *aX = 0;
@ -123,7 +123,7 @@ __try {
*aWidth = 0; *aWidth = 0;
*aHeight = 0; *aHeight = 0;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -148,12 +148,12 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_nSelections(long *aNSelections) ia2AccessibleText::get_nSelections(long *aNSelections)
{ {
__try { __try {
*aNSelections = 0; *aNSelections = 0;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -170,14 +170,14 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_offsetAtPoint(long aX, long aY, ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
enum IA2CoordinateType aCoordType, enum IA2CoordinateType aCoordType,
long *aOffset) long *aOffset)
{ {
__try { __try {
*aOffset = 0; *aOffset = 0;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -198,14 +198,14 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_selection(long aSelectionIndex, long *aStartOffset, ia2AccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
long *aEndOffset) long *aEndOffset)
{ {
__try { __try {
*aStartOffset = 0; *aStartOffset = 0;
*aEndOffset = 0; *aEndOffset = 0;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -224,12 +224,12 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText) ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
{ {
__try { __try {
*aText = NULL; *aText = NULL;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -249,17 +249,17 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_textBeforeOffset(long aOffset, ia2AccessibleText::get_textBeforeOffset(long aOffset,
enum IA2TextBoundaryType aBoundaryType, enum IA2TextBoundaryType aBoundaryType,
long *aStartOffset, long *aEndOffset, long *aStartOffset, long *aEndOffset,
BSTR *aText) BSTR *aText)
{ {
__try { __try {
*aStartOffset = 0; *aStartOffset = 0;
*aEndOffset = 0; *aEndOffset = 0;
*aText = NULL; *aText = NULL;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -296,17 +296,17 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_textAfterOffset(long aOffset, ia2AccessibleText::get_textAfterOffset(long aOffset,
enum IA2TextBoundaryType aBoundaryType, enum IA2TextBoundaryType aBoundaryType,
long *aStartOffset, long *aEndOffset, long *aStartOffset, long *aEndOffset,
BSTR *aText) BSTR *aText)
{ {
__try { __try {
*aStartOffset = 0; *aStartOffset = 0;
*aEndOffset = 0; *aEndOffset = 0;
*aText = NULL; *aText = NULL;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -343,17 +343,17 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_textAtOffset(long aOffset, ia2AccessibleText::get_textAtOffset(long aOffset,
enum IA2TextBoundaryType aBoundaryType, enum IA2TextBoundaryType aBoundaryType,
long *aStartOffset, long *aEndOffset, long *aStartOffset, long *aEndOffset,
BSTR *aText) BSTR *aText)
{ {
__try { __try {
*aStartOffset = 0; *aStartOffset = 0;
*aEndOffset = 0; *aEndOffset = 0;
*aText = NULL; *aText = NULL;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -390,10 +390,10 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::removeSelection(long aSelectionIndex) ia2AccessibleText::removeSelection(long aSelectionIndex)
{ {
__try { __try {
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -405,10 +405,10 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::setCaretOffset(long aOffset) ia2AccessibleText::setCaretOffset(long aOffset)
{ {
__try { __try {
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -420,11 +420,11 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset, ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
long aEndOffset) long aEndOffset)
{ {
__try { __try {
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -437,12 +437,12 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_nCharacters(long *aNCharacters) ia2AccessibleText::get_nCharacters(long *aNCharacters)
{ {
__try { __try {
*aNCharacters = 0; *aNCharacters = 0;
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -454,11 +454,11 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex, ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
enum IA2ScrollType aScrollType) enum IA2ScrollType aScrollType)
{ {
__try { __try {
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -470,12 +470,12 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex, ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
enum IA2CoordinateType aCoordType, enum IA2CoordinateType aCoordType,
long aX, long aY) long aX, long aY)
{ {
__try { __try {
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this)); HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
@ -492,7 +492,7 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_newText(IA2TextSegment *aNewText) ia2AccessibleText::get_newText(IA2TextSegment *aNewText)
{ {
__try { __try {
return GetModifiedText(true, aNewText); return GetModifiedText(true, aNewText);
@ -502,7 +502,7 @@ __try {
} }
STDMETHODIMP STDMETHODIMP
CAccessibleText::get_oldText(IA2TextSegment *aOldText) ia2AccessibleText::get_oldText(IA2TextSegment *aOldText)
{ {
__try { __try {
return GetModifiedText(false, aOldText); return GetModifiedText(false, aOldText);
@ -511,11 +511,11 @@ __try {
return E_FAIL; return E_FAIL;
} }
// CAccessibleText // ia2AccessibleText
HRESULT HRESULT
CAccessibleText::GetModifiedText(bool aGetInsertedText, ia2AccessibleText::GetModifiedText(bool aGetInsertedText,
IA2TextSegment *aText) IA2TextSegment *aText)
{ {
PRUint32 startOffset = 0, endOffset = 0; PRUint32 startOffset = 0, endOffset = 0;
nsAutoString text; nsAutoString text;
@ -536,7 +536,7 @@ CAccessibleText::GetModifiedText(bool aGetInsertedText,
} }
AccessibleTextBoundary AccessibleTextBoundary
CAccessibleText::GetGeckoTextBoundary(enum IA2TextBoundaryType aBoundaryType) ia2AccessibleText::GetGeckoTextBoundary(enum IA2TextBoundaryType aBoundaryType)
{ {
switch (aBoundaryType) { switch (aBoundaryType) {
case IA2_TEXT_BOUNDARY_CHAR: case IA2_TEXT_BOUNDARY_CHAR:

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

@ -13,7 +13,7 @@
#include "AccessibleText.h" #include "AccessibleText.h"
class CAccessibleText: public IAccessibleText class ia2AccessibleText: public IAccessibleText
{ {
public: public: