Bug 1683226 - part 10: Get rid of `nsIWidget::EnableIMEForPlugin()` r=m_kato

This is used only on Windows.

Differential Revision: https://phabricator.services.mozilla.com/D100122
This commit is contained in:
Masayuki Nakano 2020-12-21 06:31:16 +00:00
Родитель ff0e3ef67e
Коммит f13852f795
14 изменённых файлов: 1 добавлений и 100 удалений

Просмотреть файл

@ -3154,16 +3154,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvSetPluginFocused(
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserParent::RecvEnableIMEForPlugin(
const bool& aEnable) {
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
return IPC_OK();
}
widget->EnableIMEForPlugin(aEnable);
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserParent::RecvGetInputContext(
widget::IMEState* aState) {
nsCOMPtr<nsIWidget> widget = GetWidget();

Просмотреть файл

@ -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(

Просмотреть файл

@ -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.

Просмотреть файл

@ -871,23 +871,6 @@ bool nsPluginInstanceOwner::RequestCommitOrCancel(bool aCommitted) {
return true;
}
bool nsPluginInstanceOwner::EnableIME(bool aEnable) {
if (NS_WARN_IF(!mPluginFrame)) {
return false;
}
nsCOMPtr<nsIWidget> 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(

Просмотреть файл

@ -257,7 +257,6 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
bool GetCompositionString(uint32_t aIndex, nsTArray<uint8_t>* aString,
int32_t* aLength);
bool RequestCommitOrCancel(bool aCommitted);
bool EnableIME(bool aEnable);
// See nsIKeyEventInPluginCallback
virtual void HandledWindowedPluginKeyEvent(

Просмотреть файл

@ -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.
//

Просмотреть файл

@ -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;

Просмотреть файл

@ -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(

Просмотреть файл

@ -282,7 +282,6 @@ class PluginInstanceParent : public PPluginInstanceParent {
nsTArray<uint8_t>* 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(

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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,

Просмотреть файл

@ -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

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;