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

Unified Diff: LayoutTests/fast/workers/resources/bubble2.js

Issue 474683003: Not for review - Rebase of crrev.com/62833003 Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/workers/resources/bubble.js ('k') | LayoutTests/fast/workers/resources/bubble2_jank.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/workers/resources/bubble2.js
diff --git a/LayoutTests/fast/workers/resources/bubble2.js b/LayoutTests/fast/workers/resources/bubble2.js
new file mode 100644
index 0000000000000000000000000000000000000000..220510b634aede1bbc6da8731209ee5ca4b7d7f9
--- /dev/null
+++ b/LayoutTests/fast/workers/resources/bubble2.js
@@ -0,0 +1,56 @@
+(function(scope) {
+ 'use strict';
+
+ var tokens = null;
+ var scroll = null;
+ var pendingscrolldelta = null;
+ var transform = null;
+
+ function sign(n) {
+ if (n >= 0)
+ return 1;
+ return -1;
+ }
+
+ // An extremely cheesy animation.
+ function tick(context) {
+ var seconds = context.timestamp / 1000.0;
+ var scrolltop = context.getScalar(scroll);
+ var psd = undefined;
+ try {
+ psd = context.getScalar(pendingscrolldelta);
+ } catch(err) {
+ console.log(err);
+ }
+
+ if (psd) {
+ // beforescroll
+ console.log('beforescroll pendingscrolldelta: ' + psd);
+
+ var matrix = context.getMatrix(transform);
+ matrix.m24 -= psd;
+ context.setMatrix(transform, matrix);
+ context.setScalar(pendingscrolldelta, 5 * sign(psd));
+ //context.setScalar(pendingscrolldelta, 0);
+ } else {
+ // normal
+ console.log('normal tick, scrolltop: ' + scrolltop);
+
+ //var matrix = context.getMatrix(transform);
+ //matrix.m24 = 0.5 * scrolltop; //Math.sin(seconds);
+ //context.setMatrix(transform, matrix);
+ }
+
+ scope.teleportMessage(context, tick);
+ }
+
+ scope.onmessage = function(e) {
+ tokens = e.data;
+ scroll = tokens[0];
+ pendingscrolldelta = tokens[1];
+ transform = tokens[2];
+ var context = new TeleportContext(tokens);
+ scope.teleportMessage(context, tick);
+ };
+
+})(self);
« no previous file with comments | « LayoutTests/fast/workers/resources/bubble.js ('k') | LayoutTests/fast/workers/resources/bubble2_jank.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698