Files
firefox/testing/web-platform/tests/css/cssom-view/elementFromPoint-subpixel.html
Xiaocheng Hu c2ca8ccb61 Bug 1560843 [wpt PR 17351] - Don't round hit test location in HitTestLocation::RectForPoint, a=testonly
Automatic update from web-platform-tests
Don't round hit test location in HitTestLocation::RectForPoint

HitTestLocation rounds the hit test location to the closest 1x1 rect
for no good reason, causing some confusing hit test results. Hence,
this patch removes such rounding.

Bug: 974314
Change-Id: I48266a7ec8bffbeb746085c5d8835d3f300dd4b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1661297
Reviewed-by: Emil A Eklund <[email protected]>
Reviewed-by: Philip Rogers <[email protected]>
Commit-Queue: Xiaocheng Hu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#669579}

--

wpt-commits: 5689f6b102fa8055740ff66dfe6b8c3b9a808c08
wpt-pr: 17351
2019-07-24 13:29:50 +01:00

60 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>CSSOM View - extensions to the Document interface</title>
<link rel="author" title="Xiaocheng Hu" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/cssom-view/#extensions-to-the-document-interface">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.container {
display: flex;
width: 500px;
height: 100px;
}
.map {
flex: 1 1 auto;
position: relative;
}
.box {
flex: 0 0 auto;
}
.child {
width: 183.66px;
}
</style>
</head>
<body>
<div class="container">
<div class="map"></div>
<div class="box" id="box">
<div class="child"></div>
</div>
</div>
<script>
const box = document.getElementById('box');
const rect = box.getBoundingClientRect();
test(() => {
assert_equals(document.elementFromPoint(rect.x, rect.y), box);
}, 'Hit test top left corner of box');
test(() => {
assert_equals(document.elementFromPoint(rect.x + rect.width - 1, rect.y), box);
}, 'Hit test top right corner of box');
test(() => {
assert_equals(document.elementFromPoint(rect.x, rect.y + rect.height - 1), box);
}, 'Hit test bottom left corner of box');
test(() => {
assert_equals(document.elementFromPoint(rect.x + rect.width - 1, rect.y + rect.height - 1), box);
}, 'Hit test lower left corner of box');
</script>
</body>
</html>