Bug 1468917 - part 2: TSFTextStore::GetTextExt() shouldn't return TS_E_NOLAYOUT when ATOK retrieves text rects *in* the composition string r=m_kato a=lizzard
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 22 Jun 2018 18:43:40 +0900
changeset 477835 462984c1b4ffb94d76c7362d84867c2b3590eb19
parent 477834 b5967b6eb0a9b61be56f9cf6138ee251868b21cb
child 477836 43f3051e9efa7b39531644a7b2f82f62f7b0eb4e
push id9444
push userarchaeopteryx@coole-files.de
push dateSat, 07 Jul 2018 21:01:06 +0000
treeherdermozilla-beta@3c8ab5a011e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato, lizzard
bugs1468917
milestone62.0
Bug 1468917 - part 2: TSFTextStore::GetTextExt() shouldn't return TS_E_NOLAYOUT when ATOK retrieves text rects *in* the composition string r=m_kato a=lizzard 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
@@ -4506,18 +4506,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() &&