svnno****@sourc*****
svnno****@sourc*****
2011年 5月 3日 (火) 23:36:01 JST
Revision: 2642
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2642
Author: dhrname
Date: 2011-05-03 23:36:01 +0900 (Tue, 03 May 2011)
Log Message:
-----------
stop-colorに対して、currentColorの値をサポートした
Modified Paths:
--------------
branches/07x/076/org/w3c/dom/css.js
branches/07x/076/org/w3c/dom/svg.js
Modified: branches/07x/076/org/w3c/dom/css.js
===================================================================
--- branches/07x/076/org/w3c/dom/css.js 2011-05-03 13:37:04 UTC (rev 2641)
+++ branches/07x/076/org/w3c/dom/css.js 2011-05-03 14:36:01 UTC (rev 2642)
@@ -275,7 +275,7 @@
ti, paintType, v1,
uri = null,
color = null,
- fill, stroke;
+ fill, stroke, stop;
if (!!this[propertyName]) {
tg = this.getPropertyCSSValue(propertyName);
}
@@ -303,18 +303,24 @@
uri = RegExp.$1;
} else if (value === "currentColor") {
paintType = /*SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR*/ 102;
- color = this.getPropertyValue("color");
+ color = this.getPropertyValue("color") || "rgb(0,0,0)";
}
ti.setPaint(paintType, uri, color, null);
paintType = v1 = uri = color = null;
} else if (this._isStop[propertyName]) {
ti = new SVGColor();
- ti.colorType = /*SVGColor.SVG_COLORTYPE_RGBCOLOR*/ 1;
+ 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]) {
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);
@@ -323,6 +329,10 @@
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 {
ti = new CSSPrimitiveValue();
Modified: branches/07x/076/org/w3c/dom/svg.js
===================================================================
--- branches/07x/076/org/w3c/dom/svg.js 2011-05-03 13:37:04 UTC (rev 2641)
+++ branches/07x/076/org/w3c/dom/svg.js 2011-05-03 14:36:01 UTC (rev 2642)
@@ -4356,9 +4356,13 @@
for (var i = 0; i < length; ++i) {
stop = stops[i];
sstyle = stop.ownerDocument.defaultView.getComputedStyle(stop, "");
- ci = sstyle.getPropertyValue("stop-color");
- color[i] = SVGColor.prototype._keywords[ci] || ci;
- colors[i] = stop.offset.baseVal + " " + ci;
+ ci = sstyle.getPropertyCSSValue("stop-color");
+ if (ci && (ci.colorType === /*SVGColor.SVG_COLORTYPE_CURRENTCOLOR*/ 3)) {
+ /*再度、設定。css.jsのsetPropertyを参照*/
+ sstyle.setProperty("color", sstyle.getPropertyValue("color"));
+ }
+ color[i] = "rgb(" +ci.rgbColor.red.cssText+ "," +ci.rgbColor.green.cssText+ "," +ci.rgbColor.blue.cssText+ ")";
+ colors[i] = stop.offset.baseVal + " " + color[i];
opacity[i] = (sstyle.getPropertyValue("stop-opacity") || 1) * t.getPropertyValue("fill-opacity") * t.getPropertyValue("opacity");
}
ele["method"] = "none";