/work/obj-fuzz/dist/include/mozilla/layers/IAPZCTreeManager.h
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 | | #ifndef mozilla_layers_IAPZCTreeManager_h |
8 | | #define mozilla_layers_IAPZCTreeManager_h |
9 | | |
10 | | #include <stdint.h> // for uint64_t, uint32_t |
11 | | |
12 | | #include "FrameMetrics.h" // for FrameMetrics, etc |
13 | | #include "mozilla/layers/LayersTypes.h" // for TouchBehaviorFlags |
14 | | #include "nsTArrayForwardDeclare.h" // for nsTArray, nsTArray_Impl, etc |
15 | | #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc |
16 | | #include "Units.h" // for CSSRect, etc |
17 | | |
18 | | namespace mozilla { |
19 | | namespace layers { |
20 | | |
21 | | class APZInputBridge; |
22 | | class KeyboardMap; |
23 | | |
24 | | enum AllowedTouchBehavior { |
25 | | NONE = 0, |
26 | | VERTICAL_PAN = 1 << 0, |
27 | | HORIZONTAL_PAN = 1 << 1, |
28 | | PINCH_ZOOM = 1 << 2, |
29 | | DOUBLE_TAP_ZOOM = 1 << 3, |
30 | | UNKNOWN = 1 << 4 |
31 | | }; |
32 | | |
33 | | enum ZoomToRectBehavior : uint32_t { |
34 | | DEFAULT_BEHAVIOR = 0, |
35 | | DISABLE_ZOOM_OUT = 1 << 0, |
36 | | PAN_INTO_VIEW_ONLY = 1 << 1, |
37 | | ONLY_ZOOM_TO_DEFAULT_SCALE = 1 << 2 |
38 | | }; |
39 | | |
40 | | class AsyncDragMetrics; |
41 | | |
42 | | class IAPZCTreeManager { |
43 | | NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING(IAPZCTreeManager) |
44 | | |
45 | | public: |
46 | | /** |
47 | | * Set the keyboard shortcuts to use for translating keyboard events. |
48 | | */ |
49 | | virtual void SetKeyboardMap(const KeyboardMap& aKeyboardMap) = 0; |
50 | | |
51 | | /** |
52 | | * Kicks an animation to zoom to a rect. This may be either a zoom out or zoom |
53 | | * in. The actual animation is done on the sampler thread after being set |
54 | | * up. |aRect| must be given in CSS pixels, relative to the document. |
55 | | * |aFlags| is a combination of the ZoomToRectBehavior enum values. |
56 | | */ |
57 | | virtual void ZoomToRect( |
58 | | const ScrollableLayerGuid& aGuid, |
59 | | const CSSRect& aRect, |
60 | | const uint32_t aFlags = DEFAULT_BEHAVIOR) = 0; |
61 | | |
62 | | /** |
63 | | * If we have touch listeners, this should always be called when we know |
64 | | * definitively whether or not content has preventDefaulted any touch events |
65 | | * that have come in. If |aPreventDefault| is true, any touch events in the |
66 | | * queue will be discarded. This function must be called on the controller |
67 | | * thread. |
68 | | */ |
69 | | virtual void ContentReceivedInputBlock( |
70 | | uint64_t aInputBlockId, |
71 | | bool aPreventDefault) = 0; |
72 | | |
73 | | /** |
74 | | * When the event regions code is enabled, this function should be invoked to |
75 | | * to confirm the target of the input block. This is only needed in cases |
76 | | * where the initial input event of the block hit a dispatch-to-content region |
77 | | * but is safe to call for all input blocks. This function should always be |
78 | | * invoked on the controller thread. |
79 | | * The different elements in the array of targets correspond to the targets |
80 | | * for the different touch points. In the case where the touch point has no |
81 | | * target, or the target is not a scrollable frame, the target's |mScrollId| |
82 | | * should be set to FrameMetrics::NULL_SCROLL_ID. |
83 | | */ |
84 | | virtual void SetTargetAPZC( |
85 | | uint64_t aInputBlockId, |
86 | | const nsTArray<ScrollableLayerGuid>& aTargets) = 0; |
87 | | |
88 | | /** |
89 | | * Updates any zoom constraints contained in the <meta name="viewport"> tag. |
90 | | * If the |aConstraints| is Nothing() then previously-provided constraints for |
91 | | * the given |aGuid| are cleared. |
92 | | */ |
93 | | virtual void UpdateZoomConstraints( |
94 | | const ScrollableLayerGuid& aGuid, |
95 | | const Maybe<ZoomConstraints>& aConstraints) = 0; |
96 | | |
97 | | virtual void SetDPI(float aDpiValue) = 0; |
98 | | |
99 | | /** |
100 | | * Sets allowed touch behavior values for current touch-session for specific |
101 | | * input block (determined by aInputBlock). |
102 | | * Should be invoked by the widget. Each value of the aValues arrays |
103 | | * corresponds to the different touch point that is currently active. |
104 | | * Must be called after receiving the TOUCH_START event that starts the |
105 | | * touch-session. |
106 | | * This must be called on the controller thread. |
107 | | */ |
108 | | virtual void SetAllowedTouchBehavior( |
109 | | uint64_t aInputBlockId, |
110 | | const nsTArray<TouchBehaviorFlags>& aValues) = 0; |
111 | | |
112 | | virtual void StartScrollbarDrag( |
113 | | const ScrollableLayerGuid& aGuid, |
114 | | const AsyncDragMetrics& aDragMetrics) = 0; |
115 | | |
116 | | virtual bool StartAutoscroll( |
117 | | const ScrollableLayerGuid& aGuid, |
118 | | const ScreenPoint& aAnchorLocation) = 0; |
119 | | |
120 | | virtual void StopAutoscroll(const ScrollableLayerGuid& aGuid) = 0; |
121 | | |
122 | | /** |
123 | | * Function used to disable LongTap gestures. |
124 | | * |
125 | | * On slow running tests, drags and touch events can be misinterpreted |
126 | | * as a long tap. This allows tests to disable long tap gesture detection. |
127 | | */ |
128 | | virtual void SetLongTapEnabled(bool aTapGestureEnabled) = 0; |
129 | | |
130 | | /** |
131 | | * Returns an APZInputBridge interface that can be used to send input |
132 | | * events to APZ in a synchronous manner. This will always be non-null, and |
133 | | * the returned object's lifetime will match the lifetime of this |
134 | | * IAPZCTreeManager implementation. |
135 | | * It is only valid to call this function in the UI process. |
136 | | */ |
137 | | virtual APZInputBridge* InputBridge() = 0; |
138 | | |
139 | | protected: |
140 | | |
141 | | // Discourage destruction outside of decref |
142 | | |
143 | 0 | virtual ~IAPZCTreeManager() { } |
144 | | }; |
145 | | |
146 | | } // namespace layers |
147 | | } // namespace mozilla |
148 | | |
149 | | #endif // mozilla_layers_IAPZCTreeManager_h |