/src/mozilla-central/gfx/layers/ipc/APZInputBridgeChild.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/APZInputBridgeChild.h" |
8 | | |
9 | | #include "InputData.h" // for InputData, etc |
10 | | |
11 | | namespace mozilla { |
12 | | namespace layers { |
13 | | |
14 | | APZInputBridgeChild::APZInputBridgeChild() |
15 | | : mDestroyed(false) |
16 | 0 | { |
17 | 0 | MOZ_ASSERT(XRE_IsParentProcess()); |
18 | 0 | MOZ_ASSERT(NS_IsMainThread()); |
19 | 0 | } |
20 | | |
21 | | APZInputBridgeChild::~APZInputBridgeChild() |
22 | 0 | { |
23 | 0 | } |
24 | | |
25 | | void |
26 | | APZInputBridgeChild::Destroy() |
27 | 0 | { |
28 | 0 | MOZ_ASSERT(XRE_IsParentProcess()); |
29 | 0 | MOZ_ASSERT(NS_IsMainThread()); |
30 | 0 |
|
31 | 0 | if (mDestroyed) { |
32 | 0 | return; |
33 | 0 | } |
34 | 0 | |
35 | 0 | Send__delete__(this); |
36 | 0 | mDestroyed = true; |
37 | 0 | } |
38 | | |
39 | | void |
40 | | APZInputBridgeChild::ActorDestroy(ActorDestroyReason aWhy) |
41 | 0 | { |
42 | 0 | mDestroyed = true; |
43 | 0 | } |
44 | | |
45 | | nsEventStatus |
46 | | APZInputBridgeChild::ReceiveInputEvent( |
47 | | InputData& aEvent, |
48 | | ScrollableLayerGuid* aOutTargetGuid, |
49 | | uint64_t* aOutInputBlockId) |
50 | 0 | { |
51 | 0 | switch (aEvent.mInputType) { |
52 | 0 | case MULTITOUCH_INPUT: { |
53 | 0 | MultiTouchInput& event = aEvent.AsMultiTouchInput(); |
54 | 0 | MultiTouchInput processedEvent; |
55 | 0 |
|
56 | 0 | nsEventStatus res; |
57 | 0 | SendReceiveMultiTouchInputEvent(event, |
58 | 0 | &res, |
59 | 0 | &processedEvent, |
60 | 0 | aOutTargetGuid, |
61 | 0 | aOutInputBlockId); |
62 | 0 |
|
63 | 0 | event = processedEvent; |
64 | 0 | return res; |
65 | 0 | } |
66 | 0 | case MOUSE_INPUT: { |
67 | 0 | MouseInput& event = aEvent.AsMouseInput(); |
68 | 0 | MouseInput processedEvent; |
69 | 0 |
|
70 | 0 | nsEventStatus res; |
71 | 0 | SendReceiveMouseInputEvent(event, |
72 | 0 | &res, |
73 | 0 | &processedEvent, |
74 | 0 | aOutTargetGuid, |
75 | 0 | aOutInputBlockId); |
76 | 0 |
|
77 | 0 | event = processedEvent; |
78 | 0 | return res; |
79 | 0 | } |
80 | 0 | case PANGESTURE_INPUT: { |
81 | 0 | PanGestureInput& event = aEvent.AsPanGestureInput(); |
82 | 0 | PanGestureInput processedEvent; |
83 | 0 |
|
84 | 0 | nsEventStatus res; |
85 | 0 | SendReceivePanGestureInputEvent(event, |
86 | 0 | &res, |
87 | 0 | &processedEvent, |
88 | 0 | aOutTargetGuid, |
89 | 0 | aOutInputBlockId); |
90 | 0 |
|
91 | 0 | event = processedEvent; |
92 | 0 | return res; |
93 | 0 | } |
94 | 0 | case PINCHGESTURE_INPUT: { |
95 | 0 | PinchGestureInput& event = aEvent.AsPinchGestureInput(); |
96 | 0 | PinchGestureInput processedEvent; |
97 | 0 |
|
98 | 0 | nsEventStatus res; |
99 | 0 | SendReceivePinchGestureInputEvent(event, |
100 | 0 | &res, |
101 | 0 | &processedEvent, |
102 | 0 | aOutTargetGuid, |
103 | 0 | aOutInputBlockId); |
104 | 0 |
|
105 | 0 | event = processedEvent; |
106 | 0 | return res; |
107 | 0 | } |
108 | 0 | case TAPGESTURE_INPUT: { |
109 | 0 | TapGestureInput& event = aEvent.AsTapGestureInput(); |
110 | 0 | TapGestureInput processedEvent; |
111 | 0 |
|
112 | 0 | nsEventStatus res; |
113 | 0 | SendReceiveTapGestureInputEvent(event, |
114 | 0 | &res, |
115 | 0 | &processedEvent, |
116 | 0 | aOutTargetGuid, |
117 | 0 | aOutInputBlockId); |
118 | 0 |
|
119 | 0 | event = processedEvent; |
120 | 0 | return res; |
121 | 0 | } |
122 | 0 | case SCROLLWHEEL_INPUT: { |
123 | 0 | ScrollWheelInput& event = aEvent.AsScrollWheelInput(); |
124 | 0 | ScrollWheelInput processedEvent; |
125 | 0 |
|
126 | 0 | nsEventStatus res; |
127 | 0 | SendReceiveScrollWheelInputEvent(event, |
128 | 0 | &res, |
129 | 0 | &processedEvent, |
130 | 0 | aOutTargetGuid, |
131 | 0 | aOutInputBlockId); |
132 | 0 |
|
133 | 0 | event = processedEvent; |
134 | 0 | return res; |
135 | 0 | } |
136 | 0 | case KEYBOARD_INPUT: { |
137 | 0 | KeyboardInput& event = aEvent.AsKeyboardInput(); |
138 | 0 | KeyboardInput processedEvent; |
139 | 0 |
|
140 | 0 | nsEventStatus res; |
141 | 0 | SendReceiveKeyboardInputEvent(event, |
142 | 0 | &res, |
143 | 0 | &processedEvent, |
144 | 0 | aOutTargetGuid, |
145 | 0 | aOutInputBlockId); |
146 | 0 |
|
147 | 0 | event = processedEvent; |
148 | 0 | return res; |
149 | 0 | } |
150 | 0 | default: { |
151 | 0 | MOZ_ASSERT_UNREACHABLE("Invalid InputData type."); |
152 | 0 | return nsEventStatus_eConsumeNoDefault; |
153 | 0 | } |
154 | 0 | } |
155 | 0 | } |
156 | | |
157 | | void APZInputBridgeChild::ProcessUnhandledEvent( |
158 | | LayoutDeviceIntPoint* aRefPoint, |
159 | | ScrollableLayerGuid* aOutTargetGuid, |
160 | | uint64_t* aOutFocusSequenceNumber) |
161 | 0 | { |
162 | 0 | SendProcessUnhandledEvent(*aRefPoint, |
163 | 0 | aRefPoint, |
164 | 0 | aOutTargetGuid, |
165 | 0 | aOutFocusSequenceNumber); |
166 | 0 | } |
167 | | |
168 | | void |
169 | | APZInputBridgeChild::UpdateWheelTransaction( |
170 | | LayoutDeviceIntPoint aRefPoint, |
171 | | EventMessage aEventMessage) |
172 | 0 | { |
173 | 0 | SendUpdateWheelTransaction(aRefPoint, aEventMessage); |
174 | 0 | } |
175 | | |
176 | | } // namespace layers |
177 | | } // namespace mozilla |