Bug 1418387 - Find the appropriate scrollbar node in GetAPZCAtPointWR. r=botond

MozReview-Commit-ID: Fb4465Gaj7K

--HG--
extra : rebase_source : 647e617326d5e45dde0eb22b3ba9ac7cc03f7096
This commit is contained in:
Kartikaya Gupta 2017-11-24 16:23:06 -05:00
Родитель c82aeb4865
Коммит dcc1822a45
4 изменённых файлов: 40 добавлений и 3 удалений

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

@ -2197,7 +2197,8 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint,
if (gfxPrefs::WebRenderHitTest()) {
HitTestResult wrHitResult = HitNothing;
RefPtr<AsyncPanZoomController> wrTarget = GetAPZCAtPointWR(aPoint, &wrHitResult);
HitTestingTreeNode* wrScrollbarNode = nullptr;
RefPtr<AsyncPanZoomController> wrTarget = GetAPZCAtPointWR(aPoint, &wrHitResult, &wrScrollbarNode);
// For now just compare the WR and non-WR results.
if (wrHitResult != hitResult) {
printf_stderr("WR hit result mismatch at %s: got %d, expected %d\n",
@ -2211,6 +2212,11 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint,
target ? Stringify(target->GetGuid()).c_str() : "null");
// MOZ_RELEASE_ASSERT(false);
}
if (wrScrollbarNode != scrollbarNode) {
printf_stderr("WR scrollbar node mismatch at %s: got %p, expected %p\n",
Stringify(aPoint).c_str(), wrScrollbarNode, scrollbarNode);
// MOZ_RELEASE_ASSERT(false);
}
}
if (aOutHitResult) {
@ -2224,9 +2230,11 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint,
already_AddRefed<AsyncPanZoomController>
APZCTreeManager::GetAPZCAtPointWR(const ScreenPoint& aHitTestPoint,
HitTestResult* aOutHitResult)
HitTestResult* aOutHitResult,
HitTestingTreeNode** aOutScrollbarNode)
{
MOZ_ASSERT(aOutHitResult);
MOZ_ASSERT(aOutScrollbarNode);
RefPtr<AsyncPanZoomController> result;
RefPtr<wr::WebRenderAPI> wr = GetWebRenderAPI();
@ -2256,6 +2264,22 @@ APZCTreeManager::GetAPZCAtPointWR(const ScreenPoint& aHitTestPoint,
MOZ_ASSERT(result);
}
bool isScrollbar = bool(hitInfo & gfx::CompositorHitTestInfo::eScrollbar);
bool isScrollbarThumb = bool(hitInfo & gfx::CompositorHitTestInfo::eScrollbarThumb);
ScrollDirection direction = (hitInfo & gfx::CompositorHitTestInfo::eScrollbarVertical)
? ScrollDirection::eVertical
: ScrollDirection::eHorizontal;
if (isScrollbar || isScrollbarThumb) {
*aOutScrollbarNode = BreadthFirstSearch<ReverseIterator>(mRootNode.get(),
[&](HitTestingTreeNode* aNode) {
return (aNode->GetLayersId() == layersId) &&
(aNode->IsScrollbarNode() == isScrollbar) &&
(aNode->IsScrollThumbNode() == isScrollbarThumb) &&
(aNode->GetScrollbarDirection() == direction) &&
(aNode->GetScrollTargetId() == scrollId);
});
}
*aOutHitResult = HitLayer;
if (hitInfo & gfx::CompositorHitTestInfo::eDispatchToContent) {
*aOutHitResult = HitDispatchToContentRegion;

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

@ -524,7 +524,8 @@ private:
HitTestResult* aOutHitResult,
HitTestingTreeNode** aOutScrollbarNode);
already_AddRefed<AsyncPanZoomController> GetAPZCAtPointWR(const ScreenPoint& aHitTestPoint,
HitTestResult* aOutHitResult);
HitTestResult* aOutHitResult,
HitTestingTreeNode** aOutScrollbarNode);
AsyncPanZoomController* FindRootApzcForLayersId(uint64_t aLayersId) const;
AsyncPanZoomController* FindRootContentApzcForLayersId(uint64_t aLayersId) const;
AsyncPanZoomController* FindRootContentOrRootApzc() const;

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

@ -124,6 +124,16 @@ HitTestingTreeNode::IsScrollbarNode() const
return mScrollbarContainerDirection.isSome() || IsScrollThumbNode();
}
ScrollDirection
HitTestingTreeNode::GetScrollbarDirection() const
{
MOZ_ASSERT(IsScrollbarNode());
if (mScrollThumbData.mDirection.isSome()) {
return *(mScrollThumbData.mDirection);
}
return *mScrollbarContainerDirection;
}
FrameMetrics::ViewID
HitTestingTreeNode::GetScrollTargetId() const
{

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

@ -100,6 +100,8 @@ public:
const Maybe<ScrollDirection>& aScrollContainerDirection);
bool MatchesScrollDragMetrics(const AsyncDragMetrics& aDragMetrics) const;
bool IsScrollbarNode() const; // Scroll thumb or scrollbar container layer.
// This can only be called if IsScrollbarNode() is true
ScrollDirection GetScrollbarDirection() const;
bool IsScrollThumbNode() const; // Scroll thumb container layer.
FrameMetrics::ViewID GetScrollTargetId() const;
const ScrollThumbData& GetScrollThumbData() const;