Bug 1640387 - Only set HitResult::mTargetIsRoot for confirmed-root targets. r=snorp,botond

Differential Revision: https://phabricator.services.mozilla.com/D76594
This commit is contained in:
Kartikaya Gupta 2020-05-26 16:30:12 +00:00
Родитель e0ccbf2510
Коммит 91befca134
3 изменённых файлов: 18 добавлений и 8 удалений

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

@ -57,7 +57,8 @@ struct APZEventResult {
*/
ScrollableLayerGuid mTargetGuid;
/**
* Whether or not mTargetGuid refers to the root content APZC
* Whether or not mTargetGuid refers to the root content APZC. This gets set
* to false in cases where APZ is unsure due to imprecision in hit-testing.
*/
bool mTargetIsRoot;
/**

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

@ -1543,7 +1543,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
// Update the out-parameters so they are what the caller expects.
hit.mTargetApzc->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = hit.mTargetApzc->IsRootContent();
result.mTargetIsRoot = hit.TargetIsConfirmedRoot();
if (!hitScrollbar) {
// The input was not targeted at a scrollbar, so we untransform it
@ -1628,7 +1628,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
// Update the out-parameters so they are what the caller expects.
hit.mTargetApzc->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = hit.mTargetApzc->IsRootContent();
result.mTargetIsRoot = hit.TargetIsConfirmedRoot();
wheelInput.mOrigin = *untransformedOrigin;
}
break;
@ -1687,7 +1687,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
// Update the out-parameters so they are what the caller expects.
hit.mTargetApzc->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = hit.mTargetApzc->IsRootContent();
result.mTargetIsRoot = hit.TargetIsConfirmedRoot();
panInput.mPanStartPoint = *untransformedStartPoint;
panInput.mPanDisplacement = *untransformedDisplacement;
@ -1730,7 +1730,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
// Update the out-parameters so they are what the caller expects.
hit.mTargetApzc->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = hit.mTargetApzc->IsRootContent();
result.mTargetIsRoot = hit.TargetIsConfirmedRoot();
pinchInput.mFocusPoint = *untransformedFocusPoint;
}
break;
@ -1760,7 +1760,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
// Update the out-parameters so they are what the caller expects.
hit.mTargetApzc->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = hit.mTargetApzc->IsRootContent();
result.mTargetIsRoot = hit.TargetIsConfirmedRoot();
tapInput.mPoint = *untransformedPoint;
}
break;
@ -2045,7 +2045,7 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
CompositorHitTestInvisibleToHit);
mTouchBlockHitResult.mTargetApzc->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = mTouchBlockHitResult.mTargetApzc->IsRootContent();
result.mTargetIsRoot = mTouchBlockHitResult.TargetIsConfirmedRoot();
result.mStatus = mInputQueue->ReceiveInputEvent(
mTouchBlockHitResult.mTargetApzc,
TargetConfirmationFlags{mTouchBlockHitResult.mHitResult}, aInput,
@ -2154,7 +2154,7 @@ APZEventResult APZCTreeManager::ProcessTouchInputForScrollbarDrag(
}
mTouchBlockHitResult.mTargetApzc->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = mTouchBlockHitResult.mTargetApzc->IsRootContent();
result.mTargetIsRoot = mTouchBlockHitResult.TargetIsConfirmedRoot();
// Since the input was targeted at a scrollbar:
// - The original touch event (which will be sent on to content) will
@ -3922,5 +3922,13 @@ APZCTreeManager::StickyPositionInfo::StickyPositionInfo(
mStickyScrollRangeOuter = aNode->GetStickyScrollRangeOuter();
}
bool APZCTreeManager::HitTestResult::TargetIsConfirmedRoot() const {
CompositorHitTestInfo impreciseHitAreaFlags(
CompositorHitTestFlags::eIrregularArea,
CompositorHitTestFlags::eInactiveScrollframe);
return (mHitResult & impreciseHitAreaFlags).isEmpty() &&
mTargetApzc->IsRootContent();
}
} // namespace layers
} // namespace mozilla

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

@ -556,6 +556,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
// Make it move-only.
HitTestResult(HitTestResult&&) = default;
HitTestResult& operator=(HitTestResult&&) = default;
bool TargetIsConfirmedRoot() const;
};
/* Some helper functions to find an APZC given some identifying input. These