Closed Bug 1481153 Opened Last year Closed Last year

[TSF][TS_E_NOLAYOUT] MS Pinyin and MS Wubi may not show candidate window even after TS_E_NOLAYOUT bug is fixed by Windows

Categories

(Core :: Widget: Win32, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox-esr52 --- unaffected
firefox-esr60 --- unaffected
firefox61 --- unaffected
firefox62 --- unaffected
firefox63 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

(Keywords: inputmethod, regression)

Attachments

(4 files)

MS Pinyin sometimes not show candidate window. When I see MS Pinyin not showing candidate window, I only see this TS_E_NOLAYOUT log:

> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   Unlocked (TS_LF_READWRITE) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RecordCompositionUpdateAction(), mComposition={ mView=0x000001B42B603D10, mStart=0, mString="n" (Length()=1) }
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::SelectionForTSFRef(): acpStart=1, acpEnd=1 (length=0), reverted=false
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RecordCompositionUpdateAction() succeeded
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::FlushPendingActions() flushing Type::eCompositionStart={ mSelectionStart=0, mSelectionLength=0 }, mDestroyed=false
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::FlushPendingActions() dispatching compositionstart event...
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::FlushPendingActions() flushing Type::eCompositionUpdate={ mData="n", mRanges=0x000001B41A379250, mRanges->Length()=2 }
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::FlushPendingActions() dispatching compositionchange event...
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RequestLock() succeeded: *phrSession=S_OK
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::GetStatus(pdcs=0x00000093F0BFE2A0)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RequestLock(dwLockFlags=TS_LF_READWRITE, phrSession=0x00000093F0BFE2E8), mLock=not-specified, mDestroyed=false
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   Locking (TS_LF_READWRITE) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RequestSupportedAttrs(dwFlags=no flags (0), cFilterAttrs=1)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::HandleRequestAttrs(aFlags=no flags (0), aFilterCount=1)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::HandleRequestAttrs(), requested attr=GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RetrieveRequestedAttrs() called ulCount=1, mRequestedAttrValues=false
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RetrieveRequestedAttrs() for GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RequestAttrsAtPosition(acpPos=0, cFilterAttrs=1, dwFlags=no flags (0))
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::HandleRequestAttrs(aFlags=TS_ATTR_FIND_WANT_VALUE, aFilterCount=1)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::HandleRequestAttrs(), requested attr=GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RetrieveRequestedAttrs() called ulCount=1, mRequestedAttrValues=true
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RetrieveRequestedAttrs() for GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B427ADB340 InputScopeImpl()
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   Unlocked (TS_LF_READWRITE) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RequestLock() succeeded: *phrSession=S_OK
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::GetStatus(pdcs=0x00000093F0BFE2A0)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RequestLock(dwLockFlags=TS_LF_READWRITE, phrSession=0x00000093F0BFE2E8), mLock=not-specified, mDestroyed=false
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   Locking (TS_LF_READWRITE) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RequestSupportedAttrs(dwFlags=no flags (0), cFilterAttrs=1)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::HandleRequestAttrs(aFlags=no flags (0), aFilterCount=1)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::HandleRequestAttrs(), requested attr=GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RetrieveRequestedAttrs() called ulCount=1, mRequestedAttrValues=false
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RetrieveRequestedAttrs() for GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RequestAttrsAtPosition(acpPos=0, cFilterAttrs=1, dwFlags=no flags (0))
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::HandleRequestAttrs(aFlags=TS_ATTR_FIND_WANT_VALUE, aFilterCount=1)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::HandleRequestAttrs(), requested attr=GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RetrieveRequestedAttrs() called ulCount=1, mRequestedAttrValues=true
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RetrieveRequestedAttrs() for GUID_PROP_INPUTSCOPE
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B427ADB340 InputScopeImpl()
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   Unlocked (TS_LF_READWRITE) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::RequestLock() succeeded: *phrSession=S_OK
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::GetStatus(pdcs=0x00000093F0BFE2A0)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::RequestLock(dwLockFlags=TS_LF_READWRITE, phrSession=0x00000093F0BFE2E8), mLock=not-specified, mDestroyed=false
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   Locking (TS_LF_READWRITE) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::GetActiveView(pvcView=0x00000093F0BFD308)
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::GetActiveView() succeeded: *pvcView=1
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::GetScreenExt(vcView=1, prc=0x00000093F0BFD3F0)
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::GetScreenExtInternal()
> [Parent 3184: Main Thread]: D/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::GetScreenExtInternal() succeeded: aScreenExt={ left=821, top=428, right=1446, bottom=453 }
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::GetScreenExt() succeeded: *prc={ left=821, top=428, right=1446, bottom=453 }
> [Parent 3184: Main Thread]: I/nsTextStoreWidgets 0x000001B43B8621C0 TSFTextStore::GetTextExt(vcView=1, acpStart=0, acpEnd=1, prc=0x00000093F0BFD400, pfClipped=0x00000093F0BFD340), IsHandlingComposition()=true, mContentForTSF={ MinOffsetOfLayoutChanged()=0, LatestCompositionStartOffset()=0, LatestCompositionEndOffset()=1 }, mComposition= { IsComposing()=true, mStart=0, EndOffset()=1 }, mDeferNotifyingTSF=false, mWaitingQueryLayout=false
> [Parent 3184: Main Thread]: E/nsTextStoreWidgets 0x000001B43B8621C0   TSFTextStore::GetTextExt() returned TS_E_NOLAYOUT (acpEnd=1)

However, I see same error even when MS Pinyin shows candidate window. So, perhaps, the TS_E_NOLAYOUT is a trigger, but internal state of MS Pinyin also causes this bug.  Anyway, we need to keep hacking against TS_E_NOLAYOUT bug.
And also MS Wubi. I.e., both Simplified Chinese IME of Microsoft.
Summary: [TSF][TS_E_NOLAYOUT] MS Pinyin may not show candidate window even after TS_E_NOLAYOUT bug is fixed by Windows → [TSF][TS_E_NOLAYOUT] MS Pinyin and MS Wubi may not show candidate window even after TS_E_NOLAYOUT bug is fixed by Windows
As we know, GUID comparison is not cheap if it's required a lot. Unfortunately,
we need to check it more in TSFTextStore::MaybeHackNoErrorLayoutBugs()
and it's called a lot. So, even though mapping from GUID to TIP is expensive,
we should do it only once. Note that most users won't change IME during a
browser session, so, running this expensive method once must be reasonable.
On the other hand, we don't allow to make damage to start up performance,
we should avoid to do it as far as possible. For example, when we need to
check if active TIP is a specific TIP, we should check current language.
Currently, TSFTextStore::MaybeHackNoErrorLayoutBugs() checks pref to enable
hack first, then, check if active TIP is the target of pref. This was intended
to save comparison cost of GUIDs. However, we don't need to worry about
the cost and that was not makes sense since all prefs are true by default.
So, this patch makes the big if-elseif blocks with switch-case with
TSFStaticSink::ActiveTIP(). Then, each case block starts to check:
- if Windows still TS_E_NOLAYOUT bug of GetTextExt().
- if corresponding pref is true.
Note that this duplicates some code for making the code look easier.
E.g., eMicrosoftOfficeIME2010ForJapanese case is duplicated from the
eMicrosoftIMEForJapanese case. eMicrosoftPinyin and eMicrosoftWubi
case is duplicated from the eMicrosoftChangJie and eMicrosoftQuick case.
Microsoft Pinyin and Microsoft Wubi (Simplified Chinese TIPs) work better on
Windows 10 Build 17643 or later (i.e., TS_E_NOLAYOUT bug is fixed). However,
they sometimes do not show candidate window, perhaps, the reason is
something stateful bug in them. Therefore, we still need to hack the result of
GetTextExt() until they fix this bug.
We should get feedback from each CJKT testers at least one cycle after Win10
RS5 is released. Until then, we should not stop hacking GetTextExt() result in
late Beta nor Release builds.
Comment on attachment 8998443 [details]
Bug 1481153 - part 1: Make TSFStaticSink cache active TIP rather than checking it every time with GUID comparison

Makoto Kato [:m_kato] has approved the revision.
Attachment #8998443 - Flags: review+
Comment on attachment 8998445 [details]
Bug 1481153 - part 2: Rewrite TSFTextStore::MaybeHackNoErrorLayoutBugs() with switch-case statement with TSFStaticSink::ActiveTIP()

Makoto Kato [:m_kato] has approved the revision.
Attachment #8998445 - Flags: review+
Comment on attachment 8998446 [details]
Bug 1481153 - part 3: Make TSFTextStore::MaybeHackNoErrorLayoutBugs() hack even on Win10 build 17643 or later when Microsoft Pinyin or Microsoft Wubi is active

Makoto Kato [:m_kato] has approved the revision.
Attachment #8998446 - Flags: review+
Comment on attachment 8998447 [details]
Bug 1481153 - part 4: Should stop hacking the result of TSFTextStore::GetTextExt() when Win10 build 17643 only in Nightly or early Beta

Makoto Kato [:m_kato] has approved the revision.
Attachment #8998447 - Flags: review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/241cb3078495a2aae68fa4fb129659c04d370176
Bug 1481153 - part 1: Make TSFStaticSink cache active TIP rather than checking it every time with GUID comparison r=m_kato

https://hg.mozilla.org/integration/mozilla-inbound/rev/5d8f6ac00e4ff90c664591abd9615cc5107280e2
Bug 1481153 - part 2: Rewrite TSFTextStore::MaybeHackNoErrorLayoutBugs() with switch-case statement with TSFStaticSink::ActiveTIP() r=m_kato

https://hg.mozilla.org/integration/mozilla-inbound/rev/e89afaa8173de68496ac1737b5244a91c0cb25a5
Bug 1481153 - part 3: Make TSFTextStore::MaybeHackNoErrorLayoutBugs() hack even on Win10 build 17643 or later when Microsoft Pinyin or Microsoft Wubi is active r=m_kato

https://hg.mozilla.org/integration/mozilla-inbound/rev/1c2151fe7f760e68770178466ad7bf7a1cdce819
Bug 1481153 - part 4: Should stop hacking the result of TSFTextStore::GetTextExt() when Win10 build 17643 only in Nightly or early Beta r=m_kato
You need to log in before you can comment on or make changes to this bug.