mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1077559 - Do some cleanup on APZCCallbackHandler. r=botond
This commit is contained in:
parent
678e25c39d
commit
dd9da9919b
@ -4,29 +4,17 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "APZCCallbackHandler.h"
|
#include "APZCCallbackHandler.h"
|
||||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
|
||||||
#include "mozilla/layers/APZCTreeManager.h"
|
#include "mozilla/layers/APZCTreeManager.h"
|
||||||
#include "nsAppShell.h"
|
|
||||||
#include "nsLayoutUtils.h"
|
|
||||||
#include "nsPrintfCString.h"
|
|
||||||
#include "nsThreadUtils.h"
|
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "nsWindow.h"
|
#include "nsWindow.h"
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
|
||||||
#include "AndroidBridge.h"
|
#include "AndroidBridge.h"
|
||||||
#include "nsIContent.h"
|
|
||||||
|
|
||||||
using mozilla::layers::APZCCallbackHelper;
|
|
||||||
using mozilla::layers::APZCTreeManager;
|
using mozilla::layers::APZCTreeManager;
|
||||||
using mozilla::layers::FrameMetrics;
|
|
||||||
using mozilla::layers::ScrollableLayerGuid;
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace widget {
|
namespace widget {
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
StaticRefPtr<APZCCallbackHandler> APZCCallbackHandler::sInstance;
|
|
||||||
|
|
||||||
NativePanZoomController::GlobalRef APZCCallbackHandler::sNativePanZoomController = nullptr;
|
NativePanZoomController::GlobalRef APZCCallbackHandler::sNativePanZoomController = nullptr;
|
||||||
|
|
||||||
NativePanZoomController::LocalRef
|
NativePanZoomController::LocalRef
|
||||||
@ -45,8 +33,8 @@ APZCCallbackHandler::NotifyDefaultPrevented(uint64_t aInputBlockId,
|
|||||||
// The notification must reach the APZ on the Java UI thread (aka the
|
// The notification must reach the APZ on the Java UI thread (aka the
|
||||||
// APZ "controller" thread) but we get it from the Gecko thread, so we
|
// APZ "controller" thread) but we get it from the Gecko thread, so we
|
||||||
// have to throw it onto the other thread.
|
// have to throw it onto the other thread.
|
||||||
AndroidBridge::Bridge()->PostTaskToUiThread(NewRunnableMethod(
|
AndroidBridge::Bridge()->PostTaskToUiThread(NewRunnableFunction(
|
||||||
this, &APZCCallbackHandler::NotifyDefaultPrevented,
|
&APZCCallbackHandler::NotifyDefaultPrevented,
|
||||||
aInputBlockId, aDefaultPrevented), 0);
|
aInputBlockId, aDefaultPrevented), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -21,34 +21,20 @@ namespace android {
|
|||||||
|
|
||||||
class APZCCallbackHandler final : public mozilla::layers::ChromeProcessController
|
class APZCCallbackHandler final : public mozilla::layers::ChromeProcessController
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
static StaticRefPtr<APZCCallbackHandler> sInstance;
|
|
||||||
|
|
||||||
static NativePanZoomController::GlobalRef sNativePanZoomController;
|
|
||||||
|
|
||||||
private:
|
|
||||||
APZCCallbackHandler(nsIWidget* aWidget, mozilla::layers::APZEventState* aAPZEventState)
|
APZCCallbackHandler(nsIWidget* aWidget, mozilla::layers::APZEventState* aAPZEventState)
|
||||||
: mozilla::layers::ChromeProcessController(aWidget, aAPZEventState)
|
: mozilla::layers::ChromeProcessController(aWidget, aAPZEventState)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
// ChromeProcessController methods
|
||||||
static void Initialize(nsIWidget* aWidget, mozilla::layers::APZEventState* aAPZEventState) {
|
|
||||||
|
|
||||||
MOZ_ASSERT(!sInstance.get(), "APZCCallbackHandler.Initialize() got called twice");
|
|
||||||
sInstance = new APZCCallbackHandler(aWidget, aAPZEventState);
|
|
||||||
}
|
|
||||||
|
|
||||||
static APZCCallbackHandler* GetInstance() {
|
|
||||||
MOZ_ASSERT(sInstance.get(), "Calling APZCCallbackHandler.GetInstance() before it's initialization");
|
|
||||||
return sInstance.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
static NativePanZoomController::LocalRef SetNativePanZoomController(NativePanZoomController::Param obj);
|
|
||||||
void NotifyDefaultPrevented(uint64_t aInputBlockId, bool aDefaultPrevented);
|
|
||||||
|
|
||||||
public: // ChromeProcessController methods
|
|
||||||
|
|
||||||
void PostDelayedTask(Task* aTask, int aDelayMs) override;
|
void PostDelayedTask(Task* aTask, int aDelayMs) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static NativePanZoomController::LocalRef SetNativePanZoomController(NativePanZoomController::Param obj);
|
||||||
|
static void NotifyDefaultPrevented(uint64_t aInputBlockId, bool aDefaultPrevented);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static NativePanZoomController::GlobalRef sNativePanZoomController;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
@ -1077,7 +1077,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
|
|||||||
// previous block should not be default-prevented
|
// previous block should not be default-prevented
|
||||||
bool defaultPrevented = isDownEvent ? false : preventDefaultActions;
|
bool defaultPrevented = isDownEvent ? false : preventDefaultActions;
|
||||||
if (ae->Type() == AndroidGeckoEvent::APZ_INPUT_EVENT) {
|
if (ae->Type() == AndroidGeckoEvent::APZ_INPUT_EVENT) {
|
||||||
widget::android::APZCCallbackHandler::GetInstance()->NotifyDefaultPrevented(ae->ApzInputBlockId(), defaultPrevented);
|
widget::android::APZCCallbackHandler::NotifyDefaultPrevented(ae->ApzInputBlockId(), defaultPrevented);
|
||||||
} else {
|
} else {
|
||||||
GeckoAppShell::NotifyDefaultPrevented(defaultPrevented);
|
GeckoAppShell::NotifyDefaultPrevented(defaultPrevented);
|
||||||
}
|
}
|
||||||
@ -1090,7 +1090,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
|
|||||||
if (isDownEvent) {
|
if (isDownEvent) {
|
||||||
if (preventDefaultActions) {
|
if (preventDefaultActions) {
|
||||||
if (ae->Type() == AndroidGeckoEvent::APZ_INPUT_EVENT) {
|
if (ae->Type() == AndroidGeckoEvent::APZ_INPUT_EVENT) {
|
||||||
widget::android::APZCCallbackHandler::GetInstance()->NotifyDefaultPrevented(ae->ApzInputBlockId(), true);
|
widget::android::APZCCallbackHandler::NotifyDefaultPrevented(ae->ApzInputBlockId(), true);
|
||||||
} else {
|
} else {
|
||||||
GeckoAppShell::NotifyDefaultPrevented(true);
|
GeckoAppShell::NotifyDefaultPrevented(true);
|
||||||
}
|
}
|
||||||
@ -2492,10 +2492,7 @@ nsWindow::ConfigureAPZControllerThread()
|
|||||||
already_AddRefed<GeckoContentController>
|
already_AddRefed<GeckoContentController>
|
||||||
nsWindow::CreateRootContentController()
|
nsWindow::CreateRootContentController()
|
||||||
{
|
{
|
||||||
widget::android::APZCCallbackHandler::Initialize(this, mAPZEventState);
|
nsRefPtr<GeckoContentController> controller = new widget::android::APZCCallbackHandler(this, mAPZEventState);
|
||||||
|
|
||||||
nsRefPtr<widget::android::APZCCallbackHandler> controller =
|
|
||||||
widget::android::APZCCallbackHandler::GetInstance();
|
|
||||||
return controller.forget();
|
return controller.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user