Commit 7f617841 authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Add wheel scroll options "scroll_by_page" to GpuBenchmarking

In GpuBenchmarking, for mouse wheel and touchpad scroll, we want to add
"scroll_by_page" scroll option to GpuBenchmarking::SmoothScrollBy.

Bug: 871970
Change-Id: If73cc2bb41a77499cfc6215b5d8fde09f33f6caa
Reviewed-on: https://chromium-review.googlesource.com/1174993
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarSahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585656}
parent 8a6d66b9
...@@ -189,7 +189,9 @@ class MockSyntheticGestureTarget : public SyntheticGestureTarget { ...@@ -189,7 +189,9 @@ class MockSyntheticGestureTarget : public SyntheticGestureTarget {
class MockMoveGestureTarget : public MockSyntheticGestureTarget { class MockMoveGestureTarget : public MockSyntheticGestureTarget {
public: public:
MockMoveGestureTarget() MockMoveGestureTarget()
: total_abs_move_distance_length_(0), precise_scrolling_deltas_(false) {} : total_abs_move_distance_length_(0),
precise_scrolling_deltas_(false),
scroll_by_page_(false) {}
~MockMoveGestureTarget() override {} ~MockMoveGestureTarget() override {}
gfx::Vector2dF start_to_end_distance() const { gfx::Vector2dF start_to_end_distance() const {
...@@ -199,11 +201,13 @@ class MockMoveGestureTarget : public MockSyntheticGestureTarget { ...@@ -199,11 +201,13 @@ class MockMoveGestureTarget : public MockSyntheticGestureTarget {
return total_abs_move_distance_length_; return total_abs_move_distance_length_;
} }
bool precise_scrolling_deltas() const { return precise_scrolling_deltas_; } bool precise_scrolling_deltas() const { return precise_scrolling_deltas_; }
bool scroll_by_page() const { return scroll_by_page_; }
protected: protected:
gfx::Vector2dF start_to_end_distance_; gfx::Vector2dF start_to_end_distance_;
float total_abs_move_distance_length_; float total_abs_move_distance_length_;
bool precise_scrolling_deltas_; bool precise_scrolling_deltas_;
bool scroll_by_page_;
}; };
class MockScrollMouseTarget : public MockMoveGestureTarget { class MockScrollMouseTarget : public MockMoveGestureTarget {
...@@ -219,6 +223,7 @@ class MockScrollMouseTarget : public MockMoveGestureTarget { ...@@ -219,6 +223,7 @@ class MockScrollMouseTarget : public MockMoveGestureTarget {
start_to_end_distance_ += delta; start_to_end_distance_ += delta;
total_abs_move_distance_length_ += delta.Length(); total_abs_move_distance_length_ += delta.Length();
precise_scrolling_deltas_ = mouse_wheel_event.has_precise_scrolling_deltas; precise_scrolling_deltas_ = mouse_wheel_event.has_precise_scrolling_deltas;
scroll_by_page_ = mouse_wheel_event.scroll_by_page;
} }
}; };
...@@ -1258,6 +1263,27 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureMousePreciseScroll) { ...@@ -1258,6 +1263,27 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureMousePreciseScroll) {
scroll_target->precise_scrolling_deltas()); scroll_target->precise_scrolling_deltas());
} }
TEST_F(SyntheticGestureControllerTest, SingleScrollGestureMouseScrollByPage) {
CreateControllerAndTarget<MockScrollMouseTarget>();
SyntheticSmoothMoveGestureParams params;
params.input_type = SyntheticSmoothMoveGestureParams::MOUSE_WHEEL_INPUT;
params.start_point.SetPoint(39, 86);
params.distances.push_back(gfx::Vector2d(0, -132));
params.scroll_by_page = true;
std::unique_ptr<SyntheticSmoothMoveGesture> gesture(
new SyntheticSmoothMoveGesture(params));
QueueSyntheticGesture(std::move(gesture));
FlushInputUntilComplete();
MockMoveGestureTarget* scroll_target =
static_cast<MockMoveGestureTarget*>(target_);
EXPECT_EQ(1, num_success_);
EXPECT_EQ(0, num_failure_);
EXPECT_EQ(params.scroll_by_page, scroll_target->scroll_by_page());
}
void CheckIsWithinRangeMulti(float scroll_distance, void CheckIsWithinRangeMulti(float scroll_distance,
int target_distance, int target_distance,
SyntheticGestureTarget* target) { SyntheticGestureTarget* target) {
......
...@@ -81,9 +81,13 @@ void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( ...@@ -81,9 +81,13 @@ void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform(
return; return;
} }
base::TimeTicks timestamp = web_wheel.TimeStamp(); base::TimeTicks timestamp = web_wheel.TimeStamp();
int modifiers = web_wheel.has_precise_scrolling_deltas int modifiers = ui::EF_NONE;
? ui::EF_PRECISION_SCROLLING_DELTA if (web_wheel.has_precise_scrolling_deltas)
: ui::EF_NONE; modifiers |= ui::EF_PRECISION_SCROLLING_DELTA;
if (web_wheel.scroll_by_page)
modifiers |= ui::EF_SCROLL_BY_PAGE;
ui::MouseWheelEvent wheel_event( ui::MouseWheelEvent wheel_event(
gfx::Vector2d(web_wheel.delta_x, web_wheel.delta_y), gfx::Point(), gfx::Vector2d(web_wheel.delta_x, web_wheel.delta_y), gfx::Point(),
gfx::Point(), timestamp, modifiers, ui::EF_NONE); gfx::Point(), timestamp, modifiers, ui::EF_NONE);
......
...@@ -33,7 +33,8 @@ SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams() ...@@ -33,7 +33,8 @@ SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams()
fling_velocity_y(0), fling_velocity_y(0),
prevent_fling(true), prevent_fling(true),
add_slop(true), add_slop(true),
precise_scrolling_deltas(false) {} precise_scrolling_deltas(false),
scroll_by_page(false) {}
SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams( SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams(
const SyntheticSmoothMoveGestureParams& other) = default; const SyntheticSmoothMoveGestureParams& other) = default;
...@@ -270,7 +271,8 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent( ...@@ -270,7 +271,8 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent(
const base::TimeTicks& timestamp) const { const base::TimeTicks& timestamp) const {
blink::WebMouseWheelEvent mouse_wheel_event = blink::WebMouseWheelEvent mouse_wheel_event =
SyntheticWebMouseWheelEventBuilder::Build( SyntheticWebMouseWheelEventBuilder::Build(
0, 0, delta.x(), delta.y(), 0, params_.precise_scrolling_deltas); 0, 0, delta.x(), delta.y(), 0, params_.precise_scrolling_deltas,
params_.scroll_by_page);
mouse_wheel_event.SetPositionInWidget( mouse_wheel_event.SetPositionInWidget(
current_move_segment_start_position_.x(), current_move_segment_start_position_.x(),
......
...@@ -39,6 +39,7 @@ class CONTENT_EXPORT SyntheticSmoothMoveGestureParams { ...@@ -39,6 +39,7 @@ class CONTENT_EXPORT SyntheticSmoothMoveGestureParams {
bool prevent_fling; bool prevent_fling;
bool add_slop; bool add_slop;
bool precise_scrolling_deltas; bool precise_scrolling_deltas;
bool scroll_by_page;
}; };
// This class is used as helper class for simulation of scroll and drag. // This class is used as helper class for simulation of scroll and drag.
......
...@@ -51,6 +51,7 @@ bool SyntheticSmoothScrollGesture::InitializeMoveGesture( ...@@ -51,6 +51,7 @@ bool SyntheticSmoothScrollGesture::InitializeMoveGesture(
move_params.input_type = GetInputSourceType(gesture_type); move_params.input_type = GetInputSourceType(gesture_type);
move_params.add_slop = true; move_params.add_slop = true;
move_params.precise_scrolling_deltas = params_.precise_scrolling_deltas; move_params.precise_scrolling_deltas = params_.precise_scrolling_deltas;
move_params.scroll_by_page = params_.scroll_by_page;
move_gesture_.reset(new SyntheticSmoothMoveGesture(move_params)); move_gesture_.reset(new SyntheticSmoothMoveGesture(move_params));
return true; return true;
} }
......
...@@ -18,7 +18,8 @@ SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams() ...@@ -18,7 +18,8 @@ SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams()
speed_in_pixels_s(kDefaultSpeedInPixelsS), speed_in_pixels_s(kDefaultSpeedInPixelsS),
fling_velocity_x(0), fling_velocity_x(0),
fling_velocity_y(0), fling_velocity_y(0),
precise_scrolling_deltas(false) {} precise_scrolling_deltas(false),
scroll_by_page(false) {}
SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams( SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams(
const SyntheticSmoothScrollGestureParams& other) = default; const SyntheticSmoothScrollGestureParams& other) = default;
......
...@@ -31,6 +31,7 @@ struct CONTENT_EXPORT SyntheticSmoothScrollGestureParams ...@@ -31,6 +31,7 @@ struct CONTENT_EXPORT SyntheticSmoothScrollGestureParams
float fling_velocity_x; float fling_velocity_x;
float fling_velocity_y; float fling_velocity_y;
bool precise_scrolling_deltas; bool precise_scrolling_deltas;
bool scroll_by_page;
static const SyntheticSmoothScrollGestureParams* Cast( static const SyntheticSmoothScrollGestureParams* Cast(
const SyntheticGestureParams* gesture_params); const SyntheticGestureParams* gesture_params);
......
...@@ -50,23 +50,27 @@ WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( ...@@ -50,23 +50,27 @@ WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(
return result; return result;
} }
WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x, WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(
float x,
float y, float y,
float dx, float dx,
float dy, float dy,
int modifiers, int modifiers,
bool precise) { bool precise,
return Build(x, y, 0, 0, dx, dy, modifiers, precise); bool scroll_by_page) {
return Build(x, y, 0, 0, dx, dy, modifiers, precise, scroll_by_page);
} }
WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x, WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(
float x,
float y, float y,
float global_x, float global_x,
float global_y, float global_y,
float dx, float dx,
float dy, float dy,
int modifiers, int modifiers,
bool precise) { bool precise,
bool scroll_by_page) {
WebMouseWheelEvent result(WebInputEvent::kMouseWheel, modifiers, WebMouseWheelEvent result(WebInputEvent::kMouseWheel, modifiers,
ui::EventTimeForNow()); ui::EventTimeForNow());
result.SetPositionInScreen(global_x, global_y); result.SetPositionInScreen(global_x, global_y);
...@@ -78,6 +82,7 @@ WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x, ...@@ -78,6 +82,7 @@ WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x,
if (dy) if (dy)
result.wheel_ticks_y = dy > 0.0f ? 1.0f : -1.0f; result.wheel_ticks_y = dy > 0.0f ? 1.0f : -1.0f;
result.has_precise_scrolling_deltas = precise; result.has_precise_scrolling_deltas = precise;
result.scroll_by_page = scroll_by_page;
return result; return result;
} }
......
...@@ -38,7 +38,8 @@ class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder { ...@@ -38,7 +38,8 @@ class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder {
float dx, float dx,
float dy, float dy,
int modifiers, int modifiers,
bool precise); bool precise,
bool scroll_by_page = false);
static blink::WebMouseWheelEvent Build(float x, static blink::WebMouseWheelEvent Build(float x,
float y, float y,
float global_x, float global_x,
...@@ -46,7 +47,8 @@ class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder { ...@@ -46,7 +47,8 @@ class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder {
float dx, float dx,
float dy, float dy,
int modifiers, int modifiers,
bool precise); bool precise,
bool scroll_by_page = false);
}; };
class CONTENT_EXPORT SyntheticWebKeyboardEventBuilder { class CONTENT_EXPORT SyntheticWebKeyboardEventBuilder {
......
...@@ -122,6 +122,8 @@ IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams) ...@@ -122,6 +122,8 @@ IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams)
IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s) IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s)
IPC_STRUCT_TRAITS_MEMBER(fling_velocity_x) IPC_STRUCT_TRAITS_MEMBER(fling_velocity_x)
IPC_STRUCT_TRAITS_MEMBER(fling_velocity_y) IPC_STRUCT_TRAITS_MEMBER(fling_velocity_y)
IPC_STRUCT_TRAITS_MEMBER(precise_scrolling_deltas)
IPC_STRUCT_TRAITS_MEMBER(scroll_by_page)
IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams) IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams)
......
...@@ -289,7 +289,8 @@ bool BeginSmoothScroll(GpuBenchmarkingContext* context, ...@@ -289,7 +289,8 @@ bool BeginSmoothScroll(GpuBenchmarkingContext* context,
float start_x, float start_x,
float start_y, float start_y,
float fling_velocity, float fling_velocity,
bool precise_scrolling_deltas) { bool precise_scrolling_deltas,
bool scroll_by_page) {
gfx::Rect rect = context->render_view_impl()->GetWidget()->ViewRect(); gfx::Rect rect = context->render_view_impl()->GetWidget()->ViewRect();
rect -= rect.OffsetFromOrigin(); rect -= rect.OffsetFromOrigin();
if (!rect.Contains(start_x, start_y)) { if (!rect.Contains(start_x, start_y)) {
...@@ -327,6 +328,7 @@ bool BeginSmoothScroll(GpuBenchmarkingContext* context, ...@@ -327,6 +328,7 @@ bool BeginSmoothScroll(GpuBenchmarkingContext* context,
gesture_params.speed_in_pixels_s = speed_in_pixels_s; gesture_params.speed_in_pixels_s = speed_in_pixels_s;
gesture_params.prevent_fling = prevent_fling; gesture_params.prevent_fling = prevent_fling;
gesture_params.precise_scrolling_deltas = precise_scrolling_deltas; gesture_params.precise_scrolling_deltas = precise_scrolling_deltas;
gesture_params.scroll_by_page = scroll_by_page;
gesture_params.anchor.SetPoint(start_x, start_y); gesture_params.anchor.SetPoint(start_x, start_y);
...@@ -659,6 +661,7 @@ bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) { ...@@ -659,6 +661,7 @@ bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) {
std::string direction = "down"; std::string direction = "down";
float speed_in_pixels_s = 800; float speed_in_pixels_s = 800;
bool precise_scrolling_deltas = true; bool precise_scrolling_deltas = true;
bool scroll_by_page = false;
if (!GetOptionalArg(args, &pixels_to_scroll) || if (!GetOptionalArg(args, &pixels_to_scroll) ||
!GetOptionalArg(args, &callback) || !GetOptionalArg(args, &start_x) || !GetOptionalArg(args, &callback) || !GetOptionalArg(args, &start_x) ||
...@@ -666,17 +669,23 @@ bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) { ...@@ -666,17 +669,23 @@ bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) {
!GetOptionalArg(args, &gesture_source_type) || !GetOptionalArg(args, &gesture_source_type) ||
!GetOptionalArg(args, &direction) || !GetOptionalArg(args, &direction) ||
!GetOptionalArg(args, &speed_in_pixels_s) || !GetOptionalArg(args, &speed_in_pixels_s) ||
!GetOptionalArg(args, &precise_scrolling_deltas)) { !GetOptionalArg(args, &precise_scrolling_deltas) ||
!GetOptionalArg(args, &scroll_by_page)) {
return false; return false;
} }
// For all touch inputs, always scroll by precise deltas.
DCHECK(gesture_source_type != SyntheticGestureParams::TOUCH_INPUT || DCHECK(gesture_source_type != SyntheticGestureParams::TOUCH_INPUT ||
precise_scrolling_deltas); precise_scrolling_deltas);
// Scroll by page only for mouse inputs.
DCHECK(!scroll_by_page ||
gesture_source_type == SyntheticGestureParams::MOUSE_INPUT);
EnsureRemoteInterface(); EnsureRemoteInterface();
return BeginSmoothScroll(&context, args, input_injector_, pixels_to_scroll, return BeginSmoothScroll(&context, args, input_injector_, pixels_to_scroll,
callback, gesture_source_type, direction, callback, gesture_source_type, direction,
speed_in_pixels_s, true, start_x, start_y, 0, speed_in_pixels_s, true, start_x, start_y, 0,
precise_scrolling_deltas); precise_scrolling_deltas, scroll_by_page);
} }
bool GpuBenchmarking::SmoothDrag(gin::Arguments* args) { bool GpuBenchmarking::SmoothDrag(gin::Arguments* args) {
...@@ -745,7 +754,8 @@ bool GpuBenchmarking::Swipe(gin::Arguments* args) { ...@@ -745,7 +754,8 @@ bool GpuBenchmarking::Swipe(gin::Arguments* args) {
return BeginSmoothScroll(&context, args, input_injector_, -pixels_to_scroll, return BeginSmoothScroll(&context, args, input_injector_, -pixels_to_scroll,
callback, gesture_source_type, direction, callback, gesture_source_type, direction,
speed_in_pixels_s, false, start_x, start_y, speed_in_pixels_s, false, start_x, start_y,
fling_velocity, true); fling_velocity, true /* precise_scrolling_deltas */,
false /* scroll_by_page */);
} }
bool GpuBenchmarking::ScrollBounce(gin::Arguments* args) { bool GpuBenchmarking::ScrollBounce(gin::Arguments* args) {
......
...@@ -2242,6 +2242,7 @@ crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/pointerevents/po ...@@ -2242,6 +2242,7 @@ crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/pointerevents/po
# regularly on Windows. crbug.com/850964 # regularly on Windows. crbug.com/850964
crbug.com/613672 [ Mac Win ] virtual/threaded/external/wpt/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html [ Skip ] crbug.com/613672 [ Mac Win ] virtual/threaded/external/wpt/feature-policy/experimental-features/vertical-scroll-touch-block-manual.tentative.html [ Skip ]
crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scroll.html [ Skip ] crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scroll.html [ Skip ]
crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scroll-by-page.html [ Skip ]
crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ] crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ]
crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ] crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ]
crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ] crbug.com/613672 [ Mac ] fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ]
...@@ -2260,6 +2261,7 @@ crbug.com/613672 [ Mac ] fast/events/touch/gesture/touch-gesture-scroll-page-pas ...@@ -2260,6 +2261,7 @@ crbug.com/613672 [ Mac ] fast/events/touch/gesture/touch-gesture-scroll-page-pas
crbug.com/613672 [ Mac ] fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ] crbug.com/613672 [ Mac ] fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ]
crbug.com/613672 [ Mac ] fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ] crbug.com/613672 [ Mac ] fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scroll.html [ Skip ] crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scroll.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scroll-by-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ] crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ] crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ] crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ]
...@@ -2278,6 +2280,7 @@ crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture ...@@ -2278,6 +2280,7 @@ crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture
crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ] crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ] crbug.com/613672 [ Mac ] virtual/mouseevent_fractional/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scroll.html [ Skip ] crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scroll.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scroll-by-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ] crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ] crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ] crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ]
...@@ -2296,6 +2299,7 @@ crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/ ...@@ -2296,6 +2299,7 @@ crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/
crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ] crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ] crbug.com/613672 [ Mac ] virtual/scroll_customization/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scroll.html [ Skip ] crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scroll.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scroll-by-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ] crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scrollbar-touchpad-fling.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ] crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scrollbar-touchscreen-fling.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ] crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ]
...@@ -2314,6 +2318,7 @@ crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/to ...@@ -2314,6 +2318,7 @@ crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/to
crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ] crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/touch-gesture-scroll-page-zoomed.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ] crbug.com/613672 [ Mac ] virtual/user-activation-v2/fast/events/touch/gesture/touch-gesture-scroll-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scroll.html [ Skip ] crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scroll.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scroll-by-page.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ] crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scrollbar-mainframe.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scrollbar.html [ Skip ] crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/gesture-scrollbar.html [ Skip ]
crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/touch-gesture-noscroll-body-xhidden.html [ Skip ] crbug.com/613672 [ Mac ] virtual/paint-touchaction-rects/fast/events/touch/gesture/touch-gesture-noscroll-body-xhidden.html [ Skip ]
......
This tests gesture scrolling by pages.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.scrollingElement.scrollTop >= window.innerHeight * 0.875 * 2 became true
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <!DOCTYPE html>
<html> <script src="../../../../resources/testharness.js"></script>
<head> <script src="../../../../resources/testharnessreport.js"></script>
<script src="../../../../resources/js-test.js"></script> <script src="../../../../resources/gesture-util.js"></script>
<style type="text/css"> <style type="text/css">
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0px; width: 0px;
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
} }
</style> </style>
</head>
<body style="margin:0" onload="runTest();"> <body style="margin:0">
<div id="greenbox"></div> <div id="greenbox"></div>
<div id="redbox"></div> <div id="redbox"></div>
...@@ -29,32 +29,20 @@ ...@@ -29,32 +29,20 @@
<p id="description"></p> <p id="description"></p>
<div id="console"></div> <div id="console"></div>
<script type="text/javascript"> <script type="text/javascript">
// Turn on smooth scrolling.
internals.settings.setScrollAnimatorEnabled(true);
function gestureScroll() var x = 30;
{ var y = 30;
eventSender.gestureScrollBegin("touchpad", 10, 20); var mouse_input = GestureSourceType.MOUSE_INPUT;
eventSender.gestureScrollUpdate("touchpad", 0, -1, "Page");
eventSender.gestureScrollUpdate("touchpad", 0, -2, "Page");
eventSender.gestureScrollUpdate("touchpad", 0, 1, "Page");
eventSender.gestureScrollEnd("touchpad", 0, 0);
// see kMinFractionToStepWhenPaging in ScrollableArea.cppP
// 2 is the expected number of pages scrolled (-1 + -2 + 1)
shouldBecomeEqual("document.scrollingElement.scrollTop >= window.innerHeight * 0.875 * 2", "true", finishJSTest, 1000);
}
jsTestIsAsync = true; promise_test (async () => {
await smoothScroll(1, x, y, mouse_input, 'down', SPEED_INSTANT, false, true);
await smoothScroll(1, x, y, mouse_input, 'down', SPEED_INSTANT, false, true);
await waitFor(() => {
return document.scrollingElement.scrollTop >= window.innerHeight * 0.875 * 2; })
});
function runTest()
{
if (window.eventSender) {
description('This tests gesture scrolling by pages.');
gestureScroll();
} else {
debug("This test requires DumpRenderTree. Gesture-scroll the page to validate the implementation.");
}
}
</script> </script>
</body> </body>
</html>
...@@ -89,7 +89,7 @@ const GestureSourceType = { ...@@ -89,7 +89,7 @@ const GestureSourceType = {
// the synthetic gesture code modified to guarantee the single update behavior. // the synthetic gesture code modified to guarantee the single update behavior.
const SPEED_INSTANT = 200000; const SPEED_INSTANT = 200000;
function smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type, direction, speed_in_pixels_s) { function smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type, direction, speed_in_pixels_s, precise_scrolling_deltas, scroll_by_page) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (chrome && chrome.gpuBenchmarking) { if (chrome && chrome.gpuBenchmarking) {
chrome.gpuBenchmarking.smoothScrollBy(pixels_to_scroll, chrome.gpuBenchmarking.smoothScrollBy(pixels_to_scroll,
...@@ -98,7 +98,9 @@ function smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type, d ...@@ -98,7 +98,9 @@ function smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type, d
start_y, start_y,
gesture_source_type, gesture_source_type,
direction, direction,
speed_in_pixels_s); speed_in_pixels_s,
precise_scrolling_deltas,
scroll_by_page);
} else { } else {
reject('This test requires chrome.gpuBenchmarking'); reject('This test requires chrome.gpuBenchmarking');
} }
......
...@@ -44,6 +44,7 @@ It should not be possible to scroll this content:<br> ...@@ -44,6 +44,7 @@ It should not be possible to scroll this content:<br>
50 /* start_y */, 50 /* start_y */,
GESTURE_SOURCE_TYPE, GESTURE_SOURCE_TYPE,
'down', 'down',
20000 /* speed */); 20000 /* speed */,
false /* precise_scrolling_deltas */);
}); });
</script> </script>
...@@ -502,6 +502,8 @@ blink::WebMouseWheelEvent MakeWebMouseWheelEventFromUiEvent( ...@@ -502,6 +502,8 @@ blink::WebMouseWheelEvent MakeWebMouseWheelEventFromUiEvent(
if (event.flags() & ui::EF_PRECISION_SCROLLING_DELTA) if (event.flags() & ui::EF_PRECISION_SCROLLING_DELTA)
webkit_event.has_precise_scrolling_deltas = true; webkit_event.has_precise_scrolling_deltas = true;
if (event.flags() & ui::EF_SCROLL_BY_PAGE)
webkit_event.scroll_by_page = true;
webkit_event.wheel_ticks_x = webkit_event.wheel_ticks_x =
webkit_event.delta_x / MouseWheelEvent::kWheelDelta; webkit_event.delta_x / MouseWheelEvent::kWheelDelta;
......
...@@ -153,6 +153,9 @@ enum MouseEventFlags { ...@@ -153,6 +153,9 @@ enum MouseEventFlags {
EF_PRECISION_SCROLLING_DELTA = // Indicates this mouse event is from high EF_PRECISION_SCROLLING_DELTA = // Indicates this mouse event is from high
1 << 21, // precision touchpad and will come with a 1 << 21, // precision touchpad and will come with a
// high precision delta. // high precision delta.
EF_SCROLL_BY_PAGE = 1 << 22, // Indicates this mouse event is generated
// when users is requesting to scroll by
// pages.
}; };
// Result of dispatching an event. // Result of dispatching an event.
......
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