[Sie-announce] SIEコード [1948]

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 7月 15日 (木) 23:09:50 JST


Revision: 1948
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1948
Author:   dhrname
Date:     2010-07-15 23:09:50 +0900 (Thu, 15 Jul 2010)

Log Message:
-----------


Modified Paths:
--------------
    branches/06x/061/sie.js

Modified: branches/06x/061/sie.js
===================================================================
--- branches/06x/061/sie.js	2010-07-15 14:01:37 UTC (rev 1947)
+++ branches/06x/061/sie.js	2010-07-15 14:09:50 UTC (rev 1948)
@@ -605,12 +605,15 @@
       }
       var d = tnoi.getElementsByTagNameNS(namespaceURI, localName);
       if (d) {
-        s = s.concat(d);
+        for (var j=0,dli=d.length;j<dli;++j) {
+          s[s.length] = d[j];
+        }
         n += d.length;
       }
       ns = ln = d = null;
     }
   }
+  tno = i = j = tcli = dli = null;
   if (n === 0) {
     return null; //該当する要素なし
   }
@@ -977,8 +980,7 @@
 
 /*
 #endif // _DOM_IDL_*/
-/*
-// File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/stylesheets.idl
+//File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/stylesheets.idl
 
 #ifndef _STYLESHEETS_IDL_
 #define _STYLESHEETS_IDL_
@@ -1051,8 +1053,7 @@
 };
 /*
 #endif // _STYLESHEETS_IDL_
-*/
-/*
+
 // File: http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.idl
 
 #ifndef _CSS_IDL_
@@ -1186,6 +1187,7 @@
 /*long*/ this.length = 0;
 /*CSSRule*/ this.parentRule = null;
   this._list = []; //内部のリスト
+  this._list._fontSize = this._list._opacity = null;
   return this;
 };
 CSSStyleDeclaration.prototype = {
@@ -1211,32 +1213,8 @@
     }
     for (var i=0,tli=this._list.length;i<tli;++i) {
       var ti = this._list[i], tc = ti.cssText;
-      if (tc.indexOf(propertyName) > -1) {            //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
-        if ((propertyName === "fill:") || (propertyName === "stroke:")) {
-          /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
-           *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
-           */
-          ti = new SVGPaint();
-          ti.cssText = tc;
-           var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null;
-          if (tc.indexOf("none") > -1) {
-            paintType = SVGPaint.SVG_PAINTTYPE_NONE;
-          } else if (tc.indexOf("currentColor") > -1) {
-            paintType = SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR;
-            color = this.getPropertyValue("color");
-          } else {
-            var _urlreg = /url\(#([^)]+)/;
-            if (_urlreg.test(tc)) {                   //fill属性の値がurl(#id)ならば
-              paintType = SVGPaint.SVG_PAINTTYPE_URI;
-              uri = RegExp.$1;
-            } else {
-              paintType = SVGPaint.SVG_PAINTTYPE_RGBCOLOR;
-              color = tc.substring(tc.indexOf(":")+1, tc.length);
-            }
-          }
-          ti.setPaint(paintType, uri, color, null);
-          this._list[i] = ti;
-        }
+      if (tc.indexOf(propertyName) > -1) {  //プロパティ名に合致するCSSValueオブジェクトが見つかった場合 
+        ti._empercents = this._list._fontSize;
         return ti;
       }
     }
@@ -1280,7 +1258,42 @@
       tg._priority = priority;
       tg.cssText = cssText;
     } else {
-      var ti = new CSSPrimitiveValue();
+      if ((propertyName === "fill") || (propertyName === "stroke")) {
+        /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
+         *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
+         */
+        var ti = new SVGPaint();
+        var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null;
+        if (value === "none") {
+          paintType = SVGPaint.SVG_PAINTTYPE_NONE;
+        } else if (value === "currentColor") {
+          paintType = SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR;
+          color = this.getPropertyValue("color");
+        } else {
+          var _urlreg = /url\(#([^)]+)/;
+          if (_urlreg.test(value)) {                   //fill属性の値がurl(#id)ならば
+            paintType = SVGPaint.SVG_PAINTTYPE_URI;
+            uri = RegExp.$1;
+          } else {
+            paintType = SVGPaint.SVG_PAINTTYPE_RGBCOLOR;
+            color = value;
+          }
+        }
+        ti.setPaint(paintType, uri, color, null);
+      } else if (propertyName === "color") {
+        var fill = this.getPropertyCSSValue("fill"), stroke = this.getPropertyCSSValue("stroke");
+        if (fill) {
+          if (fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
+            fill.setPaint(fill.paintType, null, value, null);
+          }
+        } else if (stroke) {
+          if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
+            stroke.setPaint(fill.paintType, null, value, null);
+          }
+        }
+      } else {
+        var ti = new CSSPrimitiveValue();
+      }
       ti._priority = priority;
       ti.cssText = cssText;
       //_numプロパティはremovePropertyメソッドで利用する
@@ -1289,6 +1302,15 @@
       this[propertyName] = 1;
       ++this.length;
     }
+    if (value === "inherit") {
+      ti.cssValueType = CSSValue.CSS_INHERIT;
+    } else if (propertyName === "opacity") {
+      this._list._opacity = parseFloat(value);
+    } else if (propertyName === "font-size") {
+      if (/(%|em)/.test(value)) {
+        this._list.fontSize = parseFloat(value);
+      }
+    }
     cssText = null;
   },
   /*itemメソッド
@@ -1306,7 +1328,7 @@
 
 function CSSValue() {
   this.cssText = "";
-  this.cssValueType = 0;
+  this.cssValueType = 3;
   return this;
 };
     // UnitTypes
@@ -1530,124 +1552,26 @@
   azimuth : "center",
                                         // raises(dom::DOMException) on setting
   //簡略プロパティに関しては、初期値を再考せよ
-  background : "",
-                                        // raises(dom::DOMException) on setting
-  backgroundAttachment : "scroll",
-  backgroundColor : "transparent",
-  backgroundImage : "none",
-  backgroundPosition : "0% 0%",
-  backgroundRepeat : "repeat",
-  border : "medium",
-  borderColor : "black",
-  borderCollapse : "collapse",
-  borderSpacing : "0",
-  borderTop : "",
-  borderRight : "",
-  borderBottom : "",
-  borderLeft : "",
-  borderStyle : "none",
-  borderTopColor : "black",
-  borderRightColor : "black",
-  borderBottomColor : "black",
-  borderLeftColor : "black",
-  borderTopStyle : "none",
-  borderRightStyle : "none",
-  borderBottomStyle : "none",
-  borderLeftStyle : "none",
-  borderTopWidth : "medium",
-  borderRightWidth : "medium",
-  borderBottomWidth : "medium",
-  borderLeftWidth : "medium",
-  borderWidth : "medium",
-  bottom : "  auto",
-  captionSide : "top",
-  clear : "none",
   clip : "auto",
   color : "black",
-  content : "",
-  counterIncrement : "none",
-  counterReset : "none",
-  cssFloat : "none",
-  cue : "",
-  cueAfter : "none",
-  cueBefore : "none",
   cursor : "auto",
   direction : "ltr",
   display : "inline",
-  elevation : "level",
-  emptyCells : "show",
-  cssFloat : "inline",
-  height : "auto",
-  left : "auot",
   letterSpacing : "normal",
   lineHeight : "normal",
-  listStyle : "",
-  listStyleImage : "none",
-  listStylePosition : "outside",
-  listStyleType : "disc",
-  margin : "",
-  marginTop : "0",
-  marginRight : "0",
-  marginBottom : "0",
-  marginLeft : "0",
-  markerOffset : "auto",
-  marks : "none",
-  maxHeight : "none",
-  maxWidth : "none",
-  minHeight : "0",
-  minWidth : "0",
-  orphans : "2",
-  outline : "",
-  outlineColor : "invert",
-  outlineStyle : "none",
-  outlineWidth : "medium",
   overflow : "visible",
-  padding : "",
-  paddingTop : "0",
-  paddingRight : "0",
-  paddingBottom : "0",
-  paddingLeft : "0",
-  page : "auto",
-  pageBreakAfter : "auto",
-  pageBreakBefore : "auto",
-  pageBreakInside : "auto",
-  pause : "",
-  pauseAfter : "",
-  pauseBefore : "",
-  pitch : "medium",
-  pitchRange : "50",
-  playDuring : "auto",
-  position : "static",
-  quotes : "",
-  richness : "50",
-  right : "auto",
-  size : "auto",
-  speak : "normal",
-  speakHeader : "once",
-  speakNumeral : "continuous",
-  speakPunctuation : "none",
-  speechRate : "medium",
-  stress : "50",
-  tableLayout : "auto",
   textAlign : "left",
   textDecoration : "none",
   textIndent : "0",
   textShadow : "none",
   textTransform : "none",
-  top : "auto",
   unicodeBidi : "normal",
   verticalAlign : "baseline",
-  voiceFamily : "",
-  volume : "medium",
   whiteSpace : "normal",
-  widows : "2",
-  width : "auto",
   wordSpacing : "normal",
   zIndex : "auto",
 //  #
 
-  clipPath : "none",
-  clipRule : "nonzero",
   mask : "none",
 
 //# Filter Effects properties:
@@ -1707,6 +1631,8 @@
       n = p = m = i = t = u = null;
     }
   }
+  s._opacity = 1;
+  s._fontSize = 12;
   CSS2Properties._list = s;
 })();
 
@@ -1751,10 +1677,19 @@
   } else {
     var p = CSS2Properties._list;     //デフォルト値の設定
   }
-  s._list = s._list.concat(elt.style._list)
-                   .concat(elt._attributeStyle._list)  //プレゼンテーション属性を結びつける
-                   .concat(p);
-  p = null;
+  var q = s._list.concat(elt.style._list)
+                 .concat(elt._attributeStyle._list);  //プレゼンテーション属性を結びつける
+  for (var i=0,qli=q.length;i<qli;++i) {
+    if (q[i].cssValueType === CSSValue.CSS_INHERIT) {
+      q.splice(i, 1);
+      --qli;
+    }
+  }
+  s._list = q.concat(p);
+  var eso = elt.style._list._opacity || elt._attributeStyle._list._opacity;
+  s._list._opacity = p._opacity * (eso || 1);
+  s._list._fontSize = p._fontSize;
+  eso = p = q = null;
   s._document = elt.ownerDocument;
   return s;
 };
@@ -1788,6 +1723,7 @@
 /*
 #endif // _CSS_IDL_
 */
+
 //以下は例外処理のログをとるためのもの。開発者以外は削除すること
 function STLog(jou) {
 this.jo = jou;
@@ -2242,62 +2178,6 @@
 };
 
 // _EVENTS_IDL_
-/*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/
- *Usage: <script defer="defer" type="text/javascript" src="sie.js"></script>
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is the Mozilla SVG Cairo Renderer project.
- *
- * The Initial Developer of the Original Code is IBM Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Parts of this file contain code derived from the following files(s)
- * of the Mozilla SVG project (these parts are Copyright (C) by their
- * respective copyright-holders):
- *    layout/svg/renderer/src/libart/nsSVGLibartBPathBuilder.cpp
- *
- * Contributor(s):DHRNAME revulo
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
 // File: smil.idl
 /*
 #ifndef _SMIL_IDL_
@@ -2357,6 +2237,62 @@
   this.detail = detailArg;
 };
 //#endif // _SMIL_IDL_
+/*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/
+ *Usage: <script defer="defer" type="text/javascript" src="sie.js"></script>
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Mozilla SVG Cairo Renderer project.
+ *
+ * The Initial Developer of the Original Code is IBM Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2004
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Parts of this file contain code derived from the following files(s)
+ * of the Mozilla SVG project (these parts are Copyright (C) by their
+ * respective copyright-holders):
+ *    layout/svg/renderer/src/libart/nsSVGLibartBPathBuilder.cpp
+ *
+ * Contributor(s):DHRNAME revulo
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+/*
+ * Copyright (c) 2000 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ */
 
 //これを頭に付けたら、内部処理用
 var  NAIBU = {};
@@ -4204,7 +4140,7 @@
     var fillElement = !!tar._fillElement ? tar._fillElement : document.createElement("v:fill");
     var fc = fill.rgbColor, num = CSSPrimitiveValue.CSS_NUMBER;
     fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
-    var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる
+    var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * style._list._opacity; //opacityを掛け合わせる
     if (fillOpacity < 1) {
       fillElement.setAttribute("opacity", fillOpacity+"");
     }
@@ -4288,7 +4224,7 @@
   }
   var vis = style.getPropertyValue("visibility");
   el.style.visibility = vis;
-  style = cursor = null;
+  tod = el = fill = stroke = style = cursor = tar = matrix = null;
 };
 
 function SVGPathElement() {
@@ -4579,47 +4515,40 @@
        *SVGのd属性をVMLに変換していく処理である。
        */
       var tar = evt.target, matrix = tar.getScreenCTM(), tlist = tar.normalizedPathSegList, _parseInt = parseInt;
-      var dat = "", ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f;
+      var dat = [], ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f;
       for (var i=0, tli=tlist.numberOfItems;i<tli;++i) {
         var ti = tlist.getItem(i), tps = ti.pathSegTypeAsLetter;
+        /*IE6の高速化のために、以下では、x += "";のような文字連結ではなくて、
+         *x[data.length] = "";という形をとった
+         */
         if (tps === "z" || tps === "Z") {
-          dat += " x ";
+          dat[dat.length] = " x ";
         } else {
           if (tps === "M") {
-            dat += "m";
+            dat[dat.length] = "m";
           } else if (tps === "L") {
-            dat += "l";
+            dat[dat.length] = "l";
           } else if (tps === "C") {
-            dat += "c";
+            dat[dat.length] = "c";
             /*CTM(mx)の行列と座標(x, y)の積を算出する。数学における表現は以下のとおり
              *[ma mc me]   [x]
              *[mb md mf] * [y]
              *[0  0  1 ]   [1]
              */
-            var x = _parseInt(ma*ti.x1 + mc*ti.y1 + me, 10);
-            var y = _parseInt(mb*ti.x1 + md*ti.y1 + mf, 10);
-            x += " ";
-            y += " ";
-            dat += x;
-            dat += y;
-            x = _parseInt(ma*ti.x2 + mc*ti.y2 + me, 10);
-            y = _parseInt(mb*ti.x2 + md*ti.y2 + mf, 10);
-            x += " ";
-            y += " ";
-            dat += x;
-            dat += y;
+
+            dat[dat.length] = _parseInt(ma*ti.x1 + mc*ti.y1 + me, 10);
+            dat[dat.length] = _parseInt(mb*ti.x1 + md*ti.y1 + mf, 10);
+            dat[dat.length] = _parseInt(ma*ti.x2 + mc*ti.y2 + me, 10);
+            dat[dat.length] = _parseInt(mb*ti.x2 + md*ti.y2 + mf, 10);
           }
-          var x = _parseInt(ma*ti.x + mc*ti.y + me, 10); //_parseIntはparseIntのエイリアスであり、値を丸めるのに使う
-          var y = _parseInt(mb*ti.x + md*ti.y + mf, 10);
-          x += " "; //文字列型に変換しておき、空白で区切りを付ける
-          y += " ";
-          dat += x;
-          dat += y;
+          dat[dat.length] = _parseInt(ma*ti.x + mc*ti.y + me, 10);
+          dat[dat.length] = _parseInt(mb*ti.x + md*ti.y + mf, 10);
         }
       }
       var vi = tar.ownerDocument.documentElement;
       var w = vi.width.baseVal.value, h = vi.height.baseVal.value;
-      tar._tar.path = dat + " e";
+      dat[dat.length] = " e";
+      tar._tar.path = dat.join(" ");
       tar._tar.coordsize = w + " " + h;
       NAIBU._setPaint(tar, matrix);
       evt = tar = w = h = matrix = dat = x = y = null;
@@ -5183,6 +5112,9 @@
     var tar = evt.target;
     tar.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
       var tar = evt.target, ti = tar.firstChild, tp = tar.parentNode;
+      if (!(tar instanceof SVGTextContentElement)) {
+        return;
+      }
       tar._list = [];   //文字の位置を格納しておくリスト
       var x = 0, y = 0, n = 0; //現在のテキスト位置と順番
       var style = tar.ownerDocument.defaultView.getComputedStyle(tar, null);
@@ -5677,10 +5609,10 @@
       var length = stops.length;
       var color = [], colors = [], opacity = [];
       for (var i = 0; i < length; ++i) {
-        var stop = stops[i];
-        color[i] = stop.style.getPropertyValue("stop-color");
+        var stop = stops[i], sstyle = stop.ownerDocument.defaultView.getComputedStyle(stop, "");
+        color[i] = sstyle.getPropertyValue("stop-color");
         colors[i] = stop.offset.baseVal + " " + color[i];
-        opacity[i] = (stop.style.getPropertyValue("stop-opacity") || 1) * t.getPropertyValue("fill-opacity") * t.getPropertyValue("opacity");
+        opacity[i] = (sstyle.getPropertyValue("stop-opacity") || 1) * t.getPropertyValue("fill-opacity") * t.getPropertyValue("opacity");
       }
       ele.setAttribute("method", "none");
       ele.setAttribute("color",  color[0]);
@@ -5734,6 +5666,7 @@
   /*readonly SVGAnimatedLength*/ this.r = new SVGAnimatedLength();
   /*readonly SVGAnimatedLength*/ this.fx = new SVGAnimatedLength();
   /*readonly SVGAnimatedLength*/ this.fy = new SVGAnimatedLength();
+  this.cx.baseVal.value = this.cy.baseVal.value = this.r.baseVal.value = 0.5;
   this.addEventListener("DOMNodeInsertedIntoDocument", function(evt) {
     var grad = evt.target, ele = evt._tar, tar = evt._ttar; //eleはv:fill要素。tarはターゲットとになる要素
     if (!!!ele) { //まだ、path要素などが設定されていない場合
@@ -5746,25 +5679,21 @@
       /*VMLでは、図の形状に沿って、円状のグラデーションを処理するようになっているため、
        *四角だとおかしな模様が出てしまう。以下はそれを避ける処理
        */
-      var cx = parseFloat((grad.getAttributeNS(null, "cx") || "0.5"));
-      var cy = parseFloat((grad.getAttributeNS(null, "cy") || "0.5"));
-      var r = rx = ry = parseFloat((grad.getAttributeNS(null, "r") || "0.5"));
-      var el = this.w, et = this.h, er = 0, eb = 0;
-      var data = this.tar.path.value;
+      var cx = grad.cx.baseVal.value, cy = grad.cy.baseVal.value;
+      var r = rx = ry = grad.r.baseVal.value;
+      var tarrect = tar.getBBox();
+      var el = tar.viewport.width, et = tar.viewport.height, er = 0, eb = 0;
       var units = grad.getAttributeNS(null, "gradientUnits");
       if (!units || units === "objectBoundingBox") {
         //%の場合は小数点に変換(10% -> 0.1)
         cx = cx > 1 ? cx/100 : cx; cy = cy > 1 ? cy/100 : cy; r = r > 1 ? r/100 : r;
         //要素の境界領域を求める(四隅の座標を求める)
-        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]);
-          el = el > nx ? nx : el;
-          et = et > ny ? ny : et;
-          er = er > nx ? er : nx;
-          eb = eb > ny ? eb : ny; nx = ny = null;
-        }
-        degis = null;
+        var nx = tarrect.x, ny = tarrect.y;
+        el = el > nx ? nx : el;
+        et = et > ny ? ny : et;
+        er = er > nx ? er : nx;
+        eb = eb > ny ? eb : ny;
+        nx = ny = null;
         cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et);
       }
       var gt = grad.getAttributeNS(null, "gradientTransform");
@@ -6438,11 +6367,12 @@
 };
 function unsvgtovml() {
   try {
-    CSSValue = CSSPrimitiveValue = NAIBU.xmlhttp = Node = Event = NAIBU = stlog = STLog = document = null;
+    CSS2Properties = CSSValue = CSSPrimitiveValue = NAIBU.xmlhttp = Node = Event = NAIBU = stlog = STLog = document = null;
     Array = ActiveXObject = window = null;
   } catch(e) {}
 }
 NAIBU.addEvent("load", (function() {
+  stlog = new STLog(true);
   var xmlhttp; //XMLHttpオブジェクトを生成
   try {
     xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
@@ -6495,5 +6425,4 @@
     s = null;
   }
 }) );
-stlog = new STLog(true);
 NAIBU.addEvent("unload", unsvgtovml);
\ No newline at end of file




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