Bug 1162009 - Add TOUCH_CANCEL sending on e10s. r=kats

This commit is contained in:
Maksim Lebedev 2015-05-14 08:16:00 -04:00
parent 7bed5a5691
commit 513de9dca0
10 changed files with 72 additions and 32 deletions

View File

@ -60,6 +60,7 @@ using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
using nsIWidget::TouchPointerState from "nsIWidget.h";
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
using struct mozilla::OwningSerializedStructuredCloneBuffer from "ipc/IPCMessageUtils.h";
using nsEventStatus from "mozilla/EventForwards.h";
namespace mozilla {
namespace dom {
@ -594,8 +595,14 @@ child:
RealMouseButtonEvent(WidgetMouseEvent event);
RealKeyEvent(WidgetKeyboardEvent event, MaybeNativeKeyBinding keyBinding);
MouseWheelEvent(WidgetWheelEvent event, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
RealTouchEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
RealTouchMoveEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
RealTouchEvent(WidgetTouchEvent aEvent,
ScrollableLayerGuid aGuid,
uint64_t aInputBlockId,
nsEventStatus aApzResponse);
RealTouchMoveEvent(WidgetTouchEvent aEvent,
ScrollableLayerGuid aGuid,
uint64_t aInputBlockId,
nsEventStatus aApzResponse);
RealDragEvent(WidgetDragEvent aEvent, uint32_t aDragAction, uint32_t aDropEffect);
/**

View File

@ -88,6 +88,7 @@
#include "nsNetUtil.h"
#include "nsIPermissionManager.h"
#include "nsIScriptError.h"
#include "mozilla/EventForwards.h"
#define BROWSER_ELEMENT_CHILD_SCRIPT \
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
@ -2379,7 +2380,8 @@ TabChild::GetPresShellResolution() const
bool
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId)
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse)
{
TABC_LOG("Receiving touch event of type %d\n", aEvent.message);
@ -2407,17 +2409,17 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
return true;
}
mAPZEventState->ProcessTouchEvent(localEvent, aGuid, aInputBlockId,
nsEventStatus_eIgnore);
mAPZEventState->ProcessTouchEvent(localEvent, aGuid, aInputBlockId, aApzResponse);
return true;
}
bool
TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId)
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse)
{
return RecvRealTouchEvent(aEvent, aGuid, aInputBlockId);
return RecvRealTouchEvent(aEvent, aGuid, aInputBlockId, aApzResponse);
}
bool

View File

@ -363,10 +363,12 @@ public:
const uint64_t& aInputBlockId) override;
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse) override;
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) override;
const uint64_t& aInputBlockId,
const nsEventStatus& aApzResponse) override;
virtual bool RecvKeyEvent(const nsString& aType,
const int32_t& aKeyCode,
const int32_t& aCharCode,

View File

@ -96,7 +96,14 @@ struct ParamTraits<mozilla::dom::AudioChannelState>
mozilla::dom::AUDIO_CHANNEL_STATE_LAST>
{ };
template <>
struct ParamTraits<nsEventStatus>
: public ContiguousEnumSerializer<nsEventStatus,
nsEventStatus_eIgnore,
nsEventStatus_eSentinel>
{ };
}
#endif

View File

@ -1309,7 +1309,7 @@ bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
ScrollableLayerGuid guid;
uint64_t blockId;
ApzAwareEventRoutingToChild(&guid, &blockId);
ApzAwareEventRoutingToChild(&guid, &blockId, nullptr);
event.refPoint += GetChildProcessOffset();
return PBrowserParent::SendMouseWheelEvent(event, guid, blockId);
}
@ -1624,7 +1624,8 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
ScrollableLayerGuid guid;
uint64_t blockId;
ApzAwareEventRoutingToChild(&guid, &blockId);
nsEventStatus apzResponse;
ApzAwareEventRoutingToChild(&guid, &blockId, &apzResponse);
if (mIsDestroyed) {
return false;
@ -1636,8 +1637,8 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
}
return (event.message == NS_TOUCH_MOVE) ?
PBrowserParent::SendRealTouchMoveEvent(event, guid, blockId) :
PBrowserParent::SendRealTouchEvent(event, guid, blockId);
PBrowserParent::SendRealTouchMoveEvent(event, guid, blockId, apzResponse) :
PBrowserParent::SendRealTouchEvent(event, guid, blockId, apzResponse);
}
bool
@ -2727,7 +2728,8 @@ TabParent::GetWidget() const
void
TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
uint64_t* aOutInputBlockId,
nsEventStatus* aOutApzResponse)
{
if (gfxPrefs::AsyncPanZoomEnabled()) {
if (aOutTargetGuid) {
@ -2747,6 +2749,9 @@ TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
if (aOutInputBlockId) {
*aOutInputBlockId = InputAPZContext::GetInputBlockId();
}
if (aOutApzResponse) {
*aOutApzResponse = InputAPZContext::GetApzResponse();
}
// Let the widget know that the event will be sent to the child process,
// which will (hopefully) send a confirmation notice back to APZ.

View File

@ -502,18 +502,17 @@ private:
// Update state prior to routing an APZ-aware event to the child process.
// |aOutTargetGuid| will contain the identifier
// of the APZC instance that handled the event. aOutTargetGuid may be
// null.
// of the APZC instance that handled the event. aOutTargetGuid may be null.
// |aOutInputBlockId| will contain the identifier of the input block
// that this event was added to, if there was one. aOutInputBlockId may
// be null.
// that this event was added to, if there was one. aOutInputBlockId may be null.
// |aOutApzResponse| will contain the response that the APZ gave when processing
// the input block; this is used for generating appropriate pointercancel events.
void ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId);
// When true, we've initiated normal shutdown and notified our
// managing PContent.
uint64_t* aOutInputBlockId,
nsEventStatus* aOutApzResponse);
// When true, we've initiated normal shutdown and notified our managing PContent.
bool mMarkedDestroying;
// When true, the TabParent is invalid and we should not send IPC messages
// anymore.
// When true, the TabParent is invalid and we should not send IPC messages anymore.
bool mIsDestroyed;
// Whether we have already sent a FileDescriptor for the app package.
bool mAppPackageFileDescriptorSent;

View File

@ -10,6 +10,7 @@ namespace layers {
ScrollableLayerGuid InputAPZContext::sGuid;
uint64_t InputAPZContext::sBlockId = 0;
nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eIgnore;
bool InputAPZContext::sRoutedToChildProcess = false;
/*static*/ ScrollableLayerGuid
@ -24,6 +25,12 @@ InputAPZContext::GetInputBlockId()
return sBlockId;
}
/*static*/ nsEventStatus
InputAPZContext::GetApzResponse()
{
return sApzResponse;
}
/*static*/ void
InputAPZContext::SetRoutedToChildProcess()
{
@ -31,13 +38,16 @@ InputAPZContext::SetRoutedToChildProcess()
}
InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
const uint64_t& aBlockId)
const uint64_t& aBlockId,
const nsEventStatus& aApzResponse)
: mOldGuid(sGuid)
, mOldBlockId(sBlockId)
, mOldApzResponse(sApzResponse)
, mOldRoutedToChildProcess(sRoutedToChildProcess)
{
sGuid = aGuid;
sBlockId = aBlockId;
sApzResponse = aApzResponse;
sRoutedToChildProcess = false;
}
@ -45,6 +55,7 @@ InputAPZContext::~InputAPZContext()
{
sGuid = mOldGuid;
sBlockId = mOldBlockId;
sApzResponse = mOldApzResponse;
sRoutedToChildProcess = mOldRoutedToChildProcess;
}

View File

@ -7,28 +7,32 @@
#define mozilla_layers_InputAPZContext_h
#include "FrameMetrics.h"
#include "mozilla/EventForwards.h"
namespace mozilla {
namespace layers {
// InputAPZContext is used to communicate the ScrollableLayerGuid and input
// block ID from nsIWidget to RenderFrameParent. It is conceptually attached
// to any WidgetInputEvent that has been processed by APZ directly from a
// widget.
// InputAPZContext is used to communicate the ScrollableLayerGuid,
// input block ID, APZ response from nsIWidget to RenderFrameParent.
// It is conceptually attached to any WidgetInputEvent
// that has been processed by APZ directly from a widget.
class MOZ_STACK_CLASS InputAPZContext
{
private:
static ScrollableLayerGuid sGuid;
static uint64_t sBlockId;
static nsEventStatus sApzResponse;
static bool sRoutedToChildProcess;
public:
static ScrollableLayerGuid GetTargetLayerGuid();
static uint64_t GetInputBlockId();
static nsEventStatus GetApzResponse();
static void SetRoutedToChildProcess();
InputAPZContext(const ScrollableLayerGuid& aGuid,
const uint64_t& aBlockId);
const uint64_t& aBlockId,
const nsEventStatus& aApzResponse);
~InputAPZContext();
bool WasRoutedToChildProcess();
@ -36,6 +40,7 @@ public:
private:
ScrollableLayerGuid mOldGuid;
uint64_t mOldBlockId;
nsEventStatus mOldApzResponse;
bool mOldRoutedToChildProcess;
};

View File

@ -23,7 +23,9 @@ enum nsEventStatus
// The event is consumed, don't do default processing
nsEventStatus_eConsumeNoDefault,
// The event is consumed, but do default processing
nsEventStatus_eConsumeDoDefault
nsEventStatus_eConsumeDoDefault,
// Value is not for use, only for serialization
nsEventStatus_eSentinel
};
namespace mozilla {

View File

@ -1014,7 +1014,7 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
nsEventStatus aApzResponse)
{
MOZ_ASSERT(NS_IsMainThread());
InputAPZContext context(aGuid, aInputBlockId);
InputAPZContext context(aGuid, aInputBlockId, aApzResponse);
// If this is a touch event and APZ has targeted it to an APZC in the root
// process, apply that APZC's callback-transform before dispatching the