svnno****@sourc*****
svnno****@sourc*****
2011年 4月 16日 (土) 23:24:56 JST
Revision: 2597
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2597
Author: dhrname
Date: 2011-04-16 23:24:56 +0900 (Sat, 16 Apr 2011)
Log Message:
-----------
1, setPropertyメソッドの軽量か
2, stop-colorプロパティにおいて、SVGColorの型キャストができるように、setPropertyメソッドを修正
Modified Paths:
--------------
branches/07x/075/org/w3c/dom/css.js
Modified: branches/07x/075/org/w3c/dom/css.js
===================================================================
--- branches/07x/075/org/w3c/dom/css.js 2011-04-16 13:58:12 UTC (rev 2596)
+++ branches/07x/075/org/w3c/dom/css.js 2011-04-16 14:24:56 UTC (rev 2597)
@@ -252,6 +252,20 @@
return "";
}
},
+ _isFillStroke : {
+ "fill" : 1,
+ "stroke" : 1
+ },
+ _isColor : {
+ "color" : 1
+ },
+ _isStop : {
+ "stop-color" : 1
+ },
+ _isRS : {
+ "r" : 1,
+ "#" : 1
+ },
/*setPropertyメソッド
*プロパティを宣言内で、明示的に設定。継承は無視する
*/
@@ -272,14 +286,14 @@
tg.cssText = cssText;
ti = tg;
} else {
- if ((propertyName === "fill") || (propertyName === "stroke")) {
+ if (this._isFillStroke[propertyName]) {
/*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
*CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
*/
ti = new SVGPaint();
paintType = /*SVGPaint.SVG_PAINTTYPE_UNKNOWN*/ 0;
v1 = value.charAt(0);
- if ((v1 === "#") || ti._keywords[value] || (v1 === "r")) {
+ if (this._isRS[v1] || ti._keywords[value]) {
paintType = /*SVGPaint.SVG_PAINTTYPE_RGBCOLOR*/ 1;
color = value;
} else if (value === "none") {
@@ -293,7 +307,11 @@
}
ti.setPaint(paintType, uri, color, null);
paintType = v1 = uri = color = null;
- } else if (propertyName === "color") {
+ } else if (this._isStop[propertyName]) {
+ ti = new SVGColor();
+ ti.colorType = /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1;
+ ti.setRGBColor(value);
+ } else if (this._isColor[propertyName]) {
ti = new CSSPrimitiveValue();
fill = this.getPropertyCSSValue("fill");
stroke = this.getPropertyCSSValue("stroke");