OSDN Git Service

Modify the element property
authordhrname <dhrname@users.sourceforge.jp>
Sun, 5 Apr 2015 11:01:21 +0000 (20:01 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sun, 5 Apr 2015 11:01:21 +0000 (20:01 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 987c760..45b9416 100644 (file)
@@ -684,12 +684,27 @@ base("$calcMode").up("$attribute").mix( {
   /*前述の$frameオブジェクトでフレームを記述*/\r
   frame: base("$frame"),\r
   \r
-  /*SMILアニメーション関連の要素。たとえばanimate要素*/\r
+  /*アニメーションの対象となる要素。たとえば、animate要素の親要素*/\r
   element: null,\r
   \r
   /*引数で指定した要素 ele の属性を解析して、フレームに追加する*/\r
   push: function(/*Element Node*/ ele) {\r
-    this.element = ele || null;\r
+    if (!ele) {\r
+      return;\r
+    }\r
+    this.element = ele.parentNode || null;\r
+    if (!( ele.hasAttribute("from") || ele.hasAttribute("to")\r
+         || ele.hasAttribute("by") || ele.hasAttribute("values") ) ) {\r
+      /*from属性、to、by、values属性が指定されていない場合、アニメーションの効果が出ないように調整する\r
+       *SMILアニメーションの仕様を参照\r
+       *\r
+       *>if none of the from, to, by or values attributes are specified, the animation will have no effect\r
+       *「3.2.2. Animation function values」より引用\r
+       *http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues\r
+      */\r
+      return;\r
+    }\r
+    this.frame.addLine(this.frame.$begin);\r
   }\r
 } );\r
 //#endif // _SMIL_IDL_\r
index 7bb4eb0..788e82e 100644 (file)
@@ -3324,13 +3324,22 @@ describe("SMIL Animation Spec", function() {
         expect(attr.element).toBeNull();\r
         expect(attr.frame.timelines.length).toEqual(0);\r
         \r
-        attr.push(document.documentElement);\r
-        expect(attr.element).toBe(document.documentElement);\r
-        expect(attr.frame.timelines.length).toEqual(0);\r
         var s = document.createElement("animate");\r
         attr.push(s);\r
-        expect(attr.element).toBe(s);\r
+        expect(attr.element).toBeNull();\r
         expect(attr.frame.timelines.length).toEqual(0);\r
+        \r
+        var p = document.createElement("g");\r
+        p.appendChild(s);\r
+        attr.push(s);\r
+        expect(attr.element).toBe(p);\r
+        expect(attr.frame.timelines.length).toEqual(0);\r
+        \r
+        s.setAttribute("from");\r
+        expect(s.hasAttributeNS(null, "from")).toBeTruthy();\r
+        attr.push(s);\r
+        expect(attr.element).toBe(p);\r
+        expect(attr.frame.timelines.length).toEqual(1);\r
       } );\r
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
       it("should be this for the value (the valid partion on a spline mode )", function() {\r