|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #pragma once |
|
6 |
|
7 #include "mozwrlbase.h" |
|
8 |
|
9 #include "mozilla/layers/GeckoContentController.h" |
|
10 #include "mozilla/layers/APZCTreeManager.h" |
|
11 #include "mozilla/EventForwards.h" |
|
12 #include "FrameMetrics.h" |
|
13 #include "Units.h" |
|
14 |
|
15 class nsIWidgetListener; |
|
16 |
|
17 namespace mozilla { |
|
18 namespace widget { |
|
19 namespace winrt { |
|
20 |
|
21 class APZController : |
|
22 public mozilla::layers::GeckoContentController |
|
23 { |
|
24 typedef mozilla::layers::FrameMetrics FrameMetrics; |
|
25 typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid; |
|
26 typedef mozilla::layers::ZoomConstraints ZoomConstraints; |
|
27 |
|
28 public: |
|
29 APZController() : |
|
30 mWidgetListener(nullptr) |
|
31 { |
|
32 } |
|
33 |
|
34 // GeckoContentController interface |
|
35 virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics); |
|
36 virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration); |
|
37 virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, |
|
38 int32_t aModifiers, |
|
39 const mozilla::layers::ScrollableLayerGuid& aGuid); |
|
40 virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, |
|
41 int32_t aModifiers, |
|
42 const mozilla::layers::ScrollableLayerGuid& aGuid); |
|
43 virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, |
|
44 int32_t aModifiers, |
|
45 const mozilla::layers::ScrollableLayerGuid& aGuid); |
|
46 virtual void HandleLongTapUp(const mozilla::CSSPoint& aPoint, |
|
47 int32_t aModifiers, |
|
48 const mozilla::layers::ScrollableLayerGuid& aGuid); |
|
49 virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize); |
|
50 virtual void PostDelayedTask(Task* aTask, int aDelayMs); |
|
51 virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints); |
|
52 virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, |
|
53 APZStateChange aChange, |
|
54 int aArg); |
|
55 |
|
56 void SetWidgetListener(nsIWidgetListener* aWidgetListener); |
|
57 |
|
58 bool HitTestAPZC(mozilla::ScreenIntPoint& aPoint); |
|
59 void TransformCoordinateToGecko(const mozilla::ScreenIntPoint& aPoint, |
|
60 LayoutDeviceIntPoint* aRefPointOut); |
|
61 void ContentReceivedTouch(const ScrollableLayerGuid& aGuid, bool aPreventDefault); |
|
62 nsEventStatus ReceiveInputEvent(mozilla::WidgetInputEvent* aEvent, |
|
63 ScrollableLayerGuid* aOutTargetGuid); |
|
64 |
|
65 public: |
|
66 // todo: make this a member variable as prep for multiple views |
|
67 static nsRefPtr<mozilla::layers::APZCTreeManager> sAPZC; |
|
68 |
|
69 private: |
|
70 nsIWidgetListener* mWidgetListener; |
|
71 }; |
|
72 |
|
73 } } } |