OSDN Git Service

Modfiy the listener method of the and
authordhrname <dhrname@users.sourceforge.jp>
Thu, 7 Apr 2016 10:58:11 +0000 (19:58 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 7 Apr 2016 10:58:11 +0000 (19:58 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index bc2493f..ded14de 100644 (file)
@@ -300,8 +300,7 @@ base("$frame").mix ( {
       if (!evt.timeStamp && (evt.timeStamp !== 0)) {\r
         throw new Error();\r
       }\r
-      /*イベントのリスナーが遅かった場合の、誤差の演算をしておく*/\r
-      this.begin = this.eventOffset + this.$frame.currentFrame - Math.floor( (Date.now() - evt.timeStamp) * this.fpms );\r
+      this.begin = this.eventOffset + this.$frame.currentFrame;\r
       var s = this.$activate;\r
       s.begin = this.begin;\r
       this.activeTime = s.call() || Number.MAX_VALUE;\r
@@ -438,7 +437,7 @@ base("$frame").mix ( {
         /*強制的に終了させる*/\r
         this.removeLine(this.$begin);\r
       }\r
-      this.begin = this.eventOffset + this.$frame.currentFrame - Math.floor( (Date.now() - evt.timeStamp) * this.fpms );\r
+      this.begin = this.eventOffset + this.$frame.currentFrame;\r
       var s = this.$begin.$activate;\r
       s.end = this.begin;\r
       /*未解決だったendの値が、イベントの発生により、解決して再定義されたとき、\r
index de08f50..fd327ec 100644 (file)
@@ -604,8 +604,8 @@ describe("SMIL Animation Spec", function() {
         obj.$1.listener( {\r
           timeStamp: (Date.now() + 500)\r
         } );\r
-        expect(obj.$1.begin).toBe(Math.floor(500*obj.fpms) + 1);\r
-        expect(obj.$1.activeTime).toBe(Math.floor(1000*obj.fpms) - Math.floor(500*obj.fpms) - 1);\r
+        expect(obj.$1.begin).toBe(1);\r
+        expect(obj.$1.activeTime).toBe(Math.floor(1000*obj.fpms) - 1);\r
         expect(obj.$1.$activate.begin).toBe(obj.$1.begin);\r
         expect(obj.timelines[1]).toBe(obj.$1);\r
       } );\r
@@ -691,8 +691,8 @@ describe("SMIL Animation Spec", function() {
           timeStamp: (Date.now() + 120)\r
         } );\r
         expect(obj.timelines[0]).not.toBe(obj.$begin);\r
-        expect(obj.begin).toBe(Math.ceil(120*obj.fpms));\r
-        expect(obj.$begin.activeTime).toBe(Math.ceil(120*obj.fpms));\r
+        expect(obj.begin).toBe(0);\r
+        expect(obj.$begin.activeTime).toBe(0);\r
 \r
         obj.addLine(obj.$begin.mix( {\r
           begin: 12,\r
@@ -706,8 +706,8 @@ describe("SMIL Animation Spec", function() {
           timeStamp: (Date.now() + 12)\r
         } );\r
         expect(obj.timelines[0]).toBe(obj.$begin);\r
-        expect(obj.begin).toBe(Math.ceil(1012*obj.fpms));\r
-        expect(obj.$begin.activeTime).toBe(Math.ceil(1012*obj.fpms));\r
+        expect(obj.begin).toBe(Math.ceil(1000*obj.fpms));\r
+        expect(obj.$begin.activeTime).toBe(Math.ceil(1000*obj.fpms));\r
       } );\r
       /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
       it("should be this for the value (the invalid partion)", function() {\r
@@ -2935,6 +2935,8 @@ describe("SMIL Animation Spec", function() {
         expect($animate.isEnd).toBeFalsy();\r
         expect($animate.state).toBe("idling");\r
         p.dispatchEvent(evt);\r
+        frame.setFrame(frame.currentFrame + 1);\r
+        expect($animate.state).toBe("playing");\r
         frame.setFrame(frame.currentFrame + 24);\r
         expect($animate.state).toBe("idling");\r
         expect(evt.target.getAttributeNS(null, "fill") || null).toBe("rgb(10, 10, 1)");\r