зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1052286 nsTextStore::SetInputContext() should handle password state as editable state r=jimm
This commit is contained in:
Родитель
51a18d912f
Коммит
5a1e63fec0
|
@ -373,6 +373,11 @@ struct IMEState {
|
|||
mEnabled(aEnabled), mOpen(aOpen)
|
||||
{
|
||||
}
|
||||
|
||||
bool IsEditable() const
|
||||
{
|
||||
return mEnabled == ENABLED || mEnabled == PASSWORD;
|
||||
}
|
||||
};
|
||||
|
||||
struct InputContext {
|
||||
|
|
|
@ -169,10 +169,10 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
|
|||
return nsTextStore::OnTextChange(aIMENotification);
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
return nsTextStore::OnFocusChange(true, aWindow,
|
||||
aWindow->GetInputContext().mIMEState.mEnabled);
|
||||
aWindow->GetInputContext().mIMEState);
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return nsTextStore::OnFocusChange(false, aWindow,
|
||||
aWindow->GetInputContext().mIMEState.mEnabled);
|
||||
aWindow->GetInputContext().mIMEState);
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
if (nsTextStore::IsComposingOn(aWindow)) {
|
||||
nsTextStore::CommitComposition(false);
|
||||
|
@ -208,7 +208,7 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
|
|||
// the blur.
|
||||
if (nsTextStore::ThinksHavingFocus()) {
|
||||
return nsTextStore::OnFocusChange(false, aWindow,
|
||||
aWindow->GetInputContext().mIMEState.mEnabled);
|
||||
aWindow->GetInputContext().mIMEState);
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
#endif //NS_ENABLE_TSF
|
||||
|
|
|
@ -3274,25 +3274,25 @@ nsTextStore::OnActivated(DWORD dwProfileType,
|
|||
nsresult
|
||||
nsTextStore::OnFocusChange(bool aGotFocus,
|
||||
nsWindowBase* aFocusedWidget,
|
||||
IMEState::Enabled aIMEEnabled)
|
||||
const IMEState& aIMEState)
|
||||
{
|
||||
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
|
||||
("TSF: nsTextStore::OnFocusChange(aGotFocus=%s, "
|
||||
"aFocusedWidget=0x%p, aIMEEnabled=%s), sTsfThreadMgr=0x%p, "
|
||||
"sTsfTextStore=0x%p",
|
||||
"aFocusedWidget=0x%p, aIMEState={ mEnabled=%s }), "
|
||||
"sTsfThreadMgr=0x%p, sTsfTextStore=0x%p",
|
||||
GetBoolName(aGotFocus), aFocusedWidget,
|
||||
GetIMEEnabledName(aIMEEnabled), sTsfThreadMgr, sTsfTextStore));
|
||||
GetIMEEnabledName(aIMEState.mEnabled),
|
||||
sTsfThreadMgr, sTsfTextStore));
|
||||
|
||||
// no change notifications if TSF is disabled
|
||||
NS_ENSURE_TRUE(sTsfThreadMgr && sTsfTextStore, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsRefPtr<ITfDocumentMgr> prevFocusedDocumentMgr;
|
||||
if (aGotFocus && (aIMEEnabled == IMEState::ENABLED ||
|
||||
aIMEEnabled == IMEState::PASSWORD)) {
|
||||
if (aGotFocus && aIMEState.IsEditable()) {
|
||||
bool bRet = sTsfTextStore->Create(aFocusedWidget);
|
||||
NS_ENSURE_TRUE(bRet, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(sTsfTextStore->mDocumentMgr, NS_ERROR_FAILURE);
|
||||
if (aIMEEnabled == IMEState::PASSWORD) {
|
||||
if (aIMEState.mEnabled == IMEState::PASSWORD) {
|
||||
MarkContextAsKeyboardDisabled(sTsfTextStore->mContext);
|
||||
nsRefPtr<ITfContext> topContext;
|
||||
sTsfTextStore->mDocumentMgr->GetTop(getter_AddRefs(topContext));
|
||||
|
@ -3762,12 +3762,10 @@ nsTextStore::SetInputContext(nsWindowBase* aWidget,
|
|||
|
||||
// If focus isn't actually changed but the enabled state is changed,
|
||||
// emulate the focus move.
|
||||
if (!ThinksHavingFocus() &&
|
||||
aContext.mIMEState.mEnabled == IMEState::ENABLED) {
|
||||
OnFocusChange(true, aWidget, aContext.mIMEState.mEnabled);
|
||||
} else if (ThinksHavingFocus() &&
|
||||
aContext.mIMEState.mEnabled != IMEState::ENABLED) {
|
||||
OnFocusChange(false, aWidget, aContext.mIMEState.mEnabled);
|
||||
if (!ThinksHavingFocus() && aContext.mIMEState.IsEditable()) {
|
||||
OnFocusChange(true, aWidget, aContext.mIMEState);
|
||||
} else if (ThinksHavingFocus() && !aContext.mIMEState.IsEditable()) {
|
||||
OnFocusChange(false, aWidget, aContext.mIMEState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
|
||||
static nsresult OnFocusChange(bool aGotFocus,
|
||||
nsWindowBase* aFocusedWidget,
|
||||
IMEState::Enabled aIMEEnabled);
|
||||
const IMEState& aIMEState);
|
||||
static nsresult OnTextChange(const IMENotification& aIMENotification)
|
||||
{
|
||||
NS_ENSURE_TRUE(sTsfTextStore, NS_ERROR_NOT_AVAILABLE);
|
||||
|
|
|
@ -1570,11 +1570,9 @@ MetroWidget::NotifyIME(const IMENotification& aIMENotification)
|
|||
nsTextStore::CommitComposition(true);
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
return nsTextStore::OnFocusChange(true, this,
|
||||
mInputContext.mIMEState.mEnabled);
|
||||
return nsTextStore::OnFocusChange(true, this, mInputContext.mIMEState);
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return nsTextStore::OnFocusChange(false, this,
|
||||
mInputContext.mIMEState.mEnabled);
|
||||
return nsTextStore::OnFocusChange(false, this, mInputContext.mIMEState);
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
return nsTextStore::OnSelectionChange();
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
|
|
Загрузка…
Ссылка в новой задаче