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

Side by Side Diff: third_party/WebKit/LayoutTests/compositing/animation/hidden-composited.html

Issue 2397333002: Change layerTreeAsText to default to layer lists. (Closed)
Patch Set: none Created 4 years, 2 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
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <style> 2 <style>
3 @keyframes slide { 3 @keyframes slide {
4 0% { transform: translate3d(0px, 0px, 0px); } 4 0% { transform: translate3d(0px, 0px, 0px); }
5 100% { transform: translate3d(100px, 0px, 1px); } 5 100% { transform: translate3d(100px, 0px, 1px); }
6 } 6 }
7 7
8 div { 8 div {
9 width: 100px; 9 width: 100px;
10 height: 100px; 10 height: 100px;
11 background: green; 11 background: green;
12 animation-duration: 2s; 12 animation-duration: 2s;
13 animation-name: slide; 13 animation-name: slide;
14 animation-iteration-count: infinite; 14 animation-iteration-count: infinite;
15 animation-direction: alternate; 15 animation-direction: alternate;
16 } 16 }
17 </style> 17 </style>
18 <div id="animated"></div> 18 <div id="animated"></div>
19 <script src='../../resources/js-test.js'></script> 19 <script src='../../resources/js-test.js'></script>
20 20
21 <script> 21 <script>
22 description('Verifies hidden, compositor-animated layers still get composited'); 22 description('Verifies hidden, compositor-animated layers still get composited');
23 23
24 if (window.internals) 24 if (window.internals)
25 internals.settings.setPreferCompositingToLCDTextEnabled(true); 25 internals.settings.setPreferCompositingToLCDTextEnabled(true);
26 26
27 function hiddenLayerIsComposited(layer) { 27 function hiddenLayerIsComposited(layers) {
28 if (layer.children) { 28 var found = false;
29 for (var i = 0; i < layer.children.length; i++) { 29 layers["layers"].forEach(function(layer) {
30 var child = layer.children[i]; 30 if (layer.bounds[0] == 100 && layer.bounds[1] == 100) {
31 if (child.bounds[0] == 100 && child.bounds[1] == 100) { 31 for (var j = 0; j < layer.compositingReasons.length; j++) {
32 for (var j = 0; j < child.compositingReasons.length; j++) { 32 if (layer.compositingReasons[j] === 'activeAnimation')
33 if (child.compositingReasons[j] === 'activeAnimation') 33 found = true;
34 return true;
35 }
36 } 34 }
37 if (hiddenLayerIsComposited(child))
38 return true;
39 } 35 }
40 } 36 });
41 return false; 37 return found;
42 } 38 }
43 39
44 onload = function() { 40 onload = function() {
45 if (!window.internals) 41 if (!window.internals)
46 return; 42 return;
47 43
48 document.getElementById('animated').style.visibility = 'hidden'; 44 document.getElementById('animated').style.visibility = 'hidden';
49 window.internals.forceCompositingUpdate(document); 45 window.internals.forceCompositingUpdate(document);
50 46
51 documentLayerTree = JSON.parse(window.internals.layerTreeAsText( 47 documentLayerTree = JSON.parse(window.internals.layerTreeAsText(
52 document, window.internals.LAYER_TREE_INCLUDES_COMPOSITING_REASONS)); 48 document, window.internals.LAYER_TREE_INCLUDES_COMPOSITING_REASONS));
53 49
54 shouldBe('hiddenLayerIsComposited(documentLayerTree)', 'true'); 50 shouldBe('hiddenLayerIsComposited(documentLayerTree)', 'true');
55 }; 51 };
56 </script> 52 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698