svnno****@sourc*****
svnno****@sourc*****
2011年 3月 28日 (月) 22:28:29 JST
Revision: 2519
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2519
Author: dhrname
Date: 2011-03-28 22:28:29 +0900 (Mon, 28 Mar 2011)
Log Message:
-----------
setPropertyメソッドを整理して、軽量化した
Modified Paths:
--------------
branches/07x/074/org/w3c/dom/css.js
Modified: branches/07x/074/org/w3c/dom/css.js
===================================================================
--- branches/07x/074/org/w3c/dom/css.js 2011-03-28 13:00:23 UTC (rev 2518)
+++ branches/07x/074/org/w3c/dom/css.js 2011-03-28 13:28:29 UTC (rev 2519)
@@ -192,6 +192,7 @@
cssText : "",
/*long*/ length : 0,
/*CSSRule*/ parentRule : null,
+ _urlreg : /url\(#([^)]+)/,
/*getPropertyValueメソッド
*CSSの値を返す。この値は継承ではなくて、明示的に表記されているもの
*/
@@ -257,7 +258,7 @@
/*void*/ setProperty : function( /*string*/ propertyName, /*string*/ value, /*string*/ priority) {
var cssText = "",
tg = null,
- ti, paintType,
+ ti, paintType, v1,
uri = null,
color = null,
fill, stroke;
@@ -278,23 +279,21 @@
*/
ti = new SVGPaint();
paintType = /*SVGPaint.SVG_PAINTTYPE_UNKNOWN*/ 0;
- if (value === "none") {
- paintType = SVGPaint.SVG_PAINTTYPE_NONE;
+ v1 = value.charAt(0);
+ if ((v1 === "#") || ti._keywords[value] || (v1 === "r")) {
+ 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;
+ paintType = /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102;
color = this.getPropertyValue("color");
- } else {
- var _urlreg = /url\(#([^)]+)/;
- if (_urlreg.test(value)) { //fill属性の値がurl(#id)ならば
- paintType = SVGPaint.SVG_PAINTTYPE_URI;
- uri = RegExp.$1;
- } else {
- paintType = SVGPaint.SVG_PAINTTYPE_RGBCOLOR;
- color = value;
- }
}
ti.setPaint(paintType, uri, color, null);
- paintType = uri = color = null;
+ paintType = v1 = uri = color = null;
} else if (propertyName === "color") {
ti = new CSSPrimitiveValue();
fill = this.getPropertyCSSValue("fill");