From: dhrname Date: Wed, 15 Apr 2015 13:06:04 +0000 (+0900) Subject: Change the frame property of the object X-Git-Tag: version22~225 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1c5df20ff99fa36a786ed842d34250c95c27fe52;p=sie%2Fsie.git Change the frame property of the object --- diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index ae56d41..e9a99fa 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -681,8 +681,8 @@ Math.qubicnewton = function(a0, a1, a2, a3, b) { * $calcModeオブジェクトから継承*/ base("$calcMode").up("$attribute").mix( { - /*前述の$frameオブジェクトでフレームを記述*/ - frame: base("$frame"), + /*$frameオブジェクトのフレームリスト*/ + frame: [], /*アニメーションの対象となる要素。たとえば、animate要素の親要素*/ element: null, @@ -705,7 +705,8 @@ base("$calcMode").up("$attribute").mix( { return; } /*eleの属性の値を、それぞれオブジェクトに割り当て*/ - var begin = this.frame.$begin, + var $frame = base("$frame"), + begin = $frame.$begin, frame = begin.up().mix( { string: (getAttr("begin") || "0"), $activate: begin.$activate.up().mix( { @@ -723,7 +724,8 @@ base("$calcMode").up("$attribute").mix( { frame.listener( { timeStamp: Date.now() } ); - this.frame.addLine(frame); + $frame.addLine(frame); + this.frame.push(frame); } /*属性を取得するためのインライン関数*/ function getAttr(name) { diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index d067ac3..cc504c4 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -3311,7 +3311,7 @@ describe("SMIL Animation Spec", function() { } ); describe("A $attribute object", function() { describe("An push method", function() { - var attr, s, p; + var attr, s; beforeEach( function() { attr = base("$calcMode").$attribute.up("width"); base("$frame").timelines.length = 0; @@ -3320,21 +3320,24 @@ describe("SMIL Animation Spec", function() { } ); /*境界条件を調べておく (limit value analysis)*/ it("should be this for the value (limit value analysis)", function() { - expect(attr.frame).toBe(base("$frame")); + expect(attr.frame.length).toEqual(0); expect(attr.element).toBeNull(); attr.push(); expect(attr.element).toBeNull(); - expect(attr.frame.timelines.length).toEqual(0); + expect(attr.frame.length).toEqual(0); + expect(base("$frame").timelines.length).toEqual(0); attr.push(s); expect(attr.element).toBeNull(); - expect(attr.frame.timelines.length).toEqual(0); + expect(attr.frame.length).toEqual(0); + expect(base("$frame").timelines.length).toEqual(0); var p = document.createElement("g"); p.appendChild(s); attr.push(s); expect(attr.element).toBe(p); - expect(attr.frame.timelines.length).toEqual(0); + expect(attr.frame.length).toEqual(0); + expect(base("$frame").timelines.length).toEqual(0); s.setAttribute("end", "0"); check("from", 1); @@ -3346,8 +3349,10 @@ describe("SMIL Animation Spec", function() { expect(s.hasAttributeNS(null, attrName)).toBeTruthy(); attr.push(s); expect(attr.element).toBe(p); - expect(attr.frame.timelines.length).toEqual(num); - var line = attr.frame.timelines[num-1]; + var timelines = base("$frame").timelines; + expect(timelines.length).toEqual(num); + var line = timelines[num-1]; + expect(line).toBe(attr.frame[attr.frame.length-1]); expect(line.string).toBe("0"); var act = line.$activate; expect(act.dur).toBeNull(); @@ -3362,7 +3367,7 @@ describe("SMIL Animation Spec", function() { expect(s.hasAttributeNS(null, attrName)).toBeFalsy(); attr.push(s); expect(attr.element).toBe(p); - expect(attr.frame.timelines.length).toEqual(num); + expect(timelines.length).toEqual(num); }; } ); /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ @@ -3399,7 +3404,9 @@ describe("SMIL Animation Spec", function() { expect(s.hasAttributeNS(null, attrName)).toBeTruthy(); attr.push(s); expect(attr.element).toBe(p); - var line = attr.frame.timelines[attr.frame.timelines.length-1]; + var timelines = base("$frame").timelines; + var line = timelines[timelines.length-1]; + expect(line).toBe(attr.frame[attr.frame.length-1]); expect(line.string).toBe(values[0]); var act = line.$activate; expect(act.dur).toBe(values[1]); @@ -3413,6 +3420,16 @@ describe("SMIL Animation Spec", function() { } ); /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ it("should be this for the value (the invalid partion on a spline mode )", function() { + var p = document.createElement("g"); + p.appendChild(s); + + s.setAttributeNS(null, "begin", "1"); + attr.push(s); + var timelines = base("$frame").timelines; + expect(timelines.length).toEqual(0); + s.setAttributeNS(null, "from", "1"); + attr.push(s); + expect(timelines.length).toEqual(0); } ); } ); describe("A getAttr method", function() {