зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1442627 - Add new APZSampler APIs to set the test scroll offset and zoom. r=botond
MozReview-Commit-ID: DrH1D42jfJx --HG-- extra : rebase_source : 22c2546a8188c871bf106d5883452a1be32c482e
This commit is contained in:
Родитель
752091f7a7
Коммит
6107f5de3d
|
@ -63,6 +63,13 @@ public:
|
|||
|
||||
bool GetAPZTestData(uint64_t aLayersId, APZTestData* aOutData);
|
||||
|
||||
void SetTestAsyncScrollOffset(uint64_t aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const CSSPoint& aOffset);
|
||||
void SetTestAsyncZoom(uint64_t aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom);
|
||||
|
||||
protected:
|
||||
virtual ~APZSampler();
|
||||
|
||||
|
|
|
@ -95,5 +95,33 @@ APZSampler::GetAPZTestData(uint64_t aLayersId,
|
|||
return mApz->GetAPZTestData(aLayersId, aOutData);
|
||||
}
|
||||
|
||||
void
|
||||
APZSampler::SetTestAsyncScrollOffset(uint64_t aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const CSSPoint& aOffset)
|
||||
{
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
RefPtr<AsyncPanZoomController> apzc = mApz->GetTargetAPZC(aLayersId, aScrollId);
|
||||
if (apzc) {
|
||||
apzc->SetTestAsyncScrollOffset(aOffset);
|
||||
} else {
|
||||
NS_WARNING("Unable to find APZC in SetTestAsyncScrollOffset");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
APZSampler::SetTestAsyncZoom(uint64_t aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom)
|
||||
{
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
RefPtr<AsyncPanZoomController> apzc = mApz->GetTargetAPZC(aLayersId, aScrollId);
|
||||
if (apzc) {
|
||||
apzc->SetTestAsyncZoom(aZoom);
|
||||
} else {
|
||||
NS_WARNING("Unable to find APZC in SetTestAsyncZoom");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -1378,6 +1378,30 @@ CompositorBridgeParent::RecvGetFrameUniformity(FrameUniformityData* aOutData)
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeParent::SetTestAsyncScrollOffset(
|
||||
const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const CSSPoint& aPoint)
|
||||
{
|
||||
if (mApzSampler) {
|
||||
uint64_t layersId = (aLayersId == 0 ? mRootLayerTreeID : aLayersId);
|
||||
mApzSampler->SetTestAsyncScrollOffset(layersId, aScrollId, aPoint);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeParent::SetTestAsyncZoom(
|
||||
const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom)
|
||||
{
|
||||
if (mApzSampler) {
|
||||
uint64_t layersId = (aLayersId == 0 ? mRootLayerTreeID : aLayersId);
|
||||
mApzSampler->SetTestAsyncZoom(layersId, aScrollId, aZoom);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeParent::FlushApzRepaints(const uint64_t& aLayersId)
|
||||
{
|
||||
|
|
|
@ -114,6 +114,12 @@ public:
|
|||
const TimeStamp& aTime) { return true; }
|
||||
virtual void LeaveTestMode(const uint64_t& aId) { }
|
||||
virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) = 0;
|
||||
virtual void SetTestAsyncScrollOffset(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const CSSPoint& aPoint) = 0;
|
||||
virtual void SetTestAsyncZoom(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom) = 0;
|
||||
virtual void FlushApzRepaints(const uint64_t& aLayersId) = 0;
|
||||
virtual void GetAPZTestData(const uint64_t& aLayersId,
|
||||
APZTestData* aOutData) { }
|
||||
|
@ -248,6 +254,12 @@ public:
|
|||
void LeaveTestMode(const uint64_t& aId) override;
|
||||
void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) override;
|
||||
CompositorAnimationStorage* GetAnimationStorage();
|
||||
void SetTestAsyncScrollOffset(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const CSSPoint& aPoint) override;
|
||||
void SetTestAsyncZoom(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom) override;
|
||||
void FlushApzRepaints(const uint64_t& aLayersId) override;
|
||||
void GetAPZTestData(const uint64_t& aLayersId,
|
||||
APZTestData* aOutData) override;
|
||||
|
|
|
@ -463,6 +463,40 @@ CrossProcessCompositorBridgeParent::ApplyAsyncProperties(
|
|||
state->mParent->ApplyAsyncProperties(aLayerTree);
|
||||
}
|
||||
|
||||
void
|
||||
CrossProcessCompositorBridgeParent::SetTestAsyncScrollOffset(
|
||||
const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const CSSPoint& aPoint)
|
||||
{
|
||||
MOZ_ASSERT(aLayersId != 0);
|
||||
const CompositorBridgeParent::LayerTreeState* state =
|
||||
CompositorBridgeParent::GetIndirectShadowTree(aLayersId);
|
||||
if (!state) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(state->mParent);
|
||||
state->mParent->SetTestAsyncScrollOffset(aLayersId, aScrollId, aPoint);
|
||||
}
|
||||
|
||||
void
|
||||
CrossProcessCompositorBridgeParent::SetTestAsyncZoom(
|
||||
const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom)
|
||||
{
|
||||
MOZ_ASSERT(aLayersId != 0);
|
||||
const CompositorBridgeParent::LayerTreeState* state =
|
||||
CompositorBridgeParent::GetIndirectShadowTree(aLayersId);
|
||||
if (!state) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(state->mParent);
|
||||
state->mParent->SetTestAsyncZoom(aLayersId, aScrollId, aZoom);
|
||||
}
|
||||
|
||||
void
|
||||
CrossProcessCompositorBridgeParent::FlushApzRepaints(const uint64_t& aLayersId)
|
||||
{
|
||||
|
|
|
@ -95,6 +95,12 @@ public:
|
|||
const TimeStamp& aTime) override;
|
||||
void LeaveTestMode(const uint64_t& aId) override;
|
||||
void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) override;
|
||||
void SetTestAsyncScrollOffset(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const CSSPoint& aPoint) override;
|
||||
void SetTestAsyncZoom(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom) override;
|
||||
void FlushApzRepaints(const uint64_t& aLayersId) override;
|
||||
void GetAPZTestData(const uint64_t& aLayersId,
|
||||
APZTestData* aOutData) override;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "LayerTransactionParent.h"
|
||||
#include <vector> // for vector
|
||||
#include "apz/src/AsyncPanZoomController.h"
|
||||
#include "CompositableHost.h" // for CompositableParent, Get, etc
|
||||
#include "ImageLayers.h" // for ImageLayer
|
||||
#include "Layers.h" // for Layer, ContainerLayer, etc
|
||||
|
@ -751,25 +750,6 @@ LayerTransactionParent::RecvGetAnimationTransform(const uint64_t& aCompositorAni
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
static AsyncPanZoomController*
|
||||
GetAPZCForViewID(Layer* aLayer, FrameMetrics::ViewID aScrollID)
|
||||
{
|
||||
AsyncPanZoomController* resultApzc = nullptr;
|
||||
ForEachNode<ForwardIterator>(
|
||||
aLayer,
|
||||
[aScrollID, &resultApzc] (Layer* layer)
|
||||
{
|
||||
for (uint32_t i = 0; i < layer->GetScrollMetadataCount(); i++) {
|
||||
if (layer->GetFrameMetrics(i).GetScrollId() == aScrollID) {
|
||||
resultApzc = layer->GetAsyncPanZoomController(i);
|
||||
return TraversalFlag::Abort;
|
||||
}
|
||||
}
|
||||
return TraversalFlag::Continue;
|
||||
});
|
||||
return resultApzc;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
LayerTransactionParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScrollID,
|
||||
const float& aX, const float& aY)
|
||||
|
@ -778,11 +758,7 @@ LayerTransactionParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aSc
|
|||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
|
||||
AsyncPanZoomController* controller = GetAPZCForViewID(mRoot, aScrollID);
|
||||
if (!controller) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
controller->SetTestAsyncScrollOffset(CSSPoint(aX, aY));
|
||||
mCompositorBridge->SetTestAsyncScrollOffset(GetId(), aScrollID, CSSPoint(aX, aY));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -794,11 +770,7 @@ LayerTransactionParent::RecvSetAsyncZoom(const FrameMetrics::ViewID& aScrollID,
|
|||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
|
||||
AsyncPanZoomController* controller = GetAPZCForViewID(mRoot, aScrollID);
|
||||
if (!controller) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
controller->SetTestAsyncZoom(LayerToParentLayerScale(aValue));
|
||||
mCompositorBridge->SetTestAsyncZoom(GetId(), aScrollID, LayerToParentLayerScale(aValue));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "mozilla/layers/WebRenderBridgeParent.h"
|
||||
|
||||
#include "apz/src/AsyncPanZoomController.h"
|
||||
#include "CompositableHost.h"
|
||||
#include "gfxEnv.h"
|
||||
#include "gfxPrefs.h"
|
||||
|
@ -16,7 +15,6 @@
|
|||
#include "GLContextProvider.h"
|
||||
#include "mozilla/Range.h"
|
||||
#include "mozilla/layers/AnimationHelper.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/APZSampler.h"
|
||||
#include "mozilla/layers/Compositor.h"
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
|
@ -1017,18 +1015,6 @@ WebRenderBridgeParent::RecvCapture()
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
already_AddRefed<AsyncPanZoomController>
|
||||
WebRenderBridgeParent::GetTargetAPZC(const FrameMetrics::ViewID& aScrollId)
|
||||
{
|
||||
RefPtr<AsyncPanZoomController> apzc;
|
||||
if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
|
||||
if (RefPtr<APZCTreeManager> apzctm = cbp->GetAPZCTreeManager()) {
|
||||
apzc = apzctm->GetTargetAPZC(GetLayersId(), aScrollId);
|
||||
}
|
||||
}
|
||||
return apzc.forget();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
WebRenderBridgeParent::RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId,
|
||||
nsTArray<ScrollableLayerGuid>&& aTargets)
|
||||
|
@ -1106,11 +1092,7 @@ WebRenderBridgeParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aScr
|
|||
if (mDestroyed) {
|
||||
return IPC_OK();
|
||||
}
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aScrollId);
|
||||
if (!apzc) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
apzc->SetTestAsyncScrollOffset(CSSPoint(aX, aY));
|
||||
mCompositorBridge->SetTestAsyncScrollOffset(GetLayersId(), aScrollId, CSSPoint(aX, aY));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -1121,11 +1103,7 @@ WebRenderBridgeParent::RecvSetAsyncZoom(const FrameMetrics::ViewID& aScrollId,
|
|||
if (mDestroyed) {
|
||||
return IPC_OK();
|
||||
}
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aScrollId);
|
||||
if (!apzc) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
apzc->SetTestAsyncZoom(LayerToParentLayerScale(aZoom));
|
||||
mCompositorBridge->SetTestAsyncZoom(GetLayersId(), aScrollId, LayerToParentLayerScale(aZoom));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -228,10 +228,6 @@ private:
|
|||
bool PushAPZStateToWR(wr::TransactionBuilder& aTxn,
|
||||
nsTArray<wr::WrTransformProperty>& aTransformArray);
|
||||
|
||||
// Helper method to get an APZC reference from a scroll id. Uses the layers
|
||||
// id of this bridge, and may return null if the APZC wasn't found.
|
||||
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const FrameMetrics::ViewID& aId);
|
||||
|
||||
uint32_t GetNextWrEpoch();
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче