[Sie-announce] SIEコード [2531] NAIBU. _setPaint関数のvar文を整理

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 30日 (水) 23:29:45 JST


Revision: 2531
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2531
Author:   dhrname
Date:     2011-03-30 23:29:45 +0900 (Wed, 30 Mar 2011)

Log Message:
-----------
NAIBU._setPaint関数のvar文を整理

Modified Paths:
--------------
    branches/07x/074/org/w3c/dom/svg.js

Modified: branches/07x/074/org/w3c/dom/svg.js
===================================================================
--- branches/07x/074/org/w3c/dom/svg.js	2011-03-30 14:13:49 UTC (rev 2530)
+++ branches/07x/074/org/w3c/dom/svg.js	2011-03-30 14:29:45 UTC (rev 2531)
@@ -2375,31 +2375,38 @@
   /*以下では、スタイルシートを用いて、fill-とstroke-関連の
    *処理を行う。SVGPaintインターフェースをも用いる
    */
-  var tod = tar.ownerDocument, el = tar._tar;
+  var tod = tar.ownerDocument,
+      el = tar._tar,
+      style = tod.defaultView.getComputedStyle(tar, ""),
+      fill = style.getPropertyCSSValue("fill"),
+      stroke = style.getPropertyCSSValue("stroke"),
+      fillElement, tgebtfill, fc,
+      num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1,
+      t, evtt, fillOpacity, strs, cursor, vis, disp,
+      strokeElement, strokeOpacity, tgebtstroke, sgsw, w, h, swx, tsd, strokedasharray;
   if (!el) {
     return;
   }
-  var style = tod.defaultView.getComputedStyle(tar, "");
-  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を参照*/
       style.setProperty("color", style.getPropertyValue("color"));
     }
     if (!!tar._fillElement) {
-      var fillElement = tar._fillElement;
-      var tgebtfill = el.getElementsByTagName("fill");
+      fillElement = tar._fillElement;
+      tgebtfill = el.getElementsByTagName("fill");
       if (tgebtfill.length > 0) {
         /*あらかじめ消しおかないと、効果が出ない*/
         el.removeChild(tgebtfill[0]);
       }
       tgebtfill = null;
     } else {
-      var fillElement = _doc.createElement("v:fill");
+      fillElement = _doc.createElement("v:fill");
     }
-    var fc = fill.rgbColor, num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
+    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 = +(style.getPropertyValue("fill-opacity")) * style._list._opacity; //opacityを掛け合わせる
+    fillOpacity = +(style.getPropertyValue("fill-opacity")) * style._list._opacity; //opacityを掛け合わせる
     if (fillOpacity < 1) {
       fillElement.setAttribute("opacity", fillOpacity+"");
     }
@@ -2414,14 +2421,15 @@
     /*以下では、Gradation関連の要素に、イベントを渡すことで、
      *この要素の、グラデーション描画を行う
      */
-    var t = tod.getElementById(fill.uri);
+    t = tod.getElementById(fill.uri);
     if (t) {
-      var evtt = tod.createEvent("MutationEvents");
+      evtt = tod.createEvent("MutationEvents");
       evtt.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
       evtt._tar = !!tar._fillElement ? tar._fillElement : _doc.createElement("v:fill");
-      evtt._style = style, evtt._ttar = tar;
+      evtt._style = style;
+      evtt._ttar = tar;
       t.dispatchEvent(evtt);
-      if (t.localName !== "radialGradient" && !!!tar._fillElement) {
+      if ((t.localName !== "radialGradient") && !!!tar._fillElement) {
         el.appendChild(evtt._tar);
         tar._fillElement = evtt._tar; //キャッシュを作る
       }
@@ -2436,24 +2444,26 @@
       style.setProperty("color", style.getPropertyValue("color"));
     }
     if (!!tar._strokeElement) {
-      var strokeElement = tar._strokeElement;
-      var tgebtstroke = el.getElementsByTagName("stroke")
+      strokeElement = tar._strokeElement;
+      tgebtstroke = el.getElementsByTagName("stroke")
       if (tgebtstroke.length > 0) {
         el.removeChild(tgebtstroke[0]);
       }
       tgebtstroke = null;
     } else {
-      var strokeElement = _doc.createElement("v:stroke");
+      strokeElement = _doc.createElement("v:stroke");
     }
-    var sgsw = style.getPropertyCSSValue("stroke-width"), w = tod.documentElement.viewport.width, h = tod.documentElement.viewport.height;
+    sgsw = style.getPropertyCSSValue("stroke-width");
+    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(matrix._determinant()));
+    swx = sgsw.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) * _math.sqrt(_math.abs(matrix._determinant()));
     strokeElement.setAttribute("weight", swx + "px");
     sgsw = w = h = null;
     if (!stroke.uri) {
-      var fc = stroke.rgbColor, num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
+      fc = stroke.rgbColor;
       strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
-      var strokeOpacity = +(style.getPropertyValue("stroke-opacity")) * (+(style.getPropertyValue("opacity"))); //opacityを掛け合わせる
+      strokeOpacity = +(style.getPropertyValue("stroke-opacity")) * (+(style.getPropertyValue("opacity"))); //opacityを掛け合わせる
       if (swx < 1) {
         strokeOpacity *= swx; //太さが1px未満なら色を薄くする
       }
@@ -2469,14 +2479,14 @@
     } else {
       strokeElement.setAttribute("endcap", style.getPropertyValue("stroke-linecap"));
     }
-    var tsd = style.getPropertyValue("stroke-dasharray");
+    tsd = style.getPropertyValue("stroke-dasharray");
     if (tsd !== "none") {
       if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合
-        var strs = tsd.split(",");
+        strs = tsd.split(",");
         for (var i = 0, sli = strs.length; i < sli; ++i) {
           strs[i] = _math.ceil(+(strs[i]) / parseFloat(style.getPropertyValue("stroke-width"))); //精密ではないので注意
         }
-        var strokedasharray = strs.join(" ");
+        strokedasharray = strs.join(" ");
         if (strs.length % 2 === 1) {
           strokedasharray += " " + strokedasharray;
         }
@@ -2494,15 +2504,15 @@
   } else {
     el.stroked = "false";
   }
-  var cursor = style.getPropertyValue("cursor");
+  cursor = style.getPropertyValue("cursor");
   if (cursor !== "auto" && cursor !== "") {
     el.style.cursor = cursor;
   }
-  var vis = style.getPropertyValue("visibility");
+  vis = style.getPropertyValue("visibility");
   if (vis !== "visiblee") { //初期値でないならば
     el.style.visibility = vis;
   }
-  var disp = style.getPropertyValue("display");
+  disp = style.getPropertyValue("display");
   if (disp === "none") {
     el.style.display = "none";
    } else if (disp !== "inline-block") {




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