tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TouchActionHelper.h (1471B)


      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_TouchActionHelper_h__
      8 #define __mozilla_layers_TouchActionHelper_h__
      9 
     10 #include "mozilla/layers/LayersTypes.h"  // for TouchBehaviorFlags
     11 #include "RelativeTo.h"                  // for RelativeTo
     12 
     13 class nsIWidget;
     14 namespace mozilla {
     15 
     16 namespace dom {
     17 class Document;
     18 }  // namespace dom
     19 
     20 class WidgetTouchEvent;
     21 }  // namespace mozilla
     22 
     23 namespace mozilla::layers {
     24 
     25 /*
     26 * Helper class to figure out the allowed touch behavior for frames, as per
     27 * the touch-action spec.
     28 */
     29 class TouchActionHelper {
     30 public:
     31  /*
     32   * Performs hit testing on content, finds frame that corresponds to the touch
     33   * points of aEvent and retrieves touch-action CSS property value from it
     34   * according the rules specified in the spec:
     35   * http://www.w3.org/TR/pointerevents/#the-touch-action-css-property.
     36   */
     37  static nsTArray<TouchBehaviorFlags> GetAllowedTouchBehavior(
     38      nsIWidget* aWidget, dom::Document* aDocument,
     39      const WidgetTouchEvent& aPoint);
     40 
     41  static TouchBehaviorFlags GetAllowedTouchBehaviorForFrame(nsIFrame* aFrame);
     42 };
     43 
     44 }  // namespace mozilla::layers
     45 
     46 #endif /*__mozilla_layers_TouchActionHelper_h__ */