svnno****@sourc*****
svnno****@sourc*****
2010年 6月 30日 (水) 23:24:39 JST
Revision: 1916 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1916 Author: dhrname Date: 2010-06-30 23:24:39 +0900 (Wed, 30 Jun 2010) Log Message: ----------- Modified Paths: -------------- branches/06x/061/org/w3c/dom/smil.js branches/06x/061/org/w3c/dom/svg.js Modified: branches/06x/061/org/w3c/dom/smil.js =================================================================== --- branches/06x/061/org/w3c/dom/smil.js 2010-06-30 13:50:52 UTC (rev 1915) +++ branches/06x/061/org/w3c/dom/smil.js 2010-06-30 14:24:39 UTC (rev 1916) @@ -88,11 +88,11 @@ this._tar.dispatchEvent(evt); }, /*void*/ beginElementAt : function(/*float*/ offset) { - var ntc = this._tar.ownerDocument.rootElement.getCurrentTime(); + var ntc = this._tar.ownerDocument.documentElement.getCurrentTime(); this._begin = offset + ntc; }, /*void*/ endElementAt : function(/*float*/ offset) { - var ntc = this._tar.ownerDocument.rootElement.getCurrentTime(); + var ntc = this._tar.ownerDocument.documentElement.getCurrentTime(); this._end = offset + ntc; } }; Modified: branches/06x/061/org/w3c/dom/svg.js =================================================================== --- branches/06x/061/org/w3c/dom/svg.js 2010-06-30 13:50:52 UTC (rev 1915) +++ branches/06x/061/org/w3c/dom/svg.js 2010-06-30 14:24:39 UTC (rev 1916) @@ -3750,8 +3750,15 @@ SVGElement.apply(this, arguments); /*readonly SVGElement*/ this.targetElement; this._currentTime = 0; + this._currentCount = 0; + /*_maxCountはrepeatCount属性で指定された数値 + *_maxDurはrepeatDur属性で指定された数値 + */ + this._maxCount = 0; + this._maxDur = 0; + this._isRepeat = false; /*_simpleDurationプロパティは - *dur属性の値を収納しておく。属性がなければnullのまま + *dur属性の数値を収納しておく。属性がなければnullのまま */ this._simpleDuration = null; //別モジュールであるsmil::ElementTimeControlを参照のこと @@ -3765,6 +3772,26 @@ this.endElementAt = s.endElementAt; //NAIBU.Clipというリストに追加 NAIBU.Clip[NAIBU.Clip.length] = this; + this.addEventListener("beginEvent", function(evt) { + var tar = evt.target; + if (!tar.isRepeat) { + tar.endElementAt(tar.getSimpleDuration()); + } else { + tar.beginElementAt(tar.getSimpleDuration()); + if (tar.getCurrentTime() !== 0) { + var ttd = tar.ownerDocument, evt = ttd.createEvent("TimeEvents"); + tar._currentCount++; + evt.initTimeEvent("repeatEvent", ttd.defaultView, tar._currentCount); + tar.dispatchEvent(evt); + } + } + }, false); + this.addEventListener("repeatEvent", function(evt) { + var tar = evt.target; + if ((tar._currentCount >= tar._maxCount) || (tar.getCurrentTime() >= (tar._maxDur+tar.getStartTime()))) { + tar._isRepeat = false; + } + }, false); return this; }; SVGAnimationElement.constructor = SVGElement; @@ -3801,6 +3828,7 @@ var s = ntc * 125 / 0.8; //フレーム数ntcをミリ秒数sに変換 for (var i=0,ncli=nc.length;i<ncli;++i) { var nci = nc[i]; + nci.ownerDocument.documentElement.setCurrentTime(s); if (nci.getStartTime() <= s) { if (nci.getCurrentTime() === 0) { nci.beginElement();