bug 1192330 - move static text change data from HyperTextAccessibleWrap to ia2AccessibleText r=surkov

This will enable us to remove the virtual function GetModifiedText().
This commit is contained in:
Trevor Saunders 2015-08-06 15:27:35 -04:00
parent eedf7b74e2
commit 6deda0cbcd
5 changed files with 23 additions and 18 deletions

View File

@ -13,9 +13,16 @@
#include "HyperTextAccessibleWrap.h" #include "HyperTextAccessibleWrap.h"
#include "HyperTextAccessible-inl.h" #include "HyperTextAccessible-inl.h"
#include "ProxyWrappers.h" #include "ProxyWrappers.h"
#include "mozilla/ClearOnShutdown.h"
using namespace mozilla::a11y; using namespace mozilla::a11y;
StaticRefPtr<Accessible> ia2AccessibleText::sLastTextChangeAcc;
StaticAutoPtr<nsString> ia2AccessibleText::sLastTextChangeString;
uint32_t ia2AccessibleText::sLastTextChangeStart = 0;
uint32_t ia2AccessibleText::sLastTextChangeEnd = 0;
bool ia2AccessibleText::sLastTextChangeWasInsert = false;
// IAccessibleText // IAccessibleText
STDMETHODIMP STDMETHODIMP
@ -608,3 +615,9 @@ ia2AccessibleText::GetGeckoTextBoundary(enum IA2TextBoundaryType aBoundaryType)
} }
} }
void
ia2AccessibleText::InitTextChangeData()
{
ClearOnShutdown(&sLastTextChangeAcc);
ClearOnShutdown(&sLastTextChangeString);
}

View File

@ -113,11 +113,19 @@ public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText( virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText(
/* [retval][out] */ IA2TextSegment *oldText); /* [retval][out] */ IA2TextSegment *oldText);
static void InitTextChangeData();
protected: protected:
virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText, virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
uint32_t *aStartOffset, uint32_t *aStartOffset,
uint32_t *aEndOffset) = 0; uint32_t *aEndOffset) = 0;
static StaticRefPtr<Accessible> sLastTextChangeAcc;
static StaticAutoPtr<nsString> sLastTextChangeString;
static bool sLastTextChangeWasInsert;
static uint32_t sLastTextChangeStart;
static uint32_t sLastTextChangeEnd;
private: private:
HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText); HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText);
AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType); AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType);

View File

@ -15,12 +15,6 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::a11y; using namespace mozilla::a11y;
StaticRefPtr<Accessible> HyperTextAccessibleWrap::sLastTextChangeAcc;
StaticAutoPtr<nsString> HyperTextAccessibleWrap::sLastTextChangeString;
uint32_t HyperTextAccessibleWrap::sLastTextChangeStart = 0;
uint32_t HyperTextAccessibleWrap::sLastTextChangeEnd = 0;
bool HyperTextAccessibleWrap::sLastTextChangeWasInsert = false;
NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap, NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap,
HyperTextAccessible) HyperTextAccessible)

View File

@ -42,14 +42,6 @@ protected:
virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText, virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
uint32_t *aStartOffset, uint32_t *aStartOffset,
uint32_t *aEndOffset); uint32_t *aEndOffset);
static StaticRefPtr<Accessible> sLastTextChangeAcc;
static StaticAutoPtr<nsString> sLastTextChangeString;
static bool sLastTextChangeWasInsert;
static uint32_t sLastTextChangeStart;
static uint32_t sLastTextChangeEnd;
friend void PlatformInit();
}; };
} // namespace a11y } // namespace a11y

View File

@ -9,12 +9,11 @@
#include "AccEvent.h" #include "AccEvent.h"
#include "Compatibility.h" #include "Compatibility.h"
#include "HyperTextAccessibleWrap.h" #include "HyperTextAccessibleWrap.h"
#include "ia2AccessibleText.h"
#include "nsWinUtils.h" #include "nsWinUtils.h"
#include "mozilla/a11y/ProxyAccessible.h" #include "mozilla/a11y/ProxyAccessible.h"
#include "ProxyWrappers.h" #include "ProxyWrappers.h"
#include "mozilla/ClearOnShutdown.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::a11y; using namespace mozilla::a11y;
@ -24,8 +23,7 @@ a11y::PlatformInit()
Compatibility::Init(); Compatibility::Init();
nsWinUtils::MaybeStartWindowEmulation(); nsWinUtils::MaybeStartWindowEmulation();
ClearOnShutdown(&HyperTextAccessibleWrap::sLastTextChangeAcc); ia2AccessibleText::InitTextChangeData();
ClearOnShutdown(&HyperTextAccessibleWrap::sLastTextChangeString);
} }
void void