svnno****@sourc*****
svnno****@sourc*****
2010年 3月 25日 (木) 23:23:25 JST
Revision: 1754 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1754 Author: dhrname Date: 2010-03-25 23:23:25 +0900 (Thu, 25 Mar 2010) Log Message: ----------- Modified Paths: -------------- branches/ufltima/dom/css.js Modified: branches/ufltima/dom/css.js =================================================================== --- branches/ufltima/dom/css.js 2010-03-25 14:22:38 UTC (rev 1753) +++ branches/ufltima/dom/css.js 2010-03-25 14:23:25 UTC (rev 1754) @@ -215,14 +215,14 @@ if (propertyName === "fill:" || propertyName === "stroke:") { //fill、strokeプロパティは別途、SVGPaintで処理 ti = new SVGPaint(); ti.cssText = tc; - var _urlreg = /url\(#([^)]+)/; - var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null; + 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; @@ -310,9 +310,9 @@ this.cssValueType = CSSValue.CSS_PRIMITIVE_VALUE; this.primitiveType = CSSPrimitiveValue.CSS_UNKNOWN; this._value = 1; - this._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) return this; }; + CSSPrimitiveValue.CSS_UNKNOWN = 0; CSSPrimitiveValue.CSS_NUMBER = 1; CSSPrimitiveValue.CSS_PERCENTAGE = 2; @@ -341,6 +341,7 @@ CSSPrimitiveValue.CSS_RGBCOLOR = 25; CSSPrimitiveValue.prototype = new CSSValue(); CSSPrimitiveValue.constructor = CSSValue; +CSSPrimitiveValue.prototype._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15, 1, 180 / Math.PI, 90/100, 1, 1000, 1, 1000, 1]; //CSS_PX単位への変換値(なお、CSS_SはCSS_MSに、CSS_RADとCSS_GRADはCSS_DEGに、CSS_KHZはCSS_HZに統一) /*void*/ CSSPrimitiveValue.prototype.setFloatValue = function(/*short*/ unitType, /*float*/ floatValue) { if (CSSPrimitiveValue.CSS_UNKNOWN >= unitType && unitType >= CSSPrimitiveValue.CSS_STRING) { //浮動小数点数単位型をサポートしないCSS単位である場合 @@ -396,9 +397,9 @@ rgbColor = rgbColor.replace(/[\d.]+%/g, function(t) { return Math.round((2.55 * parseFloat(t))); }); - } else if (rgbColor.indexOf("#") > 0) { //#を含む場合 - rgbColor = rgbColor.replace(/[\dA-F][\dA-F]/g, function(t) { - return parseInt(t, 16); + } else if (rgbColor.indexOf("#") > -1) { //#を含む場合 + rgbColor = rgbColor.replace(/[\da-f][\da-f]/gi, function(s) { + return parseInt(s, 16); }); } var n = rgbColor.match(/\d+/g);