[Sie-announce] SIEコード [2700] NAIBU. _setPaint関数を整理

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 5月 24日 (火) 20:19:24 JST


Revision: 2700
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2700
Author:   dhrname
Date:     2011-05-24 20:19:24 +0900 (Tue, 24 May 2011)

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

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

Modified: branches/07x/078/org/w3c/dom/svg.js
===================================================================
--- branches/07x/078/org/w3c/dom/svg.js	2011-05-23 14:16:32 UTC (rev 2699)
+++ branches/07x/078/org/w3c/dom/svg.js	2011-05-24 11:19:24 UTC (rev 2700)
@@ -2484,29 +2484,23 @@
       stroke = style.getPropertyCSSValue("stroke"),
       fp = fill.paintType,
       sp = stroke.paintType,
-      fillElement, tgebtfill, fc,
+      fillElement, 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;
   }
+  /*あらかじめ、v:fill要素とv:stroke要素は消しておく*/
+  while (el.firstChild) {
+    el.removeChild(el.firstChild);
+  }
   if ((fp === /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1) || (fp === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102)) {
     if (fp === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
       /*再度、設定。css.jsのsetPropertyを参照*/
       style.setProperty("color", style.getPropertyValue("color"));
     }
-    if (!!tar._fillElement) {
-      fillElement = tar._fillElement;
-      tgebtfill = el.getElementsByTagName("fill");
-      if (tgebtfill.length > 0) {
-        /*あらかじめ消しおかないと、効果が出ない*/
-        el.removeChild(tgebtfill[0]);
-      }
-      tgebtfill = null;
-    } else {
-      fillElement = _doc.createElement("v:fill");
-    }
+    fillElement = _doc.createElement("v:fill");
     fc = fill.rgbColor;
     num = /*CSSPrimitiveValue.CSS_NUMBER*/ 1;
     fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue(num)+ "," +fc.green.getFloatValue(num)+ "," +fc.blue.getFloatValue(num)+ ")");
@@ -2514,12 +2508,7 @@
     if (fillOpacity < 1) {
       fillElement.setAttribute("opacity", fillOpacity+"");
     }
-    if (!!!tar._fillElement) {
-      el.appendChild(fillElement);
-      tar._fillElement = fillElement; //キャッシュを作る
-    } else {
-      el.appendChild(fillElement);
-    }
+    el.appendChild(fillElement);
     fillElement = fc = fillOpacity = null;
   } else if (fill.uri) {
     /*以下では、Gradation関連の要素に、イベントを渡すことで、
@@ -2529,13 +2518,12 @@
     if (t) {
       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._tar = _doc.createElement("v:fill");
       evtt._style = style;
       evtt._ttar = tar;
       t.dispatchEvent(evtt);
-      if ((t.localName !== "radialGradient") && !!!tar._fillElement) {
+      if (t.localName !== "radialGradient") {
         el.appendChild(evtt._tar);
-        tar._fillElement = evtt._tar; //キャッシュを作る
       }
       t = evtt = null;
     }
@@ -2547,16 +2535,7 @@
       /*再度、設定。css.jsのsetPropertyを参照*/
       style.setProperty("color", style.getPropertyValue("color"));
     }
-    if (!!tar._strokeElement) {
-      strokeElement = tar._strokeElement;
-      tgebtstroke = el.getElementsByTagName("stroke")
-      if (tgebtstroke.length > 0) {
-        el.removeChild(tgebtstroke[0]);
-      }
-      tgebtstroke = null;
-    } else {
-      strokeElement = _doc.createElement("v:stroke");
-    }
+    strokeElement = _doc.createElement("v:stroke");
     sgsw = style.getPropertyCSSValue("stroke-width");
     w = tod.documentElement.viewport.width;
     h = tod.documentElement.viewport.height;
@@ -2598,12 +2577,7 @@
       strokeElement.setAttribute("dashstyle", strokedasharray);
       tsd = strs = null;
     }
-    if (!!!tar._strokeElement) {
-      el.appendChild(strokeElement);
-      tar._strokeElement = strokeElement;
-    } else {
-      el.appendChild(strokeElement);
-    }
+    el.appendChild(strokeElement);
     strokeElement = tsd = null;
   } else {
     el.stroked = "false";




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