Bug 1230674 - part 3, Add overscroll api to GeckoContentController and AndroidContentController r=snorp,kats

This commit is contained in:
Randall Barker 2016-01-25 17:32:33 -08:00
parent 74d6df1aaf
commit dcf89b18d6
3 changed files with 34 additions and 2 deletions

View File

@ -144,6 +144,9 @@ public:
*/ */
virtual void NotifyFlushComplete() = 0; virtual void NotifyFlushComplete() = 0;
virtual void UpdateOverscrollVelocity(const float aX, const float aY) {}
virtual void UpdateOverscrollOffset(const float aX,const float aY) {}
GeckoContentController() {} GeckoContentController() {}
virtual void Destroy() {} virtual void Destroy() {}

View File

@ -17,6 +17,13 @@ using mozilla::layers::APZCTreeManager;
namespace mozilla { namespace mozilla {
namespace widget { namespace widget {
void
AndroidContentController::Destroy()
{
mAndroidWindow = nullptr;
ChromeProcessController::Destroy();
}
void void
AndroidContentController::NotifyDefaultPrevented(APZCTreeManager* aManager, AndroidContentController::NotifyDefaultPrevented(APZCTreeManager* aManager,
uint64_t aInputBlockId, uint64_t aInputBlockId,
@ -75,6 +82,21 @@ AndroidContentController::PostDelayedTask(Task* aTask, int aDelayMs)
{ {
AndroidBridge::Bridge()->PostTaskToUiThread(aTask, aDelayMs); AndroidBridge::Bridge()->PostTaskToUiThread(aTask, aDelayMs);
} }
void
AndroidContentController::UpdateOverscrollVelocity(const float aX, const float aY)
{
if (mAndroidWindow) {
mAndroidWindow->UpdateOverscrollVelocity(aX, aY);
}
}
void
AndroidContentController::UpdateOverscrollOffset(const float aX,const float aY)
{
if (mAndroidWindow) {
mAndroidWindow->UpdateOverscrollOffset(aX, aY);
}
}
} // namespace widget } // namespace widget
} // namespace mozilla } // namespace mozilla

View File

@ -12,6 +12,7 @@
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
#include "nsIDOMWindowUtils.h" #include "nsIDOMWindowUtils.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsWindow.h"
namespace mozilla { namespace mozilla {
namespace layers { namespace layers {
@ -24,20 +25,26 @@ class AndroidContentController final
: public mozilla::layers::ChromeProcessController : public mozilla::layers::ChromeProcessController
{ {
public: public:
AndroidContentController(nsIWidget* aWidget, AndroidContentController(nsWindow* aWindow,
mozilla::layers::APZEventState* aAPZEventState, mozilla::layers::APZEventState* aAPZEventState,
mozilla::layers::APZCTreeManager* aAPZCTreeManager) mozilla::layers::APZCTreeManager* aAPZCTreeManager)
: mozilla::layers::ChromeProcessController(aWidget, aAPZEventState, aAPZCTreeManager) : mozilla::layers::ChromeProcessController(aWindow, aAPZEventState, aAPZCTreeManager)
, mAndroidWindow(aWindow)
{} {}
// ChromeProcessController methods // ChromeProcessController methods
virtual void Destroy() override;
void HandleSingleTap(const CSSPoint& aPoint, void HandleSingleTap(const CSSPoint& aPoint,
Modifiers aModifiers, Modifiers aModifiers,
const ScrollableLayerGuid& aGuid) override; const ScrollableLayerGuid& aGuid) override;
void PostDelayedTask(Task* aTask, int aDelayMs) override; void PostDelayedTask(Task* aTask, int aDelayMs) override;
void UpdateOverscrollVelocity(const float aX, const float aY) override;
void UpdateOverscrollOffset(const float aX,const float aY) override;
static void NotifyDefaultPrevented(mozilla::layers::APZCTreeManager* aManager, static void NotifyDefaultPrevented(mozilla::layers::APZCTreeManager* aManager,
uint64_t aInputBlockId, bool aDefaultPrevented); uint64_t aInputBlockId, bool aDefaultPrevented);
private:
nsWindow* mAndroidWindow;
}; };
} // namespace widget } // namespace widget