Commit c2dc689c authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Automation API hit test should automatically convert to integer coordinates.

The automation API specifies the hit test coordinates should be
integers which is fine since there's no reason for sub-pixel
precision.

However, it crashes if you pass it a non-integer, which is not good!
It should just convert to an integer.

BUG=725159
TBR=aboxhall

Review-Url: https://codereview.chromium.org/2900803003
Cr-Commit-Position: refs/heads/master@{#473960}
parent 8ed54359
......@@ -398,8 +398,8 @@ AutomationNodeImpl.prototype = {
// Convert from global to tree-relative coordinates.
var location = GetLocation(this.treeID, GetRootID(this.treeID));
this.performAction_('hitTest',
{ x: x - location.left,
y: y - location.top,
{ x: Math.floor(x - location.left),
y: Math.floor(y - location.top),
eventToFire: eventToFire });
},
......
......@@ -21,6 +21,8 @@
</head>
<body>
<button>Hit Test 1</button>
<button>Hit Test 2</button>
<h1>
<button>Hit Test 2</button>
</h1>
</body>
</html>
......@@ -20,10 +20,8 @@ var allTests = [
button.addEventListener(EventType.ALERT, function() {
chrome.test.succeed();
}, true);
var cx = Math.floor(
button.location.left + button.location.width / 2);
var cy = Math.floor(
button.location.top + button.location.height / 2);
var cx = button.location.left + button.location.width / 2;
var cy = button.location.top + button.location.height / 2;
desktop.hitTest(cx, cy, EventType.ALERT);
}
}
......
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