From f2932331dfe9957af268178e41fff31eeb90ea16 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Wed, 11 Nov 2020 00:33:28 +0000 Subject: [PATCH] Bug 1674694 - Use ConvertAPZHandledResult nsEventStatus_eConsumeNoDefault case. r=botond,geckoview-reviewers,agi Differential Revision: https://phabricator.services.mozilla.com/D96332 --- widget/android/nsWindow.cpp | 39 +++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 654ce1e1b4f0..bbc3e4fdb09e 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -360,13 +360,9 @@ class NPZCSupport final WheelDeltaAdjustmentStrategy::eNone); APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input); - int32_t ret = - (result.mHandledResult == Some(APZHandledResult::HandledByRoot)) - ? INPUT_RESULT_HANDLED - : INPUT_RESULT_HANDLED_CONTENT; - if (result.mStatus == nsEventStatus_eConsumeNoDefault) { - return ret; + MOZ_ASSERT(result.mHandledResult, "Should have a valid APZHandledResult"); + return ConvertAPZHandledResult(result.mHandledResult.value()); } PostInputEvent([input, result](nsWindow* window) { @@ -378,7 +374,9 @@ class NPZCSupport final case nsEventStatus_eIgnore: return INPUT_RESULT_UNHANDLED; case nsEventStatus_eConsumeDoDefault: - return ret; + return (result.mHandledResult == Some(APZHandledResult::HandledByRoot)) + ? INPUT_RESULT_HANDLED + : INPUT_RESULT_HANDLED_CONTENT; default: MOZ_ASSERT_UNREACHABLE("Unexpected nsEventStatus"); return INPUT_RESULT_UNHANDLED; @@ -503,13 +501,9 @@ class NPZCSupport final nsWindow::GetEventTimeStamp(aTime), nsWindow::GetModifiers(aMetaState)); APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input); - int32_t ret = - (result.mHandledResult == Some(APZHandledResult::HandledByRoot)) - ? INPUT_RESULT_HANDLED - : INPUT_RESULT_HANDLED_CONTENT; - if (result.mStatus == nsEventStatus_eConsumeNoDefault) { - return ret; + MOZ_ASSERT(result.mHandledResult, "Should have a valid APZHandledResult"); + return ConvertAPZHandledResult(result.mHandledResult.value()); } PostInputEvent([input, result](nsWindow* window) { @@ -521,7 +515,9 @@ class NPZCSupport final case nsEventStatus_eIgnore: return INPUT_RESULT_UNHANDLED; case nsEventStatus_eConsumeDoDefault: - return ret; + return (result.mHandledResult == Some(APZHandledResult::HandledByRoot)) + ? INPUT_RESULT_HANDLED + : INPUT_RESULT_HANDLED_CONTENT; default: MOZ_ASSERT_UNREACHABLE("Unexpected nsEventStatus"); return INPUT_RESULT_UNHANDLED; @@ -704,14 +700,12 @@ class NPZCSupport final } APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input); - int32_t handled = - (result.mHandledResult == Some(APZHandledResult::HandledByRoot)) - ? INPUT_RESULT_HANDLED - : INPUT_RESULT_HANDLED_CONTENT; - if (result.mStatus == nsEventStatus_eConsumeNoDefault) { if (returnResult) { - returnResult->Complete(java::sdk::Integer::ValueOf(handled)); + MOZ_ASSERT(result.mHandledResult, + "Should have a valid APZHandledResult"); + returnResult->Complete(java::sdk::Integer::ValueOf( + ConvertAPZHandledResult(result.mHandledResult.value()))); } return; } @@ -737,7 +731,10 @@ class NPZCSupport final java::sdk::Integer::ValueOf(INPUT_RESULT_UNHANDLED)); break; case nsEventStatus_eConsumeDoDefault: - returnResult->Complete(java::sdk::Integer::ValueOf(handled)); + returnResult->Complete(java::sdk::Integer::ValueOf( + (result.mHandledResult == Some(APZHandledResult::HandledByRoot)) + ? INPUT_RESULT_HANDLED + : INPUT_RESULT_HANDLED_CONTENT)); break; default: MOZ_ASSERT_UNREACHABLE("Unexpected nsEventStatus");