Bug 1281575 - Create IPDL protocol implementation of IAPZCTreeManager. r=kats

This commit is contained in:
Ryan Hunt 2016-07-20 13:37:00 +02:00
Родитель de1e16b8e9
Коммит aa91ba815f
13 изменённых файлов: 1293 добавлений и 25 удалений

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

@ -865,6 +865,9 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
tapInput.mPoint = *untransformedPoint; tapInput.mPoint = *untransformedPoint;
} }
break; break;
} case SENTINEL_INPUT: {
MOZ_ASSERT_UNREACHABLE("Invalid InputType.");
break;
} }
} }
return result; return result;

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

@ -27,6 +27,7 @@ namespace layers {
class Layer; class Layer;
class AsyncPanZoomController; class AsyncPanZoomController;
class APZCTreeManagerParent;
class CompositorBridgeParent; class CompositorBridgeParent;
class OverscrollHandoffChain; class OverscrollHandoffChain;
struct OverscrollHandoffState; struct OverscrollHandoffState;
@ -381,18 +382,20 @@ public:
*/ */
void SetLongTapEnabled(bool aTapGestureEnabled) override; void SetLongTapEnabled(bool aTapGestureEnabled) override;
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~APZCTreeManager();
// Methods to help process WidgetInputEvents (or manage conversion to/from InputData) // Methods to help process WidgetInputEvents (or manage conversion to/from InputData)
void TransformEventRefPoint( void TransformEventRefPoint(
LayoutDeviceIntPoint* aRefPoint, LayoutDeviceIntPoint* aRefPoint,
ScrollableLayerGuid* aOutTargetGuid) override; ScrollableLayerGuid* aOutTargetGuid) override;
void UpdateWheelTransaction( void UpdateWheelTransaction(
LayoutDeviceIntPoint aRefPoint, LayoutDeviceIntPoint aRefPoint,
EventMessage aEventMessage) override; EventMessage aEventMessage) override;
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~APZCTreeManager();
// Protected hooks for gtests subclass // Protected hooks for gtests subclass
virtual AsyncPanZoomController* NewAPZCInstance(uint64_t aLayersId, virtual AsyncPanZoomController* NewAPZCInstance(uint64_t aLayersId,
GeckoContentController* aController); GeckoContentController* aController);

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

@ -1003,7 +1003,7 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent,
} }
case SCROLLWHEEL_INPUT: { case SCROLLWHEEL_INPUT: {
ScrollWheelInput scrollInput = aEvent.AsScrollWheelInput(); ScrollWheelInput scrollInput = aEvent.AsScrollWheelInput();
if (!scrollInput.TransformToLocal(aTransformToApzc)) { if (!scrollInput.TransformToLocal(aTransformToApzc)) {
return rv; return rv;
} }
@ -1012,7 +1012,7 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent,
} }
case PINCHGESTURE_INPUT: { case PINCHGESTURE_INPUT: {
PinchGestureInput pinchInput = aEvent.AsPinchGestureInput(); PinchGestureInput pinchInput = aEvent.AsPinchGestureInput();
if (!pinchInput.TransformToLocal(aTransformToApzc)) { if (!pinchInput.TransformToLocal(aTransformToApzc)) {
return rv; return rv;
} }
@ -1021,7 +1021,7 @@ nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent,
} }
case TAPGESTURE_INPUT: { case TAPGESTURE_INPUT: {
TapGestureInput tapInput = aEvent.AsTapGestureInput(); TapGestureInput tapInput = aEvent.AsTapGestureInput();
if (!tapInput.TransformToLocal(aTransformToApzc)) { if (!tapInput.TransformToLocal(aTransformToApzc)) {
return rv; return rv;
} }
@ -1470,7 +1470,7 @@ AsyncPanZoomController::ConvertToGecko(const ScreenIntPoint& aPoint, CSSPoint* a
ScreenToScreenMatrix4x4 transformScreenToGecko = ScreenToScreenMatrix4x4 transformScreenToGecko =
treeManagerLocal->GetScreenToApzcTransform(this) treeManagerLocal->GetScreenToApzcTransform(this)
* treeManagerLocal->GetApzcToGeckoTransform(this); * treeManagerLocal->GetApzcToGeckoTransform(this);
Maybe<ScreenIntPoint> layoutPoint = UntransformBy( Maybe<ScreenIntPoint> layoutPoint = UntransformBy(
transformScreenToGecko, aPoint); transformScreenToGecko, aPoint);
if (!layoutPoint) { if (!layoutPoint) {
@ -1776,6 +1776,11 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEve
animation->Update(aEvent.mTimeStamp, deltaInAppUnits, nsSize(velocity.x, velocity.y)); animation->Update(aEvent.mTimeStamp, deltaInAppUnits, nsSize(velocity.x, velocity.y));
break; break;
} }
case ScrollWheelInput::SCROLLMODE_SENTINEL: {
MOZ_ASSERT_UNREACHABLE("Invalid ScrollMode.");
break;
}
} }
return nsEventStatus_eConsumeNoDefault; return nsEventStatus_eConsumeNoDefault;

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

@ -126,6 +126,9 @@ nsEventStatus GestureEventListener::HandleInputEvent(const MultiTouchInput& aEve
mTouches.Clear(); mTouches.Clear();
rv = HandleInputTouchCancel(); rv = HandleInputTouchCancel();
break; break;
case MultiTouchInput::MULTITOUCH_SENTINEL:
MOZ_ASSERT_UNREACHABLE("Invalid MultTouchInput.");
break;
} }
return rv; return rv;

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

@ -0,0 +1,215 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* 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/. */
#include "mozilla/layers/APZCTreeManagerChild.h"
#include "InputData.h" // for InputData
namespace mozilla {
namespace layers {
nsEventStatus
APZCTreeManagerChild::ReceiveInputEvent(
InputData& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
switch (aEvent.mInputType) {
case MULTITOUCH_INPUT: {
MultiTouchInput& event = aEvent.AsMultiTouchInput();
MultiTouchInput processedEvent;
nsEventStatus res;
SendReceiveMultiTouchInputEvent(event,
&res,
&processedEvent,
aOutTargetGuid,
aOutInputBlockId);
event = processedEvent;
return res;
}
case MOUSE_INPUT: {
MouseInput& event = aEvent.AsMouseInput();
MouseInput processedEvent;
nsEventStatus res;
SendReceiveMouseInputEvent(event,
&res,
&processedEvent,
aOutTargetGuid,
aOutInputBlockId);
event = processedEvent;
return res;
}
case PANGESTURE_INPUT: {
PanGestureInput& event = aEvent.AsPanGestureInput();
PanGestureInput processedEvent;
nsEventStatus res;
SendReceivePanGestureInputEvent(event,
&res,
&processedEvent,
aOutTargetGuid,
aOutInputBlockId);
event = processedEvent;
return res;
}
case PINCHGESTURE_INPUT: {
PinchGestureInput& event = aEvent.AsPinchGestureInput();
PinchGestureInput processedEvent;
nsEventStatus res;
SendReceivePinchGestureInputEvent(event,
&res,
&processedEvent,
aOutTargetGuid,
aOutInputBlockId);
event = processedEvent;
return res;
}
case TAPGESTURE_INPUT: {
TapGestureInput& event = aEvent.AsTapGestureInput();
TapGestureInput processedEvent;
nsEventStatus res;
SendReceiveTapGestureInputEvent(event,
&res,
&processedEvent,
aOutTargetGuid,
aOutInputBlockId);
event = processedEvent;
return res;
}
case SCROLLWHEEL_INPUT: {
ScrollWheelInput& event = aEvent.AsScrollWheelInput();
ScrollWheelInput processedEvent;
nsEventStatus res;
SendReceiveScrollWheelInputEvent(event,
&res,
&processedEvent,
aOutTargetGuid,
aOutInputBlockId);
event = processedEvent;
return res;
}
default: {
MOZ_ASSERT_UNREACHABLE("Invalid InputData type.");
return nsEventStatus_eConsumeNoDefault;
}
}
}
void
APZCTreeManagerChild::ZoomToRect(
const ScrollableLayerGuid& aGuid,
const CSSRect& aRect,
const uint32_t aFlags)
{
SendZoomToRect(aGuid, aRect, aFlags);
}
void
APZCTreeManagerChild::ContentReceivedInputBlock(
uint64_t aInputBlockId,
bool aPreventDefault)
{
SendContentReceivedInputBlock(aInputBlockId, aPreventDefault);
}
void
APZCTreeManagerChild::SetTargetAPZC(
uint64_t aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets)
{
SendSetTargetAPZC(aInputBlockId, aTargets);
}
void
APZCTreeManagerChild::UpdateZoomConstraints(
const ScrollableLayerGuid& aGuid,
const Maybe<ZoomConstraints>& aConstraints)
{
SendUpdateZoomConstraints(aGuid, aConstraints);
}
void
APZCTreeManagerChild::CancelAnimation(const ScrollableLayerGuid &aGuid)
{
SendCancelAnimation(aGuid);
}
void
APZCTreeManagerChild::AdjustScrollForSurfaceShift(const ScreenPoint& aShift)
{
SendAdjustScrollForSurfaceShift(aShift);
}
void
APZCTreeManagerChild::SetDPI(float aDpiValue)
{
SendSetDPI(aDpiValue);
}
void
APZCTreeManagerChild::SetAllowedTouchBehavior(
uint64_t aInputBlockId,
const nsTArray<TouchBehaviorFlags>& aValues)
{
SendSetAllowedTouchBehavior(aInputBlockId, aValues);
}
void
APZCTreeManagerChild::StartScrollbarDrag(
const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics)
{
SendStartScrollbarDrag(aGuid, aDragMetrics);
}
void
APZCTreeManagerChild::SetLongTapEnabled(bool aTapGestureEnabled)
{
SendSetLongTapEnabled(aTapGestureEnabled);
}
void
APZCTreeManagerChild::ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY)
{
SendProcessTouchVelocity(aTimestampMs, aSpeedY);
}
void
APZCTreeManagerChild::UpdateWheelTransaction(
LayoutDeviceIntPoint aRefPoint,
EventMessage aEventMessage)
{
SendUpdateWheelTransaction(aRefPoint, aEventMessage);
}
void APZCTreeManagerChild::TransformEventRefPoint(
LayoutDeviceIntPoint* aRefPoint,
ScrollableLayerGuid* aOutTargetGuid)
{
SendTransformEventRefPoint(*aRefPoint, aRefPoint, aOutTargetGuid);
}
void
APZCTreeManagerChild::OnProcessingError(
Result aCode,
const char* aReason)
{
MOZ_RELEASE_ASSERT(aCode != MsgDropped);
}
} // namespace layers
} // namespace mozilla

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

@ -0,0 +1,100 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* 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_layers_APZCTreeManagerChild_h
#define mozilla_layers_APZCTreeManagerChild_h
#include "mozilla/layers/IAPZCTreeManager.h"
#include "mozilla/layers/PAPZCTreeManagerChild.h"
namespace mozilla {
namespace layers {
class APZCTreeManagerChild
: public IAPZCTreeManager
, public PAPZCTreeManagerChild
{
public:
APZCTreeManagerChild() { }
nsEventStatus
ReceiveInputEvent(
InputData& aEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId) override;
void
ZoomToRect(
const ScrollableLayerGuid& aGuid,
const CSSRect& aRect,
const uint32_t aFlags = DEFAULT_BEHAVIOR) override;
void
ContentReceivedInputBlock(
uint64_t aInputBlockId,
bool aPreventDefault) override;
void
SetTargetAPZC(
uint64_t aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets) override;
void
UpdateZoomConstraints(
const ScrollableLayerGuid& aGuid,
const Maybe<ZoomConstraints>& aConstraints) override;
void
CancelAnimation(const ScrollableLayerGuid &aGuid) override;
void
AdjustScrollForSurfaceShift(const ScreenPoint& aShift) override;
void
SetDPI(float aDpiValue) override;
void
SetAllowedTouchBehavior(
uint64_t aInputBlockId,
const nsTArray<TouchBehaviorFlags>& aValues) override;
void
StartScrollbarDrag(
const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics) override;
void
SetLongTapEnabled(bool aTapGestureEnabled) override;
void
ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY) override;
void
TransformEventRefPoint(
LayoutDeviceIntPoint* aRefPoint,
ScrollableLayerGuid* aOutTargetGuid) override;
void
UpdateWheelTransaction(
LayoutDeviceIntPoint aRefPoint,
EventMessage aEventMessage) override;
void
OnProcessingError(
Result aCode,
const char* aReason) override;
protected:
virtual
~APZCTreeManagerChild() { }
};
} // namespace layers
} // namespace mozilla
#endif // mozilla_layers_APZCTreeManagerChild_h

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

@ -0,0 +1,250 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* 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/. */
#include "mozilla/layers/APZCTreeManagerParent.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/APZThreadUtils.h"
namespace mozilla {
namespace layers {
APZCTreeManagerParent::APZCTreeManagerParent(RefPtr<APZCTreeManager> aAPZCTreeManager)
: mTreeManager(aAPZCTreeManager)
{
MOZ_ASSERT(aAPZCTreeManager != nullptr);
}
bool
APZCTreeManagerParent::RecvReceiveMultiTouchInputEvent(
const MultiTouchInput& aEvent,
nsEventStatus* aOutStatus,
MultiTouchInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
MultiTouchInput event = aEvent;
*aOutStatus = mTreeManager->ReceiveInputEvent(
event,
aOutTargetGuid,
aOutInputBlockId);
*aOutEvent = event;
return true;
}
bool
APZCTreeManagerParent::RecvReceiveMouseInputEvent(
const MouseInput& aEvent,
nsEventStatus* aOutStatus,
MouseInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
MouseInput event = aEvent;
*aOutStatus = mTreeManager->ReceiveInputEvent(
event,
aOutTargetGuid,
aOutInputBlockId);
*aOutEvent = event;
return true;
}
bool
APZCTreeManagerParent::RecvReceivePanGestureInputEvent(
const PanGestureInput& aEvent,
nsEventStatus* aOutStatus,
PanGestureInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
PanGestureInput event = aEvent;
*aOutStatus = mTreeManager->ReceiveInputEvent(
event,
aOutTargetGuid,
aOutInputBlockId);
*aOutEvent = event;
return true;
}
bool
APZCTreeManagerParent::RecvReceivePinchGestureInputEvent(
const PinchGestureInput& aEvent,
nsEventStatus* aOutStatus,
PinchGestureInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
PinchGestureInput event = aEvent;
*aOutStatus = mTreeManager->ReceiveInputEvent(
event,
aOutTargetGuid,
aOutInputBlockId);
*aOutEvent = event;
return true;
}
bool
APZCTreeManagerParent::RecvReceiveTapGestureInputEvent(
const TapGestureInput& aEvent,
nsEventStatus* aOutStatus,
TapGestureInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
TapGestureInput event = aEvent;
*aOutStatus = mTreeManager->ReceiveInputEvent(
event,
aOutTargetGuid,
aOutInputBlockId);
*aOutEvent = event;
return true;
}
bool
APZCTreeManagerParent::RecvReceiveScrollWheelInputEvent(
const ScrollWheelInput& aEvent,
nsEventStatus* aOutStatus,
ScrollWheelInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId)
{
ScrollWheelInput event = aEvent;
*aOutStatus = mTreeManager->ReceiveInputEvent(
event,
aOutTargetGuid,
aOutInputBlockId);
*aOutEvent = event;
return true;
}
bool
APZCTreeManagerParent::RecvZoomToRect(
const ScrollableLayerGuid& aGuid,
const CSSRect& aRect,
const uint32_t& aFlags)
{
mTreeManager->ZoomToRect(aGuid, aRect, aFlags);
return true;
}
bool
APZCTreeManagerParent::RecvContentReceivedInputBlock(
const uint64_t& aInputBlockId,
const bool& aPreventDefault)
{
mTreeManager->ContentReceivedInputBlock(aInputBlockId, aPreventDefault);
return true;
}
bool
APZCTreeManagerParent::RecvSetTargetAPZC(
const uint64_t& aInputBlockId,
nsTArray<ScrollableLayerGuid>&& aTargets)
{
mTreeManager->SetTargetAPZC(aInputBlockId, aTargets);
return true;
}
bool
APZCTreeManagerParent::RecvUpdateZoomConstraints(
const ScrollableLayerGuid& aGuid,
const MaybeZoomConstraints& aConstraints)
{
mTreeManager->UpdateZoomConstraints(aGuid, aConstraints);
return true;
}
bool
APZCTreeManagerParent::RecvCancelAnimation(const ScrollableLayerGuid& aGuid)
{
mTreeManager->CancelAnimation(aGuid);
return true;
}
bool
APZCTreeManagerParent::RecvAdjustScrollForSurfaceShift(const ScreenPoint& aShift)
{
mTreeManager->AdjustScrollForSurfaceShift(aShift);
return true;
}
bool
APZCTreeManagerParent::RecvSetDPI(const float& aDpiValue)
{
mTreeManager->SetDPI(aDpiValue);
return true;
}
bool
APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
const uint64_t& aInputBlockId,
nsTArray<TouchBehaviorFlags>&& aValues)
{
mTreeManager->SetAllowedTouchBehavior(aInputBlockId, aValues);
return true;
}
bool
APZCTreeManagerParent::RecvStartScrollbarDrag(
const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics)
{
mTreeManager->StartScrollbarDrag(aGuid, aDragMetrics);
return true;
}
bool
APZCTreeManagerParent::RecvSetLongTapEnabled(const bool& aTapGestureEnabled)
{
mTreeManager->SetLongTapEnabled(aTapGestureEnabled);
return true;
}
bool
APZCTreeManagerParent::RecvProcessTouchVelocity(
const uint32_t& aTimestampMs,
const float& aSpeedY)
{
mTreeManager->ProcessTouchVelocity(aTimestampMs, aSpeedY);
return true;
}
bool
APZCTreeManagerParent::RecvUpdateWheelTransaction(
const LayoutDeviceIntPoint& aRefPoint,
const EventMessage& aEventMessage)
{
mTreeManager->UpdateWheelTransaction(aRefPoint, aEventMessage);
return true;
}
bool
APZCTreeManagerParent::RecvTransformEventRefPoint(
const LayoutDeviceIntPoint& aRefPoint,
LayoutDeviceIntPoint* aOutRefPoint,
ScrollableLayerGuid* aOutTargetGuid)
{
LayoutDeviceIntPoint refPoint = aRefPoint;
mTreeManager->TransformEventRefPoint(&refPoint, aOutTargetGuid);
*aOutRefPoint = refPoint;
return true;
}
} // namespace layers
} // namespace mozilla

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

@ -0,0 +1,142 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=99: */
/* 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_layers_APZCTreeManagerParent_h
#define mozilla_layers_APZCTreeManagerParent_h
#include "mozilla/layers/PAPZCTreeManagerParent.h"
namespace mozilla {
namespace layers {
class APZCTreeManager;
class APZCTreeManagerParent
: public PAPZCTreeManagerParent
{
public:
APZCTreeManagerParent(RefPtr<APZCTreeManager> aAPZCTreeManager);
virtual ~APZCTreeManagerParent() { }
bool
RecvReceiveMultiTouchInputEvent(
const MultiTouchInput& aEvent,
nsEventStatus* aOutStatus,
MultiTouchInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId) override;
bool
RecvReceiveMouseInputEvent(
const MouseInput& aEvent,
nsEventStatus* aOutStatus,
MouseInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId) override;
bool
RecvReceivePanGestureInputEvent(
const PanGestureInput& aEvent,
nsEventStatus* aOutStatus,
PanGestureInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId) override;
bool
RecvReceivePinchGestureInputEvent(
const PinchGestureInput& aEvent,
nsEventStatus* aOutStatus,
PinchGestureInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId) override;
bool
RecvReceiveTapGestureInputEvent(
const TapGestureInput& aEvent,
nsEventStatus* aOutStatus,
TapGestureInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId) override;
bool
RecvReceiveScrollWheelInputEvent(
const ScrollWheelInput& aEvent,
nsEventStatus* aOutStatus,
ScrollWheelInput* aOutEvent,
ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId) override;
bool
RecvZoomToRect(
const ScrollableLayerGuid& aGuid,
const CSSRect& aRect,
const uint32_t& aFlags) override;
bool
RecvContentReceivedInputBlock(
const uint64_t& aInputBlockId,
const bool& aPreventDefault) override;
bool
RecvSetTargetAPZC(
const uint64_t& aInputBlockId,
nsTArray<ScrollableLayerGuid>&& aTargets) override;
bool
RecvUpdateZoomConstraints(
const ScrollableLayerGuid& aGuid,
const MaybeZoomConstraints& aConstraints) override;
bool
RecvCancelAnimation(const ScrollableLayerGuid& aGuid) override;
bool
RecvAdjustScrollForSurfaceShift(const ScreenPoint& aShift) override;
bool
RecvSetDPI(const float& aDpiValue) override;
bool
RecvSetAllowedTouchBehavior(
const uint64_t& aInputBlockId,
nsTArray<TouchBehaviorFlags>&& aValues) override;
bool
RecvStartScrollbarDrag(
const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics) override;
bool
RecvSetLongTapEnabled(const bool& aTapGestureEnabled) override;
bool
RecvProcessTouchVelocity(
const uint32_t& aTimestampMs,
const float& aSpeedY) override;
bool
RecvUpdateWheelTransaction(
const LayoutDeviceIntPoint& aRefPoint,
const EventMessage& aEventMessage) override;
bool
RecvTransformEventRefPoint(
const LayoutDeviceIntPoint& aRefPoint,
LayoutDeviceIntPoint* aOutRefPoint,
ScrollableLayerGuid* aOutTargetGuid) override;
void
ActorDestroy(ActorDestroyReason aWhy) override { }
private:
RefPtr<APZCTreeManager> mTreeManager;
};
} // namespace layers
} // namespace mozilla
#endif // mozilla_layers_APZCTreeManagerParent_h

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

@ -11,6 +11,7 @@
#include "ClientLayerManager.h" // for ClientLayerManager #include "ClientLayerManager.h" // for ClientLayerManager
#include "base/message_loop.h" // for MessageLoop #include "base/message_loop.h" // for MessageLoop
#include "base/task.h" // for NewRunnableMethod, etc #include "base/task.h" // for NewRunnableMethod, etc
#include "gfxPrefs.h"
#include "mozilla/layers/LayerTransactionChild.h" #include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/PLayerTransactionChild.h" #include "mozilla/layers/PLayerTransactionChild.h"
#include "mozilla/layers/TextureClient.h"// for TextureClient #include "mozilla/layers/TextureClient.h"// for TextureClient
@ -39,6 +40,7 @@
using mozilla::layers::LayerTransactionChild; using mozilla::layers::LayerTransactionChild;
using mozilla::dom::TabChildBase; using mozilla::dom::TabChildBase;
using mozilla::Unused; using mozilla::Unused;
using mozilla::gfx::GPUProcessManager;
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {

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

@ -0,0 +1,107 @@
/* -*- Mode: C++; tab-width: 8; 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/. */
include "mozilla/GfxMessageUtils.h";
include "ipc/nsGUIEventIPC.h";
using CSSRect from "Units.h";
using LayoutDeviceIntPoint from "Units.h";
using ScreenPoint from "Units.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
using mozilla::layers::MaybeZoomConstraints from "FrameMetrics.h";
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
using mozilla::layers::AsyncDragMetrics from "mozilla/layers/AsyncDragMetrics.h";
using nsEventStatus from "mozilla/EventForwards.h";
using EventMessage from "mozilla/EventForwards.h";
using class mozilla::WidgetInputEvent from "mozilla/BasicEvents.h";
using class mozilla::WidgetMouseEventBase from "mozilla/MouseEvents.h";
using mozilla::WidgetMouseEvent::Reason from "mozilla/MouseEvents.h";
using class mozilla::WidgetTouchEvent from "mozilla/TouchEvents.h";
using class mozilla::WidgetWheelEvent from "mozilla/MouseEvents.h";
using class mozilla::InputData from "InputData.h";
using class mozilla::MultiTouchInput from "InputData.h";
using class mozilla::MouseInput from "InputData.h";
using class mozilla::PanGestureInput from "InputData.h";
using class mozilla::PinchGestureInput from "InputData.h";
using class mozilla::TapGestureInput from "InputData.h";
using class mozilla::ScrollWheelInput from "InputData.h";
namespace mozilla {
namespace layers {
sync protocol PAPZCTreeManager
{
parent:
sync ReceiveMultiTouchInputEvent(MultiTouchInput aEvent)
returns (nsEventStatus aOutStatus,
MultiTouchInput aOutEvent,
ScrollableLayerGuid aOutTargetGuid,
uint64_t aOutInputBlockId);
sync ReceiveMouseInputEvent(MouseInput aEvent)
returns (nsEventStatus aOutStatus,
MouseInput aOutEvent,
ScrollableLayerGuid aOutTargetGuid,
uint64_t aOutInputBlockId);
sync ReceivePanGestureInputEvent(PanGestureInput aEvent)
returns (nsEventStatus aOutStatus,
PanGestureInput aOutEvent,
ScrollableLayerGuid aOutTargetGuid,
uint64_t aOutInputBlockId);
sync ReceivePinchGestureInputEvent(PinchGestureInput aEvent)
returns (nsEventStatus aOutStatus,
PinchGestureInput aOutEvent,
ScrollableLayerGuid aOutTargetGuid,
uint64_t aOutInputBlockId);
sync ReceiveTapGestureInputEvent(TapGestureInput aEvent)
returns (nsEventStatus aOutStatus,
TapGestureInput aOutEvent,
ScrollableLayerGuid aOutTargetGuid,
uint64_t aOutInputBlockId);
sync ReceiveScrollWheelInputEvent(ScrollWheelInput aEvent)
returns (nsEventStatus aOutStatus,
ScrollWheelInput aOutEvent,
ScrollableLayerGuid aOutTargetGuid,
uint64_t aOutInputBlockId);
async ZoomToRect(ScrollableLayerGuid aGuid, CSSRect aRect, uint32_t Flags);
async ContentReceivedInputBlock(uint64_t aInputBlockId, bool PreventDefault);
async SetTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] Targets);
async UpdateZoomConstraints(ScrollableLayerGuid aGuid, MaybeZoomConstraints aConstraints);
async CancelAnimation(ScrollableLayerGuid aGuid);
async AdjustScrollForSurfaceShift(ScreenPoint aShift);
async SetDPI(float aDpiValue);
async SetAllowedTouchBehavior(uint64_t aInputBlockId, TouchBehaviorFlags[] aValues);
async StartScrollbarDrag(ScrollableLayerGuid aGuid, AsyncDragMetrics aDragMetrics);
async SetLongTapEnabled(bool aTapGestureEnabled);
async ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY);
async UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint, EventMessage aEventMessage);
sync TransformEventRefPoint(LayoutDeviceIntPoint aRefPoint)
returns (LayoutDeviceIntPoint aOutRefPoint,
ScrollableLayerGuid aOutTargetGuid);
async __delete__();
};
} // namespace gfx
} // namespace mozilla

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

@ -154,6 +154,8 @@ EXPORTS.mozilla.layers += [
'Effects.h', 'Effects.h',
'ImageDataSerializer.h', 'ImageDataSerializer.h',
'ipc/APZChild.h', 'ipc/APZChild.h',
'ipc/APZCTreeManagerChild.h',
'ipc/APZCTreeManagerParent.h',
'ipc/AsyncTransactionTracker.h', 'ipc/AsyncTransactionTracker.h',
'ipc/CompositableForwarder.h', 'ipc/CompositableForwarder.h',
'ipc/CompositableTransactionParent.h', 'ipc/CompositableTransactionParent.h',
@ -342,6 +344,8 @@ UNIFIED_SOURCES += [
'ImageDataSerializer.cpp', 'ImageDataSerializer.cpp',
'ImageLayers.cpp', 'ImageLayers.cpp',
'ipc/APZChild.cpp', 'ipc/APZChild.cpp',
'ipc/APZCTreeManagerChild.cpp',
'ipc/APZCTreeManagerParent.cpp',
'ipc/AsyncTransactionTracker.cpp', 'ipc/AsyncTransactionTracker.cpp',
'ipc/CompositableTransactionParent.cpp', 'ipc/CompositableTransactionParent.cpp',
'ipc/CompositorBench.cpp', 'ipc/CompositorBench.cpp',
@ -414,6 +418,7 @@ IPDL_SOURCES = [
'ipc/LayersMessages.ipdlh', 'ipc/LayersMessages.ipdlh',
'ipc/LayersSurfaces.ipdlh', 'ipc/LayersSurfaces.ipdlh',
'ipc/PAPZ.ipdl', 'ipc/PAPZ.ipdl',
'ipc/PAPZCTreeManager.ipdl',
'ipc/PCompositable.ipdl', 'ipc/PCompositable.ipdl',
'ipc/PCompositorBridge.ipdl', 'ipc/PCompositorBridge.ipdl',
'ipc/PImageBridge.ipdl', 'ipc/PImageBridge.ipdl',

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

@ -21,18 +21,28 @@ class nsIWidget;
namespace mozilla { namespace mozilla {
namespace layers {
class PAPZCTreeManagerParent;
class APZCTreeManagerChild;
}
namespace dom { namespace dom {
class Touch; class Touch;
} // namespace dom } // namespace dom
enum InputType enum InputType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MULTITOUCH_INPUT, MULTITOUCH_INPUT,
MOUSE_INPUT, MOUSE_INPUT,
PANGESTURE_INPUT, PANGESTURE_INPUT,
PINCHGESTURE_INPUT, PINCHGESTURE_INPUT,
TAPGESTURE_INPUT, TAPGESTURE_INPUT,
SCROLLWHEEL_INPUT SCROLLWHEEL_INPUT,
// Used as an upper bound for ContiguousEnumSerializer
SENTINEL_INPUT,
}; };
class MultiTouchInput; class MultiTouchInput;
@ -62,6 +72,8 @@ class ScrollWheelInput;
class InputData class InputData
{ {
public: public:
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
InputType mInputType; InputType mInputType;
// Time in milliseconds that this data is relevant to. This only really // Time in milliseconds that this data is relevant to. This only really
// matters when this data is used as an event. We use uint32_t instead of // matters when this data is used as an event. We use uint32_t instead of
@ -158,6 +170,9 @@ public:
already_AddRefed<dom::Touch> ToNewDOMTouch() const; already_AddRefed<dom::Touch> ToNewDOMTouch() const;
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
// A unique number assigned to each SingleTouchData within a MultiTouchInput so // A unique number assigned to each SingleTouchData within a MultiTouchInput so
// that they can be easily distinguished when handling a touch start/move/end. // that they can be easily distinguished when handling a touch start/move/end.
int32_t mIdentifier; int32_t mIdentifier;
@ -198,10 +213,15 @@ class MultiTouchInput : public InputData
public: public:
enum MultiTouchType enum MultiTouchType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MULTITOUCH_START, MULTITOUCH_START,
MULTITOUCH_MOVE, MULTITOUCH_MOVE,
MULTITOUCH_END, MULTITOUCH_END,
MULTITOUCH_CANCEL MULTITOUCH_CANCEL,
// Used as an upper bound for ContiguousEnumSerializer
MULTITOUCH_SENTINEL,
}; };
MultiTouchInput(MultiTouchType aType, uint32_t aTime, TimeStamp aTimeStamp, MultiTouchInput(MultiTouchType aType, uint32_t aTime, TimeStamp aTimeStamp,
@ -245,6 +265,8 @@ public:
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform); bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
MultiTouchType mType; MultiTouchType mType;
nsTArray<SingleTouchData> mTouches; nsTArray<SingleTouchData> mTouches;
bool mHandledByAPZ; bool mHandledByAPZ;
@ -252,9 +274,24 @@ public:
class MouseInput : public InputData class MouseInput : public InputData
{ {
protected:
friend mozilla::layers::PAPZCTreeManagerParent;
friend mozilla::layers::APZCTreeManagerChild;
MouseInput()
: InputData(MOUSE_INPUT)
, mType(MOUSE_NONE)
, mButtonType(NONE)
, mInputSource(0)
, mButtons(0)
, mHandledByAPZ(false)
{}
public: public:
enum MouseType enum MouseType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
MOUSE_NONE, MOUSE_NONE,
MOUSE_MOVE, MOUSE_MOVE,
MOUSE_DOWN, MOUSE_DOWN,
@ -263,14 +300,22 @@ public:
MOUSE_DRAG_END, MOUSE_DRAG_END,
MOUSE_WIDGET_ENTER, MOUSE_WIDGET_ENTER,
MOUSE_WIDGET_EXIT, MOUSE_WIDGET_EXIT,
// Used as an upper bound for ContiguousEnumSerializer
MOUSE_SENTINEL,
}; };
enum ButtonType enum ButtonType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
LEFT_BUTTON, LEFT_BUTTON,
MIDDLE_BUTTON, MIDDLE_BUTTON,
RIGHT_BUTTON, RIGHT_BUTTON,
NONE NONE,
// Used as an upper bound for ContiguousEnumSerializer
BUTTON_SENTINEL,
}; };
MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource, int16_t aButtons, const ScreenPoint& aPoint, MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource, int16_t aButtons, const ScreenPoint& aPoint,
@ -284,15 +329,6 @@ public:
, mHandledByAPZ(false) , mHandledByAPZ(false)
{} {}
MouseInput()
: InputData(MOUSE_INPUT)
, mType(MOUSE_NONE)
, mButtonType(NONE)
, mInputSource(0)
, mButtons(0)
, mHandledByAPZ(false)
{}
explicit MouseInput(const WidgetMouseEventBase& aMouseEvent); explicit MouseInput(const WidgetMouseEventBase& aMouseEvent);
bool IsLeftButton() const { return mButtonType == LEFT_BUTTON; } bool IsLeftButton() const { return mButtonType == LEFT_BUTTON; }
@ -300,6 +336,8 @@ public:
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform); bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const; WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const;
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
MouseType mType; MouseType mType;
ButtonType mButtonType; ButtonType mButtonType;
uint16_t mInputSource; uint16_t mInputSource;
@ -315,9 +353,28 @@ public:
*/ */
class PanGestureInput : public InputData class PanGestureInput : public InputData
{ {
protected:
friend mozilla::layers::PAPZCTreeManagerParent;
friend mozilla::layers::APZCTreeManagerChild;
PanGestureInput()
: InputData(PANGESTURE_INPUT),
mLineOrPageDeltaX(0),
mLineOrPageDeltaY(0),
mUserDeltaMultiplierX(1.0),
mUserDeltaMultiplierY(1.0),
mHandledByAPZ(false),
mFollowedByMomentum(false),
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
{
}
public: public:
enum PanGestureType enum PanGestureType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
// MayStart: Dispatched before any actual panning has occurred but when a // MayStart: Dispatched before any actual panning has occurred but when a
// pan gesture is probably about to start, for example when the user // pan gesture is probably about to start, for example when the user
// starts touching the touchpad. Should interrupt any ongoing APZ // starts touching the touchpad. Should interrupt any ongoing APZ
@ -359,7 +416,10 @@ public:
// MomentumEnd: The momentum animation has ended, for example because the // MomentumEnd: The momentum animation has ended, for example because the
// momentum velocity has gone below the stopping threshold, or because the // momentum velocity has gone below the stopping threshold, or because the
// user has stopped the animation by putting their fingers on a touchpad. // user has stopped the animation by putting their fingers on a touchpad.
PANGESTURE_MOMENTUMEND PANGESTURE_MOMENTUMEND,
// Used as an upper bound for ContiguousEnumSerializer
PANGESTURE_SENTINEL,
}; };
PanGestureInput(PanGestureType aType, PanGestureInput(PanGestureType aType,
@ -391,6 +451,8 @@ public:
ScreenPoint UserMultipliedPanDisplacement() const; ScreenPoint UserMultipliedPanDisplacement() const;
ParentLayerPoint UserMultipliedLocalPanDisplacement() const; ParentLayerPoint UserMultipliedLocalPanDisplacement() const;
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
PanGestureType mType; PanGestureType mType;
ScreenPoint mPanStartPoint; ScreenPoint mPanStartPoint;
@ -432,12 +494,26 @@ public:
*/ */
class PinchGestureInput : public InputData class PinchGestureInput : public InputData
{ {
protected:
friend mozilla::layers::PAPZCTreeManagerParent;
friend mozilla::layers::APZCTreeManagerChild;
PinchGestureInput()
: InputData(PINCHGESTURE_INPUT)
{
}
public: public:
enum PinchGestureType enum PinchGestureType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
PINCHGESTURE_START, PINCHGESTURE_START,
PINCHGESTURE_SCALE, PINCHGESTURE_SCALE,
PINCHGESTURE_END PINCHGESTURE_END,
// Used as an upper bound for ContiguousEnumSerializer
PINCHGESTURE_SENTINEL,
}; };
// Construct a tap gesture from a Screen point. // Construct a tap gesture from a Screen point.
@ -476,6 +552,8 @@ public:
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform); bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
PinchGestureType mType; PinchGestureType mType;
// Center point of the pinch gesture. That is, if there are two fingers on the // Center point of the pinch gesture. That is, if there are two fingers on the
@ -510,15 +588,29 @@ public:
*/ */
class TapGestureInput : public InputData class TapGestureInput : public InputData
{ {
protected:
friend mozilla::layers::PAPZCTreeManagerParent;
friend mozilla::layers::APZCTreeManagerChild;
TapGestureInput()
: InputData(TAPGESTURE_INPUT)
{
}
public: public:
enum TapGestureType enum TapGestureType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
TAPGESTURE_LONG, TAPGESTURE_LONG,
TAPGESTURE_LONG_UP, TAPGESTURE_LONG_UP,
TAPGESTURE_UP, TAPGESTURE_UP,
TAPGESTURE_CONFIRMED, TAPGESTURE_CONFIRMED,
TAPGESTURE_DOUBLE, TAPGESTURE_DOUBLE,
TAPGESTURE_CANCEL TAPGESTURE_CANCEL,
// Used as an upper bound for ContiguousEnumSerializer
TAPGESTURE_SENTINEL,
}; };
// Construct a tap gesture from a Screen point. // Construct a tap gesture from a Screen point.
@ -549,6 +641,8 @@ public:
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform); bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
TapGestureType mType; TapGestureType mType;
// The location of the tap in screen pixels. // The location of the tap in screen pixels.
@ -564,14 +658,36 @@ public:
// scroll gestures. // scroll gestures.
class ScrollWheelInput : public InputData class ScrollWheelInput : public InputData
{ {
protected:
friend mozilla::layers::PAPZCTreeManagerParent;
friend mozilla::layers::APZCTreeManagerChild;
ScrollWheelInput()
: InputData(SCROLLWHEEL_INPUT)
, mHandledByAPZ(false)
, mLineOrPageDeltaX(0)
, mLineOrPageDeltaY(0)
, mScrollSeriesNumber(0)
, mUserDeltaMultiplierX(1.0)
, mUserDeltaMultiplierY(1.0)
, mMayHaveMomentum(false)
, mIsMomentum(false)
{}
public: public:
enum ScrollDeltaType enum ScrollDeltaType
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
// There are three kinds of scroll delta modes in Gecko: "page", "line" and // There are three kinds of scroll delta modes in Gecko: "page", "line" and
// "pixel". // "pixel".
SCROLLDELTA_LINE, SCROLLDELTA_LINE,
SCROLLDELTA_PAGE, SCROLLDELTA_PAGE,
SCROLLDELTA_PIXEL SCROLLDELTA_PIXEL,
// Used as an upper bound for ContiguousEnumSerializer
SCROLLDELTA_SENTINEL,
}; };
static ScrollDeltaType static ScrollDeltaType
@ -608,8 +724,14 @@ public:
enum ScrollMode enum ScrollMode
{ {
// Warning, this enum is serialized and sent over IPC. If you reorder, add,
// or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
SCROLLMODE_INSTANT, SCROLLMODE_INSTANT,
SCROLLMODE_SMOOTH SCROLLMODE_SMOOTH,
// Used as an upper bound for ContiguousEnumSerializer
SCROLLMODE_SENTINEL,
}; };
ScrollWheelInput(uint32_t aTime, ScrollWheelInput(uint32_t aTime,
@ -645,6 +767,8 @@ public:
bool IsCustomizedByUserPrefs() const; bool IsCustomizedByUserPrefs() const;
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
ScrollDeltaType mDeltaType; ScrollDeltaType mDeltaType;
ScrollMode mScrollMode; ScrollMode mScrollMode;
ScreenPoint mOrigin; ScreenPoint mOrigin;

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

@ -14,6 +14,7 @@
#include "mozilla/MouseEvents.h" #include "mozilla/MouseEvents.h"
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h" #include "mozilla/TouchEvents.h"
#include "InputData.h"
namespace IPC namespace IPC
{ {
@ -1030,6 +1031,314 @@ struct ParamTraits<mozilla::widget::CandidateWindowPosition>
} }
}; };
// InputData.h
template<>
struct ParamTraits<mozilla::InputType>
: public ContiguousEnumSerializer<
mozilla::InputType,
mozilla::InputType::MULTITOUCH_INPUT,
mozilla::InputType::SENTINEL_INPUT>
{};
template<>
struct ParamTraits<mozilla::InputData>
{
typedef mozilla::InputData paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.mInputType);
WriteParam(aMsg, aParam.mTime);
WriteParam(aMsg, aParam.mTimeStamp);
WriteParam(aMsg, aParam.modifiers);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, &aResult->mInputType) &&
ReadParam(aMsg, aIter, &aResult->mTime) &&
ReadParam(aMsg, aIter, &aResult->mTimeStamp) &&
ReadParam(aMsg, aIter, &aResult->modifiers);
}
};
template<>
struct ParamTraits<mozilla::SingleTouchData>
{
typedef mozilla::SingleTouchData paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.mIdentifier);
WriteParam(aMsg, aParam.mScreenPoint);
WriteParam(aMsg, aParam.mLocalScreenPoint);
WriteParam(aMsg, aParam.mRadius);
WriteParam(aMsg, aParam.mRotationAngle);
WriteParam(aMsg, aParam.mForce);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return (ReadParam(aMsg, aIter, &aResult->mIdentifier) &&
ReadParam(aMsg, aIter, &aResult->mScreenPoint) &&
ReadParam(aMsg, aIter, &aResult->mLocalScreenPoint) &&
ReadParam(aMsg, aIter, &aResult->mRadius) &&
ReadParam(aMsg, aIter, &aResult->mRotationAngle) &&
ReadParam(aMsg, aIter, &aResult->mForce));
}
};
template<>
struct ParamTraits<mozilla::MultiTouchInput::MultiTouchType>
: public ContiguousEnumSerializer<
mozilla::MultiTouchInput::MultiTouchType,
mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_START,
mozilla::MultiTouchInput::MultiTouchType::MULTITOUCH_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::MultiTouchInput>
{
typedef mozilla::MultiTouchInput paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
WriteParam(aMsg, aParam.mType);
WriteParam(aMsg, aParam.mTouches);
WriteParam(aMsg, aParam.mHandledByAPZ);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mType) &&
ReadParam(aMsg, aIter, &aResult->mTouches) &&
ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
}
};
template<>
struct ParamTraits<mozilla::MouseInput::MouseType>
: public ContiguousEnumSerializer<
mozilla::MouseInput::MouseType,
mozilla::MouseInput::MouseType::MOUSE_NONE,
mozilla::MouseInput::MouseType::MOUSE_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::MouseInput::ButtonType>
: public ContiguousEnumSerializer<
mozilla::MouseInput::ButtonType,
mozilla::MouseInput::ButtonType::LEFT_BUTTON,
mozilla::MouseInput::ButtonType::BUTTON_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::MouseInput>
{
typedef mozilla::MouseInput paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
WriteParam(aMsg, aParam.mButtonType);
WriteParam(aMsg, aParam.mType);
WriteParam(aMsg, aParam.mInputSource);
WriteParam(aMsg, aParam.mButtons);
WriteParam(aMsg, aParam.mOrigin);
WriteParam(aMsg, aParam.mLocalOrigin);
WriteParam(aMsg, aParam.mHandledByAPZ);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mButtonType) &&
ReadParam(aMsg, aIter, &aResult->mType) &&
ReadParam(aMsg, aIter, &aResult->mInputSource) &&
ReadParam(aMsg, aIter, &aResult->mButtons) &&
ReadParam(aMsg, aIter, &aResult->mOrigin) &&
ReadParam(aMsg, aIter, &aResult->mLocalOrigin) &&
ReadParam(aMsg, aIter, &aResult->mHandledByAPZ);
}
};
template<>
struct ParamTraits<mozilla::PanGestureInput::PanGestureType>
: public ContiguousEnumSerializer<
mozilla::PanGestureInput::PanGestureType,
mozilla::PanGestureInput::PanGestureType::PANGESTURE_MAYSTART,
mozilla::PanGestureInput::PanGestureType::PANGESTURE_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::PanGestureInput>
{
typedef mozilla::PanGestureInput paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
WriteParam(aMsg, aParam.mType);
WriteParam(aMsg, aParam.mPanStartPoint);
WriteParam(aMsg, aParam.mPanDisplacement);
WriteParam(aMsg, aParam.mLocalPanStartPoint);
WriteParam(aMsg, aParam.mLocalPanDisplacement);
WriteParam(aMsg, aParam.mLineOrPageDeltaX);
WriteParam(aMsg, aParam.mLineOrPageDeltaY);
WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
WriteParam(aMsg, aParam.mHandledByAPZ);
WriteParam(aMsg, aParam.mFollowedByMomentum);
WriteParam(aMsg, aParam.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mType) &&
ReadParam(aMsg, aIter, &aResult->mPanStartPoint) &&
ReadParam(aMsg, aIter, &aResult->mPanDisplacement) &&
ReadParam(aMsg, aIter, &aResult->mLocalPanStartPoint) &&
ReadParam(aMsg, aIter, &aResult->mLocalPanDisplacement) &&
ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
ReadParam(aMsg, aIter, &aResult->mFollowedByMomentum) &&
ReadParam(aMsg, aIter, &aResult->mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
}
};
template<>
struct ParamTraits<mozilla::PinchGestureInput::PinchGestureType>
: public ContiguousEnumSerializer<
mozilla::PinchGestureInput::PinchGestureType,
mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_START,
mozilla::PinchGestureInput::PinchGestureType::PINCHGESTURE_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::PinchGestureInput>
{
typedef mozilla::PinchGestureInput paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
WriteParam(aMsg, aParam.mType);
WriteParam(aMsg, aParam.mFocusPoint);
WriteParam(aMsg, aParam.mLocalFocusPoint);
WriteParam(aMsg, aParam.mCurrentSpan);
WriteParam(aMsg, aParam.mPreviousSpan);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mType) &&
ReadParam(aMsg, aIter, &aResult->mFocusPoint) &&
ReadParam(aMsg, aIter, &aResult->mLocalFocusPoint) &&
ReadParam(aMsg, aIter, &aResult->mCurrentSpan) &&
ReadParam(aMsg, aIter, &aResult->mPreviousSpan);
}
};
template<>
struct ParamTraits<mozilla::TapGestureInput::TapGestureType>
: public ContiguousEnumSerializer<
mozilla::TapGestureInput::TapGestureType,
mozilla::TapGestureInput::TapGestureType::TAPGESTURE_LONG,
mozilla::TapGestureInput::TapGestureType::TAPGESTURE_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::TapGestureInput>
{
typedef mozilla::TapGestureInput paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
WriteParam(aMsg, aParam.mType);
WriteParam(aMsg, aParam.mPoint);
WriteParam(aMsg, aParam.mLocalPoint);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mType) &&
ReadParam(aMsg, aIter, &aResult->mPoint) &&
ReadParam(aMsg, aIter, &aResult->mLocalPoint);
}
};
template<>
struct ParamTraits<mozilla::ScrollWheelInput::ScrollDeltaType>
: public ContiguousEnumSerializer<
mozilla::ScrollWheelInput::ScrollDeltaType,
mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_LINE,
mozilla::ScrollWheelInput::ScrollDeltaType::SCROLLDELTA_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::ScrollWheelInput::ScrollMode>
: public ContiguousEnumSerializer<
mozilla::ScrollWheelInput::ScrollMode,
mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_INSTANT,
mozilla::ScrollWheelInput::ScrollMode::SCROLLMODE_SENTINEL>
{};
template<>
struct ParamTraits<mozilla::ScrollWheelInput>
{
typedef mozilla::ScrollWheelInput paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::InputData>(aParam));
WriteParam(aMsg, aParam.mDeltaType);
WriteParam(aMsg, aParam.mScrollMode);
WriteParam(aMsg, aParam.mOrigin);
WriteParam(aMsg, aParam.mHandledByAPZ);
WriteParam(aMsg, aParam.mDeltaX);
WriteParam(aMsg, aParam.mDeltaY);
WriteParam(aMsg, aParam.mLocalOrigin);
WriteParam(aMsg, aParam.mLineOrPageDeltaX);
WriteParam(aMsg, aParam.mLineOrPageDeltaY);
WriteParam(aMsg, aParam.mScrollSeriesNumber);
WriteParam(aMsg, aParam.mUserDeltaMultiplierX);
WriteParam(aMsg, aParam.mUserDeltaMultiplierY);
WriteParam(aMsg, aParam.mMayHaveMomentum);
WriteParam(aMsg, aParam.mIsMomentum);
WriteParam(aMsg, aParam.mAllowToOverrideSystemScrollSpeed);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
{
return ReadParam(aMsg, aIter, static_cast<mozilla::InputData*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mDeltaType) &&
ReadParam(aMsg, aIter, &aResult->mScrollMode) &&
ReadParam(aMsg, aIter, &aResult->mOrigin) &&
ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
ReadParam(aMsg, aIter, &aResult->mDeltaX) &&
ReadParam(aMsg, aIter, &aResult->mDeltaY) &&
ReadParam(aMsg, aIter, &aResult->mLocalOrigin) &&
ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaX) &&
ReadParam(aMsg, aIter, &aResult->mLineOrPageDeltaY) &&
ReadParam(aMsg, aIter, &aResult->mScrollSeriesNumber) &&
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierX) &&
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
ReadParam(aMsg, aIter, &aResult->mMayHaveMomentum) &&
ReadParam(aMsg, aIter, &aResult->mIsMomentum) &&
ReadParam(aMsg, aIter, &aResult->mAllowToOverrideSystemScrollSpeed);
}
};
} // namespace IPC } // namespace IPC
#endif // nsGUIEventIPC_h__ #endif // nsGUIEventIPC_h__