Bug 1204519 part.1 Remove hack for TS_E_NOLAYOUT issue of Google Japanese Input r=emk

This commit is contained in:
Masayuki Nakano 2015-09-18 09:58:17 +09:00
parent 03522f5967
commit 5e0c8e2cec
3 changed files with 2 additions and 54 deletions

View File

@ -3166,12 +3166,10 @@ pref("intl.tsf.hack.easy_changjei.do_not_return_no_layout_error", true);
// ITfContextView::GetTextExt() if the specified range is the first character
// of selected clause of composition string.
pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_first_char", true);
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
// composition string.
pref("intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_caret", true);
pref("intl.tsf.hack.google_ja_input.do_not_return_no_layout_error_at_caret", true);
// Whether hack ITextStoreACP::QueryInsert() or not. The method should return
// new selection after specified length text is inserted at specified range.
// However, Microsoft's some Chinese TIPs expect that the result is same as

View File

@ -1292,8 +1292,6 @@ bool TSFTextStore::sDoNotReturnNoLayoutErrorToFreeChangJie = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToEasyChangjei = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar = false;
bool TSFTextStore::sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret = false;
bool TSFTextStore::sHackQueryInsertForMSSimplifiedTIP = false;
bool TSFTextStore::sHackQueryInsertForMSTraditionalTIP = false;
@ -3552,40 +3550,6 @@ TSFTextStore::GetTextExt(TsViewCookie vcView,
"acpEnd=%d", this, acpStart, acpEnd));
}
}
} else if ((sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar ||
sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret) &&
kSink->IsGoogleJapaneseInputActive()) {
// Google Japanese Input doesn't handle ITfContextView::GetTextExt()
// properly due to the same bug of TSF mentioned above. Google Japanese
// Input calls this twice for the first character of changing range of
// composition string and the caret which is typically at the end of
// composition string. The formar is used for showing candidate window.
// This is typically shown at wrong position. We should avoid only this
// case. This is not necessary on Windows 10.
if (sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar &&
!mLockedContent.IsLayoutChangedAfter(acpStart) &&
acpStart < acpEnd) {
acpEnd = acpStart;
MOZ_LOG(sTextStoreLog, LogLevel::Debug,
("TSF: 0x%p TSFTextStore::GetTextExt() hacked the offsets of "
"the first character of changing range of the composition "
"string for TIP acpStart=%d, acpEnd=%d",
this, acpStart, acpEnd));
}
// Google Japanese Input sometimes uses caret position for deciding its
// candidate window position. In such case, we should return the previous
// offset of selected clause. However, it's difficult to get where is
// selected clause for now. Instead, we should use the first character
// which is modified. This is useful in most cases.
else if (sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret &&
acpStart == acpEnd &&
currentSel.IsCollapsed() && currentSel.EndOffset() == acpEnd) {
acpEnd = acpStart = mLockedContent.MinOffsetOfLayoutChanged();
MOZ_LOG(sTextStoreLog, LogLevel::Debug,
("TSF: 0x%p TSFTextStore::GetTextExt() hacked the offsets of "
"the caret of the composition string for TIP acpStart=%d, "
"acpEnd=%d", this, acpStart, acpEnd));
}
}
// Free ChangJie 2010 and Easy Changjei 1.0.12.0 doesn't handle
// ITfContextView::GetTextExt() properly. Prehaps, it's due to the bug of
@ -5290,14 +5254,6 @@ TSFTextStore::Initialize()
Preferences::GetBool(
"intl.tsf.hack.ms_japanese_ime.do_not_return_no_layout_error_at_caret",
true);
sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar =
Preferences::GetBool(
"intl.tsf.hack.google_ja_input."
"do_not_return_no_layout_error_at_first_char", true);
sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret =
Preferences::GetBool(
"intl.tsf.hack.google_ja_input.do_not_return_no_layout_error_at_caret",
true);
sHackQueryInsertForMSSimplifiedTIP =
Preferences::GetBool(
"intl.tsf.hack.ms_simplified_chinese.query_insert_result", true);
@ -5313,18 +5269,14 @@ TSFTextStore::Initialize()
"sDoNotReturnNoLayoutErrorToFreeChangJie=%s, "
"sDoNotReturnNoLayoutErrorToEasyChangjei=%s, "
"sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar=%s, "
"sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret=%s, "
"sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar=%s, "
"sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret=%s",
"sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret=%s",
sThreadMgr.get(), sClientId, sDisplayAttrMgr.get(),
sCategoryMgr.get(), sDisabledDocumentMgr.get(), sDisabledContext.get(),
GetBoolName(sCreateNativeCaretForATOK),
GetBoolName(sDoNotReturnNoLayoutErrorToFreeChangJie),
GetBoolName(sDoNotReturnNoLayoutErrorToEasyChangjei),
GetBoolName(sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar),
GetBoolName(sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret),
GetBoolName(sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar),
GetBoolName(sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret)));
GetBoolName(sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret)));
}
// static

View File

@ -841,8 +841,6 @@ protected:
static bool sDoNotReturnNoLayoutErrorToEasyChangjei;
static bool sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtFirstChar;
static bool sDoNotReturnNoLayoutErrorToMSJapaneseIMEAtCaret;
static bool sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar;
static bool sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret;
static bool sHackQueryInsertForMSSimplifiedTIP;
static bool sHackQueryInsertForMSTraditionalTIP;
};