Bug 1213811 Include TavultesoftKeyman 90 and 80 to the whitelist of the fix of bug 1208043 r=emk a=sylvestre
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 19 Oct 2015 09:28:21 -0700
changeset 289586 c5bd26c10432
parent 289585 341d7a3d7320
child 289587 bab3ced35371
push id5201
push userkwierso@gmail.com
push date2015-10-19 16:29 +0000
treeherdermozilla-beta@c5bd26c10432 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk, sylvestre
bugs1213811, 1208043
milestone42.0
Bug 1213811 Include TavultesoftKeyman 90 and 80 to the whitelist of the fix of bug 1208043 r=emk a=sylvestre
widget/windows/TSFTextStore.cpp
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -918,16 +918,40 @@ public:
     // {B60AF051-257A-46BC-B9D3-84DAD819BAFB}
     static const GUID kGUID = {
       0xB60AF051, 0x257A, 0x46BC,
         { 0xB9, 0xD3, 0x84, 0xDA, 0xD8, 0x19, 0xBA, 0xFB }
     };
     return mActiveTIPGUID == kGUID;
   }
 
+  /****************************************************************************
+   * Other languages
+   ****************************************************************************/
+
+  bool IsTavultesoftKeyman90Active() const
+  {
+    // {487EB753-DB93-48C5-9E6A-4398E777C61D}
+    static const CLSID kCLSID = {
+      0x487EB753, 0xDB93, 0x48C5,
+        { 0x9E, 0x6A, 0x43, 0x98, 0xE7, 0x77, 0xC6, 0x1D }
+    };
+    return mActiveTextServiceCLSID == kCLSID;
+  }
+
+  bool IsTavultesoftKeyman80Active() const
+  {
+    // {7BA04432-8609-4FE6-BFF7-971091DE0933}
+    static const CLSID kCLSID = {
+      0x7BA04432, 0x8609, 0x4FE6,
+        { 0xBF, 0xF7, 0x97, 0x10, 0x91, 0xDE, 0x09, 0x33 }
+    };
+    return mActiveTextServiceCLSID == kCLSID;
+  }
+
 public: // ITfActiveLanguageProfileNotifySink
   STDMETHODIMP OnActivated(REFCLSID clsid, REFGUID guidProfile,
                            BOOL fActivated);
 
 public: // ITfInputProcessorProfileActivationSink
   STDMETHODIMP OnActivated(DWORD, LANGID, REFCLSID, REFGUID, REFGUID,
                            HKL, DWORD);
 
@@ -956,28 +980,31 @@ private:
   nsRefPtr<ITfInputProcessorProfiles> mInputProcessorProfiles;
 
   // Active TIP keyboard's description.  If active language profile isn't TIP,
   // i.e., IMM-IME or just a keyboard layout, this is empty.
   nsString mActiveTIPKeyboardDescription;
 
   // Active TIP's GUID
   GUID mActiveTIPGUID;
+  // Active Text Service's CLSID
+  CLSID mActiveTextServiceCLSID;
 
   static StaticRefPtr<TSFStaticSink> sInstance;
 };
 
 StaticRefPtr<TSFStaticSink> TSFStaticSink::sInstance;
 
 TSFStaticSink::TSFStaticSink()
   : mIPProfileCookie(TF_INVALID_COOKIE)
   , mLangProfileCookie(TF_INVALID_COOKIE)
   , mIsIMM_IME(false)
   , mOnActivatedCalled(false)
   , mActiveTIPGUID(GUID_NULL)
+  , mActiveTextServiceCLSID(CLSID_NULL)
 {
 }
 
 bool
 TSFStaticSink::Init(ITfThreadMgr* aThreadMgr,
                     ITfInputProcessorProfiles* aInputProcessorProfiles)
 {
   MOZ_ASSERT(!mThreadMgr && !mInputProcessorProfiles,
@@ -1083,16 +1110,17 @@ STDMETHODIMP
 TSFStaticSink::OnActivated(REFCLSID clsid, REFGUID guidProfile,
                            BOOL fActivated)
 {
   // NOTE: This is installed only on XP or Server 2003.
   if (fActivated) {
     // TODO: We should check if the profile's category is keyboard or not.
     mOnActivatedCalled = true;
     mActiveTIPGUID = guidProfile;
+    mActiveTextServiceCLSID = clsid;
     mIsIMM_IME = IsIMM_IME(::GetKeyboardLayout(0));
 
     LANGID langID;
     HRESULT hr = mInputProcessorProfiles->GetCurrentLanguage(&langID);
     if (FAILED(hr)) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
              ("TSF: TSFStaticSink::OnActivated() FAILED due to "
               "GetCurrentLanguage() failure, hr=0x%08X", hr));
@@ -1127,16 +1155,17 @@ TSFStaticSink::OnActivated(DWORD dwProfi
   // NOTE: This is installed only on Vista or later.  However, this may be
   //       called by EnsureInitActiveLanguageProfile() even on XP or Server
   //       2003.
   if ((dwFlags & TF_IPSINK_FLAG_ACTIVE) &&
       (dwProfileType == TF_PROFILETYPE_KEYBOARDLAYOUT ||
        catid == GUID_TFCAT_TIP_KEYBOARD)) {
     mOnActivatedCalled = true;
     mActiveTIPGUID = guidProfile;
+    mActiveTextServiceCLSID = rclsid;
     mIsIMM_IME = IsIMM_IME(hkl);
     GetTIPDescription(rclsid, langid, guidProfile,
                       mActiveTIPKeyboardDescription);
   }
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
          ("TSF: 0x%p TSFStaticSink::OnActivated(dwProfileType=%s (0x%08X), "
           "langid=0x%08X, rclsid=%s, catid=%s, guidProfile=%s, hkl=0x%08X, "
           "dwFlags=0x%08X (TF_IPSINK_FLAG_ACTIVE: %s)), mIsIMM_IME=%s, "
@@ -4051,22 +4080,25 @@ TSFTextStore::RecordCompositionStartActi
   CompleteLastActionIfStillIncomplete();
 
   // TIP may have inserted text at selection before calling
   // OnStartComposition().  In this case, we've already created a pair of
   // pending compositionstart and pending compositionend.  If the pending
   // compositionstart occurred same range as this composition, it was the
   // start of this composition.  In such case, we should cancel the pending
   // compositionend and start composition normally.
-  // FYI: This fix is restricted to MS-IME for Korean at least in 42.
+  // FYI: This fix is restricted to MS-IME for Korean and TavultesoftKeyman
+  //      at least in 42.
   const TSFStaticSink* kSink = TSFStaticSink::GetInstance();
   if (!aPreserveSelection &&
       (kSink->IsMSKoreanIMEActive() ||
        kSink->IsMSKoreanIME2010Active() ||
-       kSink->IsMSOldHangulActive()) &&
+       kSink->IsMSOldHangulActive() ||
+       kSink->IsTavultesoftKeyman90Active() ||
+       kSink->IsTavultesoftKeyman80Active()) &&
       WasTextInsertedWithoutCompositionAt(aStart, aLength)) {
     const PendingAction& pendingCompositionEnd = mPendingActions.LastElement();
     const PendingAction& pendingCompositionStart =
       mPendingActions[mPendingActions.Length() - 2];
     lockedContent.RestoreCommittedComposition(
       aComposition, pendingCompositionStart, pendingCompositionEnd);
     mPendingActions.RemoveElementAt(mPendingActions.Length() - 1);
     MOZ_LOG(sTextStoreLog, LogLevel::Info,