Commit 0c708a5a authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

Revert "Use wheelTick in forms/resources/common-wheel-event.js"

This reverts commit 5cd3140c.

Reason for revert: test failing on win7 bot
https://ci.chromium.org/p/chromium/builders/ci/Win7%20Tests%20%281%29/104437

Original change's description:
> Use wheelTick in forms/resources/common-wheel-event.js
> 
> 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
> forms/resources/common-wheel-event.js.
> 
> Bug: 1047176
> Change-Id: I7416727dfcfbe2d88a283907ee132c838952747e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2171955
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Reviewed-by: David Bokan <bokan@chromium.org>
> Commit-Queue: Lan Wei <lanwei@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#782599}

TBR=ellyjones@chromium.org,avi@chromium.org,sadrul@chromium.org,sky@chromium.org,ccameron@chromium.org,bokan@chromium.org,lanwei@chromium.org

Change-Id: I5348ccf4d638c0c4be96ac111d41a6f45e772a32
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1047176
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2268226Reviewed-by: default avatarElla Ge <eirage@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782687}
parent f5284adf
......@@ -42,8 +42,6 @@ class SyntheticGestureTargetMac : public SyntheticGestureTargetBase {
private:
RenderWidgetHostViewMac* GetView() const;
bool PointIsWithinContents(RenderWidgetHostView* view,
const gfx::PointF& point);
RenderWidgetHostViewCocoa* cocoa_view_;
DISALLOW_COPY_AND_ASSIGN(SyntheticGestureTargetMac);
......
......@@ -141,18 +141,7 @@ void SyntheticGestureTargetMac::DispatchWebMouseWheelEventToPlatform(
web_wheel.delta_x / ui::kScrollbarPixelsPerCocoaTick;
wheel_event.wheel_ticks_y =
web_wheel.delta_y / ui::kScrollbarPixelsPerCocoaTick;
// Manually route the WebMouseWheelEvent to any open popup window if the
// mouse is currently over the pop window, because window-level event routing
// on Mac happens at the OS API level which we cannot easily inject the
// events into.
if (GetView()->PopupChildHostView() &&
PointIsWithinContents(GetView()->PopupChildHostView(),
web_wheel.PositionInWidget())) {
GetView()->PopupChildHostView()->RouteOrProcessWheelEvent(wheel_event);
} else {
GetView()->RouteOrProcessWheelEvent(wheel_event);
}
GetView()->RouteOrProcessWheelEvent(wheel_event);
if (web_wheel.phase == blink::WebMouseWheelEvent::kPhaseEnded) {
// Send the pending wheel end event immediately. Otherwise, the
// MouseWheelPhaseHandler will defer the end event in case of momentum
......@@ -193,13 +182,4 @@ RenderWidgetHostViewMac* SyntheticGestureTargetMac::GetView() const {
return view;
}
bool SyntheticGestureTargetMac::PointIsWithinContents(
RenderWidgetHostView* view,
const gfx::PointF& point) {
gfx::Rect bounds = view->GetViewBounds();
gfx::Rect bounds_in_window =
bounds - bounds.OffsetFromOrigin(); // Translate the bounds to (0,0).
return bounds_in_window.Contains(point.x(), point.y());
}
} // namespace content
......@@ -469,10 +469,6 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
// |cocoa_view_|.
void SetParentAccessibilityElement(id parent_accessibility_element);
RenderWidgetHostViewMac* PopupChildHostView() {
return popup_child_host_view_;
}
MouseWheelPhaseHandler* GetMouseWheelPhaseHandler() override;
protected:
......
......@@ -4,11 +4,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Initial value is 0. We'll wheel up by 1:
PASS input.value is "1"
Wheel up by 3:
Wheel up by 100:
PASS input.value is "2"
Wheel down by 1:
PASS input.value is "1"
Wheel down by 3:
Wheel down by 256:
PASS input.value is "0"
Disabled input element:
PASS input.value is "0"
......
......@@ -2,21 +2,15 @@
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../resources/common-wheel-event.js"></script>
</head>
<body onload="runTest();">
<body>
<script>
async function runTest() {
await testWheelEvent({
'inputType' : 'number',
'initialValue' : '0',
'stepUpValue1' : '1',
'stepUpValue2' : '2' });
finishJSTest();
}
testWheelEvent({
'inputType' : 'number',
'initialValue' : '0',
'stepUpValue1' : '1',
'stepUpValue2' : '2' });
</script>
</body>
</html>
jsTestIsAsync = true;
// Positive deltaX or deltaY means scroll right or down.
async function dispatchWheelEvent(element, deltaX, deltaY)
function dispatchWheelEvent(element, deltaX, deltaY)
{
element_center = elementCenter(element);
await wheelTick(deltaX, deltaY, element_center);
var rect = element.getClientRects()[0]
eventSender.mouseMoveTo(rect.left, rect.top);
eventSender.mouseScrollBy(deltaX, deltaY);
}
var input;
async function testWheelEvent(parameters)
function testWheelEvent(parameters)
{
var inputType = parameters['inputType'];
var initialValue = parameters['initialValue'];
......@@ -22,40 +20,37 @@ async function testWheelEvent(parameters)
input.focus();
debug('Initial value is ' + initialValue + '. We\'ll wheel up by 1:');
await dispatchWheelEvent(input, 0, -1);
dispatchWheelEvent(input, 0, 1);
shouldBeEqualToString('input.value', stepUpValue1);
// We change the selected value in ScrollBegin and the three wheel ticks
// are treated as a single stream with one ScrollBegin, so we increase or
// decrease by one value even though there is more than one wheel tick.
debug('Wheel up by 3:');
await dispatchWheelEvent(input, 0, -3);
debug('Wheel up by 100:');
dispatchWheelEvent(input, 0, 100);
shouldBeEqualToString('input.value', stepUpValue2);
debug('Wheel down by 1:');
await dispatchWheelEvent(input, 0, 1);
dispatchWheelEvent(input, 0, -1);
shouldBeEqualToString('input.value', stepUpValue1);
debug('Wheel down by 3:');
await dispatchWheelEvent(input, 0, 3);
debug('Wheel down by 256:');
dispatchWheelEvent(input, 0, -256);
shouldBeEqualToString('input.value', initialValue);
debug('Disabled input element:');
input.disabled = true;
await dispatchWheelEvent(input, 0, -1);
dispatchWheelEvent(input, 0, 1);
shouldBeEqualToString('input.value', initialValue);
input.removeAttribute('disabled');
debug('Read-only input element:');
input.readOnly = true;
await dispatchWheelEvent(input, 0, -1);
dispatchWheelEvent(input, 0, 1);
shouldBeEqualToString('input.value', initialValue);
input.readOnly = false;
debug('No focus:');
document.getElementById('another').focus();
await dispatchWheelEvent(input, 0, -1);
dispatchWheelEvent(input, 0, 1);
shouldBeEqualToString('input.value', initialValue);
parent.parentNode.removeChild(parent);
......
......@@ -2,7 +2,6 @@
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../../forms/resources/common.js"></script>
<script src="../../forms/resources/common-wheel-event.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
......@@ -130,15 +129,15 @@ function test2() {
waitUntilClosing(test2AfterClosing);
}
async function scrollUp() {
function scrollUp() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, -100);
dispatchWheelEvent(suggestionList, 0, 100);
shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop', 'true', finishTest);
}
async function scrollDown() {
function scrollDown() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, 100);
dispatchWheelEvent(suggestionList, 0, -100);
shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop', 'true', scrollUp);
}
......
......@@ -2,7 +2,6 @@
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../../forms/resources/common.js"></script>
<script src="../../forms/resources/common-wheel-event.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
......@@ -83,15 +82,15 @@ function test2() {
waitUntilClosing(test2AfterClosing);
}
async function scrollUp() {
function scrollUp() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, -100);
shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop', 'true', finishTest);
dispatchWheelEvent(suggestionList, 0, 100);
shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop', 'true', finishTest)
}
async function scrollDown() {
function scrollDown() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, 100);
dispatchWheelEvent(suggestionList, 0, -100);
shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop', 'true', scrollUp);
}
......
......@@ -2,7 +2,6 @@
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../../forms/resources/common.js"></script>
<script src="../../forms/resources/common-wheel-event.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
......@@ -110,15 +109,15 @@ function test2() {
waitUntilClosing(test2AfterClosing);
}
async function scrollUp() {
function scrollUp() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, -100);
dispatchWheelEvent(suggestionList, 0, 100);
shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop', 'true', finishTest)
}
async function scrollDown() {
function scrollDown() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, 100);
dispatchWheelEvent(suggestionList, 0, -100);
shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop', 'true', scrollUp);
}
......
......@@ -2,6 +2,8 @@ Check that page popup doesn't exist at first.
PASS $("mock-page-popup") is null
Check that page popup exists.
PASS popupWindow.pagePopupController.toString() is "[object PagePopupController]"
Check that page popup exists.
PASS popupWindow.pagePopupController.toString() is "[object PagePopupController]"
Check that hovering over an entry highlights it.
PASS highlightedEntry() is "01:02"
Check that moving the mouse outside the popup de-highlights entries.
......
......@@ -2,7 +2,6 @@
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../../forms/resources/common.js"></script>
<script src="../../forms/resources/common-wheel-event.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
......@@ -48,6 +47,9 @@ function test1() {
debug('Check that page popup exists.');
shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]');
debug('Check that page popup exists.');
shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]');
debug('Check that hovering over an entry highlights it.');
hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry:nth-child(2)"));
shouldBeEqualToString('highlightedEntry()', '01:02');
......@@ -83,15 +85,15 @@ function test2() {
waitUntilClosing(test2AfterClosing);
}
async function scrollUp() {
function scrollUp() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, -100);
dispatchWheelEvent(suggestionList, 0, 100);
shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop', 'true', finishTest)
}
async function scrollDown() {
function scrollDown() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, 100);
dispatchWheelEvent(suggestionList, 0, -100);
shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop', 'true', scrollUp);
}
......
CONSOLE WARNING: line 13: The specified value "2012-12-24" does not conform to the required format. The format is "yyyy-Www" where yyyy is year in four or more digits, and ww is 01-53.
Check that page popup doesn't exist at first.
PASS $("mock-page-popup") is null
Check that page popup exists.
......
......@@ -2,7 +2,6 @@
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../../forms/resources/common.js"></script>
<script src="../../forms/resources/common-wheel-event.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
......@@ -11,7 +10,7 @@
<body style="background-color: #bbbbbb;">
<p id="description"></p>
<div id="console"></div>
<input type=week id=week value="2012-W52" list=suggestions>
<input type=week id=week value="2012-12-24" list=suggestions>
<datalist id=suggestions>
<option label="This Week">2012-W01</option>
<option>2012-W02</option>
......@@ -129,15 +128,15 @@ function test2() {
waitUntilClosing(test2AfterClosing);
}
async function scrollUp() {
function scrollUp() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, -100);
dispatchWheelEvent(suggestionList, 0, 100);
shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop', 'true', finishTest)
}
async function scrollDown() {
function scrollDown() {
scrollTopBeforeWheelEvent = suggestionList.scrollTop;
await dispatchWheelEvent(suggestionList, 0, 100);
dispatchWheelEvent(suggestionList, 0, -100);
shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop', 'true', scrollUp);
}
......
......@@ -3,7 +3,6 @@
if (window.internals)
internals.settings.setLangAttributeAwareFormControlUIEnabled(true);
</script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../fast/forms/resources/common.js"></script>
......@@ -14,16 +13,16 @@ if (window.internals)
<script>
let t = async_test('Test scrolling in time picker.');
async function test1() {
function test1() {
let hourColumn = popupWindow.global.picker.timeColumns.firstChild;
const scrollHourTopBeforeWheelEvent = hourColumn.scrollTop;
// scroll up by 2 ticks ~ 2 cells
await dispatchWheelEvent(hourColumn, 0, -2);
dispatchWheelEvent(hourColumn, 0, 2);
let minuteColumn = hourColumn.nextSibling;
const scrollMinuteTopBeforeWheelEvent = minuteColumn.scrollTop;
// scroll up by 3 ticks ~ 3 cells
await dispatchWheelEvent(minuteColumn, 0, -3);
dispatchWheelEvent(minuteColumn, 0, 3);
t.step_timeout(function() {
// verify that both columns have been scrolled up.
......
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