OSDN Git Service

Modify the object
authordhrname <dhrname@users.sourceforge.jp>
Mon, 9 Feb 2015 12:52:52 +0000 (21:52 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Mon, 9 Feb 2015 12:52:52 +0000 (21:52 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index fd1c7e7..0629980 100644 (file)
@@ -324,23 +324,29 @@ base("$frame").mix ( {
      * base.jsのofメソッドを活用して、関数型っぽい処理をする\r
      * 以下では、活動持続時間を算出*/\r
     call: function() {\r
-      var isIndefDur = (this.dur === "indefinite") || !this.dur,\r
-          isIndefRepeatCount = (this.repeatCount === "indefinite"),\r
-          isIndefRepeatDur = (this.repeatDur === "indefinite"),\r
-          actTime = null;\r
+      var ind = "indefinite",\r
+          isIndefDur = (this.dur === ind) || !this.dur,\r
+          isIndefRepeatCount = (this.repeatCount === ind),\r
+          isIndefRepeatDur = (this.repeatDur === ind),\r
+          isIndefEnd = (this.end === ind),\r
+          actList = [];\r
       if (indef(this)) {\r
-        actTime = null;\r
-      } else if (!isIndefDur) {\r
-        actTime = Math.floor( this.offset(this.dur) * this.fpms);\r
+        return null;\r
       }\r
       if (!isIndefDur && !isIndefRepeatCount && this.repeatCount) {\r
-        actTime = actTime * this.repeatCount;\r
+        actList.push( this.offset(this.dur) * this.repeatCount );\r
+      }\r
+      if (!isIndefDur && !this.repeatCount && !this.repeatDur) {\r
+        /*repeatCountやrepeatDur属性が指定されていない場合*/\r
+        actList.push( this.offset(this.dur) );\r
       }\r
 \r
       /*長くなるため、インライン関数を活用\r
        * indef関数は活動持続時間が不定かどうか、もし、不定なら真を返す*/\r
       function indef(obj) {\r
-        if (obj.end) {\r
+        if(isIndefEnd) {\r
+          return false;\r
+        } else if (obj.end) {\r
           return true;\r
         }\r
         return !!( (isIndefDur && !obj.repeatDur)\r
@@ -349,8 +355,16 @@ base("$frame").mix ( {
                    || (isIndefRepeatCount && isIndefRepeatDur)\r
                  );\r
       };\r
-      indef = void 0;\r
-      return actTime;\r
+      \r
+      ind = isIndefDur = isIndefRepeatCount = isIndefRepeatDurindef  = indef = void 0;\r
+      if (actList.length === 1) {\r
+        return Math.floor( actList[0] * this.fpms);\r
+      } else if(actList.length > 1) {\r
+        /*属性が競合するときは、最小値をとること (SMILアニメーション 3.3.4節)*/\r
+        return Math.floor( Math.min.apply(Math, actList) * this.fpms);\r
+      } else {\r
+        return null;\r
+      }\r
     }\r
   } );\r
   $frame.$begin.$end.of( {\r
@@ -360,7 +374,7 @@ base("$frame").mix ( {
       }\r
       this.parse(this.string);\r
       if (!this.isResolved) {\r
-        return null;\r
+        return "indefinite";\r
       }\r
       return this.begin;\r
     }\r
index 77b2d03..74ec36d 100644 (file)
@@ -2418,17 +2418,17 @@ describe("SMIL Animation Spec", function() {
       end.string = "0";\r
       expect(end.up().call()).toBe(0);\r
       end.string = "hoge";\r
-      expect(end.up().call()).toBeNull();\r
+      expect(end.up().call()).toBe("indefinite");\r
       \r
     } );\r
     /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
     it("should be this for the value (the valid partion)", function() {\r
       end.string = "hoge+0";\r
-      expect(end.up().call()).toBeNull();\r
+      expect(end.up().call()).toBe("indefinite");\r
       end.string = "12ms";\r
       expect(end.up().call()).toBe(Math.floor(12*end.fpms));\r
       end.string = "hoge+12ms";\r
-      expect(end.up().call()).toBeNull();\r
+      expect(end.up().call()).toBe("indefinite");\r
 \r
     } );\r
     /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r