WebKit Bugzilla
Attachment 347037 Details for
Bug 188530
: [MotionMark] Update Leaves test
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188530-20180813142941.patch (text/plain), 10.68 KB, created by
Jon Lee
on 2018-08-13 14:29:41 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jon Lee
Created:
2018-08-13 14:29:41 PDT
Size:
10.68 KB
patch
obsolete
>Subversion Revision: 234580 >diff --git a/PerformanceTests/ChangeLog b/PerformanceTests/ChangeLog >index f20e4e29b5bc822cbd0ba8a29f8888781959982e..14b7a0d95ff03aef84c94720aaf9ca1bd0eeacd6 100644 >--- a/PerformanceTests/ChangeLog >+++ b/PerformanceTests/ChangeLog >@@ -1,3 +1,19 @@ >+2018-08-13 Jon Lee <jonlee@apple.com> >+ >+ [MotionMark] Update Leaves test >+ https://bugs.webkit.org/show_bug.cgi?id=188530 >+ <rdar://problem/43251862> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Update Leaves test to include opacity and scale. Add new Leaves suite that isolate those components >+ for debugging purposes. >+ >+ * MotionMark/resources/debug-runner/tests.js: >+ * MotionMark/tests/dom/leaves.html: >+ * MotionMark/tests/dom/resources/leaves.js: >+ * MotionMark/tests/master/resources/leaves.js: >+ > 2018-07-26 Andy VanWagoner <andy@vanwagoner.family> > > [INTL] Remove INTL sub-feature compile flags >diff --git a/PerformanceTests/MotionMark/resources/debug-runner/tests.js b/PerformanceTests/MotionMark/resources/debug-runner/tests.js >index f17831418f83fcb21dc763df194814df08d77ca2..03b36268b68dc53f987fe965445f0ea2d9580eda 100644 >--- a/PerformanceTests/MotionMark/resources/debug-runner/tests.js >+++ b/PerformanceTests/MotionMark/resources/debug-runner/tests.js >@@ -190,10 +190,6 @@ Suites.push(new Suite("HTML suite", > url: "bouncing-particles/bouncing-tagged-images.html?particleWidth=100&particleHeight=100", > name: "CSS bouncing tagged images" > }, >- { >- url: "dom/leaves.html", >- name: "Leaves 2.0" >- }, > { > url: "dom/focus.html", > name: "Focus 2.0" >@@ -267,6 +263,23 @@ Suites.push(new Suite("SVG suite", > ] > )); > >+Suites.push(new Suite("Leaves suite", >+ [ >+ { >+ url: "dom/leaves.html?style=simple", >+ name: "Translate-only Leaves" >+ }, >+ { >+ url: "dom/leaves.html?style=scale", >+ name: "Translate + Scale Leaves" >+ }, >+ { >+ url: "dom/leaves.html?style=opacity", >+ name: "Translate + Opacity Leaves" >+ } >+ ] >+)); >+ > Suites.push(new Suite("Text suite", > [ > { >diff --git a/PerformanceTests/MotionMark/tests/dom/leaves.html b/PerformanceTests/MotionMark/tests/dom/leaves.html >index 8dbefce2b0e8c6056e8bb206927ab833fcf5c1f7..8dff64d0688bd26216eacaee498b701114818a0e 100644 >--- a/PerformanceTests/MotionMark/tests/dom/leaves.html >+++ b/PerformanceTests/MotionMark/tests/dom/leaves.html >@@ -1,5 +1,5 @@ > <!-- >- Copyright (C) 2015-2017 Apple Inc. All rights reserved. >+ Copyright (C) 2015-2018 Apple Inc. All rights reserved. > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions >@@ -29,7 +29,7 @@ > <link rel="stylesheet" type="text/css" href="../resources/stage.css"> > <style> > #stage { >- background-color: #23282B; >+ background-color: #33282B; > } > #stage img { > position: absolute; >diff --git a/PerformanceTests/MotionMark/tests/dom/resources/leaves.js b/PerformanceTests/MotionMark/tests/dom/resources/leaves.js >index 8c16deceab21bf94c084202895f69fbf564bca6e..a0bb6336a60861fffb35b790131ebfc13af6d2c0 100644 >--- a/PerformanceTests/MotionMark/tests/dom/resources/leaves.js >+++ b/PerformanceTests/MotionMark/tests/dom/resources/leaves.js >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -22,47 +22,50 @@ > * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF > * THE POSSIBILITY OF SUCH DAMAGE. > */ >-Leaf = Utilities.createSubclass(Particle, >+(function() { >+ >+var SuperLeaf = window.Leaf; >+var SimpleLeaf = Utilities.createSubclass(SuperLeaf, > function(stage) > { >- this.element = document.createElement("img"); >- this.element.setAttribute("src", Stage.randomElementInArray(stage.images).src); >- stage.element.appendChild(this.element); >+ SuperLeaf.call(this, stage); >+ }, { >+ >+ sizeMinimum: 25, >+ sizeRange: 0, >+ usesOpacity: false, >+ >+ move: function() >+ { >+ this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ(); >+ } >+}); > >- Particle.call(this, stage); >+var ScaleLeaf = Utilities.createSubclass(SuperLeaf, >+ function(stage) >+ { >+ SuperLeaf.call(this, stage); > }, { > > sizeMinimum: 20, >- sizeRange: 40, >+ sizeRange: 30, >+ usesOpacity: false, > >- reset: function() >+ move: function() > { >- Particle.prototype.reset.call(this); >- this.element.style.width = this.size.x + "px"; >- this.element.style.height = this.size.y + "px"; >- this._opacity = .01; >- this._opacityRate = 0.02 * Stage.random(1, 6); >- this._position = new Point(Stage.random(0, this.maxPosition.x), Stage.random(-this.size.height, this.maxPosition.y)); >- this._velocity = new Point(Stage.random(-6, -2), .1 * this.size.y + Stage.random(-1, 1)); >- }, >+ this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ(); >+ } >+}); > >- animate: function(timeDelta) >+var OpacityLeaf = Utilities.createSubclass(SuperLeaf, >+ function(stage) > { >- this.rotater.next(timeDelta); >- >- this._position.x += this._velocity.x + 8 * this.stage.focusX; >- this._position.y += this._velocity.y; >- this._opacity += this._opacityRate; >- if (this._opacity > 1) { >- this._opacity = 1; >- this._opacityRate *= -1; >- } else if (this._opacity < 0 || this._position.y > this.stage.size.height) >- this.reset(); >+ SuperLeaf.call(this, stage); >+ }, { > >- if (this._position.x < -this.size.width || this._position.x > this.stage.size.width) >- this._position.x = this._position.x - Math.sign(this._position.x) * (this.size.width + this.stage.size.width); >- this.move(); >- }, >+ sizeMinimum: 25, >+ sizeRange: 0, >+ usesOpacity: true, > > move: function() > { >@@ -70,3 +73,27 @@ Leaf = Utilities.createSubclass(Particle, > this.element.style.opacity = this._opacity; > } > }); >+ >+ >+var LeavesBenchmark = window.benchmarkClass; >+var LeavesDerivedBenchmark = Utilities.createSubclass(LeavesBenchmark, >+ function(options) >+ { >+ switch (options["style"]) { >+ case "simple": >+ window.Leaf = SimpleLeaf; >+ break; >+ case "scale": >+ window.Leaf = ScaleLeaf; >+ break; >+ case "opacity": >+ window.Leaf = OpacityLeaf; >+ break; >+ } >+ LeavesBenchmark.call(this, options); >+ } >+); >+ >+window.benchmarkClass = LeavesDerivedBenchmark; >+ >+})(); >diff --git a/PerformanceTests/MotionMark/tests/master/resources/leaves.js b/PerformanceTests/MotionMark/tests/master/resources/leaves.js >index fefda149bf4b4a0e9c1c4a025cb4767c07e257e6..5317e50b513b234940b294ddfe473c0070e985d9 100644 >--- a/PerformanceTests/MotionMark/tests/master/resources/leaves.js >+++ b/PerformanceTests/MotionMark/tests/master/resources/leaves.js >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -22,26 +22,34 @@ > * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF > * THE POSSIBILITY OF SUCH DAMAGE. > */ >-Leaf = Utilities.createSubclass(Particle, >+(function() { >+ >+window.Leaf = Utilities.createSubclass(Particle, > function(stage) > { > this.element = document.createElement("img"); > this.element.setAttribute("src", Stage.randomElementInArray(stage.images).src); >- var sizeString = this.sizeMinimum + "px"; >- this.element.style.width = sizeString; >- this.element.style.height = sizeString; > stage.element.appendChild(this.element); > > Particle.call(this, stage); > }, { > >- sizeMinimum: 25, >- sizeRange: 0, >+ sizeMinimum: 20, >+ sizeRange: 30, >+ usesOpacity: true, > > reset: function() > { > Particle.prototype.reset.call(this); >- this._life = Stage.randomInt(20, 100); >+ this.element.style.width = this.size.x + "px"; >+ this.element.style.height = this.size.y + "px"; >+ >+ if (this.usesOpacity) { >+ this._opacity = .01; >+ this._opacityRate = 0.02 * Stage.random(1, 6); >+ } else >+ this._life = Stage.randomInt(20, 100); >+ > this._position = new Point(Stage.random(0, this.maxPosition.x), Stage.random(-this.size.height, this.maxPosition.y)); > this._velocity = new Point(Stage.random(-6, -2), .1 * this.size.y + Stage.random(-1, 1)); > }, >@@ -53,9 +61,18 @@ Leaf = Utilities.createSubclass(Particle, > this._position.x += this._velocity.x + 8 * this.stage.focusX; > this._position.y += this._velocity.y; > >- this._life--; >- if (!this._life || this._position.y > this.stage.size.height) >- this.reset(); >+ if (this.usesOpacity) { >+ this._opacity += this._opacityRate; >+ if (this._opacity > 1) { >+ this._opacity = 1; >+ this._opacityRate *= -1; >+ } else if (this._opacity < 0 || this._position.y > this.stage.size.height) >+ this.reset(); >+ } else { >+ this._life--; >+ if (!this._life || this._position.y > this.stage.size.height) >+ this.reset(); >+ } > > if (this._position.x < -this.size.width || this._position.x > this.stage.size.width) > this._position.x = this._position.x - Math.sign(this._position.x) * (this.size.width + this.stage.size.width); >@@ -65,6 +82,7 @@ Leaf = Utilities.createSubclass(Particle, > move: function() > { > this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ(); >+ this.element.style.opacity = this._opacity; > } > }); > >@@ -143,7 +161,7 @@ Utilities.extendObject(ParticlesStage.prototype, { > } > }); > >-LeavesBenchmark = Utilities.createSubclass(Benchmark, >+var LeavesBenchmark = Utilities.createSubclass(Benchmark, > function(options) > { > Benchmark.call(this, new ParticlesStage(), options); >@@ -157,3 +175,5 @@ LeavesBenchmark = Utilities.createSubclass(Benchmark, > }); > > window.benchmarkClass = LeavesBenchmark; >+ >+})();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188530
:
347036
| 347037