diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 7fae7b90bea4..7fe02a854763 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1861,13 +1861,6 @@ class nsIWidget : public nsISupports { */ virtual void SetPluginFocused(bool& aFocused) = 0; - /* - * Tell the plugin has focus. It is unnecessary to use IPC - */ - bool PluginHasFocus() { - return GetInputContext().mIMEState.mEnabled == IMEEnabled::Plugin; - } - /* * Enable or Disable IME by windowless plugin. */ diff --git a/widget/windows/IMMHandler.cpp b/widget/windows/IMMHandler.cpp index ed847c89b18a..338c3a64fdd5 100644 --- a/widget/windows/IMMHandler.cpp +++ b/widget/windows/IMMHandler.cpp @@ -487,10 +487,6 @@ void IMMHandler::OnUpdateComposition(nsWindow* aWindow) { return; } - if (aWindow->PluginHasFocus()) { - return; - } - IMEContext context(aWindow); gIMMHandler->SetIMERelatedWindowsPos(aWindow, context); } @@ -2168,8 +2164,7 @@ void IMMHandler::AdjustCompositionFont(nsWindow* aWindow, logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; logFont.lfPitchAndFamily = DEFAULT_PITCH; - if (!aWindow->PluginHasFocus() && aWritingMode.IsVertical() && - IsVerticalWritingSupported()) { + if (aWritingMode.IsVertical() && IsVerticalWritingSupported()) { SetVerticalFontToLogFont(IsJapanist2003Active() ? sCompositionFontForJapanist2003 : sCompositionFont, diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 51af7cbeccdf..220c578b1656 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2532,7 +2532,7 @@ bool NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const { // message is processed by us, so, nobody shouldn't process it. HWND focusedWnd = ::GetFocus(); if (!defaultPrevented && !mFakeCharMsgs && !IsKeyMessageOnPlugin() && - focusedWnd && !mWidget->PluginHasFocus() && !isIMEEnabled && + focusedWnd && !isIMEEnabled && WinUtils::IsIMEEnabled(mWidget->GetInputContext())) { RedirectedKeyDownMessageManager::RemoveNextCharMessage(focusedWnd); @@ -2598,7 +2598,6 @@ bool NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const { ("%p NativeKey::HandleKeyDownMessage(), not dispatching keypress " "event because preceding keydown event was consumed", this)); - MaybeDispatchPluginEventsForRemovedCharMessages(); return true; } @@ -2623,8 +2622,7 @@ bool NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const { ("%p NativeKey::HandleKeyDownMessage(), tries to be dispatching " "keypress events...", this)); - return (MaybeDispatchPluginEventsForRemovedCharMessages() || - DispatchKeyPressEventsWithoutCharMessage()); + return DispatchKeyPressEventsWithoutCharMessage(); } // If WM_KEYDOWN of VK_PACKET isn't followed by WM_CHAR, we don't need to @@ -3403,71 +3401,6 @@ bool NativeKey::GetFollowingCharMessage(MSG& aCharMsg) { return false; } -bool NativeKey::MaybeDispatchPluginEventsForRemovedCharMessages() const { - MOZ_ASSERT(IsKeyDownMessage()); - MOZ_ASSERT(!IsKeyMessageOnPlugin()); - - for (size_t i = 0; - i < mFollowingCharMsgs.Length() && mWidget->ShouldDispatchPluginEvent(); - ++i) { - MOZ_LOG( - sNativeKeyLogger, LogLevel::Info, - ("%p NativeKey::MaybeDispatchPluginEventsForRemovedCharMessages(), " - "dispatching %uth plugin event for %s...", - this, i + 1, ToString(mFollowingCharMsgs[i]).get())); - MOZ_RELEASE_ASSERT( - !mWidget->Destroyed(), - "NativeKey tries to dispatch a plugin event on destroyed widget"); - mWidget->DispatchPluginEvent(mFollowingCharMsgs[i]); - if (mWidget->Destroyed() || IsFocusedWindowChanged()) { - MOZ_LOG( - sNativeKeyLogger, LogLevel::Info, - ("%p NativeKey::MaybeDispatchPluginEventsForRemovedCharMessages(), " - "%uth plugin event caused %s", - this, i + 1, - mWidget->Destroyed() ? "destroying the widget" : "focus change")); - return true; - } - MOZ_LOG( - sNativeKeyLogger, LogLevel::Info, - ("%p NativeKey::MaybeDispatchPluginEventsForRemovedCharMessages(), " - "dispatched %uth plugin event", - this, i + 1)); - } - - // Dispatch odd char messages which are caused by ATOK or WXG (both of them - // are Japanese IME) and removed by RemoveFollowingOddCharMessages(). - for (size_t i = 0; - i < mRemovedOddCharMsgs.Length() && mWidget->ShouldDispatchPluginEvent(); - ++i) { - MOZ_LOG( - sNativeKeyLogger, LogLevel::Info, - ("%p NativeKey::MaybeDispatchPluginEventsForRemovedCharMessages(), " - "dispatching %uth plugin event for odd char message, %s...", - this, i + 1, ToString(mFollowingCharMsgs[i]).get())); - MOZ_RELEASE_ASSERT( - !mWidget->Destroyed(), - "NativeKey tries to dispatch a plugin event on destroyed widget"); - mWidget->DispatchPluginEvent(mRemovedOddCharMsgs[i]); - if (mWidget->Destroyed() || IsFocusedWindowChanged()) { - MOZ_LOG( - sNativeKeyLogger, LogLevel::Info, - ("%p NativeKey::MaybeDispatchPluginEventsForRemovedCharMessages(), " - "%uth plugin event for odd char message caused %s", - this, i + 1, - mWidget->Destroyed() ? "destroying the widget" : "focus change")); - return true; - } - MOZ_LOG( - sNativeKeyLogger, LogLevel::Info, - ("%p NativeKey::MaybeDispatchPluginEventsForRemovedCharMessages(), " - "dispatched %uth plugin event for odd char message", - this, i + 1)); - } - - return false; -} - void NativeKey::ComputeInputtingStringWithKeyboardLayout() { KeyboardLayout* keyboardLayout = KeyboardLayout::GetInstance(); diff --git a/widget/windows/KeyboardLayout.h b/widget/windows/KeyboardLayout.h index cce1865eecde..d5b4cbb509d7 100644 --- a/widget/windows/KeyboardLayout.h +++ b/widget/windows/KeyboardLayout.h @@ -753,14 +753,6 @@ class MOZ_STACK_CLASS NativeKey final { */ bool DispatchKeyPressEventsWithoutCharMessage() const; - /** - * MaybeDispatchPluginEventsForRemovedCharMessages() dispatches plugin events - * for removed char messages when a windowless plugin has focus. - * Returns true if the widget is destroyed or blurred during dispatching a - * plugin event. - */ - bool MaybeDispatchPluginEventsForRemovedCharMessages() const; - /** * Checkes whether the key event down message is handled without following * WM_CHAR messages. For example, if following WM_CHAR message indicates diff --git a/widget/windows/nsWindowBase.cpp b/widget/windows/nsWindowBase.cpp index 0d3cd6a6d336..a9c9d2b53ec3 100644 --- a/widget/windows/nsWindowBase.cpp +++ b/widget/windows/nsWindowBase.cpp @@ -19,23 +19,7 @@ static const wchar_t kUser32LibName[] = L"user32.dll"; bool nsWindowBase::sTouchInjectInitialized = false; InjectTouchInputPtr nsWindowBase::sInjectTouchFuncPtr; -bool nsWindowBase::DispatchPluginEvent(const MSG& aMsg) { - if (!ShouldDispatchPluginEvent()) { - return false; - } - WidgetPluginEvent pluginEvent(true, ePluginInputEvent, this); - LayoutDeviceIntPoint point(0, 0); - InitEvent(pluginEvent, &point); - NPEvent npEvent; - npEvent.event = aMsg.message; - npEvent.wParam = aMsg.wParam; - npEvent.lParam = aMsg.lParam; - pluginEvent.mPluginEvent.Copy(npEvent); - pluginEvent.mRetargetToFocusedDocument = true; - return DispatchWindowEvent(&pluginEvent); -} - -bool nsWindowBase::ShouldDispatchPluginEvent() { return PluginHasFocus(); } +bool nsWindowBase::DispatchPluginEvent(const MSG& aMsg) { return false; } // static bool nsWindowBase::InitTouchInjection() { diff --git a/widget/windows/nsWindowBase.h b/widget/windows/nsWindowBase.h index 69f043c05049..02a91b0b7cbf 100644 --- a/widget/windows/nsWindowBase.h +++ b/widget/windows/nsWindowBase.h @@ -85,11 +85,6 @@ class nsWindowBase : public nsBaseWidget { */ virtual bool DispatchPluginEvent(const MSG& aMsg); - /* - * Returns true if this should dispatch a plugin event. - */ - bool ShouldDispatchPluginEvent(); - /* * Touch input injection apis */