| <!DOCTYPE html> |
| <style> |
| #box { |
| width: 100px; |
| height: 100px; |
| overflow: scroll; |
| } |
| |
| #scrolled { |
| background: white; |
| width: 300px; |
| height: 300px; |
| } |
| </style> |
| |
| <div id="box"> |
| <div id="scrolled"></div> |
| </div> |
| |
| <script src="../../../../resources/testharness.js"></script> |
| <script src="../../../../resources/testharnessreport.js"></script> |
| <script> |
| if (window.internals) |
| internals.settings.setCompositorWorkerEnabled(true); |
| |
| var test = async_test('Tests that a change from the worker thread is received on the main thread.'); |
| test.step(function() { |
| var worker = new CompositorWorker('resources/basic-plumbing-worker-to-main.js'); |
| worker.onmessage = test.step_func(function() { |
| // Wait until the next frame to ensure we have received the update from compositor worker. |
| requestAnimationFrame(test.step_func(function() { |
| var box = document.getElementById('box'); |
| assert_equals(getComputedStyle(box).opacity, '0.5'); |
| assert_equals(box.scrollLeft, 10); |
| assert_equals(box.scrollTop, 20); |
| assert_equals(getComputedStyle(box).transform, 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 30, 0, 0, 2)'); |
| |
| test.done(); |
| })); |
| }); |
| |
| var keys = ['opacity', 'transform', 'scrollTop', 'scrollLeft']; |
| worker.postMessage({'proxy': new CompositorProxy(document.getElementById('box'), keys)}); |
| }); |
| </script> |