Bug 1186014 Rename nsTextStore to mozilla::widget::TSFTextStore r=jimm+m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 24 Jul 2015 14:07:39 +0900
changeset 287755 807550417c75cc76e2acb417861063c3fa720cbd
parent 287754 68d8910a9cc3843a4244a96482e2fd5b7ffdc704
child 287756 a8f7b1fb0a7160cba223ee4a93216dca4feab23c
push id934
push userraliiev@mozilla.com
push dateMon, 26 Oct 2015 12:58:05 +0000
treeherdermozilla-release@05704e35c1d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1186014
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1186014 Rename nsTextStore to mozilla::widget::TSFTextStore r=jimm+m_kato
widget/windows/TSFTextStore.cpp
widget/windows/TSFTextStore.h
widget/windows/WinIMEHandler.cpp
widget/windows/WinUtils.cpp
widget/windows/moz.build
widget/windows/nsTextStore.cpp
widget/windows/nsTextStore.h
rename from widget/windows/nsTextStore.cpp
rename to widget/windows/TSFTextStore.cpp
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -14,40 +14,40 @@
 #include "WinUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/WindowsVersion.h"
 #include "nsIXULRuntime.h"
 
 #define INPUTSCOPE_INIT_GUID
 #define TEXTATTRS_INIT_GUID
-#include "nsTextStore.h"
-
-using namespace mozilla;
-using namespace mozilla::widget;
+#include "TSFTextStore.h"
+
+namespace mozilla {
+namespace widget {
 
 static const char* kPrefNameEnableTSF = "intl.tsf.enable";
 static const char* kPrefNameForceEnableTSF = "intl.tsf.force_enable";
 
 /**
  * TSF related code should log its behavior even on release build especially
  * in the interface methods.
  *
  * In interface methods, use LogLevel::Info.
  * In internal methods, use LogLevel::Debug for logging normal behavior.
  * For logging error, use LogLevel::Error.
  *
  * When an instance method is called, start with following text:
- *   "TSF: 0x%p nsFoo::Bar(", the 0x%p should be the "this" of the nsFoo.
+ *   "TSF: 0x%p TSFFoo::Bar(", the 0x%p should be the "this" of the nsFoo.
  * after that, start with:
- *   "TSF: 0x%p   nsFoo::Bar("
+ *   "TSF: 0x%p   TSFFoo::Bar("
  * In an internal method, start with following text:
- *   "TSF: 0x%p   nsFoo::Bar("
+ *   "TSF: 0x%p   TSFFoo::Bar("
  * When a static method is called, start with following text:
- *   "TSF: nsFoo::Bar("
+ *   "TSF: TSFFoo::Bar("
  */
 
 PRLogModuleInfo* sTextStoreLog = nullptr;
 
 static const char*
 GetBoolName(bool aBool)
 {
   return aBool ? "true" : "false";
@@ -448,17 +448,17 @@ GetTextRunTypeName(TsRunType aRunType)
     case  TS_RT_OPAQUE:
       return "TS_RT_OPAQUE";
     default:
       return "Unknown";
   }
 }
 
 static nsCString
-GetColorName(const TF_DA_COLOR &aColor)
+GetColorName(const TF_DA_COLOR& aColor)
 {
   switch (aColor.type) {
     case TF_CT_NONE:
       return NS_LITERAL_CSTRING("TF_CT_NONE");
     case TF_CT_SYSCOLOR:
       return nsPrintfCString("TF_CT_SYSCOLOR, nIndex:0x%08X",
                              static_cast<int32_t>(aColor.nIndex));
     case TF_CT_COLORREF:
@@ -511,17 +511,17 @@ GetClauseAttrName(TF_DA_ATTR_INFO aAttr)
       return NS_LITERAL_CSTRING("TF_ATTR_OTHER");
     default: {
       return nsPrintfCString("Unknown(%08X)", static_cast<int32_t>(aAttr));
     }
   }
 }
 
 static nsCString
-GetDisplayAttrStr(const TF_DISPLAYATTRIBUTE &aDispAttr)
+GetDisplayAttrStr(const TF_DISPLAYATTRIBUTE& aDispAttr)
 {
   nsAutoCString str;
   str = "crText:{ ";
   str += GetColorName(aDispAttr.crText);
   str += " }, crBk:{ ";
   str += GetColorName(aDispAttr.crBk);
   str += " }, lsStyle: ";
   str += GetLineStyleName(aDispAttr.lsStyle);
@@ -726,20 +726,23 @@ public:
       *(pScope + idx) = mInputScopes[idx];
       (*pcCount)++;
     }
 
     *pprgInputScopes = pScope;
     return S_OK;
   }
 
-  STDMETHODIMP GetPhrase(BSTR **ppbstrPhrases, UINT *pcCount) { return E_NOTIMPL; }
-  STDMETHODIMP GetRegularExpression(BSTR *pbstrRegExp) { return E_NOTIMPL; }
-  STDMETHODIMP GetSRGS(BSTR *pbstrSRGS) { return E_NOTIMPL; }
-  STDMETHODIMP GetXML(BSTR *pbstrXML) { return E_NOTIMPL; }
+  STDMETHODIMP GetPhrase(BSTR **ppbstrPhrases, UINT* pcCount)
+  {
+    return E_NOTIMPL;
+  }
+  STDMETHODIMP GetRegularExpression(BSTR* pbstrRegExp) { return E_NOTIMPL; }
+  STDMETHODIMP GetSRGS(BSTR* pbstrSRGS) { return E_NOTIMPL; }
+  STDMETHODIMP GetXML(BSTR* pbstrXML) { return E_NOTIMPL; }
 
 private:
   nsTArray<InputScope> mInputScopes;
 };
 
 /******************************************************************/
 /* TSFStaticSink                                                  */
 /******************************************************************/
@@ -952,17 +955,17 @@ TSFStaticSink::Destroy()
     if (FAILED(hr)) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
         ("TSF: 0x%p   TSFStaticSink::Shutdown() FAILED to get "
          "ITfSource instance (0x%08X)", this, hr));
     } else {
       hr = source->UnadviseSink(mIPProfileCookie);
       if (FAILED(hr)) {
         MOZ_LOG(sTextStoreLog, LogLevel::Error,
-          ("TSF: 0x%p   nsTextStore::Shutdown() FAILED to uninstall "
+          ("TSF: 0x%p   TSFTextStore::Shutdown() FAILED to uninstall "
            "ITfInputProcessorProfileActivationSink (0x%08X)",
            this, hr));
       }
     }
   }
 
   if (mLangProfileCookie != TF_INVALID_COOKIE) {
     nsRefPtr<ITfSource> source;
@@ -1210,39 +1213,39 @@ TSFStaticSink::IsTIPCategoryKeyboard(REF
         profile.catid == GUID_TFCAT_TIP_KEYBOARD) {
       return true;
     }
   }
   return false;
 }
 
 /******************************************************************/
-/* nsTextStore                                                    */
+/* TSFTextStore                                                   */
 /******************************************************************/
 
-StaticRefPtr<ITfThreadMgr> nsTextStore::sThreadMgr;
-StaticRefPtr<ITfMessagePump> nsTextStore::sMessagePump;
-StaticRefPtr<ITfKeystrokeMgr> nsTextStore::sKeystrokeMgr;
-StaticRefPtr<ITfDisplayAttributeMgr> nsTextStore::sDisplayAttrMgr;
-StaticRefPtr<ITfCategoryMgr> nsTextStore::sCategoryMgr;
-StaticRefPtr<ITfDocumentMgr> nsTextStore::sDisabledDocumentMgr;
-StaticRefPtr<ITfContext> nsTextStore::sDisabledContext;
-StaticRefPtr<ITfInputProcessorProfiles> nsTextStore::sInputProcessorProfiles;
-StaticRefPtr<nsTextStore> nsTextStore::sEnabledTextStore;
-DWORD nsTextStore::sClientId  = 0;
-
-bool nsTextStore::sCreateNativeCaretForATOK = false;
-bool nsTextStore::sDoNotReturnNoLayoutErrorToFreeChangJie = false;
-bool nsTextStore::sDoNotReturnNoLayoutErrorToEasyChangjei = false;
-bool nsTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar = false;
-bool nsTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret = false;
+StaticRefPtr<ITfThreadMgr> TSFTextStore::sThreadMgr;
+StaticRefPtr<ITfMessagePump> TSFTextStore::sMessagePump;
+StaticRefPtr<ITfKeystrokeMgr> TSFTextStore::sKeystrokeMgr;
+StaticRefPtr<ITfDisplayAttributeMgr> TSFTextStore::sDisplayAttrMgr;
+StaticRefPtr<ITfCategoryMgr> TSFTextStore::sCategoryMgr;
+StaticRefPtr<ITfDocumentMgr> TSFTextStore::sDisabledDocumentMgr;
+StaticRefPtr<ITfContext> TSFTextStore::sDisabledContext;
+StaticRefPtr<ITfInputProcessorProfiles> TSFTextStore::sInputProcessorProfiles;
+StaticRefPtr<TSFTextStore> TSFTextStore::sEnabledTextStore;
+DWORD TSFTextStore::sClientId  = 0;
+
+bool TSFTextStore::sCreateNativeCaretForATOK = false;
+bool TSFTextStore::sDoNotReturnNoLayoutErrorToFreeChangJie = false;
+bool TSFTextStore::sDoNotReturnNoLayoutErrorToEasyChangjei = false;
+bool TSFTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar = false;
+bool TSFTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret = false;
 
 #define TEXTSTORE_DEFAULT_VIEW (1)
 
-nsTextStore::nsTextStore()
+TSFTextStore::TSFTextStore()
   : mEditCookie(0)
   , mSinkMask(0)
   , mLock(0)
   , mLockQueued(0)
   , mLockedContent(mComposition, mSelection)
   , mRequestedAttrValues(false)
   , mIsRecordingActionsWithoutLock(false)
   , mPendingOnSelectionChange(false)
@@ -1255,87 +1258,87 @@ nsTextStore::nsTextStore()
   for (int32_t i = 0; i < NUM_OF_SUPPORTED_ATTRS; i++) {
     mRequestedAttrs[i] = false;
   }
 
   // We hope that 5 or more actions don't occur at once.
   mPendingActions.SetCapacity(5);
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::nsTestStore() SUCCEEDED", this));
+    ("TSF: 0x%p TSFTextStore::TSFTextStore() SUCCEEDED", this));
 }
 
-nsTextStore::~nsTextStore()
+TSFTextStore::~TSFTextStore()
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore instance is destroyed", this));
+    ("TSF: 0x%p TSFTextStore instance is destroyed", this));
 }
 
 bool
-nsTextStore::Init(nsWindowBase* aWidget)
+TSFTextStore::Init(nsWindowBase* aWidget)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::Init(aWidget=0x%p)",
+    ("TSF: 0x%p TSFTextStore::Init(aWidget=0x%p)",
      this, aWidget));
 
   TSFStaticSink::GetInstance()->EnsureInitActiveTIPKeyboard();
 
   if (mDocumentMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::Init() FAILED due to already initialized",
+      ("TSF: 0x%p   TSFTextStore::Init() FAILED due to already initialized",
        this));
     return false;
   }
 
   // Create document manager
   HRESULT hr = sThreadMgr->CreateDocumentMgr(getter_AddRefs(mDocumentMgr));
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::Init() FAILED to create DocumentMgr "
+      ("TSF: 0x%p   TSFTextStore::Init() FAILED to create DocumentMgr "
        "(0x%08X)", this, hr));
     return false;
   }
   mWidget = aWidget;
 
   // Create context and add it to document manager
   hr = mDocumentMgr->CreateContext(sClientId, 0,
                                    static_cast<ITextStoreACP*>(this),
                                    getter_AddRefs(mContext), &mEditCookie);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::Init() FAILED to create the context "
+      ("TSF: 0x%p   TSFTextStore::Init() FAILED to create the context "
        "(0x%08X)", this, hr));
     mDocumentMgr = nullptr;
     return false;
   }
 
   hr = mDocumentMgr->Push(mContext);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::Init() FAILED to push the context (0x%08X)",
+      ("TSF: 0x%p   TSFTextStore::Init() FAILED to push the context (0x%08X)",
        this, hr));
     // XXX Why don't we use NS_IF_RELEASE() here??
     mContext = nullptr;
     mDocumentMgr = nullptr;
     return false;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p   nsTextStore::Init() succeeded: "
+    ("TSF: 0x%p   TSFTextStore::Init() succeeded: "
      "mDocumentMgr=0x%p, mContext=0x%p, mEditCookie=0x%08X",
      this, mDocumentMgr.get(), mContext.get(), mEditCookie));
 
   return true;
 }
 
 bool
-nsTextStore::Destroy()
+TSFTextStore::Destroy()
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::Destroy(), mLock=%s, "
+    ("TSF: 0x%p TSFTextStore::Destroy(), mLock=%s, "
      "mComposition.IsComposing()=%s",
      this, GetLockFlagNameStr(mLock).get(),
      GetBoolName(mComposition.IsComposing())));
 
   if (mLock) {
     mPendingDestroy = true;
     return true;
   }
@@ -1344,17 +1347,17 @@ nsTextStore::Destroy()
   // store destroyed.  So, we should clear the composition here.
   if (mComposition.IsComposing()) {
     NS_WARNING("Composition is still alive at destroying the text store");
     CommitCompositionInternal(false);
   }
 
   if (mSink) {
     MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-      ("TSF: 0x%p   nsTextStore::Destroy(), calling "
+      ("TSF: 0x%p   TSFTextStore::Destroy(), calling "
        "ITextStoreACPSink::OnLayoutChange(TS_LC_DESTROY)...",
        this));
     mSink->OnLayoutChange(TS_LC_DESTROY, TEXTSTORE_DEFAULT_VIEW);
   }
 
   mLockedContent.Clear();
   mSelection.MarkDirty();
 
@@ -1363,168 +1366,168 @@ nsTextStore::Destroy()
     mDocumentMgr->Pop(TF_POPF_ALL);
     mDocumentMgr = nullptr;
   }
   mSink = nullptr;
   mWidget = nullptr;
 
   if (!mMouseTrackers.IsEmpty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-      ("TSF: 0x%p   nsTextStore::Destroy(), removing a mouse tracker...",
+      ("TSF: 0x%p   TSFTextStore::Destroy(), removing a mouse tracker...",
        this));
     mMouseTrackers.Clear();
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p   nsTextStore::Destroy() succeeded", this));
+    ("TSF: 0x%p   TSFTextStore::Destroy() succeeded", this));
   return true;
 }
 
 STDMETHODIMP
-nsTextStore::QueryInterface(REFIID riid,
-                            void** ppv)
+TSFTextStore::QueryInterface(REFIID riid,
+                             void** ppv)
 {
   *ppv=nullptr;
   if ( (IID_IUnknown == riid) || (IID_ITextStoreACP == riid) ) {
     *ppv = static_cast<ITextStoreACP*>(this);
   } else if (IID_ITfContextOwnerCompositionSink == riid) {
     *ppv = static_cast<ITfContextOwnerCompositionSink*>(this);
   } else if (IID_ITfMouseTrackerACP == riid) {
     *ppv = static_cast<ITfMouseTrackerACP*>(this);
   }
   if (*ppv) {
     AddRef();
     return S_OK;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Error,
-    ("TSF: 0x%p nsTextStore::QueryInterface() FAILED, riid=%s",
+    ("TSF: 0x%p TSFTextStore::QueryInterface() FAILED, riid=%s",
      this, GetRIIDNameStr(riid).get()));
   return E_NOINTERFACE;
 }
 
 STDMETHODIMP
-nsTextStore::AdviseSink(REFIID riid,
-                        IUnknown *punk,
-                        DWORD dwMask)
+TSFTextStore::AdviseSink(REFIID riid,
+                         IUnknown* punk,
+                         DWORD dwMask)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::AdviseSink(riid=%s, punk=0x%p, dwMask=%s), "
+    ("TSF: 0x%p TSFTextStore::AdviseSink(riid=%s, punk=0x%p, dwMask=%s), "
      "mSink=0x%p, mSinkMask=%s",
      this, GetRIIDNameStr(riid).get(), punk, GetSinkMaskNameStr(dwMask).get(),
      mSink.get(), GetSinkMaskNameStr(mSinkMask).get()));
 
   if (!punk) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::AdviseSink() FAILED due to the null punk",
+      ("TSF: 0x%p   TSFTextStore::AdviseSink() FAILED due to the null punk",
        this));
     return E_UNEXPECTED;
   }
 
   if (IID_ITextStoreACPSink != riid) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::AdviseSink() FAILED due to "
+      ("TSF: 0x%p   TSFTextStore::AdviseSink() FAILED due to "
        "unsupported interface", this));
     return E_INVALIDARG; // means unsupported interface.
   }
 
   if (!mSink) {
     // Install sink
     punk->QueryInterface(IID_ITextStoreACPSink, getter_AddRefs(mSink));
     if (!mSink) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-        ("TSF: 0x%p   nsTextStore::AdviseSink() FAILED due to "
+        ("TSF: 0x%p   TSFTextStore::AdviseSink() FAILED due to "
          "punk not having the interface", this));
       return E_UNEXPECTED;
     }
   } else {
     // If sink is already installed we check to see if they are the same
     // Get IUnknown from both sides for comparison
     nsRefPtr<IUnknown> comparison1, comparison2;
     punk->QueryInterface(IID_IUnknown, getter_AddRefs(comparison1));
     mSink->QueryInterface(IID_IUnknown, getter_AddRefs(comparison2));
     if (comparison1 != comparison2) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-        ("TSF: 0x%p   nsTextStore::AdviseSink() FAILED due to "
+        ("TSF: 0x%p   TSFTextStore::AdviseSink() FAILED due to "
          "the sink being different from the stored sink", this));
       return CONNECT_E_ADVISELIMIT;
     }
   }
   // Update mask either for a new sink or an existing sink
   mSinkMask = dwMask;
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::UnadviseSink(IUnknown *punk)
+TSFTextStore::UnadviseSink(IUnknown* punk)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::UnadviseSink(punk=0x%p), mSink=0x%p",
+    ("TSF: 0x%p TSFTextStore::UnadviseSink(punk=0x%p), mSink=0x%p",
      this, punk, mSink.get()));
 
   if (!punk) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::UnadviseSink() FAILED due to the null punk",
+      ("TSF: 0x%p   TSFTextStore::UnadviseSink() FAILED due to the null punk",
        this));
     return E_INVALIDARG;
   }
   if (!mSink) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::UnadviseSink() FAILED due to "
+      ("TSF: 0x%p   TSFTextStore::UnadviseSink() FAILED due to "
        "any sink not stored", this));
     return CONNECT_E_NOCONNECTION;
   }
   // Get IUnknown from both sides for comparison
   nsRefPtr<IUnknown> comparison1, comparison2;
   punk->QueryInterface(IID_IUnknown, getter_AddRefs(comparison1));
   mSink->QueryInterface(IID_IUnknown, getter_AddRefs(comparison2));
   // Unadvise only if sinks are the same
   if (comparison1 != comparison2) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::UnadviseSink() FAILED due to "
+      ("TSF: 0x%p   TSFTextStore::UnadviseSink() FAILED due to "
        "the sink being different from the stored sink", this));
     return CONNECT_E_NOCONNECTION;
   }
   mSink = nullptr;
   mSinkMask = 0;
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::RequestLock(DWORD dwLockFlags,
-                         HRESULT *phrSession)
+TSFTextStore::RequestLock(DWORD dwLockFlags,
+                          HRESULT* phrSession)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::RequestLock(dwLockFlags=%s, phrSession=0x%p), "
+    ("TSF: 0x%p TSFTextStore::RequestLock(dwLockFlags=%s, phrSession=0x%p), "
      "mLock=%s", this, GetLockFlagNameStr(dwLockFlags).get(), phrSession,
      GetLockFlagNameStr(mLock).get()));
 
   if (!mSink) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::RequestLock() FAILED due to "
+      ("TSF: 0x%p   TSFTextStore::RequestLock() FAILED due to "
        "any sink not stored", this));
     return E_FAIL;
   }
   if (!phrSession) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::RequestLock() FAILED due to "
+      ("TSF: 0x%p   TSFTextStore::RequestLock() FAILED due to "
        "null phrSession", this));
     return E_INVALIDARG;
   }
 
   if (!mLock) {
     // put on lock
     mLock = dwLockFlags & (~TS_LF_SYNC);
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
       ("TSF: 0x%p   Locking (%s) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
        ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
        this, GetLockFlagNameStr(mLock).get()));
     // Don't release this instance during this lock because this is called by
     // TSF but they don't grab us during this call.
-    nsRefPtr<nsTextStore> kungFuDeathGrip(this);
+    nsRefPtr<TSFTextStore> kungFuDeathGrip(this);
     *phrSession = mSink->OnLockGranted(mLock);
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
       ("TSF: 0x%p   Unlocked (%s) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
        "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<",
        this, GetLockFlagNameStr(mLock).get()));
     DidLockGranted();
     while (mLockQueued) {
       mLock = mLockQueued;
@@ -1542,44 +1545,44 @@ nsTextStore::RequestLock(DWORD dwLockFla
     }
 
     // The document is now completely unlocked.
     mLock = 0;
 
     MaybeFlushPendingNotifications();
 
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-      ("TSF: 0x%p   nsTextStore::RequestLock() succeeded: *phrSession=%s",
+      ("TSF: 0x%p   TSFTextStore::RequestLock() succeeded: *phrSession=%s",
        this, GetTextStoreReturnValueName(*phrSession)));
     return S_OK;
   }
 
   // only time when reentrant lock is allowed is when caller holds a
   // read-only lock and is requesting an async write lock
   if (IsReadLocked() && !IsReadWriteLocked() && IsReadWriteLock(dwLockFlags) &&
       !(dwLockFlags & TS_LF_SYNC)) {
     *phrSession = TS_S_ASYNC;
     mLockQueued = dwLockFlags & (~TS_LF_SYNC);
 
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-      ("TSF: 0x%p   nsTextStore::RequestLock() stores the request in the "
+      ("TSF: 0x%p   TSFTextStore::RequestLock() stores the request in the "
        "queue, *phrSession=TS_S_ASYNC", this));
     return S_OK;
   }
 
   // no more locks allowed
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p   nsTextStore::RequestLock() didn't allow to lock, "
+    ("TSF: 0x%p   TSFTextStore::RequestLock() didn't allow to lock, "
      "*phrSession=TS_E_SYNCHRONOUS", this));
   *phrSession = TS_E_SYNCHRONOUS;
   return E_FAIL;
 }
 
 void
-nsTextStore::DidLockGranted()
+TSFTextStore::DidLockGranted()
 {
   if (mNativeCaretIsCreated) {
     ::DestroyCaret();
     mNativeCaretIsCreated = false;
   }
   if (IsReadWriteLocked()) {
     // FreeCJ (TIP for Traditional Chinese) calls SetSelection() to set caret
     // to the start of composition string and insert a full width space for
@@ -1594,31 +1597,31 @@ nsTextStore::DidLockGranted()
   // If the widget has gone, we don't need to notify anything.
   if (!mWidget || mWidget->Destroyed()) {
     mPendingOnSelectionChange = false;
     mPendingOnLayoutChange = false;
   }
 }
 
 void
-nsTextStore::DispatchEvent(WidgetGUIEvent& aEvent)
+TSFTextStore::DispatchEvent(WidgetGUIEvent& aEvent)
 {
   if (NS_WARN_IF(!mWidget) || NS_WARN_IF(mWidget->Destroyed())) {
     return;
   }
   // If the event isn't a query content event, the event may be handled
   // asynchronously.  So, we should put off to answer from GetTextExt() etc.
   if (!aEvent.AsQueryContentEvent()) {
     mDeferNotifyingTSF = true;
   }
   mWidget->DispatchWindowEvent(&aEvent);
 }
 
 void
-nsTextStore::FlushPendingActions()
+TSFTextStore::FlushPendingActions()
 {
   if (!mWidget || mWidget->Destroyed()) {
     mPendingActions.Clear();
     mLockedContent.Clear();
     mPendingOnSelectionChange = false;
     mPendingOnLayoutChange = false;
     return;
   }
@@ -1629,53 +1632,53 @@ nsTextStore::FlushPendingActions()
   mPendingClearLockedContent = !mPendingActions.Length();
 
   nsRefPtr<nsWindowBase> kungFuDeathGrip(mWidget);
   for (uint32_t i = 0; i < mPendingActions.Length(); i++) {
     PendingAction& action = mPendingActions[i];
     switch (action.mType) {
       case PendingAction::COMPOSITION_START: {
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
+               ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "flushing COMPOSITION_START={ mSelectionStart=%d, "
                 "mSelectionLength=%d }",
                 this, action.mSelectionStart, action.mSelectionLength));
 
         if (action.mAdjustSelection) {
           // Select composition range so the new composition replaces the range
           WidgetSelectionEvent selectionSet(true, NS_SELECTION_SET, mWidget);
           mWidget->InitEvent(selectionSet);
           selectionSet.mOffset = static_cast<uint32_t>(action.mSelectionStart);
           selectionSet.mLength = static_cast<uint32_t>(action.mSelectionLength);
           selectionSet.mReversed = false;
           DispatchEvent(selectionSet);
           if (!selectionSet.mSucceeded) {
             MOZ_LOG(sTextStoreLog, LogLevel::Error,
-                   ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
+                   ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                     "FAILED due to NS_SELECTION_SET failure", this));
             break;
           }
         }
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
+               ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "dispatching compositionstart event...", this));
         WidgetCompositionEvent compositionStart(true, NS_COMPOSITION_START,
                                                 mWidget);
         mWidget->InitEvent(compositionStart);
         // NS_COMPOSITION_START always causes NOTIFY_IME_OF_COMPOSITION_UPDATE.
         mPendingClearLockedContent = true;
         DispatchEvent(compositionStart);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
         break;
       }
       case PendingAction::COMPOSITION_UPDATE: {
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
+               ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "flushing COMPOSITION_UPDATE={ mData=\"%s\", "
                 "mRanges=0x%p, mRanges->Length()=%d }",
                 this, NS_ConvertUTF16toUTF8(action.mData).get(), action.mRanges.get(),
                 action.mRanges ? action.mRanges->Length() : 0));
 
         if (!action.mRanges) {
           NS_WARNING("How does this case occur?");
           action.mRanges = new TextRangeArray();
@@ -1706,17 +1709,17 @@ nsTextStore::FlushPendingActions()
             range.mEndOffset = range.mStartOffset + clause.Length();
           }
         }
 
         action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                                       NS_LITERAL_STRING("\n"));
 
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
+               ("TSF: 0x%p   TSFTextStore::FlushPendingActions(), "
                 "dispatching compositionchange event...", this));
         WidgetCompositionEvent compositionChange(true, NS_COMPOSITION_CHANGE,
                                                  mWidget);
         mWidget->InitEvent(compositionChange);
         compositionChange.mData = action.mData;
         if (action.mRanges->IsEmpty()) {
           TextRange wholeRange;
           wholeRange.mStartOffset = 0;
@@ -1731,25 +1734,25 @@ nsTextStore::FlushPendingActions()
           mPendingClearLockedContent = true;
         }
         DispatchEvent(compositionChange);
         // Be aware, the mWidget might already have been destroyed.
         break;
       }
       case PendingAction::COMPOSITION_END: {
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
+               ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "flushing COMPOSITION_END={ mData=\"%s\" }",
                 this, NS_ConvertUTF16toUTF8(action.mData).get()));
 
         action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                                       NS_LITERAL_STRING("\n"));
 
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
+               ("TSF: 0x%p   TSFTextStore::FlushPendingActions(), "
                 "dispatching compositioncommit event...", this));
         WidgetCompositionEvent compositionCommit(true, NS_COMPOSITION_COMMIT,
                                                  mWidget);
         mWidget->InitEvent(compositionCommit);
         compositionCommit.mData = action.mData;
         // When the NS_COMPOSITION_COMMIT causes a DOM text event,
         // NOTIFY_IME_OF_COMPOSITION_UPDATE will be notified.
         if (compositionCommit.CausesDOMTextEvent()) {
@@ -1758,17 +1761,17 @@ nsTextStore::FlushPendingActions()
         DispatchEvent(compositionCommit);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
         break;
       }
       case PendingAction::SELECTION_SET: {
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
+               ("TSF: 0x%p   TSFTextStore::FlushPendingActions() "
                 "flushing SELECTION_SET={ mSelectionStart=%d, "
                 "mSelectionLength=%d, mSelectionReversed=%s }",
                 this, action.mSelectionStart, action.mSelectionLength,
                 GetBoolName(action.mSelectionReversed)));
 
         WidgetSelectionEvent selectionSet(true, NS_SELECTION_SET, mWidget);
         selectionSet.mOffset = 
           static_cast<uint32_t>(action.mSelectionStart);
@@ -1781,37 +1784,37 @@ nsTextStore::FlushPendingActions()
         MOZ_CRASH("unexpected action type");
     }
 
     if (mWidget && !mWidget->Destroyed()) {
       continue;
     }
 
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
+           ("TSF: 0x%p   TSFTextStore::FlushPendingActions(), "
             "qutting since the mWidget has gone", this));
     break;
   }
   mPendingActions.Clear();
 }
 
 void
-nsTextStore::MaybeFlushPendingNotifications()
+TSFTextStore::MaybeFlushPendingNotifications()
 {
   if (mDeferNotifyingTSF) {
     MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-           ("TSF: 0x%p   nsTextStore::MaybeFlushPendingNotifications(), "
+           ("TSF: 0x%p   TSFTextStore::MaybeFlushPendingNotifications(), "
             "putting off flushing pending notifications due to being "
             "dispatching events...", this));
     return;
   }
 
   if (IsReadLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-           ("TSF: 0x%p   nsTextStore::MaybeFlushPendingNotifications(), "
+           ("TSF: 0x%p   TSFTextStore::MaybeFlushPendingNotifications(), "
             "putting off flushing pending notifications due to being the "
             "document locked...", this));
     return;
   }
 
   if (mPendingDestroy) {
     Destroy();
     return;
@@ -1819,134 +1822,134 @@ nsTextStore::MaybeFlushPendingNotificati
 
   if (mPendingClearLockedContent) {
     mPendingClearLockedContent = false;
     mLockedContent.Clear();
   }
 
   if (mPendingOnLayoutChange) {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::MaybeFlushPendingNotifications(), "
-            "calling nsTextStore::NotifyTSFOfLayoutChange()...", this));
+           ("TSF: 0x%p   TSFTextStore::MaybeFlushPendingNotifications(), "
+            "calling TSFTextStore::NotifyTSFOfLayoutChange()...", this));
     NotifyTSFOfLayoutChange(true);
   }
 
   if (mPendingOnSelectionChange) {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::MaybeFlushPendingNotifications(), "
-            "calling nsTextStore::NotifyTSFOfSelectionChange()...", this));
+           ("TSF: 0x%p   TSFTextStore::MaybeFlushPendingNotifications(), "
+            "calling TSFTextStore::NotifyTSFOfSelectionChange()...", this));
     NotifyTSFOfSelectionChange();
   }
 }
 
 STDMETHODIMP
-nsTextStore::GetStatus(TS_STATUS *pdcs)
+TSFTextStore::GetStatus(TS_STATUS* pdcs)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::GetStatus(pdcs=0x%p)", this, pdcs));
+    ("TSF: 0x%p TSFTextStore::GetStatus(pdcs=0x%p)", this, pdcs));
 
   if (!pdcs) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: 0x%p   nsTextStore::GetStatus() FAILED due to null pdcs", this));
+      ("TSF: 0x%p   TSFTextStore::GetStatus() FAILED due to null pdcs", this));
     return E_INVALIDARG;
   }
   pdcs->dwDynamicFlags = 0;
   // we use a "flat" text model for TSF support so no hidden text
   pdcs->dwStaticFlags = TS_SS_NOHIDDENTEXT;
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::QueryInsert(LONG acpTestStart,
-                         LONG acpTestEnd,
-                         ULONG cch,
-                         LONG *pacpResultStart,
-                         LONG *pacpResultEnd)
+TSFTextStore::QueryInsert(LONG acpTestStart,
+                          LONG acpTestEnd,
+                          ULONG cch,
+                          LONG* pacpResultStart,
+                          LONG* pacpResultEnd)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::QueryInsert(acpTestStart=%ld, "
+         ("TSF: 0x%p TSFTextStore::QueryInsert(acpTestStart=%ld, "
           "acpTestEnd=%ld, cch=%lu, pacpResultStart=0x%p, pacpResultEnd=0x%p)",
           this, acpTestStart, acpTestEnd, cch, acpTestStart, acpTestEnd));
 
   if (!pacpResultStart || !pacpResultEnd) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::QueryInsert() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::QueryInsert() FAILED due to "
             "the null argument", this));
     return E_INVALIDARG;
   }
 
   if (acpTestStart < 0 || acpTestStart > acpTestEnd) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::QueryInsert() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::QueryInsert() FAILED due to "
             "wrong argument", this));
     return E_INVALIDARG;
   }
 
   // XXX need to adjust to cluster boundary
   // Assume we are given good offsets for now
   *pacpResultStart = acpTestStart;
   *pacpResultEnd = acpTestStart + cch;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p  nsTextStore::QueryInsert() succeeded: "
+         ("TSF: 0x%p  TSFTextStore::QueryInsert() succeeded: "
           "*pacpResultStart=%ld, *pacpResultEnd=%ld)",
           this, *pacpResultStart, *pacpResultEnd));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::GetSelection(ULONG ulIndex,
-                          ULONG ulCount,
-                          TS_SELECTION_ACP *pSelection,
-                          ULONG *pcFetched)
+TSFTextStore::GetSelection(ULONG ulIndex,
+                           ULONG ulCount,
+                           TS_SELECTION_ACP* pSelection,
+                           ULONG* pcFetched)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetSelection(ulIndex=%lu, ulCount=%lu, "
+         ("TSF: 0x%p TSFTextStore::GetSelection(ulIndex=%lu, ulCount=%lu, "
           "pSelection=0x%p, pcFetched=0x%p)",
           this, ulIndex, ulCount, pSelection, pcFetched));
 
   if (!IsReadLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetSelection() FAILED due to not locked",
+           ("TSF: 0x%p   TSFTextStore::GetSelection() FAILED due to not locked",
             this));
     return TS_E_NOLOCK;
   }
   if (!ulCount || !pSelection || !pcFetched) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetSelection() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   *pcFetched = 0;
 
   if (ulIndex != static_cast<ULONG>(TS_DEFAULT_SELECTION) &&
       ulIndex != 0) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetSelection() FAILED due to "
             "unsupported selection", this));
     return TS_E_NOSELECTION;
   }
 
   Selection& currentSel = CurrentSelection();
   if (currentSel.IsDirty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetSelection() FAILED due to "
             "CurrentSelection() failure", this));
     return E_FAIL;
   }
   *pSelection = currentSel.ACP();
   *pcFetched = 1;
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::GetSelection() succeeded", this));
+         ("TSF: 0x%p   TSFTextStore::GetSelection() succeeded", this));
   return S_OK;
 }
 
-nsTextStore::Content&
-nsTextStore::LockedContent()
+TSFTextStore::Content&
+TSFTextStore::LockedContent()
 {
   // This should be called when the document is locked or the content hasn't
   // been abandoned yet.
   if (NS_WARN_IF(!IsReadLocked() && !mLockedContent.IsInitialized())) {
     mLockedContent.Clear();
     return mLockedContent;
   }
 
@@ -1962,25 +1965,25 @@ nsTextStore::LockedContent()
       mLockedContent.Clear();
       return mLockedContent;
     }
 
     mLockedContent.Init(text);
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::LockedContent(): "
+         ("TSF: 0x%p   TSFTextStore::LockedContent(): "
           "mLockedContent={ mText.Length()=%d }",
           this, mLockedContent.Text().Length()));
 
   return mLockedContent;
 }
 
 bool
-nsTextStore::GetCurrentText(nsAString& aTextContent)
+TSFTextStore::GetCurrentText(nsAString& aTextContent)
 {
   if (mLockedContent.IsInitialized()) {
     aTextContent = mLockedContent.Text();
     return true;
   }
 
   MOZ_ASSERT(mWidget && !mWidget->Destroyed());
 
@@ -1992,18 +1995,18 @@ nsTextStore::GetCurrentText(nsAString& a
     aTextContent.Truncate();
     return false;
   }
 
   aTextContent = queryText.mReply.mString;
   return true;
 }
 
-nsTextStore::Selection&
-nsTextStore::CurrentSelection()
+TSFTextStore::Selection&
+TSFTextStore::CurrentSelection()
 {
   if (mSelection.IsDirty()) {
     // If the window has never been available, we should crash since working
     // with broken values may make TIP confused.
     if (!mWidget || mWidget->Destroyed()) {
       MOZ_CRASH();
     }
 
@@ -2015,17 +2018,17 @@ nsTextStore::CurrentSelection()
 
     mSelection.SetSelection(querySelection.mReply.mOffset,
                             querySelection.mReply.mString.Length(),
                             querySelection.mReply.mReversed,
                             querySelection.GetWritingMode());
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::CurrentSelection(): "
+         ("TSF: 0x%p   TSFTextStore::CurrentSelection(): "
           "acpStart=%d, acpEnd=%d (length=%d), reverted=%s",
           this, mSelection.StartOffset(), mSelection.EndOffset(),
           mSelection.Length(),
           GetBoolName(mSelection.IsReversed())));
 
   return mSelection;
 }
 
@@ -2034,17 +2037,17 @@ GetRangeExtent(ITfRange* aRange, LONG* a
 {
   nsRefPtr<ITfRangeACP> rangeACP;
   aRange->QueryInterface(IID_ITfRangeACP, getter_AddRefs(rangeACP));
   NS_ENSURE_TRUE(rangeACP, E_FAIL);
   return rangeACP->GetExtent(aStart, aLength);
 }
 
 static uint32_t
-GetGeckoSelectionValue(TF_DISPLAYATTRIBUTE &aDisplayAttr)
+GetGeckoSelectionValue(TF_DISPLAYATTRIBUTE& aDisplayAttr)
 {
   uint32_t result;
   switch (aDisplayAttr.bAttr) {
     case TF_ATTR_TARGET_CONVERTED:
       result = NS_TEXTRANGE_SELECTEDCONVERTEDTEXT;
       break;
     case TF_ATTR_CONVERTED:
       result = NS_TEXTRANGE_CONVERTEDTEXT;
@@ -2055,184 +2058,184 @@ GetGeckoSelectionValue(TF_DISPLAYATTRIBU
     default:
       result = NS_TEXTRANGE_RAWINPUT;
       break;
   }
   return result;
 }
 
 HRESULT
-nsTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty,
-                                 ITfRange* aRange,
-                                 TF_DISPLAYATTRIBUTE* aResult)
+TSFTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty,
+                                  ITfRange* aRange,
+                                  TF_DISPLAYATTRIBUTE* aResult)
 {
   NS_ENSURE_TRUE(aAttrProperty, E_FAIL);
   NS_ENSURE_TRUE(aRange, E_FAIL);
   NS_ENSURE_TRUE(aResult, E_FAIL);
 
   HRESULT hr;
 
   if (MOZ_LOG_TEST(sTextStoreLog, LogLevel::Debug)) {
     LONG start = 0, length = 0;
     hr = GetRangeExtent(aRange, &start, &length);
     MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-           ("TSF: 0x%p   nsTextStore::GetDisplayAttribute(): "
+           ("TSF: 0x%p   TSFTextStore::GetDisplayAttribute(): "
             "GetDisplayAttribute range=%ld-%ld (hr=%s)",
             this, start - mComposition.mStart,
             start - mComposition.mStart + length,
             GetCommonReturnValueName(hr)));
   }
 
   VARIANT propValue;
   ::VariantInit(&propValue);
   hr = aAttrProperty->GetValue(TfEditCookie(mEditCookie), aRange, &propValue);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetDisplayAttribute() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetDisplayAttribute() FAILED due to "
             "ITfProperty::GetValue() failed", this));
     return hr;
   }
   if (VT_I4 != propValue.vt) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetDisplayAttribute() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetDisplayAttribute() FAILED due to "
             "ITfProperty::GetValue() returns non-VT_I4 value", this));
     ::VariantClear(&propValue);
     return E_FAIL;
   }
 
   NS_ENSURE_TRUE(sCategoryMgr, E_FAIL);
   GUID guid;
   hr = sCategoryMgr->GetGUID(DWORD(propValue.lVal), &guid);
   ::VariantClear(&propValue);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetDisplayAttribute() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetDisplayAttribute() FAILED due to "
             "ITfCategoryMgr::GetGUID() failed", this));
     return hr;
   }
 
   NS_ENSURE_TRUE(sDisplayAttrMgr, E_FAIL);
   nsRefPtr<ITfDisplayAttributeInfo> info;
   hr = sDisplayAttrMgr->GetDisplayAttributeInfo(guid, getter_AddRefs(info),
                                                 nullptr);
   if (FAILED(hr) || !info) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetDisplayAttribute() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetDisplayAttribute() FAILED due to "
             "ITfDisplayAttributeMgr::GetDisplayAttributeInfo() failed", this));
     return hr;
   }
 
   hr = info->GetAttributeInfo(aResult);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetDisplayAttribute() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetDisplayAttribute() FAILED due to "
             "ITfDisplayAttributeInfo::GetAttributeInfo() failed", this));
     return hr;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::GetDisplayAttribute() succeeded: "
+         ("TSF: 0x%p   TSFTextStore::GetDisplayAttribute() succeeded: "
           "Result={ %s }", this, GetDisplayAttrStr(*aResult).get()));
   return S_OK;
 }
 
 HRESULT
-nsTextStore::RestartCompositionIfNecessary(ITfRange* aRangeNew)
+TSFTextStore::RestartCompositionIfNecessary(ITfRange* aRangeNew)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RestartCompositionIfNecessary("
+         ("TSF: 0x%p   TSFTextStore::RestartCompositionIfNecessary("
           "aRangeNew=0x%p), mComposition.mView=0x%p",
           this, aRangeNew, mComposition.mView.get()));
 
   if (!mComposition.IsComposing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RestartCompositionIfNecessary() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RestartCompositionIfNecessary() FAILED "
             "due to no composition view", this));
     return E_FAIL;
   }
 
   HRESULT hr;
   nsRefPtr<ITfCompositionView> pComposition(mComposition.mView);
   nsRefPtr<ITfRange> composingRange(aRangeNew);
   if (!composingRange) {
     hr = pComposition->GetRange(getter_AddRefs(composingRange));
     if (FAILED(hr)) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::RestartCompositionIfNecessary() FAILED "
-              "due to pComposition->GetRange() failure", this));
+             ("TSF: 0x%p   TSFTextStore::RestartCompositionIfNecessary() "
+              "FAILED due to pComposition->GetRange() failure", this));
       return hr;
     }
   }
 
   // Get starting offset of the composition
   LONG compStart = 0, compLength = 0;
   hr = GetRangeExtent(composingRange, &compStart, &compLength);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RestartCompositionIfNecessary() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RestartCompositionIfNecessary() FAILED "
             "due to GetRangeExtent() failure", this));
     return hr;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RestartCompositionIfNecessary(), "
+         ("TSF: 0x%p   TSFTextStore::RestartCompositionIfNecessary(), "
           "range=%ld-%ld, mComposition={ mStart=%ld, mString.Length()=%lu }",
           this, compStart, compStart + compLength, mComposition.mStart,
           mComposition.mString.Length()));
 
   if (mComposition.mStart != compStart ||
       mComposition.mString.Length() != (ULONG)compLength) {
     // If the queried composition length is different from the length
     // of our composition string, OnUpdateComposition is being called
     // because a part of the original composition was committed.
     hr = RestartComposition(pComposition, composingRange);
     if (FAILED(hr)) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::RestartCompositionIfNecessary() FAILED "
-              "due to RestartComposition() failure", this));
+             ("TSF: 0x%p   TSFTextStore::RestartCompositionIfNecessary() "
+              "FAILED due to RestartComposition() failure", this));
       return hr;
     }
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RestartCompositionIfNecessary() succeeded",
+         ("TSF: 0x%p   TSFTextStore::RestartCompositionIfNecessary() succeeded",
           this));
   return S_OK;
 }
 
 HRESULT
-nsTextStore::RestartComposition(ITfCompositionView* aCompositionView,
-                                ITfRange* aNewRange)
+TSFTextStore::RestartComposition(ITfCompositionView* aCompositionView,
+                                 ITfRange* aNewRange)
 {
   Selection& currentSelection = CurrentSelection();
 
   LONG newStart, newLength;
   HRESULT hr = GetRangeExtent(aNewRange, &newStart, &newLength);
   LONG newEnd = newStart + newLength;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RestartComposition(aCompositionView=0x%p, "
+         ("TSF: 0x%p   TSFTextStore::RestartComposition(aCompositionView=0x%p, "
           "aNewRange=0x%p { newStart=%d, newLength=%d }), "
           "mComposition={ mStart=%d, mCompositionString.Length()=%d }, "
           "currentSelection={ IsDirty()=%s, StartOffset()=%d, Length()=%d }",
           this, aCompositionView, aNewRange, newStart, newLength,
           mComposition.mStart, mComposition.mString.Length(),
           GetBoolName(currentSelection.IsDirty()),
           currentSelection.StartOffset(), currentSelection.Length()));
 
   if (currentSelection.IsDirty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RestartComposition() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RestartComposition() FAILED "
             "due to CurrentSelection() failure", this));
     return E_FAIL;
   }
 
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RestartComposition() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RestartComposition() FAILED "
             "due to GetRangeExtent() failure", this));
     return hr;
   }
 
   // If the new range has no overlap with the crrent range, we just commit
   // the composition and restart new composition with the new range but
   // current selection range should be preserved.
   if (newStart >= mComposition.EndOffset() || newEnd <= mComposition.mStart) {
@@ -2259,17 +2262,17 @@ nsTextStore::RestartComposition(ITfCompo
   // Remove the overlapped part from the commit string.
   nsAutoString commitString(mComposition.mString);
   commitString.Cut(keepComposingStartOffset - mComposition.mStart,
                    keepComposingLength);
   // Update the composition string.
   Content& lockedContent = LockedContent();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RestartComposition() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RestartComposition() FAILED "
             "due to LockedContent() failure", this));
     return E_FAIL;
   }
   lockedContent.ReplaceTextWith(mComposition.mStart,
                                 mComposition.mString.Length(),
                                 commitString);
   // Record a compositionupdate action for commit the part of composing string.
   PendingAction* action = LastOrNewPendingCompositionUpdate();
@@ -2292,28 +2295,28 @@ nsTextStore::RestartComposition(ITfCompo
   // Restore the latest text content and selection.
   lockedContent.ReplaceSelectedTextWith(
     nsDependentSubstring(oldComposition.mString,
                          keepComposingStartOffset - oldComposition.mStart,
                          keepComposingLength));
   currentSelection = oldSelection;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RestartComposition() succeeded, "
+         ("TSF: 0x%p   TSFTextStore::RestartComposition() succeeded, "
           "mComposition={ mStart=%d, mCompositionString.Length()=%d }, "
           "currentSelection={ IsDirty()=%s, StartOffset()=%d, Length()=%d }",
           this, mComposition.mStart, mComposition.mString.Length(),
           GetBoolName(currentSelection.IsDirty()),
           currentSelection.StartOffset(), currentSelection.Length()));
 
   return S_OK;
 }
 
 static bool
-GetColor(const TF_DA_COLOR &aTSFColor, nscolor &aResult)
+GetColor(const TF_DA_COLOR& aTSFColor, nscolor& aResult)
 {
   switch (aTSFColor.type) {
     case TF_CT_SYSCOLOR: {
       DWORD sysColor = ::GetSysColor(aTSFColor.nIndex);
       aResult = NS_RGB(GetRValue(sysColor), GetGValue(sysColor),
                        GetBValue(sysColor));
       return true;
     }
@@ -2323,17 +2326,17 @@ GetColor(const TF_DA_COLOR &aTSFColor, n
       return true;
     case TF_CT_NONE:
     default:
       return false;
   }
 }
 
 static bool
-GetLineStyle(TF_DA_LINESTYLE aTSFLineStyle, uint8_t &aTextRangeLineStyle)
+GetLineStyle(TF_DA_LINESTYLE aTSFLineStyle, uint8_t& aTextRangeLineStyle)
 {
   switch (aTSFLineStyle) {
     case TF_LS_NONE:
       aTextRangeLineStyle = TextRangeStyle::LINESTYLE_NONE;
       return true;
     case TF_LS_SOLID:
       aTextRangeLineStyle = TextRangeStyle::LINESTYLE_SOLID;
       return true;
@@ -2347,29 +2350,29 @@ GetLineStyle(TF_DA_LINESTYLE aTSFLineSty
       aTextRangeLineStyle = TextRangeStyle::LINESTYLE_WAVY;
       return true;
     default:
       return false;
   }
 }
 
 HRESULT
-nsTextStore::RecordCompositionUpdateAction()
+TSFTextStore::RecordCompositionUpdateAction()
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction(), "
+         ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction(), "
           "mComposition={ mView=0x%p, mStart=%d, mString=\"%s\" "
           "(Length()=%d) }",
           this, mComposition.mView.get(), mComposition.mStart,
           NS_ConvertUTF16toUTF8(mComposition.mString).get(),
           mComposition.mString.Length()));
 
   if (!mComposition.IsComposing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() FAILED "
             "due to no composition view", this));
     return E_FAIL;
   }
 
   // Getting display attributes is *really* complicated!
   // We first get the context and the property objects to query for
   // attributes, but since a big range can have a variety of values for
   // the attribute, we have to find out all the ranges that have distinct
@@ -2377,45 +2380,45 @@ nsTextStore::RecordCompositionUpdateActi
   // the display attribute manager and translate that to TextRange to be
   // sent in NS_COMPOSITION_CHANGE
 
   nsRefPtr<ITfProperty> attrPropetry;
   HRESULT hr = mContext->GetProperty(GUID_PROP_ATTRIBUTE,
                                      getter_AddRefs(attrPropetry));
   if (FAILED(hr) || !attrPropetry) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() FAILED "
             "due to mContext->GetProperty() failure", this));
     return FAILED(hr) ? hr : E_FAIL;
   }
 
   nsRefPtr<ITfRange> composingRange;
   hr = mComposition.mView->GetRange(getter_AddRefs(composingRange));
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() "
             "FAILED due to mComposition.mView->GetRange() failure", this));
     return hr;
   }
 
   nsRefPtr<IEnumTfRanges> enumRanges;
   hr = attrPropetry->EnumRanges(TfEditCookie(mEditCookie),
                                 getter_AddRefs(enumRanges), composingRange);
   if (FAILED(hr) || !enumRanges) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() FAILED "
             "due to attrPropetry->EnumRanges() failure", this));
     return FAILED(hr) ? hr : E_FAIL;
   }
 
   // First, put the log of content and selection here.
   Selection& currentSel = CurrentSelection();
   if (currentSel.IsDirty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() FAILED "
             "due to CurrentSelection() failure", this));
     return E_FAIL;
   }
 
   PendingAction* action = LastOrNewPendingCompositionUpdate();
   action->mData = mComposition.mString;
   // The ranges might already have been initialized, however, if this is
   // called again, that means we need to overwrite the ranges with current
@@ -2442,25 +2445,25 @@ nsTextStore::RecordCompositionUpdateActi
     LONG start = std::min(std::max(rangeStart, mComposition.mStart),
                           mComposition.EndOffset());
     LONG end = std::max(std::min(rangeStart + rangeLength,
                                  mComposition.EndOffset()),
                         mComposition.mStart);
     LONG length = end - start;
     if (length < 0) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() "
+             ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() "
               "ignores invalid range (%d-%d)",
               this, rangeStart - mComposition.mStart,
               rangeStart - mComposition.mStart + rangeLength));
       continue;
     }
     if (!length) {
       MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-             ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() "
+             ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() "
               "ignores a range due to outside of the composition or empty "
               "(%d-%d)",
               this, rangeStart - mComposition.mStart,
               rangeStart - mComposition.mStart + rangeLength));
       continue;
     }
 
     TextRange newRange;
@@ -2532,70 +2535,70 @@ nsTextStore::RecordCompositionUpdateActi
   TextRange caretRange;
   caretRange.mStartOffset = caretRange.mEndOffset = uint32_t(caretPosition);
   caretRange.mRangeType = NS_TEXTRANGE_CARETPOSITION;
   action->mRanges->AppendElement(caretRange);
 
   action->mIncomplete = false;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::RecordCompositionUpdateAction() "
+         ("TSF: 0x%p   TSFTextStore::RecordCompositionUpdateAction() "
           "succeeded", this));
 
   return S_OK;
 }
 
 HRESULT
-nsTextStore::SetSelectionInternal(const TS_SELECTION_ACP* pSelection,
-                                  bool aDispatchCompositionChangeEvent)
+TSFTextStore::SetSelectionInternal(const TS_SELECTION_ACP* pSelection,
+                                   bool aDispatchCompositionChangeEvent)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::SetSelectionInternal(pSelection={ "
+         ("TSF: 0x%p   TSFTextStore::SetSelectionInternal(pSelection={ "
           "acpStart=%ld, acpEnd=%ld, style={ ase=%s, fInterimChar=%s} }, "
           "aDispatchCompositionChangeEvent=%s), mComposition.IsComposing()=%s",
           this, pSelection->acpStart, pSelection->acpEnd,
           GetActiveSelEndName(pSelection->style.ase),
           GetBoolName(pSelection->style.fInterimChar),
           GetBoolName(aDispatchCompositionChangeEvent),
           GetBoolName(mComposition.IsComposing())));
 
   MOZ_ASSERT(IsReadWriteLocked());
 
   Selection& currentSel = CurrentSelection();
   if (currentSel.IsDirty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-       ("TSF: 0x%p   nsTextStore::SetSelectionInternal() FAILED due to "
+       ("TSF: 0x%p   TSFTextStore::SetSelectionInternal() FAILED due to "
         "CurrentSelection() failure", this));
     return E_FAIL;
   }
 
   if (mComposition.IsComposing()) {
     if (aDispatchCompositionChangeEvent) {
       HRESULT hr = RestartCompositionIfNecessary();
       if (FAILED(hr)) {
         MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetSelectionInternal() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetSelectionInternal() FAILED due to "
             "RestartCompositionIfNecessary() failure", this));
         return hr;
       }
     }
     if (pSelection->acpStart < mComposition.mStart ||
         pSelection->acpEnd > mComposition.EndOffset()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-         ("TSF: 0x%p   nsTextStore::SetSelectionInternal() FAILED due to "
+         ("TSF: 0x%p   TSFTextStore::SetSelectionInternal() FAILED due to "
           "the selection being out of the composition string", this));
       return TS_E_INVALIDPOS;
     }
     // Emulate selection during compositions
     currentSel.SetSelection(*pSelection);
     if (aDispatchCompositionChangeEvent) {
       HRESULT hr = RecordCompositionUpdateAction();
       if (FAILED(hr)) {
         MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetSelectionInternal() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetSelectionInternal() FAILED due to "
             "RecordCompositionUpdateAction() failure", this));
         return hr;
       }
     }
     return S_OK;
   }
 
   CompleteLastActionIfStillIncomplete();
@@ -2606,100 +2609,100 @@ nsTextStore::SetSelectionInternal(const 
   action->mSelectionReversed = (pSelection->style.ase == TS_AE_START);
 
   currentSel.SetSelection(*pSelection);
 
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::SetSelection(ULONG ulCount,
-                          const TS_SELECTION_ACP *pSelection)
+TSFTextStore::SetSelection(ULONG ulCount,
+                           const TS_SELECTION_ACP* pSelection)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::SetSelection(ulCount=%lu, pSelection=%p { "
+         ("TSF: 0x%p TSFTextStore::SetSelection(ulCount=%lu, pSelection=%p { "
           "acpStart=%ld, acpEnd=%ld, style={ ase=%s, fInterimChar=%s } }), "
           "mComposition.IsComposing()=%s",
           this, ulCount, pSelection,
           pSelection ? pSelection->acpStart : 0,
           pSelection ? pSelection->acpEnd : 0,
           pSelection ? GetActiveSelEndName(pSelection->style.ase) : "",
           pSelection ? GetBoolName(pSelection->style.fInterimChar) : "",
           GetBoolName(mComposition.IsComposing())));
 
   if (!IsReadWriteLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetSelection() FAILED due to "
             "not locked (read-write)", this));
     return TS_E_NOLOCK;
   }
   if (ulCount != 1) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetSelection() FAILED due to "
             "trying setting multiple selection", this));
     return E_INVALIDARG;
   }
   if (!pSelection) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetSelection() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   HRESULT hr = SetSelectionInternal(pSelection, true);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetSelection() FAILED due to "
             "SetSelectionInternal() failure", this));
   } else {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::SetSelection() succeeded", this));
+           ("TSF: 0x%p   TSFTextStore::SetSelection() succeeded", this));
   }
   return hr;
 }
 
 STDMETHODIMP
-nsTextStore::GetText(LONG acpStart,
-                     LONG acpEnd,
-                     WCHAR *pchPlain,
-                     ULONG cchPlainReq,
-                     ULONG *pcchPlainOut,
-                     TS_RUNINFO *prgRunInfo,
-                     ULONG ulRunInfoReq,
-                     ULONG *pulRunInfoOut,
-                     LONG *pacpNext)
+TSFTextStore::GetText(LONG acpStart,
+                      LONG acpEnd,
+                      WCHAR* pchPlain,
+                      ULONG cchPlainReq,
+                      ULONG* pcchPlainOut,
+                      TS_RUNINFO* prgRunInfo,
+                      ULONG ulRunInfoReq,
+                      ULONG* pulRunInfoOut,
+                      LONG* pacpNext)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: 0x%p nsTextStore::GetText(acpStart=%ld, acpEnd=%ld, pchPlain=0x%p, "
+    ("TSF: 0x%p TSFTextStore::GetText(acpStart=%ld, acpEnd=%ld, pchPlain=0x%p, "
      "cchPlainReq=%lu, pcchPlainOut=0x%p, prgRunInfo=0x%p, ulRunInfoReq=%lu, "
      "pulRunInfoOut=0x%p, pacpNext=0x%p), mComposition={ mStart=%ld, "
      "mString.Length()=%lu, IsComposing()=%s }",
      this, acpStart, acpEnd, pchPlain, cchPlainReq, pcchPlainOut,
      prgRunInfo, ulRunInfoReq, pulRunInfoOut, pacpNext,
      mComposition.mStart, mComposition.mString.Length(),
      GetBoolName(mComposition.IsComposing())));
 
   if (!IsReadLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
             "not locked (read)", this));
     return TS_E_NOLOCK;
   }
 
   if (!pcchPlainOut || (!pchPlain && !prgRunInfo) ||
       !cchPlainReq != !pchPlain || !ulRunInfoReq != !prgRunInfo) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
             "invalid argument", this));
     return E_INVALIDARG;
   }
 
   if (acpStart < 0 || acpEnd < -1 || (acpEnd != -1 && acpStart > acpEnd)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
             "invalid position", this));
     return TS_E_INVALIDPOS;
   }
 
   // Making sure to null-terminate string just to be on the safe side
   *pcchPlainOut = 0;
   if (pchPlain && cchPlainReq) *pchPlain = 0;
   if (pulRunInfoOut) *pulRunInfoOut = 0;
@@ -2707,30 +2710,30 @@ nsTextStore::GetText(LONG acpStart,
   if (prgRunInfo && ulRunInfoReq) {
     prgRunInfo->uCount = 0;
     prgRunInfo->type = TS_RT_PLAIN;
   }
 
   Content& lockedContent = LockedContent();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
             "LockedContent() failure", this));
     return E_FAIL;
   }
   if (lockedContent.Text().Length() < static_cast<uint32_t>(acpStart)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
             "acpStart is larger offset than the actual text length", this));
     return TS_E_INVALIDPOS;
   }
   if (acpEnd != -1 &&
       lockedContent.Text().Length() < static_cast<uint32_t>(acpEnd)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
             "acpEnd is larger offset than the actual text length", this));
     return TS_E_INVALIDPOS;
   }
   uint32_t length = (acpEnd == -1) ?
     lockedContent.Text().Length() - static_cast<uint32_t>(acpStart) :
     static_cast<uint32_t>(acpEnd - acpStart);
   if (cchPlainReq && cchPlainReq - 1 < length) {
     length = cchPlainReq - 1;
@@ -2747,142 +2750,142 @@ nsTextStore::GetText(LONG acpStart,
       prgRunInfo->uCount = length;
       prgRunInfo->type = TS_RT_PLAIN;
       if (pulRunInfoOut) *pulRunInfoOut = 1;
     }
     if (pacpNext) *pacpNext = acpStart + length;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::GetText() succeeded: pcchPlainOut=0x%p, "
+         ("TSF: 0x%p   TSFTextStore::GetText() succeeded: pcchPlainOut=0x%p, "
           "*prgRunInfo={ uCount=%lu, type=%s }, *pulRunInfoOut=%lu, "
           "*pacpNext=%ld)",
           this, pcchPlainOut, prgRunInfo ? prgRunInfo->uCount : 0,
           prgRunInfo ? GetTextRunTypeName(prgRunInfo->type) : "N/A",
           pulRunInfoOut ? pulRunInfoOut : 0, pacpNext ? pacpNext : 0));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::SetText(DWORD dwFlags,
-                     LONG acpStart,
-                     LONG acpEnd,
-                     const WCHAR *pchText,
-                     ULONG cch,
-                     TS_TEXTCHANGE *pChange)
+TSFTextStore::SetText(DWORD dwFlags,
+                      LONG acpStart,
+                      LONG acpEnd,
+                      const WCHAR* pchText,
+                      ULONG cch,
+                      TS_TEXTCHANGE* pChange)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::SetText(dwFlags=%s, acpStart=%ld, "
+         ("TSF: 0x%p TSFTextStore::SetText(dwFlags=%s, acpStart=%ld, "
           "acpEnd=%ld, pchText=0x%p \"%s\", cch=%lu, pChange=0x%p), "
           "mComposition.IsComposing()=%s",
           this, dwFlags == TS_ST_CORRECTION ? "TS_ST_CORRECTION" :
                                               "not-specified",
           acpStart, acpEnd, pchText,
           pchText && cch ?
             NS_ConvertUTF16toUTF8(pchText, cch).get() : "",
           cch, pChange, GetBoolName(mComposition.IsComposing())));
 
   // Per SDK documentation, and since we don't have better
   // ways to do this, this method acts as a helper to
   // call SetSelection followed by InsertTextAtSelection
   if (!IsReadWriteLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetText() FAILED due to "
             "not locked (read)", this));
     return TS_E_NOLOCK;
   }
 
   TS_SELECTION_ACP selection;
   selection.acpStart = acpStart;
   selection.acpEnd = acpEnd;
   selection.style.ase = TS_AE_END;
   selection.style.fInterimChar = 0;
   // Set selection to desired range
   HRESULT hr = SetSelectionInternal(&selection);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetText() FAILED due to "
             "SetSelectionInternal() failure", this));
     return hr;
   }
   // Replace just selected text
   if (!InsertTextAtSelectionInternal(nsDependentSubstring(pchText, cch),
                                      pChange)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::SetText() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::SetText() FAILED due to "
             "InsertTextAtSelectionInternal() failure", this));
     return E_FAIL;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::SetText() succeeded: pChange={ "
+         ("TSF: 0x%p   TSFTextStore::SetText() succeeded: pChange={ "
           "acpStart=%ld, acpOldEnd=%ld, acpNewEnd=%ld }",
           this, pChange ? pChange->acpStart  : 0,
           pChange ? pChange->acpOldEnd : 0, pChange ? pChange->acpNewEnd : 0));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::GetFormattedText(LONG acpStart,
-                              LONG acpEnd,
-                              IDataObject **ppDataObject)
+TSFTextStore::GetFormattedText(LONG acpStart,
+                               LONG acpEnd,
+                               IDataObject** ppDataObject)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetFormattedText() called "
+         ("TSF: 0x%p TSFTextStore::GetFormattedText() called "
           "but not supported (E_NOTIMPL)", this));
 
   // no support for formatted text
   return E_NOTIMPL;
 }
 
 STDMETHODIMP
-nsTextStore::GetEmbedded(LONG acpPos,
-                         REFGUID rguidService,
-                         REFIID riid,
-                         IUnknown **ppunk)
+TSFTextStore::GetEmbedded(LONG acpPos,
+                          REFGUID rguidService,
+                          REFIID riid,
+                          IUnknown** ppunk)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetEmbedded() called "
+         ("TSF: 0x%p TSFTextStore::GetEmbedded() called "
           "but not supported (E_NOTIMPL)", this));
 
   // embedded objects are not supported
   return E_NOTIMPL;
 }
 
 STDMETHODIMP
-nsTextStore::QueryInsertEmbedded(const GUID *pguidService,
-                                 const FORMATETC *pFormatEtc,
-                                 BOOL *pfInsertable)
+TSFTextStore::QueryInsertEmbedded(const GUID* pguidService,
+                                  const FORMATETC* pFormatEtc,
+                                  BOOL* pfInsertable)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::QueryInsertEmbedded() called "
+         ("TSF: 0x%p TSFTextStore::QueryInsertEmbedded() called "
           "but not supported, *pfInsertable=FALSE (S_OK)", this));
 
   // embedded objects are not supported
   *pfInsertable = FALSE;
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::InsertEmbedded(DWORD dwFlags,
-                            LONG acpStart,
-                            LONG acpEnd,
-                            IDataObject *pDataObject,
-                            TS_TEXTCHANGE *pChange)
+TSFTextStore::InsertEmbedded(DWORD dwFlags,
+                             LONG acpStart,
+                             LONG acpEnd,
+                             IDataObject* pDataObject,
+                             TS_TEXTCHANGE* pChange)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::InsertEmbedded() called "
+         ("TSF: 0x%p TSFTextStore::InsertEmbedded() called "
           "but not supported (E_NOTIMPL)", this));
 
   // embedded objects are not supported
   return E_NOTIMPL;
 }
 
 void
-nsTextStore::SetInputScope(const nsString& aHTMLInputType)
+TSFTextStore::SetInputScope(const nsString& aHTMLInputType)
 {
   mInputScopes.Clear();
   if (aHTMLInputType.IsEmpty() || aHTMLInputType.EqualsLiteral("text")) {
     return;
   }
   
   // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html
   if (aHTMLInputType.EqualsLiteral("url")) {
@@ -2907,193 +2910,193 @@ nsTextStore::SetInputScope(const nsStrin
     mInputScopes.AppendElement(IS_TELEPHONE_FULLTELEPHONENUMBER);
     mInputScopes.AppendElement(IS_TELEPHONE_LOCALNUMBER);
   } else if (aHTMLInputType.EqualsLiteral("number")) {
     mInputScopes.AppendElement(IS_NUMBER);
   }
 }
 
 int32_t
-nsTextStore::GetRequestedAttrIndex(const TS_ATTRID& aAttrID)
+TSFTextStore::GetRequestedAttrIndex(const TS_ATTRID& aAttrID)
 {
   if (IsEqualGUID(aAttrID, GUID_PROP_INPUTSCOPE)) {
     return eInputScope;
   }
   if (IsEqualGUID(aAttrID, TSATTRID_Text_VerticalWriting)) {
     return eTextVerticalWriting;
   }
   if (IsEqualGUID(aAttrID, TSATTRID_Text_Orientation)) {
     return eTextOrientation;
   }
   return eNotSupported;
 }
 
 TS_ATTRID
-nsTextStore::GetAttrID(int32_t aIndex)
+TSFTextStore::GetAttrID(int32_t aIndex)
 {
   switch (aIndex) {
     case eInputScope:
       return GUID_PROP_INPUTSCOPE;
     case eTextVerticalWriting:
       return TSATTRID_Text_VerticalWriting;
     case eTextOrientation:
       return TSATTRID_Text_Orientation;
     default:
       MOZ_CRASH("Invalid index? Or not implemented yet?");
       return GUID_NULL;
   }
 }
 
 HRESULT
-nsTextStore::HandleRequestAttrs(DWORD aFlags,
-                                ULONG aFilterCount,
-                                const TS_ATTRID* aFilterAttrs)
+TSFTextStore::HandleRequestAttrs(DWORD aFlags,
+                                 ULONG aFilterCount,
+                                 const TS_ATTRID* aFilterAttrs)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::HandleRequestAttrs(aFlags=%s, "
+         ("TSF: 0x%p TSFTextStore::HandleRequestAttrs(aFlags=%s, "
           "aFilterCount=%u)",
           this, GetFindFlagName(aFlags).get(), aFilterCount));
 
   // This is a little weird! RequestSupportedAttrs gives us advanced notice
   // of a support query via RetrieveRequestedAttrs for a specific attribute.
   // RetrieveRequestedAttrs needs to return valid data for all attributes we
   // support, but the text service will only want the input scope object
   // returned in RetrieveRequestedAttrs if the dwFlags passed in here contains
   // TS_ATTR_FIND_WANT_VALUE.
   for (int32_t i = 0; i < NUM_OF_SUPPORTED_ATTRS; i++) {
     mRequestedAttrs[i] = false;
   }
   mRequestedAttrValues = !!(aFlags & TS_ATTR_FIND_WANT_VALUE);
 
   for (uint32_t i = 0; i < aFilterCount; i++) {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::HandleRequestAttrs(), "
+           ("TSF: 0x%p   TSFTextStore::HandleRequestAttrs(), "
             "requested attr=%s",
             this, GetGUIDNameStrWithTable(aFilterAttrs[i]).get()));
     int32_t index = GetRequestedAttrIndex(aFilterAttrs[i]);
     if (index != eNotSupported) {
       mRequestedAttrs[index] = true;
     }
   }
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::RequestSupportedAttrs(DWORD dwFlags,
-                                   ULONG cFilterAttrs,
-                                   const TS_ATTRID *paFilterAttrs)
+TSFTextStore::RequestSupportedAttrs(DWORD dwFlags,
+                                    ULONG cFilterAttrs,
+                                    const TS_ATTRID* paFilterAttrs)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::RequestSupportedAttrs(dwFlags=%s, "
+         ("TSF: 0x%p TSFTextStore::RequestSupportedAttrs(dwFlags=%s, "
           "cFilterAttrs=%lu)",
           this, GetFindFlagName(dwFlags).get(), cFilterAttrs));
 
   return HandleRequestAttrs(dwFlags, cFilterAttrs, paFilterAttrs);
 }
 
 STDMETHODIMP
-nsTextStore::RequestAttrsAtPosition(LONG acpPos,
-                                    ULONG cFilterAttrs,
-                                    const TS_ATTRID *paFilterAttrs,
-                                    DWORD dwFlags)
+TSFTextStore::RequestAttrsAtPosition(LONG acpPos,
+                                     ULONG cFilterAttrs,
+                                     const TS_ATTRID* paFilterAttrs,
+                                     DWORD dwFlags)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::RequestAttrsAtPosition(acpPos=%ld, "
+         ("TSF: 0x%p TSFTextStore::RequestAttrsAtPosition(acpPos=%ld, "
           "cFilterAttrs=%lu, dwFlags=%s)",
           this, acpPos, cFilterAttrs, GetFindFlagName(dwFlags).get()));
 
   return HandleRequestAttrs(dwFlags | TS_ATTR_FIND_WANT_VALUE,
                             cFilterAttrs, paFilterAttrs);
 }
 
 STDMETHODIMP
-nsTextStore::RequestAttrsTransitioningAtPosition(LONG acpPos,
-                                                 ULONG cFilterAttrs,
-                                                 const TS_ATTRID *paFilterAttr,
-                                                 DWORD dwFlags)
+TSFTextStore::RequestAttrsTransitioningAtPosition(LONG acpPos,
+                                                  ULONG cFilterAttrs,
+                                                  const TS_ATTRID* paFilterAttr,
+                                                  DWORD dwFlags)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::RequestAttrsTransitioningAtPosition("
+         ("TSF: 0x%p TSFTextStore::RequestAttrsTransitioningAtPosition("
           "acpPos=%ld, cFilterAttrs=%lu, dwFlags=%s) called but not supported "
           "(S_OK)",
           this, acpPos, cFilterAttrs, GetFindFlagName(dwFlags).get()));
 
   // no per character attributes defined
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::FindNextAttrTransition(LONG acpStart,
-                                    LONG acpHalt,
-                                    ULONG cFilterAttrs,
-                                    const TS_ATTRID *paFilterAttrs,
-                                    DWORD dwFlags,
-                                    LONG *pacpNext,
-                                    BOOL *pfFound,
-                                    LONG *plFoundOffset)
+TSFTextStore::FindNextAttrTransition(LONG acpStart,
+                                     LONG acpHalt,
+                                     ULONG cFilterAttrs,
+                                     const TS_ATTRID* paFilterAttrs,
+                                     DWORD dwFlags,
+                                     LONG* pacpNext,
+                                     BOOL* pfFound,
+                                     LONG* plFoundOffset)
 {
   if (!pacpNext || !pfFound || !plFoundOffset) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF:   0x%p nsTextStore::FindNextAttrTransition() FAILED due to "
+           ("TSF:   0x%p TSFTextStore::FindNextAttrTransition() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::FindNextAttrTransition() called "
+         ("TSF: 0x%p   TSFTextStore::FindNextAttrTransition() called "
           "but not supported (S_OK)", this));
 
   // no per character attributes defined
   *pacpNext = *plFoundOffset = acpHalt;
   *pfFound = FALSE;
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::RetrieveRequestedAttrs(ULONG ulCount,
-                                    TS_ATTRVAL *paAttrVals,
-                                    ULONG *pcFetched)
+TSFTextStore::RetrieveRequestedAttrs(ULONG ulCount,
+                                     TS_ATTRVAL* paAttrVals,
+                                     ULONG* pcFetched)
 {
   if (!pcFetched || !paAttrVals) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() FAILED due to "
+           ("TSF: 0x%p TSFTextStore::RetrieveRequestedAttrs() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   ULONG expectedCount = 0;
   for (int32_t i = 0; i < NUM_OF_SUPPORTED_ATTRS; i++) {
     if (mRequestedAttrs[i]) {
       expectedCount++;
     }
   }
   if (ulCount < expectedCount) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() FAILED due to "
+           ("TSF: 0x%p TSFTextStore::RetrieveRequestedAttrs() FAILED due to "
             "not enough count ulCount=%u, expectedCount=%u",
             this, ulCount, expectedCount));
     return E_INVALIDARG;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() called "
+         ("TSF: 0x%p TSFTextStore::RetrieveRequestedAttrs() called "
           "ulCount=%d, mRequestedAttrValues=%s",
           this, ulCount, GetBoolName(mRequestedAttrValues)));
 
   int32_t count = 0;
   for (int32_t i = 0; i < NUM_OF_SUPPORTED_ATTRS; i++) {
     if (!mRequestedAttrs[i]) {
       continue;
     }
     mRequestedAttrs[i] = false;
 
     TS_ATTRID attrID = GetAttrID(i);
 
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::RetrieveRequestedAttrs() for %s",
+           ("TSF: 0x%p   TSFTextStore::RetrieveRequestedAttrs() for %s",
             this, GetGUIDNameStrWithTable(attrID).get()));
 
     paAttrVals[count].idAttr = attrID;
     paAttrVals[count].dwOverlapId = 0;
 
     if (!mRequestedAttrValues) {
       paAttrVals[count].varValue.vt = VT_EMPTY;
     } else {
@@ -3130,121 +3133,122 @@ nsTextStore::RetrieveRequestedAttrs(ULON
   mRequestedAttrValues = false;
 
   if (count) {
     *pcFetched = count;
     return S_OK;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::RetrieveRequestedAttrs() called "
+         ("TSF: 0x%p   TSFTextStore::RetrieveRequestedAttrs() called "
           "for unknown TS_ATTRVAL, *pcFetched=0 (S_OK)", this));
 
   paAttrVals->dwOverlapId = 0;
   paAttrVals->varValue.vt = VT_EMPTY;
   *pcFetched = 0;
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::GetEndACP(LONG *pacp)
+TSFTextStore::GetEndACP(LONG* pacp)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetEndACP(pacp=0x%p)", this, pacp));
+         ("TSF: 0x%p TSFTextStore::GetEndACP(pacp=0x%p)", this, pacp));
 
   if (!IsReadLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetEndACP() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetEndACP() FAILED due to "
             "not locked (read)", this));
     return TS_E_NOLOCK;
   }
 
   if (!pacp) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetEndACP() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetEndACP() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   Content& lockedContent = LockedContent();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetEndACP() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetEndACP() FAILED due to "
             "LockedContent() failure", this));
     return E_FAIL;
   }
   *pacp = static_cast<LONG>(lockedContent.Text().Length());
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::GetActiveView(TsViewCookie *pvcView)
+TSFTextStore::GetActiveView(TsViewCookie* pvcView)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetActiveView(pvcView=0x%p)", this, pvcView));
+         ("TSF: 0x%p TSFTextStore::GetActiveView(pvcView=0x%p)",
+          this, pvcView));
 
   if (!pvcView) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetActiveView() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetActiveView() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   *pvcView = TEXTSTORE_DEFAULT_VIEW;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::GetActiveView() succeeded: *pvcView=%ld",
+         ("TSF: 0x%p   TSFTextStore::GetActiveView() succeeded: *pvcView=%ld",
           this, *pvcView));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::GetACPFromPoint(TsViewCookie vcView,
-                             const POINT *pt,
-                             DWORD dwFlags,
-                             LONG *pacp)
+TSFTextStore::GetACPFromPoint(TsViewCookie vcView,
+                              const POINT* pt,
+                              DWORD dwFlags,
+                              LONG* pacp)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetACPFromPoint(pvcView=%d, pt=%p (x=%d, "
+         ("TSF: 0x%p TSFTextStore::GetACPFromPoint(pvcView=%d, pt=%p (x=%d, "
           "y=%d), dwFlags=%s, pacp=%p, mDeferNotifyingTSF=%s",
           this, vcView, pt, pt ? pt->x : 0, pt ? pt->y : 0,
           GetACPFromPointFlagName(dwFlags).get(), pacp,
           GetBoolName(mDeferNotifyingTSF)));
 
   if (!IsReadLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
             "not locked (read)", this));
     return TS_E_NOLOCK;
   }
 
   if (vcView != TEXTSTORE_DEFAULT_VIEW) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
             "called with invalid view", this));
     return E_INVALIDARG;
   }
 
   if (!pt) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
             "null pt", this));
     return E_INVALIDARG;
   }
 
   if (!pacp) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
             "null pacp", this));
     return E_INVALIDARG;
   }
 
   if (mLockedContent.IsLayoutChanged()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
             "layout not recomputed", this));
     mPendingOnLayoutChange = true;
     return TS_E_NOLAYOUT;
   }
 
   nsIntPoint ourPt(pt->x, pt->y);
   // Convert to widget relative coordinates from screen's.
   ourPt -= mWidget->WidgetToScreenOffsetUntyped();
@@ -3252,44 +3256,44 @@ nsTextStore::GetACPFromPoint(TsViewCooki
   // NOTE: Don't check if the point is in the widget since the point can be
   //       outside of the widget if focused editor is in a XUL <panel>.
 
   WidgetQueryContentEvent charAtPt(true, NS_QUERY_CHARACTER_AT_POINT, mWidget);
   mWidget->InitEvent(charAtPt, &ourPt);
 
   // FYI: WidgetQueryContentEvent may cause flushing pending layout and it
   //      may cause focus change or something.
-  nsRefPtr<nsTextStore> kungFuDeathGrip(this);
+  nsRefPtr<TSFTextStore> kungFuDeathGrip(this);
   DispatchEvent(charAtPt);
   if (!mWidget || mWidget->Destroyed()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
             "mWidget was destroyed during NS_QUERY_CHARACTER_AT_POINT", this));
     return E_FAIL;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::GetACPFromPoint(), charAtPt={ "
+         ("TSF: 0x%p   TSFTextStore::GetACPFromPoint(), charAtPt={ "
           "mSucceeded=%s, mReply={ mOffset=%u, mTentativeCaretOffset=%u }}",
           this, GetBoolName(charAtPt.mSucceeded), charAtPt.mReply.mOffset,
           charAtPt.mReply.mTentativeCaretOffset));
 
   if (NS_WARN_IF(!charAtPt.mSucceeded)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
             "NS_QUERY_CHARACTER_AT_POINT failure", this));
     return E_FAIL;
   }
 
   // If dwFlags isn't set and the point isn't in any character's bounding box,
   // we should return TS_E_INVALIDPOINT.
   if (!(dwFlags & GXFPF_NEAREST) &&
       charAtPt.mReply.mOffset == WidgetQueryContentEvent::NOT_FOUND) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to the "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to the "
             "point contained by no bounding box", this));
     return TS_E_INVALIDPOINT;
   }
 
   // Although, we're not sure if mTentativeCaretOffset becomes NOT_FOUND,
   // let's assume that there is no content in such case.
   if (NS_WARN_IF(charAtPt.mReply.mTentativeCaretOffset ==
                    WidgetQueryContentEvent::NOT_FOUND)) {
@@ -3317,79 +3321,79 @@ nsTextStore::GetACPFromPoint(TsViewCooki
     // So, use tentative offset for now.
     offset = charAtPt.mReply.mTentativeCaretOffset;
 
     // However, if it's after the last character, we need to decrement the
     // offset.
     Content& lockedContent = LockedContent();
     if (!lockedContent.IsInitialized()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
               "LockedContent() failure", this));
       return E_FAIL;
     }
     if (lockedContent.Text().Length() <= offset) {
       // If the tentative caret is after the last character, let's return
       // the last character's offset.
       offset = lockedContent.Text().Length() - 1;
     }
   }
 
   if (NS_WARN_IF(offset > LONG_MAX)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetACPFromPoint() FAILED due to out of "
+           ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to out of "
             "range of the result", this));
     return TS_E_INVALIDPOINT;
   }
 
   *pacp = static_cast<LONG>(offset);
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::GetACPFromPoint() succeeded: *pacp=%d",
+         ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() succeeded: *pacp=%d",
           this, *pacp));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::GetTextExt(TsViewCookie vcView,
-                        LONG acpStart,
-                        LONG acpEnd,
-                        RECT *prc,
-                        BOOL *pfClipped)
+TSFTextStore::GetTextExt(TsViewCookie vcView,
+                         LONG acpStart,
+                         LONG acpEnd,
+                         RECT* prc,
+                         BOOL* pfClipped)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetTextExt(vcView=%ld, "
+         ("TSF: 0x%p TSFTextStore::GetTextExt(vcView=%ld, "
           "acpStart=%ld, acpEnd=%ld, prc=0x%p, pfClipped=0x%p), "
           "mDeferNotifyingTSF=%s",
           this, vcView, acpStart, acpEnd, prc, pfClipped,
           GetBoolName(mDeferNotifyingTSF)));
 
   if (!IsReadLocked()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "not locked (read)", this));
     return TS_E_NOLOCK;
   }
 
   if (vcView != TEXTSTORE_DEFAULT_VIEW) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "called with invalid view", this));
     return E_INVALIDARG;
   }
 
   if (!prc || !pfClipped) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   if (acpStart < 0 || acpEnd < acpStart) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "invalid position", this));
     return TS_E_INVALIDPOS;
   }
 
   // NOTE: TSF (at least on Win 8.1) doesn't return TS_E_NOLAYOUT to the
   // caller even if we return it.  It's converted to just E_FAIL.
   // However, this is fixed on Win 10.
 
@@ -3406,96 +3410,96 @@ nsTextStore::GetTextExt(TsViewCookie vcV
       // This is typically shown at wrong position.  We should avoid only this
       // case. This is not necessary on Windows 10.
       if (!mLockedContent.IsLayoutChangedAfter(acpStart) &&
           acpStart < acpEnd &&
           sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar &&
           kSink->IsGoogleJapaneseInputActive()) {
         acpEnd = acpStart;
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::GetTextExt() hacked the offsets of "
+               ("TSF: 0x%p   TSFTextStore::GetTextExt() hacked the offsets of "
                 "the first character of changing range of the composition "
                 "string for TIP acpStart=%d, acpEnd=%d",
                 this, acpStart, acpEnd));
       }
       // Google Japanese Input sometimes uses caret position for deciding its
       // candidate window position. In such case, we should return the previous
       // offset of selected clause. However, it's difficult to get where is
       // selected clause for now.  Instead, we should use the first character
       // which is modified. This is useful in most cases.
       else if (acpStart == acpEnd &&
                currentSel.IsCollapsed() && currentSel.EndOffset() == acpEnd &&
                sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret &&
                kSink->IsGoogleJapaneseInputActive()) {
         acpEnd = acpStart = mLockedContent.MinOffsetOfLayoutChanged();
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::GetTextExt() hacked the offsets of "
+               ("TSF: 0x%p   TSFTextStore::GetTextExt() hacked the offsets of "
                 "the caret of the composition string for TIP acpStart=%d, "
                 "acpEnd=%d", this, acpStart, acpEnd));
       }
     }
     // Free ChangJie 2010 and Easy Changjei 1.0.12.0 doesn't handle
     // ITfContextView::GetTextExt() properly.  Prehaps, it's due to the bug of
     // TSF.  We need to check if this is necessary on Windows 10 before
     // disabling this on Windows 10.
     else if ((sDoNotReturnNoLayoutErrorToFreeChangJie &&
               kSink->IsFreeChangJieActive()) ||
              (sDoNotReturnNoLayoutErrorToEasyChangjei &&
               kSink->IsEasyChangjeiActive())) {
       acpEnd = mComposition.mStart;
       acpStart = std::min(acpStart, acpEnd);
       MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-             ("TSF: 0x%p   nsTextStore::GetTextExt() hacked the offsets for "
+             ("TSF: 0x%p   TSFTextStore::GetTextExt() hacked the offsets for "
               "TIP acpStart=%d, acpEnd=%d", this, acpStart, acpEnd));
     }
   }
 
   if (mLockedContent.IsLayoutChangedAfter(acpEnd)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "layout not recomputed at %d", this, acpEnd));
     mPendingOnLayoutChange = true;
     return TS_E_NOLAYOUT;
   }
 
   // use NS_QUERY_TEXT_RECT to get rect in system, screen coordinates
   WidgetQueryContentEvent event(true, NS_QUERY_TEXT_RECT, mWidget);
   mWidget->InitEvent(event);
   event.InitForQueryTextRect(acpStart, acpEnd - acpStart);
   DispatchEvent(event);
   if (!event.mSucceeded) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "NS_QUERY_TEXT_RECT failure", this));
     return TS_E_INVALIDPOS; // but unexpected failure, maybe.
   }
   // IMEs don't like empty rects, fix here
   if (event.mReply.mRect.width <= 0)
     event.mReply.mRect.width = 1;
   if (event.mReply.mRect.height <= 0)
     event.mReply.mRect.height = 1;
 
   // convert to unclipped screen rect
   nsWindow* refWindow = static_cast<nsWindow*>(
     event.mReply.mFocusedWidget ? event.mReply.mFocusedWidget : mWidget);
   // Result rect is in top level widget coordinates
   refWindow = refWindow->GetTopLevelWindow(false);
   if (!refWindow) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "no top level window", this));
     return E_FAIL;
   }
 
   event.mReply.mRect.MoveBy(refWindow->WidgetToScreenOffset());
 
   // get bounding screen rect to test for clipping
   if (!GetScreenExtInternal(*prc)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetTextExt() FAILED due to "
             "GetScreenExtInternal() failure", this));
     return E_FAIL;
   }
 
   // clip text rect to bounding rect
   RECT textRect;
   ::SetRect(&textRect, event.mReply.mRect.x, event.mReply.mRect.y,
             event.mReply.mRect.XMost(), event.mReply.mRect.YMost());
@@ -3516,93 +3520,93 @@ nsTextStore::GetTextExt(TsViewCookie vcV
     if (mNativeCaretIsCreated) {
       ::DestroyCaret();
       mNativeCaretIsCreated = false;
     }
     CreateNativeCaret();
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::GetTextExt() succeeded: "
+         ("TSF: 0x%p   TSFTextStore::GetTextExt() succeeded: "
           "*prc={ left=%ld, top=%ld, right=%ld, bottom=%ld }, *pfClipped=%s",
           this, prc->left, prc->top, prc->right, prc->bottom,
           GetBoolName(*pfClipped)));
 
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::GetScreenExt(TsViewCookie vcView,
-                          RECT *prc)
+TSFTextStore::GetScreenExt(TsViewCookie vcView,
+                           RECT* prc)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetScreenExt(vcView=%ld, prc=0x%p)",
+         ("TSF: 0x%p TSFTextStore::GetScreenExt(vcView=%ld, prc=0x%p)",
           this, vcView, prc));
 
   if (vcView != TEXTSTORE_DEFAULT_VIEW) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetScreenExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetScreenExt() FAILED due to "
             "called with invalid view", this));
     return E_INVALIDARG;
   }
 
   if (!prc) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetScreenExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetScreenExt() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   if (!GetScreenExtInternal(*prc)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetScreenExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetScreenExt() FAILED due to "
             "GetScreenExtInternal() failure", this));
     return E_FAIL;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::GetScreenExt() succeeded: "
+         ("TSF: 0x%p   TSFTextStore::GetScreenExt() succeeded: "
           "*prc={ left=%ld, top=%ld, right=%ld, bottom=%ld }",
           this, prc->left, prc->top, prc->right, prc->bottom));
   return S_OK;
 }
 
 bool
-nsTextStore::GetScreenExtInternal(RECT &aScreenExt)
+TSFTextStore::GetScreenExtInternal(RECT& aScreenExt)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::GetScreenExtInternal()", this));
+         ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal()", this));
 
   // use NS_QUERY_EDITOR_RECT to get rect in system, screen coordinates
   WidgetQueryContentEvent event(true, NS_QUERY_EDITOR_RECT, mWidget);
   mWidget->InitEvent(event);
   DispatchEvent(event);
   if (!event.mSucceeded) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetScreenExtInternal() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal() FAILED due to "
             "NS_QUERY_EDITOR_RECT failure", this));
     return false;
   }
 
   nsWindow* refWindow = static_cast<nsWindow*>(
     event.mReply.mFocusedWidget ?
       event.mReply.mFocusedWidget : mWidget);
   // Result rect is in top level widget coordinates
   refWindow = refWindow->GetTopLevelWindow(false);
   if (!refWindow) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetScreenExtInternal() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal() FAILED due to "
             "no top level window", this));
     return false;
   }
 
   nsIntRect boundRect;
   if (NS_FAILED(refWindow->GetClientBounds(boundRect))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetScreenExtInternal() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal() FAILED due to "
             "failed to get the client bounds", this));
     return false;
   }
 
   boundRect.MoveTo(0, 0);
 
   // Clip frame rect to window rect
   boundRect.IntersectRect(LayoutDevicePixel::ToUntyped(event.mReply.mRect), boundRect);
@@ -3610,172 +3614,172 @@ nsTextStore::GetScreenExtInternal(RECT &
     boundRect.MoveBy(refWindow->WidgetToScreenOffsetUntyped());
     ::SetRect(&aScreenExt, boundRect.x, boundRect.y,
               boundRect.XMost(), boundRect.YMost());
   } else {
     ::SetRectEmpty(&aScreenExt);
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::GetScreenExtInternal() succeeded: "
+         ("TSF: 0x%p   TSFTextStore::GetScreenExtInternal() succeeded: "
           "aScreenExt={ left=%ld, top=%ld, right=%ld, bottom=%ld }",
           this, aScreenExt.left, aScreenExt.top,
           aScreenExt.right, aScreenExt.bottom));
   return true;
 }
 
 STDMETHODIMP
-nsTextStore::GetWnd(TsViewCookie vcView,
-                    HWND *phwnd)
+TSFTextStore::GetWnd(TsViewCookie vcView,
+                     HWND* phwnd)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::GetWnd(vcView=%ld, phwnd=0x%p), "
+         ("TSF: 0x%p TSFTextStore::GetWnd(vcView=%ld, phwnd=0x%p), "
           "mWidget=0x%p",
           this, vcView, phwnd, mWidget.get()));
 
   if (vcView != TEXTSTORE_DEFAULT_VIEW) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetWnd() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetWnd() FAILED due to "
             "called with invalid view", this));
     return E_INVALIDARG;
   }
 
   if (!phwnd) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::GetScreenExt() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::GetScreenExt() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
   *phwnd = mWidget->GetWindowHandle();
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::GetWnd() succeeded: *phwnd=0x%p",
+         ("TSF: 0x%p   TSFTextStore::GetWnd() succeeded: *phwnd=0x%p",
           this, static_cast<void*>(*phwnd)));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::InsertTextAtSelection(DWORD dwFlags,
-                                   const WCHAR *pchText,
-                                   ULONG cch,
-                                   LONG *pacpStart,
-                                   LONG *pacpEnd,
-                                   TS_TEXTCHANGE *pChange)
+TSFTextStore::InsertTextAtSelection(DWORD dwFlags,
+                                    const WCHAR* pchText,
+                                    ULONG cch,
+                                    LONG* pacpStart,
+                                    LONG* pacpEnd,
+                                    TS_TEXTCHANGE* pChange)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::InsertTextAtSelection(dwFlags=%s, "
+         ("TSF: 0x%p TSFTextStore::InsertTextAtSelection(dwFlags=%s, "
           "pchText=0x%p \"%s\", cch=%lu, pacpStart=0x%p, pacpEnd=0x%p, "
           "pChange=0x%p), IsComposing()=%s",
           this, dwFlags == 0 ? "0" :
                 dwFlags == TF_IAS_NOQUERY ? "TF_IAS_NOQUERY" :
                 dwFlags == TF_IAS_QUERYONLY ? "TF_IAS_QUERYONLY" : "Unknown",
           pchText,
           pchText && cch ? NS_ConvertUTF16toUTF8(pchText, cch).get() : "",
           cch, pacpStart, pacpEnd, pChange,
           GetBoolName(mComposition.IsComposing())));
 
   if (cch && !pchText) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
             "null pchText", this));
     return E_INVALIDARG;
   }
 
   if (TS_IAS_QUERYONLY == dwFlags) {
     if (!IsReadLocked()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
               "not locked (read)", this));
       return TS_E_NOLOCK;
     }
 
     if (!pacpStart || !pacpEnd) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
               "null argument", this));
       return E_INVALIDARG;
     }
 
     // Get selection first
     Selection& currentSel = CurrentSelection();
     if (currentSel.IsDirty()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
               "CurrentSelection() failure", this));
       return E_FAIL;
     }
 
     // Simulate text insertion
     *pacpStart = currentSel.StartOffset();
     *pacpEnd = currentSel.EndOffset();
     if (pChange) {
       pChange->acpStart = currentSel.StartOffset();
       pChange->acpOldEnd = currentSel.EndOffset();
       pChange->acpNewEnd = currentSel.StartOffset() + static_cast<LONG>(cch);
     }
   } else {
     if (!IsReadWriteLocked()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
               "not locked (read-write)", this));
       return TS_E_NOLOCK;
     }
 
     if (!pChange) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
               "null pChange", this));
       return E_INVALIDARG;
     }
 
     if (TS_IAS_NOQUERY != dwFlags && (!pacpStart || !pacpEnd)) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
               "null argument", this));
       return E_INVALIDARG;
     }
 
     if (!InsertTextAtSelectionInternal(nsDependentSubstring(pchText, cch),
                                        pChange)) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() FAILED due to "
               "InsertTextAtSelectionInternal() failure", this));
       return E_FAIL;
     }
 
     if (TS_IAS_NOQUERY != dwFlags) {
       *pacpStart = pChange->acpStart;
       *pacpEnd = pChange->acpNewEnd;
     }
   }
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::InsertTextAtSelection() succeeded: "
+         ("TSF: 0x%p   TSFTextStore::InsertTextAtSelection() succeeded: "
           "*pacpStart=%ld, *pacpEnd=%ld, "
           "*pChange={ acpStart=%ld, acpOldEnd=%ld, acpNewEnd=%ld })",
           this, pacpStart ? *pacpStart : 0, pacpEnd ? *pacpEnd : 0,
           pChange ? pChange->acpStart: 0, pChange ? pChange->acpOldEnd : 0,
           pChange ? pChange->acpNewEnd : 0));
   return S_OK;
 }
 
 bool
-nsTextStore::InsertTextAtSelectionInternal(const nsAString &aInsertStr,
-                                           TS_TEXTCHANGE* aTextChange)
+TSFTextStore::InsertTextAtSelectionInternal(const nsAString& aInsertStr,
+                                            TS_TEXTCHANGE* aTextChange)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::InsertTextAtSelectionInternal("
+         ("TSF: 0x%p   TSFTextStore::InsertTextAtSelectionInternal("
           "aInsertStr=\"%s\", aTextChange=0x%p), IsComposing=%s",
           this, NS_ConvertUTF16toUTF8(aInsertStr).get(), aTextChange,
           GetBoolName(mComposition.IsComposing())));
 
   Content& lockedContent = LockedContent();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::InsertTextAtSelectionInternal() failed "
+           ("TSF: 0x%p   TSFTextStore::InsertTextAtSelectionInternal() failed "
             "due to LockedContent() failure()", this));
     return false;
   }
 
   TS_SELECTION_ACP oldSelection = lockedContent.Selection().ACP();
   if (!mComposition.IsComposing()) {
     // Use a temporary composition to contain the text
     PendingAction* compositionStart = mPendingActions.AppendElement();
@@ -3793,98 +3797,98 @@ nsTextStore::InsertTextAtSelectionIntern
 
   if (aTextChange) {
     aTextChange->acpStart = oldSelection.acpStart;
     aTextChange->acpOldEnd = oldSelection.acpEnd;
     aTextChange->acpNewEnd = lockedContent.Selection().EndOffset();
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::InsertTextAtSelectionInternal() succeeded: "
-          "mWidget=0x%p, mWidget->Destroyed()=%s, aTextChange={ acpStart=%ld, "
-          "acpOldEnd=%ld, acpNewEnd=%ld }",
+         ("TSF: 0x%p   TSFTextStore::InsertTextAtSelectionInternal() "
+          "succeeded: mWidget=0x%p, mWidget->Destroyed()=%s, aTextChange={ "
+          "acpStart=%ld, acpOldEnd=%ld, acpNewEnd=%ld }",
           this, mWidget.get(),
           GetBoolName(mWidget ? mWidget->Destroyed() : true),
           aTextChange ? aTextChange->acpStart : 0,
           aTextChange ? aTextChange->acpOldEnd : 0,
           aTextChange ? aTextChange->acpNewEnd : 0));
   return true;
 }
 
 STDMETHODIMP
-nsTextStore::InsertEmbeddedAtSelection(DWORD dwFlags,
-                                       IDataObject *pDataObject,
-                                       LONG *pacpStart,
-                                       LONG *pacpEnd,
-                                       TS_TEXTCHANGE *pChange)
+TSFTextStore::InsertEmbeddedAtSelection(DWORD dwFlags,
+                                        IDataObject* pDataObject,
+                                        LONG* pacpStart,
+                                        LONG* pacpEnd,
+                                        TS_TEXTCHANGE* pChange)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::InsertEmbeddedAtSelection() called "
+         ("TSF: 0x%p TSFTextStore::InsertEmbeddedAtSelection() called "
           "but not supported (E_NOTIMPL)", this));
 
   // embedded objects are not supported
   return E_NOTIMPL;
 }
 
 HRESULT
-nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition,
-                                          ITfRange* aRange,
-                                          bool aPreserveSelection)
+TSFTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition,
+                                           ITfRange* aRange,
+                                           bool aPreserveSelection)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RecordCompositionStartAction("
+         ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction("
           "aComposition=0x%p, aRange=0x%p, aPreserveSelection=%s), "
           "mComposition.mView=0x%p",
           this, aComposition, aRange, GetBoolName(aPreserveSelection),
           mComposition.mView.get()));
 
   LONG start = 0, length = 0;
   HRESULT hr = GetRangeExtent(aRange, &start, &length);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionStartAction() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction() FAILED "
             "due to GetRangeExtent() failure", this));
     return hr;
   }
 
   return RecordCompositionStartAction(aComposition, start, length,
                                       aPreserveSelection);
 }
 
 HRESULT
-nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition,
-                                          LONG aStart,
-                                          LONG aLength,
-                                          bool aPreserveSelection)
+TSFTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition,
+                                           LONG aStart,
+                                           LONG aLength,
+                                           bool aPreserveSelection)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RecordCompositionStartAction("
+         ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction("
           "aComposition=0x%p, aStart=%d, aLength=%d, aPreserveSelection=%s), "
           "mComposition.mView=0x%p",
           this, aComposition, aStart, aLength, GetBoolName(aPreserveSelection),
           mComposition.mView.get()));
 
   Content& lockedContent = LockedContent();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionStartAction() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction() FAILED "
             "due to LockedContent() failure", this));
     return E_FAIL;
   }
 
   CompleteLastActionIfStillIncomplete();
   PendingAction* action = mPendingActions.AppendElement();
   action->mType = PendingAction::COMPOSITION_START;
   action->mSelectionStart = aStart;
   action->mSelectionLength = aLength;
 
   Selection& currentSel = CurrentSelection();
   if (currentSel.IsDirty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionStartAction() FAILED "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction() FAILED "
             "due to CurrentSelection() failure", this));
     action->mAdjustSelection = true;
   } else if (currentSel.MinOffset() != aStart ||
              currentSel.MaxOffset() != aStart + aLength) {
     // If new composition range is different from current selection range,
     // we need to set selection before dispatching compositionstart event.
     action->mAdjustSelection = true;
   } else {
@@ -3893,242 +3897,242 @@ nsTextStore::RecordCompositionStartActio
     // position in HTML editor since generated flat text content and offset in
     // it are lossy data of HTML contents.
     action->mAdjustSelection = false;
   }
 
   lockedContent.StartComposition(aComposition, *action, aPreserveSelection);
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::RecordCompositionStartAction() succeeded: "
+         ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction() succeeded: "
           "mComposition={ mStart=%ld, mString.Length()=%ld, "
           "mSelection={ acpStart=%ld, acpEnd=%ld, style.ase=%s, "
           "style.fInterimChar=%s } }",
           this, mComposition.mStart, mComposition.mString.Length(),
           mSelection.StartOffset(), mSelection.EndOffset(),
           GetActiveSelEndName(mSelection.ActiveSelEnd()),
           GetBoolName(mSelection.IsInterimChar())));
   return S_OK;
 }
 
 HRESULT
-nsTextStore::RecordCompositionEndAction()
+TSFTextStore::RecordCompositionEndAction()
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::RecordCompositionEndAction(), "
+         ("TSF: 0x%p   TSFTextStore::RecordCompositionEndAction(), "
           "mComposition={ mView=0x%p, mString=\"%s\" }",
           this, mComposition.mView.get(),
           NS_ConvertUTF16toUTF8(mComposition.mString).get()));
 
   MOZ_ASSERT(mComposition.IsComposing());
 
   CompleteLastActionIfStillIncomplete();
   PendingAction* action = mPendingActions.AppendElement();
   action->mType = PendingAction::COMPOSITION_END;
   action->mData = mComposition.mString;
 
   Content& lockedContent = LockedContent();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::RecordCompositionEndAction() FAILED due "
+           ("TSF: 0x%p   TSFTextStore::RecordCompositionEndAction() FAILED due "
             "to LockedContent() failure", this));
     return E_FAIL;
   }
   lockedContent.EndComposition(*action);
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::RecordCompositionEndAction(), succeeded",
+         ("TSF: 0x%p   TSFTextStore::RecordCompositionEndAction(), succeeded",
           this));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::OnStartComposition(ITfCompositionView* pComposition,
-                                BOOL* pfOk)
+TSFTextStore::OnStartComposition(ITfCompositionView* pComposition,
+                                 BOOL* pfOk)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::OnStartComposition(pComposition=0x%p, "
+         ("TSF: 0x%p TSFTextStore::OnStartComposition(pComposition=0x%p, "
           "pfOk=0x%p), mComposition.mView=0x%p",
           this, pComposition, pfOk, mComposition.mView.get()));
 
   AutoPendingActionAndContentFlusher flusher(this);
 
   *pfOk = FALSE;
 
   // Only one composition at a time
   if (mComposition.IsComposing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnStartComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnStartComposition() FAILED due to "
             "there is another composition already (but returns S_OK)", this));
     return S_OK;
   }
 
   nsRefPtr<ITfRange> range;
   HRESULT hr = pComposition->GetRange(getter_AddRefs(range));
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnStartComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnStartComposition() FAILED due to "
             "pComposition->GetRange() failure", this));
     return hr;
   }
   hr = RecordCompositionStartAction(pComposition, range, false);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnStartComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnStartComposition() FAILED due to "
             "RecordCompositionStartAction() failure", this));
     return hr;
   }
 
   *pfOk = TRUE;
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::OnStartComposition() succeeded", this));
+         ("TSF: 0x%p   TSFTextStore::OnStartComposition() succeeded", this));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::OnUpdateComposition(ITfCompositionView* pComposition,
-                                 ITfRange* pRangeNew)
+TSFTextStore::OnUpdateComposition(ITfCompositionView* pComposition,
+                                  ITfRange* pRangeNew)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::OnUpdateComposition(pComposition=0x%p, "
+         ("TSF: 0x%p TSFTextStore::OnUpdateComposition(pComposition=0x%p, "
           "pRangeNew=0x%p), mComposition.mView=0x%p",
           this, pComposition, pRangeNew, mComposition.mView.get()));
 
   AutoPendingActionAndContentFlusher flusher(this);
 
   if (!mDocumentMgr || !mContext) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnUpdateComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() FAILED due to "
             "not ready for the composition", this));
     return E_UNEXPECTED;
   }
   if (!mComposition.IsComposing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnUpdateComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() FAILED due to "
             "no active composition", this));
     return E_UNEXPECTED;
   }
   if (mComposition.mView != pComposition) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnUpdateComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() FAILED due to "
             "different composition view specified", this));
     return E_UNEXPECTED;
   }
 
   // pRangeNew is null when the update is not complete
   if (!pRangeNew) {
     PendingAction* action = LastOrNewPendingCompositionUpdate();
     action->mIncomplete = true;
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::OnUpdateComposition() succeeded but "
+           ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() succeeded but "
             "not complete", this));
     return S_OK;
   }
 
   HRESULT hr = RestartCompositionIfNecessary(pRangeNew);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnUpdateComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() FAILED due to "
             "RestartCompositionIfNecessary() failure", this));
     return hr;
   }
 
   hr = RecordCompositionUpdateAction();
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnUpdateComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() FAILED due to "
             "RecordCompositionUpdateAction() failure", this));
     return hr;
   }
 
   if (MOZ_LOG_TEST(sTextStoreLog, LogLevel::Info)) {
     Selection& currentSel = CurrentSelection();
     if (currentSel.IsDirty()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::OnUpdateComposition() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() FAILED due to "
               "CurrentSelection() failure", this));
       return E_FAIL;
     }
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::OnUpdateComposition() succeeded: "
+           ("TSF: 0x%p   TSFTextStore::OnUpdateComposition() succeeded: "
             "mComposition={ mStart=%ld, mString=\"%s\" }, "
             "CurrentSelection()={ acpStart=%ld, acpEnd=%ld, style.ase=%s }",
             this, mComposition.mStart,
             NS_ConvertUTF16toUTF8(mComposition.mString).get(),
             currentSel.StartOffset(), currentSel.EndOffset(),
             GetActiveSelEndName(currentSel.ActiveSelEnd())));
   }
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::OnEndComposition(ITfCompositionView* pComposition)
+TSFTextStore::OnEndComposition(ITfCompositionView* pComposition)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::OnEndComposition(pComposition=0x%p), "
+         ("TSF: 0x%p TSFTextStore::OnEndComposition(pComposition=0x%p), "
           "mComposition={ mView=0x%p, mString=\"%s\" }",
           this, pComposition, mComposition.mView.get(),
           NS_ConvertUTF16toUTF8(mComposition.mString).get()));
 
   AutoPendingActionAndContentFlusher flusher(this);
 
   if (!mComposition.IsComposing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnEndComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnEndComposition() FAILED due to "
             "no active composition", this));
     return E_UNEXPECTED;
   }
 
   if (mComposition.mView != pComposition) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnEndComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnEndComposition() FAILED due to "
             "different composition view specified", this));
     return E_UNEXPECTED;
   }
 
   HRESULT hr = RecordCompositionEndAction();
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::OnEndComposition() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::OnEndComposition() FAILED due to "
             "RecordCompositionEndAction() failure", this));
     return hr;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::OnEndComposition(), succeeded", this));
+         ("TSF: 0x%p   TSFTextStore::OnEndComposition(), succeeded", this));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::AdviseMouseSink(ITfRangeACP* range,
-                             ITfMouseSink* pSink,
-                             DWORD* pdwCookie)
+TSFTextStore::AdviseMouseSink(ITfRangeACP* range,
+                              ITfMouseSink* pSink,
+                              DWORD* pdwCookie)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::AdviseMouseSink(range=0x%p, pSink=0x%p, "
+         ("TSF: 0x%p TSFTextStore::AdviseMouseSink(range=0x%p, pSink=0x%p, "
           "pdwCookie=0x%p)", this, range, pSink, pdwCookie));
 
   if (!pdwCookie) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::AdviseMouseSink() FAILED due to the "
+           ("TSF: 0x%p   TSFTextStore::AdviseMouseSink() FAILED due to the "
             "pdwCookie is null", this));
     return E_INVALIDARG;
   }
   // Initialize the result with invalid cookie for safety.
   *pdwCookie = MouseTracker::kInvalidCookie;
 
   if (!range) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::AdviseMouseSink() FAILED due to the "
+           ("TSF: 0x%p   TSFTextStore::AdviseMouseSink() FAILED due to the "
             "range is null", this));
     return E_INVALIDARG;
   }
   if (!pSink) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::AdviseMouseSink() FAILED due to the "
+           ("TSF: 0x%p   TSFTextStore::AdviseMouseSink() FAILED due to the "
             "pSink is null", this));
     return E_INVALIDARG;
   }
 
   // Looking for an unusing tracker.
   MouseTracker* tracker = nullptr;
   for (size_t i = 0; i < mMouseTrackers.Length(); i++) {
     if (mMouseTrackers[i].IsUsing()) {
@@ -4138,76 +4142,76 @@ nsTextStore::AdviseMouseSink(ITfRangeACP
   }
   // If there is no unusing tracker, create new one.
   // XXX Should we make limitation of the number of installs?
   if (!tracker) {
     tracker = mMouseTrackers.AppendElement();
     HRESULT hr = tracker->Init(this);
     if (FAILED(hr)) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   nsTextStore::AdviseMouseSink() FAILED due to "
+             ("TSF: 0x%p   TSFTextStore::AdviseMouseSink() FAILED due to "
               "failure of MouseTracker::Init()", this));
       return hr;
     }
   }
   HRESULT hr = tracker->AdviseSink(this, range, pSink);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::AdviseMouseSink() FAILED due to failure "
+           ("TSF: 0x%p   TSFTextStore::AdviseMouseSink() FAILED due to failure "
             "of MouseTracker::Init()", this));
     return hr;
   }
   *pdwCookie = tracker->Cookie();
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::AdviseMouseSink(), succeeded, "
+         ("TSF: 0x%p   TSFTextStore::AdviseMouseSink(), succeeded, "
           "*pdwCookie=%d", this, *pdwCookie));
   return S_OK;
 }
 
 STDMETHODIMP
-nsTextStore::UnadviseMouseSink(DWORD dwCookie)
+TSFTextStore::UnadviseMouseSink(DWORD dwCookie)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p nsTextStore::UnadviseMouseSink(dwCookie=%d)",
+         ("TSF: 0x%p TSFTextStore::UnadviseMouseSink(dwCookie=%d)",
           this, dwCookie));
   if (dwCookie == MouseTracker::kInvalidCookie) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::UnadviseMouseSink() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::UnadviseMouseSink() FAILED due to "
             "the cookie is invalid value", this));
     return E_INVALIDARG;
   }
   // The cookie value must be an index of mMouseTrackers.
   // We can use this shortcut for now.
   if (static_cast<size_t>(dwCookie) >= mMouseTrackers.Length()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::UnadviseMouseSink() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::UnadviseMouseSink() FAILED due to "
             "the cookie is too large value", this));
     return E_INVALIDARG;
   }
   MouseTracker& tracker = mMouseTrackers[dwCookie];
   if (!tracker.IsUsing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::UnadviseMouseSink() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::UnadviseMouseSink() FAILED due to "
             "the found tracker uninstalled already", this));
     return E_INVALIDARG;
   }
   tracker.UnadviseSink();
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::UnadviseMouseSink(), succeeded", this));
+         ("TSF: 0x%p   TSFTextStore::UnadviseMouseSink(), succeeded", this));
   return S_OK;
 }
 
 // static
 nsresult
-nsTextStore::OnFocusChange(bool aGotFocus,
-                           nsWindowBase* aFocusedWidget,
-                           const InputContext& aContext)
+TSFTextStore::OnFocusChange(bool aGotFocus,
+                            nsWindowBase* aFocusedWidget,
+                            const InputContext& aContext)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF:   nsTextStore::OnFocusChange(aGotFocus=%s, "
+         ("TSF:   TSFTextStore::OnFocusChange(aGotFocus=%s, "
           "aFocusedWidget=0x%p, aContext={ mIMEState={ mEnabled=%s }, "
           "mHTMLInputType=\"%s\" }), "
           "sThreadMgr=0x%p, sEnabledTextStore=0x%p",
           GetBoolName(aGotFocus), aFocusedWidget,
           GetIMEEnabledName(aContext.mIMEState.mEnabled),
           NS_ConvertUTF16toUTF8(aContext.mHTMLInputType).get(),
           sThreadMgr.get(), sEnabledTextStore.get()));
 
@@ -4236,128 +4240,128 @@ nsTextStore::OnFocusChange(bool aGotFocu
   }
 
   // If this is a notification of blur, move focus to the dummy document
   // manager.
   if (!aGotFocus || !aContext.mIMEState.IsEditable()) {
     HRESULT hr = sThreadMgr->SetFocus(sDisabledDocumentMgr);
     if (NS_WARN_IF(FAILED(hr))) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF:   nsTextStore::OnFocusChange() FAILED due to "
+             ("TSF:   TSFTextStore::OnFocusChange() FAILED due to "
               "ITfThreadMgr::SetFocus() failure"));
       return NS_ERROR_FAILURE;
     }
     return NS_OK;
   }
 
   // If an editor is getting focus, create new TextStore and set focus.
   if (NS_WARN_IF(!CreateAndSetFocus(aFocusedWidget, aContext))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF:   nsTextStore::OnFocusChange() FAILED due to "
+           ("TSF:   TSFTextStore::OnFocusChange() FAILED due to "
             "ITfThreadMgr::CreateAndSetFocus() failure"));
     // If setting focus, we should destroy the TextStore completely because
     // it causes memory leak.
     if (sEnabledTextStore) {
       sEnabledTextStore->Destroy();
       sEnabledTextStore = nullptr;
     }
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 // static
 bool
-nsTextStore::CreateAndSetFocus(nsWindowBase* aFocusedWidget,
-                               const InputContext& aContext)
+TSFTextStore::CreateAndSetFocus(nsWindowBase* aFocusedWidget,
+                                const InputContext& aContext)
 {
   // TSF might do something which causes that we need to access static methods
-  // of nsTextStore.  At that time, sEnabledTextStore may be necessary.
+  // of TSFTextStore.  At that time, sEnabledTextStore may be necessary.
   // So, we should set sEnabledTextStore directly.
-  sEnabledTextStore = new nsTextStore();
+  sEnabledTextStore = new TSFTextStore();
   if (NS_WARN_IF(!sEnabledTextStore->Init(aFocusedWidget))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF:   nsTextStore::CreateAndSetFocus() FAILED due to "
-            "nsTextStore::Init() failure"));
+           ("TSF:   TSFTextStore::CreateAndSetFocus() FAILED due to "
+            "TSFTextStore::Init() failure"));
     return false;
   }
   if (NS_WARN_IF(!sEnabledTextStore->mDocumentMgr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF:   nsTextStore::CreateAndSetFocus() FAILED due to "
-            "invalid nsTextStore::mDocumentMgr"));
+           ("TSF:   TSFTextStore::CreateAndSetFocus() FAILED due to "
+            "invalid TSFTextStore::mDocumentMgr"));
     return false;
   }
   if (aContext.mIMEState.mEnabled == IMEState::PASSWORD) {
     MarkContextAsKeyboardDisabled(sEnabledTextStore->mContext);
     nsRefPtr<ITfContext> topContext;
     sEnabledTextStore->mDocumentMgr->GetTop(getter_AddRefs(topContext));
     if (topContext && topContext != sEnabledTextStore->mContext) {
       MarkContextAsKeyboardDisabled(topContext);
     }
   }
   HRESULT hr = sThreadMgr->SetFocus(sEnabledTextStore->mDocumentMgr);
   if (NS_WARN_IF(FAILED(hr))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF:   nsTextStore::CreateAndSetFocus() FAILED due to "
+           ("TSF:   TSFTextStore::CreateAndSetFocus() FAILED due to "
             "ITfTheadMgr::SetFocus() failure"));
     return false;
   }
   // Use AssociateFocus() for ensuring that any native focus event
   // never steal focus from our documentMgr.
   nsRefPtr<ITfDocumentMgr> prevFocusedDocumentMgr;
   hr = sThreadMgr->AssociateFocus(aFocusedWidget->GetWindowHandle(),
                                   sEnabledTextStore->mDocumentMgr,
                                   getter_AddRefs(prevFocusedDocumentMgr));
   if (NS_WARN_IF(FAILED(hr))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF:   nsTextStore::CreateAndSetFocus() FAILED due to "
+           ("TSF:   TSFTextStore::CreateAndSetFocus() FAILED due to "
             "ITfTheadMgr::AssociateFocus() failure"));
     return false;
   }
   sEnabledTextStore->SetInputScope(aContext.mHTMLInputType);
 
   if (sEnabledTextStore->mSink) {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-      ("TSF:   nsTextStore::CreateAndSetFocus(), calling "
+      ("TSF:   TSFTextStore::CreateAndSetFocus(), calling "
        "ITextStoreACPSink::OnLayoutChange(TS_LC_CREATE) for 0x%p...",
        sEnabledTextStore.get()));
     sEnabledTextStore->mSink->OnLayoutChange(TS_LC_CREATE,
                                              TEXTSTORE_DEFAULT_VIEW);
   }
   return true;
 }
 
 // static
 nsIMEUpdatePreference
-nsTextStore::GetIMEUpdatePreference()
+TSFTextStore::GetIMEUpdatePreference()
 {
   if (sThreadMgr && sEnabledTextStore && sEnabledTextStore->mDocumentMgr) {
     nsRefPtr<ITfDocumentMgr> docMgr;
     sThreadMgr->GetFocus(getter_AddRefs(docMgr));
     if (docMgr == sEnabledTextStore->mDocumentMgr) {
       nsIMEUpdatePreference updatePreference(
         nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
         nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE |
         nsIMEUpdatePreference::NOTIFY_POSITION_CHANGE |
         nsIMEUpdatePreference::NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR |
         nsIMEUpdatePreference::NOTIFY_DURING_DEACTIVE);
-      // nsTextStore shouldn't notify TSF of selection change and text change
+      // TSFTextStore shouldn't notify TSF of selection change and text change
       // which are caused by composition.
       updatePreference.DontNotifyChangesCausedByComposition();
       return updatePreference;
     }
   }
   return nsIMEUpdatePreference();
 }
 
 nsresult
-nsTextStore::OnTextChangeInternal(const IMENotification& aIMENotification)
+TSFTextStore::OnTextChangeInternal(const IMENotification& aIMENotification)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::OnTextChangeInternal(aIMENotification={ "
+         ("TSF: 0x%p   TSFTextStore::OnTextChangeInternal(aIMENotification={ "
           "mMessage=0x%08X, mTextChangeData={ mStartOffset=%lu, "
           "mRemovedEndOffset=%lu, mAddedEndOffset=%lu}), mSink=0x%p, "
           "mSinkMask=%s, mComposition.IsComposing()=%s",
           this, aIMENotification.mMessage,
           aIMENotification.mTextChangeData.mStartOffset,
           aIMENotification.mTextChangeData.mRemovedEndOffset,
           aIMENotification.mTextChangeData.mAddedEndOffset, mSink.get(),
           GetSinkMaskNameStr(mSinkMask).get(),
@@ -4384,63 +4388,63 @@ nsTextStore::OnTextChangeInternal(const 
       static_cast<LONG>(aIMENotification.mTextChangeData.mStartOffset);
     textChange.acpOldEnd =
       static_cast<LONG>(aIMENotification.mTextChangeData.mRemovedEndOffset);
     textChange.acpNewEnd =
       static_cast<LONG>(aIMENotification.mTextChangeData.mAddedEndOffset);
     NotifyTSFOfTextChange(textChange);
   } else {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::NotifyTSFOfTextChange() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::NotifyTSFOfTextChange() FAILED due to "
             "offset is too big for calling "
             "ITextStoreACPSink::OnTextChange()...",
             this));
   }
 
   MaybeFlushPendingNotifications();
 
   return NS_OK;
 }
 
 void
-nsTextStore::NotifyTSFOfTextChange(const TS_TEXTCHANGE& aTextChange)
+TSFTextStore::NotifyTSFOfTextChange(const TS_TEXTCHANGE& aTextChange)
 {
   // XXX We need to cache the text change ranges and notify TSF of that
   //     the document is unlocked.
   if (NS_WARN_IF(IsReadLocked())) {
     return;
   }
 
   // Some TIPs are confused by text change notification during composition.
   // Especially, some of them stop working for composition in our process.
   // For preventing it, let's commit the composition.
   if (mComposition.IsComposing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::NotifyTSFOfTextChange(), "
+           ("TSF: 0x%p   TSFTextStore::NotifyTSFOfTextChange(), "
             "committing the composition for avoiding making TIP confused...",
             this));
     CommitCompositionInternal(false);
     return;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::NotifyTSFOfTextChange(), calling "
+         ("TSF: 0x%p   TSFTextStore::NotifyTSFOfTextChange(), calling "
           "ITextStoreACPSink::OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, "
           "acpNewEnd=%ld })...", this, aTextChange.acpStart,
           aTextChange.acpOldEnd, aTextChange.acpNewEnd));
   mSink->OnTextChange(0, &aTextChange);
 }
 
 nsresult
-nsTextStore::OnSelectionChangeInternal(const IMENotification& aIMENotification)
+TSFTextStore::OnSelectionChangeInternal(const IMENotification& aIMENotification)
 {
   const IMENotification::SelectionChangeData& selectionChangeData =
     aIMENotification.mSelectionChangeData;
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::OnSelectionChangeInternal("
+         ("TSF: 0x%p   TSFTextStore::OnSelectionChangeInternal("
           "aIMENotification={ mSelectionChangeData={ mOffset=%lu, "
           "Length()=%lu, mReversed=%s, mWritingMode=%s, "
           "mCausedByComposition=%s, mCausedBySelectionEvent=%s } }), "
           "mSink=0x%p, mSinkMask=%s, mIsRecordingActionsWithoutLock=%s, "
           "mComposition.IsComposing()=%s",
           this, selectionChangeData.mOffset, selectionChangeData.Length(),
           GetBoolName(selectionChangeData.mReversed),
           GetWritingModeName(selectionChangeData.GetWritingMode()).get(),
@@ -4464,17 +4468,17 @@ nsTextStore::OnSelectionChangeInternal(c
     selectionChangeData.GetWritingMode());
 
   if (!selectionChangeData.mCausedBySelectionEvent) {
     // Should be notified via MaybeFlushPendingNotifications() for keeping
     // the order of change notifications.
     mPendingOnSelectionChange = true;
     if (mIsRecordingActionsWithoutLock) {
       MOZ_LOG(sTextStoreLog, LogLevel::Info,
-             ("TSF: 0x%p   nsTextStore::OnSelectionChangeInternal(), putting "
+             ("TSF: 0x%p   TSFTextStore::OnSelectionChangeInternal(), putting "
               "off notifying TSF of selection change...", this));
       return NS_OK;
     }
   } else {
     // If the selection change is caused by setting selection range, we don't
     // need to notify that.  Additionally, even if there is pending selection
     // change notification, we don't need to notify that since the selection
     // range is changed as expected by TSF or TIP.
@@ -4483,133 +4487,134 @@ nsTextStore::OnSelectionChangeInternal(c
 
   // Flush remaining pending notifications here if it's possible.
   MaybeFlushPendingNotifications();
 
   return NS_OK;
 }
 
 void
-nsTextStore::NotifyTSFOfSelectionChange()
+TSFTextStore::NotifyTSFOfSelectionChange()
 {
   if (NS_WARN_IF(IsReadLocked())) {
     return;
   }
 
   mPendingOnSelectionChange = false;
 
   if (!mSink || !(mSinkMask & TS_AS_SEL_CHANGE)) {
     return;
   }
 
   // Some TIPs are confused by selection change notification during composition.
   // Especially, some of them stop working for composition in our process.
   // For preventing it, let's commit the composition.
   if (mComposition.IsComposing()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::NotifyTSFOfSelectionChange(), "
+           ("TSF: 0x%p   TSFTextStore::NotifyTSFOfSelectionChange(), "
             "committing the composition for avoiding making TIP confused...",
             this));
     CommitCompositionInternal(false);
     return;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::NotifyTSFOfSelectionChange(), calling "
+         ("TSF: 0x%p   TSFTextStore::NotifyTSFOfSelectionChange(), calling "
           "ITextStoreACPSink::OnSelectionChange()...", this));
   mSink->OnSelectionChange();
 }
 
 nsresult
-nsTextStore::OnLayoutChangeInternal()
+TSFTextStore::OnLayoutChangeInternal()
 {
   NS_ENSURE_TRUE(mContext, NS_ERROR_FAILURE);
   NS_ENSURE_TRUE(mSink, NS_ERROR_FAILURE);
 
   mDeferNotifyingTSF = false;
 
   nsresult rv = NS_OK;
 
   // We need to notify TSF of layout change even if the document is locked.
   // So, don't use MaybeFlushPendingNotifications() for flushing pending
   // layout change.
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-         ("TSF: 0x%p   nsTextStore::OnLayoutChangeInternal(), calling "
+         ("TSF: 0x%p   TSFTextStore::OnLayoutChangeInternal(), calling "
           "NotifyTSFOfLayoutChange()...", this));
   if (NS_WARN_IF(!NotifyTSFOfLayoutChange(mPendingOnLayoutChange))) {
     rv = NS_ERROR_FAILURE;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::OnLayoutChangeInternal(), calling "
+         ("TSF: 0x%p   TSFTextStore::OnLayoutChangeInternal(), calling "
           "MaybeFlushPendingNotifications()...", this));
   MaybeFlushPendingNotifications();
 
   return rv;
 }
 
 bool
-nsTextStore::NotifyTSFOfLayoutChange(bool aFlush)
+TSFTextStore::NotifyTSFOfLayoutChange(bool aFlush)
 {
   mPendingOnLayoutChange = false;
 
   // This method should return true if either way succeeds.
   bool ret = false;
 
   if (mSink) {
     MOZ_LOG(sTextStoreLog, LogLevel::Info,
-           ("TSF: 0x%p   nsTextStore::NotifyTSFOfLayoutChange(), "
+           ("TSF: 0x%p   TSFTextStore::NotifyTSFOfLayoutChange(), "
             "calling ITextStoreACPSink::OnLayoutChange()...",
             this));
     HRESULT hr = mSink->OnLayoutChange(TS_LC_CHANGE, TEXTSTORE_DEFAULT_VIEW);
     ret = SUCCEEDED(hr);
   }
 
   // The layout change caused by composition string change should cause
   // calling ITfContextOwnerServices::OnLayoutChange() too.
   if (aFlush && mContext) {
     nsRefPtr<ITfContextOwnerServices> service;
     mContext->QueryInterface(IID_ITfContextOwnerServices,
                              getter_AddRefs(service));
     if (service) {
       MOZ_LOG(sTextStoreLog, LogLevel::Info,
-             ("TSF: 0x%p   nsTextStore::NotifyTSFOfLayoutChange(), "
+             ("TSF: 0x%p   TSFTextStore::NotifyTSFOfLayoutChange(), "
               "calling ITfContextOwnerServices::OnLayoutChange()...",
               this));
       HRESULT hr = service->OnLayoutChange();
       ret = SUCCEEDED(hr);
     }
   }
 
   return ret;
 }
 
 nsresult
-nsTextStore::OnUpdateCompositionInternal()
+TSFTextStore::OnUpdateCompositionInternal()
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-    ("TSF: 0x%p   nsTextStore::OnUpdateCompositionInternal(), "
+    ("TSF: 0x%p   TSFTextStore::OnUpdateCompositionInternal(), "
      "mDeferNotifyingTSF=%s",
      this, GetBoolName(mDeferNotifyingTSF)));
 
   mPendingClearLockedContent = true;
   mDeferNotifyingTSF = false;
   MaybeFlushPendingNotifications();
   return NS_OK;
 }
 
 nsresult
-nsTextStore::OnMouseButtonEventInternal(const IMENotification& aIMENotification)
+TSFTextStore::OnMouseButtonEventInternal(
+                const IMENotification& aIMENotification)
 {
   if (mMouseTrackers.IsEmpty()) {
     return NS_OK;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::OnMouseButtonEventInternal("
+         ("TSF: 0x%p   TSFTextStore::OnMouseButtonEventInternal("
           "aIMENotification={ mEventMessage=%s, mOffset=%u, mCursorPos={ "
           "mX=%d, mY=%d }, mCharRect={ mX=%d, mY=%d, mWidth=%d, mHeight=%d }, "
           "mButton=%s, mButtons=%s, mModifiers=%s })",
           this, GetEventMessageName(
                   aIMENotification.mMouseButtonEventData.mEventMessage),
           aIMENotification.mMouseButtonEventData.mOffset,
           aIMENotification.mMouseButtonEventData.mCursorPos.mX,
           aIMENotification.mMouseButtonEventData.mCursorPos.mY,
@@ -4666,111 +4671,111 @@ nsTextStore::OnMouseButtonEventInternal(
                                    quadrant, buttonStatus)) {
       return NS_SUCCESS_EVENT_CONSUMED;
     }
   }
   return NS_OK;
 }
 
 void
-nsTextStore::CreateNativeCaret()
+TSFTextStore::CreateNativeCaret()
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::CreateNativeCaret(), "
+         ("TSF: 0x%p   TSFTextStore::CreateNativeCaret(), "
           "mComposition.IsComposing()=%s",
           this, GetBoolName(mComposition.IsComposing())));
 
   Selection& currentSel = CurrentSelection();
   if (currentSel.IsDirty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::CreateNativeCaret() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::CreateNativeCaret() FAILED due to "
             "CurrentSelection() failure", this));
     return;
   }
 
   // XXX If this is called without composition and the selection isn't
   //     collapsed, is it OK?
   uint32_t caretOffset = currentSel.MaxOffset();
 
   WidgetQueryContentEvent queryCaretRect(true, NS_QUERY_CARET_RECT, mWidget);
   queryCaretRect.InitForQueryCaretRect(caretOffset);
   mWidget->InitEvent(queryCaretRect);
   DispatchEvent(queryCaretRect);
   if (!queryCaretRect.mSucceeded) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::CreateNativeCaret() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::CreateNativeCaret() FAILED due to "
             "NS_QUERY_CARET_RECT failure (offset=%d)", this, caretOffset));
     return;
   }
 
   LayoutDeviceIntRect& caretRect = queryCaretRect.mReply.mRect;
   mNativeCaretIsCreated = ::CreateCaret(mWidget->GetWindowHandle(), nullptr,
                                         caretRect.width, caretRect.height);
   if (!mNativeCaretIsCreated) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::CreateNativeCaret() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::CreateNativeCaret() FAILED due to "
             "CreateCaret() failure", this));
     return;
   }
 
   nsWindow* window = static_cast<nsWindow*>(mWidget.get());
   nsWindow* toplevelWindow = window->GetTopLevelWindow(false);
   if (!toplevelWindow) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::CreateNativeCaret() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::CreateNativeCaret() FAILED due to "
             "no top level window", this));
     return;
   }
 
   if (toplevelWindow != window) {
     caretRect.MoveBy(toplevelWindow->WidgetToScreenOffset());
     caretRect.MoveBy(-window->WidgetToScreenOffset());
   }
 
   ::SetCaretPos(caretRect.x, caretRect.y);
 }
 
 void
-nsTextStore::CommitCompositionInternal(bool aDiscard)
+TSFTextStore::CommitCompositionInternal(bool aDiscard)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::CommitCompositionInternal(aDiscard=%s), "
+         ("TSF: 0x%p   TSFTextStore::CommitCompositionInternal(aDiscard=%s), "
           "mSink=0x%p, mContext=0x%p, mComposition.mView=0x%p, "
           "mComposition.mString=\"%s\"",
           this, GetBoolName(aDiscard), mSink.get(), mContext.get(),
           mComposition.mView.get(),
           NS_ConvertUTF16toUTF8(mComposition.mString).get()));
 
   if (mComposition.IsComposing() && aDiscard) {
     LONG endOffset = mComposition.EndOffset();
     mComposition.mString.Truncate(0);
     if (mSink && !mLock) {
       TS_TEXTCHANGE textChange;
       textChange.acpStart = mComposition.mStart;
       textChange.acpOldEnd = endOffset;
       textChange.acpNewEnd = mComposition.mStart;
       MOZ_LOG(sTextStoreLog, LogLevel::Info,
-             ("TSF: 0x%p   nsTextStore::CommitCompositionInternal(), calling"
+             ("TSF: 0x%p   TSFTextStore::CommitCompositionInternal(), calling"
               "mSink->OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, "
               "acpNewEnd=%ld })...", this, textChange.acpStart,
               textChange.acpOldEnd, textChange.acpNewEnd));
       mSink->OnTextChange(0, &textChange);
     }
   }
   // Terminate two contexts, the base context (mContext) and the top
   // if the top context is not the same as the base context
   nsRefPtr<ITfContext> context = mContext;
   do {
     if (context) {
       nsRefPtr<ITfContextOwnerCompositionServices> services;
       context->QueryInterface(IID_ITfContextOwnerCompositionServices,
                               getter_AddRefs(services));
       if (services) {
         MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-               ("TSF: 0x%p   nsTextStore::CommitCompositionInternal(), "
+               ("TSF: 0x%p   TSFTextStore::CommitCompositionInternal(), "
                 "requesting TerminateComposition() for the context 0x%p...",
                 this, context.get()));
         services->TerminateComposition(nullptr);
       }
     }
     if (context != mContext)
       break;
     if (mDocumentMgr)
@@ -4791,44 +4796,45 @@ GetCompartment(IUnknown* pUnk,
   if (!compMgr) return false;
 
   return SUCCEEDED(compMgr->GetCompartment(aID, aCompartment)) &&
          (*aCompartment) != nullptr;
 }
 
 // static
 void
-nsTextStore::SetIMEOpenState(bool aState)
+TSFTextStore::SetIMEOpenState(bool aState)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: nsTextStore::SetIMEOpenState(aState=%s)", GetBoolName(aState)));
+         ("TSF: TSFTextStore::SetIMEOpenState(aState=%s)",
+          GetBoolName(aState)));
 
   nsRefPtr<ITfCompartment> comp;
   if (!GetCompartment(sThreadMgr,
                       GUID_COMPARTMENT_KEYBOARD_OPENCLOSE,
                       getter_AddRefs(comp))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-           ("TSF:   nsTextStore::SetIMEOpenState() FAILED due to"
+           ("TSF:   TSFTextStore::SetIMEOpenState() FAILED due to"
             "no compartment available"));
     return;
   }
 
   VARIANT variant;
   variant.vt = VT_I4;
   variant.lVal = aState;
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF:   nsTextStore::SetIMEOpenState(), setting "
+         ("TSF:   TSFTextStore::SetIMEOpenState(), setting "
           "0x%04X to GUID_COMPARTMENT_KEYBOARD_OPENCLOSE...",
           variant.lVal));
   comp->SetValue(sClientId, &variant);
 }
 
 // static
 bool
-nsTextStore::GetIMEOpenState(void)
+TSFTextStore::GetIMEOpenState()
 {
   nsRefPtr<ITfCompartment> comp;
   if (!GetCompartment(sThreadMgr,
                       GUID_COMPARTMENT_KEYBOARD_OPENCLOSE,
                       getter_AddRefs(comp)))
     return false;
 
   VARIANT variant;
@@ -4837,22 +4843,22 @@ nsTextStore::GetIMEOpenState(void)
     return variant.lVal != 0;
 
   ::VariantClear(&variant); // clear up in case variant.vt != VT_I4
   return false;
 }
 
 // static
 void
-nsTextStore::SetInputContext(nsWindowBase* aWidget,
+TSFTextStore::SetInputContext(nsWindowBase* aWidget,
                              const InputContext& aContext,
                              const InputContextAction& aAction)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: nsTextStore::SetInputContext(aWidget=%p, "
+         ("TSF: TSFTextStore::SetInputContext(aWidget=%p, "
           "aContext.mIMEState.mEnabled=%s, aAction.mFocusChange=%s), "
           "sEnabledTextStore=0x%p, ThinksHavingFocus()=%s",
           aWidget, GetIMEEnabledName(aContext.mIMEState.mEnabled),
           GetFocusChangeName(aAction.mFocusChange), sEnabledTextStore.get(),
           GetBoolName(ThinksHavingFocus())));
 
   NS_ENSURE_TRUE_VOID(IsInTSFMode());
 
@@ -4869,86 +4875,86 @@ nsTextStore::SetInputContext(nsWindowBas
     OnFocusChange(true, aWidget, aContext);
   } else if (ThinksHavingFocus() && !aContext.mIMEState.IsEditable()) {
     OnFocusChange(false, aWidget, aContext);
   }
 }
 
 // static
 void
-nsTextStore::MarkContextAsKeyboardDisabled(ITfContext* aContext)
+TSFTextStore::MarkContextAsKeyboardDisabled(ITfContext* aContext)
 {
   VARIANT variant_int4_value1;
   variant_int4_value1.vt = VT_I4;
   variant_int4_value1.lVal = 1;
 
   nsRefPtr<ITfCompartment> comp;
   if (!GetCompartment(aContext,
                       GUID_COMPARTMENT_KEYBOARD_DISABLED,
                       getter_AddRefs(comp))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: nsTextStore::MarkContextAsKeyboardDisabled() failed"
+           ("TSF: TSFTextStore::MarkContextAsKeyboardDisabled() failed"
             "aContext=0x%p...", aContext));
     return;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: nsTextStore::MarkContextAsKeyboardDisabled(), setting "
+         ("TSF: TSFTextStore::MarkContextAsKeyboardDisabled(), setting "
           "to disable context 0x%p...",
           aContext));
   comp->SetValue(sClientId, &variant_int4_value1);
 }
 
 // static
 void
-nsTextStore::MarkContextAsEmpty(ITfContext* aContext)
+TSFTextStore::MarkContextAsEmpty(ITfContext* aContext)
 {
   VARIANT variant_int4_value1;
   variant_int4_value1.vt = VT_I4;
   variant_int4_value1.lVal = 1;
 
   nsRefPtr<ITfCompartment> comp;
   if (!GetCompartment(aContext,
                       GUID_COMPARTMENT_EMPTYCONTEXT,
                       getter_AddRefs(comp))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: nsTextStore::MarkContextAsEmpty() failed"
+           ("TSF: TSFTextStore::MarkContextAsEmpty() failed"
             "aContext=0x%p...", aContext));
     return;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: nsTextStore::MarkContextAsEmpty(), setting "
+         ("TSF: TSFTextStore::MarkContextAsEmpty(), setting "
           "to mark empty context 0x%p...", aContext));
   comp->SetValue(sClientId, &variant_int4_value1);
 }
 
 // static
 void
-nsTextStore::Initialize()
+TSFTextStore::Initialize()
 {
   if (!sTextStoreLog) {
     sTextStoreLog = PR_NewLogModule("nsTextStoreWidgets");
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF: nsTextStore::Initialize() is called..."));
+    ("TSF: TSFTextStore::Initialize() is called..."));
 
   if (sThreadMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED due to already initialized"));
+      ("TSF:   TSFTextStore::Initialize() FAILED due to already initialized"));
     return;
   }
 
   bool enableTsf =
     Preferences::GetBool(kPrefNameForceEnableTSF, false) ||
     (IsVistaOrLater() && Preferences::GetBool(kPrefNameEnableTSF, false) &&
      !BrowserTabsRemoteAutostart());
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF:   nsTextStore::Initialize(), TSF is %s",
+    ("TSF:   TSFTextStore::Initialize(), TSF is %s",
      enableTsf ? "enabled" : "disabled"));
   if (!enableTsf) {
     return;
   }
 
   // XXX MSDN documents that ITfInputProcessorProfiles is available only on
   //     desktop apps.  However, there is no known way to obtain
   //     ITfInputProcessorProfileMgr instance without ITfInputProcessorProfiles
@@ -4956,113 +4962,113 @@ nsTextStore::Initialize()
   nsRefPtr<ITfInputProcessorProfiles> inputProcessorProfiles;
   HRESULT hr =
     ::CoCreateInstance(CLSID_TF_InputProcessorProfiles, nullptr,
                        CLSCTX_INPROC_SERVER,
                        IID_ITfInputProcessorProfiles,
                        getter_AddRefs(inputProcessorProfiles));
   if (FAILED(hr) || !inputProcessorProfiles) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to create input processor "
+      ("TSF:   TSFTextStore::Initialize() FAILED to create input processor "
        "profiles, hr=0x%08X", hr));
     return;
   }
 
   nsRefPtr<ITfThreadMgr> threadMgr;
   hr = ::CoCreateInstance(CLSID_TF_ThreadMgr, nullptr,
                           CLSCTX_INPROC_SERVER, IID_ITfThreadMgr,
                           getter_AddRefs(threadMgr));
   if (FAILED(hr) || !threadMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to "
+      ("TSF:   TSFTextStore::Initialize() FAILED to "
        "create the thread manager, hr=0x%08X", hr));
     return;
   }
 
   nsRefPtr<ITfMessagePump> messagePump;
   hr = threadMgr->QueryInterface(IID_ITfMessagePump,
                                  getter_AddRefs(messagePump));
   if (FAILED(hr) || !messagePump) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to "
+      ("TSF:   TSFTextStore::Initialize() FAILED to "
        "QI message pump from the thread manager, hr=0x%08X", hr));
     return;
   }
 
   nsRefPtr<ITfKeystrokeMgr> keystrokeMgr;
   hr = threadMgr->QueryInterface(IID_ITfKeystrokeMgr,
                                  getter_AddRefs(keystrokeMgr));
   if (FAILED(hr) || !keystrokeMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to "
+      ("TSF:   TSFTextStore::Initialize() FAILED to "
        "QI keystroke manager from the thread manager, hr=0x%08X", hr));
     return;
   }
 
   hr = threadMgr->Activate(&sClientId);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to activate, hr=0x%08X", hr));
+      ("TSF:   TSFTextStore::Initialize() FAILED to activate, hr=0x%08X", hr));
     return;
   }
 
   nsRefPtr<ITfDisplayAttributeMgr> displayAttributeMgr;
   hr = ::CoCreateInstance(CLSID_TF_DisplayAttributeMgr, nullptr,
                           CLSCTX_INPROC_SERVER, IID_ITfDisplayAttributeMgr,
                           getter_AddRefs(displayAttributeMgr));
   if (FAILED(hr) || !displayAttributeMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to create "
+      ("TSF:   TSFTextStore::Initialize() FAILED to create "
        "a display attribute manager instance, hr=0x%08X", hr));
     return;
   }
 
   nsRefPtr<ITfCategoryMgr> categoryMgr;
   hr = ::CoCreateInstance(CLSID_TF_CategoryMgr, nullptr,
                           CLSCTX_INPROC_SERVER, IID_ITfCategoryMgr,
                           getter_AddRefs(categoryMgr));
   if (FAILED(hr) || !categoryMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to create "
+      ("TSF:   TSFTextStore::Initialize() FAILED to create "
        "a category manager instance, hr=0x%08X", hr));
     return;
   }
 
   nsRefPtr<ITfDocumentMgr> disabledDocumentMgr;
   hr = threadMgr->CreateDocumentMgr(getter_AddRefs(disabledDocumentMgr));
   if (FAILED(hr) || !disabledDocumentMgr) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to create "
+      ("TSF:   TSFTextStore::Initialize() FAILED to create "
        "a document manager for disabled mode, hr=0x%08X", hr));
     return;
   }
 
   nsRefPtr<ITfContext> disabledContext;
   DWORD editCookie = 0;
   hr = disabledDocumentMgr->CreateContext(sClientId, 0, nullptr,
                                           getter_AddRefs(disabledContext),
                                           &editCookie);
   if (FAILED(hr) || !disabledContext) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to create "
+      ("TSF:   TSFTextStore::Initialize() FAILED to create "
        "a context for disabled mode, hr=0x%08X", hr));
     return;
   }
 
   MarkContextAsKeyboardDisabled(disabledContext);
   MarkContextAsEmpty(disabledContext);
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF:   nsTextStore::Initialize() is creating "
+    ("TSF:   TSFTextStore::Initialize() is creating "
      "a TSFStaticSink instance..."));
   TSFStaticSink* staticSink = TSFStaticSink::GetInstance();
   if (!staticSink->Init(threadMgr, inputProcessorProfiles)) {
     TSFStaticSink::Shutdown();
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::Initialize() FAILED to initialize TSFStaticSink "
+      ("TSF:   TSFTextStore::Initialize() FAILED to initialize TSFStaticSink "
        "instance"));
     return;
   }
 
   sInputProcessorProfiles = inputProcessorProfiles;
   sThreadMgr = threadMgr;
   sMessagePump = messagePump;
   sKeystrokeMgr = keystrokeMgr;
@@ -5084,17 +5090,17 @@ nsTextStore::Initialize()
       "intl.tsf.hack.google_ja_input."
         "do_not_return_no_layout_error_at_first_char", true);
   sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret =
     Preferences::GetBool(
       "intl.tsf.hack.google_ja_input.do_not_return_no_layout_error_at_caret",
       true);
 
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
-    ("TSF:   nsTextStore::Initialize(), sThreadMgr=0x%p, "
+    ("TSF:   TSFTextStore::Initialize(), sThreadMgr=0x%p, "
      "sClientId=0x%08X, sDisplayAttrMgr=0x%p, "
      "sCategoryMgr=0x%p, sDisabledDocumentMgr=0x%p, sDisabledContext=%p, "
      "sCreateNativeCaretForATOK=%s, "
      "sDoNotReturnNoLayoutErrorToFreeChangJie=%s, "
      "sDoNotReturnNoLayoutErrorToEasyChangjei=%s, "
      "sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar=%s, "
      "sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret=%s",
      sThreadMgr.get(), sClientId, sDisplayAttrMgr.get(),
@@ -5103,19 +5109,19 @@ nsTextStore::Initialize()
      GetBoolName(sDoNotReturnNoLayoutErrorToFreeChangJie),
      GetBoolName(sDoNotReturnNoLayoutErrorToEasyChangjei),
      GetBoolName(sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar),
      GetBoolName(sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret)));
 }
 
 // static
 void
-nsTextStore::Terminate(void)
+TSFTextStore::Terminate()
 {
-  MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: nsTextStore::Terminate()"));
+  MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: TSFTextStore::Terminate()"));
 
   TSFStaticSink::Shutdown();
 
   sDisplayAttrMgr = nullptr;
   sCategoryMgr = nullptr;
   sEnabledTextStore = nullptr;
   sDisabledDocumentMgr = nullptr;
   sDisabledContext = nullptr;
@@ -5126,17 +5132,17 @@ nsTextStore::Terminate(void)
     sThreadMgr = nullptr;
     sMessagePump = nullptr;
     sKeystrokeMgr = nullptr;
   }
 }
 
 // static
 bool
-nsTextStore::ProcessRawKeyMessage(const MSG& aMsg)
+TSFTextStore::ProcessRawKeyMessage(const MSG& aMsg)
 {
   if (!sKeystrokeMgr) {
     return false; // not in TSF mode
   }
 
   if (aMsg.message == WM_KEYDOWN) {
     BOOL eaten;
     HRESULT hr = sKeystrokeMgr->TestKeyDown(aMsg.wParam, aMsg.lParam, &eaten);
@@ -5155,19 +5161,21 @@ nsTextStore::ProcessRawKeyMessage(const 
     hr = sKeystrokeMgr->KeyUp(aMsg.wParam, aMsg.lParam, &eaten);
     return SUCCEEDED(hr) && eaten;
   }
   return false;
 }
 
 // static
 void
-nsTextStore::ProcessMessage(nsWindowBase* aWindow, UINT aMessage,
-                            WPARAM& aWParam, LPARAM& aLParam,
-                            MSGResult& aResult)
+TSFTextStore::ProcessMessage(nsWindowBase* aWindow,
+                             UINT aMessage,
+                             WPARAM& aWParam,
+                             LPARAM& aLParam,
+                             MSGResult& aResult)
 {
   switch (aMessage) {
     case WM_IME_SETCONTEXT:
       // If a windowless plugin had focus and IME was handled on it, composition
       // window was set the position.  After that, even in TSF mode, WinXP keeps
       // to use composition window at the position if the active IME is not
       // aware TSF.  For avoiding this issue, we need to hide the composition
       // window here.
@@ -5183,63 +5191,63 @@ nsTextStore::ProcessMessage(nsWindowBase
       }
       CommitComposition(false);
       break;
   }
 }
 
 // static
 bool
-nsTextStore::IsIMM_IME()
+TSFTextStore::IsIMM_IME()
 {
   return TSFStaticSink::IsIMM_IME();
 }
 
 /******************************************************************/
-/* nsTextStore::Composition                                       */
+/* TSFTextStore::Composition                                       */
 /******************************************************************/
 
 void
-nsTextStore::Composition::Start(ITfCompositionView* aCompositionView,
-                                LONG aCompositionStartOffset,
-                                const nsAString& aCompositionString)
+TSFTextStore::Composition::Start(ITfCompositionView* aCompositionView,
+                                 LONG aCompositionStartOffset,
+                                 const nsAString& aCompositionString)
 {
   mView = aCompositionView;
   mString = aCompositionString;
   mStart = aCompositionStartOffset;
 }
 
 void
-nsTextStore::Composition::End()
+TSFTextStore::Composition::End()
 {
   mView = nullptr;
   mString.Truncate();
 }
 
 /******************************************************************************
- *  nsTextStore::Content
+ *  TSFTextStore::Content
  *****************************************************************************/
 
 const nsDependentSubstring
-nsTextStore::Content::GetSelectedText() const
+TSFTextStore::Content::GetSelectedText() const
 {
   MOZ_ASSERT(mInitialized);
   return GetSubstring(static_cast<uint32_t>(mSelection.StartOffset()),
                       static_cast<uint32_t>(mSelection.Length()));
 }
 
 const nsDependentSubstring
-nsTextStore::Content::GetSubstring(uint32_t aStart, uint32_t aLength) const
+TSFTextStore::Content::GetSubstring(uint32_t aStart, uint32_t aLength) const
 {
   MOZ_ASSERT(mInitialized);
   return nsDependentSubstring(mText, aStart, aLength);
 }
 
 void
-nsTextStore::Content::ReplaceSelectedTextWith(const nsAString& aString)
+TSFTextStore::Content::ReplaceSelectedTextWith(const nsAString& aString)
 {
   MOZ_ASSERT(mInitialized);
   ReplaceTextWith(mSelection.StartOffset(), mSelection.Length(), aString);
 }
 
 inline uint32_t
 FirstDifferentCharOffset(const nsAString& aStr1, const nsAString& aStr2)
 {
@@ -5248,18 +5256,19 @@ FirstDifferentCharOffset(const nsAString
   uint32_t minLength = std::min(aStr1.Length(), aStr2.Length());
   for (; i < minLength && aStr1[i] == aStr2[i]; i++) {
     /* nothing to do */
   }
   return i;
 }
 
 void
-nsTextStore::Content::ReplaceTextWith(LONG aStart, LONG aLength,
-                                      const nsAString& aReplaceString)
+TSFTextStore::Content::ReplaceTextWith(LONG aStart,
+                                       LONG aLength,
+                                       const nsAString& aReplaceString)
 {
   MOZ_ASSERT(mInitialized);
   const nsDependentSubstring replacedString =
     GetSubstring(static_cast<uint32_t>(aStart),
                  static_cast<uint32_t>(aLength));
   if (aReplaceString != replacedString) {
     uint32_t firstDifferentOffset = mMinTextModifiedOffset;
     if (mComposition.IsComposing()) {
@@ -5293,19 +5302,19 @@ nsTextStore::Content::ReplaceTextWith(LO
                   static_cast<uint32_t>(aLength), aReplaceString);
   }
   // Selection should be collapsed at the end of the inserted string.
   mSelection.CollapseAt(
     static_cast<uint32_t>(aStart) + aReplaceString.Length());
 }
 
 void
-nsTextStore::Content::StartComposition(ITfCompositionView* aCompositionView,
-                                       const PendingAction& aCompStart,
-                                       bool aPreserveSelection)
+TSFTextStore::Content::StartComposition(ITfCompositionView* aCompositionView,
+                                        const PendingAction& aCompStart,
+                                        bool aPreserveSelection)
 {
   MOZ_ASSERT(mInitialized);
   MOZ_ASSERT(aCompositionView);
   MOZ_ASSERT(!mComposition.mView);
   MOZ_ASSERT(aCompStart.mType == PendingAction::COMPOSITION_START);
 
   mComposition.Start(aCompositionView, aCompStart.mSelectionStart,
     GetSubstring(static_cast<uint32_t>(aCompStart.mSelectionStart),
@@ -5314,190 +5323,194 @@ nsTextStore::Content::StartComposition(I
     // XXX Do we need to set a new writing-mode here when setting a new
     // selection? Currently, we just preserve the existing value.
     mSelection.SetSelection(mComposition.mStart, mComposition.mString.Length(),
                             false, mSelection.GetWritingMode());
   }
 }
 
 void
-nsTextStore::Content::EndComposition(const PendingAction& aCompEnd)
+TSFTextStore::Content::EndComposition(const PendingAction& aCompEnd)
 {
   MOZ_ASSERT(mInitialized);
   MOZ_ASSERT(mComposition.mView);
   MOZ_ASSERT(aCompEnd.mType == PendingAction::COMPOSITION_END);
 
   mSelection.CollapseAt(mComposition.mStart + aCompEnd.mData.Length());
   mComposition.End();
 }
 
 /******************************************************************************
- *  nsTextStore::MouseTracker
+ *  TSFTextStore::MouseTracker
  *****************************************************************************/
 
-nsTextStore::MouseTracker::MouseTracker()
+TSFTextStore::MouseTracker::MouseTracker()
   : mStart(-1)
   , mLength(-1)
   , mCookie(kInvalidCookie)
 {
 }
 
 HRESULT
-nsTextStore::MouseTracker::Init(nsTextStore* aTextStore)
+TSFTextStore::MouseTracker::Init(TSFTextStore* aTextStore)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::MouseTracker::Init(aTextStore=0x%p), "
+         ("TSF: 0x%p   TSFTextStore::MouseTracker::Init(aTextStore=0x%p), "
           "aTextStore->mMouseTrackers.Length()=%d",
           this, aTextStore->mMouseTrackers.Length()));
 
   if (&aTextStore->mMouseTrackers.LastElement() != this) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::MouseTracker::Init() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::MouseTracker::Init() FAILED due to "
             "this is not the last element of mMouseTrackers", this));
     return E_FAIL;
   }
   if (aTextStore->mMouseTrackers.Length() > kInvalidCookie) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::MouseTracker::Init() FAILED due to "
+           ("TSF: 0x%p   TSFTextStore::MouseTracker::Init() FAILED due to "
             "no new cookie available", this));
     return E_FAIL;
   }
   MOZ_ASSERT(!aTextStore->mMouseTrackers.IsEmpty(),
-             "This instance must be in nsTextStore::mMouseTrackers");
+             "This instance must be in TSFTextStore::mMouseTrackers");
   mCookie = static_cast<DWORD>(aTextStore->mMouseTrackers.Length() - 1);
   return S_OK;
 }
 
 HRESULT
-nsTextStore::MouseTracker::AdviseSink(nsTextStore* aTextStore,
-                                      ITfRangeACP* aTextRange,
-                                      ITfMouseSink* aMouseSink)
+TSFTextStore::MouseTracker::AdviseSink(TSFTextStore* aTextStore,
+                                       ITfRangeACP* aTextRange,
+                                       ITfMouseSink* aMouseSink)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::MouseTracker::AdviseSink(aTextStore=0x%p, "
+         ("TSF: 0x%p   TSFTextStore::MouseTracker::AdviseSink(aTextStore=0x%p, "
           "aTextRange=0x%p, aMouseSink=0x%p), mCookie=%d, mSink=0x%p",
           this, aTextStore, aTextRange, aMouseSink, mCookie, mSink.get()));
   MOZ_ASSERT(mCookie != kInvalidCookie, "This hasn't been initalized?");
 
   if (mSink) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::MouseTracker::AdviseMouseSink() FAILED "
+           ("TSF: 0x%p   TSFTextStore::MouseTracker::AdviseMouseSink() FAILED "
             "due to already being used", this));
     return E_FAIL;
   }
 
   HRESULT hr = aTextRange->GetExtent(&mStart, &mLength);
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::MouseTracker::AdviseMouseSink() FAILED "
+           ("TSF: 0x%p   TSFTextStore::MouseTracker::AdviseMouseSink() FAILED "
             "due to failure of ITfRangeACP::GetExtent()", this));
     return hr;
   }
 
   if (mStart < 0 || mLength <= 0) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::MouseTracker::AdviseMouseSink() FAILED "
+           ("TSF: 0x%p   TSFTextStore::MouseTracker::AdviseMouseSink() FAILED "
             "due to odd result of ITfRangeACP::GetExtent(), "
             "mStart=%d, mLength=%d", this, mStart, mLength));
     return E_INVALIDARG;
   }
 
   nsAutoString textContent;
   if (NS_WARN_IF(!aTextStore->GetCurrentText(textContent))) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::MouseTracker::AdviseMouseSink() FAILED "
-            "due to failure of nsTextStore::GetCurrentText()", this));
+           ("TSF: 0x%p   TSFTextStore::MouseTracker::AdviseMouseSink() FAILED "
+            "due to failure of TSFTextStore::GetCurrentText()", this));
     return E_FAIL;
   }
 
   if (textContent.Length() <= static_cast<uint32_t>(mStart) ||
       textContent.Length() < static_cast<uint32_t>(mStart + mLength)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   nsTextStore::MouseTracker::AdviseMouseSink() FAILED "
+           ("TSF: 0x%p   TSFTextStore::MouseTracker::AdviseMouseSink() FAILED "
             "due to out of range, mStart=%d, mLength=%d, "
             "textContent.Length()=%d",
             this, mStart, mLength, textContent.Length()));
     return E_INVALIDARG;
   }
 
   mSink = aMouseSink;
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::MouseTracker::AdviseMouseSink(), "
+         ("TSF: 0x%p   TSFTextStore::MouseTracker::AdviseMouseSink(), "
           "succeeded, mStart=%d, mLength=%d, textContent.Length()=%d",
           this, mStart, mLength, textContent.Length()));
   return S_OK;
 }
 
 void
-nsTextStore::MouseTracker::UnadviseSink()
+TSFTextStore::MouseTracker::UnadviseSink()
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::MouseTracker::UnadviseSink(), "
+         ("TSF: 0x%p   TSFTextStore::MouseTracker::UnadviseSink(), "
           "mCookie=%d, mSink=0x%p, mStart=%d, mLength=%d",
           this, mCookie, mSink.get(), mStart, mLength));
   mSink = nullptr;
   mStart = mLength = -1;
 }
 
 bool
-nsTextStore::MouseTracker::OnMouseButtonEvent(ULONG aEdge,
-                                              ULONG aQuadrant,
-                                              DWORD aButtonStatus)
+TSFTextStore::MouseTracker::OnMouseButtonEvent(ULONG aEdge,
+                                               ULONG aQuadrant,
+                                               DWORD aButtonStatus)
 {
   MOZ_ASSERT(IsUsing(), "The caller must check before calling OnMouseEvent()");
 
   BOOL eaten = FALSE;
   HRESULT hr = mSink->OnMouseEvent(aEdge, aQuadrant, aButtonStatus, &eaten);
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   nsTextStore::MouseTracker::OnMouseEvent(aEdge=%d, "
+         ("TSF: 0x%p   TSFTextStore::MouseTracker::OnMouseEvent(aEdge=%d, "
           "aQuadrant=%d, aButtonStatus=0x%08X), hr=0x%08X, eaten=%s",
           this, aEdge, aQuadrant, aButtonStatus, hr, GetBoolName(!!eaten)));
 
   return SUCCEEDED(hr) && eaten;
 }
 
 #ifdef DEBUG
 // static
 bool
-nsTextStore::CurrentKeyboardLayoutHasIME()
+TSFTextStore::CurrentKeyboardLayoutHasIME()
 {
   if (!sInputProcessorProfiles) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF: nsTextStore::CurrentKeyboardLayoutHasIME() FAILED due to there is "
-       "no input processor profiles instance"));
+      ("TSF: TSFTextStore::CurrentKeyboardLayoutHasIME() FAILED due to "
+       "there is no input processor profiles instance"));
     return false;
   }
   nsRefPtr<ITfInputProcessorProfileMgr> profileMgr;
   HRESULT hr =
     sInputProcessorProfiles->QueryInterface(IID_ITfInputProcessorProfileMgr,
                                             getter_AddRefs(profileMgr));
   if (FAILED(hr) || !profileMgr) {
     // On Windows Vista or later, ImmIsIME() API always returns true.
     // If we failed to obtain the profile manager, we cannot know if current
     // keyboard layout has IME.
     if (IsVistaOrLater()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-        ("TSF:   nsTextStore::CurrentKeyboardLayoutHasIME() FAILED to query "
+        ("TSF:   TSFTextStore::CurrentKeyboardLayoutHasIME() FAILED to query "
          "ITfInputProcessorProfileMgr"));
       return false;
     }
     // If the profiles instance doesn't have ITfInputProcessorProfileMgr
     // interface, that means probably we're running on WinXP or WinServer2003
     // (except WinServer2003 R2).  Then, we should use ImmIsIME().
     return ::ImmIsIME(::GetKeyboardLayout(0));
   }
 
   TF_INPUTPROCESSORPROFILE profile;
   hr = profileMgr->GetActiveProfile(GUID_TFCAT_TIP_KEYBOARD, &profile);
   if (hr == S_FALSE) {
     return false; // not found or not active
   }
   if (FAILED(hr)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-      ("TSF:   nsTextStore::CurrentKeyboardLayoutHasIME() FAILED to retreive "
+      ("TSF:   TSFTextStore::CurrentKeyboardLayoutHasIME() FAILED to retreive "
        "active profile"));
     return false;
   }
   return (profile.dwProfileType == TF_PROFILETYPE_INPUTPROCESSOR);
 }
 #endif // #ifdef DEBUG
+
+} // name widget
+} // name mozilla
+
rename from widget/windows/nsTextStore.h
rename to widget/windows/TSFTextStore.h
--- a/widget/windows/nsTextStore.h
+++ b/widget/windows/TSFTextStore.h
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
-#ifndef NSTEXTSTORE_H_
-#define NSTEXTSTORE_H_
+#ifndef TSFTextStore_h_
+#define TSFTextStore_h_
 
 #include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIWidget.h"
 #include "nsWindowBase.h"
 #include "WinUtils.h"
 #include "mozilla/Attributes.h"
@@ -36,32 +36,31 @@
 struct ITfThreadMgr;
 struct ITfDocumentMgr;
 struct ITfDisplayAttributeMgr;
 struct ITfCategoryMgr;
 class nsWindow;
 
 namespace mozilla {
 namespace widget {
+
 struct MSGResult;
-} // namespace widget
-} // namespace mozilla
 
 /*
  * Text Services Framework text store
  */
 
-class nsTextStore final : public ITextStoreACP
-                        , public ITfContextOwnerCompositionSink
-                        , public ITfMouseTrackerACP
+class TSFTextStore final : public ITextStoreACP
+                         , public ITfContextOwnerCompositionSink
+                         , public ITfMouseTrackerACP
 {
 public: /*IUnknown*/
   STDMETHODIMP          QueryInterface(REFIID, void**);
 
-  NS_INLINE_DECL_IUNKNOWN_REFCOUNTING(nsTextStore)
+  NS_INLINE_DECL_IUNKNOWN_REFCOUNTING(TSFTextStore)
 
 public: /*ITextStoreACP*/
   STDMETHODIMP AdviseSink(REFIID, IUnknown*, DWORD);
   STDMETHODIMP UnadviseSink(IUnknown*);
   STDMETHODIMP RequestLock(DWORD, HRESULT*);
   STDMETHODIMP GetStatus(TS_STATUS*);
   STDMETHODIMP QueryInsert(LONG, LONG, ULONG, LONG*, LONG*);
   STDMETHODIMP GetSelection(ULONG, ULONG, TS_SELECTION_ACP*, ULONG*);
@@ -95,30 +94,24 @@ public: /*ITfContextOwnerCompositionSink
   STDMETHODIMP OnStartComposition(ITfCompositionView*, BOOL*);
   STDMETHODIMP OnUpdateComposition(ITfCompositionView*, ITfRange*);
   STDMETHODIMP OnEndComposition(ITfCompositionView*);
 
 public: /*ITfMouseTrackerACP*/
   STDMETHODIMP AdviseMouseSink(ITfRangeACP*, ITfMouseSink*, DWORD*);
   STDMETHODIMP UnadviseMouseSink(DWORD);
 
-protected:
-  typedef mozilla::widget::IMENotification IMENotification;
-  typedef mozilla::widget::IMEState IMEState;
-  typedef mozilla::widget::InputContext InputContext;
-  typedef mozilla::widget::InputContextAction InputContextAction;
-
 public:
   static void     Initialize(void);
   static void     Terminate(void);
 
   static bool     ProcessRawKeyMessage(const MSG& aMsg);
   static void     ProcessMessage(nsWindowBase* aWindow, UINT aMessage,
                                  WPARAM& aWParam, LPARAM& aLParam,
-                                 mozilla::widget::MSGResult& aResult);
+                                 MSGResult& aResult);
 
 
   static void     SetIMEOpenState(bool);
   static bool     GetIMEOpenState(void);
 
   static void     CommitComposition(bool aDiscard)
   {
     NS_ASSERTION(IsInTSFMode(), "Not in TSF mode, shouldn't be called");
@@ -222,18 +215,18 @@ public:
   static bool IsIMM_IME();
 
 #ifdef DEBUG
   // Returns true when keyboard layout has IME (TIP).
   static bool     CurrentKeyboardLayoutHasIME();
 #endif // #ifdef DEBUG
 
 protected:
-  nsTextStore();
-  ~nsTextStore();
+  TSFTextStore();
+  ~TSFTextStore();
 
   static bool CreateAndSetFocus(nsWindowBase* aFocusedWidget,
                                 const InputContext& aContext);
   static void MarkContextAsKeyboardDisabled(ITfContext* aContext);
   static void MarkContextAsEmpty(ITfContext* aContext);
 
   bool     Init(nsWindowBase* aWidget);
   bool     Destroy();
@@ -248,25 +241,25 @@ protected:
   }
   bool     IsReadLocked() const { return IsReadLock(mLock); }
   bool     IsReadWriteLocked() const { return IsReadWriteLock(mLock); }
 
   // This is called immediately after a call of OnLockGranted() of mSink.
   // Note that mLock isn't cleared yet when this is called.
   void     DidLockGranted();
 
-  bool     GetScreenExtInternal(RECT &aScreenExt);
+  bool     GetScreenExtInternal(RECT& aScreenExt);
   // If aDispatchCompositionChangeEvent is true, this method will dispatch
   // compositionchange event if this is called during IME composing.
   // aDispatchCompositionChangeEvent should be true only when this is called
   // from SetSelection.  Because otherwise, the compositionchange event should
   // not be sent from here.
   HRESULT  SetSelectionInternal(const TS_SELECTION_ACP*,
                                 bool aDispatchCompositionChangeEvent = false);
-  bool     InsertTextAtSelectionInternal(const nsAString &aInsertStr,
+  bool     InsertTextAtSelectionInternal(const nsAString& aInsertStr,
                                          TS_TEXTCHANGE* aTextChange);
   void     CommitCompositionInternal(bool);
   nsresult OnTextChangeInternal(const IMENotification& aIMENotification);
   nsresult OnSelectionChangeInternal(const IMENotification& aIMENotification);
   nsresult OnMouseButtonEventInternal(const IMENotification& aIMENotification);
   HRESULT  GetDisplayAttribute(ITfProperty* aProperty,
                                ITfRange* aRange,
                                TF_DISPLAYATTRIBUTE* aResult);
@@ -284,17 +277,17 @@ protected:
                                         LONG aLength,
                                         bool aPreserveSelection);
   HRESULT  RecordCompositionUpdateAction();
   HRESULT  RecordCompositionEndAction();
 
   // DispatchEvent() dispatches the event and if it may not be handled
   // synchronously, this makes the instance not notify TSF of pending
   // notifications until next notification from content.
-  void     DispatchEvent(mozilla::WidgetGUIEvent& aEvent);
+  void     DispatchEvent(WidgetGUIEvent& aEvent);
   void     OnLayoutInformationAvaliable();
 
   // FlushPendingActions() performs pending actions recorded in mPendingActions
   // and clear it.
   void     FlushPendingActions();
   // MaybeFlushPendingNotifications() performs pending notifications to TSF.
   void     MaybeFlushPendingNotifications();
 
@@ -364,17 +357,17 @@ protected:
     void Start(ITfCompositionView* aCompositionView,
                LONG aCompositionStartOffset,
                const nsAString& aCompositionString);
     void End();
   };
   // While the document is locked, we cannot dispatch any events which cause
   // DOM events since the DOM events' handlers may modify the locked document.
   // However, even while the document is locked, TSF may queries us.
-  // For that, nsTextStore modifies mComposition even while the document is
+  // For that, TSFTextStore modifies mComposition even while the document is
   // locked.  With mComposition, query methods can returns the text content
   // information.
   Composition mComposition;
 
   class Selection
   {
   public:
     Selection() : mDirty(true) {}
@@ -396,18 +389,20 @@ protected:
       if (mACP.style.ase != TS_AE_START) {
         mACP.style.ase = TS_AE_END;
       }
       // We're not support interim char selection for now.
       // XXX Probably, this is necessary for supporting South Asian languages.
       mACP.style.fInterimChar = FALSE;
     }
 
-    void SetSelection(uint32_t aStart, uint32_t aLength, bool aReversed,
-                      mozilla::WritingMode aWritingMode)
+    void SetSelection(uint32_t aStart,
+                      uint32_t aLength,
+                      bool aReversed,
+                      WritingMode aWritingMode)
     {
       mDirty = false;
       mACP.acpStart = static_cast<LONG>(aStart);
       mACP.acpEnd = static_cast<LONG>(aStart + aLength);
       mACP.style.ase = aReversed ? TS_AE_START : TS_AE_END;
       mACP.style.fInterimChar = FALSE;
       mWritingMode = aWritingMode;
     }
@@ -479,25 +474,25 @@ protected:
     }
 
     bool IsInterimChar() const
     {
       MOZ_ASSERT(!mDirty);
       return (mACP.style.fInterimChar != FALSE);
     }
 
-    mozilla::WritingMode GetWritingMode() const
+    WritingMode GetWritingMode() const
     {
       MOZ_ASSERT(!mDirty);
       return mWritingMode;
     }
 
   private:
     TS_SELECTION_ACP mACP;
-    mozilla::WritingMode mWritingMode;
+    WritingMode mWritingMode;
     bool mDirty;
   };
   // Don't access mSelection directly except at calling MarkDirty().
   // Use CurrentSelection() instead.  This is marked as dirty when the
   // selection or content is changed without document lock.
   Selection mSelection;
 
   // Get "current selection".  If the document is locked, this initializes
@@ -518,17 +513,17 @@ protected:
     };
     ActionType mType;
     // For compositionstart and selectionset
     LONG mSelectionStart;
     LONG mSelectionLength;
     // For compositionupdate and compositionend
     nsString mData;
     // For compositionupdate
-    nsRefPtr<mozilla::TextRangeArray> mRanges;
+    nsRefPtr<TextRangeArray> mRanges;
     // For selectionset
     bool mSelectionReversed;
     // For compositionupdate
     bool mIncomplete;
     // For compositionstart
     bool mAdjustSelection;
   };
   // Items of mPendingActions are appended when TSF tells us to need to dispatch
@@ -542,17 +537,17 @@ protected:
     if (!mPendingActions.IsEmpty()) {
       PendingAction& lastAction = mPendingActions.LastElement();
       if (lastAction.mType == PendingAction::COMPOSITION_UPDATE) {
         return &lastAction;
       }
     }
     PendingAction* newAction = mPendingActions.AppendElement();
     newAction->mType = PendingAction::COMPOSITION_UPDATE;
-    newAction->mRanges = new mozilla::TextRangeArray();
+    newAction->mRanges = new TextRangeArray();
     newAction->mIncomplete = true;
     return newAction;
   }
 
   bool IsPendingCompositionUpdateIncomplete() const
   {
     if (mPendingActions.IsEmpty()) {
       return false;
@@ -571,17 +566,17 @@ protected:
   }
 
   // When On*Composition() is called without document lock, we need to flush
   // the recorded actions at quitting the method.
   // AutoPendingActionAndContentFlusher class is usedful for it.  
   class MOZ_STACK_CLASS AutoPendingActionAndContentFlusher final
   {
   public:
-    AutoPendingActionAndContentFlusher(nsTextStore* aTextStore)
+    AutoPendingActionAndContentFlusher(TSFTextStore* aTextStore)
       : mTextStore(aTextStore)
     {
       MOZ_ASSERT(!mTextStore->mIsRecordingActionsWithoutLock);
       if (!mTextStore->IsReadWriteLocked()) {
         mTextStore->mIsRecordingActionsWithoutLock = true;
       }
     }
 
@@ -592,24 +587,24 @@ protected:
       }
       mTextStore->FlushPendingActions();
       mTextStore->mIsRecordingActionsWithoutLock = false;
     }
 
   private:
     AutoPendingActionAndContentFlusher() {}
 
-    nsRefPtr<nsTextStore> mTextStore;
+    nsRefPtr<TSFTextStore> mTextStore;
   };
 
   class Content final
   {
   public:
-    Content(nsTextStore::Composition& aComposition,
-            nsTextStore::Selection& aSelection) :
+    Content(TSFTextStore::Composition& aComposition,
+            TSFTextStore::Selection& aSelection) :
       mComposition(aComposition), mSelection(aSelection)
     {
       Clear();
     }
 
     void Clear()
     {
       mText.Truncate();
@@ -659,26 +654,26 @@ protected:
       return mInitialized && (mMinTextModifiedOffset != NOT_MODIFIED);
     }
     // Returns minimum offset of modified text range.
     uint32_t MinOffsetOfLayoutChanged() const
     {
       return mInitialized ? mMinTextModifiedOffset : NOT_MODIFIED;
     }
 
-    nsTextStore::Composition& Composition() { return mComposition; }
-    nsTextStore::Selection& Selection() { return mSelection; }
+    TSFTextStore::Composition& Composition() { return mComposition; }
+    TSFTextStore::Selection& Selection() { return mSelection; }
 
   private:
     nsString mText;
     // mLastCompositionString stores the composition string when the document
     // is locked. This is necessary to compute mMinTextModifiedOffset.
     nsString mLastCompositionString;
-    nsTextStore::Composition& mComposition;
-    nsTextStore::Selection& mSelection;
+    TSFTextStore::Composition& mComposition;
+    TSFTextStore::Selection& mSelection;
 
     // The minimum offset of modified part of the text.
     enum : uint32_t
     {
       NOT_MODIFIED = UINT32_MAX
     };
     uint32_t mMinTextModifiedOffset;
 
@@ -700,18 +695,18 @@ protected:
 
   class MouseTracker final
   {
   public:
     static const DWORD kInvalidCookie = static_cast<DWORD>(-1);
 
     MouseTracker();
 
-    HRESULT Init(nsTextStore* aTextStore);
-    HRESULT AdviseSink(nsTextStore* aTextStore,
+    HRESULT Init(TSFTextStore* aTextStore);
+    HRESULT AdviseSink(TSFTextStore* aTextStore,
                        ITfRangeACP* aTextRange, ITfMouseSink* aMouseSink);
     void UnadviseSink();
 
     bool IsUsing() const { return mSink != nullptr; }
     bool InRange(uint32_t aOffset) const
     {
       if (NS_WARN_IF(mStart < 0) ||
           NS_WARN_IF(mLength <= 0)) {
@@ -789,43 +784,45 @@ protected:
   // we shouldn't query layout information.  However, TS_E_NOLAYOUT bugs of
   // ITextStoreAPC::GetTextExt() blocks us to behave ideally.
   // For preventing it to be called, we should put off notifying TSF of
   // anything until layout information becomes available.
   bool                         mDeferNotifyingTSF;
 
 
   // TSF thread manager object for the current application
-  static mozilla::StaticRefPtr<ITfThreadMgr> sThreadMgr;
+  static StaticRefPtr<ITfThreadMgr> sThreadMgr;
   // sMessagePump is QI'ed from sThreadMgr
-  static mozilla::StaticRefPtr<ITfMessagePump> sMessagePump;
+  static StaticRefPtr<ITfMessagePump> sMessagePump;
   // sKeystrokeMgr is QI'ed from sThreadMgr
-  static mozilla::StaticRefPtr<ITfKeystrokeMgr> sKeystrokeMgr;
+  static StaticRefPtr<ITfKeystrokeMgr> sKeystrokeMgr;
   // TSF display attribute manager
-  static mozilla::StaticRefPtr<ITfDisplayAttributeMgr> sDisplayAttrMgr;
+  static StaticRefPtr<ITfDisplayAttributeMgr> sDisplayAttrMgr;
   // TSF category manager
-  static mozilla::StaticRefPtr<ITfCategoryMgr> sCategoryMgr;
+  static StaticRefPtr<ITfCategoryMgr> sCategoryMgr;
 
   // Current text store which is managing a keyboard enabled editor (i.e.,
-  // editable editor).  Currently only ONE nsTextStore instance is ever used,
+  // editable editor).  Currently only ONE TSFTextStore instance is ever used,
   // although Create is called when an editor is focused and Destroy called
   // when the focused editor is blurred.
-  static mozilla::StaticRefPtr<nsTextStore> sEnabledTextStore;
+  static StaticRefPtr<TSFTextStore> sEnabledTextStore;
 
   // For IME (keyboard) disabled state:
-  static mozilla::StaticRefPtr<ITfDocumentMgr> sDisabledDocumentMgr;
-  static mozilla::StaticRefPtr<ITfContext> sDisabledContext;
+  static StaticRefPtr<ITfDocumentMgr> sDisabledDocumentMgr;
+  static StaticRefPtr<ITfContext> sDisabledContext;
 
-  static mozilla::StaticRefPtr<ITfInputProcessorProfiles>
-    sInputProcessorProfiles;
+  static StaticRefPtr<ITfInputProcessorProfiles> sInputProcessorProfiles;
 
   // TSF client ID for the current application
   static DWORD sClientId;
 
   // Enables/Disables hack for specific TIP.
   static bool sCreateNativeCaretForATOK;
   static bool sDoNotReturnNoLayoutErrorToFreeChangJie;
   static bool sDoNotReturnNoLayoutErrorToEasyChangjei;
   static bool sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar;
   static bool sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret;
 };
 
-#endif /*NSTEXTSTORE_H_*/
+} // namespace widget
+} // namespace mozilla
+
+#endif // #ifndef TSFTextStore_h_
--- a/widget/windows/WinIMEHandler.cpp
+++ b/widget/windows/WinIMEHandler.cpp
@@ -5,17 +5,17 @@
 
 #include "WinIMEHandler.h"
 
 #include "IMMHandler.h"
 #include "mozilla/Preferences.h"
 #include "nsWindowDefs.h"
 
 #ifdef NS_ENABLE_TSF
-#include "nsTextStore.h"
+#include "TSFTextStore.h"
 #endif // #ifdef NS_ENABLE_TSF
 
 #include "nsWindow.h"
 #include "WinUtils.h"
 
 namespace mozilla {
 namespace widget {
 
@@ -30,22 +30,22 @@ bool IMEHandler::sPluginHasFocus = false
 decltype(SetInputScopes)* IMEHandler::sSetInputScopes = nullptr;
 #endif // #ifdef NS_ENABLE_TSF
 
 // static
 void
 IMEHandler::Initialize()
 {
 #ifdef NS_ENABLE_TSF
-  nsTextStore::Initialize();
-  sIsInTSFMode = nsTextStore::IsInTSFMode();
+  TSFTextStore::Initialize();
+  sIsInTSFMode = TSFTextStore::IsInTSFMode();
   sIsIMMEnabled =
     !sIsInTSFMode || Preferences::GetBool("intl.tsf.support_imm", true);
   if (!sIsInTSFMode) {
-    // When full nsTextStore is not available, try to use SetInputScopes API
+    // When full TSFTextStore is not available, try to use SetInputScopes API
     // to enable at least InputScope. Use GET_MODULE_HANDLE_EX_FLAG_PIN to
     // ensure that msctf.dll will not be unloaded.
     HMODULE module = nullptr;
     if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_PIN, L"msctf.dll",
                            &module)) {
       sSetInputScopes = reinterpret_cast<decltype(SetInputScopes)*>(
         GetProcAddress(module, "SetInputScopes"));
     }
@@ -56,30 +56,30 @@ IMEHandler::Initialize()
 }
 
 // static
 void
 IMEHandler::Terminate()
 {
 #ifdef NS_ENABLE_TSF
   if (sIsInTSFMode) {
-    nsTextStore::Terminate();
+    TSFTextStore::Terminate();
     sIsInTSFMode = false;
   }
 #endif // #ifdef NS_ENABLE_TSF
 
   IMMHandler::Terminate();
 }
 
 // static
 void*
 IMEHandler::GetNativeData(uint32_t aDataType)
 {
 #ifdef NS_ENABLE_TSF
-  void* result = nsTextStore::GetNativeData(aDataType);
+  void* result = TSFTextStore::GetNativeData(aDataType);
   if (!result || !(*(static_cast<void**>(result)))) {
     return nullptr;
   }
   // XXX During the TSF module test, sIsInTSFMode must be true.  After that,
   //     the value should be restored but currently, there is no way for that.
   //     When the TSF test is enabled again, we need to fix this.  Perhaps,
   //     sending a message can fix this.
   sIsInTSFMode = true;
@@ -90,96 +90,96 @@ IMEHandler::GetNativeData(uint32_t aData
 }
 
 // static
 bool
 IMEHandler::ProcessRawKeyMessage(const MSG& aMsg)
 {
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
-    return nsTextStore::ProcessRawKeyMessage(aMsg);
+    return TSFTextStore::ProcessRawKeyMessage(aMsg);
   }
 #endif // #ifdef NS_ENABLE_TSF
   return false; // noting to do in IMM mode.
 }
 
 // static
 bool
 IMEHandler::ProcessMessage(nsWindow* aWindow, UINT aMessage,
                            WPARAM& aWParam, LPARAM& aLParam,
                            MSGResult& aResult)
 {
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
-    nsTextStore::ProcessMessage(aWindow, aMessage, aWParam, aLParam, aResult);
+    TSFTextStore::ProcessMessage(aWindow, aMessage, aWParam, aLParam, aResult);
     if (aResult.mConsumed) {
       return true;
     }
     // If we don't support IMM in TSF mode, we don't use IMMHandler.
     if (!sIsIMMEnabled) {
       return false;
     }
     // IME isn't implemented with IMM, IMMHandler shouldn't handle any
     // messages.
-    if (!nsTextStore::IsIMM_IME()) {
+    if (!TSFTextStore::IsIMM_IME()) {
       return false;
     }
   }
 #endif // #ifdef NS_ENABLE_TSF
 
   return IMMHandler::ProcessMessage(aWindow, aMessage, aWParam, aLParam,
                                     aResult);
 }
 
 #ifdef NS_ENABLE_TSF
 // static
 bool
 IMEHandler::IsIMMActive()
 {
-  return nsTextStore::IsIMM_IME();
+  return TSFTextStore::IsIMM_IME();
 }
 #endif // #ifdef NS_ENABLE_TSF
 
 // static
 bool
 IMEHandler::IsComposing()
 {
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
-    return nsTextStore::IsComposing() || IMMHandler::IsComposing();
+    return TSFTextStore::IsComposing() || IMMHandler::IsComposing();
   }
 #endif // #ifdef NS_ENABLE_TSF
 
   return IMMHandler::IsComposing();
 }
 
 // static
 bool
 IMEHandler::IsComposingOn(nsWindow* aWindow)
 {
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
-    return nsTextStore::IsComposingOn(aWindow) ||
+    return TSFTextStore::IsComposingOn(aWindow) ||
            IMMHandler::IsComposingOn(aWindow);
   }
 #endif // #ifdef NS_ENABLE_TSF
 
   return IMMHandler::IsComposingOn(aWindow);
 }
 
 // static
 nsresult
 IMEHandler::NotifyIME(nsWindow* aWindow,
                       const IMENotification& aIMENotification)
 {
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
     switch (aIMENotification.mMessage) {
       case NOTIFY_IME_OF_SELECTION_CHANGE: {
-        nsresult rv = nsTextStore::OnSelectionChange(aIMENotification);
+        nsresult rv = TSFTextStore::OnSelectionChange(aIMENotification);
         // If IMM IME is active, we need to notify IMMHandler of updating
         // composition change.  It will adjust candidate window position or
         // composition window position.
         bool isIMMActive = IsIMMActive();
         if (isIMMActive) {
           IMMHandler::OnUpdateComposition(aWindow);
         }
         IMMHandler::OnSelectionChange(aWindow, aIMENotification, isIMMActive);
@@ -187,51 +187,51 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
       }
       case NOTIFY_IME_OF_COMPOSITION_UPDATE:
         // If IMM IME is active, we need to notify IMMHandler of updating
         // composition change.  It will adjust candidate window position or
         // composition window position.
         if (IsIMMActive()) {
           IMMHandler::OnUpdateComposition(aWindow);
         } else {
-          nsTextStore::OnUpdateComposition();
+          TSFTextStore::OnUpdateComposition();
         }
         return NS_OK;
       case NOTIFY_IME_OF_TEXT_CHANGE:
-        return nsTextStore::OnTextChange(aIMENotification);
+        return TSFTextStore::OnTextChange(aIMENotification);
       case NOTIFY_IME_OF_FOCUS:
         IMMHandler::OnFocusChange(true, aWindow);
-        return nsTextStore::OnFocusChange(true, aWindow,
-                                          aWindow->GetInputContext());
+        return TSFTextStore::OnFocusChange(true, aWindow,
+                                           aWindow->GetInputContext());
       case NOTIFY_IME_OF_BLUR:
         IMMHandler::OnFocusChange(false, aWindow);
-        return nsTextStore::OnFocusChange(false, aWindow,
-                                          aWindow->GetInputContext());
+        return TSFTextStore::OnFocusChange(false, aWindow,
+                                           aWindow->GetInputContext());
       case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
         // If IMM IME is active, we should send a mouse button event via IMM.
         if (IsIMMActive()) {
           return IMMHandler::OnMouseButtonEvent(aWindow, aIMENotification);
         }
-        return nsTextStore::OnMouseButtonEvent(aIMENotification);
+        return TSFTextStore::OnMouseButtonEvent(aIMENotification);
       case REQUEST_TO_COMMIT_COMPOSITION:
-        if (nsTextStore::IsComposingOn(aWindow)) {
-          nsTextStore::CommitComposition(false);
+        if (TSFTextStore::IsComposingOn(aWindow)) {
+          TSFTextStore::CommitComposition(false);
         } else if (IsIMMActive()) {
           IMMHandler::CommitComposition(aWindow);
         }
         return NS_OK;
       case REQUEST_TO_CANCEL_COMPOSITION:
-        if (nsTextStore::IsComposingOn(aWindow)) {
-          nsTextStore::CommitComposition(true);
+        if (TSFTextStore::IsComposingOn(aWindow)) {
+          TSFTextStore::CommitComposition(true);
         } else if (IsIMMActive()) {
           IMMHandler::CancelComposition(aWindow);
         }
         return NS_OK;
       case NOTIFY_IME_OF_POSITION_CHANGE:
-        return nsTextStore::OnLayoutChange();
+        return TSFTextStore::OnLayoutChange();
       default:
         return NS_ERROR_NOT_IMPLEMENTED;
     }
   }
 #endif //NS_ENABLE_TSF
 
   switch (aIMENotification.mMessage) {
     case REQUEST_TO_COMMIT_COMPOSITION:
@@ -252,47 +252,47 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
     case NOTIFY_IME_OF_FOCUS:
       IMMHandler::OnFocusChange(true, aWindow);
       return NS_OK;
     case NOTIFY_IME_OF_BLUR:
       IMMHandler::OnFocusChange(false, aWindow);
 #ifdef NS_ENABLE_TSF
       // If a plugin gets focus while TSF has focus, we need to notify TSF of
       // the blur.
-      if (nsTextStore::ThinksHavingFocus()) {
-        return nsTextStore::OnFocusChange(false, aWindow,
-                                          aWindow->GetInputContext());
+      if (TSFTextStore::ThinksHavingFocus()) {
+        return TSFTextStore::OnFocusChange(false, aWindow,
+                                           aWindow->GetInputContext());
       }
 #endif //NS_ENABLE_TSF
       return NS_OK;
     default:
       return NS_ERROR_NOT_IMPLEMENTED;
   }
 }
 
 // static
 nsIMEUpdatePreference
 IMEHandler::GetUpdatePreference()
 {
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
-    return nsTextStore::GetIMEUpdatePreference();
+    return TSFTextStore::GetIMEUpdatePreference();
   }
 #endif //NS_ENABLE_TSF
 
   return IMMHandler::GetIMEUpdatePreference();
 }
 
 // static
 bool
 IMEHandler::GetOpenState(nsWindow* aWindow)
 {
 #ifdef NS_ENABLE_TSF
   if (IsTSFAvailable() && !IsIMMActive()) {
-    return nsTextStore::GetIMEOpenState();
+    return TSFTextStore::GetIMEOpenState();
   }
 #endif //NS_ENABLE_TSF
 
   IMEContext context(aWindow);
   return context.GetOpenState();
 }
 
 // static
@@ -331,29 +331,29 @@ IMEHandler::SetInputContext(nsWindow* aW
   bool open = (adjustOpenState &&
     aInputContext.mIMEState.mOpen == IMEState::OPEN);
 
   aInputContext.mNativeIMEContext = nullptr;
 
 #ifdef NS_ENABLE_TSF
   // Note that even while a plugin has focus, we need to notify TSF of that.
   if (sIsInTSFMode) {
-    nsTextStore::SetInputContext(aWindow, aInputContext, aAction);
+    TSFTextStore::SetInputContext(aWindow, aInputContext, aAction);
     if (IsTSFAvailable()) {
-      aInputContext.mNativeIMEContext = nsTextStore::GetThreadManager();
+      aInputContext.mNativeIMEContext = TSFTextStore::GetThreadManager();
       if (sIsIMMEnabled) {
         // Associate IME context for IMM-IMEs.
         AssociateIMEContext(aWindow, enable);
       } else if (oldInputContext.mIMEState.mEnabled == IMEState::PLUGIN) {
         // Disassociate the IME context from the window when plugin loses focus
         // in pure TSF mode.
         AssociateIMEContext(aWindow, false);
       }
       if (adjustOpenState) {
-        nsTextStore::SetIMEOpenState(open);
+        TSFTextStore::SetIMEOpenState(open);
       }
       return;
     }
   } else {
     // Set at least InputScope even when TextStore is not available.
     SetInputScopeForIMM32(aWindow, aInputContext.mHTMLInputType);
   }
 #endif // #ifdef NS_ENABLE_TSF
@@ -395,20 +395,20 @@ IMEHandler::AssociateIMEContext(nsWindow
 void
 IMEHandler::InitInputContext(nsWindow* aWindow, InputContext& aInputContext)
 {
   // For a11y, the default enabled state should be 'enabled'.
   aInputContext.mIMEState.mEnabled = IMEState::ENABLED;
 
 #ifdef NS_ENABLE_TSF
   if (sIsInTSFMode) {
-    nsTextStore::SetInputContext(aWindow, aInputContext,
+    TSFTextStore::SetInputContext(aWindow, aInputContext,
       InputContextAction(InputContextAction::CAUSE_UNKNOWN,
                          InputContextAction::GOT_FOCUS));
-    aInputContext.mNativeIMEContext = nsTextStore::GetThreadManager();
+    aInputContext.mNativeIMEContext = TSFTextStore::GetThreadManager();
     MOZ_ASSERT(aInputContext.mNativeIMEContext);
     // IME context isn't necessary in pure TSF mode.
     if (!sIsIMMEnabled) {
       AssociateIMEContext(aWindow, false);
     }
     return;
   }
 #endif // #ifdef NS_ENABLE_TSF
@@ -426,17 +426,17 @@ IMEHandler::InitInputContext(nsWindow* a
 
 #ifdef DEBUG
 // static
 bool
 IMEHandler::CurrentKeyboardLayoutHasIME()
 {
 #ifdef NS_ENABLE_TSF
   if (sIsInTSFMode) {
-    return nsTextStore::CurrentKeyboardLayoutHasIME();
+    return TSFTextStore::CurrentKeyboardLayoutHasIME();
   }
 #endif // #ifdef NS_ENABLE_TSF
 
   return IMMHandler::IsIMEAvailable();
 }
 #endif // #ifdef DEBUG
 
 // static
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -42,17 +42,17 @@
 #include "imgIEncoder.h"
 #include "nsIThread.h"
 #include "MainThreadUtils.h"
 #include "gfxColor.h"
 #include "nsLookAndFeel.h"
 
 #ifdef NS_ENABLE_TSF
 #include <textstor.h>
-#include "nsTextStore.h"
+#include "TSFTextStore.h"
 #endif // #ifdef NS_ENABLE_TSF
 
 PRLogModuleInfo* gWindowsLog = nullptr;
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace widget {
@@ -567,17 +567,17 @@ WinUtils::LogToPhys(double aValue)
 }
 
 /* static */
 bool
 WinUtils::PeekMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
                       UINT aLastMessage, UINT aOption)
 {
 #ifdef NS_ENABLE_TSF
-  ITfMessagePump* msgPump = nsTextStore::GetMessagePump();
+  ITfMessagePump* msgPump = TSFTextStore::GetMessagePump();
   if (msgPump) {
     BOOL ret = FALSE;
     HRESULT hr = msgPump->PeekMessageW(aMsg, aWnd, aFirstMessage, aLastMessage,
                                        aOption, &ret);
     NS_ENSURE_TRUE(SUCCEEDED(hr), false);
     return ret;
   }
 #endif // #ifdef NS_ENABLE_TSF
@@ -585,17 +585,17 @@ WinUtils::PeekMessage(LPMSG aMsg, HWND a
 }
 
 /* static */
 bool
 WinUtils::GetMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
                      UINT aLastMessage)
 {
 #ifdef NS_ENABLE_TSF
-  ITfMessagePump* msgPump = nsTextStore::GetMessagePump();
+  ITfMessagePump* msgPump = TSFTextStore::GetMessagePump();
   if (msgPump) {
     BOOL ret = FALSE;
     HRESULT hr = msgPump->GetMessageW(aMsg, aWnd, aFirstMessage, aLastMessage,
                                       &ret);
     NS_ENSURE_TRUE(SUCCEEDED(hr), false);
     return ret;
   }
 #endif // #ifdef NS_ENABLE_TSF
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -76,17 +76,17 @@ if CONFIG['NS_PRINTING']:
     UNIFIED_SOURCES += [
         'nsDeviceContextSpecWin.cpp',
         'nsPrintOptionsWin.cpp',
         'nsPrintSettingsWin.cpp',
     ]
 
 if CONFIG['NS_ENABLE_TSF']:
     SOURCES += [
-        'nsTextStore.cpp',
+        'TSFTextStore.cpp',
     ]
 
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'