Commit eb54f7c1 authored by Liviu Tinta's avatar Liviu Tinta Committed by Commit Bot

Main thread Scrollbar interaction injects GSB/GSU/GSE to compositor

If Scroll Unification is enabled, send GSB, GSU and GSE to
CompositorThreadEventQueue instead of MainThreadEventQueue in
|WebFrameWidgetBase::InjectGestureScrollEvent|.


Bug: 1047198
Change-Id: Iec178bf6053d937ed1b6cdd977ac7e42267b4ef2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2392409
Commit-Queue: Liviu Tinta <liviutinta@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808052}
parent aeda2e22
...@@ -1713,8 +1713,26 @@ void WebFrameWidgetBase::InjectGestureScrollEvent( ...@@ -1713,8 +1713,26 @@ void WebFrameWidgetBase::InjectGestureScrollEvent(
ui::ScrollGranularity granularity, ui::ScrollGranularity granularity,
cc::ElementId scrollable_area_element_id, cc::ElementId scrollable_area_element_id,
blink::WebInputEvent::Type injected_type) { blink::WebInputEvent::Type injected_type) {
widget_base_->input_handler().InjectGestureScrollEvent( if (RuntimeEnabledFeatures::ScrollUnificationEnabled()) {
device, delta, granularity, scrollable_area_element_id, injected_type); // create a GestureScroll Event and post it to the compositor thread
// TODO(crbug.com/1126098) use original input event's timestamp.
// TODO(crbug.com/1082590) ensure continuity in scroll metrics collection
base::TimeTicks now = base::TimeTicks::Now();
std::unique_ptr<WebGestureEvent> gesture_event =
WebGestureEvent::GenerateInjectedScrollGesture(
injected_type, now, device, gfx::PointF(0, 0), delta, granularity);
if (injected_type == WebInputEvent::Type::kGestureScrollBegin) {
gesture_event->data.scroll_begin.scrollable_area_element_id =
scrollable_area_element_id.GetStableId();
gesture_event->data.scroll_begin.main_thread_hit_tested = true;
}
widget_base_->widget_input_handler_manager()
->DispatchScrollGestureToCompositor(std::move(gesture_event));
} else {
widget_base_->input_handler().InjectGestureScrollEvent(
device, delta, granularity, scrollable_area_element_id, injected_type);
}
} }
void WebFrameWidgetBase::DidChangeCursor(const ui::Cursor& cursor) { void WebFrameWidgetBase::DidChangeCursor(const ui::Cursor& cursor) {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/check_op.h" #include "base/check_op.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/notreached.h" #include "base/notreached.h"
#include "cc/base/features.h" #include "cc/base/features.h"
...@@ -389,6 +390,27 @@ void WidgetInputHandlerManager::LogInputTimingUMA() { ...@@ -389,6 +390,27 @@ void WidgetInputHandlerManager::LogInputTimingUMA() {
} }
} }
void WidgetInputHandlerManager::DispatchScrollGestureToCompositor(
std::unique_ptr<WebGestureEvent> event) {
DCHECK(base::FeatureList::IsEnabled(features::kScrollUnification));
std::unique_ptr<WebCoalescedInputEvent> web_scoped_gesture_event =
std::make_unique<WebCoalescedInputEvent>(std::move(event),
ui::LatencyInfo());
DCHECK(compositor_task_runner_);
compositor_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&WidgetInputHandlerManager::
HandleInputEventWithLatencyInfoOnCompositor,
this, std::move(web_scoped_gesture_event)));
}
void WidgetInputHandlerManager::HandleInputEventWithLatencyInfoOnCompositor(
std::unique_ptr<WebCoalescedInputEvent> event) {
DCHECK(base::FeatureList::IsEnabled(features::kScrollUnification));
DCHECK(input_handler_proxy_);
input_handler_proxy_->HandleInputEventWithLatencyInfo(std::move(event),
base::DoNothing());
}
void WidgetInputHandlerManager::DispatchEvent( void WidgetInputHandlerManager::DispatchEvent(
std::unique_ptr<WebCoalescedInputEvent> event, std::unique_ptr<WebCoalescedInputEvent> event,
mojom::blink::WidgetInputHandler::DispatchEventCallback callback) { mojom::blink::WidgetInputHandler::DispatchEventCallback callback) {
...@@ -398,7 +420,7 @@ void WidgetInputHandlerManager::DispatchEvent( ...@@ -398,7 +420,7 @@ void WidgetInputHandlerManager::DispatchEvent(
if (!event_is_move) if (!event_is_move)
LogInputTimingUMA(); LogInputTimingUMA();
// Drop input if we are deferring a rendring pipeline phase, unless it's a // Drop input if we are deferring a rendering pipeline phase, unless it's a
// move event. // move event.
// We don't want users interacting with stuff they can't see, so we drop it. // We don't want users interacting with stuff they can't see, so we drop it.
// We allow moves because we need to keep the current pointer location up // We allow moves because we need to keep the current pointer location up
...@@ -436,7 +458,7 @@ void WidgetInputHandlerManager::DispatchEvent( ...@@ -436,7 +458,7 @@ void WidgetInputHandlerManager::DispatchEvent(
return; return;
} }
// The InputHandlerProxy will be the first to try handing the event on the // The InputHandlerProxy will be the first to try handling the event on the
// compositor thread. It will respond to this class by calling // compositor thread. It will respond to this class by calling
// DidHandleInputEventSentToCompositor with the result of its attempt. Based // DidHandleInputEventSentToCompositor with the result of its attempt. Based
// on the resulting disposition, DidHandleInputEventSentToCompositor will // on the resulting disposition, DidHandleInputEventSentToCompositor will
......
...@@ -98,6 +98,8 @@ class PLATFORM_EXPORT WidgetInputHandlerManager final ...@@ -98,6 +98,8 @@ class PLATFORM_EXPORT WidgetInputHandlerManager final
const WebGestureEvent& gesture_event, const WebGestureEvent& gesture_event,
const cc::InputHandlerScrollResult& scroll_result); const cc::InputHandlerScrollResult& scroll_result);
void DispatchScrollGestureToCompositor(
std::unique_ptr<WebGestureEvent> event);
void DispatchEvent( void DispatchEvent(
std::unique_ptr<blink::WebCoalescedInputEvent> event, std::unique_ptr<blink::WebCoalescedInputEvent> event,
mojom::blink::WidgetInputHandler::DispatchEventCallback callback); mojom::blink::WidgetInputHandler::DispatchEventCallback callback);
...@@ -225,6 +227,9 @@ class PLATFORM_EXPORT WidgetInputHandlerManager final ...@@ -225,6 +227,9 @@ class PLATFORM_EXPORT WidgetInputHandlerManager final
const WebGestureEvent& gesture_event, const WebGestureEvent& gesture_event,
const cc::InputHandlerScrollResult& scroll_result); const cc::InputHandlerScrollResult& scroll_result);
void HandleInputEventWithLatencyInfoOnCompositor(
std::unique_ptr<WebCoalescedInputEvent>);
// Returns the task runner for the thread that receives input. i.e. the // Returns the task runner for the thread that receives input. i.e. the
// "Mojo-bound" thread. // "Mojo-bound" thread.
const scoped_refptr<base::SingleThreadTaskRunner>& InputThreadTaskRunner() const scoped_refptr<base::SingleThreadTaskRunner>& InputThreadTaskRunner()
......
...@@ -6731,3 +6731,9 @@ crbug.com/1126709 [ Win ] virtual/threaded/external/wpt/animation-worklet/workle ...@@ -6731,3 +6731,9 @@ crbug.com/1126709 [ Win ] virtual/threaded/external/wpt/animation-worklet/workle
# Sheriff 2020-09-17 # Sheriff 2020-09-17
crbug.com/1129347 [ Mac10.13 Debug ] http/tests/devtools/persistence/persistence-external-change-breakpoints.js [ Pass Failure ] crbug.com/1129347 [ Mac10.13 Debug ] http/tests/devtools/persistence/persistence-external-change-breakpoints.js [ Pass Failure ]
### virtual/scroll-unification/fast/scrolling/scrollbars/
virtual/scroll-unification/fast/scrolling/scrollbars/mouse-autoscrolling-on-scrollbar.html [ Failure ]
virtual/scroll-unification/fast/scrolling/scrollbars/mouse-scrolling-on-div-scrollbar.html [ Failure ]
virtual/scroll-unification/fast/scrolling/scrollbars/scrollbar-occluded-by-div.html [ Failure ]
virtual/scroll-unification/fast/scrolling/scrollbars/scrollbar-rtl-manipulation.html [ Failure ]
virtual/scroll-unification/fast/scrolling/scrollbars/dsf-ready/mouse-interactions-dsf-2.html [ Failure ]
...@@ -743,5 +743,11 @@ ...@@ -743,5 +743,11 @@
"args": ["--enable-threaded-compositing", "args": ["--enable-threaded-compositing",
"--enable-features=CompositeCrossOriginIframes", "--enable-features=CompositeCrossOriginIframes",
"--disable-auto-wpt-origin-isolation"] "--disable-auto-wpt-origin-isolation"]
},
{
"prefix": "scroll-unification",
"bases": ["fast/scrolling/scrollbars"],
"args": ["--enable-features=ScrollUnification",
"--enable-threaded-compositing"]
} }
] ]
This directory is dedicated for testing the "ScrollUnification" feature.
This directory is dedicated for testing the "ScrollUnification" feature.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment