Bug 1627737 - Add `mTargetIsRoot` to `APZEventResult` r=botond

This allows us to determine if the event was handled in the
toplevel frame or not.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Willcox 2020-04-08 16:13:50 +00:00
Родитель 579bafbb86
Коммит 3ed4ef71c1
4 изменённых файлов: 15 добавлений и 1 удалений

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

@ -56,6 +56,10 @@ struct APZEventResult {
* The guid of the APZC this event was delivered to.
*/
ScrollableLayerGuid mTargetGuid;
/**
* Whether or not mTargetGuid refers to the root content APZC
*/
bool mTargetIsRoot;
/**
* If this event started or was added to an input block, the id of that
* input block, otherwise InputBlockState::NO_BLOCK_ID.

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

@ -1581,6 +1581,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();
if (!hitScrollbar) {
// The input was not targeted at a scrollbar, so we untransform it
@ -1665,6 +1666,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();
wheelInput.mOrigin = *untransformedOrigin;
}
break;
@ -1723,6 +1725,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();
panInput.mPanStartPoint = *untransformedStartPoint;
panInput.mPanDisplacement = *untransformedDisplacement;
@ -1762,6 +1765,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();
pinchInput.mFocusPoint = *untransformedFocusPoint;
}
break;
@ -1791,6 +1795,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();
tapInput.mPoint = *untransformedPoint;
}
break;
@ -2071,6 +2076,7 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
MOZ_ASSERT(mHitResultForInputBlock != CompositorHitTestInvisibleToHit);
mApzcForInputBlock->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = mApzcForInputBlock->IsRootContent();
result.mStatus = mInputQueue->ReceiveInputEvent(
mApzcForInputBlock, TargetConfirmationFlags{mHitResultForInputBlock},
aInput, &result.mInputBlockId,
@ -2175,6 +2181,7 @@ APZEventResult APZCTreeManager::ProcessTouchInputForScrollbarDrag(
}
mApzcForInputBlock->GetGuid(&result.mTargetGuid);
result.mTargetIsRoot = mApzcForInputBlock->IsRootContent();
// Since the input was targeted at a scrollbar:
// - The original touch event (which will be sent on to content) will

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

@ -25,6 +25,7 @@ namespace layers {
APZEventResult::APZEventResult()
: mStatus(nsEventStatus_eIgnore),
mTargetIsRoot(false),
mInputBlockId(InputBlockState::NO_BLOCK_ID),
mHitRegionWithApzAwareListeners(false) {}

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

@ -545,6 +545,7 @@ struct ParamTraits<mozilla::layers::APZEventResult> {
WriteParam(aMsg, aParam.mTargetGuid);
WriteParam(aMsg, aParam.mInputBlockId);
WriteParam(aMsg, aParam.mHitRegionWithApzAwareListeners);
WriteParam(aMsg, aParam.mTargetIsRoot);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
@ -552,7 +553,8 @@ struct ParamTraits<mozilla::layers::APZEventResult> {
return (ReadParam(aMsg, aIter, &aResult->mStatus) &&
ReadParam(aMsg, aIter, &aResult->mTargetGuid) &&
ReadParam(aMsg, aIter, &aResult->mInputBlockId) &&
ReadParam(aMsg, aIter, &aResult->mHitRegionWithApzAwareListeners));
ReadParam(aMsg, aIter, &aResult->mHitRegionWithApzAwareListeners) &&
ReadParam(aMsg, aIter, &aResult->mTargetIsRoot));
}
};