Bug 685395 part.4 IME open state should be able to set/get by InputContext r=roc, sr=matspal
This commit is contained in:
@@ -564,35 +564,42 @@ TabParent::RecvEndIMEComposition(const bool& aCancel,
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvGetInputContext(PRUint32* aValue)
|
||||
TabParent::RecvGetInputContext(PRInt32* aIMEEnabled,
|
||||
PRInt32* aIMEOpen)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget) {
|
||||
*aValue = InputContext::IME_DISABLED;
|
||||
*aIMEEnabled = IMEState::DISABLED;
|
||||
*aIMEOpen = IMEState::OPEN_STATE_NOT_SUPPORTED;
|
||||
return true;
|
||||
}
|
||||
|
||||
InputContext context = widget->GetInputContext();
|
||||
*aValue = context.mIMEEnabled;
|
||||
*aIMEEnabled = static_cast<PRInt32>(context.mIMEState.mEnabled);
|
||||
*aIMEOpen = static_cast<PRInt32>(context.mIMEState.mOpen);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvSetInputContext(const PRUint32& aValue,
|
||||
TabParent::RecvSetInputContext(const PRInt32& aIMEEnabled,
|
||||
const PRInt32& aIMEOpen,
|
||||
const nsString& aType,
|
||||
const nsString& aActionHint,
|
||||
const PRInt32& aCause,
|
||||
const PRInt32& aFocusChange)
|
||||
{
|
||||
// mIMETabParent (which is actually static) tracks which if any TabParent has IMEFocus
|
||||
// When the input mode is set to anything but IME_STATUS_NONE, mIMETabParent should be set to this
|
||||
mIMETabParent = aValue & nsIContent::IME_STATUS_MASK_ENABLED ? this : nsnull;
|
||||
// When the input mode is set to anything but IMEState::DISABLED,
|
||||
// mIMETabParent should be set to this
|
||||
mIMETabParent =
|
||||
aIMEEnabled != static_cast<PRInt32>(IMEState::DISABLED) ? this : nsnull;
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget || !AllowContentIME())
|
||||
return true;
|
||||
|
||||
InputContext context;
|
||||
context.mIMEEnabled = aValue;
|
||||
context.mIMEState.mEnabled = static_cast<IMEState::Enabled>(aIMEEnabled);
|
||||
context.mIMEState.mOpen = static_cast<IMEState::Open>(aIMEOpen);
|
||||
context.mHTMLInputType.Assign(aType);
|
||||
context.mActionHint.Assign(aActionHint);
|
||||
InputContextAction action(
|
||||
@@ -605,30 +612,12 @@ TabParent::RecvSetInputContext(const PRUint32& aValue,
|
||||
return true;
|
||||
|
||||
nsAutoString state;
|
||||
state.AppendInt(aValue);
|
||||
state.AppendInt(aIMEEnabled);
|
||||
observerService->NotifyObservers(nsnull, "ime-enabled-state-changed", state.get());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvGetIMEOpenState(bool* aValue)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget)
|
||||
widget->GetIMEOpenState(aValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvSetIMEOpenState(const bool& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (widget && AllowContentIME())
|
||||
widget->SetIMEOpenState(aValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvGetDPI(float* aValue)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user