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