Commit 4d2507c0 authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Use wheelTick in events/mouse-event-buttons-attribute.html

After we finish the scroll unification, the scrolls happens mainly on
the compositor thread, and the scroll code in the main thread will be
removed. eventSender sends the scroll events to main thread, so it
would not work after the scroll unification. This CL we should replace
eventSender.mouseScrollBy with wheelTick which uses
gpuBenchmarking.smoothScrollByXY in
events/mouse-event-buttons-attribute.html.

Bug: 1047176
Change-Id: Ife50b732a6ec0733e84b034c07565a4a5138b51a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2173614
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790142}
parent dad9827b
......@@ -39,30 +39,19 @@ float GetCurvedRatio(const base::TimeTicks& current,
(kMaxArctan - kMinArctan);
}
const int kDefaultSpeedInPixelsPerSec = 800;
} // namespace
SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams()
: speed_in_pixels_s(kDefaultSpeedInPixelsPerSec),
fling_velocity_x(0),
fling_velocity_y(0),
prevent_fling(true),
add_slop(true),
granularity(ui::ScrollGranularity::kScrollByPixel),
key_modifiers(0) {}
SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams() = default;
SyntheticSmoothMoveGestureParams::SyntheticSmoothMoveGestureParams(
const SyntheticSmoothMoveGestureParams& other) = default;
SyntheticSmoothMoveGestureParams::~SyntheticSmoothMoveGestureParams() {}
SyntheticSmoothMoveGestureParams::~SyntheticSmoothMoveGestureParams() = default;
SyntheticSmoothMoveGesture::SyntheticSmoothMoveGesture(
SyntheticSmoothMoveGestureParams params)
: params_(params),
current_move_segment_start_position_(params.start_point),
state_(SETUP),
needs_scroll_begin_(true) {}
current_move_segment_start_position_(params.start_point) {}
SyntheticSmoothMoveGesture::~SyntheticSmoothMoveGesture() {}
......@@ -178,7 +167,7 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelInputEvents(
needs_scroll_begin_ ? blink::WebMouseWheelEvent::kPhaseBegan
: blink::WebMouseWheelEvent::kPhaseChanged;
ForwardMouseWheelEvent(target, delta, phase, event_timestamp,
params_.key_modifiers);
params_.modifiers);
current_move_segment_total_delta_ += delta;
needs_scroll_begin_ = false;
}
......@@ -199,7 +188,7 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelInputEvents(
// Forward a wheel event with phase ended and zero deltas.
ForwardMouseWheelEvent(target, gfx::Vector2d(),
blink::WebMouseWheelEvent::kPhaseEnded,
event_timestamp, params_.key_modifiers);
event_timestamp, params_.modifiers);
}
needs_scroll_begin_ = true;
}
......@@ -269,10 +258,10 @@ void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent(
const gfx::Vector2dF& delta,
const blink::WebMouseWheelEvent::Phase phase,
const base::TimeTicks& timestamp,
int key_modifiers) const {
int modifiers) const {
blink::WebMouseWheelEvent mouse_wheel_event =
blink::SyntheticWebMouseWheelEventBuilder::Build(
0, 0, delta.x(), delta.y(), key_modifiers, params_.granularity);
0, 0, delta.x(), delta.y(), modifiers, params_.granularity);
mouse_wheel_event.SetPositionInWidget(
current_move_segment_start_position_.x(),
......
......@@ -35,14 +35,14 @@ class CONTENT_EXPORT SyntheticSmoothMoveGestureParams {
InputType input_type;
gfx::PointF start_point;
std::vector<gfx::Vector2dF> distances;
int speed_in_pixels_s;
int fling_velocity_x;
int fling_velocity_y;
bool prevent_fling;
bool add_slop;
ui::ScrollGranularity granularity;
int speed_in_pixels_s = SyntheticGestureParams::kDefaultSpeedInPixelsPerSec;
int fling_velocity_x = 0;
int fling_velocity_y = 0;
bool prevent_fling = true;
bool add_slop = true;
ui::ScrollGranularity granularity = ui::ScrollGranularity::kScrollByPixel;
// A bitfield of values from blink::WebInputEvent::Modifiers.
int key_modifiers;
int modifiers = 0;
};
// This class is used as helper class for simulation of scroll and drag.
......@@ -83,7 +83,7 @@ class CONTENT_EXPORT SyntheticSmoothMoveGesture : public SyntheticGesture {
const gfx::Vector2dF& delta,
const blink::WebMouseWheelEvent::Phase phase,
const base::TimeTicks& timestamp,
int key_modifiers) const;
int modifiers) const;
void ForwardFlingGestureEvent(SyntheticGestureTarget* target,
const blink::WebInputEvent::Type type) const;
......@@ -110,12 +110,12 @@ class CONTENT_EXPORT SyntheticSmoothMoveGesture : public SyntheticGesture {
gfx::Vector2dF current_move_segment_total_delta_;
// Used for touch input.
gfx::PointF current_move_segment_start_position_;
GestureState state_;
GestureState state_ = SETUP;
int current_move_segment_;
base::TimeTicks current_move_segment_start_time_;
base::TimeTicks current_move_segment_stop_time_;
// Used to set phase information for synthetic wheel events.
bool needs_scroll_begin_;
bool needs_scroll_begin_ = true;
DISALLOW_COPY_AND_ASSIGN(SyntheticSmoothMoveGesture);
};
......
......@@ -11,8 +11,7 @@ SyntheticSmoothScrollGesture::SyntheticSmoothScrollGesture(
: params_(params) {
}
SyntheticSmoothScrollGesture::~SyntheticSmoothScrollGesture() {
}
SyntheticSmoothScrollGesture::~SyntheticSmoothScrollGesture() = default;
SyntheticGesture::Result SyntheticSmoothScrollGesture::ForwardInputEvents(
const base::TimeTicks& timestamp,
......@@ -58,8 +57,8 @@ bool SyntheticSmoothScrollGesture::InitializeMoveGesture(
move_params.input_type = GetInputSourceType(gesture_type);
move_params.add_slop = true;
move_params.granularity = params_.granularity;
move_params.key_modifiers = params_.key_modifiers;
move_gesture_.reset(new SyntheticSmoothMoveGesture(move_params));
move_params.modifiers = params_.modifiers;
move_gesture_ = std::make_unique<SyntheticSmoothMoveGesture>(move_params);
return true;
}
return false;
......
......@@ -48,6 +48,8 @@ struct CONTENT_EXPORT SyntheticGestureParams {
SYNTHETIC_GESTURE_TYPE_MAX = POINTER_ACTION_LIST
};
static constexpr int kDefaultSpeedInPixelsPerSec = 800;
virtual GestureType GetGestureType() const = 0;
// Returns true if the specific gesture source type is supported on this
......
......@@ -7,15 +7,8 @@
#include "base/check_op.h"
namespace content {
namespace {
const float kDefaultSpeedInPixelsPerSec = 800;
} // namespace
SyntheticSmoothDragGestureParams::SyntheticSmoothDragGestureParams()
: speed_in_pixels_s(kDefaultSpeedInPixelsPerSec) {
}
SyntheticSmoothDragGestureParams::SyntheticSmoothDragGestureParams() = default;
SyntheticSmoothDragGestureParams::SyntheticSmoothDragGestureParams(
const SyntheticSmoothDragGestureParams& other)
......@@ -25,8 +18,7 @@ SyntheticSmoothDragGestureParams::SyntheticSmoothDragGestureParams(
speed_in_pixels_s(other.speed_in_pixels_s) {
}
SyntheticSmoothDragGestureParams::~SyntheticSmoothDragGestureParams() {
}
SyntheticSmoothDragGestureParams::~SyntheticSmoothDragGestureParams() = default;
SyntheticGestureParams::GestureType
SyntheticSmoothDragGestureParams::GetGestureType() const {
......
......@@ -26,7 +26,7 @@ struct CONTENT_EXPORT SyntheticSmoothDragGestureParams
gfx::PointF start_point;
std::vector<gfx::Vector2dF> distances;
float speed_in_pixels_s;
float speed_in_pixels_s = SyntheticGestureParams::kDefaultSpeedInPixelsPerSec;
static const SyntheticSmoothDragGestureParams* Cast(
const SyntheticGestureParams* gesture_params);
......
......@@ -7,24 +7,15 @@
#include "base/check_op.h"
namespace content {
namespace {
const float kDefaultSpeedInPixelsS = 800;
} // namespace
SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams()
: prevent_fling(true),
speed_in_pixels_s(kDefaultSpeedInPixelsS),
fling_velocity_x(0),
fling_velocity_y(0),
granularity(ui::ScrollGranularity::kScrollByPixel),
key_modifiers(0) {}
SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams() =
default;
SyntheticSmoothScrollGestureParams::SyntheticSmoothScrollGestureParams(
const SyntheticSmoothScrollGestureParams& other) = default;
SyntheticSmoothScrollGestureParams::~SyntheticSmoothScrollGestureParams() {}
SyntheticSmoothScrollGestureParams::~SyntheticSmoothScrollGestureParams() =
default;
SyntheticGestureParams::GestureType
SyntheticSmoothScrollGestureParams::GetGestureType() const {
......
......@@ -27,13 +27,13 @@ struct CONTENT_EXPORT SyntheticSmoothScrollGestureParams
gfx::PointF anchor;
std::vector<gfx::Vector2dF> distances; // Positive X/Y to scroll left/up.
bool prevent_fling; // Defaults to true.
float speed_in_pixels_s;
float fling_velocity_x;
float fling_velocity_y;
ui::ScrollGranularity granularity;
bool prevent_fling = true; // Defaults to true.
float speed_in_pixels_s = SyntheticGestureParams::kDefaultSpeedInPixelsPerSec;
float fling_velocity_x = 0;
float fling_velocity_y = 0;
ui::ScrollGranularity granularity = ui::ScrollGranularity::kScrollByPixel;
// A bitfield of values from blink::WebInputEvent::Modifiers.
int key_modifiers;
int modifiers = 0;
static const SyntheticSmoothScrollGestureParams* Cast(
const SyntheticGestureParams* gesture_params);
......
......@@ -71,7 +71,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams)
IPC_STRUCT_TRAITS_MEMBER(fling_velocity_x)
IPC_STRUCT_TRAITS_MEMBER(fling_velocity_y)
IPC_STRUCT_TRAITS_MEMBER(granularity)
IPC_STRUCT_TRAITS_MEMBER(key_modifiers)
IPC_STRUCT_TRAITS_MEMBER(modifiers)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams)
......
......@@ -319,6 +319,21 @@ int ToKeyModifiers(const base::StringPiece& key) {
return 0;
}
int ToButtonModifiers(const base::StringPiece& button) {
if (button == "Left")
return blink::WebMouseEvent::kLeftButtonDown;
if (button == "Middle")
return blink::WebMouseEvent::kMiddleButtonDown;
if (button == "Right")
return blink::WebMouseEvent::kRightButtonDown;
if (button == "Back")
return blink::WebMouseEvent::kBackButtonDown;
if (button == "Forward")
return blink::WebMouseEvent::kForwardButtonDown;
NOTREACHED() << "invalid button modifier";
return 0;
}
// BeginSmoothScroll takes pixels_to_scroll_x and pixels_to_scroll_y, positive
// pixels_to_scroll_y means scroll down, positive pixels_to_scroll_x means
// scroll right.
......@@ -337,7 +352,7 @@ bool BeginSmoothScroll(GpuBenchmarkingContext* context,
bool scroll_by_page,
bool cursor_visible,
bool scroll_by_percentage,
int key_modifiers) {
int modifiers) {
DCHECK(!(precise_scrolling_deltas && scroll_by_page));
DCHECK(!(precise_scrolling_deltas && scroll_by_percentage));
DCHECK(!(scroll_by_page && scroll_by_percentage));
......@@ -351,8 +366,7 @@ bool BeginSmoothScroll(GpuBenchmarkingContext* context,
// trigger any hover or mousemove effects.
context->web_view()->SetIsActive(true);
blink::WebMouseEvent mouseMove(blink::WebInputEvent::Type::kMouseMove,
blink::WebInputEvent::kNoModifiers,
ui::EventTimeForNow());
modifiers, ui::EventTimeForNow());
mouseMove.SetPositionInWidget(start_x, start_y);
CHECK(context->web_view()->MainFrameWidget());
context->web_view()->MainFrameWidget()->HandleInputEvent(
......@@ -400,7 +414,7 @@ bool BeginSmoothScroll(GpuBenchmarkingContext* context,
gesture_params.fling_velocity_y = fling_velocity.y();
gesture_params.distances.push_back(-pixels_to_scroll);
gesture_params.key_modifiers = key_modifiers;
gesture_params.modifiers = modifiers;
injector->QueueSyntheticSmoothScroll(
gesture_params, base::BindOnce(&OnSyntheticGestureCompleted,
......@@ -743,7 +757,7 @@ bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) {
if (!pixels_to_scrol_vector.has_value())
return false;
gfx::Vector2dF fling_velocity(0, 0);
int key_modifiers = 0;
int modifiers = 0;
std::vector<base::StringPiece> key_list = base::SplitStringPiece(
keys_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (const base::StringPiece& key : key_list) {
......@@ -751,7 +765,7 @@ bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) {
if (key_modifier == 0) {
return false;
}
key_modifiers |= key_modifier;
modifiers |= key_modifier;
}
EnsureRemoteInterface();
......@@ -759,7 +773,7 @@ bool GpuBenchmarking::SmoothScrollBy(gin::Arguments* args) {
&context, args, input_injector_, pixels_to_scrol_vector.value(), callback,
gesture_source_type, speed_in_pixels_s, true /* prevent_fling */, start_x,
start_y, fling_velocity, precise_scrolling_deltas, scroll_by_page,
cursor_visible, scroll_by_percentage, key_modifiers);
cursor_visible, scroll_by_percentage, modifiers);
}
// SmoothScrollByXY does not take direction as one of the arguments, and
......@@ -782,7 +796,14 @@ bool GpuBenchmarking::SmoothScrollByXY(gin::Arguments* args) {
bool scroll_by_page = false;
bool cursor_visible = true;
bool scroll_by_percentage = false;
// It should be one or multiple values in the |Modifiers| in the function
// ToKeyModifiers, multiple values are expressed as a string
// separated by comma.
std::string keys_value;
// It should be one or multiple values in the |Buttons| in the function
// ToButtonModifiers, multiple values are expressed as a string separated by
// comma.
std::string buttons_value;
if (!GetOptionalArg(args, &pixels_to_scroll_x) ||
!GetOptionalArg(args, &pixels_to_scroll_y) ||
......@@ -794,7 +815,8 @@ bool GpuBenchmarking::SmoothScrollByXY(gin::Arguments* args) {
!GetOptionalArg(args, &scroll_by_page) ||
!GetOptionalArg(args, &cursor_visible) ||
!GetOptionalArg(args, &scroll_by_percentage) ||
!GetOptionalArg(args, &keys_value)) {
!GetOptionalArg(args, &keys_value) ||
!GetOptionalArg(args, &buttons_value)) {
return false;
}
......@@ -810,7 +832,7 @@ bool GpuBenchmarking::SmoothScrollByXY(gin::Arguments* args) {
gfx::Vector2dF distances(pixels_to_scroll_x, pixels_to_scroll_y);
gfx::Vector2dF fling_velocity(0, 0);
int key_modifiers = 0;
int modifiers = 0;
std::vector<base::StringPiece> key_list = base::SplitStringPiece(
keys_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (const base::StringPiece& key : key_list) {
......@@ -818,7 +840,17 @@ bool GpuBenchmarking::SmoothScrollByXY(gin::Arguments* args) {
if (key_modifier == 0) {
return false;
}
key_modifiers |= key_modifier;
modifiers |= key_modifier;
}
std::vector<base::StringPiece> button_list = base::SplitStringPiece(
buttons_value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (const base::StringPiece& button : button_list) {
int button_modifier = ToButtonModifiers(button);
if (button_modifier == 0) {
return false;
}
modifiers |= button_modifier;
}
EnsureRemoteInterface();
......@@ -826,7 +858,7 @@ bool GpuBenchmarking::SmoothScrollByXY(gin::Arguments* args) {
&context, args, input_injector_, distances, callback, gesture_source_type,
speed_in_pixels_s, true /* prevent_fling */, start_x, start_y,
fling_velocity, precise_scrolling_deltas, scroll_by_page, cursor_visible,
scroll_by_percentage, key_modifiers);
scroll_by_percentage, modifiers);
}
bool GpuBenchmarking::SmoothDrag(gin::Arguments* args) {
......@@ -904,7 +936,7 @@ bool GpuBenchmarking::Swipe(gin::Arguments* args) {
false /* prevent_fling */, start_x, start_y,
fling_velocity_vector.value(), true /* precise_scrolling_deltas */,
false /* scroll_by_page */, true /* cursor_visible */,
false /* scroll_by_percentage */, 0 /* key_modifiers */);
false /* scroll_by_percentage */, 0 /* modifiers */);
}
bool GpuBenchmarking::ScrollBounce(gin::Arguments* args) {
......
PASS successfullyParsed is true
TEST COMPLETE
===== doubleClickAction with initial state=[] =====
1. targetDiv received mouseover buttons: 0
2. targetDiv received mouseenter buttons: 0
......@@ -217,3 +213,7 @@ TEST COMPLETE
24. targetDiv received mouseleave buttons: 6
PASS successfullyParsed is true
TEST COMPLETE
......@@ -18,14 +18,15 @@
<img id="drag" src="resources/greenbox30.png" draggable>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/gesture-util.js"></script>
<script>
jsTestIsAsync = true;
const L = 'leftButton';
const R = 'rightButton';
const M = 'middleButton';
var seqNo = 0;
var testSet = [
let seqNo = 0;
let testSet = [
{ initialButtons: [], action: doubleClickAction },
{ initialButtons: [R], action: clickAction },
{ initialButtons: [M, R], action: clickAction },
......@@ -73,10 +74,25 @@ function doubleClickAction()
eventSender.mouseUp(0);
}
function wheelAction()
async function wheelAction(initialButtons)
{
moveAction();
eventSender.mouseScrollBy(0, 120, false, true);
let targetDiv = document.getElementById('target');
let buttons = [];
initialButtons.forEach(function(item) {
if (item == L)
buttons.push(Buttons.LEFT);
else if (item == R)
buttons.push(Buttons.RIGHT);
else if (item == M)
buttons.push(Buttons.Middle);
})
let scroller_target = elementCenter(targetDiv);
await smoothScrollWithXY(0, 1, scroller_target.x, scroller_target.y,
GestureSourceType.MOUSE_INPUT, SPEED_INSTANT,
true /* precise_scrolling_deltas */,
false /* scroll_by_page */, true /* cursor_visible */,
false /* scroll_by_percentage */,
"" /* modifier_keys */, buttons.join(','));
}
function tapAction()
......@@ -113,7 +129,7 @@ function dragDropAction()
function printTestInfo(testItem)
{
var showContextMenuOnMouseUp = "";
let showContextMenuOnMouseUp = "";
if (testItem.showContextMenuOnMouseUp != undefined)
showContextMenuOnMouseUp = "and showContextMenuOnMouseUp=" +
testItem.showContextMenuOnMouseUp + " ";
......@@ -123,9 +139,9 @@ function printTestInfo(testItem)
}
function init() {
var targetDiv = document.getElementById('target');
var dragImg = document.getElementById('drag');
var eventList = ['dblclick', 'click', 'mousedown', 'mouseup', 'mousemove', 'mouseenter', 'mouseleave', 'mouseover', 'mouseout', 'mousewheel', 'dragstart', 'dragend', 'dragenter', 'dragleave', 'dragover', 'drag', 'contextmenu'];
let targetDiv = document.getElementById('target');
let dragImg = document.getElementById('drag');
let eventList = ['dblclick', 'click', 'mousedown', 'mouseup', 'mousemove', 'mouseenter', 'mouseleave', 'mouseover', 'mouseout', 'mousewheel', 'dragstart', 'dragend', 'dragenter', 'dragleave', 'dragover', 'drag', 'contextmenu'];
eventList.forEach(function(eventName) {
targetDiv.addEventListener(eventName, function(event) {
debug(++seqNo + ". targetDiv received " + event.type + " buttons: " + event.buttons);
......@@ -136,29 +152,27 @@ function init() {
});
}
window.onload=function() {
window.onload=async function() {
init();
if(window.eventSender) {
for (var i = 0; i < testSet.length; i++) {
printTestInfo(testSet[i]);
// Reset the state for the new test
seqNo = 0;
eventSender.setMouseButtonState(-1, testSet[i].initialButtons);
internals.settings.setShowContextMenuOnMouseUp(testSet[i].showContextMenuOnMouseUp);
for (let i = 0; i < testSet.length; i++) {
printTestInfo(testSet[i]);
testSet[i].action();
// Reset the state for the new test
seqNo = 0;
eventSender.setMouseButtonState(-1, testSet[i].initialButtons);
internals.settings.setShowContextMenuOnMouseUp(testSet[i].showContextMenuOnMouseUp);
// Reset the mouse position
await testSet[i].action(testSet[i].initialButtons);
// Reset the mouse position
if(window.eventSender)
eventSender.mouseMoveTo(-1, -1);
debug('');
}
debug('');
}
}
if (!window.eventSender) {
debug("This test requires eventSender");
finishJSTest();
}
</script>
......@@ -180,7 +180,7 @@ const GestureSourceType = (function() {
})();
// Enums used as input to the |modifier_keys| parameters of methods in this
// file like smoothScroll and wheelTick.
// file like smoothScrollWithXY and wheelTick.
const Modifiers = (function() {
return {
ALT: "Alt",
......@@ -193,6 +193,18 @@ const Modifiers = (function() {
}
})();
// Enums used as input to the |modifier_buttons| parameters of methods in this
// file like smoothScrollWithXY and wheelTick.
const Buttons = (function() {
return {
LEFT: "Left",
MIDDLE: "Middle",
RIGHT: "Right",
BACK: "Back",
FORWARD: "Forward",
}
})();
// Use this for speed to make gestures (effectively) instant. That is, finish
// entirely within one Begin|Update|End triplet. This is in physical
// pixels/second.
......@@ -202,9 +214,7 @@ const Modifiers = (function() {
// https://crbug.com/893608
const SPEED_INSTANT = 400000;
// modifier_keys means the keys pressed while doing the mouse wheel scroll, it
// should be one of the values in the |Modifiers| or a comma separated string
// to specify multiple values.
// This will be replaced by smoothScrollWithXY.
function smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type,
direction, speed_in_pixels_s, precise_scrolling_deltas,
scroll_by_page, cursor_visible, scroll_by_percentage,
......@@ -252,10 +262,14 @@ function percentScroll(percent_to_scroll_x, percent_to_scroll_y, start_x, start_
// modifier_keys means the keys pressed while doing the mouse wheel scroll, it
// should be one of the values in the |Modifiers| or a comma separated string
// to specify multiple values.
// modifier_buttons means the mouse buttons pressed while doing the mouse wheel
// scroll, it should be one of the values in the |Buttons| or a comma separated
// string to specify multiple values.
function smoothScrollWithXY(pixels_to_scroll_x, pixels_to_scroll_y, start_x,
start_y, gesture_source_type, speed_in_pixels_s,
precise_scrolling_deltas, scroll_by_page,
cursor_visible, scroll_by_percentage, modifier_keys) {
cursor_visible, scroll_by_percentage, modifier_keys,
modifier_buttons) {
return new Promise((resolve, reject) => {
if (window.chrome && chrome.gpuBenchmarking) {
chrome.gpuBenchmarking.smoothScrollByXY(pixels_to_scroll_x,
......@@ -269,7 +283,8 @@ function smoothScrollWithXY(pixels_to_scroll_x, pixels_to_scroll_y, start_x,
scroll_by_page,
cursor_visible,
scroll_by_percentage,
modifier_keys);
modifier_keys,
modifier_buttons);
} else {
reject('This test requires chrome.gpuBenchmarking');
}
......@@ -279,7 +294,11 @@ function smoothScrollWithXY(pixels_to_scroll_x, pixels_to_scroll_y, start_x,
// modifier_keys means the keys pressed while doing the mouse wheel scroll, it
// should be one of the values in the |Modifiers| or a comma separated string
// to specify multiple values.
function wheelTick(scroll_tick_x, scroll_tick_y, center, speed_in_pixels_s, modifier_keys) {
// modifier_buttons means the mouse buttons pressed while doing the mouse wheel
// scroll, it should be one of the values in the |Buttons| or a comma separated
// string to specify multiple values.
function wheelTick(scroll_tick_x, scroll_tick_y, center, speed_in_pixels_s,
modifier_keys, modifier_buttons) {
if (typeof(speed_in_pixels_s) == "undefined")
speed_in_pixels_s = SPEED_INSTANT;
// Do not allow precise scrolling deltas for tick wheel scroll.
......@@ -288,7 +307,8 @@ function wheelTick(scroll_tick_x, scroll_tick_y, center, speed_in_pixels_s, modi
center.x, center.y, GestureSourceType.MOUSE_INPUT,
speed_in_pixels_s, false /* precise_scrolling_deltas */,
false /* scroll_by_page */, true /* cursor_visible */,
false /* precise_scrolling_deltas */, modifier_keys);
false /* scroll_by_percentage */, modifier_keys,
modifier_buttons);
}
const LEGACY_MOUSE_WHEEL_TICK_MULTIPLIER = 120;
......
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