From 4b91a0a66102668083c4198b0c10c54e455fb963 Mon Sep 17 00:00:00 2001 From: Andrew Quartey Date: Sat, 16 Jun 2012 17:28:31 +1200 Subject: [PATCH] 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 --- accessible/src/msaa/HyperTextAccessibleWrap.h | 1 - accessible/src/msaa/Makefile.in | 2 +- .../src/msaa/ia2AccessibleHypertext.cpp | 2 +- accessible/src/msaa/ia2AccessibleHypertext.h | 6 +- ...cessibleText.cpp => ia2AccessibleText.cpp} | 126 +++++++++--------- ...{CAccessibleText.h => ia2AccessibleText.h} | 2 +- 6 files changed, 69 insertions(+), 70 deletions(-) rename accessible/src/msaa/{CAccessibleText.cpp => ia2AccessibleText.cpp} (74%) rename accessible/src/msaa/{CAccessibleText.h => ia2AccessibleText.h} (99%) diff --git a/accessible/src/msaa/HyperTextAccessibleWrap.h b/accessible/src/msaa/HyperTextAccessibleWrap.h index fdde2f1b7e52..fb474081bc12 100644 --- a/accessible/src/msaa/HyperTextAccessibleWrap.h +++ b/accessible/src/msaa/HyperTextAccessibleWrap.h @@ -9,7 +9,6 @@ #define mozilla_a11y_HyperTextAccessibleWrap_h__ #include "HyperTextAccessible.h" -#include "CAccessibleText.h" #include "CAccessibleEditableText.h" #include "ia2AccessibleHyperText.h" diff --git a/accessible/src/msaa/Makefile.in b/accessible/src/msaa/Makefile.in index 0bfe346f0b32..53108c9b1960 100644 --- a/accessible/src/msaa/Makefile.in +++ b/accessible/src/msaa/Makefile.in @@ -26,7 +26,6 @@ CPPSRCS = \ nsAccessNodeWrap.cpp \ nsHTMLWin32ObjectAccessible.cpp \ nsWinUtils.cpp \ - CAccessibleText.cpp \ CAccessibleEditableText.cpp \ CAccessibleHyperlink.cpp \ CAccessibleTable.cpp \ @@ -39,6 +38,7 @@ CPPSRCS = \ ia2AccessibleImage.cpp \ ia2AccessibleHypertext.cpp \ ia2AccessibleRelation.cpp \ + ia2AccessibleText.cpp \ RootAccessibleWrap.cpp \ TextLeafAccessibleWrap.cpp \ $(NULL) diff --git a/accessible/src/msaa/ia2AccessibleHypertext.cpp b/accessible/src/msaa/ia2AccessibleHypertext.cpp index 98f82235f51d..ccaa47333e3d 100644 --- a/accessible/src/msaa/ia2AccessibleHypertext.cpp +++ b/accessible/src/msaa/ia2AccessibleHypertext.cpp @@ -27,7 +27,7 @@ ia2AccessibleHypertext::QueryInterface(REFIID iid, void** ppv) return E_NOINTERFACE; } - return CAccessibleText::QueryInterface(iid, ppv); + return ia2AccessibleText::QueryInterface(iid, ppv); } // IAccessibleHypertext diff --git a/accessible/src/msaa/ia2AccessibleHypertext.h b/accessible/src/msaa/ia2AccessibleHypertext.h index f925180a03b4..c352e9b23cd2 100644 --- a/accessible/src/msaa/ia2AccessibleHypertext.h +++ b/accessible/src/msaa/ia2AccessibleHypertext.h @@ -10,10 +10,10 @@ #include "nsISupports.h" -#include "CAccessibleText.h" +#include "ia2AccessibleText.h" #include "AccessibleHypertext.h" -class ia2AccessibleHypertext : public CAccessibleText, +class ia2AccessibleHypertext : public ia2AccessibleText, public IAccessibleHypertext { public: @@ -22,7 +22,7 @@ public: STDMETHODIMP QueryInterface(REFIID, void**); // IAccessibleText - FORWARD_IACCESSIBLETEXT(CAccessibleText) + FORWARD_IACCESSIBLETEXT(ia2AccessibleText) // IAccessibleHypertext virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nHyperlinks( diff --git a/accessible/src/msaa/CAccessibleText.cpp b/accessible/src/msaa/ia2AccessibleText.cpp similarity index 74% rename from accessible/src/msaa/CAccessibleText.cpp rename to accessible/src/msaa/ia2AccessibleText.cpp index 16ed7ef3281c..e2b4b8dd7f02 100644 --- a/accessible/src/msaa/CAccessibleText.cpp +++ b/accessible/src/msaa/ia2AccessibleText.cpp @@ -5,19 +5,19 @@ * 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/. */ -#include "CAccessibleText.h" +#include "ia2AccessibleText.h" #include "Accessible2.h" #include "AccessibleText_i.c" -#include "HyperTextAccessible.h" +#include "HyperTextAccessibleWrap.h" #include "nsIPersistentProperties2.h" // IUnknown STDMETHODIMP -CAccessibleText::QueryInterface(REFIID iid, void** ppv) +ia2AccessibleText::QueryInterface(REFIID iid, void** ppv) { *ppv = NULL; @@ -37,10 +37,10 @@ CAccessibleText::QueryInterface(REFIID iid, void** ppv) // IAccessibleText STDMETHODIMP -CAccessibleText::addSelection(long aStartOffset, long aEndOffset) +ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset) { __try { - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -52,8 +52,8 @@ __try { } STDMETHODIMP -CAccessibleText::get_attributes(long aOffset, long *aStartOffset, - long *aEndOffset, BSTR *aTextAttributes) +ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset, + long *aEndOffset, BSTR *aTextAttributes) { __try { if (!aStartOffset || !aEndOffset || !aTextAttributes) @@ -63,7 +63,7 @@ __try { *aEndOffset = 0; *aTextAttributes = NULL; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -90,12 +90,12 @@ __try { } STDMETHODIMP -CAccessibleText::get_caretOffset(long *aOffset) +ia2AccessibleText::get_caretOffset(long *aOffset) { __try { *aOffset = -1; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -112,10 +112,10 @@ __try { } STDMETHODIMP -CAccessibleText::get_characterExtents(long aOffset, - enum IA2CoordinateType aCoordType, - long *aX, long *aY, - long *aWidth, long *aHeight) +ia2AccessibleText::get_characterExtents(long aOffset, + enum IA2CoordinateType aCoordType, + long *aX, long *aY, + long *aWidth, long *aHeight) { __try { *aX = 0; @@ -123,7 +123,7 @@ __try { *aWidth = 0; *aHeight = 0; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -148,12 +148,12 @@ __try { } STDMETHODIMP -CAccessibleText::get_nSelections(long *aNSelections) +ia2AccessibleText::get_nSelections(long *aNSelections) { __try { *aNSelections = 0; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -170,14 +170,14 @@ __try { } STDMETHODIMP -CAccessibleText::get_offsetAtPoint(long aX, long aY, - enum IA2CoordinateType aCoordType, - long *aOffset) +ia2AccessibleText::get_offsetAtPoint(long aX, long aY, + enum IA2CoordinateType aCoordType, + long *aOffset) { __try { *aOffset = 0; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -198,14 +198,14 @@ __try { } STDMETHODIMP -CAccessibleText::get_selection(long aSelectionIndex, long *aStartOffset, - long *aEndOffset) +ia2AccessibleText::get_selection(long aSelectionIndex, long *aStartOffset, + long *aEndOffset) { __try { *aStartOffset = 0; *aEndOffset = 0; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -224,12 +224,12 @@ __try { } STDMETHODIMP -CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText) +ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText) { __try { *aText = NULL; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -249,17 +249,17 @@ __try { } STDMETHODIMP -CAccessibleText::get_textBeforeOffset(long aOffset, - enum IA2TextBoundaryType aBoundaryType, - long *aStartOffset, long *aEndOffset, - BSTR *aText) +ia2AccessibleText::get_textBeforeOffset(long aOffset, + enum IA2TextBoundaryType aBoundaryType, + long *aStartOffset, long *aEndOffset, + BSTR *aText) { __try { *aStartOffset = 0; *aEndOffset = 0; *aText = NULL; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -296,17 +296,17 @@ __try { } STDMETHODIMP -CAccessibleText::get_textAfterOffset(long aOffset, - enum IA2TextBoundaryType aBoundaryType, - long *aStartOffset, long *aEndOffset, - BSTR *aText) +ia2AccessibleText::get_textAfterOffset(long aOffset, + enum IA2TextBoundaryType aBoundaryType, + long *aStartOffset, long *aEndOffset, + BSTR *aText) { __try { *aStartOffset = 0; *aEndOffset = 0; *aText = NULL; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -343,17 +343,17 @@ __try { } STDMETHODIMP -CAccessibleText::get_textAtOffset(long aOffset, - enum IA2TextBoundaryType aBoundaryType, - long *aStartOffset, long *aEndOffset, - BSTR *aText) +ia2AccessibleText::get_textAtOffset(long aOffset, + enum IA2TextBoundaryType aBoundaryType, + long *aStartOffset, long *aEndOffset, + BSTR *aText) { __try { *aStartOffset = 0; *aEndOffset = 0; *aText = NULL; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -390,10 +390,10 @@ __try { } STDMETHODIMP -CAccessibleText::removeSelection(long aSelectionIndex) +ia2AccessibleText::removeSelection(long aSelectionIndex) { __try { - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -405,10 +405,10 @@ __try { } STDMETHODIMP -CAccessibleText::setCaretOffset(long aOffset) +ia2AccessibleText::setCaretOffset(long aOffset) { __try { - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -420,11 +420,11 @@ __try { } STDMETHODIMP -CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset, - long aEndOffset) +ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset, + long aEndOffset) { __try { - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -437,12 +437,12 @@ __try { } STDMETHODIMP -CAccessibleText::get_nCharacters(long *aNCharacters) +ia2AccessibleText::get_nCharacters(long *aNCharacters) { __try { *aNCharacters = 0; - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -454,11 +454,11 @@ __try { } STDMETHODIMP -CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex, - enum IA2ScrollType aScrollType) +ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex, + enum IA2ScrollType aScrollType) { __try { - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -470,12 +470,12 @@ __try { } STDMETHODIMP -CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex, - enum IA2CoordinateType aCoordType, - long aX, long aY) +ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex, + enum IA2CoordinateType aCoordType, + long aX, long aY) { __try { - nsRefPtr textAcc(do_QueryObject(this)); + HyperTextAccessible* textAcc = static_cast(this); if (textAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED; @@ -492,7 +492,7 @@ __try { } STDMETHODIMP -CAccessibleText::get_newText(IA2TextSegment *aNewText) +ia2AccessibleText::get_newText(IA2TextSegment *aNewText) { __try { return GetModifiedText(true, aNewText); @@ -502,7 +502,7 @@ __try { } STDMETHODIMP -CAccessibleText::get_oldText(IA2TextSegment *aOldText) +ia2AccessibleText::get_oldText(IA2TextSegment *aOldText) { __try { return GetModifiedText(false, aOldText); @@ -511,11 +511,11 @@ __try { return E_FAIL; } -// CAccessibleText +// ia2AccessibleText HRESULT -CAccessibleText::GetModifiedText(bool aGetInsertedText, - IA2TextSegment *aText) +ia2AccessibleText::GetModifiedText(bool aGetInsertedText, + IA2TextSegment *aText) { PRUint32 startOffset = 0, endOffset = 0; nsAutoString text; @@ -536,7 +536,7 @@ CAccessibleText::GetModifiedText(bool aGetInsertedText, } AccessibleTextBoundary -CAccessibleText::GetGeckoTextBoundary(enum IA2TextBoundaryType aBoundaryType) +ia2AccessibleText::GetGeckoTextBoundary(enum IA2TextBoundaryType aBoundaryType) { switch (aBoundaryType) { case IA2_TEXT_BOUNDARY_CHAR: diff --git a/accessible/src/msaa/CAccessibleText.h b/accessible/src/msaa/ia2AccessibleText.h similarity index 99% rename from accessible/src/msaa/CAccessibleText.h rename to accessible/src/msaa/ia2AccessibleText.h index 0c715ed3be1e..bb47166c91ef 100644 --- a/accessible/src/msaa/CAccessibleText.h +++ b/accessible/src/msaa/ia2AccessibleText.h @@ -13,7 +13,7 @@ #include "AccessibleText.h" -class CAccessibleText: public IAccessibleText +class ia2AccessibleText: public IAccessibleText { public: