From 8ea96116b7039ac9de822630ea958d21ceb9b90a Mon Sep 17 00:00:00 2001 From: Ella Ge Date: Thu, 4 Apr 2019 13:15:22 -0700 Subject: [PATCH] Fix web_test pointerevent_coordinates_when_locked on wpt The test was failing on WPT[1] because test driver only takes integer coordinates, but the test was using getBoundingClientRect which returns float values. This CL changes the test to set the "origin" for test driver actions so that there is no need to use getBoundingClientRect. [1] https://wpt.fyi/results/pointerevents/pointerlock/pointerevent_coordinates_when_locked.html Change-Id: I56b2c052805b3bc174573564d176d6660accd7cb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1553645 Reviewed-by: Lan Wei Commit-Queue: Ella Ge Cr-Commit-Position: refs/heads/master@{#647877} --- .../pointerlock/pointerevent_coordinates_when_locked.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pointerevents/pointerlock/pointerevent_coordinates_when_locked.html b/pointerevents/pointerlock/pointerevent_coordinates_when_locked.html index 2556e83da10d9b..9dfd5e1764d33d 100644 --- a/pointerevents/pointerlock/pointerevent_coordinates_when_locked.html +++ b/pointerevents/pointerlock/pointerevent_coordinates_when_locked.html @@ -73,15 +73,15 @@ }); var actions = new test_driver.Actions(); - actions.pointerMove(/* x = */ 0, /* y = */ 0, {origin: target}).pointerDown(); + actions.pointerMove(/* x = */ 0, /* y = */ 0, {origin: div1}).pointerDown(); - pos_x = target.getBoundingClientRect().x + target.offsetWidth / 2; - pos_y = target.getBoundingClientRect().y + target.offsetHeight / 2; + pos_x = div1.offsetWidth / 2; + pos_y = div1.offsetHeight / 2; for (var i = 0; i < 10; i++) { // Alternatively move left/right and up/down. pos_x += ((-1)**i) * i * 10; pos_y -= ((-1)**i) * i * 10; - actions.pointerMove(pos_x, pos_y); + actions.pointerMove(pos_x, pos_y, {origin: div1}); } actions.pointerUp().send(); }