зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1146024 - Fix up input routing for APZ on Fennec. r=kats
nsWindow::ProcessUntransformedAPZEvent is the method that deals with APZ Input, so it should receive it's events
This commit is contained in:
Родитель
848c9ba9ee
Коммит
d7e8379673
|
@ -6,6 +6,7 @@
|
|||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
|
||||
#include "mozilla/layers/Compositor.h"
|
||||
#include "AndroidBridge.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -52,6 +53,16 @@ APZThreadUtils::AssertOnCompositorThread()
|
|||
/*static*/ void
|
||||
APZThreadUtils::RunOnControllerThread(Task* aTask)
|
||||
{
|
||||
#ifdef MOZ_ANDROID_APZ
|
||||
// This is needed while nsWindow::ConfigureAPZControllerThread is not propper
|
||||
// implemented.
|
||||
if (AndroidBridge::IsJavaUiThread()) {
|
||||
aTask->Run();
|
||||
delete aTask;
|
||||
} else {
|
||||
AndroidBridge::Bridge()->PostTaskToUiThread(aTask, 0);
|
||||
}
|
||||
#else
|
||||
if (!sControllerThread) {
|
||||
// Could happen on startup
|
||||
NS_WARNING("Dropping task posted to controller thread\n");
|
||||
|
@ -65,6 +76,7 @@ APZThreadUtils::RunOnControllerThread(Task* aTask)
|
|||
} else {
|
||||
sControllerThread->PostTask(FROM_HERE, aTask);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -1074,7 +1074,7 @@ ScrollFrameHelper::HandleScrollbarStyleSwitching()
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(MOZ_B2G) || defined(MOZ_WIDGET_ANDROID)
|
||||
#if defined(MOZ_B2G) || (defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_ANDROID_APZ))
|
||||
static bool IsFocused(nsIContent* aContent)
|
||||
{
|
||||
// Some content elements, like the GetContent() of a scroll frame
|
||||
|
@ -1099,7 +1099,7 @@ ScrollFrameHelper::WantAsyncScroll() const
|
|||
bool isHScrollable = !!(directions & nsIScrollableFrame::HORIZONTAL) &&
|
||||
(styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN);
|
||||
|
||||
#if defined(MOZ_B2G) || defined(MOZ_WIDGET_ANDROID)
|
||||
#if defined(MOZ_B2G) || (defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_ANDROID_APZ))
|
||||
// Mobile platforms need focus to scroll.
|
||||
bool canScrollWithoutScrollbars = IsFocused(mOuter->GetContent());
|
||||
#else
|
||||
|
|
|
@ -949,7 +949,7 @@ Java_org_mozilla_gecko_gfx_NativePanZoomController_handleTouchEvent(JNIEnv* env,
|
|||
uint64_t blockId;
|
||||
nsEventStatus status = controller->ReceiveInputEvent(input, &guid, &blockId);
|
||||
if (status != nsEventStatus_eConsumeNoDefault) {
|
||||
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeApzInputEvent(input, guid, blockId));
|
||||
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeApzInputEvent(input, guid, blockId, status));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -672,6 +672,13 @@ AndroidGeckoEvent::ApzInputBlockId()
|
|||
return mApzInputBlockId;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
AndroidGeckoEvent::ApzEventStatus()
|
||||
{
|
||||
MOZ_ASSERT(Type() == APZ_INPUT_EVENT);
|
||||
return mApzEventStatus;
|
||||
}
|
||||
|
||||
WidgetTouchEvent
|
||||
AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
|
||||
{
|
||||
|
|
|
@ -495,12 +495,13 @@ public:
|
|||
return event;
|
||||
}
|
||||
|
||||
static AndroidGeckoEvent* MakeApzInputEvent(const MultiTouchInput& aInput, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) {
|
||||
static AndroidGeckoEvent* MakeApzInputEvent(const MultiTouchInput& aInput, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId, nsEventStatus aEventStatus) {
|
||||
AndroidGeckoEvent* event = new AndroidGeckoEvent();
|
||||
event->Init(APZ_INPUT_EVENT);
|
||||
event->mApzInput = aInput;
|
||||
event->mApzGuid = aGuid;
|
||||
event->mApzInputBlockId = aInputBlockId;
|
||||
event->mApzEventStatus = aEventStatus;
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -570,6 +571,7 @@ public:
|
|||
nsIObserver *Observer() { return mObserver; }
|
||||
mozilla::layers::ScrollableLayerGuid ApzGuid();
|
||||
uint64_t ApzInputBlockId();
|
||||
nsEventStatus ApzEventStatus();
|
||||
|
||||
protected:
|
||||
int mAction;
|
||||
|
@ -612,6 +614,7 @@ protected:
|
|||
MultiTouchInput mApzInput;
|
||||
mozilla::layers::ScrollableLayerGuid mApzGuid;
|
||||
uint64_t mApzInputBlockId;
|
||||
nsEventStatus mApzEventStatus;
|
||||
AutoGlobalWrappedJavaObject mObject;
|
||||
|
||||
void ReadIntArray(nsTArray<int> &aVals,
|
||||
|
|
|
@ -46,6 +46,7 @@ using mozilla::unused;
|
|||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/AsyncCompositionManager.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLContextProvider.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
|
@ -837,7 +838,13 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
|||
break;
|
||||
}
|
||||
|
||||
case AndroidGeckoEvent::APZ_INPUT_EVENT:
|
||||
case AndroidGeckoEvent::APZ_INPUT_EVENT: {
|
||||
win->UserActivity();
|
||||
|
||||
WidgetTouchEvent touchEvent = ae->MakeTouchEvent(win);
|
||||
win->ProcessUntransformedAPZEvent(&touchEvent, ae->ApzGuid(), ae->ApzInputBlockId(), ae->ApzEventStatus());
|
||||
break;
|
||||
}
|
||||
case AndroidGeckoEvent::MOTION_EVENT: {
|
||||
win->UserActivity();
|
||||
bool preventDefaultActions = win->OnMultitouchEvent(ae);
|
||||
|
@ -2513,6 +2520,12 @@ nsWindow::ConfigureAPZCTreeManager()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::ConfigureAPZControllerThread()
|
||||
{
|
||||
APZThreadUtils::SetControllerThread(nullptr);
|
||||
}
|
||||
|
||||
already_AddRefed<GeckoContentController>
|
||||
nsWindow::CreateRootContentController()
|
||||
{
|
||||
|
|
|
@ -203,6 +203,8 @@ protected:
|
|||
void FlushIMEChanges();
|
||||
|
||||
void ConfigureAPZCTreeManager() override;
|
||||
void ConfigureAPZControllerThread() override;
|
||||
|
||||
already_AddRefed<GeckoContentController> CreateRootContentController() override;
|
||||
|
||||
// Call this function when the users activity is the direct cause of an
|
||||
|
|
Загрузка…
Ссылка в новой задаче