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 4bddb28647
commit 4de780992c
3 changed files with 34 additions and 2 deletions

View File

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

View File

@ -17,6 +17,13 @@ using mozilla::layers::APZCTreeManager;
namespace mozilla {
namespace widget {
void
AndroidContentController::Destroy()
{
mAndroidWindow = nullptr;
ChromeProcessController::Destroy();
}
void
AndroidContentController::NotifyDefaultPrevented(APZCTreeManager* aManager,
uint64_t aInputBlockId,
@ -75,6 +82,21 @@ AndroidContentController::PostDelayedTask(Task* aTask, int 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 mozilla

View File

@ -12,6 +12,7 @@
#include "mozilla/TimeStamp.h"
#include "nsIDOMWindowUtils.h"
#include "nsTArray.h"
#include "nsWindow.h"
namespace mozilla {
namespace layers {
@ -24,20 +25,26 @@ class AndroidContentController final
: public mozilla::layers::ChromeProcessController
{
public:
AndroidContentController(nsIWidget* aWidget,
AndroidContentController(nsWindow* aWindow,
mozilla::layers::APZEventState* aAPZEventState,
mozilla::layers::APZCTreeManager* aAPZCTreeManager)
: mozilla::layers::ChromeProcessController(aWidget, aAPZEventState, aAPZCTreeManager)
: mozilla::layers::ChromeProcessController(aWindow, aAPZEventState, aAPZCTreeManager)
, mAndroidWindow(aWindow)
{}
// ChromeProcessController methods
virtual void Destroy() override;
void HandleSingleTap(const CSSPoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid) 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,
uint64_t aInputBlockId, bool aDefaultPrevented);
private:
nsWindow* mAndroidWindow;
};
} // namespace widget