OSDN Git Service

Lighten the updateList method
authordhrname <dhrname@users.sourceforge.jp>
Mon, 7 Nov 2016 13:16:25 +0000 (22:16 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Mon, 7 Nov 2016 13:16:25 +0000 (22:16 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index fc25d5e..b6b9796 100644 (file)
@@ -197,12 +197,13 @@ base("$frame").mix ( {
        * それをbeginプロパティの値cacheBeginと比較する*/\r
       var startTime = this.getMaxList(f, this.beginList),\r
           endTime = this.getMaxList(f, this.endList),\r
+          isWait = (state === wait),\r
           cacheBegin = this.begin;\r
-      if ( (!startTime) && (state === wait) ) {\r
+      if ( !startTime && isWait) {\r
           /*開始時刻が0ならば、アニメーションを開始*/\r
           this.begin = 0;\r
           this.state = begin;\r
-      } else if ( (state === wait) || (state === post) ) {\r
+      } else if ( isWait || (state === post) ) {\r
         if (startTime > cacheBegin) {\r
           this.state = begin;\r
           /*beginプロパティに開始時刻をキャッシュ用に保存*/\r
@@ -247,7 +248,7 @@ base("$frame").mix ( {
       } else {\r
         this.state = begin;\r
       }\r
-      cacheBegin = startTime = endTime = void 0;\r
+      cacheBegin = startTime = endTime = isWait = state = void 0;\r
       return this;\r
     },\r
     \r
@@ -286,7 +287,8 @@ base("$frame").mix ( {
         for (var i=0;i<list.length;++i) {\r
           list[i](this);\r
         }\r
-        /*開始時刻と終了時刻が一致した場合はstateはENDING状態*/\r
+        /*開始時刻と終了時刻が一致した場合はstateはENDING状態\r
+         * それ以外はPLAYING状態*/\r
         state = this.updateState(f).state;\r
       }\r
       if (state === /*this.ENDING*/ 3) {\r
index f866a41..d701599 100644 (file)
@@ -485,7 +485,9 @@ describe("SMIL Animation Spec", function() {
           expect(evt.state).toBe(frame.PLAYING);\r
           t = 3;\r
         });\r
+        frame.state = frame.WAITING;\r
         frame.setFrame(0);\r
+        expect(frame.state).toBe(frame.POSTWAITING);\r
         expect(t).toBe(2);\r
         \r
         t=0;\r