From bfc9cbbe0cce6b897b707ec03bb8a89cd98867a7 Mon Sep 17 00:00:00 2001 From: dhrname Date: Sun, 4 Oct 2015 22:25:59 +0900 Subject: [PATCH] Add to a timeline property to the object --- org/w3c/dom/smil.js | 18 ++++++++++++------ tool/Spec/spec/SvgDomSpec.js | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 9892ef2..bed08a5 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -1007,21 +1007,27 @@ base("$calcMode").up("$attribute").mix( { /*アニメーションが終了したかどうか*/ isEnd: false, + /*開始を設定されたタイムライン ($beginオブジェクト)*/ + timeline: base("$frame").$begin, + /*アニメが終了した際の後処理 * 終了した後は、ひたすらtrueを値として返す*/ _setEndFrame: function(frame) { - if (isNaN(this.begin + this.activeTime) - || ( frame < (this.begin + this.activeTime) ) || this.isEnd) { - /*イベントが設定されており、未解決である場合、あるいは、 - * アニメーションが終了間近でなければ凍結の処理をしない*/ + if (( frame < (this.begin + this.activeTime) ) || this.isEnd) { + /*アニメーションが終了間近でなければ凍結の処理をしない*/ return true; - } else { + } else if (!isNaN(this.begin + this.activeTime)) { + /*イベントが設定されていないか、解決済みである場合*/ this.isEnd = true; - /*アニメーションを凍結せずに、もとに戻す*/ + /*removeの場合、アニメーションを凍結せずに、もとに戻す*/ if ((this.fill === "remove") && this.isDefault) { this.element.setAttributeNS(this.attrNameSpace, this.attrName, this.defaultValue); } else if (this.fill === "remove"){ this.element.removeAttributeNS(this.attrNameSpace, this.attrName); + } else { + /*freezeの場合、ここで、setTimeメソッドを呼び出しておかないと、 + * simpleDurationプロパティが設定されない問題が起きる(イベント設定時のみ)*/ + this.setTime(this.timeline); } return false; } diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 13feaf9..108c904 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -3724,6 +3724,8 @@ describe("SMIL Animation Spec", function() { } ); /*境界条件を調べておく (limit value analysis)*/ it("should be this for the value (limit value analysis)", function() { + expect($set.timeline).toBe(frame.$begin); + expect($set.activeTime).toBeUndefined(); expect($set.begin).toBeUndefined(); expect($set.simpleDuration).toBeUndefined(); @@ -4243,6 +4245,7 @@ describe("SMIL Animation Spec", function() { evt = ele.ownerDocument.createEvent("MouseEvents"); evt.initMouseEvent("mousedown",true, true, window, 0, 0, 0, 0, 0, false, false, false, false,0, p); p.addEventListener("mousedown", function(evt) { + expect($animate.isEnd).toBeFalsy(); frame.setFrame(24); expect(evt.target.getAttributeNS(null, "fill") || null).toBe("rgb(10, 10, 1)"); }, false ); -- 2.11.0