forked from mirrors/gecko-dev
Bug 1858610 - Move HandleTap from the APZCTreeManager to the InputBridge protocol. r=botond
The HandleTap message should be part of the InputBridge protocol to ensure that the synthesized click events are sent to content after the corresponding touch-end. Differential Revision: https://phabricator.services.mozilla.com/D203468
This commit is contained in:
parent
286db30f2d
commit
d497db15e7
13 changed files with 192 additions and 94 deletions
|
|
@ -24,14 +24,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1285070
|
|||
{"file": "helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html",
|
||||
"prefs": touch_action_prefs},
|
||||
{"file": "helper_bug1719855_pointercancel_on_touchmove_after_contextmenu_prevented.html"},
|
||||
{"file": "helper_bug1285070.html"},
|
||||
{"file": "helper_bug1299195.html", "prefs": [["dom.meta-viewport.enabled", isMac]]},
|
||||
];
|
||||
|
||||
if (getPlatform() != "android") {
|
||||
// Bug 1858610: these subtests are flaky on Android.
|
||||
subtests.push(
|
||||
{"file": "helper_bug1285070.html"},
|
||||
{"file": "helper_bug1299195.html", "prefs": [["dom.meta-viewport.enabled", isMac]]},
|
||||
{"file": "helper_bug1502010_unconsumed_pan.html"}
|
||||
)
|
||||
subtests.push({"file": "helper_bug1502010_unconsumed_pan.html"});
|
||||
}
|
||||
|
||||
if (isApzEnabled()) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ void APZCTreeManagerChild::SetCompositorSession(
|
|||
// we're setting mCompositorSession or we're clearing it).
|
||||
MOZ_ASSERT(!mCompositorSession ^ !aSession);
|
||||
mCompositorSession = aSession;
|
||||
if (mInputBridge) {
|
||||
mInputBridge->SetCompositorSession(aSession);
|
||||
}
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::SetInputBridge(APZInputBridgeChild* aInputBridge) {
|
||||
|
|
@ -143,45 +146,6 @@ void APZCTreeManagerChild::ActorDestroy(ActorDestroyReason aWhy) {
|
|||
mIPCOpen = false;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerChild::RecvHandleTap(
|
||||
const TapType& aType, const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
if (mCompositorSession &&
|
||||
mCompositorSession->RootLayerTreeId() == aGuid.mLayersId &&
|
||||
mCompositorSession->GetContentController()) {
|
||||
RefPtr<GeckoContentController> controller =
|
||||
mCompositorSession->GetContentController();
|
||||
controller->HandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics);
|
||||
return IPC_OK();
|
||||
}
|
||||
dom::BrowserParent* tab =
|
||||
dom::BrowserParent::GetBrowserParentFromLayersId(aGuid.mLayersId);
|
||||
if (tab) {
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// On Android, touch events are dispatched from the UI thread to the main
|
||||
// thread using the Android priority queue. It is possible that this tap has
|
||||
// made it to the GPU process and back before they have been processed. We
|
||||
// must therefore dispatch this message to the same queue, otherwise the tab
|
||||
// may receive the tap event before the touch events that synthesized it.
|
||||
mozilla::jni::DispatchToGeckoPriorityQueue(
|
||||
NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
|
||||
ScrollableLayerGuid, uint64_t,
|
||||
Maybe<DoubleTapToZoomMetrics>>(
|
||||
"dom::BrowserParent::SendHandleTap", tab,
|
||||
&dom::BrowserParent::SendHandleTap, aType, aPoint, aModifiers,
|
||||
aGuid, aInputBlockId, aDoubleTapToZoomMetrics));
|
||||
#else
|
||||
tab->SendHandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics);
|
||||
#endif
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerChild::RecvNotifyPinchGesture(
|
||||
const PinchGestureType& aType, const ScrollableLayerGuid& aGuid,
|
||||
const LayoutDevicePoint& aFocusPoint, const LayoutDeviceCoord& aSpanChange,
|
||||
|
|
|
|||
|
|
@ -73,13 +73,6 @@ class APZCTreeManagerChild : public IAPZCTreeManager,
|
|||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
protected:
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
mozilla::ipc::IPCResult RecvHandleTap(
|
||||
const TapType& aType, const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNotifyPinchGesture(
|
||||
const PinchGestureType& aType, const ScrollableLayerGuid& aGuid,
|
||||
const LayoutDevicePoint& aFocusPoint,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@
|
|||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layers/SynchronousTask.h"
|
||||
|
||||
#include "mozilla/layers/GeckoContentController.h" // for GeckoContentController
|
||||
#include "mozilla/layers/DoubleTapToZoom.h" // for DoubleTapToZoomMetrics
|
||||
#include "mozilla/layers/RemoteCompositorSession.h" // for RemoteCompositorSession
|
||||
#include "mozilla/dom/BrowserParent.h" // for BrowserParent
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
# include "mozilla/jni/Utils.h" // for DispatchToGeckoPriorityQueue
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
|
@ -31,13 +39,20 @@ RefPtr<APZInputBridgeChild> APZInputBridgeChild::Create(
|
|||
}
|
||||
|
||||
APZInputBridgeChild::APZInputBridgeChild(const uint64_t& aProcessToken)
|
||||
: mIsOpen(false), mProcessToken(aProcessToken) {
|
||||
: mIsOpen(false),
|
||||
mProcessToken(aProcessToken),
|
||||
mCompositorSession(nullptr) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
|
||||
APZInputBridgeChild::~APZInputBridgeChild() = default;
|
||||
|
||||
void APZInputBridgeChild::SetCompositorSession(
|
||||
RemoteCompositorSession* aSession) {
|
||||
mCompositorSession = aSession;
|
||||
}
|
||||
|
||||
void APZInputBridgeChild::Open(Endpoint<PAPZInputBridgeChild>&& aEndpoint) {
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
|
|
@ -176,6 +191,63 @@ APZEventResult APZInputBridgeChild::ReceiveInputEvent(
|
|||
return res;
|
||||
}
|
||||
|
||||
void APZInputBridgeChild::HandleTapOnMainThread(
|
||||
const TapType& aType, const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics) {
|
||||
if (mCompositorSession &&
|
||||
mCompositorSession->RootLayerTreeId() == aGuid.mLayersId &&
|
||||
mCompositorSession->GetContentController()) {
|
||||
RefPtr<GeckoContentController> controller =
|
||||
mCompositorSession->GetContentController();
|
||||
controller->HandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics);
|
||||
return;
|
||||
}
|
||||
dom::BrowserParent* tab =
|
||||
dom::BrowserParent::GetBrowserParentFromLayersId(aGuid.mLayersId);
|
||||
if (tab) {
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// On Android, touch events are dispatched from the UI thread to the main
|
||||
// thread using the Android priority queue. It is possible that this tap has
|
||||
// made it to the GPU process and back before they have been processed. We
|
||||
// must therefore dispatch this message to the same queue, otherwise the tab
|
||||
// may receive the tap event before the touch events that synthesized it.
|
||||
mozilla::jni::DispatchToGeckoPriorityQueue(
|
||||
NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
|
||||
ScrollableLayerGuid, uint64_t,
|
||||
Maybe<DoubleTapToZoomMetrics>>(
|
||||
"dom::BrowserParent::SendHandleTap", tab,
|
||||
&dom::BrowserParent::SendHandleTap, aType, aPoint, aModifiers,
|
||||
aGuid, aInputBlockId, aDoubleTapToZoomMetrics));
|
||||
#else
|
||||
tab->SendHandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeChild::RecvHandleTap(
|
||||
const TapType& aType, const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics) {
|
||||
if (NS_IsMainThread()) {
|
||||
HandleTapOnMainThread(aType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics);
|
||||
} else {
|
||||
NS_DispatchToMainThread(
|
||||
NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
|
||||
ScrollableLayerGuid, uint64_t,
|
||||
Maybe<DoubleTapToZoomMetrics>>(
|
||||
"layers::APZInputBridgeChild::HandleTapOnMainThread", this,
|
||||
&APZInputBridgeChild::HandleTapOnMainThread, aType, aPoint,
|
||||
aModifiers, aGuid, aInputBlockId, aDoubleTapToZoomMetrics));
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeChild::RecvCallInputBlockCallback(
|
||||
uint64_t aInputBlockId, const APZHandledResult& aHandledResult) {
|
||||
auto it = mInputBlockCallbacks.find(aInputBlockId);
|
||||
|
|
|
|||
|
|
@ -10,11 +10,16 @@
|
|||
#include "mozilla/layers/APZInputBridge.h"
|
||||
#include "mozilla/layers/PAPZInputBridgeChild.h"
|
||||
|
||||
#include "mozilla/layers/GeckoContentControllerTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class RemoteCompositorSession;
|
||||
|
||||
class APZInputBridgeChild : public PAPZInputBridgeChild, public APZInputBridge {
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(APZInputBridgeChild, final)
|
||||
using TapType = GeckoContentController_TapType;
|
||||
|
||||
public:
|
||||
static RefPtr<APZInputBridgeChild> Create(
|
||||
|
|
@ -23,10 +28,19 @@ class APZInputBridgeChild : public PAPZInputBridgeChild, public APZInputBridge {
|
|||
|
||||
void Destroy();
|
||||
|
||||
void SetCompositorSession(RemoteCompositorSession* aSession);
|
||||
|
||||
APZEventResult ReceiveInputEvent(
|
||||
InputData& aEvent,
|
||||
InputBlockCallback&& aCallback = InputBlockCallback()) override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
mozilla::ipc::IPCResult RecvHandleTap(
|
||||
const TapType& aType, const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics);
|
||||
|
||||
mozilla::ipc::IPCResult RecvCallInputBlockCallback(
|
||||
uint64_t aInputBlockId, const APZHandledResult& handledResult);
|
||||
|
||||
|
|
@ -48,8 +62,16 @@ class APZInputBridgeChild : public PAPZInputBridgeChild, public APZInputBridge {
|
|||
private:
|
||||
void Open(Endpoint<PAPZInputBridgeChild>&& aEndpoint);
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
void HandleTapOnMainThread(
|
||||
const TapType& aType, const LayoutDevicePoint& aPoint,
|
||||
const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics);
|
||||
|
||||
bool mIsOpen;
|
||||
uint64_t mProcessToken;
|
||||
MOZ_NON_OWNING_REF RemoteCompositorSession* mCompositorSession = nullptr;
|
||||
|
||||
using InputBlockCallbackMap =
|
||||
std::unordered_map<uint64_t, InputBlockCallback>;
|
||||
|
|
|
|||
|
|
@ -16,14 +16,15 @@ namespace mozilla {
|
|||
namespace layers {
|
||||
|
||||
/* static */
|
||||
RefPtr<APZInputBridgeParent> APZInputBridgeParent::Create(
|
||||
APZInputBridgeParent* APZInputBridgeParent::Create(
|
||||
const LayersId& aLayersId, Endpoint<PAPZInputBridgeParent>&& aEndpoint) {
|
||||
RefPtr<APZInputBridgeParent> parent = new APZInputBridgeParent(aLayersId);
|
||||
APZInputBridgeParent* parent = new APZInputBridgeParent(aLayersId);
|
||||
if (!aEndpoint.Bind(parent)) {
|
||||
// We can't recover from this.
|
||||
MOZ_CRASH("Failed to bind APZInputBridgeParent to endpoint");
|
||||
}
|
||||
|
||||
CompositorBridgeParent::SetAPZInputBridgeParent(aLayersId, parent);
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +32,7 @@ APZInputBridgeParent::APZInputBridgeParent(const LayersId& aLayersId) {
|
|||
MOZ_ASSERT(XRE_IsGPUProcess());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mLayersId = aLayersId;
|
||||
mTreeManager = CompositorBridgeParent::GetAPZCTreeManager(aLayersId);
|
||||
MOZ_ASSERT(mTreeManager);
|
||||
}
|
||||
|
|
@ -205,6 +207,10 @@ mozilla::ipc::IPCResult APZInputBridgeParent::RecvProcessUnhandledEvent(
|
|||
}
|
||||
|
||||
void APZInputBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
StaticMonitorAutoLock lock(CompositorBridgeParent::sIndirectLayerTreesLock);
|
||||
CompositorBridgeParent::LayerTreeState& state =
|
||||
CompositorBridgeParent::sIndirectLayerTrees[mLayersId];
|
||||
state.mApzInputBridgeParent = nullptr;
|
||||
// We shouldn't need it after this
|
||||
mTreeManager = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class APZInputBridgeParent : public PAPZInputBridgeParent {
|
|||
NS_INLINE_DECL_REFCOUNTING(APZInputBridgeParent, final)
|
||||
|
||||
public:
|
||||
static RefPtr<APZInputBridgeParent> Create(
|
||||
static APZInputBridgeParent* Create(
|
||||
const LayersId& aLayersId, Endpoint<PAPZInputBridgeParent>&& aEndpoint);
|
||||
|
||||
mozilla::ipc::IPCResult RecvReceiveMultiTouchInputEvent(
|
||||
|
|
@ -67,6 +67,7 @@ class APZInputBridgeParent : public PAPZInputBridgeParent {
|
|||
|
||||
private:
|
||||
RefPtr<IAPZCTreeManager> mTreeManager;
|
||||
LayersId mLayersId;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ bool CompositorBridgeParentBase::DeallocShmem(ipc::Shmem& aShmem) {
|
|||
|
||||
CompositorBridgeParent::LayerTreeState::LayerTreeState()
|
||||
: mApzcTreeManagerParent(nullptr),
|
||||
mApzInputBridgeParent(nullptr),
|
||||
mParent(nullptr),
|
||||
mContentCompositorBridgeParent(nullptr) {}
|
||||
|
||||
|
|
@ -645,9 +646,21 @@ bool CompositorBridgeParent::DeallocPAPZCTreeManagerParent(
|
|||
return true;
|
||||
}
|
||||
|
||||
void CompositorBridgeParent::SetAPZInputBridgeParent(
|
||||
const LayersId& aLayersId, APZInputBridgeParent* aInputBridgeParent) {
|
||||
MOZ_RELEASE_ASSERT(XRE_IsGPUProcess());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
StaticMonitorAutoLock lock(CompositorBridgeParent::sIndirectLayerTreesLock);
|
||||
CompositorBridgeParent::LayerTreeState& state =
|
||||
CompositorBridgeParent::sIndirectLayerTrees[aLayersId];
|
||||
MOZ_ASSERT(!state.mApzInputBridgeParent);
|
||||
state.mApzInputBridgeParent = aInputBridgeParent;
|
||||
}
|
||||
|
||||
void CompositorBridgeParent::AllocateAPZCTreeManagerParent(
|
||||
const StaticMonitorAutoLock& aProofOfLayerTreeStateLock,
|
||||
const LayersId& aLayersId, LayerTreeState& aState) {
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
MOZ_ASSERT(aState.mParent == this);
|
||||
MOZ_ASSERT(mApzcTreeManager);
|
||||
MOZ_ASSERT(mApzUpdater);
|
||||
|
|
@ -1712,6 +1725,15 @@ APZCTreeManagerParent* CompositorBridgeParent::GetApzcTreeManagerParentForRoot(
|
|||
return state ? state->mApzcTreeManagerParent : nullptr;
|
||||
}
|
||||
|
||||
/* static */
|
||||
APZInputBridgeParent* CompositorBridgeParent::GetApzInputBridgeParentForRoot(
|
||||
LayersId aContentLayersId) {
|
||||
StaticMonitorAutoLock lock(sIndirectLayerTreesLock);
|
||||
CompositorBridgeParent::LayerTreeState* state =
|
||||
GetStateForRoot(aContentLayersId, lock);
|
||||
return state ? state->mApzInputBridgeParent : nullptr;
|
||||
}
|
||||
|
||||
/* static */
|
||||
GeckoContentController*
|
||||
CompositorBridgeParent::GetGeckoContentControllerForRoot(
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "mozilla/layers/ISurfaceAllocator.h" // for IShmemAllocator
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "mozilla/layers/PCompositorBridgeParent.h"
|
||||
#include "mozilla/layers/APZInputBridgeParent.h"
|
||||
#include "mozilla/webrender/WebRenderTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
@ -394,6 +395,10 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
~LayerTreeState();
|
||||
RefPtr<GeckoContentController> mController;
|
||||
APZCTreeManagerParent* mApzcTreeManagerParent;
|
||||
// The mApzInputBridgeParent is only populated for LayerTreeState
|
||||
// objects corresponding to root LayerIds (one for each top-level
|
||||
// window).
|
||||
APZInputBridgeParent* mApzInputBridgeParent;
|
||||
RefPtr<CompositorBridgeParent> mParent;
|
||||
RefPtr<WebRenderBridgeParent> mWrBridge;
|
||||
// Pointer to the ContentCompositorBridgeParent. Used by APZCs to share
|
||||
|
|
@ -437,6 +442,13 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
static GeckoContentController* GetGeckoContentControllerForRoot(
|
||||
LayersId aContentLayersId);
|
||||
|
||||
/**
|
||||
* Same as the GetApzcTreeManagerParentForRoot function, but returns
|
||||
* the APZInputBridge for the parent process.
|
||||
*/
|
||||
static APZInputBridgeParent* GetApzInputBridgeParentForRoot(
|
||||
LayersId aContentLayersId);
|
||||
|
||||
/**
|
||||
* Used by the profiler to denote when a vsync occured
|
||||
*/
|
||||
|
|
@ -454,6 +466,9 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
|
|||
const StaticMonitorAutoLock& aProofOfLayerTreeStateLock,
|
||||
const LayersId& aLayersId, LayerTreeState& aLayerTreeStateToUpdate);
|
||||
|
||||
static void SetAPZInputBridgeParent(const LayersId& aLayersId,
|
||||
APZInputBridgeParent* aInputBridgeParent);
|
||||
|
||||
PAPZParent* AllocPAPZParent(const LayersId& aLayersId) override;
|
||||
bool DeallocPAPZParent(PAPZParent* aActor) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -80,10 +80,6 @@ parent:
|
|||
|
||||
child:
|
||||
|
||||
async HandleTap(GeckoContentController_TapType aType, LayoutDevicePoint point, Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||
DoubleTapToZoomMetrics? aDoubleTapToZoomMetrics);
|
||||
|
||||
async NotifyPinchGesture(PinchGestureType aType, ScrollableLayerGuid aGuid,
|
||||
LayoutDevicePoint aFocusPoint, LayoutDeviceCoord aSpanChange,
|
||||
Modifiers aModifiers);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,15 @@
|
|||
include "ipc/nsGUIEventIPC.h";
|
||||
|
||||
using mozilla::LayoutDeviceIntPoint from "Units.h";
|
||||
using mozilla::LayoutDevicePoint from "Units.h";
|
||||
using mozilla::layers::GeckoContentController_TapType from "mozilla/layers/GeckoContentControllerTypes.h";
|
||||
using mozilla::layers::DoubleTapToZoomMetrics from "mozilla/layers/DoubleTapToZoom.h";
|
||||
using struct mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
|
||||
using struct mozilla::layers::APZEventResult from "mozilla/layers/APZInputBridge.h";
|
||||
using struct mozilla::layers::APZHandledResult from "mozilla/layers/APZInputBridge.h";
|
||||
|
||||
using mozilla::EventMessage from "mozilla/EventForwards.h";
|
||||
using mozilla::Modifiers from "mozilla/EventForwards.h";
|
||||
using class mozilla::MultiTouchInput from "InputData.h";
|
||||
using class mozilla::MouseInput from "InputData.h";
|
||||
using class mozilla::PanGestureInput from "InputData.h";
|
||||
|
|
@ -82,6 +86,10 @@ parent:
|
|||
child:
|
||||
async CallInputBlockCallback(uint64_t aInputBlockId,
|
||||
APZHandledResult aHandledResult);
|
||||
|
||||
async HandleTap(GeckoContentController_TapType aType, LayoutDevicePoint point,
|
||||
Modifiers aModifiers, ScrollableLayerGuid aGuid,
|
||||
uint64_t aInputBlockId, DoubleTapToZoomMetrics? aDoubleTapToZoomMetrics);
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void RemoteContentController::RequestContentRepaint(
|
|||
}
|
||||
}
|
||||
|
||||
void RemoteContentController::HandleTapOnMainThread(
|
||||
void RemoteContentController::HandleTapOnParentProcessMainThread(
|
||||
TapType aTapType, LayoutDevicePoint aPoint, Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics) {
|
||||
|
|
@ -78,20 +78,19 @@ void RemoteContentController::HandleTapOnMainThread(
|
|||
}
|
||||
}
|
||||
|
||||
void RemoteContentController::HandleTapOnCompositorThread(
|
||||
void RemoteContentController::HandleTapOnGPUProcessMainThread(
|
||||
TapType aTapType, LayoutDevicePoint aPoint, Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics) {
|
||||
MOZ_ASSERT(XRE_IsGPUProcess());
|
||||
MOZ_ASSERT(mCompositorThread->IsOnCurrentThread());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// The raw pointer to APZCTreeManagerParent is ok here because we are on
|
||||
// the compositor thread.
|
||||
APZCTreeManagerParent* apzctmp =
|
||||
CompositorBridgeParent::GetApzcTreeManagerParentForRoot(aGuid.mLayersId);
|
||||
if (apzctmp) {
|
||||
Unused << apzctmp->SendHandleTap(aTapType, aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, aDoubleTapToZoomMetrics);
|
||||
// Send a message to the controller thread to handle the single-tap gesture.
|
||||
APZInputBridgeParent* apzib =
|
||||
CompositorBridgeParent::GetApzInputBridgeParentForRoot(aGuid.mLayersId);
|
||||
if (apzib) {
|
||||
Unused << apzib->SendHandleTap(aTapType, aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, aDoubleTapToZoomMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -103,19 +102,18 @@ void RemoteContentController::HandleTap(
|
|||
APZThreadUtils::AssertOnControllerThread();
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_GPU) {
|
||||
if (mCompositorThread->IsOnCurrentThread()) {
|
||||
HandleTapOnCompositorThread(aTapType, aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, aDoubleTapToZoomMetrics);
|
||||
if (NS_IsMainThread()) {
|
||||
HandleTapOnGPUProcessMainThread(aTapType, aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, aDoubleTapToZoomMetrics);
|
||||
} else {
|
||||
// We have to send messages from the compositor thread
|
||||
mCompositorThread->Dispatch(
|
||||
NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
|
||||
ScrollableLayerGuid, uint64_t,
|
||||
Maybe<DoubleTapToZoomMetrics>>(
|
||||
"layers::RemoteContentController::HandleTapOnCompositorThread",
|
||||
this, &RemoteContentController::HandleTapOnCompositorThread,
|
||||
aTapType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics));
|
||||
NS_DispatchToMainThread(NewRunnableMethod<TapType, LayoutDevicePoint,
|
||||
Modifiers, ScrollableLayerGuid,
|
||||
uint64_t,
|
||||
Maybe<DoubleTapToZoomMetrics>>(
|
||||
"layers::RemoteContentController::HandleTapOnGPUProcessMainThread",
|
||||
this, &RemoteContentController::HandleTapOnGPUProcessMainThread,
|
||||
aTapType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -123,8 +121,8 @@ void RemoteContentController::HandleTap(
|
|||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
HandleTapOnMainThread(aTapType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics);
|
||||
HandleTapOnParentProcessMainThread(aTapType, aPoint, aModifiers, aGuid,
|
||||
aInputBlockId, aDoubleTapToZoomMetrics);
|
||||
} else {
|
||||
// We must be on Android, running on the Java UI thread
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
|
|
@ -138,13 +136,15 @@ void RemoteContentController::HandleTap(
|
|||
// using NS_DispatchToMainThread would post to a different message loop,
|
||||
// and introduces the possibility of this tap event getting processed
|
||||
// out of order with respect to the touch events that synthesized it.
|
||||
mozilla::jni::DispatchToGeckoPriorityQueue(
|
||||
NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
|
||||
ScrollableLayerGuid, uint64_t,
|
||||
Maybe<DoubleTapToZoomMetrics>>(
|
||||
"layers::RemoteContentController::HandleTapOnMainThread", this,
|
||||
&RemoteContentController::HandleTapOnMainThread, aTapType, aPoint,
|
||||
aModifiers, aGuid, aInputBlockId, aDoubleTapToZoomMetrics));
|
||||
mozilla::jni::DispatchToGeckoPriorityQueue(NewRunnableMethod<
|
||||
TapType, LayoutDevicePoint,
|
||||
Modifiers, ScrollableLayerGuid,
|
||||
uint64_t,
|
||||
Maybe<DoubleTapToZoomMetrics>>(
|
||||
"layers::RemoteContentController::HandleTapOnParentProcessMainThread",
|
||||
this, &RemoteContentController::HandleTapOnParentProcessMainThread,
|
||||
aTapType, aPoint, aModifiers, aGuid, aInputBlockId,
|
||||
aDoubleTapToZoomMetrics));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,12 +98,12 @@ class RemoteContentController : public GeckoContentController,
|
|||
nsCOMPtr<nsISerialEventTarget> mCompositorThread;
|
||||
bool mCanSend;
|
||||
|
||||
void HandleTapOnMainThread(
|
||||
TapType aType, LayoutDevicePoint aPoint, Modifiers aModifiers,
|
||||
void HandleTapOnParentProcessMainThread(
|
||||
TapType aTapType, LayoutDevicePoint aPoint, Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics);
|
||||
void HandleTapOnCompositorThread(
|
||||
TapType aType, LayoutDevicePoint aPoint, Modifiers aModifiers,
|
||||
void HandleTapOnGPUProcessMainThread(
|
||||
TapType aTapType, LayoutDevicePoint aPoint, Modifiers aModifiers,
|
||||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||
const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics);
|
||||
void NotifyPinchGestureOnCompositorThread(
|
||||
|
|
|
|||
Loading…
Reference in a new issue