Bug 1563178 - Properly manage the renderRoot variable during the APZ tree walk. r=botond

The APZ tree walk is recursive but the render root was not being updated when
walking up out of a subtree with a different render root. This changes the
code to use a stack and push/pop the render root for subtrees as we enter
and exit the subtrees as part of the tree walk.

Differential Revision: https://phabricator.services.mozilla.com/D37614

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2019-07-10 19:54:08 +00:00
parent a526f3ed1f
commit bc26232cbc

View File

@ -411,7 +411,8 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
HitTestingTreeNode* parent = nullptr;
HitTestingTreeNode* next = nullptr;
LayersId layersId = mRootLayersId;
wr::RenderRoot renderRoot = wr::RenderRoot::Default;
std::stack<wr::RenderRoot> renderRoots;
renderRoots.push(wr::RenderRoot::Default);
ancestorTransforms.push(AncestorTransform());
state.mParentHasPerspective.push(false);
@ -441,7 +442,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
HitTestingTreeNode* node = PrepareNodeForLayer(
lock, aLayerMetrics, aLayerMetrics.Metrics(), layersId,
ancestorTransforms.top(), parent, next, state, renderRoot);
ancestorTransforms.top(), parent, next, state, renderRoots.top());
MOZ_ASSERT(node);
AsyncPanZoomController* apzc = node->GetApzc();
aLayerMetrics.SetApzc(apzc);
@ -490,7 +491,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
}
if (Maybe<wr::RenderRoot> newRenderRoot =
aLayerMetrics.GetReferentRenderRoot()) {
renderRoot = *newRenderRoot;
renderRoots.push(*newRenderRoot);
}
indents.push(gfx::TreeAutoIndent<LOG_DEFAULT>(mApzcTreeLog));
@ -508,6 +509,9 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
ancestorTransforms.pop();
indents.pop();
state.mParentHasPerspective.pop();
if (aLayerMetrics.GetReferentRenderRoot()) {
renderRoots.pop();
}
});
mApzcTreeLog << "[end]\n";