Bug 1121822 - Remove NS_ENABLE_TSF r=m_kato,masayuki
authorKagami Sascha Rosylight <krosylight@mozilla.com>
Thu, 29 Oct 2020 01:46:05 +0000
changeset 555007 97d7b670f0999ffd4d4e6f62acd5b6a54a622753
parent 555006 8f0fadc9e78b9d155e833f3b25d940e13cb7fed9
child 555008 463a8e88c16a62e78f6e0396befec0c4101af688
push id37902
push userccoroiu@mozilla.com
push dateThu, 29 Oct 2020 15:52:12 +0000
treeherdermozilla-central@5071cedfee7f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato, masayuki
bugs1121822
milestone84.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 1121822 - Remove NS_ENABLE_TSF r=m_kato,masayuki Differential Revision: https://phabricator.services.mozilla.com/D95037
modules/libpref/init/all.js
old-configure.in
widget/windows/WinIMEHandler.cpp
widget/windows/WinIMEHandler.h
widget/windows/WinUtils.cpp
widget/windows/moz.build
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2976,87 +2976,85 @@ pref("font.size.monospace.x-math", 13);
   //   - Microsoft New Quick
   //   - Microsoft Pinyin
   //   - Microsoft Pinyin New Experience Input Style
   //   - Microsoft Wubi
   //   - Microsoft IME for Korean (except on Win7)
   //   - Microsoft Old Hangul
   pref("intl.ime.hack.set_input_scope_of_url_bar_to_default", true);
 
-  #ifdef NS_ENABLE_TSF
-    // Enable/Disable TSF support.
-    pref("intl.tsf.enable", true);
-
-    // Support IMEs implemented with IMM in TSF mode.
-    pref("intl.tsf.support_imm", true);
-
-    // This is referred only when both "intl.tsf.enable" and
-    // "intl.tsf.support_imm" are true.  When this is true, default IMC is
-    // associated with focused window only when active keyboard layout is a
-    // legacy IMM-IME.
-    pref("intl.tsf.associate_imc_only_when_imm_ime_is_active", false);
-
-    // Enables/Disables hack for specific TIP.
-
-    // On Windows 10 Build 17643 (an Insider Preview build of RS5), Microsoft
-    // have fixed the caller of ITextACPStore::GetTextExt() to return
-    // TS_E_NOLAYOUT to TIP as-is, rather than converting to E_FAIL.
-    // Therefore, if TIP supports asynchronous layout computation perfectly, we
-    // can return TS_E_NOLAYOUT and TIP waits next OnLayoutChange()
-    // notification.  However, some TIPs still have some bugs of asynchronous
-    // layout support.  We keep hacking the result of GetTextExt() like running
-    // on Windows 10, however, there could be unknown TIP bugs if we stop
-    // hacking the result.  So, user can stop checking build ID to make Gecko
-    // hack the result forcibly.
-    #ifdef EARLY_BETA_OR_EARLIER
-      pref("intl.tsf.hack.allow_to_stop_hacking_on_build_17643_or_later", true);
-    #else
-      pref("intl.tsf.hack.allow_to_stop_hacking_on_build_17643_or_later", false);
-    #endif
-
-    // Whether creates native caret for ATOK or not.
-    pref("intl.tsf.hack.atok.create_native_caret", true);
-    // Whether use available composition string rect for result of
-    // ITextStoreACP::GetTextExt() even if the specified range is same as the
-    // range of composition string but some character rects of them are not
-    // available.  Note that this is ignored if active ATOK is or older than
-    // 2016 and create_native_caret is true.
-    pref("intl.tsf.hack.atok.do_not_return_no_layout_error_of_composition_string", true);
-    // Whether use available composition string rect for result of
-    // ITextStoreACP::GetTextExt() even if the specified range is same as or is
-    // in the range of composition string but some character rects of them are
-    // not available.
-    pref("intl.tsf.hack.japanist10.do_not_return_no_layout_error_of_composition_string", true);
-    // Whether use composition start position for the result of
-    // ITfContextView::GetTextExt() if the specified range is larger than
-    // composition start offset.
-    // For Free ChangJie 2010
-    pref("intl.tsf.hack.free_chang_jie.do_not_return_no_layout_error", true);
-    // For Microsoft Pinyin and Microsoft Wubi
-    pref("intl.tsf.hack.ms_simplified_chinese.do_not_return_no_layout_error", true);
-    // For Microsoft ChangJie and Microsoft Quick
-    pref("intl.tsf.hack.ms_traditional_chinese.do_not_return_no_layout_error", true);
-    // Whether use previous character rect for the result of
-    // ITfContextView::GetTextExt() if the specified range is the first
-    // character of selected clause of composition string.
-    pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_first_char", true);
-    // Whether use previous character rect for the result of
-    // ITfContextView::GetTextExt() if the specified range is the caret of
-    // composition string.
-    pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_caret", true);
-    // Whether hack ITextStoreACP::QueryInsert() or not.  The method should
-    // return new selection after specified length text is inserted at
-    // specified range. However, Microsoft's some Chinese TIPs expect that the
-    // result is same as specified range.  If following prefs are true,
-    // ITextStoreACP::QueryInsert() returns specified range only when one of
-    // the TIPs is active. For Microsoft Pinyin and Microsoft Wubi.
-    pref("intl.tsf.hack.ms_simplified_chinese.query_insert_result", true);
-    // For Microsoft ChangJie and Microsoft Quick
-    pref("intl.tsf.hack.ms_traditional_chinese.query_insert_result", true);
-  #endif // NS_ENABLE_TSF
+  // Enable/Disable TSF support.
+  pref("intl.tsf.enable", true);
+
+  // Support IMEs implemented with IMM in TSF mode.
+  pref("intl.tsf.support_imm", true);
+
+  // This is referred only when both "intl.tsf.enable" and
+  // "intl.tsf.support_imm" are true.  When this is true, default IMC is
+  // associated with focused window only when active keyboard layout is a
+  // legacy IMM-IME.
+  pref("intl.tsf.associate_imc_only_when_imm_ime_is_active", false);
+
+  // Enables/Disables hack for specific TIP.
+
+  // On Windows 10 Build 17643 (an Insider Preview build of RS5), Microsoft
+  // have fixed the caller of ITextACPStore::GetTextExt() to return
+  // TS_E_NOLAYOUT to TIP as-is, rather than converting to E_FAIL.
+  // Therefore, if TIP supports asynchronous layout computation perfectly, we
+  // can return TS_E_NOLAYOUT and TIP waits next OnLayoutChange()
+  // notification.  However, some TIPs still have some bugs of asynchronous
+  // layout support.  We keep hacking the result of GetTextExt() like running
+  // on Windows 10, however, there could be unknown TIP bugs if we stop
+  // hacking the result.  So, user can stop checking build ID to make Gecko
+  // hack the result forcibly.
+  #ifdef EARLY_BETA_OR_EARLIER
+    pref("intl.tsf.hack.allow_to_stop_hacking_on_build_17643_or_later", true);
+  #else
+    pref("intl.tsf.hack.allow_to_stop_hacking_on_build_17643_or_later", false);
+  #endif
+
+  // Whether creates native caret for ATOK or not.
+  pref("intl.tsf.hack.atok.create_native_caret", true);
+  // Whether use available composition string rect for result of
+  // ITextStoreACP::GetTextExt() even if the specified range is same as the
+  // range of composition string but some character rects of them are not
+  // available.  Note that this is ignored if active ATOK is or older than
+  // 2016 and create_native_caret is true.
+  pref("intl.tsf.hack.atok.do_not_return_no_layout_error_of_composition_string", true);
+  // Whether use available composition string rect for result of
+  // ITextStoreACP::GetTextExt() even if the specified range is same as or is
+  // in the range of composition string but some character rects of them are
+  // not available.
+  pref("intl.tsf.hack.japanist10.do_not_return_no_layout_error_of_composition_string", true);
+  // Whether use composition start position for the result of
+  // ITfContextView::GetTextExt() if the specified range is larger than
+  // composition start offset.
+  // For Free ChangJie 2010
+  pref("intl.tsf.hack.free_chang_jie.do_not_return_no_layout_error", true);
+  // For Microsoft Pinyin and Microsoft Wubi
+  pref("intl.tsf.hack.ms_simplified_chinese.do_not_return_no_layout_error", true);
+  // For Microsoft ChangJie and Microsoft Quick
+  pref("intl.tsf.hack.ms_traditional_chinese.do_not_return_no_layout_error", true);
+  // Whether use previous character rect for the result of
+  // ITfContextView::GetTextExt() if the specified range is the first
+  // character of selected clause of composition string.
+  pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_first_char", true);
+  // Whether use previous character rect for the result of
+  // ITfContextView::GetTextExt() if the specified range is the caret of
+  // composition string.
+  pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_caret", true);
+  // Whether hack ITextStoreACP::QueryInsert() or not.  The method should
+  // return new selection after specified length text is inserted at
+  // specified range. However, Microsoft's some Chinese TIPs expect that the
+  // result is same as specified range.  If following prefs are true,
+  // ITextStoreACP::QueryInsert() returns specified range only when one of
+  // the TIPs is active. For Microsoft Pinyin and Microsoft Wubi.
+  pref("intl.tsf.hack.ms_simplified_chinese.query_insert_result", true);
+  // For Microsoft ChangJie and Microsoft Quick
+  pref("intl.tsf.hack.ms_traditional_chinese.query_insert_result", true);
 
   // If composition_font is set, Gecko sets the font to IME.  IME may use
   // the fonts on their window like candidate window.  If they are empty,
   // Gecko uses the system default font which is set to the IM context.
   // The font name must not start with '@'.  When the writing mode is vertical,
   // Gecko inserts '@' to the start of the font name automatically.
   // FYI: Changing these prefs requires to restart.
   pref("intl.imm.composition_font", "");
--- a/old-configure.in
+++ b/old-configure.in
@@ -1490,23 +1490,16 @@ MOZ_SPELLCHECK=1
 MOZ_UNIVERSALCHARDET=1
 MOZ_XUL=1
 MOZ_ZIPWRITER=1
 MOZ_NO_SMART_CARDS=
 MOZ_SANDBOX=1
 MOZ_BINARY_EXTENSIONS=
 MOZ_DEVTOOLS=server
 
-case "$target_os" in
-    mingw*)
-        NS_ENABLE_TSF=1
-        AC_DEFINE(NS_ENABLE_TSF)
-        ;;
-esac
-
 dnl ========================================================
 dnl = Trademarked Branding
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(official-branding,
 [  --enable-official-branding
                           Enable Official mozilla.org Branding
                           Do not distribute builds with
                           --enable-official-branding unless you have
@@ -2725,17 +2718,16 @@ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
 AC_SUBST(HAVE_X86_AVX2)
 AC_SUBST(HAVE_ALTIVEC)
 
 AC_SUBST_LIST(DSO_CFLAGS)
 AC_SUBST_LIST(DSO_PIC_CFLAGS)
 AC_SUBST(DSO_LDOPTS)
 AC_SUBST(BIN_SUFFIX)
 AC_SUBST(USE_N32)
-AC_SUBST(NS_ENABLE_TSF)
 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
 
 AC_SUBST(MOZ_DEVTOOLS)
 
 AC_SUBST(MOZ_PACKAGE_JSSHELL)
 
 AC_SUBST(DMG_TOOL)
--- a/widget/windows/WinIMEHandler.cpp
+++ b/widget/windows/WinIMEHandler.cpp
@@ -7,19 +7,17 @@
 
 #include "IMMHandler.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/WindowsVersion.h"
 #include "nsWindowDefs.h"
 #include "WinTextEventDispatcherListener.h"
 
-#ifdef NS_ENABLE_TSF
-#  include "TSFTextStore.h"
-#endif  // #ifdef NS_ENABLE_TSF
+#include "TSFTextStore.h"
 
 #include "OSKInputPaneManager.h"
 #include "nsLookAndFeel.h"
 #include "nsWindow.h"
 #include "WinUtils.h"
 #include "nsIWindowsRegKey.h"
 #include "nsIWindowsUIUtils.h"
 
@@ -54,29 +52,26 @@ nsWindow* IMEHandler::sFocusedWindow = n
 InputContextAction::Cause IMEHandler::sLastContextActionCause =
     InputContextAction::CAUSE_UNKNOWN;
 bool IMEHandler::sMaybeEditable = false;
 bool IMEHandler::sForceDisableCurrentIMM_IME = false;
 bool IMEHandler::sPluginHasFocus = false;
 bool IMEHandler::sNativeCaretIsCreated = false;
 bool IMEHandler::sHasNativeCaretBeenRequested = false;
 
-#ifdef NS_ENABLE_TSF
 bool IMEHandler::sIsInTSFMode = false;
 bool IMEHandler::sIsIMMEnabled = true;
 bool IMEHandler::sAssociateIMCOnlyWhenIMM_IMEActive = false;
 decltype(SetInputScopes)* IMEHandler::sSetInputScopes = nullptr;
-#endif  // #ifdef NS_ENABLE_TSF
 
 static POWER_PLATFORM_ROLE sPowerPlatformRole = PlatformRoleUnspecified;
 static bool sDeterminedPowerPlatformRole = false;
 
 // static
 void IMEHandler::Initialize() {
-#ifdef NS_ENABLE_TSF
   TSFTextStore::Initialize();
   sIsInTSFMode = TSFTextStore::IsInTSFMode();
   sIsIMMEnabled =
       !sIsInTSFMode || Preferences::GetBool("intl.tsf.support_imm", true);
   sAssociateIMCOnlyWhenIMM_IMEActive =
       sIsIMMEnabled &&
       Preferences::GetBool("intl.tsf.associate_imc_only_when_imm_ime_is_active",
                            false);
@@ -86,44 +81,39 @@ void IMEHandler::Initialize() {
     // 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"));
     }
   }
-#endif  // #ifdef NS_ENABLE_TSF
 
   IMMHandler::Initialize();
 
   sForceDisableCurrentIMM_IME = IMMHandler::IsActiveIMEInBlockList();
 }
 
 // static
 void IMEHandler::Terminate() {
-#ifdef NS_ENABLE_TSF
   if (sIsInTSFMode) {
     TSFTextStore::Terminate();
     sIsInTSFMode = false;
   }
-#endif  // #ifdef NS_ENABLE_TSF
 
   IMMHandler::Terminate();
   WinTextEventDispatcherListener::Shutdown();
 }
 
 // static
 void* IMEHandler::GetNativeData(nsWindow* aWindow, uint32_t aDataType) {
   if (aDataType == NS_RAW_NATIVE_IME_CONTEXT) {
-#ifdef NS_ENABLE_TSF
     if (IsTSFAvailable()) {
       return TSFTextStore::GetThreadManager();
     }
-#endif  // #ifdef NS_ENABLE_TSF
     IMEContext context(aWindow);
     if (context.IsValid()) {
       return context.get();
     }
     // If IMC isn't associated with the window, IME is disabled on the window
     // now.  In such case, we should return default IMC instead.
     const IMEContext& defaultIMC = aWindow->DefaultIMC();
     if (defaultIMC.IsValid()) {
@@ -131,39 +121,33 @@ void* IMEHandler::GetNativeData(nsWindow
     }
     // If there is no default IMC, we should return the pointer to the window
     // since if we return nullptr, IMEStateManager cannot manage composition
     // with TextComposition instance.  This is possible if no IME is installed,
     // but composition may occur with dead key sequence.
     return aWindow;
   }
 
-#ifdef NS_ENABLE_TSF
   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;
   return result;
-#else   // #ifdef NS_ENABLE_TSF
-  return nullptr;
-#endif  // #ifdef NS_ENABLE_TSF #else
 }
 
 // static
 bool IMEHandler::ProcessRawKeyMessage(const MSG& aMsg) {
-#ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
     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) {
   // If we're putting native caret over our caret, Windows dispatches
@@ -184,33 +168,31 @@ bool IMEHandler::ProcessMessage(nsWindow
     // So, when we receive first WM_GETOBJECT for OBJID_CARET, let's start to
     // create native caret for such applications.
     sHasNativeCaretBeenRequested = true;
     // If an editable element has focus, we can put native caret now.
     // XXX Should we avoid doing this if there is composition?
     MaybeCreateNativeCaret(aWindow);
   }
 
-#ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
     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 (!IsIMMActive()) {
       return false;
     }
   }
-#endif  // #ifdef NS_ENABLE_TSF
 
   bool keepGoing =
       IMMHandler::ProcessMessage(aWindow, aMessage, aWParam, aLParam, aResult);
 
   // If user changes active IME to an IME which is listed in our block list,
   // we should disassociate IMC from the window for preventing the IME to work
   // and crash.
   if (aMessage == WM_INPUTLANGCHANGE) {
@@ -231,49 +213,41 @@ bool IMEHandler::IsA11yHandlingNativeCar
 #ifndef ACCESSIBILITY
   return false;
 #else   // #ifndef ACCESSIBILITY
   // Let's assume that when there is the service, it handles native caret.
   return GetAccService() != nullptr;
 #endif  // #ifndef ACCESSIBILITY #else
 }
 
-#ifdef NS_ENABLE_TSF
 // static
 bool IMEHandler::IsIMMActive() { return TSFTextStore::IsIMM_IMEActive(); }
 
-#endif  // #ifdef NS_ENABLE_TSF
-
 // static
 bool IMEHandler::IsComposing() {
-#ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
     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 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 = 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();
@@ -332,17 +306,16 @@ nsresult IMEHandler::NotifyIME(nsWindow*
         }
         return NS_OK;
       case NOTIFY_IME_OF_POSITION_CHANGE:
         return TSFTextStore::OnLayoutChange();
       default:
         return NS_ERROR_NOT_IMPLEMENTED;
     }
   }
-#endif  // NS_ENABLE_TSF
 
   switch (aIMENotification.mMessage) {
     case REQUEST_TO_COMMIT_COMPOSITION:
       IMMHandler::CommitComposition(aWindow);
       return NS_OK;
     case REQUEST_TO_CANCEL_COMPOSITION:
       IMMHandler::CancelComposition(aWindow);
       return NS_OK;
@@ -365,69 +338,63 @@ nsresult IMEHandler::NotifyIME(nsWindow*
       IMEHandler::MaybeShowOnScreenKeyboard(aWindow,
                                             aWindow->GetInputContext());
       MaybeCreateNativeCaret(aWindow);
       return NS_OK;
     case NOTIFY_IME_OF_BLUR:
       sFocusedWindow = nullptr;
       IMEHandler::MaybeDismissOnScreenKeyboard(aWindow);
       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 (TSFTextStore::ThinksHavingFocus()) {
         return TSFTextStore::OnFocusChange(false, aWindow,
                                            aWindow->GetInputContext());
       }
-#endif  // NS_ENABLE_TSF
       return NS_OK;
     default:
       return NS_ERROR_NOT_IMPLEMENTED;
   }
 }
 
 // static
 IMENotificationRequests IMEHandler::GetIMENotificationRequests() {
   // While a plugin has focus, neither TSFTextStore nor IMMHandler needs
   // notifications.
   if (sPluginHasFocus) {
     return IMENotificationRequests();
   }
 
-#ifdef NS_ENABLE_TSF
   if (IsTSFAvailable()) {
     if (!sIsIMMEnabled) {
       return TSFTextStore::GetIMENotificationRequests();
     }
     // Even if TSF is available, the active IME may be an IMM-IME.
     // Unfortunately, changing the result of GetIMENotificationRequests() while
     // an editor has focus isn't supported by IMEContentObserver nor
     // ContentCacheInParent.  Therefore, we need to request whole notifications
     // which are necessary either IMMHandler or TSFTextStore.
     return IMMHandler::GetIMENotificationRequests() |
            TSFTextStore::GetIMENotificationRequests();
   }
-#endif  // NS_ENABLE_TSF
 
   return IMMHandler::GetIMENotificationRequests();
 }
 
 // static
 TextEventDispatcherListener*
 IMEHandler::GetNativeTextEventDispatcherListener() {
   return WinTextEventDispatcherListener::GetInstance();
 }
 
 // static
 bool IMEHandler::GetOpenState(nsWindow* aWindow) {
-#ifdef NS_ENABLE_TSF
   if (IsTSFAvailable() && !IsIMMActive()) {
     return TSFTextStore::GetIMEOpenState();
   }
-#endif  // NS_ENABLE_TSF
 
   IMEContext context(aWindow);
   return context.GetOpenState();
 }
 
 // static
 void IMEHandler::OnDestroyWindow(nsWindow* aWindow) {
   // When focus is in remote process, but the window is being destroyed, we
@@ -437,35 +404,31 @@ void IMEHandler::OnDestroyWindow(nsWindo
   if (sFocusedWindow == aWindow) {
     MOZ_ASSERT(aWindow->GetInputContext().IsOriginContentProcess(),
                "input context of focused widget should've been set by a remote "
                "process "
                "if IME focus isn't cleared before destroying the widget");
     NotifyIME(aWindow, IMENotification(NOTIFY_IME_OF_BLUR));
   }
 
-#ifdef NS_ENABLE_TSF
   // We need to do nothing here for TSF. Just restore the default context
   // if it's been disassociated.
   if (!sIsInTSFMode) {
     // MSDN says we need to set IS_DEFAULT to avoid memory leak when we use
     // SetInputScopes API. Use an empty string to do this.
     SetInputScopeForIMM32(aWindow, u""_ns, u""_ns, false);
   }
-#endif  // #ifdef NS_ENABLE_TSF
   AssociateIMEContext(aWindow, true);
 }
 
-#ifdef NS_ENABLE_TSF
 // static
 bool IMEHandler::NeedsToAssociateIMC() {
   return !sForceDisableCurrentIMM_IME &&
          (!sAssociateIMCOnlyWhenIMM_IMEActive || !IsIMMActive());
 }
-#endif  // #ifdef NS_ENABLE_TSF
 
 // static
 void IMEHandler::SetInputContext(nsWindow* aWindow, InputContext& aInputContext,
                                  const InputContextAction& aAction) {
   sLastContextActionCause = aAction.mCause;
   // FYI: If there is no composition, this call will do nothing.
   NotifyIME(aWindow, IMENotification(REQUEST_TO_COMMIT_COMPOSITION));
 
@@ -485,17 +448,16 @@ void IMEHandler::SetInputContext(nsWindo
   }
 
   bool enable = WinUtils::IsIMEEnabled(aInputContext);
   bool adjustOpenState = (enable && aInputContext.mIMEState.mOpen !=
                                         IMEState::DONT_CHANGE_OPEN_STATE);
   bool open =
       (adjustOpenState && aInputContext.mIMEState.mOpen == IMEState::OPEN);
 
-#ifdef NS_ENABLE_TSF
   // Note that even while a plugin has focus, we need to notify TSF of that.
   if (sIsInTSFMode) {
     TSFTextStore::SetInputContext(aWindow, aInputContext, aAction);
     if (IsTSFAvailable()) {
       if (sIsIMMEnabled) {
         // Associate IMC with aWindow only when it's necessary.
         AssociateIMEContext(aWindow, enable && NeedsToAssociateIMC());
       } else if (oldInputContext.mIMEState.mEnabled == IMEState::PLUGIN) {
@@ -509,17 +471,16 @@ void IMEHandler::SetInputContext(nsWindo
       return;
     }
   } else {
     // Set at least InputScope even when TextStore is not available.
     SetInputScopeForIMM32(aWindow, aInputContext.mHTMLInputType,
                           aInputContext.mHTMLInputInputmode,
                           aInputContext.mInPrivateBrowsing);
   }
-#endif  // #ifdef NS_ENABLE_TSF
 
   AssociateIMEContext(aWindow, enable);
 
   IMEContext context(aWindow);
   if (adjustOpenState) {
     context.SetOpenState(open);
   }
 }
@@ -555,45 +516,41 @@ void IMEHandler::InitInputContext(nsWind
     // after creating each normal window, so, here is a good place to
     // initialize these modules.
     Initialize();
   }
 
   // For a11y, the default enabled state should be 'enabled'.
   aInputContext.mIMEState.mEnabled = IMEState::ENABLED;
 
-#ifdef NS_ENABLE_TSF
   if (sIsInTSFMode) {
     TSFTextStore::SetInputContext(
         aWindow, aInputContext,
         InputContextAction(InputContextAction::CAUSE_UNKNOWN,
                            InputContextAction::WIDGET_CREATED));
     // IME context isn't necessary in pure TSF mode.
     if (!sIsIMMEnabled) {
       AssociateIMEContext(aWindow, false);
     }
     return;
   }
-#endif  // #ifdef NS_ENABLE_TSF
 
 #ifdef DEBUG
   // NOTE: IMC may be null if IMM module isn't installed.
   IMEContext context(aWindow);
   MOZ_ASSERT(context.IsValid() || !CurrentKeyboardLayoutHasIME());
 #endif  // #ifdef DEBUG
 }
 
 #ifdef DEBUG
 // static
 bool IMEHandler::CurrentKeyboardLayoutHasIME() {
-#  ifdef NS_ENABLE_TSF
   if (sIsInTSFMode) {
     return TSFTextStore::CurrentKeyboardLayoutHasIME();
   }
-#  endif  // #ifdef NS_ENABLE_TSF
 
   return IMMHandler::IsIMEAvailable();
 }
 #endif  // #ifdef DEBUG
 
 // static
 void IMEHandler::OnKeyboardLayoutChanged() {
   // Be aware, this method won't be called until TSFStaticSink starts to
--- a/widget/windows/WinIMEHandler.h
+++ b/widget/windows/WinIMEHandler.h
@@ -157,22 +157,20 @@ class IMEHandler final {
   static void SetCandidateWindow(nsWindow* aWindow, CANDIDATEFORM* aForm);
 
   /*
    * For WM_IME_*COMPOSITION messages and e10s with windowless plugin
    */
   static void DefaultProcOfPluginEvent(nsWindow* aWindow,
                                        const NPEvent* aPluginEvent);
 
-#ifdef NS_ENABLE_TSF
   /**
    * This is called by TSFStaticSink when active IME is changed.
    */
   static void OnKeyboardLayoutChanged();
-#endif  // #ifdef NS_ENABLE_TSF
 
 #ifdef DEBUG
   /**
    * Returns true when current keyboard layout has IME.  Otherwise, false.
    */
   static bool CurrentKeyboardLayoutHasIME();
 #endif  // #ifdef DEBUG
 
@@ -202,17 +200,16 @@ class IMEHandler final {
    * MaybeCreateNativeCaret() may create native caret over our caret if
    * focused content is text editable and we need to create native caret
    * for other applications.
    *
    * @param aWindow     The window which owns the native caret.
    */
   static bool MaybeCreateNativeCaret(nsWindow* aWindow);
 
-#ifdef NS_ENABLE_TSF
   static decltype(SetInputScopes)* sSetInputScopes;
   static void SetInputScopeForIMM32(nsWindow* aWindow,
                                     const nsAString& aHTMLInputType,
                                     const nsAString& aHTMLInputInputmode,
                                     bool aInPrivateBrowsing);
   static bool sIsInTSFMode;
   // If sIMMEnabled is false, any IME messages are not handled in TSF mode.
   // Additionally, IME context is always disassociated from focused window.
@@ -247,15 +244,14 @@ class IMEHandler final {
    */
   static void DismissOnScreenKeyboard(nsWindow* aWindow);
 
   /**
    * Get the HWND for the on-screen keyboard, if it's up. Only
    * allowed for Windows 8 and higher.
    */
   static HWND GetOnScreenKeyboardWindow();
-#endif  // #ifdef NS_ENABLE_TSF
 };
 
 }  // namespace widget
 }  // namespace mozilla
 
 #endif  // #ifndef WinIMEHandler_h_
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -48,20 +48,18 @@
 #include "nsIChannel.h"
 #include "nsIThread.h"
 #include "MainThreadUtils.h"
 #include "nsLookAndFeel.h"
 #include "nsUnicharUtils.h"
 #include "nsWindowsHelpers.h"
 #include "WinContentSystemParameters.h"
 
-#ifdef NS_ENABLE_TSF
-#  include <textstor.h>
-#  include "TSFTextStore.h"
-#endif  // #ifdef NS_ENABLE_TSF
+#include <textstor.h>
+#include "TSFTextStore.h"
 
 #include <shlobj.h>
 #include <shlwapi.h>
 
 mozilla::LazyLogModule gWindowsLog("Widget");
 
 #define LOG_E(...) MOZ_LOG(gWindowsLog, LogLevel::Error, (__VA_ARGS__))
 #define LOG_D(...) MOZ_LOG(gWindowsLog, LogLevel::Debug, (__VA_ARGS__))
@@ -717,42 +715,38 @@ a11y::Accessible* WinUtils::GetRootAcces
 
   return window->GetAccessible();
 }
 #endif  // ACCESSIBILITY
 
 /* static */
 bool WinUtils::PeekMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
                            UINT aLastMessage, UINT aOption) {
-#ifdef NS_ENABLE_TSF
   RefPtr<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
   return ::PeekMessageW(aMsg, aWnd, aFirstMessage, aLastMessage, aOption);
 }
 
 /* static */
 bool WinUtils::GetMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
                           UINT aLastMessage) {
-#ifdef NS_ENABLE_TSF
   RefPtr<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
   return ::GetMessageW(aMsg, aWnd, aFirstMessage, aLastMessage);
 }
 
 #if defined(ACCESSIBILITY)
 static DWORD GetWaitFlags() {
   DWORD result = MWMO_INPUTAVAILABLE;
   if (XRE_IsContentProcess()) {
     result |= MWMO_ALERTABLE;
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -127,16 +127,17 @@ SOURCES += [
 # These files redefine the winsdk api version macro and we don't want it to leak to other files.
 SOURCES += [
     "DirectManipulationOwner.cpp",
 ]
 
 # Needs INITGUID and we don't allow INITGUID in unified sources since bug 970429.
 SOURCES += [
     "InputDeviceUtils.cpp",
+    "TSFTextStore.cpp",
 ]
 
 if CONFIG["NS_PRINTING"]:
     UNIFIED_SOURCES += [
         "nsDeviceContextSpecWin.cpp",
         "nsPrintDialogUtil.cpp",
         "nsPrintDialogWin.cpp",
         "nsPrinterWin.cpp",
@@ -144,21 +145,16 @@ if CONFIG["NS_PRINTING"]:
         "nsPrintSettingsWin.cpp",
     ]
 
 if CONFIG["MOZ_ENABLE_SKIA_PDF"]:
     UNIFIED_SOURCES += [
         "WindowsEMF.cpp",
     ]
 
-if CONFIG["NS_ENABLE_TSF"]:
-    SOURCES += [
-        "TSFTextStore.cpp",
-    ]
-
 XPCOM_MANIFESTS += [
     "components.conf",
 ]
 
 include("/ipc/chromium/chromium-config.mozbuild")
 
 FINAL_LIBRARY = "xul"