From b0e15796c7f2c42303c72dd740e4d4c2f315c971 Mon Sep 17 00:00:00 2001 From: dhrname Date: Mon, 17 Oct 2016 21:21:29 +0900 Subject: [PATCH] Edit the Spec for the --- org/w3c/dom/smil.js | 17 +++++++-------- tool/Spec/spec/SvgDomSpec.js | 51 -------------------------------------------- 2 files changed, 8 insertions(+), 60 deletions(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index db84e43..b4982ad 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -1305,7 +1305,7 @@ base("$calcMode").up("$attribute").mix( { to: "", /*initメソッドで使われるアニメーション関数*/ - _setFrame: function () { + _setFrame: function ($list) { this.setAttribute(this.to); }, @@ -1313,7 +1313,7 @@ base("$calcMode").up("$attribute").mix( { timeline: base("$frame").$begin, /*アニメが終了した際の後処理*/ - _setEndFrame: function (frame) { + _setEndFrame: function ($list) { /*removeの場合、アニメーションを凍結せずに、もとに戻す*/ if (this.fill === "remove") { this.removeAttribute(); @@ -1339,7 +1339,7 @@ base("$calcMode").up("$attribute").mix( { line.$list.addEvent("end", this._setEndFrame.bind(this)); base("$frame").addLine(line.$list); /*アニメーションが再起動する可能性もあるため、$listのstateプロパティはここで初期化*/ - line.$list.state = this.$list.WAITING; + line.$list.state = line.$list.WAITING; } line = thisele = void 0; } @@ -1373,7 +1373,8 @@ base("$calcMode").up("$attribute").mix( { return ""; }, - _setFrame: function(currentTime) { + _setFrame: function($list) { + var currentTime = $list.currentFrame; /*durationは単純継続時間 *advanceは継続時間内での、進捗率 *  仕様を参照 http://www.w3.org/TR/smil-animation/#AnimFuncValues @@ -1392,11 +1393,9 @@ base("$calcMode").up("$attribute").mix( { }, /*_setEndFrameメソッドは、終了処理と凍結作業をするときに、falseを返す*/ - _setEndFrame: function(frame) { + _setEndFrame: function($list) { + var frame = $list.currentFrame; /*上書きされたメソッドを呼び出してアニメーションの凍結作業をする*/ - if (!this.checkEnd(frame)) { - return; - } if (this.fill === "freeze") { var line = this.timeline, duration = line.simpleDuration; @@ -1775,7 +1774,7 @@ base("$calcMode").up("$attribute").mix( { _setEndFrame: function(currentFrame) { var list = this.element.__transformList; - if (!this.checkEnd(currentFrame) || (this.fill !== "remove") || !list) { + if ((this.fill !== "remove") || !list) { return; } if (!this.isSum) { diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 6b2404b..1a9afd2 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -2234,48 +2234,6 @@ describe("SMIL Animation Spec", function() { expect($set.element).toBeNull(); } ); } ); - describe("An checkEnd method", function() { - var $set, ele, frame; - beforeEach( function() { - $set = base("$calcMode").$attribute.$setElement.up(); - var p = document.createElementNS("http://www.w3.org/2000/svg", "g"); - ele = document.createElementNS("http://www.w3.org/2000/svg", "set"); - p.appendChild(ele); - frame = base("$frame"); - } ); - /*境界条件を調べておく (limit value analysis)*/ - it("should be this for the value (limit value analysis)", function() { - expect($set.checkEnd()).toBeFalsy(); - $set.init(ele); - frame.setFrame(0); - frame.$endFrame.setFrame(0); - expect($set.checkEnd()).toBeFalsy(); - } ); - /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ - it("should be this for the value (the valid partion)", function() { - ele.setAttributeNS(null, "dur", "1s"); - ele.setAttributeNS(null, "attributeName", "fill"); - ele.setAttributeNS(null, "to", "red"); - $set.init(ele); - expect($set.checkEnd(0)).toBeFalsy(); - expect($set.checkEnd(24)).toBeFalsy(); - $set.state = "playing"; - expect($set.checkEnd(25)).toBeTruthy(); - expect($set.state).toBe("idling"); - expect($set.checkEnd(26)).toBeFalsy(); - } ); - /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ - it("should be this for the value (the invalid partion)", function() { - $set.timeline.isResolved = false; - expect($set.checkEnd(0)).toBeFalsy(); - $set.timeline.activeTime = null; - expect($set.checkEnd(0)).toBeFalsy(); - $set.timeline = null; - expect(function() { - $set.checkEnd(0); - } ).toThrow(); - } ); - } ); describe("An init method", function() { var $set, ele, frame; @@ -2368,7 +2326,6 @@ describe("SMIL Animation Spec", function() { /*境界条件を調べておく (limit value analysis)*/ it("should be this for the value (limit value analysis)", function() { expect($set.isEnd).toBeFalsy(); - expect($set.state).toBe("idling"); ele.setAttributeNS(null, "dur", "1s"); ele.setAttributeNS(null, "attributeName", "fill"); ele.setAttributeNS(null, "to", "red"); @@ -2379,12 +2336,10 @@ describe("SMIL Animation Spec", function() { frame.setFrame(0); frame.$endFrame.setFrame(0); expect(ele.parentNode.getAttributeNS(null, "fill")).toBe("red"); - expect($set.state).toBe("playing"); frame.setFrame(24); frame.$endFrame.setFrame(24); expect(ele.parentNode.hasAttributeNS(null, "fill")).toBeFalsy(); - expect($set.state).toBe("idling"); } ); /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ it("should be this for the value (the valid partion)", function() { @@ -3460,12 +3415,9 @@ describe("SMIL Animation Spec", function() { $animate.init(ele); $animate.isCSS = false; expect(p.getAttributeNS(null, "fill") || null).toBeNull(); - expect($animate.state).toBe("idling"); evt = ele.ownerDocument.createEvent("MouseEvents"); evt.initMouseEvent("beginEvent",true, true, window, 0, 0, 0, 0, 0, false, false, false, false,0, ele); - expect($animate.state).toBe("idling"); p.dispatchEvent(evt); - expect($animate.state).toBe("idling"); expect(p.getAttributeNS(null, "fill") || null).toBeNull(); evt = ele.ownerDocument.createEvent("MouseEvents"); @@ -3473,14 +3425,11 @@ describe("SMIL Animation Spec", function() { frame.setFrame(frame.currentFrame); frame.$endFrame.setFrame(frame.currentFrame); expect($animate.isEnd).toBeFalsy(); - expect($animate.state).toBe("idling"); p.dispatchEvent(evt); frame.setFrame(frame.currentFrame + 1); frame.$endFrame.setFrame(frame.currentFrame + 1); - expect($animate.state).toBe("playing"); frame.setFrame(frame.currentFrame + 24); frame.$endFrame.setFrame(frame.currentFrame + 24); - expect($animate.state).toBe("idling"); expect(evt.target.getAttributeNS(null, "fill") || null).toBe("rgb(10, 10, 1)"); } ); } ); -- 2.11.0