Bug 1466910 - 1. Forward more InputContext members through e10s; r?masayuki
Some InputContext members are not forwarded through
PBrowser::SetInputContext.
MozReview-Commit-ID: C1bGYq4w8zT
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -46,20 +46,19 @@ using mozilla::layers::MaybeZoomConstrai
using mozilla::layers::GeckoContentController::TapType from "mozilla/layers/GeckoContentController.h";
using FrameMetrics::ViewID from "FrameMetrics.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
using nscolor from "nsColor.h";
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::widget::IMENotification from "mozilla/widget/IMEData.h";
using struct mozilla::widget::IMENotificationRequests from "mozilla/widget/IMEData.h";
-using mozilla::widget::IMEState::Enabled from "mozilla/widget/IMEData.h";
-using mozilla::widget::IMEState::Open from "mozilla/widget/IMEData.h";
-using mozilla::widget::InputContextAction::Cause from "mozilla/widget/IMEData.h";
-using mozilla::widget::InputContextAction::FocusChange from "mozilla/widget/IMEData.h";
+using struct mozilla::widget::IMEState from "mozilla/widget/IMEData.h";
+using struct mozilla::widget::InputContext from "mozilla/widget/IMEData.h";
+using struct mozilla::widget::InputContextAction from "mozilla/widget/IMEData.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using class mozilla::ContentCache from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetDragEvent from "ipc/nsGUIEventIPC.h";
@@ -350,27 +349,20 @@ parent:
/**
* Indicate, based on the current state, that some commands are enabled and
* some are disabled.
*/
async EnableDisableCommands(nsString action,
nsCString[] enabledCommands,
nsCString[] disabledCommands);
- nested(inside_cpow) sync GetInputContext() returns (Enabled IMEEnabled,
- Open IMEOpen);
+ nested(inside_cpow) sync GetInputContext() returns (IMEState state);
- nested(inside_cpow) async SetInputContext(Enabled IMEEnabled,
- Open IMEOpen,
- nsString type,
- nsString inputmode,
- nsString actionHint,
- bool inPrivateBrowsing,
- Cause cause,
- FocusChange focusChange);
+ nested(inside_cpow) async SetInputContext(InputContext context,
+ InputContextAction action);
sync IsParentWindowMainWidgetVisible() returns (bool visible);
/**
* Set the native cursor.
* @param value
* The widget cursor to set.
* @param force
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2447,56 +2447,35 @@ TabParent::RecvDefaultProcOfPluginEvent(
return IPC_OK();
}
widget->DefaultProcOfPluginEvent(aEvent);
return IPC_OK();
}
mozilla::ipc::IPCResult
-TabParent::RecvGetInputContext(IMEState::Enabled* aIMEEnabled,
- IMEState::Open* aIMEOpen)
+TabParent::RecvGetInputContext(widget::IMEState* aState)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
- *aIMEEnabled = IMEState::DISABLED;
- *aIMEOpen = IMEState::OPEN_STATE_NOT_SUPPORTED;
+ *aState = widget::IMEState(IMEState::DISABLED,
+ IMEState::OPEN_STATE_NOT_SUPPORTED);
return IPC_OK();
}
- InputContext context = widget->GetInputContext();
- *aIMEEnabled = context.mIMEState.mEnabled;
- *aIMEOpen = context.mIMEState.mOpen;
+ *aState = widget->GetInputContext().mIMEState;
return IPC_OK();
}
mozilla::ipc::IPCResult
TabParent::RecvSetInputContext(
- const IMEState::Enabled& aIMEEnabled,
- const IMEState::Open& aIMEOpen,
- const nsString& aType,
- const nsString& aInputmode,
- const nsString& aActionHint,
- const bool& aInPrivateBrowsing,
- const InputContextAction::Cause& aCause,
- const InputContextAction::FocusChange& aFocusChange)
+ const InputContext& aContext,
+ const InputContextAction& aAction)
{
- InputContext context;
- context.mIMEState.mEnabled = aIMEEnabled;
- context.mIMEState.mOpen = aIMEOpen;
- context.mHTMLInputType.Assign(aType);
- context.mHTMLInputInputmode.Assign(aInputmode);
- context.mActionHint.Assign(aActionHint);
- context.mOrigin = InputContext::ORIGIN_CONTENT;
- context.mInPrivateBrowsing = aInPrivateBrowsing;
-
- InputContextAction action(aCause, aFocusChange);
-
- IMEStateManager::SetInputContextForChildProcess(this, context, action);
-
+ IMEStateManager::SetInputContextForChildProcess(this, aContext, aAction);
return IPC_OK();
}
mozilla::ipc::IPCResult
TabParent::RecvIsParentWindowMainWidgetVisible(bool* aIsVisible)
{
nsCOMPtr<nsIContent> frame = do_QueryInterface(mFrameElement);
if (!frame)
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -236,28 +236,21 @@ public:
const widget::CandidateWindowPosition& aPosition) override;
virtual mozilla::ipc::IPCResult
RecvEnableIMEForPlugin(const bool& aEnable) override;
virtual mozilla::ipc::IPCResult
RecvDefaultProcOfPluginEvent(const WidgetPluginEvent& aEvent) override;
virtual mozilla::ipc::IPCResult RecvGetInputContext(
- widget::IMEState::Enabled* aIMEEnabled,
- widget::IMEState::Open* aIMEOpen) override;
+ widget::IMEState* aIMEState) override;
virtual mozilla::ipc::IPCResult RecvSetInputContext(
- const widget::IMEState::Enabled& aIMEEnabled,
- const widget::IMEState::Open& aIMEOpen,
- const nsString& aType,
- const nsString& aInputmode,
- const nsString& aActionHint,
- const bool& aInPrivateBrowsing,
- const widget::InputContextAction::Cause& aCause,
- const widget::InputContextAction::FocusChange& aFocusChange) override;
+ const widget::InputContext& aContext,
+ const widget::InputContextAction& aAction) override;
// See nsIKeyEventInPluginCallback
virtual void HandledWindowedPluginKeyEvent(
const NativeEventData& aKeyEventData,
bool aIsConsumed) override;
virtual mozilla::ipc::IPCResult RecvOnWindowedPluginKeyEvent(
const NativeEventData& aKeyEventData) override;
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -764,24 +764,17 @@ PuppetWidget::SetInputContext(const Inpu
mInputContext = aContext;
// Any widget instances cannot cache IME open state because IME open state
// can be changed by user but native IME may not notify us of changing the
// open state on some platforms.
mInputContext.mIMEState.mOpen = IMEState::OPEN_STATE_NOT_SUPPORTED;
if (!mTabChild) {
return;
}
- mTabChild->SendSetInputContext(aContext.mIMEState.mEnabled,
- aContext.mIMEState.mOpen,
- aContext.mHTMLInputType,
- aContext.mHTMLInputInputmode,
- aContext.mActionHint,
- aContext.mInPrivateBrowsing,
- aAction.mCause,
- aAction.mFocusChange);
+ mTabChild->SendSetInputContext(aContext, aAction);
}
InputContext
PuppetWidget::GetInputContext()
{
// XXX Currently, we don't support retrieving IME open state from child
// process.
@@ -793,21 +786,17 @@ PuppetWidget::GetInputContext()
NS_WARNING("PuppetWidget::GetInputContext() needs to retrieve it with IPC");
// Don't cache InputContext here because this process isn't managing IME
// state of the chrome widget. So, we cannot modify mInputContext when
// chrome widget is set to new context.
InputContext context;
if (mTabChild) {
- IMEState::Enabled enabled;
- IMEState::Open open;
- mTabChild->SendGetInputContext(&enabled, &open);
- context.mIMEState.mEnabled = enabled;
- context.mIMEState.mOpen = open;
+ mTabChild->SendGetInputContext(&context.mIMEState);
}
return context;
}
NativeIMEContext
PuppetWidget::GetNativeIMEContext()
{
return mNativeIMEContext;
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -965,16 +965,73 @@ struct ParamTraits<mozilla::widget::IMES
: ContiguousEnumSerializerInclusive<
mozilla::widget::IMEState::Open,
mozilla::widget::IMEState::Open::OPEN_STATE_NOT_SUPPORTED,
mozilla::widget::IMEState::Open::CLOSED>
{
};
template<>
+struct ParamTraits<mozilla::widget::IMEState>
+{
+ typedef mozilla::widget::IMEState paramType;
+
+ static void Write(Message* aMsg, const paramType& aParam)
+ {
+ WriteParam(aMsg, aParam.mEnabled);
+ WriteParam(aMsg, aParam.mOpen);
+ }
+
+ static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
+ {
+ return ReadParam(aMsg, aIter, &aResult->mEnabled) &&
+ ReadParam(aMsg, aIter, &aResult->mOpen);
+ }
+};
+
+template<>
+struct ParamTraits<mozilla::widget::InputContext::Origin>
+ : ContiguousEnumSerializerInclusive<
+ mozilla::widget::InputContext::Origin,
+ mozilla::widget::InputContext::Origin::ORIGIN_MAIN,
+ mozilla::widget::InputContext::Origin::ORIGIN_CONTENT>
+{
+};
+
+template<>
+struct ParamTraits<mozilla::widget::InputContext>
+{
+ typedef mozilla::widget::InputContext paramType;
+
+ static void Write(Message* aMsg, const paramType& aParam)
+ {
+ WriteParam(aMsg, aParam.mIMEState);
+ WriteParam(aMsg, aParam.mHTMLInputType);
+ WriteParam(aMsg, aParam.mHTMLInputInputmode);
+ WriteParam(aMsg, aParam.mActionHint);
+ WriteParam(aMsg, aParam.mOrigin);
+ WriteParam(aMsg, aParam.mMayBeIMEUnaware);
+ WriteParam(aMsg, aParam.mHasHandledUserInput);
+ WriteParam(aMsg, aParam.mInPrivateBrowsing);
+ }
+
+ static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
+ {
+ return ReadParam(aMsg, aIter, &aResult->mIMEState) &&
+ ReadParam(aMsg, aIter, &aResult->mHTMLInputType) &&
+ ReadParam(aMsg, aIter, &aResult->mHTMLInputInputmode) &&
+ ReadParam(aMsg, aIter, &aResult->mActionHint) &&
+ ReadParam(aMsg, aIter, &aResult->mOrigin) &&
+ ReadParam(aMsg, aIter, &aResult->mMayBeIMEUnaware) &&
+ ReadParam(aMsg, aIter, &aResult->mHasHandledUserInput) &&
+ ReadParam(aMsg, aIter, &aResult->mInPrivateBrowsing);
+ }
+};
+
+template<>
struct ParamTraits<mozilla::widget::InputContextAction::Cause>
: ContiguousEnumSerializerInclusive<
mozilla::widget::InputContextAction::Cause,
mozilla::widget::InputContextAction::Cause::CAUSE_UNKNOWN,
mozilla::widget::InputContextAction::Cause::
CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT>
{
};
@@ -984,16 +1041,34 @@ struct ParamTraits<mozilla::widget::Inpu
: ContiguousEnumSerializerInclusive<
mozilla::widget::InputContextAction::FocusChange,
mozilla::widget::InputContextAction::FocusChange::FOCUS_NOT_CHANGED,
mozilla::widget::InputContextAction::FocusChange::WIDGET_CREATED>
{
};
template<>
+struct ParamTraits<mozilla::widget::InputContextAction>
+{
+ typedef mozilla::widget::InputContextAction paramType;
+
+ static void Write(Message* aMsg, const paramType& aParam)
+ {
+ WriteParam(aMsg, aParam.mCause);
+ WriteParam(aMsg, aParam.mFocusChange);
+ }
+
+ static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
+ {
+ return ReadParam(aMsg, aIter, &aResult->mCause) &&
+ ReadParam(aMsg, aIter, &aResult->mFocusChange);
+ }
+};
+
+template<>
struct ParamTraits<mozilla::WidgetPluginEvent>
{
typedef mozilla::WidgetPluginEvent paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
WriteParam(aMsg, aParam.mRetargetToFocusedDocument);