Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / touch-rect-crash-on-unpromote-layer.html
blobbc506fd9480f8b05dca630cf2ca67b8b003002b5
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <style>
6 #layer {
7 position: relative;
8 left: 10px;
10 .composited {
11 transform: translate3d(0, 0, 0);
13 </style>
14 </head>
15 <body>
16 <div id="layer" class="composited">A layer that may or may not be composited</div>
17 <p id="description"></p>
18 <div id="console"></div>
19 <script>
20 description("Make sure we don't crash when a layer with a touch event handler becomes non-composited");
22 var layer = document.getElementById('layer');
23 layer.addEventListener('touchstart', function() {});
25 // Ensure we've done a layout, updated compositing, and we have a hit rect on this composited layer.
26 var x = layer.offsetTop;
28 if (window.internals)
29 window.internals.forceCompositingUpdate(document);
31 var rects;
32 if (window.internals) {
33 rects = window.internals.touchEventTargetLayerRects(document);
34 shouldBe("rects.length", "1");
35 shouldBeEqualToString("rects[0].layerAssociatedNode.id", "layer");
38 // Make the layer non-composited
39 layer.className = '';
41 // Verify we now have a hit rect on the document.
42 // (layout and compositing update are done by touchEventTargetLayerRects().)
43 if (window.internals) {
44 rects = window.internals.touchEventTargetLayerRects(document);
45 shouldBe("rects.length", "1");
46 shouldBeEqualToString("rects[0].layerAssociatedNode.nodeName", "#document");
48 </script>
49 </body>
50 </html>