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

Side by Side Diff: third_party/WebKit/LayoutTests/compositing/change-preferCompositingToLCDText-setting.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 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <style> 4 <style>
5 #scroller { 5 #scroller {
6 overflow: scroll; 6 overflow: scroll;
7 height: 300px; 7 height: 300px;
8 width: 300px; 8 width: 300px;
9 background-color: rgba(255,0,0,0.5); /* Force non-promotion due to backgroun d opacity */; 9 background-color: rgba(255,0,0,0.5); /* Force non-promotion due to backgroun d opacity */;
10 } 10 }
11 11
12 #scrolled { 12 #scrolled {
13 height: 1000px; 13 height: 1000px;
14 width: 250px; 14 width: 250px;
15 background-color: rgba(0,128,0,0.5); /* Force non-promotion due to backgroun d opacity */; 15 background-color: rgba(0,128,0,0.5); /* Force non-promotion due to backgroun d opacity */;
16 } 16 }
17 </style> 17 </style>
18 18
19 <script> 19 <script>
20 20
21 var t = async_test("Check that the preferCompositingToLCDText flag results in co mpositing"); 21 var t = async_test("Check that the preferCompositingToLCDText flag results in co mpositing");
22 22
23 function isUsingCompositedScrolling(layer) { 23 function isUsingCompositedScrolling() {
24 layer = layer || JSON.parse(window.internals.layerTreeAsText(document)); 24 var layers = JSON.parse(window.internals.layerTreeAsText(document));
25 if (layer.bounds[1] == 1000) 25 var found = false;
26 return true; 26 layers["layers"].forEach(function(layer) {
27 if (layer.children) { 27 if (layer.bounds[1] == 1000)
28 for (var i = 0; i < layer.children.length; i++) { 28 found = true;
29 if (isUsingCompositedScrolling(layer.children[i])) 29 });
30 return true; 30 return found;
31 }
32 }
33 return false;
34 } 31 }
35 32
36 window.onload = function() { 33 window.onload = function() {
37 t.step(function() { 34 t.step(function() {
38 assert_not_equals(window.internals, null, 'This test requires window.interna ls'); 35 assert_not_equals(window.internals, null, 'This test requires window.interna ls');
39 36
40 window.internals.settings.setPreferCompositingToLCDTextEnabled(false); 37 window.internals.settings.setPreferCompositingToLCDTextEnabled(false);
41 var stateBefore = isUsingCompositedScrolling(); 38 var stateBefore = isUsingCompositedScrolling();
42 window.internals.settings.setPreferCompositingToLCDTextEnabled(true); 39 window.internals.settings.setPreferCompositingToLCDTextEnabled(true);
43 var stateAfter = isUsingCompositedScrolling(); 40 var stateAfter = isUsingCompositedScrolling();
44 41
45 assert_false(stateBefore, 'Composited scrolling began disabled'); 42 assert_false(stateBefore, 'Composited scrolling began disabled');
46 assert_true(stateAfter, 'Composited scrolling became enabled'); 43 assert_true(stateAfter, 'Composited scrolling became enabled');
47 t.done(); 44 t.done();
48 }); 45 });
49 }; 46 };
50 </script> 47 </script>
51 48
52 <div id="scroller"> 49 <div id="scroller">
53 <div id="scrolled"></div> 50 <div id="scrolled"></div>
54 </div> 51 </div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698