Bug 1357754 - Hook up chaining layer trees. r=botond,jrmuizel

When APZ traverses a tree using LayerMetricsWrapper, the layer tree
already has its RefLayers connected because of the in-scope
AutoResolveRefLayers. When traversing using the
WebRenderScrollDataWrapper though, this is not the case, and we need to
explicitly jump from one layer tree to another during the walk.
Thankfully we don't require upwards traversal in the tree or this would
be much more complicated.

MozReview-Commit-ID: 8gbvUlzghLx
This commit is contained in:
Kartikaya Gupta 2017-04-20 10:38:06 -04:00
Родитель 7e8f4eeba8
Коммит 194523e5d1
3 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -307,10 +307,18 @@ WebRenderBridgeParent::HandleDPEnd(const gfx::IntSize& aSize,
dl, dlDesc, aux, auxDesc); dl, dlDesc, aux, auxDesc);
HoldPendingTransactionId(mWrEpoch, aTransactionId); HoldPendingTransactionId(mWrEpoch, aTransactionId);
mScrollData = aScrollData;
// TODO: pass the WebRenderScrollData to APZ (this will happen in a future // TODO: pass the WebRenderScrollData to APZ (this will happen in a future
// patch) // patch)
} }
const WebRenderScrollData&
WebRenderBridgeParent::GetScrollData() const
{
MOZ_ASSERT(mozilla::layers::CompositorThreadHolder::IsInCompositorThread());
return mScrollData;
}
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
WebRenderBridgeParent::RecvDPEnd(const gfx::IntSize& aSize, WebRenderBridgeParent::RecvDPEnd(const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands, InfallibleTArray<WebRenderParentCommand>&& aCommands,

Просмотреть файл

@ -160,6 +160,8 @@ public:
return mIdNameSpace; return mIdNameSpace;
} }
const WebRenderScrollData& GetScrollData() const;
private: private:
virtual ~WebRenderBridgeParent(); virtual ~WebRenderBridgeParent();
@ -223,6 +225,9 @@ private:
bool mPaused; bool mPaused;
bool mDestroyed; bool mDestroyed;
// Can only be accessed on the compositor thread.
WebRenderScrollData mScrollData;
static uint32_t sIdNameSpace; static uint32_t sIdNameSpace;
}; };

Просмотреть файл

@ -7,6 +7,8 @@
#define GFX_WEBRENDERSCROLLDATAWRAPPER_H #define GFX_WEBRENDERSCROLLDATAWRAPPER_H
#include "FrameMetrics.h" #include "FrameMetrics.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/WebRenderBridgeParent.h"
#include "mozilla/layers/WebRenderScrollData.h" #include "mozilla/layers/WebRenderScrollData.h"
namespace mozilla { namespace mozilla {
@ -157,6 +159,19 @@ public:
size_t subtreeLastIndex = std::min(mContainingSubtreeLastIndex, prevSiblingIndex); size_t subtreeLastIndex = std::min(mContainingSubtreeLastIndex, prevSiblingIndex);
return WebRenderScrollDataWrapper(mData, mLayerIndex + 1, subtreeLastIndex); return WebRenderScrollDataWrapper(mData, mLayerIndex + 1, subtreeLastIndex);
} }
// We've run out of descendants. But! If the original layer was a RefLayer,
// then it connects to another layer tree and we need to traverse that too.
// So return a WebRenderScrollDataWrapper for the root of the child layer
// tree.
if (mLayer->GetReferentId()) {
CompositorBridgeParent::LayerTreeState* lts =
CompositorBridgeParent::GetIndirectShadowTree(mLayer->GetReferentId().value());
if (lts && lts->mWrBridge) {
return WebRenderScrollDataWrapper(&(lts->mWrBridge->GetScrollData()));
}
}
return WebRenderScrollDataWrapper(); return WebRenderScrollDataWrapper();
} }