2012-07-19 23:48:25 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_layers_GeckoContentController_h
|
|
|
|
#define mozilla_layers_GeckoContentController_h
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "FrameMetrics.h" // for FrameMetrics, etc
|
2014-03-12 12:27:45 -07:00
|
|
|
#include "Units.h" // for CSSPoint, CSSRect, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
2012-07-30 17:42:26 -07:00
|
|
|
#include "nsISupportsImpl.h"
|
2012-07-19 23:48:25 -07:00
|
|
|
|
2013-02-25 12:50:49 -08:00
|
|
|
class Task;
|
|
|
|
|
2012-07-19 23:48:25 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class GeckoContentController
|
|
|
|
{
|
2012-07-19 23:48:25 -07:00
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(GeckoContentController)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Requests a paint of the given FrameMetrics |aFrameMetrics| from Gecko.
|
|
|
|
* Implementations per-platform are responsible for actually handling this.
|
|
|
|
*/
|
|
|
|
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) = 0;
|
2012-07-22 13:37:13 -07:00
|
|
|
|
2014-02-05 14:43:20 -08:00
|
|
|
/**
|
|
|
|
* Acknowledges the recipt of a scroll offset update for the scrollable
|
|
|
|
* frame with the given scroll id. This is used to maintain consistency
|
|
|
|
* between APZ and other sources of scroll changes.
|
|
|
|
*/
|
|
|
|
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
|
|
|
|
const uint32_t& aScrollGeneration) = 0;
|
|
|
|
|
2012-08-08 21:39:02 -07:00
|
|
|
/**
|
|
|
|
* Requests handling of a double tap. |aPoint| is in CSS pixels, relative to
|
|
|
|
* the current scroll offset. This should eventually round-trip back to
|
|
|
|
* AsyncPanZoomController::ZoomToRect with the dimensions that we want to zoom
|
|
|
|
* to.
|
|
|
|
*/
|
2014-03-12 12:27:45 -07:00
|
|
|
virtual void HandleDoubleTap(const CSSPoint& aPoint,
|
2014-02-07 09:13:50 -08:00
|
|
|
int32_t aModifiers,
|
|
|
|
const ScrollableLayerGuid& aGuid) = 0;
|
2012-08-08 21:39:02 -07:00
|
|
|
|
2012-09-14 18:16:32 -07:00
|
|
|
/**
|
|
|
|
* Requests handling a single tap. |aPoint| is in CSS pixels, relative to the
|
|
|
|
* current scroll offset. This should simulate and send to content a mouse
|
|
|
|
* button down, then mouse button up at |aPoint|.
|
|
|
|
*/
|
2014-03-12 12:27:45 -07:00
|
|
|
virtual void HandleSingleTap(const CSSPoint& aPoint,
|
2014-02-07 09:13:50 -08:00
|
|
|
int32_t aModifiers,
|
|
|
|
const ScrollableLayerGuid& aGuid) = 0;
|
2012-09-14 18:16:32 -07:00
|
|
|
|
2012-11-08 11:35:02 -08:00
|
|
|
/**
|
|
|
|
* Requests handling a long tap. |aPoint| is in CSS pixels, relative to the
|
|
|
|
* current scroll offset.
|
|
|
|
*/
|
2014-03-12 12:27:45 -07:00
|
|
|
virtual void HandleLongTap(const CSSPoint& aPoint,
|
2014-02-07 09:13:50 -08:00
|
|
|
int32_t aModifiers,
|
|
|
|
const ScrollableLayerGuid& aGuid) = 0;
|
2012-11-08 11:35:02 -08:00
|
|
|
|
2013-12-11 16:39:06 -08:00
|
|
|
/**
|
|
|
|
* Requests handling of releasing a long tap. |aPoint| is in CSS pixels,
|
|
|
|
* relative to the current scroll offset. HandleLongTapUp will always be
|
|
|
|
* preceeded by HandleLongTap
|
|
|
|
*/
|
2014-03-12 12:27:45 -07:00
|
|
|
virtual void HandleLongTapUp(const CSSPoint& aPoint,
|
2014-02-07 09:13:50 -08:00
|
|
|
int32_t aModifiers,
|
|
|
|
const ScrollableLayerGuid& aGuid) = 0;
|
2013-12-11 16:39:06 -08:00
|
|
|
|
2012-12-24 22:09:34 -08:00
|
|
|
/**
|
|
|
|
* Requests sending a mozbrowserasyncscroll domevent to embedder.
|
|
|
|
* |aContentRect| is in CSS pixels, relative to the current cssPage.
|
|
|
|
* |aScrollableSize| is the current content width/height in CSS pixels.
|
|
|
|
*/
|
2013-11-08 16:07:00 -08:00
|
|
|
virtual void SendAsyncScrollDOMEvent(bool aIsRoot,
|
2013-07-30 11:03:42 -07:00
|
|
|
const CSSRect &aContentRect,
|
2013-06-10 06:05:44 -07:00
|
|
|
const CSSSize &aScrollableSize) = 0;
|
2012-12-24 22:09:34 -08:00
|
|
|
|
2013-02-25 12:50:49 -08:00
|
|
|
/**
|
|
|
|
* Schedules a runnable to run on the controller/UI thread at some time
|
|
|
|
* in the future.
|
|
|
|
*/
|
|
|
|
virtual void PostDelayedTask(Task* aTask, int aDelayMs) = 0;
|
|
|
|
|
2013-09-13 07:18:33 -07:00
|
|
|
/**
|
2013-11-14 09:35:41 -08:00
|
|
|
* Retrieves the last known zoom constraints for the root scrollable layer
|
|
|
|
* for this layers tree. This function should return false if there are no
|
|
|
|
* last known zoom constraints.
|
2013-09-13 07:18:33 -07:00
|
|
|
*/
|
2014-01-06 10:26:44 -08:00
|
|
|
virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints)
|
2013-09-13 07:18:33 -07:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2013-07-25 10:15:06 -07:00
|
|
|
|
2014-01-16 12:19:59 -08:00
|
|
|
/**
|
|
|
|
* APZ uses |FrameMetrics::mCompositionBounds| for hit testing. Sometimes,
|
|
|
|
* widget code has knowledge of a touch-sensitive region that should
|
|
|
|
* additionally constrain hit testing for all frames associated with the
|
|
|
|
* controller. This method allows APZ to query the controller for such a
|
|
|
|
* region. A return value of true indicates that the controller has such a
|
|
|
|
* region, and it is returned in |aOutRegion|.
|
|
|
|
* TODO: once bug 928833 is implemented, this should be removed, as
|
|
|
|
* APZ can then get the correct touch-sensitive region for each frame
|
|
|
|
* directly from the layer.
|
|
|
|
*/
|
|
|
|
virtual bool GetTouchSensitiveRegion(CSSRect* aOutRegion)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-04-11 17:27:57 -07:00
|
|
|
MOZ_BEGIN_NESTED_ENUM_CLASS(APZStateChange, int8_t)
|
|
|
|
/**
|
|
|
|
* APZ started modifying the view (including panning, zooming, and fling).
|
|
|
|
*/
|
|
|
|
TransformBegin,
|
|
|
|
/**
|
|
|
|
* APZ finished modifying the view.
|
|
|
|
*/
|
|
|
|
TransformEnd,
|
2014-04-09 11:07:47 -07:00
|
|
|
/**
|
|
|
|
* APZ started a touch.
|
|
|
|
* |aArg| is 1 if touch can be a pan, 0 otherwise.
|
|
|
|
*/
|
|
|
|
StartTouch,
|
2014-04-14 11:57:09 -07:00
|
|
|
/**
|
|
|
|
* APZ started a pan.
|
|
|
|
*/
|
|
|
|
StartPanning,
|
2014-04-11 17:27:57 -07:00
|
|
|
APZStateChangeSentinel
|
|
|
|
MOZ_END_NESTED_ENUM_CLASS(APZStateChange)
|
|
|
|
|
2013-07-25 10:15:06 -07:00
|
|
|
/**
|
2014-04-11 17:27:57 -07:00
|
|
|
* General notices of APZ state changes for consumers.
|
|
|
|
* |aGuid| identifies the APZC originating the state change.
|
|
|
|
* |aChange| identifies the type of state change
|
|
|
|
* |aArg| is used by some state changes to pass extra information (see
|
|
|
|
* the documentation for each state change above)
|
2013-07-25 10:15:06 -07:00
|
|
|
*/
|
2014-04-11 17:27:57 -07:00
|
|
|
virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
|
|
|
APZStateChange aChange,
|
|
|
|
int aArg = 0) {}
|
2013-07-25 10:15:06 -07:00
|
|
|
|
2012-07-24 12:12:11 -07:00
|
|
|
GeckoContentController() {}
|
2014-04-04 09:27:02 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Protected destructor, to discourage deletion outside of Release():
|
2012-07-24 12:12:11 -07:00
|
|
|
virtual ~GeckoContentController() {}
|
2012-07-19 23:48:25 -07:00
|
|
|
};
|
|
|
|
|
2014-04-11 17:27:57 -07:00
|
|
|
MOZ_FINISH_NESTED_ENUM_CLASS(GeckoContentController::APZStateChange)
|
|
|
|
|
2012-07-19 23:48:25 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // mozilla_layers_GeckoContentController_h
|