OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/js-test.js"></script> | |
3 <script> | |
4 var centerX; | |
5 var centerY; | |
6 function hitTestCenterOfElement(elementID, expectedID) | |
7 { | |
8 var element = document.getElementById(elementID); | |
9 var rect = element.getBoundingClientRect(); | |
10 centerX = rect.left + (rect.width / 2); | |
11 centerY = rect.top + (rect.height / 2); | |
12 shouldBe("document.elementFromPoint(centerX, centerY).id", "'" + expectedID + "'"); | |
13 } | |
14 | |
15 function test() { | |
leviw_travelin_and_unemployed
2015/12/10 23:17:39
Chrishtr: Is this kinda what you were talking abou
chrishtr
2015/12/10 23:31:16
Yeah seem helpful. Please put them in LayoutTests/
| |
16 hitTestCenterOfElement("containTransform", "containTransform"); | |
17 hitTestCenterOfElement("containAbsolute", "containAbsolute"); | |
18 hitTestCenterOfElement("containFixed", "containFixed"); | |
19 | |
20 hitTestCenterOfElement("transform", "body"); | |
21 hitTestCenterOfElement("absolute", "body"); | |
22 hitTestCenterOfElement("fixed", "body"); | |
23 } | |
24 </script> | |
25 <style> | |
26 div { | |
27 width: 100px; | |
28 height: 100px; | |
29 background-color: green; | |
30 } | |
31 div > div { | |
32 background-color: red; | |
33 } | |
34 .paintContainment { | |
35 contain: paint; | |
36 margin: 10px; | |
37 } | |
38 #transform { | |
39 transform: translateZ(0) translateX(100px); | |
40 } | |
41 #absolute { | |
42 position: absolute; | |
43 top: 0px; | |
44 left: 100px; | |
45 } | |
46 #fixed { | |
47 position: fixed; | |
48 top: 0px; | |
49 left: 100px; | |
50 } | |
51 </style> | |
52 <body onload="test()" id="body"> | |
53 <p>Hit testing should respect clips established by contain: paint.</p> | |
54 <div id="containTransform" class="paintContainment"> | |
55 <div id="transform"></div> | |
56 </div> | |
57 <div id="containAbsolute" class="paintContainment"> | |
58 <div id="absolute"></div> | |
59 </div> | |
60 <div id="containFixed" class="paintContainment"> | |
61 <div id="fixed"></div> | |
62 </div> | |
63 <pre id="console"></pre> | |
OLD | NEW |