fune/testing/web-platform/tests/css/css-transforms/transform-scale-hittest.html
Xiaocheng Hu 30f2829795 Bug 1738145 [wpt PR 31408] - Fix WPT transform-scale-hittest.html, a=testonly
Automatic update from web-platform-tests
Fix WPT transform-scale-hittest.html

This WPT test was introduced as a regression test for crbug.com/1015801. However, its second test case, a subpixel test case tests a non-standard behavior, and it also passes even without the fix to that bug. So this patch turns it into a whole-pixel test to make it spec-compliant.

Change-Id: I351f197310948618f92990e4f739af58d8658b69
Fixed: 1264088
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3247884
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#936087}

--

wpt-commits: 46b8b0fb32938ac71d791f4d788774a8a86af8a0
wpt-pr: 31408
2021-11-02 14:58:10 +00:00

38 lines
1.1 KiB
HTML

<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#propdef-scale">
<link rel="help" href="http://www.w3.org/TR/cssom-view/#extensions-to-the-document-interface">
<link rel="help" href="https://crbug.com/1015801">
<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#normal {
width: 100px;
height: 10px;
position: absolute;
top: 0px;
}
#scaled {
width: 1px;
height: 1px;
transform: scaleX(100) scaleY(100);
transform-origin: 0px 0px;
position: absolute;
top: 10px;
z-index: 1; /* Hit test #scaled before #normal */
}
</style>
<div id=normal></div>
<div id=scaled></div>
<script>
test(() => {
const result = document.elementFromPoint(50, 9);
assert_equals(result, document.getElementById('normal'));
}, 'Hit test within unscaled box');
test(() => {
const result = document.elementFromPoint(50, 10);
assert_equals(result, document.getElementById('scaled'));
}, 'Hit test intersecting scaled box');
</script>