Bug 1367837 - Expose a testing helper method to get an APZC instance from the layers id and scroll id. r=botond

MozReview-Commit-ID: HyEMamx7nDk
This commit is contained in:
Kartikaya Gupta 2017-05-28 07:48:33 -04:00
parent 71133b7ca0
commit f47534e48a
2 changed files with 21 additions and 7 deletions

View File

@ -1802,6 +1802,25 @@ APZCTreeManager::GetTargetAPZC(const ScrollableLayerGuid& aGuid)
return apzc.forget();
}
static bool
GuidComparatorIgnoringPresShell(const ScrollableLayerGuid& aOne, const ScrollableLayerGuid& aTwo)
{
return aOne.mLayersId == aTwo.mLayersId
&& aOne.mScrollId == aTwo.mScrollId;
}
already_AddRefed<AsyncPanZoomController>
APZCTreeManager::GetTargetAPZC(const uint64_t& aLayersId,
const FrameMetrics::ViewID& aScrollId)
{
MutexAutoLock lock(mTreeLock);
ScrollableLayerGuid guid(aLayersId, 0, aScrollId);
RefPtr<HitTestingTreeNode> node = GetTargetNode(guid, &GuidComparatorIgnoringPresShell);
MOZ_ASSERT(!node || node->GetApzc()); // any node returned must have an APZC
RefPtr<AsyncPanZoomController> apzc = node ? node->GetApzc() : nullptr;
return apzc.forget();
}
already_AddRefed<HitTestingTreeNode>
APZCTreeManager::GetTargetNode(const ScrollableLayerGuid& aGuid,
GuidComparator aComparator) const
@ -1842,13 +1861,6 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint,
return target.forget();
}
static bool
GuidComparatorIgnoringPresShell(const ScrollableLayerGuid& aOne, const ScrollableLayerGuid& aTwo)
{
return aOne.mLayersId == aTwo.mLayersId
&& aOne.mScrollId == aTwo.mScrollId;
}
RefPtr<const OverscrollHandoffChain>
APZCTreeManager::BuildOverscrollHandoffChain(const RefPtr<AsyncPanZoomController>& aInitialTarget)
{

View File

@ -459,6 +459,8 @@ public:
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScreenPoint& aPoint,
HitTestResult* aOutHitResult,
HitTestingTreeNode** aOutScrollbarNode = nullptr);
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const uint64_t& aLayersId,
const FrameMetrics::ViewID& aScrollId);
ScreenToParentLayerMatrix4x4 GetScreenToApzcTransform(const AsyncPanZoomController *aApzc) const;
ParentLayerToScreenMatrix4x4 GetApzcToGeckoTransform(const AsyncPanZoomController *aApzc) const;