Bug 2064211 - Move messages sent only from the parent process from PAPZCTreeManager to PAPZInputBridge. r=botond,geckoview-reviewers,hiro
SetKeyboardMap, SetDPI, SetBrowserGestureResponse, StartAutoscroll, StopAutoscroll and SetLongTapEnabled are only ever sent from the UI process to the GPU process, so move them to PAPZInputBridge, a protocol which doesn't have an endpoint in the content process at all. Notable details: - PAPZInputBridge's child endpoint is bound to the APZ controller thread rather than the main thread, so APZInputBridgeChild hops to it before sending. Note that on Android, these calls can initially arrive on the Java UI thread. - Originally, four of those methods are executed via APZUpdater queue by RunOnUpdaterThread in APZCTreeManagerParent. But this patch doesn't use the queue anymore, because the message doesn't need to be ordered with respect to WR frame generation first of all. Differential Revision: https://phabricator.services.mozilla.com/D319238
This commit is contained in:
committed by
i.am.kanaru.sato@gmail.com
parent
57c647e76c
commit
e65ec172dd
@@ -20,11 +20,21 @@ namespace layers {
|
||||
class APZInputBridgeParent;
|
||||
class AsyncPanZoomController;
|
||||
class InputBlockState;
|
||||
class KeyboardMap;
|
||||
class TouchBlockState;
|
||||
struct ScrollableLayerGuid;
|
||||
struct TargetConfirmationFlags;
|
||||
struct PointerEventsConsumableFlags;
|
||||
|
||||
// This enum class is used for communicating between APZ and the browser gesture
|
||||
// support code. APZ needs to wait for the browser to send this response just
|
||||
// like APZ waits for the content's response if there's an APZ ware event
|
||||
// listener in the content process.
|
||||
enum class BrowserGestureResponse : bool {
|
||||
NotConsumed = 0, // Representing the browser doesn't consume the gesture
|
||||
Consumed = 1, // Representing the browser has started consuming the gesture.
|
||||
};
|
||||
|
||||
enum class APZHandledPlace : uint8_t {
|
||||
Unhandled = 0, // we know for sure that the event will not be handled
|
||||
// by either the root APZC or others
|
||||
@@ -273,6 +283,29 @@ class APZInputBridge {
|
||||
// be sent through APZ so they are transformed correctly for BrowserParent.
|
||||
static Maybe<APZWheelAction> ActionForWheelEvent(WidgetWheelEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Set the keyboard shortcuts to use for translating keyboard events.
|
||||
*/
|
||||
virtual void SetKeyboardMap(const KeyboardMap& aKeyboardMap) = 0;
|
||||
|
||||
virtual void SetDPI(float aDpiValue) = 0;
|
||||
|
||||
virtual void SetBrowserGestureResponse(uint64_t aInputBlockId,
|
||||
BrowserGestureResponse aResponse) = 0;
|
||||
|
||||
virtual void StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation) = 0;
|
||||
|
||||
virtual void StopAutoscroll(const ScrollableLayerGuid& aGuid) = 0;
|
||||
|
||||
/**
|
||||
* Function used to disable LongTap gestures.
|
||||
*
|
||||
* On slow running tests, drags and touch events can be misinterpreted
|
||||
* as a long tap. This allows tests to disable long tap gesture detection.
|
||||
*/
|
||||
virtual void SetLongTapEnabled(bool aTapGestureEnabled) = 0;
|
||||
|
||||
protected:
|
||||
friend class APZInputBridgeParent;
|
||||
|
||||
@@ -294,15 +327,6 @@ class APZInputBridge {
|
||||
std::ostream& operator<<(std::ostream& aOut,
|
||||
const APZHandledResult& aHandledResult);
|
||||
|
||||
// This enum class is used for communicating between APZ and the browser gesture
|
||||
// support code. APZ needs to wait for the browser to send this response just
|
||||
// like APZ waits for the content's response if there's an APZ ware event
|
||||
// listener in the content process.
|
||||
enum class BrowserGestureResponse : bool {
|
||||
NotConsumed = 0, // Representing the browser doesn't consume the gesture
|
||||
Consumed = 1, // Representing the browser has started consuming the gesture.
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class APZInputBridge;
|
||||
class KeyboardMap;
|
||||
struct ZoomTarget;
|
||||
|
||||
enum AllowedTouchBehavior {
|
||||
@@ -39,8 +38,6 @@ enum ZoomToRectBehavior : uint32_t {
|
||||
ZOOM_TO_FOCUSED_INPUT_ON_RESIZES_VISUAL = 1 << 4,
|
||||
};
|
||||
|
||||
enum class BrowserGestureResponse : bool;
|
||||
|
||||
class AsyncDragMetrics;
|
||||
struct APZHandledResult;
|
||||
|
||||
@@ -48,11 +45,6 @@ class IAPZCTreeManager {
|
||||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||
|
||||
public:
|
||||
/**
|
||||
* Set the keyboard shortcuts to use for translating keyboard events.
|
||||
*/
|
||||
virtual void SetKeyboardMap(const KeyboardMap& aKeyboardMap) = 0;
|
||||
|
||||
/**
|
||||
* Kicks an animation to zoom to a rect. This may be either a zoom out or zoom
|
||||
* in. The actual animation is done on the sampler thread after being set
|
||||
@@ -96,8 +88,6 @@ class IAPZCTreeManager {
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const Maybe<ZoomConstraints>& aConstraints) = 0;
|
||||
|
||||
virtual void SetDPI(float aDpiValue) = 0;
|
||||
|
||||
/**
|
||||
* Sets allowed touch behavior values for current touch-session for specific
|
||||
* input block (determined by aInputBlock).
|
||||
@@ -110,25 +100,9 @@ class IAPZCTreeManager {
|
||||
virtual void SetAllowedTouchBehavior(
|
||||
uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aValues) = 0;
|
||||
|
||||
virtual void SetBrowserGestureResponse(uint64_t aInputBlockId,
|
||||
BrowserGestureResponse aResponse) = 0;
|
||||
|
||||
virtual void StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
|
||||
const AsyncDragMetrics& aDragMetrics) = 0;
|
||||
|
||||
virtual void StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation) = 0;
|
||||
|
||||
virtual void StopAutoscroll(const ScrollableLayerGuid& aGuid) = 0;
|
||||
|
||||
/**
|
||||
* Function used to disable LongTap gestures.
|
||||
*
|
||||
* On slow running tests, drags and touch events can be misinterpreted
|
||||
* as a long tap. This allows tests to disable long tap gesture detection.
|
||||
*/
|
||||
virtual void SetLongTapEnabled(bool aTapGestureEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Notify APZ that the content process has just registered a non-passive
|
||||
* APZ-aware event listener (touchstart/touchmove/touchend/wheel/...).
|
||||
|
||||
@@ -1153,7 +1153,13 @@ void APZCTreeManager::StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
|
||||
|
||||
void APZCTreeManager::StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation) {
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid, ScreenPoint>(
|
||||
"layers::APZCTreeManager::StartAutoscroll", this,
|
||||
&APZCTreeManager::StartAutoscroll, aGuid, aAnchorLocation));
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
|
||||
if (!apzc) {
|
||||
@@ -1165,7 +1171,13 @@ void APZCTreeManager::StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
}
|
||||
|
||||
void APZCTreeManager::StopAutoscroll(const ScrollableLayerGuid& aGuid) {
|
||||
APZThreadUtils::AssertOnControllerThread();
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid>(
|
||||
"layers::APZCTreeManager::StopAutoscroll", this,
|
||||
&APZCTreeManager::StopAutoscroll, aGuid));
|
||||
return;
|
||||
}
|
||||
|
||||
if (RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid)) {
|
||||
apzc->StopAutoscroll();
|
||||
|
||||
@@ -670,8 +670,6 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
||||
aCallback(lock);
|
||||
}
|
||||
|
||||
LayersId GetRootLayersId() const { return mRootLayersId; }
|
||||
|
||||
private:
|
||||
using GuidComparator = ScrollableLayerGuid::Comparator;
|
||||
using ScrollNode = WebRenderScrollDataWrapper;
|
||||
|
||||
@@ -50,11 +50,6 @@ void APZCTreeManagerChild::Destroy() {
|
||||
}
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::SetKeyboardMap(const KeyboardMap& aKeyboardMap) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendSetKeyboardMap(aKeyboardMap);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::ZoomToRect(const ScrollableLayerGuid& aGuid,
|
||||
const ZoomTarget& aZoomTarget,
|
||||
const uint32_t aFlags) {
|
||||
@@ -83,45 +78,18 @@ void APZCTreeManagerChild::UpdateZoomConstraints(
|
||||
}
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::SetDPI(float aDpiValue) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendSetDPI(aDpiValue);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::SetAllowedTouchBehavior(
|
||||
uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aValues) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendSetAllowedTouchBehavior(aInputBlockId, aValues);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::SetBrowserGestureResponse(
|
||||
uint64_t aInputBlockId, BrowserGestureResponse aResponse) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendSetBrowserGestureResponse(aInputBlockId, aResponse);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::StartScrollbarDrag(
|
||||
const ScrollableLayerGuid& aGuid, const AsyncDragMetrics& aDragMetrics) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendStartScrollbarDrag(aGuid, aDragMetrics);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendStartAutoscroll(aGuid, aAnchorLocation);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::StopAutoscroll(const ScrollableLayerGuid& aGuid) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendStopAutoscroll(aGuid);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::SetLongTapEnabled(bool aTapGestureEnabled) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SendSetLongTapEnabled(aTapGestureEnabled);
|
||||
}
|
||||
|
||||
void APZCTreeManagerChild::NotifyApzAwareListenerAdded(
|
||||
const ScrollableLayerGuid& aGuid) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@@ -29,8 +29,6 @@ class APZCTreeManagerChild final : public IAPZCTreeManager,
|
||||
void SetInputBridge(RefPtr<APZInputBridgeChild>&& aInputBridge);
|
||||
void Destroy();
|
||||
|
||||
void SetKeyboardMap(const KeyboardMap& aKeyboardMap) override;
|
||||
|
||||
void ZoomToRect(const ScrollableLayerGuid& aGuid,
|
||||
const ZoomTarget& aZoomTarget,
|
||||
const uint32_t aFlags = DEFAULT_BEHAVIOR) override;
|
||||
@@ -45,25 +43,13 @@ class APZCTreeManagerChild final : public IAPZCTreeManager,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const Maybe<ZoomConstraints>& aConstraints) override;
|
||||
|
||||
void SetDPI(float aDpiValue) override;
|
||||
|
||||
void SetAllowedTouchBehavior(
|
||||
uint64_t aInputBlockId,
|
||||
const nsTArray<TouchBehaviorFlags>& aValues) override;
|
||||
|
||||
void SetBrowserGestureResponse(uint64_t aInputBlockId,
|
||||
BrowserGestureResponse aResponse) override;
|
||||
|
||||
void StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
|
||||
const AsyncDragMetrics& aDragMetrics) override;
|
||||
|
||||
void StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation) override;
|
||||
|
||||
void StopAutoscroll(const ScrollableLayerGuid& aGuid) override;
|
||||
|
||||
void SetLongTapEnabled(bool aTapGestureEnabled) override;
|
||||
|
||||
void NotifyApzAwareListenerAdded(const ScrollableLayerGuid& aGuid) override;
|
||||
|
||||
APZInputBridge* InputBridge() override;
|
||||
|
||||
@@ -40,23 +40,6 @@ void APZCTreeManagerParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
CompositorBridgeParent::DisconnectApzcTreeManager(this);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetKeyboardMap(
|
||||
const KeyboardMap& aKeyboardMap) {
|
||||
// See RecvStartAutoscroll() for why this check is necessary.
|
||||
if (!IsForRootLayer()) {
|
||||
return IPC_FAIL(
|
||||
this,
|
||||
"SetKeyboardMap from non-root APZCTreeManagerParent is not expected.");
|
||||
}
|
||||
|
||||
mUpdater->RunOnUpdaterThread(
|
||||
mLayersId, NewRunnableMethod<KeyboardMap>(
|
||||
"layers::IAPZCTreeManager::SetKeyboardMap", mTreeManager,
|
||||
&IAPZCTreeManager::SetKeyboardMap, aKeyboardMap));
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvZoomToRect(
|
||||
const ScrollableLayerGuid& aGuid, const ZoomTarget& aZoomTarget,
|
||||
const uint32_t& aFlags) {
|
||||
@@ -107,21 +90,6 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvUpdateZoomConstraints(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetDPI(
|
||||
const float& aDpiValue) {
|
||||
// See RecvStartAutoscroll() for why this check is necessary.
|
||||
if (!IsForRootLayer()) {
|
||||
return IPC_FAIL(
|
||||
this, "SetDPI from non-root APZCTreeManagerParent is not expected.");
|
||||
}
|
||||
|
||||
mUpdater->RunOnUpdaterThread(
|
||||
mLayersId,
|
||||
NewRunnableMethod<float>("layers::IAPZCTreeManager::SetDPI", mTreeManager,
|
||||
&IAPZCTreeManager::SetDPI, aDpiValue));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
|
||||
const uint64_t& aInputBlockId, nsTArray<TouchBehaviorFlags>&& aValues) {
|
||||
mUpdater->RunOnUpdaterThread(
|
||||
@@ -135,24 +103,6 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetBrowserGestureResponse(
|
||||
const uint64_t& aInputBlockId, const BrowserGestureResponse& aResponse) {
|
||||
// See RecvStartAutoscroll() for why this check is necessary.
|
||||
if (!IsForRootLayer()) {
|
||||
return IPC_FAIL(this,
|
||||
"SetBrowserGestureResponse from non-root "
|
||||
"APZCTreeManagerParent is not expected.");
|
||||
}
|
||||
|
||||
mUpdater->RunOnUpdaterThread(
|
||||
mLayersId, NewRunnableMethod<uint64_t, BrowserGestureResponse>(
|
||||
"layers::IAPZCTreeManager::SetBrowserGestureResponse",
|
||||
mTreeManager, &IAPZCTreeManager::SetBrowserGestureResponse,
|
||||
aInputBlockId, aResponse));
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStartScrollbarDrag(
|
||||
const ScrollableLayerGuid& aGuid, const AsyncDragMetrics& aDragMetrics) {
|
||||
if (!IsGuidValid(aGuid)) {
|
||||
@@ -168,61 +118,6 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStartScrollbarDrag(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStartAutoscroll(
|
||||
const ScrollableLayerGuid& aGuid, const ScreenPoint& aAnchorLocation) {
|
||||
// Autoscroll is legitimately started only through the APZCTreeManagerParent
|
||||
// that corresponds to the root of the layer tree. We check if this
|
||||
// instance corresponds to the root of the layer tree.
|
||||
if (!IsForRootLayer()) {
|
||||
return IPC_FAIL(
|
||||
this,
|
||||
"StartAutoscroll from non-root APZCTreeManagerParent is not expected.");
|
||||
}
|
||||
|
||||
mUpdater->RunOnControllerThread(
|
||||
mLayersId,
|
||||
NewRunnableMethod<ScrollableLayerGuid, ScreenPoint>(
|
||||
"layers::IAPZCTreeManager::StartAutoscroll", mTreeManager,
|
||||
&IAPZCTreeManager::StartAutoscroll, aGuid, aAnchorLocation));
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStopAutoscroll(
|
||||
const ScrollableLayerGuid& aGuid) {
|
||||
// See RecvStartAutoscroll().
|
||||
if (!IsForRootLayer()) {
|
||||
return IPC_FAIL(
|
||||
this,
|
||||
"StopAutoscroll from non-root APZCTreeManagerParent is not expected.");
|
||||
}
|
||||
|
||||
mUpdater->RunOnControllerThread(
|
||||
mLayersId, NewRunnableMethod<ScrollableLayerGuid>(
|
||||
"layers::IAPZCTreeManager::StopAutoscroll", mTreeManager,
|
||||
&IAPZCTreeManager::StopAutoscroll, aGuid));
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetLongTapEnabled(
|
||||
const bool& aLongTapEnabled) {
|
||||
// See RecvStartAutoscroll() for why this check is necessary.
|
||||
if (!IsForRootLayer()) {
|
||||
return IPC_FAIL(this,
|
||||
"SetLongTapEnabled from non-root APZCTreeManagerParent is "
|
||||
"not expected.");
|
||||
}
|
||||
|
||||
mUpdater->RunOnUpdaterThread(
|
||||
mLayersId,
|
||||
NewRunnableMethod<bool>(
|
||||
"layers::IAPZCTreeManager::SetLongTapEnabled", mTreeManager,
|
||||
&IAPZCTreeManager::SetLongTapEnabled, aLongTapEnabled));
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvNotifyApzAwareListenerAdded(
|
||||
const ScrollableLayerGuid& aGuid) {
|
||||
if (!IsGuidValid(aGuid)) {
|
||||
@@ -240,9 +135,5 @@ bool APZCTreeManagerParent::IsGuidValid(const ScrollableLayerGuid& aGuid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool APZCTreeManagerParent::IsForRootLayer() const {
|
||||
return mLayersId == mTreeManager->GetRootLayersId();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -30,8 +30,6 @@ class APZCTreeManagerParent final : public PAPZCTreeManagerParent {
|
||||
void ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager,
|
||||
RefPtr<APZUpdater> aAPZUpdater);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap);
|
||||
|
||||
mozilla::ipc::IPCResult RecvZoomToRect(const ScrollableLayerGuid& aGuid,
|
||||
const ZoomTarget& aZoomTarget,
|
||||
const uint32_t& aFlags);
|
||||
@@ -46,24 +44,12 @@ class APZCTreeManagerParent final : public PAPZCTreeManagerParent {
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
const Maybe<ZoomConstraints>& aConstraints);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetDPI(const float& aDpiValue);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetAllowedTouchBehavior(
|
||||
const uint64_t& aInputBlockId, nsTArray<TouchBehaviorFlags>&& aValues);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetBrowserGestureResponse(
|
||||
const uint64_t& aInputBlockId, const BrowserGestureResponse& aResponse);
|
||||
|
||||
mozilla::ipc::IPCResult RecvStartScrollbarDrag(
|
||||
const ScrollableLayerGuid& aGuid, const AsyncDragMetrics& aDragMetrics);
|
||||
|
||||
mozilla::ipc::IPCResult RecvStartAutoscroll(
|
||||
const ScrollableLayerGuid& aGuid, const ScreenPoint& aAnchorLocation);
|
||||
|
||||
mozilla::ipc::IPCResult RecvStopAutoscroll(const ScrollableLayerGuid& aGuid);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetLongTapEnabled(const bool& aTapGestureEnabled);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNotifyApzAwareListenerAdded(
|
||||
const ScrollableLayerGuid& aGuid);
|
||||
|
||||
@@ -74,8 +60,6 @@ class APZCTreeManagerParent final : public PAPZCTreeManagerParent {
|
||||
|
||||
bool IsGuidValid(const ScrollableLayerGuid& aGuid);
|
||||
|
||||
bool IsForRootLayer() const;
|
||||
|
||||
LayersId mLayersId;
|
||||
RefPtr<APZCTreeManager> mTreeManager;
|
||||
RefPtr<APZUpdater> mUpdater;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layers/DoubleTapToZoom.h" // for DoubleTapToZoomMetrics
|
||||
#include "mozilla/layers/GeckoContentController.h" // for GeckoContentController
|
||||
#include "mozilla/layers/KeyboardMap.h" // for KeyboardMap
|
||||
#include "mozilla/layers/RemoteCompositorSession.h" // for RemoteCompositorSession
|
||||
#include "mozilla/layers/SynchronousTask.h"
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
@@ -278,5 +279,113 @@ void APZInputBridgeChild::UpdateWheelTransaction(
|
||||
SendUpdateWheelTransaction(aRefPoint, aEventMessage, aTargetGuid);
|
||||
}
|
||||
|
||||
// This actor is bound to the controller thread (see
|
||||
// APZInputBridgeChild::Open()), so they must hop to it before sending.
|
||||
void APZInputBridgeChild::SetKeyboardMap(const KeyboardMap& aKeyboardMap) {
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
|
||||
"layers::APZInputBridgeChild::SetKeyboardMap", this,
|
||||
&APZInputBridgeChild::SetKeyboardMap, aKeyboardMap));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendSetKeyboardMap(aKeyboardMap);
|
||||
}
|
||||
|
||||
// This actor is bound to the controller thread (see
|
||||
// APZInputBridgeChild::Open()), so they must hop to it before sending.
|
||||
void APZInputBridgeChild::SetDPI(float aDpiValue) {
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<float>("layers::APZInputBridgeChild::SetDPI", this,
|
||||
&APZInputBridgeChild::SetDPI, aDpiValue));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendSetDPI(aDpiValue);
|
||||
}
|
||||
|
||||
// This actor is bound to the controller thread (see
|
||||
// APZInputBridgeChild::Open()), so they must hop to it before sending.
|
||||
void APZInputBridgeChild::SetBrowserGestureResponse(
|
||||
uint64_t aInputBlockId, BrowserGestureResponse aResponse) {
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<uint64_t, BrowserGestureResponse>(
|
||||
"layers::APZInputBridgeChild::SetBrowserGestureResponse", this,
|
||||
&APZInputBridgeChild::SetBrowserGestureResponse, aInputBlockId,
|
||||
aResponse));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendSetBrowserGestureResponse(aInputBlockId, aResponse);
|
||||
}
|
||||
|
||||
// This actor is bound to the controller thread (see
|
||||
// APZInputBridgeChild::Open()), so they must hop to it before sending.
|
||||
void APZInputBridgeChild::StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation) {
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid, ScreenPoint>(
|
||||
"layers::APZInputBridgeChild::StartAutoscroll", this,
|
||||
&APZInputBridgeChild::StartAutoscroll, aGuid, aAnchorLocation));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendStartAutoscroll(aGuid, aAnchorLocation);
|
||||
}
|
||||
|
||||
// This actor is bound to the controller thread (see
|
||||
// APZInputBridgeChild::Open()), so they must hop to it before sending.
|
||||
void APZInputBridgeChild::StopAutoscroll(const ScrollableLayerGuid& aGuid) {
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableMethod<ScrollableLayerGuid>(
|
||||
"layers::APZInputBridgeChild::StopAutoscroll", this,
|
||||
&APZInputBridgeChild::StopAutoscroll, aGuid));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendStopAutoscroll(aGuid);
|
||||
}
|
||||
|
||||
// This actor is bound to the controller thread (see
|
||||
// APZInputBridgeChild::Open()), so they must hop to it before sending.
|
||||
void APZInputBridgeChild::SetLongTapEnabled(bool aTapGestureEnabled) {
|
||||
if (!APZThreadUtils::IsControllerThread()) {
|
||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod<bool>(
|
||||
"layers::APZInputBridgeChild::SetLongTapEnabled", this,
|
||||
&APZInputBridgeChild::SetLongTapEnabled, aTapGestureEnabled));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
SendSetLongTapEnabled(aTapGestureEnabled);
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -31,6 +31,20 @@ class APZInputBridgeChild : public PAPZInputBridgeChild, public APZInputBridge {
|
||||
InputData& aEvent,
|
||||
InputBlockCallback&& aCallback = InputBlockCallback()) override;
|
||||
|
||||
void SetKeyboardMap(const KeyboardMap& aKeyboardMap) override;
|
||||
|
||||
void SetDPI(float aDpiValue) override;
|
||||
|
||||
void SetBrowserGestureResponse(uint64_t aInputBlockId,
|
||||
BrowserGestureResponse aResponse) override;
|
||||
|
||||
void StartAutoscroll(const ScrollableLayerGuid& aGuid,
|
||||
const ScreenPoint& aAnchorLocation) override;
|
||||
|
||||
void StopAutoscroll(const ScrollableLayerGuid& aGuid) override;
|
||||
|
||||
void SetLongTapEnabled(bool aTapGestureEnabled) override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
mozilla::ipc::IPCResult RecvHandleTap(
|
||||
const TapType& aType, const LayoutDevicePoint& aPoint,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "InputData.h"
|
||||
#include "mozilla/ipc/Endpoint.h"
|
||||
#include "mozilla/layers/APZInputBridge.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/layers/IAPZCTreeManager.h"
|
||||
|
||||
@@ -203,6 +204,49 @@ mozilla::ipc::IPCResult APZInputBridgeParent::RecvProcessUnhandledEvent(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeParent::RecvSetKeyboardMap(
|
||||
const KeyboardMap& aKeyboardMap) {
|
||||
mTreeManager->InputBridge()->SetKeyboardMap(aKeyboardMap);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeParent::RecvSetDPI(
|
||||
const float& aDpiValue) {
|
||||
mTreeManager->InputBridge()->SetDPI(aDpiValue);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeParent::RecvSetBrowserGestureResponse(
|
||||
const uint64_t& aInputBlockId, const BrowserGestureResponse& aResponse) {
|
||||
mTreeManager->InputBridge()->SetBrowserGestureResponse(aInputBlockId,
|
||||
aResponse);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeParent::RecvStartAutoscroll(
|
||||
const ScrollableLayerGuid& aGuid, const ScreenPoint& aAnchorLocation) {
|
||||
mTreeManager->InputBridge()->StartAutoscroll(aGuid, aAnchorLocation);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeParent::RecvStopAutoscroll(
|
||||
const ScrollableLayerGuid& aGuid) {
|
||||
mTreeManager->InputBridge()->StopAutoscroll(aGuid);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult APZInputBridgeParent::RecvSetLongTapEnabled(
|
||||
const bool& aTapGestureEnabled) {
|
||||
mTreeManager->InputBridge()->SetLongTapEnabled(aTapGestureEnabled);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
void APZInputBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
// EnsureLayerTreeStateUnderLock mirrors the previous sIndirectLayerTrees[]
|
||||
// access (insert-or-get), so this stays a behavior-preserving translation.
|
||||
|
||||
@@ -59,6 +59,20 @@ class APZInputBridgeParent final : public PAPZInputBridgeParent {
|
||||
ScrollableLayerGuid* aOutTargetGuid, uint64_t* aOutFocusSequenceNumber,
|
||||
LayersId* aOutLayersId);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetDPI(const float& aDpiValue);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetBrowserGestureResponse(
|
||||
const uint64_t& aInputBlockId, const BrowserGestureResponse& aResponse);
|
||||
|
||||
mozilla::ipc::IPCResult RecvStartAutoscroll(
|
||||
const ScrollableLayerGuid& aGuid, const ScreenPoint& aAnchorLocation);
|
||||
|
||||
mozilla::ipc::IPCResult RecvStopAutoscroll(const ScrollableLayerGuid& aGuid);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetLongTapEnabled(const bool& aTapGestureEnabled);
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -11,7 +11,6 @@ include protocol PCompositorBridge;
|
||||
using mozilla::CSSRect from "Units.h";
|
||||
using mozilla::LayoutDeviceCoord from "Units.h";
|
||||
using mozilla::LayoutDevicePoint from "Units.h";
|
||||
using mozilla::ScreenPoint from "Units.h";
|
||||
using mozilla::layers::ZoomTarget from "mozilla/layers/DoubleTapToZoom.h";
|
||||
using mozilla::layers::DoubleTapToZoomMetrics from "mozilla/layers/DoubleTapToZoom.h";
|
||||
using mozilla::layers::ZoomConstraints from "mozilla/layers/ZoomConstraints.h";
|
||||
@@ -21,8 +20,6 @@ using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::layers::AsyncDragMetrics from "mozilla/layers/AsyncDragMetrics.h";
|
||||
using mozilla::layers::GeckoContentController_TapType from "mozilla/layers/GeckoContentControllerTypes.h";
|
||||
using mozilla::layers::APZHandledResult from "mozilla/layers/APZInputBridge.h";
|
||||
using mozilla::layers::BrowserGestureResponse from "mozilla/layers/APZInputBridge.h";
|
||||
using class mozilla::layers::KeyboardMap from "mozilla/layers/KeyboardMap.h";
|
||||
using mozilla::wr::RenderRoot from "mozilla/webrender/WebRenderTypes.h";
|
||||
|
||||
using mozilla::Modifiers from "mozilla/EventForwards.h";
|
||||
@@ -57,23 +54,10 @@ parent:
|
||||
|
||||
async UpdateZoomConstraints(ScrollableLayerGuid aGuid, ZoomConstraints? aConstraints);
|
||||
|
||||
async SetKeyboardMap(KeyboardMap aKeyboardMap);
|
||||
|
||||
async SetDPI(float aDpiValue);
|
||||
|
||||
async SetAllowedTouchBehavior(uint64_t aInputBlockId, TouchBehaviorFlags[] aValues);
|
||||
|
||||
async StartScrollbarDrag(ScrollableLayerGuid aGuid, AsyncDragMetrics aDragMetrics);
|
||||
|
||||
async StartAutoscroll(ScrollableLayerGuid aGuid, ScreenPoint aAnchorLocation);
|
||||
|
||||
async StopAutoscroll(ScrollableLayerGuid aGuid);
|
||||
|
||||
async SetLongTapEnabled(bool aTapGestureEnabled);
|
||||
|
||||
async SetBrowserGestureResponse(uint64_t aInputBlockId,
|
||||
BrowserGestureResponse aResponse);
|
||||
|
||||
// Fast notification from content that an APZ-aware (non-passive
|
||||
// touchstart/touchmove/touchend/wheel/...) event listener has been
|
||||
// registered. |aGuid| identifies the nearest scroll container ancestor
|
||||
|
||||
@@ -6,11 +6,13 @@ include "ipc/nsGUIEventIPC.h";
|
||||
|
||||
using mozilla::LayoutDeviceIntPoint from "Units.h";
|
||||
using mozilla::LayoutDevicePoint from "Units.h";
|
||||
using mozilla::ScreenPoint 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::layers::BrowserGestureResponse from "mozilla/layers/APZInputBridge.h";
|
||||
|
||||
using mozilla::EventMessage from "mozilla/EventForwards.h";
|
||||
using mozilla::Modifiers from "mozilla/EventForwards.h";
|
||||
@@ -22,6 +24,8 @@ using class mozilla::TapGestureInput from "InputData.h";
|
||||
using class mozilla::ScrollWheelInput from "InputData.h";
|
||||
using class mozilla::KeyboardInput from "InputData.h";
|
||||
|
||||
using class mozilla::layers::KeyboardMap from "mozilla/layers/KeyboardMap.h";
|
||||
|
||||
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
@@ -82,6 +86,19 @@ parent:
|
||||
uint64_t aOutFocusSequenceNumber,
|
||||
LayersId aOutLayersId);
|
||||
|
||||
async SetKeyboardMap(KeyboardMap aKeyboardMap);
|
||||
|
||||
async SetDPI(float aDpiValue);
|
||||
|
||||
async SetBrowserGestureResponse(uint64_t aInputBlockId,
|
||||
BrowserGestureResponse aResponse);
|
||||
|
||||
async StartAutoscroll(ScrollableLayerGuid aGuid, ScreenPoint aAnchorLocation);
|
||||
|
||||
async StopAutoscroll(ScrollableLayerGuid aGuid);
|
||||
|
||||
async SetLongTapEnabled(bool aTapGestureEnabled);
|
||||
|
||||
child:
|
||||
async CallInputBlockCallback(uint64_t aInputBlockId,
|
||||
APZHandledResult aHandledResult);
|
||||
|
||||
@@ -373,7 +373,7 @@ class NPZCSupport final
|
||||
}
|
||||
|
||||
if (controller) {
|
||||
controller->SetLongTapEnabled(aIsLongpressEnabled);
|
||||
controller->InputBridge()->SetLongTapEnabled(aIsLongpressEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -607,7 +607,7 @@ float nsIWidget::GetDPI() {
|
||||
|
||||
void nsIWidget::NotifyAPZOfDPIChange() {
|
||||
if (mAPZC) {
|
||||
mAPZC->SetDPI(GetDPI());
|
||||
mAPZC->InputBridge()->SetDPI(GetDPI());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1043,11 +1043,11 @@ void nsIWidget::ConfigureAPZCTreeManager() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mAPZC);
|
||||
|
||||
mAPZC->SetDPI(GetDPI());
|
||||
mAPZC->InputBridge()->SetDPI(GetDPI());
|
||||
|
||||
if (StaticPrefs::apz_keyboard_enabled_AtStartup()) {
|
||||
KeyboardMap map = RootWindowGlobalKeyListener::CollectKeyboardShortcuts();
|
||||
mAPZC->SetKeyboardMap(map);
|
||||
mAPZC->InputBridge()->SetKeyboardMap(map);
|
||||
}
|
||||
|
||||
ContentReceivedInputBlockCallback callback(
|
||||
@@ -2106,13 +2106,13 @@ void nsIWidget::StartAsyncAutoscroll(const ScreenPoint& aAnchorLocation,
|
||||
const ScrollableLayerGuid& aGuid) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess() && AsyncPanZoomEnabled());
|
||||
|
||||
mAPZC->StartAutoscroll(aGuid, aAnchorLocation);
|
||||
mAPZC->InputBridge()->StartAutoscroll(aGuid, aAnchorLocation);
|
||||
}
|
||||
|
||||
void nsIWidget::StopAsyncAutoscroll(const ScrollableLayerGuid& aGuid) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess() && AsyncPanZoomEnabled());
|
||||
|
||||
mAPZC->StopAutoscroll(aGuid);
|
||||
mAPZC->InputBridge()->StopAutoscroll(aGuid);
|
||||
}
|
||||
|
||||
LayersId nsIWidget::GetRootLayerTreeId() {
|
||||
@@ -2276,8 +2276,8 @@ void nsIWidget::ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) {
|
||||
}
|
||||
} else if (mAPZC) {
|
||||
// If the event wasn't start swipe, we need to notify it to APZ.
|
||||
mAPZC->SetBrowserGestureResponse(aInputBlockId,
|
||||
BrowserGestureResponse::NotConsumed);
|
||||
mAPZC->InputBridge()->SetBrowserGestureResponse(
|
||||
aInputBlockId, BrowserGestureResponse::NotConsumed);
|
||||
}
|
||||
mSwipeEventQueue = nullptr;
|
||||
}
|
||||
@@ -2308,8 +2308,8 @@ void nsIWidget::TrackScrollEventAsSwipe(
|
||||
} else {
|
||||
// Now SwipeTracker has started consuming pan events, notify it to APZ so
|
||||
// that APZ can discard queued events.
|
||||
mAPZC->SetBrowserGestureResponse(aInputBlockId,
|
||||
BrowserGestureResponse::Consumed);
|
||||
mAPZC->InputBridge()->SetBrowserGestureResponse(
|
||||
aInputBlockId, BrowserGestureResponse::Consumed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2376,8 +2376,8 @@ WidgetWheelEvent nsIWidget::MayStartSwipeForAPZ(
|
||||
// Inform that the browser gesture didn't use the pan event (pan-start
|
||||
// precisely), so that APZ can now start using the event for
|
||||
// scrolling/overscrolling.
|
||||
mAPZC->SetBrowserGestureResponse(aApzResult.mInputBlockId,
|
||||
BrowserGestureResponse::NotConsumed);
|
||||
mAPZC->InputBridge()->SetBrowserGestureResponse(
|
||||
aApzResult.mInputBlockId, BrowserGestureResponse::NotConsumed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user