From a91563ffa5d469f2915f1797bccbedd4c684c390 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Thu, 6 Aug 2015 15:27:35 -0400 Subject: [PATCH] bug 1192330 - move static text change data from HyperTextAccessibleWrap to ia2AccessibleText r=surkov This will enable us to remove the virtual function GetModifiedText(). --- accessible/windows/ia2/ia2AccessibleText.cpp | 13 +++++++++++++ accessible/windows/ia2/ia2AccessibleText.h | 8 ++++++++ accessible/windows/msaa/HyperTextAccessibleWrap.cpp | 6 ------ accessible/windows/msaa/HyperTextAccessibleWrap.h | 8 -------- accessible/windows/msaa/Platform.cpp | 6 ++---- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/accessible/windows/ia2/ia2AccessibleText.cpp b/accessible/windows/ia2/ia2AccessibleText.cpp index e0fbe3c759b..bd714e3ee3a 100644 --- a/accessible/windows/ia2/ia2AccessibleText.cpp +++ b/accessible/windows/ia2/ia2AccessibleText.cpp @@ -13,9 +13,16 @@ #include "HyperTextAccessibleWrap.h" #include "HyperTextAccessible-inl.h" #include "ProxyWrappers.h" +#include "mozilla/ClearOnShutdown.h" using namespace mozilla::a11y; +StaticRefPtr ia2AccessibleText::sLastTextChangeAcc; +StaticAutoPtr ia2AccessibleText::sLastTextChangeString; +uint32_t ia2AccessibleText::sLastTextChangeStart = 0; +uint32_t ia2AccessibleText::sLastTextChangeEnd = 0; +bool ia2AccessibleText::sLastTextChangeWasInsert = false; + // IAccessibleText STDMETHODIMP @@ -608,3 +615,9 @@ ia2AccessibleText::GetGeckoTextBoundary(enum IA2TextBoundaryType aBoundaryType) } } +void +ia2AccessibleText::InitTextChangeData() +{ + ClearOnShutdown(&sLastTextChangeAcc); + ClearOnShutdown(&sLastTextChangeString); +} diff --git a/accessible/windows/ia2/ia2AccessibleText.h b/accessible/windows/ia2/ia2AccessibleText.h index e621329cb22..0e6db22f1ec 100644 --- a/accessible/windows/ia2/ia2AccessibleText.h +++ b/accessible/windows/ia2/ia2AccessibleText.h @@ -113,11 +113,19 @@ public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText( /* [retval][out] */ IA2TextSegment *oldText); + static void InitTextChangeData(); + protected: virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText, uint32_t *aStartOffset, uint32_t *aEndOffset) = 0; + static StaticRefPtr sLastTextChangeAcc; + static StaticAutoPtr sLastTextChangeString; + static bool sLastTextChangeWasInsert; + static uint32_t sLastTextChangeStart; + static uint32_t sLastTextChangeEnd; + private: HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText); AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType); diff --git a/accessible/windows/msaa/HyperTextAccessibleWrap.cpp b/accessible/windows/msaa/HyperTextAccessibleWrap.cpp index 6b8deedcdea..064d0b4f688 100644 --- a/accessible/windows/msaa/HyperTextAccessibleWrap.cpp +++ b/accessible/windows/msaa/HyperTextAccessibleWrap.cpp @@ -15,12 +15,6 @@ using namespace mozilla; using namespace mozilla::a11y; -StaticRefPtr HyperTextAccessibleWrap::sLastTextChangeAcc; -StaticAutoPtr HyperTextAccessibleWrap::sLastTextChangeString; -uint32_t HyperTextAccessibleWrap::sLastTextChangeStart = 0; -uint32_t HyperTextAccessibleWrap::sLastTextChangeEnd = 0; -bool HyperTextAccessibleWrap::sLastTextChangeWasInsert = false; - NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap, HyperTextAccessible) diff --git a/accessible/windows/msaa/HyperTextAccessibleWrap.h b/accessible/windows/msaa/HyperTextAccessibleWrap.h index a0454c6c948..16f1fa5aeb1 100644 --- a/accessible/windows/msaa/HyperTextAccessibleWrap.h +++ b/accessible/windows/msaa/HyperTextAccessibleWrap.h @@ -42,14 +42,6 @@ protected: virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText, uint32_t *aStartOffset, uint32_t *aEndOffset); - - static StaticRefPtr sLastTextChangeAcc; - static StaticAutoPtr sLastTextChangeString; - static bool sLastTextChangeWasInsert; - static uint32_t sLastTextChangeStart; - static uint32_t sLastTextChangeEnd; - - friend void PlatformInit(); }; } // namespace a11y diff --git a/accessible/windows/msaa/Platform.cpp b/accessible/windows/msaa/Platform.cpp index 65b33102f3e..2c45f29c4ec 100644 --- a/accessible/windows/msaa/Platform.cpp +++ b/accessible/windows/msaa/Platform.cpp @@ -9,12 +9,11 @@ #include "AccEvent.h" #include "Compatibility.h" #include "HyperTextAccessibleWrap.h" +#include "ia2AccessibleText.h" #include "nsWinUtils.h" #include "mozilla/a11y/ProxyAccessible.h" #include "ProxyWrappers.h" -#include "mozilla/ClearOnShutdown.h" - using namespace mozilla; using namespace mozilla::a11y; @@ -24,8 +23,7 @@ a11y::PlatformInit() Compatibility::Init(); nsWinUtils::MaybeStartWindowEmulation(); - ClearOnShutdown(&HyperTextAccessibleWrap::sLastTextChangeAcc); - ClearOnShutdown(&HyperTextAccessibleWrap::sLastTextChangeString); + ia2AccessibleText::InitTextChangeData(); } void