Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/touch/touch-rect-crash-on-unpromote-layer.html

Issue 2609923002: Use runAfterLayoutAndPaint instead of requestAnimationFrame and (Closed)
Patch Set: update comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <style> 5 <style>
6 #layer { 6 #layer {
7 position: relative; 7 position: relative;
8 left: 10px; 8 left: 10px;
9 } 9 }
10 .composited { 10 .composited {
11 transform: translate3d(0, 0, 0); 11 transform: translate3d(0, 0, 0);
12 } 12 }
13 </style> 13 </style>
14 </head> 14 </head>
15 <body> 15 <body>
16 <div id="layer" class="composited">A layer that may or may not be composited</di v> 16 <div id="layer" class="composited">A layer that may or may not be composited</di v>
17 <p id="description"></p> 17 <p id="description"></p>
18 <div id="console"></div> 18 <div id="console"></div>
19 19
20 <script src="../../../resources/js-test.js"></script> 20 <script src="../../../resources/js-test.js"></script>
21 <script src="../../../resources/run-after-layout-and-paint.js"></script>
21 <script> 22 <script>
22 jsTestIsAsync = true; 23 jsTestIsAsync = true;
23 description("Make sure we don't crash when a layer with a touch event handler becomes non-composited"); 24 description("Make sure we don't crash when a layer with a touch event handler becomes non-composited");
24 25
25 var layer = document.getElementById('layer'); 26 var layer = document.getElementById('layer');
26 layer.addEventListener('touchstart', function() {}); 27 layer.addEventListener('touchstart', function() {});
27 28
28 29
29 var rects; 30 var rects;
30 if (window.internals) { 31 if (window.internals) {
31 // Ensure we've done a layout, updated compositing, and we have a hit rect o n this composited layer. 32 // Ensure we've done a layout, updated compositing, and we have a hit rect o n this composited layer.
32 window.internals.forceCompositingUpdate(document); 33 window.internals.forceCompositingUpdate(document);
33 rects = window.internals.touchEventTargetLayerRects(document); 34 rects = window.internals.touchEventTargetLayerRects(document);
34 shouldBe("rects.length", "1"); 35 shouldBe("rects.length", "1");
35 shouldBeEqualToString("rects[0].layerAssociatedNode.id", "layer"); 36 shouldBeEqualToString("rects[0].layerAssociatedNode.id", "layer");
36 } 37 }
37 38
38 // Make the layer non-composited 39 // Make the layer non-composited
39 layer.className = ''; 40 layer.className = '';
40 41
41 // Verify we now have a hit rect on the document after waiting a frame. 42 // Verify we now have a hit rect on the document after layout and paint.
42 setTimeout(function() { 43 runAfterLayoutAndPaint(function() {
43 window.requestAnimationFrame(function() { 44 if (window.internals) {
44 if (window.internals) { 45 rects = window.internals.touchEventTargetLayerRects(document);
45 rects = window.internals.touchEventTargetLayerRects(document); 46 shouldBe("rects.length", "1");
46 shouldBe("rects.length", "1"); 47 shouldBeEqualToString("rects[0].layerAssociatedNode.nodeName", "#document" );
47 shouldBeEqualToString("rects[0].layerAssociatedNode.nodeName", "#documen t"); 48 }
48 } 49 finishJSTest();
49 finishJSTest(); 50 });
50 });
51 }, 0);
52 </script> 51 </script>
53 </body> 52 </body>
54 </html> 53 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698