Fix SVG benchmark test
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Apr 2016 20:19:26 +0000 (20:19 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Apr 2016 20:19:26 +0000 (20:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156410

Reviewed by Dean Jackson.

* Animometer/resources/extensions.js: Update Point.zero to be a static Point.
* Animometer/tests/simple/resources/tiled-canvas-image.js:
(Stage.call._setupTiles): Refactor.
* Animometer/tests/master/resources/particles.js:
(Particle.prototype.reset): Use Point.center.
(complexity): We are not using a gradient background anymore, so remove the +1.
* Animometer/tests/master/resources/svg-particles.js: Update to use SVG transform
instead of CSS transform.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199244 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/Animometer/resources/extensions.js
PerformanceTests/Animometer/tests/master/resources/particles.js
PerformanceTests/Animometer/tests/master/resources/svg-particles.js
PerformanceTests/Animometer/tests/simple/resources/tiled-canvas-image.js
PerformanceTests/ChangeLog

index 1806670..d81dd79 100644 (file)
@@ -286,10 +286,7 @@ Point = Utilities.createClass(
 });
 
 Utilities.extendObject(Point, {
-    zero: function()
-    {
-        return new Point(0, 0);
-    },
+    zero: new Point(0, 0),
 
     pointOnCircle: function(angle, radius)
     {
index 1de3e78..cf474e4 100644 (file)
@@ -15,7 +15,7 @@ Particle.prototype =
     {
         var randSize = Math.round(Math.pow(Pseudo.random(), 4) * this.sizeRange + this.sizeMinimum);
         this.size = new Point(randSize, randSize);
-        this.minPosition = this.size.multiply(.5);
+        this.minPosition = this.size.center;
         this.maxPosition = this.stage.size.subtract(this.minPosition);
     },
 
@@ -107,7 +107,6 @@ ParticlesStage = Utilities.createSubclass(Stage,
 
     complexity: function()
     {
-        // We add one to represent the gradient background.
-        return this.particles.length + 1;
+        return this.particles.length;
     }
 });
index 91ae8b7..2ce24b5 100644 (file)
@@ -42,9 +42,9 @@ SVGParticle = Utilities.createSubclass(Particle,
         if (this.isClipPath) {
             this.element.setAttribute("width", this.size.x);
             this.element.setAttribute("height", this.size.y);
-            this.transformSuffix = "translate(-" + (this.size.x >> 1) + "px,-" + (this.size.y >> 1) + "px)";
+            this.transformSuffix = " translate(-" + this.size.center.x + ",-" + this.size.center.y + ")";
         } else
-            this.transformSuffix = "scale(" + this.size.x + ")translate(-.5px,-.5px)";
+            this.transformSuffix = " scale(" + this.size.x + ") translate(-.5,-.5)";
 
         this.stage.colorOffset = (this.stage.colorOffset + .5) % 360;
 
@@ -59,7 +59,7 @@ SVGParticle = Utilities.createSubclass(Particle,
 
     move: function()
     {
-        this.element.style.transform = "translate(" + this.position.x + "px," + this.position.y + "px)" + this.rotater.rotateZ() + this.transformSuffix;
+        this.element.setAttribute("transform", "translate(" + this.position.x + "," + this.position.y + ") " + this.rotater.rotate(Point.zero) + this.transformSuffix);
     }
 });
 
index 806b3c4..f5d02b6 100644 (file)
@@ -41,7 +41,7 @@ TiledCanvasImageStage = Utilities.createSubclass(Stage,
 
         this._tiles = new Array(maxTilesPerRow * maxTilesPerCol);
 
-        var source = Point.zero();
+        var source = Point.zero;
         for (var index = 0; index < this._tiles.length; ++index) {
             this._tiles[index] = new CanvasImageTile(this, source);
             source = this._nextTilePosition(source);
index b5ad86e..1d503cc 100644 (file)
@@ -1,3 +1,19 @@
+2016-04-08  Jon Lee  <jonlee@apple.com>
+
+        Fix SVG benchmark test
+        https://bugs.webkit.org/show_bug.cgi?id=156410
+
+        Reviewed by Dean Jackson.
+
+        * Animometer/resources/extensions.js: Update Point.zero to be a static Point.
+        * Animometer/tests/simple/resources/tiled-canvas-image.js:
+        (Stage.call._setupTiles): Refactor.
+        * Animometer/tests/master/resources/particles.js:
+        (Particle.prototype.reset): Use Point.center.
+        (complexity): We are not using a gradient background anymore, so remove the +1.
+        * Animometer/tests/master/resources/svg-particles.js: Update to use SVG transform
+        instead of CSS transform.
+
 2016-04-06  Jon Lee  <jonlee@apple.com>
 
         Update master benchmark with SVG test