bug 1192330 - move static text change data from HyperTextAccessibleWrap to ia2AccessibleText r=surkov
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Thu, 06 Aug 2015 15:27:35 -0400
changeset 286608 5c1af6e4c004c018a3525c9053503f990c243189
parent 286607 6d2b9ae330a2e5e6c1a520f46cd085ef20d245c5
child 286609 d5b9c388f05a6ee50e1e5395197c6803f27df51c
push id4570
push userdburns@mozilla.com
push dateWed, 19 Aug 2015 19:33:48 +0000
reviewerssurkov
bugs1192330
milestone43.0a1
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
accessible/windows/ia2/ia2AccessibleText.h
accessible/windows/msaa/HyperTextAccessibleWrap.cpp
accessible/windows/msaa/HyperTextAccessibleWrap.h
accessible/windows/msaa/Platform.cpp
--- a/accessible/windows/ia2/ia2AccessibleText.cpp
+++ b/accessible/windows/ia2/ia2AccessibleText.cpp
@@ -8,19 +8,26 @@
 #include "ia2AccessibleText.h"
 
 #include "Accessible2.h"
 #include "AccessibleText_i.c"
 
 #include "HyperTextAccessibleWrap.h"
 #include "HyperTextAccessible-inl.h"
 #include "ProxyWrappers.h"
+#include "mozilla/ClearOnShutdown.h"
 
 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
 
 STDMETHODIMP
 ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
@@ -603,8 +610,14 @@ ia2AccessibleText::GetGeckoTextBoundary(
     //case IA2_TEXT_BOUNDARY_SENTENCE:
     //case IA2_TEXT_BOUNDARY_PARAGRAPH:
       // XXX: not implemented
     default:
       return -1;
   }
 }
 
+void
+ia2AccessibleText::InitTextChangeData()
+{
+  ClearOnShutdown(&sLastTextChangeAcc);
+  ClearOnShutdown(&sLastTextChangeString);
+}
--- a/accessible/windows/ia2/ia2AccessibleText.h
+++ b/accessible/windows/ia2/ia2AccessibleText.h
@@ -108,21 +108,29 @@ public:
       /* [in] */ long y);
 
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_newText(
       /* [retval][out] */ IA2TextSegment *newText);
 
   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<Accessible> sLastTextChangeAcc;
+  static StaticAutoPtr<nsString> sLastTextChangeString;
+  static bool sLastTextChangeWasInsert;
+  static uint32_t sLastTextChangeStart;
+  static uint32_t sLastTextChangeEnd;
+
 private:
   HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText);
   AccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType);
 };
 
 } // namespace a11y
 } // namespace mozilla
 
--- a/accessible/windows/msaa/HyperTextAccessibleWrap.cpp
+++ b/accessible/windows/msaa/HyperTextAccessibleWrap.cpp
@@ -10,22 +10,16 @@
 
 #include "nsEventShell.h"
 
 #include "mozilla/StaticPtr.h"
 
 using namespace mozilla;
 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,
                              HyperTextAccessible)
 
 STDMETHODIMP
 HyperTextAccessibleWrap::QueryInterface(REFIID aIID, void** aInstancePtr)
 {
   if (!aInstancePtr)
     return E_FAIL;
--- a/accessible/windows/msaa/HyperTextAccessibleWrap.h
+++ b/accessible/windows/msaa/HyperTextAccessibleWrap.h
@@ -37,22 +37,14 @@ public:
   virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
 protected:
   ~HyperTextAccessibleWrap() {}
 
   virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
                                    uint32_t *aStartOffset,
                                    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 mozilla
 
 #endif
--- a/accessible/windows/msaa/Platform.cpp
+++ b/accessible/windows/msaa/Platform.cpp
@@ -4,33 +4,31 @@
  * 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 "Platform.h"
 
 #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;
 
 void
 a11y::PlatformInit()
 {
   Compatibility::Init();
 
   nsWinUtils::MaybeStartWindowEmulation();
-  ClearOnShutdown(&HyperTextAccessibleWrap::sLastTextChangeAcc);
-  ClearOnShutdown(&HyperTextAccessibleWrap::sLastTextChangeString);
+  ia2AccessibleText::InitTextChangeData();
 }
 
 void
 a11y::PlatformShutdown()
 {
   ::DestroyCaret();
 
   nsWinUtils::ShutdownWindowEmulation();