diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp index 512e72821721..1bd37f0a9cdc 100644 --- a/dom/ipc/BrowserParent.cpp +++ b/dom/ipc/BrowserParent.cpp @@ -3154,16 +3154,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvSetPluginFocused( return IPC_OK(); } -mozilla::ipc::IPCResult BrowserParent::RecvEnableIMEForPlugin( - const bool& aEnable) { - nsCOMPtr widget = GetWidget(); - if (!widget) { - return IPC_OK(); - } - widget->EnableIMEForPlugin(aEnable); - return IPC_OK(); -} - mozilla::ipc::IPCResult BrowserParent::RecvGetInputContext( widget::IMEState* aState) { nsCOMPtr widget = GetWidget(); diff --git a/dom/ipc/BrowserParent.h b/dom/ipc/BrowserParent.h index 5980d4aa2256..d815cc7c12cd 100644 --- a/dom/ipc/BrowserParent.h +++ b/dom/ipc/BrowserParent.h @@ -385,8 +385,6 @@ class BrowserParent final : public PBrowserParent, mozilla::ipc::IPCResult RecvSetPluginFocused(const bool& aFocused); - mozilla::ipc::IPCResult RecvEnableIMEForPlugin(const bool& aEnable); - mozilla::ipc::IPCResult RecvGetInputContext(widget::IMEState* aIMEState); mozilla::ipc::IPCResult RecvSetInputContext( diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index d38ff22960cc..d8fe0ea42373 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -387,11 +387,6 @@ parent: */ nested(inside_cpow) async SetPluginFocused(bool aFocused); - /** - * Enable or Disable IME by windowless plugin if plugin has focus. - */ - async EnableIMEForPlugin(bool aEnable); - /** * Notifies the parent process of native key event data received in a * plugin process directly. diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 118bd4bd0da7..0be90b7800e3 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -871,23 +871,6 @@ bool nsPluginInstanceOwner::RequestCommitOrCancel(bool aCommitted) { return true; } -bool nsPluginInstanceOwner::EnableIME(bool aEnable) { - if (NS_WARN_IF(!mPluginFrame)) { - return false; - } - - nsCOMPtr widget = GetContainingWidgetIfOffset(); - if (!widget) { - widget = GetRootWidgetForPluginFrame(mPluginFrame); - if (NS_WARN_IF(!widget)) { - return false; - } - } - - widget->EnableIMEForPlugin(aEnable); - return true; -} - #endif // #ifdef XP_WIN void nsPluginInstanceOwner::HandledWindowedPluginKeyEvent( diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index 50246410d7e6..9c94d2d380f2 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -257,7 +257,6 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner, bool GetCompositionString(uint32_t aIndex, nsTArray* aString, int32_t* aLength); bool RequestCommitOrCancel(bool aCommitted); - bool EnableIME(bool aEnable); // See nsIKeyEventInPluginCallback virtual void HandledWindowedPluginKeyEvent( diff --git a/dom/plugins/ipc/PPluginInstance.ipdl b/dom/plugins/ipc/PPluginInstance.ipdl index f87639733c58..4b54f61e3bd7 100644 --- a/dom/plugins/ipc/PPluginInstance.ipdl +++ b/dom/plugins/ipc/PPluginInstance.ipdl @@ -256,11 +256,6 @@ parent: returns (uint8_t[] aDist, int32_t aLength); async RequestCommitOrCancel(bool aCommitted); - // Control IME can enable or disable - // - // @param aEanble whether IME is enabled or disabled - async EnableIME(bool aEnable); - // Notifies the parent process of a plugin instance receiving key event // directly. // diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 9f02fe112ee3..2a6b1db4bbfc 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -2027,7 +2027,6 @@ BOOL PluginInstanceChild::ImmAssociateContextExProc(HWND hWND, HIMC hImc, // Store the last IME state since Flash may call ImmAssociateContextEx // before taking focus. self->mLastEnableIMEState = !!(dwFlags & IACE_DEFAULT); - self->SendEnableIME(self->mLastEnableIMEState); } return sImm32ImmAssociateContextExStub(hWND, hImc, dwFlags); } @@ -2112,11 +2111,7 @@ int16_t PluginInstanceChild::WinlessHandleEvent(NPEvent& event) { // activated and set input context with PLUGIN. So after activating // content process, we have to set current IME state again. - if (event.event == WM_SETFOCUS) { - // When focus is changed from chrome process to plugin process, - // Flash may call ImmAssociateContextEx before receiving WM_SETFOCUS. - SendEnableIME(mLastEnableIMEState); - } else if (event.event == WM_KILLFOCUS) { + if (event.event == WM_KILLFOCUS) { // Flash always calls ImmAssociateContextEx by taking focus. // Although this flag doesn't have to be reset, I add it for safety. mLastEnableIMEState = true; diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 4fde5b0297e4..6e29171d912d 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -2279,19 +2279,6 @@ mozilla::ipc::IPCResult PluginInstanceParent::RecvRequestCommitOrCancel( return IPC_OK(); } -mozilla::ipc::IPCResult PluginInstanceParent::RecvEnableIME( - const bool& aEnable) { -#if defined(OS_WIN) - nsPluginInstanceOwner* owner = GetOwner(); - if (owner) { - owner->EnableIME(aEnable); - } -#else - MOZ_CRASH("Not reachable"); -#endif - return IPC_OK(); -} - nsresult PluginInstanceParent::HandledWindowedPluginKeyEvent( const NativeEventData& aKeyEventData, bool aIsConsumed) { if (NS_WARN_IF( diff --git a/dom/plugins/ipc/PluginInstanceParent.h b/dom/plugins/ipc/PluginInstanceParent.h index f4af33eb7841..bef637b21fc2 100644 --- a/dom/plugins/ipc/PluginInstanceParent.h +++ b/dom/plugins/ipc/PluginInstanceParent.h @@ -282,7 +282,6 @@ class PluginInstanceParent : public PPluginInstanceParent { nsTArray* aBuffer, int32_t* aLength); mozilla::ipc::IPCResult RecvRequestCommitOrCancel(const bool& aCommitted); - mozilla::ipc::IPCResult RecvEnableIME(const bool& aEnable); // for reserved shortcut key handling with windowed plugin on Windows nsresult HandledWindowedPluginKeyEvent( diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 3653b1137958..3e68db453d6c 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -1210,23 +1210,6 @@ nsIWidgetListener* PuppetWidget::GetCurrentWidgetListener() { return mAttachedWidgetListener; } -void PuppetWidget::EnableIMEForPlugin(bool aEnable) { - if (!mBrowserChild) { - return; - } - - // If current IME state isn't plugin, we ignore this call. - if (NS_WARN_IF(HaveValidInputContextCache() && - mInputContext.mIMEState.mEnabled != IMEEnabled::Unknown && - mInputContext.mIMEState.mEnabled != IMEEnabled::Plugin)) { - return; - } - - // We don't have valid state in cache or state is plugin, so delegate to - // chrome process. - mBrowserChild->SendEnableIMEForPlugin(aEnable); -} - void PuppetWidget::ZoomToRect(const uint32_t& aPresShellId, const ScrollableLayerGuid::ViewID& aViewId, const CSSRect& aRect, const uint32_t& aFlags) { diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h index 23c99e16df96..e60dc39ff41d 100644 --- a/widget/PuppetWidget.h +++ b/widget/PuppetWidget.h @@ -283,8 +283,6 @@ class PuppetWidget : public nsBaseWidget, virtual void StartAsyncScrollbarDrag( const AsyncDragMetrics& aDragMetrics) override; - virtual void EnableIMEForPlugin(bool aEnable) override; - virtual void ZoomToRect(const uint32_t& aPresShellId, const ScrollableLayerGuid::ViewID& aViewId, const CSSRect& aRect, diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 7fe02a854763..d1f8a7015f2e 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1861,11 +1861,6 @@ class nsIWidget : public nsISupports { */ virtual void SetPluginFocused(bool& aFocused) = 0; - /* - * Enable or Disable IME by windowless plugin. - */ - virtual void EnableIMEForPlugin(bool aEnable) {} - /** * MaybeDispatchInitialFocusEvent will dispatch a focus event after creation * of the widget, in the event that we were not able to observe and respond to diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index a0e8f59efb1f..adb860e01786 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -8498,21 +8498,6 @@ bool nsWindow::WidgetTypeSupportsAcceleration() { !(IsPopup() && DeviceManagerDx::Get()->IsWARP()); } -void nsWindow::EnableIMEForPlugin(bool aEnable) { - // Current IME state isn't plugin, ignore this call - if (NS_WARN_IF(mInputContext.mIMEState.mEnabled != IMEEnabled::Plugin)) { - return; - } - - InputContext inputContext = GetInputContext(); - if (aEnable) { - inputContext.mHTMLInputType.AssignLiteral("text"); - } else { - inputContext.mHTMLInputType.AssignLiteral("password"); - } - SetInputContext(inputContext, InputContextAction()); -} - nsresult nsWindow::OnWindowedPluginKeyEvent( const NativeEventData& aKeyEventData, nsIKeyEventInPluginCallback* aCallback) { diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index aabf326ddddb..20e8447c0a89 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -356,7 +356,6 @@ class nsWindow final : public nsWindowBase { const IMEContext& DefaultIMC() const { return mDefaultIMC; } - virtual void EnableIMEForPlugin(bool aEnable) override; virtual nsresult OnWindowedPluginKeyEvent( const mozilla::NativeEventData& aKeyEventData, nsIKeyEventInPluginCallback* aCallback) override;