зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1689034 - part 1: Get rid of communication part between plugin process and widget in the main process r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D103138
This commit is contained in:
Родитель
32d4e4c266
Коммит
796bb2f86e
|
@ -68,7 +68,6 @@ const ErrorCodes = {
|
|||
NS_ERROR_GFX_PRINTER_DOC_IS_BUSY: 0x80480007,
|
||||
NS_ERROR_GFX_CMAP_MALFORMED: 0x80480033,
|
||||
NS_SUCCESS_EVENT_CONSUMED: 0x490001,
|
||||
NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY: 0x490002,
|
||||
NS_BINDING_SUCCEEDED: 0x0,
|
||||
NS_BINDING_FAILED: 0x804b0001,
|
||||
NS_BINDING_ABORTED: 0x804b0002,
|
||||
|
|
|
@ -2613,15 +2613,6 @@ mozilla::ipc::IPCResult BrowserChild::RecvNavigateByKey(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserChild::RecvHandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, const bool& aIsConsumed) {
|
||||
if (NS_WARN_IF(!mPuppetWidget)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
mPuppetWidget->HandledWindowedPluginKeyEvent(aKeyEventData, aIsConsumed);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool BrowserChild::InitBrowserChildMessageManager() {
|
||||
if (!mBrowserChildMessageManager) {
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(WebNavigation());
|
||||
|
|
|
@ -536,9 +536,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
|||
mozilla::ipc::IPCResult RecvHandleAccessKey(const WidgetKeyboardEvent& aEvent,
|
||||
nsTArray<uint32_t>&& aCharCodes);
|
||||
|
||||
mozilla::ipc::IPCResult RecvHandledWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData, const bool& aIsConsumed);
|
||||
|
||||
mozilla::ipc::IPCResult RecvPrintPreview(
|
||||
const PrintData& aPrintData,
|
||||
const mozilla::Maybe<uint64_t>& aSourceOuterWindowID,
|
||||
|
|
|
@ -2270,42 +2270,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnEventNeedingAckHandled(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
void BrowserParent::HandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, bool aIsConsumed) {
|
||||
DebugOnly<bool> ok =
|
||||
SendHandledWindowedPluginKeyEvent(aKeyEventData, aIsConsumed);
|
||||
NS_WARNING_ASSERTION(ok, "SendHandledWindowedPluginKeyEvent failed");
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvOnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData) {
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (NS_WARN_IF(!widget)) {
|
||||
// Notifies the plugin process of the key event being not consumed by us.
|
||||
HandledWindowedPluginKeyEvent(aKeyEventData, false);
|
||||
return IPC_OK();
|
||||
}
|
||||
nsresult rv = widget->OnWindowedPluginKeyEvent(aKeyEventData, this);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
// Notifies the plugin process of the key event being not consumed by us.
|
||||
HandledWindowedPluginKeyEvent(aKeyEventData, false);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
// If the key event is posted to another process, we need to wait a call
|
||||
// of HandledWindowedPluginKeyEvent(). So, nothing to do here in this case.
|
||||
if (rv == NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
// Otherwise, the key event is handled synchronously. Let's notify the
|
||||
// plugin process of the key event's result.
|
||||
bool consumed = (rv == NS_SUCCESS_EVENT_CONSUMED);
|
||||
HandledWindowedPluginKeyEvent(aKeyEventData, consumed);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserParent::RecvRequestFocus(
|
||||
const bool& aCanRaise, const CallerType aCallerType) {
|
||||
LOGBROWSERFOCUS(("RecvRequestFocus %p, aCanRaise: %d", this, aCanRaise));
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "nsIAuthPromptProvider.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIKeyEventInPluginCallback.h"
|
||||
#include "nsIRemoteTab.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
@ -82,7 +81,6 @@ class StructuredCloneData;
|
|||
class BrowserParent final : public PBrowserParent,
|
||||
public nsIDOMEventListener,
|
||||
public nsIAuthPromptProvider,
|
||||
public nsIKeyEventInPluginCallback,
|
||||
public nsSupportsWeakReference,
|
||||
public TabContext,
|
||||
public LiveResizeListener {
|
||||
|
@ -383,13 +381,6 @@ class BrowserParent final : public PBrowserParent,
|
|||
const widget::InputContext& aContext,
|
||||
const widget::InputContextAction& aAction);
|
||||
|
||||
// See nsIKeyEventInPluginCallback
|
||||
virtual void HandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, bool aIsConsumed) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvOnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData);
|
||||
|
||||
mozilla::ipc::IPCResult RecvRequestFocus(const bool& aCanRaise,
|
||||
const CallerType aCallerType);
|
||||
|
||||
|
|
|
@ -364,16 +364,6 @@ parent:
|
|||
*/
|
||||
nested(inside_cpow) async OnEventNeedingAckHandled(EventMessage message);
|
||||
|
||||
/**
|
||||
* Notifies the parent process of native key event data received in a
|
||||
* plugin process directly.
|
||||
*
|
||||
* aKeyEventData The native key event data. The actual type copied into
|
||||
* NativeEventData depending on the caller. Please check
|
||||
* PluginInstanceChild.
|
||||
*/
|
||||
nested(inside_cpow) async OnWindowedPluginKeyEvent(NativeEventData aKeyEventData);
|
||||
|
||||
/**
|
||||
* Request that the parent process move focus to the browser's frame. If
|
||||
* canRaise is true, the window can be raised if it is inactive.
|
||||
|
@ -944,18 +934,6 @@ child:
|
|||
async HandleAccessKey(WidgetKeyboardEvent event,
|
||||
uint32_t[] charCodes);
|
||||
|
||||
/**
|
||||
* HandledWindowedPluginKeyEvent() is always called after posting a native
|
||||
* key event with OnWindowedPluginKeyEvent().
|
||||
*
|
||||
* @param aKeyEventData The key event which was posted to the parent
|
||||
* process.
|
||||
* @param aIsConsumed true if aKeyEventData is consumed in the
|
||||
* parent process. Otherwise, false.
|
||||
*/
|
||||
async HandledWindowedPluginKeyEvent(NativeEventData aKeyEventData,
|
||||
bool aIsConsumed);
|
||||
|
||||
/**
|
||||
* Tell the child to create a print preview document in this browser, or
|
||||
* to update the existing print preview document with new print settings.
|
||||
|
|
|
@ -681,20 +681,6 @@ nsresult nsNPAPIPluginInstance::GetScrollCaptureContainer(
|
|||
}
|
||||
#endif
|
||||
|
||||
nsresult nsNPAPIPluginInstance::HandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, bool aIsConsumed) {
|
||||
if (NS_WARN_IF(!mPlugin)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PluginLibrary* library = mPlugin->GetLibrary();
|
||||
if (NS_WARN_IF(!library)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return library->HandledWindowedPluginKeyEvent(&mNPP, aKeyEventData,
|
||||
aIsConsumed);
|
||||
}
|
||||
|
||||
void nsNPAPIPluginInstance::DidComposite() {
|
||||
if (RUNNING != mRunning) return;
|
||||
|
||||
|
|
|
@ -127,8 +127,6 @@ class nsNPAPIPluginInstance final : public nsIAudioChannelAgentCallback,
|
|||
nsresult GetScrollCaptureContainer(
|
||||
mozilla::layers::ImageContainer** aContainer);
|
||||
#endif
|
||||
nsresult HandledWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData, bool aIsConsumed);
|
||||
nsPluginInstanceOwner* GetOwner();
|
||||
void SetOwner(nsPluginInstanceOwner* aOwner);
|
||||
void DidComposite();
|
||||
|
|
|
@ -290,7 +290,7 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() {
|
|||
|
||||
NS_IMPL_ISUPPORTS(nsPluginInstanceOwner, nsIPluginInstanceOwner,
|
||||
nsIDOMEventListener, nsIPrivacyTransitionObserver,
|
||||
nsIKeyEventInPluginCallback, nsISupportsWeakReference)
|
||||
nsISupportsWeakReference)
|
||||
|
||||
nsresult nsPluginInstanceOwner::SetInstance(nsNPAPIPluginInstance* aInstance) {
|
||||
NS_ASSERTION(!mInstance || !aInstance,
|
||||
|
@ -700,23 +700,6 @@ bool nsPluginInstanceOwner::RequestCommitOrCancel(bool aCommitted) {
|
|||
|
||||
#endif // #ifdef XP_WIN
|
||||
|
||||
void nsPluginInstanceOwner::HandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, bool aIsConsumed) {
|
||||
if (NS_WARN_IF(!mInstance)) {
|
||||
return;
|
||||
}
|
||||
DebugOnly<nsresult> rv =
|
||||
mInstance->HandledWindowedPluginKeyEvent(aKeyEventData, aIsConsumed);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "HandledWindowedPluginKeyEvent fail");
|
||||
}
|
||||
|
||||
void nsPluginInstanceOwner::OnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData) {
|
||||
// Notifies the plugin process of the key event being not consumed by us.
|
||||
HandledWindowedPluginKeyEvent(aKeyEventData, false);
|
||||
return;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::SetEventModel(int32_t eventModel) {
|
||||
#ifdef XP_MACOSX
|
||||
mEventModel = static_cast<NPEventModel>(eventModel);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/dom/HTMLObjectElementBinding.h"
|
||||
#include "npapi.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIKeyEventInPluginCallback.h"
|
||||
#include "nsIPluginInstanceOwner.h"
|
||||
#include "nsIPrivacyTransitionObserver.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
@ -54,7 +53,6 @@ using mozilla::widget::PuppetWidget;
|
|||
class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
|
||||
public nsIDOMEventListener,
|
||||
public nsIPrivacyTransitionObserver,
|
||||
public nsIKeyEventInPluginCallback,
|
||||
public nsSupportsWeakReference {
|
||||
public:
|
||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||
|
@ -254,19 +252,6 @@ class nsPluginInstanceOwner final : public nsIPluginInstanceOwner,
|
|||
int32_t* aLength);
|
||||
bool RequestCommitOrCancel(bool aCommitted);
|
||||
|
||||
// See nsIKeyEventInPluginCallback
|
||||
virtual void HandledWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData, bool aIsConsumed) override;
|
||||
|
||||
/**
|
||||
* OnWindowedPluginKeyEvent() is called when the plugin process receives
|
||||
* native key event directly.
|
||||
*
|
||||
* @param aNativeKeyData The key event which was received by the
|
||||
* plugin process directly.
|
||||
*/
|
||||
void OnWindowedPluginKeyEvent(const mozilla::NativeEventData& aNativeKeyData);
|
||||
|
||||
void GetCSSZoomFactor(float* result);
|
||||
|
||||
private:
|
||||
|
|
|
@ -132,16 +132,6 @@ child:
|
|||
intr NPP_Destroy()
|
||||
returns (NPError rv);
|
||||
|
||||
// HandledWindowedPluginKeyEvent() is always called after posting a native
|
||||
// key event with OnWindowedPluginKeyEvent().
|
||||
//
|
||||
// @param aKeyEventData The key event which was posted to the parent
|
||||
// process.
|
||||
// @param aIsConsumed true if aKeyEventData is consumed in the
|
||||
// parent process. Otherwise, false.
|
||||
async HandledWindowedPluginKeyEvent(NativeEventData aKeyEventData,
|
||||
bool aIsConsumed);
|
||||
|
||||
parent:
|
||||
intr NPN_GetValue_NPNVWindowNPObject()
|
||||
returns (nullable PPluginScriptableObject value, NPError result);
|
||||
|
@ -256,13 +246,6 @@ parent:
|
|||
returns (uint8_t[] aDist, int32_t aLength);
|
||||
async RequestCommitOrCancel(bool aCommitted);
|
||||
|
||||
// Notifies the parent process of a plugin instance receiving key event
|
||||
// directly.
|
||||
//
|
||||
// @param aKeyEventData The native key event which will be sent to
|
||||
// plugin from native event handler.
|
||||
async OnWindowedPluginKeyEvent(NativeEventData aKeyEventData);
|
||||
|
||||
both:
|
||||
async PPluginScriptableObject();
|
||||
|
||||
|
|
|
@ -57,8 +57,6 @@ using namespace mozilla::widget;
|
|||
# include <windowsx.h>
|
||||
|
||||
# include "mozilla/widget/WinMessages.h"
|
||||
# include "mozilla/widget/WinModifierKeyState.h"
|
||||
# include "mozilla/widget/WinNativeEventData.h"
|
||||
# include "nsWindowsDllInterceptor.h"
|
||||
# include "X11UndefineNone.h"
|
||||
|
||||
|
@ -116,8 +114,6 @@ static RefPtr<DrawTarget> CreateDrawTargetForSurface(gfxASurface* aSurface) {
|
|||
return drawTarget;
|
||||
}
|
||||
|
||||
bool PluginInstanceChild::sIsIMEComposing = false;
|
||||
|
||||
PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
|
||||
const nsCString& aMimeType,
|
||||
const nsTArray<nsCString>& aNames,
|
||||
|
@ -132,8 +128,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
|
|||
#endif
|
||||
,
|
||||
mCSSZoomFactor(0.0),
|
||||
mPostingKeyEvents(0),
|
||||
mPostingKeyEventsOutdated(0),
|
||||
mDrawingModel(kDefaultDrawingModel),
|
||||
mCurrentDirectSurface(nullptr),
|
||||
mAsyncInvalidateMutex("PluginInstanceChild::mAsyncInvalidateMutex"),
|
||||
|
@ -180,7 +174,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
|
|||
mDestroyed(false)
|
||||
#ifdef XP_WIN
|
||||
,
|
||||
mLastKeyEventConsumed(false),
|
||||
mLastEnableIMEState(true)
|
||||
#endif // #ifdef XP_WIN
|
||||
,
|
||||
|
@ -1286,92 +1279,6 @@ bool PluginInstanceChild::Initialize() {
|
|||
return true;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginInstanceChild::RecvHandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, const bool& aIsConsumed) {
|
||||
#if defined(OS_WIN)
|
||||
const WinNativeKeyEventData* eventData =
|
||||
static_cast<const WinNativeKeyEventData*>(aKeyEventData);
|
||||
switch (eventData->mMessage) {
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
mLastKeyEventConsumed = aIsConsumed;
|
||||
break;
|
||||
case WM_CHAR:
|
||||
case WM_SYSCHAR:
|
||||
case WM_DEADCHAR:
|
||||
case WM_SYSDEADCHAR:
|
||||
// If preceding keydown or keyup event is consumed by the chrome
|
||||
// process, we should consume WM_*CHAR messages too.
|
||||
if (mLastKeyEventConsumed) {
|
||||
return IPC_OK();
|
||||
}
|
||||
default:
|
||||
MOZ_CRASH("Needs to handle all messages posted to the parent");
|
||||
}
|
||||
#endif // #if defined(OS_WIN)
|
||||
|
||||
// Unknown key input shouldn't be sent to plugin for security.
|
||||
// XXX Is this possible if a plugin process which posted the message
|
||||
// already crashed and this plugin process is recreated?
|
||||
if (NS_WARN_IF(!mPostingKeyEvents && !mPostingKeyEventsOutdated)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
// If there is outdated posting key events, we should consume the key
|
||||
// events.
|
||||
if (mPostingKeyEventsOutdated) {
|
||||
mPostingKeyEventsOutdated--;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mPostingKeyEvents--;
|
||||
|
||||
// If composition has been started after posting the key event,
|
||||
// we should discard the event since if we send the event to plugin,
|
||||
// the plugin may be confused and the result may be broken because
|
||||
// the event order is shuffled.
|
||||
if (aIsConsumed || sIsIMEComposing) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
UINT message = 0;
|
||||
switch (eventData->mMessage) {
|
||||
case WM_KEYDOWN:
|
||||
message = MOZ_WM_KEYDOWN;
|
||||
break;
|
||||
case WM_SYSKEYDOWN:
|
||||
message = MOZ_WM_SYSKEYDOWN;
|
||||
break;
|
||||
case WM_KEYUP:
|
||||
message = MOZ_WM_KEYUP;
|
||||
break;
|
||||
case WM_SYSKEYUP:
|
||||
message = MOZ_WM_SYSKEYUP;
|
||||
break;
|
||||
case WM_CHAR:
|
||||
message = MOZ_WM_CHAR;
|
||||
break;
|
||||
case WM_SYSCHAR:
|
||||
message = MOZ_WM_SYSCHAR;
|
||||
break;
|
||||
case WM_DEADCHAR:
|
||||
message = MOZ_WM_DEADCHAR;
|
||||
break;
|
||||
case WM_SYSDEADCHAR:
|
||||
message = MOZ_WM_SYSDEADCHAR;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Needs to handle all messages posted to the parent");
|
||||
}
|
||||
PluginWindowProcInternal(mPluginWindowHWND, message, eventData->mWParam,
|
||||
eventData->mLParam);
|
||||
#endif
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
static const TCHAR kWindowClassName[] = TEXT("GeckoPluginWindow");
|
||||
|
@ -1513,66 +1420,17 @@ LRESULT CALLBACK PluginInstanceChild::PluginWindowProcInternal(HWND hWnd,
|
|||
break;
|
||||
}
|
||||
|
||||
case WM_SETFOCUS:
|
||||
// If this gets focus, ensure that there is no pending key events.
|
||||
// Even if there were, we should ignore them for performance reason.
|
||||
// Although, such case shouldn't occur.
|
||||
NS_WARNING_ASSERTION(self->mPostingKeyEvents == 0, "pending events");
|
||||
self->mPostingKeyEvents = 0;
|
||||
self->mLastKeyEventConsumed = false;
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
if (self->MaybePostKeyMessage(message, wParam, lParam)) {
|
||||
// If PreHandleKeyMessage() posts the message to the parent
|
||||
// process, we need to wait RecvOnKeyEventHandledBeforePlugin()
|
||||
// to be called.
|
||||
return 0; // Consume current message temporarily.
|
||||
}
|
||||
break;
|
||||
|
||||
case MOZ_WM_KEYDOWN:
|
||||
message = WM_KEYDOWN;
|
||||
break;
|
||||
case MOZ_WM_SYSKEYDOWN:
|
||||
message = WM_SYSKEYDOWN;
|
||||
break;
|
||||
case MOZ_WM_KEYUP:
|
||||
message = WM_KEYUP;
|
||||
break;
|
||||
case MOZ_WM_SYSKEYUP:
|
||||
message = WM_SYSKEYUP;
|
||||
break;
|
||||
case MOZ_WM_CHAR:
|
||||
message = WM_CHAR;
|
||||
break;
|
||||
case MOZ_WM_SYSCHAR:
|
||||
message = WM_SYSCHAR;
|
||||
break;
|
||||
case MOZ_WM_DEADCHAR:
|
||||
message = WM_DEADCHAR;
|
||||
break;
|
||||
case MOZ_WM_SYSDEADCHAR:
|
||||
message = WM_SYSDEADCHAR;
|
||||
break;
|
||||
|
||||
case WM_IME_STARTCOMPOSITION:
|
||||
isIMECompositionMessage = true;
|
||||
sIsIMEComposing = true;
|
||||
break;
|
||||
case WM_IME_ENDCOMPOSITION:
|
||||
isIMECompositionMessage = true;
|
||||
sIsIMEComposing = false;
|
||||
break;
|
||||
case WM_IME_COMPOSITION:
|
||||
isIMECompositionMessage = true;
|
||||
// XXX Some old IME may not send WM_IME_COMPOSITION_START or
|
||||
// WM_IME_COMPSOITION_END properly. So, we need to check
|
||||
// WM_IME_COMPSOITION and if it includes commit string.
|
||||
sIsIMEComposing = !(lParam & GCS_RESULTSTR);
|
||||
break;
|
||||
|
||||
// The plugin received keyboard focus, let the parent know so the dom
|
||||
|
@ -1582,15 +1440,6 @@ LRESULT CALLBACK PluginInstanceChild::PluginWindowProcInternal(HWND hWnd,
|
|||
break;
|
||||
}
|
||||
|
||||
// When a composition is committed, there may be pending key
|
||||
// events which were posted to the parent process before starting
|
||||
// the composition. Then, we shouldn't handle it since they are
|
||||
// now outdated.
|
||||
if (isIMECompositionMessage && !sIsIMEComposing) {
|
||||
self->mPostingKeyEventsOutdated += self->mPostingKeyEvents;
|
||||
self->mPostingKeyEvents = 0;
|
||||
}
|
||||
|
||||
// Prevent lockups due to plugins making rpc calls when the parent
|
||||
// is making a synchronous SendMessage call to the child window. Add
|
||||
// more messages as needed.
|
||||
|
@ -1647,89 +1496,6 @@ LRESULT CALLBACK PluginInstanceChild::PluginWindowProcInternal(HWND hWnd,
|
|||
return res;
|
||||
}
|
||||
|
||||
bool PluginInstanceChild::ShouldPostKeyMessage(UINT message, WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
// If there is a composition, we shouldn't post the key message to the
|
||||
// parent process because we cannot handle IME messages asynchronously.
|
||||
// Therefore, if we posted key events to the parent process, the event
|
||||
// order of the posted key events and IME events are shuffled.
|
||||
if (sIsIMEComposing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there are some pending keyboard events which are not handled in
|
||||
// the parent process, we should post the message for avoiding to shuffle
|
||||
// the key event order.
|
||||
if (mPostingKeyEvents) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we are not waiting calls of RecvOnKeyEventHandledBeforePlugin(),
|
||||
// we don't need to post WM_*CHAR messages.
|
||||
switch (message) {
|
||||
case WM_CHAR:
|
||||
case WM_SYSCHAR:
|
||||
case WM_DEADCHAR:
|
||||
case WM_SYSDEADCHAR:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise, we should post key message which might match with a
|
||||
// shortcut key.
|
||||
ModifierKeyState modifierState;
|
||||
if (!modifierState.MaybeMatchShortcutKey()) {
|
||||
// For better UX, we shouldn't use IPC when user tries to
|
||||
// input character(s).
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ignore modifier key events and keys already handled by IME.
|
||||
switch (wParam) {
|
||||
case VK_SHIFT:
|
||||
case VK_CONTROL:
|
||||
case VK_MENU:
|
||||
case VK_LWIN:
|
||||
case VK_RWIN:
|
||||
case VK_CAPITAL:
|
||||
case VK_NUMLOCK:
|
||||
case VK_SCROLL:
|
||||
// Following virtual keycodes shouldn't come with WM_(SYS)KEY* message
|
||||
// but check it for avoiding unnecessary cross process communication.
|
||||
case VK_LSHIFT:
|
||||
case VK_RSHIFT:
|
||||
case VK_LCONTROL:
|
||||
case VK_RCONTROL:
|
||||
case VK_LMENU:
|
||||
case VK_RMENU:
|
||||
case VK_PROCESSKEY:
|
||||
case VK_PACKET:
|
||||
case 0xFF: // 0xFF could be sent with unidentified key by the layout.
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PluginInstanceChild::MaybePostKeyMessage(UINT message, WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
if (!ShouldPostKeyMessage(message, wParam, lParam)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ModifierKeyState modifierState;
|
||||
WinNativeKeyEventData winNativeKeyData(message, wParam, lParam,
|
||||
modifierState);
|
||||
NativeEventData nativeKeyData;
|
||||
nativeKeyData.Copy(winNativeKeyData);
|
||||
if (NS_WARN_IF(!SendOnWindowedPluginKeyEvent(nativeKeyData))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mPostingKeyEvents++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* set window long ptr hook for flash */
|
||||
|
||||
/*
|
||||
|
|
|
@ -207,9 +207,6 @@ class PluginInstanceChild : public PPluginInstanceChild {
|
|||
|
||||
void DoAsyncRedraw();
|
||||
|
||||
mozilla::ipc::IPCResult RecvHandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, const bool& aIsConsumed);
|
||||
|
||||
#if defined(XP_WIN)
|
||||
NPError DefaultAudioDeviceChanged(NPAudioDeviceChangeDetails& details);
|
||||
NPError AudioDeviceStateChanged(NPAudioDeviceStateChanged& aDeviceState);
|
||||
|
@ -311,8 +308,6 @@ class PluginInstanceChild : public PPluginInstanceChild {
|
|||
bool mWindowed;
|
||||
};
|
||||
|
||||
bool ShouldPostKeyMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
bool MaybePostKeyMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
#endif // #if defined(OS_WIN)
|
||||
const NPPluginFuncs* mPluginIface;
|
||||
nsCString mMimeType;
|
||||
|
@ -324,8 +319,6 @@ class PluginInstanceChild : public PPluginInstanceChild {
|
|||
double mContentsScaleFactor;
|
||||
#endif
|
||||
double mCSSZoomFactor;
|
||||
uint32_t mPostingKeyEvents;
|
||||
uint32_t mPostingKeyEventsOutdated;
|
||||
int16_t mDrawingModel;
|
||||
|
||||
NPAsyncSurface* mCurrentDirectSurface;
|
||||
|
@ -573,21 +566,11 @@ class PluginInstanceChild : public PPluginInstanceChild {
|
|||
bool mDestroyed;
|
||||
|
||||
#ifdef XP_WIN
|
||||
// WM_*CHAR messages are never consumed by chrome process's widget.
|
||||
// So, if preceding keydown or keyup event is consumed by reserved
|
||||
// shortcut key in the chrome process, we shouldn't send the following
|
||||
// WM_*CHAR messages to the plugin.
|
||||
bool mLastKeyEventConsumed;
|
||||
|
||||
// Store the last IME state by ImmAssociateContextEx. This will reset by
|
||||
// WM_KILLFOCUS;
|
||||
bool mLastEnableIMEState;
|
||||
#endif // #ifdef XP_WIN
|
||||
|
||||
// While IME in the process has composition, this is set to true.
|
||||
// Otherwise, false.
|
||||
static bool sIsIMEComposing;
|
||||
|
||||
// A counter is incremented by AutoStackHelper to indicate that there is an
|
||||
// active plugin call which should be preventing shutdown.
|
||||
public:
|
||||
|
|
|
@ -2279,28 +2279,6 @@ mozilla::ipc::IPCResult PluginInstanceParent::RecvRequestCommitOrCancel(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
nsresult PluginInstanceParent::HandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, bool aIsConsumed) {
|
||||
if (NS_WARN_IF(
|
||||
!SendHandledWindowedPluginKeyEvent(aKeyEventData, aIsConsumed))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginInstanceParent::RecvOnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData) {
|
||||
nsPluginInstanceOwner* owner = GetOwner();
|
||||
if (NS_WARN_IF(!owner)) {
|
||||
// Notifies the plugin process of the key event being not consumed
|
||||
// by us.
|
||||
HandledWindowedPluginKeyEvent(aKeyEventData, false);
|
||||
return IPC_OK();
|
||||
}
|
||||
owner->OnWindowedPluginKeyEvent(aKeyEventData);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void PluginInstanceParent::RecordDrawingModel() {
|
||||
int mode = -1;
|
||||
switch (mWindowType) {
|
||||
|
|
|
@ -283,12 +283,6 @@ class PluginInstanceParent : public PPluginInstanceParent {
|
|||
int32_t* aLength);
|
||||
mozilla::ipc::IPCResult RecvRequestCommitOrCancel(const bool& aCommitted);
|
||||
|
||||
// for reserved shortcut key handling with windowed plugin on Windows
|
||||
nsresult HandledWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData, bool aIsConsumed);
|
||||
mozilla::ipc::IPCResult RecvOnWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData);
|
||||
|
||||
private:
|
||||
// Create an appropriate platform surface for a background of size
|
||||
// |aSize|. Return true if successful.
|
||||
|
|
|
@ -103,9 +103,6 @@ class PluginLibrary {
|
|||
virtual nsresult GetScrollCaptureContainer(
|
||||
NPP aInstance, mozilla::layers::ImageContainer** aContainer) = 0;
|
||||
#endif
|
||||
virtual nsresult HandledWindowedPluginKeyEvent(
|
||||
NPP aInstance, const mozilla::NativeEventData& aNativeKeyData,
|
||||
bool aIsCOnsumed) = 0;
|
||||
|
||||
/**
|
||||
* The next three methods are the third leg in the trip to
|
||||
|
|
|
@ -1679,13 +1679,6 @@ nsresult PluginModuleParent::GetScrollCaptureContainer(
|
|||
}
|
||||
#endif
|
||||
|
||||
nsresult PluginModuleParent::HandledWindowedPluginKeyEvent(
|
||||
NPP aInstance, const NativeEventData& aNativeKeyData, bool aIsConsumed) {
|
||||
PluginInstanceParent* pip = PluginInstanceParent::Cast(aInstance);
|
||||
return pip ? pip->HandledWindowedPluginKeyEvent(aNativeKeyData, aIsConsumed)
|
||||
: NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void PluginModuleParent::OnInitFailure() {
|
||||
if (GetIPCChannel()->CanSend()) {
|
||||
Close();
|
||||
|
|
|
@ -211,10 +211,6 @@ class PluginModuleParent : public PPluginModuleParent,
|
|||
NPP aInstance, mozilla::layers::ImageContainer** aContainer) override;
|
||||
#endif
|
||||
|
||||
virtual nsresult HandledWindowedPluginKeyEvent(
|
||||
NPP aInstance, const mozilla::NativeEventData& aNativeKeyData,
|
||||
bool aIsConsumed) override;
|
||||
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs,
|
||||
NPError* error) override;
|
||||
|
|
|
@ -1184,31 +1184,6 @@ bool PuppetWidget::HasPendingInputEvent() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void PuppetWidget::HandledWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData, bool aIsConsumed) {
|
||||
if (NS_WARN_IF(mKeyEventInPluginCallbacks.IsEmpty())) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIKeyEventInPluginCallback> callback =
|
||||
mKeyEventInPluginCallbacks[0];
|
||||
MOZ_ASSERT(callback);
|
||||
mKeyEventInPluginCallbacks.RemoveElementAt(0);
|
||||
callback->HandledWindowedPluginKeyEvent(aKeyEventData, aIsConsumed);
|
||||
}
|
||||
|
||||
nsresult PuppetWidget::OnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData,
|
||||
nsIKeyEventInPluginCallback* aCallback) {
|
||||
if (NS_WARN_IF(!mBrowserChild)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
if (NS_WARN_IF(!mBrowserChild->SendOnWindowedPluginKeyEvent(aKeyEventData))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mKeyEventInPluginCallbacks.AppendElement(aCallback);
|
||||
return NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY;
|
||||
}
|
||||
|
||||
// TextEventDispatcherListener
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "nsBaseScreen.h"
|
||||
#include "nsBaseWidget.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIKeyEventInPluginCallback.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
@ -284,13 +283,6 @@ class PuppetWidget : public nsBaseWidget,
|
|||
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
|
||||
void HandledWindowedPluginKeyEvent(const NativeEventData& aKeyEventData,
|
||||
bool aIsConsumed);
|
||||
|
||||
virtual nsresult OnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData,
|
||||
nsIKeyEventInPluginCallback* aCallback) override;
|
||||
|
||||
virtual void LookUpDictionary(
|
||||
const nsAString& aText,
|
||||
const nsTArray<mozilla::FontRange>& aFontRangeArray,
|
||||
|
@ -375,8 +367,6 @@ class PuppetWidget : public nsBaseWidget,
|
|||
|
||||
ScreenIntMargin mSafeAreaInsets;
|
||||
|
||||
nsCOMArray<nsIKeyEventInPluginCallback> mKeyEventInPluginCallbacks;
|
||||
|
||||
RefPtr<TextEventDispatcherListener> mNativeTextEventDispatcherListener;
|
||||
|
||||
protected:
|
||||
|
@ -389,9 +379,9 @@ class PuppetWidget : public nsBaseWidget,
|
|||
// composition may have already been committed in the main process. In such
|
||||
// case, this will receive remaining composition events for the old
|
||||
// composition even after requesting to commit/cancel the old composition
|
||||
// but the TextComposition for the old composition has already been destroyed.
|
||||
// So, until this meets new eCompositionStart, following composition events
|
||||
// should be ignored if this is set to true.
|
||||
// but the TextComposition for the old composition has already been
|
||||
// destroyed. So, until this meets new eCompositionStart, following
|
||||
// composition events should be ignored if this is set to true.
|
||||
bool mIgnoreCompositionEvents;
|
||||
};
|
||||
|
||||
|
|
|
@ -135,7 +135,6 @@ EXPORTS += [
|
|||
"nsBaseScreen.h",
|
||||
"nsBaseWidget.h",
|
||||
"nsIDeviceContextSpec.h",
|
||||
"nsIKeyEventInPluginCallback.h",
|
||||
"nsIPluginWidget.h",
|
||||
"nsIPrintDialogService.h",
|
||||
"nsIRollupListener.h",
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
#include "nsIAppWindow.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIKeyEventInPluginCallback.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIWidgetListener.h"
|
||||
|
@ -2219,12 +2218,6 @@ const IMENotificationRequests& nsIWidget::IMENotificationRequestsRef() {
|
|||
return dispatcher->IMENotificationRequestsRef();
|
||||
}
|
||||
|
||||
nsresult nsIWidget::OnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData,
|
||||
nsIKeyEventInPluginCallback* aCallback) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void nsIWidget::PostHandleKeyEvent(mozilla::WidgetKeyboardEvent* aEvent) {}
|
||||
|
||||
bool nsIWidget::GetEditCommands(nsIWidget::NativeKeyBindingsType aType,
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsIKeyEventInPluginCallback_h_
|
||||
#define nsIKeyEventInPluginCallback_h_
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_IKEYEVENTINPLUGINCALLBACK_IID \
|
||||
{ \
|
||||
0x543c5a8a, 0xc50e, 0x4cf9, { \
|
||||
0xa6, 0xba, 0x29, 0xa1, 0xc5, 0xa5, 0x47, 0x07 \
|
||||
} \
|
||||
}
|
||||
|
||||
class nsIKeyEventInPluginCallback : public nsISupports {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IKEYEVENTINPLUGINCALLBACK_IID)
|
||||
|
||||
/**
|
||||
* HandledWindowedPluginKeyEvent() is a callback method of
|
||||
* nsIWidget::OnWindowedPluginKeyEvent(). When it returns
|
||||
* NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY, it should call this method
|
||||
* when the key event is handled.
|
||||
*
|
||||
* @param aKeyEventData The key event which was posted to the parent
|
||||
* process from a plugin process.
|
||||
* @param aIsConsumed true if aKeyEventData is consumed in the
|
||||
* parent process. Otherwise, false.
|
||||
*/
|
||||
virtual void HandledWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData, bool aIsConsumed) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIKeyEventInPluginCallback,
|
||||
NS_IKEYEVENTINPLUGINCALLBACK_IID)
|
||||
|
||||
#endif // #ifndef nsIKeyEventInPluginCallback_h_
|
|
@ -54,7 +54,6 @@ class nsIContent;
|
|||
class ViewWrapper;
|
||||
class nsIScreen;
|
||||
class nsIRunnable;
|
||||
class nsIKeyEventInPluginCallback;
|
||||
class nsUint64HashKey;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -2052,28 +2051,6 @@ class nsIWidget : public nsISupports {
|
|||
const ScrollableLayerGuid::ViewID& aViewId,
|
||||
const CSSRect& aRect, const uint32_t& aFlags) = 0;
|
||||
|
||||
/**
|
||||
* OnWindowedPluginKeyEvent() is called when native key event is
|
||||
* received in the focused plugin process directly in PluginInstanceChild.
|
||||
*
|
||||
* @param aKeyEventData The native key event data. The actual type
|
||||
* copied into NativeEventData depends on the
|
||||
* caller. Please check PluginInstanceChild.
|
||||
* @param aCallback Callback interface. When this returns
|
||||
* NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY,
|
||||
* the event handler has to call this callback.
|
||||
* Otherwise, the caller should do that instead.
|
||||
* @return NS_ERROR_* if this fails to handle the event.
|
||||
* NS_SUCCESS_EVENT_CONSUMED if the key event is
|
||||
* consumed.
|
||||
* NS_OK if the key event isn't consumed.
|
||||
* NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY if the
|
||||
* key event will be handled asynchronously.
|
||||
*/
|
||||
virtual nsresult OnWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData,
|
||||
nsIKeyEventInPluginCallback* aCallback);
|
||||
|
||||
/**
|
||||
* LookUpDictionary shows the dictionary for the word around current point.
|
||||
*
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_widget_WinNativeEventData_h_
|
||||
#define mozilla_widget_WinNativeEventData_h_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/widget/WinModifierKeyState.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
/**
|
||||
* WinNativeKeyEventData is used by nsIWidget::OnWindowedPluginKeyEvent() and
|
||||
* related IPC methods. This class cannot hold any pointers and references
|
||||
* since which are not available in different process.
|
||||
*/
|
||||
|
||||
class WinNativeKeyEventData final {
|
||||
public:
|
||||
UINT mMessage;
|
||||
WPARAM mWParam;
|
||||
LPARAM mLParam;
|
||||
Modifiers mModifiers;
|
||||
|
||||
private:
|
||||
uintptr_t mKeyboardLayout;
|
||||
|
||||
public:
|
||||
WinNativeKeyEventData(UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
||||
const ModifierKeyState& aModifierKeyState)
|
||||
: mMessage(aMessage),
|
||||
mWParam(aWParam),
|
||||
mLParam(aLParam),
|
||||
mModifiers(aModifierKeyState.GetModifiers()),
|
||||
mKeyboardLayout(reinterpret_cast<uintptr_t>(::GetKeyboardLayout(0))) {}
|
||||
|
||||
HKL GetKeyboardLayout() const {
|
||||
return reinterpret_cast<HKL>(mKeyboardLayout);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // #ifndef mozilla_widget_WinNativeEventData_h_
|
|
@ -53,7 +53,6 @@ EXPORTS.mozilla.widget += [
|
|||
"WindowsSMTCProvider.h",
|
||||
"WinMessages.h",
|
||||
"WinModifierKeyState.h",
|
||||
"WinNativeEventData.h",
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
|
|
@ -92,7 +92,6 @@
|
|||
|
||||
#include "mozilla/WidgetTraceEvent.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIKeyEventInPluginCallback.h"
|
||||
#include "nsITheme.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIScreenManager.h"
|
||||
|
@ -139,7 +138,6 @@
|
|||
#include "mozilla/TextEvents.h" // For WidgetKeyboardEvent
|
||||
#include "mozilla/TextEventDispatcherListener.h"
|
||||
#include "mozilla/widget/nsAutoRollup.h"
|
||||
#include "mozilla/widget/WinNativeEventData.h"
|
||||
#include "mozilla/widget/PlatformWidgetTypes.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsBidiKeyboard.h"
|
||||
|
@ -8503,17 +8501,22 @@ bool nsWindow::WidgetTypeSupportsAcceleration() {
|
|||
//
|
||||
// Windows' support for transparent accelerated surfaces isn't great.
|
||||
// Some possible approaches:
|
||||
// - Readback the data and update it using UpdateLayeredWindow/UpdateLayeredWindowIndirect
|
||||
// This is what WPF does. See CD3DDeviceLevel1::PresentWithGDI/CD3DSwapChainWithSwDC in WpfGfx.
|
||||
// The rationale for not using IDirect3DSurface9::GetDC is explained here:
|
||||
// - Readback the data and update it using
|
||||
// UpdateLayeredWindow/UpdateLayeredWindowIndirect
|
||||
// This is what WPF does. See
|
||||
// CD3DDeviceLevel1::PresentWithGDI/CD3DSwapChainWithSwDC in WpfGfx. The
|
||||
// rationale for not using IDirect3DSurface9::GetDC is explained here:
|
||||
// https://web.archive.org/web/20160521191104/https://blogs.msdn.microsoft.com/dwayneneed/2008/09/08/transparent-windows-in-wpf/
|
||||
// - Use D3D11_RESOURCE_MISC_GDI_COMPATIBLE, IDXGISurface1::GetDC(),
|
||||
// and UpdateLayeredWindowIndirect.
|
||||
// This is suggested here: https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/december/windows-with-c-layered-windows-with-direct2d
|
||||
// This is suggested here:
|
||||
// https://docs.microsoft.com/en-us/archive/msdn-magazine/2009/december/windows-with-c-layered-windows-with-direct2d
|
||||
// but might have the same problem that IDirect3DSurface9::GetDC has.
|
||||
// - Creating the window with the WS_EX_NOREDIRECTIONBITMAP flag and use DirectComposition.
|
||||
// - Creating the window with the WS_EX_NOREDIRECTIONBITMAP flag and use
|
||||
// DirectComposition.
|
||||
// Not supported on Win7.
|
||||
// - Using DwmExtendFrameIntoClientArea with negative margins and something to turn off the glass effect.
|
||||
// - Using DwmExtendFrameIntoClientArea with negative margins and something
|
||||
// to turn off the glass effect.
|
||||
// This doesn't work when the DWM is not running (Win7)
|
||||
//
|
||||
// Also see bug 1150376, D3D11 composition can cause issues on some devices
|
||||
|
@ -8523,42 +8526,6 @@ bool nsWindow::WidgetTypeSupportsAcceleration() {
|
|||
!(IsPopup() && DeviceManagerDx::Get()->IsWARP());
|
||||
}
|
||||
|
||||
nsresult nsWindow::OnWindowedPluginKeyEvent(
|
||||
const NativeEventData& aKeyEventData,
|
||||
nsIKeyEventInPluginCallback* aCallback) {
|
||||
if (NS_WARN_IF(!mWnd)) {
|
||||
return NS_OK;
|
||||
}
|
||||
const WinNativeKeyEventData* eventData =
|
||||
static_cast<const WinNativeKeyEventData*>(aKeyEventData);
|
||||
switch (eventData->mMessage) {
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN: {
|
||||
MSG mozMsg = WinUtils::InitMSG(MOZ_WM_KEYDOWN, eventData->mWParam,
|
||||
eventData->mLParam, mWnd);
|
||||
ModifierKeyState modifierKeyState(eventData->mModifiers);
|
||||
NativeKey nativeKey(this, mozMsg, modifierKeyState,
|
||||
eventData->GetKeyboardLayout());
|
||||
return nativeKey.HandleKeyDownMessage() ? NS_SUCCESS_EVENT_CONSUMED
|
||||
: NS_OK;
|
||||
}
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP: {
|
||||
MSG mozMsg = WinUtils::InitMSG(MOZ_WM_KEYUP, eventData->mWParam,
|
||||
eventData->mLParam, mWnd);
|
||||
ModifierKeyState modifierKeyState(eventData->mModifiers);
|
||||
NativeKey nativeKey(this, mozMsg, modifierKeyState,
|
||||
eventData->GetKeyboardLayout());
|
||||
return nativeKey.HandleKeyUpMessage() ? NS_SUCCESS_EVENT_CONSUMED : NS_OK;
|
||||
}
|
||||
default:
|
||||
// We shouldn't consume WM_*CHAR messages here even if the preceding
|
||||
// keydown or keyup event on the plugin is consumed. It should be
|
||||
// managed in each plugin window rather than top level window.
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
bool nsWindow::OnPointerEvents(UINT msg, WPARAM aWParam, LPARAM aLParam) {
|
||||
if (!mPointerEvents.ShouldHandleWinPointerMessages(msg, aWParam)) {
|
||||
return false;
|
||||
|
|
|
@ -356,10 +356,6 @@ class nsWindow final : public nsWindowBase {
|
|||
|
||||
const IMEContext& DefaultIMC() const { return mDefaultIMC; }
|
||||
|
||||
virtual nsresult OnWindowedPluginKeyEvent(
|
||||
const mozilla::NativeEventData& aKeyEventData,
|
||||
nsIKeyEventInPluginCallback* aCallback) override;
|
||||
|
||||
void GetCompositorWidgetInitData(
|
||||
mozilla::widget::CompositorWidgetInitData* aInitData) override;
|
||||
bool IsTouchWindow() const { return mTouchWindow; }
|
||||
|
|
|
@ -233,15 +233,9 @@ with modules["GFX"]:
|
|||
with modules["WIDGET"]:
|
||||
# Used by:
|
||||
# - nsIWidget::NotifyIME()
|
||||
# - nsIWidget::OnWindowedPluginKeyEvent()
|
||||
# Returned when the notification or the event is handled and it's consumed
|
||||
# by somebody.
|
||||
errors["NS_SUCCESS_EVENT_CONSUMED"] = SUCCESS(1)
|
||||
# Used by:
|
||||
# - nsIWidget::OnWindowedPluginKeyEvent()
|
||||
# Returned when the event is handled correctly but the result will be
|
||||
# notified asynchronously.
|
||||
errors["NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY"] = SUCCESS(2)
|
||||
|
||||
|
||||
# =======================================================================
|
||||
|
|
Загрузка…
Ссылка в новой задаче