[Sie-announce] SIEコード [2178] 0. 64統合

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2010年 11月 24日 (水) 23:12:35 JST


Revision: 2178
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2178
Author:   dhrname
Date:     2010-11-24 23:12:35 +0900 (Wed, 24 Nov 2010)

Log Message:
-----------
0.64統合

Modified Paths:
--------------
    branches/06x/org/w3c/dom/css.js
    branches/06x/org/w3c/dom/events.js
    branches/06x/org/w3c/dom/svg.js

Property Changed:
----------------
    branches/06x/org/
    branches/06x/org/w3c/
    branches/06x/org/w3c/core.js
    branches/06x/org/w3c/dom/css.js
    branches/06x/org/w3c/dom/events.js
    branches/06x/org/w3c/dom/svg.js


Property changes on: branches/06x/org
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/06x/061/org:1864-2067
/branches/06x/062/org:2071-2106
/branches/06x/063/org:2110-2146
   + /branches/06x/061/org:1864-2067
/branches/06x/062/org:2071-2106
/branches/06x/063/org:2110-2146
/branches/06x/064/org:2149-2177


Property changes on: branches/06x/org/w3c
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/06x/061/org/w3c:1864-2067
/branches/06x/062/org/w3c:2071-2106
/branches/06x/063/org/w3c:2110-2146
/branches/ufltima:1621-1788
   + /branches/06x/061/org/w3c:1864-2067
/branches/06x/062/org/w3c:2071-2106
/branches/06x/063/org/w3c:2110-2146
/branches/06x/064/org/w3c:2149-2177
/branches/ufltima:1621-1788


Property changes on: branches/06x/org/w3c/core.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/06x/061/org/w3c/core.js:1864-2067
/branches/06x/062/org/w3c/core.js:2071-2106
/branches/06x/063/org/w3c/core.js:2110-2146
/branches/ufltima/core.js:1621-1854
   + /branches/06x/061/org/w3c/core.js:1864-2067
/branches/06x/062/org/w3c/core.js:2071-2106
/branches/06x/063/org/w3c/core.js:2110-2146
/branches/06x/064/org/w3c/core.js:2149-2177
/branches/ufltima/core.js:1621-1854

Modified: branches/06x/org/w3c/dom/css.js
===================================================================
--- branches/06x/org/w3c/dom/css.js	2010-11-24 14:10:19 UTC (rev 2177)
+++ branches/06x/org/w3c/dom/css.js	2010-11-24 14:12:35 UTC (rev 2178)
@@ -702,21 +702,43 @@
   var style = this.defaultView.getComputedStyle(tar, "")
   s.setProperty = function(propertyName, value, priority) {
     var tar = elt, el = tar._tar, isFill = isStroke = false;
+    if ((tar.localName === "g") || (tar.localName === "a")) {
+      var sl = tar.getElementsByTagNameNS("http://www.w3.org/2000/svg", "*");
+      if (sl) {
+        for (var i=0,sli=sl.length;i<sli;++i) {
+          var di = sl[i];
+          NAIBU._setPaint(di, di.getScreenCTM());
+          di = null;
+        }
+        sl = null;
+      }
+      el = null;
+    }
+    if (!el) {
+      setProp.call(s, propertyName, value, priority);
+      return;
+    }
     if (!!!tar._fillElement) {
       tar._fillElement = document.createElement("v:fill"); //キャッシュを作る
     } else {
-      /*あらかじめ消しおかないと、効果が出ない*/
-      el.removeChild(tar._fillElement);
+      var tgebtfill = el.getElementsByTagName("fill");
+      if (tgebtfill.length > 0) {
+        /*あらかじめ消しおかないと、効果が出ない*/
+        el.removeChild(tgebtfill[0]);
+      }
+      tgebtfill = null;
       isFill = true;
     }
     if (!!!tar._strokeElement) {
       tar._strokeElement = document.createElement("v:stroke");
     } else {
-      /*あらかじめ消しおかないと、効果が出ない*/
-      el.removeChild(tar._strokeElement);
+      var tgebtstroke = el.getElementsByTagName("stroke")
+      if (tgebtstroke.length > 0) {
+        el.removeChild(tgebtstroke[0]);
+      }
+      tgebtstroke = null;
       isStroke = true;
     }
-
     var fillElement = tar._fillElement, strokeElement = tar._strokeElement;
     setProp.call(s, propertyName, value, priority);
     if (propertyName === "fill-opacity") {


Property changes on: branches/06x/org/w3c/dom/css.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/06x/061/org/w3c/dom/css.js:1864-2067
/branches/06x/062/org/w3c/dom/css.js:2071-2106
/branches/06x/063/org/w3c/dom/css.js:2110-2146
/branches/ufltima/dom/css.js:1621-1855
   + /branches/06x/061/org/w3c/dom/css.js:1864-2067
/branches/06x/062/org/w3c/dom/css.js:2071-2106
/branches/06x/063/org/w3c/dom/css.js:2110-2146
/branches/06x/064/org/w3c/dom/css.js:2149-2177
/branches/ufltima/dom/css.js:1621-1855

Modified: branches/06x/org/w3c/dom/events.js
===================================================================
--- branches/06x/org/w3c/dom/events.js	2010-11-24 14:10:19 UTC (rev 2177)
+++ branches/06x/org/w3c/dom/events.js	2010-11-24 14:12:35 UTC (rev 2178)
@@ -155,7 +155,7 @@
    *
    */
   for (var i=0, n=1, d=0, tce = null, sli = s.length, slii = sli*2-1;i<slii;++i){
-    d = sli - i - 1;
+    var d = sli - i - 1;
     if (d === 0){ //イベントのターゲットに到着(折り返し地点)
       n = -1;
       evt.eventPhase = 2;//Event.AT_TARGET;


Property changes on: branches/06x/org/w3c/dom/events.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/06x/061/org/w3c/dom/events.js:1864-2067
/branches/06x/062/org/w3c/dom/events.js:2071-2106
/branches/06x/063/org/w3c/dom/events.js:2110-2146
/branches/ufltima/dom/events.js:1621-1856
   + /branches/06x/061/org/w3c/dom/events.js:1864-2067
/branches/06x/062/org/w3c/dom/events.js:2071-2106
/branches/06x/063/org/w3c/dom/events.js:2110-2146
/branches/06x/064/org/w3c/dom/events.js:2149-2177
/branches/ufltima/dom/events.js:1621-1856

Modified: branches/06x/org/w3c/dom/svg.js
===================================================================
--- branches/06x/org/w3c/dom/svg.js	2010-11-24 14:10:19 UTC (rev 2177)
+++ branches/06x/org/w3c/dom/svg.js	2010-11-24 14:12:35 UTC (rev 2178)
@@ -1530,6 +1530,15 @@
       NAIBU.doc.validateOnParse = false;
       NAIBU.doc.resolveExternals = false;
       NAIBU.doc.loadXML(str);
+      /*IE6-8のみで使えるupdateIntervalは、
+       *描画間隔の調整が可能。デフォルトは0。
+       *スクロール時にバグが起きるので、0に戻してやる必要がある。
+       */
+      screen.updateInterval = 999;
+      window.onscroll = function () {
+        screen.updateInterval = 0;
+        screen.updateInterval = 99;
+      }
       var objei = this._tar;
       if (/&[^;]+;/.test(str)) {
         /*以下の処理は、実体参照を使ったとき
@@ -2150,9 +2159,12 @@
   /*以下では、スタイルシートを用いて、fill-とstroke-関連の
    *処理を行う。SVGPaintインターフェースをも用いる
    */
-  var tod = tar.ownerDocument;
+  var tod = tar.ownerDocument, el = tar._tar;
+  if (!el) {
+    return;
+  }
   var style = tod.defaultView.getComputedStyle(tar, "");
-  var el = tar._tar, fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke");
+  var fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke");
   if (fill.paintType === /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1 || fill.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
     if (fill.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
       /*再度、設定。css.jsのsetPropertyを参照*/
@@ -2160,8 +2172,12 @@
     }
     if (!!tar._fillElement) {
       var fillElement = tar._fillElement;
-      /*あらかじめ消しおかないと、効果が出ない*/
-      el.removeChild(fillElement);
+      var tgebtfill = el.getElementsByTagName("fill");
+      if (tgebtfill.length > 0) {
+        /*あらかじめ消しおかないと、効果が出ない*/
+        el.removeChild(tgebtfill[0]);
+      }
+      tgebtfill = null;
     } else {
       var fillElement = document.createElement("v:fill");
     }
@@ -2205,7 +2221,11 @@
     }
     if (!!tar._strokeElement) {
       var strokeElement = tar._strokeElement;
-      el.removeChild(strokeElement);
+      var tgebtstroke = el.getElementsByTagName("stroke")
+      if (tgebtstroke.length > 0) {
+        el.removeChild(tgebtstroke[0]);
+      }
+      tgebtstroke = null;
     } else {
       var strokeElement = document.createElement("v:stroke");
     }
@@ -4634,10 +4654,10 @@
 SVGAnimationElement.prototype._eventRegExp = /(mouse|activ|clic)[a-z]+/;
 SVGAnimationElement.prototype._timeRegExp = /[\-\d\.]+(h|min|s|ms)?/;
 SVGAnimationElement.prototype._unit = {
-    "h" : 2880000,
+    "h"   : 2880000,
     "min" : 48000,
-    "s" : 800,
-    "ms" : 0.8
+    "s"   : 800,
+    "ms"  : 0.8
 };
 /*どれだけズレの時間があるかを計測するメソッド
  *tに数値が使われていないときは0を返す
@@ -4690,7 +4710,7 @@
  *決して現在時刻ではない。要素のbeginイベントの発火したときが0sである。
  */
 /*float*/ SVGAnimationElement.prototype.getCurrentTime = function(){
-  return (this._currentFrame * 125 / 0.8);
+  return (this._currentFrame * 125 * 0.8);
 };
 /*float*/ SVGAnimationElement.prototype.getSimpleDuration = function(){
   if (!!!this._simpleDuration && !!!this._end && this._simpleDuration !== 0) {
@@ -4708,11 +4728,12 @@
   Max : 7000,
   start : function() {
   if (NAIBU.Clip.length > 0) {
+    screen.updateInterval = 42; //24fpsとして描画処理
     NAIBU.stop = setInterval( (function() {
 /*      try{*/
         var ntc = NAIBU.Time.currentFrame++;
         var nc = NAIBU.Clip;
-        var s = ntc * 125 / 0.8; //フレーム数ntcをミリ秒数sに変換
+        var s = ntc * 125 * 0.8; //フレーム数ntcをミリ秒数sに変換
         if (ntc > NAIBU.Time.Max) {
           clearInterval(NAIBU.stop);
         }
@@ -4736,7 +4757,6 @@
             }
             if (!!nci._frame) {
               nci._frame();
-              nci._currentFrame++;
             }
           }
           nci = null;
@@ -4745,7 +4765,7 @@
         stlog.add(e, 4157);
       }*/
         }),
-         64
+         1
       );
     }
  }
@@ -4762,6 +4782,15 @@
    *機械が理解できる形で保管されているvalueの値の配列リスト
    */
   this._valueList = [];
+  this._isDiscrete = false;
+  this.addEventListener("DOMAttrModified", function(evt){
+    if (evt.eventPhase === Event.BUBBLING_PHASE) {
+      return; //強制終了させる
+    }
+    if ((evt.attrName === "calcMode") && (evt.newValue === "discrete")) {
+      evt.target._isDiscrete = true;
+    }
+  }, false);
   this.addEventListener("DOMNodeInserted", function(evt){
     if (evt.eventPhase === Event.BUBBLING_PHASE) {
       return; //強制終了させる
@@ -4778,7 +4807,7 @@
         tar._values[0] = ttr.getAttributeNS(null, attrName) || ttr.style.getPropertyValue(attrName);
       }
       if (!!tta) {
-        ttr[attrName].animVal = vi[attrName].baseVal;
+        tta.animVal = vi[attrName].baseVal;
         for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
           var vir = ttr.cloneNode(false); //仮の要素
           delete vir._tar;
@@ -4809,7 +4838,7 @@
         vi = null;
         return;
       }
-      if ((tar._keyTimes[1] === 1) && (tar._valueList.length > 2)) {
+      if ((tar._keyTimes[1] === 1) && (tar._valueList.length > 2)) { //keyTimesが設定されていない場合、均等に時間を割り振る
         for (var i=0,n=0,tvli=tar._valueList.length-1;i<tvli;++i) {
           n += 1 / tvli;
           tar._keyTimes[i+1] = n;
@@ -4839,13 +4868,16 @@
       evt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
       if (!!tta) {
         var base = tta.baseVal, tanim = tta.animVal;
-        var v1 = tar._valueList[ii].value, v2 = tar._valueList[ii+1].value;
+        var v1 = tar._valueList[ii].value;
         /*vを求める公式に関しては、SMIL2.0 Animation Moduleの単純アニメーション関数の項を参照
          * 3.4.2 Specifying the simple animation function f(t)
          *http://www.w3.org/TR/2005/REC-SMIL2-20050107/animation.html#animationNS-SpecifyingAnimationFunction
          */
-        var v = v1 + (v2-v1) * (tg-tar._keyTimes[ii]*d) / d;
-        console.log(tg);
+        if (!tar._isDiscrete) {
+          var v2 = tar._valueList[ii+1].value, di = (tar._keyTimes[ii+1] - tar._keyTimes[ii]) * d, v = v1 + (v2-v1) * (tg-tar._keyTimes[ii]*d) / di;
+        } else {
+          var v = v1;
+        }
         tanim.newValueSpecifiedUnits(tanim.unitType, v);
         tta.baseVal = tanim;
         tanim = null;
@@ -4855,25 +4887,29 @@
          */
         tta.animVal = tta.baseVal;
         tta.baseVal = base;
+        di = null;
       } else if (!!CSS2Properties[attrName] || attrName.indexOf("-") > -1) { //スタイルシートのプロパティならば
         var base = null;
-        var v1 = tar._valueList[ii], v2 = tar._valueList[ii+1];
-        var v = v1 + (v2-v1) * (tg-tar._keyTimes[ii]*d) / d;
-        ttr.dispatchEvent(evt);
+        var v1 = tar._valueList[ii].value, v2 = tar._valueList[ii+1].value, di = (tar._keyTimes[ii+1] - tar._keyTimes[ii]) * d;
+        if (!tar._isDiscrete) {
+          var v = v1 + (v2-v1) * (tg-tar._keyTimes[ii]*d) / di;
+        } else {
+          var v = v1;
+        }
       } else if ("animatedPoints" in ttr) {
         var base = ttr.points;
         ttr.points = ttr.animatedPoints;
         ttr.dispatchEvent(evt);
-        tta.animatedPoints = tta.points;
-        tta.points = base;
+        ttr.animatedPoints = ttr.points;
+        ttr.points = base;
       } else if ("normalizedPathSegList" in ttr) {
         var base = ttr.normalizedPathSegList;
         ttr.normalizedPathSegList = ttr.animatedNormalizedPathSegList;
         ttr.dispatchEvent(evt);
-        tta.animatedNormalizedPathSegList = tta.normalizedPathSegList;
-        tta.normalizedPathSegList = base;
+        ttr.animatedNormalizedPathSegList = ttr.normalizedPathSegList;
+        ttr.normalizedPathSegList = base;
       }
-     evt = v1 = v2 = v = null;
+     evt = v1 = v2 = v = d = n = ii = tg = null;
     };
     evt = vir = null;
   }, false);
@@ -5038,6 +5074,26 @@
 function SVGAnimateColorElement() {
   SVGAnimationElement.apply(this);
   NAIBU.Clip[NAIBU.Clip.length] = this;
+  this._valueList = [];
+  this.addEventListener("DOMNodeInserted", function(evt){
+    if (evt.eventPhase === Event.BUBBLING_PHASE) {
+      return; //強制終了させる
+    }
+    var tar = evt.target;
+    tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt){
+      var tar = evt.target, attrName = tar.getAttributeNS(null, "attributeName"),ttr = tar.targetElement;
+      var fstyle = tar.ownerDocument.defaultView.getComputedStyle(ttr, "");
+      if (!tar._values[0]) {
+        tar._values[0] = fstyle.getPropertyValue(attrName);
+      }
+      for (var i=0, tav=tar._values, tvli=tav.length;i<tvli;++i) {
+        var to = new SVGColor();
+        to.setRGBColor(tar._values[i]);
+        tar._valueList[tar._valueList.length] = to;
+        to = null;
+      }
+    }, false);
+  }, false);
   this.addEventListener("beginEvent", function(evt) {
     var tar = evt.target, attrName = tar.getAttributeNS(null, "attributeName");
     var style = tar.ownerDocument.getOverrideStyle(tar.targetElement, "");
@@ -5046,30 +5102,20 @@
       style.setProperty(attrName, tar._values[0], null);
     }
     tar._frame = function() {
-      var _tar = tar, to = new SVGColor(), from = new SVGColor();
-      var d = _tar.getSimpleDuration();
-      if (d === 0) {
-        d = null;
+      var _tar = tar;
+      var d = _tar.getSimpleDuration() * 0.8, n = _tar._valueList.length - 1, tg = _tar.getCurrentTime();
+      if ((n !== -1) && (d !== 0) && (tg <= d)) {
+        var ii = Math.floor((tg*n) / d);
+      } else {
         return;
       }
-      var n = _tar._values.length - 1, t = _tar.getCurrentTime(), i = Math.floor((t*n) / d);
-      to.setRGBColor(_tar._values[i+1]);
-      from.setRGBColor(_tar._values[i]);
-      if (!!!_tar._keyTimes) {
-        var ti = d / n, ki =ti;
-        if (n === 1) {
-          ti = 0;
-        }
-      } else {
-        var ti = parseFloat(_tar._keyTimes[i]) * d;
-        var ki = parseFloat(_tar._keyTimes[i+1])*d - ti;
-      }
-      var tc = to.rgbColor, fc = from.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER, di = (t - ti) / ki;
-      var r = fc.red.getFloatValue(num) + (tc.red.getFloatValue(num) - fc.red.getFloatValue(num)) * di;
-      var g = fc.green.getFloatValue(num) + (tc.green.getFloatValue(num) - fc.green.getFloatValue(num)) * di;
-      var b = fc.blue.getFloatValue(num) + (tc.blue.getFloatValue(num) - fc.blue.getFloatValue(num)) * di;
+      var fc = _tar._valueList[ii].rgbColor, tc = _tar._valueList[ii+1].rgbColor, di = (_tar._keyTimes[ii+1] - _tar._keyTimes[ii]) * d, durd = (tg-tar._keyTimes[ii]*d) / di, num = CSSPrimitiveValue.CSS_NUMBER;
+      var fr = fc.red.getFloatValue(num), fg = fc.green.getFloatValue(num), fb = fc.blue.getFloatValue(num);
+      var r = fr + (tc.red.getFloatValue(num) - fr) * durd;
+      var g = fg + (tc.green.getFloatValue(num) - fg) * durd;
+      var b = fb + (tc.blue.getFloatValue(num) - fb) * durd;
       style.setProperty(attrName, "rgb(" +Math.ceil(r)+ "," +Math.ceil(g)+ "," +Math.ceil(b)+ ")", null);
-      _tar = t = to = from = fc = tc = num = r = g = b = null;
+      _tar = d = n = tg = fc = tc = fr = fg = fb = num = r = g = b = null;
     }
   }, false);
   this.addEventListener("endEvent", function(evt) {
@@ -5341,6 +5387,8 @@
     if ("stop" in NAIBU) {
       clearInterval(NAIBU.stop);
     }
+    window.dettachEvent("onload", NAIBU._main);
+    window.onscroll = NAIBU.emptyFunction;
     Element = SVGElement = Attr = NamedNodeMap = CSS2Properties = CSSValue = CSSPrimitiveValue = NAIBU.xmlhttp = Node = Event = NAIBU = stlog = STLog = document = null;
     Array = ActiveXObject = null;
   } catch(e) {}
@@ -5440,6 +5488,7 @@
       s = null;
     }
   }
+  xmlhttp = null;
 });
 NAIBU.addEvent("load", NAIBU._main);
 NAIBU.utf16 = function ( /*string*/ s)  {


Property changes on: branches/06x/org/w3c/dom/svg.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/06x/061/org/w3c/dom/svg.js:1864-2067
/branches/06x/062/org/w3c/dom/svg.js:2071-2106
/branches/06x/063/org/w3c/dom/svg.js:2110-2146
/branches/ufltima/dom/svg.js:1621-1856
   + /branches/06x/061/org/w3c/dom/svg.js:1864-2067
/branches/06x/062/org/w3c/dom/svg.js:2071-2106
/branches/06x/063/org/w3c/dom/svg.js:2110-2146
/branches/06x/064/org/w3c/dom/svg.js:2149-2177
/branches/ufltima/dom/svg.js:1621-1856




Sie-announce メーリングリストの案内
Zurück zum Archiv-Index