[Sie-announce] SIEコード [2435] 0. 71 モジュール統合

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 2月 25日 (金) 22:35:17 JST


Revision: 2435
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2435
Author:   dhrname
Date:     2011-02-25 22:35:17 +0900 (Fri, 25 Feb 2011)

Log Message:
-----------
0.71 モジュール統合

Modified Paths:
--------------
    branches/07x/sie.js

Modified: branches/07x/sie.js
===================================================================
--- branches/07x/sie.js	2011-02-25 13:30:57 UTC (rev 2434)
+++ branches/07x/sie.js	2011-02-25 13:35:17 UTC (rev 2435)
@@ -2111,6 +2111,9 @@
   for (var i=0,pli=p.length;i<pli;++i) {
     q[q.length] = p[i];
   }
+  if (elt._runtimeStyle) {
+    q = elt._runtimeStyle._list.concat(q);
+  }
   s._def = this._defaultCSS;    //デフォルト値の設定
   s._list =  q;
   if (!!elt.style) {
@@ -2137,14 +2140,16 @@
     var s = new CSSStyleDeclaration(), setProp = s.setProperty; //このsetPropは関数オブジェクトではなくて、単なる関数のラベル
     tar._runtimeStyle = s;
   }
-  var style = this.defaultView.getComputedStyle(tar, "")
   s.setProperty = function(propertyName, value, priority) {
+    setProp.call(s, propertyName, value, priority);
     var tar = elt, el = tar._tar, isFill = isStroke = false;
+    delete tar._currentStyle;
     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];
+          delete di._currentStyle;
           NAIBU._setPaint(di, di.getScreenCTM());
           di = null;
         }
@@ -2153,146 +2158,10 @@
       el = null;
     }
     if (!el) {
-      setProp.call(s, propertyName, value, priority);
       return;
     }
-    if (!!!tar._fillElement) {
-      tar._fillElement = document.createElement("v:fill"); //キャッシュを作る
-    } else {
-      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 {
-      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") {
-      var fillOpacity = parseFloat(value) * style._list._opacity; //opacityを掛け合わせる
-      if (fillOpacity < 1) {
-        fillElement.setAttribute("opacity", fillOpacity+"");
-        isFill = true;
-      }
-    } else if (propertyName === "opacity") {
-      var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * parseFloat(value); //opacityを掛け合わせる
-      if (fillOpacity < 1) {
-        fillElement.setAttribute("opacity", fillOpacity+"");
-        isFill = true;
-      }
-      var strokeOpacity = parseFloat(style.getPropertyValue("stroke-opacity")) * parseFloat(value);
-      if (strokeOpacity < 1) {
-        strokeElement.setAttribute("opacity", strokeOpacity+"");
-        isStroke = true;
-      }
-      fillOpacity = strokeOpacity = null;
-    } else if (propertyName === "fill") {
-      var fill = s.getPropertyCSSValue("fill");
-      if (value.indexOf("#") > -1) {
-        /*以下では、Gradation関連の要素に、イベントを渡すことで、
-         *この要素の、グラデーション描画を行う
-         */
-        var tod = tar.ownerDocument, t = tod.getElementById(fill.uri);
-        if (t) {
-          var evtt = tod.createEvent("MutationEvents");
-          evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
-          evtt._tar = tar._fillElement;
-          evtt._style = style, evtt._ttar = tar;
-          t.dispatchEvent(evtt);
-          if (t.localName !== "radialGradient" && !!!tar._fillElement) {
-            el.appendChild(evtt._tar);
-            tar._fillElement = evtt._tar; //キャッシュを作る
-          }
-          isFill = true;
-          t = evtt = null;
-        }
-        tod = null;
-      } else if (value === "none") {
-        tar.removeChild(tar._fillElment);
-        el.filled = "false";
-      } else {        
-        var fc = fill.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER;
-        fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")"); 
-        isFill = true;
-      }
-    } else if (propertyName === "stroke") {
-      var stroke = style.getPropertyCSSValue("stroke");
-      if (value === "none") {
-        tar.removeChild(tar._strokeElment);
-        el.stroked = "false";
-      } else if (!stroke.uri) {
-        var fc = stroke.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER;
-        strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
-        isStroke = true;
-      }
-    } else if (propertyName === "stroke-opacity") {
-      var strokeOpacity = parseFloat(value) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる
-      if (strokeOpacity < 1) {
-        strokeElement.setAttribute("opacity", strokeOpacity);
-        isStroke = true;
-      }
-      fc = num = strokeOpacity = null;
-    } else if (propertyName === "stroke-width") {
-      var sgsw = s.getPropertyCSSValue("stroke-width"), tod = tar.ownerDocument, w = tod.documentElement.viewport.width, h = tod.documentElement.viewport.height;
-      sgsw._percent = Math.sqrt((w*w + h*h) / 2);
-      var swx = sgsw.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) * Math.sqrt(Math.abs(tar.getScreenCTM()._determinant()));
-      strokeElement.setAttribute("weight", swx + "px");
-      isStroke = true;
-      sgsw = w = h = null;
-    } else if (propertyName === "stroke-miterlimit") {
-      strokeElement.setAttribute("miterlimit", value);
-      isStroke = true;
-    } else if (propertyName === "stroke-linejoin") {
-      strokeElement.setAttribute("joinstyle", value);
-      isStroke = true;
-    } else if (propertyName === "stroke-linecap") {
-      if (value === "butt") {
-        strokeElement.setAttribute("endcap", "flat");
-      } else {
-        strokeElement.setAttribute("endcap", value);
-      }
-      isStroke = true;
-    } else if (propertyName === "stroke-dasharray") {
-      var tsd = value;
-      if (tsd !== "none") {
-        if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合
-          var strs = tsd.split(",");
-          for (var i = 0, sli = strs.length; i < sli; ++i) {
-            strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(style.getPropertyValue("stroke-width"))); //精密ではないので注意
-          }
-          var strokedasharray = strs.join(" ");
-          if (strs.length % 2 === 1) {
-            strokedasharray += " " + strokedasharray;
-          }
-        }
-        strokeElement.setAttribute("dashstyle", strokedasharray);
-        isStroke = true;
-        tsd = strs = null;
-      }
-    } else if ((propertyName === "cursor") && (value !== "auto") && (value !== "")) {
-      el.style.cursor = value;
-    } else if (propertyName === "visibility") {
-      el.style.visibility = value;
-    } else if (propertyName === "display") {
-      el.style.display = value;
-    }
-    if (isFill) {
-      el.appendChild(tar._fillElement);
-    } else if (isStroke) {
-      el.appendChild(tar._strokeElement);
-    }
-    el = fill = stroke = tar = value = propertyName = null;
+    NAIBU._setPaint(tar, tar.getScreenCTM());
+    el = tar = value = null;
   }
   return s;
 };
@@ -2879,6 +2748,7 @@
 function SVGAnimatedLength() {
   /*readonly SVGLength*/ this.animVal;
   this.baseVal = new SVGLength();
+  this.baseVal.unitType = 1;
   return this;
 };
 function SVGLengthList() {
@@ -4568,7 +4438,7 @@
     }
     var fc = fill.rgbColor, num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
     fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
-    var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * style._list._opacity; //opacityを掛け合わせる
+    var fillOpacity = +(style.getPropertyValue("fill-opacity")) * style._list._opacity; //opacityを掛け合わせる
     if (fillOpacity < 1) {
       fillElement.setAttribute("opacity", fillOpacity+"");
     }
@@ -4622,7 +4492,7 @@
     if (!stroke.uri) {
       var fc = stroke.rgbColor, num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
       strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
-      var strokeOpacity = parseFloat(style.getPropertyValue("stroke-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる
+      var strokeOpacity = +(style.getPropertyValue("stroke-opacity")) * (+(style.getPropertyValue("opacity"))); //opacityを掛け合わせる
       if (swx < 1) {
         strokeOpacity *= swx; //太さが1px未満なら色を薄くする
       }
@@ -4643,7 +4513,7 @@
       if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合
         var strs = tsd.split(",");
         for (var i = 0, sli = strs.length; i < sli; ++i) {
-          strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(style.getPropertyValue("stroke-width"))); //精密ではないので注意
+          strs[i] = Math.ceil(+(strs[i]) / parseFloat(style.getPropertyValue("stroke-width"))); //精密ではないので注意
         }
         var strokedasharray = strs.join(" ");
         if (strs.length % 2 === 1) {
@@ -5851,7 +5721,8 @@
 };
 /*float*/    SVGTextContentElement.prototype.getComputedTextLength = function() {
   var l = this.textLength.baseVal;
-  if (l.unitType === SVGLength.SVG_LENGTHTYPE_UNKNOWN) {
+  if ((l.value === 0) && (this.getNumberOfChars() > 0)) {
+    /*何も設定されていない場合のみ、初期化を行う*/
     l.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_NUMBER, this.getSubStringLength(0, this.getNumberOfChars()));
   }
   l = null;
@@ -6981,7 +6852,7 @@
       } else if (tar._to) {
         tar._values = [null, tar._to];
       } else if (tar._by) {
-        tar._values = ["0", tar._by];
+        tar._values = [null, null, tar._by];
       } else if (!tar.hasChildNodes() && !tar.hasAttributeNS(null, "path")) { //SVGAnimateMotionElementに留意
         /*アニメーションの効果が出ないように調整する
          *SMILアニメーションの仕様を参照
@@ -7154,15 +7025,15 @@
               }
               nci._currentFrame++;
             }
-            if (nci._end) {
-              if (nci._end <= s && nci.getCurrentTime() !== 0) {
-                nci.endElement();
-                nci._currentFrame = 0;
-                delete nci._begin;
-                nci._end = null;
+            if (nci._end && (nci._end <= s) && (nci.getCurrentTime() !== 0)) {
+              nci.endElement();
+              if (!!nci._frame) {
+                nci._frame();
               }
-            }
-            if (!!nci._frame) {
+              nci._currentFrame = 0;
+              delete nci._begin;
+              nci._end = null;
+            } else if (!!nci._frame) {
               nci._frame();
             }
           }
@@ -7217,6 +7088,12 @@
       var vi = ttr.cloneNode(false);
       if (!tar._values[0]) {
         tar._values[0] = ttr.getAttributeNS(null, attrName) || ttr.style.getPropertyValue(attrName);
+        if (!tar._values[1]) { //by属性のみが設定されている場合
+          var v2 = parseFloat(tar._values[0]) + parseFloat(tar._values[2]), tanni = tar._values[0].match(/\D+/) || [""];
+          tar._values[1] = v2 + tanni[0];
+          tar._values.pop();
+          v2 = tanni = null;
+        }
       }
       if (!!tta) {
         tta.animVal = vi[attrName].baseVal;
@@ -7260,6 +7137,9 @@
     tar._frame = function() {
       var d = tar.getSimpleDuration() * 0.8, n = tar._valueList.length-1, tg = tar.getCurrentTime();
       if ((n !== -1) && (d !== 0) && (tg <= d)) {
+        if (tar._isDiscrete) {
+          ++n; //discreteモードは他のモードに比べて、分割数が多いことに注意
+        }
         var ii = Math.floor((tg*n) / d);
         if (ii === n) { //iiが境い目のときは、n-2を適用
           ii -= 1;
@@ -7294,7 +7174,7 @@
         } else {
           var v = v1;
         }
-        tanim.newValueSpecifiedUnits(tanim.unitType, v);
+        tanim.newValueSpecifiedUnits(base.unitType, v);
         tta.baseVal = tanim;
         tanim = null;
         ttr.dispatchEvent(evt);




Sie-announce メーリングリストの案内
Back to archive index