Bug 1050644 part.2 Hack ITextStoreACP::GetTextExt()'s offset for some Chinese TIPs of MS r=emk
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 03 Aug 2015 15:15:30 +0900
changeset 287474 00e3222ed96f6a2d3c063a38caf1e9e4ba329c03
parent 287473 b40379bbe7f35429072cce42ffdbce4ad9f21d5a
child 287475 2bf9ce6c8403454172e5211c84da133c495e0e7b
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk
bugs1050644
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 1050644 part.2 Hack ITextStoreACP::GetTextExt()'s offset for some Chinese TIPs of MS r=emk
modules/libpref/init/all.js
widget/windows/TSFTextStore.cpp
widget/windows/TSFTextStore.h
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3150,16 +3150,20 @@ pref("intl.tsf.support_imm", true);
 
 // Whether creates native caret for ATOK or not.
 pref("intl.tsf.hack.atok.create_native_caret", 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);
 // For Easy Changjei
 pref("intl.tsf.hack.easy_changjei.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.google_ja_input.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
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -1276,16 +1276,18 @@ StaticRefPtr<ITfDisplayAttributeMgr> TSF
 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::sDoNotReturnNoLayoutErrorToMSSimplifiedTIP = false;
+bool TSFTextStore::sDoNotReturnNoLayoutErrorToMSTraditionalTIP = false;
 bool TSFTextStore::sDoNotReturnNoLayoutErrorToFreeChangJie = false;
 bool TSFTextStore::sDoNotReturnNoLayoutErrorToEasyChangjei = false;
 bool TSFTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar = false;
 bool TSFTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret = false;
 
 #define TEXTSTORE_DEFAULT_VIEW (1)
 
 TSFTextStore::TSFTextStore()
@@ -3494,16 +3496,31 @@ TSFTextStore::GetTextExt(TsViewCookie vc
              (sDoNotReturnNoLayoutErrorToEasyChangjei &&
               kSink->IsEasyChangjeiActive())) {
       acpEnd = mComposition.mStart;
       acpStart = std::min(acpStart, acpEnd);
       MOZ_LOG(sTextStoreLog, LogLevel::Debug,
              ("TSF: 0x%p   TSFTextStore::GetTextExt() hacked the offsets for "
               "TIP acpStart=%d, acpEnd=%d", this, acpStart, acpEnd));
     }
+    // Some Chinese TIPs of Microsoft doesn't show candidate window in e10s
+    // mode on Win8 or later.
+    else if (IsWin8OrLater() &&
+             ((sDoNotReturnNoLayoutErrorToMSTraditionalTIP &&
+               (kSink->IsMSChangJieActive() ||
+                kSink->IsMSQuickQuickActive())) ||
+              (sDoNotReturnNoLayoutErrorToMSSimplifiedTIP &&
+                (kSink->IsMSPinyinActive() ||
+                 kSink->IsMSWubiActive())))) {
+      acpEnd = mComposition.mStart;
+      acpStart = std::min(acpStart, acpEnd);
+      MOZ_LOG(sTextStoreLog, LogLevel::Debug,
+             ("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   TSFTextStore::GetTextExt() FAILED due to "
             "layout not recomputed at %d", this, acpEnd));
     mPendingOnLayoutChange = true;
     return TS_E_NOLAYOUT;
@@ -5146,16 +5163,24 @@ TSFTextStore::Initialize()
   sKeystrokeMgr = keystrokeMgr;
   sDisplayAttrMgr = displayAttributeMgr;
   sCategoryMgr = categoryMgr;
   sDisabledDocumentMgr = disabledDocumentMgr;
   sDisabledContext = disabledContext;
 
   sCreateNativeCaretForATOK =
     Preferences::GetBool("intl.tsf.hack.atok.create_native_caret", true);
+  sDoNotReturnNoLayoutErrorToMSSimplifiedTIP =
+    Preferences::GetBool(
+      "intl.tsf.hack.ms_simplified_chinese.do_not_return_no_layout_error",
+      true);
+  sDoNotReturnNoLayoutErrorToMSTraditionalTIP =
+    Preferences::GetBool(
+      "intl.tsf.hack.ms_traditional_chinese.do_not_return_no_layout_error",
+      true);
   sDoNotReturnNoLayoutErrorToFreeChangJie =
     Preferences::GetBool(
       "intl.tsf.hack.free_chang_jie.do_not_return_no_layout_error", true);
   sDoNotReturnNoLayoutErrorToEasyChangjei =
     Preferences::GetBool(
       "intl.tsf.hack.easy_changjei.do_not_return_no_layout_error", true);
   sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar =
     Preferences::GetBool(
--- a/widget/windows/TSFTextStore.h
+++ b/widget/windows/TSFTextStore.h
@@ -830,16 +830,18 @@ protected:
 
   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 sDoNotReturnNoLayoutErrorToMSSimplifiedTIP;
+  static bool sDoNotReturnNoLayoutErrorToMSTraditionalTIP;
   static bool sDoNotReturnNoLayoutErrorToFreeChangJie;
   static bool sDoNotReturnNoLayoutErrorToEasyChangjei;
   static bool sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar;
   static bool sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret;
 };
 
 } // namespace widget
 } // namespace mozilla