mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1377653
- part3: WidgetEvent::mFlags should have a bool flag if it's been posted to at least one remote process r=smaug
Currently, it's not been managed yet that whether an event is posted to at least one remote process. So, for managing the state, BaseEventFlags should have a new bool flag and WidgetEvent and BaseEventFlags should have helper methods for it. Additionally, this fixes a bug of nsGUIEventIPC.h. In a lot of ParamTraits, static_cast<Foo> is used for using base class's ParamTraits. However, it causes creating temporary instance with copy constructor. Therefore, WidgetEvent::MarkAsPostedToRemoteProcess() call in ParamTraits<mozilla::WidgetEvent>::Write() didn't work as expected. MozReview-Commit-ID: DdafsbVfrya --HG-- extra : rebase_source : 94205f3a7b36455c3c9f607c35866be033e627c1
This commit is contained in:
parent
57f359b0de
commit
5533f095cb
@ -1225,30 +1225,35 @@ EventStateManager::HandleAccessKey(WidgetKeyboardEvent* aEvent,
|
||||
return false;
|
||||
}// end of HandleAccessKey
|
||||
|
||||
bool
|
||||
void
|
||||
EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
||||
nsFrameLoader* aFrameLoader,
|
||||
nsEventStatus *aStatus) {
|
||||
nsEventStatus *aStatus)
|
||||
{
|
||||
TabParent* remote = TabParent::GetFrom(aFrameLoader);
|
||||
if (!remote) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aEvent->mClass) {
|
||||
case eMouseEventClass: {
|
||||
return remote->SendRealMouseEvent(*aEvent->AsMouseEvent());
|
||||
remote->SendRealMouseEvent(*aEvent->AsMouseEvent());
|
||||
return;
|
||||
}
|
||||
case eKeyboardEventClass: {
|
||||
return remote->SendRealKeyEvent(*aEvent->AsKeyboardEvent());
|
||||
remote->SendRealKeyEvent(*aEvent->AsKeyboardEvent());
|
||||
return;
|
||||
}
|
||||
case eWheelEventClass: {
|
||||
return remote->SendMouseWheelEvent(*aEvent->AsWheelEvent());
|
||||
remote->SendMouseWheelEvent(*aEvent->AsWheelEvent());
|
||||
return;
|
||||
}
|
||||
case eTouchEventClass: {
|
||||
// Let the child process synthesize a mouse event if needed, and
|
||||
// ensure we don't synthesize one in this process.
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
return remote->SendRealTouchEvent(*aEvent->AsTouchEvent());
|
||||
remote->SendRealTouchEvent(*aEvent->AsTouchEvent());
|
||||
return;
|
||||
}
|
||||
case eDragEventClass: {
|
||||
if (remote->Manager()->IsContentParent()) {
|
||||
@ -1268,14 +1273,13 @@ EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
||||
}
|
||||
}
|
||||
|
||||
bool retval = remote->SendRealDragEvent(*aEvent->AsDragEvent(),
|
||||
action, dropEffect);
|
||||
|
||||
return retval;
|
||||
remote->SendRealDragEvent(*aEvent->AsDragEvent(), action, dropEffect);
|
||||
return;
|
||||
}
|
||||
case ePluginEventClass: {
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
return remote->SendPluginEvent(*aEvent->AsPluginEvent());
|
||||
remote->SendPluginEvent(*aEvent->AsPluginEvent());
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
MOZ_CRASH("Attempt to send non-whitelisted event?");
|
||||
@ -1297,6 +1301,9 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!aEvent->HasBeenPostedToRemoteProcess(),
|
||||
"Why do we need to post same event to remote processes again?");
|
||||
|
||||
// Collect the remote event targets we're going to forward this
|
||||
// event to.
|
||||
//
|
||||
@ -1347,7 +1354,6 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
|
||||
|
||||
// Look up the frame loader for all the remote targets we found, and
|
||||
// then dispatch the event to the remote content they represent.
|
||||
bool dispatched = false;
|
||||
for (uint32_t i = 0; i < targets.Length(); ++i) {
|
||||
nsIContent* target = targets[i];
|
||||
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(target);
|
||||
@ -1366,9 +1372,9 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
|
||||
continue;
|
||||
}
|
||||
|
||||
dispatched |= DispatchCrossProcessEvent(aEvent, frameLoader, aStatus);
|
||||
DispatchCrossProcessEvent(aEvent, frameLoader, aStatus);
|
||||
}
|
||||
return dispatched;
|
||||
return aEvent->HasBeenPostedToRemoteProcess();
|
||||
}
|
||||
|
||||
//
|
||||
@ -2823,14 +2829,13 @@ NodeAllowsClickThrough(nsINode* aNode)
|
||||
|
||||
void
|
||||
EventStateManager::PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
|
||||
nsEventStatus& aStatus,
|
||||
bool dispatchedToContentProcess)
|
||||
nsEventStatus& aStatus)
|
||||
{
|
||||
if (aStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dispatchedToContentProcess) {
|
||||
if (!aKeyboardEvent->HasBeenPostedToRemoteProcess()) {
|
||||
// The widget expects a reply for every keyboard event. If the event wasn't
|
||||
// dispatched to a content process (non-e10s or no content process
|
||||
// running), we need to short-circuit here. Otherwise, we need to wait for
|
||||
@ -2855,8 +2860,9 @@ EventStateManager::PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
|
||||
// because to the FocusManager the remote-browser looks like one
|
||||
// element, so we would just move the focus to the next element
|
||||
// in chrome, instead of handling it in content.
|
||||
if (dispatchedToContentProcess)
|
||||
if (aKeyboardEvent->HasBeenPostedToRemoteProcess()) {
|
||||
break;
|
||||
}
|
||||
|
||||
EnsureDocument(mPresContext);
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
@ -2907,7 +2913,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
mCurrentTarget = aTargetFrame;
|
||||
mCurrentTargetContent = nullptr;
|
||||
|
||||
bool dispatchedToContentProcess = HandleCrossProcessEvent(aEvent, aStatus);
|
||||
HandleCrossProcessEvent(aEvent, aStatus);
|
||||
// NOTE: the above call may have destroyed aTargetFrame, please use
|
||||
// mCurrentTarget henceforth. This is to avoid using it accidentally:
|
||||
aTargetFrame = nullptr;
|
||||
@ -2939,7 +2945,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
// <xul:browser remote> element. This will ensure that subsequent mousemove/mouseup
|
||||
// events will continue to be dispatched to this element and therefore forwarded
|
||||
// to the child.
|
||||
if (dispatchedToContentProcess && !nsIPresShell::GetCapturingContent()) {
|
||||
if (aEvent->HasBeenPostedToRemoteProcess() &&
|
||||
!nsIPresShell::GetCapturingContent()) {
|
||||
nsIContent* content = mCurrentTarget ? mCurrentTarget->GetContent() : nullptr;
|
||||
nsIPresShell::SetCapturingContent(content, 0);
|
||||
}
|
||||
@ -3444,7 +3451,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
if (ContentChild* child = ContentChild::GetSingleton()) {
|
||||
child->SendUpdateDropEffect(action, dropEffect);
|
||||
}
|
||||
if (dispatchedToContentProcess) {
|
||||
if (aEvent->HasBeenPostedToRemoteProcess()) {
|
||||
dragSession->SetCanDrop(true);
|
||||
} else if (initialDataTransfer) {
|
||||
// Now set the drop effect in the initial dataTransfer. This ensures
|
||||
@ -3480,7 +3487,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
case eKeyPress:
|
||||
{
|
||||
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
|
||||
PostHandleKeyboardEvent(keyEvent, *aStatus, dispatchedToContentProcess);
|
||||
PostHandleKeyboardEvent(keyEvent, *aStatus);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -109,8 +109,7 @@ public:
|
||||
nsEventStatus* aStatus);
|
||||
|
||||
void PostHandleKeyboardEvent(WidgetKeyboardEvent* aKeyboardEvent,
|
||||
nsEventStatus& aStatus,
|
||||
bool dispatchedToContentProcess);
|
||||
nsEventStatus& aStatus);
|
||||
|
||||
/**
|
||||
* DispatchLegacyMouseScrollEvents() dispatches eLegacyMouseLineOrPageScroll
|
||||
@ -895,9 +894,22 @@ protected:
|
||||
dom::TabParent *GetCrossProcessTarget();
|
||||
bool IsTargetCrossProcess(WidgetGUIEvent* aEvent);
|
||||
|
||||
bool DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
||||
/**
|
||||
* DispatchCrossProcessEvent() try to post aEvent to target remote process.
|
||||
* If you need to check if the event is posted to a remote process, you
|
||||
* can use aEvent->HasBeenPostedToRemoteProcess().
|
||||
*/
|
||||
void DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
||||
nsFrameLoader* aRemote,
|
||||
nsEventStatus *aStatus);
|
||||
/**
|
||||
* HandleCrossProcessEvent() may post aEvent to target remote processes.
|
||||
* When it succeeded to post the event to at least one remote process,
|
||||
* returns true. Otherwise, including the case not tried to dispatch to
|
||||
* post the event, returns false.
|
||||
* If you need to check if the event is posted to at least one remote
|
||||
* process, you can use aEvent->HasBeenPostedToRemoteProcess().
|
||||
*/
|
||||
bool HandleCrossProcessEvent(WidgetEvent* aEvent,
|
||||
nsEventStatus* aStatus);
|
||||
|
||||
|
@ -1832,7 +1832,10 @@ TabChild::RequestEditCommands(nsIWidget::NativeKeyBindingsType aType,
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid native key bindings type");
|
||||
}
|
||||
|
||||
SendRequestNativeKeyBindings(aType, aEvent, &aCommands);
|
||||
// Don't send aEvent to the parent process directly because it'll be marked
|
||||
// as posted to remote process.
|
||||
WidgetKeyboardEvent localEvent(aEvent);
|
||||
SendRequestNativeKeyBindings(aType, localEvent, &aCommands);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
@ -818,7 +818,11 @@ TabParent::HandleAccessKey(const WidgetKeyboardEvent& aEvent,
|
||||
const int32_t& aModifierMask)
|
||||
{
|
||||
if (!mIsDestroyed) {
|
||||
Unused << SendHandleAccessKey(aEvent, aCharCodes, aModifierMask);
|
||||
// Note that we don't need to mark aEvent is posted to a remote process
|
||||
// because the event may be dispatched to it as normal keyboard event.
|
||||
// Therefore, we should use local copy to send it.
|
||||
WidgetKeyboardEvent localEvent(aEvent);
|
||||
Unused << SendHandleAccessKey(localEvent, aCharCodes, aModifierMask);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,11 +1087,11 @@ TabParent::SendKeyEvent(const nsAString& aType,
|
||||
aModifiers, aPreventDefault);
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
TabParent::SendRealMouseEvent(WidgetMouseEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
|
||||
@ -1114,13 +1118,20 @@ TabParent::SendRealMouseEvent(WidgetMouseEvent& aEvent)
|
||||
|
||||
if (eMouseMove == aEvent.mMessage) {
|
||||
if (aEvent.mReason == WidgetMouseEvent::eSynthesized) {
|
||||
return SendSynthMouseMoveEvent(aEvent, guid, blockId);
|
||||
} else {
|
||||
return SendRealMouseMoveEvent(aEvent, guid, blockId);
|
||||
DebugOnly<bool> ret = SendSynthMouseMoveEvent(aEvent, guid, blockId);
|
||||
NS_WARNING_ASSERTION(ret, "SendSynthMouseMoveEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
return;
|
||||
}
|
||||
DebugOnly<bool> ret = SendRealMouseMoveEvent(aEvent, guid, blockId);
|
||||
NS_WARNING_ASSERTION(ret, "SendRealMouseMoveEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
return;
|
||||
}
|
||||
|
||||
return SendRealMouseButtonEvent(aEvent, guid, blockId);
|
||||
DebugOnly<bool> ret = SendRealMouseButtonEvent(aEvent, guid, blockId);
|
||||
NS_WARNING_ASSERTION(ret, "SendRealMouseButtonEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
}
|
||||
|
||||
LayoutDeviceToCSSScale
|
||||
@ -1135,15 +1146,18 @@ TabParent::GetLayoutDeviceToCSSScale()
|
||||
: 0.0f);
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
TabParent::SendRealDragEvent(WidgetDragEvent& aEvent, uint32_t aDragAction,
|
||||
uint32_t aDropEffect)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
return PBrowserParent::SendRealDragEvent(aEvent, aDragAction, aDropEffect);
|
||||
DebugOnly<bool> ret =
|
||||
PBrowserParent::SendRealDragEvent(aEvent, aDragAction, aDropEffect);
|
||||
NS_WARNING_ASSERTION(ret, "PBrowserParent::SendRealDragEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
}
|
||||
|
||||
LayoutDevicePoint
|
||||
@ -1152,18 +1166,21 @@ TabParent::AdjustTapToChildWidget(const LayoutDevicePoint& aPoint)
|
||||
return aPoint + LayoutDevicePoint(GetChildProcessOffset());
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
TabParent::SendMouseWheelEvent(WidgetWheelEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
ScrollableLayerGuid guid;
|
||||
uint64_t blockId;
|
||||
ApzAwareEventRoutingToChild(&guid, &blockId, nullptr);
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
return PBrowserParent::SendMouseWheelEvent(aEvent, guid, blockId);
|
||||
DebugOnly<bool> ret =
|
||||
PBrowserParent::SendMouseWheelEvent(aEvent, guid, blockId);
|
||||
NS_WARNING_ASSERTION(ret, "PBrowserParent::SendMouseWheelEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
@ -1428,11 +1445,11 @@ TabParent::RecvClearNativeTouchSequence(const uint64_t& aObserverId)
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
TabParent::SendRealKeyEvent(WidgetKeyboardEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
aEvent.mRefPoint += GetChildProcessOffset();
|
||||
|
||||
@ -1444,14 +1461,16 @@ TabParent::SendRealKeyEvent(WidgetKeyboardEvent& aEvent)
|
||||
aEvent.PreventNativeKeyBindings();
|
||||
}
|
||||
|
||||
return PBrowserParent::SendRealKeyEvent(aEvent);
|
||||
DebugOnly<bool> ret = PBrowserParent::SendRealKeyEvent(aEvent);
|
||||
NS_WARNING_ASSERTION(ret, "PBrowserParent::SendRealKeyEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
TabParent::SendRealTouchEvent(WidgetTouchEvent& aEvent)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
// PresShell::HandleEventInternal adds touches on touch end/cancel. This
|
||||
@ -1472,7 +1491,7 @@ TabParent::SendRealTouchEvent(WidgetTouchEvent& aEvent)
|
||||
ApzAwareEventRoutingToChild(&guid, &blockId, &apzResponse);
|
||||
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
LayoutDeviceIntPoint offset = GetChildProcessOffset();
|
||||
@ -1480,9 +1499,28 @@ TabParent::SendRealTouchEvent(WidgetTouchEvent& aEvent)
|
||||
aEvent.mTouches[i]->mRefPoint += offset;
|
||||
}
|
||||
|
||||
return (aEvent.mMessage == eTouchMove) ?
|
||||
PBrowserParent::SendRealTouchMoveEvent(aEvent, guid, blockId, apzResponse) :
|
||||
if (aEvent.mMessage == eTouchMove) {
|
||||
DebugOnly<bool> ret =
|
||||
PBrowserParent::SendRealTouchMoveEvent(aEvent, guid, blockId,
|
||||
apzResponse);
|
||||
NS_WARNING_ASSERTION(ret,
|
||||
"PBrowserParent::SendRealTouchMoveEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
return;
|
||||
}
|
||||
|
||||
DebugOnly<bool> ret =
|
||||
PBrowserParent::SendRealTouchEvent(aEvent, guid, blockId, apzResponse);
|
||||
NS_WARNING_ASSERTION(ret, "PBrowserParent::SendRealTouchEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::SendPluginEvent(WidgetPluginEvent& aEvent)
|
||||
{
|
||||
DebugOnly<bool> ret = PBrowserParent::SendPluginEvent(aEvent);
|
||||
NS_WARNING_ASSERTION(ret, "PBrowserParent::SendPluginEvent() failed");
|
||||
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -2052,7 +2090,11 @@ TabParent::SendCompositionEvent(WidgetCompositionEvent& aEvent)
|
||||
if (!mContentCache.OnCompositionEvent(aEvent)) {
|
||||
return true;
|
||||
}
|
||||
return PBrowserParent::SendCompositionEvent(aEvent);
|
||||
if (NS_WARN_IF(!PBrowserParent::SendCompositionEvent(aEvent))) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(aEvent.HasBeenPostedToRemoteProcess());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -2069,6 +2111,7 @@ TabParent::SendSelectionEvent(WidgetSelectionEvent& aEvent)
|
||||
if (NS_WARN_IF(!PBrowserParent::SendSelectionEvent(aEvent))) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(aEvent.HasBeenPostedToRemoteProcess());
|
||||
aEvent.mSucceeded = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -438,17 +438,35 @@ public:
|
||||
int32_t aCharCode, int32_t aModifiers,
|
||||
bool aPreventDefault);
|
||||
|
||||
bool SendRealMouseEvent(mozilla::WidgetMouseEvent& aEvent);
|
||||
/**
|
||||
* The following Send*Event() marks aEvent as posted to remote process if
|
||||
* it succeeded. So, you can check the result with
|
||||
* aEvent.HasBeenPostedToRemoteProcess().
|
||||
*/
|
||||
void SendRealMouseEvent(WidgetMouseEvent& aEvent);
|
||||
|
||||
bool SendRealDragEvent(mozilla::WidgetDragEvent& aEvent,
|
||||
void SendRealDragEvent(WidgetDragEvent& aEvent,
|
||||
uint32_t aDragAction,
|
||||
uint32_t aDropEffect);
|
||||
|
||||
bool SendMouseWheelEvent(mozilla::WidgetWheelEvent& aEvent);
|
||||
void SendMouseWheelEvent(WidgetWheelEvent& aEvent);
|
||||
|
||||
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& aEvent);
|
||||
void SendRealKeyEvent(WidgetKeyboardEvent& aEvent);
|
||||
|
||||
bool SendRealTouchEvent(WidgetTouchEvent& aEvent);
|
||||
void SendRealTouchEvent(WidgetTouchEvent& aEvent);
|
||||
|
||||
void SendPluginEvent(WidgetPluginEvent& aEvent);
|
||||
|
||||
/**
|
||||
* Different from above Send*Event(), these methods return true if the
|
||||
* event has been posted to the remote process or failed to do that but
|
||||
* shouldn't be handled by following event listeners.
|
||||
* If you need to check if it's actually posted to the remote process,
|
||||
* you can refer aEvent.HasBeenPostedToRemoteProcess().
|
||||
*/
|
||||
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& aEvent);
|
||||
|
||||
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& aEvent);
|
||||
|
||||
bool SendHandleTap(TapType aType,
|
||||
const LayoutDevicePoint& aPoint,
|
||||
@ -496,10 +514,6 @@ public:
|
||||
|
||||
bool HandleQueryContentEvent(mozilla::WidgetQueryContentEvent& aEvent);
|
||||
|
||||
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& aEvent);
|
||||
|
||||
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& aEvent);
|
||||
|
||||
bool SendPasteTransferable(const IPCDataTransfer& aDataTransfer,
|
||||
const bool& aIsPrivateData,
|
||||
const IPC::Principal& aRequestingPrincipal);
|
||||
|
@ -154,6 +154,10 @@ public:
|
||||
// for when the parent process need the know first how the event was used
|
||||
// by content before handling it itself.
|
||||
bool mWantReplyFromContentProcess : 1;
|
||||
// If mPostedToRemoteProcess is true, the event has been posted to the
|
||||
// remote process (but it's not handled yet if it's not a duplicated event
|
||||
// instance).
|
||||
bool mPostedToRemoteProcess : 1;
|
||||
|
||||
// If the event is being handled in target phase, returns true.
|
||||
inline bool InTargetPhase() const
|
||||
@ -223,6 +227,7 @@ public:
|
||||
*/
|
||||
inline void StopCrossProcessForwarding()
|
||||
{
|
||||
MOZ_ASSERT(!mPostedToRemoteProcess);
|
||||
mNoRemoteProcessDispatch = true;
|
||||
mWantReplyFromContentProcess = false;
|
||||
}
|
||||
@ -238,6 +243,7 @@ public:
|
||||
*/
|
||||
inline void MarkAsWaitingReplyFromRemoteProcess()
|
||||
{
|
||||
MOZ_ASSERT(!mPostedToRemoteProcess);
|
||||
// When this is called, it means that event handlers in this process need
|
||||
// a reply from content in a remote process. So, callers should stop
|
||||
// propagation in this process first.
|
||||
@ -262,6 +268,7 @@ public:
|
||||
{
|
||||
mNoRemoteProcessDispatch = true;
|
||||
mWantReplyFromContentProcess = true;
|
||||
mPostedToRemoteProcess = false;
|
||||
}
|
||||
/**
|
||||
* Return true if the event has already been handled in the remote process.
|
||||
@ -278,12 +285,42 @@ public:
|
||||
MOZ_ASSERT(!XRE_IsParentProcess());
|
||||
return IsWaitingReplyFromRemoteProcess();
|
||||
}
|
||||
/**
|
||||
* Mark the event has already posted to a remote process.
|
||||
*/
|
||||
inline void MarkAsPostedToRemoteProcess()
|
||||
{
|
||||
MOZ_ASSERT(!IsCrossProcessForwardingStopped());
|
||||
mPostedToRemoteProcess = true;
|
||||
}
|
||||
/**
|
||||
* Reset the cross process dispatching state. This should be used when a
|
||||
* process receives the event because the state is in the sender.
|
||||
*/
|
||||
inline void ResetCrossProcessDispatchingState()
|
||||
{
|
||||
MOZ_ASSERT(!IsCrossProcessForwardingStopped());
|
||||
mPostedToRemoteProcess = false;
|
||||
}
|
||||
/**
|
||||
* Return true if the event has been posted to a remote process.
|
||||
* Note that MarkAsPostedToRemoteProcess() is called by
|
||||
* ParamTraits<mozilla::WidgetEvent>. Therefore, it *might* be possible
|
||||
* that posting the event failed even if this returns true. But that must
|
||||
* really rare. If that'd be problem for you, you should unmark this in
|
||||
* TabParent or somewhere.
|
||||
*/
|
||||
inline bool HasBeenPostedToRemoteProcess() const
|
||||
{
|
||||
return mPostedToRemoteProcess;
|
||||
}
|
||||
/**
|
||||
* Mark the event is reserved by chrome. I.e., shouldn't be dispatched to
|
||||
* content because it shouldn't be cancelable.
|
||||
*/
|
||||
inline void MarkAsReservedByChrome()
|
||||
{
|
||||
MOZ_ASSERT(!mPostedToRemoteProcess);
|
||||
mIsReservedByChrome = true;
|
||||
// For reserved commands (such as Open New Tab), we don't need to wait for
|
||||
// the content to answer, neither to give a chance for content to override
|
||||
@ -624,6 +661,28 @@ public:
|
||||
{
|
||||
return mFlags.WantReplyFromContentProcess();
|
||||
}
|
||||
/**
|
||||
* Mark the event has already posted to a remote process.
|
||||
*/
|
||||
inline void MarkAsPostedToRemoteProcess()
|
||||
{
|
||||
mFlags.MarkAsPostedToRemoteProcess();
|
||||
}
|
||||
/**
|
||||
* Reset the cross process dispatching state. This should be used when a
|
||||
* process receives the event because the state is in the sender.
|
||||
*/
|
||||
inline void ResetCrossProcessDispatchingState()
|
||||
{
|
||||
mFlags.ResetCrossProcessDispatchingState();
|
||||
}
|
||||
/**
|
||||
* Return true if the event has been posted to a remote process.
|
||||
*/
|
||||
inline bool HasBeenPostedToRemoteProcess() const
|
||||
{
|
||||
return mFlags.HasBeenPostedToRemoteProcess();
|
||||
}
|
||||
/**
|
||||
* Mark the event is reserved by chrome. I.e., shouldn't be dispatched to
|
||||
* content because it shouldn't be cancelable.
|
||||
|
@ -61,6 +61,9 @@ struct ParamTraits<mozilla::WidgetEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
// Mark the event as posted to another process.
|
||||
const_cast<mozilla::WidgetEvent&>(aParam).MarkAsPostedToRemoteProcess();
|
||||
|
||||
WriteParam(aMsg,
|
||||
static_cast<mozilla::EventClassIDType>(aParam.mClass));
|
||||
WriteParam(aMsg, aParam.mMessage);
|
||||
@ -82,6 +85,11 @@ struct ParamTraits<mozilla::WidgetEvent>
|
||||
ReadParam(aMsg, aIter, &aResult->mTimeStamp) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFlags);
|
||||
aResult->mClass = static_cast<mozilla::EventClassID>(eventClassID);
|
||||
if (ret) {
|
||||
// Reset cross process dispatching state here because the event has not
|
||||
// been dispatched to different process from current process.
|
||||
aResult->ResetCrossProcessDispatchingState();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
@ -109,7 +117,7 @@ struct ParamTraits<mozilla::WidgetGUIEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mPluginEvent);
|
||||
}
|
||||
|
||||
@ -127,7 +135,7 @@ struct ParamTraits<mozilla::WidgetInputEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mModifiers);
|
||||
}
|
||||
|
||||
@ -146,7 +154,7 @@ struct ParamTraits<mozilla::WidgetMouseEventBase>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.button);
|
||||
WriteParam(aMsg, aParam.buttons);
|
||||
WriteParam(aMsg, aParam.pressure);
|
||||
@ -173,7 +181,7 @@ struct ParamTraits<mozilla::WidgetWheelEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEventBase&>(aParam));
|
||||
WriteParam(aMsg, aParam.mDeltaX);
|
||||
WriteParam(aMsg, aParam.mDeltaY);
|
||||
WriteParam(aMsg, aParam.mDeltaZ);
|
||||
@ -255,7 +263,7 @@ struct ParamTraits<mozilla::WidgetMouseEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEventBase&>(aParam));
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetPointerHelper>(aParam));
|
||||
WriteParam(aMsg, aParam.mIgnoreRootScrollFrame);
|
||||
WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.mReason));
|
||||
@ -296,7 +304,7 @@ struct ParamTraits<mozilla::WidgetDragEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mUserCancelled);
|
||||
WriteParam(aMsg, aParam.mDefaultPreventedOnContent);
|
||||
}
|
||||
@ -318,7 +326,7 @@ struct ParamTraits<mozilla::WidgetPointerEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetMouseEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mWidth);
|
||||
WriteParam(aMsg, aParam.mHeight);
|
||||
WriteParam(aMsg, aParam.mIsPrimary);
|
||||
@ -429,7 +437,7 @@ struct ParamTraits<mozilla::WidgetKeyboardEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam));
|
||||
WriteParam(aMsg,
|
||||
static_cast<mozilla::KeyNameIndexType>(aParam.mKeyNameIndex));
|
||||
WriteParam(aMsg,
|
||||
@ -600,7 +608,7 @@ struct ParamTraits<mozilla::WidgetCompositionEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mData);
|
||||
WriteParam(aMsg, aParam.mNativeIMEContext);
|
||||
bool hasRanges = !!aParam.mRanges;
|
||||
@ -684,7 +692,7 @@ struct ParamTraits<mozilla::WidgetQueryContentEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mSucceeded);
|
||||
WriteParam(aMsg, aParam.mUseNativeLineBreak);
|
||||
WriteParam(aMsg, aParam.mWithFontRanges);
|
||||
@ -725,7 +733,7 @@ struct ParamTraits<mozilla::WidgetSelectionEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mOffset);
|
||||
WriteParam(aMsg, aParam.mLength);
|
||||
WriteParam(aMsg, aParam.mReversed);
|
||||
@ -958,7 +966,7 @@ struct ParamTraits<mozilla::WidgetPluginEvent>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::WidgetGUIEvent&>(aParam));
|
||||
WriteParam(aMsg, aParam.mRetargetToFocusedDocument);
|
||||
}
|
||||
|
||||
@ -1127,7 +1135,7 @@ struct ParamTraits<mozilla::MultiTouchInput>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mTouches);
|
||||
WriteParam(aMsg, aParam.mHandledByAPZ);
|
||||
@ -1165,7 +1173,7 @@ struct ParamTraits<mozilla::MouseInput>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
|
||||
WriteParam(aMsg, aParam.mButtonType);
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mInputSource);
|
||||
@ -1203,7 +1211,7 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mPanStartPoint);
|
||||
WriteParam(aMsg, aParam.mPanDisplacement);
|
||||
@ -1251,7 +1259,7 @@ struct ParamTraits<mozilla::PinchGestureInput>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mFocusPoint);
|
||||
WriteParam(aMsg, aParam.mLocalFocusPoint);
|
||||
@ -1285,7 +1293,7 @@ struct ParamTraits<mozilla::TapGestureInput>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mPoint);
|
||||
WriteParam(aMsg, aParam.mLocalPoint);
|
||||
@ -1323,7 +1331,7 @@ struct ParamTraits<mozilla::ScrollWheelInput>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
|
||||
WriteParam(aMsg, aParam.mDeltaType);
|
||||
WriteParam(aMsg, aParam.mScrollMode);
|
||||
WriteParam(aMsg, aParam.mOrigin);
|
||||
@ -1377,7 +1385,7 @@ struct ParamTraits<mozilla::KeyboardInput>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
|
||||
WriteParam(aMsg, static_cast<const mozilla::InputData&>(aParam));
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mKeyCode);
|
||||
WriteParam(aMsg, aParam.mCharCode);
|
||||
|
Loading…
Reference in New Issue
Block a user