зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1633322 - Turn APZEventResult::mHandledByRootApzc into a Maybe. r=kats,geckoview-reviewers,snorp
Differential Revision: https://phabricator.services.mozilla.com/D79930
This commit is contained in:
Родитель
66380a8ca4
Коммит
6651ba71a3
|
@ -60,10 +60,13 @@ struct APZEventResult {
|
|||
*/
|
||||
ScrollableLayerGuid mTargetGuid;
|
||||
/**
|
||||
* This is set to true if we know for sure that the event will be handled
|
||||
* by the root content APZC.
|
||||
* This is:
|
||||
* - set to true if we know for sure that the event will be handled
|
||||
* by the root content APZC;
|
||||
* - set to false if we know for sure it will not be;
|
||||
* - left empty if we are unsure.
|
||||
*/
|
||||
bool mHandledByRootApzc;
|
||||
Maybe<bool> mHandledByRootApzc;
|
||||
/**
|
||||
* If this event started or was added to an input block, the id of that
|
||||
* input block, otherwise InputBlockState::NO_BLOCK_ID.
|
||||
|
|
|
@ -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.mHandledByRootApzc = hit.TargetIsConfirmedRoot();
|
||||
result.mHandledByRootApzc = hit.HandledByRoot();
|
||||
|
||||
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.mHandledByRootApzc = hit.TargetIsConfirmedRoot();
|
||||
result.mHandledByRootApzc = hit.HandledByRoot();
|
||||
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.mHandledByRootApzc = hit.TargetIsConfirmedRoot();
|
||||
result.mHandledByRootApzc = hit.HandledByRoot();
|
||||
panInput.mPanStartPoint = *untransformedStartPoint;
|
||||
panInput.mPanDisplacement = *untransformedDisplacement;
|
||||
|
||||
|
@ -1736,7 +1736,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
|
|||
|
||||
// Update the out-parameters so they are what the caller expects.
|
||||
hit.mTargetApzc->GetGuid(&result.mTargetGuid);
|
||||
result.mHandledByRootApzc = hit.TargetIsConfirmedRoot();
|
||||
result.mHandledByRootApzc = hit.HandledByRoot();
|
||||
pinchInput.mFocusPoint = *untransformedFocusPoint;
|
||||
}
|
||||
break;
|
||||
|
@ -1766,7 +1766,7 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(InputData& aEvent) {
|
|||
|
||||
// Update the out-parameters so they are what the caller expects.
|
||||
hit.mTargetApzc->GetGuid(&result.mTargetGuid);
|
||||
result.mHandledByRootApzc = hit.TargetIsConfirmedRoot();
|
||||
result.mHandledByRootApzc = hit.HandledByRoot();
|
||||
tapInput.mPoint = *untransformedPoint;
|
||||
}
|
||||
break;
|
||||
|
@ -2037,7 +2037,7 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
|
|||
CompositorHitTestInvisibleToHit);
|
||||
|
||||
mTouchBlockHitResult.mTargetApzc->GetGuid(&result.mTargetGuid);
|
||||
result.mHandledByRootApzc = mTouchBlockHitResult.TargetIsConfirmedRoot();
|
||||
result.mHandledByRootApzc = mTouchBlockHitResult.HandledByRoot();
|
||||
result.mStatus = mInputQueue->ReceiveInputEvent(
|
||||
mTouchBlockHitResult.mTargetApzc,
|
||||
TargetConfirmationFlags{mTouchBlockHitResult.mHitResult}, aInput,
|
||||
|
@ -2138,7 +2138,7 @@ APZEventResult APZCTreeManager::ProcessTouchInputForScrollbarDrag(
|
|||
}
|
||||
|
||||
mTouchBlockHitResult.mTargetApzc->GetGuid(&result.mTargetGuid);
|
||||
result.mHandledByRootApzc = mTouchBlockHitResult.TargetIsConfirmedRoot();
|
||||
result.mHandledByRootApzc = mTouchBlockHitResult.HandledByRoot();
|
||||
|
||||
// Since the input was targeted at a scrollbar:
|
||||
// - The original touch event (which will be sent on to content) will
|
||||
|
@ -3939,9 +3939,19 @@ APZCTreeManager::StickyPositionInfo::StickyPositionInfo(
|
|||
mStickyScrollRangeOuter = aNode->GetStickyScrollRangeOuter();
|
||||
}
|
||||
|
||||
bool APZCTreeManager::HitTestResult::TargetIsConfirmedRoot() const {
|
||||
return (mHitResult & CompositorHitTestDispatchToContent).isEmpty() &&
|
||||
mTargetApzc->IsRootContent();
|
||||
Maybe<bool> APZCTreeManager::HitTestResult::HandledByRoot() const {
|
||||
if (!mTargetApzc->IsRootContent()) {
|
||||
// If the initial target is not the root, this will definitely not be
|
||||
// handled by the root. (The confirmed target is either the initial
|
||||
// target, or a descendant.)
|
||||
return Some(false);
|
||||
} else if ((mHitResult & CompositorHitTestDispatchToContent).isEmpty()) {
|
||||
// If the initial target is the root and we don't need to dispatch to
|
||||
// content, the event will definitely be handled by the root.
|
||||
return Some(true);
|
||||
}
|
||||
// Otherwise, we're not sure.
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -558,7 +558,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
|||
// Make it move-only.
|
||||
HitTestResult(HitTestResult&&) = default;
|
||||
HitTestResult& operator=(HitTestResult&&) = default;
|
||||
bool TargetIsConfirmedRoot() const;
|
||||
Maybe<bool> HandledByRoot() const;
|
||||
};
|
||||
|
||||
/* Some helper functions to find an APZC given some identifying input. These
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace layers {
|
|||
|
||||
APZEventResult::APZEventResult()
|
||||
: mStatus(nsEventStatus_eIgnore),
|
||||
mHandledByRootApzc(false),
|
||||
mInputBlockId(InputBlockState::NO_BLOCK_ID) {}
|
||||
|
||||
static bool WillHandleMouseEvent(const WidgetMouseEventBase& aEvent) {
|
||||
|
|
|
@ -338,11 +338,11 @@ TEST_F(APZEventRegionsTester, HandledByRootApzcFlag) {
|
|||
APZEventResult result =
|
||||
TouchDown(manager, ScreenIntPoint(50, 25), mcc->Time());
|
||||
TouchUp(manager, ScreenIntPoint(50, 25), mcc->Time());
|
||||
EXPECT_TRUE(result.mHandledByRootApzc);
|
||||
EXPECT_EQ(result.mHandledByRootApzc, Some(true));
|
||||
|
||||
// Tap the bottom half and check that we report that we're not
|
||||
// sure whether the event was handled by the root APZC.
|
||||
result = TouchDown(manager, ScreenIntPoint(50, 75), mcc->Time());
|
||||
TouchUp(manager, ScreenIntPoint(50, 75), mcc->Time());
|
||||
EXPECT_FALSE(result.mHandledByRootApzc);
|
||||
EXPECT_EQ(result.mHandledByRootApzc, Nothing());
|
||||
}
|
||||
|
|
|
@ -878,8 +878,9 @@ class nsWindow::NPZCSupport final
|
|||
WheelDeltaAdjustmentStrategy::eNone);
|
||||
|
||||
APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input);
|
||||
int32_t ret = result.mHandledByRootApzc ? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
int32_t ret = (result.mHandledByRootApzc == Some(true))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
|
||||
if (result.mStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
return ret;
|
||||
|
@ -1000,8 +1001,9 @@ class nsWindow::NPZCSupport final
|
|||
GetEventTimeStamp(aTime), GetModifiers(aMetaState));
|
||||
|
||||
APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input);
|
||||
int32_t ret = result.mHandledByRootApzc ? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
int32_t ret = (result.mHandledByRootApzc == Some(true))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
|
||||
if (result.mStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
return ret;
|
||||
|
@ -1125,8 +1127,9 @@ class nsWindow::NPZCSupport final
|
|||
}
|
||||
|
||||
APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input);
|
||||
int32_t ret = result.mHandledByRootApzc ? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
int32_t ret = (result.mHandledByRootApzc == Some(true))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
|
||||
if (result.mStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
return ret;
|
||||
|
|
Загрузка…
Ссылка в новой задаче