svnno****@sourc*****
svnno****@sourc*****
2010年 2月 23日 (火) 22:40:49 JST
Revision: 1674 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1674 Author: dhrname Date: 2010-02-23 22:40:49 +0900 (Tue, 23 Feb 2010) Log Message: ----------- SVGElementの修正 Modified Paths: -------------- branches/ufltima/dom/svg.js Modified: branches/ufltima/dom/svg.js =================================================================== --- branches/ufltima/dom/svg.js 2010-02-23 13:36:14 UTC (rev 1673) +++ branches/ufltima/dom/svg.js 2010-02-23 13:40:49 UTC (rev 1674) @@ -139,17 +139,23 @@ *すべてのSVG関連要素の雛形となるオブジェクト */ function SVGElement() { - /*String*/ this.id = null; //id属性の値 - /*String*/ this.xmlbase = null; //xml:base属性の値 - /*SVGSVGElement*/ this.ownerSVGElement; //ルート要素であるsvg要素 - /*readonly SVGElement*/ this.viewportElement; //ビューポートを形成する要素(多くはsvg要素) - /*interface SVGStylable*/ - /*readonly SVGAnimatedString*/ this.className = new SVGAnimatedString(); //class属性の値 - /*readonly css::CSSStyleDeclaration*/ this.style = new CSSStyleDeclaration(); //スタイルシートの値 + /*String*/ this.id = null; //id属性の値 + /*String*/ this.xmlbase = null; //xml:base属性の値 + /*SVGSVGElement*/ this.ownerSVGElement; //ルート要素であるsvg要素 + /*readonly SVGElement*/ this.viewportElement; //ビューポートを形成する要素(多くはsvg要素) + SVGStylable.call(this, arguments); //ElementCSSInlineStyleのインタフェースを継承 /*interface SVGTransformable : SVGLocatable *TransformListはtransform属性を行列で表現したあとのリスト構造 */ /*readonly attribute SVGAnimatedTransformList*/ this.transform = new SVGAnimatedTransformList(); + this.addEventListener("DOMAttrModified", function(evt){ + var name = evt.attrName, tar = evt.target; + if (!!CSS2Properties[name] || name.indexOf("-") > -1) { + tar._attributeStyle.setProperty(name, evt.newValue, ""); + } else if (name === "transform") { + } else if (name.indexOf("on") === 0) { + } + }, false) return this; }; SVGElement.constructor = Element; @@ -526,12 +532,19 @@ function SVGStylable() { /*readonly attribute SVGAnimatedString*/ this.className = new SVGAnimatedString(); /*readonly attribute css::CSSStyleDeclaration*/ this.style = new CSSStyleDeclaration(); + this._runtimeStyle = new CSSStyleDeclaration(); //getOverrideStyleメソッドで利用する + this._attributeStyle = new CSSStyleDeclaration(); //プレゼンテーション属性の値を格納する }; /*getPresentationAttributeメソッド *プレゼンテーション属性の値をCSSValueとして得る。これはCSSのスタイルの設定値を定めるときや、内部の動的処理に役立つ */ /*css::CSSValue*/ SVGElement.prototype.getPresentationAttribute = function( /*DOMString*/ name ){ - var s = new CSSValue(), tgn = this.attributes.getNamedItemNS(null, name); + var s = this._attributeStyle.getPropertyCSSValue(name); + if (s) { + return s; + } else { + return null; + } }; /*SVGURIReferenceオブジェクトはURI参照を用いる要素に適用される @@ -1652,7 +1665,7 @@ }; /*void*/ SVGPaint.prototype.setPaint = function(/*unsigned short*/ paintType, /*DOMString*/ uri, /*DOMString*/ rgbColor, /*DOMString*/ iccColor ) { if ((paintType < 101 && uri) || (paintType > 102 && !uri)) { - throw new SVGException(SVG_INVALID_VALUE_ERR); + throw new SVGException(SVGException.SVG_INVALID_VALUE_ERR); } this.uri = uri; this.paintType = paintType;