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