Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set sw=4 ts=8 et 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/APZChild.h"
8 : #include "mozilla/layers/GeckoContentController.h"
9 :
10 : #include "mozilla/dom/TabChild.h"
11 : #include "mozilla/layers/APZCCallbackHelper.h"
12 :
13 : #include "InputData.h" // for InputData
14 :
15 : namespace mozilla {
16 : namespace layers {
17 :
18 1 : APZChild::APZChild(RefPtr<GeckoContentController> aController)
19 1 : : mController(aController)
20 : {
21 1 : MOZ_ASSERT(mController);
22 1 : }
23 :
24 0 : APZChild::~APZChild()
25 : {
26 0 : if (mController) {
27 0 : mController->Destroy();
28 0 : mController = nullptr;
29 : }
30 0 : }
31 :
32 : mozilla::ipc::IPCResult
33 0 : APZChild::RecvRequestContentRepaint(const FrameMetrics& aFrameMetrics)
34 : {
35 0 : MOZ_ASSERT(mController->IsRepaintThread());
36 :
37 0 : mController->RequestContentRepaint(aFrameMetrics);
38 0 : return IPC_OK();
39 : }
40 :
41 : mozilla::ipc::IPCResult
42 0 : APZChild::RecvUpdateOverscrollVelocity(const float& aX, const float& aY, const bool& aIsRootContent)
43 : {
44 0 : mController->UpdateOverscrollVelocity(aX, aY, aIsRootContent);
45 0 : return IPC_OK();
46 : }
47 :
48 : mozilla::ipc::IPCResult
49 0 : APZChild::RecvUpdateOverscrollOffset(const float& aX, const float& aY, const bool& aIsRootContent)
50 : {
51 0 : mController->UpdateOverscrollOffset(aX, aY, aIsRootContent);
52 0 : return IPC_OK();
53 : }
54 :
55 : mozilla::ipc::IPCResult
56 0 : APZChild::RecvNotifyMozMouseScrollEvent(const ViewID& aScrollId,
57 : const nsString& aEvent)
58 : {
59 0 : mController->NotifyMozMouseScrollEvent(aScrollId, aEvent);
60 0 : return IPC_OK();
61 : }
62 :
63 : mozilla::ipc::IPCResult
64 0 : APZChild::RecvNotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
65 : const APZStateChange& aChange,
66 : const int& aArg)
67 : {
68 0 : mController->NotifyAPZStateChange(aGuid, aChange, aArg);
69 0 : return IPC_OK();
70 : }
71 :
72 : mozilla::ipc::IPCResult
73 0 : APZChild::RecvNotifyFlushComplete()
74 : {
75 0 : MOZ_ASSERT(mController->IsRepaintThread());
76 :
77 0 : mController->NotifyFlushComplete();
78 0 : return IPC_OK();
79 : }
80 :
81 : mozilla::ipc::IPCResult
82 0 : APZChild::RecvNotifyAsyncScrollbarDragRejected(const ViewID& aScrollId)
83 : {
84 0 : mController->NotifyAsyncScrollbarDragRejected(aScrollId);
85 0 : return IPC_OK();
86 : }
87 :
88 : mozilla::ipc::IPCResult
89 0 : APZChild::RecvDestroy()
90 : {
91 : // mController->Destroy will be called in the destructor
92 0 : PAPZChild::Send__delete__(this);
93 0 : return IPC_OK();
94 : }
95 :
96 :
97 : } // namespace layers
98 : } // namespace mozilla
|