From 4ed9caad8af308edaef68f16aa77cacb53fdb11c Mon Sep 17 00:00:00 2001 From: "yupeng74@huawei.com" Date: Thu, 12 Oct 2023 14:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E8=83=BD=E6=8B=96=E6=BB=91=E6=8F=90?= =?UTF-8?q?=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yupeng74@huawei.com --- .../browser/renderer_host/input/input_router_impl.cc | 11 +++++++---- .../browser/renderer_host/input/input_router_impl.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc index 5edac43d07..9566ace69e 100644 --- a/content/browser/renderer_host/input/input_router_impl.cc +++ b/content/browser/renderer_host/input/input_router_impl.cc @@ -71,7 +71,7 @@ std::unique_ptr ScaleEvent( std::vector>(), std::vector>(), latency_info); } - +constexpr uint64_t GESTURE_MOVE_PERIOD = 250000000; } // namespace InputRouterImpl::InputRouterImpl( @@ -141,14 +141,17 @@ void InputRouterImpl::SendGestureEvent( GestureEventWithLatencyInfo gesture_event(original_gesture_event); #if BUILDFLAG(IS_OHOS) - if (gesture_event.event.GetType() == - WebInputEvent::Type::kGestureFlingStart) { - LOG(INFO) << "InputRouterImpl::SendGestureEvent type=kGestureFlingStart"; + timeStamp_ = ::base::subtle::TimeTicksNowIgnoringOverride().since_origin().InNanoseconds(); + if (gesture_event.event.GetType() == WebInputEvent::Type::kGestureScrollUpdate && + timeStamp_ - prePerfTimeStamp_ > GESTURE_MOVE_PERIOD) { + prePerfTimeStamp_ = timeStamp_; + LOG(INFO) << "InputRouterImpl::SendGestureEvent type=kGestureScrollUpdate success"; client_->GetWidgetInputHandler()->TryStartFling(); } else if (gesture_event.event.GetType() == WebInputEvent::Type::kGestureScrollEnd) { LOG(INFO) << "InputRouterImpl::SendGestureEvent type=kGestureScrollEnd"; client_->GetWidgetInputHandler()->TryFinishFling(); + prePerfTimeStamp_ = 0; } #endif if (gesture_event_queue_.PassToFlingController(gesture_event)) { diff --git a/content/browser/renderer_host/input/input_router_impl.h b/content/browser/renderer_host/input/input_router_impl.h index 3ecc630cbf..394f3a356c 100644 --- a/content/browser/renderer_host/input/input_router_impl.h +++ b/content/browser/renderer_host/input/input_router_impl.h @@ -261,6 +261,8 @@ class CONTENT_EXPORT InputRouterImpl base::WeakPtr weak_this_; base::WeakPtrFactory weak_ptr_factory_{this}; + uint64_t timeStamp_ = 0; + uint64_t prePerfTimeStamp_ = 0; }; } // namespace content -- Gitee