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

Side by Side Diff: chrome/test/data/third_party/spaceport/js/sprites/renderers/cssMatrixImg.js

Issue 10154006: Add test data for spaceport benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 define([ 'util/ensureCallback', 'features', 'sprites/renderers/DomContext', 'uti l/create', 'sprites/container' ], function (ensureCallback, features, DomContext , create, container) {
2 var CSSMatrix = features.CSSMatrix;
3
4 function RenderContext(sourceData, frameData) {
5 if (!CSSMatrix) {
6 return;
7 }
8
9 this.loadPromise = quickPromise();
10 DomContext.call(this, sourceData, frameData, this.loadPromise.resolve);
11
12 this.elements.forEach(function (frameElements) {
13 frameElements.forEach(function (element) {
14 element.style[features.transformOriginStyleProperty] = '0 0';
15 });
16 });
17
18 this.transformData = frameData.map(function (objectTransforms) {
19 return objectTransforms.map(function (t) {
20 var m = new CSSMatrix();
21 m.a = t.matrix[0];
22 m.b = t.matrix[1];
23 m.c = t.matrix[3];
24 m.d = t.matrix[4];
25 m.e = t.matrix[2];
26 m.f = t.matrix[5];
27 return m;
28 });
29 });
30
31 this.containerElement = container();
32 }
33
34 RenderContext.prototype = create(DomContext.prototype);
35
36 RenderContext.prototype.load = function load(callback) {
37 callback = ensureCallback(callback);
38
39 if (!CSSMatrix) {
40 callback(new Error('Not supported'));
41 return;
42 }
43
44 document.body.appendChild(this.containerElement);
45
46 this.loadPromise.then(function () {
47 callback(null);
48 });
49 };
50
51 RenderContext.prototype.unload = function unload() {
52 this.containerElement.parentNode.removeChild(this.containerElement);
53 DomContext.prototype.unload.call(this);
54 };
55
56 var transformStyleProperty = features.transformStyleProperty;
57
58 RenderContext.prototype.processElements = function processElements(elements, transforms) {
59 var count = transforms.length;
60 var i;
61 for (i = 0; i < count; ++i) {
62 var element = elements[i];
63 element.style[transformStyleProperty] = transforms[i];
64 element.zIndex = i;
65
66 // Elements not in the DOM need to be added
67 if (!element.parentNode) {
68 this.containerElement.appendChild(element);
69 }
70 }
71 };
72
73 return function (element, frameData) {
74 return new RenderContext(element, frameData);
75 };
76 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698