gfx/layers/apz/public/GeckoContentController.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/apz/public/GeckoContentController.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,165 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set sw=4 ts=8 et tw=80 : */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_layers_GeckoContentController_h
    1.11 +#define mozilla_layers_GeckoContentController_h
    1.12 +
    1.13 +#include "FrameMetrics.h"               // for FrameMetrics, etc
    1.14 +#include "Units.h"                      // for CSSPoint, CSSRect, etc
    1.15 +#include "mozilla/Assertions.h"         // for MOZ_ASSERT_HELPER2
    1.16 +#include "nsISupportsImpl.h"
    1.17 +
    1.18 +class Task;
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace layers {
    1.22 +
    1.23 +class GeckoContentController
    1.24 +{
    1.25 +public:
    1.26 +  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GeckoContentController)
    1.27 +
    1.28 +  /**
    1.29 +   * Requests a paint of the given FrameMetrics |aFrameMetrics| from Gecko.
    1.30 +   * Implementations per-platform are responsible for actually handling this.
    1.31 +   */
    1.32 +  virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) = 0;
    1.33 +
    1.34 +  /**
    1.35 +   * Acknowledges the recipt of a scroll offset update for the scrollable
    1.36 +   * frame with the given scroll id. This is used to maintain consistency
    1.37 +   * between APZ and other sources of scroll changes.
    1.38 +   */
    1.39 +  virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
    1.40 +                                       const uint32_t& aScrollGeneration) = 0;
    1.41 +
    1.42 +  /**
    1.43 +   * Requests handling of a double tap. |aPoint| is in CSS pixels, relative to
    1.44 +   * the current scroll offset. This should eventually round-trip back to
    1.45 +   * AsyncPanZoomController::ZoomToRect with the dimensions that we want to zoom
    1.46 +   * to.
    1.47 +   */
    1.48 +  virtual void HandleDoubleTap(const CSSPoint& aPoint,
    1.49 +                               int32_t aModifiers,
    1.50 +                               const ScrollableLayerGuid& aGuid) = 0;
    1.51 +
    1.52 +  /**
    1.53 +   * Requests handling a single tap. |aPoint| is in CSS pixels, relative to the
    1.54 +   * current scroll offset. This should simulate and send to content a mouse
    1.55 +   * button down, then mouse button up at |aPoint|.
    1.56 +   */
    1.57 +  virtual void HandleSingleTap(const CSSPoint& aPoint,
    1.58 +                               int32_t aModifiers,
    1.59 +                               const ScrollableLayerGuid& aGuid) = 0;
    1.60 +
    1.61 +  /**
    1.62 +   * Requests handling a long tap. |aPoint| is in CSS pixels, relative to the
    1.63 +   * current scroll offset.
    1.64 +   */
    1.65 +  virtual void HandleLongTap(const CSSPoint& aPoint,
    1.66 +                             int32_t aModifiers,
    1.67 +                             const ScrollableLayerGuid& aGuid) = 0;
    1.68 +
    1.69 +  /**
    1.70 +   * Requests handling of releasing a long tap. |aPoint| is in CSS pixels,
    1.71 +   * relative to the current scroll offset. HandleLongTapUp will always be
    1.72 +   * preceeded by HandleLongTap
    1.73 +   */
    1.74 +  virtual void HandleLongTapUp(const CSSPoint& aPoint,
    1.75 +                               int32_t aModifiers,
    1.76 +                               const ScrollableLayerGuid& aGuid) = 0;
    1.77 +
    1.78 +  /**
    1.79 +   * Requests sending a mozbrowserasyncscroll domevent to embedder.
    1.80 +   * |aContentRect| is in CSS pixels, relative to the current cssPage.
    1.81 +   * |aScrollableSize| is the current content width/height in CSS pixels.
    1.82 +   */
    1.83 +  virtual void SendAsyncScrollDOMEvent(bool aIsRoot,
    1.84 +                                       const CSSRect &aContentRect,
    1.85 +                                       const CSSSize &aScrollableSize) = 0;
    1.86 +
    1.87 +  /**
    1.88 +   * Schedules a runnable to run on the controller/UI thread at some time
    1.89 +   * in the future.
    1.90 +   */
    1.91 +  virtual void PostDelayedTask(Task* aTask, int aDelayMs) = 0;
    1.92 +
    1.93 +  /**
    1.94 +   * Retrieves the last known zoom constraints for the root scrollable layer
    1.95 +   * for this layers tree. This function should return false if there are no
    1.96 +   * last known zoom constraints.
    1.97 +   */
    1.98 +  virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints)
    1.99 +  {
   1.100 +    return false;
   1.101 +  }
   1.102 +
   1.103 +  /**
   1.104 +   * APZ uses |FrameMetrics::mCompositionBounds| for hit testing. Sometimes,
   1.105 +   * widget code has knowledge of a touch-sensitive region that should
   1.106 +   * additionally constrain hit testing for all frames associated with the
   1.107 +   * controller. This method allows APZ to query the controller for such a
   1.108 +   * region. A return value of true indicates that the controller has such a
   1.109 +   * region, and it is returned in |aOutRegion|.
   1.110 +   * TODO: once bug 928833 is implemented, this should be removed, as
   1.111 +   * APZ can then get the correct touch-sensitive region for each frame
   1.112 +   * directly from the layer.
   1.113 +   */
   1.114 +  virtual bool GetTouchSensitiveRegion(CSSRect* aOutRegion)
   1.115 +  {
   1.116 +    return false;
   1.117 +  }
   1.118 +
   1.119 +  MOZ_BEGIN_NESTED_ENUM_CLASS(APZStateChange, int8_t)
   1.120 +    /**
   1.121 +     * APZ started modifying the view (including panning, zooming, and fling).
   1.122 +     */
   1.123 +    TransformBegin,
   1.124 +    /**
   1.125 +     * APZ finished modifying the view.
   1.126 +     */
   1.127 +    TransformEnd,
   1.128 +    /**
   1.129 +     * APZ started a touch.
   1.130 +     * |aArg| is 1 if touch can be a pan, 0 otherwise.
   1.131 +     */
   1.132 +    StartTouch,
   1.133 +    /**
   1.134 +     * APZ started a pan.
   1.135 +     */
   1.136 +    StartPanning,
   1.137 +    /**
   1.138 +     * APZ finished processing a touch.
   1.139 +     * |aArg| is 1 if touch was a click, 0 otherwise.
   1.140 +     */
   1.141 +    EndTouch,
   1.142 +    APZStateChangeSentinel
   1.143 +  MOZ_END_NESTED_ENUM_CLASS(APZStateChange)
   1.144 +
   1.145 +  /**
   1.146 +   * General notices of APZ state changes for consumers.
   1.147 +   * |aGuid| identifies the APZC originating the state change.
   1.148 +   * |aChange| identifies the type of state change
   1.149 +   * |aArg| is used by some state changes to pass extra information (see
   1.150 +   *        the documentation for each state change above)
   1.151 +   */
   1.152 +  virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
   1.153 +                                    APZStateChange aChange,
   1.154 +                                    int aArg = 0) {}
   1.155 +
   1.156 +  GeckoContentController() {}
   1.157 +
   1.158 +protected:
   1.159 +  // Protected destructor, to discourage deletion outside of Release():
   1.160 +  virtual ~GeckoContentController() {}
   1.161 +};
   1.162 +
   1.163 +MOZ_FINISH_NESTED_ENUM_CLASS(GeckoContentController::APZStateChange)
   1.164 +
   1.165 +}
   1.166 +}
   1.167 +
   1.168 +#endif // mozilla_layers_GeckoContentController_h

mercurial