[Sie-announce] SIEコード [2714] setPropertyメソッドについて、再入力の際も、色が変化できるように修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 5月 27日 (金) 20:01:13 JST


Revision: 2714
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2714
Author:   dhrname
Date:     2011-05-27 20:01:13 +0900 (Fri, 27 May 2011)

Log Message:
-----------
setPropertyメソッドについて、再入力の際も、色が変化できるように修正

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

Modified: branches/07x/078/org/w3c/dom/css.js
===================================================================
--- branches/07x/078/org/w3c/dom/css.js	2011-05-27 11:00:42 UTC (rev 2713)
+++ branches/07x/078/org/w3c/dom/css.js	2011-05-27 11:01:13 UTC (rev 2714)
@@ -281,64 +281,76 @@
     }
     cssText += ":";
     cssText += value;
-    if (tg) {  //見つかった場合
-      tg._priority = priority;
-      tg.cssText = cssText;
-      ti = tg;
-    } else {
-      if (this._isFillStroke[propertyName]) {
-        /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
-         *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
-         */
+    if (this._isFillStroke[propertyName]) {
+      /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
+       *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
+       */
+      if (tg) {  //見つかった場合
+        ti = tg;
+      } else {
         ti = new SVGPaint();
-        paintType = /*SVGPaint.SVG_PAINTTYPE_UNKNOWN*/ 0;
-        v1 = value.charAt(0);
-        if (this._isRS[v1] || ti._keywords[value]) {
-          paintType = /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1;
-          color = value;
-        } else if (value === "none") {
-          paintType = /*SVGPaint.SVG_PAINTTYPE_NONE*/ 101;
-        } else if (this._urlreg.test(value)) {                   //fill属性の値がurl(#id)ならば
-          paintType = /*SVGPaint.SVG_PAINTTYPE_URI*/ 107;
-          uri = RegExp.$1;
-        } else if (value === "currentColor") {
-          paintType = /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102;
-          color = this.getPropertyValue("color") || "rgb(0,0,0)";
-        }
-        ti.setPaint(paintType, uri, color, null);
-        paintType = v1 = uri = color = null;
-      } else if (this._isStop[propertyName]) {
+      }
+      paintType = /*SVGPaint.SVG_PAINTTYPE_UNKNOWN*/ 0;
+      v1 = value.charAt(0);
+      if (this._isRS[v1] || ti._keywords[value]) {
+        paintType = /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1;
+        color = value;
+      } else if (value === "none") {
+        paintType = /*SVGPaint.SVG_PAINTTYPE_NONE*/ 101;
+      } else if (this._urlreg.test(value)) {                   //fill属性の値がurl(#id)ならば
+        paintType = /*SVGPaint.SVG_PAINTTYPE_URI*/ 107;
+        uri = RegExp.$1;
+      } else if (value === "currentColor") {
+        paintType = /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102;
+        color = this.getPropertyValue("color") || "rgb(0,0,0)";
+      }
+      ti.setPaint(paintType, uri, color, null);
+      paintType = v1 = uri = color = null;
+    } else if (this._isStop[propertyName]) {
+      if (tg) {  //見つかった場合
+        ti = tg;
+      } else {
         ti = new SVGColor();
-        if (value === "currentColor") {
-          ti.colorType = /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3;
-          value = this.getPropertyValue("color") || "rgb(0,0,0)";
-        } else {
-          ti.colorType = /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1;
-        }
-        ti.setRGBColor(value);
-      } else if (this._isColor[propertyName]) {
+      }
+      if (value === "currentColor") {
+        ti.colorType = /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3;
+        value = this.getPropertyValue("color") || "rgb(0,0,0)";
+      } else {
+        ti.colorType = /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1;
+      }
+      ti.setRGBColor(value);
+    } else if (this._isColor[propertyName]) {
+      if (tg) {  //見つかった場合
+        ti = tg;
+      } else {
         ti = new CSSPrimitiveValue();
-        fill = this.getPropertyCSSValue("fill");
-        stroke = this.getPropertyCSSValue("stroke");
-        stop = this.getPropertyCSSValue("stop-color");
-        if (fill) {
-          if (fill.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
-            fill.setPaint(fill.paintType, null, value, null);
-          }
-        } else if (stroke) {
-          if (stroke.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
-            stroke.setPaint(fill.paintType, null, value, null);
-          }
-        } else if (stop) {
-          if (stop.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3) {
-            stop.setRGBColor(value);
-          }
+      }
+      fill = this.getPropertyCSSValue("fill");
+      stroke = this.getPropertyCSSValue("stroke");
+      stop = this.getPropertyCSSValue("stop-color");
+      if (fill) {
+        if (fill.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
+          fill.setPaint(fill.paintType, null, value, null);
         }
+      } else if (stroke) {
+        if (stroke.paintType === /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102) {
+          stroke.setPaint(fill.paintType, null, value, null);
+        }
+      } else if (stop) {
+        if (stop.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3) {
+          stop.setRGBColor(value);
+        }
+      }
+    } else {
+      if (tg) {  //見つかった場合
+        ti = tg;
       } else {
         ti = new CSSPrimitiveValue();
       }
-      ti._priority = priority;
-      ti.cssText = cssText;
+    }
+    ti._priority = priority;
+    ti.cssText = cssText;
+    if (!tg) {
       //_numプロパティはremovePropertyメソッドで利用する
       ti._num = this._list.length;
       this._list[ti._num] = ti;




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