[Sie-announce] SIEコード [2436] 0. 71統合

Back to archive index

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


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

Log Message:
-----------
0.71統合

Modified Paths:
--------------
    trunk/sie.js

Property Changed:
----------------
    trunk/sie.js

Modified: trunk/sie.js
===================================================================
--- trunk/sie.js	2011-02-25 13:35:17 UTC (rev 2435)
+++ trunk/sie.js	2011-02-25 13:43:16 UTC (rev 2436)
@@ -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);


Property changes on: trunk/sie.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2409
   + /branches/04x/040/sie.js:812-829
/branches/04x/041/sie.js:891-923
/branches/04x/042/sie.js:927-967
/branches/04x/043/sie.js:969-1013
/branches/04x/044/sie.js:1015-1067
/branches/04x/045/sie.js:1069-1078
/branches/04x/046/sie.js:1080-1129
/branches/04x/047/sie.js:1131-1164
/branches/04x/048/sie.js:1166-1180
/branches/04x/sie.js:830-1181
/branches/05x/050/sie.js:1183-1201
/branches/05x/051/sie.js:1207-1323
/branches/05x/052/sie.js:1325-1352
/branches/05x/053/sie.js:1354-1400
/branches/05x/054/sie.js:1403-1422
/branches/05x/055/sie.js:1424-1454
/branches/05x/056/sie.js:1456-1491
/branches/05x/057/sie.js:1496-1523
/branches/05x/058/sie.js:1526-1590
/branches/05x/sie.js:1183-1594
/branches/06x/060/sie.js:1603-1850
/branches/06x/sie.js:1599-2355
/branches/07x/sie.js:2357-2435




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