svnno****@sourc*****
svnno****@sourc*****
2010年 7月 14日 (水) 22:55:46 JST
Revision: 1942
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1942
Author: dhrname
Date: 2010-07-14 22:55:45 +0900 (Wed, 14 Jul 2010)
Log Message:
-----------
setPropertyメソッドの修正
Modified Paths:
--------------
branches/06x/061/org/w3c/dom/css.js
Modified: branches/06x/061/org/w3c/dom/css.js
===================================================================
--- branches/06x/061/org/w3c/dom/css.js 2010-07-12 11:55:11 UTC (rev 1941)
+++ branches/06x/061/org/w3c/dom/css.js 2010-07-14 13:55:45 UTC (rev 1942)
@@ -213,35 +213,7 @@
}
for (var i=0,tli=this._list.length;i<tli;++i) {
var ti = this._list[i], tc = ti.cssText;
- if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
- if ((propertyName === "fill:") || (propertyName === "stroke:")) {
- /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
- *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
- */
- if (ti instanceof SVGPaint) {
- return ti;
- }
- ti = new SVGPaint();
- ti.cssText = tc;
- 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;
- } else {
- paintType = SVGPaint.SVG_PAINTTYPE_RGBCOLOR;
- color = tc.substring(tc.indexOf(":")+1, tc.length);
- }
- }
- ti.setPaint(paintType, uri, color, null);
- this._list[i] = ti;
- }
+ if (tc.indexOf(propertyName) > -1) { //プロパティ名に合致するCSSValueオブジェクトが見つかった場合
return ti;
}
}
@@ -285,7 +257,42 @@
tg._priority = priority;
tg.cssText = cssText;
} else {
- var ti = new CSSPrimitiveValue();
+ if ((propertyName === "fill") || (propertyName === "stroke")) {
+ /*fill、strokeプロパティは別途、SVGPaintで処理(JavaScriptでは、型キャストを使えないため)
+ *CSSPrimitiveValueオブジェクトとSVGPaintオブジェクトを最後に置き換える
+ */
+ var ti = new SVGPaint();
+ var paintType = SVGPaint.SVG_PAINTTYPE_UNKNOWN, uri = null, color = null;
+ if (value === "none") {
+ paintType = SVGPaint.SVG_PAINTTYPE_NONE;
+ } else if (value === "currentColor") {
+ paintType = SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR;
+ 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);
+ } else if (propertyName === "color") {
+ var fill = this.getPropertyCSSValue("fill"), stroke = this.getPropertyCSSValue("stroke");
+ if (fill) {
+ if (fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
+ fill.setPaint(fill.paintType, null, value, null);
+ }
+ } else if (stroke) {
+ if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
+ stroke.setPaint(fill.paintType, null, value, null);
+ }
+ }
+ } else {
+ var ti = new CSSPrimitiveValue();
+ }
ti._priority = priority;
ti.cssText = cssText;
//_numプロパティはremovePropertyメソッドで利用する
@@ -535,124 +542,26 @@
azimuth : "center",
// raises(dom::DOMException) on setting
//簡略プロパティに関しては、初期値を再考せよ
- background : "",
- // raises(dom::DOMException) on setting
- backgroundAttachment : "scroll",
- backgroundColor : "transparent",
- backgroundImage : "none",
- backgroundPosition : "0% 0%",
- backgroundRepeat : "repeat",
- border : "medium",
- borderColor : "black",
- borderCollapse : "collapse",
- borderSpacing : "0",
- borderTop : "",
- borderRight : "",
- borderBottom : "",
- borderLeft : "",
- borderStyle : "none",
- borderTopColor : "black",
- borderRightColor : "black",
- borderBottomColor : "black",
- borderLeftColor : "black",
- borderTopStyle : "none",
- borderRightStyle : "none",
- borderBottomStyle : "none",
- borderLeftStyle : "none",
- borderTopWidth : "medium",
- borderRightWidth : "medium",
- borderBottomWidth : "medium",
- borderLeftWidth : "medium",
- borderWidth : "medium",
- bottom : " auto",
- captionSide : "top",
- clear : "none",
clip : "auto",
color : "black",
- content : "",
- counterIncrement : "none",
- counterReset : "none",
- cssFloat : "none",
- cue : "",
- cueAfter : "none",
- cueBefore : "none",
cursor : "auto",
direction : "ltr",
display : "inline",
- elevation : "level",
- emptyCells : "show",
- cssFloat : "inline",
- height : "auto",
- left : "auot",
letterSpacing : "normal",
lineHeight : "normal",
- listStyle : "",
- listStyleImage : "none",
- listStylePosition : "outside",
- listStyleType : "disc",
- margin : "",
- marginTop : "0",
- marginRight : "0",
- marginBottom : "0",
- marginLeft : "0",
- markerOffset : "auto",
- marks : "none",
- maxHeight : "none",
- maxWidth : "none",
- minHeight : "0",
- minWidth : "0",
- orphans : "2",
- outline : "",
- outlineColor : "invert",
- outlineStyle : "none",
- outlineWidth : "medium",
overflow : "visible",
- padding : "",
- paddingTop : "0",
- paddingRight : "0",
- paddingBottom : "0",
- paddingLeft : "0",
- page : "auto",
- pageBreakAfter : "auto",
- pageBreakBefore : "auto",
- pageBreakInside : "auto",
- pause : "",
- pauseAfter : "",
- pauseBefore : "",
- pitch : "medium",
- pitchRange : "50",
- playDuring : "auto",
- position : "static",
- quotes : "",
- richness : "50",
- right : "auto",
- size : "auto",
- speak : "normal",
- speakHeader : "once",
- speakNumeral : "continuous",
- speakPunctuation : "none",
- speechRate : "medium",
- stress : "50",
- tableLayout : "auto",
textAlign : "left",
textDecoration : "none",
textIndent : "0",
textShadow : "none",
textTransform : "none",
- top : "auto",
unicodeBidi : "normal",
verticalAlign : "baseline",
- voiceFamily : "",
- volume : "medium",
whiteSpace : "normal",
- widows : "2",
- width : "auto",
wordSpacing : "normal",
zIndex : "auto",
// #
- clipPath : "none",
- clipRule : "nonzero",
mask : "none",
//# Filter Effects properties: