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

Side by Side Diff: third_party/WebKit/ManualTests/compositor-worker/parallax.js

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
OLDNEW
(Empty)
1 (function(scope) {
2 "use strict";
3
4 scope.isMain = function() {
5 return scope.window;
6 };
7
8 scope.tick = function(timestamp) {
9 console.log("tick (scrollTop = " + scroller.scrollTop + ", transform = " +
10 bg.transform + ")");
11 var t = bg.transform;
12 t.m42 = Math.round(scroller.scrollTop);
13 bg.transform = t;
14 var t = bg_parallax.transform;
15 t.m42 = 0.8 * scroller.scrollTop;
16 bg_parallax.transform = t;
17 scope.requestAnimationFrame(tick);
18 };
19
20 scope.initWorker = function() {
21 console.log("init worker");
22
23 self.onmessage = function(e) {
24 console.log("onmessage");
25
26 scope.scroller = e.data[0];
27 scope.bg = e.data[1];
28 scope.bg_parallax = e.data[2];
29
30 scope.requestAnimationFrame(tick);
31 };
32 };
33
34 scope.initMain = function() {
35 console.log("init main");
36
37 scope.worker = new CompositorWorker("parallax.js");
38
39 scope.scroller = new CompositorProxy(document.getElementById("scroller"), [' scrollTop']);
40 scope.bg = new CompositorProxy(document.getElementById("bg"), ['transform']) ;
41 scope.bg_parallax = new CompositorProxy(document.getElementById("bg-parallax "), ['transform']);
42
43 worker.postMessage([scroller, bg, bg_parallax]);
44 };
45
46 if (isMain())
47 initMain();
48 else
49 initWorker();
50 })(self);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698