OSDN Git Service

Modify the updateState method
authordhrname <dhrname@users.sourceforge.jp>
Wed, 5 Oct 2016 14:16:28 +0000 (23:16 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 5 Oct 2016 14:16:28 +0000 (23:16 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 18fbb6d..0e21879 100644 (file)
@@ -177,18 +177,25 @@ base("$frame").mix ( {
       }\r
       if ( isWait && (startTime >= this.begin) ) {\r
         this.state = begin;\r
+        /*beginプロパティに開始時刻をキャッシュ用に保存*/\r
+        this.begin = startTime;\r
       } else if (isWait) {\r
         return this;\r
       } else if (state === begin) {\r
         this.state = play;\r
       } else if (state === play) {\r
-        if (endTime >= this.begin) {\r
+        if ( (endTime >= this.begin) && (startTime > this.begin) ) {\r
+          /*終了時刻に到達したか、再び開始イベントが発火されたとき*/\r
           this.state = end;\r
         } else {\r
           return this;\r
         }\r
       } else if (state === end) {\r
-        this.state = post;\r
+        if (startTime > this.begin) {\r
+          this.state = begin;\r
+        } else {\r
+          this.state = post;\r
+        }\r
       } else {\r
         this.state = begin;\r
       }\r
index 09a1625..83f0dd6 100644 (file)
@@ -229,7 +229,7 @@ describe("SMIL Animation Spec", function() {
       };\r
       appendBegin(0);\r
       expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
-      expect(frame.state).toBe(frame.BEGINNING);\r
+      expect(frame.begin).toBe(0);\r
       expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.state).toBe(frame.PLAYING);\r
       expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
@@ -251,10 +251,13 @@ describe("SMIL Animation Spec", function() {
       frame.begin = 0;\r
       frame.state = frame.WAITING;\r
       expect(frame.updateState(0).state).toBe(frame.BEGINNING);\r
+      expect(frame.begin).toBe(0);\r
       expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
       expect(frame.updateState(0).state).toBe(frame.PLAYING);\r
+      expect(frame.begin).toBe(0);\r
       expect(frame.updateState(1).state).toBe(frame.ENDING);\r
       expect(frame.updateState(1).state).toBe(frame.BEGINNING);\r
+      expect(frame.begin).toBe(1);\r
       expect(frame.updateState(1).state).toBe(frame.PLAYING);\r
       expect(frame.updateState(1).state).toBe(frame.PLAYING);\r
       \r