Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/ipc/APZInputBridgeParent.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "mozilla/layers/APZInputBridgeParent.h"
8
9
#include "mozilla/layers/APZInputBridge.h"
10
#include "mozilla/layers/CompositorBridgeParent.h"
11
#include "mozilla/layers/IAPZCTreeManager.h"
12
13
namespace mozilla {
14
namespace layers {
15
16
APZInputBridgeParent::APZInputBridgeParent(const LayersId& aLayersId)
17
0
{
18
0
  MOZ_ASSERT(XRE_IsGPUProcess());
19
0
  MOZ_ASSERT(NS_IsMainThread());
20
0
21
0
  mTreeManager = CompositorBridgeParent::GetAPZCTreeManager(aLayersId);
22
0
  MOZ_ASSERT(mTreeManager);
23
0
}
24
25
APZInputBridgeParent::~APZInputBridgeParent()
26
0
{
27
0
}
28
29
mozilla::ipc::IPCResult
30
APZInputBridgeParent::RecvReceiveMultiTouchInputEvent(
31
    const MultiTouchInput& aEvent,
32
    nsEventStatus* aOutStatus,
33
    MultiTouchInput* aOutEvent,
34
    ScrollableLayerGuid* aOutTargetGuid,
35
    uint64_t* aOutInputBlockId)
36
0
{
37
0
  MultiTouchInput event = aEvent;
38
0
39
0
  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
40
0
    event,
41
0
    aOutTargetGuid,
42
0
    aOutInputBlockId);
43
0
  *aOutEvent = event;
44
0
45
0
  return IPC_OK();
46
0
}
47
48
mozilla::ipc::IPCResult
49
APZInputBridgeParent::RecvReceiveMouseInputEvent(
50
    const MouseInput& aEvent,
51
    nsEventStatus* aOutStatus,
52
    MouseInput* aOutEvent,
53
    ScrollableLayerGuid* aOutTargetGuid,
54
    uint64_t* aOutInputBlockId)
55
0
{
56
0
  MouseInput event = aEvent;
57
0
58
0
  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
59
0
    event,
60
0
    aOutTargetGuid,
61
0
    aOutInputBlockId);
62
0
  *aOutEvent = event;
63
0
64
0
  return IPC_OK();
65
0
}
66
67
mozilla::ipc::IPCResult
68
APZInputBridgeParent::RecvReceivePanGestureInputEvent(
69
    const PanGestureInput& aEvent,
70
    nsEventStatus* aOutStatus,
71
    PanGestureInput* aOutEvent,
72
    ScrollableLayerGuid* aOutTargetGuid,
73
    uint64_t* aOutInputBlockId)
74
0
{
75
0
  PanGestureInput event = aEvent;
76
0
77
0
  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
78
0
    event,
79
0
    aOutTargetGuid,
80
0
    aOutInputBlockId);
81
0
  *aOutEvent = event;
82
0
83
0
  return IPC_OK();
84
0
}
85
86
mozilla::ipc::IPCResult
87
APZInputBridgeParent::RecvReceivePinchGestureInputEvent(
88
    const PinchGestureInput& aEvent,
89
    nsEventStatus* aOutStatus,
90
    PinchGestureInput* aOutEvent,
91
    ScrollableLayerGuid* aOutTargetGuid,
92
    uint64_t* aOutInputBlockId)
93
0
{
94
0
  PinchGestureInput event = aEvent;
95
0
96
0
  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
97
0
    event,
98
0
    aOutTargetGuid,
99
0
    aOutInputBlockId);
100
0
  *aOutEvent = event;
101
0
102
0
  return IPC_OK();
103
0
}
104
105
mozilla::ipc::IPCResult
106
APZInputBridgeParent::RecvReceiveTapGestureInputEvent(
107
    const TapGestureInput& aEvent,
108
    nsEventStatus* aOutStatus,
109
    TapGestureInput* aOutEvent,
110
    ScrollableLayerGuid* aOutTargetGuid,
111
    uint64_t* aOutInputBlockId)
112
0
{
113
0
  TapGestureInput event = aEvent;
114
0
115
0
  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
116
0
    event,
117
0
    aOutTargetGuid,
118
0
    aOutInputBlockId);
119
0
  *aOutEvent = event;
120
0
121
0
  return IPC_OK();
122
0
}
123
124
mozilla::ipc::IPCResult
125
APZInputBridgeParent::RecvReceiveScrollWheelInputEvent(
126
    const ScrollWheelInput& aEvent,
127
    nsEventStatus* aOutStatus,
128
    ScrollWheelInput* aOutEvent,
129
    ScrollableLayerGuid* aOutTargetGuid,
130
    uint64_t* aOutInputBlockId)
131
0
{
132
0
  ScrollWheelInput event = aEvent;
133
0
134
0
  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
135
0
    event,
136
0
    aOutTargetGuid,
137
0
    aOutInputBlockId);
138
0
  *aOutEvent = event;
139
0
140
0
  return IPC_OK();
141
0
}
142
143
mozilla::ipc::IPCResult
144
APZInputBridgeParent::RecvReceiveKeyboardInputEvent(
145
        const KeyboardInput& aEvent,
146
        nsEventStatus* aOutStatus,
147
        KeyboardInput* aOutEvent,
148
        ScrollableLayerGuid* aOutTargetGuid,
149
        uint64_t* aOutInputBlockId)
150
0
{
151
0
  KeyboardInput event = aEvent;
152
0
153
0
  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
154
0
    event,
155
0
    aOutTargetGuid,
156
0
    aOutInputBlockId);
157
0
  *aOutEvent = event;
158
0
159
0
  return IPC_OK();
160
0
}
161
162
mozilla::ipc::IPCResult
163
APZInputBridgeParent::RecvUpdateWheelTransaction(
164
        const LayoutDeviceIntPoint& aRefPoint,
165
        const EventMessage& aEventMessage)
166
0
{
167
0
  mTreeManager->InputBridge()->UpdateWheelTransaction(
168
0
        aRefPoint, aEventMessage);
169
0
  return IPC_OK();
170
0
}
171
172
mozilla::ipc::IPCResult
173
APZInputBridgeParent::RecvProcessUnhandledEvent(
174
        const LayoutDeviceIntPoint& aRefPoint,
175
        LayoutDeviceIntPoint* aOutRefPoint,
176
        ScrollableLayerGuid*  aOutTargetGuid,
177
        uint64_t*             aOutFocusSequenceNumber)
178
0
{
179
0
  LayoutDeviceIntPoint refPoint = aRefPoint;
180
0
  mTreeManager->InputBridge()->ProcessUnhandledEvent(
181
0
        &refPoint, aOutTargetGuid, aOutFocusSequenceNumber);
182
0
  *aOutRefPoint = refPoint;
183
0
184
0
  return IPC_OK();
185
0
}
186
187
void
188
APZInputBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
189
0
{
190
0
  // We shouldn't need it after this
191
0
  mTreeManager = nullptr;
192
0
}
193
194
} // namespace layers
195
} // namespace mozilla