Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| diff --git a/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js b/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| index 9c23f183731dd5c6bcdfe158d5a8092479f11ed4..0d47029ae93c261ab5a0318fb895d927ed59070b 100644 |
| --- a/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| +++ b/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js |
| @@ -58,30 +58,35 @@ function mouseScrollLeft() { |
| function touchTapInTarget(targetId) { |
| if (window.chrome && chrome.gpuBenchmarking) { |
| var target = document.getElementById(targetId); |
| + target.scrollIntoViewIfNeeded(); |
| var targetRect = target.getBoundingClientRect(); |
| - window.scrollTo(targetRect.left, targetRect.top); |
| - targetRect = target.getBoundingClientRect(); |
| chrome.gpuBenchmarking.tap(targetRect.left+5, targetRect.top+5); |
| } |
| } |
| -function touchScrollUpInTarget(targetId) { |
| +function touchScrollUpInTarget(targetId, needScroll) { |
| if (window.chrome && chrome.gpuBenchmarking) { |
| var target = document.getElementById(targetId); |
| + if (needScroll) |
| + target.scrollIntoViewIfNeeded(); |
| var targetRect = target.getBoundingClientRect(); |
| - window.scrollTo(targetRect.left, targetRect.top); |
| - targetRect = target.getBoundingClientRect(); |
| - chrome.gpuBenchmarking.smoothDrag(targetRect.left, targetRect.bottom-5, targetRect.left, targetRect.top+5); |
| + chrome.gpuBenchmarking.smoothDrag(targetRect.left+10, targetRect.top+targetRect.height/2, targetRect.left+10, targetRect.top+10); |
| } |
| } |
| -function touchScrollLeftInTarget(targetId) { |
| +function touchScrollLeftInTarget(targetId, needScroll, callback_func) { |
| if (window.chrome && chrome.gpuBenchmarking) { |
| var target = document.getElementById(targetId); |
| + if (needScroll) |
| + target.scrollIntoViewIfNeeded(); |
|
Navid Zolghadr
2016/07/21 21:18:15
Does anything go wrong if we always scrollIntoView
lanwei
2016/07/28 04:48:23
I do not know why for some test pages, even I use
|
| var targetRect = target.getBoundingClientRect(); |
| - window.scrollTo(targetRect.left, targetRect.top); |
| - targetRect = target.getBoundingClientRect(); |
| - chrome.gpuBenchmarking.smoothDrag(targetRect.right-5, targetRect.top+5, targetRect.left+5, targetRect.top+5); |
| + chrome.gpuBenchmarking.smoothDrag(targetRect.left+targetRect.width/2, targetRect.top+10, targetRect.left+10, targetRect.top+10, callback_func); |
| + } |
| +} |
| + |
| +function touchScrollByPosition(x, y, offset, direction, callback_function) { |
| + if (window.chrome && chrome.gpuBenchmarking) { |
| + chrome.gpuBenchmarking.smoothScrollBy(offset, callback_function, x, y, 1, direction); |
| } |
| } |
| @@ -100,12 +105,12 @@ function penClickIntoTarget(target) { |
| // Keyboard actions |
| function keyboardScrollUp() { |
| if (window.eventSender) |
| - eventSender.keyDown('downArrow'); |
| + eventSender.keyDown('ArrowDown'); |
| } |
| function keyboardScrollLeft() { |
| if (window.eventSender) |
| - eventSender.keyDown('rightArrow'); |
| + eventSender.keyDown('ArrowRight'); |
| } |
| // Defined in every test |