| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Tests that a change from the main thread is received on the compositor thread. |
| 4 --> |
| 5 <script> |
| 6 window.jsTestIsAsync = true; |
| 7 </script> |
| 8 <script src="../../resources/js-test.js"></script> |
| 9 |
| 10 <script> |
| 11 if (window.internals) { |
| 12 internals.settings.setCompositorWorkerEnabled(true); |
| 13 } |
| 14 |
| 15 var cw; |
| 16 onload = function() { |
| 17 cw = new CompositorWorker('resources/basic-plumbing-main-to-worker.js'); |
| 18 cw.onmessage = continueTest; |
| 19 var keys = ['opacity', 'transform', 'scrollTop', 'scrollLeft']; |
| 20 cw.postMessage({'proxy': new CompositorProxy(document.getElementById('box'),
keys)}); |
| 21 } |
| 22 |
| 23 function continueTest(e) { |
| 24 shouldBe(JSON.stringify(e.data.opacity), '1.0'); |
| 25 shouldBe(JSON.stringify(e.data.scrollLeft), '0'); |
| 26 shouldBe(JSON.stringify(e.data.scrollTop), '0'); |
| 27 shouldBe("'" + JSON.stringify(e.data.transform) + "'", '\'{"0":1,"1":0,"2":0
,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"1
5":1}\''); |
| 28 var element = document.getElementById('box'); |
| 29 element.scrollLeft = 10; |
| 30 element.scrollTop = 20; |
| 31 element.style.transform = 'translate3d(30px, 0, 0)'; |
| 32 element.style.opacity = 0.5; |
| 33 cw.onmessage = finishTest; |
| 34 cw.postMessage({}); |
| 35 } |
| 36 |
| 37 function finishTest(e) { |
| 38 shouldBe(JSON.stringify(e.data.opacity), '0.5'); |
| 39 shouldBe(JSON.stringify(e.data.scrollLeft), '10'); |
| 40 shouldBe(JSON.stringify(e.data.scrollTop), '20'); |
| 41 shouldBe("'" + JSON.stringify(e.data.transform) + "'", '\'{"0":1,"1":0,"2":0
,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":30,"13":0,"14":0,"
15":1}\''); |
| 42 if (window.testRunner) |
| 43 testRunner.notifyDone(); |
| 44 } |
| 45 </script> |
| 46 |
| 47 <style> |
| 48 #box { |
| 49 width: 100px; |
| 50 height: 100px; |
| 51 overflow: scroll; |
| 52 } |
| 53 |
| 54 #scrolled { |
| 55 background: white; |
| 56 width: 300px; |
| 57 height: 300px; |
| 58 } |
| 59 </style> |
| 60 |
| 61 <div id="box"> |
| 62 <div id="scrolled"></div> |
| 63 </div> |
| OLD | NEW |