gfx/layers/apz/public/GeckoContentController.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set sw=4 ts=8 et tw=80 : */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_layers_GeckoContentController_h
michael@0 8 #define mozilla_layers_GeckoContentController_h
michael@0 9
michael@0 10 #include "FrameMetrics.h" // for FrameMetrics, etc
michael@0 11 #include "Units.h" // for CSSPoint, CSSRect, etc
michael@0 12 #include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
michael@0 13 #include "nsISupportsImpl.h"
michael@0 14
michael@0 15 class Task;
michael@0 16
michael@0 17 namespace mozilla {
michael@0 18 namespace layers {
michael@0 19
michael@0 20 class GeckoContentController
michael@0 21 {
michael@0 22 public:
michael@0 23 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GeckoContentController)
michael@0 24
michael@0 25 /**
michael@0 26 * Requests a paint of the given FrameMetrics |aFrameMetrics| from Gecko.
michael@0 27 * Implementations per-platform are responsible for actually handling this.
michael@0 28 */
michael@0 29 virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) = 0;
michael@0 30
michael@0 31 /**
michael@0 32 * Acknowledges the recipt of a scroll offset update for the scrollable
michael@0 33 * frame with the given scroll id. This is used to maintain consistency
michael@0 34 * between APZ and other sources of scroll changes.
michael@0 35 */
michael@0 36 virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
michael@0 37 const uint32_t& aScrollGeneration) = 0;
michael@0 38
michael@0 39 /**
michael@0 40 * Requests handling of a double tap. |aPoint| is in CSS pixels, relative to
michael@0 41 * the current scroll offset. This should eventually round-trip back to
michael@0 42 * AsyncPanZoomController::ZoomToRect with the dimensions that we want to zoom
michael@0 43 * to.
michael@0 44 */
michael@0 45 virtual void HandleDoubleTap(const CSSPoint& aPoint,
michael@0 46 int32_t aModifiers,
michael@0 47 const ScrollableLayerGuid& aGuid) = 0;
michael@0 48
michael@0 49 /**
michael@0 50 * Requests handling a single tap. |aPoint| is in CSS pixels, relative to the
michael@0 51 * current scroll offset. This should simulate and send to content a mouse
michael@0 52 * button down, then mouse button up at |aPoint|.
michael@0 53 */
michael@0 54 virtual void HandleSingleTap(const CSSPoint& aPoint,
michael@0 55 int32_t aModifiers,
michael@0 56 const ScrollableLayerGuid& aGuid) = 0;
michael@0 57
michael@0 58 /**
michael@0 59 * Requests handling a long tap. |aPoint| is in CSS pixels, relative to the
michael@0 60 * current scroll offset.
michael@0 61 */
michael@0 62 virtual void HandleLongTap(const CSSPoint& aPoint,
michael@0 63 int32_t aModifiers,
michael@0 64 const ScrollableLayerGuid& aGuid) = 0;
michael@0 65
michael@0 66 /**
michael@0 67 * Requests handling of releasing a long tap. |aPoint| is in CSS pixels,
michael@0 68 * relative to the current scroll offset. HandleLongTapUp will always be
michael@0 69 * preceeded by HandleLongTap
michael@0 70 */
michael@0 71 virtual void HandleLongTapUp(const CSSPoint& aPoint,
michael@0 72 int32_t aModifiers,
michael@0 73 const ScrollableLayerGuid& aGuid) = 0;
michael@0 74
michael@0 75 /**
michael@0 76 * Requests sending a mozbrowserasyncscroll domevent to embedder.
michael@0 77 * |aContentRect| is in CSS pixels, relative to the current cssPage.
michael@0 78 * |aScrollableSize| is the current content width/height in CSS pixels.
michael@0 79 */
michael@0 80 virtual void SendAsyncScrollDOMEvent(bool aIsRoot,
michael@0 81 const CSSRect &aContentRect,
michael@0 82 const CSSSize &aScrollableSize) = 0;
michael@0 83
michael@0 84 /**
michael@0 85 * Schedules a runnable to run on the controller/UI thread at some time
michael@0 86 * in the future.
michael@0 87 */
michael@0 88 virtual void PostDelayedTask(Task* aTask, int aDelayMs) = 0;
michael@0 89
michael@0 90 /**
michael@0 91 * Retrieves the last known zoom constraints for the root scrollable layer
michael@0 92 * for this layers tree. This function should return false if there are no
michael@0 93 * last known zoom constraints.
michael@0 94 */
michael@0 95 virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints)
michael@0 96 {
michael@0 97 return false;
michael@0 98 }
michael@0 99
michael@0 100 /**
michael@0 101 * APZ uses |FrameMetrics::mCompositionBounds| for hit testing. Sometimes,
michael@0 102 * widget code has knowledge of a touch-sensitive region that should
michael@0 103 * additionally constrain hit testing for all frames associated with the
michael@0 104 * controller. This method allows APZ to query the controller for such a
michael@0 105 * region. A return value of true indicates that the controller has such a
michael@0 106 * region, and it is returned in |aOutRegion|.
michael@0 107 * TODO: once bug 928833 is implemented, this should be removed, as
michael@0 108 * APZ can then get the correct touch-sensitive region for each frame
michael@0 109 * directly from the layer.
michael@0 110 */
michael@0 111 virtual bool GetTouchSensitiveRegion(CSSRect* aOutRegion)
michael@0 112 {
michael@0 113 return false;
michael@0 114 }
michael@0 115
michael@0 116 MOZ_BEGIN_NESTED_ENUM_CLASS(APZStateChange, int8_t)
michael@0 117 /**
michael@0 118 * APZ started modifying the view (including panning, zooming, and fling).
michael@0 119 */
michael@0 120 TransformBegin,
michael@0 121 /**
michael@0 122 * APZ finished modifying the view.
michael@0 123 */
michael@0 124 TransformEnd,
michael@0 125 /**
michael@0 126 * APZ started a touch.
michael@0 127 * |aArg| is 1 if touch can be a pan, 0 otherwise.
michael@0 128 */
michael@0 129 StartTouch,
michael@0 130 /**
michael@0 131 * APZ started a pan.
michael@0 132 */
michael@0 133 StartPanning,
michael@0 134 /**
michael@0 135 * APZ finished processing a touch.
michael@0 136 * |aArg| is 1 if touch was a click, 0 otherwise.
michael@0 137 */
michael@0 138 EndTouch,
michael@0 139 APZStateChangeSentinel
michael@0 140 MOZ_END_NESTED_ENUM_CLASS(APZStateChange)
michael@0 141
michael@0 142 /**
michael@0 143 * General notices of APZ state changes for consumers.
michael@0 144 * |aGuid| identifies the APZC originating the state change.
michael@0 145 * |aChange| identifies the type of state change
michael@0 146 * |aArg| is used by some state changes to pass extra information (see
michael@0 147 * the documentation for each state change above)
michael@0 148 */
michael@0 149 virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
michael@0 150 APZStateChange aChange,
michael@0 151 int aArg = 0) {}
michael@0 152
michael@0 153 GeckoContentController() {}
michael@0 154
michael@0 155 protected:
michael@0 156 // Protected destructor, to discourage deletion outside of Release():
michael@0 157 virtual ~GeckoContentController() {}
michael@0 158 };
michael@0 159
michael@0 160 MOZ_FINISH_NESTED_ENUM_CLASS(GeckoContentController::APZStateChange)
michael@0 161
michael@0 162 }
michael@0 163 }
michael@0 164
michael@0 165 #endif // mozilla_layers_GeckoContentController_h

mercurial