Bug 1256589 part.3 Move the implementation of StopCrossProcessForwarding() from dom::Event to WidgetEvent r=smaug
MozReview-Commit-ID: KXeVxCJ05Mo
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -475,17 +475,17 @@ Event::StopImmediatePropagation()
{
mEvent->StopImmediatePropagation();
return NS_OK;
}
NS_IMETHODIMP
Event::StopCrossProcessForwarding()
{
- mEvent->mFlags.mNoCrossProcessBoundaryForwarding = true;
+ mEvent->StopCrossProcessForwarding();
return NS_OK;
}
NS_IMETHODIMP
Event::GetIsTrusted(bool* aIsTrusted)
{
*aIsTrusted = IsTrusted();
return NS_OK;
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -637,34 +637,34 @@ EventStateManager::PreHandleEvent(nsPres
}
case eMouseEnterIntoWidget:
// In some cases on e10s eMouseEnterIntoWidget
// event was sent twice into child process of content.
// (From specific widget code (sending is not permanent) and
// from ESM::DispatchMouseOrPointerEvent (sending is permanent)).
// Flag mNoCrossProcessBoundaryForwarding helps to
// suppress sending accidental event from widget code.
- aEvent->mFlags.mNoCrossProcessBoundaryForwarding = true;
+ aEvent->StopCrossProcessForwarding();
break;
case eMouseExitFromWidget:
// If this is a remote frame, we receive eMouseExitFromWidget from the
// parent the mouse exits our content. Since the parent may update the
// cursor while the mouse is outside our frame, and since PuppetWidget
// caches the current cursor internally, re-entering our content (say from
// over a window edge) wont update the cursor if the cached value and the
// current cursor match. So when the mouse exits a remote frame, clear the
// cached widget cursor so a proper update will occur when the mouse
// re-enters.
if (XRE_IsContentProcess()) {
ClearCachedWidgetCursor(mCurrentTarget);
}
// Flag helps to suppress double event sending into process of content.
// For more information see comment above, at eMouseEnterIntoWidget case.
- aEvent->mFlags.mNoCrossProcessBoundaryForwarding = true;
+ aEvent->StopCrossProcessForwarding();
// If the event is not a top-level window exit, then it's not
// really an exit --- we may have traversed widget boundaries but
// we're still in our toplevel window.
if (mouseEvent->exit != WidgetMouseEvent::eTopLevel) {
// Treat it as a synthetic move so we don't generate spurious
// "exit" or "move" events. Any necessary "out" or "over" events
// will be generated by GenerateMouseEnterExit
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2103,19 +2103,18 @@ TabParent::GetChildProcessOffset()
}
bool
TabParent::RecvReplyKeyEvent(const WidgetKeyboardEvent& event)
{
NS_ENSURE_TRUE(mFrameElement, true);
WidgetKeyboardEvent localEvent(event);
- // Set mNoCrossProcessBoundaryForwarding to avoid this event from
- // being infinitely redispatched and forwarded to the child again.
- localEvent.mFlags.mNoCrossProcessBoundaryForwarding = true;
+ // Mark the event as not to be dispatched to remote process again.
+ localEvent.StopCrossProcessForwarding();
// Here we convert the WidgetEvent that we received to an nsIDOMEvent
// to be able to dispatch it to the <browser> element as the target element.
nsIDocument* doc = mFrameElement->OwnerDoc();
nsIPresShell* presShell = doc->GetShell();
NS_ENSURE_TRUE(presShell, true);
nsPresContext* presContext = presShell->GetPresContext();
NS_ENSURE_TRUE(presContext, true);
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -412,17 +412,17 @@ nsXBLWindowKeyHandler::HandleEventOnCapt
return;
}
bool isReserved = false;
if (HasHandlerForEvent(aEvent, &isReserved) && isReserved) {
// For reserved commands (such as Open New Tab), we don't to wait for
// the content to answer (so mWantReplyFromContentProcess remains false),
// neither to give a chance for content to override its behavior.
- widgetKeyboardEvent->mFlags.mNoCrossProcessBoundaryForwarding = true;
+ widgetKeyboardEvent->StopCrossProcessForwarding();
// If the key combination is reserved by chrome, we shouldn't expose the
// keyboard event to web contents because such keyboard events shouldn't be
// cancelable. So, it's not good behavior to fire keyboard events but
// to ignore the defaultPrevented attribute value in chrome.
widgetKeyboardEvent->mFlags.mOnlySystemGroupDispatchInContent = true;
}
}
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -7072,17 +7072,17 @@ PresShell::HandleKeyboardEvent(nsINode*
defaultPrevented);
// Before event is default-prevented. Dispatch after events with
// embeddedCancelled = false to partial items.
if (defaultPrevented) {
*aStatus = nsEventStatus_eConsumeNoDefault;
DispatchAfterKeyboardEventInternal(chain, aEvent, false, chainIndex);
// No need to forward the event to child process.
- aEvent.mFlags.mNoCrossProcessBoundaryForwarding = true;
+ aEvent.StopCrossProcessForwarding();
return;
}
// Event listeners may kill nsPresContext and nsPresShell.
if (!CanDispatchEvent()) {
return;
}
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -137,16 +137,20 @@ public:
{
mPropagationStopped = true;
}
inline void StopImmediatePropagation()
{
StopPropagation();
mImmediatePropagationStopped = true;
}
+ inline void StopCrossProcessForwarding()
+ {
+ mNoCrossProcessBoundaryForwarding = true;
+ }
inline void Clear()
{
SetRawFlags(0);
}
// Get if either the instance's bit or the aOther's bit is true, the
// instance's bit becomes true. In other words, this works like:
// eventFlags |= aOther;
@@ -321,16 +325,17 @@ public:
originalTarget = aCopyTargets ? aEvent.originalTarget : nullptr;
}
/**
* Helper methods for methods of DOM Event.
*/
void StopPropagation() { mFlags.StopPropagation(); }
void StopImmediatePropagation() { mFlags.StopImmediatePropagation(); }
+ void StopCrossProcessForwarding() { mFlags.StopCrossProcessForwarding(); }
void PreventDefault()
{
mFlags.mDefaultPrevented = true;
mFlags.mDefaultPreventedByChrome = true;
}
/**