Fix APZ target confirmations arriving before dependent layer transactions. (bug 1154130, r=kats)
This commit is contained in:
@@ -799,22 +799,6 @@ TabChild::Create(nsIContentChild* aManager,
|
|||||||
return NS_SUCCEEDED(iframe->Init()) ? iframe.forget() : nullptr;
|
return NS_SUCCEEDED(iframe->Init()) ? iframe.forget() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TabChildSetTargetAPZCCallback : public SetTargetAPZCCallback {
|
|
||||||
public:
|
|
||||||
explicit TabChildSetTargetAPZCCallback(TabChild* aTabChild)
|
|
||||||
: mTabChild(do_GetWeakReference(static_cast<nsITabChild*>(aTabChild)))
|
|
||||||
{}
|
|
||||||
|
|
||||||
void Run(uint64_t aInputBlockId, const nsTArray<ScrollableLayerGuid>& aTargets) const override {
|
|
||||||
if (nsCOMPtr<nsITabChild> tabChild = do_QueryReferent(mTabChild)) {
|
|
||||||
static_cast<TabChild*>(tabChild.get())->SendSetTargetAPZC(aInputBlockId, aTargets);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsWeakPtr mTabChild;
|
|
||||||
};
|
|
||||||
|
|
||||||
class TabChildSetAllowedTouchBehaviorCallback : public SetAllowedTouchBehaviorCallback {
|
class TabChildSetAllowedTouchBehaviorCallback : public SetAllowedTouchBehaviorCallback {
|
||||||
public:
|
public:
|
||||||
explicit TabChildSetAllowedTouchBehaviorCallback(TabChild* aTabChild)
|
explicit TabChildSetAllowedTouchBehaviorCallback(TabChild* aTabChild)
|
||||||
@@ -865,7 +849,6 @@ TabChild::TabChild(nsIContentChild* aManager,
|
|||||||
, mOrientation(eScreenOrientation_PortraitPrimary)
|
, mOrientation(eScreenOrientation_PortraitPrimary)
|
||||||
, mUpdateHitRegion(false)
|
, mUpdateHitRegion(false)
|
||||||
, mIgnoreKeyPressEvent(false)
|
, mIgnoreKeyPressEvent(false)
|
||||||
, mSetTargetAPZCCallback(new TabChildSetTargetAPZCCallback(this))
|
|
||||||
, mSetAllowedTouchBehaviorCallback(new TabChildSetAllowedTouchBehaviorCallback(this))
|
, mSetAllowedTouchBehaviorCallback(new TabChildSetAllowedTouchBehaviorCallback(this))
|
||||||
, mHasValidInnerSize(false)
|
, mHasValidInnerSize(false)
|
||||||
, mDestroyed(false)
|
, mDestroyed(false)
|
||||||
@@ -2192,7 +2175,7 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
|||||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||||
nsCOMPtr<nsIDocument> document(GetDocument());
|
nsCOMPtr<nsIDocument> document(GetDocument());
|
||||||
APZCCallbackHelper::SendSetTargetAPZCNotification(WebWidget(), document, aEvent, aGuid,
|
APZCCallbackHelper::SendSetTargetAPZCNotification(WebWidget(), document, aEvent, aGuid,
|
||||||
aInputBlockId, mSetTargetAPZCCallback);
|
aInputBlockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetWheelEvent event(aEvent);
|
WidgetWheelEvent event(aEvent);
|
||||||
@@ -2387,7 +2370,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
|||||||
}
|
}
|
||||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||||
APZCCallbackHelper::SendSetTargetAPZCNotification(WebWidget(), document,
|
APZCCallbackHelper::SendSetTargetAPZCNotification(WebWidget(), document,
|
||||||
localEvent, aGuid, aInputBlockId, mSetTargetAPZCCallback);
|
localEvent, aGuid, aInputBlockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch event to content (potentially a long-running operation)
|
// Dispatch event to content (potentially a long-running operation)
|
||||||
|
|||||||
@@ -619,7 +619,6 @@ private:
|
|||||||
|
|
||||||
bool mIgnoreKeyPressEvent;
|
bool mIgnoreKeyPressEvent;
|
||||||
nsRefPtr<APZEventState> mAPZEventState;
|
nsRefPtr<APZEventState> mAPZEventState;
|
||||||
nsRefPtr<SetTargetAPZCCallback> mSetTargetAPZCCallback;
|
|
||||||
nsRefPtr<SetAllowedTouchBehaviorCallback> mSetAllowedTouchBehaviorCallback;
|
nsRefPtr<SetAllowedTouchBehaviorCallback> mSetAllowedTouchBehaviorCallback;
|
||||||
bool mHasValidInnerSize;
|
bool mHasValidInnerSize;
|
||||||
bool mDestroyed;
|
bool mDestroyed;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#include "ContentHelper.h"
|
#include "ContentHelper.h"
|
||||||
#include "gfxPlatform.h" // For gfxPlatform::UseTiling
|
#include "gfxPlatform.h" // For gfxPlatform::UseTiling
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
|
#include "mozilla/layers/LayerTransactionChild.h"
|
||||||
|
#include "mozilla/layers/ShadowLayers.h"
|
||||||
#include "nsIScrollableFrame.h"
|
#include "nsIScrollableFrame.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
@@ -565,14 +567,29 @@ PrepareForSetTargetAPZCNotification(nsIWidget* aWidget,
|
|||||||
scrollAncestor, nsLayoutUtils::RepaintMode::Repaint);
|
scrollAncestor, nsLayoutUtils::RepaintMode::Repaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
SendLayersDependentApzcTargetConfirmation(nsIPresShell* aShell, uint64_t aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets)
|
||||||
|
{
|
||||||
|
LayerManager* lm = aShell->GetLayerManager();
|
||||||
|
if (!lm) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerTransactionChild* shadow = lm->AsShadowForwarder()->GetShadowManager();
|
||||||
|
if (!shadow) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
shadow->SendSetConfirmedTargetAPZC(aInputBlockId, aTargets);
|
||||||
|
}
|
||||||
|
|
||||||
class DisplayportSetListener : public nsAPostRefreshObserver {
|
class DisplayportSetListener : public nsAPostRefreshObserver {
|
||||||
public:
|
public:
|
||||||
DisplayportSetListener(const nsRefPtr<SetTargetAPZCCallback>& aCallback,
|
DisplayportSetListener(nsIPresShell* aPresShell,
|
||||||
nsIPresShell* aPresShell,
|
|
||||||
const uint64_t& aInputBlockId,
|
const uint64_t& aInputBlockId,
|
||||||
const nsTArray<ScrollableLayerGuid>& aTargets)
|
const nsTArray<ScrollableLayerGuid>& aTargets)
|
||||||
: mCallback(aCallback)
|
: mPresShell(aPresShell)
|
||||||
, mPresShell(aPresShell)
|
|
||||||
, mInputBlockId(aInputBlockId)
|
, mInputBlockId(aInputBlockId)
|
||||||
, mTargets(aTargets)
|
, mTargets(aTargets)
|
||||||
{
|
{
|
||||||
@@ -583,18 +600,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DidRefresh() override {
|
void DidRefresh() override {
|
||||||
if (!mCallback) {
|
if (!mPresShell) {
|
||||||
MOZ_ASSERT_UNREACHABLE("Post-refresh observer fired again after failed attempt at unregistering it");
|
MOZ_ASSERT_UNREACHABLE("Post-refresh observer fired again after failed attempt at unregistering it");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
APZCCH_LOG("Got refresh, sending target APZCs for input block %" PRIu64 "\n", mInputBlockId);
|
APZCCH_LOG("Got refresh, sending target APZCs for input block %" PRIu64 "\n", mInputBlockId);
|
||||||
mCallback->Run(mInputBlockId, mTargets);
|
SendLayersDependentApzcTargetConfirmation(mPresShell, mInputBlockId, mTargets);
|
||||||
|
|
||||||
if (!mPresShell->RemovePostRefreshObserver(this)) {
|
if (!mPresShell->RemovePostRefreshObserver(this)) {
|
||||||
MOZ_ASSERT_UNREACHABLE("Unable to unregister post-refresh observer! Leaking it instead of leaving garbage registered");
|
MOZ_ASSERT_UNREACHABLE("Unable to unregister post-refresh observer! Leaking it instead of leaving garbage registered");
|
||||||
// Graceful handling, just in case...
|
// Graceful handling, just in case...
|
||||||
mCallback = nullptr;
|
|
||||||
mPresShell = nullptr;
|
mPresShell = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -603,7 +619,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsRefPtr<SetTargetAPZCCallback> mCallback;
|
|
||||||
nsRefPtr<nsIPresShell> mPresShell;
|
nsRefPtr<nsIPresShell> mPresShell;
|
||||||
uint64_t mInputBlockId;
|
uint64_t mInputBlockId;
|
||||||
nsTArray<ScrollableLayerGuid> mTargets;
|
nsTArray<ScrollableLayerGuid> mTargets;
|
||||||
@@ -612,21 +627,21 @@ private:
|
|||||||
// Sends a SetTarget notification for APZC, given one or more previous
|
// Sends a SetTarget notification for APZC, given one or more previous
|
||||||
// calls to PrepareForAPZCSetTargetNotification().
|
// calls to PrepareForAPZCSetTargetNotification().
|
||||||
static void
|
static void
|
||||||
SendSetTargetAPZCNotificationHelper(nsIPresShell* aShell,
|
SendSetTargetAPZCNotificationHelper(nsIWidget* aWidget,
|
||||||
|
nsIPresShell* aShell,
|
||||||
const uint64_t& aInputBlockId,
|
const uint64_t& aInputBlockId,
|
||||||
const nsTArray<ScrollableLayerGuid>& aTargets,
|
const nsTArray<ScrollableLayerGuid>& aTargets,
|
||||||
bool aWaitForRefresh,
|
bool aWaitForRefresh)
|
||||||
const nsRefPtr<SetTargetAPZCCallback>& aCallback)
|
|
||||||
{
|
{
|
||||||
bool waitForRefresh = aWaitForRefresh;
|
bool waitForRefresh = aWaitForRefresh;
|
||||||
if (waitForRefresh) {
|
if (waitForRefresh) {
|
||||||
APZCCH_LOG("At least one target got a new displayport, need to wait for refresh\n");
|
APZCCH_LOG("At least one target got a new displayport, need to wait for refresh\n");
|
||||||
waitForRefresh = aShell->AddPostRefreshObserver(
|
waitForRefresh = aShell->AddPostRefreshObserver(
|
||||||
new DisplayportSetListener(aCallback, aShell, aInputBlockId, aTargets));
|
new DisplayportSetListener(aShell, aInputBlockId, aTargets));
|
||||||
}
|
}
|
||||||
if (!waitForRefresh) {
|
if (!waitForRefresh) {
|
||||||
APZCCH_LOG("Sending target APZCs for input block %" PRIu64 "\n", aInputBlockId);
|
APZCCH_LOG("Sending target APZCs for input block %" PRIu64 "\n", aInputBlockId);
|
||||||
aCallback->Run(aInputBlockId, aTargets);
|
aWidget->SetConfirmedTargetAPZC(aInputBlockId, aTargets);
|
||||||
} else {
|
} else {
|
||||||
APZCCH_LOG("Successfully registered post-refresh observer\n");
|
APZCCH_LOG("Successfully registered post-refresh observer\n");
|
||||||
}
|
}
|
||||||
@@ -637,8 +652,7 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
|||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
const WidgetGUIEvent& aEvent,
|
const WidgetGUIEvent& aEvent,
|
||||||
const ScrollableLayerGuid& aGuid,
|
const ScrollableLayerGuid& aGuid,
|
||||||
uint64_t aInputBlockId,
|
uint64_t aInputBlockId)
|
||||||
const nsRefPtr<SetTargetAPZCCallback>& aCallback)
|
|
||||||
{
|
{
|
||||||
if (!aWidget || !aDocument) {
|
if (!aWidget || !aDocument) {
|
||||||
return;
|
return;
|
||||||
@@ -660,8 +674,12 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
|||||||
// TODO: Do other types of events need to be handled?
|
// TODO: Do other types of events need to be handled?
|
||||||
|
|
||||||
if (!targets.IsEmpty()) {
|
if (!targets.IsEmpty()) {
|
||||||
SendSetTargetAPZCNotificationHelper(shell, aInputBlockId, targets,
|
SendSetTargetAPZCNotificationHelper(
|
||||||
waitForRefresh, aCallback);
|
aWidget,
|
||||||
|
shell,
|
||||||
|
aInputBlockId,
|
||||||
|
targets,
|
||||||
|
waitForRefresh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,17 +19,6 @@ template<class T> struct already_AddRefed;
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
/* A base class for callbacks to be passed to APZCCallbackHelper::SendSetTargetAPZCNotification.
|
|
||||||
* If we had something like std::function, we could just use
|
|
||||||
* std::function<void(uint64_t, const nsTArray<ScrollableLayerGuid>&)>. */
|
|
||||||
struct SetTargetAPZCCallback {
|
|
||||||
public:
|
|
||||||
NS_INLINE_DECL_REFCOUNTING(SetTargetAPZCCallback)
|
|
||||||
virtual void Run(uint64_t aInputBlockId, const nsTArray<ScrollableLayerGuid>& aTargets) const = 0;
|
|
||||||
protected:
|
|
||||||
virtual ~SetTargetAPZCCallback() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* A base class for callbacks to be passed to
|
/* A base class for callbacks to be passed to
|
||||||
* APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification. */
|
* APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification. */
|
||||||
struct SetAllowedTouchBehaviorCallback {
|
struct SetAllowedTouchBehaviorCallback {
|
||||||
@@ -165,16 +154,18 @@ public:
|
|||||||
|
|
||||||
/* Perform hit-testing on the touch points of |aEvent| to determine
|
/* Perform hit-testing on the touch points of |aEvent| to determine
|
||||||
* which scrollable frames they target. If any of these frames don't have
|
* which scrollable frames they target. If any of these frames don't have
|
||||||
* a displayport, set one. Finally, invoke the provided callback with
|
* a displayport, set one.
|
||||||
* the guids of the target frames. If any displayports needed to be set,
|
*
|
||||||
* the callback is invoked after the next refresh, otherwise it's invoked
|
* If any displayports need to be set, the actual notification to APZ is
|
||||||
* right away. */
|
* sent to the compositor, which will then post a message back to APZ's
|
||||||
|
* controller thread. Otherwise, the provided widget's SetConfirmedTargetAPZC
|
||||||
|
* method is invoked immediately.
|
||||||
|
*/
|
||||||
static void SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
static void SendSetTargetAPZCNotification(nsIWidget* aWidget,
|
||||||
nsIDocument* aDocument,
|
nsIDocument* aDocument,
|
||||||
const WidgetGUIEvent& aEvent,
|
const WidgetGUIEvent& aEvent,
|
||||||
const ScrollableLayerGuid& aGuid,
|
const ScrollableLayerGuid& aGuid,
|
||||||
uint64_t aInputBlockId,
|
uint64_t aInputBlockId);
|
||||||
const nsRefPtr<SetTargetAPZCCallback>& aCallback);
|
|
||||||
|
|
||||||
/* Figure out the allowed touch behaviors of each touch point in |aEvent|
|
/* Figure out the allowed touch behaviors of each touch point in |aEvent|
|
||||||
* and send that information to the provided callback. */
|
* and send that information to the provided callback. */
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "mozilla/gfx/Point.h" // for IntSize
|
#include "mozilla/gfx/Point.h" // for IntSize
|
||||||
#include "mozilla/ipc/Transport.h" // for Transport
|
#include "mozilla/ipc/Transport.h" // for Transport
|
||||||
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
|
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
|
||||||
|
#include "mozilla/layers/APZThreadUtils.h" // for APZCTreeManager
|
||||||
#include "mozilla/layers/AsyncCompositionManager.h"
|
#include "mozilla/layers/AsyncCompositionManager.h"
|
||||||
#include "mozilla/layers/BasicCompositor.h" // for BasicCompositor
|
#include "mozilla/layers/BasicCompositor.h" // for BasicCompositor
|
||||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||||
@@ -1235,6 +1236,39 @@ CompositorParent::GetAPZTestData(const LayerTransactionParent* aLayerTree,
|
|||||||
*aOutData = sIndirectLayerTrees[mRootLayerTreeID].mApzTestData;
|
*aOutData = sIndirectLayerTrees[mRootLayerTreeID].mApzTestData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NotifyAPZConfirmedTargetTask : public Task
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NotifyAPZConfirmedTargetTask(const nsRefPtr<APZCTreeManager>& aAPZCTM,
|
||||||
|
const uint64_t& aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets)
|
||||||
|
: mAPZCTM(aAPZCTM),
|
||||||
|
mInputBlockId(aInputBlockId),
|
||||||
|
mTargets(aTargets)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Run() override {
|
||||||
|
mAPZCTM->SetTargetAPZC(mInputBlockId, mTargets);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsRefPtr<APZCTreeManager> mAPZCTM;
|
||||||
|
uint64_t mInputBlockId;
|
||||||
|
nsTArray<ScrollableLayerGuid> mTargets;
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
CompositorParent::SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree,
|
||||||
|
const uint64_t& aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets)
|
||||||
|
{
|
||||||
|
if (!mApzcTreeManager) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
APZThreadUtils::RunOnControllerThread(new NotifyAPZConfirmedTargetTask(
|
||||||
|
mApzcTreeManager, aInputBlockId, aTargets));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
|
CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
|
||||||
@@ -1587,6 +1621,9 @@ public:
|
|||||||
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) override;
|
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) override;
|
||||||
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
|
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
|
||||||
APZTestData* aOutData) override;
|
APZTestData* aOutData) override;
|
||||||
|
virtual void SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree,
|
||||||
|
const uint64_t& aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets) override;
|
||||||
|
|
||||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) override;
|
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) override;
|
||||||
|
|
||||||
@@ -1969,6 +2006,24 @@ CrossProcessCompositorParent::GetAPZTestData(const LayerTransactionParent* aLaye
|
|||||||
*aOutData = sIndirectLayerTrees[id].mApzTestData;
|
*aOutData = sIndirectLayerTrees[id].mApzTestData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CrossProcessCompositorParent::SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree,
|
||||||
|
const uint64_t& aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets)
|
||||||
|
{
|
||||||
|
uint64_t id = aLayerTree->GetId();
|
||||||
|
MOZ_ASSERT(id != 0);
|
||||||
|
CompositorParent* parent = nullptr;
|
||||||
|
{
|
||||||
|
MonitorAutoLock lock(*sIndirectLayerTreesLock);
|
||||||
|
const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(id);
|
||||||
|
if (!state || !state->mParent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parent = state->mParent;
|
||||||
|
}
|
||||||
|
parent->SetConfirmedTargetAPZC(aLayerTree, aInputBlockId, aTargets);
|
||||||
|
}
|
||||||
|
|
||||||
AsyncCompositionManager*
|
AsyncCompositionManager*
|
||||||
CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree)
|
CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree)
|
||||||
|
|||||||
@@ -198,6 +198,9 @@ public:
|
|||||||
override;
|
override;
|
||||||
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
|
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
|
||||||
APZTestData* aOutData) override;
|
APZTestData* aOutData) override;
|
||||||
|
virtual void SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree,
|
||||||
|
const uint64_t& aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets) override;
|
||||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) override { return mCompositionManager; }
|
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) override { return mCompositionManager; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -805,6 +805,13 @@ LayerTransactionParent::RecvRequestProperty(const nsString& aProperty, float* aV
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
LayerTransactionParent::RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId,
|
||||||
|
nsTArray<ScrollableLayerGuid>&& aTargets)
|
||||||
|
{
|
||||||
|
mShadowLayersManager->SetConfirmedTargetAPZC(this, aBlockId, aTargets);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
|
LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ protected:
|
|||||||
const int32_t& aX, const int32_t& aY) override;
|
const int32_t& aX, const int32_t& aY) override;
|
||||||
virtual bool RecvGetAPZTestData(APZTestData* aOutData) override;
|
virtual bool RecvGetAPZTestData(APZTestData* aOutData) override;
|
||||||
virtual bool RecvRequestProperty(const nsString& aProperty, float* aValue) override;
|
virtual bool RecvRequestProperty(const nsString& aProperty, float* aValue) override;
|
||||||
|
virtual bool RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId,
|
||||||
|
nsTArray<ScrollableLayerGuid>&& aTargets) override;
|
||||||
|
|
||||||
virtual PLayerParent* AllocPLayerParent() override;
|
virtual PLayerParent* AllocPLayerParent() override;
|
||||||
virtual bool DeallocPLayerParent(PLayerParent* actor) override;
|
virtual bool DeallocPLayerParent(PLayerParent* actor) override;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
|||||||
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
|
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
|
||||||
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
|
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
|
||||||
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
||||||
|
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The layers protocol is spoken between thread contexts that manage
|
* The layers protocol is spoken between thread contexts that manage
|
||||||
@@ -102,6 +103,10 @@ parent:
|
|||||||
// Query a named property from the last frame
|
// Query a named property from the last frame
|
||||||
sync RequestProperty(nsString property) returns (float value);
|
sync RequestProperty(nsString property) returns (float value);
|
||||||
|
|
||||||
|
// Tell the compositor to notify APZ that a layer has been confirmed for an
|
||||||
|
// input event.
|
||||||
|
async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
|
||||||
|
|
||||||
async ChildAsyncMessages(AsyncChildMessageData[] aMessages);
|
async ChildAsyncMessages(AsyncChildMessageData[] aMessages);
|
||||||
|
|
||||||
async Shutdown();
|
async Shutdown();
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ public:
|
|||||||
virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) { }
|
virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) { }
|
||||||
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
|
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
|
||||||
APZTestData* aOutData) { }
|
APZTestData* aOutData) { }
|
||||||
|
virtual void SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree,
|
||||||
|
const uint64_t& aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // layers
|
} // layers
|
||||||
|
|||||||
@@ -484,6 +484,15 @@ PuppetWidget::ClearNativeTouchSequence(nsIObserver* aObserver)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PuppetWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets) const
|
||||||
|
{
|
||||||
|
if (mTabChild) {
|
||||||
|
mTabChild->SendSetTargetAPZC(aInputBlockId, aTargets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(bool)
|
NS_IMETHODIMP_(bool)
|
||||||
PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
|
PuppetWidget::ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
|
||||||
const mozilla::WidgetKeyboardEvent& aEvent,
|
const mozilla::WidgetKeyboardEvent& aEvent,
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ public:
|
|||||||
NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
|
NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
|
||||||
nsEventStatus DispatchAPZAwareEvent(WidgetInputEvent* aEvent) override;
|
nsEventStatus DispatchAPZAwareEvent(WidgetInputEvent* aEvent) override;
|
||||||
nsEventStatus DispatchInputEvent(WidgetInputEvent* aEvent) override;
|
nsEventStatus DispatchInputEvent(WidgetInputEvent* aEvent) override;
|
||||||
|
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets) const override;
|
||||||
|
|
||||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
|
||||||
bool aDoCapture) override
|
bool aDoCapture) override
|
||||||
|
|||||||
@@ -902,25 +902,6 @@ nsBaseWidget::CreateRootContentController()
|
|||||||
return controller.forget();
|
return controller.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChromeProcessSetTargetAPZCCallback : public SetTargetAPZCCallback {
|
|
||||||
public:
|
|
||||||
explicit ChromeProcessSetTargetAPZCCallback(APZCTreeManager* aTreeManager)
|
|
||||||
: mTreeManager(aTreeManager)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void Run(uint64_t aInputBlockId, const nsTArray<ScrollableLayerGuid>& aTargets) const override {
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
// need a local var to disambiguate between the SetTargetAPZC overloads.
|
|
||||||
void (APZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
|
||||||
= &APZCTreeManager::SetTargetAPZC;
|
|
||||||
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
|
|
||||||
mTreeManager.get(), setTargetApzcFunc, aInputBlockId, aTargets));
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsRefPtr<APZCTreeManager> mTreeManager;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ChromeProcessSetAllowedTouchBehaviorCallback : public SetAllowedTouchBehaviorCallback {
|
class ChromeProcessSetAllowedTouchBehaviorCallback : public SetAllowedTouchBehaviorCallback {
|
||||||
public:
|
public:
|
||||||
explicit ChromeProcessSetAllowedTouchBehaviorCallback(APZCTreeManager* aTreeManager)
|
explicit ChromeProcessSetAllowedTouchBehaviorCallback(APZCTreeManager* aTreeManager)
|
||||||
@@ -967,7 +948,6 @@ void nsBaseWidget::ConfigureAPZCTreeManager()
|
|||||||
mAPZC->SetDPI(GetDPI());
|
mAPZC->SetDPI(GetDPI());
|
||||||
mAPZEventState = new APZEventState(this,
|
mAPZEventState = new APZEventState(this,
|
||||||
new ChromeProcessContentReceivedInputBlockCallback(mAPZC));
|
new ChromeProcessContentReceivedInputBlockCallback(mAPZC));
|
||||||
mSetTargetAPZCCallback = new ChromeProcessSetTargetAPZCCallback(mAPZC);
|
|
||||||
mSetAllowedTouchBehaviorCallback = new ChromeProcessSetAllowedTouchBehaviorCallback(mAPZC);
|
mSetAllowedTouchBehaviorCallback = new ChromeProcessSetAllowedTouchBehaviorCallback(mAPZC);
|
||||||
|
|
||||||
nsRefPtr<GeckoContentController> controller = CreateRootContentController();
|
nsRefPtr<GeckoContentController> controller = CreateRootContentController();
|
||||||
@@ -982,6 +962,17 @@ void nsBaseWidget::ConfigureAPZControllerThread()
|
|||||||
APZThreadUtils::SetControllerThread(MessageLoop::current());
|
APZThreadUtils::SetControllerThread(MessageLoop::current());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsBaseWidget::SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets) const
|
||||||
|
{
|
||||||
|
// Need to specifically bind this since it's overloaded.
|
||||||
|
void (APZCTreeManager::*setTargetApzcFunc)(uint64_t, const nsTArray<ScrollableLayerGuid>&)
|
||||||
|
= &APZCTreeManager::SetTargetAPZC;
|
||||||
|
APZThreadUtils::RunOnControllerThread(NewRunnableMethod(
|
||||||
|
mAPZC.get(), setTargetApzcFunc, aInputBlockId, mozilla::Move(aTargets)));
|
||||||
|
}
|
||||||
|
|
||||||
nsEventStatus
|
nsEventStatus
|
||||||
nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
||||||
const ScrollableLayerGuid& aGuid,
|
const ScrollableLayerGuid& aGuid,
|
||||||
@@ -1017,12 +1008,12 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
|
|||||||
aInputBlockId, mSetAllowedTouchBehaviorCallback);
|
aInputBlockId, mSetAllowedTouchBehaviorCallback);
|
||||||
}
|
}
|
||||||
APZCCallbackHelper::SendSetTargetAPZCNotification(this, GetDocument(), *aEvent,
|
APZCCallbackHelper::SendSetTargetAPZCNotification(this, GetDocument(), *aEvent,
|
||||||
aGuid, aInputBlockId, mSetTargetAPZCCallback);
|
aGuid, aInputBlockId);
|
||||||
}
|
}
|
||||||
mAPZEventState->ProcessTouchEvent(*touchEvent, aGuid, aInputBlockId, aApzResponse);
|
mAPZEventState->ProcessTouchEvent(*touchEvent, aGuid, aInputBlockId, aApzResponse);
|
||||||
} else if (WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent()) {
|
} else if (WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent()) {
|
||||||
APZCCallbackHelper::SendSetTargetAPZCNotification(this, GetDocument(), *aEvent,
|
APZCCallbackHelper::SendSetTargetAPZCNotification(this, GetDocument(), *aEvent,
|
||||||
aGuid, aInputBlockId, mSetTargetAPZCCallback);
|
aGuid, aInputBlockId);
|
||||||
mAPZEventState->ProcessWheelEvent(*wheelEvent, aGuid, aInputBlockId);
|
mAPZEventState->ProcessWheelEvent(*wheelEvent, aGuid, aInputBlockId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class APZCTreeManager;
|
|||||||
class GeckoContentController;
|
class GeckoContentController;
|
||||||
class APZEventState;
|
class APZEventState;
|
||||||
struct ScrollableLayerGuid;
|
struct ScrollableLayerGuid;
|
||||||
struct SetTargetAPZCCallback;
|
|
||||||
struct SetAllowedTouchBehaviorCallback;
|
struct SetAllowedTouchBehaviorCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +94,6 @@ protected:
|
|||||||
typedef mozilla::layers::GeckoContentController GeckoContentController;
|
typedef mozilla::layers::GeckoContentController GeckoContentController;
|
||||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||||
typedef mozilla::layers::APZEventState APZEventState;
|
typedef mozilla::layers::APZEventState APZEventState;
|
||||||
typedef mozilla::layers::SetTargetAPZCCallback SetTargetAPZCCallback;
|
|
||||||
typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
|
typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
|
||||||
typedef mozilla::ScreenRotation ScreenRotation;
|
typedef mozilla::ScreenRotation ScreenRotation;
|
||||||
|
|
||||||
@@ -238,6 +236,9 @@ public:
|
|||||||
// Dispatch an event that must be first be routed through APZ.
|
// Dispatch an event that must be first be routed through APZ.
|
||||||
nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) override;
|
nsEventStatus DispatchAPZAwareEvent(mozilla::WidgetInputEvent* aEvent) override;
|
||||||
|
|
||||||
|
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||||
|
const nsTArray<ScrollableLayerGuid>& aTargets) const override;
|
||||||
|
|
||||||
void NotifyWindowDestroyed();
|
void NotifyWindowDestroyed();
|
||||||
void NotifySizeMoveDone();
|
void NotifySizeMoveDone();
|
||||||
void NotifyWindowMoved(int32_t aX, int32_t aY);
|
void NotifyWindowMoved(int32_t aX, int32_t aY);
|
||||||
@@ -479,7 +480,6 @@ protected:
|
|||||||
nsRefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
|
nsRefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
|
||||||
nsRefPtr<APZCTreeManager> mAPZC;
|
nsRefPtr<APZCTreeManager> mAPZC;
|
||||||
nsRefPtr<APZEventState> mAPZEventState;
|
nsRefPtr<APZEventState> mAPZEventState;
|
||||||
nsRefPtr<SetTargetAPZCCallback> mSetTargetAPZCCallback;
|
|
||||||
nsRefPtr<SetAllowedTouchBehaviorCallback> mSetAllowedTouchBehaviorCallback;
|
nsRefPtr<SetAllowedTouchBehaviorCallback> mSetAllowedTouchBehaviorCallback;
|
||||||
nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
|
nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
|
||||||
nsRefPtr<TextEventDispatcher> mTextEventDispatcher;
|
nsRefPtr<TextEventDispatcher> mTextEventDispatcher;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class CompositorChild;
|
|||||||
class LayerManager;
|
class LayerManager;
|
||||||
class LayerManagerComposite;
|
class LayerManagerComposite;
|
||||||
class PLayerTransactionChild;
|
class PLayerTransactionChild;
|
||||||
|
struct ScrollableLayerGuid;
|
||||||
}
|
}
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
class DrawTarget;
|
class DrawTarget;
|
||||||
@@ -1767,6 +1768,13 @@ class nsIWidget : public nsISupports {
|
|||||||
*/
|
*/
|
||||||
virtual nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) = 0;
|
virtual nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm an APZ-aware event target. This should be used when APZ will
|
||||||
|
* not need a layers update to process the event.
|
||||||
|
*/
|
||||||
|
virtual void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
||||||
|
const nsTArray<mozilla::layers::ScrollableLayerGuid>& aTargets) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user