Bug 1683226 - part 13: Get rid of nsIWidget::StartPluginFocused() r=m_kato,ipc-reviewers,mccr8
Depends on D100386 Differential Revision: https://phabricator.services.mozilla.com/D100387
This commit is contained in:
@@ -3132,18 +3132,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvRequestIMEToCommitComposition(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvStartPluginIME(
|
||||
const WidgetKeyboardEvent& aKeyboardEvent, const int32_t& aPanelX,
|
||||
const int32_t& aPanelY, nsString* aCommitted) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget) {
|
||||
return IPC_OK();
|
||||
}
|
||||
Unused << widget->StartPluginIME(aKeyboardEvent, (int32_t&)aPanelX,
|
||||
(int32_t&)aPanelY, *aCommitted);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvGetInputContext(
|
||||
widget::IMEState* aState) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
|
||||
@@ -379,10 +379,6 @@ class BrowserParent final : public PBrowserParent,
|
||||
mozilla::ipc::IPCResult RecvRequestIMEToCommitComposition(
|
||||
const bool& aCancel, bool* aIsCommitted, nsString* aCommittedString);
|
||||
|
||||
mozilla::ipc::IPCResult RecvStartPluginIME(
|
||||
const WidgetKeyboardEvent& aKeyboardEvent, const int32_t& aPanelX,
|
||||
const int32_t& aPanelY, nsString* aCommitted);
|
||||
|
||||
mozilla::ipc::IPCResult RecvGetInputContext(widget::IMEState* aIMEState);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetInputContext(
|
||||
|
||||
@@ -365,19 +365,6 @@ parent:
|
||||
*/
|
||||
nested(inside_cpow) async OnEventNeedingAckHandled(EventMessage message);
|
||||
|
||||
/**
|
||||
* Tells chrome to start plugin IME. If this results in a string getting
|
||||
* committed, the result is in aCommitted (otherwise aCommitted is empty).
|
||||
*
|
||||
* aKeyboardEvent The event with which plugin IME is to be started
|
||||
* panelX and panelY Location in screen coordinates of the IME input panel
|
||||
* (should be just under the plugin)
|
||||
* aCommitted The string committed during IME -- otherwise empty
|
||||
*/
|
||||
nested(inside_cpow) sync StartPluginIME(WidgetKeyboardEvent aKeyboardEvent,
|
||||
int32_t panelX, int32_t panelY)
|
||||
returns (nsString aCommitted);
|
||||
|
||||
/**
|
||||
* Notifies the parent process of native key event data received in a
|
||||
* plugin process directly.
|
||||
|
||||
@@ -1941,30 +1941,6 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(
|
||||
int16_t response = kNPEventNotHandled;
|
||||
mInstance->HandleEvent(&cocoaEvent, &response,
|
||||
NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
|
||||
if ((response == kNPEventStartIME) &&
|
||||
(cocoaEvent.type == NPCocoaEventKeyDown)) {
|
||||
nsIWidget* widget = mPluginFrame->GetNearestWidget();
|
||||
if (widget) {
|
||||
const WidgetKeyboardEvent* keyEvent = anEvent.AsKeyboardEvent();
|
||||
double screenX, screenY;
|
||||
ConvertPoint(0.0, mPluginFrame->GetScreenRect().height,
|
||||
NPCoordinateSpacePlugin, &screenX, &screenY,
|
||||
NPCoordinateSpaceScreen);
|
||||
nsAutoString outText;
|
||||
if (NS_SUCCEEDED(
|
||||
widget->StartPluginIME(*keyEvent, screenX, screenY, outText)) &&
|
||||
!outText.IsEmpty()) {
|
||||
CFStringRef cfString = ::CFStringCreateWithCharacters(
|
||||
kCFAllocatorDefault,
|
||||
reinterpret_cast<const UniChar*>(outText.get()), outText.Length());
|
||||
NPCocoaEvent textEvent;
|
||||
InitializeNPCocoaEvent(&textEvent);
|
||||
textEvent.type = NPCocoaEventTextInput;
|
||||
textEvent.data.text.text = (NPNSString*)cfString;
|
||||
mInstance->HandleEvent(&textEvent, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool handled = (response == kNPEventHandled || response == kNPEventStartIME);
|
||||
bool leftMouseButtonDown =
|
||||
|
||||
@@ -810,8 +810,6 @@ description = legacy sync IPC - please add detailed description
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PBrowser::RequestIMEToCommitComposition]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PBrowser::StartPluginIME]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PBrowser::GetInputContext]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PBrowser::RequestNativeKeyBindings]
|
||||
|
||||
@@ -649,37 +649,6 @@ nsresult PuppetWidget::RequestIMEToCommitComposition(bool aCancel) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult PuppetWidget::StartPluginIME(const WidgetKeyboardEvent& aKeyboardEvent,
|
||||
int32_t aPanelX, int32_t aPanelY,
|
||||
nsString& aCommitted) {
|
||||
DebugOnly<bool> propagationAlreadyStopped =
|
||||
aKeyboardEvent.mFlags.mPropagationStopped;
|
||||
DebugOnly<bool> immediatePropagationAlreadyStopped =
|
||||
aKeyboardEvent.mFlags.mImmediatePropagationStopped;
|
||||
if (!mBrowserChild || !mBrowserChild->SendStartPluginIME(
|
||||
aKeyboardEvent, aPanelX, aPanelY, &aCommitted)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// BrowserChild::SendStartPluginIME() sends back the keyboard event to the
|
||||
// main process synchronously. At this time,
|
||||
// ParamTraits<WidgetEvent>::Write() marks the event as "posted to remote
|
||||
// process". However, this is not correct here since the event has been
|
||||
// handled synchronously in the main process. So, we adjust the cross process
|
||||
// dispatching state here.
|
||||
const_cast<WidgetKeyboardEvent&>(aKeyboardEvent)
|
||||
.ResetCrossProcessDispatchingState();
|
||||
// Although it shouldn't occur in content process,
|
||||
// ResetCrossProcessDispatchingState() may reset propagation state too
|
||||
// if the event was posted to a remote process and we're waiting its
|
||||
// result. So, if you saw hitting the following assertions, you'd
|
||||
// need to restore the propagation state too.
|
||||
MOZ_ASSERT(propagationAlreadyStopped ==
|
||||
aKeyboardEvent.mFlags.mPropagationStopped);
|
||||
MOZ_ASSERT(immediatePropagationAlreadyStopped ==
|
||||
aKeyboardEvent.mFlags.mImmediatePropagationStopped);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// When this widget caches input context and currently managed by
|
||||
// IMEStateManager, the cache is valid.
|
||||
bool PuppetWidget::HaveValidInputContextCache() const {
|
||||
|
||||
@@ -248,10 +248,6 @@ class PuppetWidget : public nsBaseWidget,
|
||||
|
||||
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
||||
|
||||
[[nodiscard]] virtual nsresult StartPluginIME(
|
||||
const mozilla::WidgetKeyboardEvent& aKeyboardEvent, int32_t aPanelX,
|
||||
int32_t aPanelY, nsString& aCommitted) override;
|
||||
|
||||
virtual nsresult SynthesizeNativeKeyEvent(
|
||||
int32_t aNativeKeyboardLayout, int32_t aNativeKeyCode,
|
||||
uint32_t aModifierFlags, const nsAString& aCharacters,
|
||||
|
||||
@@ -479,10 +479,6 @@ class nsChildView final : public nsBaseWidget {
|
||||
return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual nsresult StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
||||
int32_t aPanelX, int32_t aPanelY,
|
||||
nsString& aCommitted) override;
|
||||
|
||||
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
||||
|
||||
void DispatchAPZWheelInputEvent(mozilla::InputData& aEvent, bool aCanTriggerSwipe);
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#include "nsMenuUtilsX.h"
|
||||
#include "nsMenuBarX.h"
|
||||
#include "NativeKeyBindings.h"
|
||||
#include "ComplexTextInputPanel.h"
|
||||
|
||||
#include "gfxContext.h"
|
||||
#include "gfxQuartzSurface.h"
|
||||
@@ -1471,27 +1470,6 @@ bool nsChildView::HasPendingInputEvent() { return DoHasPendingInputEvent(); }
|
||||
|
||||
#pragma mark -
|
||||
|
||||
nsresult nsChildView::StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
||||
int32_t aPanelX, int32_t aPanelY, nsString& aCommitted) {
|
||||
NS_ENSURE_TRUE(mView, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
ComplexTextInputPanel* ctiPanel = ComplexTextInputPanel::GetSharedComplexTextInputPanel();
|
||||
|
||||
ctiPanel->PlacePanel(aPanelX, aPanelY);
|
||||
// We deliberately don't use TextInputHandler::GetCurrentKeyEvent() to
|
||||
// obtain the NSEvent* we pass to InterpretKeyEvent(). This works fine in
|
||||
// non-e10s mode. But in e10s mode TextInputHandler::HandleKeyDownEvent()
|
||||
// has already returned, so the relevant KeyEventState* (and its NSEvent*)
|
||||
// is already out of scope. Furthermore we don't *need* to use it.
|
||||
// StartPluginIME() is only ever called to start a new IME session when none
|
||||
// currently exists. So nested IME should never reach here, and so it should
|
||||
// be fine to use the last key-down event received by -[ChildView keyDown:]
|
||||
// (as we currently do).
|
||||
ctiPanel->InterpretKeyEvent([mView lastKeyDownEvent], aCommitted);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsChildView::SetInputContext(const InputContext& aContext, const InputContextAction& aAction) {
|
||||
NS_ENSURE_TRUE_VOID(mTextInputHandler);
|
||||
|
||||
|
||||
@@ -287,11 +287,6 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
nsresult NotifyIME(const IMENotification& aIMENotification) final;
|
||||
[[nodiscard]] virtual nsresult StartPluginIME(
|
||||
const mozilla::WidgetKeyboardEvent& aKeyboardEvent, int32_t aPanelX,
|
||||
int32_t aPanelY, nsString& aCommitted) override {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
[[nodiscard]] virtual nsresult AttachNativeKeyEvent(
|
||||
mozilla::WidgetKeyboardEvent& aEvent) override {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
@@ -1839,19 +1839,6 @@ class nsIWidget : public nsISupports {
|
||||
*/
|
||||
virtual nsresult NotifyIME(const IMENotification& aIMENotification) = 0;
|
||||
|
||||
/**
|
||||
* Start plugin IME. If this results in a string getting committed, the
|
||||
* result is in aCommitted (otherwise aCommitted is empty).
|
||||
*
|
||||
* aKeyboardEvent The event with which plugin IME is to be started
|
||||
* panelX and panelY Location in screen coordinates of the IME input panel
|
||||
* (should be just under the plugin)
|
||||
* aCommitted The string committed during IME -- otherwise empty
|
||||
*/
|
||||
[[nodiscard]] virtual nsresult StartPluginIME(
|
||||
const mozilla::WidgetKeyboardEvent& aKeyboardEvent, int32_t aPanelX,
|
||||
int32_t aPanelY, nsString& aCommitted) = 0;
|
||||
|
||||
/**
|
||||
* MaybeDispatchInitialFocusEvent will dispatch a focus event after creation
|
||||
* of the widget, in the event that we were not able to observe and respond to
|
||||
|
||||
Reference in New Issue
Block a user