LCOV - code coverage report
Current view: top level - gfx/layers/apz/public - GeckoContentController.h (source / functions) Hit Total Coverage
Test: output.info Lines: 2 10 20.0 %
Date: 2017-07-14 16:53:18 Functions: 3 10 30.0 %
Legend: Lines: hit not hit

          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             : #ifndef mozilla_layers_GeckoContentController_h
       8             : #define mozilla_layers_GeckoContentController_h
       9             : 
      10             : #include "FrameMetrics.h"               // for FrameMetrics, etc
      11             : #include "InputData.h"                  // for PinchGestureInput
      12             : #include "Units.h"                      // for CSSPoint, CSSRect, etc
      13             : #include "mozilla/Assertions.h"         // for MOZ_ASSERT_HELPER2
      14             : #include "mozilla/DefineEnum.h"         // for MOZ_DEFINE_ENUM
      15             : #include "mozilla/EventForwards.h"      // for Modifiers
      16             : #include "nsISupportsImpl.h"
      17             : 
      18             : namespace mozilla {
      19             : 
      20             : class Runnable;
      21             : 
      22             : namespace layers {
      23             : 
      24             : class GeckoContentController
      25             : {
      26             : public:
      27         109 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GeckoContentController)
      28             : 
      29             :   /**
      30             :    * Requests a paint of the given FrameMetrics |aFrameMetrics| from Gecko.
      31             :    * Implementations per-platform are responsible for actually handling this.
      32             :    *
      33             :    * This method must always be called on the repaint thread, which depends
      34             :    * on the GeckoContentController. For ChromeProcessController it is the
      35             :    * Gecko main thread, while for RemoteContentController it is the compositor
      36             :    * thread where it can send IPDL messages.
      37             :    */
      38             :   virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) = 0;
      39             : 
      40             :   /**
      41             :    * Different types of tap-related events that can be sent in
      42             :    * the HandleTap function. The names should be relatively self-explanatory.
      43             :    * Note that the eLongTapUp will always be preceded by an eLongTap, but not
      44             :    * all eLongTap notifications will be followed by an eLongTapUp (for instance,
      45             :    * if the user moves their finger after triggering the long-tap but before
      46             :    * lifting it).
      47             :    * The difference between eDoubleTap and eSecondTap is subtle - the eDoubleTap
      48             :    * is for an actual double-tap "gesture" while eSecondTap is for the same user
      49             :    * input but where a double-tap gesture is not allowed. This is used to fire
      50             :    * a click event with detail=2 to web content (similar to what a mouse double-
      51             :    * click would do).
      52             :    */
      53             :   MOZ_DEFINE_ENUM_CLASS_AT_CLASS_SCOPE(
      54             :     TapType, (
      55             :       eSingleTap,
      56             :       eDoubleTap,
      57             :       eSecondTap,
      58             :       eLongTap,
      59             :       eLongTapUp
      60             :   ));
      61             : 
      62             :   /**
      63             :    * Requests handling of a tap event. |aPoint| is in LD pixels, relative to the
      64             :    * current scroll offset.
      65             :    */
      66             :   virtual void HandleTap(TapType aType,
      67             :                          const LayoutDevicePoint& aPoint,
      68             :                          Modifiers aModifiers,
      69             :                          const ScrollableLayerGuid& aGuid,
      70             :                          uint64_t aInputBlockId) = 0;
      71             : 
      72             :   /**
      73             :    * When the apz.allow_zooming pref is set to false, the APZ will not
      74             :    * translate pinch gestures to actual zooming. Instead, it will call this
      75             :    * method to notify gecko of the pinch gesture, and allow it to deal with it
      76             :    * however it wishes. Note that this function is not called if the pinch is
      77             :    * prevented by content calling preventDefault() on the touch events, or via
      78             :    * use of the touch-action property.
      79             :    * @param aType One of PINCHGESTURE_START, PINCHGESTURE_SCALE, or
      80             :    *        PINCHGESTURE_END, indicating the phase of the pinch.
      81             :    * @param aGuid The guid of the APZ that is detecting the pinch. This is
      82             :    *        generally the root APZC for the layers id.
      83             :    * @param aSpanChange For the START or END event, this is always 0.
      84             :    *        For a SCALE event, this is the difference in span between the
      85             :    *        previous state and the new state.
      86             :    * @param aModifiers The keyboard modifiers depressed during the pinch.
      87             :    */
      88             :   virtual void NotifyPinchGesture(PinchGestureInput::PinchGestureType aType,
      89             :                                   const ScrollableLayerGuid& aGuid,
      90             :                                   LayoutDeviceCoord aSpanChange,
      91             :                                   Modifiers aModifiers) = 0;
      92             : 
      93             :   /**
      94             :    * Schedules a runnable to run on the controller/UI thread at some time
      95             :    * in the future.
      96             :    * This method must always be called on the controller thread.
      97             :    */
      98             :   virtual void PostDelayedTask(already_AddRefed<Runnable> aRunnable, int aDelayMs) = 0;
      99             : 
     100             :   /**
     101             :    * Returns true if we are currently on the thread that can send repaint requests.
     102             :    */
     103             :   virtual bool IsRepaintThread() = 0;
     104             : 
     105             :   /**
     106             :    * Runs the given task on the "repaint" thread.
     107             :    */
     108             :   virtual void DispatchToRepaintThread(already_AddRefed<Runnable> aTask) = 0;
     109             : 
     110             :   MOZ_DEFINE_ENUM_CLASS_AT_CLASS_SCOPE(
     111             :     APZStateChange, (
     112             :       /**
     113             :        * APZ started modifying the view (including panning, zooming, and fling).
     114             :        */
     115             :       eTransformBegin,
     116             :       /**
     117             :        * APZ finished modifying the view.
     118             :        */
     119             :       eTransformEnd,
     120             :       /**
     121             :        * APZ started a touch.
     122             :        * |aArg| is 1 if touch can be a pan, 0 otherwise.
     123             :        */
     124             :       eStartTouch,
     125             :       /**
     126             :        * APZ started a pan.
     127             :        */
     128             :       eStartPanning,
     129             :       /**
     130             :        * APZ finished processing a touch.
     131             :        * |aArg| is 1 if touch was a click, 0 otherwise.
     132             :        */
     133             :       eEndTouch
     134             :   ));
     135             : 
     136             :   /**
     137             :    * General notices of APZ state changes for consumers.
     138             :    * |aGuid| identifies the APZC originating the state change.
     139             :    * |aChange| identifies the type of state change
     140             :    * |aArg| is used by some state changes to pass extra information (see
     141             :    *        the documentation for each state change above)
     142             :    */
     143           0 :   virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
     144             :                                     APZStateChange aChange,
     145           0 :                                     int aArg = 0) {}
     146             : 
     147             :   /**
     148             :    * Notify content of a MozMouseScrollFailed event.
     149             :    */
     150           0 :   virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
     151           0 :   {}
     152             : 
     153             :   /**
     154             :    * Notify content that the repaint requests have been flushed.
     155             :    */
     156             :   virtual void NotifyFlushComplete() = 0;
     157             : 
     158             :   virtual void NotifyAsyncScrollbarDragRejected(const FrameMetrics::ViewID& aScrollId) = 0;
     159             : 
     160           0 :   virtual void UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent) {}
     161           0 :   virtual void UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent) {}
     162             : 
     163           3 :   GeckoContentController() {}
     164             : 
     165             :   /**
     166             :    * Needs to be called on the main thread.
     167             :    */
     168           0 :   virtual void Destroy() {}
     169             : 
     170             : protected:
     171             :   // Protected destructor, to discourage deletion outside of Release():
     172           0 :   virtual ~GeckoContentController() {}
     173             : };
     174             : 
     175             : } // namespace layers
     176             : } // namespace mozilla
     177             : 
     178             : #endif // mozilla_layers_GeckoContentController_h

Generated by: LCOV version 1.13