[Sie-announce] SIEコード [2227] 0. 65統合

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2010年 12月 18日 (土) 20:35:10 JST


Revision: 2227
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2227
Author:   dhrname
Date:     2010-12-18 20:35:10 +0900 (Sat, 18 Dec 2010)

Log Message:
-----------
0.65統合

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

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

Modified: trunk/sie.js
===================================================================
--- trunk/sie.js	2010-12-18 11:25:45 UTC (rev 2226)
+++ trunk/sie.js	2010-12-18 11:35:10 UTC (rev 2227)
@@ -1,4 +1,4 @@
-/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
+/*SIE-SVG without Plugin under LGPL2.1 & GPL2.0 & Mozilla Public Lisence
  *公式ページは http://sie.sourceforge.jp/
  *利用方法は <script defer="defer" type="text/javascript" src="sie.js"></script>
  *http://sie.sourceforge.jp/
@@ -1172,6 +1172,8 @@
   },
   /*void*/ preventDefault : function(){
     this._default = false;
+    /*IEのみで使えるreturnValueプロパティ*/
+    window.event.returnValue = false;
   },
   /*void*/ initEvent : function( /*string*/ eventTypeArg, /*boolean*/ canBubbleArg, /*boolean*/ cancelableArg) {
     this.type = eventTypeArg;
@@ -1700,9 +1702,11 @@
       var ti = this._list[i], tc = ti.cssText;
       if (tc.indexOf(propertyName) > -1) {  //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 
         ti._empercents = this._list._fontSize;
+        propertyName = null;
         return ti;
       }
     }
+    propertyName = null;
     return null;
   },
   /*removePropertyメソッド
@@ -2128,17 +2132,18 @@
   return this;
 };
 /*CSSStyleDeclaration*/ ViewCSS.prototype.getComputedStyle = function( /*Element*/ elt, /*string*/ pseudoElt) {
+  if (!!elt._currentStyle) {
+    /*キャッシュがあれば、それを返す*/
+    return (elt._currentStyle);
+  }
   var s = new CSSStyleDeclaration();
+  elt._currentStyle = s;
   //リストを連結することによって、カスケーディングを実現する
   var pelt = elt.parentNode;
   if (pelt) {
-    if (this._cache_ele !== pelt) {                     //キャッシュを更新する
-      this._cache = this.getComputedStyle(pelt, pseudoElt);
-      this._cache_ele = pelt;
-    }
-    var p = this._cache._list;
+    var p = this.getComputedStyle(pelt, pseudoElt)._list;
   } else {
-    var p = CSS2Properties._list;     //デフォルト値の設定
+    var p = this._defaultCSS;     //デフォルト値の設定
   }
   var q = s._list;
   if (!!elt.style) {
@@ -2166,7 +2171,7 @@
   }
   s._list._opacity = p._opacity * (eso || 1);
   s._list._fontSize = p._fontSize;
-  eso = p = q = null;
+  pelt = eso = p = q = null;
   s._document = elt.ownerDocument;
   return s;
 };
@@ -2520,16 +2525,17 @@
     if (evt.eventPhase === Event.BUBBLING_PHASE) {
       return;
     }
-    var name = evt.attrName, tar = evt.target, _parseFloat = parseFloat;
+    var name = evt.attrName, tar = evt.target;
     if (!!CSS2Properties[name] || name.indexOf("-") > -1) { //スタイルシートのプロパティならば
       tar._attributeStyle.setProperty(name, evt.newValue, "");
+      tar._currentStyle = null;  //キャッシュは消しておく
     }
     if (evt.relatedNode.localName === "id") { //xml:idあるいはid属性ならば
       tar.id = evt.newValue;
     } else if (name === "transform" && !!tar.transform) {
-      var tft = evt.newValue, degR = /[\-\d\.e]+/g;
-      var coma = tft.match(/[A-Za-z]+(?=\s*\()/g);   //コマンド文字にマッチ translate
-      var list = tft.match(/\([^\)]+\)/g);           //カッコ内のリストにマッチ (10 20 30...)
+      var tft = evt.newValue, degR = tar._degReg;
+      var coma = tft.match(tar._comaReg);   //コマンド文字にマッチ translate
+      var list = tft.match(tar._strReg);           //カッコ内のリストにマッチ (10 20 30...)
       var a,b,c,d,e,f,lis,deg,rad,degli;
       //transform属性の値を、SVGTransformListであるtransformプロパティに結びつける
       for (var j=0,cli=coma.length;j<cli;j++) {
@@ -2539,22 +2545,22 @@
         degli = deg.length;
         if (degli === 6) {
           var cm = s.matrix;
-          cm.a = _parseFloat(deg[0]);
-          cm.b = _parseFloat(deg[1]);
-          cm.c = _parseFloat(deg[2]);
-          cm.d = _parseFloat(deg[3]);
-          cm.e = _parseFloat(deg[4]);
-          cm.f = _parseFloat(deg[5]);
+          cm.a = +(deg[0]);
+          cm.b = +(deg[1]);
+          cm.c = +(deg[2]);
+          cm.d = +(deg[3]);
+          cm.e = +(deg[4]);
+          cm.f = +(deg[5]);
         } else {
           if (degli === 3) {
-            var degz = _parseFloat(deg[0]);
-            s.setRotate(degz, _parseFloat(deg[1]), _parseFloat(deg[2]))
+            var degz = +(deg[0]);
+            s.setRotate(degz, +(deg[1]), +(deg[2]))
           } else if (degli <= 2) {
-            var degz = _parseFloat(deg[0]);
+            var degz = +(deg[0]);
             if (com === "translate") {
-              s.setTranslate(degz, _parseFloat(deg[1] || 0));
+              s.setTranslate(degz, +(deg[1] || 0));
             } else if (com === "scale") {
-              s.setScale(degz, _parseFloat(deg[1] || deg[0]));
+              s.setScale(degz, +(deg[1] || deg[0]));
             } else if (com === "rotate") {
               s.setRotate(degz, 0, 0);
             } else if (com === "skewX") {
@@ -2573,9 +2579,9 @@
       style.cssText = sc;
       if (sc !== "") {
         //style属性値の解析
-        sc = sc.replace(/^[^a-z\-]+/, "")
-               .replace(/\:\s+/g, ":")
-               .replace(/\s*;[^a-z\-]*/g, ";");
+        sc = sc.replace(tar._shouReg, "")
+               .replace(tar._conReg, ":")
+               .replace(tar._bouReg, ";");
         var a = sc.split(";");
         for (var i=0, ali=a.length;i<ali;++i) {
           var ai = a[i], m = ai.split(":");
@@ -2586,6 +2592,7 @@
         }
         a = sc = null;
       }
+      tar._currentStyle = null;
     } else if (name === "class") {
       tar.className = evt.newValue;
     } else if (name.indexOf("on") === 0) {           //event属性ならば
@@ -2623,7 +2630,7 @@
       if (!!tar[name]) {
         var tea = tar[name], tod = tar.ownerDocument.documentElement;
         if (tea instanceof SVGAnimatedLength) {
-          var n = evt.newValue.match(/\D+$/), type = SVGLength.SVG_LENGTHTYPE_NUMBER;
+          var n = evt.newValue.match(tar._NaNReg), type = SVGLength.SVG_LENGTHTYPE_NUMBER, _parseFloat = parseFloat;
           if (!!n) {
             n = n[0];
           }
@@ -2677,6 +2684,14 @@
 SVGElement.constructor = Element;
 SVGElement.prototype = new Element();
 
+SVGElement.prototype._degReg = /[\-\d\.e]+/g;
+SVGElement.prototype._comaReg = /[A-Za-z]+(?=\s*\()/g;
+SVGElement.prototype._strReg =  /\([^\)]+\)/g;
+SVGElement.prototype._syouReg = /^[^a-z\-]+/;
+SVGElement.prototype._conReg = /\:\s+/g;
+SVGElement.prototype._bouReg = /\s*;[^a-z\-]*/g;
+SVGElement.prototype._NaNReg = /\D+$/;
+
 /*interface SVGLocatable*/
 /*SVGRect*/   SVGElement.prototype.getBBox = function(){
   var s = new SVGRect();
@@ -2688,7 +2703,7 @@
    */
   var degis = data.match(/[0-9\-]+/g);
   for (var i=0,degisli=degis.length;i<degisli;i+=2) {
-    var nx = parseInt(degis[i]), ny = parseInt(degis[i+1]);
+    var nx = +(degis[i]), ny = +(degis[i+1]);
     el = el > nx ? nx : el;
     et = et > ny ? ny : et;
     er = er > nx ? er : nx;
@@ -3926,11 +3941,14 @@
         tmp = null;
       }
       var s = DOMImplementation.createDocument("http://www.w3.org/2000/svg", "svg");
-      var tar = s.documentElement;
-      tar.viewport.top = 0;
-      tar.viewport.left = 0;
-      tar.viewport.width = objei.clientWidth;
-      tar.viewport.height = objei.clientHeight;
+      var tar = s.documentElement, tview = tar.viewport;
+      tview.top = 0;
+      tview.left = 0;
+      tview.width = objei.clientWidth;
+      tview.height = objei.clientHeight;
+      if (tview.height < 24) { //IEの標準モードではclientHeightプロパティの値が小さくなることがある
+        tview.height = screen.availHeight;
+      }
       if (tar.viewport.height < 24) { //IEの標準モードではclientHeightプロパティの値が小さくなることがある
         tar.viewport.height = screen.width;
       }
@@ -3950,10 +3968,9 @@
       }
       str = attr = null;
       var sdt = tar._tar, sp = document.createElement("div"), dcp = document.createElement("v:group");
-      var view = tar.viewport;
-      dcp.style.width = view.width+ "px";
-      dcp.style.height = view.height+ "px";
-      dcp.coordsize = view.width+ " " +view.height;
+      dcp.style.width = tview.width+ "px";
+      dcp.style.height = tview.height+ "px";
+      dcp.coordsize = tview.width+ " " +tview.height;
       sp.appendChild(dcp);
       objei.parentNode.insertBefore(sp, objei);
       dcp.appendChild(sdt)
@@ -3967,7 +3984,7 @@
        *作り出す作業を行う。これは必須
        */
       var backr = document.createElement("v:rect");
-      var w = tar.viewport.width, h = tar.viewport.height, sw = tar.width.baseVal.value, sh = tar.height.baseVal.value;
+      var w = tview.width, h = tview.height, sw = tar.width.baseVal.value, sh = tar.height.baseVal.value;
       backr.style.position = "absolute";
       backr.style.width = w+ "px";
       backr.style.height = h+ "px";
@@ -4063,10 +4080,9 @@
  *2次元座標の点(x,y)を表すオブジェクト
  */
 function SVGPoint() { 
-  /*float*/ this.x = 0;
-  /*float*/ this.y = 0;
   return this;
 };
+/*float*/SVGPoint.prototype.x = SVGPoint.prototype.y = 0;
 SVGPoint.prototype.matrixTransform = function(/*SVGMatrix*/ matrix ) {
   /*整数にしているのは、VMLの設計上、小数点を扱えないときがあるため*/
   var x = parseInt(matrix.a * this.x + matrix.c * this.y + matrix.e);
@@ -4095,15 +4111,15 @@
  *[0 0 1]
  */
 function SVGMatrix() { 
-  /*float*/ this.a = 1;
-   /*float*/ this.b = 0;
-  /*float*/ this.c = 0;
-  /*float*/ this.d = 1;
-  /*float*/ this.e = 0;
-  /*float*/ this.f = 0;
   return this;
 };
 SVGMatrix.prototype = {
+  /*float*/ a : 1,
+  /*float*/ b : 0,
+  /*float*/ c : 0,
+  /*float*/ d : 1,
+  /*float*/ e : 0,
+  /*float*/ f : 0,
   /*multiplyメソッド
    *行列の積を求めて返す
    */
@@ -5030,10 +5046,9 @@
       var w = vi.width.baseVal.value, h = vi.height.baseVal.value;
       dat[dat.length] = " e";
       tar._tar.path = dat.join(" ");
-      dat = null;
       tar._tar.coordsize = w + " " + h;
       NAIBU._setPaint(tar, matrix);
-      evt = tar = w = h = matrix  = x = y = _parseInt = null;
+      evt = tar = dat = w = h = matrix = tlist = x = y = _parseInt = ma = mb = mc = md = me = mf = vi = isZ = isM = isL = isC = null;
     }, false);
     evt = tar = null;
   }, false);
@@ -6509,7 +6524,7 @@
       rx = ry = r;
       var tarrect = tar.getBBox();
       var vi = tar.ownerDocument.documentElement.viewport;
-      var el = vi.width, et = vi.height, er = 0, eb = 0;
+      var el = vi.width | 0, et = vi.height | 0, er = 0, eb = 0;
       var units = grad.getAttributeNS(null, "gradientUnits");
       if (!units || units === "objectBoundingBox") {
         //%の場合は小数点に変換(10% -> 0.1)
@@ -7107,7 +7122,7 @@
 /*      try{*/
         var ntc = NAIBU.Time.currentFrame++;
         var nc = NAIBU.Clip;
-        var s = ntc * 125 * 0.8; //フレーム数ntcをミリ秒数sに変換
+        var s = ntc * 100; //フレーム数ntcをミリ秒数sに変換
         if (ntc > NAIBU.Time.Max) {
           clearInterval(NAIBU.stop);
         }
@@ -7537,6 +7552,11 @@
                 SVGExternalResourcesRequired,
                 SVGStylable*/ {
   SVGElement.apply(this);
+  this.addEventListener("SVGLoad", function(evt){
+    var tar = evt.target, ctar = evt.currentTarget;
+    ctar._instance = tar._instance;
+    evt = tar = ctar = null;
+  }, true);
   return this;
 };
 SVGFontElement.constructor = SVGElement;
@@ -7596,11 +7616,6 @@
     }
     evt.target.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:show", "embed");
   }, false);
-  this.addEventListener("SVGLoad", function(evt){
-    var tar = evt.target;
-    var doc = tar.ownerDocument.importNode(tar._instance, true);
-    evt = trans = tar = evtt = tgtb = null;
-  }, false);
   SVGURIReference.apply(this);
   return this;
 };
@@ -7741,6 +7756,8 @@
   s._list._opacity = 1;
   s._list._fontSize = 12;
   CSS2Properties._list = s._list;
+  Document.prototype.defaultView._defaultCSS = CSS2Properties._list;
+  s = null;
 })();
 
 NAIBU.addEvent = function(evt,lis){


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-2185
   + /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-2226




Sie-announce メーリングリストの案内
アーカイブの一覧に戻る