1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef __mozilla_layers_TouchActionHelper_h__
7 #define __mozilla_layers_TouchActionHelper_h__
8 
9 #include "mozilla/layers/APZUtils.h" // for TouchBehaviorFlags
10 
11 class nsIFrame;
12 class nsIWidget;
13 
14 namespace mozilla {
15 namespace layers {
16 
17 /*
18  * Helper class to figure out the allowed touch behavior for frames, as per
19  * the touch-action spec.
20  */
21 class TouchActionHelper
22 {
23 private:
24   static void UpdateAllowedBehavior(uint32_t aTouchActionValue,
25                                     bool aConsiderPanning,
26                                     TouchBehaviorFlags& aOutBehavior);
27 
28 public:
29   /*
30    * Performs hit testing on content, finds frame that corresponds to the aPoint and retrieves
31    * touch-action css property value from it according the rules specified in the spec:
32    * http://www.w3.org/TR/pointerevents/#the-touch-action-css-property.
33    */
34   static TouchBehaviorFlags GetAllowedTouchBehavior(nsIWidget* aWidget,
35                                                     nsIFrame* aRootFrame,
36                                                     const LayoutDeviceIntPoint& aPoint);
37 };
38 
39 } // namespace layers
40 } // namespace mozilla
41 
42 #endif /*__mozilla_layers_TouchActionHelper_h__ */
43