Bug 1468917 - part 2: TSFTextStore::GetTextExt() shouldn't return TS_E_NOLAYOUT when ATOK retrieves text rects *in* the composition string r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 22 Jun 2018 18:43:40 +0900
changeset 809581 d0dae4390d7b05a76ac8dc796c298c13fcfd324d
parent 809580 1a13f09b7b6065988771011b3b7ff362216c004a
push id113713
push usermasayuki@d-toybox.com
push dateFri, 22 Jun 2018 13:01:27 +0000
reviewersm_kato
bugs1468917
milestone62.0a1
Bug 1468917 - part 2: TSFTextStore::GetTextExt() shouldn't return TS_E_NOLAYOUT when ATOK retrieves text rects *in* the composition string r?m_kato Currently, TSFTextStore::GetTextExt() won't return TS_E_NOLAYOUT error when ATOK retrieves text rect of all of the composition string. However, if user converts 2nd or later clause, ATOK retrieves text rect after start of the character of selected clause. Returning TS_E_NOLAYOUT in this case causes candidate window being positioned temporarily below first character of the composition string. For avoiding the flicker of the candidate window, TSFTextStore::GetTextExt() shouldn't return TS_E_NOLAYOUT when ATOK retrieves text rects *in* the composition string. MozReview-Commit-ID: Cp17HmP2QGK
widget/windows/TSFTextStore.cpp
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -4532,18 +4532,20 @@ TSFTextStore::GetTextExt(TsViewCookie vc
     //     refers native caret rect on windows whose window class is one of
     //     Mozilla window classes and we stop creating native caret for ATOK
     //     because creating native caret causes ATOK refers caret position
     //     when GetTextExt() returns TS_E_NOLAYOUT.
     else if (TSFPrefs::DoNotReturnNoLayoutErrorToATOKOfCompositionString() &&
              TSFStaticSink::IsATOKActive() &&
              (!TSFStaticSink::IsATOKReferringNativeCaretActive() ||
               !TSFPrefs::NeedToCreateNativeCaretForLegacyATOK()) &&
-             mContentForTSF.LatestCompositionStartOffset() == acpStart &&
-             mContentForTSF.LatestCompositionEndOffset() == acpEnd) {
+             acpStart >= mContentForTSF.LatestCompositionStartOffset() &&
+             acpStart <= mContentForTSF.LatestCompositionEndOffset() &&
+             acpEnd >= mContentForTSF.LatestCompositionStartOffset() &&
+             acpEnd <= mContentForTSF.LatestCompositionEndOffset()) {
       dontReturnNoLayoutError = true;
     }
     // Japanist 10 fails to handle TS_E_NOLAYOUT when it decides the position of
     // candidate window.  In such case, Japanist shows candidate window at
     // top-left of the screen.  So, we should return the nearest caret rect
     // where we know.
     else if (
       TSFPrefs::DoNotReturnNoLayoutErrorToJapanist10OfCompositionString() &&