Bug 937688 - Get the guid from ReceiveInputEvent and use it in the callback to ContentReceivedTouch. r=botond

This commit is contained in:
Kartikaya Gupta 2013-11-13 13:20:31 -05:00
Родитель 0fe345daf7
Коммит 769fa270c3
8 изменённых файлов: 71 добавлений и 25 удалений

Просмотреть файл

@ -23,6 +23,7 @@ using struct gfxMatrix from "gfxMatrix.h";
using struct gfxSize from "gfxPoint.h";
using CSSRect from "Units.h";
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
using FrameMetrics::ViewID from "FrameMetrics.h";
using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
@ -285,7 +286,7 @@ parent:
* batched and only processed for panning and zooming if content does not
* preventDefault.
*/
ContentReceivedTouch(bool aPreventDefault);
ContentReceivedTouch(ScrollableLayerGuid aGuid, bool aPreventDefault);
/**
* Updates the parent's zoom constraints for this tab. The zoom controller
@ -373,10 +374,10 @@ child:
RealMouseEvent(WidgetMouseEvent event);
RealKeyEvent(WidgetKeyboardEvent event);
MouseWheelEvent(WidgetWheelEvent event);
RealTouchEvent(WidgetTouchEvent event);
RealTouchEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid);
// We use a separate message for touchmove events only to apply
// compression to them.
RealTouchMoveEvent(WidgetTouchEvent event) compress;
RealTouchMoveEvent(WidgetTouchEvent aEvent, ScrollableLayerGuid aGuid) compress;
/**
* @see nsIDOMWindowUtils sendKeyEvent.

Просмотреть файл

@ -1867,7 +1867,8 @@ TabChild::CancelTapTracking()
}
bool
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent)
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid)
{
WidgetTouchEvent localEvent(aEvent);
nsEventStatus status = DispatchWidgetEvent(localEvent);
@ -1877,7 +1878,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent)
nsCOMPtr<nsPIDOMWindow> innerWindow = outerWindow->GetCurrentInnerWindow();
if (innerWindow && innerWindow->HasTouchEventListeners()) {
SendContentReceivedTouch(nsIPresShell::gPreventMouseEvents);
SendContentReceivedTouch(aGuid, nsIPresShell::gPreventMouseEvents);
}
} else {
UpdateTapState(aEvent, status);
@ -1887,9 +1888,10 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent)
}
bool
TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent)
TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid)
{
return RecvRealTouchEvent(aEvent);
return RecvRealTouchEvent(aEvent, aGuid);
}
bool

Просмотреть файл

@ -229,8 +229,10 @@ public:
virtual bool RecvRealMouseEvent(const mozilla::WidgetMouseEvent& event);
virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event);
virtual bool RecvMouseWheelEvent(const mozilla::WidgetWheelEvent& event);
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& event);
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& event);
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid);
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid);
virtual bool RecvKeyEvent(const nsString& aType,
const int32_t& aKeyCode,
const int32_t& aCharCode,

Просмотреть файл

@ -649,7 +649,7 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
return false;
}
WidgetMouseEvent e(event);
MaybeForwardEventToRenderFrame(event, &e);
MaybeForwardEventToRenderFrame(event, nullptr, &e);
if (!MapEventCoordinatesForChildProcess(&e)) {
return false;
}
@ -662,7 +662,7 @@ bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
return false;
}
WidgetWheelEvent e(event);
MaybeForwardEventToRenderFrame(event, &e);
MaybeForwardEventToRenderFrame(event, nullptr, &e);
if (!MapEventCoordinatesForChildProcess(&e)) {
return false;
}
@ -675,7 +675,7 @@ bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event)
return false;
}
WidgetKeyboardEvent e(event);
MaybeForwardEventToRenderFrame(event, &e);
MaybeForwardEventToRenderFrame(event, nullptr, &e);
if (!MapEventCoordinatesForChildProcess(&e)) {
return false;
}
@ -720,13 +720,14 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
}
}
MaybeForwardEventToRenderFrame(event, &e);
ScrollableLayerGuid guid;
MaybeForwardEventToRenderFrame(event, &guid, &e);
MapEventCoordinatesForChildProcess(mChildProcessOffsetAtTouchStart, &e);
return (e.message == NS_TOUCH_MOVE) ?
PBrowserParent::SendRealTouchMoveEvent(e) :
PBrowserParent::SendRealTouchEvent(e);
PBrowserParent::SendRealTouchMoveEvent(e, guid) :
PBrowserParent::SendRealTouchEvent(e, guid);
}
/*static*/ TabParent*
@ -1576,10 +1577,11 @@ TabParent::UseAsyncPanZoom()
void
TabParent::MaybeForwardEventToRenderFrame(const WidgetInputEvent& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
WidgetInputEvent* aOutEvent)
{
if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->NotifyInputEvent(aEvent, aOutEvent);
rfp->NotifyInputEvent(aEvent, aOutTargetGuid, aOutEvent);
}
}
@ -1646,10 +1648,11 @@ TabParent::RecvUpdateScrollOffset(const uint32_t& aPresShellId,
}
bool
TabParent::RecvContentReceivedTouch(const bool& aPreventDefault)
TabParent::RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid,
const bool& aPreventDefault)
{
if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->ContentReceivedTouch(aPreventDefault);
rfp->ContentReceivedTouch(aGuid, aPreventDefault);
}
return true;
}

Просмотреть файл

@ -169,7 +169,8 @@ public:
const CSSToScreenScale& aMinZoom,
const CSSToScreenScale& aMaxZoom);
virtual bool RecvUpdateScrollOffset(const uint32_t& aPresShellId, const ViewID& aViewId, const CSSIntPoint& aScrollOffset);
virtual bool RecvContentReceivedTouch(const bool& aPreventDefault);
virtual bool RecvContentReceivedTouch(const ScrollableLayerGuid& aGuid,
const bool& aPreventDefault);
virtual bool RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
const bool& aIsAudio,
const bool& aIsVideo);
@ -345,8 +346,11 @@ private:
// If we have a render frame currently, notify it that we're about
// to dispatch |aEvent| to our child. If there's a relevant
// transform in place, |aOutEvent| is the transformed |aEvent| to
// dispatch to content.
// dispatch to content. |aOutTargetGuid| will contain the identifier
// of the APZC instance that handled the event. aOutTargetGuid may be
// null but aOutEvent must not be.
void MaybeForwardEventToRenderFrame(const WidgetInputEvent& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
WidgetInputEvent* aOutEvent);
// The offset for the child process which is sampled at touch start. This
// means that the touch events are relative to where the frame was at the

Просмотреть файл

@ -660,6 +660,26 @@ struct ParamTraits<mozilla::gfx::SurfaceFormat>
mozilla::gfx::FORMAT_UNKNOWN>
{};
template <>
struct ParamTraits<mozilla::layers::ScrollableLayerGuid>
{
typedef mozilla::layers::ScrollableLayerGuid paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.mLayersId);
WriteParam(aMsg, aParam.mPresShellId);
WriteParam(aMsg, aParam.mScrollId);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
return (ReadParam(aMsg, aIter, &aResult->mLayersId) &&
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
ReadParam(aMsg, aIter, &aResult->mScrollId));
}
};
} /* namespace IPC */
#endif /* __GFXMESSAGEUTILS_H__ */

Просмотреть файл

@ -827,10 +827,11 @@ RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
void
RenderFrameParent::NotifyInputEvent(const WidgetInputEvent& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
WidgetInputEvent* aOutEvent)
{
if (GetApzcTreeManager()) {
GetApzcTreeManager()->ReceiveInputEvent(aEvent, nullptr, aOutEvent);
GetApzcTreeManager()->ReceiveInputEvent(aEvent, aOutTargetGuid, aOutEvent);
}
}
@ -1011,11 +1012,11 @@ RenderFrameParent::ZoomToRect(uint32_t aPresShellId, ViewID aViewId,
}
void
RenderFrameParent::ContentReceivedTouch(bool aPreventDefault)
RenderFrameParent::ContentReceivedTouch(const ScrollableLayerGuid& aGuid,
bool aPreventDefault)
{
if (GetApzcTreeManager()) {
GetApzcTreeManager()->ContentReceivedTouch(ScrollableLayerGuid(mLayersId),
aPreventDefault);
GetApzcTreeManager()->ContentReceivedTouch(aGuid, aPreventDefault);
}
}

Просмотреть файл

@ -30,6 +30,7 @@ class GestureEventListener;
class TargetConfig;
class LayerTransactionParent;
struct TextureFactoryIdentifier;
struct ScrollableLayerGuid;
}
namespace layout {
@ -47,6 +48,7 @@ class RenderFrameParent : public PRenderFrameParent,
typedef mozilla::layers::LayerTransactionParent LayerTransactionParent;
typedef mozilla::FrameLayerBuilder::ContainerParameters ContainerParameters;
typedef mozilla::layers::TextureFactoryIdentifier TextureFactoryIdentifier;
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
typedef FrameMetrics::ViewID ViewID;
public:
@ -93,14 +95,25 @@ public:
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
/**
* Notify the APZ code of an input event, and get back the untransformed event.
* @param aOutTargetGuid An out-parameter that will contain the identifier
* of the APZC instance that handled the event, if one was found. This
* argument may be null.
* @param aOutEvent An out-parameter that contains aEvent with the async transforms
* unapplied. This can be passed to Gecko for hit testing and normal event
* dispatch. This argument may not be null.
*/
void NotifyInputEvent(const WidgetInputEvent& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
WidgetInputEvent* aOutEvent);
void NotifyDimensionsChanged(ScreenIntSize size);
void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect);
void ContentReceivedTouch(bool aPreventDefault);
void ContentReceivedTouch(const ScrollableLayerGuid& aGuid,
bool aPreventDefault);
void UpdateZoomConstraints(bool aAllowZoom,
const CSSToScreenScale& aMinZoom,