svnno****@sourc*****
svnno****@sourc*****
2009年 10月 3日 (土) 23:06:24 JST
Revision: 1309
http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1309
Author: dhrname
Date: 2009-10-03 23:06:24 +0900 (Sat, 03 Oct 2009)
Log Message:
-----------
1, SVGColorの実装
2, GetSVGDocumentオブジェクトの一部実装
Modified Paths:
--------------
branches/DOM/org/w3c/dom/svg.js
Modified: branches/DOM/org/w3c/dom/svg.js
===================================================================
--- branches/DOM/org/w3c/dom/svg.js 2009-10-03 10:41:54 UTC (rev 1308)
+++ branches/DOM/org/w3c/dom/svg.js 2009-10-03 14:06:24 UTC (rev 1309)
@@ -1261,7 +1261,7 @@
}
list = coma = mat = null;
}
- } catch(e) {stlog.add(e,816);}
+ } catch(e) {}
}
var n = this.transform.animVal.consolidate();
n = n ? n.matrix : this.ownerDocument.documentElement.createSVGMatrix();
@@ -1270,7 +1270,7 @@
return (this.transform._matrix);
};
/*SVGMatrix*/ SVGElement.prototype.getScreenCTM = function(){
- return (this.viewportElement.getCTM());
+ return (this.ownerDocument.documentElement.getCTM());
};
/*getTransformToElementメソッド
*これは、あるelementへの変換行列を計算して返す
@@ -1464,16 +1464,33 @@
/*void*/ SVGColor.prototype.setRGBColor = function(/*DOMString*/ rgbColor ){
this.colorType = SVGColor.SVG_COLORTYPE_RGBCOLOR;
- if (rgbColor.indexOf("%", 5) > 0) { // %を含むrgb形式の場合
- return rgbColor.replace(/[\d.]+%/g, function(s) {
+ this.cssText = rgbColor;
+ var tkr = this.keywords[rgbColor]
+ if (tkr !== void 0) {
+ rgbColor = tkr;
+ }
+ if (rgbColor.indexOf("%", 5) > 0) { // %を含むrgb形式の場合
+ rgbColor = rgbColor.replace(/[\d.]+%/g, function(s) {
return Math.round(2.55 * parseFloat(s));
});
+ } else if (rgbColor.indexOf("#") > 0) } //#を含む場合
+ rgbColor = rgbColor.replace(/[\dA-F][\dA-F]/g, function(s) {
+ return parseInt(s, 16);
+ });
}
- this.cssText = rgbColor;
+ var s = rgbColor.match(/\d+/g);
+ this.rgbColor.r = parseInt(s[0]);
+ this.rgbColor.g = parseInt(s[1]);
+ this.rgbColor.b = parseInt(s[2]);
}
// raises( SVGException );
/*void*/ SVGColor.prototype.setColor =function(/*unsigned short*/ colorType, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ){
-
+ if (colorType === 1) {
+ this.setRGBColor(rgbColor);
+ } else if (colorType === 3) {
+ this.colorType - SVGColor.SVG_COLORTYPE_CURRENTCOLOR;
+ this.setRGBColor(this.style.getProperty("color"));
+ }
}
// raises( SVGException );
//色キーワード
@@ -2124,7 +2141,12 @@
function GetSVGDocument() {
var obje = document.getElementsByTagName("object"); //HTML内のobject要素を探し出して、メソッドを結びつける
- /*SVGDocument getSVGDocument = function(){}
+ for (var i=0;i<obje.length;++i) {
+ /*SVGDocument*/ obje.getSVGDocument = (function(){
+ var s = DOMImplementation.createDocument("http://www.w3.org/svg/2000", "svg");
+ return s;
+ });
+ }
};
/*SVGStyleElement
*style要素をあらわすオブジェクト